From: "Rémi Denis-Courmont" <remi@remlab.net> To: ffmpeg-devel@ffmpeg.org Subject: [FFmpeg-devel] [PATCH] lavc/vp8dsp: R-V V vp8_luma_dc_wht Date: Sun, 26 May 2024 10:29:02 +0300 Message-ID: <20240526072902.10274-1-remi@remlab.net> (raw) This is not great as transposition is poorly supported, but it works: vp8_luma_dc_wht_c: 2.5 vp8_luma_dc_wht_rvv_i32: 1.7 --- libavcodec/riscv/vp8dsp_init.c | 2 ++ libavcodec/riscv/vp8dsp_rvv.S | 55 ++++++++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+) diff --git a/libavcodec/riscv/vp8dsp_init.c b/libavcodec/riscv/vp8dsp_init.c index 2413fbf449..d48fe08560 100644 --- a/libavcodec/riscv/vp8dsp_init.c +++ b/libavcodec/riscv/vp8dsp_init.c @@ -26,6 +26,7 @@ #include "libavcodec/vp8dsp.h" #include "vp8dsp.h" +void ff_vp8_luma_dc_wht_rvv(int16_t block[4][4][16], int16_t dc[16]); void ff_vp8_idct_dc_add_rvv(uint8_t *dst, int16_t block[16], ptrdiff_t stride); void ff_vp8_idct_dc_add4y_rvv(uint8_t *dst, int16_t block[4][16], ptrdiff_t stride); void ff_vp8_idct_dc_add4uv_rvv(uint8_t *dst, int16_t block[4][16], ptrdiff_t stride); @@ -110,6 +111,7 @@ av_cold void ff_vp8dsp_init_riscv(VP8DSPContext *c) int flags = av_get_cpu_flags(); if (flags & AV_CPU_FLAG_RVV_I32 && ff_rv_vlen_least(128)) { + c->vp8_luma_dc_wht = ff_vp8_luma_dc_wht_rvv; c->vp8_idct_dc_add = ff_vp8_idct_dc_add_rvv; c->vp8_idct_dc_add4y = ff_vp8_idct_dc_add4y_rvv; if (flags & AV_CPU_FLAG_RVB_ADDR) { diff --git a/libavcodec/riscv/vp8dsp_rvv.S b/libavcodec/riscv/vp8dsp_rvv.S index 21c8985b04..f57852c82b 100644 --- a/libavcodec/riscv/vp8dsp_rvv.S +++ b/libavcodec/riscv/vp8dsp_rvv.S @@ -32,6 +32,61 @@ .endif .endm +#if __riscv_xlen >= 64 +func ff_vp8_luma_dc_wht_rvv, zve64x + vsetivli zero, 1, e64, m1, ta, ma + vlseg4e64.v v4, (a1) + vsetivli zero, 4, e16, mf2, ta, ma + vwadd.vv v1, v5, v6 + addi t1, sp, -48 + vwadd.vv v0, v4, v7 + addi t2, sp, -32 + vwsub.vv v2, v5, v6 + addi t3, sp, -16 + vwsub.vv v3, v4, v7 + addi sp, sp, -64 + vsetvli zero, zero, e32, m1, ta, ma + vadd.vv v4, v0, v1 + vadd.vv v5, v3, v2 + vse32.v v4, (sp) + vsub.vv v6, v0, v1 + vse32.v v5, (t1) + vsub.vv v7, v3, v2 + vse32.v v6, (t2) + vse32.v v7, (t3) + vlseg4e32.v v4, (sp) + vadd.vv v0, v4, v7 + sd zero, (a1) + vadd.vv v1, v5, v6 + sd zero, 8(a1) + vsub.vv v2, v5, v6 + sd zero, 16(a1) + vsub.vv v3, v4, v7 + sd zero, 24(a1) + vadd.vi v0, v0, 3 # rounding mode not supported, do it manually + li t0, 4 * 16 * 2 + vadd.vi v3, v3, 3 + addi t1, a0, 16 * 2 + vadd.vv v4, v0, v1 + addi t2, a0, 16 * 2 * 2 + vadd.vv v5, v3, v2 + addi t3, a0, 16 * 2 * 3 + vsub.vv v6, v0, v1 + vsub.vv v7, v3, v2 + vsetvli zero, zero, e16, mf2, ta, ma + vnsra.wi v0, v4, 3 + addi sp, sp, 64 + vnsra.wi v1, v5, 3 + vsse16.v v0, (a0), t0 + vnsra.wi v2, v6, 3 + vsse16.v v1, (t1), t0 + vnsra.wi v3, v7, 3 + vsse16.v v2, (t2), t0 + vsse16.v v3, (t3), t0 + ret +endfunc +#endif + .macro vp8_idct_dc_add vlse32.v v0, (a0), a2 lh a5, 0(a1) -- 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".
next reply other threads:[~2024-05-26 7:29 UTC|newest] Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top 2024-05-26 7:29 Rémi Denis-Courmont [this message] 2024-05-26 7:30 ` 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=20240526072902.10274-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