History

lavc/sbrdsp: R-V V sum64x5

sum64x5_c: 385.0 sum64x5_rvv_f32: 116.0

Rémi Denis-Courmont committed 3 years ago

Commit 86bee421 parent eba73145 files · +92 −2Browse files

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

Unified · Split

5 files
  1. libavcodec/riscv/Makefile +2 −2
  2. libavcodec/riscv/sbrdsp_init.c +37 −0
  3. libavcodec/riscv/sbrdsp_rvv.S +50 −0
  4. libavcodec/sbrdsp.h +1 −0
  5. libavcodec/sbrdsp_template.c +2 −0
libavcodec/riscv/Makefile+2−2
@@ -1,5 +1,5 @@
1OBJS-$(CONFIG_AAC_DECODER) += riscv/aacpsdsp_init.o1OBJS-$(CONFIG_AAC_DECODER) += riscv/aacpsdsp_init.o riscv/sbrdsp_init.o
2RVV-OBJS-$(CONFIG_AAC_DECODER) += riscv/aacpsdsp_rvv.o2RVV-OBJS-$(CONFIG_AAC_DECODER) += riscv/aacpsdsp_rvv.o riscv/sbrdsp_rvv.o
3OBJS-$(CONFIG_AC3DSP) += riscv/ac3dsp_init.o \3OBJS-$(CONFIG_AC3DSP) += riscv/ac3dsp_init.o \
4 riscv/ac3dsp_rvb.o4 riscv/ac3dsp_rvb.o
5OBJS-$(CONFIG_ALAC_DECODER) += riscv/alacdsp_init.o5OBJS-$(CONFIG_ALAC_DECODER) += riscv/alacdsp_init.o
libavcodec/riscv/sbrdsp_init.c+37−0
@@ -0,0 +1,37 @@
1/*
2 * Copyright © 2023 Rémi Denis-Courmont.
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 "config.h"
22#include "libavutil/attributes.h"
23#include "libavutil/cpu.h"
24#include "libavcodec/sbrdsp.h"
25
26void ff_sbr_sum64x5_rvv(float *z);
27
28av_cold void ff_sbrdsp_init_riscv(SBRDSPContext *c)
29{
30#if HAVE_RVV
31 int flags = av_get_cpu_flags();
32
33 if ((flags & AV_CPU_FLAG_RVV_F32) && (flags & AV_CPU_FLAG_RVB_ADDR)) {
34 c->sum64x5 = ff_sbr_sum64x5_rvv;
35 }
36#endif
37}
libavcodec/riscv/sbrdsp_rvv.S+50−0
@@ -0,0 +1,50 @@
1/*
2 * Copyright © 2023 Rémi Denis-Courmont.
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_sbr_sum64x5_rvv, zve32f
24 li a5, 64
25 addi a1, a0, 64 * 4
26 addi a2, a0, 128 * 4
27 addi a3, a0, 192 * 4
28 addi a4, a0, 256 * 4
291:
30 vsetvli t0, a5, e32, m8, ta, ma
31 sub a5, a5, t0
32 vle32.v v0, (a0)
33 vle32.v v8, (a1)
34 sh2add a1, t0, a1
35 vle32.v v16, (a2)
36 vfadd.vv v0, v0, v8
37 sh2add a2, t0, a2
38 vle32.v v24, (a3)
39 vfadd.vv v0, v0, v16
40 sh2add a3, t0, a3
41 vle32.v v8, (a4)
42 vfadd.vv v0, v0, v24
43 sh2add a4, t0, a4
44 vfadd.vv v0, v0, v8
45 vse32.v v0, (a0)
46 sh2add a0, t0, a0
47 bnez a5, 1b
48
49 ret
50endfunc
libavcodec/sbrdsp.h+1−0
@@ -48,6 +48,7 @@ extern const INTFLOAT AAC_RENAME(ff_sbr_noise_table)[][2]; · 47 unmodified lines
48void AAC_RENAME(ff_sbrdsp_init)(SBRDSPContext *s);48void AAC_RENAME(ff_sbrdsp_init)(SBRDSPContext *s);
49void ff_sbrdsp_init_arm(SBRDSPContext *s);49void ff_sbrdsp_init_arm(SBRDSPContext *s);
50void ff_sbrdsp_init_aarch64(SBRDSPContext *s);50void ff_sbrdsp_init_aarch64(SBRDSPContext *s);
51void ff_sbrdsp_init_riscv(SBRDSPContext *s);
51void ff_sbrdsp_init_x86(SBRDSPContext *s);52void ff_sbrdsp_init_x86(SBRDSPContext *s);
52void ff_sbrdsp_init_mips(SBRDSPContext *s);53void ff_sbrdsp_init_mips(SBRDSPContext *s);
53 54
libavcodec/sbrdsp_template.c+2−0
@@ -98,6 +98,8 @@ av_cold void AAC_RENAME(ff_sbrdsp_init)(SBRDSPContext *s) · 97 unmodified lines
98 ff_sbrdsp_init_arm(s);98 ff_sbrdsp_init_arm(s);
99#elif ARCH_AARCH6499#elif ARCH_AARCH64
100 ff_sbrdsp_init_aarch64(s);100 ff_sbrdsp_init_aarch64(s);
101#elif ARCH_RISCV
102 ff_sbrdsp_init_riscv(s);
101#elif ARCH_X86103#elif ARCH_X86
102 ff_sbrdsp_init_x86(s);104 ff_sbrdsp_init_x86(s);
103#elif ARCH_MIPS105#elif ARCH_MIPS

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