[x265] [PATCH 1 of 2] change costUncoded[] coordinate system from Raster to Zigzag

Min Chen chenm003 at 163.com
Fri Apr 10 14:06:37 CEST 2015


# HG changeset patch
# User Min Chen <chenm003 at 163.com>
# Date 1428667583 -28800
# Node ID 85a01b9b002f6c2573d06e92a3763f6d486f1259
# Parent  984e254f93f7cedc5a9b00851d2e14b49dc94e91
change costUncoded[] coordinate system from Raster to Zigzag
---
 source/common/quant.cpp |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)

diff -r 984e254f93f7 -r 85a01b9b002f source/common/quant.cpp
--- a/source/common/quant.cpp	Thu Apr 09 11:48:08 2015 -0500
+++ b/source/common/quant.cpp	Fri Apr 10 20:06:23 2015 +0800
@@ -613,13 +613,13 @@
              * FIX15 nature of the CABAC cost tables minus the forward transform scale */
 
             /* cost of not coding this coefficient (all distortion, no signal bits) */
-            costUncoded[scanPos] = ((int64_t)signCoef * signCoef) << scaleBits;
+            costUncoded[blkPos] = ((int64_t)signCoef * signCoef) << scaleBits;
             X265_CHECK((!!scanPos ^ !!blkPos) == 0, "failed on (blkPos=0 && scanPos!=0)\n");
             if (usePsyMask & scanPos)
                 /* when no residual coefficient is coded, predicted coef == recon coef */
-                costUncoded[scanPos] -= PSYVALUE(predictedCoef);
+                costUncoded[blkPos] -= PSYVALUE(predictedCoef);
 
-            totalUncodedCost += costUncoded[scanPos];
+            totalUncodedCost += costUncoded[blkPos];
 
             if (maxAbsLevel && lastScanPos < 0)
             {
@@ -638,7 +638,7 @@
                 /* No non-zero coefficient yet found, but this does not mean
                  * there is no uncoded-cost for this coefficient. Pre-
                  * quantization the coefficient may have been non-zero */
-                totalRdCost += costUncoded[scanPos];
+                totalRdCost += costUncoded[blkPos];
             }
             else
             {
@@ -668,7 +668,7 @@
                     {
                         /* set default costs to uncoded costs */
                         costSig[scanPos] = SIGCOST(estBitsSbac.significantBits[ctxSig][0]);
-                        costCoeff[scanPos] = costUncoded[scanPos] + costSig[scanPos];
+                        costCoeff[scanPos] = costUncoded[blkPos] + costSig[scanPos];
                     }
                     sigRateDelta[blkPos] = estBitsSbac.significantBits[ctxSig][1] - estBitsSbac.significantBits[ctxSig][0];
                     sigCoefBits = estBitsSbac.significantBits[ctxSig][1];
@@ -810,7 +810,7 @@
             {
                 sigCoeffGroupFlag64 |= cgBlkPosMask;
                 cgRdStats.codedLevelAndDist += costCoeff[scanPos] - costSig[scanPos];
-                cgRdStats.uncodedDist += costUncoded[scanPos];
+                cgRdStats.uncodedDist += costUncoded[blkPos];
                 cgRdStats.nnzBeforePos0 += scanPosinCG;
             }
         } /* end for (scanPosinCG) */
@@ -965,7 +965,7 @@
                 }
 
                 totalRdCost -= costCoeff[scanPos];
-                totalRdCost += costUncoded[scanPos];
+                totalRdCost += costUncoded[blkPos];
             }
             else
                 totalRdCost -= costSig[scanPos];



More information about the x265-devel mailing list