From 6e4d0592f237932deb28f7c888804eb615fb3914 Mon Sep 17 00:00:00 2001 From: leacyand Date: Thu, 10 Sep 2026 15:21:38 +0800 Subject: [PATCH] avcodec/riscv/hevcdsp_init: decouple add_residual from RVB guard 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. upstream PR 23500 (https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/23500) project:TC2025040201 Signed-off-by: lanjing lan.jing3@zte.com.cn --- ...vcdsp_init-decouple-add_residual-fro.patch | 66 +++++++++++++++++++ ffmpeg.spec | 8 ++- 2 files changed, 73 insertions(+), 1 deletion(-) create mode 100644 0003-avcodec-riscv-hevcdsp_init-decouple-add_residual-fro.patch diff --git a/0003-avcodec-riscv-hevcdsp_init-decouple-add_residual-fro.patch b/0003-avcodec-riscv-hevcdsp_init-decouple-add_residual-fro.patch new file mode 100644 index 0000000..39f0428 --- /dev/null +++ b/0003-avcodec-riscv-hevcdsp_init-decouple-add_residual-fro.patch @@ -0,0 +1,66 @@ +From 2d54b096fe389a7756495797e8879312465659ad Mon Sep 17 00:00:00 2001 +From: "deng.zewen" +Date: Wed, 9 Sep 2026 11:32:44 +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 13ab2ba..597b635 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.27.0 + diff --git a/ffmpeg.spec b/ffmpeg.spec index a36bad6..f26b401 100644 --- a/ffmpeg.spec +++ b/ffmpeg.spec @@ -1,4 +1,4 @@ -%define anolis_release 4 +%define anolis_release 5 %global av_codec_soversion 62 %global av_device_soversion 62 @@ -24,6 +24,9 @@ Patch0: 0001-bugfix-CVE-2026-40962.patch # https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/22738 Patch1001: 0002-libavcodec-riscv-add-RVV-optimized-hevc_add_res.patch +# https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/23500 +Patch1002: 0003-avcodec-riscv-hevcdsp_init-decouple-add_residual-fro.patch + # CVE-2026-8461 https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/23159.patch Patch0001: 0001-bugfix-for-CVE-2026-8461.patch @@ -383,6 +386,9 @@ rm -rf %{buildroot}%{_datadir}/%{name}/examples %changelog +* Wed Sep 09 2026 Lan Jing - 8.0.1-5 +- Add patch to decouple add_residual from RVB guard + * Thu Sep 01 2026 Lan Jing - 8.0.1-4 - Add RVV optimized hevc_add_res patch -- Gitee