[x265] [PATCH 4 of 4] improve by replace condition operator to mask based
Min Chen
chenm003 at 163.com
Sat May 16 04:29:42 CEST 2015
# HG changeset patch
# User Min Chen <chenm003 at 163.com>
# Date 1431743349 25200
# Node ID 09b3ab102563f5cebbfc45356d6d8aae9ea2f7fe
# Parent 2b7090d749ba1bb414fc1f6a2c1a9e735de2b627
improve by replace condition operator to mask based
---
source/common/quant.cpp | 12 ++++++------
1 files changed, 6 insertions(+), 6 deletions(-)
diff -r 2b7090d749ba -r 09b3ab102563 source/common/quant.cpp
--- a/source/common/quant.cpp Fri May 15 17:30:24 2015 -0700
+++ b/source/common/quant.cpp Fri May 15 19:29:09 2015 -0700
@@ -320,7 +320,7 @@
if (signbit != (absSum & 0x1)) // compare signbit with sum_parity
{
int minCostInc = MAX_INT, minPos = -1, curCost = MAX_INT;
- int16_t finalChange = 0, curChange = 0;
+ int32_t finalChange = 0, curChange = 0;
uint32_t cgFlags = coeffFlag[cg];
if (cg == cgLastScanPos)
cgFlags >>= correctOffset;
@@ -328,7 +328,7 @@
for (n = (cg == cgLastScanPos ? lastNZPosInCG : SCAN_SET_SIZE - 1); n >= 0; --n)
{
uint32_t blkPos = scan[n + cgStartPos];
- X265_CHECK(!!coeff[blkPos] == (cgFlags & 1), "non zero coeff check failure\n");
+ X265_CHECK(!!coeff[blkPos] == !!(cgFlags & 1), "non zero coeff check failure\n");
if (cgFlags & 1)
{
@@ -390,10 +390,10 @@
else if (finalChange == -1 && abs(coeff[minPos]) == 1)
numSig--;
- if (m_resiDctCoeff[minPos] >= 0)
- coeff[minPos] += finalChange;
- else
- coeff[minPos] -= finalChange;
+ {
+ const int16_t sigMask = ((int16_t)m_resiDctCoeff[minPos]) >> 15;
+ coeff[minPos] += ((int16_t)finalChange ^ sigMask) - sigMask;
+ }
}
}
}
More information about the x265-devel
mailing list