From e842972404fa3a4a3571e64864be1e311a0ba4c9 Mon Sep 17 00:00:00 2001
From: triple-groove <triple-groove@users.noreply.github.com>
Date: Sun, 22 Feb 2026 16:07:56 -0800
Subject: [PATCH 3/5] fix(dsc): correct RC parameter tables to match VESA DSC
 1.1 standard

The minqp444_8b, maxqp444_8b, and ofs_und8 tables in nvt_dsc_pps.c
contain non-standard values for the 8bpc / 8.0 bpp operating point
(column index 4). Ranges 9-14 have more constrained max_qp values
than the VESA DSC 1.1 specification (Table E-5), and range 11 has
an incorrect bpg_offset.

These deviations prevent the DSC encoder from quantizing aggressively
enough when the RC buffer approaches overflow on complex content,
causing visible block/tile "rainbow static" artifacts on sinks that
implement strict VESA-compliant DSC decompression.

Corrected values (all at column index 4 = 8.0 bpp):

  minqp444_8b  range  9: 4 -> 3
  minqp444_8b  range 13: 8 -> 7
  minqp444_8b  range 14: 12 -> 13
  maxqp444_8b  range 10: 10 -> 11
  maxqp444_8b  range 11: 11 -> 12
  maxqp444_8b  range 12: 11 -> 13
  maxqp444_8b  range 13: 12 -> 13
  maxqp444_8b  range 14: 13 -> 15
  ofs_und8     range 11: -10 -> -12

Tested on RTX 5090 with Bigscreen Beyond VR headset (DSC 1.1, 8bpc,
8.0 bpp, RGB 4:4:4, 3840x1920@90Hz). Artifacts completely eliminated.

Signed-off-by: triple-groove <triple-groove@users.noreply.github.com>
---
 src/common/modeset/timing/nvt_dsc_pps.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/src/common/modeset/timing/nvt_dsc_pps.c b/src/common/modeset/timing/nvt_dsc_pps.c
