From: "Rémi Denis-Courmont" <remi@remlab.net>
To: ffmpeg-devel@ffmpeg.org
Subject: [FFmpeg-devel] [PATCH 3/3] lavc/h264dsp: R-V V 8-bit h264_idct8_add4
Date: Tue, 2 Jul 2024 20:13:35 +0300
Message-ID: <20240702171336.26390-3-remi@remlab.net> (raw)
In-Reply-To: <20240702171336.26390-1-remi@remlab.net>
---
libavcodec/riscv/h264dsp_init.c | 4 ++
libavcodec/riscv/h264idct_rvv.S | 70 +++++++++++++++++++++++++++++++++
2 files changed, 74 insertions(+)
diff --git a/libavcodec/riscv/h264dsp_init.c b/libavcodec/riscv/h264dsp_init.c
index 7badb86e87..5cf75f280e 100644
--- a/libavcodec/riscv/h264dsp_init.c
+++ b/libavcodec/riscv/h264dsp_init.c
@@ -40,6 +40,9 @@ void ff_h264_idct_add16_8_rvv(uint8_t *dst, const int *blockoffset,
void ff_h264_idct_add16intra_8_rvv(uint8_t *dst, const int *blockoffset,
int16_t *block, int stride,
const uint8_t nnzc[5 * 8]);
+void ff_h264_idct8_add4_8_rvv(uint8_t *dst, const int *blockoffset,
+ int16_t *block, int stride,
+ const uint8_t nnzc[5 * 8]);
extern int ff_startcode_find_candidate_rvb(const uint8_t *, int);
extern int ff_startcode_find_candidate_rvv(const uint8_t *, int);
@@ -62,6 +65,7 @@ av_cold void ff_h264dsp_init_riscv(H264DSPContext *dsp, const int bit_depth,
dsp->h264_idct_add16 = ff_h264_idct_add16_8_rvv;
dsp->h264_idct_add16intra = ff_h264_idct_add16intra_8_rvv;
+ dsp->h264_idct8_add4 = ff_h264_idct8_add4_8_rvv;
}
dsp->startcode_find_candidate = ff_startcode_find_candidate_rvv;
}
diff --git a/libavcodec/riscv/h264idct_rvv.S b/libavcodec/riscv/h264idct_rvv.S
index 42a29ba336..7422942717 100644
--- a/libavcodec/riscv/h264idct_rvv.S
+++ b/libavcodec/riscv/h264idct_rvv.S
@@ -170,5 +170,75 @@ func ff_h264_idct_add16intra_\depth\()_rvv, zve32x
addi sp, sp, 80
ret
endfunc
+
+func ff_h264_idct8_add4_\depth\()_rvv, zve32x
+ addi sp, sp, -80
+ lla t0, ff_h264_scan8
+ sd s0, (sp)
+ li t1, 4 * 32 << (\depth > 8)
+ mv s0, sp
+ li t2, 4
+ sd ra, 8(sp)
+ sd s1, 16(sp)
+ sd s2, 24(sp)
+ sd s3, 32(sp)
+ sd s4, 40(sp)
+ sd s5, 48(sp)
+ sd s6, 56(sp)
+ sd s7, 64(sp)
+ vsetivli zero, 4, e8, mf4, ta, ma
+ vlse8.v v8, (t0), t2
+ vlse16.v v16, (a2), t1
+ vluxei8.v v12, (a4), v8
+.if \depth == 8
+ vsetvli zero, zero, e16, mf2, ta, ma
+.else
+ vsetvli zero, zero, e32, m1, ta, ma
+.endif
+ vmsne.vi v1, v16, 0
+ vsetvli zero, zero, e8, mf4, ta, ma
+ vmseq.vi v2, v12, 1
+ vmsne.vi v0, v12, 0
+ vmand.mm v1, v1, v2
+ vmv.x.s s2, v0
+ vmv.x.s s3, v1
+ li s1, 4
+ mv s4, a0
+ mv s5, a1
+ mv s6, a2
+ mv s7, a3
+1:
+ andi t0, s2, 1
+ addi s1, s1, -1
+ srli s2, s2, 1
+ beqz t0, 3f # if (nnz)
+ lw t2, (s5) # block_offset[i]
+ andi t1, s3, 1
+ mv a1, s6
+ mv a2, s7
+ add a0, s4, t2
+ beqz t1, 2f # if (nnz == 1 && block[i * 16])
+ call ff_h264_idct8_dc_add_\depth\()_c
+ j 3f
+2:
+ call ff_h264_idct8_add_\depth\()_c
+3:
+ srli s3, s3, 1
+ addi s5, s5, 4 * 4
+ addi s6, s6, 4 * 16 * 2 << (\depth > 8)
+ bnez s1, 1b
+
+ ld s7, 64(sp)
+ ld s6, 56(sp)
+ ld s5, 48(sp)
+ ld s4, 40(sp)
+ ld s3, 32(sp)
+ ld s2, 24(sp)
+ ld s1, 16(sp)
+ ld ra, 8(sp)
+ ld s0, 0(sp)
+ addi sp, sp, 80
+ ret
+endfunc
.endr
#endif
--
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 prev parent reply other threads:[~2024-07-02 17:14 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-02 17:13 [FFmpeg-devel] [PATCH 1/3] lavc/h264dsp: R-V V 8-bit h264_idct_add16 Rémi Denis-Courmont
2024-07-02 17:13 ` [FFmpeg-devel] [PATCH 2/3] lavc/h264dsp: R-V V 8-bit h264_idct_add16intra Rémi Denis-Courmont
2024-07-02 17:13 ` Rémi Denis-Courmont [this message]
2024-07-02 17:27 ` [FFmpeg-devel] [PATCH 1/3] lavc/h264dsp: R-V V 8-bit h264_idct_add16 Rémi Denis-Courmont
2024-07-02 19:22 ` [FFmpeg-devel] [PATCH 4/4] lavc/h264dsp: R-V V 8-bit h264_idct_add Rémi Denis-Courmont
2024-07-03 17:09 ` [FFmpeg-devel] [PATCH 5/5] lavc/h264dsp: R-V V 8-bit h264_idct8_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=20240702171336.26390-3-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