Le perjantaina 11. lokakuuta 2024, 13.38.42 EEST u...@foxmail.com a écrit : > From: sunyuechi <sunyue...@iscas.ac.cn> > > k230 > banana_f3 put_chroma_pixels_8_4x4_c: 61.5 ( > 1.00x) 69.5 ( 1.00x) put_chroma_pixels_8_4x4_rvv_i32: > 33.8 ( 1.82x) 38.2 ( 1.82x) put_chroma_pixels_8_8x8_c: > 219.1 ( 1.00x) 246.5 ( 1.00x) > put_chroma_pixels_8_8x8_rvv_i32: 70.8 ( 3.09x) > 59.2 ( 4.16x) put_chroma_pixels_8_16x16_c: 830.3 > ( 1.00x) 830.0 ( 1.00x) put_chroma_pixels_8_16x16_rvv_i32: > 181.8 ( 4.57x) 142.5 ( 5.82x) put_chroma_pixels_8_32x32_c: > 3246.8 ( 1.00x) 3247.0 ( 1.00x) > put_chroma_pixels_8_32x32_rvv_i32: 506.1 ( 6.42x) > 330.0 ( 9.84x) put_chroma_pixels_8_64x64_c: 13616.8 > ( 1.00x) 12967.0 ( 1.00x) put_chroma_pixels_8_64x64_rvv_i32: > 1672.5 ( 8.14x) 996.8 (13.01x) put_chroma_pixels_8_128x128_c: > 54263.6 ( 1.00x) 52002.2 ( 1.00x) > put_chroma_pixels_8_128x128_rvv_i32: 9181.8 ( 5.91x) > 3611.8 (14.40x) put_luma_pixels_8_4x4_c: > 61.5 ( 1.00x) 69.8 ( 1.00x) put_luma_pixels_8_4x4_rvv_i32: > 33.8 ( 1.82x) 28.0 ( 2.49x) put_luma_pixels_8_8x8_c: > 219.1 ( 1.00x) 226.0 ( 1.00x) > put_luma_pixels_8_8x8_rvv_i32: 80.3 ( 2.73x) > 59.2 ( 3.81x) put_luma_pixels_8_16x16_c: 830.3 > ( 1.00x) 830.2 ( 1.00x) put_luma_pixels_8_16x16_rvv_i32: > 181.8 ( 4.57x) 142.5 ( 5.83x) put_luma_pixels_8_32x32_c: > 3256.1 ( 1.00x) 3247.2 ( 1.00x) > put_luma_pixels_8_32x32_rvv_i32: 506.1 ( 6.43x) > 361.2 ( 8.99x) put_luma_pixels_8_64x64_c: 14042.5 > ( 1.00x) 12977.2 ( 1.00x) put_luma_pixels_8_64x64_rvv_i32: > 1681.8 ( 8.35x) 1007.0 (12.89x) put_luma_pixels_8_128x128_c: > 54291.3 ( 1.00x) 53700.5 ( 1.00x) > put_luma_pixels_8_128x128_rvv_i32: 10700.0 ( 5.07x) > 3684.8 (14.57x) --- > libavcodec/riscv/vvc/vvc_mc_rvv.S | 61 ++++++++++++++++++++++++++---- > libavcodec/riscv/vvc/vvcdsp_init.c | 22 +++++++++++ > 2 files changed, 76 insertions(+), 7 deletions(-) > > diff --git a/libavcodec/riscv/vvc/vvc_mc_rvv.S > b/libavcodec/riscv/vvc/vvc_mc_rvv.S index 2c634af48f..7300889430 100644 > --- a/libavcodec/riscv/vvc/vvc_mc_rvv.S > +++ b/libavcodec/riscv/vvc/vvc_mc_rvv.S > @@ -158,7 +158,7 @@ > .endm > > > -.macro AVG_JMP_TABLE id, vlen > +.macro POW2_JMP_TABLE id, vlen > const jmp_table_\id\vlen > .4byte \id\()2\vlen\()f - jmp_table_\id\vlen > .4byte \id\()4\vlen\()f - jmp_table_\id\vlen > @@ -170,8 +170,8 @@ const jmp_table_\id\vlen > endconst > .endm > > -.macro AVG_J vlen, id > - clz t1, a4 > +.macro POW2_J vlen, id, w > + clz t1, \w > neg t1, t1 > lla t5, jmp_table_\id\vlen > sh2add t1, t1, t5 > @@ -183,9 +183,9 @@ endconst > .macro func_avg vlen > func ff_vvc_avg_8_rvv_\vlen\(), zve32x, zbb, zba > lpad 0 > - AVG_JMP_TABLE 1, \vlen > + POW2_JMP_TABLE 1, \vlen > csrwi vxrm, 0 > - AVG_J \vlen, 1 > + POW2_J \vlen, 1, a4 > .irp w,2,4,8,16,32,64,128 > avg \w, \vlen, 1 > .endr > @@ -265,7 +265,7 @@ func_avg 256 > .macro func_w_avg vlen > func ff_vvc_w_avg_8_rvv_\vlen\(), zve32x, zbb, zba > lpad 0 > - AVG_JMP_TABLE 2, \vlen > + POW2_JMP_TABLE 2, \vlen > csrwi vxrm, 0 > addi t6, a6, 7 > ld t3, (sp) > @@ -275,7 +275,7 @@ func ff_vvc_w_avg_8_rvv_\vlen\(), zve32x, zbb, zba > add t4, t4, t5 > addi t5, t6, -1 // shift - 1 > sll t4, t4, t5 > - AVG_J \vlen, 2 > + POW2_J \vlen, 2, a4 > .irp w,2,4,8,16,32,64,128 > w_avg \w, \vlen, 2 > .endr > @@ -405,3 +405,50 @@ func_dmvr \vlen, dmvr_h > func_dmvr \vlen, dmvr_v > func_dmvr \vlen, dmvr_hv > .endr > + > +.macro put_pixels w, vlen, id > +\id\w\vlen: > + vsetvlstatic16 \w, \vlen > +.if \w == 128 && \vlen == 128 > +1: > + addi t0, a1, 64 > + addi t1, a0, 64*2 > + vle8.v v0, (a1) > + vle8.v v16, (t0) > + vzext.vf2 v8, v0 > + vzext.vf2 v24, v16 > + vsll.vi v8, v8, 6 > + vsll.vi v24, v24, 6
Even without Zvbb's widening shift, widening multiplication is probably faster here. > + vse16.v v8, (a0) > + vse16.v v24, (t1) > + add a1, a1, a2 > + addi a3, a3, -1 > + addi a0, a0, 128*2 > + bnez a3, 1b > +.else > +1: > + vle8.v v0, (a1) > + vzext.vf2 v8, v0 > + vsll.vi v8, v8, 6 > + vse16.v v8, (a0) > + add a1, a1, a2 > + addi a3, a3, -1 > + addi a0, a0, 128*2 > + bnez a3, 1b > +.endif > + ret > +.endm > + > +.macro func_put_pixels vlen > +func ff_vvc_put_pixels_8_rvv_\vlen\(), zve32x, zbb, zba > + lpad 0 > + POW2_JMP_TABLE 3, \vlen > + POW2_J \vlen, 3, a6 > + .irp w,2,4,8,16,32,64,128 > + put_pixels \w, \vlen, 3 > + .endr > +endfunc > +.endm > + > +func_put_pixels 256 > +func_put_pixels 128 > diff --git a/libavcodec/riscv/vvc/vvcdsp_init.c > b/libavcodec/riscv/vvc/vvcdsp_init.c index 7df3ce58db..18e7a455f2 100644 > --- a/libavcodec/riscv/vvc/vvcdsp_init.c > +++ b/libavcodec/riscv/vvc/vvcdsp_init.c > @@ -24,6 +24,7 @@ > #include "libavutil/cpu.h" > #include "libavutil/riscv/cpu.h" > #include "libavcodec/vvc/dsp.h" > +#include "libavcodec/vvc/dec.h" > > #define bf(fn, bd, opt) fn##_##bd##_##opt > > @@ -57,6 +58,23 @@ DMVR_PROTOTYPES(8, rvv_256) > c->inter.dmvr[1][1] = ff_vvc_dmvr_hv_##bd##_##opt; \ > } while (0) > > +#define PUT_PIXELS_PROTOTYPES2(bd, opt) > \ +void bf(ff_vvc_put_pixels, bd, opt)(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); + > +PUT_PIXELS_PROTOTYPES2(8, rvv_128) > +PUT_PIXELS_PROTOTYPES2(8, rvv_256) > + > +#define PEL_FUNC(dst, C, idx1, idx2, a) > \ + do { > \ + for (int w = 1; w < 7; w++) > \ + c->inter.dst[C][w][idx1][idx2] = a; > \ + } while (0) > \ + > +#define FUNCS(C, opt) > \ + PEL_FUNC(put, C, 0, 0, ff_vvc_put_pixels_8_##opt); > \ + > void ff_vvc_dsp_init_riscv(VVCDSPContext *const c, const int bd) > { > #if HAVE_RVV > @@ -72,6 +90,8 @@ void ff_vvc_dsp_init_riscv(VVCDSPContext *const c, const > int bd) c->inter.w_avg = ff_vvc_w_avg_8_rvv_256; > # endif > DMVR_INIT(8, rvv_256); > + FUNCS(LUMA, rvv_256); > + FUNCS(CHROMA, rvv_256); > break; > default: > break; > @@ -85,6 +105,8 @@ void ff_vvc_dsp_init_riscv(VVCDSPContext *const c, const > int bd) c->inter.w_avg = ff_vvc_w_avg_8_rvv_128; > # endif > DMVR_INIT(8, rvv_128); > + FUNCS(LUMA, rvv_128); > + FUNCS(CHROMA, rvv_128); > break; > default: > break; -- レミ・デニ-クールモン http://www.remlab.net/ _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".