[x265] [PATCH 5 of 7] improvement by replace SHIFT to MASK_AND

Min Chen chenm003 at 163.com
Mon Mar 24 20:00:42 CET 2014


# HG changeset patch
# User Min Chen <chenm003 at 163.com>
# Date 1395687572 25200
# Node ID d39b436d01f293e20fd51a5a53028166e50cee58
# Parent  105fa844e4e3e2c6bffb8d2ea613e56e429cdf64
improvement by replace SHIFT to MASK_AND

diff -r 105fa844e4e3 -r d39b436d01f2 source/Lib/TLibEncoder/TEncSbac.cpp
--- a/source/Lib/TLibEncoder/TEncSbac.cpp	Mon Mar 24 11:58:53 2014 -0700
+++ b/source/Lib/TLibEncoder/TEncSbac.cpp	Mon Mar 24 11:59:32 2014 -0700
@@ -2117,7 +2117,7 @@
 
     // Code position of last coefficient
     int posLastY = posLast >> log2TrSize;
-    int posLastX = posLast - (posLastY << log2TrSize);
+    int posLastX = posLast & (trSize - 1);
     codeLastSignificantXY(posLastX, posLastY, log2TrSize, ttype, codingParameters.scanType);
     //===== code significance flag =====
     ContextModel * const baseCoeffGroupCtx = &m_contextModels[OFF_SIG_CG_FLAG_CTX + (ttype ? NUM_SIG_CG_FLAG_CTX : 0)];
@@ -2178,9 +2178,9 @@
                 if (sig)
                 {
                     absCoeff[numNonZero] = int(abs(coeff[blkPos]));
-                    coeffSigns = 2 * coeffSigns + (coeff[blkPos] < 0);
+                    coeffSigns = 2 * coeffSigns + ((uint32_t)coeff[blkPos] >> 31);
                     numNonZero++;
-                    if (lastNZPosInCG == -1)
+                    if (lastNZPosInCG < 0)
                     {
                         lastNZPosInCG = scanPosSig;
                     }



More information about the x265-devel mailing list