Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: "Rémi Denis-Courmont" <remi@remlab.net>
To: ffmpeg-devel@ffmpeg.org
Subject: [FFmpeg-devel] [PATCH 2/3] lavc/vp7dsp: revector ff_vp7_dc_wht_rvv
Date: Sun, 26 May 2024 14:12:04 +0300
Message-ID: <20240526111205.21965-1-remi@remlab.net> (raw)
In-Reply-To: <20240526092823.16116-1-remi@remlab.net>

This prepares for some code reuse.
---
 libavcodec/riscv/vp7dsp_init.c |  3 ++-
 libavcodec/riscv/vp7dsp_rvv.S  | 23 ++++++++++++++---------
 2 files changed, 16 insertions(+), 10 deletions(-)

diff --git a/libavcodec/riscv/vp7dsp_init.c b/libavcodec/riscv/vp7dsp_init.c
index 5a57a39d0b..1406eb1c6a 100644
--- a/libavcodec/riscv/vp7dsp_init.c
+++ b/libavcodec/riscv/vp7dsp_init.c
@@ -32,7 +32,8 @@ av_cold void ff_vp7dsp_init_riscv(VP8DSPContext *c)
 #if HAVE_RVV
     int flags = av_get_cpu_flags();
 
-    if ((flags & AV_CPU_FLAG_RVV_I32) && ff_rv_vlen_least(128)) {
+    if ((flags & AV_CPU_FLAG_RVV_I32) && (flags & AV_CPU_FLAG_RVB_ADDR) &&
+        ff_rv_vlen_least(128)) {
 #if __riscv_xlen >= 64
         c->vp8_luma_dc_wht = ff_vp7_luma_dc_wht_rvv;
 #endif
diff --git a/libavcodec/riscv/vp7dsp_rvv.S b/libavcodec/riscv/vp7dsp_rvv.S
index 819d2056dc..06e251f5ce 100644
--- a/libavcodec/riscv/vp7dsp_rvv.S
+++ b/libavcodec/riscv/vp7dsp_rvv.S
@@ -22,6 +22,15 @@
 
 #if __riscv_xlen >= 64
 func ff_vp7_luma_dc_wht_rvv, zve32x
+        li          a2, 4 * 16 * 2
+        li          a7, 16 * 2
+        jal         t0, 1f
+        vsse16.v    v4, (a0), a7
+        vsse16.v    v5, (t1), a7
+        vsse16.v    v6, (t2), a7
+        vsse16.v    v7, (t3), a7
+        ret
+1:
         csrwi       vxrm, 0
         li          t4, 12540
         vsetivli    zero, 4, e16, mf2, ta, ma
@@ -58,14 +67,14 @@ func ff_vp7_luma_dc_wht_rvv, zve32x
         vle16.v     v2, (t2)
         vle16.v     v3, (t3)
         vwmul.vx    v8, v1, t4
-        li          t0, 16 * 2
         vwmul.vx    v9, v3, t6
-        addi        t1, a0, 1 * 4 * 16 * 2
+        add         t1, a2, a0
         vwmul.vx    v10, v1, t6
-        addi        t2, a0, 2 * 4 * 16 * 2
+        sh1add      t2, a2, a0
         vwmul.vx    v11, v3, t4
-        addi        t3, a0, 3 * 4 * 16 * 2
+        sh1add      a2, a2, a2 # a2 *= 3
         vwadd.vv    v4, v0, v2
+        add         t3, a2, a0
         vwsub.vv    v5, v0, v2
         vsetvli     zero, zero, e32, m1, ta, ma
         vmul.vx     v4, v4, t5
@@ -86,10 +95,6 @@ func ff_vp7_luma_dc_wht_rvv, zve32x
         vnclip.wi   v5, v1, 18
         vnclip.wi   v6, v2, 18
         vnclip.wi   v7, v3, 18
-        vsse16.v    v4, (a0), t0
-        vsse16.v    v5, (t1), t0
-        vsse16.v    v6, (t2), t0
-        vsse16.v    v7, (t3), t0
-        ret
+        jr          t0
 endfunc
 #endif
-- 
2.45.1

_______________________________________________
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".

  reply	other threads:[~2024-05-26 11:12 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-26  9:28 [FFmpeg-devel] [PATCH] lavc/vp7dsp: add R-V V vp7_luma_dc_wht Rémi Denis-Courmont
2024-05-26 11:12 ` Rémi Denis-Courmont [this message]
2024-05-26 11:12   ` [FFmpeg-devel] [PATCH 3/3] lavc/vp7dsp: R-V V vp7_idct_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=20240526111205.21965-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