[x265] [PATCH] entropy: inline codeTransformSkipFlags()

ashok at multicorewareinc.com ashok at multicorewareinc.com
Wed Dec 24 08:23:50 CET 2014


# HG changeset patch
# User Ashok Kumar Mishra<ashok at multicorewareinc.com>
# Date 1419404487 -19800
#      Wed Dec 24 12:31:27 2014 +0530
# Node ID 1bf769c6953d7c4f660d26a8618083ac1c0885e5
# Parent  5f9f7194267b76f733e9ffb0f9e8b474dfe89a71
entropy: inline codeTransformSkipFlags()

diff -r 5f9f7194267b -r 1bf769c6953d source/encoder/entropy.cpp
--- a/source/encoder/entropy.cpp	Tue Dec 23 17:40:53 2014 +0900
+++ b/source/encoder/entropy.cpp	Wed Dec 24 12:31:27 2014 +0530
@@ -1407,17 +1407,6 @@
         encodeBin(cu.getCbf(absPartIdx, ttype, lowestTUDepth), m_contextState[OFF_QT_CBF_CTX + ctx]);
 }
 
-void Entropy::codeTransformSkipFlags(const CUData& cu, uint32_t absPartIdx, uint32_t trSize, TextType ttype)
-{
-    if (cu.m_tqBypass[absPartIdx])
-        return;
-    if (trSize != 4)
-        return;
-
-    uint32_t useTransformSkip = cu.m_transformSkip[ttype][absPartIdx];
-    encodeBin(useTransformSkip, m_contextState[OFF_TRANSFORMSKIP_FLAG_CTX + (ttype ? NUM_TRANSFORMSKIP_FLAG_CTX : 0)]);
-}
-
 /** Encode (X,Y) position of the last significant coefficient
  * \param posx X component of last coefficient
  * \param posy Y component of last coefficient
@@ -1473,17 +1462,18 @@
 void Entropy::codeCoeffNxN(const CUData& cu, const coeff_t* coeff, uint32_t absPartIdx, uint32_t log2TrSize, TextType ttype)
 {
     uint32_t trSize = 1 << log2TrSize;
+    uint32_t tqBypass = cu.m_tqBypass[absPartIdx];
 
     // compute number of significant coefficients
     uint32_t numSig = primitives.count_nonzero(coeff, (1 << (log2TrSize << 1)));
 
     X265_CHECK(numSig > 0, "cbf check fail\n");
 
-    bool bHideFirstSign = cu.m_slice->m_pps->bSignHideEnabled && !cu.m_tqBypass[absPartIdx];
+    bool bHideFirstSign = cu.m_slice->m_pps->bSignHideEnabled && !tqBypass;
 
-    if (cu.m_slice->m_pps->bTransformSkipEnabled)
-        codeTransformSkipFlags(cu, absPartIdx, trSize, ttype);
-    
+    if (cu.m_slice->m_pps->bTransformSkipEnabled && !tqBypass && (trSize == 4))
+        codeTransformSkipFlags(cu.m_transformSkip[ttype][absPartIdx], ttype);
+
     bool bIsLuma = ttype == TEXT_LUMA;
 
     // select scans
diff -r 5f9f7194267b -r 1bf769c6953d source/encoder/entropy.h
--- a/source/encoder/entropy.h	Tue Dec 23 17:40:53 2014 +0900
+++ b/source/encoder/entropy.h	Wed Dec 24 12:31:27 2014 +0530
@@ -179,6 +179,7 @@
     inline void codeQtCbfLuma(uint32_t cbf, uint32_t tuDepth)             { encodeBin(cbf, m_contextState[OFF_QT_CBF_CTX + !tuDepth]); }
     inline void codeQtCbfChroma(uint32_t cbf, uint32_t tuDepth)           { encodeBin(cbf, m_contextState[OFF_QT_CBF_CTX + 2 + tuDepth]); }
     inline void codeQtRootCbf(uint32_t cbf)                               { encodeBin(cbf, m_contextState[OFF_QT_ROOT_CBF_CTX]); }
+    inline void codeTransformSkipFlags(uint32_t transformSkip, TextType ttype) { encodeBin(transformSkip, m_contextState[OFF_TRANSFORMSKIP_FLAG_CTX + (ttype ? NUM_TRANSFORMSKIP_FLAG_CTX : 0)]); }
 
     void codeSaoOffset(const SaoCtuParam& ctuParam, int plane);
 
@@ -244,7 +245,6 @@
 
     void codeDeltaQP(const CUData& cu, uint32_t absPartIdx);
     void codeLastSignificantXY(uint32_t posx, uint32_t posy, uint32_t log2TrSize, bool bIsLuma, uint32_t scanIdx);
-    void codeTransformSkipFlags(const CUData& cu, uint32_t absPartIdx, uint32_t trSize, TextType ttype);
 
     void encodeTransform(const CUData& cu, uint32_t absPartIdx, uint32_t tuDepth, uint32_t log2TrSize,
                          bool& bCodeDQP, const uint32_t depthRange[2]);


More information about the x265-devel mailing list