Changeset 1360 in 3DVCSoftware for branches/HTM-15.2-dev/source/Lib/TLibDecoder/SEIread.cpp
- Timestamp:
- 28 Oct 2015, 17:46:00 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HTM-15.2-dev/source/Lib/TLibDecoder/SEIread.cpp
r1356 r1360 63 63 #endif 64 64 65 Void SEIReader::sei_read_code(std::ostream *pOS, UInt uiLength, UInt& ruiCode, const Char *pSymbolName)65 Void SEIReader::sei_read_code(std::ostream *pOS, UInt uiLength, UInt& ruiCode, const TChar *pSymbolName) 66 66 { 67 67 READ_CODE(uiLength, ruiCode, pSymbolName); … … 72 72 } 73 73 74 Void SEIReader::sei_read_uvlc(std::ostream *pOS, UInt& ruiCode, const Char *pSymbolName)74 Void SEIReader::sei_read_uvlc(std::ostream *pOS, UInt& ruiCode, const TChar *pSymbolName) 75 75 { 76 76 READ_UVLC(ruiCode, pSymbolName); … … 81 81 } 82 82 83 Void SEIReader::sei_read_svlc(std::ostream *pOS, Int& ruiCode, const Char *pSymbolName)83 Void SEIReader::sei_read_svlc(std::ostream *pOS, Int& ruiCode, const TChar *pSymbolName) 84 84 { 85 85 READ_SVLC(ruiCode, pSymbolName); … … 90 90 } 91 91 92 Void SEIReader::sei_read_flag(std::ostream *pOS, UInt& ruiCode, const Char *pSymbolName)92 Void SEIReader::sei_read_flag(std::ostream *pOS, UInt& ruiCode, const TChar *pSymbolName) 93 93 { 94 94 READ_FLAG(ruiCode, pSymbolName); … … 99 99 } 100 100 101 Void SEIReader::sei_read_string(std::ostream *pOS, UInt uiBufSize, UChar* pucCode, UInt& ruiLength, const Char *pSymbolName) 101 #if NH_MV_SEI 102 Void SEIReader::sei_read_string(std::ostream *pOS, UInt uiBufSize, UChar* pucCode, UInt& ruiLength, const TChar *pSymbolName) 102 103 { 103 104 READ_STRING(uiBufSize, pucCode, ruiLength, pSymbolName); … … 107 108 } 108 109 } 109 110 #if NH_MV_SEI111 110 inline Void SEIReader::output_sei_message_header(SEI &sei, std::ostream *pDecodedMessageOutputStream, UInt payloadSize) 112 111 #else … … 295 294 xParseSEITimeCode((SEITimeCode&) *sei, payloadSize, pDecodedMessageOutputStream); 296 295 break; 297 case SEI::CHROMA_ SAMPLING_FILTER_HINT:298 sei = new SEIChroma SamplingFilterHint;299 xParseSEIChroma SamplingFilterHint((SEIChromaSamplingFilterHint&) *sei, payloadSize/*, sps*/, pDecodedMessageOutputStream);296 case SEI::CHROMA_RESAMPLING_FILTER_HINT: 297 sei = new SEIChromaResamplingFilterHint; 298 xParseSEIChromaResamplingFilterHint((SEIChromaResamplingFilterHint&) *sei, payloadSize, pDecodedMessageOutputStream); 300 299 //} 301 300 break; … … 303 302 sei = new SEIKneeFunctionInfo; 304 303 xParseSEIKneeFunctionInfo((SEIKneeFunctionInfo&) *sei, payloadSize, pDecodedMessageOutputStream); 304 break; 305 case SEI::COLOUR_REMAPPING_INFO: 306 sei = new SEIColourRemappingInfo; 307 xParseSEIColourRemappingInfo((SEIColourRemappingInfo&) *sei, payloadSize, pDecodedMessageOutputStream); 305 308 break; 306 309 case SEI::MASTERING_DISPLAY_COLOUR_VOLUME: … … 531 534 UInt val; 532 535 sei_read_code( pDecodedMessageOutputStream, 8, val, "hash_type"); 533 sei.method = static_cast< SEIDecodedPictureHash::Method>(val); bytesRead++;534 535 const Char *traceString="\0";536 sei.method = static_cast<HashType>(val); bytesRead++; 537 538 const TChar *traceString="\0"; 536 539 switch (sei.method) 537 540 { 538 case SEIDecodedPictureHash::MD5: traceString="picture_md5"; break;539 case SEIDecodedPictureHash::CRC: traceString="picture_crc"; break;540 case SEIDecodedPictureHash::CHECKSUM: traceString="picture_checksum"; break;541 case HASHTYPE_MD5: traceString="picture_md5"; break; 542 case HASHTYPE_CRC: traceString="picture_crc"; break; 543 case HASHTYPE_CHECKSUM: traceString="picture_checksum"; break; 541 544 default: assert(false); break; 542 545 } … … 1123 1126 } 1124 1127 1125 Void SEIReader::xParseSEIChroma SamplingFilterHint(SEIChromaSamplingFilterHint& sei, UInt payloadSize/*, TComSPS* sps*/, std::ostream *pDecodedMessageOutputStream)1128 Void SEIReader::xParseSEIChromaResamplingFilterHint(SEIChromaResamplingFilterHint& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream) 1126 1129 { 1127 1130 UInt uiCode; … … 1130 1133 sei_read_code( pDecodedMessageOutputStream, 8, uiCode, "ver_chroma_filter_idc"); sei.m_verChromaFilterIdc = uiCode; 1131 1134 sei_read_code( pDecodedMessageOutputStream, 8, uiCode, "hor_chroma_filter_idc"); sei.m_horChromaFilterIdc = uiCode; 1132 sei_read_flag( pDecodedMessageOutputStream, uiCode, "ver_filtering_ process_flag"); sei.m_verFilteringProcessFlag = uiCode;1135 sei_read_flag( pDecodedMessageOutputStream, uiCode, "ver_filtering_field_processing_flag"); sei.m_verFilteringFieldProcessingFlag = uiCode; 1133 1136 if(sei.m_verChromaFilterIdc == 1 || sei.m_horChromaFilterIdc == 1) 1134 1137 { … … 1136 1139 if(sei.m_verChromaFilterIdc == 1) 1137 1140 { 1138 sei_read_uvlc( pDecodedMessageOutputStream, uiCode, "num_vertical_filters"); sei.m_numVerticalFilters = uiCode; 1139 if(sei.m_numVerticalFilters > 0) 1140 { 1141 sei.m_verTapLengthMinus1 = (Int*)malloc(sei.m_numVerticalFilters * sizeof(Int)); 1142 sei.m_verFilterCoeff = (Int**)malloc(sei.m_numVerticalFilters * sizeof(Int*)); 1143 for(Int i = 0; i < sei.m_numVerticalFilters; i ++) 1144 { 1145 sei_read_uvlc( pDecodedMessageOutputStream, uiCode, "ver_tap_length_minus_1"); sei.m_verTapLengthMinus1[i] = uiCode; 1146 sei.m_verFilterCoeff[i] = (Int*)malloc(sei.m_verTapLengthMinus1[i] * sizeof(Int)); 1147 for(Int j = 0; j < sei.m_verTapLengthMinus1[i]; j ++) 1141 UInt numVerticalFilters; 1142 sei_read_uvlc( pDecodedMessageOutputStream, numVerticalFilters, "num_vertical_filters"); sei.m_verFilterCoeff.resize(numVerticalFilters); 1143 if(numVerticalFilters > 0) 1144 { 1145 for(Int i = 0; i < numVerticalFilters; i++) 1146 { 1147 UInt verTapLengthMinus1; 1148 sei_read_uvlc( pDecodedMessageOutputStream, verTapLengthMinus1, "ver_tap_length_minus_1"); sei.m_verFilterCoeff[i].resize(verTapLengthMinus1+1); 1149 for(Int j = 0; j < (verTapLengthMinus1 + 1); j++) 1148 1150 { 1149 1151 sei_read_svlc( pDecodedMessageOutputStream, sei.m_verFilterCoeff[i][j], "ver_filter_coeff"); … … 1154 1156 if(sei.m_horChromaFilterIdc == 1) 1155 1157 { 1156 sei_read_uvlc( pDecodedMessageOutputStream, uiCode, "num_horizontal_filters"); sei.m_numHorizontalFilters = uiCode; 1157 if(sei.m_numHorizontalFilters > 0) 1158 { 1159 sei.m_horTapLengthMinus1 = (Int*)malloc(sei.m_numHorizontalFilters * sizeof(Int)); 1160 sei.m_horFilterCoeff = (Int**)malloc(sei.m_numHorizontalFilters * sizeof(Int*)); 1161 for(Int i = 0; i < sei.m_numHorizontalFilters; i ++) 1162 { 1163 sei_read_uvlc( pDecodedMessageOutputStream, uiCode, "hor_tap_length_minus_1"); sei.m_horTapLengthMinus1[i] = uiCode; 1164 sei.m_horFilterCoeff[i] = (Int*)malloc(sei.m_horTapLengthMinus1[i] * sizeof(Int)); 1165 for(Int j = 0; j < sei.m_horTapLengthMinus1[i]; j ++) 1158 UInt numHorizontalFilters; 1159 sei_read_uvlc( pDecodedMessageOutputStream, numHorizontalFilters, "num_horizontal_filters"); sei.m_horFilterCoeff.resize(numHorizontalFilters); 1160 if(numHorizontalFilters > 0) 1161 { 1162 for(Int i = 0; i < numHorizontalFilters; i++) 1163 { 1164 UInt horTapLengthMinus1; 1165 sei_read_uvlc( pDecodedMessageOutputStream, horTapLengthMinus1, "hor_tap_length_minus_1"); sei.m_horFilterCoeff[i].resize(horTapLengthMinus1+1); 1166 for(Int j = 0; j < (horTapLengthMinus1 + 1); j++) 1166 1167 { 1167 1168 sei_read_svlc( pDecodedMessageOutputStream, sei.m_horFilterCoeff[i][j], "hor_filter_coeff"); … … 1199 1200 } 1200 1201 } 1202 1203 Void SEIReader::xParseSEIColourRemappingInfo(SEIColourRemappingInfo& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream) 1204 { 1205 UInt uiVal; 1206 Int iVal; 1207 output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize); 1208 1209 sei_read_uvlc( pDecodedMessageOutputStream, uiVal, "colour_remap_id" ); sei.m_colourRemapId = uiVal; 1210 sei_read_flag( pDecodedMessageOutputStream, uiVal, "colour_remap_cancel_flag" ); sei.m_colourRemapCancelFlag = uiVal; 1211 if( !sei.m_colourRemapCancelFlag ) 1212 { 1213 sei_read_flag( pDecodedMessageOutputStream, uiVal, "colour_remap_persistence_flag" ); sei.m_colourRemapPersistenceFlag = uiVal; 1214 sei_read_flag( pDecodedMessageOutputStream, uiVal, "colour_remap_video_signal_info_present_flag" ); sei.m_colourRemapVideoSignalInfoPresentFlag = uiVal; 1215 if ( sei.m_colourRemapVideoSignalInfoPresentFlag ) 1216 { 1217 sei_read_flag( pDecodedMessageOutputStream, uiVal, "colour_remap_full_range_flag" ); sei.m_colourRemapFullRangeFlag = uiVal; 1218 sei_read_code( pDecodedMessageOutputStream, 8, uiVal, "colour_remap_primaries" ); sei.m_colourRemapPrimaries = uiVal; 1219 sei_read_code( pDecodedMessageOutputStream, 8, uiVal, "colour_remap_transfer_function" ); sei.m_colourRemapTransferFunction = uiVal; 1220 sei_read_code( pDecodedMessageOutputStream, 8, uiVal, "colour_remap_matrix_coefficients" ); sei.m_colourRemapMatrixCoefficients = uiVal; 1221 } 1222 sei_read_code( pDecodedMessageOutputStream, 8, uiVal, "colour_remap_input_bit_depth" ); sei.m_colourRemapInputBitDepth = uiVal; 1223 sei_read_code( pDecodedMessageOutputStream, 8, uiVal, "colour_remap_bit_depth" ); sei.m_colourRemapBitDepth = uiVal; 1224 1225 for( Int c=0 ; c<3 ; c++ ) 1226 { 1227 sei_read_code( pDecodedMessageOutputStream, 8, uiVal, "pre_lut_num_val_minus1[c]" ); sei.m_preLutNumValMinus1[c] = (uiVal==0) ? 1 : uiVal; 1228 sei.m_preLut[c].resize(sei.m_preLutNumValMinus1[c]+1); 1229 if( uiVal> 0 ) 1230 { 1231 for ( Int i=0 ; i<=sei.m_preLutNumValMinus1[c] ; i++ ) 1232 { 1233 sei_read_code( pDecodedMessageOutputStream, (( sei.m_colourRemapInputBitDepth + 7 ) >> 3 ) << 3, uiVal, "pre_lut_coded_value[c][i]" ); sei.m_preLut[c][i].codedValue = uiVal; 1234 sei_read_code( pDecodedMessageOutputStream, (( sei.m_colourRemapBitDepth + 7 ) >> 3 ) << 3, uiVal, "pre_lut_target_value[c][i]" ); sei.m_preLut[c][i].targetValue = uiVal; 1235 } 1236 } 1237 else // pre_lut_num_val_minus1[c] == 0 1238 { 1239 sei.m_preLut[c][0].codedValue = 0; 1240 sei.m_preLut[c][0].targetValue = 0; 1241 sei.m_preLut[c][1].codedValue = (1 << sei.m_colourRemapInputBitDepth) - 1 ; 1242 sei.m_preLut[c][1].targetValue = (1 << sei.m_colourRemapBitDepth) - 1 ; 1243 } 1244 } 1245 1246 sei_read_flag( pDecodedMessageOutputStream, uiVal, "colour_remap_matrix_present_flag" ); sei.m_colourRemapMatrixPresentFlag = uiVal; 1247 if( sei.m_colourRemapMatrixPresentFlag ) 1248 { 1249 sei_read_code( pDecodedMessageOutputStream, 4, uiVal, "log2_matrix_denom" ); sei.m_log2MatrixDenom = uiVal; 1250 for ( Int c=0 ; c<3 ; c++ ) 1251 { 1252 for ( Int i=0 ; i<3 ; i++ ) 1253 { 1254 sei_read_svlc( pDecodedMessageOutputStream, iVal, "colour_remap_coeffs[c][i]" ); sei.m_colourRemapCoeffs[c][i] = iVal; 1255 } 1256 } 1257 } 1258 else // setting default matrix (I3) 1259 { 1260 sei.m_log2MatrixDenom = 10; 1261 for ( Int c=0 ; c<3 ; c++ ) 1262 { 1263 for ( Int i=0 ; i<3 ; i++ ) 1264 { 1265 sei.m_colourRemapCoeffs[c][i] = (c==i) << sei.m_log2MatrixDenom; 1266 } 1267 } 1268 } 1269 for( Int c=0 ; c<3 ; c++ ) 1270 { 1271 sei_read_code( pDecodedMessageOutputStream, 8, uiVal, "post_lut_num_val_minus1[c]" ); sei.m_postLutNumValMinus1[c] = (uiVal==0) ? 1 : uiVal; 1272 sei.m_postLut[c].resize(sei.m_postLutNumValMinus1[c]+1); 1273 if( uiVal > 0 ) 1274 { 1275 for ( Int i=0 ; i<=sei.m_postLutNumValMinus1[c] ; i++ ) 1276 { 1277 sei_read_code( pDecodedMessageOutputStream, (( sei.m_colourRemapBitDepth + 7 ) >> 3 ) << 3, uiVal, "post_lut_coded_value[c][i]" ); sei.m_postLut[c][i].codedValue = uiVal; 1278 sei_read_code( pDecodedMessageOutputStream, (( sei.m_colourRemapBitDepth + 7 ) >> 3 ) << 3, uiVal, "post_lut_target_value[c][i]" ); sei.m_postLut[c][i].targetValue = uiVal; 1279 } 1280 } 1281 else 1282 { 1283 sei.m_postLut[c][0].codedValue = 0; 1284 sei.m_postLut[c][0].targetValue = 0; 1285 sei.m_postLut[c][1].targetValue = (1 << sei.m_colourRemapBitDepth) - 1; 1286 sei.m_postLut[c][1].codedValue = (1 << sei.m_colourRemapBitDepth) - 1; 1287 } 1288 } 1289 } 1290 } 1291 1201 1292 1202 1293 Void SEIReader::xParseSEIMasteringDisplayColourVolume(SEIMasteringDisplayColourVolume& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream)
Note: See TracChangeset for help on using the changeset viewer.