History

lavc/vp9dsp: R-V ipred vert

C908: vp9_vert_8x8_8bpp_c: 22.0 vp9_vert_8x8_8bpp_rvi: 15.7 vp9_vert_16x16_8bpp_c: 71.2 vp9_vert_16x16_8bpp_rvi: 39.0 vp9_vert_32x32_8bpp_c: 300.2 vp9_vert_32x32_8bpp_rvi: 135.2

sunyuechi committed 2 years ago

Commit aa9dbd91 parent a3e45064 files · +90 −3Browse files

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

Unified · Split

4 files
  1. libavcodec/riscv/Makefile +1 −0
  2. libavcodec/riscv/vp9_intra_rvi.S +71 −0
  3. libavcodec/riscv/vp9dsp.h +6 −0
  4. libavcodec/riscv/vp9dsp_init.c +12 −3
libavcodec/riscv/Makefile+1−0
@@ -63,6 +63,7 @@ OBJS-$(CONFIG_VP8DSP) += riscv/vp8dsp_init.o · 62 unmodified lines
6363 RV-OBJS-$(CONFIG_VP8DSP) += riscv/vp8dsp_rvi.o
6464 RVV-OBJS-$(CONFIG_VP8DSP) += riscv/vp8dsp_rvv.o
6565 OBJS-$(CONFIG_VP9_DECODER) += riscv/vp9dsp_init.o
66+RV-OBJS-$(CONFIG_VP9_DECODER) += riscv/vp9_intra_rvi.o
6667 RVV-OBJS-$(CONFIG_VP9_DECODER) += riscv/vp9_intra_rvv.o
6768 OBJS-$(CONFIG_VORBIS_DECODER) += riscv/vorbisdsp_init.o
6869 RVV-OBJS-$(CONFIG_VORBIS_DECODER) += riscv/vorbisdsp_rvv.o
libavcodec/riscv/vp9_intra_rvi.S+71−0
@@ -0,0 +1,71 @@
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+#if __riscv_xlen >= 64
24+func ff_v_32x32_rvi
25+ ld t0, (a3)
26+ ld t1, 8(a3)
27+ ld t2, 16(a3)
28+ ld t3, 24(a3)
29+ .rept 16
30+ add a7, a0, a1
31+ sd t0, (a0)
32+ sd t1, 8(a0)
33+ sd t2, 16(a0)
34+ sd t3, 24(a0)
35+ sh1add a0, a1, a0
36+ sd t0, (a7)
37+ sd t1, 8(a7)
38+ sd t2, 16(a7)
39+ sd t3, 24(a7)
40+ .endr
41+
42+ ret
43+endfunc
44+
45+func ff_v_16x16_rvi
46+ ld t0, (a3)
47+ ld t1, 8(a3)
48+ .rept 8
49+ add a7, a0, a1
50+ sd t0, (a0)
51+ sd t1, 8(a0)
52+ sh1add a0, a1, a0
53+ sd t0, (a7)
54+ sd t1, 8(a7)
55+ .endr
56+
57+ ret
58+endfunc
59+
60+func ff_v_8x8_rvi
61+ ld t0, (a3)
62+ .rept 4
63+ add a7, a0, a1
64+ sd t0, (a0)
65+ sh1add a0, a1, a0
66+ sd t0, (a7)
67+ .endr
68+
69+ ret
70+endfunc
71+#endif
libavcodec/riscv/vp9dsp.h+6−0
@@ -60,6 +60,12 @@ void ff_dc_129_16x16_rvv(uint8_t *dst, ptrdiff_t stride, const uint8_t *l, · 59 unmodified lines
6060 const uint8_t *a);
6161 void ff_dc_129_8x8_rvv(uint8_t *dst, ptrdiff_t stride, const uint8_t *l,
6262 const uint8_t *a);
63+void ff_v_32x32_rvi(uint8_t *dst, ptrdiff_t stride, const uint8_t *l,
64+ const uint8_t *a);
65+void ff_v_16x16_rvi(uint8_t *dst, ptrdiff_t stride, const uint8_t *l,
66+ const uint8_t *a);
67+void ff_v_8x8_rvi(uint8_t *dst, ptrdiff_t stride, const uint8_t *l,
68+ const uint8_t *a);
6369
6470 #define VP9_8TAP_RISCV_RVV_FUNC(SIZE, type, type_idx) \
6571 void ff_put_8tap_##type##_##SIZE##h_rvv(uint8_t *dst, ptrdiff_t dststride, \
libavcodec/riscv/vp9dsp_init.c+12−3
@@ -24,11 +24,19 @@ · 23 unmodified lines
2424 #include "libavcodec/vp9dsp.h"
2525 #include "vp9dsp.h"
2626
27−static av_cold void vp9dsp_intrapred_init_rvv(VP9DSPContext *dsp, int bpp)
27+static av_cold void vp9dsp_intrapred_init_riscv(VP9DSPContext *dsp, int bpp)
2828 {
29−#if HAVE_RVV
29+#if HAVE_RV
3030 int flags = av_get_cpu_flags();
3131
32+# if __riscv_xlen >= 64
33+ if (bpp == 8 && (flags & AV_CPU_FLAG_RVB_ADDR)) {
34+ dsp->intra_pred[TX_32X32][VERT_PRED] = ff_v_32x32_rvi;
35+ dsp->intra_pred[TX_16X16][VERT_PRED] = ff_v_16x16_rvi;
36+ dsp->intra_pred[TX_8X8][VERT_PRED] = ff_v_8x8_rvi;
37+ }
38+# endif
39+#if HAVE_RVV
3240 if (bpp == 8 && flags & AV_CPU_FLAG_RVV_I64 && ff_rv_vlen_least(128)) {
3341 dsp->intra_pred[TX_8X8][DC_PRED] = ff_dc_8x8_rvv;
3442 dsp->intra_pred[TX_8X8][LEFT_DC_PRED] = ff_dc_left_8x8_rvv;
@@ -53,9 +61,10 @@ static av_cold void vp9dsp_intrapred_init_rvv(VP9DSPContext *dsp, int bpp) · 18 unmodified lines
5361 dsp->intra_pred[TX_16X16][TOP_DC_PRED] = ff_dc_top_16x16_rvv;
5462 }
5563 #endif
64+#endif
5665 }
5766
5867 av_cold void ff_vp9dsp_init_riscv(VP9DSPContext *dsp, int bpp, int bitexact)
5968 {
60− vp9dsp_intrapred_init_rvv(dsp, bpp);
69+ vp9dsp_intrapred_init_riscv(dsp, bpp);
6170 }

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