From 29305d37a7afd0d2125d37fbb680dee3854534f1 Mon Sep 17 00:00:00 2001
From: Brian Heng <brian.heng@broadcom.com>
Date: Sat, 20 Jul 2019 11:28:46 -0700
Subject: [PATCH] Fix for Ticket #311 Scaling List Bugs

  - Previous fix broke dependent  quantization for the non-scaling list case.
  - Negative shift values are no longer set to zero, so the shift is applied repeatedly to the fixed invQScale value (g_invQuantScales) during each loop.
---
 source/Lib/CommonLib/DepQuant.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/source/Lib/CommonLib/DepQuant.cpp b/source/Lib/CommonLib/DepQuant.cpp
index bbc6d72d74..5ad65d3485 100644
--- a/source/Lib/CommonLib/DepQuant.cpp
+++ b/source/Lib/CommonLib/DepQuant.cpp
@@ -750,7 +750,7 @@ namespace DQIntern
       {
         if (enableScalingLists)
           invQScale = piDequantCoef[rasterPos];//scalingfactor*levelScale
-        if (shift < 0)
+        if (shift < 0 && (enableScalingLists || scanIdx == lastScanIdx))
         {
           invQScale <<= -shift;
         }
-- 
GitLab