[x265] [PATCH 4 of 4] rdoQuant: reduce address operators by swap order on array significantBits[][]
Min Chen
chenm003 at 163.com
Mon Apr 27 14:32:12 CEST 2015
# HG changeset patch
# User Min Chen <chenm003 at 163.com>
# Date 1430137914 -28800
# Node ID ef528f33270a1ba7e56ffdbf64d84f2dd8dac9b1
# Parent 0232a96d7fb2c07bac98910d5ce9bc207652779d
rdoQuant: reduce address operators by swap order on array significantBits[][]
---
source/common/quant.cpp | 18 +++++++++---------
source/encoder/entropy.cpp | 8 ++++----
source/encoder/entropy.h | 2 +-
3 files changed, 14 insertions(+), 14 deletions(-)
diff -r 0232a96d7fb2 -r ef528f33270a source/common/quant.cpp
--- a/source/common/quant.cpp Mon Apr 27 20:31:50 2015 +0800
+++ b/source/common/quant.cpp Mon Apr 27 20:31:54 2015 +0800
@@ -743,9 +743,9 @@
X265_CHECK(trSize > 4, "trSize check failure\n");
X265_CHECK(ctxSig == getSigCtxInc(patternSigCtx, log2TrSize, trSize, codeParams.scan[scanPosBase + scanPosOffset], bIsLuma, codeParams.firstSignificanceMapContext), "sigCtx check failure\n");
- costSig[scanPosBase + scanPosOffset] = SIGCOST(estBitsSbac.significantBits[ctxSig][0]);
+ costSig[scanPosBase + scanPosOffset] = SIGCOST(estBitsSbac.significantBits[0][ctxSig]);
costCoeff[scanPosBase + scanPosOffset] = costUncoded[blkPos + x];
- sigRateDelta[blkPos + x] = estBitsSbac.significantBits[ctxSig][1] - estBitsSbac.significantBits[ctxSig][0];
+ sigRateDelta[blkPos + x] = estBitsSbac.significantBits[1][ctxSig] - estBitsSbac.significantBits[0][ctxSig];
}
blkPos += trSize;
}
@@ -768,9 +768,9 @@
X265_CHECK(trSize > 4, "trSize check failure\n");
X265_CHECK(ctxSig == getSigCtxInc(patternSigCtx, log2TrSize, trSize, codeParams.scan[scanPosBase + scanPosOffset], bIsLuma, codeParams.firstSignificanceMapContext), "sigCtx check failure\n");
- costSig[scanPosBase + scanPosOffset] = SIGCOST(estBitsSbac.significantBits[ctxSig][0]);
+ costSig[scanPosBase + scanPosOffset] = SIGCOST(estBitsSbac.significantBits[0][ctxSig]);
costCoeff[scanPosBase + scanPosOffset] = costUncoded[blkPos + x];
- sigRateDelta[blkPos + x] = estBitsSbac.significantBits[ctxSig][1] - estBitsSbac.significantBits[ctxSig][0];
+ sigRateDelta[blkPos + x] = estBitsSbac.significantBits[1][ctxSig] - estBitsSbac.significantBits[0][ctxSig];
}
blkPos += trSize;
}
@@ -836,9 +836,9 @@
{
// fast zero coeff path
/* set default costs to uncoded costs */
- costSig[scanPos] = SIGCOST(estBitsSbac.significantBits[ctxSig][0]);
+ costSig[scanPos] = SIGCOST(estBitsSbac.significantBits[0][ctxSig]);
costCoeff[scanPos] = costUncoded[blkPos] + costSig[scanPos];
- sigRateDelta[blkPos] = estBitsSbac.significantBits[ctxSig][1] - estBitsSbac.significantBits[ctxSig][0];
+ sigRateDelta[blkPos] = estBitsSbac.significantBits[1][ctxSig] - estBitsSbac.significantBits[0][ctxSig];
totalRdCost += costCoeff[scanPos];
rateIncUp[blkPos] = greaterOneBits[0];
@@ -869,11 +869,11 @@
if (maxAbsLevel < 3)
{
/* set default costs to uncoded costs */
- costSig[scanPos] = SIGCOST(estBitsSbac.significantBits[ctxSig][0]);
+ costSig[scanPos] = SIGCOST(estBitsSbac.significantBits[0][ctxSig]);
costCoeff[scanPos] = costUncoded[blkPos] + costSig[scanPos];
}
- sigRateDelta[blkPos] = estBitsSbac.significantBits[ctxSig][1] - estBitsSbac.significantBits[ctxSig][0];
- sigCoefBits = estBitsSbac.significantBits[ctxSig][1];
+ sigRateDelta[blkPos] = estBitsSbac.significantBits[1][ctxSig] - estBitsSbac.significantBits[0][ctxSig];
+ sigCoefBits = estBitsSbac.significantBits[1][ctxSig];
}
// NOTE: X265_MAX(maxAbsLevel - 1, 1) ==> (X>=2 -> X-1), (X<2 -> 1) | (0 < X < 2 ==> X=1)
diff -r 0232a96d7fb2 -r ef528f33270a source/encoder/entropy.cpp
--- a/source/encoder/entropy.cpp Mon Apr 27 20:31:50 2015 +0800
+++ b/source/encoder/entropy.cpp Mon Apr 27 20:31:54 2015 +0800
@@ -1877,20 +1877,20 @@
if (bIsLuma)
{
for (uint32_t bin = 0; bin < 2; bin++)
- estBitsSbac.significantBits[0][bin] = sbacGetEntropyBits(m_contextState[OFF_SIG_FLAG_CTX], bin);
+ estBitsSbac.significantBits[bin][0] = sbacGetEntropyBits(m_contextState[OFF_SIG_FLAG_CTX], bin);
for (int ctxIdx = firstCtx; ctxIdx < firstCtx + numCtx; ctxIdx++)
for (uint32_t bin = 0; bin < 2; bin++)
- estBitsSbac.significantBits[ctxIdx][bin] = sbacGetEntropyBits(m_contextState[OFF_SIG_FLAG_CTX + ctxIdx], bin);
+ estBitsSbac.significantBits[bin][ctxIdx] = sbacGetEntropyBits(m_contextState[OFF_SIG_FLAG_CTX + ctxIdx], bin);
}
else
{
for (uint32_t bin = 0; bin < 2; bin++)
- estBitsSbac.significantBits[0][bin] = sbacGetEntropyBits(m_contextState[OFF_SIG_FLAG_CTX + (NUM_SIG_FLAG_CTX_LUMA + 0)], bin);
+ estBitsSbac.significantBits[bin][0] = sbacGetEntropyBits(m_contextState[OFF_SIG_FLAG_CTX + (NUM_SIG_FLAG_CTX_LUMA + 0)], bin);
for (int ctxIdx = firstCtx; ctxIdx < firstCtx + numCtx; ctxIdx++)
for (uint32_t bin = 0; bin < 2; bin++)
- estBitsSbac.significantBits[ctxIdx][bin] = sbacGetEntropyBits(m_contextState[OFF_SIG_FLAG_CTX + (NUM_SIG_FLAG_CTX_LUMA + ctxIdx)], bin);
+ estBitsSbac.significantBits[bin][ctxIdx] = sbacGetEntropyBits(m_contextState[OFF_SIG_FLAG_CTX + (NUM_SIG_FLAG_CTX_LUMA + ctxIdx)], bin);
}
int blkSizeOffset = bIsLuma ? ((log2TrSize - 2) * 3 + ((log2TrSize - 1) >> 2)) : NUM_CTX_LAST_FLAG_XY_LUMA;
diff -r 0232a96d7fb2 -r ef528f33270a source/encoder/entropy.h
--- a/source/encoder/entropy.h Mon Apr 27 20:31:50 2015 +0800
+++ b/source/encoder/entropy.h Mon Apr 27 20:31:54 2015 +0800
@@ -87,7 +87,7 @@
struct EstBitsSbac
{
int significantCoeffGroupBits[NUM_SIG_CG_FLAG_CTX][2];
- int significantBits[NUM_SIG_FLAG_CTX][2];
+ int significantBits[2][NUM_SIG_FLAG_CTX];
int lastBits[2][10];
int greaterOneBits[NUM_ONE_FLAG_CTX][2];
int levelAbsBits[NUM_ABS_FLAG_CTX][2];
More information about the x265-devel
mailing list