[x265] [PATCH 3 of 4] reuse coeffFlag to reduce memory operator on coeff[] memory
Min Chen
chenm003 at 163.com
Sat May 16 04:29:41 CEST 2015
# HG changeset patch
# User Min Chen <chenm003 at 163.com>
# Date 1431736224 25200
# Node ID 2b7090d749ba1bb414fc1f6a2c1a9e735de2b627
# Parent 8a72f51e58a850dda1646900cba05ab50f282fd3
reuse coeffFlag to reduce memory operator on coeff[] memory
---
source/common/quant.cpp | 16 +++++++++++++---
1 files changed, 13 insertions(+), 3 deletions(-)
diff -r 8a72f51e58a8 -r 2b7090d749ba source/common/quant.cpp
--- a/source/common/quant.cpp Fri May 15 17:30:22 2015 -0700
+++ b/source/common/quant.cpp Fri May 15 17:30:24 2015 -0700
@@ -321,11 +321,16 @@
{
int minCostInc = MAX_INT, minPos = -1, curCost = MAX_INT;
int16_t finalChange = 0, curChange = 0;
+ uint32_t cgFlags = coeffFlag[cg];
+ if (cg == cgLastScanPos)
+ cgFlags >>= correctOffset;
for (n = (cg == cgLastScanPos ? lastNZPosInCG : SCAN_SET_SIZE - 1); n >= 0; --n)
{
uint32_t blkPos = scan[n + cgStartPos];
- if (coeff[blkPos])
+ X265_CHECK(!!coeff[blkPos] == (cgFlags & 1), "non zero coeff check failure\n");
+
+ if (cgFlags & 1)
{
if (deltaU[blkPos] > 0)
{
@@ -334,8 +339,11 @@
}
else
{
- if (n == firstNZPosInCG && abs(coeff[blkPos]) == 1)
+ if ((cgFlags == 1) && (abs(coeff[blkPos]) == 1))
+ {
+ X265_CHECK(n == firstNZPosInCG, "firstNZPosInCG position check failure\n");
curCost = MAX_INT;
+ }
else
{
curCost = deltaU[blkPos];
@@ -345,8 +353,9 @@
}
else
{
- if (n < firstNZPosInCG)
+ if (cgFlags == 0)
{
+ X265_CHECK(n < firstNZPosInCG, "firstNZPosInCG position check failure\n");
uint32_t thisSignBit = m_resiDctCoeff[blkPos] >= 0 ? 0 : 1;
if (thisSignBit != signbit)
curCost = MAX_INT;
@@ -369,6 +378,7 @@
finalChange = curChange;
minPos = blkPos;
}
+ cgFlags>>=1;
}
/* do not allow change to violate coeff clamp */
More information about the x265-devel
mailing list