Changeset 644 in SHVCSoftware for trunk/source/App/TAppDecoder


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

merge with SHM-5.1-dev branch

Location:
trunk
Files:
4 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
Note: See TracChangeset for help on using the changeset viewer.