[x265] [PATCH 4 of 5] reduce conditional operators on c1Flag loop in codeCoeffNxN()
Min Chen
chenm003 at 163.com
Tue May 12 01:42:26 CEST 2015
# HG changeset patch
# User Min Chen <chenm003 at 163.com>
# Date 1431386748 25200
# Node ID a58a6e5bb3c6c4f2541d0dbd77bd35d6f40c2eb7
# Parent d4eda2573100588fb6e32188d592cd648da046e9
reduce conditional operators on c1Flag loop in codeCoeffNxN()
---
source/encoder/entropy.cpp | 19 ++++++++++++++-----
1 files changed, 14 insertions(+), 5 deletions(-)
diff -r d4eda2573100 -r a58a6e5bb3c6 source/encoder/entropy.cpp
--- a/source/encoder/entropy.cpp Mon May 11 16:25:45 2015 -0700
+++ b/source/encoder/entropy.cpp Mon May 11 16:25:48 2015 -0700
@@ -1769,15 +1769,24 @@
{
uint32_t symbol = absCoeff[idx] > 1;
encodeBin(symbol, baseCtxMod[c1]);
+
+ // TODO: VC can't work fine on below style, but ICL can generate branch free code
+#ifdef __INTEL_COMPILER
+ if (symbol)
+ c1 = 0;
+
+ if ((firstC2FlagIdx < 0) & symbol)
+ firstC2FlagIdx = (int)idx;
+#else
if (symbol)
{
c1 = 0;
-
- if (firstC2FlagIdx == -1)
- firstC2FlagIdx = idx;
+ if (firstC2FlagIdx < 0)
+ firstC2FlagIdx = (int)idx;
}
- else if ((c1 < 3) && (c1 > 0))
- c1++;
+#endif
+ c1 += ((c1 >> 1) ^ c1) & 1;
+ X265_CHECK((c1 >= 0) && (c1 <= 3), "c1 check failure\n");
idx++;
}
while(idx < numC1Flag);
More information about the x265-devel
mailing list