@@ -1,7 +1,8 @@
OBJS-$(CONFIG_AAC_DECODER) += riscv/aacpsdsp_init.o
RVV-OBJS-$(CONFIG_AAC_DECODER) += riscv/aacpsdsp_rvv.o
OBJS-$(CONFIG_AC3DSP) += riscv/ac3dsp_init.o
-RVV-OBJS-$(CONFIG_AC3DSP) += riscv/ac3dsp_rvv.o
+RVV-OBJS-$(CONFIG_AC3DSP) += riscv/ac3dsp_rvv.o \
+ riscv/ac3dsp_rvb.o
OBJS-$(CONFIG_ALAC_DECODER) += riscv/alacdsp_init.o
RVV-OBJS-$(CONFIG_ALAC_DECODER) += riscv/alacdsp_rvv.o
OBJS-$(CONFIG_AUDIODSP) += riscv/audiodsp_init.o \
@@ -26,6 +26,7 @@
void ff_ac3_exponent_min_rvv(uint8_t *exp, int num_reuse_blocks, int nb_coefs);
void ff_float_to_fixed24_rvv(int32_t *dst, const float *src, unsigned int len);
+void ff_ac3_extract_exponents_rvb(uint8_t *exp, int32_t *coef, int nb_coefs);
void ff_ac3_sum_square_butterfly_int32_rvv(int64_t sum[4],
const int32_t *coef0,
const int32_t *coef1,
@@ -40,6 +41,8 @@ void ff_ac3_compute_mantissa_size_rvv(uint16_t mant_cnt[6][16]);
av_cold void ff_ac3dsp_init_riscv(AC3DSPContext *c)
{
int flags = av_get_cpu_flags();
+ if (flags & AV_CPU_FLAG_RVB_BASIC)
+ c->extract_exponents = ff_ac3_extract_exponents_rvb;
#if HAVE_RVV
if (flags & AV_CPU_FLAG_RVV_I32) {
c->ac3_exponent_min = ff_ac3_exponent_min_rvv;
new file mode 100644
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2023 Beijing ESWIN Computing Technology Co., Ltd.
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "config.h"
+#include "libavutil/riscv/asm.S"
+
+func ff_ac3_extract_exponents_rvb, zbb
+ li t1, __riscv_xlen - 24
+1:
+ lw t0, (a1)
+ bgez t0, 2f
+ neg t0, t0
+
+2:
+ clz t4, t0
+ sub t4, t4, t1
+ sb t4,(a0)
+ addi a2, a2, -1
+ addi a1, a1, 4
+ addi a0, a0, 1
+
+ bgtz a2, 1b
+
+ ret
+endfunc
\ No newline at end of file