[x265] [PATCH] Cleanup setErrScaleCoeff function

praveen at multicorewareinc.com praveen at multicorewareinc.com
Wed Jul 10 12:40:37 CEST 2013


# HG changeset patch
# User praveentiwari
# Date 1373452827 -19800
# Node ID e1107ee66428db376fed4bd537b33716e83272e1
# Parent  ae3cf6062c1ac55006e71a591e1ab8766f332ecc
Cleanup setErrScaleCoeff function

diff -r ae3cf6062c1a -r e1107ee66428 source/Lib/TLibCommon/TComTrQuant.cpp
--- a/source/Lib/TLibCommon/TComTrQuant.cpp	Wed Jul 10 00:41:02 2013 -0500
+++ b/source/Lib/TLibCommon/TComTrQuant.cpp	Wed Jul 10 16:10:27 2013 +0530
@@ -1603,22 +1603,22 @@
  */
 Void TComTrQuant::setErrScaleCoeff(UInt list, UInt size, UInt qp)
 {
-    UInt uiLog2TrSize = g_convertToBit[g_scalingListSizeX[size]] + 2;
+    UInt log2TrSize = g_convertToBit[g_scalingListSizeX[size]] + 2;
     Int bitDepth = (size < SCALING_LIST_32x32 && list != 0 && list != 3) ? g_bitDepthC : g_bitDepthY;
-    Int iTransformShift = MAX_TR_DYNAMIC_RANGE - bitDepth - uiLog2TrSize; // Represents scaling through forward transform
+    Int transformShift = MAX_TR_DYNAMIC_RANGE - bitDepth - log2TrSize; // Represents scaling through forward transform
 
-    UInt i, uiMaxNumCoeff = g_scalingListSize[size];
-    Int *piQuantcoeff;
-    Double *pdErrScale;
+    UInt i, maxNumCoeff = g_scalingListSize[size];
+    Int *quantCoeff;
+    Double *errScale;
 
-    piQuantcoeff   = getQuantCoeff(list, qp, size);
-    pdErrScale     = getErrScaleCoeff(list, size, qp);
+    quantCoeff   = getQuantCoeff(list, qp, size);
+    errScale     = getErrScaleCoeff(list, size, qp);
 
-    Double dErrScale = (Double)(1 << SCALE_BITS);                          // Compensate for scaling of bitcount in Lagrange cost function
-    dErrScale = dErrScale * pow(2.0, -2.0 * iTransformShift);              // Compensate for scaling through forward transform
-    for (i = 0; i < uiMaxNumCoeff; i++)
+    Double scalingBits = (Double)(1 << SCALE_BITS);                          // Compensate for scaling of bitcount in Lagrange cost function
+    scalingBits = scalingBits * pow(2.0, -2.0 * transformShift);              // Compensate for scaling through forward transform
+    for (i = 0; i < maxNumCoeff; i++)
     {
-        pdErrScale[i] = dErrScale / piQuantcoeff[i] / piQuantcoeff[i] / (1 << DISTORTION_PRECISION_ADJUSTMENT(2 * (bitDepth - 8)));
+        errScale[i] = scalingBits / quantCoeff[i] / quantCoeff[i] / (1 << DISTORTION_PRECISION_ADJUSTMENT(2 * (bitDepth - 8)));
     }
 }
 


More information about the x265-devel mailing list