Changeset 644 in SHVCSoftware


Ignore:
Timestamp:
25 Mar 2014, 21:51:30 (11 years ago)
Author:
seregin
Message:

merge with SHM-5.1-dev branch

Location:
trunk
Files:
48 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/source

  • trunk/source/App/TAppDecoder/TAppDecTop.cpp

    r595 r644  
    4141#include <fcntl.h>
    4242#include <assert.h>
    43 
     43#include <iostream>
    4444#include "TAppDecTop.h"
    4545#include "TLibDecoder/AnnexBread.h"
    4646#include "TLibDecoder/NALread.h"
    47 
    4847//! \ingroup TAppDecoder
    4948//! \{
     
    255254        openedReconFile[curLayerId] = true;
    256255      }
     256#if ALIGNED_BUMPING
     257      Bool outputPicturesFlag = true; 
     258#if NO_OUTPUT_OF_PRIOR_PICS
     259      if( m_acTDecTop[nalu.m_layerId].getNoOutputOfPriorPicsFlags() )
     260      {
     261        outputPicturesFlag = false;
     262      }
     263#endif
     264
     265      if (nalu.m_nalUnitType == NAL_UNIT_EOS) // End of sequence
     266      {
     267        flushAllPictures( nalu.m_layerId, outputPicturesFlag );       
     268      }
     269      if( bNewPicture ) // New picture, slice header parsed but picture not decoded
     270      {
     271#if NO_OUTPUT_OF_PRIOR_PICS
     272        if(
     273#else
     274        if ( bNewPOC &&
     275#endif
     276           (   nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_IDR_W_RADL
     277            || nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_IDR_N_LP
     278            || nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_BLA_N_LP
     279            || nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_BLA_W_RADL
     280            || nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_BLA_W_LP ) )
     281        {
     282          flushAllPictures( nalu.m_layerId, outputPicturesFlag );
     283        }
     284        else
     285        {
     286          this->checkOutputBeforeDecoding( nalu.m_layerId );
     287        }
     288      }
     289
     290      /* The following code has to be executed when the last DU of the picture is decoded
     291         TODO: Need code to identify end of decoding a picture
     292      {
     293        this->checkOutputAfterDecoding( );
     294      } */
     295#else
    257296      if ( bNewPicture && bNewPOC &&
    258297           (   nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_IDR_W_RADL
     
    273312        xWriteOutput( pcListPic, curLayerId, nalu.m_temporalId );
    274313      }
    275     }
    276   }
     314#endif
     315    }
     316  }
     317#if ALIGNED_BUMPING
     318   flushAllPictures( true );   
     319#else
    277320  for(UInt layer = 0; layer <= m_tgtLayerId; layer++)
    278321  {
    279322    xFlushOutput( m_acTDecTop[layer].getListPic(), layer );
    280323  }
     324#endif
    281325  // delete buffers
    282326#if AVC_BASE
     
    9871031  return false;
    9881032}
    989 
     1033#if ALIGNED_BUMPING
     1034// Function outputs a picture, and marks it as not needed for output.
     1035Void TAppDecTop::xOutputAndMarkPic( TComPic *pic, const Char *reconFile, const Int layerIdx, Int &pocLastDisplay, DpbStatus &dpbStatus )
     1036{
     1037  if ( reconFile )
     1038  {
     1039    const Window &conf = pic->getConformanceWindow();
     1040    const Window &defDisp = m_respectDefDispWindow ? pic->getDefDisplayWindow() : Window();
     1041    Int xScal =  1, yScal = 1;
     1042#if REPN_FORMAT_IN_VPS
     1043    UInt chromaFormatIdc = pic->getSlice(0)->getChromaFormatIdc();
     1044    xScal = TComSPS::getWinUnitX( chromaFormatIdc );
     1045    yScal = TComSPS::getWinUnitY( chromaFormatIdc );
     1046#endif
     1047    m_acTVideoIOYuvReconFile[layerIdx].write( pic->getPicYuvRec(),
     1048      conf.getWindowLeftOffset()  * xScal + defDisp.getWindowLeftOffset(),
     1049      conf.getWindowRightOffset() * xScal + defDisp.getWindowRightOffset(),
     1050      conf.getWindowTopOffset()   * yScal + defDisp.getWindowTopOffset(),
     1051      conf.getWindowBottomOffset()* yScal + defDisp.getWindowBottomOffset() );
     1052  }
     1053  // update POC of display order
     1054  pocLastDisplay = pic->getPOC();
     1055
     1056  // Mark as not needed for output
     1057  pic->setOutputMark(false);
     1058
     1059  // "erase" non-referenced picture in the reference picture list after display
     1060  if ( !pic->getSlice(0)->isReferenced() && pic->getReconMark() == true )
     1061  {
     1062    pic->setReconMark(false);
     1063
     1064    // mark it should be extended later
     1065    pic->getPicYuvRec()->setBorderExtension( false );
     1066
     1067    dpbStatus.m_numPicsInLayer[layerIdx]--;
     1068  }
     1069}
     1070
     1071Void TAppDecTop::flushAllPictures(Int layerId, Bool outputPictures)
     1072{
     1073  // First "empty" all pictures that are not used for reference and not needed for output
     1074  emptyUnusedPicturesNotNeededForOutput();
     1075
     1076  if( outputPictures )  // All pictures in the DPB in that layer are to be output; this means other pictures would also be output
     1077  {
     1078    std::vector<Int>  listOfPocs;
     1079    std::vector<Int>  listOfPocsInEachLayer[MAX_LAYERS];
     1080    std::vector<Int>  listOfPocsPositionInEachLayer[MAX_LAYERS];
     1081    DpbStatus dpbStatus;
     1082
     1083    // Find the status of the DPB
     1084    xFindDPBStatus(listOfPocs, listOfPocsInEachLayer, listOfPocsPositionInEachLayer, dpbStatus);
     1085
     1086    if( listOfPocs.size() )
     1087    {
     1088      while( listOfPocsInEachLayer[layerId].size() )    // As long as there picture in the layer to be output
     1089      {
     1090        bumpingProcess( listOfPocs, listOfPocsInEachLayer, listOfPocsPositionInEachLayer, dpbStatus );
     1091      }
     1092    }
     1093  }
     1094
     1095  // Now remove all pictures from the layer DPB?
     1096  markAllPicturesAsErased(layerId);
     1097}
     1098Void TAppDecTop::flushAllPictures(Bool outputPictures)
     1099{
     1100  // First "empty" all pictures that are not used for reference and not needed for output
     1101  emptyUnusedPicturesNotNeededForOutput();
     1102
     1103  if( outputPictures )  // All pictures in the DPB are to be output
     1104  {
     1105    std::vector<Int>  listOfPocs;
     1106    std::vector<Int>  listOfPocsInEachLayer[MAX_LAYERS];
     1107    std::vector<Int>  listOfPocsPositionInEachLayer[MAX_LAYERS];
     1108    DpbStatus dpbStatus;
     1109
     1110    // Find the status of the DPB
     1111    xFindDPBStatus(listOfPocs, listOfPocsInEachLayer, listOfPocsPositionInEachLayer, dpbStatus);
     1112
     1113    while( dpbStatus.m_numAUsNotDisplayed )
     1114    {
     1115      bumpingProcess( listOfPocs, listOfPocsInEachLayer, listOfPocsPositionInEachLayer, dpbStatus );
     1116    }
     1117  }
     1118
     1119  // Now remove all pictures from the DPB?
     1120  markAllPicturesAsErased();
     1121}
     1122
     1123Void TAppDecTop::markAllPicturesAsErased()
     1124{
     1125  for(Int i = 0; i < MAX_LAYERS; i++)
     1126  {
     1127    m_acTDecTop[i].getListPic()->clear();
     1128  }
     1129}
     1130
     1131Void TAppDecTop::markAllPicturesAsErased(Int layerIdx)
     1132{
     1133  m_acTDecTop[layerIdx].getListPic()->clear();
     1134}
     1135
     1136Void TAppDecTop::checkOutputBeforeDecoding(Int layerIdx)
     1137{
     1138   
     1139  std::vector<Int>  listOfPocs;
     1140  std::vector<Int>  listOfPocsInEachLayer[MAX_LAYERS];
     1141  std::vector<Int>  listOfPocsPositionInEachLayer[MAX_LAYERS];
     1142  DpbStatus dpbStatus;
     1143
     1144  // First "empty" all pictures that are not used for reference and not needed for output
     1145  emptyUnusedPicturesNotNeededForOutput();
     1146
     1147  // Find the status of the DPB
     1148  xFindDPBStatus(listOfPocs, listOfPocsInEachLayer, listOfPocsPositionInEachLayer, dpbStatus);
     1149
     1150  // If not picture to be output, return
     1151  if( listOfPocs.size() == 0 )
     1152  {
     1153    return;
     1154  }
     1155
     1156  // Find DPB-information from the VPS
     1157  DpbStatus maxDpbLimit;
     1158  Int targetLsIdx, subDpbIdx;
     1159  TComVPS *vps = findDpbParametersFromVps(listOfPocs, listOfPocsInEachLayer, listOfPocsPositionInEachLayer, maxDpbLimit);
     1160  if( getCommonDecoderParams()->getTargetOutputLayerSetIdx() == 0 )
     1161  {
     1162    targetLsIdx = 0;
     1163    subDpbIdx   = 0;
     1164  }
     1165  else
     1166  {
     1167    targetLsIdx = vps->getOutputLayerSetIdx( getCommonDecoderParams()->getTargetOutputLayerSetIdx() );
     1168    subDpbIdx   = vps->getSubDpbAssigned( targetLsIdx, layerIdx );
     1169  }
     1170  // Assume that listOfPocs is sorted in increasing order - if not have to sort it.
     1171  while( ifInvokeBumpingBeforeDecoding(dpbStatus, maxDpbLimit, layerIdx, subDpbIdx) )
     1172  {
     1173    bumpingProcess( listOfPocs, listOfPocsInEachLayer, listOfPocsPositionInEachLayer, dpbStatus );
     1174  } 
     1175}
     1176
     1177Void TAppDecTop::checkOutputAfterDecoding()
     1178{   
     1179  std::vector<Int>  listOfPocs;
     1180  std::vector<Int>  listOfPocsInEachLayer[MAX_LAYERS];
     1181  std::vector<Int>  listOfPocsPositionInEachLayer[MAX_LAYERS];
     1182  DpbStatus dpbStatus;
     1183
     1184  // First "empty" all pictures that are not used for reference and not needed for output
     1185  emptyUnusedPicturesNotNeededForOutput();
     1186
     1187  // Find the status of the DPB
     1188  xFindDPBStatus(listOfPocs, listOfPocsInEachLayer, listOfPocsPositionInEachLayer, dpbStatus);
     1189
     1190  // If not picture to be output, return
     1191  if( listOfPocs.size() == 0 )
     1192  {
     1193    return;
     1194  }
     1195
     1196  // Find DPB-information from the VPS
     1197  DpbStatus maxDpbLimit;
     1198  findDpbParametersFromVps(listOfPocs, listOfPocsInEachLayer, listOfPocsPositionInEachLayer, maxDpbLimit);
     1199
     1200  // Assume that listOfPocs is sorted in increasing order - if not have to sort it.
     1201  while( ifInvokeBumpingAfterDecoding(dpbStatus, maxDpbLimit) )
     1202  {
     1203    bumpingProcess( listOfPocs, listOfPocsInEachLayer, listOfPocsPositionInEachLayer, dpbStatus );
     1204  } 
     1205}
     1206
     1207Void TAppDecTop::bumpingProcess(std::vector<Int> &listOfPocs, std::vector<Int> *listOfPocsInEachLayer, std::vector<Int> *listOfPocsPositionInEachLayer, DpbStatus &dpbStatus)
     1208{
     1209  // Choose the smallest POC value
     1210  Int pocValue = *(listOfPocs.begin());
     1211  std::vector<int>::iterator it;
     1212  TComList<TComPic*>::iterator iterPic;
     1213  for( Int layerIdx = 0; layerIdx < dpbStatus.m_numLayers; layerIdx++)
     1214  {
     1215    // Check if picture with pocValue is present.
     1216    it = find( listOfPocsInEachLayer[layerIdx].begin(), listOfPocsInEachLayer[layerIdx].end(), pocValue );
     1217    if( it != listOfPocsInEachLayer[layerIdx].end() )  // picture found.
     1218    {
     1219      Int picPosition = std::distance( listOfPocsInEachLayer[layerIdx].begin(), it );
     1220      Int j;
     1221      for(j = 0, iterPic = m_acTDecTop[layerIdx].getListPic()->begin(); j < listOfPocsPositionInEachLayer[layerIdx][picPosition]; j++) // Picture to be output
     1222      {
     1223        iterPic++;
     1224      }
     1225      TComPic *pic = *iterPic;
     1226
     1227      xOutputAndMarkPic( pic, m_pchReconFile[layerIdx], layerIdx, m_aiPOCLastDisplay[layerIdx], dpbStatus );
     1228
     1229      listOfPocsInEachLayer[layerIdx].erase( it );
     1230      listOfPocsPositionInEachLayer[layerIdx].erase( listOfPocsPositionInEachLayer[layerIdx].begin() + picPosition );
     1231    }
     1232  }
     1233  // Update sub-DPB status
     1234  for( Int subDpbIdx = 0; subDpbIdx < dpbStatus.m_numSubDpbs; subDpbIdx++)
     1235  {
     1236    dpbStatus.m_numPicsInSubDpb[subDpbIdx]--;
     1237  }
     1238  dpbStatus.m_numAUsNotDisplayed--;   
     1239
     1240  // Remove the picture from the listOfPocs
     1241  listOfPocs.erase( listOfPocs.begin() );
     1242}
     1243
     1244TComVPS *TAppDecTop::findDpbParametersFromVps(std::vector<Int> const &listOfPocs, std::vector<Int> const *listOfPocsInEachLayer, std::vector<Int> const *listOfPocsPositionInEachLayer, DpbStatus &maxDpbLimit)
     1245{
     1246  Int targetOutputLsIdx = getCommonDecoderParams()->getTargetOutputLayerSetIdx();
     1247  TComVPS *vps = NULL;
     1248
     1249  if( targetOutputLsIdx == 0 )   // Only base layer is output
     1250  {
     1251    TComSPS *sps = NULL;
     1252    assert( listOfPocsInEachLayer[0].size() != 0 );
     1253    TComList<TComPic*>::iterator iterPic;
     1254    Int j;
     1255    for(j = 0, iterPic = m_acTDecTop[0].getListPic()->begin(); j < listOfPocsPositionInEachLayer[0][0]; j++) // Picture to be output
     1256    {
     1257      iterPic++;
     1258    }
     1259    TComPic *pic = *iterPic;
     1260    sps = pic->getSlice(0)->getSPS();   assert( sps->getLayerId() == 0 );
     1261    vps = pic->getSlice(0)->getVPS();
     1262    Int highestTId = sps->getMaxTLayers() - 1;
     1263
     1264    maxDpbLimit.m_numAUsNotDisplayed = sps->getNumReorderPics( highestTId ); // m_numAUsNotDisplayed is only variable name - stores reorderpics
     1265    maxDpbLimit.m_maxLatencyIncrease = sps->getMaxLatencyIncrease( highestTId ) > 0;
     1266    if( maxDpbLimit.m_maxLatencyIncrease )
     1267    {
     1268      maxDpbLimit.m_maxLatencyPictures = sps->getMaxLatencyIncrease( highestTId ) + sps->getNumReorderPics( highestTId ) - 1;
     1269    }
     1270    maxDpbLimit.m_numPicsInLayer[0] = sps->getMaxDecPicBuffering( highestTId );
     1271    maxDpbLimit.m_numPicsInSubDpb[0] = sps->getMaxDecPicBuffering( highestTId );
     1272  }
     1273  else
     1274  {
     1275    // -------------------------------------
     1276    // Find the VPS used for the pictures
     1277    // -------------------------------------
     1278    for(Int i = 0; i < MAX_LAYERS; i++)
     1279    {
     1280      if( m_acTDecTop[i].getListPic()->empty() )
     1281      {
     1282        assert( listOfPocsInEachLayer[i].size() == 0 );
     1283        continue;
     1284      }
     1285      std::vector<Int>::const_iterator it;
     1286      it = find( listOfPocsInEachLayer[i].begin(), listOfPocsInEachLayer[i].end(), listOfPocs[0] );
     1287      TComList<TComPic*>::iterator iterPic;
     1288      if( it != listOfPocsInEachLayer[i].end() )
     1289      {
     1290        Int picPosition = std::distance( listOfPocsInEachLayer[i].begin(), it );
     1291        Int j;
     1292        for(j = 0, iterPic = m_acTDecTop[i].getListPic()->begin(); j < listOfPocsPositionInEachLayer[i][picPosition]; j++) // Picture to be output
     1293        {
     1294          iterPic++;
     1295        }
     1296        TComPic *pic = *iterPic;
     1297        vps = pic->getSlice(0)->getVPS();
     1298        break;
     1299      }
     1300    }
     1301
     1302    Int targetLsIdx       = vps->getOutputLayerSetIdx( getCommonDecoderParams()->getTargetOutputLayerSetIdx() );
     1303    Int highestTId = vps->getMaxTLayers() - 1;
     1304
     1305    maxDpbLimit.m_numAUsNotDisplayed = vps->getMaxVpsNumReorderPics( targetOutputLsIdx, highestTId ); // m_numAUsNotDisplayed is only variable name - stores reorderpics
     1306    maxDpbLimit.m_maxLatencyIncrease  = vps->getMaxVpsLatencyIncreasePlus1(targetOutputLsIdx, highestTId ) > 0;
     1307    if( maxDpbLimit.m_maxLatencyIncrease )
     1308    {
     1309      maxDpbLimit.m_maxLatencyPictures = vps->getMaxVpsNumReorderPics( targetOutputLsIdx, highestTId ) + vps->getMaxVpsLatencyIncreasePlus1(targetOutputLsIdx, highestTId ) - 1;
     1310    }
     1311    for(Int i = 0; i < vps->getNumLayersInIdList( targetLsIdx ); i++)
     1312    {
     1313      maxDpbLimit.m_numPicsInLayer[i] = vps->getMaxVpsLayerDecPicBuffMinus1( targetOutputLsIdx, i, highestTId ) + 1;
     1314      maxDpbLimit.m_numPicsInSubDpb[vps->getSubDpbAssigned( targetLsIdx, i )] = vps->getMaxVpsDecPicBufferingMinus1( targetOutputLsIdx, vps->getSubDpbAssigned( targetLsIdx, i ), highestTId) + 1;
     1315    }
     1316    // -------------------------------------
     1317  }
     1318  return vps;
     1319}
     1320Void TAppDecTop::emptyUnusedPicturesNotNeededForOutput()
     1321{
     1322  for(Int layerIdx = 0; layerIdx < MAX_LAYERS; layerIdx++)
     1323  {
     1324    TComList <TComPic*> *pcListPic = m_acTDecTop[layerIdx].getListPic();
     1325    TComList<TComPic*>::iterator iterPic = pcListPic->begin();
     1326    while ( iterPic != pcListPic->end() )
     1327    {
     1328      TComPic *pic = *iterPic;
     1329      if( !pic->getSlice(0)->isReferenced() && !pic->getOutputMark() )
     1330      {
     1331        // Emtpy the picture buffer
     1332        pic->setReconMark( false );
     1333      }
     1334      iterPic++;
     1335    }
     1336  }
     1337}
     1338
     1339Bool TAppDecTop::ifInvokeBumpingBeforeDecoding( const DpbStatus &dpbStatus, const DpbStatus &dpbLimit, const Int layerIdx, const Int subDpbIdx )
     1340{
     1341  Bool retVal = false;
     1342  // Number of reorder picutres
     1343  retVal |= ( dpbStatus.m_numAUsNotDisplayed > dpbLimit.m_numAUsNotDisplayed );
     1344
     1345  // Number of pictures in each sub-DPB
     1346  retVal |= ( dpbStatus.m_numPicsInSubDpb[subDpbIdx] >= dpbLimit.m_numPicsInSubDpb[subDpbIdx] );
     1347 
     1348  // Number of pictures in each layer
     1349  retVal |= ( dpbStatus.m_numPicsInLayer[layerIdx] >= dpbLimit.m_numPicsInLayer[layerIdx]);
     1350
     1351  return retVal;
     1352}
     1353
     1354Bool TAppDecTop::ifInvokeBumpingAfterDecoding( const DpbStatus &dpbStatus, const DpbStatus &dpbLimit )
     1355{
     1356  Bool retVal = false;
     1357
     1358  // Number of reorder picutres
     1359  retVal |= ( dpbStatus.m_numAUsNotDisplayed > dpbLimit.m_numAUsNotDisplayed );
     1360
     1361  return retVal;
     1362}
     1363
     1364Void TAppDecTop::xFindDPBStatus( std::vector<Int> &listOfPocs
     1365                            , std::vector<Int> *listOfPocsInEachLayer
     1366                            , std::vector<Int> *listOfPocsPositionInEachLayer
     1367                            , DpbStatus &dpbStatus
     1368                            )
     1369{
     1370  TComVPS *vps = NULL;
     1371  dpbStatus.init();
     1372  for( Int i = 0; i < MAX_LAYERS; i++ )
     1373  {
     1374    if( m_acTDecTop[i].getListPic()->empty() )
     1375    {
     1376      continue;
     1377    }
     1378   
     1379    // To check # AUs that have at least one picture not output,
     1380    // For each layer, populate listOfPOcs if not already present
     1381    TComList<TComPic*>::iterator iterPic = m_acTDecTop[i].getListPic()->begin();
     1382    Int picPositionInList = 0;
     1383    while (iterPic != m_acTDecTop[i].getListPic()->end())
     1384    {
     1385      TComPic* pic = *(iterPic);
     1386      if( pic->getReconMark() )
     1387      {
     1388        if( vps == NULL )
     1389        {
     1390          vps = pic->getSlice(0)->getVPS();
     1391        }
     1392
     1393        std::vector<Int>::iterator it;
     1394        if( pic->getOutputMark() ) // && pic->getPOC() > m_aiPOCLastDisplay[i])
     1395        {
     1396          it = find( listOfPocs.begin(), listOfPocs.end(), pic->getPOC() ); // Check if already included
     1397          if( it == listOfPocs.end() )  // New POC value - i.e. new AU - add to the list
     1398          {
     1399            listOfPocs.push_back( pic->getPOC() );
     1400          }
     1401          listOfPocsInEachLayer         [i].push_back( pic->getPOC()    );    // POC to be output in each layer
     1402          listOfPocsPositionInEachLayer [i].push_back( picPositionInList  );  // For ease of access
     1403        }
     1404        if( pic->getSlice(0)->isReferenced() || pic->getOutputMark() )
     1405        {
     1406          dpbStatus.m_numPicsInLayer[i]++;  // Count pictures that are "used for reference" or "needed for output"
     1407        }
     1408      }
     1409      iterPic++;
     1410      picPositionInList++;
     1411    }
     1412  }
     1413
     1414  assert( vps != NULL );    // No picture in any DPB?
     1415  std::sort( listOfPocs.begin(), listOfPocs.end() );    // Sort in increasing order of POC
     1416  Int targetLsIdx = vps->getOutputLayerSetIdx( getCommonDecoderParams()->getTargetOutputLayerSetIdx() );
     1417  // Update status
     1418  dpbStatus.m_numAUsNotDisplayed = listOfPocs.size();   // Number of AUs not displayed
     1419  dpbStatus.m_numLayers = vps->getNumLayersInIdList( targetLsIdx );
     1420  dpbStatus.m_numSubDpbs = vps->getNumSubDpbs( vps->getOutputLayerSetIdx(
     1421                                                      this->getCommonDecoderParams()->getTargetOutputLayerSetIdx() ) );
     1422
     1423  for(Int i = 0; i < dpbStatus.m_numLayers; i++)
     1424  {
     1425    dpbStatus.m_numPicsNotDisplayedInLayer[i] = listOfPocsInEachLayer[i].size();
     1426    dpbStatus.m_numPicsInSubDpb[vps->getSubDpbAssigned(targetLsIdx,i)] += dpbStatus.m_numPicsInLayer[i];
     1427  }
     1428  assert( dpbStatus.m_numAUsNotDisplayed != -1 );
     1429
     1430
     1431
     1432#endif
    9901433//! \}
  • trunk/source/App/TAppDecoder/TAppDecTop.h

    r595 r644  
    5555// Class definition
    5656// ====================================================================================================================
    57 
     57#if ALIGNED_BUMPING
     58struct DpbStatus;
     59#endif
    5860/// decoder application class
    5961class TAppDecTop : public TAppDecCfg
     
    98100#endif
    99101  Bool  isNaluWithinTargetDecLayerIdSet ( InputNALUnit* nalu ); ///< check whether given Nalu is within targetDecLayerIdSet
     102#if ALIGNED_BUMPING
     103  Void checkOutputBeforeDecoding(Int layerIdx);
     104  Void checkOutputAfterDecoding();
     105  Void flushAllPictures(Bool outputPictures);
     106  Void flushAllPictures(Int layerId, Bool outputPictures);
     107
     108  Void xOutputAndMarkPic( TComPic *pic, const Char *reconFile, const Int layerID, Int &pocLastDisplay, DpbStatus &dpbStatus);
     109  Void xFindDPBStatus( std::vector<Int> &listOfPocs
     110                            , std::vector<Int> *listOfPocsInEachLayer
     111                            , std::vector<Int> *listOfPocsPositionInEachLayer
     112                            , DpbStatus &dpbStatus
     113                            );
     114
     115  Bool ifInvokeBumpingBeforeDecoding( const DpbStatus &dpbStatus, const DpbStatus &dpbLimit, const Int layerIdx, const Int subDpbIdx );
     116  Bool ifInvokeBumpingAfterDecoding ( const DpbStatus &dpbStatus, const DpbStatus &dpbLimit );
     117  Void bumpingProcess(std::vector<Int> &listOfPocs, std::vector<Int> *listOfPocsInEachLayer, std::vector<Int> *listOfPocsPositionInEachLayer, DpbStatus &dpbStatus);
     118  Void emptyUnusedPicturesNotNeededForOutput();
     119  Void markAllPicturesAsErased();
     120  Void markAllPicturesAsErased(Int layerIdx);
     121  TComVPS* findDpbParametersFromVps(std::vector<Int> const &listOfPocs, std::vector<Int> const *listOfPocsInEachLayer, std::vector<Int> const *listOfPocsPositionInEachLayer, DpbStatus &maxDpbLimit);
     122#endif
    100123};
    101124
     125#if ALIGNED_BUMPING
     126struct DpbStatus
     127{
     128  // Number of AUs and pictures
     129  Int m_numAUsNotDisplayed;
     130  Int m_numPicsNotDisplayedInLayer[MAX_LAYERS];
     131  Int m_numPicsInLayer[MAX_LAYERS];   // Pictures marked as used_for_reference or needed for output in the layer
     132  Int m_numPicsInSubDpb[MAX_LAYERS];  // Pictures marked as used_for_reference or needed for output in the sub-DPB
     133  Bool m_maxLatencyIncrease;
     134  Int m_maxLatencyPictures;
     135 
     136  Int m_numSubDpbs;
     137  Int m_numLayers;
     138
     139  DpbStatus()
     140  {
     141    init();
     142  }
     143  Void init()
     144  {
     145    m_numAUsNotDisplayed = 0;
     146    m_maxLatencyIncrease  = false;
     147    m_maxLatencyPictures  = 0;
     148    ::memset( m_numPicsInLayer,  0, sizeof(m_numPicsInLayer)  );
     149    ::memset( m_numPicsInSubDpb, 0, sizeof(m_numPicsInSubDpb) );
     150    ::memset(m_numPicsNotDisplayedInLayer, 0, sizeof(m_numPicsNotDisplayedInLayer) );
     151    m_numSubDpbs = -1;
     152    m_numLayers = -1;
     153  }
     154};
     155#endif
    102156//! \}
    103157
  • trunk/source/App/TAppEncoder/TAppEncCfg.cpp

    r595 r644  
    385385  string    cfg_scaledRefLayerBottomOffset [MAX_LAYERS];
    386386  Int*      cfg_numScaledRefLayerOffsets[MAX_LAYERS];
     387#if P0312_VERT_PHASE_ADJ
     388  string    cfg_vertPhasePositionEnableFlag[MAX_LAYERS];
     389#endif
    387390
    388391#if O0098_SCALED_REF_LAYER_ID
     
    393396  string*    cfg_scaledRefLayerRightOffsetPtr  [MAX_LAYERS];
    394397  string*    cfg_scaledRefLayerBottomOffsetPtr [MAX_LAYERS];
     398#if P0312_VERT_PHASE_ADJ
     399  string*    cfg_vertPhasePositionEnableFlagPtr[MAX_LAYERS];
     400#endif
     401
    395402#if RC_SHVC_HARMONIZATION
    396403  Bool*   cfg_RCEnableRateControl  [MAX_LAYERS];
     
    451458    {
    452459#if O0098_SCALED_REF_LAYER_ID
    453       cfg_scaledRefLayerIdPtr          [layer] = &cfg_scaledRefLayerId[layer]          ;
    454 #endif
    455       cfg_scaledRefLayerLeftOffsetPtr  [layer] = &cfg_scaledRefLayerLeftOffset[layer]  ;
    456       cfg_scaledRefLayerTopOffsetPtr   [layer] = &cfg_scaledRefLayerTopOffset[layer]   ;
    457       cfg_scaledRefLayerRightOffsetPtr [layer] = &cfg_scaledRefLayerRightOffset[layer] ;
     460      cfg_scaledRefLayerIdPtr          [layer] = &cfg_scaledRefLayerId[layer];
     461#endif
     462      cfg_scaledRefLayerLeftOffsetPtr  [layer] = &cfg_scaledRefLayerLeftOffset[layer];
     463      cfg_scaledRefLayerTopOffsetPtr   [layer] = &cfg_scaledRefLayerTopOffset[layer];
     464      cfg_scaledRefLayerRightOffsetPtr [layer] = &cfg_scaledRefLayerRightOffset[layer];
    458465      cfg_scaledRefLayerBottomOffsetPtr[layer] = &cfg_scaledRefLayerBottomOffset[layer];
     466#if P0312_VERT_PHASE_ADJ
     467      cfg_vertPhasePositionEnableFlagPtr[layer] = &cfg_vertPhasePositionEnableFlag[layer];
     468#endif
    459469    }
    460470#if RC_SHVC_HARMONIZATION
     
    569579                                                                 " bottom-right luma sample of the EL picture, in units of two luma samples")
    570580  ("ScaledRefLayerBottomOffset%d", cfg_scaledRefLayerBottomOffsetPtr,string(""), MAX_LAYERS, "Vertical offset of bottom-right luma sample of scaled base layer picture with respect to"
    571                                                                  " bottom-right luma sample of the EL picture, in units of two luma samples")
     581  " bottom-right luma sample of the EL picture, in units of two luma samples")
     582#if P0312_VERT_PHASE_ADJ
     583  ("VertPhasePositionEnableFlag%d", cfg_vertPhasePositionEnableFlagPtr,string(""), MAX_LAYERS, "VertPhasePositionEnableFlag for layer %d")
     584#endif
    572585#if O0194_DIFFERENT_BITDEPTH_EL_BL
    573586  ("InputBitDepth%d",       cfg_InputBitDepthY,    8, MAX_LAYERS, "Bit-depth of input file for layer %d")
     
    588601#if N0147_IRAP_ALIGN_FLAG
    589602  ("CrossLayerIrapAlignFlag", m_crossLayerIrapAlignFlag, true, "align IRAP across layers" ) 
     603#endif
     604#if P0068_CROSS_LAYER_ALIGNED_IDR_ONLY_FOR_IRAP_FLAG
     605  ("CrossLayerAlignedIdrOnlyFlag", m_crossLayerAlignedIdrOnlyFlag, true, "only idr for IRAP across layers" ) 
    590606#endif
    591607#if O0194_WEIGHTED_PREDICTION_CGS
     
    714730  ("LambdaModifier5,-LM5", m_adLambdaModifier[ 5 ], ( Double )1.0, "Lambda modifier for temporal layer 5")
    715731  ("LambdaModifier6,-LM6", m_adLambdaModifier[ 6 ], ( Double )1.0, "Lambda modifier for temporal layer 6")
    716   ("LambdaModifier7,-LM7", m_adLambdaModifier[ 7 ], ( Double )1.0, "Lambda modifier for temporal layer 7")
    717732#endif
    718733
     
    10701085      assert( strcmp(cfg_scaledRefLayerId[layer].c_str(),  ""));
    10711086#endif
     1087#if P0312_VERT_PHASE_ADJ
    10721088      assert( strcmp(cfg_scaledRefLayerLeftOffset[layer].c_str(),  "") ||
    10731089              strcmp(cfg_scaledRefLayerRightOffset[layer].c_str(), "") ||
    10741090              strcmp(cfg_scaledRefLayerTopOffset[layer].c_str(),   "") ||
    1075               strcmp(cfg_scaledRefLayerBottomOffset[layer].c_str(),"")
    1076             );
     1091              strcmp(cfg_scaledRefLayerBottomOffset[layer].c_str(),"") ||
     1092              strcmp(cfg_vertPhasePositionEnableFlag[layer].c_str(),"") );
     1093#else
     1094      assert( strcmp(cfg_scaledRefLayerLeftOffset[layer].c_str(),  "") ||
     1095              strcmp(cfg_scaledRefLayerRightOffset[layer].c_str(), "") ||
     1096              strcmp(cfg_scaledRefLayerTopOffset[layer].c_str(),   "") ||
     1097              strcmp(cfg_scaledRefLayerBottomOffset[layer].c_str(),"") );
     1098#endif
    10771099    }
    10781100
     
    11501172      }
    11511173    }
     1174#if P0312_VERT_PHASE_ADJ
     1175   // VertPhasePositionEnableFlag //
     1176    if(strcmp(cfg_vertPhasePositionEnableFlag[layer].c_str(),  ""))
     1177    {
     1178      cfgStringToArray( &tempArray, cfg_vertPhasePositionEnableFlag[layer], m_acLayerCfg[layer].m_numScaledRefLayerOffsets, "VertPhasePositionEnableFlag");
     1179      if(tempArray)
     1180      {
     1181        for(Int i = 0; i < m_acLayerCfg[layer].m_numScaledRefLayerOffsets; i++)
     1182        {
     1183          m_acLayerCfg[layer].m_vertPhasePositionEnableFlag[i] = tempArray[i];
     1184        }
     1185        delete [] tempArray; tempArray = NULL;
     1186      }
     1187    }
     1188#endif
    11521189  }
    11531190#if VPS_EXTN_DIRECT_REF_LAYERS
     
    23422379  printf("Cross layer IRAP alignment    : %d\n", m_crossLayerIrapAlignFlag );
    23432380#endif
     2381#if P0068_CROSS_LAYER_ALIGNED_IDR_ONLY_FOR_IRAP_FLAG
     2382  printf("IDR only for IRAP             : %d\n", m_crossLayerAlignedIdrOnlyFlag );
     2383#endif
    23442384#if O0194_WEIGHTED_PREDICTION_CGS
    23452385  printf("InterLayerWeightedPred        : %d\n", m_useInterLayerWeightedPred );
  • trunk/source/App/TAppEncoder/TAppEncCfg.h

    r595 r644  
    384384  Bool      m_crossLayerIrapAlignFlag;
    385385#endif
     386#if P0068_CROSS_LAYER_ALIGNED_IDR_ONLY_FOR_IRAP_FLAG
     387  Bool      m_crossLayerAlignedIdrOnlyFlag;
     388#endif
    386389#if O0149_CROSS_LAYER_BLA_FLAG
    387390  Bool      m_crossLayerBLAFlag;
  • trunk/source/App/TAppEncoder/TAppEncLayerCfg.cpp

    r540 r644  
    6060  ::memset(m_scaledRefLayerRightOffset,  0, sizeof(m_scaledRefLayerRightOffset));
    6161  ::memset(m_scaledRefLayerBottomOffset, 0, sizeof(m_scaledRefLayerBottomOffset));
     62#if P0312_VERT_PHASE_ADJ
     63  ::memset(m_vertPhasePositionEnableFlag, 0, sizeof(m_vertPhasePositionEnableFlag));
     64#endif
    6265}
    6366
  • trunk/source/App/TAppEncoder/TAppEncLayerCfg.h

    r588 r644  
    9797  Int       m_scaledRefLayerRightOffset [MAX_LAYERS];
    9898  Int       m_scaledRefLayerBottomOffset[MAX_LAYERS];
     99#if P0312_VERT_PHASE_ADJ
     100  Bool      m_vertPhasePositionEnableFlag[MAX_LAYERS];
     101#endif
     102
    99103#if O0194_DIFFERENT_BITDEPTH_EL_BL
    100104  Int       m_inputBitDepthY;                               ///< bit-depth of input file (luma component)
  • trunk/source/App/TAppEncoder/TAppEncTop.cpp

    r597 r644  
    570570        m_acTEncTop[layer].setScaledRefLayerId(i, m_acLayerCfg[layer].m_scaledRefLayerId[i]);
    571571#endif
     572#if P0312_VERT_PHASE_ADJ
     573        m_acTEncTop[layer].setVertPhasePositionEnableFlag( i, m_acLayerCfg[layer].m_vertPhasePositionEnableFlag[i] );
     574        m_acTEncTop[layer].getScaledRefLayerWindow(i).setWindow( 2*m_acLayerCfg[layer].m_scaledRefLayerLeftOffset[i], 2*m_acLayerCfg[layer].m_scaledRefLayerRightOffset[i],
     575                                                  2*m_acLayerCfg[layer].m_scaledRefLayerTopOffset[i], 2*m_acLayerCfg[layer].m_scaledRefLayerBottomOffset[i], m_acLayerCfg[layer].m_vertPhasePositionEnableFlag[i] );
     576#else
    572577        m_acTEncTop[layer].getScaledRefLayerWindow(i).setWindow( 2*m_acLayerCfg[layer].m_scaledRefLayerLeftOffset[i], 2*m_acLayerCfg[layer].m_scaledRefLayerRightOffset[i],
    573578                                                  2*m_acLayerCfg[layer].m_scaledRefLayerTopOffset[i], 2*m_acLayerCfg[layer].m_scaledRefLayerBottomOffset[i]);
     579#endif
    574580      }
    575581    }
     
    956962#endif
    957963    m_acTEncTop[layer].init(isFieldCoding);
     964#if P0182_VPS_VUI_PS_FLAG
     965    m_acTEncTop[layer].getVPS()->setSPSId(layer, m_acTEncTop[layer].getSPS()->getSPSId());
     966    m_acTEncTop[layer].getVPS()->setPPSId(layer, m_acTEncTop[layer].getPPS()->getPPSId());
     967#endif
    958968  }
    959969#if VPS_RENAME
     
    11931203        // at the encoder, modify below
    11941204        Int oldValue = vps->getMaxVpsDecPicBufferingMinus1( i, vps->getSubDpbAssigned( layerSetIdxForOutputLayerSet, k ), j );
    1195         oldValue += vps->getMaxVpsLayerDecPicBuffMinus1( i, k, j );
     1205        oldValue += vps->getMaxVpsLayerDecPicBuffMinus1( i, k, j ) + 1;
    11961206        vps->setMaxVpsDecPicBufferingMinus1( i, vps->getSubDpbAssigned( layerSetIdxForOutputLayerSet, k ), j, oldValue );
    11971207#else
     
    12001210        maxNumReorderPics       = std::max( maxNumReorderPics, m_acTEncTop[layerId].getNumReorderPics(j));
    12011211      }
     1212#if RESOLUTION_BASED_DPB
     1213      for(Int k = 0; k < vps->getNumSubDpbs(i); k++)
     1214      {
     1215        // Decrement m_maxVpsDecPicBufferingMinus1
     1216        Int oldValue = vps->getMaxVpsDecPicBufferingMinus1( i, vps->getSubDpbAssigned( layerSetIdxForOutputLayerSet, k ), j );
     1217        vps->setMaxVpsDecPicBufferingMinus1( i, vps->getSubDpbAssigned( layerSetIdxForOutputLayerSet, k ), j, oldValue - 1 );
     1218      }
     1219#endif
    12021220      vps->setMaxVpsNumReorderPics(i, j, maxNumReorderPics);
    12031221      vps->determineSubDpbInfoFlags();
     
    12861304    vps->setCrossLayerPictureTypeAlignFlag( m_crossLayerPictureTypeAlignFlag );
    12871305#endif
     1306#if P0068_CROSS_LAYER_ALIGNED_IDR_ONLY_FOR_IRAP_FLAG
     1307    vps->setCrossLayerAlignedIdrOnlyFlag( m_crossLayerAlignedIdrOnlyFlag );
     1308#endif
    12881309#if N0147_IRAP_ALIGN_FLAG
    12891310    vps->setCrossLayerIrapAlignFlag( m_crossLayerIrapAlignFlag );
     
    13271348#endif
    13281349
     1350#if P0300_ALT_OUTPUT_LAYER_FLAG
     1351  for (Int k = 0; k < MAX_VPS_LAYER_SETS_PLUS1; k++)
     1352  {
     1353    vps->setAltOuputLayerFlag( k, m_altOutputLayerFlag );
     1354  }
     1355#else
    13291356#if O0153_ALT_OUTPUT_LAYER_FLAG
    13301357  vps->setAltOuputLayerFlag( m_altOutputLayerFlag );
     1358#endif
     1359#endif
     1360
     1361#if P0312_VERT_PHASE_ADJ
     1362  Bool vpsVuiVertPhaseInUseFlag = false;
     1363  for( UInt layerId = 1; layerId < m_numLayers; layerId++ )
     1364  {
     1365    for( i = 0; i < m_acLayerCfg[layerId].m_numScaledRefLayerOffsets; i++ )
     1366    {
     1367      if( m_acTEncTop[layerId].getVertPhasePositionEnableFlag(i) )
     1368      {
     1369        vpsVuiVertPhaseInUseFlag = true;
     1370        break;
     1371      }
     1372    }
     1373  }
     1374  vps->setVpsVuiVertPhaseInUseFlag( vpsVuiVertPhaseInUseFlag );
     1375#endif
     1376
     1377#if O0164_MULTI_LAYER_HRD
     1378  vps->setVpsVuiBspHrdPresentFlag(false);
     1379  TEncTop *pcCfg = &m_acTEncTop[0];
     1380  if( pcCfg->getBufferingPeriodSEIEnabled() )
     1381  {
     1382    vps->setVpsVuiBspHrdPresentFlag(true);
     1383    vps->setVpsNumBspHrdParametersMinus1(vps->getNumLayerSets() - 2);
     1384    vps->createBspHrdParamBuffer(vps->getVpsNumBspHrdParametersMinus1() + 1);
     1385    for ( i = 0; i <= vps->getVpsNumBspHrdParametersMinus1(); i++ )
     1386    {
     1387      vps->setBspCprmsPresentFlag(i, true);
     1388
     1389      UInt layerId = i + 1;
     1390      TEncTop *pcCfgLayer = &m_acTEncTop[layerId];
     1391
     1392      Int iPicWidth         = pcCfgLayer->getSourceWidth();
     1393      Int iPicHeight        = pcCfgLayer->getSourceHeight();
     1394      UInt uiWidthInCU       = ( iPicWidth %m_uiMaxCUWidth  ) ? iPicWidth /m_uiMaxCUWidth  + 1 : iPicWidth /m_uiMaxCUWidth;
     1395      UInt uiHeightInCU      = ( iPicHeight%m_uiMaxCUHeight ) ? iPicHeight/m_uiMaxCUHeight + 1 : iPicHeight/m_uiMaxCUHeight;
     1396      UInt uiNumCUsInFrame   = uiWidthInCU * uiHeightInCU;
     1397
     1398      UInt maxCU = pcCfgLayer->getSliceArgument() >> ( m_uiMaxCUDepth << 1);
     1399      UInt numDU = ( pcCfgLayer->getSliceMode() == 1 ) ? ( uiNumCUsInFrame / maxCU ) : ( 0 );
     1400      if( uiNumCUsInFrame % maxCU != 0 || numDU == 0 )
     1401      {
     1402        numDU ++;
     1403      }
     1404      vps->getBspHrd(i)->setNumDU( numDU );
     1405      vps->setBspHrdParameters( i, pcCfgLayer->getFrameRate(), numDU, pcCfgLayer->getTargetBitrate(), ( pcCfgLayer->getIntraPeriod() > 0 ) );
     1406    }
     1407    for(UInt h = 1; h <= (vps->getNumLayerSets()-1); h++)
     1408    {
     1409      vps->setNumBitstreamPartitions(h, 1);
     1410      for( i = 0; i < vps->getNumBitstreamPartitions(h); i++ )
     1411      {
     1412        for( UInt j = 0; j <= (vps->getMaxLayers()-1); j++ )
     1413        {
     1414          if (vps->getLayerIdIncludedFlag(h, j) && h == j)
     1415          {
     1416            vps->setLayerInBspFlag(h, i, j, true);
     1417          }
     1418        }
     1419      }
     1420      vps->setNumBspSchedCombinations(h, 1);
     1421      for( i = 0; i < vps->getNumBspSchedCombinations(h); i++ )
     1422      {
     1423        for( UInt j = 0; j < vps->getNumBitstreamPartitions(h); j++ )
     1424        {
     1425          vps->setBspCombHrdIdx(h, i, j, 0);
     1426          vps->setBspCombSchedIdx(h, i, j, 0);
     1427        }
     1428      }
     1429    }
     1430  }
    13311431#endif
    13321432
  • trunk/source/Lib/TLibCommon/CommonDef.h

    r595 r644  
    5858#if SVC_EXTENSION
    5959#include <vector>
    60 #define NV_VERSION        "5.0 (HM-13.0)"                 ///< Current software version
     60#define NV_VERSION        "5.1 (HM-13.0)"                 ///< Current software version
    6161#else
    6262#define NV_VERSION        "13.0"                ///< Current software version
     
    178178
    179179// Explicit temporal layer QP offset
    180 #define MAX_TLAYER                  8           ///< max number of temporal layer
     180#define MAX_TLAYER                  7           ///< max number of temporal layer
    181181#define HB_LAMBDA_FOR_LDC           1           ///< use of B-style lambda for non-key pictures in low-delay mode
    182182
     
    288288  std::vector<Int> *m_targetDecLayerIdSet;
    289289  Bool m_valueCheckedFlag;
     290  Int m_highestTId;
    290291public:
    291292  CommonDecoderParams():
     
    294295    , m_targetDecLayerIdSet(NULL)
    295296    , m_valueCheckedFlag(false)
     297    , m_highestTId(6)
    296298 {}
    297299
     
    308310  Bool getValueCheckedFlag()            { return m_valueCheckedFlag;}
    309311 
     312  Void setHighestTId(const Int x) { m_highestTId = x; }
     313  Int  getHighestTId()            { return m_highestTId; }
    310314};
    311315#endif
  • trunk/source/Lib/TLibCommon/SEI.h

    r595 r644  
    4040//! \{
    4141class TComSPS;
     42#if O0164_MULTI_LAYER_HRD
     43class TComHRD;
     44#endif
    4245
    4346/**
     
    8184   ,SUB_BITSTREAM_PROPERTY               = 139    // Final PayloadType to be defined after finalization
    8285#endif
     86#if O0164_MULTI_LAYER_HRD
     87   ,BSP_NESTING                          = 140
     88   ,BSP_INITIAL_ARRIVAL_TIME             = 141
     89   ,BSP_HRD                              = 142
     90#endif
    8391  };
    8492 
     
    157165  , m_cpbDelayOffset      (0)
    158166  , m_dpbDelayOffset      (0)
     167#if P0138_USE_ALT_CPB_PARAMS_FLAG
     168  , m_useAltCpbParamsFlagPresent(false)
     169  , m_useAltCpbParamsFlag (false)
     170#endif
    159171  {
    160172    ::memset(m_initialCpbRemovalDelay, 0, sizeof(m_initialCpbRemovalDelay));
     
    175187  Bool m_concatenationFlag;
    176188  UInt m_auCpbRemovalDelayDelta;
     189#if P0138_USE_ALT_CPB_PARAMS_FLAG
     190  Bool m_useAltCpbParamsFlagPresent;
     191  Bool m_useAltCpbParamsFlag;
     192#endif
    177193};
    178194class SEIPictureTiming : public SEI
     
    440456Void deleteSEIs (SEIMessages &seiList);
    441457
     458#if O0164_MULTI_LAYER_HRD
     459
     460class SEIBspNesting : public SEI
     461{
     462public:
     463  PayloadType payloadType() const { return BSP_NESTING; }
     464
     465  SEIBspNesting() {}
     466  virtual ~SEIBspNesting()
     467  {
     468    if (!m_callerOwnsSEIs)
     469    {
     470      deleteSEIs(m_nestedSEIs);
     471    }
     472  }
     473
     474  Int  m_bspIdx;
     475  Bool  m_callerOwnsSEIs;
     476  SEIMessages m_nestedSEIs;
     477};
     478
     479class SEIBspInitialArrivalTime : public SEI
     480{
     481public:
     482  PayloadType payloadType() const { return BSP_INITIAL_ARRIVAL_TIME; }
     483
     484  SEIBspInitialArrivalTime () {}
     485  virtual ~SEIBspInitialArrivalTime () {}
     486
     487  UInt m_nalInitialArrivalDelay[256];
     488  UInt m_vclInitialArrivalDelay[256];
     489};
     490
     491class SEIBspHrd : public SEI
     492{
     493public:
     494  PayloadType payloadType() const { return BSP_HRD; }
     495
     496  SEIBspHrd () {}
     497  virtual ~SEIBspHrd () {}
     498
     499  UInt m_seiNumBspHrdParametersMinus1;
     500  Bool m_seiBspCprmsPresentFlag[MAX_VPS_LAYER_SETS_PLUS1];
     501  UInt m_seiNumBitstreamPartitionsMinus1[MAX_VPS_LAYER_SETS_PLUS1];
     502  Bool m_seiLayerInBspFlag[MAX_VPS_LAYER_SETS_PLUS1][8][MAX_LAYERS];
     503  UInt m_seiNumBspSchedCombinationsMinus1[MAX_VPS_LAYER_SETS_PLUS1];
     504  UInt m_seiBspCombHrdIdx[MAX_VPS_LAYER_SETS_PLUS1][16][16];
     505  UInt m_seiBspCombScheddx[MAX_VPS_LAYER_SETS_PLUS1][16][16];
     506  UInt m_vpsMaxLayers;
     507  Bool m_layerIdIncludedFlag[MAX_VPS_LAYER_SETS_PLUS1][MAX_VPS_LAYER_ID_PLUS1];
     508
     509  TComHRD *hrd;
     510};
     511
     512#endif
     513
    442514class SEIScalableNesting : public SEI
    443515{
  • trunk/source/Lib/TLibCommon/TComBitStream.cpp

    r595 r644  
    229229  UChar saved_held_bits = m_held_bits;
    230230  UInt saved_fifo_idx = m_fifo_idx;
     231#if P0138_USE_ALT_CPB_PARAMS_FLAG
     232  UInt saved_numBitsRead = m_numBitsRead;
     233#endif
    231234
    232235  UInt num_bits_to_read = min(uiNumberOfBits, getNumBitsLeft());
     
    237240  m_held_bits = saved_held_bits;
    238241  m_num_held_bits = saved_num_held_bits;
     242#if P0138_USE_ALT_CPB_PARAMS_FLAG
     243  m_numBitsRead = saved_numBitsRead;
     244#endif
    239245}
    240246
  • trunk/source/Lib/TLibCommon/TComPrediction.cpp

    r595 r644  
    768768#if O0215_PHASE_ALIGNMENT
    769769#if O0194_JOINT_US_BITSHIFT
    770 Void TComPrediction::upsampleBasePic( TComSlice* currSlice, UInt refLayerIdc, TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic, const Window window, bool phaseAlignFlag )
     770Void TComPrediction::upsampleBasePic( TComSlice* currSlice, UInt refLayerIdc, TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic, const Window window, Bool phaseAlignFlag )
    771771{
    772772  m_cUsf.upsampleBasePic( currSlice, refLayerIdc, pcUsPic, pcBasePic, pcTempPic, window, phaseAlignFlag );
    773773}
    774774#else
    775 Void TComPrediction::upsampleBasePic( UInt refLayerIdc, TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic, const Window window, bool phaseAlignFlag )
     775Void TComPrediction::upsampleBasePic( UInt refLayerIdc, TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic, const Window window, Bool phaseAlignFlag )
    776776{
    777777  m_cUsf.upsampleBasePic( refLayerIdc, pcUsPic, pcBasePic, pcTempPic, window, phaseAlignFlag );
  • trunk/source/Lib/TLibCommon/TComPrediction.h

    r595 r644  
    4949
    5050#if SVC_UPSAMPLING
    51 #include "TComDataCU.h"
    5251#include "TComUpsampleFilter.h"
    5352#endif
     
    122121#if O0215_PHASE_ALIGNMENT
    123122#if O0194_JOINT_US_BITSHIFT
    124   Void upsampleBasePic( TComSlice* currSlice, UInt refLayerIdc, TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic, const Window window, bool phaseAlignFlag );
     123  Void upsampleBasePic( TComSlice* currSlice, UInt refLayerIdc, TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic, const Window window, Bool phaseAlignFlag );
    125124#else
    126   Void upsampleBasePic( UInt refLayerIdc, TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic, const Window window, bool phaseAlignFlag );
     125  Void upsampleBasePic( UInt refLayerIdc, TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic, const Window window, Bool phaseAlignFlag );
    127126#endif
    128127#else
  • trunk/source/Lib/TLibCommon/TComRom.h

    r595 r644  
    273273#if SVC_EXTENSION
    274274#if FAST_INTRA_SHVC
    275 extern       UInt g_reducedSetIntraModes[NUM_INTRA_MODE-1];
    276 extern       UInt g_predefSetIntraModes[NUM_INTRA_MODE-1];
     275extern UInt g_reducedSetIntraModes[NUM_INTRA_MODE-1];
     276extern UInt g_predefSetIntraModes[NUM_INTRA_MODE-1];
    277277#endif
    278278extern Int g_mvScalingFactor  [MAX_LAYERS][2];
  • trunk/source/Lib/TLibCommon/TComSampleAdaptiveOffset.cpp

    r595 r644  
    4444//! \ingroup TLibCommon
    4545//! \{
     46#if !SVC_EXTENSION
    4647UInt g_saoMaxOffsetQVal[NUM_SAO_COMPONENTS];
     48#endif
    4749
    4850SAOOffset::SAOOffset()
     
    160162    Int bitDepthSample = (compIdx == SAO_Y)?g_bitDepthY:g_bitDepthC;
    161163    m_offsetStepLog2  [compIdx] = max(bitDepthSample - MAX_SAO_TRUNCATED_BITDEPTH, 0);
     164#if SVC_EXTENSION
     165    m_saoMaxOffsetQVal[compIdx] = (1<<(min(bitDepthSample,MAX_SAO_TRUNCATED_BITDEPTH)-5))-1; //Table 9-32, inclusive
     166#else
    162167    g_saoMaxOffsetQVal[compIdx] = (1<<(min(bitDepthSample,MAX_SAO_TRUNCATED_BITDEPTH)-5))-1; //Table 9-32, inclusive
     168#endif
    163169  }
    164170
     
    168174    Int bitDepthSample = (compIdx == SAO_Y)?g_bitDepthY:g_bitDepthC; //exclusive
    169175    Int maxSampleValue = (1<< bitDepthSample); //exclusive
     176#if SVC_EXTENSION
     177    Int maxOffsetValue = (m_saoMaxOffsetQVal[compIdx] << m_offsetStepLog2[compIdx]);
     178#else
    170179    Int maxOffsetValue = (g_saoMaxOffsetQVal[compIdx] << m_offsetStepLog2[compIdx]);
     180#endif
    171181
    172182    m_offsetClipTable[compIdx] = new Int[(maxSampleValue + maxOffsetValue -1)+ (maxOffsetValue)+1 ]; //positive & negative range plus 0
  • trunk/source/Lib/TLibCommon/TComSampleAdaptiveOffset.h

    r595 r644  
    5353// Class definition
    5454// ====================================================================================================================
     55#if !SVC_EXTENSION
    5556extern UInt g_saoMaxOffsetQVal[NUM_SAO_COMPONENTS];
     57#endif
    5658
    5759class TComSampleAdaptiveOffset
     
    6971  Void reconstructBlkSAOParams(TComPic* pic, SAOBlkParam* saoBlkParams);
    7072  Void PCMLFDisableProcess (TComPic* pcPic);
     73#if SVC_EXTENSION
     74  UInt* getSaoMaxOffsetQVal() { return m_saoMaxOffsetQVal; }
     75#endif
    7176protected:
    7277  Void offsetBlock(Int compIdx, Int typeIdx, Int* offset, Pel* srcBlk, Pel* resBlk, Int srcStride, Int resStride,  Int width, Int height
     
    101106  Int*   m_offsetClipTable[NUM_SAO_COMPONENTS];
    102107  Short* m_signTable;
    103 
     108#if SVC_EXTENSION
     109  UInt m_saoMaxOffsetQVal[NUM_SAO_COMPONENTS];
     110#endif
    104111};
    105112
  • trunk/source/Lib/TLibCommon/TComSlice.cpp

    r597 r644  
    111111, m_bCrossLayerBLAFlag            ( false )
    112112#endif
     113#if NO_OUTPUT_OF_PRIOR_PICS
     114, m_noOutputOfPriorPicsFlag       ( false )
     115, m_noRaslOutputFlag              ( false )
     116, m_handleCraAsBlaFlag            ( false )
     117#endif
     118#if POC_RESET_IDC_SIGNALLING
     119, m_pocResetIdc                   ( 0 )
     120, m_pocResetPeriodId              ( 0 )
     121, m_fullPocResetFlag              ( false )
     122, m_pocLsbVal                     ( 0 )
     123, m_pocMsbVal                     ( 0 )
     124, m_pocMsbValRequiredFlag         ( false )
     125, m_pocMsbValPresentFlag          ( false )
     126#endif
    113127#endif //SVC_EXTENSION
    114128{
     
    120134  m_interLayerPredEnabledFlag = 0;
    121135  ::memset( m_interLayerPredLayerIdc, 0, sizeof(m_interLayerPredLayerIdc) );
     136#if P0312_VERT_PHASE_ADJ
     137  ::memset( m_vertPhasePositionFlag, 0, sizeof(m_vertPhasePositionFlag) );
     138#endif
    122139#endif //SVC_EXTENSION
    123140
     
    194211      || getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA;
    195212}
     213#if NO_OUTPUT_OF_PRIOR_PICS
     214Bool TComSlice::getBlaPicFlag       ()
     215{
     216    return  getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_N_LP
     217    || getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL
     218    || getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP;
     219}
     220Bool TComSlice::getCraPicFlag       ()
     221{
     222    return getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA;
     223}
     224#endif
    196225
    197226/**
     
    848877
    849878#if SVC_EXTENSION
    850   if( m_eSliceType == I_SLICE || ( m_pcSPS->getLayerId() &&
     879  if( m_eSliceType == I_SLICE || ( m_layerId &&
    851880    (m_eNalUnitType >= NAL_UNIT_CODED_SLICE_BLA_W_LP) &&
    852881    (m_eNalUnitType <= NAL_UNIT_CODED_SLICE_CRA) ) )
     
    872901  {
    873902    numRpsCurrTempList += m_activeNumILRRefIdx;
    874 }
     903  }
    875904#endif
    876905
     
    11051134  m_interLayerPredEnabledFlag  = pSrc->m_interLayerPredEnabledFlag;
    11061135  memcpy( m_interLayerPredLayerIdc, pSrc->m_interLayerPredLayerIdc, sizeof( m_interLayerPredLayerIdc ) );
     1136#if P0312_VERT_PHASE_ADJ
     1137  memcpy( m_vertPhasePositionFlag, pSrc->m_vertPhasePositionFlag, sizeof( m_vertPhasePositionFlag ) );
     1138#endif
    11071139#endif
    11081140  m_pcSPS                = pSrc->m_pcSPS;
     
    13891421  Int i, isReference;
    13901422
     1423#if !ALIGNED_BUMPING
    13911424  checkLeadingPictureRestrictions(rcListPic);
     1425#endif
    13921426
    13931427  // loop through all pictures in the reference picture buffer
     
    20712105  m_crossLayerIrapAlignFlag = true;
    20722106#endif
     2107#if P0068_CROSS_LAYER_ALIGNED_IDR_ONLY_FOR_IRAP_FLAG
     2108  m_crossLayerAlignedIdrOnlyFlag = false;
     2109#endif
    20732110#if N0120_MAX_TID_REF_PRESENT_FLAG
    20742111  m_maxTidRefPresentFlag = true;
     
    24552492  return -1;  // Layer not found
    24562493}
     2494#if O0164_MULTI_LAYER_HRD
     2495Void TComVPS::setBspHrdParameters( UInt hrdIdx, UInt frameRate, UInt numDU, UInt bitRate, Bool randomAccess )
     2496{
     2497  if( !getVpsVuiBspHrdPresentFlag() )
     2498  {
     2499    return;
     2500  }
     2501
     2502  TComHRD *hrd = getBspHrd(hrdIdx);
     2503
     2504  Bool rateCnt = ( bitRate > 0 );
     2505  hrd->setNalHrdParametersPresentFlag( rateCnt );
     2506  hrd->setVclHrdParametersPresentFlag( rateCnt );
     2507
     2508  hrd->setSubPicCpbParamsPresentFlag( ( numDU > 1 ) );
     2509
     2510  if( hrd->getSubPicCpbParamsPresentFlag() )
     2511  {
     2512    hrd->setTickDivisorMinus2( 100 - 2 );                          //
     2513    hrd->setDuCpbRemovalDelayLengthMinus1( 7 );                    // 8-bit precision ( plus 1 for last DU in AU )
     2514    hrd->setSubPicCpbParamsInPicTimingSEIFlag( true );
     2515    hrd->setDpbOutputDelayDuLengthMinus1( 5 + 7 );                 // With sub-clock tick factor of 100, at least 7 bits to have the same value as AU dpb delay
     2516  }
     2517  else
     2518  {
     2519    hrd->setSubPicCpbParamsInPicTimingSEIFlag( false ); 
     2520  }
     2521
     2522  hrd->setBitRateScale( 4 );                                       // in units of 2~( 6 + 4 ) = 1,024 bps
     2523  hrd->setCpbSizeScale( 6 );                                       // in units of 2~( 4 + 4 ) = 1,024 bit
     2524  hrd->setDuCpbSizeScale( 6 );                                       // in units of 2~( 4 + 4 ) = 1,024 bit
     2525
     2526  hrd->setInitialCpbRemovalDelayLengthMinus1(15);                  // assuming 0.5 sec, log2( 90,000 * 0.5 ) = 16-bit
     2527  if( randomAccess )
     2528  {
     2529    hrd->setCpbRemovalDelayLengthMinus1(5);                        // 32 = 2^5 (plus 1)
     2530    hrd->setDpbOutputDelayLengthMinus1 (5);                        // 32 + 3 = 2^6
     2531  }
     2532  else
     2533  {
     2534    hrd->setCpbRemovalDelayLengthMinus1(9);                        // max. 2^10
     2535    hrd->setDpbOutputDelayLengthMinus1 (9);                        // max. 2^10
     2536  }
     2537
     2538  /*
     2539  Note: only the case of "vps_max_temporal_layers_minus1 = 0" is supported.
     2540  */
     2541  Int i, j;
     2542  UInt birateValue, cpbSizeValue;
     2543  UInt ducpbSizeValue;
     2544  UInt duBitRateValue = 0;
     2545
     2546  for( i = 0; i < MAX_TLAYER; i ++ )
     2547  {
     2548    hrd->setFixedPicRateFlag( i, 1 );
     2549    hrd->setPicDurationInTcMinus1( i, 0 );
     2550    hrd->setLowDelayHrdFlag( i, 0 );
     2551    hrd->setCpbCntMinus1( i, 0 );
     2552
     2553    birateValue  = bitRate;
     2554    cpbSizeValue = bitRate;                                     // 1 second
     2555    ducpbSizeValue = bitRate/numDU;
     2556    duBitRateValue = bitRate;
     2557    for( j = 0; j < ( hrd->getCpbCntMinus1( i ) + 1 ); j ++ )
     2558    {
     2559      hrd->setBitRateValueMinus1( i, j, 0, ( birateValue  - 1 ) );
     2560      hrd->setCpbSizeValueMinus1( i, j, 0, ( cpbSizeValue - 1 ) );
     2561      hrd->setDuCpbSizeValueMinus1( i, j, 0, ( ducpbSizeValue - 1 ) );
     2562      hrd->setCbrFlag( i, j, 0, ( j == 0 ) );
     2563
     2564      hrd->setBitRateValueMinus1( i, j, 1, ( birateValue  - 1) );
     2565      hrd->setCpbSizeValueMinus1( i, j, 1, ( cpbSizeValue - 1 ) );
     2566      hrd->setDuCpbSizeValueMinus1( i, j, 1, ( ducpbSizeValue - 1 ) );
     2567      hrd->setDuBitRateValueMinus1( i, j, 1, ( duBitRateValue - 1 ) );
     2568      hrd->setCbrFlag( i, j, 1, ( j == 0 ) );
     2569    }
     2570  }
     2571}
     2572#endif
    24572573// RepFormat Assignment operator
    24582574RepFormat& RepFormat::operator= (const RepFormat &other)
     
    25482664  ::memset(m_ltRefPicPocLsbSps, 0, sizeof(m_ltRefPicPocLsbSps));
    25492665  ::memset(m_usedByCurrPicLtSPSFlag, 0, sizeof(m_usedByCurrPicLtSPSFlag));
     2666
     2667#if P0312_VERT_PHASE_ADJ
     2668  ::memset(m_vertPhasePositionEnableFlag, 0, sizeof(m_vertPhasePositionEnableFlag));
     2669#endif
    25502670}
    25512671
     
    27362856, m_scalingListRefLayerId ( 0 )
    27372857#endif
     2858#if POC_RESET_IDC
     2859, m_pocResetInfoPresentFlag   (false)
     2860#endif
    27382861{
    27392862  m_scalingList = new TComScalingList;
     
    34053528    //set reference picture POC of each ILP reference
    34063529    Int thePoc = ilpPic[refLayerIdc]->getPOC();
    3407     assert(thePoc >= 0);
    34083530    assert(thePoc == pcRefPicBL->getPOC());
    34093531
  • trunk/source/Lib/TLibCommon/TComSlice.h

    r595 r644  
    231231{
    232232  ProfileTierLevel m_generalPTL;
    233   ProfileTierLevel m_subLayerPTL[6];      // max. value of max_sub_layers_minus1 is 6
    234   Bool m_subLayerProfilePresentFlag[6];
    235   Bool m_subLayerLevelPresentFlag[6];
     233  ProfileTierLevel m_subLayerPTL    [MAX_TLAYER-1];      // max. value of max_sub_layers_minus1 is MAX_TLAYER-1 ( = 6 )
     234  Bool m_subLayerProfilePresentFlag [MAX_TLAYER-1];
     235  Bool m_subLayerLevelPresentFlag   [MAX_TLAYER-1];
    236236
    237237public:
     
    568568  Bool       m_crossLayerIrapAlignFlag;
    569569#endif
     570#if P0068_CROSS_LAYER_ALIGNED_IDR_ONLY_FOR_IRAP_FLAG
     571  Bool       m_crossLayerAlignedIdrOnlyFlag;
     572#endif
    570573#if O0225_MAX_TID_FOR_REF_LAYERS
    571574  UInt       m_maxTidIlRefPicsPlus1[MAX_VPS_LAYER_ID_PLUS1 - 1][MAX_VPS_LAYER_ID_PLUS1];
     
    599602#endif
    600603#if N0160_VUI_EXT_ILP_REF   
    601   Bool        m_ilpRestrictedRefLayersFlag;
    602   Int         m_minSpatialSegmentOffsetPlus1[MAX_VPS_LAYER_ID_PLUS1][MAX_VPS_LAYER_ID_PLUS1];
    603   Bool        m_ctuBasedOffsetEnabledFlag   [MAX_VPS_LAYER_ID_PLUS1][MAX_VPS_LAYER_ID_PLUS1];
    604   Int         m_minHorizontalCtuOffsetPlus1 [MAX_VPS_LAYER_ID_PLUS1][MAX_VPS_LAYER_ID_PLUS1];
     604  Bool       m_ilpRestrictedRefLayersFlag;
     605  Int        m_minSpatialSegmentOffsetPlus1[MAX_VPS_LAYER_ID_PLUS1][MAX_VPS_LAYER_ID_PLUS1];
     606  Bool       m_ctuBasedOffsetEnabledFlag   [MAX_VPS_LAYER_ID_PLUS1][MAX_VPS_LAYER_ID_PLUS1];
     607  Int        m_minHorizontalCtuOffsetPlus1 [MAX_VPS_LAYER_ID_PLUS1][MAX_VPS_LAYER_ID_PLUS1];
    605608#endif
    606609#if VPS_VUI_VIDEO_SIGNAL
    607   Bool        m_vidSigPresentVpsFlag;
    608   Int         m_vpsVidSigInfo;
    609   Int         m_vpsVidSigIdx[MAX_VPS_LAYER_ID_PLUS1];
    610   Int         m_vpsVidFormat[16];
    611   Bool        m_vpsFullRangeFlag[16];
    612   Int         m_vpsColorPrimaries[16];
    613   Int         m_vpsTransChar[16];
    614   Int         m_vpsMatCoeff[16];
     610  Bool       m_vidSigPresentVpsFlag;
     611  Int        m_vpsVidSigInfo;
     612  Int        m_vpsVidSigIdx[MAX_VPS_LAYER_ID_PLUS1];
     613  Int        m_vpsVidFormat[16];
     614  Bool       m_vpsFullRangeFlag[16];
     615  Int        m_vpsColorPrimaries[16];
     616  Int        m_vpsTransChar[16];
     617  Int        m_vpsMatCoeff[16];
    615618#endif
    616619#if VPS_VUI_BITRATE_PICRATE
    617   Bool        m_bitRatePresentVpsFlag;
    618   Bool        m_picRatePresentVpsFlag;
    619   Bool        m_bitRatePresentFlag  [MAX_VPS_LAYER_SETS_PLUS1][MAX_TLAYER];
    620   Bool        m_picRatePresentFlag  [MAX_VPS_LAYER_SETS_PLUS1][MAX_TLAYER];
    621   Int         m_avgBitRate          [MAX_VPS_LAYER_SETS_PLUS1][MAX_TLAYER];
    622   Int         m_maxBitRate          [MAX_VPS_LAYER_SETS_PLUS1][MAX_TLAYER];
    623   Int         m_constPicRateIdc     [MAX_VPS_LAYER_SETS_PLUS1][MAX_TLAYER];
    624   Int         m_avgPicRate          [MAX_VPS_LAYER_SETS_PLUS1][MAX_TLAYER];
    625 #endif
     620  Bool       m_bitRatePresentVpsFlag;
     621  Bool       m_picRatePresentVpsFlag;
     622  Bool       m_bitRatePresentFlag  [MAX_VPS_LAYER_SETS_PLUS1][MAX_TLAYER];
     623  Bool       m_picRatePresentFlag  [MAX_VPS_LAYER_SETS_PLUS1][MAX_TLAYER];
     624  Int        m_avgBitRate          [MAX_VPS_LAYER_SETS_PLUS1][MAX_TLAYER];
     625  Int        m_maxBitRate          [MAX_VPS_LAYER_SETS_PLUS1][MAX_TLAYER];
     626  Int        m_constPicRateIdc     [MAX_VPS_LAYER_SETS_PLUS1][MAX_TLAYER];
     627  Int        m_avgPicRate          [MAX_VPS_LAYER_SETS_PLUS1][MAX_TLAYER];
     628#endif
     629 
     630#if P0312_VERT_PHASE_ADJ
     631  Bool       m_vpsVuiVertPhaseInUseFlag;
     632#endif
     633
     634#if P0300_ALT_OUTPUT_LAYER_FLAG
     635  Bool       m_altOutputLayerFlag[MAX_VPS_LAYER_SETS_PLUS1];
     636#else
    626637#if O0153_ALT_OUTPUT_LAYER_FLAG
    627638  Bool       m_altOutputLayerFlag;
     639#endif
    628640#endif
    629641#if REPN_FORMAT_IN_VPS
     
    635647#if VIEW_ID_RELATED_SIGNALING
    636648#if O0109_VIEW_ID_LEN
    637   Int         m_viewIdLen;
     649  Int        m_viewIdLen;
    638650#else
    639   Int         m_viewIdLenMinus1;
    640 #endif
    641   Int         m_viewIdVal                [MAX_LAYERS];
     651  Int        m_viewIdLenMinus1;
     652#endif
     653  Int        m_viewIdVal                [MAX_LAYERS];
    642654#endif
    643655
     
    650662  Bool       m_recursiveRefLayerFlag[MAX_NUM_LAYER_IDS][MAX_NUM_LAYER_IDS];  // flag to indicate if j-th layer is a direct or indirect reference layer of i-th layer
    651663#endif
     664#if SPS_DPB_PARAMS
     665  Int        m_TolsIdx;
     666#endif
    652667#if VPS_DPB_SIZE_TABLE
    653   Bool    m_subLayerFlagInfoPresentFlag [MAX_VPS_OP_LAYER_SETS_PLUS1];
    654   Bool    m_subLayerDpbInfoPresentFlag  [MAX_VPS_OP_LAYER_SETS_PLUS1][MAX_LAYERS];
    655   Int     m_maxVpsDecPicBufferingMinus1 [MAX_VPS_OP_LAYER_SETS_PLUS1][MAX_LAYERS][MAX_TLAYER];
     668  Bool       m_subLayerFlagInfoPresentFlag [MAX_VPS_OP_LAYER_SETS_PLUS1];
     669  Bool       m_subLayerDpbInfoPresentFlag  [MAX_VPS_OP_LAYER_SETS_PLUS1][MAX_LAYERS];
     670  Int        m_maxVpsDecPicBufferingMinus1 [MAX_VPS_OP_LAYER_SETS_PLUS1][MAX_LAYERS][MAX_TLAYER];
    656671#if RESOLUTION_BASED_DPB
    657   Int     m_maxVpsLayerDecPicBuffMinus1 [MAX_VPS_OP_LAYER_SETS_PLUS1][MAX_LAYERS][MAX_TLAYER]; 
    658 #endif
    659   Int     m_maxVpsNumReorderPics        [MAX_VPS_OP_LAYER_SETS_PLUS1][MAX_LAYERS];
    660   Int     m_maxVpsLatencyIncreasePlus1  [MAX_VPS_OP_LAYER_SETS_PLUS1][MAX_LAYERS];
     672  Int        m_maxVpsLayerDecPicBuffMinus1 [MAX_VPS_OP_LAYER_SETS_PLUS1][MAX_LAYERS][MAX_TLAYER]; 
     673#endif
     674  Int        m_maxVpsNumReorderPics        [MAX_VPS_OP_LAYER_SETS_PLUS1][MAX_LAYERS];
     675  Int        m_maxVpsLatencyIncreasePlus1  [MAX_VPS_OP_LAYER_SETS_PLUS1][MAX_LAYERS];
    661676#if CHANGE_NUMSUBDPB_IDX
    662   Int     m_numSubDpbs                  [MAX_VPS_LAYER_SETS_PLUS1];
     677  Int        m_numSubDpbs                  [MAX_VPS_LAYER_SETS_PLUS1];
    663678#else
    664   Int     m_numSubDpbs                  [MAX_VPS_OP_LAYER_SETS_PLUS1];
     679  Int        m_numSubDpbs                  [MAX_VPS_OP_LAYER_SETS_PLUS1];
    665680#endif
    666681#endif
     
    670685#endif
    671686
     687#if O0164_MULTI_LAYER_HRD
     688  Bool       m_vpsVuiBspHrdPresentFlag;
     689  UInt       m_vpsNumBspHrdParametersMinus1;
     690  Bool       m_bspCprmsPresentFlag[MAX_VPS_LAYER_SETS_PLUS1];
     691  TComHRD    *m_bspHrd;
     692  UInt       m_numBitstreamPartitions[MAX_VPS_LAYER_SETS_PLUS1];
     693  Bool       m_layerInBspFlag[MAX_VPS_LAYER_SETS_PLUS1][8][MAX_LAYERS];
     694  UInt       m_numBspSchedCombinations[MAX_VPS_LAYER_SETS_PLUS1];
     695  UInt       m_bspCombHrdIdx[MAX_VPS_LAYER_SETS_PLUS1][16][16];
     696  UInt       m_bspCombSchedIdx[MAX_VPS_LAYER_SETS_PLUS1][16][16];
     697#endif
     698
     699#if P0182_VPS_VUI_PS_FLAG
     700  UInt       m_SPSId[MAX_LAYERS];
     701  UInt       m_PPSId[MAX_LAYERS];
     702  UInt       m_baseLayerPSCompatibilityFlag[MAX_LAYERS];
     703#endif
     704
    672705#if !P0307_REMOVE_VPS_VUI_OFFSET
    673706#if VPS_VUI_OFFSET
    674   Int     m_vpsVuiOffset;
     707  Int        m_vpsVuiOffset;
    675708#endif
    676709#endif
    677710#if P0307_VPS_NON_VUI_EXTENSION
    678   Int     m_vpsNonVuiExtLength;
     711  Int        m_vpsNonVuiExtLength;
    679712#endif
    680713#if RESOLUTION_BASED_DPB
    681   Int     m_subDpbAssigned            [MAX_VPS_LAYER_SETS_PLUS1][MAX_LAYERS];
     714  Int        m_subDpbAssigned            [MAX_VPS_LAYER_SETS_PLUS1][MAX_LAYERS];
    682715#endif
    683716#endif //SVC_EXTENSION
     
    692725    m_cprmsPresentFlag = new Bool   [ getNumHrdParameters() ];
    693726  }
     727
     728#if O0164_MULTI_LAYER_HRD
     729  Void    createBspHrdParamBuffer(UInt numHrds)
     730  {
     731    m_bspHrd    = new TComHRD[ numHrds ];
     732//    m_hrdOpSetIdx      = new UInt   [ getNumHrdParameters() ];
     733//    m_cprmsPresentFlag = new Bool   [ getNumHrdParameters() ];
     734  }
     735#endif
    694736
    695737  TComHRD* getHrdParameters   ( UInt i )             { return &m_hrdParameters[ i ]; }
     
    875917  Bool   getCrossLayerPictureTypeAlignFlag()                                    { return m_crossLayerPictureTypeAlignFlag;                      }
    876918  Void   setCrossLayerPictureTypeAlignFlag(Bool x)                              { m_crossLayerPictureTypeAlignFlag = x;                         }
     919#endif
     920#if P0068_CROSS_LAYER_ALIGNED_IDR_ONLY_FOR_IRAP_FLAG
     921  Bool   getCrossLayerAlignedIdrOnlyFlag()                                    { return m_crossLayerAlignedIdrOnlyFlag;                      }
     922  Void   setCrossLayerAlignedIdrOnlyFlag(Bool x)                              { m_crossLayerAlignedIdrOnlyFlag = x;                         }
    877923#endif
    878924#if N0147_IRAP_ALIGN_FLAG
     
    892938#endif
    893939#if VPS_TSLAYERS
    894     Bool   getMaxTSLayersPresentFlag()                                  { return m_maxTSLayersPresentFlag ;}
    895     Void   setMaxTSLayersPresentFlag(Bool x)                            { m_maxTSLayersPresentFlag = x;}
    896     UInt   getMaxTSLayersMinus1(Int layerId)                            { return m_maxTSLayerMinus1[layerId];}
    897     Void   setMaxTSLayersMinus1(Int layerId, UInt maxTSublayer)         { m_maxTSLayerMinus1[layerId] = maxTSublayer;}
     940  Bool   getMaxTSLayersPresentFlag()                                  { return m_maxTSLayersPresentFlag ;}
     941  Void   setMaxTSLayersPresentFlag(Bool x)                            { m_maxTSLayersPresentFlag = x;}
     942  UInt   getMaxTSLayersMinus1(Int layerId)                            { return m_maxTSLayerMinus1[layerId];}
     943  Void   setMaxTSLayersMinus1(Int layerId, UInt maxTSublayer)         { m_maxTSLayerMinus1[layerId] = maxTSublayer;}
    898944#endif
    899945#if M0040_ADAPTIVE_RESOLUTION_CHANGE
     
    924970#endif
    925971#if N0160_VUI_EXT_ILP_REF 
    926   Bool  getIlpRestrictedRefLayersFlag   ( )                                        { return m_ilpRestrictedRefLayersFlag        ;}
    927   Void  setIlpRestrictedRefLayersFlag   ( Int val )                                { m_ilpRestrictedRefLayersFlag         = val;}
    928  
    929   Int  getMinSpatialSegmentOffsetPlus1( Int currLayerId, Int refLayerId )          { return m_minSpatialSegmentOffsetPlus1[currLayerId][refLayerId];}
    930   Void setMinSpatialSegmentOffsetPlus1( Int currLayerId, Int refLayerId, Int val ) { m_minSpatialSegmentOffsetPlus1[currLayerId][refLayerId] = val;}
    931  
    932   Bool getCtuBasedOffsetEnabledFlag   ( Int currLayerId, Int refLayerId )            { return m_ctuBasedOffsetEnabledFlag[currLayerId][refLayerId];}
    933   Void setCtuBasedOffsetEnabledFlag   ( Int currLayerId, Int refLayerId, Bool flag ) { m_ctuBasedOffsetEnabledFlag[currLayerId][refLayerId] = flag;}
    934  
    935   Int  getMinHorizontalCtuOffsetPlus1 ( Int currLayerId, Int refLayerId )            { return m_minHorizontalCtuOffsetPlus1[currLayerId][refLayerId];}
    936   Void setMinHorizontalCtuOffsetPlus1 ( Int currLayerId, Int refLayerId, Int val )   { m_minHorizontalCtuOffsetPlus1[currLayerId][refLayerId] = val;} 
     972  Bool   getIlpRestrictedRefLayersFlag   ( )                                        { return m_ilpRestrictedRefLayersFlag        ;}
     973  Void   setIlpRestrictedRefLayersFlag   ( Int val )                                { m_ilpRestrictedRefLayersFlag         = val;}
     974 
     975  Int    getMinSpatialSegmentOffsetPlus1( Int currLayerId, Int refLayerId )          { return m_minSpatialSegmentOffsetPlus1[currLayerId][refLayerId];}
     976  Void   setMinSpatialSegmentOffsetPlus1( Int currLayerId, Int refLayerId, Int val ) { m_minSpatialSegmentOffsetPlus1[currLayerId][refLayerId] = val;}
     977 
     978  Bool   getCtuBasedOffsetEnabledFlag   ( Int currLayerId, Int refLayerId )            { return m_ctuBasedOffsetEnabledFlag[currLayerId][refLayerId];}
     979  Void   setCtuBasedOffsetEnabledFlag   ( Int currLayerId, Int refLayerId, Bool flag ) { m_ctuBasedOffsetEnabledFlag[currLayerId][refLayerId] = flag;}
     980 
     981  Int    getMinHorizontalCtuOffsetPlus1 ( Int currLayerId, Int refLayerId )            { return m_minHorizontalCtuOffsetPlus1[currLayerId][refLayerId];}
     982  Void   setMinHorizontalCtuOffsetPlus1 ( Int currLayerId, Int refLayerId, Int val )   { m_minHorizontalCtuOffsetPlus1[currLayerId][refLayerId] = val;} 
    937983#endif
    938984#if VPS_VUI_VIDEO_SIGNAL
    939     Bool   getVideoSigPresentVpsFlag()           { return m_vidSigPresentVpsFlag; }
    940     Void   setVideoSigPresentVpsFlag(Bool x)     { m_vidSigPresentVpsFlag = x;    }
    941     Int    getNumVideoSignalInfo()               { return m_vpsVidSigInfo;        }
    942     Void   setNumVideoSignalInfo(Int x)          { m_vpsVidSigInfo = x;           }
    943     Int    getVideoSignalInfoIdx(Int idx)        { return m_vpsVidSigIdx[idx];    }
    944     Void   setVideoSignalInfoIdx(Int idx, Int x) { m_vpsVidSigIdx[idx] = x;       }
    945     Int    getVideoVPSFormat(Int idx)            { return m_vpsVidFormat[idx];    }
    946     Void   setVideoVPSFormat(Int idx, Int x)     { m_vpsVidFormat[idx] = x;       }
    947     Bool   getVideoFullRangeVpsFlag(Int idx)     { return m_vpsFullRangeFlag[idx];}
    948     Void   setVideoFullRangeVpsFlag(Int idx, Bool x) { m_vpsFullRangeFlag[idx] = x;   }
    949     Int    getColorPrimaries(Int idx)            { return m_vpsColorPrimaries[idx];   }
    950     Void   setColorPrimaries(Int idx, Int x)     { m_vpsColorPrimaries[idx] = x;      }
    951     Int    getTransCharacter(Int idx)            { return m_vpsTransChar[idx];    }
    952     Void   setTransCharacter(Int idx, Int x)     { m_vpsTransChar[idx] = x;       }
    953     Int    getMaxtrixCoeff(Int idx)              { return m_vpsMatCoeff[idx];     }
    954     Void   setMaxtrixCoeff(Int idx, Int x)       { m_vpsMatCoeff[idx] = x;        }
     985  Bool   getVideoSigPresentVpsFlag()           { return m_vidSigPresentVpsFlag; }
     986  Void   setVideoSigPresentVpsFlag(Bool x)     { m_vidSigPresentVpsFlag = x;    }
     987  Int    getNumVideoSignalInfo()               { return m_vpsVidSigInfo;        }
     988  Void   setNumVideoSignalInfo(Int x)          { m_vpsVidSigInfo = x;           }
     989  Int    getVideoSignalInfoIdx(Int idx)        { return m_vpsVidSigIdx[idx];    }
     990  Void   setVideoSignalInfoIdx(Int idx, Int x) { m_vpsVidSigIdx[idx] = x;       }
     991  Int    getVideoVPSFormat(Int idx)            { return m_vpsVidFormat[idx];    }
     992  Void   setVideoVPSFormat(Int idx, Int x)     { m_vpsVidFormat[idx] = x;       }
     993  Bool   getVideoFullRangeVpsFlag(Int idx)     { return m_vpsFullRangeFlag[idx];}
     994  Void   setVideoFullRangeVpsFlag(Int idx, Bool x) { m_vpsFullRangeFlag[idx] = x;   }
     995  Int    getColorPrimaries(Int idx)            { return m_vpsColorPrimaries[idx];   }
     996  Void   setColorPrimaries(Int idx, Int x)     { m_vpsColorPrimaries[idx] = x;      }
     997  Int    getTransCharacter(Int idx)            { return m_vpsTransChar[idx];    }
     998  Void   setTransCharacter(Int idx, Int x)     { m_vpsTransChar[idx] = x;       }
     999  Int    getMaxtrixCoeff(Int idx)              { return m_vpsMatCoeff[idx];     }
     1000  Void   setMaxtrixCoeff(Int idx, Int x)       { m_vpsMatCoeff[idx] = x;        }
    9551001#endif
    9561002#if VPS_VUI_BITRATE_PICRATE
    957   Bool getBitRatePresentVpsFlag()       { return m_bitRatePresentVpsFlag; }
    958   Void setBitRatePresentVpsFlag(Bool x) { m_bitRatePresentVpsFlag = x;    }
    959   Bool getPicRatePresentVpsFlag()       { return m_picRatePresentVpsFlag; }
    960   Void setPicRatePresentVpsFlag(Bool x) { m_picRatePresentVpsFlag = x;    }
    961 
    962   Bool getBitRatePresentFlag(Int i, Int j)          { return m_bitRatePresentFlag[i][j]; }
    963   Void setBitRatePresentFlag(Int i, Int j, Bool x)  { m_bitRatePresentFlag[i][j] = x;    }
    964   Bool getPicRatePresentFlag(Int i, Int j)          { return m_picRatePresentFlag[i][j]; }
    965   Void setPicRatePresentFlag(Int i, Int j, Bool x)  { m_picRatePresentFlag[i][j] = x;    }
    966  
    967   Int  getAvgBitRate(Int i, Int j)          { return m_avgBitRate[i][j]; }
    968   Void setAvgBitRate(Int i, Int j, Int x)   { m_avgBitRate[i][j] = x;    }
    969   Int  getMaxBitRate(Int i, Int j)          { return m_maxBitRate[i][j]; }
    970   Void setMaxBitRate(Int i, Int j, Int x)   { m_maxBitRate[i][j] = x;    }
    971  
    972   Int  getConstPicRateIdc(Int i, Int j)          { return m_constPicRateIdc[i][j]; }
    973   Void setConstPicRateIdc(Int i, Int j, Int x)   { m_constPicRateIdc[i][j] = x;    }
    974   Int  getAvgPicRate(Int i, Int j)          { return m_avgPicRate[i][j]; }
    975   Void setAvgPicRate(Int i, Int j, Int x)   { m_avgPicRate[i][j] = x;    }
    976 #endif
     1003  Bool   getBitRatePresentVpsFlag()       { return m_bitRatePresentVpsFlag; }
     1004  Void   setBitRatePresentVpsFlag(Bool x) { m_bitRatePresentVpsFlag = x;    }
     1005  Bool   getPicRatePresentVpsFlag()       { return m_picRatePresentVpsFlag; }
     1006  Void   setPicRatePresentVpsFlag(Bool x) { m_picRatePresentVpsFlag = x;    }
     1007         
     1008  Bool   getBitRatePresentFlag(Int i, Int j)          { return m_bitRatePresentFlag[i][j]; }
     1009  Void   setBitRatePresentFlag(Int i, Int j, Bool x)  { m_bitRatePresentFlag[i][j] = x;    }
     1010  Bool   getPicRatePresentFlag(Int i, Int j)          { return m_picRatePresentFlag[i][j]; }
     1011  Void   setPicRatePresentFlag(Int i, Int j, Bool x)  { m_picRatePresentFlag[i][j] = x;    }
     1012         
     1013  Int    getAvgBitRate(Int i, Int j)          { return m_avgBitRate[i][j]; }
     1014  Void   setAvgBitRate(Int i, Int j, Int x)   { m_avgBitRate[i][j] = x;    }
     1015  Int    getMaxBitRate(Int i, Int j)          { return m_maxBitRate[i][j]; }
     1016  Void   setMaxBitRate(Int i, Int j, Int x)   { m_maxBitRate[i][j] = x;    }
     1017         
     1018  Int    getConstPicRateIdc(Int i, Int j)          { return m_constPicRateIdc[i][j]; }
     1019  Void   setConstPicRateIdc(Int i, Int j, Int x)   { m_constPicRateIdc[i][j] = x;    }
     1020  Int    getAvgPicRate(Int i, Int j)          { return m_avgPicRate[i][j]; }
     1021  Void   setAvgPicRate(Int i, Int j, Int x)   { m_avgPicRate[i][j] = x;    }
     1022#endif
     1023#if O0164_MULTI_LAYER_HRD
     1024  Bool     getVpsVuiBspHrdPresentFlag()                         { return m_vpsVuiBspHrdPresentFlag;      }
     1025  Void     setVpsVuiBspHrdPresentFlag(Bool x)                   { m_vpsVuiBspHrdPresentFlag = x;         }
     1026  UInt     getVpsNumBspHrdParametersMinus1()                    { return m_vpsNumBspHrdParametersMinus1; }
     1027  Void     setVpsNumBspHrdParametersMinus1(UInt i)              { m_vpsNumBspHrdParametersMinus1 = i;    }
     1028  Bool     getBspCprmsPresentFlag(UInt i)                       { return m_bspCprmsPresentFlag[i];       }
     1029  Void     setBspCprmsPresentFlag(UInt i, Bool val)             { m_bspCprmsPresentFlag[i] = val;        }
     1030  TComHRD* getBspHrd(UInt i)                                    { return &m_bspHrd[i];                    }
     1031  UInt     getNumBitstreamPartitions(UInt i)                    { return m_numBitstreamPartitions[i];    }
     1032  Void     setNumBitstreamPartitions(UInt i, UInt val)          { m_numBitstreamPartitions[i] = val;     }
     1033  UInt     getLayerInBspFlag(UInt h, UInt i, UInt j)            { return m_layerInBspFlag[h][i][j];      }
     1034  Void     setLayerInBspFlag(UInt h, UInt i, UInt j, UInt val)  { m_layerInBspFlag[h][i][j] = val;       }
     1035  UInt     getNumBspSchedCombinations(UInt i)                   { return m_numBspSchedCombinations[i];   }
     1036  Void     setNumBspSchedCombinations(UInt i, UInt val)         { m_numBspSchedCombinations[i] = val;    }
     1037  UInt     getBspCombHrdIdx(UInt h, UInt i, UInt j)             { return m_bspCombHrdIdx[h][i][j];       }
     1038  Void     setBspCombHrdIdx(UInt h, UInt i, UInt j, UInt val)   { m_bspCombHrdIdx[h][i][j] = val;        }
     1039  UInt     getBspCombSchedIdx(UInt h, UInt i, UInt j)           { return m_bspCombSchedIdx[h][i][j];     }
     1040  Void     setBspCombSchedIdx(UInt h, UInt i, UInt j, UInt val) { m_bspCombSchedIdx[h][i][j] = val;      }
     1041#endif
     1042#if P0182_VPS_VUI_PS_FLAG
     1043  Int    getSPSId       (Int layer)                   { return m_SPSId[layer];       }
     1044  Void   setSPSId       (Int layer, Int val)          { m_SPSId[layer] = val;        }
     1045  Int    getPPSId       (Int layer)                   { return m_PPSId[layer];       }
     1046  Void   setPPSId       (Int layer, Int val)          { m_PPSId[layer] = val;        }
     1047  Void   setBaseLayerPSCompatibilityFlag (Int layer, int val)        { m_baseLayerPSCompatibilityFlag[layer] = val; }
     1048  Int    getBaseLayerPSCompatibilityFlag (Int layer)   { return m_baseLayerPSCompatibilityFlag[layer];}
     1049#endif
     1050
     1051#if P0312_VERT_PHASE_ADJ
     1052  Bool   getVpsVuiVertPhaseInUseFlag()       { return m_vpsVuiVertPhaseInUseFlag; }
     1053  Void   setVpsVuiVertPhaseInUseFlag(Bool x) { m_vpsVuiVertPhaseInUseFlag = x;    }
     1054#endif
     1055
     1056#if P0300_ALT_OUTPUT_LAYER_FLAG
     1057  Bool   getAltOuputLayerFlag(Int idx)         { return m_altOutputLayerFlag[idx]; }
     1058  Void   setAltOuputLayerFlag(Int idx, Bool x) { m_altOutputLayerFlag[idx] = x;    }
     1059#else
    9771060#if O0153_ALT_OUTPUT_LAYER_FLAG
    9781061  Bool   getAltOuputLayerFlag()             { return m_altOutputLayerFlag; }
    9791062  Void   setAltOuputLayerFlag(Bool x)       { m_altOutputLayerFlag = x;    }
    9801063#endif
     1064#endif
    9811065#if REPN_FORMAT_IN_VPS
    9821066  Bool   getRepFormatIdxPresentFlag()       { return m_repFormatIdxPresentFlag; }
     
    9881072  RepFormat* getVpsRepFormat(Int idx)       { return &m_vpsRepFormat[idx];      }
    9891073
    990   Int    getVpsRepFormatIdx(Int idx)        { return m_vpsRepFormatIdx[idx];   }
    991   Void   setVpsRepFormatIdx(Int idx, Int x) { m_vpsRepFormatIdx[idx] = x;      }         
     1074  Int    getVpsRepFormatIdx(Int idx)        { return m_vpsRepFormatIdx[idx];    }
     1075  Void   setVpsRepFormatIdx(Int idx, Int x) { m_vpsRepFormatIdx[idx] = x;       }         
    9921076#endif
    9931077#if VIEW_ID_RELATED_SIGNALING
    9941078#if O0109_VIEW_ID_LEN
    995   Void    setViewIdLen( Int  val )                                   { m_viewIdLen = val; }
    996   Int     getViewIdLen(  )                                           { return m_viewIdLen; }
     1079  Void   setViewIdLen( Int  val )                                   { m_viewIdLen = val; }
     1080  Int    getViewIdLen(  )                                           { return m_viewIdLen; }
    9971081#else
    998   Void    setViewIdLenMinus1( Int  val )                                   { m_viewIdLenMinus1 = val; }
    999   Int     getViewIdLenMinus1(  )                                           { return m_viewIdLenMinus1; }
    1000 #endif
    1001 
    1002   Void    setViewIdVal( Int viewOrderIndex, Int  val )                     { m_viewIdVal[viewOrderIndex] = val; }
    1003   Int     getViewIdVal( Int viewOrderIndex )                               { return m_viewIdVal[viewOrderIndex]; }
    1004   Int     getScalabilityId(Int, ScalabilityType scalType );
    1005 
    1006   Int     getViewIndex    ( Int layerIdInNuh )                             { return getScalabilityId( getLayerIdInVps(layerIdInNuh), VIEW_ORDER_INDEX  ); }   
    1007 
    1008   Int     getNumViews();
    1009   Int     scalTypeToScalIdx( ScalabilityType scalType );
     1082  Void   setViewIdLenMinus1( Int  val )                             { m_viewIdLenMinus1 = val; }
     1083  Int    getViewIdLenMinus1(  )                                     { return m_viewIdLenMinus1; }
     1084#endif
     1085
     1086  Void   setViewIdVal( Int viewOrderIndex, Int  val )               { m_viewIdVal[viewOrderIndex] = val; }
     1087  Int    getViewIdVal( Int viewOrderIndex )                         { return m_viewIdVal[viewOrderIndex]; }
     1088  Int    getScalabilityId(Int, ScalabilityType scalType );
     1089
     1090  Int    getViewIndex    ( Int layerIdInNuh )                       { return getScalabilityId( getLayerIdInVps(layerIdInNuh), VIEW_ORDER_INDEX  ); }   
     1091
     1092  Int    getNumViews();
     1093  Int    scalTypeToScalIdx( ScalabilityType scalType );
    10101094#endif
    10111095#if !P0125_REVERT_VPS_EXTN_OFFSET_TO_RESERVED
    10121096#if VPS_EXTN_OFFSET
    1013   Int     getExtensionOffset()                 { return m_extensionOffset;   }
    1014   Void    setExtensionOffset( UInt offset )    { m_extensionOffset = offset; }
     1097  Int    getExtensionOffset()                 { return m_extensionOffset;   }
     1098  Void   setExtensionOffset( UInt offset )    { m_extensionOffset = offset; }
    10151099#endif
    10161100#endif
     
    10201104#endif
    10211105#if VPS_DPB_SIZE_TABLE
    1022   Bool    getSubLayerFlagInfoPresentFlag(Int i)         {return m_subLayerFlagInfoPresentFlag[i]; }
    1023   Void    setSubLayerFlagInfoPresentFlag(Int i, Bool x) {m_subLayerFlagInfoPresentFlag[i] = x;    }
    1024 
    1025   Bool    getSubLayerDpbInfoPresentFlag(Int i, Int j)         {return m_subLayerDpbInfoPresentFlag[i][j]; }
    1026   Void    setSubLayerDpbInfoPresentFlag(Int i, Int j, Bool x) {m_subLayerDpbInfoPresentFlag[i][j] = x;    }
     1106  Bool   getSubLayerFlagInfoPresentFlag(Int i)         {return m_subLayerFlagInfoPresentFlag[i]; }
     1107  Void   setSubLayerFlagInfoPresentFlag(Int i, Bool x) {m_subLayerFlagInfoPresentFlag[i] = x;    }
     1108
     1109  Bool   getSubLayerDpbInfoPresentFlag(Int i, Int j)         {return m_subLayerDpbInfoPresentFlag[i][j]; }
     1110  Void   setSubLayerDpbInfoPresentFlag(Int i, Int j, Bool x) {m_subLayerDpbInfoPresentFlag[i][j] = x;    }
    10271111
    10281112  // For the 0-th output layer set, use the date from the active SPS for base layer.
    1029   Int     getMaxVpsDecPicBufferingMinus1(Int i, Int k, Int j)         { assert(i != 0); return m_maxVpsDecPicBufferingMinus1[i][k][j]; }
    1030   Void    setMaxVpsDecPicBufferingMinus1(Int i, Int k, Int j, Int x) { m_maxVpsDecPicBufferingMinus1[i][k][j] = x;    }
     1113  Int    getMaxVpsDecPicBufferingMinus1(Int i, Int k, Int j)         { assert(i != 0); return m_maxVpsDecPicBufferingMinus1[i][k][j]; }
     1114  Void   setMaxVpsDecPicBufferingMinus1(Int i, Int k, Int j, Int x) { m_maxVpsDecPicBufferingMinus1[i][k][j] = x;    }
    10311115
    10321116#if RESOLUTION_BASED_DPB
    1033   Int     getMaxVpsLayerDecPicBuffMinus1(Int i, Int k, Int j)        { assert(i != 0); return m_maxVpsLayerDecPicBuffMinus1[i][k][j]; }
    1034   Void    setMaxVpsLayerDecPicBuffMinus1(Int i, Int k, Int j, Int x) { m_maxVpsLayerDecPicBuffMinus1[i][k][j] = x;    }
    1035 #endif
    1036 
    1037   Int     getMaxVpsNumReorderPics(Int i, Int j)         { assert(i != 0); return m_maxVpsNumReorderPics[i][j]; }
    1038   Void    setMaxVpsNumReorderPics(Int i, Int j, Int x) { m_maxVpsNumReorderPics[i][j] = x;    }
    1039 
    1040   Int     getMaxVpsLatencyIncreasePlus1(Int i, Int j)         { assert(i != 0); return m_maxVpsLatencyIncreasePlus1[i][j]; }
    1041   Void    setMaxVpsLatencyIncreasePlus1(Int i, Int j, Int x) { m_maxVpsLatencyIncreasePlus1[i][j] = x;    }
    1042 
    1043   Int     getNumSubDpbs(Int i)                          { return m_numSubDpbs[i]; }
    1044   Void    setNumSubDpbs(Int i, Int x)                   { m_numSubDpbs[i] = x;    }
    1045   Void    determineSubDpbInfoFlags();
     1117  Int    getMaxVpsLayerDecPicBuffMinus1(Int i, Int k, Int j)        { assert(i != 0); return m_maxVpsLayerDecPicBuffMinus1[i][k][j]; }
     1118  Void   setMaxVpsLayerDecPicBuffMinus1(Int i, Int k, Int j, Int x) { m_maxVpsLayerDecPicBuffMinus1[i][k][j] = x;    }
     1119#endif
     1120
     1121  Int    getMaxVpsNumReorderPics(Int i, Int j)        { assert(i != 0); return m_maxVpsNumReorderPics[i][j]; }
     1122  Void   setMaxVpsNumReorderPics(Int i, Int j, Int x) { m_maxVpsNumReorderPics[i][j] = x;    }
     1123
     1124  Int    getMaxVpsLatencyIncreasePlus1(Int i, Int j)        { assert(i != 0); return m_maxVpsLatencyIncreasePlus1[i][j]; }
     1125  Void   setMaxVpsLatencyIncreasePlus1(Int i, Int j, Int x) { m_maxVpsLatencyIncreasePlus1[i][j] = x;    }
     1126
     1127  Int    getNumSubDpbs(Int i)                          { return m_numSubDpbs[i]; }
     1128  Void   setNumSubDpbs(Int i, Int x)                   { m_numSubDpbs[i] = x;    }
     1129  Void   determineSubDpbInfoFlags();
    10461130#endif
    10471131
     
    10531137#if !P0307_REMOVE_VPS_VUI_OFFSET
    10541138#if VPS_VUI_OFFSET
    1055   Int     getVpsVuiOffset()         { return m_vpsVuiOffset; }
    1056   Void    setVpsVuiOffset(Int x)    { m_vpsVuiOffset = x; }
     1139  Int    getVpsVuiOffset()         { return m_vpsVuiOffset; }
     1140  Void   setVpsVuiOffset(Int x)    { m_vpsVuiOffset = x; }
    10571141#endif
    10581142#endif
    10591143#if P0307_VPS_NON_VUI_EXTENSION
    1060   Int     getVpsNonVuiExtLength()         { return m_vpsNonVuiExtLength; }
    1061   Void    setVpsNonVuiExtLength(Int x)    { m_vpsNonVuiExtLength = x; }
     1144  Int    getVpsNonVuiExtLength()         { return m_vpsNonVuiExtLength; }
     1145  Void   setVpsNonVuiExtLength(Int x)    { m_vpsNonVuiExtLength = x; }
    10621146#endif
    10631147#if RESOLUTION_BASED_DPB
    1064   Void assignSubDpbIndices();
    1065   Int  getSubDpbAssigned  (Int lsIdx, Int layerIdx) { return m_subDpbAssigned[lsIdx][layerIdx]; }
    1066   Int  findLayerIdxInLayerSet ( Int lsIdx, Int nuhLayerId );
     1148  Void   assignSubDpbIndices();
     1149  Int    getSubDpbAssigned  (Int lsIdx, Int layerIdx) { return m_subDpbAssigned[lsIdx][layerIdx]; }
     1150  Int    findLayerIdxInLayerSet ( Int lsIdx, Int nuhLayerId );
     1151#endif
     1152#if O0164_MULTI_LAYER_HRD
     1153  Void setBspHrdParameters( UInt hrdIdx, UInt frameRate, UInt numDU, UInt bitRate, Bool randomAccess );
    10671154#endif
    10681155#endif //SVC_EXTENSION
     
    10771164  Int           m_winTopOffset;
    10781165  Int           m_winBottomOffset;
     1166#if P0312_VERT_PHASE_ADJ
     1167  Bool          m_vertPhasePositionEnableFlag;
     1168#endif
    10791169public:
    10801170  Window()
     
    10841174  , m_winTopOffset      (0)
    10851175  , m_winBottomOffset   (0)
     1176#if P0312_VERT_PHASE_ADJ
     1177  , m_vertPhasePositionEnableFlag(false) 
     1178#endif
    10861179  { }
    10871180
    10881181  Bool          getWindowEnabledFlag() const      { return m_enabledFlag; }
    1089   Void          resetWindow()                     { m_enabledFlag = false; m_winLeftOffset = m_winRightOffset = m_winTopOffset = m_winBottomOffset = 0; }
     1182#if P0312_VERT_PHASE_ADJ
     1183  Void          resetWindow()                     { m_enabledFlag = false; m_winLeftOffset = m_winRightOffset = m_winTopOffset = m_winBottomOffset = 0; m_vertPhasePositionEnableFlag = false; }
     1184#else
     1185  Void          resetWindow()                     { m_enabledFlag = false; m_winLeftOffset = m_winRightOffset = m_winTopOffset = m_winBottomOffset = 0;}
     1186#endif
    10901187  Int           getWindowLeftOffset() const       { return m_enabledFlag ? m_winLeftOffset : 0; }
    10911188  Void          setWindowLeftOffset(Int val)      { m_winLeftOffset = val; m_enabledFlag = true; }
     
    10971194  Void          setWindowBottomOffset(Int val)    { m_winBottomOffset = val; m_enabledFlag = true; }
    10981195
     1196#if P0312_VERT_PHASE_ADJ
     1197  Bool          getVertPhasePositionEnableFlag() const     { return m_vertPhasePositionEnableFlag;  }
     1198  Void          setVertPhasePositionEnableFlag(Bool val)    { m_vertPhasePositionEnableFlag = val;  }
     1199  Void          setWindow(Int offsetLeft, Int offsetLRight, Int offsetLTop, Int offsetLBottom, Bool vertPhasePositionEnableFlag = 0)
     1200#else
    10991201  Void          setWindow(Int offsetLeft, Int offsetLRight, Int offsetLTop, Int offsetLBottom)
     1202#endif
    11001203  {
    11011204    m_enabledFlag       = true;
     
    11041207    m_winTopOffset      = offsetLTop;
    11051208    m_winBottomOffset   = offsetLBottom;
     1209#if P0312_VERT_PHASE_ADJ
     1210    m_vertPhasePositionEnableFlag = vertPhasePositionEnableFlag;   
     1211#endif
    11061212  }
    11071213};
     
    13531459
    13541460#if SVC_EXTENSION
    1355   UInt m_layerId;
     1461  UInt        m_layerId;
    13561462  UInt        m_numScaledRefLayerOffsets;
     1463#if P0312_VERT_PHASE_ADJ
     1464 Bool         m_vertPhasePositionEnableFlag[MAX_LAYERS];
     1465#endif
    13571466#if O0098_SCALED_REF_LAYER_ID
    13581467  UInt        m_scaledRefLayerId[MAX_LAYERS];
     
    13601469  Window      m_scaledRefLayerWindow[MAX_LAYERS];
    13611470#if REPN_FORMAT_IN_VPS
    1362   Bool m_updateRepFormatFlag;
     1471  Bool        m_updateRepFormatFlag;
    13631472#if O0096_REP_FORMAT_INDEX
    1364   UInt m_updateRepFormatIndex;
     1473  UInt        m_updateRepFormatIndex;
    13651474#endif
    13661475#endif
    13671476#if SCALINGLIST_INFERRING
    1368   Bool       m_inferScalingListFlag;
    1369   UInt       m_scalingListRefLayerId;
     1477  Bool        m_inferScalingListFlag;
     1478  UInt        m_scalingListRefLayerId;
    13701479#endif
    13711480#endif //SVC_EXTENSION
     
    15071616
    15081617#if SVC_EXTENSION
    1509   Void     setLayerId(UInt layerId) { m_layerId = layerId; }
    1510   UInt     getLayerId() { return m_layerId; }
    1511   UInt     getNumScaledRefLayerOffsets()  { return m_numScaledRefLayerOffsets; }
    1512   Void     setNumScaledRefLayerOffsets(Int x)  { m_numScaledRefLayerOffsets = x; }
     1618  Void     setLayerId(UInt layerId)            { m_layerId = layerId; }
     1619  UInt     getLayerId()                        { return m_layerId;    }
     1620  UInt     getNumScaledRefLayerOffsets()       { return m_numScaledRefLayerOffsets; }
     1621  Void     setNumScaledRefLayerOffsets(Int x)  { m_numScaledRefLayerOffsets = x;    }
     1622#if P0312_VERT_PHASE_ADJ
     1623  Bool     getVertPhasePositionEnableFlag(Int x)          { return m_vertPhasePositionEnableFlag[x]; }
     1624  Void     setVertPhasePositionEnableFlag(Int x, Bool b)  { m_vertPhasePositionEnableFlag[x] = b;    }
     1625#endif
    15131626#if O0098_SCALED_REF_LAYER_ID
    15141627  UInt     getScaledRefLayerId(Int x)          { return m_scaledRefLayerId[x]; }
    1515   Void     setScaledRefLayerId(Int x, UInt id) { m_scaledRefLayerId[x] = id; }
     1628  Void     setScaledRefLayerId(Int x, UInt id) { m_scaledRefLayerId[x] = id;   }
    15161629  Window&  getScaledRefLayerWindowForLayer( Int layerId );
    15171630#endif
     
    16241737  Bool     m_inferScalingListFlag;
    16251738  UInt     m_scalingListRefLayerId;
     1739#endif
     1740#if POC_RESET_IDC
     1741  Bool     m_pocResetInfoPresentFlag;
    16261742#endif
    16271743#endif
     
    17621878  Bool getSliceHeaderExtensionPresentFlag   ()                    { return m_sliceHeaderExtensionPresentFlag; }
    17631879  Void setSliceHeaderExtensionPresentFlag   (Bool val)            { m_sliceHeaderExtensionPresentFlag = val; }
     1880#if POC_RESET_IDC
     1881  Bool getPocResetInfoPresentFlag   ()                    { return m_pocResetInfoPresentFlag; }
     1882  Void setPocResetInfoPresentFlag   (const Bool val)      { m_pocResetInfoPresentFlag = val; }
     1883#endif
    17641884};
    17651885
     
    18992019  Int         m_activeNumILRRefIdx;        //< Active inter-layer reference pictures
    19002020  Int         m_interLayerPredLayerIdc  [MAX_VPS_LAYER_ID_PLUS1];
     2021#if P0312_VERT_PHASE_ADJ
     2022  Bool        m_vertPhasePositionFlag[MAX_VPS_LAYER_ID_PLUS1];
     2023#endif
    19012024#if POC_RESET_FLAG
    19022025  Bool        m_bPocResetFlag;
     
    19062029#if O0149_CROSS_LAYER_BLA_FLAG
    19072030  Bool        m_bCrossLayerBLAFlag;
     2031#endif
     2032#if NO_OUTPUT_OF_PRIOR_PICS
     2033  Bool        m_noOutputOfPriorPicsFlag;
     2034  Bool        m_noRaslOutputFlag;
     2035  Bool        m_handleCraAsBlaFlag;
     2036#endif
     2037#if POC_RESET_IDC_SIGNALLING
     2038  Int         m_pocResetIdc;
     2039  Int         m_pocResetPeriodId;
     2040  Bool        m_fullPocResetFlag;
     2041  Int         m_pocLsbVal;
     2042  Int         m_pocMsbVal;
     2043  Bool        m_pocMsbValRequiredFlag;
     2044  Bool        m_pocMsbValPresentFlag;
    19082045#endif
    19092046#endif //SVC_EXTENSION
     
    19932130  NalUnitType getNalUnitType    () const                        { return m_eNalUnitType;        }
    19942131  Bool      getRapPicFlag       (); 
     2132#if NO_OUTPUT_OF_PRIOR_PICS
     2133  Bool      getBlaPicFlag       ();
     2134  Bool      getCraPicFlag       ();
     2135#endif
    19952136  Bool      getIdrPicFlag       ()                              { return getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_W_RADL || getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP; }
    19962137  Bool      isIRAP              () const                        { return (getNalUnitType() >= 16) && (getNalUnitType() <= 23); } 
     
    21702311  Bool      getInterLayerPredEnabledFlag     ()                { return m_interLayerPredEnabledFlag;}
    21712312
     2313#if P0312_VERT_PHASE_ADJ
     2314  Int       getVertPhasePositionFlag (UInt layerIdx)              { return   m_vertPhasePositionFlag[layerIdx];}
     2315  Void      setVertPhasePositionFlag (Bool b, UInt layerIdx)      {  m_vertPhasePositionFlag[layerIdx] = b;  }
     2316#endif
     2317
    21722318  Void      setNumMotionPredRefLayers(int i)            { m_numMotionPredRefLayers = i; }
    21732319  Int       getNumMotionPredRefLayers()                 { return m_numMotionPredRefLayers; }
     
    22142360
    22152361  Void setILRPic(TComPic **pcIlpPic);
     2362#if NO_OUTPUT_OF_PRIOR_PICS
     2363  Void setNoOutputOfPriorPicsFlag(const Bool x)   { m_noOutputOfPriorPicsFlag = x;    }
     2364  Bool getNoOutputOfPriorPicsFlag()               { return m_noOutputOfPriorPicsFlag; }
     2365
     2366  Void setNoRaslOutputFlag    ( const Bool val )   { m_noRaslOutputFlag = val;  }
     2367  Bool getNoRaslOutputFlag    ()                   { return m_noRaslOutputFlag; }
     2368
     2369  Void setHandleCraAsBlaFlag  ( const Bool val )   { m_handleCraAsBlaFlag = val;  }
     2370  Bool getHandleCraAsBlaFlag  ()                   { return m_handleCraAsBlaFlag; }
     2371
     2372#endif
     2373#if POC_RESET_IDC_SIGNALLING
     2374  Int       getPocResetIdc       ()                              { return m_pocResetIdc;       }
     2375  Void      setPocResetIdc       (Int b)                         { m_pocResetIdc = b;          }
     2376  Int       getPocResetPeriodId  ()                              { return m_pocResetPeriodId;       }
     2377  Void      setPocResetPeriodId  (Int b)                         { m_pocResetPeriodId = b;          }
     2378  Bool      getFullPocResetFlag  ()                              { return m_fullPocResetFlag;       }
     2379  Void      setFullPocResetFlag  (Bool b)                        { m_fullPocResetFlag = b;          }
     2380  Int       getPocLsbVal         ()                              { return m_pocLsbVal;       }
     2381  Void      setPocLsbVal       (Int b)                           { m_pocLsbVal = b;          }
     2382  Int       getPocMsbVal         ()                              { return m_pocMsbVal;       }
     2383  Void      setPocMsbVal       (Int b)                           { m_pocMsbVal = b;          }
     2384  Bool      getPocMsbValPresentFlag ()                           { return m_pocMsbValPresentFlag; }
     2385  Void      setPocMsbValPresentFlag (Bool x)                     { m_pocMsbValPresentFlag = x; }
     2386  Bool      getPocMsbValRequiredFlag ()                           { return m_pocMsbValRequiredFlag; }
     2387  Void      setPocMsbValRequiredFlag (Bool x)                     { m_pocMsbValRequiredFlag = x; }
     2388#endif
    22162389
    22172390#endif //SVC_EXTENSION
  • trunk/source/Lib/TLibCommon/TComUpsampleFilter.cpp

    r498 r644  
    127127  Int strideEL  = pcUsPic->getStride();
    128128
     129#if P0312_VERT_PHASE_ADJ
     130  Bool vertPhasePositionEnableFlag = scalEL.getVertPhasePositionEnableFlag();
     131  Bool vertPhasePositionFlag = currSlice->getVertPhasePositionFlag( refLayerIdc );
     132  if( vertPhasePositionFlag )
     133  {
     134    assert( vertPhasePositionEnableFlag );
     135  }
     136#endif
     137
    129138  Pel* piTempBufY = pcTempPic->getLumaAddr();
    130139  Pel* piSrcBufY  = pcBasePic->getLumaAddr();
     
    155164#endif
    156165
     166  // non-normative software optimization for certain simple resampling cases
    157167  if( scaleX == 65536 && scaleY == 65536 ) // ratio 1x
    158168  {
    159169    piSrcY = piSrcBufY;
    160170    piDstY = piDstBufY + scalEL.getWindowLeftOffset() + scalEL.getWindowTopOffset() * strideEL;
     171
     172#if O0194_JOINT_US_BITSHIFT
     173    Int shift = g_bitDepthYLayer[currLayerId] - g_bitDepthYLayer[refLayerId];
     174#endif
     175
    161176    for( i = 0; i < heightBL; i++ )
    162177    {
     178#if O0194_JOINT_US_BITSHIFT
     179      for( j = 0; j < widthBL; j++ )
     180      {
     181        piDstY[j] = piSrcY[j] << shift;
     182      }
     183#else
    163184      memcpy( piDstY, piSrcY, sizeof(Pel) * widthBL );
     185#endif
    164186      piSrcY += strideBL;
    165187      piDstY += strideEL;
     
    172194    heightBL >>= 1;
    173195
    174     strideBL  = pcBasePic->getCStride();
    175     strideEL  = pcUsPic->getCStride();
     196    strideBL = pcBasePic->getCStride();
     197    strideEL = pcUsPic->getCStride();
    176198
    177199    piSrcU = piSrcBufU;
     
    181203    piDstV = piDstBufV + ( scalEL.getWindowLeftOffset() >> 1 ) + ( scalEL.getWindowTopOffset() >> 1 ) * strideEL;
    182204
     205#if O0194_JOINT_US_BITSHIFT
     206    shift = g_bitDepthCLayer[currLayerId] - g_bitDepthCLayer[refLayerId];
     207#endif
     208
    183209    for( i = 0; i < heightBL; i++ )
    184210    {
     211#if O0194_JOINT_US_BITSHIFT
     212      for( j = 0; j < widthBL; j++ )
     213      {
     214        piDstU[j] = piSrcU[j] << shift;
     215        piDstV[j] = piSrcV[j] << shift;
     216      }
     217#else
    185218      memcpy( piDstU, piSrcU, sizeof(Pel) * widthBL );
    186219      memcpy( piDstV, piSrcV, sizeof(Pel) * widthBL );
     220#endif
    187221      piSrcU += strideBL;
    188222      piSrcV += strideBL;
     
    191225    }
    192226  }
    193   else
     227  else // general resampling process
    194228  {
    195229    Int refPos16 = 0;
     
    212246
    213247    pcBasePic->setBorderExtension(false);
    214     pcBasePic->extendPicBorder   (); // extend the border.
     248    pcBasePic->extendPicBorder(); // extend the border.
    215249
    216250    Int   shiftX = 16;
     
    219253#if O0215_PHASE_ALIGNMENT //for Luma, if Phase 0, then both PhaseX  and PhaseY should be 0. If symmetric: both PhaseX and PhaseY should be 2
    220254    Int   phaseX = 2*phaseAlignFlag;
     255#if P0312_VERT_PHASE_ADJ
     256    Int   phaseY = vertPhasePositionEnableFlag ? ( vertPhasePositionFlag * 4 ) : ( 2 * phaseAlignFlag );
     257#else
    221258    Int   phaseY = 2*phaseAlignFlag;
     259#endif
    222260#else
    223261    Int   phaseX = 0;
     262#if P0312_VERT_PHASE_ADJ
     263    Int   phaseY = (vertPhasePositionEnableFlag?(vertPhasePositionFlag *4):(0));
     264#else
    224265    Int   phaseY = 0;
     266#endif
    225267#endif
    226268
     
    251293    Int leftOffset = leftStartL > 0 ? leftStartL : 0;
    252294
    253 #if  N0214_INTERMEDIATE_BUFFER_16BITS
     295#if N0214_INTERMEDIATE_BUFFER_16BITS
    254296#if O0194_JOINT_US_BITSHIFT
    255297    // g_bitDepthY was set to EL bit-depth, but shift1 should be calculated using BL bit-depth
     
    274316      for( j = 0; j < heightBL ; j++ )
    275317      {
    276 #if  N0214_INTERMEDIATE_BUFFER_16BITS
     318#if N0214_INTERMEDIATE_BUFFER_16BITS
    277319        *piDstY = sumLumaHor(piSrcY, coeff) >> shift1;
    278320#else
     
    290332    pcTempPic->setHeight(heightEL);
    291333
    292 #if  N0214_INTERMEDIATE_BUFFER_16BITS
     334#if N0214_INTERMEDIATE_BUFFER_16BITS
    293335#if O0194_JOINT_US_BITSHIFT
    294336    Int nShift = 20 - g_bitDepthYLayer[currLayerId];
     
    363405
    364406#if O0215_PHASE_ALIGNMENT
     407    Int phaseXC = phaseAlignFlag;
     408#if P0312_VERT_PHASE_ADJ
     409    Int phaseYC = vertPhasePositionEnableFlag ? ( vertPhasePositionFlag * 4 ) : ( phaseAlignFlag + 1 );
     410#else
     411    Int phaseYC = phaseAlignFlag + 1;
     412#endif
     413#else
    365414    Int phaseXC = 0;
     415#if P0312_VERT_PHASE_ADJ
     416    Int phaseYC = vertPhasePositionEnableFlag ? (vertPhasePositionFlag * 4): 1;
     417#else
    366418    Int phaseYC = 1;
    367 
     419#endif
     420#endif
     421   
    368422#if ROUNDING_OFFSET
    369     addX       = ( ( (phaseXC+phaseAlignFlag) * scaleX + 2 ) >> 2 ) + ( 1 << ( shiftX - 5 ) );
    370     addY       = ( ( (phaseYC+phaseAlignFlag) * scaleY + 2 ) >> 2 ) + ( 1 << ( shiftY - 5 ) );
    371 #else
    372     addX       = ( ( ( widthBL * (phaseXC+phaseAlignFlag) ) << ( shiftX - 2 ) ) + ( widthEL >> 1 ) ) / widthEL + ( 1 << ( shiftX - 5 ) );
    373     addY       = ( ( ( heightBL * (phaseYC+phaseAlignFlag) ) << ( shiftY - 2 ) ) + ( heightEL >> 1 ) ) / heightEL+ ( 1 << ( shiftY - 5 ) );
    374 #endif
    375 
    376     deltaX     = 4 * (phaseXC+phaseAlignFlag);
    377     deltaY     = 4 * (phaseYC+phaseAlignFlag);
    378 #else
    379     phaseX = 0;
    380     phaseY = 1;
    381 
    382 #if ROUNDING_OFFSET
    383     addX       = ( ( phaseX * scaleX + 2 ) >> 2 ) + ( 1 << ( shiftX - 5 ) );
    384     addY       = ( ( phaseY * scaleY + 2 ) >> 2 ) + ( 1 << ( shiftY - 5 ) );
    385 #else
    386     addX       = ( ( ( widthBL * phaseX ) << ( shiftX - 2 ) ) + ( widthEL >> 1 ) ) / widthEL + ( 1 << ( shiftX - 5 ) );
    387     addY       = ( ( ( heightBL * phaseY ) << ( shiftY - 2 ) ) + ( heightEL >> 1 ) ) / heightEL+ ( 1 << ( shiftY - 5 ) );
    388 #endif
    389 
    390     deltaX     = 4 * phaseX;
    391     deltaY     = 4 * phaseY;
    392 #endif
     423    addX       = ( ( phaseXC * scaleX + 2 ) >> 2 ) + ( 1 << ( shiftX - 5 ) );
     424    addY       = ( ( phaseYC * scaleY + 2 ) >> 2 ) + ( 1 << ( shiftY - 5 ) );
     425#else
     426    addX       = ( ( ( widthBL * (phaseXC) ) << ( shiftX - 2 ) ) + ( widthEL >> 1 ) ) / widthEL + ( 1 << ( shiftX - 5 ) );
     427    addY       = ( ( ( heightBL * (phaseYC) ) << ( shiftY - 2 ) ) + ( heightEL >> 1 ) ) / heightEL+ ( 1 << ( shiftY - 5 ) );
     428#endif
     429
     430    deltaX     = 4 * phaseXC;
     431    deltaY     = 4 * phaseYC;
    393432
    394433    shiftXM4 = shiftX - 4;
     
    401440    heightBL  = min<Int>( pcBasePic->getHeight() >> 1, heightEL );
    402441
    403 #if  N0214_INTERMEDIATE_BUFFER_16BITS
     442#if N0214_INTERMEDIATE_BUFFER_16BITS
    404443#if O0194_JOINT_US_BITSHIFT
    405444    // g_bitDepthC was set to EL bit-depth, but shift1 should be calculated using BL bit-depth
     
    426465      for( j = 0; j < heightBL ; j++ )
    427466      {
    428 #if  N0214_INTERMEDIATE_BUFFER_16BITS
     467#if N0214_INTERMEDIATE_BUFFER_16BITS
    429468        *piDstU = sumChromaHor(piSrcU, coeff) >> shift1;
    430469        *piDstV = sumChromaHor(piSrcV, coeff) >> shift1;
     
    447486    pcTempPic->setHeight(heightEL << 1);
    448487
    449 #if  N0214_INTERMEDIATE_BUFFER_16BITS
     488#if N0214_INTERMEDIATE_BUFFER_16BITS
    450489#if O0194_JOINT_US_BITSHIFT
    451490    nShift = 20 - g_bitDepthCLayer[currLayerId];
  • trunk/source/Lib/TLibCommon/TComUpsampleFilter.h

    r494 r644  
    4545#if O0215_PHASE_ALIGNMENT
    4646#if O0194_JOINT_US_BITSHIFT
    47   Void upsampleBasePic( TComSlice* currSlice, UInt refLayerIdc, TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic, const Window window, bool phaseAlignFlag );
     47  Void upsampleBasePic( TComSlice* currSlice, UInt refLayerIdc, TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic, const Window window, Bool phaseAlignFlag );
    4848#else
    49   Void upsampleBasePic( UInt refLayerIdc, TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic, const Window window, bool phaseAlignFlag );
     49  Void upsampleBasePic( UInt refLayerIdc, TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic, const Window window, Bool phaseAlignFlag );
    5050#endif
    5151#else
  • trunk/source/Lib/TLibCommon/TypeDef.h

    r595 r644  
    5050#define O0137_MAX_LAYERID                1      ///< JCTVC-O0137, JCTVC-O0200, JCTVC-O0223: restrict nuh_layer_id and vps_max_layers_minus1
    5151
     52#define P0312_VERT_PHASE_ADJ             1      ///< JCTVC-P0312: vertical phase adjustment in re-sampling process (BoG report)
    5253#define P0130_EOB                        1      ///< JCTVC-P0130, set layer Id of EOB NALU to be fixed to 0
    5354#define P0307_REMOVE_VPS_VUI_OFFSET      1      ///< JCTVC-P0307, remove implementation related to VPS VUI offset signalling
    5455#define P0307_VPS_NON_VUI_EXTENSION      1      ///< JCTVC-P0307, implementation related to NON VUI VPS Extension signalling
     56#define P0307_VPS_NON_VUI_EXT_UPDATE     1      ///< JCTVC-P0307, implementation related to NON VUI VPS Extension signalling
    5557
    5658#define DISCARDABLE_PIC_RPS              1      ///< JCTVC-P0130: Inter-layer RPS and temporal RPS should not contain picture with discardable_flag equal to 1
     
    5860#define CHANGE_NUMSUBDPB_IDX             1      ///< Change index of NumSubDpb from output layer set to layer set, to be more aligned with the Spec
    5961#define RESOLUTION_BASED_DPB             1      ///< JCTVC-P0192: Assign layers to sub-DPBs based on the rep_format() signaled in the VPS
     62#define ALIGNED_BUMPING                  1      ///< JCTVC-P0192: Align bumping of pictures in an AU
     63#define MAX_SUBDPBS                      MAX_LAYERS
    6064#define SUB_BITSTREAM_PROPERTY_SEI       1      ///< JCTVC-P0204: Sub-bitstream property SEI message
    6165#if SUB_BITSTREAM_PROPERTY_SEI
     
    7579
    7680#define O0135_DEFAULT_ONE_OUT_SEMANTIC   1      ///< JCTVC-O0135: semantics change of default_one_target_output_layer_idc for auxiliary pictures
     81
     82#define O0164_MULTI_LAYER_HRD            1      ///< JCTVC-O0164: Multi-layer HRD operation
    7783
    7884#define O0194_DIFFERENT_BITDEPTH_EL_BL   1      ///< JCTVC-O0194: Support for different bitdepth values for BL and EL, add required configuration parameters (and Some bugfixes when REPN_FORMAT_IN_VPS (JCTVC-N0092) is enabled)
     
    8490#define VPS_NUH_LAYER_ID                 1      ///< JCTVC-N0085: Assert that the nuh_layer_id of VPS NAL unit should be 0
    8591#define POC_RESET_FLAG                   1      ///< JCTVC-N0244: POC reset flag for  layer pictures.
     92#define POC_RESET_IDC                    1      ///< JCTVC-P0041: Include poc_reset_idc and related derivation - eventually will replace POC_RESET_FLAG
     93#if POC_RESET_IDC
     94#define POC_RESET_IDC_SIGNALLING         1      ///< JCTVC-P0041: Include signalling for poc_reset related syntax elements
     95#endif
     96#define NO_OUTPUT_OF_PRIOR_PICS          1      ///< Use no_output_of_prior_pics_flag
    8697#define ALIGN_TSA_STSA_PICS              1      ///< JCTVC-N0084: Alignment of TSA and STSA pictures across AU.
    8798#define REPN_FORMAT_IN_VPS               1      ///< JCTVC-N0092: Signal represenation format (spatial resolution, bit depth, colour format) in the VPS
     
    137148#define VPS_VUI_VIDEO_SIGNAL_MOVE        1      ///< JCTVC-P0076 Move video signal information syntax structure earlier in the VPS VUI
    138149#endif
     150#define P0182_VPS_VUI_PS_FLAG            1      ///< JCTVC-P0182, add base_layer_parameter_set_compatibility_flag
    139151#endif //VPS_VUI
    140152
     
    179191#define O0223_PICTURE_TYPES_ALIGN_FLAG   1  ///< a flag to indicatate whether picture types are aligned across layers.
    180192
     193#define P0068_CROSS_LAYER_ALIGNED_IDR_ONLY_FOR_IRAP_FLAG   1  ///< a flag to indicatate whether picture types for IRAP are IDR across layers.
     194
    181195#define N0147_IRAP_ALIGN_FLAG            1      ///< a flag to indicatate whether IRAPs are aligned across layers
    182196#if N0147_IRAP_ALIGN_FLAG
     
    216230
    217231#define O0153_ALT_OUTPUT_LAYER_FLAG      1      ///< JCTVC-O0153: alt output layer flag
     232#define P0300_ALT_OUTPUT_LAYER_FLAG      1      ///< JCTVC-P0300: alt output layer flag
    218233
    219234#define VPS_DPB_SIZE_TABLE               1      ///< JCTVC-O0217: DPB operations: signaling DPB-related parameters
     
    224239#endif
    225240#endif
    226 
     241#define SPS_DPB_PARAMS                   1      ///< JCTVC-P0155 signaling & inferrence for sps dpb parameters for nuh_layer_id > 0
     242#define DPB_PARAMS_MAXTLAYERS            1      ///< JCTVC-P0156 DPB parameters up to maximum temporal sub-layers in the layer set
     243#define NUM_OL_FLAGS                     1      ///< JCTVC-P0156 output_layer_flag[ i ][ j ] is signalled for j equal to 0 to NumLayersInIdList[ lsIdx ] inclusive
    227244#define NO_CLRAS_OUTPUT_FLAG             1
    228245#define O0149_CROSS_LAYER_BLA_FLAG       1      ///< JCTVC-O0149: signal cross_layer_bla_flag in slice header
     246
     247#define P0138_USE_ALT_CPB_PARAMS_FLAG    1      ///< JCTVC-P0138: use_alt_cpb_params_flag syntax in buffering period SEI message extension
     248#define P0166_MODIFIED_PPS_EXTENSION     1      ///< JCTVC-P0166: add pps_extension_type_flag
    229249
    230250#if VIEW_ID_RELATED_SIGNALING
  • trunk/source/Lib/TLibDecoder/SEIread.cpp

    r595 r644  
    111111#endif
    112112#if SUB_BITSTREAM_PROPERTY_SEI
    113     case SEI::SUB_BITSTREAM_PROPERTY:
    114       fprintf( g_hTrace, "=========== Sub-bitstream property SEI message ===========\n");
    115       break;
     113  case SEI::SUB_BITSTREAM_PROPERTY:
     114    fprintf( g_hTrace, "=========== Sub-bitstream property SEI message ===========\n");
     115    break;
     116#endif
     117#if O0164_MULTI_LAYER_HRD
     118  case SEI::BSP_NESTING:
     119    fprintf( g_hTrace, "=========== Bitstream parition nesting SEI message ===========\n");
     120    break;
     121  case SEI::BSP_INITIAL_ARRIVAL_TIME:
     122    fprintf( g_hTrace, "=========== Bitstream parition initial arrival time SEI message ===========\n");
     123    break;
     124  case SEI::BSP_HRD:
     125    fprintf( g_hTrace, "=========== Bitstream parition HRD parameters SEI message ===========\n");
     126    break;
    116127#endif
    117128#endif //SVC_EXTENSION
     
    152163}
    153164
     165#if O0164_MULTI_LAYER_HRD
     166#if LAYERS_NOT_PRESENT_SEI
     167Void SEIReader::xReadSEImessage(SEIMessages& seis, const NalUnitType nalUnitType, TComVPS *vps, TComSPS *sps, const SEIScalableNesting *nestingSei, const SEIBspNesting *bspNestingSei)
     168#else
     169Void SEIReader::xReadSEImessage(SEIMessages& seis, const NalUnitType nalUnitType, TComSPS *sps, const SEIScalableNesting *nestingSei)
     170#endif
     171#else
    154172#if LAYERS_NOT_PRESENT_SEI
    155173Void SEIReader::xReadSEImessage(SEIMessages& seis, const NalUnitType nalUnitType, TComVPS *vps, TComSPS *sps)
    156174#else
    157175Void SEIReader::xReadSEImessage(SEIMessages& seis, const NalUnitType nalUnitType, TComSPS *sps)
     176#endif
    158177#endif
    159178{
     
    272291      xParseSEIScalableNesting((SEIScalableNesting&) *sei, nalUnitType, payloadSize, sps);
    273292#endif
     293      break;
    274294#if SVC_EXTENSION
    275295#if LAYERS_NOT_PRESENT_SEI
     
    296316     sei = new SEISubBitstreamProperty;
    297317     xParseSEISubBitstreamProperty((SEISubBitstreamProperty&) *sei);
     318     break;
     319#endif
     320#if O0164_MULTI_LAYER_HRD
     321   case SEI::BSP_NESTING:
     322     sei = new SEIBspNesting;
     323#if LAYERS_NOT_PRESENT_SEI
     324     xParseSEIBspNesting((SEIBspNesting&) *sei, nalUnitType, vps, sps, *nestingSei);
     325#else
     326     xParseSEIBspNesting((SEIBspNesting&) *sei, nalUnitType, sps, *nestingSei);
     327#endif
     328     break;
     329   case SEI::BSP_INITIAL_ARRIVAL_TIME:
     330     sei = new SEIBspInitialArrivalTime;
     331     xParseSEIBspInitialArrivalTime((SEIBspInitialArrivalTime&) *sei, vps, sps, *nestingSei, *bspNestingSei);
     332     break;
     333   case SEI::BSP_HRD:
     334     sei = new SEIBspHrd;
     335     xParseSEIBspHrd((SEIBspHrd&) *sei, sps, *nestingSei);
    298336     break;
    299337#endif
     
    380418}
    381419
     420#if P0138_USE_ALT_CPB_PARAMS_FLAG
     421/**
     422 * Check if SEI message contains payload extension
     423 */
     424Bool SEIReader::xPayloadExtensionPresent()
     425{
     426  Int payloadBitsRemaining = getBitstream()->getNumBitsLeft();
     427  Bool payloadExtensionPresent = false;
     428
     429  if (payloadBitsRemaining > 8)
     430  {
     431    payloadExtensionPresent = true;
     432  }
     433  else
     434  {
     435    Int finalBits = getBitstream()->peekBits(payloadBitsRemaining);
     436    while (payloadBitsRemaining && (finalBits & 1) == 0)
     437    {
     438      payloadBitsRemaining--;
     439      finalBits >>= 1;
     440    }
     441    payloadBitsRemaining--;
     442    if (payloadBitsRemaining > 0)
     443    {
     444      payloadExtensionPresent = true;
     445    }
     446  }
     447
     448  return payloadExtensionPresent;
     449}
     450#endif
     451
    382452/**
    383453 * parse bitstream bs and unpack a user_data_unregistered SEI message
     
    536606    }
    537607  }
     608
     609#if P0138_USE_ALT_CPB_PARAMS_FLAG
     610  sei.m_useAltCpbParamsFlag = false;
     611  sei.m_useAltCpbParamsFlagPresent = false;
     612  if (xPayloadExtensionPresent())
     613  {
     614    READ_FLAG (code, "use_alt_cpb_params_flag");
     615    sei.m_useAltCpbParamsFlag = code;
     616    sei.m_useAltCpbParamsFlagPresent = true;
     617  }
     618#endif
     619
    538620  xParseByteAlign();
    539621}
     
    826908  // read nested SEI messages
    827909  do {
     910#if O0164_MULTI_LAYER_HRD
     911#if LAYERS_NOT_PRESENT_SEI
     912    xReadSEImessage(sei.m_nestedSEIs, nalUnitType, vps, sps, &sei);
     913#else
     914    xReadSEImessage(sei.m_nestedSEIs, nalUnitType, sps, &sei);
     915#endif
     916#else
    828917#if LAYERS_NOT_PRESENT_SEI
    829918    xReadSEImessage(sei.m_nestedSEIs, nalUnitType, vps, sps);
    830919#else
    831920    xReadSEImessage(sei.m_nestedSEIs, nalUnitType, sps);
     921#endif
    832922#endif
    833923  } while (m_pcBitstream->getNumBitsLeft() > 8);
     
    9301020}
    9311021#endif
     1022
     1023#if O0164_MULTI_LAYER_HRD
     1024#if LAYERS_NOT_PRESENT_SEI
     1025Void SEIReader::xParseSEIBspNesting(SEIBspNesting &sei, const NalUnitType nalUnitType, TComVPS *vps, TComSPS *sps, const SEIScalableNesting &nestingSei)
     1026#else
     1027Void SEIReader::xParseSEIBspNesting(SEIBspNesting &sei, const NalUnitType nalUnitType, TComSPS *sps, const SEIScalableNesting &nestingSei)
     1028#endif
     1029{
     1030  UInt uiCode;
     1031  READ_UVLC( uiCode, "bsp_idx" ); sei.m_bspIdx = uiCode;
     1032
     1033  // byte alignment
     1034  while ( m_pcBitstream->getNumBitsRead() % 8 != 0 )
     1035  {
     1036    UInt code;
     1037    READ_FLAG( code, "bsp_nesting_zero_bit" );
     1038  }
     1039
     1040  sei.m_callerOwnsSEIs = false;
     1041
     1042  // read nested SEI messages
     1043  do {
     1044#if LAYERS_NOT_PRESENT_SEI
     1045    xReadSEImessage(sei.m_nestedSEIs, nalUnitType, vps, sps, &nestingSei, &sei);
     1046#else
     1047    xReadSEImessage(sei.m_nestedSEIs, nalUnitType, sps, &nestingSei);
     1048#endif
     1049  } while (m_pcBitstream->getNumBitsLeft() > 8);
     1050}
     1051
     1052Void SEIReader::xParseSEIBspInitialArrivalTime(SEIBspInitialArrivalTime &sei, TComVPS *vps, TComSPS *sps, const SEIScalableNesting &nestingSei, const SEIBspNesting &bspNestingSei)
     1053{
     1054  assert(vps->getVpsVuiPresentFlag());
     1055
     1056  UInt schedCombCnt = vps->getNumBspSchedCombinations(nestingSei.m_nestingOpIdx[0]);
     1057  UInt len;
     1058  UInt hrdIdx;
     1059  UInt uiCode;
     1060
     1061  if (schedCombCnt > 0)
     1062  {
     1063    hrdIdx = vps->getBspCombHrdIdx(nestingSei.m_nestingOpIdx[0], 0, bspNestingSei.m_bspIdx);
     1064  }
     1065  else
     1066  {
     1067    hrdIdx = 0;
     1068  }
     1069
     1070  TComHRD *hrd = vps->getBspHrd(hrdIdx);
     1071
     1072  if (hrd->getNalHrdParametersPresentFlag() || hrd->getVclHrdParametersPresentFlag())
     1073  {
     1074    len = hrd->getInitialCpbRemovalDelayLengthMinus1() + 1;
     1075  }
     1076  else
     1077  {
     1078    len = 23 + 1;
     1079  }
     1080
     1081  if (hrd->getNalHrdParametersPresentFlag())
     1082  {
     1083    for(UInt i = 0; i < schedCombCnt; i++)
     1084    {
     1085      READ_CODE( len, uiCode, "nal_initial_arrival_delay" ); sei.m_nalInitialArrivalDelay[i] = uiCode;
     1086    }
     1087  }
     1088  else
     1089  {
     1090    for(UInt i = 0; i < schedCombCnt; i++)
     1091    {
     1092      READ_CODE( len, uiCode, "vcl_initial_arrival_delay" ); sei.m_vclInitialArrivalDelay[i] = uiCode;
     1093    }
     1094  }
     1095}
     1096
     1097Void SEIReader::xParseSEIBspHrd(SEIBspHrd &sei, TComSPS *sps, const SEIScalableNesting &nestingSei)
     1098{
     1099  UInt uiCode;
     1100  READ_UVLC( uiCode, "sei_num_bsp_hrd_parameters_minus1" ); sei.m_seiNumBspHrdParametersMinus1 = uiCode;
     1101  for (UInt i = 0; i <= sei.m_seiNumBspHrdParametersMinus1; i++)
     1102  {
     1103    if (i > 0)
     1104    {
     1105      READ_FLAG( uiCode, "sei_bsp_cprms_present_flag" ); sei.m_seiBspCprmsPresentFlag[i] = uiCode;
     1106    }
     1107    xParseHrdParameters(sei.hrd, i==0 ? 1 : sei.m_seiBspCprmsPresentFlag[i], nestingSei.m_nestingMaxTemporalIdPlus1[0]-1);
     1108  }
     1109  for (UInt h = 0; h <= nestingSei.m_nestingNumOpsMinus1; h++)
     1110  {
     1111    UInt lsIdx = nestingSei.m_nestingOpIdx[h];
     1112    READ_UVLC( uiCode, "num_sei_bitstream_partitions_minus1[i]"); sei.m_seiNumBitstreamPartitionsMinus1[lsIdx] = uiCode;
     1113    for (UInt i = 0; i <= sei.m_seiNumBitstreamPartitionsMinus1[lsIdx]; i++)
     1114    {
     1115      for (UInt j = 0; j < sei.m_vpsMaxLayers; j++)
     1116      {
     1117        if (sei.m_layerIdIncludedFlag[lsIdx][j])
     1118        {
     1119          READ_FLAG( uiCode, "sei_layer_in_bsp_flag[lsIdx][i][j]" ); sei.m_seiLayerInBspFlag[lsIdx][i][j] = uiCode;
     1120        }
     1121      }
     1122    }
     1123    READ_UVLC( uiCode, "sei_num_bsp_sched_combinations_minus1[i]"); sei.m_seiNumBspSchedCombinationsMinus1[lsIdx] = uiCode;
     1124    for (UInt i = 0; i <= sei.m_seiNumBspSchedCombinationsMinus1[lsIdx]; i++)
     1125    {
     1126      for (UInt j = 0; j <= sei.m_seiNumBitstreamPartitionsMinus1[lsIdx]; j++)
     1127      {
     1128        READ_UVLC( uiCode, "sei_bsp_comb_hrd_idx[lsIdx][i][j]"); sei.m_seiBspCombHrdIdx[lsIdx][i][j] = uiCode;
     1129        READ_UVLC( uiCode, "sei_bsp_comb_sched_idx[lsIdx][i][j]"); sei.m_seiBspCombScheddx[lsIdx][i][j] = uiCode;
     1130      }
     1131    }
     1132  }
     1133}
     1134
     1135Void SEIReader::xParseHrdParameters(TComHRD *hrd, Bool commonInfPresentFlag, UInt maxNumSubLayersMinus1)
     1136{
     1137  UInt  uiCode;
     1138  if( commonInfPresentFlag )
     1139  {
     1140    READ_FLAG( uiCode, "nal_hrd_parameters_present_flag" );           hrd->setNalHrdParametersPresentFlag( uiCode == 1 ? true : false );
     1141    READ_FLAG( uiCode, "vcl_hrd_parameters_present_flag" );           hrd->setVclHrdParametersPresentFlag( uiCode == 1 ? true : false );
     1142    if( hrd->getNalHrdParametersPresentFlag() || hrd->getVclHrdParametersPresentFlag() )
     1143    {
     1144      READ_FLAG( uiCode, "sub_pic_cpb_params_present_flag" );         hrd->setSubPicCpbParamsPresentFlag( uiCode == 1 ? true : false );
     1145      if( hrd->getSubPicCpbParamsPresentFlag() )
     1146      {
     1147        READ_CODE( 8, uiCode, "tick_divisor_minus2" );                hrd->setTickDivisorMinus2( uiCode );
     1148        READ_CODE( 5, uiCode, "du_cpb_removal_delay_length_minus1" ); hrd->setDuCpbRemovalDelayLengthMinus1( uiCode );
     1149        READ_FLAG( uiCode, "sub_pic_cpb_params_in_pic_timing_sei_flag" ); hrd->setSubPicCpbParamsInPicTimingSEIFlag( uiCode == 1 ? true : false );
     1150        READ_CODE( 5, uiCode, "dpb_output_delay_du_length_minus1"  ); hrd->setDpbOutputDelayDuLengthMinus1( uiCode );
     1151      }
     1152      READ_CODE( 4, uiCode, "bit_rate_scale" );                       hrd->setBitRateScale( uiCode );
     1153      READ_CODE( 4, uiCode, "cpb_size_scale" );                       hrd->setCpbSizeScale( uiCode );
     1154      if( hrd->getSubPicCpbParamsPresentFlag() )
     1155      {
     1156        READ_CODE( 4, uiCode, "cpb_size_du_scale" );                  hrd->setDuCpbSizeScale( uiCode );
     1157      }
     1158      READ_CODE( 5, uiCode, "initial_cpb_removal_delay_length_minus1" ); hrd->setInitialCpbRemovalDelayLengthMinus1( uiCode );
     1159      READ_CODE( 5, uiCode, "au_cpb_removal_delay_length_minus1" );      hrd->setCpbRemovalDelayLengthMinus1( uiCode );
     1160      READ_CODE( 5, uiCode, "dpb_output_delay_length_minus1" );       hrd->setDpbOutputDelayLengthMinus1( uiCode );
     1161    }
     1162  }
     1163  Int i, j, nalOrVcl;
     1164  for( i = 0; i <= maxNumSubLayersMinus1; i ++ )
     1165  {
     1166    READ_FLAG( uiCode, "fixed_pic_rate_general_flag" );                     hrd->setFixedPicRateFlag( i, uiCode == 1 ? true : false  );
     1167    if( !hrd->getFixedPicRateFlag( i ) )
     1168    {
     1169      READ_FLAG( uiCode, "fixed_pic_rate_within_cvs_flag" );                hrd->setFixedPicRateWithinCvsFlag( i, uiCode == 1 ? true : false  );
     1170    }
     1171    else
     1172    {
     1173      hrd->setFixedPicRateWithinCvsFlag( i, true );
     1174    }
     1175    hrd->setLowDelayHrdFlag( i, 0 ); // Infered to be 0 when not present
     1176    hrd->setCpbCntMinus1   ( i, 0 ); // Infered to be 0 when not present
     1177    if( hrd->getFixedPicRateWithinCvsFlag( i ) )
     1178    {
     1179      READ_UVLC( uiCode, "elemental_duration_in_tc_minus1" );             hrd->setPicDurationInTcMinus1( i, uiCode );
     1180    }
     1181    else
     1182    {
     1183      READ_FLAG( uiCode, "low_delay_hrd_flag" );                      hrd->setLowDelayHrdFlag( i, uiCode == 1 ? true : false  );
     1184    }
     1185    if (!hrd->getLowDelayHrdFlag( i ))
     1186    {
     1187      READ_UVLC( uiCode, "cpb_cnt_minus1" );                          hrd->setCpbCntMinus1( i, uiCode );
     1188    }
     1189    for( nalOrVcl = 0; nalOrVcl < 2; nalOrVcl ++ )
     1190    {
     1191      if( ( ( nalOrVcl == 0 ) && ( hrd->getNalHrdParametersPresentFlag() ) ) ||
     1192          ( ( nalOrVcl == 1 ) && ( hrd->getVclHrdParametersPresentFlag() ) ) )
     1193      {
     1194        for( j = 0; j <= ( hrd->getCpbCntMinus1( i ) ); j ++ )
     1195        {
     1196          READ_UVLC( uiCode, "bit_rate_value_minus1" );             hrd->setBitRateValueMinus1( i, j, nalOrVcl, uiCode );
     1197          READ_UVLC( uiCode, "cpb_size_value_minus1" );             hrd->setCpbSizeValueMinus1( i, j, nalOrVcl, uiCode );
     1198          if( hrd->getSubPicCpbParamsPresentFlag() )
     1199          {
     1200            READ_UVLC( uiCode, "cpb_size_du_value_minus1" );       hrd->setDuCpbSizeValueMinus1( i, j, nalOrVcl, uiCode );
     1201            READ_UVLC( uiCode, "bit_rate_du_value_minus1" );       hrd->setDuBitRateValueMinus1( i, j, nalOrVcl, uiCode );
     1202          }
     1203          READ_FLAG( uiCode, "cbr_flag" );                          hrd->setCbrFlag( i, j, nalOrVcl, uiCode == 1 ? true : false  );
     1204        }
     1205      }
     1206    }
     1207  }
     1208}
     1209#endif
     1210
    9321211#endif //SVC_EXTENSION
    9331212
  • trunk/source/Lib/TLibDecoder/SEIread.h

    r595 r644  
    6262#endif
    6363protected:
     64#if O0164_MULTI_LAYER_HRD
     65#if LAYERS_NOT_PRESENT_SEI
     66  Void xReadSEImessage                (SEIMessages& seis, const NalUnitType nalUnitType, TComVPS *vps, TComSPS *sps, const SEIScalableNesting *nestingSei=NULL, const SEIBspNesting *bspNestingSei=NULL);
     67#else
     68  Void xReadSEImessage                (SEIMessages& seis, const NalUnitType nalUnitType, TComSPS *sps, const SEIScalableNesting *nestingSei=NULL);
     69#endif
     70#else
    6471#if LAYERS_NOT_PRESENT_SEI
    6572  Void xReadSEImessage                (SEIMessages& seis, const NalUnitType nalUnitType, TComVPS *vps, TComSPS *sps);
    6673#else
    6774  Void xReadSEImessage                (SEIMessages& seis, const NalUnitType nalUnitType, TComSPS *sps);
     75#endif
     76#endif
     77#if P0138_USE_ALT_CPB_PARAMS_FLAG
     78  Bool xPayloadExtensionPresent       ();
    6879#endif
    6980  Void xParseSEIuserDataUnregistered  (SEIuserDataUnregistered &sei, UInt payloadSize);
     
    92103  Void xParseSEIScalableNesting       (SEIScalableNesting& sei, const NalUnitType nalUnitType, UInt payloadSize, TComSPS *sps);
    93104#endif
     105#if O0164_MULTI_LAYER_HRD
     106#if LAYERS_NOT_PRESENT_SEI
     107  Void xParseSEIBspNesting(SEIBspNesting &sei, const NalUnitType nalUnitType, TComVPS *vps, TComSPS *sps, const SEIScalableNesting &nestingSei);
     108#else
     109  Void xParseSEIBspNesting(SEIBspNesting &sei, const NalUnitType nalUnitType, TComSPS *sps, const SEIScalableNesting &nestingSei);
     110#endif
     111  Void xParseSEIBspInitialArrivalTime(SEIBspInitialArrivalTime &sei, TComVPS *vps, TComSPS *sps, const SEIScalableNesting &nestingSei, const SEIBspNesting &bspNestingSei);
     112  Void xParseSEIBspHrd(SEIBspHrd &sei, TComSPS *sps, const SEIScalableNesting &nestingSei);
     113  Void xParseHrdParameters(TComHRD *hrd, Bool commonInfPresentFlag, UInt maxNumSubLayersMinus1);
     114#endif
    94115  Void xParseByteAlign();
    95116};
  • trunk/source/Lib/TLibDecoder/TDecCAVLC.cpp

    r595 r644  
    334334  if (uiCode)
    335335  {
     336#if P0166_MODIFIED_PPS_EXTENSION
     337    UInt ppsExtensionTypeFlag[8];
     338    for (UInt i = 0; i < 8; i++)
     339    {
     340      READ_FLAG( ppsExtensionTypeFlag[i], "pps_extension_type_flag" );
     341    }
     342#if !POC_RESET_IDC
     343    if (ppsExtensionTypeFlag[1])
     344    {
     345#else
     346    if( ppsExtensionTypeFlag[0] )
     347    {
     348      READ_FLAG( uiCode, "poc_reset_info_present_flag" );
     349      pcPPS->setPocResetInfoPresentFlag(uiCode ? true : false);
     350#endif
     351    }
     352    if (ppsExtensionTypeFlag[7])
     353    {
     354#endif
     355
    336356    while ( xMoreRbspData() )
    337357    {
    338358      READ_FLAG( uiCode, "pps_extension_data_flag");
    339359    }
     360#if P0166_MODIFIED_PPS_EXTENSION
     361    }
     362#endif
    340363  }
    341364}
     
    514537}
    515538
    516 #if SVC_EXTENSION
     539#if SVC_EXTENSION && !SPS_DPB_PARAMS
    517540Void TDecCavlc::parseSPS(TComSPS* pcSPS, ParameterSetManagerDecoder *parameterSetManager)
    518541#else
     
    536559#if SVC_EXTENSION
    537560  }
     561#if !SPS_DPB_PARAMS
    538562  else
    539563  {
     
    542566  }
    543567#endif
     568#endif
     569
    544570  if ( pcSPS->getMaxTLayers() == 1 )
    545571  {
    546572    // sps_temporal_id_nesting_flag must be 1 when sps_max_sub_layers_minus1 is 0
    547573#if SVC_EXTENSION
     574#if !SPS_DPB_PARAMS
    548575    assert( pcSPS->getTemporalIdNestingFlag() == true );
     576#endif
    549577#else
    550578    assert( uiCode == 1 );
     
    644672  assert(uiCode <= 12);
    645673
    646   UInt subLayerOrderingInfoPresentFlag;
    647   READ_FLAG(subLayerOrderingInfoPresentFlag, "sps_sub_layer_ordering_info_present_flag");
    648 
    649   for(UInt i=0; i <= pcSPS->getMaxTLayers()-1; i++)
    650   {
    651     READ_UVLC ( uiCode, "sps_max_dec_pic_buffering_minus1");
    652     pcSPS->setMaxDecPicBuffering( uiCode + 1, i);
    653     READ_UVLC ( uiCode, "sps_num_reorder_pics" );
    654     pcSPS->setNumReorderPics(uiCode, i);
    655     READ_UVLC ( uiCode, "sps_max_latency_increase_plus1");
    656     pcSPS->setMaxLatencyIncrease( uiCode, i );
    657 
    658     if (!subLayerOrderingInfoPresentFlag)
    659     {
    660       for (i++; i <= pcSPS->getMaxTLayers()-1; i++)
    661       {
    662         pcSPS->setMaxDecPicBuffering(pcSPS->getMaxDecPicBuffering(0), i);
    663         pcSPS->setNumReorderPics(pcSPS->getNumReorderPics(0), i);
    664         pcSPS->setMaxLatencyIncrease(pcSPS->getMaxLatencyIncrease(0), i);
    665       }
    666       break;
    667     }
    668   }
    669 
     674#if SPS_DPB_PARAMS
     675  if( pcSPS->getLayerId() == 0 ) 
     676  {
     677#endif
     678    UInt subLayerOrderingInfoPresentFlag;
     679    READ_FLAG(subLayerOrderingInfoPresentFlag, "sps_sub_layer_ordering_info_present_flag");
     680
     681    for(UInt i=0; i <= pcSPS->getMaxTLayers()-1; i++)
     682    {
     683      READ_UVLC ( uiCode, "sps_max_dec_pic_buffering_minus1");
     684      pcSPS->setMaxDecPicBuffering( uiCode + 1, i);
     685      READ_UVLC ( uiCode, "sps_num_reorder_pics" );
     686      pcSPS->setNumReorderPics(uiCode, i);
     687      READ_UVLC ( uiCode, "sps_max_latency_increase_plus1");
     688      pcSPS->setMaxLatencyIncrease( uiCode, i );
     689
     690      if (!subLayerOrderingInfoPresentFlag)
     691      {
     692        for (i++; i <= pcSPS->getMaxTLayers()-1; i++)
     693        {
     694          pcSPS->setMaxDecPicBuffering(pcSPS->getMaxDecPicBuffering(0), i);
     695          pcSPS->setNumReorderPics(pcSPS->getNumReorderPics(0), i);
     696          pcSPS->setMaxLatencyIncrease(pcSPS->getMaxLatencyIncrease(0), i);
     697        }
     698        break;
     699      }
     700    }
     701#if SPS_DPB_PARAMS
     702  }
     703#endif
    670704  READ_UVLC( uiCode, "log2_min_coding_block_size_minus3" );
    671705  Int log2MinCUSize = uiCode + 3;
     
    824858      Window& scaledWindow = pcSPS->getScaledRefLayerWindow(i);
    825859#if O0098_SCALED_REF_LAYER_ID
    826       READ_CODE( 6,  uiCode,  "scaled_ref_layer_left_id" );  pcSPS->setScaledRefLayerId( i, uiCode );
     860      READ_CODE( 6,  uiCode,  "scaled_ref_layer_id" );       pcSPS->setScaledRefLayerId( i, uiCode );
    827861#endif
    828862      READ_SVLC( iCode, "scaled_ref_layer_left_offset" );    scaledWindow.setWindowLeftOffset  (iCode << 1);
     
    830864      READ_SVLC( iCode, "scaled_ref_layer_right_offset" );   scaledWindow.setWindowRightOffset (iCode << 1);
    831865      READ_SVLC( iCode, "scaled_ref_layer_bottom_offset" );  scaledWindow.setWindowBottomOffset(iCode << 1);
     866#if P0312_VERT_PHASE_ADJ
     867      READ_FLAG( uiCode, "vert_phase_position_enable_flag" ); scaledWindow.setVertPhasePositionEnableFlag(uiCode);  pcSPS->setVertPhasePositionEnableFlag( pcSPS->getScaledRefLayerId(i), uiCode);   
     868#endif
    832869    }
    833870  }
     
    850887  READ_CODE( 6,  uiCode,  "vps_reserved_zero_6bits" );            assert(uiCode == 0);
    851888#endif
    852   READ_CODE( 3,  uiCode,  "vps_max_sub_layers_minus1" );          pcVPS->setMaxTLayers( uiCode + 1 );
     889  READ_CODE( 3,  uiCode,  "vps_max_sub_layers_minus1" );          pcVPS->setMaxTLayers( uiCode + 1 ); assert(uiCode <= 6);
    853890  READ_FLAG(     uiCode,  "vps_temporal_id_nesting_flag" );       pcVPS->setTemporalNestingFlag( uiCode ? true:false );
    854891  assert (pcVPS->getMaxTLayers()>1||pcVPS->getTemporalNestingFlag());
     
    9701007  UInt uiCode;
    9711008  // ... More syntax elements to be parsed here
     1009#if P0300_ALT_OUTPUT_LAYER_FLAG
     1010  Int NumOutputLayersInOutputLayerSet[MAX_VPS_LAYER_SETS_PLUS1];
     1011  Int OlsHighestOutputLayerId[MAX_VPS_LAYER_SETS_PLUS1];
     1012#endif
    9721013#if VPS_EXTN_MASK_AND_DIM_INFO
    9731014  UInt numScalabilityTypes = 0, i = 0, j = 0;
     
    10911132    if (vps->getMaxTSLayersPresentFlag())
    10921133    {
    1093         for(i = 0; i < vps->getMaxLayers() - 1; i++)
     1134        for(i = 0; i < vps->getMaxLayers(); i++)
    10941135        {
    10951136            READ_CODE( 3, uiCode, "sub_layers_vps_max_minus1[i]" ); vps->setMaxTSLayersMinus1(i, uiCode);
     
    10981139    else
    10991140    {
    1100         for( i = 0; i < vps->getMaxLayers() - 1; i++)
     1141        for( i = 0; i < vps->getMaxLayers(); i++)
    11011142        {
    11021143            vps->setMaxTSLayersMinus1(i, vps->getMaxTLayers()-1);
     
    12381279    {
    12391280      Int lsIdx = vps->getOutputLayerSetIdx(i);
     1281#if NUM_OL_FLAGS
     1282      for(j = 0; j < vps->getNumLayersInIdList(lsIdx) ; j++)
     1283#else
    12401284      for(j = 0; j < vps->getNumLayersInIdList(lsIdx) - 1; j++)
     1285#endif
    12411286      {
    12421287        READ_FLAG( uiCode, "output_layer_flag[i][j]"); vps->setOutputLayerFlag(i, j, uiCode);
     
    12691314    }
    12701315    READ_CODE( numBits, uiCode, "profile_level_tier_idx[i]" );     vps->setProfileLevelTierIdx(i, uiCode);
     1316#if P0300_ALT_OUTPUT_LAYER_FLAG
     1317    NumOutputLayersInOutputLayerSet[i] = 0;
     1318    Int layerSetIdxForOutputLayerSet = vps->getOutputLayerSetIdx(i);
     1319    for (j = 0; j < vps->getNumLayersInIdList(layerSetIdxForOutputLayerSet); j++)
     1320    {
     1321      NumOutputLayersInOutputLayerSet[i] += vps->getOutputLayerFlag(i, j);
     1322      if (vps->getOutputLayerFlag(i, j))
     1323      {
     1324        OlsHighestOutputLayerId[i] = vps->getLayerSetLayerIdList(layerSetIdxForOutputLayerSet, j);
     1325      }
     1326    }
     1327    if (NumOutputLayersInOutputLayerSet[i] == 1 && vps->getNumDirectRefLayers(OlsHighestOutputLayerId[i]) > 0)
     1328    {
     1329      READ_FLAG(uiCode, "alt_output_layer_flag[i]");
     1330      vps->setAltOuputLayerFlag(i, uiCode ? true : false);
     1331    }
     1332#endif
    12711333  }
    12721334#else
     
    12921354      READ_CODE( numBits, uiCode, "output_layer_set_idx_minus1");   vps->setOutputLayerSetIdx( i, uiCode + 1);
    12931355      Int lsIdx = vps->getOutputLayerSetIdx(i);
     1356#if NUM_OL_FLAGS
     1357      for(j = 0; j < vps->getNumLayersInIdList(lsIdx) ; j++)
     1358#else
    12941359      for(j = 0; j < vps->getNumLayersInIdList(lsIdx) - 1; j++)
     1360#endif
    12951361      {
    12961362        READ_FLAG( uiCode, "output_layer_flag[i][j]"); vps->setOutputLayerFlag(i, j, uiCode);
     
    13541420#endif
    13551421
     1422#if !P0300_ALT_OUTPUT_LAYER_FLAG
    13561423#if O0153_ALT_OUTPUT_LAYER_FLAG
    13571424  if( vps->getMaxLayers() > 1 )
     
    13601427    vps->setAltOuputLayerFlag( uiCode ? true : false );
    13611428  }
     1429#endif
    13621430#endif
    13631431
     
    15101578#if P0307_VPS_NON_VUI_EXTENSION
    15111579  READ_UVLC( uiCode,           "vps_non_vui_extension_length"); vps->setVpsNonVuiExtLength((Int)uiCode);
     1580#if P0307_VPS_NON_VUI_EXT_UPDATE
     1581  Int nonVuiExtByte = uiCode;
     1582  for (i = 1; i <= nonVuiExtByte; i++)
     1583  {
     1584    READ_CODE( 8, uiCode, "vps_non_vui_extension_data_byte" ); //just parse and discard for now.
     1585  }
     1586#else
    15121587  if ( vps->getVpsNonVuiExtLength() > 0 )
    15131588  {
    15141589    printf("\n\nUp to the current spec, the value of vps_non_vui_extension_length is supposed to be 0\n");
    15151590  }
     1591#endif
    15161592#endif
    15171593
     
    15961672{
    15971673  UInt uiCode;
     1674#if DPB_PARAMS_MAXTLAYERS
     1675    Int * MaxSubLayersInLayerSetMinus1 = new Int[vps->getNumOutputLayerSets()];
     1676    for(Int i = 1; i < vps->getNumOutputLayerSets(); i++)
     1677    {
     1678        UInt maxSLMinus1 = 0;
     1679#if CHANGE_NUMSUBDPB_IDX
     1680        Int optLsIdx = vps->getOutputLayerSetIdx( i );
     1681#else
     1682        Int optLsIdx = i;
     1683#endif
     1684        for(Int k = 0; k < vps->getNumLayersInIdList(optLsIdx); k++ ) {
     1685            Int  lId = vps->getLayerSetLayerIdList(optLsIdx, k);
     1686            maxSLMinus1 = max(maxSLMinus1, vps->getMaxTSLayersMinus1(vps->getLayerIdInVps(lId)));
     1687        }
     1688        MaxSubLayersInLayerSetMinus1[ i ] = maxSLMinus1;
     1689    }
     1690#endif
     1691   
    15981692#if !RESOLUTION_BASED_DPB
    15991693  vps->deriveNumberOfSubDpbs();
     
    16051699#endif
    16061700    READ_FLAG( uiCode, "sub_layer_flag_info_present_flag[i]");  vps->setSubLayerFlagInfoPresentFlag( i, uiCode ? true : false );
    1607     for(Int j = 0; j < vps->getMaxTLayers(); j++)
     1701#if DPB_PARAMS_MAXTLAYERS
     1702      for(Int j = 0; j <= MaxSubLayersInLayerSetMinus1[ i ]; j++)
     1703#else
     1704    for(Int j = 0; j <= vps->getMaxTLayers(); j++)
     1705#endif
    16081706    {
    16091707      if( j > 0 && vps->getSubLayerFlagInfoPresentFlag(i) )
     
    16521750      }
    16531751    }
     1752    for(Int j = vps->getMaxTLayers(); j < MAX_TLAYER; j++)
     1753    {
     1754      vps->setSubLayerDpbInfoPresentFlag( i, j, false );
     1755    }
     1756  }
     1757
     1758  // Infer values when not signalled
     1759  for(Int i = 1; i < vps->getNumOutputLayerSets(); i++)
     1760  {
     1761    Int layerSetIdxForOutputLayerSet = vps->getOutputLayerSetIdx( i );
     1762    for(Int j = 0; j < MAX_TLAYER; j++)
     1763    {
     1764      if( !vps->getSubLayerDpbInfoPresentFlag(i, j) )  // If sub-layer DPB information is NOT present
     1765      {
     1766        for(Int k = 0; k < vps->getNumSubDpbs(layerSetIdxForOutputLayerSet); k++)
     1767        {
     1768          vps->setMaxVpsDecPicBufferingMinus1( i, k, j, vps->getMaxVpsDecPicBufferingMinus1( i, k, j - 1 ) );
     1769        }
     1770        vps->setMaxVpsNumReorderPics( i, j, vps->getMaxVpsNumReorderPics( i, j - 1) );
     1771        for(Int k = 0; k < vps->getNumLayersInIdList( layerSetIdxForOutputLayerSet ); k++)
     1772        {
     1773          vps->setMaxVpsLayerDecPicBuffMinus1( i, k, j, vps->getMaxVpsLayerDecPicBuffMinus1( i, k, j - 1));
     1774        }
     1775        vps->setMaxVpsLatencyIncreasePlus1( i, j, vps->getMaxVpsLatencyIncreasePlus1( i, j - 1 ) );
     1776      }
     1777    }
    16541778  }
    16551779}
     
    16691793    READ_FLAG(uiCode, "cross_layer_irap_aligned_flag" );
    16701794    vps->setCrossLayerIrapAlignFlag(uiCode);
     1795#if P0068_CROSS_LAYER_ALIGNED_IDR_ONLY_FOR_IRAP_FLAG
     1796    if (uiCode)
     1797    {
     1798      READ_FLAG(uiCode, "only_idr_for_IRAP_across_layers" );
     1799      vps->setCrossLayerIrapAlignFlag(uiCode);
     1800    }
     1801#endif
    16711802#endif
    16721803#if O0223_PICTURE_TYPES_ALIGN_FLAG
     
    18251956#endif
    18261957#endif
    1827 
     1958#if P0312_VERT_PHASE_ADJ
     1959  READ_FLAG( uiCode, "vps_vui_vert_phase_in_use_flag" ); vps->setVpsVuiVertPhaseInUseFlag(uiCode);
     1960#endif
    18281961#if N0160_VUI_EXT_ILP_REF
    18291962  READ_FLAG( uiCode, "ilp_restricted_ref_layers_flag" ); vps->setIlpRestrictedRefLayersFlag( uiCode == 1 );
     
    18922025#endif
    18932026#endif
     2027
     2028#if O0164_MULTI_LAYER_HRD
     2029    READ_FLAG(uiCode, "vps_vui_bsp_hrd_present_flag" ); vps->setVpsVuiBspHrdPresentFlag(uiCode);
     2030    if (vps->getVpsVuiBspHrdPresentFlag())
     2031    {
     2032      READ_UVLC( uiCode, "vps_num_bsp_hrd_parameters_minus1" ); vps->setVpsNumBspHrdParametersMinus1(uiCode);
     2033      vps->createBspHrdParamBuffer(vps->getVpsNumBspHrdParametersMinus1() + 1);
     2034      for( i = 0; i <= vps->getVpsNumBspHrdParametersMinus1(); i++ )
     2035      {
     2036        if( i > 0 )
     2037        {
     2038          READ_FLAG( uiCode, "bsp_cprms_present_flag[i]" ); vps->setBspCprmsPresentFlag(i, uiCode);
     2039        }
     2040        parseHrdParameters(vps->getBspHrd(i), i==0 ? 1 : vps->getBspCprmsPresentFlag(i), vps->getMaxTLayers()-1);
     2041      }
     2042      for( UInt h = 1; h <= (vps->getNumLayerSets()-1); h++ )
     2043      {
     2044        READ_UVLC( uiCode, "num_bitstream_partitions[i]"); vps->setNumBitstreamPartitions(h, uiCode);
     2045        for( i = 0; i < vps->getNumBitstreamPartitions(h); i++ )
     2046        {
     2047          for( j = 0; j <= (vps->getMaxLayers()-1); j++ )
     2048          {
     2049            if( vps->getLayerIdIncludedFlag(h, j) )
     2050            {
     2051              READ_FLAG( uiCode, "layer_in_bsp_flag[h][i][j]" ); vps->setLayerInBspFlag(h, i, j, uiCode);
     2052            }
     2053          }
     2054        }
     2055        if (vps->getNumBitstreamPartitions(h))
     2056        {
     2057          READ_UVLC( uiCode, "num_bsp_sched_combinations[h]"); vps->setNumBspSchedCombinations(h, uiCode);
     2058          for( i = 0; i < vps->getNumBspSchedCombinations(h); i++ )
     2059          {
     2060            for( j = 0; j < vps->getNumBitstreamPartitions(h); j++ )
     2061            {
     2062              READ_UVLC( uiCode, "bsp_comb_hrd_idx[h][i][j]"); vps->setBspCombHrdIdx(h, i, j, uiCode);
     2063              READ_UVLC( uiCode, "bsp_comb_sched_idx[h][i][j]"); vps->setBspCombSchedIdx(h, i, j, uiCode);
     2064            }
     2065          }
     2066        }
     2067      }
     2068    }
     2069#endif
     2070
     2071#if P0182_VPS_VUI_PS_FLAG
     2072    for(i = 1; i < vps->getMaxLayers(); i++)
     2073    {
     2074      if (vps->getNumRefLayers(vps->getLayerIdInNuh(i)) == 0)
     2075      {
     2076        READ_FLAG( uiCode, "base_layer_parameter_set_compatibility_flag" );
     2077        vps->setBaseLayerPSCompatibilityFlag( i, uiCode );
     2078      }
     2079      else
     2080      {
     2081        vps->setBaseLayerPSCompatibilityFlag( i, 0 );
     2082      }
     2083    }
     2084#endif
    18942085}
    18952086#endif
     
    19112102  if( rpcSlice->getRapPicFlag())
    19122103  {
     2104#if !NO_OUTPUT_OF_PRIOR_PICS
    19132105    READ_FLAG( uiCode, "no_output_of_prior_pics_flag" );  //ignored
     2106#else
     2107    READ_FLAG( uiCode, "no_output_of_prior_pics_flag" );  rpcSlice->setNoOutputOfPriorPicsFlag( uiCode ? true : false );
     2108#endif
    19142109  }
    19152110  READ_UVLC (    uiCode, "slice_pic_parameter_set_id" );  rpcSlice->setPPSId(uiCode);
     
    22292424#if ILP_SSH_SIG
    22302425#if ILP_SSH_SIG_FIX
    2231     if((sps->getLayerId() > 0) && !(rpcSlice->getVPS()->getIlpSshSignalingEnabledFlag()) && (rpcSlice->getNumILRRefIdx() > 0) )
    2232 #else
    2233     if((sps->getLayerId() > 0) && rpcSlice->getVPS()->getIlpSshSignalingEnabledFlag() && (rpcSlice->getNumILRRefIdx() > 0) )
    2234 #endif
    2235 #else
    2236     if((sps->getLayerId() > 0)  &&  (rpcSlice->getNumILRRefIdx() > 0) )
     2426    if((rpcSlice->getLayerId() > 0) && !(rpcSlice->getVPS()->getIlpSshSignalingEnabledFlag()) && (rpcSlice->getNumILRRefIdx() > 0) )
     2427#else
     2428    if((rpcSlice->getLayerId() > 0) && rpcSlice->getVPS()->getIlpSshSignalingEnabledFlag() && (rpcSlice->getNumILRRefIdx() > 0) )
     2429#endif
     2430#else
     2431    if((rpcSlice->getLayerId() > 0)  &&  (rpcSlice->getNumILRRefIdx() > 0) )
    22372432#endif
    22382433    {
     
    22562451          {
    22572452#if P0079_DERIVE_NUMACTIVE_REF_PICS
    2258             Int   numRefLayerPics = 0;
    2259             Int   i = 0;
    2260             Int   refLayerPicIdc  [MAX_VPS_LAYER_ID_PLUS1];
    2261             for(i = 0, numRefLayerPics = 0;  i < rpcSlice->getNumILRRefIdx(); i++ )
     2453            for( Int i = 0; i < rpcSlice->getNumILRRefIdx(); i++ )
    22622454            {
    22632455              if(rpcSlice->getVPS()->getMaxTidIlRefPicsPlus1(rpcSlice->getVPS()->getLayerIdInVps(i),rpcSlice->getLayerId()) >  rpcSlice->getTLayer() &&
    22642456                (rpcSlice->getVPS()->getMaxTSLayersMinus1(rpcSlice->getVPS()->getLayerIdInVps(i)) >=  rpcSlice->getTLayer()) )
    22652457              {         
    2266                 refLayerPicIdc[ numRefLayerPics++ ] = i;
     2458                rpcSlice->setActiveNumILRRefIdx(1);
     2459                break;
    22672460              }
    22682461            }
    2269             if (numRefLayerPics)
    2270               rpcSlice->setActiveNumILRRefIdx(1);
    22712462#else
    22722463            rpcSlice->setActiveNumILRRefIdx(1);
     
    23442535#endif
    23452536#endif
     2537#if P0312_VERT_PHASE_ADJ
     2538    for(Int i = 0; i < rpcSlice->getActiveNumILRRefIdx(); i++ )
     2539    {
     2540      UInt refLayerIdc = rpcSlice->getInterLayerPredLayerIdc(i);
     2541      if( rpcSlice->getSPS()->getVertPhasePositionEnableFlag(refLayerIdc) )
     2542      {
     2543        READ_FLAG( uiCode, "vert_phase_position_flag" ); rpcSlice->setVertPhasePositionFlag( uiCode? true : false, refLayerIdc );
     2544      }
     2545    }
     2546#endif
    23462547
    23472548    if(sps->getUseSAO())
     
    26612862  }
    26622863
     2864#if POC_RESET_IDC_SIGNALLING
     2865  Int sliceHederExtensionLength = 0;
     2866  if(pps->getSliceHeaderExtensionPresentFlag())
     2867  {
     2868    READ_UVLC( uiCode, "slice_header_extension_length"); sliceHederExtensionLength = uiCode;
     2869  }
     2870  else
     2871  {
     2872    sliceHederExtensionLength = 0;
     2873  }
     2874  UInt startBits = m_pcBitstream->getNumBitsRead();     // Start counter of # SH Extn bits
     2875  if( sliceHederExtensionLength > 0 )
     2876  {
     2877    if( rpcSlice->getPPS()->getPocResetInfoPresentFlag() )
     2878    {
     2879      READ_CODE( 2, uiCode,       "poc_reset_idc"); rpcSlice->setPocResetIdc(uiCode);
     2880    }
     2881    else
     2882    {
     2883      rpcSlice->setPocResetIdc( 0 );
     2884    }
     2885    if( rpcSlice->getPocResetIdc() > 0 )
     2886    {
     2887      READ_CODE(6, uiCode,      "poc_reset_period_id"); rpcSlice->setPocResetPeriodId(uiCode);
     2888    }
     2889    else
     2890    {
     2891     
     2892      rpcSlice->setPocResetPeriodId( 0 );
     2893    }
     2894
     2895    if (rpcSlice->getPocResetIdc() == 3)
     2896    {
     2897      READ_FLAG( uiCode,        "full_poc_reset_flag"); rpcSlice->setFullPocResetFlag((uiCode == 1) ? true : false);
     2898      READ_CODE(rpcSlice->getSPS()->getBitsForPOC(), uiCode,"poc_lsb_val"); rpcSlice->setPocLsbVal(uiCode);
     2899    }
     2900
     2901    // Derive the value of PocMsbValRequiredFlag
     2902    rpcSlice->setPocMsbValRequiredFlag( rpcSlice->getCraPicFlag() || rpcSlice->getBlaPicFlag()
     2903                                          /* || related to vps_poc_lsb_aligned_flag */
     2904                                          );
     2905
     2906    if( !rpcSlice->getPocMsbValRequiredFlag() /* vps_poc_lsb_aligned_flag */ )
     2907    {
     2908      READ_FLAG( uiCode,    "poc_msb_val_present_flag"); rpcSlice->setPocMsbValPresentFlag( uiCode ? true : false );
     2909    }
     2910    else
     2911    {
     2912      if( rpcSlice->getPocMsbValRequiredFlag() )
     2913      {
     2914        rpcSlice->setPocMsbValPresentFlag( true );
     2915      }
     2916      else
     2917      {
     2918        rpcSlice->setPocMsbValPresentFlag( false );
     2919      }
     2920    }
     2921
     2922    Int maxPocLsb  = 1 << rpcSlice->getSPS()->getBitsForPOC();
     2923    if( rpcSlice->getPocMsbValPresentFlag() )
     2924    {
     2925      READ_UVLC( uiCode,    "poc_msb_val");             rpcSlice->setPocMsbVal( uiCode );
     2926      // Update POC of the slice based on this MSB val
     2927      Int pocLsb     = rpcSlice->getPOC() % maxPocLsb;
     2928      rpcSlice->setPOC((rpcSlice->getPocMsbVal() * maxPocLsb) + pocLsb);
     2929    }
     2930    else
     2931    {
     2932      rpcSlice->setPocMsbVal( rpcSlice->getPOC() / maxPocLsb );
     2933    }
     2934
     2935    // Read remaining bits in the slice header extension.
     2936    UInt endBits = m_pcBitstream->getNumBitsRead();
     2937    Int counter = (endBits - startBits) % 8;
     2938    if( counter )
     2939    {
     2940      counter = 8 - counter;
     2941    }
     2942
     2943    while( counter )
     2944    {
     2945      READ_FLAG( uiCode, "slice_segment_header_extension_reserved_bit" ); assert( uiCode == 1 );
     2946      counter--;
     2947    }
     2948  }
     2949#else
    26632950  if(pps->getSliceHeaderExtensionPresentFlag())
    26642951  {
     
    26702957    }
    26712958  }
     2959#endif
    26722960  m_pcBitstream->readByteAlignment();
    26732961
  • trunk/source/Lib/TLibDecoder/TDecCAVLC.h

    r595 r644  
    8686  Void  parseVpsDpbSizeTable( TComVPS *vps );
    8787#endif
     88#if SPS_DPB_PARAMS
     89  Void  parseSPS            ( TComSPS* pcSPS ); // it should be removed after macro clean up
     90#else
    8891  Void  parseSPS            ( TComSPS* pcSPS, ParameterSetManagerDecoder *parameterSetManager );
     92#endif
    8993  Void  parseSPSExtension    ( TComSPS* pcSPS );
    9094#else //SVC_EXTENSION
  • trunk/source/Lib/TLibDecoder/TDecEntropy.h

    r595 r644  
    6666
    6767  virtual Void  parseVPS                  ( TComVPS* pcVPS )                       = 0;
    68 #if SVC_EXTENSION
     68#if SVC_EXTENSION && !SPS_DPB_PARAMS
    6969  virtual Void  parseSPS                  ( TComSPS* pcSPS, ParameterSetManagerDecoder *parameterSetManager )           = 0;
    7070#else
     
    133133  Void    resetEntropy                ( TComSlice* p)           { m_pcEntropyDecoderIf->resetEntropy(p);                    }
    134134  Void    decodeVPS                   ( TComVPS* pcVPS ) { m_pcEntropyDecoderIf->parseVPS(pcVPS); }
    135 #if SVC_EXTENSION
     135#if SVC_EXTENSION && !SPS_DPB_PARAMS
    136136  Void    decodeSPS                   ( TComSPS* pcSPS, ParameterSetManagerDecoder *parameterSetManager )    { m_pcEntropyDecoderIf->parseSPS(pcSPS, parameterSetManager);                    }
    137137#else
  • trunk/source/Lib/TLibDecoder/TDecSbac.cpp

    r595 r644  
    13941394
    13951395Void TDecSbac::parseSAOBlkParam (SAOBlkParam& saoBlkParam
     1396#if SVC_EXTENSION
     1397                                , UInt* saoMaxOffsetQVal
     1398#endif
    13961399                                , Bool* sliceEnabled
    13971400                                , Bool leftMergeAvail
     
    14681471        for(Int i=0; i< 4; i++)
    14691472        {
     1473#if SVC_EXTENSION
     1474          parseSaoMaxUvlc(uiSymbol,  saoMaxOffsetQVal[compIdx] ); //sao_offset_abs
     1475#else
    14701476          parseSaoMaxUvlc(uiSymbol,  g_saoMaxOffsetQVal[compIdx] ); //sao_offset_abs
     1477#endif
    14711478          offset[i] = (Int)uiSymbol;
    14721479        }
  • trunk/source/Lib/TLibDecoder/TDecSbac.h

    r595 r644  
    7676  Void  setBitstream              ( TComInputBitstream* p  ) { m_pcBitstream = p; m_pcTDecBinIf->init( p ); }
    7777  Void  parseVPS                  ( TComVPS* /*pcVPS*/ ) {}
    78 #if SVC_EXTENSION
     78#if SVC_EXTENSION && !SPS_DPB_PARAMS
    7979  Void  parseSPS                  ( TComSPS* /*pcSPS*/, ParameterSetManagerDecoder * /*parameterSetManager*/ ) {}
    8080#else
     
    9090  Void  parseSaoTypeIdx           ( UInt&  ruiVal  );
    9191  Void  parseSaoUflc              ( UInt uiLength, UInt& ruiVal     );
     92
     93#if SVC_EXTENSION
     94  Void parseSAOBlkParam (SAOBlkParam& saoBlkParam, UInt* saoMaxOffsetQVal, Bool* sliceEnabled, Bool leftMergeAvail, Bool aboveMergeAvail );
     95#else
    9296  Void parseSAOBlkParam (SAOBlkParam& saoBlkParam, Bool* sliceEnabled, Bool leftMergeAvail, Bool aboveMergeAvail);
     97#endif
    9398  Void parseSaoSign(UInt& val);
    9499private:
  • trunk/source/Lib/TLibDecoder/TDecSlice.cpp

    r595 r644  
    105105
    106106#if SVC_EXTENSION
    107 Void TDecSlice::init(TDecTop** ppcDecTop,TDecEntropy* pcEntropyDecoder, TDecCu* pcCuDecoder)
     107Void TDecSlice::init(TDecEntropy* pcEntropyDecoder, TDecCu* pcCuDecoder, UInt* saoMaxOffsetQVal)
    108108{
    109109  m_pcEntropyDecoder  = pcEntropyDecoder;
    110110  m_pcCuDecoder       = pcCuDecoder;
    111   m_ppcTDecTop        = ppcDecTop;
     111  m_saoMaxOffsetQVal  = saoMaxOffsetQVal;
    112112}
    113113#else
     
    347347          aboveMergeAvail = rpcPic->getSAOMergeAvailability(iCUAddr, iCUAddr-uiWidthInLCUs);
    348348        }
    349 
     349#if SVC_EXTENSION
     350        pcSbacDecoder->parseSAOBlkParam( saoblkParam, m_saoMaxOffsetQVal, sliceEnabled, leftMergeAvail, aboveMergeAvail);
     351#else
    350352        pcSbacDecoder->parseSAOBlkParam( saoblkParam, sliceEnabled, leftMergeAvail, aboveMergeAvail);
     353#endif
    351354      }
    352355      else
  • trunk/source/Lib/TLibDecoder/TDecSlice.h

    r595 r644  
    7272  std::vector<TDecSbac*> CTXMem;
    7373#if SVC_EXTENSION
    74   TDecTop**       m_ppcTDecTop;
     74  UInt*           m_saoMaxOffsetQVal;
    7575#endif
    7676 
     
    8080 
    8181#if SVC_EXTENSION 
    82   Void  init              ( TDecTop** ppcDecTop, TDecEntropy* pcEntropyDecoder, TDecCu* pcMbDecoder );
     82  Void  init              ( TDecEntropy* pcEntropyDecoder, TDecCu* pcMbDecoder, UInt* saoMaxOffsetQVal );
    8383#else
    8484  Void  init              ( TDecEntropy* pcEntropyDecoder, TDecCu* pcMbDecoder );
     
    9191  Void      setCtxMem( TDecSbac* sb, Int b )   { CTXMem[b] = sb; }
    9292  Int       getCtxMemSize( )                   { return (Int)CTXMem.size(); }
    93 #if SVC_EXTENSION
    94   TDecTop*  getLayerDec   ( UInt LayerId )  { return m_ppcTDecTop[LayerId]; } 
    95 #endif
    9693};
    9794
  • trunk/source/Lib/TLibDecoder/TDecTop.cpp

    r595 r644  
    138138#if SVC_EXTENSION
    139139  m_cGopDecoder.init( m_ppcTDecTop, &m_cEntropyDecoder, &m_cSbacDecoder, &m_cBinCABAC, &m_cCavlcDecoder, &m_cSliceDecoder, &m_cLoopFilter, &m_cSAO);
    140   m_cSliceDecoder.init( m_ppcTDecTop, &m_cEntropyDecoder, &m_cCuDecoder );
     140  m_cSliceDecoder.init( &m_cEntropyDecoder, &m_cCuDecoder, m_cSAO.getSaoMaxOffsetQVal() );
    141141#else
    142142  m_cGopDecoder.init( &m_cEntropyDecoder, &m_cSbacDecoder, &m_cBinCABAC, &m_cCavlcDecoder, &m_cSliceDecoder, &m_cLoopFilter, &m_cSAO);
     
    349349        TComPicYuv* pcPicYuvRecBase = (*(pcTDecTopBase->getListPic()->begin()))->getPicYuvRec();
    350350#if REPN_FORMAT_IN_VPS
     351#if O0194_DIFFERENT_BITDEPTH_EL_BL
     352        UInt refLayerId = pcSlice->getVPS()->getRefLayerId(m_layerId, i);
     353        Bool sameBitDepths = ( g_bitDepthYLayer[m_layerId] == g_bitDepthYLayer[refLayerId] ) && ( g_bitDepthCLayer[m_layerId] == g_bitDepthCLayer[refLayerId] );
     354
     355        if( pcPicYuvRecBase->getWidth() != pcSlice->getPicWidthInLumaSamples() || pcPicYuvRecBase->getHeight() != pcSlice->getPicHeightInLumaSamples() || !zeroOffsets || !sameBitDepths )
     356#else
    351357        if(pcPicYuvRecBase->getWidth() != pcSlice->getPicWidthInLumaSamples() || pcPicYuvRecBase->getHeight() != pcSlice->getPicHeightInLumaSamples() || !zeroOffsets )
     358#endif
    352359#else
    353360        if(pcPicYuvRecBase->getWidth() != pcSlice->getSPS()->getPicWidthInLumaSamples() || pcPicYuvRecBase->getHeight() != pcSlice->getSPS()->getPicHeightInLumaSamples() || !zeroOffsets )
     
    726733#endif
    727734
     735#if P0312_VERT_PHASE_ADJ
     736  if( activeVPS->getVpsVuiVertPhaseInUseFlag() == 0 )
     737  {   
     738    for(Int i = 0; i < activeSPS->getNumScaledRefLayerOffsets(); i++)
     739    {
     740      UInt scaledRefLayerId = activeSPS->getScaledRefLayerId(i);
     741      if( activeSPS->getVertPhasePositionEnableFlag( scaledRefLayerId ) )
     742      {
     743        printf("\nWarning: LayerId = %d: vert_phase_position_enable_flag[%d] = 1, however indication vert_phase_position_in_use_flag = 0\n", m_layerId, scaledRefLayerId );
     744        break;
     745      }
     746    }
     747  }
     748#endif
     749
     750#if SPS_DPB_PARAMS
     751  if( m_layerId > 0 )
     752  {
     753    // When not present sps_max_sub_layers_minus1 is inferred to be equal to vps_max_sub_layers_minus1.
     754    sps->setMaxTLayers( activeVPS->getMaxTLayers() );
     755
     756    // When not present sps_temporal_id_nesting_flag is inferred to be equal to vps_temporal_id_nesting_flag
     757    sps->setTemporalIdNestingFlag( activeVPS->getTemporalNestingFlag() );
     758
     759    // When sps_max_dec_pic_buffering_minus1[ i ] is not present for i in the range of 0 to sps_max_sub_layers_minus1, inclusive, due to nuh_layer_id being greater than 0,
     760    // it is inferred to be equal to max_vps_dec_pic_buffering_minus1[ TargetOptLayerSetIdx ][ currLayerId ][ i ] of the active VPS, where currLayerId is the nuh_layer_id of the layer that refers to the SPS.
     761    for(UInt i=0; i < sps->getMaxTLayers(); i++)
     762    {
     763      // to avoid compiler warning "array subscript is above array bounds"
     764      assert( i < MAX_TLAYER );
     765
     766      sps->setMaxDecPicBuffering( activeVPS->getMaxVpsDecPicBufferingMinus1( getCommonDecoderParams()->getTargetOutputLayerSetIdx(), sps->getLayerId(), i) + 1, i);
     767    }
     768  }
     769#endif
     770
    728771  if( pps->getDependentSliceSegmentsEnabledFlag() )
    729772  {
     
    800843  TComPic*&   pcPic         = m_pcPic;
    801844#if SVC_EXTENSION
     845#if !NO_OUTPUT_OF_PRIOR_PICS
    802846#if NO_CLRAS_OUTPUT_FLAG
    803847  Bool bFirstSliceInSeq;
     848#endif
    804849#endif
    805850  m_apcSlicePilot->setVPS( m_parameterSetManagerDecoder.getPrefetchedVPS(0) );
     
    855900  m_apcSlicePilot->setAssociatedIRAPType(m_associatedIRAPType);
    856901
     902#if NO_OUTPUT_OF_PRIOR_PICS
     903  // Infer the value of NoOutputOfPriorPicsFlag
     904  if( m_apcSlicePilot->getRapPicFlag() )
     905  {
     906    if ( m_apcSlicePilot->getBlaPicFlag() || m_apcSlicePilot->getIdrPicFlag()  ||
     907        (m_apcSlicePilot->getCraPicFlag() && m_bFirstSliceInSequence) ||
     908        (m_apcSlicePilot->getCraPicFlag() && m_apcSlicePilot->getHandleCraAsBlaFlag()))
     909    {
     910      m_apcSlicePilot->setNoRaslOutputFlag( true );
     911    }
     912    else
     913    {
     914      m_apcSlicePilot->setNoRaslOutputFlag( false );
     915    }
     916  }
     917#endif
     918
    857919  // Skip pictures due to random access
    858920  if (isRandomAccessSkipPicture(iSkipFrame, iPOCLastDisplay))
     
    876938#if SVC_EXTENSION
    877939  bNewPOC = (m_apcSlicePilot->getPOC()!= m_prevPOC);
     940
     941#if NO_OUTPUT_OF_PRIOR_PICS
     942#if NO_CLRAS_OUTPUT_FLAG
     943  if (m_layerId == 0 && m_apcSlicePilot->getRapPicFlag() )
     944  {
     945    if (m_bFirstSliceInSequence)
     946    {
     947      setNoClrasOutputFlag(true);
     948    }
     949    else if ( m_apcSlicePilot->getBlaPicFlag() )
     950    {
     951      setNoClrasOutputFlag(true);
     952    }
     953#if O0149_CROSS_LAYER_BLA_FLAG
     954    else if (m_apcSlicePilot->getIdrPicFlag() && m_apcSlicePilot->getCrossLayerBLAFlag())
     955    {
     956      setNoClrasOutputFlag(true);
     957    }
     958#endif
     959    else
     960    {
     961      setNoClrasOutputFlag(false);
     962    }     
     963  }
     964  else
     965  {
     966    setNoClrasOutputFlag(false);
     967  }
     968
     969  m_apcSlicePilot->decodingRefreshMarking(m_pocCRA, m_bRefreshPending, m_cListPic, getNoClrasOutputFlag());
     970#endif
     971
     972  // Derive the value of NoOutputOfPriorPicsFlag
     973  if( bNewPOC || m_layerId!=m_uiPrevLayerId )   // i.e. new coded picture
     974  {
     975    if( m_apcSlicePilot->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA && m_apcSlicePilot->getNoRaslOutputFlag() )
     976    {
     977      this->setNoOutputOfPriorPicsFlags( true );
     978    }
     979    else if( m_apcSlicePilot->getRapPicFlag() && m_apcSlicePilot->getNoRaslOutputFlag() )
     980    {
     981      this->setNoOutputOfPriorPicsFlags( m_apcSlicePilot->getNoOutputOfPriorPicsFlag() );
     982    }
     983    else
     984    {
     985      if( this->m_ppcTDecTop[0]->getNoClrasOutputFlag() )
     986      {
     987        this->setNoOutputOfPriorPicsFlags( true );
     988      }
     989    }
     990  }
     991#endif
     992
     993#if ALIGNED_BUMPING
     994  if (bNewPOC || m_layerId!=m_uiPrevLayerId)
     995  {
     996    m_apcSlicePilot->applyReferencePictureSet(m_cListPic, m_apcSlicePilot->getRPS());
     997  }
     998#endif
    878999  if (m_apcSlicePilot->isNextSlice() && (bNewPOC || m_layerId!=m_uiPrevLayerId) && !m_bFirstSliceInSequence )
    8791000  {
     
    9291050#endif
    9301051  }
     1052#if !NO_OUTPUT_OF_PRIOR_PICS
    9311053#if NO_CLRAS_OUTPUT_FLAG
    9321054  bFirstSliceInSeq = m_bFirstSliceInSequence;
     1055#endif
    9331056#endif
    9341057  m_bFirstSliceInSequence = false;
     
    10931216#endif
    10941217
     1218#if !NO_OUTPUT_OF_PRIOR_PICS
    10951219#if NO_CLRAS_OUTPUT_FLAG
    10961220    if (m_layerId == 0 &&
     
    11371261    m_apcSlicePilot->decodingRefreshMarking(m_pocCRA, m_bRefreshPending, m_cListPic, getNoClrasOutputFlag());
    11381262#endif
    1139 
     1263#else
     1264    if ( m_layerId == 0 && m_apcSlicePilot->getRapPicFlag() && getNoClrasOutputFlag() )
     1265    {
     1266      for (UInt i = 0; i < m_apcSlicePilot->getVPS()->getMaxLayers(); i++)
     1267      {
     1268        m_ppcTDecTop[i]->setLayerInitializedFlag(false);
     1269        m_ppcTDecTop[i]->setFirstPicInLayerDecodedFlag(false);
     1270      }
     1271    }
     1272#endif
    11401273    // Buffer initialize for prediction.
    11411274    m_cPrediction.initTempBuff();
     1275#if !ALIGNED_BUMPING
    11421276    m_apcSlicePilot->applyReferencePictureSet(m_cListPic, m_apcSlicePilot->getRPS());
     1277#else
     1278    m_apcSlicePilot->checkLeadingPictureRestrictions(m_cListPic);
     1279#endif
    11431280    //  Get a new picture buffer
    11441281    xGetNewPicBuffer (m_apcSlicePilot, pcPic);
     
    16001737#if SVC_EXTENSION
    16011738  sps->setLayerId(m_layerId);
     1739#if SPS_DPB_PARAMS
     1740  m_cEntropyDecoder.decodeSPS( sps ); // it should be removed after macro clean up
     1741#else
    16021742  m_cEntropyDecoder.decodeSPS( sps, &m_parameterSetManagerDecoder );
     1743#endif
    16031744  m_parameterSetManagerDecoder.storePrefetchedSPS(sps);
    16041745#if !REPN_FORMAT_IN_VPS   // ILRP can only be initialized at activation 
  • trunk/source/Lib/TLibDecoder/TDecTop.h

    r595 r644  
    239239  fstream* getBLSyntaxFile() { return m_pBLSyntaxFile; }
    240240#endif
    241 
     241#if NO_OUTPUT_OF_PRIOR_PICS
     242#if NO_CLRAS_OUTPUT_FLAG
     243  Bool getNoOutputOfPriorPicsFlags()         { return m_noOutputOfPriorPicsFlags;}
     244  Void setNoOutputOfPriorPicsFlags(Bool x)   { m_noOutputOfPriorPicsFlags = x;   }
     245#endif
     246#endif
    242247protected:
    243248  Void  xGetNewPicBuffer  (TComSlice* pcSlice, TComPic*& rpcPic);
     
    266271  Int  getFirstPicInLayerDecodedFlag()       { return m_firstPicInLayerDecodedFlag;}
    267272  Void setFirstPicInLayerDecodedFlag(Bool x) { m_firstPicInLayerDecodedFlag = x;   }
     273#if !NO_OUTPUT_OF_PRIOR_PICS
    268274  Int  getNoOutputOfPriorPicsFlags()         { return m_noOutputOfPriorPicsFlags;}
    269275  Void setNoOutputOfPriorPicsFlags(Bool x)   { m_noOutputOfPriorPicsFlags = x;   }
    270276#endif
     277#endif
    271278};// END CLASS DEFINITION TDecTop
    272279
  • trunk/source/Lib/TLibEncoder/SEIwrite.cpp

    r595 r644  
    105105#endif
    106106#if SUB_BITSTREAM_PROPERTY_SEI
    107     case SEI::SUB_BITSTREAM_PROPERTY:
    108       fprintf( g_hTrace, "=========== Sub-bitstream property SEI message ===========\n");
    109       break;
     107  case SEI::SUB_BITSTREAM_PROPERTY:
     108    fprintf( g_hTrace, "=========== Sub-bitstream property SEI message ===========\n");
     109    break;
     110#endif
     111#if O0164_MULTI_LAYER_HRD
     112  case SEI::BSP_NESTING:
     113    fprintf( g_hTrace, "=========== Bitstream partition nesting SEI message ===========\n");
     114    break;
     115  case SEI::BSP_INITIAL_ARRIVAL_TIME:
     116    fprintf( g_hTrace, "=========== Bitstream parition initial arrival time SEI message ===========\n");
     117    break;
     118  case SEI::BSP_HRD:
     119    fprintf( g_hTrace, "=========== Bitstream parition HRD parameters SEI message ===========\n");
     120    break;
    110121#endif
    111122#endif //SVC_EXTENSION
     
    117128#endif
    118129
     130#if O0164_MULTI_LAYER_HRD
     131void SEIWriter::xWriteSEIpayloadData(TComBitIf& bs, const SEI& sei, TComVPS *vps, TComSPS *sps, const SEIScalableNesting& nestingSei, const SEIBspNesting& bspNestingSei)
     132#else
    119133void SEIWriter::xWriteSEIpayloadData(TComBitIf& bs, const SEI& sei, TComSPS *sps)
     134#endif
    120135{
    121136  switch (sei.payloadType())
     
    161176    break;
    162177  case SEI::SCALABLE_NESTING:
     178#if O0164_MULTI_LAYER_HRD
     179    xWriteSEIScalableNesting(bs, *static_cast<const SEIScalableNesting*>(&sei), vps, sps);
     180#else
    163181    xWriteSEIScalableNesting(bs, *static_cast<const SEIScalableNesting*>(&sei), sps);
     182#endif
    164183    break;
    165184#if SVC_EXTENSION
     
    179198     break;
    180199#endif
     200#if O0164_MULTI_LAYER_HRD
     201   case SEI::BSP_NESTING:
     202     xWriteSEIBspNesting(bs, *static_cast<const SEIBspNesting*>(&sei), vps, sps, nestingSei);
     203     break;
     204   case SEI::BSP_INITIAL_ARRIVAL_TIME:
     205     xWriteSEIBspInitialArrivalTime(*static_cast<const SEIBspInitialArrivalTime*>(&sei), vps, sps, nestingSei, bspNestingSei);
     206     break;
     207   case SEI::BSP_HRD:
     208     xWriteSEIBspHrd(*static_cast<const SEIBspHrd*>(&sei), sps, nestingSei);
     209     break;
     210#endif
    181211#endif //SVC_EXTENSION
    182212  default:
     
    189219 * in bitstream bs.
    190220 */
     221#if O0164_MULTI_LAYER_HRD
     222Void SEIWriter::writeSEImessage(TComBitIf& bs, const SEI& sei, TComVPS *vps, TComSPS *sps, const SEIScalableNesting* nestingSei, const SEIBspNesting* bspNestingSei)
     223#else
    191224Void SEIWriter::writeSEImessage(TComBitIf& bs, const SEI& sei, TComSPS *sps)
     225#endif
    192226{
    193227  /* calculate how large the payload data is */
     
    202236  g_HLSTraceEnable = false;
    203237#endif
     238#if O0164_MULTI_LAYER_HRD
     239  xWriteSEIpayloadData(bs_count, sei, vps, sps, *nestingSei, *bspNestingSei);
     240#else
    204241  xWriteSEIpayloadData(bs_count, sei, sps);
     242#endif
    205243#if ENC_DEC_TRACE
    206244  g_HLSTraceEnable = traceEnable;
     
    237275#endif
    238276
     277#if O0164_MULTI_LAYER_HRD
     278  xWriteSEIpayloadData(bs, sei, vps, sps, *nestingSei, *bspNestingSei);
     279#else
    239280  xWriteSEIpayloadData(bs, sei, sps);
     281#endif
    240282}
    241283
     
    367409    }
    368410  }
     411#if P0138_USE_ALT_CPB_PARAMS_FLAG
     412  if (sei.m_useAltCpbParamsFlagPresent)
     413  {
     414    WRITE_FLAG( sei.m_useAltCpbParamsFlag, "use_alt_cpb_params_flag");
     415  }
     416#endif
    369417  xWriteByteAlign();
    370418}
     
    571619}
    572620
     621#if O0164_MULTI_LAYER_HRD
     622Void SEIWriter::xWriteSEIScalableNesting(TComBitIf& bs, const SEIScalableNesting& sei, TComVPS *vps, TComSPS *sps)
     623#else
    573624Void SEIWriter::xWriteSEIScalableNesting(TComBitIf& bs, const SEIScalableNesting& sei, TComSPS *sps)
     625#endif
    574626{
    575627  WRITE_FLAG( sei.m_bitStreamSubsetFlag,             "bitstream_subset_flag"         );
     
    581633    for (UInt i = (sei.m_defaultOpFlag ? 1 : 0); i <= sei.m_nestingNumOpsMinus1; i++)
    582634    {
    583       WRITE_CODE( sei.m_nestingNoOpMaxTemporalIdPlus1, 3, "nesting_no_op_max_temporal_id" );
    584635      WRITE_CODE( sei.m_nestingMaxTemporalIdPlus1[i], 3,  "nesting_max_temporal_id"       );
    585636      WRITE_UVLC( sei.m_nestingOpIdx[i],                  "nesting_op_idx"                );
     
    609660  for (SEIMessages::const_iterator it = sei.m_nestedSEIs.begin(); it != sei.m_nestedSEIs.end(); it++)
    610661  {
     662#if O0164_MULTI_LAYER_HRD
     663    writeSEImessage(bs, *(*it), vps, sps, &sei);
     664#else
    611665    writeSEImessage(bs, *(*it), sps);
     666#endif
    612667  }
    613668}
     
    693748}
    694749#endif
     750
     751#if O0164_MULTI_LAYER_HRD
     752Void SEIWriter::xWriteSEIBspNesting(TComBitIf& bs, const SEIBspNesting &sei, TComVPS *vps, TComSPS *sps, const SEIScalableNesting &nestingSei)
     753{
     754  WRITE_UVLC( sei.m_bspIdx, "bsp_idx" );
     755
     756  while ( m_pcBitIf->getNumberOfWrittenBits() % 8 != 0 )
     757  {
     758    WRITE_FLAG( 0, "bsp_nesting_zero_bit" );
     759  }
     760
     761  // write nested SEI messages
     762  for (SEIMessages::const_iterator it = sei.m_nestedSEIs.begin(); it != sei.m_nestedSEIs.end(); it++)
     763  {
     764    writeSEImessage(bs, *(*it), vps, sps, &nestingSei, &sei);
     765  }
     766}
     767
     768Void SEIWriter::xWriteSEIBspInitialArrivalTime(const SEIBspInitialArrivalTime &sei, TComVPS *vps, TComSPS *sps, const SEIScalableNesting &nestingSei, const SEIBspNesting &bspNestingSei)
     769{
     770  assert(vps->getVpsVuiPresentFlag());
     771
     772  UInt schedCombCnt = vps->getNumBspSchedCombinations(nestingSei.m_nestingOpIdx[0]);
     773  UInt len;
     774  UInt hrdIdx;
     775
     776  if (schedCombCnt > 0)
     777  {
     778    hrdIdx = vps->getBspCombHrdIdx(nestingSei.m_nestingOpIdx[0], 0, bspNestingSei.m_bspIdx);
     779  }
     780  else
     781  {
     782    hrdIdx = 0;
     783  }
     784
     785  TComHRD *hrd = vps->getBspHrd(hrdIdx);
     786
     787  if (hrd->getNalHrdParametersPresentFlag() || hrd->getVclHrdParametersPresentFlag())
     788  {
     789    len = hrd->getInitialCpbRemovalDelayLengthMinus1() + 1;
     790  }
     791  else
     792  {
     793    len = 23 + 1;
     794  }
     795
     796  if (hrd->getNalHrdParametersPresentFlag())
     797  {
     798    for(UInt i = 0; i < schedCombCnt; i++)
     799    {
     800      WRITE_CODE( sei.m_nalInitialArrivalDelay[i], len, "nal_initial_arrival_delay" );
     801    }
     802  }
     803  else
     804  {
     805    for(UInt i = 0; i < schedCombCnt; i++)
     806    {
     807      WRITE_CODE( sei.m_vclInitialArrivalDelay[i], len, "vcl_initial_arrival_delay" );
     808    }
     809  }
     810}
     811
     812Void SEIWriter::xWriteSEIBspHrd(const SEIBspHrd &sei, TComSPS *sps, const SEIScalableNesting &nestingSei)
     813{
     814  WRITE_UVLC( sei.m_seiNumBspHrdParametersMinus1, "sei_num_bsp_hrd_parameters_minus1" );
     815  for (UInt i = 0; i <= sei.m_seiNumBspHrdParametersMinus1; i++)
     816  {
     817    if (i > 0)
     818    {
     819      WRITE_FLAG( sei.m_seiBspCprmsPresentFlag[i], "sei_bsp_cprms_present_flag" );
     820    }
     821    xCodeHrdParameters(sei.hrd, i==0 ? 1 : sei.m_seiBspCprmsPresentFlag[i], nestingSei.m_nestingMaxTemporalIdPlus1[0]-1);
     822  }
     823  for (UInt h = 0; h <= nestingSei.m_nestingNumOpsMinus1; h++)
     824  {
     825    UInt lsIdx = nestingSei.m_nestingOpIdx[h];
     826    WRITE_UVLC( sei.m_seiNumBitstreamPartitionsMinus1[lsIdx], "num_sei_bitstream_partitions_minus1[i]");
     827    for (UInt i = 0; i <= sei.m_seiNumBitstreamPartitionsMinus1[lsIdx]; i++)
     828    {
     829      for (UInt j = 0; j < sei.m_vpsMaxLayers; j++)
     830      {
     831        if (sei.m_layerIdIncludedFlag[lsIdx][j])
     832        {
     833          WRITE_FLAG( sei.m_seiLayerInBspFlag[lsIdx][i][j], "sei_layer_in_bsp_flag[lsIdx][i][j]" );
     834        }
     835      }
     836    }
     837    WRITE_UVLC( sei.m_seiNumBspSchedCombinationsMinus1[lsIdx], "sei_num_bsp_sched_combinations_minus1[i]");
     838    for (UInt i = 0; i <= sei.m_seiNumBspSchedCombinationsMinus1[lsIdx]; i++)
     839    {
     840      for (UInt j = 0; j <= sei.m_seiNumBitstreamPartitionsMinus1[lsIdx]; j++)
     841      {
     842        WRITE_UVLC( sei.m_seiBspCombHrdIdx[lsIdx][i][j], "sei_bsp_comb_hrd_idx[lsIdx][i][j]");
     843        WRITE_UVLC( sei.m_seiBspCombScheddx[lsIdx][i][j], "sei_bsp_comb_sched_idx[lsIdx][i][j]");
     844      }
     845    }
     846  }
     847}
     848
     849Void SEIWriter::xCodeHrdParameters( TComHRD *hrd, Bool commonInfPresentFlag, UInt maxNumSubLayersMinus1 )
     850{
     851  if( commonInfPresentFlag )
     852  {
     853    WRITE_FLAG( hrd->getNalHrdParametersPresentFlag() ? 1 : 0 ,  "nal_hrd_parameters_present_flag" );
     854    WRITE_FLAG( hrd->getVclHrdParametersPresentFlag() ? 1 : 0 ,  "vcl_hrd_parameters_present_flag" );
     855    if( hrd->getNalHrdParametersPresentFlag() || hrd->getVclHrdParametersPresentFlag() )
     856    {
     857      WRITE_FLAG( hrd->getSubPicCpbParamsPresentFlag() ? 1 : 0,  "sub_pic_cpb_params_present_flag" );
     858      if( hrd->getSubPicCpbParamsPresentFlag() )
     859      {
     860        WRITE_CODE( hrd->getTickDivisorMinus2(), 8,              "tick_divisor_minus2" );
     861        WRITE_CODE( hrd->getDuCpbRemovalDelayLengthMinus1(), 5,  "du_cpb_removal_delay_length_minus1" );
     862        WRITE_FLAG( hrd->getSubPicCpbParamsInPicTimingSEIFlag() ? 1 : 0, "sub_pic_cpb_params_in_pic_timing_sei_flag" );
     863        WRITE_CODE( hrd->getDpbOutputDelayDuLengthMinus1(), 5,   "dpb_output_delay_du_length_minus1"  );
     864      }
     865      WRITE_CODE( hrd->getBitRateScale(), 4,                     "bit_rate_scale" );
     866      WRITE_CODE( hrd->getCpbSizeScale(), 4,                     "cpb_size_scale" );
     867      if( hrd->getSubPicCpbParamsPresentFlag() )
     868      {
     869        WRITE_CODE( hrd->getDuCpbSizeScale(), 4,                "du_cpb_size_scale" );
     870      }
     871      WRITE_CODE( hrd->getInitialCpbRemovalDelayLengthMinus1(), 5, "initial_cpb_removal_delay_length_minus1" );
     872      WRITE_CODE( hrd->getCpbRemovalDelayLengthMinus1(),        5, "au_cpb_removal_delay_length_minus1" );
     873      WRITE_CODE( hrd->getDpbOutputDelayLengthMinus1(),         5, "dpb_output_delay_length_minus1" );
     874    }
     875  }
     876  Int i, j, nalOrVcl;
     877  for( i = 0; i <= maxNumSubLayersMinus1; i ++ )
     878  {
     879    WRITE_FLAG( hrd->getFixedPicRateFlag( i ) ? 1 : 0,          "fixed_pic_rate_general_flag");
     880    if( !hrd->getFixedPicRateFlag( i ) )
     881    {
     882      WRITE_FLAG( hrd->getFixedPicRateWithinCvsFlag( i ) ? 1 : 0, "fixed_pic_rate_within_cvs_flag");
     883    }
     884    else
     885    {
     886      hrd->setFixedPicRateWithinCvsFlag( i, true );
     887    }
     888    if( hrd->getFixedPicRateWithinCvsFlag( i ) )
     889    {
     890      WRITE_UVLC( hrd->getPicDurationInTcMinus1( i ),           "elemental_duration_in_tc_minus1");
     891    }
     892    else
     893    {
     894      WRITE_FLAG( hrd->getLowDelayHrdFlag( i ) ? 1 : 0,           "low_delay_hrd_flag");
     895    }
     896    if (!hrd->getLowDelayHrdFlag( i ))
     897    {
     898      WRITE_UVLC( hrd->getCpbCntMinus1( i ),                      "cpb_cnt_minus1");
     899    }
     900   
     901    for( nalOrVcl = 0; nalOrVcl < 2; nalOrVcl ++ )
     902    {
     903      if( ( ( nalOrVcl == 0 ) && ( hrd->getNalHrdParametersPresentFlag() ) ) ||
     904          ( ( nalOrVcl == 1 ) && ( hrd->getVclHrdParametersPresentFlag() ) ) )
     905      {
     906        for( j = 0; j <= ( hrd->getCpbCntMinus1( i ) ); j ++ )
     907        {
     908          WRITE_UVLC( hrd->getBitRateValueMinus1( i, j, nalOrVcl ), "bit_rate_value_minus1");
     909          WRITE_UVLC( hrd->getCpbSizeValueMinus1( i, j, nalOrVcl ), "cpb_size_value_minus1");
     910          if( hrd->getSubPicCpbParamsPresentFlag() )
     911          {
     912            WRITE_UVLC( hrd->getDuCpbSizeValueMinus1( i, j, nalOrVcl ), "cpb_size_du_value_minus1"); 
     913            WRITE_UVLC( hrd->getDuBitRateValueMinus1( i, j, nalOrVcl ), "bit_rate_du_value_minus1");
     914          }
     915          WRITE_FLAG( hrd->getCbrFlag( i, j, nalOrVcl ) ? 1 : 0, "cbr_flag");
     916        }
     917      }
     918    }
     919  }
     920}
     921
     922#endif
     923
    695924#endif //SVC_EXTENSION
    696925
  • trunk/source/Lib/TLibEncoder/SEIwrite.h

    r595 r644  
    4747  virtual ~SEIWriter() {};
    4848
     49#if O0164_MULTI_LAYER_HRD
     50  void writeSEImessage(TComBitIf& bs, const SEI& sei, TComVPS *vps, TComSPS *sps, const SEIScalableNesting* nestingSei=NULL, const SEIBspNesting* bspNestingSei=NULL);
     51#else
    4952  void writeSEImessage(TComBitIf& bs, const SEI& sei, TComSPS *sps);
     53#endif
    5054
    5155protected:
     56#if O0164_MULTI_LAYER_HRD
     57  Void xWriteSEIpayloadData(TComBitIf& bs, const SEI& sei, TComVPS *vps, TComSPS *sps, const SEIScalableNesting& nestingSei, const SEIBspNesting& bspNestingSei);
     58#else
    5259  Void xWriteSEIpayloadData(TComBitIf& bs, const SEI& sei, TComSPS *sps);
     60#endif
    5361  Void xWriteSEIuserDataUnregistered(const SEIuserDataUnregistered &sei);
    5462  Void xWriteSEIActiveParameterSets(const SEIActiveParameterSets& sei);
     
    6573  Void xWriteSEIToneMappingInfo(const SEIToneMappingInfo& sei);
    6674  Void xWriteSEISOPDescription(const SEISOPDescription& sei);
     75#if O0164_MULTI_LAYER_HRD
     76  Void xWriteSEIScalableNesting(TComBitIf& bs, const SEIScalableNesting& sei, TComVPS *vps, TComSPS *sps);
     77#else
    6778  Void xWriteSEIScalableNesting(TComBitIf& bs, const SEIScalableNesting& sei, TComSPS *sps);
     79#endif
    6880  Void xWriteByteAlign();
    6981#if SVC_EXTENSION
     
    7789  Void xWriteSEISubBitstreamProperty(const SEISubBitstreamProperty &sei);
    7890#endif
     91#if O0164_MULTI_LAYER_HRD
     92  Void xWriteSEIBspNesting(TComBitIf& bs, const SEIBspNesting &sei, TComVPS *vps, TComSPS *sps, const SEIScalableNesting &nestingSei);
     93  Void xWriteSEIBspInitialArrivalTime(const SEIBspInitialArrivalTime &sei, TComVPS *vps, TComSPS *sps, const SEIScalableNesting &nestingSei, const SEIBspNesting &bspNestingSei);
     94  Void xWriteSEIBspHrd(const SEIBspHrd &sei, TComSPS *sps, const SEIScalableNesting &nestingSei);
     95  Void xCodeHrdParameters( TComHRD *hrd, Bool commonInfPresentFlag, UInt maxNumSubLayersMinus1 );
     96#endif
    7997#endif //SVC_EXTENSION
    8098};
  • trunk/source/Lib/TLibEncoder/TEncCavlc.cpp

    r595 r644  
    251251  WRITE_UVLC( pcPPS->getLog2ParallelMergeLevelMinus2(), "log2_parallel_merge_level_minus2");
    252252  WRITE_FLAG( pcPPS->getSliceHeaderExtensionPresentFlag() ? 1 : 0, "slice_segment_header_extension_present_flag");
     253#if P0166_MODIFIED_PPS_EXTENSION
     254  WRITE_FLAG( 1, "pps_extension_flag" );
     255  if( 1 ) //pps_extension_flag
     256  {
     257#if !POC_RESET_IDC
     258    UInt ppsExtensionTypeFlag[8] = { 0, 1, 0, 0, 0, 0, 0, 0 };
     259#else
     260    UInt ppsExtensionTypeFlag[8] = { 1, 0, 0, 0, 0, 0, 0, 0 };
     261#endif
     262    for (UInt i = 0; i < 8; i++)
     263    {
     264      WRITE_FLAG( ppsExtensionTypeFlag[i], "pps_extension_type_flag" );
     265    }
     266#if POC_RESET_IDC
     267    if( ppsExtensionTypeFlag[0] )
     268    {
     269      WRITE_FLAG( pcPPS->getPocResetInfoPresentFlag() ? 1 : 0, "poc_reset_info_present_flag" );
     270#endif
     271    }
     272  }
     273#else
    253274  WRITE_FLAG( 0, "pps_extension_flag" );
     275#endif
    254276}
    255277
     
    496518  WRITE_UVLC( pcSPS->getBitsForPOC()-4,                 "log2_max_pic_order_cnt_lsb_minus4" );
    497519
     520#if SPS_DPB_PARAMS
     521  if( pcSPS->getLayerId() == 0 )
     522  {
     523#endif
    498524  const Bool subLayerOrderingInfoPresentFlag = 1;
    499525  WRITE_FLAG(subLayerOrderingInfoPresentFlag,       "sps_sub_layer_ordering_info_present_flag");
     
    508534    }
    509535  }
     536#if SPS_DPB_PARAMS
     537  }
     538#endif
    510539  assert( pcSPS->getMaxCUWidth() == pcSPS->getMaxCUHeight() );
    511540 
     
    632661      WRITE_SVLC( scaledWindow.getWindowRightOffset()  >> 1, "scaled_ref_layer_right_offset" );
    633662      WRITE_SVLC( scaledWindow.getWindowBottomOffset() >> 1, "scaled_ref_layer_bottom_offset" );
     663#if P0312_VERT_PHASE_ADJ
     664      WRITE_FLAG( scaledWindow.getVertPhasePositionEnableFlag(), "vert_phase_position_enable_flag" );
     665#endif
    634666    }
    635667  }
     
    776808{
    777809  // ... More syntax elements to be written here
     810#if P0300_ALT_OUTPUT_LAYER_FLAG
     811  Int NumOutputLayersInOutputLayerSet[MAX_VPS_LAYER_SETS_PLUS1];
     812  Int OlsHighestOutputLayerId[MAX_VPS_LAYER_SETS_PLUS1];
     813#endif
    778814#if VPS_EXTN_MASK_AND_DIM_INFO
    779815  UInt i = 0, j = 0;
     
    887923    if (vps->getMaxTSLayersPresentFlag())
    888924    {
    889         for( i = 0; i < vps->getMaxLayers() - 1; i++)
     925        for( i = 0; i < vps->getMaxLayers(); i++)
    890926        {
    891927            WRITE_CODE(vps->getMaxTSLayersMinus1(i), 3, "sub_layers_vps_max_minus1[i]" );
     
    9931029#endif
    9941030      Int lsIdx = vps->getOutputLayerSetIdx(i);
     1031#if NUM_OL_FLAGS
     1032      for(j = 0; j < vps->getNumLayersInIdList(lsIdx) ; j++)
     1033#else
    9951034      for(j = 0; j < vps->getNumLayersInIdList(lsIdx) - 1; j++)
     1035#endif
    9961036      {
    9971037        WRITE_FLAG( vps->getOutputLayerFlag(i,j), "output_layer_flag[i][j]");
     
    10041044    }
    10051045    WRITE_CODE( vps->getProfileLevelTierIdx(i), numBits, "profile_level_tier_idx[i]" );     
    1006   }
    1007 
     1046#if P0300_ALT_OUTPUT_LAYER_FLAG
     1047    NumOutputLayersInOutputLayerSet[i] = 0;
     1048    Int layerSetIdxForOutputLayerSet = vps->getOutputLayerSetIdx(i);
     1049    for (j = 0; j < vps->getNumLayersInIdList(layerSetIdxForOutputLayerSet); j++)
     1050    {
     1051      NumOutputLayersInOutputLayerSet[i] += vps->getOutputLayerFlag(i, j);
     1052      if (vps->getOutputLayerFlag(i, j))
     1053      {
     1054        OlsHighestOutputLayerId[i] = vps->getLayerSetLayerIdList(layerSetIdxForOutputLayerSet, j);
     1055      }
     1056    }
     1057    if (NumOutputLayersInOutputLayerSet[i] == 1 && vps->getNumDirectRefLayers(OlsHighestOutputLayerId[i]) > 0)
     1058    {
     1059      WRITE_FLAG(vps->getAltOuputLayerFlag(i), "alt_output_layer_flag[i]");
     1060    }
     1061#endif
     1062  }
     1063
     1064#if !P0300_ALT_OUTPUT_LAYER_FLAG
    10081065#if O0153_ALT_OUTPUT_LAYER_FLAG
    10091066  if( vps->getMaxLayers() > 1 )
     
    10111068    WRITE_FLAG( vps->getAltOuputLayerFlag(), "alt_output_layer_flag" );   
    10121069  }
     1070#endif
    10131071#endif
    10141072
     
    11241182#if P0307_VPS_NON_VUI_EXTENSION
    11251183  WRITE_UVLC( vps->getVpsNonVuiExtLength(), "vps_non_vui_extension_length" );
     1184#if P0307_VPS_NON_VUI_EXT_UPDATE
     1185  for (i = 1; i <= vps->getVpsNonVuiExtLength(); i++)
     1186  {
     1187    WRITE_CODE(1, 8, "vps_non_vui_extension_data_byte");
     1188  }
     1189#else
    11261190  if ( vps->getVpsNonVuiExtLength() > 0 )
    11271191  {
    11281192    printf("\n\nUp to the current spec, the value of vps_non_vui_extension_length is supposed to be 0\n");
    11291193  }
     1194#endif
    11301195#endif
    11311196
     
    12171282Void TEncCavlc::codeVpsDpbSizeTable(TComVPS *vps)
    12181283{
     1284#if DPB_PARAMS_MAXTLAYERS
     1285    Int * MaxSubLayersInLayerSetMinus1 = new Int[vps->getNumOutputLayerSets()];
     1286    for(Int i = 1; i < vps->getNumOutputLayerSets(); i++)
     1287    {
     1288        UInt maxSLMinus1 = 0;
     1289#if CHANGE_NUMSUBDPB_IDX
     1290        Int optLsIdx = vps->getOutputLayerSetIdx( i );
     1291#else
     1292        Int optLsIdx = i;
     1293#endif
     1294        for(Int k = 0; k < vps->getNumLayersInIdList(optLsIdx); k++ ) {
     1295            Int  lId = vps->getLayerSetLayerIdList(optLsIdx, k);
     1296            maxSLMinus1 = max(maxSLMinus1, vps->getMaxTSLayersMinus1(vps->getLayerIdInVps(lId)));
     1297        }
     1298        MaxSubLayersInLayerSetMinus1[ i ] = maxSLMinus1;
     1299    }
     1300#endif
     1301   
    12191302  for(Int i = 1; i < vps->getNumOutputLayerSets(); i++)
    12201303  {
     
    12221305    Int layerSetIdxForOutputLayerSet = vps->getOutputLayerSetIdx( i );
    12231306#endif
    1224     WRITE_FLAG( vps->getSubLayerFlagInfoPresentFlag( i ), "sub_layer_flag_info_present_flag[i]"); 
     1307    WRITE_FLAG( vps->getSubLayerFlagInfoPresentFlag( i ), "sub_layer_flag_info_present_flag[i]");
     1308#if DPB_PARAMS_MAXTLAYERS
     1309    for(Int j = 0; j <= MaxSubLayersInLayerSetMinus1[ i ]; j++)
     1310#else
    12251311    for(Int j = 0; j < vps->getMaxTLayers(); j++)
     1312#endif
    12261313    {
    12271314      if( j > 0 && vps->getSubLayerFlagInfoPresentFlag(i) )
     
    12661353#if IRAP_ALIGN_FLAG_IN_VPS_VUI
    12671354    WRITE_FLAG(vps->getCrossLayerIrapAlignFlag(), "cross_layer_irap_aligned_flag");
     1355#if P0068_CROSS_LAYER_ALIGNED_IDR_ONLY_FOR_IRAP_FLAG
     1356    if(vps->getCrossLayerIrapAlignFlag())
     1357    {
     1358       WRITE_FLAG(vps->getCrossLayerAlignedIdrOnlyFlag(), "only_idr_for_IRAP_across_layers");
     1359    }
     1360#endif
    12681361#endif
    12691362#if O0223_PICTURE_TYPES_ALIGN_FLAG
     
    13751468  WRITE_FLAG(vps->getHigherLayerIrapSkipFlag(), "higher_layer_irap_skip_flag" );
    13761469#endif
     1470#endif
     1471#if P0312_VERT_PHASE_ADJ
     1472  WRITE_FLAG( vps->getVpsVuiVertPhaseInUseFlag(), "vps_vui_vert_phase_in_use_flag" );
    13771473#endif
    13781474#if N0160_VUI_EXT_ILP_REF
     
    14241520#endif
    14251521#endif
     1522#if O0164_MULTI_LAYER_HRD
     1523    WRITE_FLAG(vps->getVpsVuiBspHrdPresentFlag(), "vps_vui_bsp_hrd_present_flag" );
     1524    if (vps->getVpsVuiBspHrdPresentFlag())
     1525    {
     1526      WRITE_UVLC( vps->getVpsNumBspHrdParametersMinus1(), "vps_num_bsp_hrd_parameters_minus1" );
     1527      for( i = 0; i <= vps->getVpsNumBspHrdParametersMinus1(); i++ )
     1528      {
     1529        if( i > 0 )
     1530        {
     1531          WRITE_FLAG( vps->getBspCprmsPresentFlag(i), "bsp_cprms_present_flag[i]" );
     1532        }
     1533        codeHrdParameters(vps->getBspHrd(i), i==0 ? 1 : vps->getBspCprmsPresentFlag(i), vps->getMaxTLayers()-1);
     1534      }
     1535      for( UInt h = 1; h <= (vps->getNumLayerSets()-1); h++ )
     1536      {
     1537        WRITE_UVLC( vps->getNumBitstreamPartitions(h), "num_bitstream_partitions[i]");
     1538        for( i = 0; i < vps->getNumBitstreamPartitions(h); i++ )
     1539        {
     1540          for( j = 0; j <= (vps->getMaxLayers()-1); j++ )
     1541          {
     1542            if (vps->getLayerIdIncludedFlag(h, j))
     1543            {
     1544              WRITE_FLAG( vps->getLayerInBspFlag(h, i, j), "layer_in_bsp_flag[h][i][j]" );
     1545            }
     1546          }
     1547        }
     1548        if (vps->getNumBitstreamPartitions(h))
     1549        {
     1550          WRITE_UVLC( vps->getNumBspSchedCombinations(h), "num_bsp_sched_combinations[h]");
     1551          for( i = 0; i < vps->getNumBspSchedCombinations(h); i++ )
     1552          {
     1553            for( j = 0; j < vps->getNumBitstreamPartitions(h); j++ )
     1554            {
     1555              WRITE_UVLC( vps->getBspCombHrdIdx(h, i, j), "bsp_comb_hrd_idx[h][i][j]");
     1556              WRITE_UVLC( vps->getBspCombSchedIdx(h, i, j), "bsp_comb_sched_idx[h][i][j]");
     1557            }
     1558          }
     1559        }
     1560      }
     1561    }
     1562#endif
     1563#if P0182_VPS_VUI_PS_FLAG
     1564    for(i = 1; i < vps->getMaxLayers(); i++)
     1565    {
     1566      if(vps->getNumRefLayers(vps->getLayerIdInNuh(i)) == 0)
     1567      {
     1568        if ((vps->getSPSId(i) == 0) && (vps->getPPSId(i) == 0))
     1569        {
     1570          vps->setBaseLayerPSCompatibilityFlag(i, 1);
     1571          WRITE_FLAG(vps->getBaseLayerPSCompatibilityFlag(i), "base_layer_parameter_set_compatibility_flag" );
     1572        }
     1573        else
     1574        {
     1575          vps->setBaseLayerPSCompatibilityFlag(i, 0);
     1576        }
     1577      }
     1578    }
     1579#endif
    14261580}
    14271581#endif
     
    14581612  if ( pcSlice->getRapPicFlag() )
    14591613  {
     1614#if NO_OUTPUT_OF_PRIOR_PICS
     1615    WRITE_FLAG( pcSlice->getNoOutputOfPriorPicsFlag(), "no_output_of_prior_pics_flag" );
     1616#else
    14601617    WRITE_FLAG( 0, "no_output_of_prior_pics_flag" );
     1618#endif
    14611619  }
    14621620  WRITE_UVLC( pcSlice->getPPS()->getPPSId(), "slice_pic_parameter_set_id" );
     
    16901848#if ILP_SSH_SIG
    16911849#if ILP_SSH_SIG_FIX
    1692     if((pcSlice->getSPS()->getLayerId() > 0) && !(pcSlice->getVPS()->getIlpSshSignalingEnabledFlag()) && (pcSlice->getNumILRRefIdx() > 0) )
    1693 #else
    1694     if((pcSlice->getSPS()->getLayerId() > 0) && pcSlice->getVPS()->getIlpSshSignalingEnabledFlag() && (pcSlice->getNumILRRefIdx() > 0) )
    1695 #endif
    1696 #else
    1697     if((pcSlice->getSPS()->getLayerId() > 0)  &&  (pcSlice->getNumILRRefIdx() > 0) )
     1850    if((pcSlice->getLayerId() > 0) && !(pcSlice->getVPS()->getIlpSshSignalingEnabledFlag()) && (pcSlice->getNumILRRefIdx() > 0) )
     1851#else
     1852    if((pcSlice->getLayerId() > 0) && pcSlice->getVPS()->getIlpSshSignalingEnabledFlag() && (pcSlice->getNumILRRefIdx() > 0) )
     1853#endif
     1854#else
     1855    if((pcSlice->getLayerId() > 0)  &&  (pcSlice->getNumILRRefIdx() > 0) )
    16981856#endif
    16991857    {
     
    17261884      }
    17271885    }     
     1886#if P0312_VERT_PHASE_ADJ
     1887    for(Int i = 0; i < pcSlice->getActiveNumILRRefIdx(); i++ )
     1888    {
     1889      UInt refLayerIdc = pcSlice->getInterLayerPredLayerIdc(i);
     1890      if( pcSlice->getSPS()->getVertPhasePositionEnableFlag(refLayerIdc) )
     1891      {
     1892        WRITE_FLAG( pcSlice->getVertPhasePositionFlag(refLayerIdc), "vert_phase_position_flag" );
     1893      }
     1894    }
     1895#endif
    17281896#endif //SVC_EXTENSION
    17291897
     
    18862054    }
    18872055  }
     2056
     2057#if !POC_RESET_IDC_SIGNALLING   // Wrong place to put slice header extension
    18882058  if(pcSlice->getPPS()->getSliceHeaderExtensionPresentFlag())
    18892059  {
    18902060    WRITE_UVLC(0,"slice_header_extension_length");
    18912061  }
     2062#endif
    18922063}
    18932064
     
    20252196}
    20262197
     2198#if POC_RESET_IDC_SIGNALLING
     2199Void  TEncCavlc::codeSliceHeaderExtn( TComSlice* slice, Int shBitsWrittenTillNow )
     2200{
     2201  Int tmpBitsBeforeWriting = getNumberOfWrittenBits();
     2202  if(slice->getPPS()->getSliceHeaderExtensionPresentFlag())
     2203  {
     2204    // Derive the value of PocMsbValRequiredFlag
     2205    slice->setPocMsbValRequiredFlag( slice->getCraPicFlag() || slice->getBlaPicFlag()
     2206                                          /* || related to vps_poc_lsb_aligned_flag */
     2207                                          );
     2208
     2209    // Determine value of SH extension length.
     2210    Int shExtnLengthInBit = 0;
     2211    if (slice->getPPS()->getPocResetInfoPresentFlag())
     2212    {
     2213      shExtnLengthInBit += 2;
     2214    }
     2215    if (slice->getPocResetIdc() > 0)
     2216    {
     2217      shExtnLengthInBit += 6;
     2218    }
     2219    if (slice->getPocResetIdc() == 3)
     2220    {
     2221      shExtnLengthInBit += (slice->getSPS()->getBitsForPOC() + 1);
     2222    }
     2223
     2224
     2225    if( !slice->getPocMsbValRequiredFlag() /* &&  vps_poc_lsb_aligned_flag */ )
     2226    {
     2227      shExtnLengthInBit++;
     2228    }
     2229    else
     2230    {
     2231      if( slice->getPocMsbValRequiredFlag() )
     2232      {
     2233        slice->setPocMsbValPresentFlag( true );
     2234      }
     2235      else
     2236      {
     2237        slice->setPocMsbValPresentFlag( false );
     2238      }
     2239    }
     2240
     2241    if( slice->getPocMsbValPresentFlag() )
     2242    {
     2243      UInt lengthVal = 1;
     2244      UInt tempVal = slice->getPocMsbVal() + 1;
     2245      assert ( tempVal );
     2246      while( 1 != tempVal )
     2247      {
     2248        tempVal >>= 1;
     2249        lengthVal += 2;
     2250      }
     2251      shExtnLengthInBit += lengthVal;
     2252    }
     2253    Int shExtnAdditionalBits = 0;
     2254    if(shExtnLengthInBit % 8 != 0)
     2255    {
     2256      shExtnAdditionalBits = 8 - (shExtnLengthInBit % 8);
     2257    }
     2258    Int shExtnLength = (shExtnLengthInBit + shExtnAdditionalBits) / 8;
     2259    WRITE_UVLC( shExtnLength, "slice_header_extension_length" );
     2260
     2261    if(slice->getPPS()->getPocResetInfoPresentFlag())
     2262    {
     2263      WRITE_CODE( slice->getPocResetIdc(), 2,                                 "poc_reset_idc");
     2264    }
     2265    if(slice->getPocResetIdc() > 0)
     2266    {
     2267      WRITE_CODE( slice->getPocResetPeriodId(), 6,                            "poc_reset_period_id");
     2268    }
     2269    if(slice->getPocResetIdc() == 3)
     2270    {
     2271      WRITE_FLAG( slice->getFullPocResetFlag() ? 1 : 0,                       "full_poc_reset_flag");
     2272      WRITE_CODE( slice->getPocLsbVal(), slice->getSPS()->getBitsForPOC(),  "poc_lsb_val");
     2273    }
     2274
     2275    if( !slice->getPocMsbValRequiredFlag() /* &&  vps_poc_lsb_aligned_flag */ )
     2276    {
     2277      WRITE_FLAG( slice->getPocMsbValPresentFlag(),                           "poc_msb_val_present_flag" );
     2278    }
     2279    if( slice->getPocMsbValPresentFlag() )
     2280    {
     2281      WRITE_UVLC( slice->getPocMsbVal(),                                      "poc_msb_val" );
     2282    }
     2283    for (Int i = 0; i < shExtnAdditionalBits; i++)
     2284    {
     2285      WRITE_FLAG( 1, "slice_segment_header_extension_reserved_bit");
     2286    }
     2287  }
     2288  shBitsWrittenTillNow += ( getNumberOfWrittenBits() - tmpBitsBeforeWriting );
     2289 
     2290  // Slice header byte_alignment() included in xAttachSliceDataToNalUnit
     2291}
     2292#endif
     2293
    20272294Void TEncCavlc::codeTerminatingBit      ( UInt uilsLast )
    20282295{
  • trunk/source/Lib/TLibEncoder/TEncCavlc.h

    r595 r644  
    9696  Void  codeHrdParameters       ( TComHRD *hrd, Bool commonInfPresentFlag, UInt maxNumSubLayersMinus1 );
    9797  Void  codeTilesWPPEntryPoint( TComSlice* pSlice );
     98#if POC_RESET_IDC_SIGNALLING
     99  Void  codeSliceHeaderExtn( TComSlice* slice, Int shBitsWrittenTillNow );
     100#endif
    98101  Void  codeTerminatingBit      ( UInt uilsLast );
    99102  Void  codeSliceFinish         ();
    100103 
    101104  Void codeMVPIdx ( TComDataCU* pcCU, UInt uiAbsPartIdx, RefPicList eRefList );
     105#if SVC_EXTENSION
     106  Void codeSAOBlkParam(SAOBlkParam& saoBlkParam, UInt* saoMaxOffsetQVal, Bool* sliceEnabled, Bool leftMergeAvail, Bool aboveMergeAvail, Bool onlyEstMergeInfo = false){printf("only supported in CABAC"); assert(0); exit(-1);}
     107#else
    102108  Void codeSAOBlkParam(SAOBlkParam& saoBlkParam, Bool* sliceEnabled, Bool leftMergeAvail, Bool aboveMergeAvail, Bool onlyEstMergeInfo = false){printf("only supported in CABAC"); assert(0); exit(-1);}
     109#endif
    103110  Void codeCUTransquantBypassFlag( TComDataCU* pcCU, UInt uiAbsPartIdx );
    104111  Void codeSkipFlag      ( TComDataCU* pcCU, UInt uiAbsPartIdx );
  • trunk/source/Lib/TLibEncoder/TEncCfg.h

    r595 r644  
    386386
    387387  Window   &getConformanceWindow()                           { return m_conformanceWindow; }
     388#if P0312_VERT_PHASE_ADJ
     389  Void      setConformanceWindow (Int confLeft, Int confRight, Int confTop, Int confBottom ) { m_conformanceWindow.setWindow (confLeft, confRight, confTop, confBottom, false); }
     390#else
    388391  Void      setConformanceWindow (Int confLeft, Int confRight, Int confTop, Int confBottom ) { m_conformanceWindow.setWindow (confLeft, confRight, confTop, confBottom); }
     392#endif
    389393
    390394  Void      setFramesToBeEncoded            ( Int   i )      { m_framesToBeEncoded = i; }
  • trunk/source/Lib/TLibEncoder/TEncEntropy.cpp

    r595 r644  
    6060}
    6161
     62#if POC_RESET_IDC_SIGNALLING
     63Void  TEncEntropy::encodeSliceHeaderExtn( TComSlice* pSlice, Int shBitsWrittenTillNow )
     64{
     65  m_pcEntropyCoderIf->codeSliceHeaderExtn( pSlice, shBitsWrittenTillNow );
     66}
     67#endif
     68
    6269Void TEncEntropy::encodeTerminatingBit      ( UInt uiIsLast )
    6370{
  • trunk/source/Lib/TLibEncoder/TEncEntropy.h

    r595 r644  
    7474
    7575  virtual Void  codeTilesWPPEntryPoint  ( TComSlice* pSlice )     = 0;
     76#if POC_RESET_IDC_SIGNALLING
     77  virtual Void  codeSliceHeaderExtn     ( TComSlice* pSlice, Int shBitsWrittenTillNow )     = 0;
     78#endif
    7679  virtual Void  codeTerminatingBit      ( UInt uilsLast )                                       = 0;
    7780  virtual Void  codeSliceFinish         ()                                                      = 0;
     
    105108  virtual Void codeCoeffNxN      ( TComDataCU* pcCU, TCoeff* pcCoef, UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight, UInt uiDepth, TextType eTType ) = 0;
    106109  virtual Void codeTransformSkipFlags ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt width, UInt height, TextType eTType ) = 0;
     110#if SVC_EXTENSION
     111  virtual Void codeSAOBlkParam(SAOBlkParam& saoBlkParam, UInt* saoMaxOffsetQVal, Bool* sliceEnabled, Bool leftMergeAvail, Bool aboveMergeAvail, Bool onlyEstMergeInfo = false)    =0;
     112#else
    107113  virtual Void codeSAOBlkParam(SAOBlkParam& saoBlkParam, Bool* sliceEnabled, Bool leftMergeAvail, Bool aboveMergeAvail, Bool onlyEstMergeInfo = false)    =0;
     114#endif
    108115  virtual Void estBit               (estBitsSbacStruct* pcEstBitsSbac, Int width, Int height, TextType eTType) = 0;
    109116 
     
    138145  Void    encodeSliceHeader         ( TComSlice* pcSlice );
    139146  Void    encodeTilesWPPEntryPoint( TComSlice* pSlice );
     147#if POC_RESET_IDC_SIGNALLING
     148Void      encodeSliceHeaderExtn( TComSlice* pSlice, Int shBitsWrittenTillNow );
     149#endif
    140150  Void    encodeTerminatingBit      ( UInt uiIsLast );
    141151  Void    encodeSliceFinish         ();
     
    184194 
    185195  Void estimateBit             ( estBitsSbacStruct* pcEstBitsSbac, Int width, Int height, TextType eTType);
     196#if SVC_EXTENSION
     197  Void encodeSAOBlkParam(SAOBlkParam& saoBlkParam, UInt* saoMaxOffsetQVal, Bool* sliceEnabled, Bool leftMergeAvail, Bool aboveMergeAvail){m_pcEntropyCoderIf->codeSAOBlkParam(saoBlkParam, saoMaxOffsetQVal, sliceEnabled, leftMergeAvail, aboveMergeAvail, false);}
     198#else
    186199  Void encodeSAOBlkParam(SAOBlkParam& saoBlkParam, Bool* sliceEnabled, Bool leftMergeAvail, Bool aboveMergeAvail){m_pcEntropyCoderIf->codeSAOBlkParam(saoBlkParam, sliceEnabled, leftMergeAvail, aboveMergeAvail, false);}
     200#endif
    187201  static Int countNonZeroCoeffs( TCoeff* pcCoef, UInt uiSize );
    188202
  • trunk/source/Lib/TLibEncoder/TEncGOP.cpp

    r595 r644  
    303303    //nalu = NALUnit(NAL_UNIT_SEI);
    304304    m_pcEntropyCoder->setBitstream(&nalu.m_Bitstream);
     305#if O0164_MULTI_LAYER_HRD
     306    m_seiWriter.writeSEImessage(nalu.m_Bitstream, *sei, m_pcEncTop->getVPS(), sps);
     307#else
    305308    m_seiWriter.writeSEImessage(nalu.m_Bitstream, *sei, sps);
     309#endif
    306310    writeRBSPTrailingBits(nalu.m_Bitstream);
    307311    accessUnit.push_back(new NALUnitEBSP(nalu));
     
    316320    nalu = NALUnit(NAL_UNIT_PREFIX_SEI);
    317321    m_pcEntropyCoder->setBitstream(&nalu.m_Bitstream);
     322#if O0164_MULTI_LAYER_HRD
     323    m_seiWriter.writeSEImessage(nalu.m_Bitstream, *sei, m_pcEncTop->getVPS(), sps);
     324#else
    318325    m_seiWriter.writeSEImessage(nalu.m_Bitstream, *sei, sps);
     326#endif
    319327    writeRBSPTrailingBits(nalu.m_Bitstream);
    320328    accessUnit.push_back(new NALUnitEBSP(nalu));
     
    327335    nalu = NALUnit(NAL_UNIT_PREFIX_SEI);
    328336    m_pcEntropyCoder->setBitstream(&nalu.m_Bitstream);
     337#if O0164_MULTI_LAYER_HRD
     338    m_seiWriter.writeSEImessage(nalu.m_Bitstream, *sei, m_pcEncTop->getVPS(), sps);
     339#else
    329340    m_seiWriter.writeSEImessage(nalu.m_Bitstream, *sei, sps);
     341#endif
    330342    writeRBSPTrailingBits(nalu.m_Bitstream);
    331343    accessUnit.push_back(new NALUnitEBSP(nalu));
     
    338350    nalu = NALUnit(NAL_UNIT_PREFIX_SEI);
    339351    m_pcEntropyCoder->setBitstream(&nalu.m_Bitstream);
     352#if O0164_MULTI_LAYER_HRD
     353    m_seiWriter.writeSEImessage(nalu.m_Bitstream, *sei, m_pcEncTop->getVPS(), sps);
     354#else
    340355    m_seiWriter.writeSEImessage(nalu.m_Bitstream, *sei, sps);
     356#endif
    341357    writeRBSPTrailingBits(nalu.m_Bitstream);
    342358    accessUnit.push_back(new NALUnitEBSP(nalu));
     
    350366    SEILayersNotPresent *sei = xCreateSEILayersNotPresent ();
    351367    m_pcEntropyCoder->setBitstream(&nalu.m_Bitstream);
     368#if O0164_MULTI_LAYER_HRD
     369    m_seiWriter.writeSEImessage(nalu.m_Bitstream, *sei, m_pcEncTop->getVPS(), sps);
     370#else
    352371    m_seiWriter.writeSEImessage(nalu.m_Bitstream, *sei, sps);
     372#endif
    353373    writeRBSPTrailingBits(nalu.m_Bitstream);
    354374    accessUnit.push_back(new NALUnitEBSP(nalu));
     
    364384    nalu = NALUnit(NAL_UNIT_PREFIX_SEI, 0, m_pcCfg->getNumLayer()-1); // For highest layer
    365385    m_pcEntropyCoder->setBitstream(&nalu.m_Bitstream);
     386#if O0164_MULTI_LAYER_HRD
     387    m_seiWriter.writeSEImessage(nalu.m_Bitstream, *sei, m_pcEncTop->getVPS(), sps);
     388#else
    366389    m_seiWriter.writeSEImessage(nalu.m_Bitstream, *sei, sps);
     390#endif
    367391    writeRBSPTrailingBits(nalu.m_Bitstream);
    368392    accessUnit.push_back(new NALUnitEBSP(nalu));
     
    797821          Window scalEL = pcSlice->getSPS()->getScaledRefLayerWindow(refLayerIdc);
    798822#endif*/
     823#if P0312_VERT_PHASE_ADJ
     824          //when PhasePositionEnableFlag is equal to 1, set vertPhasePositionFlag to 0 if BL is top field and 1 if bottom
     825          if( scalEL.getVertPhasePositionEnableFlag() )
     826          {
     827            pcSlice->setVertPhasePositionFlag( pcSlice->getPOC()%2, refLayerIdc );
     828          }
     829#endif
    799830#if O0215_PHASE_ALIGNMENT
    800831#if O0194_JOINT_US_BITSHIFT
     
    928959      pcSlice->createExplicitReferencePictureSetFromReference(rcListPic, pcSlice->getRPS(), pcSlice->isIRAP());
    929960    }
     961#if ALIGNED_BUMPING
     962    pcSlice->checkLeadingPictureRestrictions(rcListPic);
     963#endif
    930964    pcSlice->applyReferencePictureSet(rcListPic, pcSlice->getRPS());
    931965
     
    17161750      xCreateLeadingSEIMessages(accessUnit, pcSlice->getSPS());
    17171751
     1752#if O0164_MULTI_LAYER_HRD
     1753      if (pcSlice->getLayerId() == 0 && m_pcEncTop->getVPS()->getVpsVuiBspHrdPresentFlag())
     1754      {
     1755        nalu = NALUnit(NAL_UNIT_PREFIX_SEI, 0, 1);
     1756        m_pcEntropyCoder->setEntropyCoder(m_pcCavlcCoder, pcSlice);
     1757        m_pcEntropyCoder->setBitstream(&nalu.m_Bitstream);
     1758        SEIScalableNesting *scalableBspNestingSei = xCreateBspNestingSEI(pcSlice);
     1759        m_seiWriter.writeSEImessage(nalu.m_Bitstream, *scalableBspNestingSei, m_pcEncTop->getVPS(), pcSlice->getSPS());
     1760        writeRBSPTrailingBits(nalu.m_Bitstream);
     1761
     1762        UInt seiPositionInAu = xGetFirstSeiLocation(accessUnit);
     1763        UInt offsetPosition = m_activeParameterSetSEIPresentInAU
     1764          + m_bufferingPeriodSEIPresentInAU
     1765          + m_pictureTimingSEIPresentInAU
     1766          + m_nestedPictureTimingSEIPresentInAU;  // Insert SEI after APS, BP and PT SEI
     1767        AccessUnit::iterator it;
     1768        for(j = 0, it = accessUnit.begin(); j < seiPositionInAu + offsetPosition; j++)
     1769        {
     1770          it++;
     1771        }
     1772        accessUnit.insert(it, new NALUnitEBSP(nalu));
     1773      }
     1774#endif
     1775
    17181776      m_bSeqFirst = false;
    17191777    }
     
    17501808      SOPDescriptionSEI.m_numPicsInSopMinus1 = i - 1;
    17511809
     1810#if O0164_MULTI_LAYER_HRD
     1811      m_seiWriter.writeSEImessage( nalu.m_Bitstream, SOPDescriptionSEI, m_pcEncTop->getVPS(), pcSlice->getSPS());
     1812#else
    17521813      m_seiWriter.writeSEImessage( nalu.m_Bitstream, SOPDescriptionSEI, pcSlice->getSPS());
     1814#endif
    17531815      writeRBSPTrailingBits(nalu.m_Bitstream);
    17541816      accessUnit.push_back(new NALUnitEBSP(nalu));
     
    18341896      sei_buffering_period.m_dpbDelayOffset = 0;
    18351897
     1898#if O0164_MULTI_LAYER_HRD
     1899      m_seiWriter.writeSEImessage( nalu.m_Bitstream, sei_buffering_period, m_pcEncTop->getVPS(), pcSlice->getSPS());
     1900#else
    18361901      m_seiWriter.writeSEImessage( nalu.m_Bitstream, sei_buffering_period, pcSlice->getSPS());
     1902#endif
    18371903      writeRBSPTrailingBits(nalu.m_Bitstream);
    18381904      {
     
    18551921        scalableNestingSEI.m_nestedSEIs.clear();
    18561922        scalableNestingSEI.m_nestedSEIs.push_back(&sei_buffering_period);
     1923#if O0164_MULTI_LAYER_HRD
     1924        m_seiWriter.writeSEImessage( naluTmp.m_Bitstream, scalableNestingSEI, m_pcEncTop->getVPS(), pcSlice->getSPS());
     1925#else
    18571926        m_seiWriter.writeSEImessage( naluTmp.m_Bitstream, scalableNestingSEI, pcSlice->getSPS());
     1927#endif
    18581928        writeRBSPTrailingBits(naluTmp.m_Bitstream);
    18591929        UInt seiPositionInAu = xGetFirstSeiLocation(accessUnit);
     
    18841954        seiGradualDecodingRefreshInfo.m_gdrForegroundFlag = true; // Indicating all "foreground"
    18851955
     1956#if O0164_MULTI_LAYER_HRD
     1957        m_seiWriter.writeSEImessage( nalu.m_Bitstream, seiGradualDecodingRefreshInfo, m_pcEncTop->getVPS(), pcSlice->getSPS() );
     1958#else
    18861959        m_seiWriter.writeSEImessage( nalu.m_Bitstream, seiGradualDecodingRefreshInfo, pcSlice->getSPS() );
     1960#endif
    18871961        writeRBSPTrailingBits(nalu.m_Bitstream);
    18881962        accessUnit.push_back(new NALUnitEBSP(nalu));
     
    19021976      sei_recovery_point.m_brokenLinkFlag    = false;
    19031977
     1978#if O0164_MULTI_LAYER_HRD
     1979      m_seiWriter.writeSEImessage( nalu.m_Bitstream, sei_recovery_point, m_pcEncTop->getVPS(), pcSlice->getSPS() );
     1980#else
    19041981      m_seiWriter.writeSEImessage( nalu.m_Bitstream, sei_recovery_point, pcSlice->getSPS() );
     1982#endif
    19051983      writeRBSPTrailingBits(nalu.m_Bitstream);
    19061984      accessUnit.push_back(new NALUnitEBSP(nalu));
     
    21282206            m_pcEntropyCoder->setEntropyCoder   ( m_pcCavlcCoder, pcSlice );
    21292207            m_pcEntropyCoder->setBitstream(&nalu.m_Bitstream);
     2208#if !POC_RESET_IDC_SIGNALLING
    21302209            m_pcEntropyCoder->encodeTilesWPPEntryPoint( pcSlice );
     2210#else
     2211            tmpBitsBeforeWriting = m_pcEntropyCoder->getNumberOfWrittenBits();
     2212            m_pcEntropyCoder->encodeTilesWPPEntryPoint( pcSlice );
     2213            actualHeadBits += ( m_pcEntropyCoder->getNumberOfWrittenBits() - tmpBitsBeforeWriting );
     2214            m_pcEntropyCoder->encodeSliceHeaderExtn( pcSlice, actualHeadBits );
     2215#endif
    21312216
    21322217            // Substreams...
     
    22692354        /* write the SEI messages */
    22702355        m_pcEntropyCoder->setEntropyCoder(m_pcCavlcCoder, pcSlice);
     2356#if O0164_MULTI_LAYER_HRD
     2357        m_seiWriter.writeSEImessage(nalu.m_Bitstream, sei_recon_picture_digest, m_pcEncTop->getVPS(), pcSlice->getSPS());
     2358#else
    22712359        m_seiWriter.writeSEImessage(nalu.m_Bitstream, sei_recon_picture_digest, pcSlice->getSPS());
     2360#endif
    22722361        writeRBSPTrailingBits(nalu.m_Bitstream);
    22732362
     
    22932382        /* write the SEI messages */
    22942383        m_pcEntropyCoder->setEntropyCoder(m_pcCavlcCoder, pcSlice);
     2384#if O0164_MULTI_LAYER_HRD
     2385        m_seiWriter.writeSEImessage(nalu.m_Bitstream, sei_temporal_level0_index, m_pcEncTop->getVPS(), pcSlice->getSPS());
     2386#else
    22952387        m_seiWriter.writeSEImessage(nalu.m_Bitstream, sei_temporal_level0_index, pcSlice->getSPS());
     2388#endif
    22962389        writeRBSPTrailingBits(nalu.m_Bitstream);
    22972390
     
    24432536          m_pcEntropyCoder->setEntropyCoder(m_pcCavlcCoder, pcSlice);
    24442537          pictureTimingSEI.m_picStruct = (isField && pcSlice->getPic()->isTopField())? 1 : isField? 2 : 0;
     2538#if O0164_MULTI_LAYER_HRD
     2539          m_seiWriter.writeSEImessage(nalu.m_Bitstream, pictureTimingSEI, m_pcEncTop->getVPS(), pcSlice->getSPS());
     2540#else
    24452541          m_seiWriter.writeSEImessage(nalu.m_Bitstream, pictureTimingSEI, pcSlice->getSPS());
     2542#endif
    24462543          writeRBSPTrailingBits(nalu.m_Bitstream);
    24472544          UInt seiPositionInAu = xGetFirstSeiLocation(accessUnit);
     
    24622559            scalableNestingSEI.m_nestedSEIs.clear();
    24632560            scalableNestingSEI.m_nestedSEIs.push_back(&pictureTimingSEI);
     2561#if O0164_MULTI_LAYER_HRD
     2562            m_seiWriter.writeSEImessage(nalu.m_Bitstream, scalableNestingSEI, m_pcEncTop->getVPS(), pcSlice->getSPS());
     2563#else
    24642564            m_seiWriter.writeSEImessage(nalu.m_Bitstream, scalableNestingSEI, pcSlice->getSPS());
     2565#endif
    24652566            writeRBSPTrailingBits(nalu.m_Bitstream);
    24662567            UInt seiPositionInAu = xGetFirstSeiLocation(accessUnit);
     
    24942595            {
    24952596              // Insert before the first slice.
     2597#if O0164_MULTI_LAYER_HRD
     2598              m_seiWriter.writeSEImessage(nalu.m_Bitstream, tempSEI, m_pcEncTop->getVPS(), pcSlice->getSPS());
     2599#else
    24962600              m_seiWriter.writeSEImessage(nalu.m_Bitstream, tempSEI, pcSlice->getSPS());
     2601#endif
    24972602              writeRBSPTrailingBits(nalu.m_Bitstream);
    24982603
     
    25162621                {
    25172622                  // Insert before the first slice.
     2623#if O0164_MULTI_LAYER_HRD
     2624                  m_seiWriter.writeSEImessage(nalu.m_Bitstream, tempSEI, m_pcEncTop->getVPS(), pcSlice->getSPS());
     2625#else
    25182626                  m_seiWriter.writeSEImessage(nalu.m_Bitstream, tempSEI, pcSlice->getSPS());
     2627#endif
    25192628                  writeRBSPTrailingBits(nalu.m_Bitstream);
    25202629
     
    36523761}
    36533762#endif
     3763
     3764#if O0164_MULTI_LAYER_HRD
     3765SEIScalableNesting* TEncGOP::xCreateBspNestingSEI(TComSlice *pcSlice)
     3766{
     3767  SEIScalableNesting *seiScalableNesting = new SEIScalableNesting();
     3768  SEIBspInitialArrivalTime *seiBspInitialArrivalTime = new SEIBspInitialArrivalTime();
     3769  SEIBspNesting *seiBspNesting = new SEIBspNesting();
     3770  SEIBufferingPeriod *seiBufferingPeriod = new SEIBufferingPeriod();
     3771
     3772  // Scalable nesting SEI
     3773
     3774  seiScalableNesting->m_bitStreamSubsetFlag           = 1;      // If the nested SEI messages are picture buffereing SEI mesages, picure timing SEI messages or sub-picture timing SEI messages, bitstream_subset_flag shall be equal to 1
     3775  seiScalableNesting->m_nestingOpFlag                 = 1;
     3776  seiScalableNesting->m_defaultOpFlag                 = 0;
     3777  seiScalableNesting->m_nestingNumOpsMinus1           = 0;      //nesting_num_ops_minus1
     3778  seiScalableNesting->m_nestingOpIdx[0]               = 1;
     3779  seiScalableNesting->m_allLayersFlag                 = 0;
     3780  seiScalableNesting->m_nestingNoOpMaxTemporalIdPlus1 = 6 + 1;  //nesting_no_op_max_temporal_id_plus1
     3781  seiScalableNesting->m_nestingNumLayersMinus1        = 1 - 1;  //nesting_num_layers_minus1
     3782  seiScalableNesting->m_nestingLayerId[0]             = 0;
     3783  seiScalableNesting->m_callerOwnsSEIs                = true;
     3784
     3785  // Bitstream partition nesting SEI
     3786
     3787  seiBspNesting->m_bspIdx = 0;
     3788  seiBspNesting->m_callerOwnsSEIs = true;
     3789
     3790  // Buffering period SEI
     3791
     3792  UInt uiInitialCpbRemovalDelay = (90000/2);                      // 0.5 sec
     3793  seiBufferingPeriod->m_initialCpbRemovalDelay      [0][0]     = uiInitialCpbRemovalDelay;
     3794  seiBufferingPeriod->m_initialCpbRemovalDelayOffset[0][0]     = uiInitialCpbRemovalDelay;
     3795  seiBufferingPeriod->m_initialCpbRemovalDelay      [0][1]     = uiInitialCpbRemovalDelay;
     3796  seiBufferingPeriod->m_initialCpbRemovalDelayOffset[0][1]     = uiInitialCpbRemovalDelay;
     3797
     3798  Double dTmp = (Double)pcSlice->getSPS()->getVuiParameters()->getTimingInfo()->getNumUnitsInTick() / (Double)pcSlice->getSPS()->getVuiParameters()->getTimingInfo()->getTimeScale();
     3799
     3800  UInt uiTmp = (UInt)( dTmp * 90000.0 );
     3801  uiInitialCpbRemovalDelay -= uiTmp;
     3802  uiInitialCpbRemovalDelay -= uiTmp / ( pcSlice->getSPS()->getVuiParameters()->getHrdParameters()->getTickDivisorMinus2() + 2 );
     3803  seiBufferingPeriod->m_initialAltCpbRemovalDelay      [0][0]  = uiInitialCpbRemovalDelay;
     3804  seiBufferingPeriod->m_initialAltCpbRemovalDelayOffset[0][0]  = uiInitialCpbRemovalDelay;
     3805  seiBufferingPeriod->m_initialAltCpbRemovalDelay      [0][1]  = uiInitialCpbRemovalDelay;
     3806  seiBufferingPeriod->m_initialAltCpbRemovalDelayOffset[0][1]  = uiInitialCpbRemovalDelay;
     3807
     3808  seiBufferingPeriod->m_rapCpbParamsPresentFlag              = 0;
     3809  //for the concatenation, it can be set to one during splicing.
     3810  seiBufferingPeriod->m_concatenationFlag = 0;
     3811  //since the temporal layer HRD is not ready, we assumed it is fixed
     3812  seiBufferingPeriod->m_auCpbRemovalDelayDelta = 1;
     3813  seiBufferingPeriod->m_cpbDelayOffset = 0;
     3814  seiBufferingPeriod->m_dpbDelayOffset = 0;
     3815
     3816  // Intial arrival time SEI message
     3817
     3818  seiBspInitialArrivalTime->m_nalInitialArrivalDelay[0] = 0;
     3819  seiBspInitialArrivalTime->m_vclInitialArrivalDelay[0] = 0;
     3820
     3821
     3822  seiBspNesting->m_nestedSEIs.push_back(seiBufferingPeriod);
     3823  seiBspNesting->m_nestedSEIs.push_back(seiBspInitialArrivalTime);
     3824  seiScalableNesting->m_nestedSEIs.push_back(seiBspNesting); // BSP nesting SEI is contained in scalable nesting SEI
     3825
     3826  return seiScalableNesting;
     3827}
     3828#endif
     3829
    36543830#endif //SVC_EXTENSION
    36553831
  • trunk/source/Lib/TLibEncoder/TEncGOP.h

    r595 r644  
    211211  SEIInterLayerConstrainedTileSets* xCreateSEIInterLayerConstrainedTileSets();
    212212#endif
     213#if O0164_MULTI_LAYER_HRD
     214  SEIScalableNesting* xCreateBspNestingSEI(TComSlice *pcSlice);
     215#endif
    213216#endif //SVC_EXTENSION
    214217};// END CLASS DEFINITION TEncGOP
  • trunk/source/Lib/TLibEncoder/TEncSampleAdaptiveOffset.cpp

    r595 r644  
    463463  Int bitDepth = (compIdx== SAO_Y) ? g_bitDepthY : g_bitDepthC;
    464464  Int shift = 2 * DISTORTION_PRECISION_ADJUSTMENT(bitDepth-8);
     465#if SVC_EXTENSION
     466  Int offsetTh = getSaoMaxOffsetQVal()[compIdx];  //inclusive
     467#else
    465468  Int offsetTh = g_saoMaxOffsetQVal[compIdx];  //inclusive
     469#endif
    466470
    467471  ::memset(quantOffsets, 0, sizeof(Int)*MAX_NUM_SAO_CLASSES);
     
    582586  modeParam[SAO_Y ].modeIdc = SAO_MODE_OFF;
    583587  m_pcRDGoOnSbacCoder->load(cabacCoderRDO[inCabacLabel]);
     588#if SVC_EXTENSION
     589  m_pcRDGoOnSbacCoder->codeSAOBlkParam(modeParam, getSaoMaxOffsetQVal(), sliceEnabled, (mergeList[SAO_MERGE_LEFT]!= NULL), (mergeList[SAO_MERGE_ABOVE]!= NULL), true);
     590#else
    584591  m_pcRDGoOnSbacCoder->codeSAOBlkParam(modeParam, sliceEnabled, (mergeList[SAO_MERGE_LEFT]!= NULL), (mergeList[SAO_MERGE_ABOVE]!= NULL), true);
     592#endif
    585593  m_pcRDGoOnSbacCoder->store(cabacCoderRDO[SAO_CABACSTATE_BLK_MID]);
    586594
     
    590598  modeParam[compIdx].modeIdc = SAO_MODE_OFF;
    591599  m_pcRDGoOnSbacCoder->resetBits();
     600#if SVC_EXTENSION
     601  m_pcRDGoOnSbacCoder->codeSAOOffsetParam(compIdx, modeParam[compIdx], sliceEnabled[compIdx], getSaoMaxOffsetQVal());
     602#else
    592603  m_pcRDGoOnSbacCoder->codeSAOOffsetParam(compIdx, modeParam[compIdx], sliceEnabled[compIdx]);
     604#endif
    593605  modeDist[compIdx] = 0;
    594606  minCost= m_lambda[compIdx]*((Double)m_pcRDGoOnSbacCoder->getNumberOfWrittenBits());
     
    613625      m_pcRDGoOnSbacCoder->load(cabacCoderRDO[SAO_CABACSTATE_BLK_MID]);
    614626      m_pcRDGoOnSbacCoder->resetBits();
     627#if SVC_EXTENSION
     628      m_pcRDGoOnSbacCoder->codeSAOOffsetParam(compIdx, testOffset[compIdx], sliceEnabled[compIdx], getSaoMaxOffsetQVal());
     629#else
    615630      m_pcRDGoOnSbacCoder->codeSAOOffsetParam(compIdx, testOffset[compIdx], sliceEnabled[compIdx]);
     631#endif
    616632      rate = m_pcRDGoOnSbacCoder->getNumberOfWrittenBits();
    617633      cost = (Double)dist[compIdx] + m_lambda[compIdx]*((Double)rate);
     
    638654    modeDist [component] = 0;
    639655
     656#if SVC_EXTENSION
     657    m_pcRDGoOnSbacCoder->codeSAOOffsetParam(component, modeParam[component], sliceEnabled[component], getSaoMaxOffsetQVal());
     658#else
    640659    m_pcRDGoOnSbacCoder->codeSAOOffsetParam(component, modeParam[component], sliceEnabled[component]);
     660#endif
    641661
    642662    const UInt currentWrittenBits = m_pcRDGoOnSbacCoder->getNumberOfWrittenBits();
     
    672692      dist[compIdx]= getDistortion(ctu, compIdx, typeIdc, testOffset[compIdx].typeAuxInfo, invQuantOffset, blkStats[ctu][compIdx][typeIdc]);
    673693
     694#if SVC_EXTENSION
     695      m_pcRDGoOnSbacCoder->codeSAOOffsetParam(compIdx, testOffset[compIdx], sliceEnabled[compIdx], getSaoMaxOffsetQVal());
     696#else
    674697      m_pcRDGoOnSbacCoder->codeSAOOffsetParam(compIdx, testOffset[compIdx], sliceEnabled[compIdx]);
     698#endif
    675699
    676700      const UInt currentWrittenBits = m_pcRDGoOnSbacCoder->getNumberOfWrittenBits();
     
    699723  m_pcRDGoOnSbacCoder->load(cabacCoderRDO[inCabacLabel]);
    700724  m_pcRDGoOnSbacCoder->resetBits();
     725#if SVC_EXTENSION
     726  m_pcRDGoOnSbacCoder->codeSAOBlkParam(modeParam, getSaoMaxOffsetQVal(), sliceEnabled, (mergeList[SAO_MERGE_LEFT]!= NULL), (mergeList[SAO_MERGE_ABOVE]!= NULL), false);
     727#else
    701728  m_pcRDGoOnSbacCoder->codeSAOBlkParam(modeParam, sliceEnabled, (mergeList[SAO_MERGE_LEFT]!= NULL), (mergeList[SAO_MERGE_ABOVE]!= NULL), false);
     729#endif
    702730  modeNormCost += (Double)m_pcRDGoOnSbacCoder->getNumberOfWrittenBits();
    703731
     
    742770    m_pcRDGoOnSbacCoder->load(cabacCoderRDO[inCabacLabel]);
    743771    m_pcRDGoOnSbacCoder->resetBits();
     772#if SVC_EXTENSION
     773    m_pcRDGoOnSbacCoder->codeSAOBlkParam(testBlkParam, getSaoMaxOffsetQVal(), sliceEnabled, (mergeList[SAO_MERGE_LEFT]!= NULL), (mergeList[SAO_MERGE_ABOVE]!= NULL), false);
     774#else
    744775    m_pcRDGoOnSbacCoder->codeSAOBlkParam(testBlkParam, sliceEnabled, (mergeList[SAO_MERGE_LEFT]!= NULL), (mergeList[SAO_MERGE_ABOVE]!= NULL), false);
     776#endif
    745777    Int rate = m_pcRDGoOnSbacCoder->getNumberOfWrittenBits();
    746778
  • trunk/source/Lib/TLibEncoder/TEncSbac.cpp

    r595 r644  
    266266}
    267267
     268#if POC_RESET_IDC_SIGNALLING
     269Void  TEncSbac::codeSliceHeaderExtn( TComSlice* pSlice, Int shBitsWrittenTillNow )
     270{
     271  assert (0);
     272  return;
     273}
     274#endif
    268275Void TEncSbac::codeTerminatingBit( UInt uilsLast )
    269276{
     
    15921599}
    15931600
     1601#if SVC_EXTENSION
     1602Void TEncSbac::codeSAOOffsetParam(Int compIdx, SAOOffset& ctbParam, Bool sliceEnabled, UInt* saoMaxOffsetQVal)
     1603#else
    15941604Void TEncSbac::codeSAOOffsetParam(Int compIdx, SAOOffset& ctbParam, Bool sliceEnabled)
     1605#endif
    15951606{
    15961607  UInt uiSymbol;
     
    16391650    for(Int i=0; i< 4; i++)
    16401651    {
     1652#if SVC_EXTENSION
     1653      codeSaoMaxUvlc((offset[i]<0)?(-offset[i]):(offset[i]),  saoMaxOffsetQVal[compIdx] ); //sao_offset_abs
     1654#else
    16411655      codeSaoMaxUvlc((offset[i]<0)?(-offset[i]):(offset[i]),  g_saoMaxOffsetQVal[compIdx] ); //sao_offset_abs
     1656#endif
    16421657    }
    16431658
     
    16691684
    16701685Void TEncSbac::codeSAOBlkParam(SAOBlkParam& saoBlkParam
     1686#if SVC_EXTENSION
     1687                              , UInt* saoMaxOffsetQVal
     1688#endif
    16711689                              , Bool* sliceEnabled
    16721690                              , Bool leftMergeAvail
     
    17001718    for(Int compIdx=0; compIdx < NUM_SAO_COMPONENTS; compIdx++)
    17011719    {
     1720#if SVC_EXTENSION
     1721      codeSAOOffsetParam(compIdx, saoBlkParam[compIdx], sliceEnabled[compIdx], saoMaxOffsetQVal);
     1722#else
    17021723      codeSAOOffsetParam(compIdx, saoBlkParam[compIdx], sliceEnabled[compIdx]);
     1724#endif
    17031725    }
    17041726  }
  • trunk/source/Lib/TLibEncoder/TEncSbac.h

    r595 r644  
    9595  Void  codeSliceHeader         ( TComSlice* pcSlice );
    9696  Void  codeTilesWPPEntryPoint( TComSlice* pSlice );
     97#if POC_RESET_IDC_SIGNALLING
     98  Void  codeSliceHeaderExtn     ( TComSlice* pSlice, Int shBitsWrittenTillNow );
     99#endif
    97100  Void  codeTerminatingBit      ( UInt uilsLast      );
    98101  Void  codeSliceFinish         ();
     
    104107  Void  codeScalingList      ( TComScalingList* /*scalingList*/     ){ assert (0);  return;};
    105108
     109#if SVC_EXTENSION
     110  Void codeSAOOffsetParam(Int compIdx, SAOOffset& ctbParam, Bool sliceEnabled, UInt* saoMaxOffsetQVal);
     111  Void codeSAOBlkParam(SAOBlkParam& saoBlkParam
     112                    , UInt* saoMaxOffsetQVal
     113                    , Bool* sliceEnabled
     114                    , Bool leftMergeAvail
     115                    , Bool aboveMergeAvail
     116                    , Bool onlyEstMergeInfo = false
     117                    );
     118#else
    106119  Void codeSAOOffsetParam(Int compIdx, SAOOffset& ctbParam, Bool sliceEnabled);
    107120  Void codeSAOBlkParam(SAOBlkParam& saoBlkParam
     
    111124                    , Bool onlyEstMergeInfo = false
    112125                    );
     126#endif 
    113127
    114128private:
  • trunk/source/Lib/TLibEncoder/TEncSlice.cpp

    r595 r644  
    13561356        }
    13571357
     1358#if SVC_EXTENSION
     1359        m_pcEntropyCoder->encodeSAOBlkParam(saoblkParam, m_ppcTEncTop[pcSlice->getLayerId()]->getSAO()->getSaoMaxOffsetQVal(), sliceEnabled, leftMergeAvail, aboveMergeAvail);
     1360#else
    13581361        m_pcEntropyCoder->encodeSAOBlkParam(saoblkParam,sliceEnabled, leftMergeAvail, aboveMergeAvail);
     1362#endif
    13591363      }
    13601364    }
  • trunk/source/Lib/TLibEncoder/TEncTop.cpp

    r595 r644  
    791791          TEncTop *pcEncTopBase = (TEncTop *)getLayerEnc( m_layerId-1 );
    792792#endif
     793#if O0194_DIFFERENT_BITDEPTH_EL_BL
     794          UInt refLayerId = m_cVPS.getRefLayerId(m_layerId, i);
     795          Bool sameBitDepths = ( g_bitDepthYLayer[m_layerId] == g_bitDepthYLayer[refLayerId] ) && ( g_bitDepthCLayer[m_layerId] == g_bitDepthCLayer[refLayerId] );
     796
     797          if( m_iSourceWidth != pcEncTopBase->getSourceWidth() || m_iSourceHeight != pcEncTopBase->getSourceHeight() || !zeroOffsets || !sameBitDepths )
     798#else
    793799          if(m_iSourceWidth != pcEncTopBase->getSourceWidth() || m_iSourceHeight != pcEncTopBase->getSourceHeight() || !zeroOffsets )
     800#endif
    794801          {
    795802            pcEPic->setSpatialEnhLayerFlag( i, true );
     
    846853          TEncTop *pcEncTopBase = (TEncTop *)getLayerEnc( m_layerId-1 );
    847854#endif
     855#if O0194_DIFFERENT_BITDEPTH_EL_BL
     856          UInt refLayerId = m_cVPS.getRefLayerId(m_layerId, i);
     857          Bool sameBitDepths = ( g_bitDepthYLayer[m_layerId] == g_bitDepthYLayer[refLayerId] ) && ( g_bitDepthCLayer[m_layerId] == g_bitDepthCLayer[refLayerId] );
     858
     859          if( m_iSourceWidth != pcEncTopBase->getSourceWidth() || m_iSourceHeight != pcEncTopBase->getSourceHeight() || !zeroOffsets || !sameBitDepths )
     860#else
    848861          if(m_iSourceWidth != pcEncTopBase->getSourceWidth() || m_iSourceHeight != pcEncTopBase->getSourceHeight() || !zeroOffsets )
     862#endif
    849863          {
    850864            rpcPic->setSpatialEnhLayerFlag( i, true );
     
    902916#endif
    903917    m_cSPS.getScaledRefLayerWindow(i) = m_scaledRefLayerWindow[i];
     918#if P0312_VERT_PHASE_ADJ
     919    m_cSPS.setVertPhasePositionEnableFlag( m_scaledRefLayerId[i], m_scaledRefLayerWindow[i].getVertPhasePositionEnableFlag() );
     920#endif
    904921  }
    905922#endif //SVC_EXTENSION
  • trunk/source/Lib/TLibEncoder/TEncTop.h

    r595 r644  
    139139#endif
    140140  Window                  m_scaledRefLayerWindow[MAX_LAYERS];
     141#if P0312_VERT_PHASE_ADJ
     142  Bool                    m_vertPhasePositionEnableFlag[MAX_LAYERS];
     143#endif
    141144#if POC_RESET_FLAG
    142145  Int                     m_pocAdjustmentValue;
     
    213216  /// encode several number of pictures until end-of-sequence
    214217#if SVC_EXTENSION
    215   Void                    setLayerEnc(TEncTop** p) {m_ppcTEncTop = p;}
    216   TEncTop**               getLayerEnc()            {return m_ppcTEncTop;}
    217   Int                     getPOCLast            () { return m_iPOCLast;               }
    218   Int                     getNumPicRcvd         () { return m_iNumPicRcvd;            }
    219   Void                    setNumPicRcvd         ( Int num ) { m_iNumPicRcvd = num;      }
    220   Void                    setNumScaledRefLayerOffsets(Int x) { m_numScaledRefLayerOffsets = x; }
    221   UInt                    getNumScaledRefLayerOffsets() { return m_numScaledRefLayerOffsets; }
     218  Void      setLayerEnc(TEncTop** p)            { m_ppcTEncTop = p;                  }
     219  TEncTop** getLayerEnc()                       { return m_ppcTEncTop;               }
     220  Int       getPOCLast            ()            { return m_iPOCLast;                 }
     221  Int       getNumPicRcvd         ()            { return m_iNumPicRcvd;              }
     222  Void      setNumPicRcvd         ( Int num )   { m_iNumPicRcvd = num;               }
     223  Void      setNumScaledRefLayerOffsets(Int x)  { m_numScaledRefLayerOffsets = x;    }
     224  UInt      getNumScaledRefLayerOffsets()      { return m_numScaledRefLayerOffsets; }
    222225#if O0098_SCALED_REF_LAYER_ID
    223   Void                    setScaledRefLayerId(Int x, UInt id) { m_scaledRefLayerId[x] = id;   }
    224   UInt                    getScaledRefLayerId(Int x)          { return m_scaledRefLayerId[x]; }
    225   Window&  getScaledRefLayerWindowForLayer(Int layerId);
    226 #endif
    227   Window&  getScaledRefLayerWindow(Int x)            { return m_scaledRefLayerWindow[x]; }
     226  Void      setScaledRefLayerId(Int x, UInt id) { m_scaledRefLayerId[x] = id;   }
     227  UInt      getScaledRefLayerId(Int x)          { return m_scaledRefLayerId[x]; }
     228  Window&   getScaledRefLayerWindowForLayer(Int layerId);
     229#endif
     230  Window&   getScaledRefLayerWindow(Int x)                 { return m_scaledRefLayerWindow[x];        }
     231#if P0312_VERT_PHASE_ADJ
     232  Void      setVertPhasePositionEnableFlag(Int x, Bool b)  { m_vertPhasePositionEnableFlag[x] = b;    }
     233  UInt      getVertPhasePositionEnableFlag(Int x)          { return m_vertPhasePositionEnableFlag[x]; }
     234#endif
     235
    228236  TComPic** getIlpList() { return m_cIlpPic; }
    229237#if REF_IDX_MFM
    230   Void      setMFMEnabledFlag       (Bool flag)   {m_bMFMEnabledFlag = flag;}
    231   Bool      getMFMEnabledFlag()                   {return m_bMFMEnabledFlag;}   
     238  Void      setMFMEnabledFlag       (Bool flag)   { m_bMFMEnabledFlag = flag; }
     239  Bool      getMFMEnabledFlag()                   { return m_bMFMEnabledFlag; }   
    232240#endif
    233241#if O0194_WEIGHTED_PREDICTION_CGS
     
    247255#endif
    248256#if POC_RESET_FLAG
    249   Int  getPocAdjustmentValue()      { return m_pocAdjustmentValue;}
    250   Void setPocAdjustmentValue(Int x) { m_pocAdjustmentValue = x;   }
     257  Int       getPocAdjustmentValue()      { return m_pocAdjustmentValue;}
     258  Void      setPocAdjustmentValue(Int x) { m_pocAdjustmentValue = x;   }
    251259#endif
    252260#if NO_CLRAS_OUTPUT_FLAG
Note: See TracChangeset for help on using the changeset viewer.