[x265] [PATCH] cleanup signBitHidingHDQ function

praveen at multicorewareinc.com praveen at multicorewareinc.com
Tue Jul 9 08:08:46 CEST 2013


# HG changeset patch
# User praveentiwari
# Date 1373350111 -19800
# Node ID 2ac04f78e6bffbd554dff2a37a9f3e11015c225e
# Parent  2e0f0ca8b5f1b8f54d3a80117273200f9a0926ce
cleanup signBitHidingHDQ function

diff -r 2e0f0ca8b5f1 -r 2ac04f78e6bf source/Lib/TLibCommon/TComTrQuant.cpp
--- a/source/Lib/TLibCommon/TComTrQuant.cpp	Tue Jul 09 11:04:33 2013 +0530
+++ b/source/Lib/TLibCommon/TComTrQuant.cpp	Tue Jul 09 11:38:31 2013 +0530
@@ -616,7 +616,7 @@
 }
 
 // To minimize the distortion only. No rate is considered.
-Void TComTrQuant::signBitHidingHDQ(TCoeff* pQCoef, TCoeff* pCoef, UInt const *scan, Int* deltaU, Int width, Int height)
+Void TComTrQuant::signBitHidingHDQ(TCoeff* qCoef, TCoeff* coef, UInt const *scan, Int* deltaU, Int width, Int height)
 {
     Int lastCG = -1;
     Int absSum = 0;
@@ -630,7 +630,7 @@
 
         for (n = SCAN_SET_SIZE - 1; n >= 0; --n)
         {
-            if (pQCoef[scan[n + subPos]])
+            if (qCoef[scan[n + subPos]])
             {
                 lastNZPosInCG = n;
                 break;
@@ -639,7 +639,7 @@
 
         for (n = 0; n < SCAN_SET_SIZE; n++)
         {
-            if (pQCoef[scan[n + subPos]])
+            if (qCoef[scan[n + subPos]])
             {
                 firstNZPosInCG = n;
                 break;
@@ -648,7 +648,7 @@
 
         for (n = firstNZPosInCG; n <= lastNZPosInCG; n++)
         {
-            absSum += pQCoef[scan[n + subPos]];
+            absSum += qCoef[scan[n + subPos]];
         }
 
         if (lastNZPosInCG >= 0 && lastCG == -1)
@@ -658,7 +658,7 @@
 
         if (lastNZPosInCG - firstNZPosInCG >= SBH_THRESHOLD)
         {
-            UInt signbit = (pQCoef[scan[subPos + firstNZPosInCG]] > 0 ? 0 : 1);
+            UInt signbit = (qCoef[scan[subPos + firstNZPosInCG]] > 0 ? 0 : 1);
             if (signbit != (absSum & 0x1)) //compare signbit with sum_parity
             {
                 Int minCostInc = MAX_INT,  minPos = -1, finalChange = 0, curCost = MAX_INT, curChange = 0;
@@ -666,7 +666,7 @@
                 for (n = (lastCG == 1 ? lastNZPosInCG : SCAN_SET_SIZE - 1); n >= 0; --n)
                 {
                     UInt blkPos   = scan[n + subPos];
-                    if (pQCoef[blkPos] != 0)
+                    if (qCoef[blkPos] != 0)
                     {
                         if (deltaU[blkPos] > 0)
                         {
@@ -676,7 +676,7 @@
                         else
                         {
                             //curChange =-1;
-                            if (n == firstNZPosInCG && abs(pQCoef[blkPos]) == 1)
+                            if (n == firstNZPosInCG && abs(qCoef[blkPos]) == 1)
                             {
                                 curCost = MAX_INT;
                             }
@@ -691,7 +691,7 @@
                     {
                         if (n < firstNZPosInCG)
                         {
-                            UInt thisSignBit = (pCoef[blkPos] >= 0 ? 0 : 1);
+                            UInt thisSignBit = (coef[blkPos] >= 0 ? 0 : 1);
                             if (thisSignBit != signbit)
                             {
                                 curCost = MAX_INT;
@@ -717,18 +717,18 @@
                     }
                 } //CG loop
 
-                if (pQCoef[minPos] == 32767 || pQCoef[minPos] == -32768)
+                if (qCoef[minPos] == 32767 || qCoef[minPos] == -32768)
                 {
                     finalChange = -1;
                 }
 
-                if (pCoef[minPos] >= 0)
+                if (coef[minPos] >= 0)
                 {
-                    pQCoef[minPos] += finalChange;
+                    qCoef[minPos] += finalChange;
                 }
                 else
                 {
-                    pQCoef[minPos] -= finalChange;
+                    qCoef[minPos] -= finalChange;
                 }
             } // Hide
         }


More information about the x265-devel mailing list