40 #if RExt__DECODER_DEBUG_BIT_STATISTICS
48 : m_pcTComBitstream( 0 )
72 #if RExt__DECODER_DEBUG_BIT_STATISTICS
88 assert( ((lastByte << (8 +
m_bitsNeeded)) & 0xff) == 0x80 );
107 #if RExt__DECODER_DEBUG_BIT_STATISTICS
114 const UInt startingRange = m_uiRange;
119 UInt scaledRange = m_uiRange << 7;
121 if( m_uiValue < scaledRange )
124 ruiBin = rcCtxModel.
getMps();
125 #if RExt__DECODER_DEBUG_BIT_STATISTICS
130 if ( scaledRange < ( 256 << 7 ) )
132 m_uiRange = scaledRange >> 6;
133 m_uiValue += m_uiValue;
135 if ( ++m_bitsNeeded == 0 )
138 m_uiValue += m_pcTComBitstream->readByte();
145 ruiBin = 1 - rcCtxModel.
getMps();
146 #if RExt__DECODER_DEBUG_BIT_STATISTICS
150 m_uiValue = ( m_uiValue - scaledRange ) << numBits;
151 m_uiRange = uiLPS << numBits;
154 m_bitsNeeded += numBits;
156 if ( m_bitsNeeded >= 0 )
158 m_uiValue += m_pcTComBitstream->readByte() << m_bitsNeeded;
164 if ((
g_debugCounter + debugCabacBinWindow) >= debugCabacBinTargetLine)
166 std::cout <<
g_debugCounter <<
": coding bin value " << ruiBin <<
", range = [" << startingRange <<
"->" << m_uiRange <<
"]\n";
171 UChar breakPointThis;
174 if (
g_debugCounter >= (debugCabacBinTargetLine + debugCabacBinWindow))
183 #if RExt__DECODER_DEBUG_BIT_STATISTICS
189 if (m_uiRange == 256)
191 #if RExt__DECODER_DEBUG_BIT_STATISTICS
192 decodeAlignedBinsEP(ruiBin, 1, whichStat);
194 decodeAlignedBinsEP(ruiBin, 1);
199 m_uiValue += m_uiValue;
201 if ( ++m_bitsNeeded >= 0 )
204 m_uiValue += m_pcTComBitstream->readByte();
208 UInt scaledRange = m_uiRange << 7;
209 if ( m_uiValue >= scaledRange )
212 m_uiValue -= scaledRange;
214 #if RExt__DECODER_DEBUG_BIT_STATISTICS
219 #if RExt__DECODER_DEBUG_BIT_STATISTICS
225 if (m_uiRange == 256)
227 #if RExt__DECODER_DEBUG_BIT_STATISTICS
228 decodeAlignedBinsEP(ruiBin, numBins, whichStat);
230 decodeAlignedBinsEP(ruiBin, numBins);
236 #if RExt__DECODER_DEBUG_BIT_STATISTICS
237 Int origNumBins=numBins;
239 while ( numBins > 8 )
241 m_uiValue = ( m_uiValue << 8 ) + ( m_pcTComBitstream->readByte() << ( 8 + m_bitsNeeded ) );
243 UInt scaledRange = m_uiRange << 15;
244 for (
Int i = 0; i < 8; i++ )
248 if ( m_uiValue >= scaledRange )
251 m_uiValue -= scaledRange;
257 m_bitsNeeded += numBins;
258 m_uiValue <<= numBins;
260 if ( m_bitsNeeded >= 0 )
262 m_uiValue += m_pcTComBitstream->readByte() << m_bitsNeeded;
266 UInt scaledRange = m_uiRange << ( numBins + 7 );
267 for (
Int i = 0; i < numBins; i++ )
271 if ( m_uiValue >= scaledRange )
274 m_uiValue -= scaledRange;
279 #if RExt__DECODER_DEBUG_BIT_STATISTICS
286 #if RExt__DECODER_DEBUG_BIT_STATISTICS
292 #if RExt__DECODER_DEBUG_BIT_STATISTICS
298 Int binsRemaining = numBins;
301 assert(m_uiRange == 256);
303 while (binsRemaining > 0)
305 const UInt binsToRead = std::min<UInt>(binsRemaining, 8);
306 const UInt binMask = (1 << binsToRead) - 1;
317 const UInt newBins = (m_uiValue >> (15 - binsToRead)) & binMask;
319 ruiBins = (ruiBins << binsToRead) | newBins;
320 m_uiValue = (m_uiValue << binsToRead) & 0x7FFF;
322 binsRemaining -= binsToRead;
323 m_bitsNeeded += binsToRead;
325 if (m_bitsNeeded >= 0)
327 m_uiValue |= m_pcTComBitstream->readByte() << m_bitsNeeded;
332 #if RExt__DECODER_DEBUG_BIT_STATISTICS
345 #if RExt__DECODER_DEBUG_BIT_STATISTICS
353 #if RExt__DECODER_DEBUG_BIT_STATISTICS
356 if ( scaledRange < ( 256 << 7 ) )
377 assert ( uiLength > 0 );
379 #if RExt__DECODER_DEBUG_BIT_STATISTICS
Void decodeBinTrm(UInt &ruiBin)
TComInputBitstream * m_pcTComBitstream
static const UChar sm_aucLPSTable[1<< CONTEXT_STATE_BITS][4]
Void decodeBinsEP(UInt &ruiBin, Int numBins)
UChar getState()
get current state
Void copyState(const TDecBinIf *pcTDecBinIf)
Void decodeBinEP(UInt &ruiBin)
Void init(TComInputBitstream *pcTComBitstream)
static Void UpdateCABACStat(const TComCodingStatisticsClassType &stat, UInt uiRangeBefore, UInt uiRangeAfter, Int val)
Void decodeBin(UInt &ruiBin, ContextModel &rcCtxModel)
Void decodeAlignedBinsEP(UInt &ruiBins, Int numBins)
UChar getMps()
get curret MPS
Void xReadPCMCode(UInt uiLength, UInt &ruiCode)
virtual TDecBinCABAC * getTDecBinCABAC()
static const UChar sm_aucRenormTable[32]
static Void IncrementStatisticEP(const TComCodingStatisticsClassType &stat, const Int numBits, const Int value)
Defines types and objects for environment-variable-based debugging and feature control.
binary entropy decoder of CABAC