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

chen chenm003 at 163.com
Thu Jun 18 19:37:11 CEST 2015


 
在 2015-06-18 13:33:11,"Deepthi Nandakumar" <deepthi at multicorewareinc.com> 写道:





On Wed, Jun 17, 2015 at 5:01 AM, Min Chen <chenm003 at 163.com> wrote:
# 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");


Min, this really affects readability. Are the savings from removing the conditional operator?

the X265_CHECK show more clean, so I think it is not a problem
I got ~0.8% improve in total time
 
             c1 = 1;
             uint8_t *baseCtxMod = &m_contextState[(bIsLuma ? 0 : NUM_ONE_FLAG_CTX_LUMA) + OFF_ONE_FLAG_CTX + 4 * ctxSet];

_______________________________________________
x265-devel mailing list
x265-devel at videolan.org
https://mailman.videolan.org/listinfo/x265-devel


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20150619/0704bb9d/attachment.html>


More information about the x265-devel mailing list