index ce6d6a795470..d100c57d9351 100644
--- a/src/common/modeset/timing/nvt_dsc_pps.c
+++ b/src/common/modeset/timing/nvt_dsc_pps.c
@@ -187,12 +187,12 @@ static const NvU8 minqp444_8b[15][37]={
        ,{ 5, 5, 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1,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10,10, 9, 9, 9, 8, 8, 8, 7, 7, 7, 7, 6, 6, 5, 5, 5, 5, 4, 4, 4, 3, 3, 3, 3}
+       ,{ 9, 9, 9, 9, 7, 8, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 6, 6, 5, 5, 5, 5, 4, 4, 3, 3, 3, 3, 2, 2, 1, 1, 1}  // [13] col4: 8->7 (VESA DSC 1.1)
+       ,{14,14,13,13,13,12,12,12,11,11,10,10,10,10, 9, 9, 9, 8, 8, 8, 7, 7, 7, 7, 6, 6, 5, 5, 5, 5, 4, 4, 4, 3, 3, 3, 3}  // [14] col4: 12->13 (VESA DSC 1.1)
 };
 
 static const NvU8 maxqp444_8b[15][37]={
@@ -206,11 +206,11 @@ static const NvU8 maxqp444_8b[15][37]={
        ,{10,10, 9, 9, 8, 8, 8, 8, 8, 8, 8, 8, 8, 7, 7, 6, 5, 5, 4, 4, 4, 4, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1}
        ,{11,11,10,10, 9, 9, 9, 9, 9, 9, 8, 8, 8, 7, 7, 6, 6, 5, 5, 5, 5, 5, 4, 4, 4, 4, 3, 3, 2, 2, 2, 2, 2, 2, 1, 1, 1}
        ,{12,11,11,10,10,10, 9, 9, 9, 9, 9, 9, 9, 8, 8, 7, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4, 3, 3, 2, 2, 2, 2, 2, 2, 1, 1, 1}
-       ,{12,12,11,11,10,10,10,10,10,10, 9, 9, 9, 8, 8, 7, 7, 6, 6, 6, 5, 5, 4, 4, 4, 4, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 1}
-       ,{12,12,12,11,11,11,10,10,10,10, 9, 9, 9, 9, 8, 8, 8, 7, 7, 7, 6, 6, 5, 5, 5, 5, 4, 4, 3, 3, 3, 3, 2, 2, 2, 2, 1}
-       ,{12,12,12,12,11,11,11,11,11,10,10, 9, 9, 9, 8, 8, 8, 7, 7, 7, 6, 6, 5, 5, 5, 5, 4, 4, 3, 3, 3, 3, 2, 2, 2, 2, 1}
-       ,{13,13,13,13,12,12,11,11,11,11,10,10,10,10, 9, 9, 8, 8, 8, 8, 7, 7, 6, 6, 6, 6, 5, 5, 4, 4, 4, 4, 3, 3, 2, 2, 2}
-       ,{15,15,14,14,13,13,13,13,12,12,11,11,11,11,10,10,10, 9, 9, 9, 8, 8, 8, 8, 7, 7, 6, 6, 6, 6, 5, 5, 5, 4, 4, 4, 4}
+       ,{12,12,11,11,11,10,10,10,10,10, 9, 9, 9, 8, 8, 7, 7, 6, 6, 6, 5, 5, 4, 4, 4, 4, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 1}  // [10] col4: 10->11 (VESA DSC 1.1)
+       ,{12,12,12,11,12,11,10,10,10,10, 9, 9, 9, 9, 8, 8, 8, 7, 7, 7, 6, 6, 5, 5, 5, 5, 4, 4, 3, 3, 3, 3, 2, 2, 2, 2, 1}  // [11] col4: 11->12 (VESA DSC 1.1)
+       ,{12,12,12,12,13,11,11,11,11,10,10, 9, 9, 9, 8, 8, 8, 7, 7, 7, 6, 6, 5, 5, 5, 5, 4, 4, 3, 3, 3, 3, 2, 2, 2, 2, 1}  // [12] col4: 11->13 (VESA DSC 1.1)
+       ,{13,13,13,13,13,12,11,11,11,11,10,10,10,10, 9, 9, 8, 8, 8, 8, 7, 7, 6, 6, 6, 6, 5, 5, 4, 4, 4, 4, 3, 3, 2, 2, 2}  // [13] col4: 12->13 (VESA DSC 1.1)
+       ,{15,15,14,14,15,13,13,13,12,12,11,11,11,11,10,10,10, 9, 9, 9, 8, 8, 8, 8, 7, 7, 6, 6, 6, 6, 5, 5, 5, 4, 4, 4, 4}  // [14] col4: 13->15 (VESA DSC 1.1)
 };
 
 static const NvU8 minqp444_10b[15][49]={
@@ -934,7 +934,7 @@ DSC_PpsCalcRcParam
             //else
             {
                 const NvU32 ofs_und6[] = { 0, -2, -2, -4, -6, -6, -8, -8, -8, -10, -10, -12, -12, -12, -12 };
-                const NvU32 ofs_und8[] = { 2, 0, 0, -2, -4, -6, -8, -8, -8, -10, -10, -10, -12, -12, -12 };
+                const NvU32 ofs_und8[] = { 2, 0, 0, -2, -4, -6, -8, -8, -8, -10, -10, -12, -12, -12, -12 };  // [11]: -10->-12 (VESA DSC 1.1)
                 const NvU32 ofs_und12[] = { 2, 0, 0, -2, -4, -6, -8, -8, -8, -10, -10, -10, -12, -12, -12 };
                 const NvU32 ofs_und15[] = { 10, 8, 6, 4, 2, 0, -2, -4, -6, -8, -10, -10, -12, -12, -12 };
 
-- 
2.53.0

