[x265] [PATCH 2 of 6] asm: reuse costCoeffGroupNxN in 4x4 path

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


# HG changeset patch
# User Min Chen <chenm003 at 163.com>
# Date 1433445189 25200
# Node ID b740e2fe118387360b9c4ab960c58555d512a250
# Parent  24f347c00df01352fa6860e05b376846d8d8cc74
asm: reuse costCoeffGroupNxN in 4x4 path
---
 source/encoder/entropy.cpp |   37 +------------------------------------
 1 files changed, 1 insertions(+), 36 deletions(-)

diff -r 24f347c00df0 -r b740e2fe1183 source/encoder/entropy.cpp
--- a/source/encoder/entropy.cpp	Thu Jun 04 12:13:05 2015 -0700
+++ b/source/encoder/entropy.cpp	Thu Jun 04 12:13:09 2015 -0700
@@ -1668,42 +1668,7 @@
                 uint32_t sum = 0;
                 if (log2TrSize == 2)
                 {
-                    // TODO: accelerate by PABSW
-                    for (int i = 0; i < MLS_CG_SIZE; i++)
-                    {
-                        tmpCoeff[i * MLS_CG_SIZE + 0] = (uint16_t)abs(coeff[blkPosBase + i * trSize + 0]);
-                        tmpCoeff[i * MLS_CG_SIZE + 1] = (uint16_t)abs(coeff[blkPosBase + i * trSize + 1]);
-                        tmpCoeff[i * MLS_CG_SIZE + 2] = (uint16_t)abs(coeff[blkPosBase + i * trSize + 2]);
-                        tmpCoeff[i * MLS_CG_SIZE + 3] = (uint16_t)abs(coeff[blkPosBase + i * trSize + 3]);
-                    }
-
-                    do
-                    {
-                        uint32_t blkPos, sig, ctxSig;
-                        blkPos = g_scan4x4[codingParameters.scanType][scanPosSigOff];
-                        sig     = scanFlagMask & 1;
-                        scanFlagMask >>= 1;
-                        X265_CHECK((uint32_t)(tmpCoeff[blkPos] != 0) == sig, "sign bit mistake\n");
-                        {
-                            ctxSig = ctxIndMap4x4[blkPos];
-                            X265_CHECK(ctxSig == Quant::getSigCtxInc(patternSigCtx, log2TrSize, trSize, codingParameters.scan[subPosBase + scanPosSigOff], bIsLuma, codingParameters.firstSignificanceMapContext), "sigCtx mistake!\n");;
-                            //encodeBin(sig, baseCtx[ctxSig]);
-                            const uint32_t mstate = baseCtx[ctxSig];
-                            const uint32_t mps = mstate & 1;
-                            const uint32_t stateBits = g_entropyStateBits[mstate ^ sig];
-                            uint32_t nextState = (stateBits >> 24) + mps;
-                            if ((mstate ^ sig) == 1)
-                                nextState = sig;
-                            X265_CHECK(sbacNext(mstate, sig) == nextState, "nextState check failure\n");
-                            X265_CHECK(sbacGetEntropyBits(mstate, sig) == (stateBits & 0xFFFFFF), "entropyBits check failure\n");
-                            baseCtx[ctxSig] = (uint8_t)nextState;
-                            sum += stateBits;
-                        }
-                        absCoeff[numNonZero] = tmpCoeff[blkPos];
-                        numNonZero += sig;
-                        scanPosSigOff--;
-                    }
-                    while(scanPosSigOff >= 0);
+                    sum = primitives.costCoeffNxN(g_scan4x4[codingParameters.scanType], &coeff[blkPosBase], (intptr_t)trSize, absCoeff + numNonZero, ctxIndMap4x4, scanFlagMask, baseCtx, offset + posOffset, scanPosSigOff, 0);
                 } // end of 4x4
                 else
                 {



More information about the x265-devel mailing list