[x265] [PATCH] Removed block of code and added switch to corresponding functions

praveen at multicorewareinc.com praveen at multicorewareinc.com
Wed Jun 26 14:12:50 CEST 2013


# HG changeset patch
# User praveentiwari
# Date 1372248759 -19800
# Node ID 321b2fd70a1bd58b2bb1c2351f49766709a15770
# Parent  a65e58e757f5019e44087d0789e6e0ba4818b419
Removed block of code and added switch to corresponding functions

diff -r a65e58e757f5 -r 321b2fd70a1b source/Lib/TLibCommon/TComTrQuant.cpp
--- a/source/Lib/TLibCommon/TComTrQuant.cpp	Wed Jun 26 17:39:07 2013 +0530
+++ b/source/Lib/TLibCommon/TComTrQuant.cpp	Wed Jun 26 17:42:39 2013 +0530
@@ -818,29 +818,16 @@
         Int iQBits = QUANT_SHIFT + cQpBase.m_iPer + iTransformShift;
         iAdd = (pcCU->getSlice()->getSliceType() == I_SLICE ? 171 : 85) << (iQBits - 9);
         Int iQBitsC = QUANT_SHIFT + cQpBase.m_iPer + iTransformShift - ARL_C_PRECISION;
-        Int iAddC   = 1 << (iQBitsC - 1);
 
-        Int qBits8 = iQBits - 8;
-        for (Int n = 0; n < iWidth * iHeight; n++)
+        Int numCoeff = iWidth * iHeight;
+        if (m_bUseAdaptQpSelect)
         {
-            Int iLevel;
-            Int  iSign;
-            UInt uiBlockPos = n;
-            iLevel  = piCoef[uiBlockPos];
-            iSign   = (iLevel < 0 ? -1 : 1);
-
-            Int64 tmpLevel = (Int64)abs(iLevel) * piQuantCoeff[uiBlockPos];
-            if (m_bUseAdaptQpSelect)
-            {
-                piArlCCoef[uiBlockPos] = (Int)((tmpLevel + iAddC) >> iQBitsC);
-            }
-            iLevel = (Int)((tmpLevel + iAdd) >> iQBits);
-            deltaU[uiBlockPos] = (Int)((tmpLevel - (iLevel << iQBits)) >> qBits8);
-            uiAcSum += iLevel;
-            iLevel *= iSign;
-            piQCoef[uiBlockPos] = Clip3(-32768, 32767, iLevel);
-        } // for n
-
+            uiAcSum += x265::primitives.calQuantCoefEAdp(piCoef, piQuantCoeff, deltaU, piQCoef, piArlCCoef, iQBitsC, iQBits, iAdd, numCoeff);
+        }
+        else
+        {
+            uiAcSum += x265::primitives.calQuantCoefDAdp(piCoef, piQuantCoeff, deltaU, piQCoef, iQBits, iAdd, numCoeff);
+        }
         if (pcCU->getSlice()->getPPS()->getSignHideFlag())
         {
             if (uiAcSum >= 2)


More information about the x265-devel mailing list