PR #22859 opened by george.zaguri URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/22859 Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/22859.patch
Apple M4: put_chroma_hv_10_2x2_c: 9.1 ( 1.00x) put_chroma_hv_10_4x4_c: 20.1 ( 1.00x) put_chroma_hv_10_8x8_c: 35.6 ( 1.00x) put_chroma_hv_10_8x8_neon: 15.4 ( 2.31x) put_chroma_hv_10_16x16_c: 113.7 ( 1.00x) put_chroma_hv_10_16x16_neon: 57.0 ( 1.99x) put_chroma_hv_10_32x32_c: 406.9 ( 1.00x) put_chroma_hv_10_32x32_neon: 225.7 ( 1.80x) put_chroma_hv_10_64x64_c: 1498.8 ( 1.00x) put_chroma_hv_10_64x64_neon: 876.2 ( 1.71x) put_chroma_hv_10_128x128_c: 5757.0 ( 1.00x) put_chroma_hv_10_128x128_neon: 3446.6 ( 1.67x) put_chroma_hv_12_2x2_c: 9.9 ( 1.00x) put_chroma_hv_12_4x4_c: 19.2 ( 1.00x) put_chroma_hv_12_8x8_c: 36.1 ( 1.00x) put_chroma_hv_12_8x8_neon: 17.9 ( 2.02x) put_chroma_hv_12_16x16_c: 112.2 ( 1.00x) put_chroma_hv_12_16x16_neon: 55.6 ( 2.02x) put_chroma_hv_12_32x32_c: 416.6 ( 1.00x) put_chroma_hv_12_32x32_neon: 224.3 ( 1.86x) put_chroma_hv_12_64x64_c: 1464.8 ( 1.00x) put_chroma_hv_12_64x64_neon: 860.1 ( 1.70x) put_chroma_hv_12_128x128_c: 5776.8 ( 1.00x) put_chroma_hv_12_128x128_neon: 3445.2 ( 1.68x) RPi5: put_chroma_hv_10_2x2_c: 118.5 ( 1.00x) put_chroma_hv_10_4x4_c: 190.6 ( 1.00x) put_chroma_hv_10_8x8_c: 303.1 ( 1.00x) put_chroma_hv_10_8x8_neon: 172.6 ( 1.76x) put_chroma_hv_10_16x16_c: 1036.1 ( 1.00x) put_chroma_hv_10_16x16_neon: 626.7 ( 1.65x) put_chroma_hv_10_32x32_c: 3624.4 ( 1.00x) put_chroma_hv_10_32x32_neon: 2386.9 ( 1.52x) put_chroma_hv_10_64x64_c: 13612.1 ( 1.00x) put_chroma_hv_10_64x64_neon: 9314.8 ( 1.46x) put_chroma_hv_10_128x128_c: 52975.4 ( 1.00x) put_chroma_hv_10_128x128_neon: 37083.5 ( 1.43x) put_chroma_hv_12_2x2_c: 118.6 ( 1.00x) put_chroma_hv_12_4x4_c: 188.1 ( 1.00x) put_chroma_hv_12_8x8_c: 303.4 ( 1.00x) put_chroma_hv_12_8x8_neon: 176.7 ( 1.72x) put_chroma_hv_12_16x16_c: 1037.9 ( 1.00x) put_chroma_hv_12_16x16_neon: 626.5 ( 1.66x) put_chroma_hv_12_32x32_c: 3629.0 ( 1.00x) put_chroma_hv_12_32x32_neon: 2386.6 ( 1.52x) put_chroma_hv_12_64x64_c: 13649.0 ( 1.00x) put_chroma_hv_12_64x64_neon: 9313.6 ( 1.47x) put_chroma_hv_12_128x128_c: 52978.0 ( 1.00x) put_chroma_hv_12_128x128_neon: 37101.2 ( 1.43x) >From 8061d227a8eff645223a03a368b43b35d13a419a Mon Sep 17 00:00:00 2001 From: Georgii Zagoruiko <[email protected]> Date: Sun, 19 Apr 2026 14:44:12 +0000 Subject: [PATCH] aarch64/vvc: Optimisations of put_chroma_hv() functions for 10/12-bit Apple M4: put_chroma_hv_10_2x2_c: 9.1 ( 1.00x) put_chroma_hv_10_4x4_c: 20.1 ( 1.00x) put_chroma_hv_10_8x8_c: 35.6 ( 1.00x) put_chroma_hv_10_8x8_neon: 15.4 ( 2.31x) put_chroma_hv_10_16x16_c: 113.7 ( 1.00x) put_chroma_hv_10_16x16_neon: 57.0 ( 1.99x) put_chroma_hv_10_32x32_c: 406.9 ( 1.00x) put_chroma_hv_10_32x32_neon: 225.7 ( 1.80x) put_chroma_hv_10_64x64_c: 1498.8 ( 1.00x) put_chroma_hv_10_64x64_neon: 876.2 ( 1.71x) put_chroma_hv_10_128x128_c: 5757.0 ( 1.00x) put_chroma_hv_10_128x128_neon: 3446.6 ( 1.67x) put_chroma_hv_12_2x2_c: 9.9 ( 1.00x) put_chroma_hv_12_4x4_c: 19.2 ( 1.00x) put_chroma_hv_12_8x8_c: 36.1 ( 1.00x) put_chroma_hv_12_8x8_neon: 17.9 ( 2.02x) put_chroma_hv_12_16x16_c: 112.2 ( 1.00x) put_chroma_hv_12_16x16_neon: 55.6 ( 2.02x) put_chroma_hv_12_32x32_c: 416.6 ( 1.00x) put_chroma_hv_12_32x32_neon: 224.3 ( 1.86x) put_chroma_hv_12_64x64_c: 1464.8 ( 1.00x) put_chroma_hv_12_64x64_neon: 860.1 ( 1.70x) put_chroma_hv_12_128x128_c: 5776.8 ( 1.00x) put_chroma_hv_12_128x128_neon: 3445.2 ( 1.68x) RPi5: put_chroma_hv_10_2x2_c: 118.5 ( 1.00x) put_chroma_hv_10_4x4_c: 190.6 ( 1.00x) put_chroma_hv_10_8x8_c: 303.1 ( 1.00x) put_chroma_hv_10_8x8_neon: 172.6 ( 1.76x) put_chroma_hv_10_16x16_c: 1036.1 ( 1.00x) put_chroma_hv_10_16x16_neon: 626.7 ( 1.65x) put_chroma_hv_10_32x32_c: 3624.4 ( 1.00x) put_chroma_hv_10_32x32_neon: 2386.9 ( 1.52x) put_chroma_hv_10_64x64_c: 13612.1 ( 1.00x) put_chroma_hv_10_64x64_neon: 9314.8 ( 1.46x) put_chroma_hv_10_128x128_c: 52975.4 ( 1.00x) put_chroma_hv_10_128x128_neon: 37083.5 ( 1.43x) put_chroma_hv_12_2x2_c: 118.6 ( 1.00x) put_chroma_hv_12_4x4_c: 188.1 ( 1.00x) put_chroma_hv_12_8x8_c: 303.4 ( 1.00x) put_chroma_hv_12_8x8_neon: 176.7 ( 1.72x) put_chroma_hv_12_16x16_c: 1037.9 ( 1.00x) put_chroma_hv_12_16x16_neon: 626.5 ( 1.66x) put_chroma_hv_12_32x32_c: 3629.0 ( 1.00x) put_chroma_hv_12_32x32_neon: 2386.6 ( 1.52x) put_chroma_hv_12_64x64_c: 13649.0 ( 1.00x) put_chroma_hv_12_64x64_neon: 9313.6 ( 1.47x) put_chroma_hv_12_128x128_c: 52978.0 ( 1.00x) put_chroma_hv_12_128x128_neon: 37101.2 ( 1.43x) --- libavcodec/aarch64/vvc/dsp_init.c | 25 ++++ libavcodec/aarch64/vvc/inter.S | 196 ++++++++++++++++++++++++++++++ 2 files changed, 221 insertions(+) diff --git a/libavcodec/aarch64/vvc/dsp_init.c b/libavcodec/aarch64/vvc/dsp_init.c index e5ed0ea244..53bf9f9edd 100644 --- a/libavcodec/aarch64/vvc/dsp_init.c +++ b/libavcodec/aarch64/vvc/dsp_init.c @@ -103,6 +103,19 @@ void ff_vvc_put_luma_hv16_12_neon(int16_t *dst, const uint8_t *_src, const ptrdi void ff_vvc_put_luma_hv_x16_12_neon(int16_t *dst, const uint8_t *_src, const ptrdiff_t _src_stride, const int height, const int8_t *hf, const int8_t *vf, const int width); +void ff_vvc_put_chroma_hv8_10_neon(int16_t *dst, const uint8_t *_src, const ptrdiff_t _src_stride, + const int height, const int8_t *hf, const int8_t *vf, const int width); +void ff_vvc_put_chroma_hv16_10_neon(int16_t *dst, const uint8_t *_src, const ptrdiff_t _src_stride, + const int height, const int8_t *hf, const int8_t *vf, const int width); +void ff_vvc_put_chroma_hv_x16_10_neon(int16_t *dst, const uint8_t *_src, const ptrdiff_t _src_stride, + const int height, const int8_t *hf, const int8_t *vf, const int width); +void ff_vvc_put_chroma_hv8_12_neon(int16_t *dst, const uint8_t *_src, const ptrdiff_t _src_stride, + const int height, const int8_t *hf, const int8_t *vf, const int width); +void ff_vvc_put_chroma_hv16_12_neon(int16_t *dst, const uint8_t *_src, const ptrdiff_t _src_stride, + const int height, const int8_t *hf, const int8_t *vf, const int width); +void ff_vvc_put_chroma_hv_x16_12_neon(int16_t *dst, const uint8_t *_src, const ptrdiff_t _src_stride, + const int height, const int8_t *hf, const int8_t *vf, const int width); + void ff_alf_classify_sum_neon(int *sum0, int *sum1, int16_t *grad, uint32_t gshift, uint32_t steps); #define BIT_DEPTH 8 @@ -353,6 +366,12 @@ void ff_vvc_dsp_init_aarch64(VVCDSPContext *const c, const int bd) c->inter.put[0][5][1][1] = c->inter.put[0][6][1][1] = ff_vvc_put_luma_hv_x16_10_neon; + c->inter.put[1][2][1][1] = ff_vvc_put_chroma_hv8_10_neon; + c->inter.put[1][3][1][1] = ff_vvc_put_chroma_hv16_10_neon; + c->inter.put[1][4][1][1] = + c->inter.put[1][5][1][1] = + c->inter.put[1][6][1][1] = ff_vvc_put_chroma_hv_x16_10_neon; + c->alf.filter[LUMA] = alf_filter_luma_10_neon; c->alf.filter[CHROMA] = alf_filter_chroma_10_neon; c->alf.classify = alf_classify_10_neon; @@ -399,6 +418,12 @@ void ff_vvc_dsp_init_aarch64(VVCDSPContext *const c, const int bd) c->inter.put[1][5][1][0] = c->inter.put[1][6][1][0] = ff_vvc_put_chroma_v_x16_12_neon; + c->inter.put[1][2][1][1] = ff_vvc_put_chroma_hv8_12_neon; + c->inter.put[1][3][1][1] = ff_vvc_put_chroma_hv16_12_neon; + c->inter.put[1][4][1][1] = + c->inter.put[1][5][1][1] = + c->inter.put[1][6][1][1] = ff_vvc_put_chroma_hv_x16_12_neon; + c->alf.filter[LUMA] = alf_filter_luma_12_neon; c->alf.filter[CHROMA] = alf_filter_chroma_12_neon; c->alf.classify = alf_classify_12_neon; diff --git a/libavcodec/aarch64/vvc/inter.S b/libavcodec/aarch64/vvc/inter.S index 73fef909dc..dad2e9916f 100644 --- a/libavcodec/aarch64/vvc/inter.S +++ b/libavcodec/aarch64/vvc/inter.S @@ -2931,3 +2931,199 @@ endfunc function ff_vvc_put_luma_hv_x16_12_neon, export=1 put_luma_hv_x16_xx_neon 4 endfunc + +.macro put_chroma_hv_x8_horizontal_filter shift, dst, src0, src1 + ext v2.16b, \src0\().16b, \src1\().16b, #2 + ext v3.16b, \src0\().16b, \src1\().16b, #4 + ext v4.16b, \src0\().16b, \src1\().16b, #6 + smull v6.4s, \src0\().4h, v0.h[0] + smull2 v7.4s, \src0\().8h, v0.h[0] + smlal v6.4s, v2.4h, v0.h[1] + smlal2 v7.4s, v2.8h, v0.h[1] + smlal v6.4s, v3.4h, v0.h[2] + smlal2 v7.4s, v3.8h, v0.h[2] + smlal v6.4s, v4.4h, v0.h[3] + smlal2 v7.4s, v4.8h, v0.h[3] + sqshrn \dst\().4h, v6.4s, #(\shift) + sqshrn2 \dst\().8h, v7.4s, #(\shift) +.endm + +.macro put_chroma_hv_x8_vertical_filter dst0, dst1, src0, src1, src2, src3 + smull \dst0\().4s, \src0\().4h, v1.h[0] + smull2 \dst1\().4s, \src0\().8h, v1.h[0] + smlal \dst0\().4s, \src1\().4h, v1.h[1] + smlal2 \dst1\().4s, \src1\().8h, v1.h[1] + smlal \dst0\().4s, \src2\().4h, v1.h[2] + smlal2 \dst1\().4s, \src2\().8h, v1.h[2] + smlal \dst0\().4s, \src3\().4h, v1.h[3] + smlal2 \dst1\().4s, \src3\().8h, v1.h[3] + sqshrn \dst0\().4h, \dst0\().4s, #6 + sqshrn \dst1\().4h, \dst1\().4s, #6 +.endm + +.macro put_chroma_hv8_xx_neon shift + // dst .req x0 + // _src .req x1 + // _src_stride .req x2 + // height .req x3 + // hf .req x4 + // vf .req x5 + // width .req x6 + mov x9, #(VVC_MAX_PB_SIZE * 2) + sub x1, x1, #2 + ldr s0, [x4] + ldr s1, [x5] + sxtl v0.8h, v0.8b + sub x1, x1, x2 + sxtl v1.8h, v1.8b + ld1 {v16.8h, v17.8h}, [x1], x2 + ld1 {v18.8h, v19.8h}, [x1], x2 + ld1 {v20.8h, v21.8h}, [x1], x2 + put_chroma_hv_x8_horizontal_filter \shift, v16, v16, v17 + put_chroma_hv_x8_horizontal_filter \shift, v18, v18, v19 + put_chroma_hv_x8_horizontal_filter \shift, v20, v20, v21 +1: + ld1 {v22.8h, v23.8h}, [x1], x2 + put_chroma_hv_x8_horizontal_filter \shift, v22, v22, v23 + put_chroma_hv_x8_vertical_filter v2, v3, v16, v18, v20, v22 + ld1 {v24.8h, v25.8h}, [x1], x2 + st1 {v2.4h-v3.4h}, [x0], x9 + put_chroma_hv_x8_horizontal_filter \shift, v24, v24, v25 + put_chroma_hv_x8_vertical_filter v2, v3, v18, v20, v22, v24 + st1 {v2.4h-v3.4h}, [x0], x9 + + mov v16.16b, v20.16b + mov v18.16b, v22.16b + subs w3, w3, #2 + mov v20.16b, v24.16b + b.gt 1b + ret +.endm + +function ff_vvc_put_chroma_hv8_10_neon, export=1 + put_chroma_hv8_xx_neon 2 +endfunc + +function ff_vvc_put_chroma_hv8_12_neon, export=1 + put_chroma_hv8_xx_neon 4 +endfunc + +.macro put_chroma_hv16_xx_neon shift + // dst .req x0 + // _src .req x1 + // _src_stride .req x2 + // height .req x3 + // hf .req x4 + // vf .req x5 + // width .req x6 + mov x9, #(VVC_MAX_PB_SIZE * 2) + sub x1, x1, #2 + ldr s0, [x4] + ldr s1, [x5] + sxtl v0.8h, v0.8b + sub x1, x1, x2 + sxtl v1.8h, v1.8b + ld1 {v16.8h-v18.8h}, [x1], x2 + ld1 {v19.8h-v21.8h}, [x1], x2 + ld1 {v22.8h-v24.8h}, [x1], x2 + put_chroma_hv_x8_horizontal_filter \shift, v16, v16, v17 + put_chroma_hv_x8_horizontal_filter \shift, v17, v17, v18 + put_chroma_hv_x8_horizontal_filter \shift, v19, v19, v20 + put_chroma_hv_x8_horizontal_filter \shift, v20, v20, v21 + put_chroma_hv_x8_horizontal_filter \shift, v22, v22, v23 + put_chroma_hv_x8_horizontal_filter \shift, v23, v23, v24 +1: + ld1 {v25.8h-v27.8h}, [x1], x2 + put_chroma_hv_x8_horizontal_filter \shift, v25, v25, v26 + put_chroma_hv_x8_horizontal_filter \shift, v26, v26, v27 + put_chroma_hv_x8_vertical_filter v2, v3, v16, v19, v22, v25 + put_chroma_hv_x8_vertical_filter v4, v5, v17, v20, v23, v26 + ld1 {v28.8h-v30.8h}, [x1], x2 + st1 {v2.4h-v5.4h}, [x0], x9 + put_chroma_hv_x8_horizontal_filter \shift, v28, v28, v29 + put_chroma_hv_x8_horizontal_filter \shift, v29, v29, v30 + put_chroma_hv_x8_vertical_filter v2, v3, v19, v22, v25, v28 + put_chroma_hv_x8_vertical_filter v4, v5, v20, v23, v26, v29 + st1 {v2.4h-v5.4h}, [x0], x9 + mov v16.16b, v22.16b + mov v17.16b, v23.16b + mov v19.16b, v25.16b + mov v20.16b, v26.16b + subs w3, w3, #2 + mov v22.16b, v28.16b + mov v23.16b, v29.16b + b.gt 1b + ret +.endm + +function ff_vvc_put_chroma_hv16_10_neon, export=1 + put_chroma_hv16_xx_neon 2 +endfunc + +function ff_vvc_put_chroma_hv16_12_neon, export=1 + put_chroma_hv16_xx_neon 4 +endfunc + +.macro put_chroma_hv_x16_xx_neon shift + // dst .req x0 + // _src .req x1 + // _src_stride .req x2 + // height .req x3 + // hf .req x4 + // vf .req x5 + // width .req x6 + mov x9, #(VVC_MAX_PB_SIZE * 2) + sub x1, x1, #2 + ldr s0, [x4] + ldr s1, [x5] + sxtl v0.8h, v0.8b + sub x1, x1, x2 + sxtl v1.8h, v1.8b +1: + mov w13, w3 + mov x11, x1 + mov x10, x0 + ld1 {v16.8h-v18.8h}, [x11], x2 + ld1 {v19.8h-v21.8h}, [x11], x2 + ld1 {v22.8h-v24.8h}, [x11], x2 + put_chroma_hv_x8_horizontal_filter \shift, v16, v16, v17 + put_chroma_hv_x8_horizontal_filter \shift, v17, v17, v18 + put_chroma_hv_x8_horizontal_filter \shift, v19, v19, v20 + put_chroma_hv_x8_horizontal_filter \shift, v20, v20, v21 + put_chroma_hv_x8_horizontal_filter \shift, v22, v22, v23 + put_chroma_hv_x8_horizontal_filter \shift, v23, v23, v24 +2: + ld1 {v25.8h-v27.8h}, [x11], x2 + put_chroma_hv_x8_horizontal_filter \shift, v25, v25, v26 + put_chroma_hv_x8_horizontal_filter \shift, v26, v26, v27 + put_chroma_hv_x8_vertical_filter v2, v3, v16, v19, v22, v25 + put_chroma_hv_x8_vertical_filter v4, v5, v17, v20, v23, v26 + ld1 {v28.8h-v30.8h}, [x11], x2 + st1 {v2.4h-v5.4h}, [x10], x9 + put_chroma_hv_x8_horizontal_filter \shift, v28, v28, v29 + put_chroma_hv_x8_horizontal_filter \shift, v29, v29, v30 + put_chroma_hv_x8_vertical_filter v2, v3, v19, v22, v25, v28 + put_chroma_hv_x8_vertical_filter v4, v5, v20, v23, v26, v29 + st1 {v2.4h-v5.4h}, [x10], x9 + mov v16.16b, v22.16b + mov v17.16b, v23.16b + mov v19.16b, v25.16b + mov v20.16b, v26.16b + subs w13, w13, #2 + mov v22.16b, v28.16b + mov v23.16b, v29.16b + b.gt 2b + subs w6, w6, #16 + add x0, x0, #32 + add x1, x1, #32 + b.gt 1b + ret +.endm + +function ff_vvc_put_chroma_hv_x16_10_neon, export=1 + put_chroma_hv_x16_xx_neon 2 +endfunc + +function ff_vvc_put_chroma_hv_x16_12_neon, export=1 + put_chroma_hv_x16_xx_neon 4 +endfunc \ No newline at end of file -- 2.52.0 _______________________________________________ ffmpeg-devel mailing list -- [email protected] To unsubscribe send an email to [email protected]
