As we do not need to widen accumulators to 64 bits, we effectively get double capacity for unrolling compared to the integer function. This explains the slightly better performance gains. ac3_sum_square_bufferfly_float_c: 65.2 ac3_sum_square_bufferfly_float_rvv_f32: 12.2
Unified · Split
| @@ -30,6 +30,8 @@ void ff_extract_exponents_rvb(uint8_t *exp, int32_t *coef, int nb_coefs); · 29 unmodified lines | |||
| 30 | void ff_float_to_fixed24_rvv(int32_t *dst, const float *src, size_t len); | 30 | void ff_float_to_fixed24_rvv(int32_t *dst, const float *src, size_t len); |
| 31 | void ff_sum_square_butterfly_int32_rvv(int64_t *, const int32_t *, | 31 | void ff_sum_square_butterfly_int32_rvv(int64_t *, const int32_t *, |
| 32 | const int32_t *, int); | 32 | const int32_t *, int); |
| 33 | void ff_sum_square_butterfly_float_rvv(float *, const float *, | ||
| 34 | const float *, int); | ||
| 33 | 35 | ||
| 34 | av_cold void ff_ac3dsp_init_riscv(AC3DSPContext *c) | 36 | av_cold void ff_ac3dsp_init_riscv(AC3DSPContext *c) |
| 35 | { | 37 | { |
| @@ -39,8 +41,10 @@ av_cold void ff_ac3dsp_init_riscv(AC3DSPContext *c) · 3 unmodified lines | |||
| 39 | if (flags & AV_CPU_FLAG_RVB_ADDR) { | 41 | if (flags & AV_CPU_FLAG_RVB_ADDR) { |
| 40 | if (flags & AV_CPU_FLAG_RVB_BASIC) | 42 | if (flags & AV_CPU_FLAG_RVB_BASIC) |
| 41 | c->extract_exponents = ff_extract_exponents_rvb; | 43 | c->extract_exponents = ff_extract_exponents_rvb; |
| 42 | if (flags & AV_CPU_FLAG_RVV_F32) | 44 | if (flags & AV_CPU_FLAG_RVV_F32) { |
| 43 | c->float_to_fixed24 = ff_float_to_fixed24_rvv; | 45 | c->float_to_fixed24 = ff_float_to_fixed24_rvv; |
| 46 | c->sum_square_butterfly_float = ff_sum_square_butterfly_float_rvv; | ||
| 47 | } | ||
| 44 | # if __riscv_xlen >= 64 | 48 | # if __riscv_xlen >= 64 |
| 45 | if (flags & AV_CPU_FLAG_RVV_I64) | 49 | if (flags & AV_CPU_FLAG_RVV_I64) |
| 46 | c->sum_square_butterfly_int32 = ff_sum_square_butterfly_int32_rvv; | 50 | c->sum_square_butterfly_int32 = ff_sum_square_butterfly_int32_rvv; |
| @@ -78,3 +78,42 @@ func ff_sum_square_butterfly_int32_rvv, zve64x · 77 unmodified lines | |||
| 78 | ret | 78 | ret |
| 79 | endfunc | 79 | endfunc |
| 80 | #endif | 80 | #endif |
| 81 | |||
| 82 | func ff_sum_square_butterfly_float_rvv, zve32f | ||
| 83 | vsetvli t0, zero, e32, m8, ta, ma | ||
| 84 | vmv.v.x v0, zero | ||
| 85 | vmv.v.x v8, zero | ||
| 86 | 1: | ||
| 87 | vsetvli t0, a3, e32, m4, tu, ma | ||
| 88 | vle32.v v16, (a1) | ||
| 89 | sub a3, a3, t0 | ||
| 90 | vle32.v v20, (a2) | ||
| 91 | sh2add a1, t0, a1 | ||
| 92 | vfadd.vv v24, v16, v20 | ||
| 93 | sh2add a2, t0, a2 | ||
| 94 | vfsub.vv v28, v16, v20 | ||
| 95 | vfmacc.vv v0, v16, v16 | ||
| 96 | vfmacc.vv v4, v20, v20 | ||
| 97 | vfmacc.vv v8, v24, v24 | ||
| 98 | vfmacc.vv v12, v28, v28 | ||
| 99 | bnez a3, 1b | ||
| 100 | |||
| 101 | vsetvli t0, zero, e32, m4, ta, ma | ||
| 102 | vmv.s.x v16, zero | ||
| 103 | vmv.s.x v17, zero | ||
| 104 | vfredsum.vs v16, v0, v16 | ||
| 105 | vmv.s.x v18, zero | ||
| 106 | vfredsum.vs v17, v4, v17 | ||
| 107 | vmv.s.x v19, zero | ||
| 108 | vfredsum.vs v18, v8, v18 | ||
| 109 | vfmv.f.s ft0, v16 | ||
| 110 | vfredsum.vs v19, v12, v19 | ||
| 111 | vfmv.f.s ft1, v17 | ||
| 112 | fsw ft0, (a0) | ||
| 113 | vfmv.f.s ft2, v18 | ||
| 114 | fsw ft1, 4(a0) | ||
| 115 | vfmv.f.s ft3, v19 | ||
| 116 | fsw ft2, 8(a0) | ||
| 117 | fsw ft3, 12(a0) | ||
| 118 | ret | ||
| 119 | endfunc | ||