PR #25786 opened by kierank
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/25786
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/25786.patch

rem6[] and div6[] are sized for qP up to 51 + 4 * 6 = 75 (QpY +
QpBdOffset at 12 bits) but list only 74 values, so qP 74 and 75 read the
zero padding: 12-bit coefficients at QP 50 and 51 are scaled by
levelScale[0] << 0 = 40 instead of 51 << 12 and 57 << 12. Add the two
missing entries.

Written by AI

# Summary of changes

Briefly describe what this PR does and why.

<!--
If this PR requires new FATE test samples, attach them to the PR and
list their target paths below (relative to the fate-suite root).

Attached filenames must match the sample's filename:

```fate-samples
# e.g. vorbis/new-sample.ogg
```
-->



>From f530b3ff1027f67a912655000f0c6d44898ba19e Mon Sep 17 00:00:00 2001
From: Kieran Kunhya <[email protected]>
Date: Thu, 5 Nov 2026 08:50:27 +0100
Subject: [PATCH] avcodec/hevc/cabac: complete the dequantisation tables for
 12-bit QP 50 and 51

rem6[] and div6[] are sized for qP up to 51 + 4 * 6 = 75 (QpY +
QpBdOffset at 12 bits) but list only 74 values, so qP 74 and 75 read the
zero padding: 12-bit coefficients at QP 50 and 51 are scaled by
levelScale[0] << 0 = 40 instead of 51 << 12 and 57 << 12. Add the two
missing entries.
---
 libavcodec/hevc/cabac.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavcodec/hevc/cabac.c b/libavcodec/hevc/cabac.c
index 57f43be06f3..74dbcc720c6 100644
--- a/libavcodec/hevc/cabac.c
+++ b/libavcodec/hevc/cabac.c
@@ -1110,14 +1110,14 @@ void ff_hevc_hls_residual_coding(HEVCLocalContext *lc, 
const HEVCPPS *pps,
             0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2,
             3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5,
             0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3,
-            4, 5, 0, 1, 2, 3, 4, 5, 0, 1
+            4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3
         };
 
         static const uint8_t div6[51 + 4 * 6 + 1] = {
             0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3,  3,  3,
             3, 3, 3, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6,  6,  6,
             7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 10, 10, 10, 
10,
-            10, 10, 11, 11, 11, 11, 11, 11, 12, 12
+            10, 10, 11, 11, 11, 11, 11, 11, 12, 12, 12, 12
         };
         int qp_y = lc->qp_y;
 
-- 
2.54.0

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

Reply via email to