[x265] [PATCH 6 of 6] reduce shift operator on coeff remain code
Min Chen
chenm003 at 163.com
Wed Jun 17 01:31:19 CEST 2015
# HG changeset patch
# User Min Chen <chenm003 at 163.com>
# Date 1434496332 25200
# Node ID deee2eae898d7ea835a50482aaacac8205fc9fa3
# Parent 6cc50a833797c6fac594710996bbf6e88f0adc93
reduce shift operator on coeff remain code
---
source/encoder/entropy.cpp | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diff -r 6cc50a833797 -r deee2eae898d source/encoder/entropy.cpp
--- a/source/encoder/entropy.cpp Tue Jun 16 15:54:22 2015 -0700
+++ b/source/encoder/entropy.cpp Tue Jun 16 16:12:12 2015 -0700
@@ -1809,6 +1809,7 @@
// Standard path
uint32_t goRiceParam = 0;
int baseLevel = 3;
+ uint32_t threshold = COEF_REMAIN_BIN_REDUCTION;
#if CHECKED_BUILD || _DEBUG
int firstCoeff2 = 1;
#endif
@@ -1823,8 +1824,10 @@
if (absCoeff[idx] >= baseLevel)
{
writeCoefRemainExGolomb(absCoeff[idx] - baseLevel, goRiceParam);
- if (absCoeff[idx] > (COEF_REMAIN_BIN_REDUCTION << goRiceParam))
- goRiceParam = (goRiceParam + 1) - (goRiceParam >> 2);
+ X265_CHECK(threshold == (uint32_t)(COEF_REMAIN_BIN_REDUCTION << goRiceParam), "COEF_REMAIN_BIN_REDUCTION check failure\n");
+ const int adjust = (absCoeff[idx] > threshold) & (goRiceParam <= 3);
+ goRiceParam += adjust;
+ threshold += (adjust) ? threshold : 0;
X265_CHECK(goRiceParam <= 4, "goRiceParam check failure\n");
}
#if CHECKED_BUILD || _DEBUG
More information about the x265-devel
mailing list