PR #25422 opened by Forgejo_Fairy URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/25422 Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/25422.patch
The H.264 parser includes `QpBdOffsetY` in `PPS.init_qp` and `PPS.init_qs`, but Vulkan's `StdVideoH264PictureParameterSet` requires the original syntax values. Subtract `6 * (sps->bit_depth_luma - 8)` when converting both fields, matching the existing NVDEC treatment of initial QP. For generated 10-bit High10 and High422 inputs, the bitstream fields are −3/0 while the current Vulkan conversion produces 9/12. This change restores −3/0; the 8-bit values remain unchanged. Found while investigating #25359. The parameter defect is confirmed, but whether it explains or completely resolves the reported grayscale output remains unverified: the available RTX 5090 uses driver 595.84, which rejects the reported profiles during session initialization. Testing on the reporter's driver 621.01 is still needed; this PR should not automatically close the issue. Validation: built with Vulkan-Headers 1.4.329; compared an independent PPS syntax reader with the real H.264 parser and an exact extraction of `set_pps()` before and after the change for generated 8/10-bit 4:2:0 and 4:2:2 inputs. The patched 8-bit 4:2:0 Vulkan control matches the unpatched first frame, and all 25 frames match software decoding byte-for-byte. `git diff --check` passes. Reproduction instructions and diagnostic sources are preserved on `fairy/issue25359-tooling` under `tools/issue25359/`. From 8182562a3a38512bbd903bc1e0db17fc34d24803 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer <[email protected]> Date: Sat, 24 Oct 2026 16:27:41 +0000 Subject: [PATCH] vulkan_h264: remove the bit-depth offset from initial QP values The H.264 parser adds QpBdOffsetY to PPS.init_qp and PPS.init_qs. StdVideoH264PictureParameterSet requires the original syntax values, so subtract that offset along with 26, as nvdec already does for init_qp. Otherwise both fields are 12 too large for 10-bit input. This corrects parameter conversion found while investigating #25359; the reported grayscale output still needs testing on driver 621.01. Assisted-by: Fairy --- libavcodec/vulkan_h264.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/vulkan_h264.c b/libavcodec/vulkan_h264.c index aa173a05119..5b44086fe58 100644 --- a/libavcodec/vulkan_h264.c +++ b/libavcodec/vulkan_h264.c @@ -320,8 +320,8 @@ static void set_pps(const PPS *pps, const SPS *sps, .num_ref_idx_l0_default_active_minus1 = pps->ref_count[0] - 1, .num_ref_idx_l1_default_active_minus1 = pps->ref_count[1] - 1, .weighted_bipred_idc = pps->weighted_bipred_idc, - .pic_init_qp_minus26 = pps->init_qp - 26, - .pic_init_qs_minus26 = pps->init_qs - 26, + .pic_init_qp_minus26 = pps->init_qp - 26 - 6 * (sps->bit_depth_luma - 8), + .pic_init_qs_minus26 = pps->init_qs - 26 - 6 * (sps->bit_depth_luma - 8), .chroma_qp_index_offset = pps->chroma_qp_index_offset[0], .second_chroma_qp_index_offset = pps->chroma_qp_index_offset[1], .flags = (StdVideoH264PpsFlags) { -- 2.54.0 _______________________________________________ ffmpeg-devel mailing list -- [email protected] To unsubscribe send an email to [email protected]
