[x265] [PATCH 3 of 3] simplify logic on posOffset in codeCoeffNxN()

Min Chen chenm003 at 163.com
Tue Apr 28 14:24:22 CEST 2015


# HG changeset patch
# User Min Chen <chenm003 at 163.com>
# Date 1430223846 -28800
# Node ID 1da121195c1b8c6532ee6e833dc614484da336e1
# Parent  4e5b677bac8e4277d473dc48c6bd104a08c9f925
simplify logic on posOffset in codeCoeffNxN()
---
 source/encoder/entropy.cpp |    9 +--------
 1 files changed, 1 insertions(+), 8 deletions(-)

diff -r 4e5b677bac8e -r 1da121195c1b source/encoder/entropy.cpp
--- a/source/encoder/entropy.cpp	Tue Apr 28 20:24:01 2015 +0800
+++ b/source/encoder/entropy.cpp	Tue Apr 28 20:24:06 2015 +0800
@@ -1560,6 +1560,7 @@
         {
             X265_CHECK((log2TrSize != 2) || (log2TrSize == 2 && subSet == 0), "log2TrSize and subSet mistake!\n");
             const int patternSigCtx = Quant::calcPatternSigCtx(sigCoeffGroupFlag64, cgPosX, cgPosY, cgBlkPos, (trSize >> MLS_CG_LOG2_SIZE));
+            const uint32_t posOffset = (bIsLuma && subSet) ? 3 : 0;
 
             static const uint8_t ctxIndMap4x4[16] =
             {
@@ -1626,9 +1627,6 @@
 
                     const uint8_t (*tabSigCtx)[4] = table_cnt[(uint32_t)patternSigCtx];
                     const int offset = codingParameters.firstSignificanceMapContext;
-                    const uint32_t lumaMask = bIsLuma ? ~0 : 0;
-                    static const uint32_t posXY4Mask[] = {0x024, 0x0CC, 0x39C};
-                    const uint32_t posGT4Mask = posXY4Mask[log2TrSize - 3] & lumaMask;
 
                     uint32_t blkPos, sig, ctxSig;
                     for (; scanPosSigOff >= 0; scanPosSigOff--)
@@ -1642,7 +1640,6 @@
                         if (scanPosSigOff != 0 || subSet == 0 || numNonZero)
                         {
                             const uint32_t posY = blkPos >> log2TrSize;
-                            const uint32_t posOffset = (blkPos & posGT4Mask) ? 3 : 0;
 
                             const uint32_t posXinSubset = blkPos & 3;
                             const uint32_t posYinSubset = posY & 3;
@@ -1688,9 +1685,6 @@
 
                     const uint8_t (*tabSigCtx)[4] = table_cnt[(uint32_t)patternSigCtx];
                     const int offset = codingParameters.firstSignificanceMapContext;
-                    const uint32_t lumaMask = bIsLuma ? ~0 : 0;
-                    static const uint32_t posXY4Mask[] = {0x024, 0x0CC, 0x39C};
-                    const uint32_t posGT4Mask = posXY4Mask[log2TrSize - 3] & lumaMask;
 
                     uint32_t blkPos, sig, ctxSig;
                     for (; scanPosSigOff >= 0; scanPosSigOff--)
@@ -1704,7 +1698,6 @@
                         if (scanPosSigOff != 0 || subSet == 0 || numNonZero)
                         {
                             const uint32_t posY = blkPos >> log2TrSize;
-                            const uint32_t posOffset = (blkPos & posGT4Mask) ? 3 : 0;
 
                             const uint32_t posXinSubset = blkPos & 3;
                             const uint32_t posYinSubset = posY & 3;



More information about the x265-devel mailing list