[x265] [PATCH 4 of 6] merge NxN and 4x4 fast RD path

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


# HG changeset patch
# User Min Chen <chenm003 at 163.com>
# Date 1433445194 25200
# Node ID f2a13eb7ae4529ef47f03dca7e5abf2e10dcdaa4
# Parent  2a57298045d8a8328aee87e0c97016ef3e954b5f
merge NxN and 4x4 fast RD path
---
 source/encoder/entropy.cpp |   18 +++---------------
 1 files changed, 3 insertions(+), 15 deletions(-)

diff -r 2a57298045d8 -r f2a13eb7ae45 source/encoder/entropy.cpp
--- a/source/encoder/entropy.cpp	Thu Jun 04 12:13:12 2015 -0700
+++ b/source/encoder/entropy.cpp	Thu Jun 04 12:13:14 2015 -0700
@@ -1665,24 +1665,12 @@
             else // fast RD path
             {
                 // maximum g_entropyBits are 18-bits and maximum of count are 16, so intermedia of sum are 22-bits
-                uint32_t sum = 0;
-                if (log2TrSize == 2)
-                {
-                    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
-                {
-                    X265_CHECK((log2TrSize > 2), "log2TrSize must be more than 2 in this path!\n");
-                    const uint8_t *tabSigCtx = table_cnt[(uint32_t)patternSigCtx];
-
-                    sum = primitives.costCoeffNxN(g_scan4x4[codingParameters.scanType], &coeff[blkPosBase], (intptr_t)trSize, absCoeff + numNonZero, tabSigCtx, scanFlagMask, baseCtx, offset + posOffset, scanPosSigOff, subPosBase);
+                const uint8_t *tabSigCtx = table_cnt[(log2TrSize == 2) ? 4 : (uint32_t)patternSigCtx];
+                uint32_t sum = primitives.costCoeffNxN(g_scan4x4[codingParameters.scanType], &coeff[blkPosBase], (intptr_t)trSize, absCoeff + numNonZero, tabSigCtx, scanFlagMask, baseCtx, offset + posOffset, scanPosSigOff, subPosBase);
 
 #if CHECKED_BUILD || _DEBUG
-                    numNonZero = coeffNum[subSet];
+                numNonZero = coeffNum[subSet];
 #endif
-                } // end of non 4x4 path
-                sum &= 0xFFFFFF;
-
                 // update RD cost
                 m_fracBits += sum;
             } // end of fast RD path -- !m_bitIf



More information about the x265-devel mailing list