Changeset 1313 in 3DVCSoftware for trunk/source/Lib/TLibDecoder/SyntaxElementParser.cpp
- Timestamp:
- 13 Aug 2015, 17:38:13 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/source/Lib/TLibDecoder/SyntaxElementParser.cpp
r1179 r1313 2 2 * License, included below. This software may be subject to other third party 3 3 * and contributor rights, including patent rights, and no such rights are 4 * granted under this license. 4 * granted under this license. 5 5 * 6 6 * Copyright (c) 2010-2015, ITU/ISO/IEC … … 43 43 #include "TLibCommon/TComBitStream.h" 44 44 #include "SyntaxElementParser.h" 45 #if RExt__DECODER_DEBUG_BIT_STATISTICS 46 #include "TLibCommon/TComCodingStatistics.h" 47 #endif 45 48 46 49 #if ENC_DEC_TRACE … … 48 51 Void SyntaxElementParser::xReadCodeTr (UInt length, UInt& rValue, const Char *pSymbolName) 49 52 { 53 #if RExt__DECODER_DEBUG_BIT_STATISTICS 54 xReadCode (length, rValue, pSymbolName); 55 #else 50 56 xReadCode (length, rValue); 57 #endif 51 58 #if H_MV_ENC_DEC_TRAC 52 59 if ( g_disableHLSTrace || !g_HLSTraceEnable ) … … 56 63 if ( !g_disableNumbering ) 57 64 { 58 #endif 65 incSymbolCounter(); 66 fprintf( g_hTrace, "%8lld ", g_nSymbolCounter ); 67 } 68 #else 69 fprintf( g_hTrace, "%8lld ", g_nSymbolCounter++ ); 70 #endif 71 if (length < 10) 72 { 73 fprintf( g_hTrace, "%-50s u(%d) : %u\n", pSymbolName, length, rValue ); 74 } 75 else 76 { 77 fprintf( g_hTrace, "%-50s u(%d) : %u\n", pSymbolName, length, rValue ); 78 } 79 fflush ( g_hTrace ); 80 } 81 82 Void SyntaxElementParser::xReadUvlcTr (UInt& rValue, const Char *pSymbolName) 83 { 84 #if RExt__DECODER_DEBUG_BIT_STATISTICS 85 xReadUvlc (rValue, pSymbolName); 86 #else 87 xReadUvlc (rValue); 88 #endif 89 #if H_MV_ENC_DEC_TRAC 90 if ( g_disableHLSTrace || !g_HLSTraceEnable ) 91 { 92 return; 93 } 94 if ( !g_disableNumbering ) 95 { 96 incSymbolCounter(); 97 fprintf( g_hTrace, "%8lld ", g_nSymbolCounter ); 98 } 99 #else 59 100 fprintf( g_hTrace, "%8lld ", g_nSymbolCounter++ ); 101 #endif 102 fprintf( g_hTrace, "%-50s ue(v) : %u\n", pSymbolName, rValue ); 103 fflush ( g_hTrace ); 104 } 105 106 Void SyntaxElementParser::xReadSvlcTr (Int& rValue, const Char *pSymbolName) 107 { 108 #if RExt__DECODER_DEBUG_BIT_STATISTICS 109 xReadSvlc (rValue, pSymbolName); 110 #else 111 xReadSvlc (rValue); 112 #endif 60 113 #if H_MV_ENC_DEC_TRAC 61 } 62 #endif 63 64 if (length < 10) 65 { 66 fprintf( g_hTrace, "%-50s u(%d) : %u\n", pSymbolName, length, rValue ); 67 } 68 else 69 { 70 fprintf( g_hTrace, "%-50s u(%d) : %u\n", pSymbolName, length, rValue ); 71 } 114 if ( g_disableHLSTrace || !g_HLSTraceEnable ) 115 { 116 return; 117 } 118 if ( !g_disableNumbering ) 119 { 120 incSymbolCounter(); 121 fprintf( g_hTrace, "%8lld ", g_nSymbolCounter ); 122 } 123 #else 124 fprintf( g_hTrace, "%8lld ", g_nSymbolCounter++ ); 125 #endif 126 fprintf( g_hTrace, "%-50s se(v) : %d\n", pSymbolName, rValue ); 72 127 fflush ( g_hTrace ); 73 128 } 74 129 75 Void SyntaxElementParser::xReadUvlcTr (UInt& rValue, const Char *pSymbolName) 76 { 77 xReadUvlc (rValue); 130 Void SyntaxElementParser::xReadFlagTr (UInt& rValue, const Char *pSymbolName) 131 { 132 #if RExt__DECODER_DEBUG_BIT_STATISTICS 133 xReadFlag (rValue, pSymbolName); 134 #else 135 xReadFlag (rValue); 136 #endif 78 137 #if H_MV_ENC_DEC_TRAC 79 if ( g_disableHLSTrace 138 if ( g_disableHLSTrace || !g_HLSTraceEnable ) 80 139 { 81 140 return; … … 83 142 if ( !g_disableNumbering ) 84 143 { 85 #endif 144 incSymbolCounter(); 145 fprintf( g_hTrace, "%8lld ", g_nSymbolCounter ); 146 } 147 #else 86 148 fprintf( g_hTrace, "%8lld ", g_nSymbolCounter++ ); 87 #if H_MV_ENC_DEC_TRAC 88 } 89 #endif 90 fprintf( g_hTrace, "%-50s ue(v) : %u\n", pSymbolName, rValue ); 149 #endif 150 fprintf( g_hTrace, "%-50s u(1) : %d\n", pSymbolName, rValue ); 91 151 fflush ( g_hTrace ); 92 152 } 93 153 94 Void SyntaxElementParser::xReadSvlcTr (Int& rValue, const Char *pSymbolName) 95 { 96 xReadSvlc(rValue); 97 #if H_MV_ENC_DEC_TRAC 98 if ( g_disableHLSTrace || !g_HLSTraceEnable ) 99 { 100 return; 101 } 102 if ( !g_disableNumbering ) 103 { 104 #endif 105 fprintf( g_hTrace, "%8lld ", g_nSymbolCounter++ ); 106 #if H_MV_ENC_DEC_TRAC 107 } 108 #endif 109 110 fprintf( g_hTrace, "%-50s se(v) : %d\n", pSymbolName, rValue ); 111 fflush ( g_hTrace ); 112 } 113 114 Void SyntaxElementParser::xReadFlagTr (UInt& rValue, const Char *pSymbolName) 115 { 116 xReadFlag(rValue); 117 #if H_MV_ENC_DEC_TRAC 118 if ( g_disableHLSTrace || !g_HLSTraceEnable ) 119 { 120 return; 121 } 122 if ( !g_disableNumbering ) 123 { 124 #endif 125 fprintf( g_hTrace, "%8lld ", g_nSymbolCounter++ ); 126 #if H_MV_ENC_DEC_TRAC 127 } 128 #endif 129 fprintf( g_hTrace, "%-50s u(1) : %d\n", pSymbolName, rValue ); 130 fflush ( g_hTrace ); 154 Void xTraceAccessUnitDelimiter () 155 { 156 fprintf( g_hTrace, "=========== Access Unit Delimiter ===========\n"); 157 } 158 159 Void xTraceFillerData () 160 { 161 fprintf( g_hTrace, "=========== Filler Data ===========\n"); 131 162 } 132 163 … … 137 168 // Protected member functions 138 169 // ==================================================================================================================== 139 170 #if RExt__DECODER_DEBUG_BIT_STATISTICS 171 Void SyntaxElementParser::xReadCode (UInt uiLength, UInt& ruiCode, const Char *pSymbolName) 172 #else 140 173 Void SyntaxElementParser::xReadCode (UInt uiLength, UInt& ruiCode) 174 #endif 141 175 { 142 176 assert ( uiLength > 0 ); 143 177 m_pcBitstream->read (uiLength, ruiCode); 144 } 145 178 #if RExt__DECODER_DEBUG_BIT_STATISTICS 179 TComCodingStatistics::IncrementStatisticEP(pSymbolName, uiLength, ruiCode); 180 #endif 181 } 182 183 #if RExt__DECODER_DEBUG_BIT_STATISTICS 184 Void SyntaxElementParser::xReadUvlc( UInt& ruiVal, const Char *pSymbolName) 185 #else 146 186 Void SyntaxElementParser::xReadUvlc( UInt& ruiVal) 187 #endif 147 188 { 148 189 UInt uiVal = 0; … … 150 191 UInt uiLength; 151 192 m_pcBitstream->read( 1, uiCode ); 193 #if RExt__DECODER_DEBUG_BIT_STATISTICS 194 UInt totalLen=1; 195 #endif 152 196 153 197 if( 0 == uiCode ) … … 164 208 165 209 uiVal += (1 << uiLength)-1; 210 #if RExt__DECODER_DEBUG_BIT_STATISTICS 211 totalLen+=uiLength+uiLength; 212 #endif 166 213 } 167 214 168 215 ruiVal = uiVal; 169 } 170 216 #if RExt__DECODER_DEBUG_BIT_STATISTICS 217 TComCodingStatistics::IncrementStatisticEP(pSymbolName, Int(totalLen), ruiVal); 218 #endif 219 } 220 221 #if RExt__DECODER_DEBUG_BIT_STATISTICS 222 Void SyntaxElementParser::xReadSvlc( Int& riVal, const Char *pSymbolName) 223 #else 171 224 Void SyntaxElementParser::xReadSvlc( Int& riVal) 225 #endif 172 226 { 173 227 UInt uiBits = 0; 174 228 m_pcBitstream->read( 1, uiBits ); 229 #if RExt__DECODER_DEBUG_BIT_STATISTICS 230 UInt totalLen=1; 231 #endif 175 232 if( 0 == uiBits ) 176 233 { … … 187 244 uiBits += (1 << uiLength); 188 245 riVal = ( uiBits & 1) ? -(Int)(uiBits>>1) : (Int)(uiBits>>1); 246 #if RExt__DECODER_DEBUG_BIT_STATISTICS 247 totalLen+=uiLength+uiLength; 248 #endif 189 249 } 190 250 else … … 192 252 riVal = 0; 193 253 } 194 } 195 254 #if RExt__DECODER_DEBUG_BIT_STATISTICS 255 TComCodingStatistics::IncrementStatisticEP(pSymbolName, Int(totalLen), riVal); 256 #endif 257 } 258 259 #if RExt__DECODER_DEBUG_BIT_STATISTICS 260 Void SyntaxElementParser::xReadFlag (UInt& ruiCode, const Char *pSymbolName) 261 #else 196 262 Void SyntaxElementParser::xReadFlag (UInt& ruiCode) 263 #endif 197 264 { 198 265 m_pcBitstream->read( 1, ruiCode ); 266 #if RExt__DECODER_DEBUG_BIT_STATISTICS 267 TComCodingStatistics::IncrementStatisticEP(pSymbolName, 1, Int(ruiCode)); 268 #endif 269 } 270 271 Void SyntaxElementParser::xReadRbspTrailingBits() 272 { 273 UInt bit; 274 READ_FLAG( bit, "rbsp_stop_one_bit"); 275 assert (bit==1); 276 Int cnt = 0; 277 while (m_pcBitstream->getNumBitsUntilByteAligned()) 278 { 279 READ_FLAG( bit, "rbsp_alignment_zero_bit"); 280 assert (bit==0); 281 cnt++; 282 } 283 assert(cnt<8); 284 } 285 286 Void AUDReader::parseAccessUnitDelimiter(TComInputBitstream* bs, UInt &picType) 287 { 288 setBitstream(bs); 289 290 #if ENC_DEC_TRACE 291 xTraceAccessUnitDelimiter(); 292 #endif 293 294 READ_CODE (3, picType, "pic_type"); 295 xReadRbspTrailingBits(); 296 } 297 298 Void FDReader::parseFillerData(TComInputBitstream* bs, UInt &fdSize) 299 { 300 setBitstream(bs); 301 #if ENC_DEC_TRACE 302 xTraceFillerData(); 303 #endif 304 UInt ffByte; 305 fdSize = 0; 306 while( m_pcBitstream->getNumBitsLeft() >8 ) 307 { 308 READ_CODE (8, ffByte, "ff_byte"); 309 assert (ffByte==0xff); 310 fdSize++; 311 } 312 xReadRbspTrailingBits(); 199 313 } 200 314
Note: See TracChangeset for help on using the changeset viewer.