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
63RV-OBJS-$(CONFIG_VP8DSP) += riscv/vp8dsp_rvi.o63RV-OBJS-$(CONFIG_VP8DSP) += riscv/vp8dsp_rvi.o
64RVV-OBJS-$(CONFIG_VP8DSP) += riscv/vp8dsp_rvv.o64RVV-OBJS-$(CONFIG_VP8DSP) += riscv/vp8dsp_rvv.o
65OBJS-$(CONFIG_VP9_DECODER) += riscv/vp9dsp_init.o65OBJS-$(CONFIG_VP9_DECODER) += riscv/vp9dsp_init.o
66RV-OBJS-$(CONFIG_VP9_DECODER) += riscv/vp9_intra_rvi.o
66RVV-OBJS-$(CONFIG_VP9_DECODER) += riscv/vp9_intra_rvv.o67RVV-OBJS-$(CONFIG_VP9_DECODER) += riscv/vp9_intra_rvv.o
67OBJS-$(CONFIG_VORBIS_DECODER) += riscv/vorbisdsp_init.o68OBJS-$(CONFIG_VORBIS_DECODER) += riscv/vorbisdsp_init.o
68RVV-OBJS-$(CONFIG_VORBIS_DECODER) += riscv/vorbisdsp_rvv.o69RVV-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
24func 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
43endfunc
44
45func 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
58endfunc
59
60func 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
70endfunc
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
60 const uint8_t *a);60 const uint8_t *a);
61void ff_dc_129_8x8_rvv(uint8_t *dst, ptrdiff_t stride, const uint8_t *l,61void ff_dc_129_8x8_rvv(uint8_t *dst, ptrdiff_t stride, const uint8_t *l,
62 const uint8_t *a);62 const uint8_t *a);
63void ff_v_32x32_rvi(uint8_t *dst, ptrdiff_t stride, const uint8_t *l,
64 const uint8_t *a);
65void ff_v_16x16_rvi(uint8_t *dst, ptrdiff_t stride, const uint8_t *l,
66 const uint8_t *a);
67void ff_v_8x8_rvi(uint8_t *dst, ptrdiff_t stride, const uint8_t *l,
68 const uint8_t *a);
63 69
64#define VP9_8TAP_RISCV_RVV_FUNC(SIZE, type, type_idx) \70#define VP9_8TAP_RISCV_RVV_FUNC(SIZE, type, type_idx) \
65void ff_put_8tap_##type##_##SIZE##h_rvv(uint8_t *dst, ptrdiff_t dststride, \71void 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
24#include "libavcodec/vp9dsp.h"24#include "libavcodec/vp9dsp.h"
25#include "vp9dsp.h"25#include "vp9dsp.h"
26 26
27static av_cold void vp9dsp_intrapred_init_rvv(VP9DSPContext *dsp, int bpp)27static av_cold void vp9dsp_intrapred_init_riscv(VP9DSPContext *dsp, int bpp)
28{28{
29#if HAVE_RVV29#if HAVE_RV
30 int flags = av_get_cpu_flags();30 int flags = av_get_cpu_flags();
31 31
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
32 if (bpp == 8 && flags & AV_CPU_FLAG_RVV_I64 && ff_rv_vlen_least(128)) {40 if (bpp == 8 && flags & AV_CPU_FLAG_RVV_I64 && ff_rv_vlen_least(128)) {
33 dsp->intra_pred[TX_8X8][DC_PRED] = ff_dc_8x8_rvv;41 dsp->intra_pred[TX_8X8][DC_PRED] = ff_dc_8x8_rvv;
34 dsp->intra_pred[TX_8X8][LEFT_DC_PRED] = ff_dc_left_8x8_rvv;42 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
53 dsp->intra_pred[TX_16X16][TOP_DC_PRED] = ff_dc_top_16x16_rvv;61 dsp->intra_pred[TX_16X16][TOP_DC_PRED] = ff_dc_top_16x16_rvv;
54 }62 }
55#endif63#endif
64#endif
56}65}
57 66
58av_cold void ff_vp9dsp_init_riscv(VP9DSPContext *dsp, int bpp, int bitexact)67av_cold void ff_vp9dsp_init_riscv(VP9DSPContext *dsp, int bpp, int bitexact)
59{68{
60 vp9dsp_intrapred_init_rvv(dsp, bpp);69 vp9dsp_intrapred_init_riscv(dsp, bpp);
61}70}

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