From: flow gg <hlefthleft@gmail.com> To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org> Subject: [FFmpeg-devel] [PATCH 1/3] lavc/vp9dsp: R-V V ipred vert Date: Tue, 27 Feb 2024 00:19:14 +0800 Message-ID: <CAEa-L+vdzMewd=S6tyc-3mR7TPLW6PXu5QgNRaPbqu9qAKQsuA@mail.gmail.com> (raw) [-- Attachment #1: Type: text/plain, Size: 1 bytes --] [-- Attachment #2: 0001-lavc-vp9dsp-R-V-V-ipred-vert.patch --] [-- Type: text/x-patch, Size: 5816 bytes --] From 54d784dfd5d0d04456164f250766a3620d42c8c2 Mon Sep 17 00:00:00 2001 From: sunyuechi <sunyuechi@iscas.ac.cn> Date: Mon, 26 Feb 2024 14:42:17 +0800 Subject: [PATCH 1/3] lavc/vp9dsp: R-V V ipred vert C908 vp9_vert_16x16_8bpp_c: 80.2 vp9_vert_16x16_8bpp_rvv_i32: 55.7 vp9_vert_32x32_8bpp_c: 308.2 vp9_vert_32x32_8bpp_rvv_i32: 141.7 --- libavcodec/riscv/Makefile | 2 ++ libavcodec/riscv/vp9dsp_init.c | 41 +++++++++++++++++++++++++++++ libavcodec/riscv/vp9dsp_rvv.S | 47 ++++++++++++++++++++++++++++++++++ libavcodec/vp9dsp.c | 2 ++ libavcodec/vp9dsp.h | 1 + 5 files changed, 93 insertions(+) create mode 100644 libavcodec/riscv/vp9dsp_init.c create mode 100644 libavcodec/riscv/vp9dsp_rvv.S diff --git a/libavcodec/riscv/Makefile b/libavcodec/riscv/Makefile index dff8784102..6ad1819252 100644 --- a/libavcodec/riscv/Makefile +++ b/libavcodec/riscv/Makefile @@ -60,5 +60,7 @@ OBJS-$(CONFIG_VC1DSP) += riscv/vc1dsp_init.o RVV-OBJS-$(CONFIG_VC1DSP) += riscv/vc1dsp_rvv.o OBJS-$(CONFIG_VP8DSP) += riscv/vp8dsp_init.o RVV-OBJS-$(CONFIG_VP8DSP) += riscv/vp8dsp_rvv.o +OBJS-$(CONFIG_VP9_DECODER) += riscv/vp9dsp_init.o +RVV-OBJS-$(CONFIG_VP9_DECODER) += riscv/vp9dsp_rvv.o OBJS-$(CONFIG_VORBIS_DECODER) += riscv/vorbisdsp_init.o RVV-OBJS-$(CONFIG_VORBIS_DECODER) += riscv/vorbisdsp_rvv.o diff --git a/libavcodec/riscv/vp9dsp_init.c b/libavcodec/riscv/vp9dsp_init.c new file mode 100644 index 0000000000..58db936f31 --- /dev/null +++ b/libavcodec/riscv/vp9dsp_init.c @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2024 Institue of Software Chinese Academy of Sciences (ISCAS). + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lervvr 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 + * Lervvr General Public License for more details. + * + * You should have received a copy of the GNU Lervvr 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/attributes.h" +#include "libavutil/cpu.h" +#include "libavutil/riscv/cpu.h" +#include "libavcodec/vp9dsp.h" + +void ff_vp9_ipred_v_32x32_rvv(uint8_t *dst, ptrdiff_t stride, const uint8_t *l, const uint8_t *a); +void ff_vp9_ipred_v_16x16_rvv(uint8_t *dst, ptrdiff_t stride, const uint8_t *l, const uint8_t *a); + +av_cold void ff_vp9dsp_init_riscv(VP9DSPContext *dsp, int bpp, int bitexact) +{ + #if HAVE_RVV + int flags = av_get_cpu_flags(); + + if (flags & AV_CPU_FLAG_RVV_I32) { + if (bpp == 8) { + dsp->intra_pred[TX_32X32][VERT_PRED] = ff_vp9_ipred_v_32x32_rvv; + dsp->intra_pred[TX_16X16][VERT_PRED] = ff_vp9_ipred_v_16x16_rvv; + } + } + #endif +} diff --git a/libavcodec/riscv/vp9dsp_rvv.S b/libavcodec/riscv/vp9dsp_rvv.S new file mode 100644 index 0000000000..0645567f1b --- /dev/null +++ b/libavcodec/riscv/vp9dsp_rvv.S @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2024 Institue of Software Chinese Academy of Sciences (ISCAS). + * + * 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_vp9_ipred_v_32x32_rvv, zve32x + vsetivli zero, 8, e8, mf2, ta, ma + vle32.v v8, (a3) + + .rept 31 + vse32.v v8, (a0) + add a0, a0, a1 + .endr + vse32.v v8, (a0) + + ret +endfunc + +func ff_vp9_ipred_v_16x16_rvv, zve32x + vsetivli zero, 4, e8, mf4, ta, ma + vle32.v v8, (a3) + + .rept 15 + vse32.v v8, (a0) + add a0, a0, a1 + .endr + vse32.v v8, (a0) + + ret +endfunc diff --git a/libavcodec/vp9dsp.c b/libavcodec/vp9dsp.c index d8ddf74d4f..967e6e1e1a 100644 --- a/libavcodec/vp9dsp.c +++ b/libavcodec/vp9dsp.c @@ -100,6 +100,8 @@ av_cold void ff_vp9dsp_init(VP9DSPContext *dsp, int bpp, int bitexact) ff_vp9dsp_init_aarch64(dsp, bpp); #elif ARCH_ARM ff_vp9dsp_init_arm(dsp, bpp); +#elif ARCH_RISCV + ff_vp9dsp_init_riscv(dsp, bpp, bitexact); #elif ARCH_X86 ff_vp9dsp_init_x86(dsp, bpp, bitexact); #elif ARCH_MIPS diff --git a/libavcodec/vp9dsp.h b/libavcodec/vp9dsp.h index be0ac0b181..772848e349 100644 --- a/libavcodec/vp9dsp.h +++ b/libavcodec/vp9dsp.h @@ -131,6 +131,7 @@ void ff_vp9dsp_init_12(VP9DSPContext *dsp); void ff_vp9dsp_init_aarch64(VP9DSPContext *dsp, int bpp); void ff_vp9dsp_init_arm(VP9DSPContext *dsp, int bpp); +void ff_vp9dsp_init_riscv(VP9DSPContext *dsp, int bpp, int bitexact); void ff_vp9dsp_init_x86(VP9DSPContext *dsp, int bpp, int bitexact); void ff_vp9dsp_init_mips(VP9DSPContext *dsp, int bpp); void ff_vp9dsp_init_loongarch(VP9DSPContext *dsp, int bpp); -- 2.44.0 [-- Attachment #3: Type: text/plain, Size: 251 bytes --] _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
next reply other threads:[~2024-02-26 16:19 UTC|newest] Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top 2024-02-26 16:19 flow gg [this message] 2024-02-28 17:19 ` flow gg 2024-03-02 7:41 ` flow gg
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to='CAEa-L+vdzMewd=S6tyc-3mR7TPLW6PXu5QgNRaPbqu9qAKQsuA@mail.gmail.com' \ --to=hlefthleft@gmail.com \ --cc=ffmpeg-devel@ffmpeg.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel This inbox may be cloned and mirrored by anyone: git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \ ffmpegdev@gitmailbox.com public-inbox-index ffmpegdev Example config snippet for mirrors. AGPL code for this site: git clone https://public-inbox.org/public-inbox.git