Changeset 540 in SHVCSoftware for trunk/source/Lib/TLibDecoder


Ignore:
Timestamp:
9 Jan 2014, 05:04:17 (11 years ago)
Author:
seregin
Message:

merge SHM-4.1-dev branch

Location:
trunk
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/source

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

    r313 r540  
    126126  else
    127127  {
    128     assert( nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_TLA_R
     128    assert( nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_TSA_R
    129129         && nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_TSA_N
    130130         && nalu.m_nalUnitType != NAL_UNIT_CODED_SLICE_STSA_R
  • trunk/source/Lib/TLibDecoder/TDecCAVLC.cpp

    r494 r540  
    290290    }
    291291  }
     292
     293#if SCALINGLIST_INFERRING
     294  if( pcPPS->getLayerId() > 0 )
     295  {
     296    READ_FLAG( uiCode, "pps_infer_scaling_list_flag" );
     297    pcPPS->setInferScalingListFlag( uiCode );
     298  }
     299
     300  if( pcPPS->getInferScalingListFlag() )
     301  {
     302    READ_UVLC( uiCode, "pps_scaling_list_ref_layer_id" ); pcPPS->setScalingListRefLayerId( uiCode );
     303
     304    // The value of pps_scaling_list_ref_layer_id shall be in the range of 0 to 62, inclusive
     305    assert( pcPPS->getScalingListRefLayerId() <= 62 );
     306
     307    pcPPS->setScalingListPresentFlag( false );
     308  }
     309  else
     310  {
     311#endif
     312
    292313  READ_FLAG( uiCode, "pps_scaling_list_data_present_flag" );           pcPPS->setScalingListPresentFlag( uiCode ? true : false );
    293314
    294 #if IL_SL_SIGNALLING_N0371
    295   pcPPS->setPPS( pcPPS->getLayerId(), pcPPS );
    296 #endif
    297 
    298315  if(pcPPS->getScalingListPresentFlag ())
    299316  {
    300 #if IL_SL_SIGNALLING_N0371
    301     pcPPS->getScalingList()->setLayerId( pcPPS->getLayerId() );
    302 
    303     if( pcPPS->getLayerId() > 0 )
    304     {
    305       READ_FLAG( uiCode, "pps_pred_scaling_list_flag" );           pcPPS->setPredScalingListFlag( uiCode ? true : false );
    306       pcPPS->getScalingList()->setPredScalingListFlag( pcPPS->getPredScalingListFlag() );
    307 
    308       if( pcPPS->getPredScalingListFlag() )
    309       {
    310         READ_UVLC ( uiCode, "scaling_list_pps_ref_layer_id" );   pcPPS->setScalingListRefLayerId( uiCode );
    311 
    312         // The value of pps_scaling_list_ref_layer_id shall be in the range of 0 to 62, inclusive
    313         assert( /*pcPPS->getScalingListRefLayerId() >= 0 &&*/ pcPPS->getScalingListRefLayerId() <= 62 );
    314 
    315         // When avc_base_layer_flag is equal to 1, it is a requirement of bitstream conformance that the value of pps_scaling_list_ref_layer_id shall be greater than 0
    316         if( pcPPS->getSPS()->getVPS()->getAvcBaseLayerFlag() )
    317         {
    318           assert( pcPPS->getScalingListRefLayerId() > 0 );
    319         }
    320 
    321         // It is a requirement of bitstream conformance that, when a PPS with nuh_layer_id equal to nuhLayerIdA is active for a layer with nuh_layer_id equal to nuhLayerIdB and
    322         // pps_infer_scaling_list_flag in the PPS is equal to 1, pps_infer_scaling_list_flag shall be equal to 0 for the PPS that is active for the layer with nuh_layer_id equal to pps_scaling_list_ref_layer_id
    323         assert( pcPPS->getPPS( pcPPS->getScalingListRefLayerId() )->getPredScalingListFlag() == false );
    324 
    325         // It is a requirement of bitstream conformance that, when a PPS with nuh_layer_id equal to nuhLayerIdA is active for a layer with nuh_layer_id equal to nuhLayerIdB,
    326         // the layer with nuh_layer_id equal to pps_scaling_list_ref_layer_id shall be a direct or indirect reference layer of the layer with nuh_layer_id equal to nuhLayerIdB
    327         assert( pcPPS->getSPS()->getVPS()->getScalingListLayerDependency( pcPPS->getLayerId(), pcPPS->getScalingListRefLayerId() ) == true );
    328 
    329         pcPPS->getScalingList()->setScalingListRefLayerId( pcPPS->getScalingListRefLayerId() );
    330         parseScalingList( pcPPS->getScalingList() );
    331       }
    332       else
    333       {
    334         parseScalingList( pcPPS->getScalingList() );
    335       }
    336     }
    337     else
    338     {
    339       parseScalingList( pcPPS->getScalingList() );
    340     }
    341 #else
    342317    parseScalingList( pcPPS->getScalingList() );
    343 #endif
    344   }
     318  }
     319
     320#if SCALINGLIST_INFERRING
     321  }
     322#endif
    345323
    346324  READ_FLAG( uiCode, "lists_modification_present_flag");
     
    563541    pcSPS->setTemporalIdNestingFlag( parameterSetManager->getPrefetchedVPS(pcSPS->getVPSId())->getTemporalNestingFlag() );
    564542  }
    565 #if IL_SL_SIGNALLING_N0371
    566   pcSPS->setVPS( parameterSetManager->getPrefetchedVPS(pcSPS->getVPSId()) );
    567   pcSPS->setSPS( pcSPS->getLayerId(), pcSPS );
    568 #endif
    569543#endif
    570544  if ( pcSPS->getMaxTLayers() == 1 )
     
    599573    pcSPS->setUpdateRepFormatFlag( true );
    600574  }
     575#if O0096_REP_FORMAT_INDEX
     576  if( pcSPS->getLayerId() == 0 )
     577#else
    601578  if( pcSPS->getLayerId() == 0 || pcSPS->getUpdateRepFormatFlag() )
     579#endif
    602580  {
    603581#endif
     
    619597#if REPN_FORMAT_IN_VPS
    620598  }
     599#if O0096_REP_FORMAT_INDEX
     600  else if ( pcSPS->getUpdateRepFormatFlag() )
     601  {
     602    READ_CODE(8, uiCode, "update_rep_format_index");
     603    pcSPS->setUpdateRepFormatIndex(uiCode);
     604  }
     605#endif
    621606#endif
    622607  READ_FLAG(     uiCode, "conformance_window_flag");
     
    637622  }
    638623#if REPN_FORMAT_IN_VPS
     624#if O0096_REP_FORMAT_INDEX
     625  if( pcSPS->getLayerId() == 0 )
     626#else
    639627  if(  pcSPS->getLayerId() == 0 || pcSPS->getUpdateRepFormatFlag() )
     628#endif
    640629  {
    641630#endif
     
    701690  if(pcSPS->getScalingListFlag())
    702691  {
     692#if SCALINGLIST_INFERRING
     693    if( pcSPS->getLayerId() > 0 )
     694    {
     695      READ_FLAG( uiCode, "sps_infer_scaling_list_flag" ); pcSPS->setInferScalingListFlag( uiCode );
     696    }
     697
     698    if( pcSPS->getInferScalingListFlag() )
     699    {
     700      READ_UVLC( uiCode, "sps_scaling_list_ref_layer_id" ); pcSPS->setScalingListRefLayerId( uiCode );
     701
     702      // The value of pps_scaling_list_ref_layer_id shall be in the range of 0 to 62, inclusive
     703      assert( pcSPS->getScalingListRefLayerId() <= 62 );
     704
     705      pcSPS->setScalingListPresentFlag( false );
     706    }
     707    else
     708    {
     709#endif
    703710    READ_FLAG( uiCode, "sps_scaling_list_data_present_flag" );                 pcSPS->setScalingListPresentFlag ( uiCode );
    704711    if(pcSPS->getScalingListPresentFlag ())
    705712    {
    706 
    707 #if IL_SL_SIGNALLING_N0371
    708       pcSPS->getScalingList()->setLayerId( pcSPS->getLayerId() );
    709 
    710       if( pcSPS->getLayerId() > 0 )
    711       {
    712         READ_FLAG( uiCode, "sps_pred_scaling_list_flag" );  pcSPS->setPredScalingListFlag ( uiCode );
    713         pcSPS->getScalingList()->setPredScalingListFlag( pcSPS->getPredScalingListFlag() );
    714 
    715         if( pcSPS->getPredScalingListFlag() )
    716         {
    717           READ_UVLC( uiCode, "scaling_list_sps_ref_layer_id" );    pcSPS->setScalingListRefLayerId( uiCode );
    718 
    719           // The value of sps_scaling_list_ref_layer_id shall be in the range of 0 to 62, inclusive
    720           assert( /*pcSPS->getScalingListRefLayerId() >= 0 &&*/ pcSPS->getScalingListRefLayerId() <= 62 );
    721 
    722           // When avc_base_layer_flag is equal to 1, it is a requirement of bitstream conformance that the value of sps_scaling_list_ref_layer_id shall be greater than 0
    723           if( pcSPS->getVPS()->getAvcBaseLayerFlag() )
    724           {
    725             assert( pcSPS->getScalingListRefLayerId() > 0 );
    726           }
    727 
    728           // It is a requirement of bitstream conformance that, when an SPS with nuh_layer_id equal to nuhLayerIdA is active for a layer with nuh_layer_id equal to nuhLayerIdB and
    729           // sps_infer_scaling_list_flag in the SPS is equal to 1, sps_infer_scaling_list_flag shall be equal to 0 for the SPS that is active for the layer with nuh_layer_id equal to sps_scaling_list_ref_layer_id
    730           assert( pcSPS->getSPS( pcSPS->getScalingListRefLayerId() )->getPredScalingListFlag() == false );
    731 
    732           // It is a requirement of bitstream conformance that, when an SPS with nuh_layer_id equal to nuhLayerIdA is active for a layer with nuh_layer_id equal to nuhLayerIdB,
    733           // the layer with nuh_layer_id equal to sps_scaling_list_ref_layer_id shall be a direct or indirect reference layer of the layer with nuh_layer_id equal to nuhLayerIdB
    734           assert( pcSPS->getVPS()->getScalingListLayerDependency( pcSPS->getLayerId(), pcSPS->getScalingListRefLayerId() ) == true );
    735 
    736           pcSPS->getScalingList()->setScalingListRefLayerId( pcSPS->getScalingListRefLayerId() );
    737           parseScalingList( pcSPS->getScalingList() );
    738         }
    739         else
    740         {
    741           parseScalingList( pcSPS->getScalingList() );
    742         }
    743       }
    744       else
    745       {
    746         parseScalingList( pcSPS->getScalingList() );
    747       }
    748 #else
    749713      parseScalingList( pcSPS->getScalingList() );
    750 #endif
    751 
    752     }
     714    }
     715#if SCALINGLIST_INFERRING
     716    }
     717#endif
    753718  }
    754719  READ_FLAG( uiCode, "amp_enabled_flag" );                          pcSPS->setUseAMP( uiCode );
     
    813778  {
    814779#if SPS_EXTENSION
     780
     781#if O0142_CONDITIONAL_SPS_EXTENSION
     782    UInt spsExtensionTypeFlag[8];
     783    for (UInt i = 0; i < 8; i++)
     784    {
     785      READ_FLAG( spsExtensionTypeFlag[i], "sps_extension_type_flag" );
     786    }
     787    if (spsExtensionTypeFlag[1])
     788    {
     789      parseSPSExtension( pcSPS );
     790    }
     791    if (spsExtensionTypeFlag[7])
     792    {
     793#else
    815794    parseSPSExtension( pcSPS );
    816795    READ_FLAG( uiCode, "sps_extension2_flag");
    817796    if(uiCode)
    818797    {
     798#endif
     799
    819800#endif
    820801      while ( xMoreRbspData() )
     
    846827    {
    847828      Window& scaledWindow = pcSPS->getScaledRefLayerWindow(i);
     829#if O0098_SCALED_REF_LAYER_ID
     830      READ_CODE( 6,  uiCode,  "scaled_ref_layer_left_id" );  pcSPS->setScaledRefLayerId( i, uiCode );
     831#endif
    848832      READ_SVLC( iCode, "scaled_ref_layer_left_offset" );    scaledWindow.setWindowLeftOffset  (iCode << 1);
    849833      READ_SVLC( iCode, "scaled_ref_layer_top_offset" );     scaledWindow.setWindowTopOffset   (iCode << 1);
     
    10901074    vps->setNumDirectRefLayers(layerCtr, numDirectRefLayers);
    10911075  }
     1076#endif
     1077#if VPS_TSLAYERS
     1078    READ_FLAG( uiCode, "vps_sub_layers_max_minus1_present_flag"); vps->setMaxTSLayersPresentFlag(uiCode ? true : false);
     1079    if (vps->getMaxTSLayersPresentFlag())
     1080    {
     1081        for(i = 0; i < vps->getMaxLayers() - 1; i++)
     1082        {
     1083            READ_CODE( 3, uiCode, "sub_layers_vps_max_minus1[i]" ); vps->setMaxTSLayersMinus1(i, uiCode);
     1084        }
     1085    }
     1086    else
     1087    {
     1088        for( i = 0; i < vps->getMaxLayers() - 1; i++)
     1089        {
     1090            vps->setMaxTSLayersMinus1(i, vps->getMaxTLayers()-1);
     1091        }
     1092    }
    10921093#endif
    10931094#if JCTVC_M0203_INTERLAYER_PRED_IDC
     
    12081209    else
    12091210    {
     1211#if VPS_DPB_SIZE_TABLE
     1212      vps->setOutputLayerSetIdx( i, i );
     1213#endif
    12101214      // i <= (vps->getNumLayerSets() - 1)
    12111215      // Assign OutputLayerFlag depending on default_one_target_output_layer_flag
     
    12341238  }
    12351239
     1240#if O0153_ALT_OUTPUT_LAYER_FLAG
     1241  if( vps->getMaxLayers() > 1 )
     1242  {
     1243    READ_FLAG( uiCode, "alt_output_layer_flag");
     1244    vps->setAltOuputLayerFlag( uiCode ? true : false );
     1245  }
     1246#endif
     1247
    12361248#if REPN_FORMAT_IN_VPS
    12371249  READ_FLAG( uiCode, "rep_format_idx_present_flag");
     
    12401252  if( vps->getRepFormatIdxPresentFlag() )
    12411253  {
     1254#if O0096_REP_FORMAT_INDEX
     1255    READ_CODE( 8, uiCode, "vps_num_rep_formats_minus1" );
     1256#else
    12421257    READ_CODE( 4, uiCode, "vps_num_rep_formats_minus1" );
     1258#endif
    12431259    vps->setVpsNumRepFormats( uiCode + 1 );
    12441260  }
     
    12631279      if( vps->getVpsNumRepFormats() > 1 )
    12641280      {
     1281#if O0096_REP_FORMAT_INDEX
     1282        READ_CODE( 8, uiCode, "vps_rep_format_idx[i]" );
     1283#else
    12651284        READ_CODE( 4, uiCode, "vps_rep_format_idx[i]" );
     1285#endif
    12661286        vps->setVpsRepFormatIdx( i, uiCode );
    12671287      }
     
    13051325#endif
    13061326
     1327#if VPS_DPB_SIZE_TABLE
     1328  vps->deriveNumberOfSubDpbs();
     1329  for(i = 1; i < vps->getNumOutputLayerSets(); i++)
     1330  {
     1331    READ_FLAG( uiCode, "sub_layer_flag_info_present_flag[i]");  vps->setSubLayerFlagInfoPresentFlag( i, uiCode ? true : false );
     1332    for(j = 0; j < vps->getMaxTLayers(); j++)
     1333    {
     1334      if( j > 0 && vps->getSubLayerFlagInfoPresentFlag(i) )
     1335      {
     1336        READ_FLAG( uiCode, "sub_layer_dpb_info_present_flag[i]");  vps->setSubLayerDpbInfoPresentFlag( i, j, uiCode ? true : false);
     1337      }
     1338      else
     1339      {
     1340        if( j == 0 )  // Always signal for the first sub-layer
     1341        {
     1342          vps->setSubLayerDpbInfoPresentFlag( i, j, true );
     1343        }
     1344        else // if (j != 0) && !vps->getSubLayerFlagInfoPresentFlag(i)
     1345        {
     1346          vps->setSubLayerDpbInfoPresentFlag( i, j, false );
     1347        }
     1348      }
     1349      if( vps->getSubLayerDpbInfoPresentFlag(i, j) )  // If sub-layer DPB information is present
     1350      {
     1351        for(Int k = 0; k < vps->getNumSubDpbs(i); k++)
     1352        {
     1353          READ_UVLC( uiCode, "max_vps_dec_pic_buffering_minus1[i][k][j]" ); vps->setMaxVpsDecPicBufferingMinus1( i, k, j, uiCode );
     1354        }
     1355        READ_UVLC( uiCode, "max_vps_num_reorder_pics[i][j]" );              vps->setMaxVpsNumReorderPics( i, j, uiCode);
     1356        READ_UVLC( uiCode, "max_vps_latency_increase_plus1[i][j]" );        vps->setMaxVpsLatencyIncreasePlus1( i, j, uiCode);
     1357      }
     1358    }
     1359  }
     1360#endif
    13071361#if VPS_EXTN_DIRECT_REF_LAYERS && M0457_PREDICTION_INDICATIONS
    13081362  READ_UVLC( uiCode,           "direct_dep_type_len_minus2"); vps->setDirectDepTypeLen(uiCode+2);
     1363#if O0096_DEFAULT_DEPENDENCY_TYPE
     1364  READ_FLAG(uiCode, "default_direct_dependency_type_flag");
     1365  vps->setDefaultDirectDependecyTypeFlag(uiCode == 1? true : false);
     1366  if (vps->getDefaultDirectDependencyTypeFlag())
     1367  {
     1368    READ_CODE( vps->getDirectDepTypeLen(), uiCode, "default_direct_dependency_type" );
     1369    vps->setDefaultDirectDependecyType(uiCode);
     1370  }
     1371#endif
    13091372  for(i = 1; i < vps->getMaxLayers(); i++)
    13101373  {
     
    13131376      if (vps->getDirectDependencyFlag(i, j))
    13141377      {
    1315         READ_CODE( vps->getDirectDepTypeLen(), uiCode, "direct_dependency_type[i][j]" ); vps->setDirectDependencyType(i, j, uiCode);
    1316       }
    1317     }
    1318   }
    1319 
    1320 #endif
    1321 
    1322 #if IL_SL_SIGNALLING_N0371
     1378#if O0096_DEFAULT_DEPENDENCY_TYPE
     1379        if (vps->getDefaultDirectDependencyTypeFlag())
     1380        {
     1381          vps->setDirectDependencyType(i, j, vps->getDefaultDirectDependencyType());
     1382        }
     1383        else
     1384        {
     1385          READ_CODE( vps->getDirectDepTypeLen(), uiCode, "direct_dependency_type[i][j]" );
     1386          vps->setDirectDependencyType(i, j, uiCode);
     1387        }
     1388#else
     1389        READ_CODE( vps->getDirectDepTypeLen(), uiCode, "direct_dependency_type[i][j]" );
     1390        vps->setDirectDependencyType(i, j, uiCode);
     1391#endif
     1392      }
     1393    }
     1394  }
     1395#endif
     1396#if O0092_0094_DEPENDENCY_CONSTRAINT
    13231397  for(i = 1; i < vps->getMaxLayers(); i++)
    1324     {
    1325       for(j = 0; j < i; j++)
    1326         {
    1327           vps->setScalingListLayerDependency( i, j, vps->checkLayerDependency( i,j ) );
    1328         }
    1329     }
     1398  {
     1399    vps->setNumRefLayers(vps->getLayerIdInNuh(i));   // identify the number of direct and indirect reference layers of current layer and set recursiveRefLayersFlags
     1400  }
     1401  if(vps->getMaxLayers() > MAX_REF_LAYERS)
     1402  {
     1403    for(i = 1;i < vps->getMaxLayers(); i++)
     1404    {
     1405      assert( vps->getNumRefLayers(vps->getLayerIdInNuh(i)) <= MAX_REF_LAYERS);
     1406    }
     1407  }
    13301408#endif
    13311409
     
    13331411  READ_FLAG(uiCode, "single_layer_for_non_irap_flag" ); vps->setSingleLayerForNonIrapFlag(uiCode == 1 ? true : false);
    13341412#endif
     1413#if HIGHER_LAYER_IRAP_SKIP_FLAG
     1414  READ_FLAG(uiCode, "higher_layer_irap_skip_flag" ); vps->setHigherLayerIrapSkipFlag(uiCode == 1 ? true : false);
     1415#endif
    13351416
    13361417  READ_FLAG( uiCode,  "vps_vui_present_flag" );
     
    13511432{
    13521433  UInt uiCode;
     1434#if REPN_FORMAT_CONTROL_FLAG
     1435  READ_FLAG ( uiCode, "chroma_and_bit_depth_vps_present_flag");   repFormat->setChromaAndBitDepthVpsPresentFlag(uiCode ? true : false);
     1436  READ_CODE ( 16, uiCode, "pic_width_in_luma_samples" );          repFormat->setPicWidthVpsInLumaSamples ( uiCode );
     1437  READ_CODE ( 16, uiCode, "pic_height_in_luma_samples" );         repFormat->setPicHeightVpsInLumaSamples( uiCode );
     1438
     1439  if( repFormat->getChromaAndBitDepthVpsPresentFlag() )
     1440  {
     1441#if AUXILIARY_PICTURES
     1442    READ_CODE( 2, uiCode, "chroma_format_idc" );               repFormat->setChromaFormatVpsIdc( ChromaFormat(uiCode) );
     1443#else
     1444    READ_CODE( 2, uiCode, "chroma_format_idc" );               repFormat->setChromaFormatVpsIdc( uiCode );
     1445#endif
     1446
     1447    if( repFormat->getChromaFormatVpsIdc() == 3 )
     1448    {
     1449      READ_FLAG( uiCode, "separate_colour_plane_flag");        repFormat->setSeparateColourPlaneVpsFlag(uiCode ? true : false);
     1450    }
     1451
     1452
     1453    READ_CODE( 4, uiCode, "bit_depth_luma_minus8" );           repFormat->setBitDepthVpsLuma  ( uiCode + 8 );
     1454    READ_CODE( 4, uiCode, "bit_depth_chroma_minus8" );         repFormat->setBitDepthVpsChroma( uiCode + 8 );
     1455  }
     1456#else
    13531457#if AUXILIARY_PICTURES
    13541458  READ_CODE( 2, uiCode, "chroma_format_idc" );               repFormat->setChromaFormatVpsIdc( ChromaFormat(uiCode) );
     
    13671471  READ_CODE( 4, uiCode, "bit_depth_luma_minus8" );           repFormat->setBitDepthVpsLuma  ( uiCode + 8 );
    13681472  READ_CODE( 4, uiCode, "bit_depth_chroma_minus8" );         repFormat->setBitDepthVpsChroma( uiCode + 8 );
    1369 
     1473#endif
    13701474}
    13711475#endif
     
    13751479  UInt i,j;
    13761480  UInt uiCode;
     1481#if O0223_PICTURE_TYPES_ALIGN_FLAG
     1482  READ_FLAG(uiCode, "cross_layer_pic_type_aligned_flag" );
     1483  vps->setCrossLayerPictureTypeAlignFlag(uiCode);
     1484  if (!uiCode)
     1485  {
     1486#endif
    13771487#if IRAP_ALIGN_FLAG_IN_VPS_VUI
    1378   READ_FLAG(uiCode, "cross_layer_irap_aligned_flag" );
    1379   vps->setCrossLayerIrapAlignFlag(uiCode);
     1488    READ_FLAG(uiCode, "cross_layer_irap_aligned_flag" );
     1489    vps->setCrossLayerIrapAlignFlag(uiCode);
     1490#endif
     1491#if O0223_PICTURE_TYPES_ALIGN_FLAG
     1492  }
     1493  else
     1494  {
     1495    vps->setCrossLayerIrapAlignFlag(true);
     1496  }
    13801497#endif
    13811498#if VPS_VUI_BITRATE_PICRATE
     
    14291546  }
    14301547#endif
     1548#if VPS_VUI_TILES_NOT_IN_USE__FLAG
     1549  UInt layerIdx;
     1550  READ_FLAG( uiCode, "tiles_not_in_use_flag" ); vps->setTilesNotInUseFlag(uiCode == 1);
     1551  if (!uiCode)
     1552  {
     1553    for(i = 0; i < vps->getMaxLayers(); i++)
     1554    {
     1555      READ_FLAG( uiCode, "tiles_in_use_flag[ i ]" ); vps->setTilesInUseFlag(i, (uiCode == 1));
     1556      if (uiCode)
     1557      {
     1558        READ_FLAG( uiCode, "loop_filter_not_across_tiles_flag[ i ]" ); vps->setLoopFilterNotAcrossTilesFlag(i, (uiCode == 1));
     1559      }
     1560      else
     1561      {
     1562        vps->setLoopFilterNotAcrossTilesFlag(i, false);
     1563      }
     1564    }
     1565#endif
    14311566#if TILE_BOUNDARY_ALIGNED_FLAG
    1432   for(i = 1; i < vps->getMaxLayers(); i++)
    1433   {
    1434     for(j = 0; j < vps->getNumDirectRefLayers(vps->getLayerIdInNuh(i)); j++)
    1435     {
    1436       READ_FLAG( uiCode, "tile_boundaries_aligned_flag[i][j]" ); vps->setTileBoundariesAlignedFlag(i,j,(uiCode == 1));
     1567    for(i = 1; i < vps->getMaxLayers(); i++)
     1568    {
     1569      for(j = 0; j < vps->getNumDirectRefLayers(vps->getLayerIdInNuh(i)); j++)
     1570      {
     1571#if VPS_VUI_TILES_NOT_IN_USE__FLAG
     1572        layerIdx = vps->getLayerIdInVps(vps->getRefLayerId(vps->getLayerIdInNuh(i), j));
     1573        if (vps->getTilesInUseFlag(i) && vps->getTilesInUseFlag(layerIdx)) {
     1574          READ_FLAG( uiCode, "tile_boundaries_aligned_flag[i][j]" ); vps->setTileBoundariesAlignedFlag(i,j,(uiCode == 1));
     1575        }
     1576#else
     1577        READ_FLAG( uiCode, "tile_boundaries_aligned_flag[i][j]" ); vps->setTileBoundariesAlignedFlag(i,j,(uiCode == 1));
     1578#endif
     1579      }
     1580    }
     1581#endif
     1582#if VPS_VUI_TILES_NOT_IN_USE__FLAG
     1583  }
     1584#endif
     1585#if VPS_VUI_WPP_NOT_IN_USE__FLAG
     1586  READ_FLAG( uiCode, "wpp_not_in_use_flag" ); vps->setWppNotInUseFlag(uiCode == 1);
     1587  if (!uiCode)
     1588  {
     1589    for(i = 0; i < vps->getMaxLayers(); i++)
     1590    {
     1591      READ_FLAG( uiCode, "wpp_in_use_flag[ i ]" ); vps->setWppInUseFlag(i, (uiCode == 1));
    14371592    }
    14381593  }
     
    14581613    }
    14591614  }
     1615#endif
     1616#if VPS_VUI_VIDEO_SIGNAL
     1617    READ_FLAG( uiCode, "video_signal_info_idx_present_flag" ); vps->setVideoSigPresentVpsFlag( uiCode == 1 );
     1618    if (vps->getVideoSigPresentVpsFlag())
     1619    {
     1620        READ_CODE(4, uiCode, "vps_num_video_signal_info_minus1" ); vps->setNumVideoSignalInfo(uiCode + 1);
     1621    }
     1622    else
     1623    {
     1624        vps->setNumVideoSignalInfo(vps->getMaxLayers());
     1625    }
     1626   
     1627   
     1628    for(i = 0; i < vps->getNumVideoSignalInfo(); i++)
     1629    {
     1630        READ_CODE(3, uiCode, "video_vps_format" ); vps->setVideoVPSFormat(i,uiCode);
     1631        READ_FLAG(uiCode, "video_full_range_vps_flag" ); vps->setVideoFullRangeVpsFlag(i,uiCode);
     1632        READ_CODE(8, uiCode, "color_primaries_vps" ); vps->setColorPrimaries(i,uiCode);
     1633        READ_CODE(8, uiCode, "transfer_characteristics_vps" ); vps->setTransCharacter(i,uiCode);
     1634        READ_CODE(8, uiCode, "matrix_coeffs_vps" );vps->setMaxtrixCoeff(i,uiCode);
     1635    }
     1636    if(!vps->getVideoSigPresentVpsFlag())
     1637    {
     1638        for (i=0; i < vps->getMaxLayers(); i++)
     1639        {
     1640            vps->setVideoSignalInfoIdx(i,i);
     1641        }
     1642    }
     1643    else {
     1644        vps->setVideoSignalInfoIdx(0,0);
     1645        if (vps->getNumVideoSignalInfo() > 1 )
     1646        {
     1647            for (i=1; i < vps->getMaxLayers(); i++)
     1648                READ_CODE(4, uiCode, "vps_video_signal_info_idx" ); vps->setVideoSignalInfoIdx(i, uiCode);
     1649        }
     1650        else {
     1651          for (i=1; i < vps->getMaxLayers(); i++)
     1652          {
     1653            vps->setVideoSignalInfoIdx(i,0);
     1654          }
     1655        }
     1656    }
    14601657#endif
    14611658}
     
    15481745      iBits++;
    15491746    }
     1747#if O0149_CROSS_LAYER_BLA_FLAG
     1748    if(rpcSlice->getPPS()->getNumExtraSliceHeaderBits() > iBits)
     1749    {
     1750      READ_FLAG(uiCode, "cross_layer_bla_flag");  rpcSlice->setCrossLayerBLAFlag( uiCode ? true : false );
     1751      iBits++;
     1752    }
     1753#endif
    15501754    for (; iBits < rpcSlice->getPPS()->getNumExtraSliceHeaderBits(); iBits++)
    15511755    {
     
    17341938            Int pocLTCurr = rpcSlice->getPOC() - deltaPocMSBCycleLT * maxPicOrderCntLSB
    17351939                                        - iPOClsb + pocLsbLt;
    1736 
    17371940            rps->setPOC     (j, pocLTCurr);
    17381941            rps->setDeltaPOC(j, - rpcSlice->getPOC() + pocLTCurr);
     
    18372040        else
    18382041        {
     2042#if O0225_TID_BASED_IL_RPS_DERIV && TSLAYERS_IL_RPS
     2043          if( (rpcSlice->getVPS()->getMaxTidIlRefPicsPlus1(0,rpcSlice->getLayerId()) >  rpcSlice->getTLayer()) &&
     2044             (rpcSlice->getVPS()->getMaxTSLayersMinus1(0) >=  rpcSlice->getTLayer()) )
     2045        {
     2046#endif
    18392047          rpcSlice->setActiveNumILRRefIdx(1);
    18402048          rpcSlice->setInterLayerPredLayerIdc(0,0);
     2049#if O0225_TID_BASED_IL_RPS_DERIV && TSLAYERS_IL_RPS
     2050        }
     2051#endif
    18412052        }
    18422053      }
     
    18442055#if ILP_SSH_SIG
    18452056#if ILP_SSH_SIG_FIX
    1846     else if( rpcSlice->getVPS()->getIlpSshSignalingEnabledFlag() == true )
     2057    else if( rpcSlice->getVPS()->getIlpSshSignalingEnabledFlag() == true &&  (rpcSlice->getLayerId() > 0 ))
    18472058#else
    18482059    else if( rpcSlice->getVPS()->getIlpSshSignalingEnabledFlag() == false )
     
    18502061    {
    18512062      rpcSlice->setInterLayerPredEnabledFlag(true);
     2063
     2064#if O0225_TID_BASED_IL_RPS_DERIV && TSLAYERS_IL_RPS
     2065      Int   numRefLayerPics = 0;
     2066      Int   i = 0;
     2067      Int   refLayerPicIdc  [MAX_VPS_LAYER_ID_PLUS1];
     2068      for(i = 0, numRefLayerPics = 0;  i < rpcSlice->getNumILRRefIdx(); i++ )
     2069      {
     2070        if(rpcSlice->getVPS()->getMaxTidIlRefPicsPlus1(rpcSlice->getVPS()->getLayerIdInVps(i),rpcSlice->getLayerId()) >  rpcSlice->getTLayer() &&
     2071           (rpcSlice->getVPS()->getMaxTSLayersMinus1(rpcSlice->getVPS()->getLayerIdInVps(i)) >=  rpcSlice->getTLayer()) )
     2072        {         
     2073          refLayerPicIdc[ numRefLayerPics++ ] = i;
     2074        }
     2075      }
     2076      rpcSlice->setActiveNumILRRefIdx(numRefLayerPics);
     2077      for( i = 0; i < rpcSlice->getActiveNumILRRefIdx(); i++ )
     2078      {
     2079        rpcSlice->setInterLayerPredLayerIdc(refLayerPicIdc[i],i);
     2080      }     
     2081#else
    18522082      rpcSlice->setActiveNumILRRefIdx(rpcSlice->getNumILRRefIdx());
    18532083      for( Int i = 0; i < rpcSlice->getActiveNumILRRefIdx(); i++ )
     
    18552085        rpcSlice->setInterLayerPredLayerIdc(i,i);
    18562086      }
     2087#endif
    18572088    }
    18582089#endif
     
    18792110      ChromaFormat format;
    18802111#if REPN_FORMAT_IN_VPS
     2112#if O0096_REP_FORMAT_INDEX
     2113      if( sps->getLayerId() == 0 )
     2114      {
     2115        format = sps->getChromaFormatIdc();
     2116      }
     2117      else
     2118      {
     2119        format = rpcSlice->getVPS()->getVpsRepFormat( sps->getUpdateRepFormatFlag() ? sps->getUpdateRepFormatIndex() : rpcSlice->getVPS()->getVpsRepFormatIdx(sps->getLayerId()) )->getChromaFormatVpsIdc();
     2120      }
     2121#else
    18812122      if( ( sps->getLayerId() == 0 ) || sps->getUpdateRepFormatFlag() )
    18822123      {
     
    18872128        format = rpcSlice->getVPS()->getVpsRepFormat( rpcSlice->getVPS()->getVpsRepFormatIdx(sps->getLayerId()) )->getChromaFormatVpsIdc();
    18882129      }
     2130#endif
    18892131#else
    18902132      format = sps->getChromaFormatIdc();
     
    20392281#if M0457_COL_PICTURE_SIGNALING
    20402282#if REMOVE_COL_PICTURE_SIGNALING
    2041       rpcSlice->setMFMEnabledFlag( rpcSlice->getNumMotionPredRefLayers() > 0 ? true : false );
     2283      rpcSlice->setMFMEnabledFlag( ( rpcSlice->getNumMotionPredRefLayers() > 0 && rpcSlice->getActiveNumILRRefIdx() ) ? true : false );
    20422284#else
    20432285      rpcSlice->setMFMEnabledFlag( false );
     
    26332875  UInt  code, sizeId, listId;
    26342876  Bool scalingListPredModeFlag;
    2635 
    26362877  //for each size
    26372878  for(sizeId = 0; sizeId < SCALING_LIST_SIZE_NUM; sizeId++)
     
    26392880    for(listId = 0; listId <  g_scalingListNum[sizeId]; listId++)
    26402881    {
    2641 #if IL_SL_SIGNALLING_N0371
    2642       if ( scalingList->getLayerId() > 0 && scalingList->getPredScalingListFlag() )
    2643       {
    2644         READ_FLAG( code, "scaling_list_pred_mode_flag");
    2645         scalingListPredModeFlag = (code) ? true : false;
    2646         if(!scalingListPredModeFlag) //Copy Mode
    2647         {
    2648           READ_UVLC( code, "scaling_list_pred_matrix_id_delta");
    2649           scalingList->setRefMatrixId (sizeId,listId,(UInt)((Int)(listId)-(code)));
    2650           if( sizeId > SCALING_LIST_8x8 )
    2651           {
    2652             scalingList->setScalingListDC(sizeId,listId,((listId == scalingList->getRefMatrixId (sizeId,listId))? 16 :scalingList->getScalingListDC(sizeId, scalingList->getRefMatrixId (sizeId,listId))));
    2653           }
    2654           scalingList->processRefMatrix( sizeId, listId, scalingList->getRefMatrixId (sizeId,listId));
    2655 
    2656         }
    2657         else //DPCM Mode
    2658         {
    2659           xDecodeScalingList(scalingList, sizeId, listId);
    2660         }
    2661       }
    2662       else
    2663       {
    2664         READ_FLAG( code, "scaling_list_pred_mode_flag");
    2665         scalingListPredModeFlag = (code) ? true : false;
    2666         if(!scalingListPredModeFlag) //Copy Mode
    2667         {
    2668           READ_UVLC( code, "scaling_list_pred_matrix_id_delta");
    2669           scalingList->setRefMatrixId (sizeId,listId,(UInt)((Int)(listId)-(code)));
    2670           if( sizeId > SCALING_LIST_8x8 )
    2671           {
    2672             scalingList->setScalingListDC(sizeId,listId,((listId == scalingList->getRefMatrixId (sizeId,listId))? 16 :scalingList->getScalingListDC(sizeId, scalingList->getRefMatrixId (sizeId,listId))));
    2673           }
    2674           scalingList->processRefMatrix( sizeId, listId, scalingList->getRefMatrixId (sizeId,listId));
    2675 
    2676         }
    2677         else //DPCM Mode
    2678         {
    2679           xDecodeScalingList(scalingList, sizeId, listId);
    2680         }
    2681       }
    2682 #else
    26832882      READ_FLAG( code, "scaling_list_pred_mode_flag");
    26842883      scalingListPredModeFlag = (code) ? true : false;
     
    26982897        xDecodeScalingList(scalingList, sizeId, listId);
    26992898      }
    2700 #endif
    27012899    }
    27022900  }
     
    27202918  if( sizeId > SCALING_LIST_8x8 )
    27212919  {
    2722 #if IL_SL_SIGNALLING_N0371
    2723     if( scalingList->getLayerId() > 0 && scalingList->getPredScalingListFlag() )
    2724     {
    2725       ref_scalingListDC[scalingList->getLayerId()][sizeId][listId] = scalingList->getScalingListDC(sizeId,listId);
    2726       scalingList->setScalingListDC(sizeId,listId,ref_scalingListDC[scalingList->getScalingListRefLayerId()][sizeId][listId]);
    2727     }
    2728     else
    2729     {
    2730       READ_SVLC( scalingListDcCoefMinus8, "scaling_list_dc_coef_minus8");
    2731       scalingList->setScalingListDC(sizeId,listId,scalingListDcCoefMinus8 + 8);
    2732       nextCoef = scalingList->getScalingListDC(sizeId,listId);
    2733       ref_scalingListDC[scalingList->getLayerId()][sizeId][listId] = scalingList->getScalingListDC(sizeId,listId);
    2734     }
    2735 #else
    27362920    READ_SVLC( scalingListDcCoefMinus8, "scaling_list_dc_coef_minus8");
    27372921    scalingList->setScalingListDC(sizeId,listId,scalingListDcCoefMinus8 + 8);
    27382922    nextCoef = scalingList->getScalingListDC(sizeId,listId);
    2739 #endif
    27402923  }
    27412924
    27422925  for(i = 0; i < coefNum; i++)
    27432926  {
    2744 #if IL_SL_SIGNALLING_N0371
    2745     if( scalingList->getLayerId() > 0 && scalingList->getPredScalingListFlag() )
    2746     {
    2747       ref_scalingListCoef[scalingList->getLayerId()][sizeId][listId][i] = dst[scan[i]];
    2748       dst[scan[i]] = ref_scalingListCoef[scalingList->getScalingListRefLayerId()][sizeId][listId][i];
    2749     }
    2750     else
    2751     {
    2752       READ_SVLC( data, "scaling_list_delta_coef");
    2753       nextCoef = (nextCoef + data + 256 ) % 256;
    2754       dst[scan[i]] = nextCoef;
    2755       ref_scalingListCoef[scalingList->getLayerId()][sizeId][listId][i] = dst[scan[i]];
    2756     }
    2757 #else
    27582927    READ_SVLC( data, "scaling_list_delta_coef");
    27592928    nextCoef = (nextCoef + data + 256 ) % 256;
    27602929    dst[scan[i]] = nextCoef;
    2761 #endif
    27622930  }
    27632931}
     
    27912959  return (cnt>0);
    27922960}
     2961
    27932962//! \}
    27942963
  • trunk/source/Lib/TLibDecoder/TDecCu.cpp

    r494 r540  
    317317  }
    318318 
     319#if HIGHER_LAYER_IRAP_SKIP_FLAG
     320  if (pcCU->getSlice()->getVPS()->getHigherLayerIrapSkipFlag() && pcCU->getSlice()->getVPS()->getSingleLayerForNonIrapFlag() && pcCU->getLayerId() > 0)
     321  {
     322    Bool lowerLayerExist = false;
     323    for(int i=0;i<pcCU->getLayerId();i++)
     324    {
     325      if(pcCU->getSlice()->getBaseColPic(pcCU->getSlice()->getInterLayerPredLayerIdc(i)))
     326      {
     327        lowerLayerExist = true;
     328      }
     329    }
     330    if(lowerLayerExist)
     331    {
     332      assert(pcCU->isSkipped(uiAbsPartIdx));
     333    }
     334  }
     335#endif
     336 
    319337  if( pcCU->isSkipped(uiAbsPartIdx) )
    320338  {
     
    945963
    946964}
     965
    947966//! \}
  • trunk/source/Lib/TLibDecoder/TDecEntropy.h

    r494 r540  
    106106  virtual Void parseCoeffNxN( TComDataCU* pcCU, TCoeff* pcCoef, UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight, UInt uiDepth, TextType eTType ) = 0;
    107107  virtual Void parseTransformSkipFlags ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt width, UInt height, UInt uiDepth, TextType eTType) = 0;
    108 
    109108  virtual Void updateContextTables( SliceType eSliceType, Int iQp ) = 0;
    110109 
     
    166165  Void updateContextTables    ( SliceType eSliceType, Int iQp ) { m_pcEntropyDecoderIf->updateContextTables( eSliceType, iQp ); }
    167166 
     167 
    168168private:
    169169  Void xDecodeTransform        ( TComDataCU* pcCU, UInt offsetLuma, UInt offsetChroma, UInt uiAbsPartIdx, UInt uiDepth, UInt width, UInt height, UInt uiTrIdx, Bool& bCodeDQP );
  • trunk/source/Lib/TLibDecoder/TDecGop.cpp

    r442 r540  
    128128  //-- For time output for each slice
    129129  long iBeforeTime = clock();
    130  
     130#if !HM_CLEANUP_SAO
    131131  UInt uiStartCUAddr   = pcSlice->getSliceSegmentCurStartCUAddr();
    132132
     
    136136    m_sliceStartCUAddress.push_back(uiSliceStartCuAddr);
    137137  }
    138 
     138#endif
    139139  m_pcSbacDecoder->init( (TDecBinIf*)m_pcBinCABAC );
    140140  m_pcEntropyDecoder->setEntropyDecoder (m_pcSbacDecoder);
     
    163163  m_pcEntropyDecoder->setBitstream      ( ppcSubstreams[0] );
    164164  m_pcEntropyDecoder->resetEntropy      (pcSlice);
    165 
     165#if !HM_CLEANUP_SAO
    166166  if(uiSliceStartCuAddr == uiStartCUAddr)
    167167  {
    168168    m_LFCrossSliceBoundaryFlag.push_back( pcSlice->getLFCrossSliceBoundaryFlag());
    169169  }
     170#endif
    170171  m_pcSbacDecoders[0].load(m_pcSbacDecoder);
    171172  m_pcSliceDecoder->decompressSlice( ppcSubstreams, rpcPic, m_pcSbacDecoder, m_pcSbacDecoders);
     
    195196  m_pcLoopFilter->setCfg(bLFCrossTileBoundary);
    196197  m_pcLoopFilter->loopFilterPic( rpcPic );
    197 
     198#if !HM_CLEANUP_SAO
    198199  if(pcSlice->getSPS()->getUseSAO())
    199200  {
     
    201202    rpcPic->createNonDBFilterInfo(m_sliceStartCUAddress, 0, &m_LFCrossSliceBoundaryFlag, rpcPic->getPicSym()->getNumTiles(), bLFCrossTileBoundary);
    202203  }
    203 
     204#endif
    204205  if( pcSlice->getSPS()->getUseSAO() )
    205206  {
     207#if HM_CLEANUP_SAO
     208    m_pcSAO->reconstructBlkSAOParams(rpcPic, rpcPic->getPicSym()->getSAOBlkParam());
     209    m_pcSAO->SAOProcess(rpcPic);
     210    m_pcSAO->PCMLFDisableProcess(rpcPic);
     211#else
    206212    {
    207213      SAOParam *saoParam = rpcPic->getPicSym()->getSaoParam();
     
    214220      m_pcSAO->destroyPicSaoInfo();
    215221    }
    216   }
    217 
     222#endif
     223  }
     224#if !HM_CLEANUP_SAO
    218225  if(pcSlice->getSPS()->getUseSAO())
    219226  {
    220227    rpcPic->destroyNonDBFilterInfo();
    221228  }
    222 
     229#endif
    223230  rpcPic->compressMotion();
    224231  Char c = (pcSlice->isIntra() ? 'I' : pcSlice->isInterP() ? 'P' : 'B');
     
    283290  rpcPic->setOutputMark(true);
    284291  rpcPic->setReconMark(true);
     292#if !HM_CLEANUP_SAO
    285293  m_sliceStartCUAddress.clear();
    286294  m_LFCrossSliceBoundaryFlag.clear();
     295#endif
    287296}
    288297
  • trunk/source/Lib/TLibDecoder/TDecGop.h

    r313 r540  
    8383  Int                   m_decodedPictureHashSEIEnabled;  ///< Checksum(3)/CRC(2)/MD5(1)/disable(0) acting on decoded picture hash SEI message
    8484
     85#if !HM_CLEANUP_SAO
    8586  //! list that contains the CU address of each slice plus the end address
    8687  std::vector<Int> m_sliceStartCUAddress;
    8788  std::vector<Bool> m_LFCrossSliceBoundaryFlag;
    88 
     89#endif
    8990#if SVC_EXTENSION
    9091  UInt                  m_layerId;
  • trunk/source/Lib/TLibDecoder/TDecSbac.cpp

    r494 r540  
    368368#if AUXILIARY_PICTURES
    369369        if (format == CHROMA_400)
     370        {
    370371          uiSample = uiGrayVal;
     372        }
    371373        else
    372374#endif
     
    389391#if AUXILIARY_PICTURES
    390392        if (format == CHROMA_400)
     393        {
    391394          uiSample = uiGrayVal;
     395        }
    392396        else
    393397#endif
     
    13781382    if (uiCode == 0)
    13791383    {
     1384#if HM_CLEANUP_SAO
     1385      ruiVal = 1;
     1386#else
    13801387      ruiVal = 5;
     1388#endif
    13811389    }
    13821390    else
    13831391    {
     1392#if HM_CLEANUP_SAO
     1393      ruiVal = 2;
     1394#else
    13841395      ruiVal = 1;
    1385     }
    1386   }
    1387 }
     1396#endif
     1397    }
     1398  }
     1399}
     1400
     1401#if HM_CLEANUP_SAO
     1402
     1403Void TDecSbac::parseSaoSign(UInt& val)
     1404{
     1405  m_pcTDecBinIf->decodeBinEP ( val );
     1406}
     1407
     1408Void TDecSbac::parseSAOBlkParam (SAOBlkParam& saoBlkParam
     1409                                , Bool* sliceEnabled
     1410                                , Bool leftMergeAvail
     1411                                , Bool aboveMergeAvail
     1412                                )
     1413{
     1414  UInt uiSymbol;
     1415
     1416  Bool isLeftMerge = false;
     1417  Bool isAboveMerge= false;
     1418
     1419  if(leftMergeAvail)
     1420  {
     1421    parseSaoMerge(uiSymbol); //sao_merge_left_flag
     1422    isLeftMerge = (uiSymbol?true:false);
     1423  }
     1424
     1425  if( aboveMergeAvail && !isLeftMerge)
     1426  {
     1427    parseSaoMerge(uiSymbol); //sao_merge_up_flag
     1428    isAboveMerge = (uiSymbol?true:false);
     1429  }
     1430
     1431  if(isLeftMerge || isAboveMerge) //merge mode
     1432  {
     1433    saoBlkParam[SAO_Y].modeIdc = saoBlkParam[SAO_Cb].modeIdc = saoBlkParam[SAO_Cr].modeIdc = SAO_MODE_MERGE;
     1434    saoBlkParam[SAO_Y].typeIdc = saoBlkParam[SAO_Cb].typeIdc = saoBlkParam[SAO_Cr].typeIdc = (isLeftMerge)?SAO_MERGE_LEFT:SAO_MERGE_ABOVE;
     1435  }
     1436  else //new or off mode
     1437  {   
     1438    for(Int compIdx=0; compIdx < NUM_SAO_COMPONENTS; compIdx++)
     1439    {
     1440      SAOOffset& ctbParam = saoBlkParam[compIdx];
     1441
     1442      if(!sliceEnabled[compIdx])
     1443      {
     1444        //off
     1445        ctbParam.modeIdc = SAO_MODE_OFF;
     1446        continue;
     1447      }
     1448
     1449      //type
     1450      if(compIdx == SAO_Y || compIdx == SAO_Cb)
     1451      {
     1452        parseSaoTypeIdx(uiSymbol); //sao_type_idx_luma or sao_type_idx_chroma
     1453
     1454        assert(uiSymbol ==0 || uiSymbol ==1 || uiSymbol ==2);
     1455
     1456        if(uiSymbol ==0) //OFF
     1457        {
     1458          ctbParam.modeIdc = SAO_MODE_OFF;
     1459        }
     1460        else if(uiSymbol == 1) //BO
     1461        {
     1462          ctbParam.modeIdc = SAO_MODE_NEW;
     1463          ctbParam.typeIdc = SAO_TYPE_START_BO;
     1464        }
     1465        else //2, EO
     1466        {
     1467          ctbParam.modeIdc = SAO_MODE_NEW;
     1468          ctbParam.typeIdc = SAO_TYPE_START_EO;
     1469        }
     1470
     1471      }
     1472      else //Cr, follow Cb SAO type
     1473      {
     1474        ctbParam.modeIdc = saoBlkParam[SAO_Cb].modeIdc;
     1475        ctbParam.typeIdc = saoBlkParam[SAO_Cb].typeIdc;
     1476      }
     1477
     1478      if(ctbParam.modeIdc == SAO_MODE_NEW)
     1479      {
     1480        Int offset[4];
     1481        for(Int i=0; i< 4; i++)
     1482        {
     1483          parseSaoMaxUvlc(uiSymbol,  g_saoMaxOffsetQVal[compIdx] ); //sao_offset_abs
     1484          offset[i] = (Int)uiSymbol;
     1485        }
     1486
     1487        if(ctbParam.typeIdc == SAO_TYPE_START_BO)
     1488        {
     1489          for(Int i=0; i< 4; i++)
     1490          {
     1491            if(offset[i] != 0)
     1492            {
     1493              parseSaoSign(uiSymbol); //sao_offset_sign
     1494              if(uiSymbol)
     1495              {
     1496                offset[i] = -offset[i];
     1497              }
     1498            }
     1499          }
     1500          parseSaoUflc(NUM_SAO_BO_CLASSES_LOG2, uiSymbol ); //sao_band_position
     1501          ctbParam.typeAuxInfo = uiSymbol;
     1502       
     1503          for(Int i=0; i<4; i++)
     1504          {
     1505            ctbParam.offset[(ctbParam.typeAuxInfo+i)%MAX_NUM_SAO_CLASSES] = offset[i];
     1506          }     
     1507       
     1508        }
     1509        else //EO
     1510        {
     1511          ctbParam.typeAuxInfo = 0;
     1512
     1513          if(compIdx == SAO_Y || compIdx == SAO_Cb)
     1514          {
     1515            parseSaoUflc(NUM_SAO_EO_TYPES_LOG2, uiSymbol ); //sao_eo_class_luma or sao_eo_class_chroma
     1516            ctbParam.typeIdc += uiSymbol;
     1517          }
     1518          else
     1519          {
     1520            ctbParam.typeIdc = saoBlkParam[SAO_Cb].typeIdc;
     1521          }
     1522          ctbParam.offset[SAO_CLASS_EO_FULL_VALLEY] = offset[0];
     1523          ctbParam.offset[SAO_CLASS_EO_HALF_VALLEY] = offset[1];
     1524          ctbParam.offset[SAO_CLASS_EO_PLAIN      ] = 0;
     1525          ctbParam.offset[SAO_CLASS_EO_HALF_PEAK  ] = -offset[2];
     1526          ctbParam.offset[SAO_CLASS_EO_FULL_PEAK  ] = -offset[3];
     1527        }
     1528      }
     1529    }
     1530  }
     1531}
     1532
     1533#else
    13881534
    13891535inline Void copySaoOneLcuParam(SaoLcuParam* psDst,  SaoLcuParam* psSrc)
     
    15591705}
    15601706
     1707#endif
     1708
    15611709/**
    15621710 - Initialize our contexts from the nominated source.
  • trunk/source/Lib/TLibDecoder/TDecSbac.h

    r494 r540  
    9090  Void  parseSaoTypeIdx           ( UInt&  ruiVal  );
    9191  Void  parseSaoUflc              ( UInt uiLength, UInt& ruiVal     );
     92#if HM_CLEANUP_SAO
     93  Void parseSAOBlkParam (SAOBlkParam& saoBlkParam, Bool* sliceEnabled, Bool leftMergeAvail, Bool aboveMergeAvail);
     94  Void parseSaoSign(UInt& val);
     95#else
    9296  Void  parseSaoOneLcuInterleaving(Int rx, Int ry, SAOParam* pSaoParam, TComDataCU* pcCU, Int iCUAddrInSlice, Int iCUAddrUpInSlice, Int allowMergeLeft, Int allowMergeUp);
    9397  Void  parseSaoOffset            (SaoLcuParam* psSaoLcuParam, UInt compIdx);
     98#endif
    9499private:
    95100  Void  xReadUnarySymbol    ( UInt& ruiSymbol, ContextModel* pcSCModel, Int iOffset );
  • trunk/source/Lib/TLibDecoder/TDecSlice.cpp

    r345 r540  
    197197  UInt uiTileLCUX;
    198198  Int iNumSubstreamsPerTile = 1; // if independent.
    199 
    200199  Bool depSliceSegmentsEnabled = rpcPic->getSlice(rpcPic->getCurrSliceIdx())->getPPS()->getDependentSliceSegmentsEnabledFlag();
    201200  uiTileStartLCU = rpcPic->getPicSym()->getTComTile(rpcPic->getPicSym()->getTileIdxMap(iStartCUAddr))->getFirstCUAddr();
     
    323322    g_bJustDoIt = g_bEncDecTraceEnable;
    324323#endif
     324
     325#if HM_CLEANUP_SAO
     326    if ( pcSlice->getSPS()->getUseSAO() )
     327    {
     328      SAOBlkParam& saoblkParam = (rpcPic->getPicSym()->getSAOBlkParam())[iCUAddr];
     329      if (pcSlice->getSaoEnabledFlag()||pcSlice->getSaoEnabledFlagChroma())
     330      {
     331        Bool sliceEnabled[NUM_SAO_COMPONENTS];
     332        sliceEnabled[SAO_Y] = pcSlice->getSaoEnabledFlag();
     333        sliceEnabled[SAO_Cb]= sliceEnabled[SAO_Cr]= pcSlice->getSaoEnabledFlagChroma();
     334
     335        Bool leftMergeAvail = false;
     336        Bool aboveMergeAvail= false;
     337
     338        //merge left condition
     339        Int rx = (iCUAddr % uiWidthInLCUs);
     340        if(rx > 0)
     341        {
     342          leftMergeAvail = rpcPic->getSAOMergeAvailability(iCUAddr, iCUAddr-1);
     343        }
     344        //merge up condition
     345        Int ry = (iCUAddr / uiWidthInLCUs);
     346        if(ry > 0)
     347        {
     348          aboveMergeAvail = rpcPic->getSAOMergeAvailability(iCUAddr, iCUAddr-uiWidthInLCUs);
     349        }
     350
     351        pcSbacDecoder->parseSAOBlkParam( saoblkParam, sliceEnabled, leftMergeAvail, aboveMergeAvail);
     352      }
     353      else
     354      {
     355        saoblkParam[SAO_Y ].modeIdc = SAO_MODE_OFF;
     356        saoblkParam[SAO_Cb].modeIdc = SAO_MODE_OFF;
     357        saoblkParam[SAO_Cr].modeIdc = SAO_MODE_OFF;
     358      }
     359    }
     360#else
    325361    if ( pcSlice->getSPS()->getUseSAO() && (pcSlice->getSaoEnabledFlag()||pcSlice->getSaoEnabledFlagChroma()) )
    326362    {
     
    374410      }
    375411    }
     412#endif
     413
    376414    m_pcCuDecoder->decodeCU     ( pcCU, uiIsLast );
    377415    m_pcCuDecoder->decompressCU ( pcCU );
  • trunk/source/Lib/TLibDecoder/TDecTop.cpp

    r494 r540  
    7979  m_prevSliceSkipped = false;
    8080  m_skippedPOC = 0;
     81#if NO_CLRAS_OUTPUT_FLAG
     82  m_noClrasOutputFlag          = false;
     83  m_layerInitializedFlag       = false;
     84  m_firstPicInLayerDecodedFlag = false;
     85  m_noOutputOfPriorPicsFlags   = false;
     86  m_bRefreshPending            = false;
     87#endif
    8188}
    8289
     
    170177    for( Int temporalLayer=0; temporalLayer < MAX_TLAYER; temporalLayer++)
    171178    {
     179#if USE_DPB_SIZE_TABLE
     180      if( getCommonDecoderParams()->getOutputLayerSetIdx() == 0 )
     181      {
     182        assert( this->getLayerId() == 0 );
     183        numReorderPics[temporalLayer] = pcSPS->getNumReorderPics(temporalLayer);
     184      }
     185      else
     186      {
     187        TComVPS *vps = slice->getVPS();
     188        // SHM decoders will use DPB size table in the VPS to determine the number of reorder pictures.
     189        numReorderPics[temporalLayer] = vps->getMaxVpsNumReorderPics( getCommonDecoderParams()->getOutputLayerSetIdx() , temporalLayer);
     190      }
     191#else
    172192      numReorderPics[temporalLayer] = pcSPS->getNumReorderPics(temporalLayer);
     193#endif
    173194    }
    174195
     
    260281  for( Int temporalLayer=0; temporalLayer < MAX_TLAYER; temporalLayer++)
    261282  {
     283#if USE_DPB_SIZE_TABLE
     284    if( getCommonDecoderParams()->getOutputLayerSetIdx() == 0 )
     285    {
     286      assert( this->getLayerId() == 0 );
     287      numReorderPics[temporalLayer] = pcSlice->getSPS()->getNumReorderPics(temporalLayer);
     288    }
     289    else
     290    {
     291      TComVPS *vps = pcSlice->getVPS();
     292      // SHM decoders will use DPB size table in the VPS to determine the number of reorder pictures.
     293      numReorderPics[temporalLayer] = vps->getMaxVpsNumReorderPics( getCommonDecoderParams()->getOutputLayerSetIdx() , temporalLayer);
     294    }
     295#else
    262296    numReorderPics[temporalLayer] = pcSlice->getSPS()->getNumReorderPics(temporalLayer);
    263   }
    264 
     297#endif
     298  }
     299
     300#if USE_DPB_SIZE_TABLE
     301  if( getCommonDecoderParams()->getOutputLayerSetIdx() == 0 )
     302  {
     303    assert( this->getLayerId() == 0 );
     304    m_iMaxRefPicNum = pcSlice->getSPS()->getMaxDecPicBuffering(pcSlice->getTLayer());     // m_uiMaxDecPicBuffering has the space for the picture currently being decoded
     305  }
     306  else
     307  {
     308    m_iMaxRefPicNum = pcSlice->getVPS()->getMaxVpsDecPicBufferingMinus1( getCommonDecoderParams()->getOutputLayerSetIdx(), pcSlice->getLayerId(), pcSlice->getTLayer() ) + 1; // m_uiMaxDecPicBuffering has the space for the picture currently being decoded
     309  }
     310#else
    265311  m_iMaxRefPicNum = pcSlice->getSPS()->getMaxDecPicBuffering(pcSlice->getTLayer());     // m_uiMaxDecPicBuffering has the space for the picture currently being decoded
     312#endif
    266313
    267314#if SVC_EXTENSION
     
    278325      for(UInt i = 0; i < pcSlice->getVPS()->getNumDirectRefLayers( m_layerId ); i++ )
    279326      {
     327#if O0098_SCALED_REF_LAYER_ID
     328        const Window scalEL = pcSlice->getSPS()->getScaledRefLayerWindowForLayer(pcSlice->getVPS()->getRefLayerId(m_layerId, i));
     329#else
    280330        const Window scalEL = pcSlice->getSPS()->getScaledRefLayerWindow(i);
     331#endif
    281332        Bool zeroOffsets = ( scalEL.getWindowLeftOffset() == 0 && scalEL.getWindowRightOffset() == 0 && scalEL.getWindowTopOffset() == 0 && scalEL.getWindowBottomOffset() == 0 );
    282333
     
    344395#endif
    345396#endif
    346 
     397#if !HM_CLEANUP_SAO
    347398    rpcPic->getPicSym()->allocSaoParam(&m_cSAO);
     399#endif
    348400    m_cListPic.pushBack( rpcPic );
    349401   
     
    425477#endif
    426478#endif
     479#if !HM_CLEANUP_SAO
    427480  rpcPic->getPicSym()->allocSaoParam(&m_cSAO);
     481#endif
    428482}
    429483
     
    531585  printf("\ninserting lost poc : %d\n",iLostPoc);
    532586  TComSlice cFillSlice;
    533 #if SVC_EXTENSION
    534   cFillSlice.setSPS( m_parameterSetManagerDecoder[m_layerId].getFirstSPS() );
    535   cFillSlice.setPPS( m_parameterSetManagerDecoder[m_layerId].getFirstPPS() );
    536   cFillSlice.setVPS( m_parameterSetManagerDecoder[m_layerId].getFirstVPS() );
    537   cFillSlice.initSlice( m_layerId );
    538 #else
    539587  cFillSlice.setSPS( m_parameterSetManagerDecoder.getFirstSPS() );
    540588  cFillSlice.setPPS( m_parameterSetManagerDecoder.getFirstPPS() );
     589#if SVC_EXTENSION
     590  cFillSlice.setVPS( m_parameterSetManagerDecoder.getFirstVPS() );
     591  cFillSlice.initSlice( m_layerId );
     592#else
    541593  cFillSlice.initSlice();
    542594#endif
    543595  TComPic *cFillPic;
    544596  xGetNewPicBuffer(&cFillSlice,cFillPic);
    545 #if SVC_EXTENSION
    546   cFillPic->getSlice(0)->setSPS( m_parameterSetManagerDecoder[m_layerId].getFirstSPS() );
    547   cFillPic->getSlice(0)->setPPS( m_parameterSetManagerDecoder[m_layerId].getFirstPPS() );
    548   cFillPic->getSlice(0)->setVPS( m_parameterSetManagerDecoder[m_layerId].getFirstVPS() );
    549   cFillPic->getSlice(0)->initSlice( m_layerId );
    550 #else
    551597  cFillPic->getSlice(0)->setSPS( m_parameterSetManagerDecoder.getFirstSPS() );
    552598  cFillPic->getSlice(0)->setPPS( m_parameterSetManagerDecoder.getFirstPPS() );
     599#if SVC_EXTENSION
     600  cFillPic->getSlice(0)->setVPS( m_parameterSetManagerDecoder.getFirstVPS() );
     601  cFillPic->getSlice(0)->initSlice( m_layerId );
     602#else
    553603  cFillPic->getSlice(0)->initSlice();
    554604#endif
     
    593643Void TDecTop::xActivateParameterSets()
    594644{
    595 #if SVC_EXTENSION
    596   m_parameterSetManagerDecoder[m_layerId].applyPrefetchedPS();
    597  
    598   TComPPS *pps = m_parameterSetManagerDecoder[m_layerId].getPPS(m_apcSlicePilot->getPPSId());
    599   assert (pps != 0);
    600 
    601   TComSPS *sps = m_parameterSetManagerDecoder[m_layerId].getSPS(pps->getSPSId());
    602   assert (sps != 0);
    603 
    604   if( false == m_parameterSetManagerDecoder[m_layerId].activatePPS(m_apcSlicePilot->getPPSId(), m_apcSlicePilot->isIRAP()) )
    605 #else
    606645  m_parameterSetManagerDecoder.applyPrefetchedPS();
    607646 
     
    613652
    614653  if (false == m_parameterSetManagerDecoder.activatePPS(m_apcSlicePilot->getPPSId(),m_apcSlicePilot->isIRAP()))
    615 #endif
    616654  {
    617655    printf ("Parameter set activation failed!");
    618656    assert (0);
    619657  }
     658
     659#if SCALINGLIST_INFERRING
     660  // scaling list settings and checks
     661  TComVPS *activeVPS = m_parameterSetManagerDecoder.getActiveVPS();
     662  TComSPS *activeSPS = m_parameterSetManagerDecoder.getActiveSPS();
     663  TComPPS *activePPS = m_parameterSetManagerDecoder.getActivePPS();
     664
     665  if( activeSPS->getInferScalingListFlag() )
     666  {
     667    UInt refLayerId = activeSPS->getScalingListRefLayerId();
     668    TComSPS *refSps = m_ppcTDecTop[refLayerId]->getParameterSetManager()->getActiveSPS(); assert( refSps != NULL );
     669
     670    // When avc_base_layer_flag is equal to 1, it is a requirement of bitstream conformance that the value of sps_scaling_list_ref_layer_id shall be greater than 0
     671    if( activeVPS->getAvcBaseLayerFlag() )
     672    {
     673      assert( refLayerId > 0 );
     674    }
     675
     676    // It is a requirement of bitstream conformance that, when an SPS with nuh_layer_id equal to nuhLayerIdA is active for a layer with nuh_layer_id equal to nuhLayerIdB and
     677    // sps_infer_scaling_list_flag in the SPS is equal to 1, sps_infer_scaling_list_flag shall be equal to 0 for the SPS that is active for the layer with nuh_layer_id equal to sps_scaling_list_ref_layer_id
     678    assert( refSps->getInferScalingListFlag() == false );
     679
     680    // It is a requirement of bitstream conformance that, when an SPS with nuh_layer_id equal to nuhLayerIdA is active for a layer with nuh_layer_id equal to nuhLayerIdB,
     681    // the layer with nuh_layer_id equal to sps_scaling_list_ref_layer_id shall be a direct or indirect reference layer of the layer with nuh_layer_id equal to nuhLayerIdB
     682    assert( activeVPS->getRecursiveRefLayerFlag( activeSPS->getLayerId(), refLayerId ) == true );
     683   
     684    if( activeSPS->getScalingList() != refSps->getScalingList() )
     685    {
     686      // delete created instance of scaling list since it will be inferred
     687      delete activeSPS->getScalingList();
     688
     689      // infer scaling list
     690      activeSPS->setScalingList( refSps->getScalingList() );
     691    }
     692  }
     693
     694  if( activePPS->getInferScalingListFlag() )
     695  {
     696    UInt refLayerId = activePPS->getScalingListRefLayerId();
     697    TComPPS *refPps = m_ppcTDecTop[refLayerId]->getParameterSetManager()->getActivePPS(); assert( refPps != NULL );
     698
     699    // When avc_base_layer_flag is equal to 1, it is a requirement of bitstream conformance that the value of sps_scaling_list_ref_layer_id shall be greater than 0
     700    if( activeVPS->getAvcBaseLayerFlag() )
     701    {
     702      assert( refLayerId > 0 );
     703    }
     704
     705    // It is a requirement of bitstream conformance that, when an PPS with nuh_layer_id equal to nuhLayerIdA is active for a layer with nuh_layer_id equal to nuhLayerIdB and
     706    // pps_infer_scaling_list_flag in the PPS is equal to 1, pps_infer_scaling_list_flag shall be equal to 0 for the PPS that is active for the layer with nuh_layer_id equal to pps_scaling_list_ref_layer_id
     707    assert( refPps->getInferScalingListFlag() == false );
     708
     709    // It is a requirement of bitstream conformance that, when an PPS with nuh_layer_id equal to nuhLayerIdA is active for a layer with nuh_layer_id equal to nuhLayerIdB,
     710    // the layer with nuh_layer_id equal to pps_scaling_list_ref_layer_id shall be a direct or indirect reference layer of the layer with nuh_layer_id equal to nuhLayerIdB
     711    assert( activeVPS->getRecursiveRefLayerFlag( activePPS->getLayerId(), refLayerId ) == true );
     712   
     713    if( activePPS->getScalingList() != refPps->getScalingList() )
     714    {
     715      // delete created instance of scaling list since it will be inferred
     716      delete activePPS->getScalingList();
     717
     718      // infer scaling list
     719      activePPS->setScalingList( refPps->getScalingList() );
     720    }
     721
     722  }
     723#endif
    620724
    621725  if( pps->getDependentSliceSegmentsEnabledFlag() )
     
    670774  m_cSAO.destroy();
    671775#if REPN_FORMAT_IN_VPS
     776#if AUXILIARY_PICTURES
     777#if HM_CLEANUP_SAO
     778  m_cSAO.create( m_apcSlicePilot->getPicWidthInLumaSamples(), m_apcSlicePilot->getPicHeightInLumaSamples(), sps->getChromaFormatIdc(), sps->getMaxCUWidth(), sps->getMaxCUHeight(), sps->getMaxCUDepth() );
     779#else
    672780  m_cSAO.create( m_apcSlicePilot->getPicWidthInLumaSamples(), m_apcSlicePilot->getPicHeightInLumaSamples(), sps->getMaxCUWidth(), sps->getMaxCUHeight() );
     781#endif
     782#else
     783#if HM_CLEANUP_SAO
     784  m_cSAO.create( m_apcSlicePilot->getPicWidthInLumaSamples(), m_apcSlicePilot->getPicHeightInLumaSamples(), sps->getMaxCUWidth(), sps->getMaxCUHeight(), sps->getMaxCUDepth() );
     785#else
     786  m_cSAO.create( m_apcSlicePilot->getPicWidthInLumaSamples(), m_apcSlicePilot->getPicHeightInLumaSamples(), sps->getMaxCUWidth(), sps->getMaxCUHeight() );
     787#endif
     788#endif
     789#else
     790#if HM_CLEANUP_SAO
     791  m_cSAO.create( sps->getPicWidthInLumaSamples(), sps->getPicHeightInLumaSamples(), sps->getMaxCUWidth(), sps->getMaxCUHeight(), sps->getMaxCUDepth() );
    673792#else
    674793  m_cSAO.create( sps->getPicWidthInLumaSamples(), sps->getPicHeightInLumaSamples(), sps->getMaxCUWidth(), sps->getMaxCUHeight() );
     794#endif
    675795#endif
    676796  m_cLoopFilter.create( sps->getMaxCUDepth() );
     
    688808{
    689809  TComPic*&   pcPic         = m_pcPic;
     810#if NO_CLRAS_OUTPUT_FLAG
     811  Bool bFirstSliceInSeq;
     812#endif
    690813#if SVC_EXTENSION
    691   m_apcSlicePilot->setVPS( m_parameterSetManagerDecoder[m_layerId].getPrefetchedVPS(0) );
     814  m_apcSlicePilot->setVPS( m_parameterSetManagerDecoder.getPrefetchedVPS(0) );
     815#if OUTPUT_LAYER_SET_INDEX
     816  // Following check should go wherever the VPS is activated
     817  checkValueOfOutputLayerSetIdx( m_apcSlicePilot->getVPS());
     818#endif
    692819  m_apcSlicePilot->initSlice( nalu.m_layerId );
    693820#else
     
    727854  m_apcSlicePilot->setNumSamplePredRefLayers( getNumSamplePredRefLayers() );
    728855#endif
    729   m_cEntropyDecoder.decodeSliceHeader (m_apcSlicePilot, &m_parameterSetManagerDecoder[m_layerId]);
    730 #else
     856#endif
    731857  m_cEntropyDecoder.decodeSliceHeader (m_apcSlicePilot, &m_parameterSetManagerDecoder);
    732 #endif
    733858
    734859  // set POC for dependent slices in skipped pictures
     
    788913  // actual decoding starts here
    789914  xActivateParameterSets();
    790 #if !O0223_O0139_IRAP_ALIGN_NO_CONTRAINTS
     915#if !O0223_O0139_IRAP_ALIGN_NO_CONTRAINTS && N0147_IRAP_ALIGN_FLAG
    791916  //Note setting O0223_O0139_IRAP_ALIGN_NO_CONTRAINTS to 0 may cause decoder to crash.
    792917  //When cross_layer_irap_aligned_flag is equal to 0, num_extra_slice_header_bits >=1
     
    801926  }
    802927#endif
    803 
    804928#if REPN_FORMAT_IN_VPS
    805929  // Initialize ILRP if needed, only for the current layer 
     
    816940#endif
    817941  }
     942#if NO_CLRAS_OUTPUT_FLAG
     943  bFirstSliceInSeq = m_bFirstSliceInSequence;
     944#endif
    818945  m_bFirstSliceInSequence = false;
    819946#if POC_RESET_FLAG
     
    829956      Int pocAdjustValue = m_apcSlicePilot->getPOC();
    830957
     958#if PREVTID0_POC_RESET
     959      m_apcSlicePilot->adjustPrevTid0POC(pocAdjustValue);
     960#endif
    831961      // If poc reset flag is set to 1, reset all POC for DPB -> basically do it for each slice in the picutre
    832962      TComList<TComPic*>::iterator  iterPic = m_cListPic.begin(); 
     
    8821012    // Check for TSA alignment
    8831013    if( m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_TSA_N ||
    884         m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_TLA_R
     1014        m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_TSA_R
    8851015         )
    8861016    {
     
    8921022        {
    8931023          assert( m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_TSA_N ||
    894                     m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_TLA_R );    // TSA pictures should be aligned among depenedent layers
     1024                    m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_TSA_R );    // TSA pictures should be aligned among depenedent layers
    8951025        }
    8961026      }
     
    9241054  {
    9251055#if AVC_BASE
    926     if( m_layerId == 1 && m_parameterSetManagerDecoder[0].getPrefetchedVPS(0)->getAvcBaseLayerFlag() )
     1056    if( m_layerId == 1 && m_parameterSetManagerDecoder.getPrefetchedVPS(0)->getAvcBaseLayerFlag() )
    9271057    {
    9281058      TComPic* pBLPic = (*m_ppcTDecTop[0]->getListPic()->begin());
     1059      pBLPic->getSlice(0)->setReferenced(true);
    9291060      fstream* pFile  = m_ppcTDecTop[0]->getBLReconFile();
    9301061      UInt uiWidth    = pBLPic->getPicYuvRec()->getWidth();
     
    9731104#endif
    9741105
     1106#if NO_CLRAS_OUTPUT_FLAG
     1107    if (m_layerId == 0 &&
     1108        (m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP
     1109      || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL
     1110      || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_N_LP
     1111      || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_W_RADL
     1112      || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP
     1113      || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA))
     1114    {
     1115      if (bFirstSliceInSeq)
     1116      {
     1117        setNoClrasOutputFlag(true);
     1118      }
     1119      else if (m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP
     1120            || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL
     1121            || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_N_LP)
     1122      {
     1123        setNoClrasOutputFlag(true);
     1124      }
     1125#if O0149_CROSS_LAYER_BLA_FLAG
     1126      else if ((m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_W_RADL || m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP) &&
     1127               m_apcSlicePilot->getCrossLayerBLAFlag())
     1128      {
     1129        setNoClrasOutputFlag(true);
     1130      }
     1131#endif
     1132      else
     1133      {
     1134        setNoClrasOutputFlag(false);
     1135      }
     1136      if (getNoClrasOutputFlag())
     1137      {
     1138        for (UInt i = 0; i < m_apcSlicePilot->getVPS()->getMaxLayers(); i++)
     1139        {
     1140          m_ppcTDecTop[i]->setLayerInitializedFlag(false);
     1141          m_ppcTDecTop[i]->setFirstPicInLayerDecodedFlag(false);
     1142        }
     1143      }
     1144    }
     1145#endif
     1146
     1147#if NO_CLRAS_OUTPUT_FLAG
     1148    m_apcSlicePilot->decodingRefreshMarking(m_pocCRA, m_bRefreshPending, m_cListPic, getNoClrasOutputFlag());
     1149#endif
     1150
    9751151    // Buffer initialize for prediction.
    9761152    m_cPrediction.initTempBuff();
     
    11431319    if (m_layerId == 0)
    11441320#endif
    1145 #if FIX1071
    11461321    pcSlice->setRefPicList( m_cListPic, true );
    1147 #else
    1148     pcSlice->setRefPicList( m_cListPic );
    1149 #endif
    11501322
    11511323#if SVC_EXTENSION
     
    11541326    if( m_layerId > 0 && m_uiSliceIdx == 0 )
    11551327    {     
     1328#if M0040_ADAPTIVE_RESOLUTION_CHANGE
     1329      if( !pcSlice->getVPS()->getSingleLayerForNonIrapFlag() || ( pcSlice->getVPS()->getSingleLayerForNonIrapFlag() && pcSlice->isIRAP() ) )
     1330#endif
    11561331      for( i = 0; i < pcSlice->getNumILRRefIdx(); i++ )
    11571332      {
    11581333        UInt refLayerIdc = i;
    11591334#if AVC_BASE
    1160         if( pcSlice->getVPS()->getRefLayerId( m_layerId, refLayerIdc ) == 0 && m_parameterSetManagerDecoder[0].getActiveVPS()->getAvcBaseLayerFlag() )
     1335        if( pcSlice->getVPS()->getRefLayerId( m_layerId, refLayerIdc ) == 0 && m_parameterSetManagerDecoder.getActiveVPS()->getAvcBaseLayerFlag() )
     1336        {         
     1337          TComPic* pic = *m_ppcTDecTop[0]->getListPic()->begin();
     1338
     1339          if( pic )
     1340          {
     1341            pcSlice->setBaseColPic ( refLayerIdc, pic );
     1342          }
     1343          else
     1344          {
     1345            continue;
     1346          }
     1347#if AVC_SYNTAX
     1348          TComPic* pBLPic = pcSlice->getBaseColPic(refLayerIdc);
     1349          if( pcSlice->getPOC() == 0 )
     1350          {
     1351            // initialize partition order.
     1352            UInt* piTmp = &g_auiZscanToRaster[0];
     1353            initZscanToRaster( pBLPic->getPicSym()->getMaxDepth() + 1, 1, 0, piTmp );
     1354            initRasterToZscan( pBLPic->getPicSym()->getMaxCUWidth(), pBLPic->getPicSym()->getMaxCUHeight(), pBLPic->getPicSym()->getMaxDepth() + 1 );
     1355          }     
     1356          pBLPic->getSlice( 0 )->initBaseLayerRPL( pcSlice );
     1357          pBLPic->readBLSyntax( m_ppcTDecTop[0]->getBLSyntaxFile(), SYNTAX_BYTES );
     1358#endif
     1359        }
     1360        else
     1361        {
     1362#if VPS_EXTN_DIRECT_REF_LAYERS
     1363          TDecTop *pcTDecTop = (TDecTop *)getRefLayerDec( refLayerIdc );
     1364#else
     1365          TDecTop *pcTDecTop = (TDecTop *)getLayerDec( m_layerId-1 );
     1366#endif
     1367          TComList<TComPic*> *cListPic = pcTDecTop->getListPic();
     1368          if( !pcSlice->setBaseColPic ( *cListPic, refLayerIdc ) )
     1369          {
     1370            continue;
     1371          }
     1372        }
     1373#else
     1374#if VPS_EXTN_DIRECT_REF_LAYERS
     1375        TDecTop *pcTDecTop = (TDecTop *)getRefLayerDec( refLayerIdc );
     1376#else
     1377        TDecTop *pcTDecTop = (TDecTop *)getLayerDec( m_layerId-1 );
     1378#endif
     1379        TComList<TComPic*> *cListPic = pcTDecTop->getListPic();
     1380        pcSlice->setBaseColPic ( *cListPic, refLayerIdc );
     1381#endif
     1382
     1383#if O0098_SCALED_REF_LAYER_ID
     1384        const Window &scalEL = pcSlice->getSPS()->getScaledRefLayerWindowForLayer(pcSlice->getVPS()->getRefLayerId(m_layerId, refLayerIdc));
     1385#else
     1386        const Window &scalEL = pcSlice->getSPS()->getScaledRefLayerWindow(refLayerIdc);
     1387#endif
     1388
     1389        Int widthBL   = pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec()->getWidth();
     1390        Int heightBL  = pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec()->getHeight();
     1391
     1392        Int widthEL   = pcPic->getPicYuvRec()->getWidth()  - scalEL.getWindowLeftOffset() - scalEL.getWindowRightOffset();
     1393        Int heightEL  = pcPic->getPicYuvRec()->getHeight() - scalEL.getWindowTopOffset()  - scalEL.getWindowBottomOffset();
     1394
     1395        g_mvScalingFactor[refLayerIdc][0] = widthEL  == widthBL  ? 4096 : Clip3(-4096, 4095, ((widthEL  << 8) + (widthBL  >> 1)) / widthBL);
     1396        g_mvScalingFactor[refLayerIdc][1] = heightEL == heightBL ? 4096 : Clip3(-4096, 4095, ((heightEL << 8) + (heightBL >> 1)) / heightBL);
     1397
     1398        g_posScalingFactor[refLayerIdc][0] = ((widthBL  << 16) + (widthEL  >> 1)) / widthEL;
     1399        g_posScalingFactor[refLayerIdc][1] = ((heightBL << 16) + (heightEL >> 1)) / heightEL;
     1400
     1401#if SVC_UPSAMPLING
     1402        if( pcPic->isSpatialEnhLayer(refLayerIdc) )
     1403        {   
     1404/*#if O0098_SCALED_REF_LAYER_ID
     1405          Window &scalEL = pcSlice->getSPS()->getScaledRefLayerWindowForLayer(pcSlice->getVPS()->getRefLayerId(m_layerId, refLayerIdc));
     1406#else
     1407          Window &scalEL = pcSlice->getSPS()->getScaledRefLayerWindow(refLayerIdc);
     1408#endif*/
     1409#if O0215_PHASE_ALIGNMENT
     1410#if O0194_JOINT_US_BITSHIFT
     1411          m_cPrediction.upsampleBasePic( pcSlice, refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec(), pcPic->getPicYuvRec(), scalEL, pcSlice->getVPS()->getPhaseAlignFlag() );
     1412#else
     1413          m_cPrediction.upsampleBasePic( refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec(), pcPic->getPicYuvRec(), scalEL, pcSlice->getVPS()->getPhaseAlignFlag() );
     1414#endif
     1415#else
     1416#if O0194_JOINT_US_BITSHIFT
     1417          m_cPrediction.upsampleBasePic( pcSlice, refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec(), pcPic->getPicYuvRec(), scalEL );
     1418#else
     1419          m_cPrediction.upsampleBasePic( refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec(), pcPic->getPicYuvRec(), scalEL );
     1420#endif
     1421#endif
     1422        }
     1423        else
     1424        {
     1425          pcPic->setFullPelBaseRec( refLayerIdc, pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec() );
     1426        }
     1427        pcSlice->setFullPelBaseRec ( refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc) );
     1428#endif
     1429      }
     1430    }
     1431
     1432    if( m_layerId > 0 && pcSlice->getActiveNumILRRefIdx() )
     1433    {
     1434      for( i = 0; i < pcSlice->getActiveNumILRRefIdx(); i++ )
     1435      {
     1436        UInt refLayerIdc = pcSlice->getInterLayerPredLayerIdc(i);
     1437#if AVC_BASE
     1438        if( pcSlice->getVPS()->getRefLayerId( m_layerId, refLayerIdc ) == 0 && m_parameterSetManagerDecoder.getActiveVPS()->getAvcBaseLayerFlag() )
    11611439        {
    11621440          pcSlice->setBaseColPic ( refLayerIdc, *m_ppcTDecTop[0]->getListPic()->begin() );
     
    11941472#endif
    11951473
    1196         const Window &scalEL = pcSlice->getSPS()->getScaledRefLayerWindow(refLayerIdc);
    1197 
    1198         Int widthBL   = pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec()->getWidth();
    1199         Int heightBL  = pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec()->getHeight();
    1200 
    1201         Int widthEL   = pcPic->getPicYuvRec()->getWidth()  - scalEL.getWindowLeftOffset() - scalEL.getWindowRightOffset();
    1202         Int heightEL  = pcPic->getPicYuvRec()->getHeight() - scalEL.getWindowTopOffset()  - scalEL.getWindowBottomOffset();
    1203 
    1204         g_mvScalingFactor[refLayerIdc][0] = widthEL  == widthBL  ? 4096 : Clip3(-4096, 4095, ((widthEL  << 8) + (widthBL  >> 1)) / widthBL);
    1205         g_mvScalingFactor[refLayerIdc][1] = heightEL == heightBL ? 4096 : Clip3(-4096, 4095, ((heightEL << 8) + (heightBL >> 1)) / heightBL);
    1206 
    1207         g_posScalingFactor[refLayerIdc][0] = ((widthBL  << 16) + (widthEL  >> 1)) / widthEL;
    1208         g_posScalingFactor[refLayerIdc][1] = ((heightBL << 16) + (heightEL >> 1)) / heightEL;
    1209 
    1210 #if SVC_UPSAMPLING
    1211         if( pcPic->isSpatialEnhLayer(refLayerIdc) )
    1212         {   
    1213 #if O0215_PHASE_ALIGNMENT
    1214 #if O0194_JOINT_US_BITSHIFT
    1215           m_cPrediction.upsampleBasePic( pcSlice, refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec(), pcPic->getPicYuvRec(), pcSlice->getSPS()->getScaledRefLayerWindow(refLayerIdc), pcSlice->getVPS()->getPhaseAlignFlag() );
    1216 #else
    1217           m_cPrediction.upsampleBasePic( refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec(), pcPic->getPicYuvRec(), pcSlice->getSPS()->getScaledRefLayerWindow(refLayerIdc), pcSlice->getVPS()->getPhaseAlignFlag() );
    1218 #endif
    1219 #else
    1220 #if O0194_JOINT_US_BITSHIFT
    1221           m_cPrediction.upsampleBasePic( pcSlice, refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec(), pcPic->getPicYuvRec(), pcSlice->getSPS()->getScaledRefLayerWindow(refLayerIdc) );
    1222 #else
    1223           m_cPrediction.upsampleBasePic( refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc), pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec(), pcPic->getPicYuvRec(), pcSlice->getSPS()->getScaledRefLayerWindow(refLayerIdc) );
    1224 #endif
    1225 #endif
    1226         }
    1227         else
    1228         {
    1229           pcPic->setFullPelBaseRec( refLayerIdc, pcSlice->getBaseColPic(refLayerIdc)->getPicYuvRec() );
    1230         }
    1231         pcSlice->setFullPelBaseRec ( refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc) );
    1232 #endif
    1233       }
    1234     }
    1235 
    1236     if( m_layerId > 0 && pcSlice->getActiveNumILRRefIdx() )
    1237     {
    1238       for( i = 0; i < pcSlice->getActiveNumILRRefIdx(); i++ )
    1239       {
    1240         UInt refLayerIdc = pcSlice->getInterLayerPredLayerIdc(i);
    1241 #if AVC_BASE
    1242         if( pcSlice->getVPS()->getRefLayerId( m_layerId, refLayerIdc ) == 0 && m_parameterSetManagerDecoder[0].getActiveVPS()->getAvcBaseLayerFlag() )
    1243         {
    1244           pcSlice->setBaseColPic ( refLayerIdc, *m_ppcTDecTop[0]->getListPic()->begin() );
    1245 #if AVC_SYNTAX
    1246           TComPic* pBLPic = pcSlice->getBaseColPic(refLayerIdc);
    1247           if( pcSlice->getPOC() == 0 )
    1248           {
    1249             // initialize partition order.
    1250             UInt* piTmp = &g_auiZscanToRaster[0];
    1251             initZscanToRaster( pBLPic->getPicSym()->getMaxDepth() + 1, 1, 0, piTmp );
    1252             initRasterToZscan( pBLPic->getPicSym()->getMaxCUWidth(), pBLPic->getPicSym()->getMaxCUHeight(), pBLPic->getPicSym()->getMaxDepth() + 1 );
    1253           }     
    1254           pBLPic->getSlice( 0 )->initBaseLayerRPL( pcSlice );
    1255           pBLPic->readBLSyntax( m_ppcTDecTop[0]->getBLSyntaxFile(), SYNTAX_BYTES );
    1256 #endif
    1257         }
    1258         else
    1259         {
    1260 #if VPS_EXTN_DIRECT_REF_LAYERS
    1261           TDecTop *pcTDecTop = (TDecTop *)getRefLayerDec( refLayerIdc );
    1262 #else
    1263           TDecTop *pcTDecTop = (TDecTop *)getLayerDec( m_layerId-1 );
    1264 #endif
    1265           TComList<TComPic*> *cListPic = pcTDecTop->getListPic();
    1266           pcSlice->setBaseColPic ( *cListPic, refLayerIdc );
    1267         }
    1268 #else
    1269 #if VPS_EXTN_DIRECT_REF_LAYERS
    1270         TDecTop *pcTDecTop = (TDecTop *)getRefLayerDec( refLayerIdc );
    1271 #else
    1272         TDecTop *pcTDecTop = (TDecTop *)getLayerDec( m_layerId-1 );
    1273 #endif
    1274         TComList<TComPic*> *cListPic = pcTDecTop->getListPic();
    1275         pcSlice->setBaseColPic ( *cListPic, refLayerIdc );
    1276 #endif
    1277 
    12781474        pcSlice->setFullPelBaseRec ( refLayerIdc, pcPic->getFullPelBaseRec(refLayerIdc) );
    12791475      }
     
    13151511   
    13161512#if N0147_IRAP_ALIGN_FLAG
    1317     if(  m_layerId > 0 && pcSlice->getVPS()->getCrossLayerIrapAlignFlag())
    1318     {
     1513    if( m_layerId > 0 && pcSlice->getVPS()->getCrossLayerIrapAlignFlag() )
     1514    {
     1515#if M0040_ADAPTIVE_RESOLUTION_CHANGE
     1516      if( !pcSlice->getVPS()->getSingleLayerForNonIrapFlag() || ( pcSlice->getVPS()->getSingleLayerForNonIrapFlag() && pcSlice->isIRAP() ) )
     1517#endif
    13191518      for(Int dependentLayerIdx = 0; dependentLayerIdx < pcSlice->getVPS()->getNumDirectRefLayers(m_layerId); dependentLayerIdx++)
    13201519      {
     
    13761575  if(pcSlice->getSPS()->getScalingListFlag())
    13771576  {
    1378 #if IL_SL_SIGNALLING_N0371
    1379     pcSlice->getSPS()->getScalingList()->setLayerId( m_layerId );
    1380 #endif
    1381 
    13821577    pcSlice->setScalingList ( pcSlice->getSPS()->getScalingList()  );
    1383 
    13841578    if(pcSlice->getPPS()->getScalingListPresentFlag())
    13851579    {
    1386 #if IL_SL_SIGNALLING_N0371
    1387       pcSlice->getPPS()->getScalingList()->setLayerId( m_layerId );
    1388 #endif
    1389 
    13901580      pcSlice->setScalingList ( pcSlice->getPPS()->getScalingList()  );
    13911581    }
     1582#if SCALINGLIST_INFERRING
     1583    if( m_layerId == 0 || ( m_layerId > 0 && !pcSlice->getPPS()->getInferScalingListFlag() && !pcSlice->getSPS()->getInferScalingListFlag() ) )
     1584#endif
    13921585    if(!pcSlice->getPPS()->getScalingListPresentFlag() && !pcSlice->getSPS()->getScalingListPresentFlag())
    13931586    {
    1394 #if IL_SL_SIGNALLING_N0371
    1395       pcSlice->setDefaultScalingList( m_layerId );
    1396 #else
    13971587      pcSlice->setDefaultScalingList();
    1398 #endif
    13991588    }
    14001589    m_cTrQuant.setScalingListDec(pcSlice->getScalingList());
     
    14031592  else
    14041593  {
    1405 #if IL_SL_SIGNALLING_N0371
    1406     m_cTrQuant.setFlatScalingList( m_layerId );
    1407 #else
    14081594    m_cTrQuant.setFlatScalingList();
    1409 #endif
    14101595    m_cTrQuant.setUseScalingList(false);
    14111596  }
     
    14251610 
    14261611  m_cEntropyDecoder.decodeVPS( vps );
    1427 #if SVC_EXTENSION
    1428   m_parameterSetManagerDecoder[0].storePrefetchedVPS(vps);
    1429 #else
    14301612  m_parameterSetManagerDecoder.storePrefetchedVPS(vps); 
    1431 #endif
    14321613}
    14331614
     
    14371618#if SVC_EXTENSION
    14381619  sps->setLayerId(m_layerId);
    1439   m_cEntropyDecoder.decodeSPS( sps, &m_parameterSetManagerDecoder[0] );
    1440   m_parameterSetManagerDecoder[m_layerId].storePrefetchedSPS(sps);
     1620  m_cEntropyDecoder.decodeSPS( sps, &m_parameterSetManagerDecoder );
     1621  m_parameterSetManagerDecoder.storePrefetchedSPS(sps);
    14411622#if !REPN_FORMAT_IN_VPS   // ILRP can only be initialized at activation 
    14421623  if(m_numLayer>0)
     
    14551636  TComPPS* pps = new TComPPS();
    14561637
    1457 #if IL_SL_SIGNALLING_N0371
    1458   pps->setLayerId(m_layerId);
     1638#if SCALINGLIST_INFERRING
     1639  pps->setLayerId( m_layerId );
    14591640#endif
    14601641
    14611642  m_cEntropyDecoder.decodePPS( pps );
    1462 #if SVC_EXTENSION
    1463   m_parameterSetManagerDecoder[m_layerId].storePrefetchedPPS( pps );
    1464 #else
    14651643  m_parameterSetManagerDecoder.storePrefetchedPPS( pps );
    1466 #endif
    14671644
    14681645  if( pps->getDependentSliceSegmentsEnabledFlag() )
     
    14921669#endif
    14931670#if M0043_LAYERS_PRESENT_SEI
    1494     m_seiReader.parseSEImessage( bs, m_pcPic->getSEIs(), nalUnitType, m_parameterSetManagerDecoder[m_layerId].getActiveVPS(), m_parameterSetManagerDecoder[m_layerId].getActiveSPS() );
    1495 #else
    1496     m_seiReader.parseSEImessage( bs, m_pcPic->getSEIs(), nalUnitType, m_parameterSetManagerDecoder[m_layerId].getActiveSPS() );
     1671    m_seiReader.parseSEImessage( bs, m_pcPic->getSEIs(), nalUnitType, m_parameterSetManagerDecoder.getActiveVPS(), m_parameterSetManagerDecoder.getActiveSPS() );
     1672#else
     1673    m_seiReader.parseSEImessage( bs, m_pcPic->getSEIs(), nalUnitType, m_parameterSetManagerDecoder.getActiveSPS() );
    14971674#endif
    14981675  }
     
    15001677  {
    15011678#if M0043_LAYERS_PRESENT_SEI
    1502     m_seiReader.parseSEImessage( bs, m_SEIs, nalUnitType, m_parameterSetManagerDecoder[m_layerId].getActiveVPS(), m_parameterSetManagerDecoder[m_layerId].getActiveSPS() );
    1503 #else
    1504     m_seiReader.parseSEImessage( bs, m_SEIs, nalUnitType, m_parameterSetManagerDecoder[m_layerId].getActiveSPS() );
     1679    m_seiReader.parseSEImessage( bs, m_SEIs, nalUnitType, m_parameterSetManagerDecoder.getActiveVPS(), m_parameterSetManagerDecoder.getActiveSPS() );
     1680#else
     1681    m_seiReader.parseSEImessage( bs, m_SEIs, nalUnitType, m_parameterSetManagerDecoder.getActiveSPS() );
    15051682#endif
    15061683    SEIMessages activeParamSets = getSeisByType(m_SEIs, SEI::ACTIVE_PARAMETER_SETS);
     
    15081685    {
    15091686      SEIActiveParameterSets *seiAps = (SEIActiveParameterSets*)(*activeParamSets.begin());
    1510       m_parameterSetManagerDecoder[m_layerId].applyPrefetchedPS();
     1687      m_parameterSetManagerDecoder.applyPrefetchedPS();
    15111688      assert(seiAps->activeSeqParamSetId.size()>0);
    1512       if (! m_parameterSetManagerDecoder[m_layerId].activateSPSWithSEI(seiAps->activeSeqParamSetId[0] ))
     1689      if( !m_parameterSetManagerDecoder.activateSPSWithSEI( seiAps->activeSeqParamSetId[0] ) )
    15131690      {
    15141691        printf ("Warning SPS activation with Active parameter set SEI failed");
     
    15651742      xDecodeVPS();
    15661743#if AVC_BASE
    1567       if( m_parameterSetManagerDecoder[0].getPrefetchedVPS(0)->getAvcBaseLayerFlag() )
     1744      if( m_parameterSetManagerDecoder.getPrefetchedVPS(0)->getAvcBaseLayerFlag() )
    15681745      {
    15691746        if( !m_ppcTDecTop[0]->getBLReconFile()->good() )
     
    15911768      xDecodeSPS();
    15921769#if AVC_BASE
    1593       if( m_parameterSetManagerDecoder[0].getPrefetchedVPS(0)->getAvcBaseLayerFlag() )
     1770      if( m_parameterSetManagerDecoder.getPrefetchedVPS(0)->getAvcBaseLayerFlag() )
    15941771      {
    15951772        TComPic* pBLPic = (*m_ppcTDecTop[0]->getListPic()->begin());
     
    15971774        {
    15981775          // using EL SPS with spsId = 1
    1599           TComSPS* sps = m_parameterSetManagerDecoder[nalu.m_layerId].getPrefetchedSPS(1);
     1776          TComSPS* sps = m_parameterSetManagerDecoder.getPrefetchedSPS(1);
    16001777          Int  numReorderPics[MAX_TLAYER];
    16011778          Window &conformanceWindow = sps->getConformanceWindow();
     
    16441821    case NAL_UNIT_CODED_SLICE_TRAIL_R:
    16451822    case NAL_UNIT_CODED_SLICE_TRAIL_N:
    1646     case NAL_UNIT_CODED_SLICE_TLA_R:
     1823    case NAL_UNIT_CODED_SLICE_TSA_R:
    16471824    case NAL_UNIT_CODED_SLICE_TSA_N:
    16481825    case NAL_UNIT_CODED_SLICE_STSA_R:
     
    16641841#endif
    16651842      break;
     1843     
     1844    case NAL_UNIT_EOS:
     1845      m_associatedIRAPType = NAL_UNIT_INVALID;
     1846      m_pocCRA = 0;
     1847      m_pocRandomAccess = MAX_INT;
     1848      m_prevPOC = MAX_INT;
     1849      m_bFirstSliceInPicture = true;
     1850      m_bFirstSliceInSequence = true;
     1851      m_prevSliceSkipped = false;
     1852      m_skippedPOC = 0;
     1853      return false;
     1854     
     1855    case NAL_UNIT_ACCESS_UNIT_DELIMITER:
     1856      // TODO: process AU delimiter
     1857      return false;
     1858     
     1859    case NAL_UNIT_EOB:
     1860      return false;
     1861     
    16661862    default:
    1667       assert (1);
     1863      assert (0);
    16681864  }
    16691865
     
    17461942TDecTop* TDecTop::getRefLayerDec( UInt refLayerIdc )
    17471943{
    1748   TComVPS* vps = m_parameterSetManagerDecoder[0].getActiveVPS();
     1944  TComVPS* vps = m_parameterSetManagerDecoder.getActiveVPS();
    17491945  if( vps->getNumDirectRefLayers( m_layerId ) <= 0 )
    17501946  {
     
    18382034}
    18392035#endif
    1840 
     2036#if OUTPUT_LAYER_SET_INDEX
     2037Void TDecTop::checkValueOfOutputLayerSetIdx(TComVPS *vps)
     2038{
     2039  CommonDecoderParams* params = this->getCommonDecoderParams();
     2040  if( params->getValueCheckedFlag() )
     2041  {
     2042    return; // Already checked
     2043  }
     2044  if( params->getOutputLayerSetIdx() == -1 )  // Output layer set index not specified
     2045  {
     2046    Bool layerSetMatchFound = false;
     2047    // Output layer set index not assigned.
     2048    // Based on the value of targetLayerId, check if any of the output layer matches
     2049    // Currently, the target layer ID in the encoder assumes that all the layers are decoded   
     2050    // Check if any of the output layer sets match this description
     2051    for(Int i = 0; i < vps->getNumOutputLayerSets(); i++)
     2052    {
     2053      Bool layerSetMatchFlag = true;
     2054      Int layerSetIdx = vps->getOutputLayerSetIdx( i );
     2055      if( vps->getNumLayersInIdList( layerSetIdx ) == params->getTargetLayerId() + 1 )
     2056      {
     2057        for(Int j = 0; j < vps->getNumLayersInIdList( layerSetIdx ); j++)
     2058        {
     2059          if( vps->getLayerSetLayerIdList( layerSetIdx, j ) != j )
     2060          {
     2061            layerSetMatchFlag = false;
     2062            break;
     2063          }
     2064        }
     2065      }
     2066      else
     2067      {
     2068        layerSetMatchFlag = false;
     2069      }
     2070     
     2071      if( layerSetMatchFlag ) // Potential output layer set candidate found
     2072      {
     2073        // If target dec layer ID list is also included - check if they match
     2074        if( params->getTargetDecLayerIdSet() )
     2075        {
     2076          if( params->getTargetDecLayerIdSet()->size() ) 
     2077          {
     2078            for(Int j = 0; j < vps->getNumLayersInIdList( layerSetIdx ); j++)
     2079            {
     2080              if( *(params->getTargetDecLayerIdSet()->begin() + j) != vps->getLayerIdInNuh(vps->getLayerSetLayerIdList( layerSetIdx, j )))
     2081              {
     2082                layerSetMatchFlag = false;
     2083              }
     2084            }
     2085          }
     2086        }
     2087        if( layerSetMatchFlag ) // The target dec layer ID list also matches, if present
     2088        {
     2089          // Match found
     2090          layerSetMatchFound = true;
     2091          params->setOutputLayerSetIdx( i );
     2092          params->setValueCheckedFlag( true );
     2093          break;
     2094        }
     2095      }
     2096    }
     2097    assert( layerSetMatchFound ); // No output layer set matched the value of either targetLayerId or targetdeclayerIdlist
     2098  }   
     2099  else // Output layer set index is assigned - check if the values match
     2100  {
     2101    // Check if the target decoded layer is the highest layer in the list
     2102    Int layerSetIdx = vps->getOutputLayerSetIdx( params->getOutputLayerSetIdx() );  // Index to the layer set
     2103    assert( params->getTargetLayerId() == vps->getNumLayersInIdList( layerSetIdx ) - 1);
     2104
     2105    Bool layerSetMatchFlag = true;
     2106    for(Int j = 0; j < vps->getNumLayersInIdList( layerSetIdx ); j++)
     2107    {
     2108      if( vps->getLayerSetLayerIdList( layerSetIdx, j ) != j )
     2109      {
     2110        layerSetMatchFlag = false;
     2111        break;
     2112      }
     2113    }
     2114
     2115    assert(layerSetMatchFlag);    // Signaled output layer set index does not match targetOutputLayerId.
     2116   
     2117    // Check if the targetdeclayerIdlist matches the output layer set
     2118    if( params->getTargetDecLayerIdSet() )
     2119    {
     2120      if( params->getTargetDecLayerIdSet()->size() ) 
     2121      {
     2122        for(Int i = 0; i < vps->getNumLayersInIdList( layerSetIdx ); i++)
     2123        {
     2124          assert( *(params->getTargetDecLayerIdSet()->begin() + i) == vps->getLayerIdInNuh(vps->getLayerSetLayerIdList( layerSetIdx, i )));
     2125        }
     2126      }
     2127    }
     2128    params->setValueCheckedFlag( true );
     2129
     2130  }
     2131}
     2132#endif
    18412133//! \}
  • trunk/source/Lib/TLibDecoder/TDecTop.h

    r494 r540  
    7272
    7373  TComList<TComPic*>      m_cListPic;         //  Dynamic buffer
    74 #if SVC_EXTENSION
    75   ParameterSetManagerDecoder m_parameterSetManagerDecoder[MAX_LAYERS];  // storage for parameter sets
    76 #else
    7774  ParameterSetManagerDecoder m_parameterSetManagerDecoder;  // storage for parameter sets
    78 #endif
    79 
    8075  TComSlice*              m_apcSlicePilot;
    8176
     
    134129  TComPic*                m_cIlpPic[MAX_NUM_REF];                    ///<  Inter layer Prediction picture =  upsampled picture
    135130#endif
     131#if OUTPUT_LAYER_SET_INDEX
     132  CommonDecoderParams*    m_commonDecoderParams;
     133#endif
    136134#if AVC_SYNTAX || SYNTAX_OUTPUT
    137135  fstream*               m_pBLSyntaxFile;
     136#endif
     137
     138#if NO_CLRAS_OUTPUT_FLAG
     139  Bool                    m_noClrasOutputFlag;
     140  Bool                    m_layerInitializedFlag;
     141  Bool                    m_firstPicInLayerDecodedFlag;
     142  Bool                    m_noOutputOfPriorPicsFlags;
     143
     144  Bool                   m_bRefreshPending;
    138145#endif
    139146
     
    241248#endif
    242249
     250#if NO_CLRAS_OUTPUT_FLAG
     251  Int  getNoClrasOutputFlag()                { return m_noClrasOutputFlag;}
     252  Void setNoClrasOutputFlag(Bool x)          { m_noClrasOutputFlag = x;   }
     253  Int  getLayerInitializedFlag()             { return m_layerInitializedFlag;}
     254  Void setLayerInitializedFlag(Bool x)       { m_layerInitializedFlag = x;   }
     255  Int  getFirstPicInLayerDecodedFlag()       { return m_firstPicInLayerDecodedFlag;}
     256  Void setFirstPicInLayerDecodedFlag(Bool x) { m_firstPicInLayerDecodedFlag = x;   }
     257  Int  getNoOutputOfPriorPicsFlags()         { return m_noOutputOfPriorPicsFlags;}
     258  Void setNoOutputOfPriorPicsFlags(Bool x)   { m_noOutputOfPriorPicsFlags = x;   }
     259#endif
     260public:
     261#if OUTPUT_LAYER_SET_INDEX
     262  CommonDecoderParams*    getCommonDecoderParams() { return m_commonDecoderParams; }
     263  Void                    setCommonDecoderParams(CommonDecoderParams* x) { m_commonDecoderParams = x; }
     264  Void      checkValueOfOutputLayerSetIdx(TComVPS *vps);
     265#endif
     266#if SCALINGLIST_INFERRING
     267  ParameterSetManagerDecoder* getParameterSetManager() { return &m_parameterSetManagerDecoder; }
     268#endif
    243269};// END CLASS DEFINITION TDecTop
    244270
Note: See TracChangeset for help on using the changeset viewer.