[x265] [PATCH 2 of 6] faster algorithm to calculate ctxSet in codeCoeffNxN()

Min Chen chenm003 at 163.com
Wed Jun 17 01:31:15 CEST 2015


# HG changeset patch
# User Min Chen <chenm003 at 163.com>
# Date 1434495240 25200
# Node ID 6977137391b30dbc9ed55b7bf3e35dcfb40aef9a
# Parent  f8538b22787c8ab0d1cf65446b7e438cb02d544d
faster algorithm to calculate ctxSet in codeCoeffNxN()
---
 source/encoder/entropy.cpp |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diff -r f8538b22787c -r 6977137391b3 source/encoder/entropy.cpp
--- a/source/encoder/entropy.cpp	Tue Jun 16 09:45:57 2015 -0700
+++ b/source/encoder/entropy.cpp	Tue Jun 16 15:54:00 2015 -0700
@@ -1739,9 +1739,8 @@
             CTZ(firstNZPosInCG, subCoeffFlag);
 
             bool signHidden = (lastNZPosInCG - firstNZPosInCG >= SBH_THRESHOLD);
-            uint32_t ctxSet = ((subSet > 0) & bIsLuma) ? 2 : 0;
-
-            ctxSet += !(c1 & 3);
+            const uint8_t ctxSet = (((subSet > 0) + bIsLuma) & 2) | !(c1 & 3);
+            X265_CHECK((((subSet > 0) & bIsLuma) ? 2 : 0) + !(c1 & 3) == ctxSet, "ctxSet check failure\n");
 
             c1 = 1;
             uint8_t *baseCtxMod = &m_contextState[(bIsLuma ? 0 : NUM_ONE_FLAG_CTX_LUMA) + OFF_ONE_FLAG_CTX + 4 * ctxSet];



More information about the x265-devel mailing list