Changeset 815 in SHVCSoftware for trunk/source/Lib/TLibDecoder/SEIread.cpp


Ignore:
Timestamp:
30 Jun 2014, 06:13:06 (10 years ago)
Author:
seregin
Message:

merge with SHM-6-dev branch

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/source

  • trunk/source/Lib/TLibDecoder/SEIread.cpp

    r713 r815  
    9393    fprintf( g_hTrace, "===========Tone Mapping Info SEI message ===========\n");
    9494    break;
     95#if P0050_KNEE_FUNCTION_SEI
     96  case SEI::KNEE_FUNCTION_INFO:
     97    fprintf( g_hTrace, "=========== Knee Function Information SEI message ===========\n");
     98    break;
     99#endif
    95100#if Q0074_SEI_COLOR_MAPPING
    96101  case SEI::COLOR_MAPPING_INFO:
     
    129134  case SEI::BSP_HRD:
    130135    fprintf( g_hTrace, "=========== Bitstream parition HRD parameters SEI message ===========\n");
     136    break;
     137#endif
     138#if Q0078_ADD_LAYER_SETS
     139  case SEI::OUTPUT_LAYER_SET_NESTING:
     140    fprintf(g_hTrace, "=========== Output layer set nesting SEI message ===========\n");
     141    break;
     142  case SEI::VPS_REWRITING:
     143    fprintf(g_hTrace, "=========== VPS rewriting SEI message ===========\n");
    131144    break;
    132145#endif
     
    285298      xParseSEIToneMappingInfo((SEIToneMappingInfo&) *sei, payloadSize);
    286299      break;
     300#if P0050_KNEE_FUNCTION_SEI
     301    case SEI::KNEE_FUNCTION_INFO:
     302      sei = new SEIKneeFunctionInfo;
     303      xParseSEIKneeFunctionInfo((SEIKneeFunctionInfo&) *sei, payloadSize);
     304      break;
     305#endif
    287306#if Q0074_SEI_COLOR_MAPPING
    288307    case SEI::COLOR_MAPPING_INFO:
     
    345364     sei = new SEIBspHrd;
    346365     xParseSEIBspHrd((SEIBspHrd&) *sei, sps, *nestingSei);
     366     break;
     367#endif
     368#if Q0078_ADD_LAYER_SETS
     369   case SEI::OUTPUT_LAYER_SET_NESTING:
     370     sei = new SEIOutputLayerSetNesting;
     371#if LAYERS_NOT_PRESENT_SEI
     372     xParseSEIOutputLayerSetNesting((SEIOutputLayerSetNesting&)*sei, nalUnitType, vps, sps);
     373#else
     374     xParseSEIOutputLayerSetNesting((SEIOutputLayerSetNesting&)*sei, nalUnitType, sps);
     375#endif
     376     break;
     377   case SEI::VPS_REWRITING:
     378     sei = new SEIVPSRewriting;
     379     xParseSEIVPSRewriting((SEIVPSRewriting&)*sei);
     380     break;
     381#endif
     382#if Q0189_TMVP_CONSTRAINTS
     383   case SEI::TMVP_CONSTRAINTS:
     384     sei =  new SEITMVPConstrains;
     385     xParseSEITMVPConstraints((SEITMVPConstrains&) *sei, payloadSize);
     386     break;
     387#endif
     388#if Q0247_FRAME_FIELD_INFO
     389   case SEI::FRAME_FIELD_INFO:
     390     sei =  new SEIFrameFieldInfo;
     391     xParseSEIFrameFieldInfo    ((SEIFrameFieldInfo&) *sei, payloadSize);
    347392     break;
    348393#endif
     
    849894}
    850895
     896#if P0050_KNEE_FUNCTION_SEI
     897Void SEIReader::xParseSEIKneeFunctionInfo(SEIKneeFunctionInfo& sei, UInt /*payloadSize*/){
     898  Int i;
     899  UInt val;
     900  READ_UVLC( val, "knee_function_id" );                   sei.m_kneeId = val;
     901  READ_FLAG( val, "knee_function_cancel_flag" );          sei.m_kneeCancelFlag = val;
     902  if ( !sei.m_kneeCancelFlag )
     903  {
     904    READ_FLAG( val, "knee_function_persistence_flag" );   sei.m_kneePersistenceFlag = val;
     905    READ_FLAG( val, "mapping_flag" );                     sei.m_kneeMappingFlag = val;
     906    READ_CODE( 32, val, "input_d_range" );                sei.m_kneeInputDrange = val;
     907    READ_CODE( 32, val, "input_disp_luminance" );         sei.m_kneeInputDispLuminance = val;
     908    READ_CODE( 32, val, "output_d_range" );               sei.m_kneeOutputDrange = val;
     909    READ_CODE( 32, val, "output_disp_luminance" );        sei.m_kneeOutputDispLuminance = val;
     910    READ_UVLC( val, "num_knee_points_minus1" );           sei.m_kneeNumKneePointsMinus1 = val;
     911    assert( sei.m_kneeNumKneePointsMinus1 > 0 );
     912    sei.m_kneeInputKneePoint.resize(sei.m_kneeNumKneePointsMinus1+1);
     913    sei.m_kneeOutputKneePoint.resize(sei.m_kneeNumKneePointsMinus1+1);
     914    for(i = 0; i <= sei.m_kneeNumKneePointsMinus1; i++ )
     915    {
     916      READ_CODE( 10, val, "input_knee_point" );           sei.m_kneeInputKneePoint[i] = val;
     917      READ_CODE( 10, val, "output_knee_point" );          sei.m_kneeOutputKneePoint[i] = val;
     918    }
     919  }
     920}
     921#endif
     922
    851923#if Q0074_SEI_COLOR_MAPPING
    852924Void SEIReader::xParseSEIColorMappingInfo(SEIColorMappingInfo& sei, UInt /*payloadSize*/)
     
    9601032}
    9611033
     1034#if Q0189_TMVP_CONSTRAINTS
     1035Void SEIReader::xParseSEITMVPConstraints   (SEITMVPConstrains& sei, UInt payloadSize)
     1036{
     1037  UInt uiCode;
     1038  READ_UVLC( uiCode,           "prev_pics_not_used_flag"              ); sei.prev_pics_not_used_flag = uiCode;
     1039  READ_UVLC( uiCode,           "no_intra_layer_col_pic_flag"            ); sei.no_intra_layer_col_pic_flag = uiCode;
     1040  xParseByteAlign();
     1041}
     1042#endif
     1043
     1044#if Q0247_FRAME_FIELD_INFO
     1045Void SEIReader::xParseSEIFrameFieldInfo    (SEIFrameFieldInfo& sei, UInt payloadSize)
     1046{
     1047  UInt code;
     1048  READ_CODE( 4, code, "ffinfo_pic_struct" );             sei.m_ffinfo_picStruct            = code;
     1049  READ_CODE( 2, code, "ffinfo_source_scan_type" );       sei.m_ffinfo_sourceScanType = code;
     1050  READ_FLAG(    code, "ffinfo_duplicate_flag" );         sei.m_ffinfo_duplicateFlag    = ( code == 1 ? true : false );
     1051  xParseByteAlign();
     1052}
     1053#endif
     1054
    9621055#if LAYERS_NOT_PRESENT_SEI
    9631056Void SEIReader::xParseSEIScalableNesting(SEIScalableNesting& sei, const NalUnitType nalUnitType, UInt payloadSize, TComVPS *vps, TComSPS *sps)
     
    12091302    UInt lsIdx = nestingSei.m_nestingOpIdx[h];
    12101303    READ_UVLC( uiCode, "num_sei_bitstream_partitions_minus1[i]"); sei.m_seiNumBitstreamPartitionsMinus1[lsIdx] = uiCode;
    1211     for (UInt i = 0; i <= sei.m_seiNumBitstreamPartitionsMinus1[lsIdx]; i++)
    1212     {
    1213       for (UInt j = 0; j < sei.m_vpsMaxLayers; j++)
     1304#if HRD_BPB
     1305    Int chkPart=0;
     1306#endif
     1307    UInt i;
     1308    for(i = 0; i <= sei.m_seiNumBitstreamPartitionsMinus1[lsIdx]; i++)
     1309    {
     1310#if HRD_BPB
     1311      UInt nl=0; UInt j;
     1312      for(j = 0; j < sei.m_vpsMaxLayers; j++)
    12141313      {
    12151314        if (sei.m_layerIdIncludedFlag[lsIdx][j])
    12161315        {
     1316          nl++;
     1317        }
     1318      }
     1319      for (j = 0; j < nl; j++)
     1320      {
     1321#else
     1322      for (UInt j = 0; j < sei.m_vpsMaxLayers; j++)
     1323      {
     1324        if (sei.m_layerIdIncludedFlag[lsIdx][j])
     1325        {
     1326#endif
    12171327          READ_FLAG( uiCode, "sei_layer_in_bsp_flag[lsIdx][i][j]" ); sei.m_seiLayerInBspFlag[lsIdx][i][j] = uiCode;
    12181328        }
    1219       }
    1220     }
     1329#if !HRD_BPB
     1330      }
     1331#endif
     1332#if HRD_BPB
     1333      chkPart+=sei.m_seiLayerInBspFlag[lsIdx][i][j];
     1334#endif
     1335    }
     1336#if HRD_BPB
     1337    assert(chkPart<=1);
     1338#endif
     1339#if HRD_BPB
     1340    if(sei.m_seiNumBitstreamPartitionsMinus1[lsIdx]==0)
     1341    {
     1342      Int chkPartition1=0; Int chkPartition2=0;
     1343      for (UInt j = 0; j < sei.m_vpsMaxLayers; j++)
     1344      {
     1345        if( sei.m_layerIdIncludedFlag[lsIdx][j] )
     1346        {
     1347          chkPartition1+=sei.m_seiLayerInBspFlag[lsIdx][0][j];
     1348          chkPartition2++;
     1349        }
     1350      }
     1351      assert(chkPartition1!=chkPartition2);
     1352    }
     1353#endif
     1354     
    12211355    READ_UVLC( uiCode, "sei_num_bsp_sched_combinations_minus1[i]"); sei.m_seiNumBspSchedCombinationsMinus1[lsIdx] = uiCode;
    1222     for (UInt i = 0; i <= sei.m_seiNumBspSchedCombinationsMinus1[lsIdx]; i++)
     1356    for (i = 0; i <= sei.m_seiNumBspSchedCombinationsMinus1[lsIdx]; i++)
    12231357    {
    12241358      for (UInt j = 0; j <= sei.m_seiNumBitstreamPartitionsMinus1[lsIdx]; j++)
    12251359      {
    12261360        READ_UVLC( uiCode, "sei_bsp_comb_hrd_idx[lsIdx][i][j]"); sei.m_seiBspCombHrdIdx[lsIdx][i][j] = uiCode;
     1361#if HRD_BPB
     1362        assert(uiCode <= sei.m_seiNumBspHrdParametersMinus1);
     1363#endif
    12271364        READ_UVLC( uiCode, "sei_bsp_comb_sched_idx[lsIdx][i][j]"); sei.m_seiBspCombScheddx[lsIdx][i][j] = uiCode;
     1365#if HRD_BPB
     1366        assert(uiCode <= sei.hrd->getCpbCntMinus1( sps->getMaxTLayers()-1 ));
     1367#endif
     1368
    12281369      }
    12291370    }
     
    13071448#endif
    13081449
     1450#if Q0078_ADD_LAYER_SETS
     1451
     1452#if LAYERS_NOT_PRESENT_SEI
     1453Void SEIReader::xParseSEIOutputLayerSetNesting(SEIOutputLayerSetNesting& sei, const NalUnitType nalUnitType, TComVPS *vps, TComSPS *sps)
     1454#else
     1455Void SEIReader::xParseSEIOutputLayerSetNesting(SEIOutputLayerSetNesting& sei, const NalUnitType nalUnitType, TComSPS *sps)
     1456#endif
     1457{
     1458  UInt uiCode;
     1459  SEIMessages seis;
     1460
     1461  READ_FLAG(uiCode, "ols_flag"); sei.m_olsFlag = uiCode;
     1462  READ_UVLC(uiCode, "num_ols_indices_minus1"); sei.m_numOlsIndicesMinus1 = uiCode;
     1463
     1464  for (Int i = 0; i <= sei.m_numOlsIndicesMinus1; i++)
     1465  {
     1466    READ_UVLC(uiCode, "ols_idx[i]"); sei.m_olsIdx[i] = uiCode;
     1467  }
     1468
     1469  // byte alignment
     1470  while (m_pcBitstream->getNumBitsRead() % 8 != 0)
     1471  {
     1472    UInt code;
     1473    READ_FLAG(code, "ols_nesting_zero_bit");
     1474  }
     1475
     1476  sei.m_callerOwnsSEIs = false;
     1477
     1478  // read nested SEI messages
     1479  do {
     1480#if O0164_MULTI_LAYER_HRD
     1481#if LAYERS_NOT_PRESENT_SEI
     1482    xReadSEImessage(sei.m_nestedSEIs, nalUnitType, vps, sps);
     1483#else
     1484    xReadSEImessage(sei.m_nestedSEIs, nalUnitType, sps);
     1485#endif
     1486#else
     1487#if LAYERS_NOT_PRESENT_SEI
     1488    xReadSEImessage(sei.m_nestedSEIs, nalUnitType, vps, sps);
     1489#else
     1490    xReadSEImessage(sei.m_nestedSEIs, nalUnitType, sps);
     1491#endif
     1492#endif
     1493  } while (m_pcBitstream->getNumBitsLeft() > 8);
     1494
     1495}
     1496
     1497Void SEIReader::xParseSEIVPSRewriting(SEIVPSRewriting &sei)
     1498{
     1499}
     1500
     1501#endif
     1502
    13091503#endif //SVC_EXTENSION
    13101504
Note: See TracChangeset for help on using the changeset viewer.