From: "Rémi Denis-Courmont" <remi@remlab.net> To: ffmpeg-devel@ffmpeg.org Subject: [FFmpeg-devel] [PATCH 1/2] lavu/fixed_dsp: R-V V scalarproduct Date: Tue, 3 Oct 2023 23:12:01 +0300 Message-ID: <20231003201202.121744-1-remi@remlab.net> (raw) --- libavutil/riscv/fixed_dsp_init.c | 6 +++++- libavutil/riscv/fixed_dsp_rvv.S | 22 ++++++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/libavutil/riscv/fixed_dsp_init.c b/libavutil/riscv/fixed_dsp_init.c index d4ca2e2064..409b6d7b55 100644 --- a/libavutil/riscv/fixed_dsp_init.c +++ b/libavutil/riscv/fixed_dsp_init.c @@ -25,6 +25,7 @@ #include "libavutil/cpu.h" #include "libavutil/fixed_dsp.h" +int ff_scalarproduct_fixed_rvv(const int *v1, const int *v2, int len); void ff_butterflies_fixed_rvv(int *v1, int *v2, int len); av_cold void ff_fixed_dsp_init_riscv(AVFixedDSPContext *fdsp) @@ -32,7 +33,10 @@ av_cold void ff_fixed_dsp_init_riscv(AVFixedDSPContext *fdsp) #if HAVE_RVV int flags = av_get_cpu_flags(); - if ((flags & AV_CPU_FLAG_RVV_I32) && (flags & AV_CPU_FLAG_RVB_ADDR)) + if ((flags & AV_CPU_FLAG_RVV_I32) && (flags & AV_CPU_FLAG_RVB_ADDR)) { + if (flags & AV_CPU_FLAG_RVV_I64) + fdsp->scalarproduct_fixed = ff_scalarproduct_fixed_rvv; fdsp->butterflies_fixed = ff_butterflies_fixed_rvv; + } #endif } diff --git a/libavutil/riscv/fixed_dsp_rvv.S b/libavutil/riscv/fixed_dsp_rvv.S index 6e13395294..83cad4bde3 100644 --- a/libavutil/riscv/fixed_dsp_rvv.S +++ b/libavutil/riscv/fixed_dsp_rvv.S @@ -20,6 +20,28 @@ #include "asm.S" +func ff_scalarproduct_fixed_rvv, zve64x + li t1, 1 << 30 + vsetvli t0, zero, e64, m8, ta, ma + vmv.v.x v8, zero + vmv.s.x v0, t1 +1: + vsetvli t0, a2, e32, m4, tu, ma + vle32.v v16, (a0) + sub a2, a2, t0 + vle32.v v20, (a1) + sh2add a0, t0, a0 + vwmacc.vv v8, v16, v20 + sh2add a1, t0, a1 + bnez a2, 1b + + vsetvli t0, zero, e64, m8, ta, ma + vredsum.vs v0, v8, v0 + vmv.x.s a0, v0 + srai a0, a0, 31 + ret +endfunc + // (a0) = (a0) + (a1), (a1) = (a0) - (a1) [0..a2-1] func ff_butterflies_fixed_rvv, zve32x 1: -- 2.42.0 _______________________________________________ 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:[~2023-10-03 20:12 UTC|newest] Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-10-03 20:12 Rémi Denis-Courmont [this message] 2023-10-03 20:12 ` [FFmpeg-devel] [PATCH 2/2] lavu/fixed_dsp: R-V V vector_fmul_add Rémi Denis-Courmont
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=20231003201202.121744-1-remi@remlab.net \ --to=remi@remlab.net \ --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