History

lavc/vc1dsp: R-V V vc1_inv_trans_8x4

T-Head C908 (cycles): vc1dsp.vc1_inv_trans_8x4_c: 626.2 vc1dsp.vc1_inv_trans_8x4_rvv_i32: 215.2

Rémi Denis-Courmont committed 2 years ago

Commit a169f3b1 parent 04397a22 files · +75 −0Browse files

Showing the changes to libavcodec (2 of 2 files). Show all

Unified · Split

2 files
  1. libavcodec/riscv/vc1dsp_init.c +2 −0
  2. libavcodec/riscv/vc1dsp_rvv.S +73 −0
libavcodec/riscv/vc1dsp_init.c+2−0
@@ -29,6 +29,7 @@ void ff_vc1_inv_trans_8x8_dc_rvv(uint8_t *dest, ptrdiff_t stride, int16_t *block · 28 unmodified lines
2929 void ff_vc1_inv_trans_8x8_rvv(int16_t block[64]);
3030 void ff_vc1_inv_trans_4x8_dc_rvv(uint8_t *dest, ptrdiff_t stride, int16_t *block);
3131 void ff_vc1_inv_trans_8x4_dc_rvv(uint8_t *dest, ptrdiff_t stride, int16_t *block);
32+void ff_vc1_inv_trans_8x4_rvv(uint8_t *dest, ptrdiff_t stride, int16_t *block);
3233 void ff_vc1_inv_trans_4x4_dc_rvv(uint8_t *dest, ptrdiff_t stride, int16_t *block);
3334 void ff_put_pixels16x16_rvi(uint8_t *dst, const uint8_t *src, ptrdiff_t line_size, int rnd);
3435 void ff_put_pixels8x8_rvi(uint8_t *dst, const uint8_t *src, ptrdiff_t line_size, int rnd);
@@ -55,6 +56,7 @@ av_cold void ff_vc1dsp_init_riscv(VC1DSPContext *dsp) · 20 unmodified lines
5556 if (flags & AV_CPU_FLAG_RVV_I32) {
5657 if (ff_rv_vlen_least(128)) {
5758 dsp->vc1_inv_trans_8x8 = ff_vc1_inv_trans_8x8_rvv;
59+ dsp->vc1_inv_trans_8x4 = ff_vc1_inv_trans_8x4_rvv;
5860 dsp->vc1_inv_trans_4x8_dc = ff_vc1_inv_trans_4x8_dc_rvv;
5961 dsp->vc1_inv_trans_4x4_dc = ff_vc1_inv_trans_4x4_dc_rvv;
6062 dsp->avg_vc1_mspel_pixels_tab[0][0] = ff_avg_pixels16x16_rvv;
libavcodec/riscv/vc1dsp_rvv.S+73−0
@@ -173,6 +173,31 @@ func ff_vc1_inv_trans_8_rvv, zve32x · 172 unmodified lines
173173 jr t0
174174 endfunc
175175
176+ .variant_cc ff_vc1_inv_trans_4_rvv
177+func ff_vc1_inv_trans_4_rvv, zve32x
178+ li t3, 17
179+ vmul.vx v8, v0, t3
180+ li t4, 22
181+ vmul.vx v10, v2, t3
182+ li t2, 10
183+ vmul.vx v14, v1, t4
184+ vadd.vv v24, v8, v10 # t1
185+ vsub.vv v25, v8, v10 # t2
186+ vmul.vx v16, v3, t2
187+ vmul.vx v18, v3, t4
188+ vmul.vx v20, v1, t2
189+ vadd.vv v26, v14, v16 # t3
190+ vsub.vv v27, v18, v20 # t4
191+ vadd.vv v0, v24, v26
192+ vsub.vv v1, v25, v27
193+ vadd.vv v2, v25, v27
194+ vsub.vv v3, v24, v26
195+ .irp n,0,1,2,3
196+ vssra.vx v\n, v\n, t1 # + 4 >> 3 or + 64 >> 7
197+ .endr
198+ jr t0
199+endfunc
200+
176201 func ff_vc1_inv_trans_8x8_rvv, zve32x
177202 csrwi vxrm, 0
178203 vsetivli zero, 8, e16, m1, ta, ma
@@ -223,6 +248,54 @@ func ff_vc1_inv_trans_8x8_rvv, zve32x · 44 unmodified lines
223248 ret
224249 endfunc
225250
251+func ff_vc1_inv_trans_8x4_rvv, zve32x
252+ csrwi vxrm, 0
253+ vsetivli zero, 4, e16, mf2, ta, ma
254+ vlseg8e16.v v0, (a2)
255+ jal t0, ff_vc1_inv_trans_8_rvv
256+ vsseg8e16.v v0, (a2)
257+ addi a3, a2, 1 * 8 * 2
258+ vsetivli zero, 8, e16, m1, ta, ma
259+ vle16.v v0, (a2)
260+ addi a4, a2, 2 * 8 * 2
261+ vle16.v v1, (a3)
262+ addi a5, a2, 3 * 8 * 2
263+ vle16.v v2, (a4)
264+ vle16.v v3, (a5)
265+ .irp n,0,1,2,3
266+ # shift 4 vectors of 8 elems after transpose instead of 8 of 4
267+ vssra.vi v\n, v\n, 3
268+ .endr
269+ li t1, 7
270+ jal t0, ff_vc1_inv_trans_4_rvv
271+ add a3, a1, a0
272+ vle8.v v8, (a0)
273+ add a4, a1, a3
274+ vle8.v v9, (a3)
275+ add a5, a1, a4
276+ vle8.v v10, (a4)
277+ vle8.v v11, (a5)
278+ vsetvli zero, zero, e8, mf2, ta, ma
279+ vwaddu.wv v0, v0, v8
280+ vwaddu.wv v1, v1, v9
281+ vwaddu.wv v2, v2, v10
282+ vwaddu.wv v3, v3, v11
283+ vsetvli zero, zero, e16, m1, ta, ma
284+ .irp n,0,1,2,3
285+ vmax.vx v\n, v\n, zero
286+ .endr
287+ vsetvli zero, zero, e8, mf2, ta, ma
288+ vnclipu.wi v8, v0, 0
289+ vnclipu.wi v9, v1, 0
290+ vse8.v v8, (a0)
291+ vnclipu.wi v10, v2, 0
292+ vse8.v v9, (a3)
293+ vnclipu.wi v11, v3, 0
294+ vse8.v v10, (a4)
295+ vse8.v v11, (a5)
296+ ret
297+endfunc
298+
226299 .macro mspel_op op pos n1 n2
227300 add t1, \pos, a2
228301 v\op\()e8.v v\n1, (\pos)

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t