Ignore:
Timestamp:
28 Oct 2015, 17:46:00 (9 years ago)
Author:
tech
Message:

Update to HM-16.7.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/HTM-15.2-dev/source/Lib/TLibDecoder/SEIread.cpp

    r1356 r1360  
    6363#endif
    6464
    65 Void SEIReader::sei_read_code(std::ostream *pOS, UInt uiLength, UInt& ruiCode, const Char *pSymbolName)
     65Void SEIReader::sei_read_code(std::ostream *pOS, UInt uiLength, UInt& ruiCode, const TChar *pSymbolName)
    6666{
    6767  READ_CODE(uiLength, ruiCode, pSymbolName);
     
    7272}
    7373
    74 Void SEIReader::sei_read_uvlc(std::ostream *pOS, UInt& ruiCode, const Char *pSymbolName)
     74Void SEIReader::sei_read_uvlc(std::ostream *pOS, UInt& ruiCode, const TChar *pSymbolName)
    7575{
    7676  READ_UVLC(ruiCode, pSymbolName);
     
    8181}
    8282
    83 Void SEIReader::sei_read_svlc(std::ostream *pOS, Int& ruiCode, const Char *pSymbolName)
     83Void SEIReader::sei_read_svlc(std::ostream *pOS, Int& ruiCode, const TChar *pSymbolName)
    8484{
    8585  READ_SVLC(ruiCode, pSymbolName);
     
    9090}
    9191
    92 Void SEIReader::sei_read_flag(std::ostream *pOS, UInt& ruiCode, const Char *pSymbolName)
     92Void SEIReader::sei_read_flag(std::ostream *pOS, UInt& ruiCode, const TChar *pSymbolName)
    9393{
    9494  READ_FLAG(ruiCode, pSymbolName);
     
    9999}
    100100
    101 Void SEIReader::sei_read_string(std::ostream *pOS, UInt uiBufSize, UChar* pucCode, UInt& ruiLength, const Char *pSymbolName)
     101#if NH_MV_SEI
     102Void SEIReader::sei_read_string(std::ostream *pOS, UInt uiBufSize, UChar* pucCode, UInt& ruiLength, const TChar *pSymbolName)
    102103{
    103104  READ_STRING(uiBufSize, pucCode, ruiLength, pSymbolName);
     
    107108  }
    108109}
    109 
    110 #if NH_MV_SEI
    111110inline Void SEIReader::output_sei_message_header(SEI &sei, std::ostream *pDecodedMessageOutputStream, UInt payloadSize)
    112111#else
     
    295294      xParseSEITimeCode((SEITimeCode&) *sei, payloadSize, pDecodedMessageOutputStream);
    296295      break;
    297     case SEI::CHROMA_SAMPLING_FILTER_HINT:
    298       sei = new SEIChromaSamplingFilterHint;
    299       xParseSEIChromaSamplingFilterHint((SEIChromaSamplingFilterHint&) *sei, payloadSize/*, sps*/, pDecodedMessageOutputStream);
     296    case SEI::CHROMA_RESAMPLING_FILTER_HINT:
     297      sei = new SEIChromaResamplingFilterHint;
     298      xParseSEIChromaResamplingFilterHint((SEIChromaResamplingFilterHint&) *sei, payloadSize, pDecodedMessageOutputStream);
    300299      //}
    301300      break;
     
    303302      sei = new SEIKneeFunctionInfo;
    304303      xParseSEIKneeFunctionInfo((SEIKneeFunctionInfo&) *sei, payloadSize, pDecodedMessageOutputStream);
     304      break;
     305    case SEI::COLOUR_REMAPPING_INFO:
     306      sei = new SEIColourRemappingInfo;
     307      xParseSEIColourRemappingInfo((SEIColourRemappingInfo&) *sei, payloadSize, pDecodedMessageOutputStream);
    305308      break;
    306309    case SEI::MASTERING_DISPLAY_COLOUR_VOLUME:
     
    531534  UInt val;
    532535  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";
    536539  switch (sei.method)
    537540  {
    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;
    541544    default: assert(false); break;
    542545  }
     
    11231126}
    11241127
    1125 Void SEIReader::xParseSEIChromaSamplingFilterHint(SEIChromaSamplingFilterHint& sei, UInt payloadSize/*, TComSPS* sps*/, std::ostream *pDecodedMessageOutputStream)
     1128Void SEIReader::xParseSEIChromaResamplingFilterHint(SEIChromaResamplingFilterHint& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream)
    11261129{
    11271130  UInt uiCode;
     
    11301133  sei_read_code( pDecodedMessageOutputStream, 8, uiCode, "ver_chroma_filter_idc"); sei.m_verChromaFilterIdc = uiCode;
    11311134  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;
    11331136  if(sei.m_verChromaFilterIdc == 1 || sei.m_horChromaFilterIdc == 1)
    11341137  {
     
    11361139    if(sei.m_verChromaFilterIdc == 1)
    11371140    {
    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++)
    11481150          {
    11491151            sei_read_svlc( pDecodedMessageOutputStream, sei.m_verFilterCoeff[i][j], "ver_filter_coeff");
     
    11541156    if(sei.m_horChromaFilterIdc == 1)
    11551157    {
    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++)
    11661167          {
    11671168            sei_read_svlc( pDecodedMessageOutputStream, sei.m_horFilterCoeff[i][j], "hor_filter_coeff");
     
    11991200  }
    12001201}
     1202
     1203Void 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
    12011292
    12021293Void SEIReader::xParseSEIMasteringDisplayColourVolume(SEIMasteringDisplayColourVolume& sei, UInt payloadSize, std::ostream *pDecodedMessageOutputStream)
Note: See TracChangeset for help on using the changeset viewer.