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] lavc/h264dsp: stick R-V V biweight to 16-bit
Date: Mon, 29 Jul 2024 21:45:37 +0300
Message-ID: <20240729184537.108950-1-remi@remlab.net> (raw)

T-Head C908 (ns):
h264_biweight2_8_c:        2414.5
h264_biweight2_8_rvv_i32:   701.8 (before)
h264_biweight2_8_rvv_i32:   562.8 (after)
h264_biweight4_8_c:        4655.3
h264_biweight4_8_rvv_i32:  1377.5 (before)
h264_biweight4_8_rvv_i32:  1109.0 (after)
h264_biweight8_8_c:        9701.5
h264_biweight8_8_rvv_i32:  2896.0 (before)
h264_biweight8_8_rvv_i32:  2340.5 (after)
h264_biweight16_8_c:      18025.0
h264_biweight16_8_rvv_i32: 3460.8 (before)
h264_biweight16_8_rvv_i32: 3146.0 (after)

SpacemiT X60 (ns):
h264_biweight2_8_c:        2415.5
h264_biweight2_8_rvv_i32:   478.2 (before)
h264_biweight2_8_rvv_i32:   405.0 (after)
h264_biweight4_8_c:        4655.3
h264_biweight4_8_rvv_i32:   946.7 (before)
h264_biweight4_8_rvv_i32:   811.5 (after)
h264_biweight8_8_c:        9061.8
h264_biweight8_8_rvv_i32:  2071.7 (before)
h264_biweight8_8_rvv_i32:  1811.3 (after)
h264_biweight16_8_c:      18020.5
h264_biweight16_8_rvv_i32: 3457.2 (before)
h264_biweight16_8_rvv_i32: 2499.0 (after)
---
 libavcodec/riscv/h264dsp_rvv.S | 32 +++++++++++++++-----------------
 1 file changed, 15 insertions(+), 17 deletions(-)

diff --git a/libavcodec/riscv/h264dsp_rvv.S b/libavcodec/riscv/h264dsp_rvv.S
index a38bf7ef1d..46392c92a5 100644
--- a/libavcodec/riscv/h264dsp_rvv.S
+++ b/libavcodec/riscv/h264dsp_rvv.S
@@ -56,22 +56,21 @@ func ff_h264_biweight_pixels_simple_8_rvv, zve32x
         addi    a7, a7, 1
         ori     a7, a7, 1
         sll     a7, a7, a4
+        addi    a4, a4, 1
 1:
-        vsetvli zero, t6, e32, m4, ta, ma
+        vsetvli zero, t6, e16, m2, ta, ma
         vle8.v  v8, (a0)
         addi    a3, a3, -1
         vle8.v  v12, (a1)
         add     a1, a1, a2
         vmv.v.x v16, a7
-        vsetvli zero, zero, e16, m2, ta, ma
         vzext.vf2   v24, v8
         vzext.vf2   v28, v12
-        vwmaccsu.vx v16, a5, v24
-        vwmaccsu.vx v16, a6, v28
-        vnclip.wx   v16, v16, a4
+        vmacc.vx    v16, a5, v24
+        vmacc.vx    v16, a6, v28
         vmax.vx v16, v16, zero
         vsetvli zero, zero, e8, m1, ta, ma
-        vnclipu.wi  v8, v16, 1
+        vnclipu.wx  v8, v16, a4
         vse8.v  v8, (a0)
         add     a0, a0, a2
         bnez    a3, 1b
@@ -121,12 +120,13 @@ func ff_h264_biweight_pixels_8_rvv, zve32x
         addi    a7, a7, 1
         ori     a7, a7, 1
         sll     a7, a7, a4
+        addi    a4, a4, 1
 1:
         mv      t0, a0
         mv      t1, a1
         mv      t5, t6
 2:
-        vsetvli t2, a3, e32, m8, ta, ma
+        vsetvli t2, a3, e16, m4, ta, ma
         vlsseg2e8.v v0, (t0), a2
         vlsseg2e8.v v4, (t1), a2
         addi    t5, t5, -2
@@ -135,19 +135,17 @@ func ff_h264_biweight_pixels_8_rvv, zve32x
         vsetvli zero, zero, e16, m4, ta, ma
         vzext.vf2   v8, v0
         vzext.vf2   v12, v2
-        vwmaccsu.vx v16, a5, v8
-        vwmaccsu.vx v24, a5, v12
+        vmacc.vx    v16, a5, v8
+        vmacc.vx    v24, a5, v12
         vzext.vf2   v8, v4
         vzext.vf2   v12, v6
-        vwmaccsu.vx v16, a6, v8
-        vwmaccsu.vx v24, a6, v12
-        vnclip.wx   v8, v16, a4
-        vnclip.wx   v12, v24, a4
-        vmax.vx v8, v8, zero
-        vmax.vx v12, v12, zero
+        vmacc.vx    v16, a6, v8
+        vmacc.vx    v24, a6, v12
+        vmax.vx     v8, v16, zero
+        vmax.vx     v12, v24, zero
         vsetvli zero, zero, e8, m2, ta, ma
-        vnclipu.wi  v0, v8, 1
-        vnclipu.wi  v2, v12, 1
+        vnclipu.wx  v0, v8, a4
+        vnclipu.wx  v2, v12, a4
         vssseg2e8.v v0, (t0), a2
         addi    t0, t0, 2
         addi    t1, t1, 2
-- 
2.45.2

_______________________________________________
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-07-29 18:45 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20240729184537.108950-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