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