Commit 2dc0f5dfbe for ffmpeg
commit 2dc0f5dfbe8fd5a29dbda1257fa1de6441aa5da8
Author: Michael Niedermayer <michael@niedermayer.cc>
Date: Sat Oct 24 16:27:41 2026 +0000
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
diff --git a/libavcodec/vulkan_h264.c b/libavcodec/vulkan_h264.c
index aa173a0511..5b44086fe5 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) {