[x265] [PATCH 1 of 4] faster algorithm to calculate ctxSet in codeCoeffNxN()

Min Chen chenm003 at 163.com
Tue Jun 23 02:54:54 CEST 2015


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

diff -r 83a7d8244424 -r b3915bc1febd source/encoder/entropy.cpp
--- a/source/encoder/entropy.cpp	Mon Jun 22 15:15:33 2015 +0530
+++ b/source/encoder/entropy.cpp	Mon Jun 22 17:39:45 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