From: "Rémi Denis-Courmont" <remi@remlab.net> To: ffmpeg-devel@ffmpeg.org Subject: [FFmpeg-devel] [PATCH 1/3] lavc/vc1dsp: factor R-V V inv_trans_8 code Date: Thu, 27 Jun 2024 22:04:33 +0300 Message-ID: <20240627190435.12159-1-remi@remlab.net> (raw) --- libavcodec/riscv/vc1dsp_rvv.S | 64 +++++++++++++---------------------- 1 file changed, 23 insertions(+), 41 deletions(-) diff --git a/libavcodec/riscv/vc1dsp_rvv.S b/libavcodec/riscv/vc1dsp_rvv.S index 7e1fb84b0c..b3a1f55ab9 100644 --- a/libavcodec/riscv/vc1dsp_rvv.S +++ b/libavcodec/riscv/vc1dsp_rvv.S @@ -165,6 +165,7 @@ func ff_vc1_inv_trans_8_rvv, zve32x vsll.vi v23, v7, 4 vsub.vv v20, v20, v21 vsub.vv v22, v22, v23 + srli t2, t1, 2 vadd.vv v0, v28, v16 vadd.vv v19, v20, v22 # t4 vadd.vv v1, v29, v17 @@ -174,6 +175,14 @@ func ff_vc1_inv_trans_8_rvv, zve32x vsub.vv v5, v30, v18 vsub.vv v6, v29, v17 vsub.vv v7, v28, v16 + beqz t2, 1f # faster than 4x add t2=zero + .irp n,4,5,6,7 + vadd.vi v\n, v\n, 1 + .endr +1: + .irp n,0,1,2,3,4,5,6,7 + vssra.vx v\n, v\n, t1 + .endr jr t0 endfunc @@ -220,35 +229,22 @@ func ff_vc1_inv_trans_8x8_rvv, zve32x addi a7, a0, 7 * 8 * 2 vle16.v v6, (a6) vle16.v v7, (a7) + li t1, 3 jal t0, ff_vc1_inv_trans_8_rvv - .irp n,0,1,2,3,4,5,6,7 - vssra.vi v\n, v\n, 3 - .endr vsseg8e16.v v0, (a0) .irp n,0,1,2,3,4,5,6,7 vle16.v v\n, (a\n) .endr + li t1, 7 jal t0, ff_vc1_inv_trans_8_rvv - vadd.vi v4, v4, 1 - vadd.vi v5, v5, 1 - vssra.vi v4, v4, 7 - vssra.vi v5, v5, 7 - vse16.v v4, (a4) - vadd.vi v6, v6, 1 - vse16.v v5, (a5) - vadd.vi v7, v7, 1 - vssra.vi v6, v6, 7 - vssra.vi v7, v7, 7 - vse16.v v6, (a6) - vssra.vi v0, v0, 7 - vse16.v v7, (a7) - vssra.vi v1, v1, 7 vse16.v v0, (a0) - vssra.vi v2, v2, 7 vse16.v v1, (a1) - vssra.vi v3, v3, 7 vse16.v v2, (a2) vse16.v v3, (a3) + vse16.v v4, (a4) + vse16.v v5, (a5) + vse16.v v6, (a6) + vse16.v v7, (a7) ret endfunc @@ -256,10 +252,8 @@ func ff_vc1_inv_trans_8x4_rvv, zve32x csrwi vxrm, 0 vsetivli zero, 4, e16, mf2, ta, ma vlseg8e16.v v0, (a2) + li t1, 3 jal t0, ff_vc1_inv_trans_8_rvv - .irp n,0,1,2,3,4,5,6,7 - vssra.vi v\n, v\n, 3 - .endr vsseg8e16.v v0, (a2) addi a3, a2, 1 * 8 * 2 vsetivli zero, 8, e16, m1, ta, ma @@ -323,33 +317,21 @@ func ff_vc1_inv_trans_4x8_rvv, zve32x addi t1, a2, 7 * 8 * 2 vle16.v v6, (t6) vle16.v v7, (t1) - + li t1, 7 jal t0, ff_vc1_inv_trans_8_rvv - vadd.vi v4, v4, 1 add t0, a1, a0 - vadd.vi v5, v5, 1 - vadd.vi v6, v6, 1 - add t1, a1, t0 - vadd.vi v7, v7, 1 - vssra.vi v0, v0, 7 - add t2, a1, t1 - vssra.vi v1, v1, 7 - vssra.vi v2, v2, 7 - add t3, a1, t2 - vssra.vi v3, v3, 7 - vssra.vi v4, v4, 7 - add t4, a1, t3 - vssra.vi v5, v5, 7 - vssra.vi v6, v6, 7 - add t5, a1, t4 - vssra.vi v7, v7, 7 vle8.v v8, (a0) - add t6, a1, t5 + add t1, a1, t0 vle8.v v9, (t0) + add t2, a1, t1 vle8.v v10, (t1) + add t3, a1, t2 vle8.v v11, (t2) + add t4, a1, t3 vle8.v v12, (t3) + add t5, a1, t4 vle8.v v13, (t4) + add t6, a1, t5 vle8.v v14, (t5) vle8.v v15, (t6) vsetvli zero, zero, e8, mf4, 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".
next reply other threads:[~2024-06-27 19:04 UTC|newest] Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top 2024-06-27 19:04 Rémi Denis-Courmont [this message] 2024-06-27 19:04 ` [FFmpeg-devel] [PATCH 2/3] lavc/vc1dsp: fix overflow in R-V V inv_trans_8 Rémi Denis-Courmont 2024-06-27 19:04 ` [FFmpeg-devel] [PATCH 3/3] lavc/vc1dsp: fix potential overflow in R-V V inv_trans_4 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=20240627190435.12159-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