History

lavc/vc1dsp: R-V V inv_trans

C908: vc1dsp.vc1_inv_trans_4x4_dc_c: 125.7 vc1dsp.vc1_inv_trans_4x4_dc_rvv_i32: 53.5 vc1dsp.vc1_inv_trans_4x8_dc_c: 230.7 vc1dsp.vc1_inv_trans_4x8_dc_rvv_i32: 65.5 vc1dsp.vc1_inv_trans_8x4_dc_c: 228.7 vc1dsp.vc1_inv_trans_8x4_dc_rvv_i64: 64.5 vc1dsp.vc1_inv_trans_8x8_dc_c: 476.5 vc1dsp.vc1_inv_trans_8x8_dc_rvv_i64: 80.2

sunyuechi committed 2 years ago

Commit 0b9d0091 parent 0f745b75 files · +167 −0Browse files

Unified · Split

5 files
  1. libavcodec/riscv/Makefile +2 −0
  2. libavcodec/riscv/vc1dsp_init.c +49 −0
  3. libavcodec/riscv/vc1dsp_rvv.S +113 −0
  4. libavcodec/vc1dsp.c +2 −0
  5. libavcodec/vc1dsp.h +1 −0
libavcodec/riscv/Makefile+2−0
@@ -40,5 +40,7 @@ OBJS-$(CONFIG_PIXBLOCKDSP) += riscv/pixblockdsp_init.o \ · 39 unmodified lines
40RVV-OBJS-$(CONFIG_PIXBLOCKDSP) += riscv/pixblockdsp_rvv.o40RVV-OBJS-$(CONFIG_PIXBLOCKDSP) += riscv/pixblockdsp_rvv.o
41OBJS-$(CONFIG_UTVIDEO_DECODER) += riscv/utvideodsp_init.o41OBJS-$(CONFIG_UTVIDEO_DECODER) += riscv/utvideodsp_init.o
42RVV-OBJS-$(CONFIG_UTVIDEO_DECODER) += riscv/utvideodsp_rvv.o42RVV-OBJS-$(CONFIG_UTVIDEO_DECODER) += riscv/utvideodsp_rvv.o
43OBJS-$(CONFIG_VC1DSP) += riscv/vc1dsp_init.o
44RVV-OBJS-$(CONFIG_VC1DSP) += riscv/vc1dsp_rvv.o
43OBJS-$(CONFIG_VORBIS_DECODER) += riscv/vorbisdsp_init.o45OBJS-$(CONFIG_VORBIS_DECODER) += riscv/vorbisdsp_init.o
44RVV-OBJS-$(CONFIG_VORBIS_DECODER) += riscv/vorbisdsp_rvv.o46RVV-OBJS-$(CONFIG_VORBIS_DECODER) += riscv/vorbisdsp_rvv.o
libavcodec/riscv/vc1dsp_init.c+49−0
@@ -0,0 +1,49 @@
1/*
2 * Copyright (c) 2023 Institue of Software Chinese Academy of Sciences (ISCAS).
3 *
4 * This file is part of FFmpeg.
5 *
6 * FFmpeg is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * FFmpeg is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with FFmpeg; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20
21#include <stdint.h>
22
23#include "libavutil/attributes.h"
24#include "libavutil/cpu.h"
25#include "libavutil/riscv/cpu.h"
26#include "libavcodec/vc1.h"
27
28void ff_vc1_inv_trans_8x8_dc_rvv(uint8_t *dest, ptrdiff_t stride, int16_t *block);
29void ff_vc1_inv_trans_4x8_dc_rvv(uint8_t *dest, ptrdiff_t stride, int16_t *block);
30void ff_vc1_inv_trans_8x4_dc_rvv(uint8_t *dest, ptrdiff_t stride, int16_t *block);
31void ff_vc1_inv_trans_4x4_dc_rvv(uint8_t *dest, ptrdiff_t stride, int16_t *block);
32
33av_cold void ff_vc1dsp_init_riscv(VC1DSPContext *dsp)
34{
35#if HAVE_RVV
36 int flags = av_get_cpu_flags();
37
38 if (ff_get_rv_vlenb() >= 16) {
39 if (flags & AV_CPU_FLAG_RVV_I64) {
40 dsp->vc1_inv_trans_8x8_dc = ff_vc1_inv_trans_8x8_dc_rvv;
41 dsp->vc1_inv_trans_8x4_dc = ff_vc1_inv_trans_8x4_dc_rvv;
42 }
43 if (flags & AV_CPU_FLAG_RVV_I32) {
44 dsp->vc1_inv_trans_4x8_dc = ff_vc1_inv_trans_4x8_dc_rvv;
45 dsp->vc1_inv_trans_4x4_dc = ff_vc1_inv_trans_4x4_dc_rvv;
46 }
47 }
48#endif
49}
libavcodec/riscv/vc1dsp_rvv.S+113−0
@@ -0,0 +1,113 @@
1/*
2 * Copyright (c) 2023 Institue of Software Chinese Academy of Sciences (ISCAS).
3 *
4 * This file is part of FFmpeg.
5 *
6 * FFmpeg is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * FFmpeg is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with FFmpeg; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20
21#include "libavutil/riscv/asm.S"
22
23func ff_vc1_inv_trans_8x8_dc_rvv, zve64x
24 lh t2, (a2)
25 vsetivli zero, 8, e8, mf2, ta, ma
26 vlse64.v v0, (a0), a1
27 sh1add t2, t2, t2
28 addi t2, t2, 1
29 srai t2, t2, 1
30 sh1add t2, t2, t2
31 addi t2, t2, 16
32 srai t2, t2, 5
33 li t0, 8*8
34 vsetvli zero, t0, e16, m8, ta, ma
35 vzext.vf2 v8, v0
36 vadd.vx v8, v8, t2
37 vmax.vx v8, v8, zero
38 vsetvli zero, zero, e8, m4, ta, ma
39 vnclipu.wi v0, v8, 0
40 vsetivli zero, 8, e8, mf2, ta, ma
41 vsse64.v v0, (a0), a1
42 ret
43endfunc
44
45func ff_vc1_inv_trans_4x8_dc_rvv, zve32x
46 lh t2, (a2)
47 vsetivli zero, 8, e8, mf2, ta, ma
48 vlse32.v v0, (a0), a1
49 slli t1, t2, 4
50 add t2, t2, t1
51 addi t2, t2, 4
52 srai t2, t2, 3
53 sh1add t2, t2, t2
54 slli t2, t2, 2
55 addi t2, t2, 64
56 srai t2, t2, 7
57 li t0, 4*8
58 vsetvli zero, t0, e16, m4, ta, ma
59 vzext.vf2 v4, v0
60 vadd.vx v4, v4, t2
61 vmax.vx v4, v4, zero
62 vsetvli zero, zero, e8, m2, ta, ma
63 vnclipu.wi v0, v4, 0
64 vsetivli zero, 8, e8, mf2, ta, ma
65 vsse32.v v0, (a0), a1
66 ret
67endfunc
68
69func ff_vc1_inv_trans_8x4_dc_rvv, zve64x
70 lh t2, (a2)
71 vsetivli zero, 8, e8, mf2, ta, ma
72 vlse64.v v0, (a0), a1
73 sh1add t2, t2, t2
74 addi t2, t2, 1
75 srai t2, t2, 1
76 slli t1, t2, 4
77 add t2, t2, t1
78 addi t2, t2, 64
79 srai t2, t2, 7
80 li t0, 8*4
81 vsetvli zero, t0, e16, m4, ta, ma
82 vzext.vf2 v4, v0
83 vadd.vx v4, v4, t2
84 vmax.vx v4, v4, zero
85 vsetvli zero, zero, e8, m2, ta, ma
86 vnclipu.wi v0, v4, 0
87 vsetivli zero, 8, e8, mf2, ta, ma
88 vsse64.v v0, (a0), a1
89 ret
90endfunc
91
92func ff_vc1_inv_trans_4x4_dc_rvv, zve32x
93 lh t2, (a2)
94 vsetivli zero, 4, e8, mf2, ta, ma
95 vlse32.v v0, (a0), a1
96 slli t1, t2, 4
97 add t2, t2, t1
98 addi t2, t2, 4
99 srai t2, t2, 3
100 slli t1, t2, 4
101 add t2, t2, t1
102 addi t2, t2, 64
103 srai t2, t2, 7
104 vsetivli zero, 4*4, e16, m2, ta, ma
105 vzext.vf2 v2, v0
106 vadd.vx v2, v2, t2
107 vmax.vx v2, v2, zero
108 vsetvli zero, zero, e8, m1, ta, ma
109 vnclipu.wi v0, v2, 0
110 vsetivli zero, 4, e8, mf2, ta, ma
111 vsse32.v v0, (a0), a1
112 ret
113endfunc
libavcodec/vc1dsp.c+2−0
@@ -1039,6 +1039,8 @@ av_cold void ff_vc1dsp_init(VC1DSPContext *dsp) · 1038 unmodified lines
1039 ff_vc1dsp_init_arm(dsp);1039 ff_vc1dsp_init_arm(dsp);
1040#elif ARCH_PPC1040#elif ARCH_PPC
1041 ff_vc1dsp_init_ppc(dsp);1041 ff_vc1dsp_init_ppc(dsp);
1042#elif ARCH_RISCV
1043 ff_vc1dsp_init_riscv(dsp);
1042#elif ARCH_X861044#elif ARCH_X86
1043 ff_vc1dsp_init_x86(dsp);1045 ff_vc1dsp_init_x86(dsp);
1044#elif ARCH_MIPS1046#elif ARCH_MIPS
libavcodec/vc1dsp.h+1−0
@@ -89,6 +89,7 @@ void ff_vc1dsp_init(VC1DSPContext* c); · 88 unmodified lines
89void ff_vc1dsp_init_aarch64(VC1DSPContext* dsp);89void ff_vc1dsp_init_aarch64(VC1DSPContext* dsp);
90void ff_vc1dsp_init_arm(VC1DSPContext* dsp);90void ff_vc1dsp_init_arm(VC1DSPContext* dsp);
91void ff_vc1dsp_init_ppc(VC1DSPContext *c);91void ff_vc1dsp_init_ppc(VC1DSPContext *c);
92void ff_vc1dsp_init_riscv(VC1DSPContext *c);
92void ff_vc1dsp_init_x86(VC1DSPContext* dsp);93void ff_vc1dsp_init_x86(VC1DSPContext* dsp);
93void ff_vc1dsp_init_mips(VC1DSPContext* dsp);94void ff_vc1dsp_init_mips(VC1DSPContext* dsp);
94void ff_vc1dsp_init_loongarch(VC1DSPContext* dsp);95void ff_vc1dsp_init_loongarch(VC1DSPContext* dsp);

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