[FFmpeg-cvslog] lavc/h264dsp: R-V V 8-bit MBAFF loop filter

Rémi Denis-Courmont git at videolan.org
Thu Jul 4 19:58:46 EEST 2024


ffmpeg | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun Jun 30 11:24:43 2024 +0300| [e2af5904f0fa86dbb2b7755ab579f54d14523e8e] | committer: Rémi Denis-Courmont

lavc/h264dsp: R-V V 8-bit MBAFF loop filter

Performance is (unfortunately) the same as with non-MBAFF, since the
hardware under test does not short-circuit vector tail calculations.
(IMO, a generic solution or work-around should be agreed on, rather
than bespoke approaches all over the place.)

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e2af5904f0fa86dbb2b7755ab579f54d14523e8e
---

 libavcodec/riscv/h264dsp_init.c |  4 ++++
 libavcodec/riscv/h264dsp_rvv.S  | 14 ++++++++++++++
 2 files changed, 18 insertions(+)

diff --git a/libavcodec/riscv/h264dsp_init.c b/libavcodec/riscv/h264dsp_init.c
index 0d4d541992..ab412a9924 100644
--- a/libavcodec/riscv/h264dsp_init.c
+++ b/libavcodec/riscv/h264dsp_init.c
@@ -31,6 +31,8 @@ void ff_h264_v_loop_filter_luma_8_rvv(uint8_t *pix, ptrdiff_t stride,
                                       int alpha, int beta, int8_t *tc0);
 void ff_h264_h_loop_filter_luma_8_rvv(uint8_t *pix, ptrdiff_t stride,
                                       int alpha, int beta, int8_t *tc0);
+void ff_h264_h_loop_filter_luma_mbaff_8_rvv(uint8_t *pix, ptrdiff_t stride,
+                                            int alpha, int beta, int8_t *tc0);
 
 extern int ff_startcode_find_candidate_rvb(const uint8_t *, int);
 extern int ff_startcode_find_candidate_rvv(const uint8_t *, int);
@@ -48,6 +50,8 @@ av_cold void ff_h264dsp_init_riscv(H264DSPContext *dsp, const int bit_depth,
         if (bit_depth == 8 && ff_rv_vlen_least(128)) {
             dsp->h264_v_loop_filter_luma = ff_h264_v_loop_filter_luma_8_rvv;
             dsp->h264_h_loop_filter_luma = ff_h264_h_loop_filter_luma_8_rvv;
+            dsp->h264_h_loop_filter_luma_mbaff =
+                ff_h264_h_loop_filter_luma_mbaff_8_rvv;
         }
         dsp->startcode_find_candidate = ff_startcode_find_candidate_rvv;
     }
diff --git a/libavcodec/riscv/h264dsp_rvv.S b/libavcodec/riscv/h264dsp_rvv.S
index 77bf40db1f..96a8a0a8a3 100644
--- a/libavcodec/riscv/h264dsp_rvv.S
+++ b/libavcodec/riscv/h264dsp_rvv.S
@@ -138,3 +138,17 @@ func ff_h264_h_loop_filter_luma_8_rvv, zve32x
         vssseg6e8.v v8, (a0), a1
         ret
 endfunc
+
+func ff_h264_h_loop_filter_luma_mbaff_8_rvv, zve32x
+        vsetivli    zero, 4, e16, mf2, ta, ma
+        vle8.v      v4, (a4)
+        li          t0, 0x0101
+        vzext.vf2   v6, v4
+        addi        a0, a0, -3
+        vmul.vx     v6, v6, t0    # tc_orig
+        vsetivli    zero, 8, e8, m1, ta, ma
+        vlsseg6e8.v v8, (a0), a1
+        jal         t0, ff_h264_loop_filter_luma_8_rvv
+        vssseg6e8.v v8, (a0), a1
+        ret
+endfunc



More information about the ffmpeg-cvslog mailing list