PR #23500 opened by Deng-zewen
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/23500
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/23500.patch

# Summary of changes

Decouple the add_residual[] RVV dispatch from the AV_CPU_FLAG_RVB guard
in hevcdsp_init.c. The add_residual implementations in hevcdsp_idct_rvv.S
only require zve32x (AV_CPU_FLAG_RVV_I32), but were blocked by the
combined early return that also checks AV_CPU_FLAG_RVB. On CPUs with
RVV_I32 but not RVB, add_residual would never be dispatched despite
being built. Move the RVB check into a conditional block wrapping only
the qpel/epel assignments, leaving add_residual gated solely by
RVV_I32 + vlenb >= 16 + bit_depth == 8.

This is a follow-up fix to #22738, which introduced the
add_residual[] wiring but placed it behind the existing RVB early return.

Signed-off-by: Deng Zewen [email protected]



>From 0bc4c9bd8e4f2a1dac9f358df141f539a20389b6 Mon Sep 17 00:00:00 2001
From: "deng.zewen" <[email protected]>
Date: Tue, 16 Jun 2026 14:55:21 +0800
Subject: [PATCH] avcodec/riscv/hevcdsp_init: decouple add_residual from RVB
 guard

---
 libavcodec/riscv/hevcdsp_init.c | 39 ++++++++++++++++++---------------
 1 file changed, 21 insertions(+), 18 deletions(-)

diff --git a/libavcodec/riscv/hevcdsp_init.c b/libavcodec/riscv/hevcdsp_init.c
index 13ab2baf9c..597b635248 100644
--- a/libavcodec/riscv/hevcdsp_init.c
+++ b/libavcodec/riscv/hevcdsp_init.c
@@ -49,27 +49,30 @@ void ff_hevc_dsp_init_riscv(HEVCDSPContext *c, const int 
bit_depth)
     const int flags = av_get_cpu_flags();
     int vlenb;
 
-    if (!(flags & AV_CPU_FLAG_RVV_I32) || !(flags & AV_CPU_FLAG_RVB))
+    if (!(flags & AV_CPU_FLAG_RVV_I32))
         return;
 
     vlenb = ff_get_rv_vlenb();
-    if (vlenb >= 32) {
-        switch (bit_depth) {
-            case 8:
-                RVV_FNASSIGN(c->put_hevc_qpel, 0, 0, pel_pixels, rvv_256);
-                RVV_FNASSIGN(c->put_hevc_epel, 0, 0, pel_pixels, rvv_256);
-                break;
-            default:
-                break;
-        }
-    } else if (vlenb >= 16) {
-        switch (bit_depth) {
-            case 8:
-                RVV_FNASSIGN(c->put_hevc_qpel, 0, 0, pel_pixels, rvv_128);
-                RVV_FNASSIGN(c->put_hevc_epel, 0, 0, pel_pixels, rvv_128);
-                break;
-            default:
-                break;
+
+    if (flags & AV_CPU_FLAG_RVB) {
+        if (vlenb >= 32) {
+            switch (bit_depth) {
+                case 8:
+                    RVV_FNASSIGN(c->put_hevc_qpel, 0, 0, pel_pixels, rvv_256);
+                    RVV_FNASSIGN(c->put_hevc_epel, 0, 0, pel_pixels, rvv_256);
+                    break;
+                default:
+                    break;
+            }
+        } else if (vlenb >= 16) {
+            switch (bit_depth) {
+                case 8:
+                    RVV_FNASSIGN(c->put_hevc_qpel, 0, 0, pel_pixels, rvv_128);
+                    RVV_FNASSIGN(c->put_hevc_epel, 0, 0, pel_pixels, rvv_128);
+                    break;
+                default:
+                    break;
+            }
         }
     }
 
-- 
2.52.0

_______________________________________________
ffmpeg-devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to