<div dir="ltr">Is it also possible to change codeQtCbf so that only uint32_t cbf needs to be passed in, and not entire TComDataCU*? This will help since our coming refactors will get rid of TComDataCU. <br><br><br></div><div class="gmail_extra">

<br><br><div class="gmail_quote">On Mon, Sep 1, 2014 at 3:17 PM, Steve Borho <span dir="ltr"><<a href="mailto:steve@borho.org" target="_blank">steve@borho.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<div class="">On 09/01, <a href="mailto:ashok@multicorewareinc.com">ashok@multicorewareinc.com</a> wrote:<br>
> # HG changeset patch<br>
> # User Ashok Kumar Mishra<<a href="mailto:ashok@multicorewareinc.com">ashok@multicorewareinc.com</a>><br>
> # Date 1409562155 -19800<br>
> #      Mon Sep 01 14:32:35 2014 +0530<br>
> # Node ID e7f58267b15c2d6d477bd370f936d00377d2bbc3<br>
> # Parent  4d96eb40f4d6e5cd0883a0a61f20bf00c07ed8f0<br>
> Entropy: Replaced getCtxQtCbf() with table<br>
<br>
</div>nice! but a nit<br>
<div class=""><br>
> diff -r 4d96eb40f4d6 -r e7f58267b15c source/Lib/TLibCommon/ContextTables.h<br>
> --- a/source/Lib/TLibCommon/ContextTables.h   Thu Aug 28 13:14:34 2014 +0530<br>
> +++ b/source/Lib/TLibCommon/ContextTables.h   Mon Sep 01 14:32:35 2014 +0530<br>
> @@ -144,6 +144,7 @@<br>
>  #define NEIGHBOURHOOD_00_CONTEXT_1_THRESHOLD_4x4  3<br>
>  #define NEIGHBOURHOOD_00_CONTEXT_2_THRESHOLD_4x4  1<br>
><br>
> +static const uint32_t CtxCbf[3][3] = { { 1, 0, 0 }, { 2, 3, 4 }, { 2, 3, 4} };<br>
<br>
</div>upper-case names are reserved for classes/structs.<br>
<br>
static const uint32_t ctxCbf[MAX_NUM_CHANNEL_TYPE][3] = ...<br>
<div class=""><br>
>  static const uint32_t significanceMapContextSetStart[MAX_NUM_CHANNEL_TYPE][3] = { { 0,  9, 21 }, { 0,  9, 12 } };<br>
>  static const uint32_t significanceMapContextSetSize[MAX_NUM_CHANNEL_TYPE][3]  = { { 9, 12,  6 }, { 9,  3,  3 } };<br>
>  static const uint32_t nonDiagonalScan8x8ContextOffset[MAX_NUM_CHANNEL_TYPE]   = {  6, 0  };<br>
> diff -r 4d96eb40f4d6 -r e7f58267b15c source/Lib/TLibEncoder/TEncSearch.cpp<br>
> --- a/source/Lib/TLibEncoder/TEncSearch.cpp   Thu Aug 28 13:14:34 2014 +0530<br>
> +++ b/source/Lib/TLibEncoder/TEncSearch.cpp   Mon Sep 01 14:32:35 2014 +0530<br>
> @@ -2798,7 +2798,7 @@<br>
>                  else<br>
>                      singleCostY = m_rdCost.calcRdCost(nonZeroDistY, singleBitsComp[TEXT_LUMA][0]);<br>
>                  m_entropyCoder->resetBits();<br>
> -                m_entropyCoder->codeQtCbfZero(cu, TEXT_LUMA, trMode);<br>
> +                m_entropyCoder->codeQtCbfZero(TEXT_LUMA, trMode);<br>
<br>
</div>unrelated to this patch, but why is depth here stored in trMode/trModeC?<br>
<div class="HOEnZb"><div class="h5"><br>
>                  const uint32_t nullBitsY = m_entropyCoder->getNumberOfWrittenBits();<br>
>                  uint64_t nullCostY = 0;<br>
>                  if (m_rdCost.m_psyRd)<br>
> @@ -2826,7 +2826,7 @@<br>
>          else if (checkTransformSkipY)<br>
>          {<br>
>              m_entropyCoder->resetBits();<br>
> -            m_entropyCoder->codeQtCbfZero(cu, TEXT_LUMA, trMode);<br>
> +            m_entropyCoder->codeQtCbfZero(TEXT_LUMA, trMode);<br>
>              const uint32_t nullBitsY = m_entropyCoder->getNumberOfWrittenBits();<br>
>              if (m_rdCost.m_psyRd)<br>
>                  minCost[TEXT_LUMA][0] = m_rdCost.calcPsyRdCost(distY, nullBitsY, psyEnergyY);<br>
> @@ -2898,7 +2898,7 @@<br>
>                          else<br>
>                              singleCostU = m_rdCost.calcRdCost(nonZeroDistU, singleBitsComp[TEXT_CHROMA_U][tuIterator.section]);<br>
>                          m_entropyCoder->resetBits();<br>
> -                        m_entropyCoder->codeQtCbfZero(cu, TEXT_CHROMA_U, trMode);<br>
> +                        m_entropyCoder->codeQtCbfZero(TEXT_CHROMA_U, trMode);<br>
>                          const uint32_t nullBitsU = m_entropyCoder->getNumberOfWrittenBits();<br>
>                          uint64_t nullCostU = 0;<br>
>                          if (m_rdCost.m_psyRd)<br>
> @@ -2926,7 +2926,7 @@<br>
>                  else if (checkTransformSkipUV)<br>
>                  {<br>
>                      m_entropyCoder->resetBits();<br>
> -                    m_entropyCoder->codeQtCbfZero(cu, TEXT_CHROMA_U, trModeC);<br>
> +                    m_entropyCoder->codeQtCbfZero(TEXT_CHROMA_U, trModeC);<br>
>                      const uint32_t nullBitsU = m_entropyCoder->getNumberOfWrittenBits();<br>
>                      if (m_rdCost.m_psyRd)<br>
>                          minCost[TEXT_CHROMA_U][tuIterator.section] = m_rdCost.calcPsyRdCost(distU, nullBitsU, psyEnergyU);<br>
> @@ -2980,7 +2980,7 @@<br>
>                          else<br>
>                              singleCostV = m_rdCost.calcRdCost(nonZeroDistV, singleBitsComp[TEXT_CHROMA_V][tuIterator.section]);<br>
>                          m_entropyCoder->resetBits();<br>
> -                        m_entropyCoder->codeQtCbfZero(cu, TEXT_CHROMA_V, trMode);<br>
> +                        m_entropyCoder->codeQtCbfZero(TEXT_CHROMA_V, trMode);<br>
>                          const uint32_t nullBitsV = m_entropyCoder->getNumberOfWrittenBits();<br>
>                          uint64_t nullCostV = 0;<br>
>                          if (m_rdCost.m_psyRd)<br>
> @@ -3008,7 +3008,7 @@<br>
>                  else if (checkTransformSkipUV)<br>
>                  {<br>
>                      m_entropyCoder->resetBits();<br>
> -                    m_entropyCoder->codeQtCbfZero(cu, TEXT_CHROMA_V, trModeC);<br>
> +                    m_entropyCoder->codeQtCbfZero(TEXT_CHROMA_V, trModeC);<br>
>                      const uint32_t nullBitsV = m_entropyCoder->getNumberOfWrittenBits();<br>
>                      if (m_rdCost.m_psyRd)<br>
>                          minCost[TEXT_CHROMA_V][tuIterator.section] = m_rdCost.calcPsyRdCost(distV, nullBitsV, psyEnergyV);<br>
> diff -r 4d96eb40f4d6 -r e7f58267b15c source/encoder/entropy.cpp<br>
> --- a/source/encoder/entropy.cpp      Thu Aug 28 13:14:34 2014 +0530<br>
> +++ b/source/encoder/entropy.cpp      Mon Sep 01 14:32:35 2014 +0530<br>
> @@ -1469,7 +1469,7 @@<br>
><br>
>  void Entropy::codeQtCbf(TComDataCU* cu, uint32_t absPartIdx, uint32_t absPartIdxStep, uint32_t width, uint32_t height, TextType ttype, uint32_t trDepth, bool lowestLevel)<br>
>  {<br>
> -    uint32_t ctx = cu->getCtxQtCbf(ttype, trDepth);<br>
> +    uint32_t ctx = CtxCbf[ttype][trDepth];<br>
><br>
>      bool canQuadSplit       = (width >= (MIN_TU_SIZE * 2)) && (height >= (MIN_TU_SIZE * 2));<br>
>      uint32_t lowestTUDepth  = trDepth + ((!lowestLevel && !canQuadSplit) ? 1 : 0); // unsplittable TUs inherit their parent's CBF<br>
> @@ -1498,7 +1498,7 @@<br>
><br>
>  void Entropy::codeQtCbf(TComDataCU* cu, uint32_t absPartIdx, TextType ttype, uint32_t trDepth)<br>
>  {<br>
> -    uint32_t ctx = cu->getCtxQtCbf(ttype, trDepth);<br>
> +    uint32_t ctx = CtxCbf[ttype][trDepth];<br>
>      uint32_t cbf = cu->getCbf(absPartIdx, ttype, trDepth);<br>
>      encodeBin(cbf, m_contextState[OFF_QT_CBF_CTX + ctx]);<br>
>  }<br>
> @@ -1522,14 +1522,12 @@<br>
>      encodeBin(cbf, m_contextState[OFF_QT_ROOT_CBF_CTX + ctx]);<br>
>  }<br>
><br>
> -void Entropy::codeQtCbfZero(TComDataCU* cu, TextType ttype, uint32_t trDepth)<br>
> +void Entropy::codeQtCbfZero(TextType ttype, uint32_t trDepth)<br>
>  {<br>
>      // this function is only used to estimate the bits when cbf is 0<br>
>      // and will never be called when writing the bistream. do not need to write log<br>
> -    uint32_t cbf = 0;<br>
> -    uint32_t ctx = cu->getCtxQtCbf(ttype, trDepth);<br>
> -<br>
> -    encodeBin(cbf, m_contextState[OFF_QT_CBF_CTX + ctx]);<br>
> +    uint32_t ctx = CtxCbf[ttype][trDepth];<br>
> +    encodeBin(0, m_contextState[OFF_QT_CBF_CTX + ctx]);<br>
>  }<br>
><br>
>  void Entropy::codeQtRootCbfZero(TComDataCU*)<br>
> diff -r 4d96eb40f4d6 -r e7f58267b15c source/encoder/entropy.h<br>
> --- a/source/encoder/entropy.h        Thu Aug 28 13:14:34 2014 +0530<br>
> +++ b/source/encoder/entropy.h        Mon Sep 01 14:32:35 2014 +0530<br>
> @@ -39,6 +39,7 @@<br>
>  class TComDataCU;<br>
>  class ScalingList;<br>
><br>
> +<br>
>  enum SplitType<br>
>  {<br>
>      DONT_SPLIT            = 0,<br>
> @@ -167,7 +168,7 @@<br>
>      void codeTransformSubdivFlag(uint32_t symbol, uint32_t ctx);<br>
>      void codeQtCbf(TComDataCU* cu, uint32_t absPartIdx, uint32_t absPartIdxStep, uint32_t width, uint32_t height, TextType ttype, uint32_t trDepth, bool lowestLevel);<br>
>      void codeQtCbf(TComDataCU* cu, uint32_t absPartIdx, TextType ttype, uint32_t trDepth);<br>
> -    void codeQtCbfZero(TComDataCU* cu, TextType ttype, uint32_t trDepth);<br>
> +    void codeQtCbfZero(TextType ttype, uint32_t trDepth);<br>
>      void codeQtRootCbfZero(TComDataCU* cu);<br>
>      void codeCoeff(TComDataCU* cu, uint32_t absPartIdx, uint32_t depth, bool& bCodeDQP);<br>
>      void codeCoeffNxN(TComDataCU* cu, coeff_t* coef, uint32_t absPartIdx, uint32_t log2TrSize, TextType ttype);<br>
> _______________________________________________<br>
> x265-devel mailing list<br>
> <a href="mailto:x265-devel@videolan.org">x265-devel@videolan.org</a><br>
> <a href="https://mailman.videolan.org/listinfo/x265-devel" target="_blank">https://mailman.videolan.org/listinfo/x265-devel</a><br>
<br>
</div></div><span class="HOEnZb"><font color="#888888">--<br>
Steve Borho<br>
</font></span><div class="HOEnZb"><div class="h5">_______________________________________________<br>
x265-devel mailing list<br>
<a href="mailto:x265-devel@videolan.org">x265-devel@videolan.org</a><br>
<a href="https://mailman.videolan.org/listinfo/x265-devel" target="_blank">https://mailman.videolan.org/listinfo/x265-devel</a><br>
</div></div></blockquote></div><br></div>