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/2] lavc/mpegvideoencdsp: R-V V add_8x8basis
Date: Wed, 14 Aug 2024 20:18:56 +0300
Message-ID: <20240814171856.6360-2-remi@remlab.net> (raw)

T-Head C908:
add_8x8basis_c:      440.6
add_8x8basis_rvv_i32: 70.3

SpacemiT X60:
add_8x8basis_c:      436.3
add_8x8basis_rvv_i32: 40.5
---
 libavcodec/riscv/mpegvideoencdsp_init.c |  5 ++++-
 libavcodec/riscv/mpegvideoencdsp_rvv.S  | 19 +++++++++++++++++++
 2 files changed, 23 insertions(+), 1 deletion(-)

diff --git a/libavcodec/riscv/mpegvideoencdsp_init.c b/libavcodec/riscv/mpegvideoencdsp_init.c
index 4c156c1cf2..1ac808af16 100644
--- a/libavcodec/riscv/mpegvideoencdsp_init.c
+++ b/libavcodec/riscv/mpegvideoencdsp_init.c
@@ -25,6 +25,7 @@
 
 int ff_try_8x8basis_rvv(const int16_t rem[64], const int16_t weight[64],
                         const int16_t basis[16], int scale);
+void ff_add_8x8basis_rvv(int16_t rem[64], const int16_t basis[16], int scale);
 int ff_pix_sum_rvv(const uint8_t *pix, int line_size);
 int ff_pix_norm1_rvv(const uint8_t *pix, int line_size);
 
@@ -35,8 +36,10 @@ av_cold void ff_mpegvideoencdsp_init_riscv(MpegvideoEncDSPContext *c,
     int flags = av_get_cpu_flags();
 
     if (flags & AV_CPU_FLAG_RVV_I32) {
-        if (flags & AV_CPU_FLAG_RVB)
+        if (flags & AV_CPU_FLAG_RVB) {
             c->try_8x8basis = ff_try_8x8basis_rvv;
+            c->add_8x8basis = ff_add_8x8basis_rvv;
+        }
 
         if (flags & AV_CPU_FLAG_RVV_I64) {
             if ((flags & AV_CPU_FLAG_RVB) && ff_rv_vlen_least(128))
diff --git a/libavcodec/riscv/mpegvideoencdsp_rvv.S b/libavcodec/riscv/mpegvideoencdsp_rvv.S
index 9408de47c8..7c50526934 100644
--- a/libavcodec/riscv/mpegvideoencdsp_rvv.S
+++ b/libavcodec/riscv/mpegvideoencdsp_rvv.S
@@ -55,6 +55,25 @@ func ff_try_8x8basis_rvv, zve32x, b
         ret
 endfunc
 
+func ff_add_8x8basis_rvv, zve32x, b
+        li      t1, 64
+        csrwi   vxrm, 0
+1:
+        vsetvli     t0, t1, e16, m4, ta, ma
+        vle16.v     v4, (a1)
+        sub     t1, t1, t0
+        vwmul.vx    v16, v4, a2
+        sh1add  a1, t0, a1
+        vle16.v     v8, (a0)
+        vnclip.wi   v4, v16, BASIS_SHIFT - RECON_SHIFT
+        vadd.vv     v4, v8, v4
+        vse16.v     v4, (a0)
+        sh1add  a0, t0, a0
+        bnez    t1, 1b
+
+        ret
+endfunc
+
 func ff_pix_sum_rvv, zve64x, b
         lpad    0
         vsetivli    t0, 16, e16, m1, ta, ma
-- 
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-08-14 17:19 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=20240814171856.6360-2-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