[x265] [PATCH] tcomtrquant: when useRDOQ is disabled, it recomputes qpScaled, the qpScaled for trQuant is already set

Gopu Govindaswamy gopu at multicorewareinc.com
Wed Dec 11 12:01:39 CET 2013


# HG changeset patch
# User Gopu Govindaswamy <gopu at multicorewareinc.com>
# Date 1386759688 -19800
# Node ID 8afda01fe3ea26e0f91797e2f42cbf7a9f52a0ee
# Parent  40895c94da21aed021097f40a62f921c8056ca61
tcomtrquant: when useRDOQ is disabled, it recomputes qpScaled, the qpScaled for trQuant is already set

diff -r 40895c94da21 -r 8afda01fe3ea source/Lib/TLibCommon/TComTrQuant.cpp
--- a/source/Lib/TLibCommon/TComTrQuant.cpp	Wed Dec 11 14:52:38 2013 +0530
+++ b/source/Lib/TLibCommon/TComTrQuant.cpp	Wed Dec 11 16:31:28 2013 +0530
@@ -273,42 +273,6 @@
 
         int deltaU[32 * 32];
 
-        QpParam cQpBase;
-        int qpbase = cu->getSlice()->getSliceQpBase();
-
-        int qpScaled;
-        int qpBDOffset = (ttype == TEXT_LUMA) ? cu->getSlice()->getSPS()->getQpBDOffsetY() : cu->getSlice()->getSPS()->getQpBDOffsetC();
-
-        if (ttype == TEXT_LUMA)
-        {
-            qpScaled = qpbase + qpBDOffset;
-        }
-        else
-        {
-            int chromaQPOffset;
-            if (ttype == TEXT_CHROMA_U)
-            {
-                chromaQPOffset = cu->getSlice()->getPPS()->getChromaCbQpOffset() + cu->getSlice()->getSliceQpDeltaCb();
-            }
-            else
-            {
-                chromaQPOffset = cu->getSlice()->getPPS()->getChromaCrQpOffset() + cu->getSlice()->getSliceQpDeltaCr();
-            }
-            qpbase = qpbase + chromaQPOffset;
-
-            qpScaled = Clip3(-qpBDOffset, 57, qpbase);
-
-            if (qpScaled < 0)
-            {
-                qpScaled = qpScaled +  qpBDOffset;
-            }
-            else
-            {
-                qpScaled = g_chromaScale[qpScaled] + qpBDOffset;
-            }
-        }
-        cQpBase.setQpParam(qpScaled);
-
         uint32_t log2TrSize = g_convertToBit[width] + 2;
         int scalingListType = (cu->isIntra(absPartIdx) ? 0 : 3) + g_eTTable[(int)ttype];
         assert(scalingListType < 6);
@@ -317,7 +281,7 @@
 
         int transformShift = MAX_TR_DYNAMIC_RANGE - X265_DEPTH - log2TrSize; // Represents scaling through forward transform
 
-        int qbits = QUANT_SHIFT + cQpBase.m_per + transformShift;
+        int qbits = QUANT_SHIFT + m_qpParam.m_per + transformShift;
         add = (cu->getSlice()->getSliceType() == I_SLICE ? 171 : 85) << (qbits - 9);
 
         int numCoeff = width * height;
diff -r 40895c94da21 -r 8afda01fe3ea source/common/lowres.cpp
--- a/source/common/lowres.cpp	Wed Dec 11 14:52:38 2013 +0530
+++ b/source/common/lowres.cpp	Wed Dec 11 16:31:28 2013 +0530
@@ -50,6 +50,12 @@
         qpOffset = (double*)x265_malloc(sizeof(double) * cuCount);
         if (!qpAqOffset || !invQscaleFactor || !qpOffset)
             *aqMode = 0;
+        else
+        {
+            ::memset(qpAqOffset, 0, sizeof(double) * cuCount);
+            ::memset(invQscaleFactor, 0, sizeof(int) * cuCount);
+            ::memset(qpOffset, 0, sizeof(double) * cuCount);
+        }
     }
     propagateCost = (uint16_t*)x265_malloc(sizeof(uint16_t) * cuCount);
 


More information about the x265-devel mailing list