From bf41a4b3bda1cbc4c331a40dd4d42b8728ec039a Mon Sep 17 00:00:00 2001 From: Logan Lyu Date: Thu, 26 Oct 2023 09:11:09 +0800 Subject: [PATCH 1/5] lavc/aarch64: new optimization for 8-bit hevc_epel_pixels and and hevc_qpel_pixels checkasm bench: put_hevc_pel_pixels4_8_c: 33.7 put_hevc_pel_pixels4_8_neon: 20.2 put_hevc_pel_pixels6_8_c: 61.4 put_hevc_pel_pixels6_8_neon: 25.4 put_hevc_pel_pixels8_8_c: 121.4 put_hevc_pel_pixels8_8_neon: 16.9 put_hevc_pel_pixels12_8_c: 199.9 put_hevc_pel_pixels12_8_neon: 40.2 put_hevc_pel_pixels16_8_c: 355.9 put_hevc_pel_pixels16_8_neon: 43.4 put_hevc_pel_pixels24_8_c: 774.7 put_hevc_pel_pixels24_8_neon: 78.9 put_hevc_pel_pixels32_8_c: 1345.2 put_hevc_pel_pixels32_8_neon: 152.2 put_hevc_pel_pixels48_8_c: 2963.7 put_hevc_pel_pixels48_8_neon: 309.4 put_hevc_pel_pixels64_8_c: 5236.2 put_hevc_pel_pixels64_8_neon: 514.2 Co-Authored-By: J. Dekker --- libavcodec/aarch64/hevcdsp_epel_neon.S | 112 ++++++++++++++++++++++ libavcodec/aarch64/hevcdsp_init_aarch64.c | 6 ++ 2 files changed, 118 insertions(+) diff --git a/libavcodec/aarch64/hevcdsp_epel_neon.S b/libavcodec/aarch64/hevcdsp_epel_neon.S index e398e6ac9d..0705213eed 100644 --- a/libavcodec/aarch64/hevcdsp_epel_neon.S +++ b/libavcodec/aarch64/hevcdsp_epel_neon.S @@ -131,6 +131,118 @@ endconst b.ne 1b .endm +function ff_hevc_put_hevc_pel_pixels4_8_neon, export=1 + mov x7, #(MAX_PB_SIZE * 2) +1: ld1 {v0.s}[0], [x1], x2 + ushll v4.8h, v0.8b, #6 + subs w3, w3, #1 + st1 {v4.d}[0], [x0], x7 + b.ne 1b + ret +endfunc + +function ff_hevc_put_hevc_pel_pixels6_8_neon, export=1 + mov x7, #(MAX_PB_SIZE * 2 - 8) +1: ld1 {v0.8b}, [x1], x2 + ushll v4.8h, v0.8b, #6 + st1 {v4.d}[0], [x0], #8 + subs w3, w3, #1 + st1 {v4.s}[2], [x0], x7 + b.ne 1b + ret +endfunc + +function ff_hevc_put_hevc_pel_pixels8_8_neon, export=1 + mov x7, #(MAX_PB_SIZE * 2) +1: ld1 {v0.8b}, [x1], x2 + ushll v4.8h, v0.8b, #6 + subs w3, w3, #1 + st1 {v4.8h}, [x0], x7 + b.ne 1b + ret +endfunc + +function ff_hevc_put_hevc_pel_pixels12_8_neon, export=1 + mov x7, #(MAX_PB_SIZE * 2 - 16) +1: ld1 {v0.8b, v1.8b}, [x1], x2 + ushll v4.8h, v0.8b, #6 + st1 {v4.8h}, [x0], #16 + ushll v5.8h, v1.8b, #6 + subs w3, w3, #1 + st1 {v5.d}[0], [x0], x7 + b.ne 1b + ret +endfunc + +function ff_hevc_put_hevc_pel_pixels16_8_neon, export=1 + mov x7, #(MAX_PB_SIZE * 2) +1: ld1 {v0.8b, v1.8b}, [x1], x2 + ushll v4.8h, v0.8b, #6 + ushll v5.8h, v1.8b, #6 + subs w3, w3, #1 + st1 {v4.8h, v5.8h}, [x0], x7 + b.ne 1b + ret +endfunc + +function ff_hevc_put_hevc_pel_pixels24_8_neon, export=1 + mov x7, #(MAX_PB_SIZE * 2) +1: ld1 {v0.8b-v2.8b}, [x1], x2 + ushll v4.8h, v0.8b, #6 + ushll v5.8h, v1.8b, #6 + ushll v6.8h, v2.8b, #6 + subs w3, w3, #1 + st1 {v4.8h-v6.8h}, [x0], x7 + b.ne 1b + ret +endfunc + +function ff_hevc_put_hevc_pel_pixels32_8_neon, export=1 + mov x7, #(MAX_PB_SIZE * 2) +1: ld1 {v0.8b-v3.8b}, [x1], x2 + ushll v4.8h, v0.8b, #6 + ushll v5.8h, v1.8b, #6 + ushll v6.8h, v2.8b, #6 + ushll v7.8h, v3.8b, #6 + subs w3, w3, #1 + st1 {v4.8h-v7.8h}, [x0], x7 + b.ne 1b + ret +endfunc + +function ff_hevc_put_hevc_pel_pixels48_8_neon, export=1 + mov x7, #(MAX_PB_SIZE) +1: ld1 {v0.16b-v2.16b}, [x1], x2 + ushll v4.8h, v0.8b, #6 + ushll2 v5.8h, v0.16b, #6 + ushll v6.8h, v1.8b, #6 + ushll2 v7.8h, v1.16b, #6 + st1 {v4.8h-v7.8h}, [x0], #64 + ushll v16.8h, v2.8b, #6 + ushll2 v17.8h, v2.16b, #6 + subs w3, w3, #1 + st1 {v16.8h-v17.8h}, [x0], x7 + b.ne 1b + ret +endfunc + +function ff_hevc_put_hevc_pel_pixels64_8_neon, export=1 +1: ld1 {v0.16b-v3.16b}, [x1], x2 + ushll v4.8h, v0.8b, #6 + ushll2 v5.8h, v0.16b, #6 + ushll v6.8h, v1.8b, #6 + ushll2 v7.8h, v1.16b, #6 + st1 {v4.8h-v7.8h}, [x0], #(MAX_PB_SIZE) + ushll v16.8h, v2.8b, #6 + ushll2 v17.8h, v2.16b, #6 + ushll v18.8h, v3.8b, #6 + ushll2 v19.8h, v3.16b, #6 + subs w3, w3, #1 + st1 {v16.8h-v19.8h}, [x0], #(MAX_PB_SIZE) + b.ne 1b + ret +endfunc + function ff_hevc_put_hevc_epel_uni_v4_8_neon, export=1 load_epel_filterb x6, x5 sub x2, x2, x3 diff --git a/libavcodec/aarch64/hevcdsp_init_aarch64.c b/libavcodec/aarch64/hevcdsp_init_aarch64.c index d5b973d2e0..c203d65d34 100644 --- a/libavcodec/aarch64/hevcdsp_init_aarch64.c +++ b/libavcodec/aarch64/hevcdsp_init_aarch64.c @@ -152,6 +152,10 @@ void ff_hevc_put_hevc_qpel_bi_h16_8_neon(uint8_t *_dst, ptrdiff_t _dststride, co void ff_hevc_put_hevc_##fn##32_8_neon##ext args; \ void ff_hevc_put_hevc_##fn##64_8_neon##ext args +NEON8_FNPROTO(pel_pixels, (int16_t *dst, + const uint8_t *src, ptrdiff_t srcstride, + int height, intptr_t mx, intptr_t my, int width),); + NEON8_FNPROTO(pel_uni_pixels, (uint8_t *_dst, ptrdiff_t _dststride, const uint8_t *_src, ptrdiff_t _srcstride, int height, intptr_t mx, intptr_t my, int width),); @@ -300,6 +304,8 @@ av_cold void ff_hevc_dsp_init_aarch64(HEVCDSPContext *c, const int bit_depth) c->put_hevc_qpel_bi[8][0][1] = c->put_hevc_qpel_bi[9][0][1] = ff_hevc_put_hevc_qpel_bi_h16_8_neon; + NEON8_FNASSIGN(c->put_hevc_epel, 0, 0, pel_pixels,); + NEON8_FNASSIGN(c->put_hevc_qpel, 0, 0, pel_pixels,); NEON8_FNASSIGN(c->put_hevc_epel_uni, 0, 0, pel_uni_pixels,); NEON8_FNASSIGN(c->put_hevc_epel_uni, 1, 0, epel_uni_v,); NEON8_FNASSIGN(c->put_hevc_qpel_uni, 0, 0, pel_uni_pixels,); -- 2.38.0.windows.1