[x265] [PATCH 3 of 6] merge ctxIndMap4x4[] into tab_cnt[][]

Min Chen chenm003 at 163.com
Thu Jun 4 21:13:45 CEST 2015


# HG changeset patch
# User Min Chen <chenm003 at 163.com>
# Date 1433445192 25200
# Node ID 2a57298045d8a8328aee87e0c97016ef3e954b5f
# Parent  b740e2fe118387360b9c4ab960c58555d512a250
merge ctxIndMap4x4[] into tab_cnt[][]
---
 source/encoder/entropy.cpp |   20 ++++++++++----------
 1 files changed, 10 insertions(+), 10 deletions(-)

diff -r b740e2fe1183 -r 2a57298045d8 source/encoder/entropy.cpp
--- a/source/encoder/entropy.cpp	Thu Jun 04 12:13:09 2015 -0700
+++ b/source/encoder/entropy.cpp	Thu Jun 04 12:13:12 2015 -0700
@@ -1558,15 +1558,8 @@
             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] =
-            {
-                0, 1, 4, 5,
-                2, 3, 4, 5,
-                6, 6, 8, 8,
-                7, 7, 8, 8
-            };
             // NOTE: [patternSigCtx][posXinSubset][posYinSubset]
-            static const uint8_t table_cnt[4][SCAN_SET_SIZE] =
+            static const uint8_t table_cnt[5][SCAN_SET_SIZE] =
             {
                 // patternSigCtx = 0
                 {
@@ -1595,6 +1588,13 @@
                     2, 2, 2, 2,
                     2, 2, 2, 2,
                     2, 2, 2, 2,
+                },
+                // 4x4
+                {
+                    0, 1, 4, 5,
+                    2, 3, 4, 5,
+                    6, 6, 8, 8,
+                    7, 7, 8, 8
                 }
             };
 
@@ -1624,7 +1624,7 @@
                         scanFlagMask >>= 1;
                         X265_CHECK((uint32_t)(tmpCoeff[blkPos] != 0) == sig, "sign bit mistake\n");
                         {
-                            ctxSig = ctxIndMap4x4[blkPos];
+                            ctxSig = table_cnt[4][blkPos];
                             X265_CHECK(ctxSig == Quant::getSigCtxInc(patternSigCtx, log2TrSize, trSize, blkPos, bIsLuma, codingParameters.firstSignificanceMapContext), "sigCtx mistake!\n");;
                             encodeBin(sig, baseCtx[ctxSig]);
                         }
@@ -1668,7 +1668,7 @@
                 uint32_t sum = 0;
                 if (log2TrSize == 2)
                 {
-                    sum = primitives.costCoeffNxN(g_scan4x4[codingParameters.scanType], &coeff[blkPosBase], (intptr_t)trSize, absCoeff + numNonZero, ctxIndMap4x4, scanFlagMask, baseCtx, offset + posOffset, scanPosSigOff, 0);
+                    sum = primitives.costCoeffNxN(g_scan4x4[codingParameters.scanType], &coeff[blkPosBase], (intptr_t)trSize, absCoeff + numNonZero, table_cnt[4], scanFlagMask, baseCtx, offset + posOffset, scanPosSigOff, 0);
                 } // end of 4x4
                 else
                 {



More information about the x265-devel mailing list