Ignore:
Timestamp:
26 May 2013, 16:22:23 (11 years ago)
Author:
tech
Message:

Added missing parts.

File:
1 edited

Legend:

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

    r438 r446  
    9090    fprintf( g_hTrace, "=========== Decoding Unit Information SEI message ===========\n");
    9191    break;
     92#if J0149_TONE_MAPPING_SEI
     93  case SEI::TONE_MAPPING_INFO:
     94    fprintf( g_hTrace, "===========Tone Mapping Info SEI message ===========\n");
     95    break;
     96#endif
     97#if L0208_SOP_DESCRIPTION_SEI
     98  case SEI::SOP_DESCRIPTION:
     99    fprintf( g_hTrace, "=========== SOP Description SEI message ===========\n");
     100    break;
     101#endif
     102#if K0180_SCALABLE_NESTING_SEI
     103  case SEI::SCALABLE_NESTING:
     104    fprintf( g_hTrace, "=========== Scalable Nesting SEI message ===========\n");
     105    break;
     106#endif
    92107  default:
    93108    fprintf( g_hTrace, "=========== Unknown SEI message ===========\n");
     
    154169  SEI *sei = NULL;
    155170
    156   if(nalUnitType == NAL_UNIT_SEI)
     171  if(nalUnitType == NAL_UNIT_PREFIX_SEI)
    157172  {
    158173    switch (payloadType)
     
    219234      xParseSEIGradualDecodingRefreshInfo((SEIGradualDecodingRefreshInfo&) *sei, payloadSize);
    220235      break;
     236#if J0149_TONE_MAPPING_SEI
     237    case SEI::TONE_MAPPING_INFO:
     238      sei = new SEIToneMappingInfo;
     239      xParseSEIToneMappingInfo((SEIToneMappingInfo&) *sei, payloadSize);
     240      break;
     241#endif
     242#if L0208_SOP_DESCRIPTION_SEI
     243    case SEI::SOP_DESCRIPTION:
     244      sei = new SEISOPDescription;
     245      xParseSEISOPDescription((SEISOPDescription&) *sei, payloadSize);
     246      break;
     247#endif
     248#if K0180_SCALABLE_NESTING_SEI
     249    case SEI::SCALABLE_NESTING:
     250      sei = new SEIScalableNesting;
     251      xParseSEIScalableNesting((SEIScalableNesting&) *sei, nalUnitType, payloadSize, sps);
     252      break;
     253#endif
    221254    default:
    222255      for (UInt i = 0; i < payloadSize; i++)
     
    284317    {
    285318      UInt reservedPayloadExtensionData;
    286       READ_CODE (1, reservedPayloadExtensionData, "reserved_payload_extension_data");
     319      READ_FLAG (reservedPayloadExtensionData, "reserved_payload_extension_data");
    287320    }
    288321
    289322    UInt dummy;
    290     READ_CODE (1, dummy, "payload_bit_equal_to_one");
    291     READ_CODE (payloadBitsRemaining-1, dummy, "payload_bit_equal_to_zero");
     323    READ_FLAG (dummy, "payload_bit_equal_to_one"); payloadBitsRemaining--;
     324    while (payloadBitsRemaining)
     325    {
     326      READ_FLAG (dummy, "payload_bit_equal_to_zero"); payloadBitsRemaining--;
     327    }
    292328  }
    293329
     
    632668}
    633669
     670#if J0149_TONE_MAPPING_SEI
     671Void SEIReader::xParseSEIToneMappingInfo(SEIToneMappingInfo& sei, UInt /*payloadSize*/)
     672{
     673  Int i;
     674  UInt val;
     675  READ_UVLC( val, "tone_map_id" );                         sei.m_toneMapId = val;
     676  READ_FLAG( val, "tone_map_cancel_flag" );                sei.m_toneMapCancelFlag = val;
     677
     678  if ( !sei.m_toneMapCancelFlag )
     679  {
     680    READ_FLAG( val, "tone_map_persistence_flag" );         sei.m_toneMapPersistenceFlag = val;
     681    READ_CODE( 8, val, "coded_data_bit_depth" );           sei.m_codedDataBitDepth = val;
     682    READ_CODE( 8, val, "target_bit_depth" );               sei.m_targetBitDepth = val;
     683    READ_UVLC( val, "model_id" );                          sei.m_modelId = val;
     684    switch(sei.m_modelId)
     685    {
     686    case 0:
     687      {
     688        READ_CODE( 32, val, "min_value" );                 sei.m_minValue = val;
     689        READ_CODE( 32, val, "max_value" );                 sei.m_maxValue = val;
     690        break;
     691      }
     692    case 1:
     693      {
     694        READ_CODE( 32, val, "sigmoid_midpoint" );          sei.m_sigmoidMidpoint = val;
     695        READ_CODE( 32, val, "sigmoid_width" );             sei.m_sigmoidWidth = val;
     696        break;
     697      }
     698    case 2:
     699      {
     700        UInt num = 1u << sei.m_targetBitDepth;
     701        sei.m_startOfCodedInterval.resize(num+1);
     702        for(i = 0; i < num; i++)
     703        {
     704          READ_CODE( ((( sei.m_codedDataBitDepth + 7 ) >> 3 ) << 3), val, "start_of_coded_interval" );
     705          sei.m_startOfCodedInterval[i] = val;
     706        }
     707        sei.m_startOfCodedInterval[num] = 1u << sei.m_codedDataBitDepth;
     708        break;
     709      }
     710    case 3:
     711      {
     712        READ_CODE( 16, val,  "num_pivots" );                       sei.m_numPivots = val;
     713        sei.m_codedPivotValue.resize(sei.m_numPivots);
     714        sei.m_targetPivotValue.resize(sei.m_numPivots);
     715        for(i = 0; i < sei.m_numPivots; i++ )
     716        {
     717          READ_CODE( ((( sei.m_codedDataBitDepth + 7 ) >> 3 ) << 3), val, "coded_pivot_value" );
     718          sei.m_codedPivotValue[i] = val;
     719          READ_CODE( ((( sei.m_targetBitDepth + 7 ) >> 3 ) << 3),    val, "target_pivot_value" );
     720          sei.m_targetPivotValue[i] = val;
     721        }
     722        break;
     723      }
     724    case 4:
     725      {
     726        READ_CODE( 8, val, "camera_iso_speed_idc" );                     sei.m_cameraIsoSpeedValue = val;
     727        if( sei.m_cameraIsoSpeedValue == 255) //Extended_ISO
     728        {
     729          READ_CODE( 32,   val,   "camera_iso_speed_value" );            sei.m_cameraIsoSpeedValue = val;
     730        }
     731        READ_FLAG( val, "exposure_compensation_value_sign_flag" );       sei.m_exposureCompensationValueSignFlag = val;
     732        READ_CODE( 16, val, "exposure_compensation_value_numerator" );   sei.m_exposureCompensationValueNumerator = val;
     733        READ_CODE( 16, val, "exposure_compensation_value_denom_idc" );   sei.m_exposureCompensationValueDenomIdc = val;
     734        READ_CODE( 32, val, "ref_screen_luminance_white" );              sei.m_refScreenLuminanceWhite = val;
     735        READ_CODE( 32, val, "extended_range_white_level" );              sei.m_extendedRangeWhiteLevel = val;
     736        READ_CODE( 16, val, "nominal_black_level_luma_code_value" );     sei.m_nominalBlackLevelLumaCodeValue = val;
     737        READ_CODE( 16, val, "nominal_white_level_luma_code_value" );     sei.m_nominalWhiteLevelLumaCodeValue= val;
     738        READ_CODE( 16, val, "extended_white_level_luma_code_value" );    sei.m_extendedWhiteLevelLumaCodeValue = val;
     739        break;
     740      }
     741    default:
     742      {
     743        assert(!"Undefined SEIToneMapModelId");
     744        break;
     745      }
     746    }//switch model id
     747  }// if(!sei.m_toneMapCancelFlag)
     748
     749  xParseByteAlign();
     750}
     751#endif
     752
     753#if L0208_SOP_DESCRIPTION_SEI
     754Void SEIReader::xParseSEISOPDescription(SEISOPDescription &sei, UInt payloadSize)
     755{
     756  Int iCode;
     757  UInt uiCode;
     758
     759  READ_UVLC( uiCode,           "sop_seq_parameter_set_id"            ); sei.m_sopSeqParameterSetId = uiCode;
     760  READ_UVLC( uiCode,           "num_pics_in_sop_minus1"              ); sei.m_numPicsInSopMinus1 = uiCode;
     761  for (UInt i = 0; i <= sei.m_numPicsInSopMinus1; i++)
     762  {
     763    READ_CODE( 6, uiCode,                     "sop_desc_vcl_nalu_type" );  sei.m_sopDescVclNaluType[i] = uiCode;
     764    READ_CODE( 3, sei.m_sopDescTemporalId[i], "sop_desc_temporal_id"   );  sei.m_sopDescTemporalId[i] = uiCode;
     765    if (sei.m_sopDescVclNaluType[i] != NAL_UNIT_CODED_SLICE_IDR_W_RADL && sei.m_sopDescVclNaluType[i] != NAL_UNIT_CODED_SLICE_IDR_N_LP)
     766    {
     767      READ_UVLC( sei.m_sopDescStRpsIdx[i],    "sop_desc_st_rps_idx"    ); sei.m_sopDescStRpsIdx[i] = uiCode;
     768    }
     769    if (i > 0)
     770    {
     771      READ_SVLC( iCode,                       "sop_desc_poc_delta"     ); sei.m_sopDescPocDelta[i] = iCode;
     772    }
     773  }
     774
     775  xParseByteAlign();
     776}
     777#endif
     778
     779#if K0180_SCALABLE_NESTING_SEI
     780Void SEIReader::xParseSEIScalableNesting(SEIScalableNesting& sei, const NalUnitType nalUnitType, UInt payloadSize, TComSPS *sps)
     781{
     782  UInt uiCode;
     783  SEIMessages seis;
     784
     785  READ_FLAG( uiCode,            "bitstream_subset_flag"         ); sei.m_bitStreamSubsetFlag = uiCode;
     786  READ_FLAG( uiCode,            "nesting_op_flag"               ); sei.m_nestingOpFlag = uiCode;
     787  if (sei.m_nestingOpFlag)
     788  {
     789    READ_FLAG( uiCode,            "default_op_flag"               ); sei.m_defaultOpFlag = uiCode;
     790    READ_UVLC( uiCode,            "nesting_num_ops_minus1"        ); sei.m_nestingNumOpsMinus1 = uiCode;
     791    for (UInt i = sei.m_defaultOpFlag; i <= sei.m_nestingNumOpsMinus1; i++)
     792    {
     793      READ_CODE( 3,        uiCode,  "nesting_max_temporal_id_plus1"   ); sei.m_nestingMaxTemporalIdPlus1[i] = uiCode;
     794      READ_UVLC( uiCode,            "nesting_op_idx"                  ); sei.m_nestingOpIdx[i] = uiCode;
     795    }
     796  }
     797  else
     798  {
     799    READ_FLAG( uiCode,            "all_layers_flag"               ); sei.m_allLayersFlag       = uiCode;
     800    if (!sei.m_allLayersFlag)
     801    {
     802      READ_CODE( 3,        uiCode,  "nesting_no_op_max_temporal_id_plus1"  ); sei.m_nestingNoOpMaxTemporalIdPlus1 = uiCode;
     803      READ_UVLC( uiCode,            "nesting_num_layers_minus1"            ); sei.m_nestingNumLayersMinus1        = uiCode;
     804      for (UInt i = 0; i <= sei.m_nestingNumLayersMinus1; i++)
     805      {
     806        READ_CODE( 6,           uiCode,     "nesting_layer_id"      ); sei.m_nestingLayerId[i]   = uiCode;
     807      }
     808    }
     809  }
     810
     811  // byte alignment
     812  while ( m_pcBitstream->getNumBitsRead() % 8 != 0 )
     813  {
     814    UInt code;
     815    READ_FLAG( code, "nesting_zero_bit" );
     816  }
     817
     818  sei.m_callerOwnsSEIs = false;
     819
     820  // read nested SEI messages
     821  do {
     822    xReadSEImessage(sei.m_nestedSEIs, nalUnitType, sps);
     823  } while (m_pcBitstream->getNumBitsLeft() > 8);
     824
     825}
     826#endif
     827
    634828Void SEIReader::xParseByteAlign()
    635829{
Note: See TracChangeset for help on using the changeset viewer.