[x265] [PATCH 5 of 6] reduce VC condition branch by modify code style

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


# HG changeset patch
# User Min Chen <chenm003 at 163.com>
# Date 1434495262 25200
# Node ID 6cc50a833797c6fac594710996bbf6e88f0adc93
# Parent  03f1e3d7a8ff3555850cad6e2f1a3c0293becc24
reduce VC condition branch by modify code style
---
 source/encoder/entropy.cpp |   11 ++++-------
 1 files changed, 4 insertions(+), 7 deletions(-)

diff -r 03f1e3d7a8ff -r 6cc50a833797 source/encoder/entropy.cpp
--- a/source/encoder/entropy.cpp	Tue Jun 16 15:54:09 2015 -0700
+++ b/source/encoder/entropy.cpp	Tue Jun 16 15:54:22 2015 -0700
@@ -1776,18 +1776,15 @@
                 idx = 0;
                 do
                 {
-                    uint32_t symbol1 = absCoeff[idx] > 1;
-                    uint32_t symbol2 = absCoeff[idx] > 2;
+                    const uint32_t symbol1 = absCoeff[idx] > 1;
+                    const uint32_t symbol2 = absCoeff[idx] > 2;
                     encodeBin(symbol1, baseCtxMod[c1]);
 
                     if (symbol1)
                         c1Next = 0;
 
-                    if (symbol1 + firstC2Flag == 3)
-                        firstC2Flag = symbol2;
-
-                    if (symbol1 + firstC2Idx == 9)
-                        firstC2Idx  = idx;
+                    firstC2Flag = (symbol1 + firstC2Flag == 3) ? symbol2 : firstC2Flag;
+                    firstC2Idx  = (symbol1 + firstC2Idx == 9) ? idx : firstC2Idx;
 
                     c1 = (c1Next & 3);
                     c1Next >>= 2;



More information about the x265-devel mailing list