[x265] [PATCH 02 of 16] reduce operators on goRiceParam and c1 update logic in rdoQuant()
Min Chen
chenm003 at 163.com
Wed Oct 7 00:55:13 CEST 2015
# HG changeset patch
# User Min Chen <chenm003 at 163.com>
# Date 1444148054 18000
# Node ID 0c7ff7c3e85053009cae137e3a46584af74fdbe4
# Parent 4d32c813b4653c1de49325040e70627b05234c77
reduce operators on goRiceParam and c1 update logic in rdoQuant()
---
source/common/quant.cpp | 11 ++++++++---
1 files changed, 8 insertions(+), 3 deletions(-)
diff -r 4d32c813b465 -r 0c7ff7c3e850 source/common/quant.cpp
--- a/source/common/quant.cpp Tue Oct 06 11:14:11 2015 -0500
+++ b/source/common/quant.cpp Tue Oct 06 11:14:14 2015 -0500
@@ -825,6 +825,7 @@
uint32_t subFlagMask = coeffFlag[cgScanPos];
int c2 = 0;
uint32_t goRiceParam = 0;
+ uint32_t levelThreshold = 3;
uint32_t c1Idx = 0;
uint32_t c2Idx = 0;
/* iterate over coefficients in each group in reverse scan order */
@@ -1034,10 +1035,14 @@
}
/* Update CABAC estimation state */
- if (level >= baseLevel && goRiceParam < 4 && level > (3U << goRiceParam))
+ if ((level >= baseLevel) && (goRiceParam < 4) && (level > levelThreshold))
+ {
goRiceParam++;
+ levelThreshold <<= 1;
+ }
- c1Idx -= (-(int32_t)level) >> 31;
+ const uint32_t isNonZero = (uint32_t)(-(int32_t)level) >> 31;
+ c1Idx += isNonZero;
/* update bin model */
if (level > 1)
@@ -1046,7 +1051,7 @@
c2 += (uint32_t)(c2 - 2) >> 31;
c2Idx++;
}
- else if (((c1 == 1) | (c1 == 2)) && level)
+ else if (((c1 == 1) | (c1 == 2)) & isNonZero)
c1++;
if (dstCoeff[blkPos])
More information about the x265-devel
mailing list