[x265] [PATCH 1 of 6] entropy: simplify sign hide flag

Steve Borho steve at borho.org
Sat Aug 9 10:23:39 CEST 2014


# HG changeset patch
# User Steve Borho <steve at borho.org>
# Date 1407525634 18000
#      Fri Aug 08 14:20:34 2014 -0500
# Node ID 84acc8eb8d9c2dba35d8cf80f9135054781d60dc
# Parent  091a63164c41b152f86de3a1922223a2252f4ac7
entropy: simplify sign hide flag

diff -r 091a63164c41 -r 84acc8eb8d9c source/encoder/entropy.cpp
--- a/source/encoder/entropy.cpp	Thu Aug 07 18:18:11 2014 -0500
+++ b/source/encoder/entropy.cpp	Fri Aug 08 14:20:34 2014 -0500
@@ -1493,11 +1493,7 @@
 
     X265_CHECK(numSig > 0, "cbf check fail\n");
 
-    bool beValid;
-    if (cu->getCUTransquantBypass(absPartIdx))
-        beValid = false;
-    else
-        beValid = cu->m_slice->m_pps->bSignHideEnabled;
+    bool bHideFirstSign = cu->m_slice->m_pps->bSignHideEnabled && !cu->getCUTransquantBypass(absPartIdx);
 
     if (cu->m_slice->m_pps->bTransformSkipEnabled)
         codeTransformSkipFlags(cu, absPartIdx, trSize, ttype);
@@ -1537,6 +1533,7 @@
     int posLastY = posLast >> log2TrSize;
     int posLastX = posLast & (trSize - 1);
     codeLastSignificantXY(posLastX, posLastY, log2TrSize, bIsLuma, codingParameters.scanType);
+
     //===== code significance flag =====
     uint8_t * const baseCoeffGroupCtx = &m_contextState[OFF_SIG_CG_FLAG_CTX + (bIsLuma ? 0 : NUM_SIG_CG_FLAG_CTX)];
     uint8_t * const baseCtx = bIsLuma ? &m_contextState[OFF_SIG_FLAG_CTX] : &m_contextState[OFF_SIG_FLAG_CTX + NUM_SIG_FLAG_CTX_LUMA];
@@ -1644,7 +1641,7 @@
                 }
             }
 
-            if (beValid && signHidden)
+            if (bHideFirstSign && signHidden)
                 encodeBinsEP((coeffSigns >> 1), numNonZero - 1);
             else
                 encodeBinsEP(coeffSigns, numNonZero);


More information about the x265-devel mailing list