History

lavc/vp9dsp: R-V V mc avg

C908: vp9_avg4_8bpp_c: 1.2 vp9_avg4_8bpp_rvv_i64: 1.0 vp9_avg8_8bpp_c: 3.7 vp9_avg8_8bpp_rvv_i64: 1.5 vp9_avg16_8bpp_c: 14.7 vp9_avg16_8bpp_rvv_i64: 3.5 vp9_avg32_8bpp_c: 57.7 vp9_avg32_8bpp_rvv_i64: 10.0 vp9_avg64_8bpp_c: 229.0 vp9_avg64_8bpp_rvv_i64: 31.7

sunyuechi committed 2 years ago

Commit 0c1304a1 parent 7591eb43 files · +78 −1Browse files

Unified · Split

3 files
  1. libavcodec/riscv/Makefile +2 −1
  2. libavcodec/riscv/vp9_mc_rvv.S +58 −0
  3. libavcodec/riscv/vp9dsp_init.c +18 −0
libavcodec/riscv/Makefile+2−1
@@ -69,6 +69,7 @@ RVV-OBJS-$(CONFIG_VP8DSP) += riscv/vp8dsp_rvv.o · 68 unmodified lines
69OBJS-$(CONFIG_VP9_DECODER) += riscv/vp9dsp_init.o69OBJS-$(CONFIG_VP9_DECODER) += riscv/vp9dsp_init.o
70RV-OBJS-$(CONFIG_VP9_DECODER) += riscv/vp9_intra_rvi.o \70RV-OBJS-$(CONFIG_VP9_DECODER) += riscv/vp9_intra_rvi.o \
71 riscv/vp9_mc_rvi.o71 riscv/vp9_mc_rvi.o
72RVV-OBJS-$(CONFIG_VP9_DECODER) += riscv/vp9_intra_rvv.o72RVV-OBJS-$(CONFIG_VP9_DECODER) += riscv/vp9_intra_rvv.o \
73 riscv/vp9_mc_rvv.o
73OBJS-$(CONFIG_VORBIS_DECODER) += riscv/vorbisdsp_init.o74OBJS-$(CONFIG_VORBIS_DECODER) += riscv/vorbisdsp_init.o
74RVV-OBJS-$(CONFIG_VORBIS_DECODER) += riscv/vorbisdsp_rvv.o75RVV-OBJS-$(CONFIG_VORBIS_DECODER) += riscv/vorbisdsp_rvv.o
libavcodec/riscv/vp9_mc_rvv.S+58−0
@@ -0,0 +1,58 @@
1/*
2 * Copyright (c) 2024 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
23.macro vsetvlstatic8 len an maxlen mn=m4
24.if \len == 4
25 vsetivli zero, \len, e8, mf4, ta, ma
26.elseif \len == 8
27 vsetivli zero, \len, e8, mf2, ta, ma
28.elseif \len == 16
29 vsetivli zero, \len, e8, m1, ta, ma
30.elseif \len == 32
31 li \an, \len
32 vsetvli zero, \an, e8, m2, ta, ma
33.elseif \len == 64
34 li \an, \maxlen
35 vsetvli zero, \an, e8, \mn, ta, ma
36.endif
37.endm
38
39.macro copy_avg len
40func ff_avg\len\()_rvv, zve32x
41 csrwi vxrm, 0
42 vsetvlstatic8 \len t0 64
431:
44 vle8.v v8, (a2)
45 vle8.v v16, (a0)
46 vaaddu.vv v8, v8, v16
47 addi a4, a4, -1
48 vse8.v v8, (a0)
49 add a2, a2, a3
50 add a0, a0, a1
51 bnez a4, 1b
52 ret
53endfunc
54.endm
55
56.irp len, 64, 32, 16, 8, 4
57 copy_avg \len
58.endr
libavcodec/riscv/vp9dsp_init.c+18−0
@@ -48,6 +48,24 @@ static av_cold void vp9dsp_mc_init_riscv(VP9DSPContext *dsp, int bpp) · 47 unmodified lines
48 }48 }
49# endif49# endif
50 50
51#if HAVE_RVV
52 if (bpp == 8 && (flags & AV_CPU_FLAG_RVV_I32) && ff_rv_vlen_least(128)) {
53
54#define init_fpel(idx1, sz) \
55 dsp->mc[idx1][FILTER_8TAP_SMOOTH ][1][0][0] = ff_avg##sz##_rvv; \
56 dsp->mc[idx1][FILTER_8TAP_REGULAR][1][0][0] = ff_avg##sz##_rvv; \
57 dsp->mc[idx1][FILTER_8TAP_SHARP ][1][0][0] = ff_avg##sz##_rvv; \
58 dsp->mc[idx1][FILTER_BILINEAR ][1][0][0] = ff_avg##sz##_rvv
59
60 init_fpel(0, 64);
61 init_fpel(1, 32);
62 init_fpel(2, 16);
63 init_fpel(3, 8);
64 init_fpel(4, 4);
65
66#undef init_fpel
67 }
68#endif
51#endif69#endif
52}70}
53 71

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