mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-11-21 10:55:51 +02:00
lavc/llvidencdsp: add R-V V diff_bytes
diff_bytes_c: 163.0 diff_bytes_rvv_i32: 52.7
This commit is contained in:
parent
0183c2c830
commit
0fa421c8f1
@ -94,7 +94,9 @@ av_cold void ff_llvidencdsp_init(LLVidEncDSPContext *c)
|
||||
c->sub_median_pred = sub_median_pred_c;
|
||||
c->sub_left_predict = sub_left_predict_c;
|
||||
|
||||
#if ARCH_X86
|
||||
#if ARCH_RISCV
|
||||
ff_llvidencdsp_init_riscv(c);
|
||||
#elif ARCH_X86
|
||||
ff_llvidencdsp_init_x86(c);
|
||||
#endif
|
||||
}
|
||||
|
@ -40,6 +40,7 @@ typedef struct LLVidEncDSPContext {
|
||||
} LLVidEncDSPContext;
|
||||
|
||||
void ff_llvidencdsp_init(LLVidEncDSPContext *c);
|
||||
void ff_llvidencdsp_init_riscv(LLVidEncDSPContext *c);
|
||||
void ff_llvidencdsp_init_x86(LLVidEncDSPContext *c);
|
||||
|
||||
#endif /* AVCODEC_LOSSLESS_VIDEOENCDSP_H */
|
||||
|
@ -30,6 +30,8 @@ OBJS-$(CONFIG_LLAUDDSP) += riscv/llauddsp_init.o
|
||||
RVV-OBJS-$(CONFIG_LLAUDDSP) += riscv/llauddsp_rvv.o
|
||||
OBJS-$(CONFIG_LLVIDDSP) += riscv/llviddsp_init.o
|
||||
RVV-OBJS-$(CONFIG_LLVIDDSP) += riscv/llviddsp_rvv.o
|
||||
OBJS-$(CONFIG_LLVIDENCDSP) += riscv/llvidencdsp_init.o
|
||||
RVV-OBJS-$(CONFIG_LLVIDENCDSP) += riscv/llvidencdsp_rvv.o
|
||||
OBJS-$(CONFIG_OPUS_DECODER) += riscv/opusdsp_init.o
|
||||
RVV-OBJS-$(CONFIG_OPUS_DECODER) += riscv/opusdsp_rvv.o
|
||||
OBJS-$(CONFIG_PIXBLOCKDSP) += riscv/pixblockdsp_init.o \
|
||||
|
39
libavcodec/riscv/llvidencdsp_init.c
Normal file
39
libavcodec/riscv/llvidencdsp_init.c
Normal file
@ -0,0 +1,39 @@
|
||||
/*
|
||||
* Copyright © 2023 Rémi Denis-Courmont.
|
||||
*
|
||||
* 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/attributes.h"
|
||||
#include "libavutil/cpu.h"
|
||||
#include "libavcodec/lossless_videoencdsp.h"
|
||||
|
||||
void ff_llvidenc_diff_bytes_rvv(uint8_t *dst, const uint8_t *src1,
|
||||
const uint8_t *src2, intptr_t w);
|
||||
|
||||
av_cold void ff_llvidencdsp_init_riscv(LLVidEncDSPContext *c)
|
||||
{
|
||||
#if HAVE_RVV
|
||||
int flags = av_get_cpu_flags();
|
||||
|
||||
if (flags & AV_CPU_FLAG_RVV_I32) {
|
||||
c->diff_bytes = ff_llvidenc_diff_bytes_rvv;
|
||||
}
|
||||
#endif
|
||||
}
|
37
libavcodec/riscv/llvidencdsp_rvv.S
Normal file
37
libavcodec/riscv/llvidencdsp_rvv.S
Normal file
@ -0,0 +1,37 @@
|
||||
/*
|
||||
* Copyright © 2023 Rémi Denis-Courmont.
|
||||
*
|
||||
* 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 "libavutil/riscv/asm.S"
|
||||
|
||||
func ff_llvidenc_diff_bytes_rvv, zve32x
|
||||
1:
|
||||
vsetvli t0, a3, e8, m8, ta, ma
|
||||
vle8.v v0, (a1)
|
||||
sub a3, a3, t0
|
||||
vle8.v v8, (a2)
|
||||
add a1, t0, a1
|
||||
vsub.vv v8, v0, v8
|
||||
add a2, t0, a2
|
||||
vse8.v v8, (a0)
|
||||
add a0, t0, a0
|
||||
bnez a3, 1b
|
||||
|
||||
ret
|
||||
endfunc
|
Loading…
Reference in New Issue
Block a user