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


Ignore:
Timestamp:
15 Oct 2014, 07:25:10 (10 years ago)
Author:
seregin
Message:

merge SHM-dev

Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/source

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

    r815 r906  
    7878  string cfg_ReconFile;
    7979#endif
    80 #if AVC_SYNTAX || SYNTAX_OUTPUT
    81   string cfg_BLSyntaxFile;
    82 #endif
     80
    8381  string cfg_TargetDecLayerIdSetFile;
    8482
     
    9694  ("BLSourceHeight,-hgt",   m_iBLSourceHeight,       0, "BL source picture height")
    9795#endif
    98 #if AVC_SYNTAX
    99   ("BLSyntaxFile,-ibs",    cfg_BLSyntaxFile,  string(""), "BL syntax input file name") 
    100 #endif
    10196#endif
    10297#else
    10398  ("ReconFile,o",     cfg_ReconFile,     string(""), "reconstructed YUV output file name\n"
    10499                                                     "YUV writing is skipped if omitted")
    105 #endif
    106 #if SYNTAX_OUTPUT
    107   ("BLSyntaxFile,-ibs",    cfg_BLSyntaxFile,  string(""), "BL syntax input file name")
    108   ("BLSourceWidth,-wdt",    m_iBLSourceWidth,        0, "BL source picture width")
    109   ("BLSourceHeight,-hgt",   m_iBLSourceHeight,       0, "BL source picture height")
    110   ("BLFrames,-fr",          m_iBLFrames,       0, "BL number of frames")
    111100#endif
    112101  ("SkipFrames,s", m_iSkipFrame, 0, "number of frames to skip before random access")
     
    126115  ("TarDecLayerIdSetFile,l", cfg_TargetDecLayerIdSetFile, string(""), "targetDecLayerIdSet file name. The file should include white space separated LayerId values to be decoded. Omitting the option or a value of -1 in the file decodes all layers.")
    127116  ("RespectDefDispWindow,w", m_respectDefDispWindow, 0, "Only output content inside the default display window\n")
     117#if Q0074_COLOUR_REMAPPING_SEI
     118  ("SEIColourRemappingInfo", m_colourRemapSEIEnabled, false, "Control handling of Colour Remapping Information SEI messages\n"
     119                                              "\t1: apply colour remapping on decoded pictures if available in the bitstream\n"
     120                                              "\t0: ignore SEI message")
     121#endif
    128122  ;
    129123  po::setDefaults(opts);
     
    163157#else
    164158  m_pchReconFile = cfg_ReconFile.empty() ? NULL : strdup(cfg_ReconFile.c_str());
    165 #endif
    166 #if AVC_SYNTAX || SYNTAX_OUTPUT
    167   m_pchBLSyntaxFile = cfg_BLSyntaxFile.empty() ? NULL : strdup(cfg_BLSyntaxFile.c_str());
    168159#endif
    169160
  • trunk/source/App/TAppDecoder/TAppDecCfg.h

    r713 r906  
    6969  Int           m_iMaxTemporalLayer;                  ///< maximum temporal layer to be decoded
    7070  Int           m_decodedPictureHashSEIEnabled;       ///< Checksum(3)/CRC(2)/MD5(1)/disable(0) acting on decoded picture hash SEI message
     71#if Q0074_COLOUR_REMAPPING_SEI
     72  Bool          m_colourRemapSEIEnabled;              ///< Enable the Colour Remapping Information SEI message if available (remapping decoded pictures)
     73#endif
    7174
    7275#if SVC_EXTENSION
     
    7881  Int           m_iBLSourceHeight;
    7982#endif
    80 #if AVC_SYNTAX
    81   Char*         m_pchBLSyntaxFile;                     ///< input BL syntax file name 
    8283#endif
    83 #endif
    84 #endif
    85 
    86 #if SYNTAX_OUTPUT
    87   Char*         m_pchBLSyntaxFile;                     ///< input BL syntax file name
    88 #if !REPN_FORMAT_IN_VPS
    89   Int           m_iBLSourceWidth;
    90   Int           m_iBLSourceHeight;
    91 #endif
    92   Int           m_iBLFrames;
    9384#endif
    9485
     
    110101  , m_iMaxTemporalLayer(-1)
    111102  , m_decodedPictureHashSEIEnabled(0)
     103#if Q0074_COLOUR_REMAPPING_SEI
     104  , m_colourRemapSEIEnabled(0)
     105#endif
    112106#if SVC_EXTENSION
    113107  , m_tgtLayerId(0)
     
    115109  , m_iBLSourceWidth(0)
    116110  , m_iBLSourceHeight(0)
    117 #endif
    118 #if SYNTAX_OUTPUT
    119   , m_iBLSourceWidth(0)
    120   , m_iBLSourceHeight(0)
    121   , m_iBLFrames(0)
    122111#endif
    123112#endif
  • trunk/source/App/TAppDecoder/TAppDecTop.cpp

    r815 r906  
    102102  }
    103103#endif
    104 #if AVC_SYNTAX || SYNTAX_OUTPUT
    105   if( m_pchBLSyntaxFile )
    106   {
    107     free ( m_pchBLSyntaxFile );
    108     m_pchBLSyntaxFile = NULL;
    109   }
    110 #endif
    111104}
    112105
     
    163156  }
    164157  TComList<TComPic*> *cListPic = m_acTDecTop[0].getListPic();
    165 #if AVC_SYNTAX || !REPN_FORMAT_IN_VPS
    166   m_acTDecTop[0].setBLsize( m_iBLSourceWidth, m_iBLSourceHeight );
    167 #endif
    168158  m_acTDecTop[0].setBLReconFile( &streamYUV );
    169159  pcBLPic.setLayerId( 0 );
    170160  cListPic->pushBack( &pcBLPic );
    171 #if AVC_SYNTAX
    172   fstream streamSyntaxFile;
    173   if( m_pchBLSyntaxFile )
    174   {
    175     streamSyntaxFile.open( m_pchBLSyntaxFile, fstream::in | fstream::binary );
    176   }
    177   m_acTDecTop[0].setBLSyntaxFile( &streamSyntaxFile );
    178 #endif
    179161#endif
    180162
     
    363345    streamYUV.close();
    364346  }
    365 #if AVC_SYNTAX
    366   if( streamSyntaxFile.is_open() )
    367   {
    368     streamSyntaxFile.close();
    369   }
    370 #endif
    371347  pcBLPic.destroy();
    372348
     
    405381  Bool openedReconFile = false; // reconstruction file not yet opened. (must be performed after SPS is seen)
    406382  Bool loopFiltered = false;
    407 
    408 #if SYNTAX_OUTPUT
    409   if( !m_pchBLSyntaxFile )
    410   {
    411     printf( "Wrong base layer syntax file\n" );
    412     exit(EXIT_FAILURE);
    413   }
    414   fstream streamSyntaxFile( m_pchBLSyntaxFile, fstream::out | fstream::binary );
    415   if( !streamSyntaxFile.good() )
    416   {
    417     printf( "Base layer syntax input reading error\n" );
    418     exit(EXIT_FAILURE);
    419   }
    420   m_cTDecTop.setBLSyntaxFile( &streamSyntaxFile );
    421 
    422   for( Int i = m_iBLFrames * m_iBLSourceWidth * m_iBLSourceHeight * SYNTAX_BYTES / 16; i >= 0; i-- )
    423   {
    424     streamSyntaxFile.put( 0 );
    425   }
    426   streamSyntaxFile.seekp( 0 );
    427 #endif
    428383
    429384  while (!!bitstreamFile)
     
    543498  }
    544499
    545 #if SYNTAX_OUTPUT
    546   if( streamSyntaxFile.is_open() )
    547   {
    548     streamSyntaxFile.close();
    549   }
    550 #endif
    551 
    552500  xFlushOutput( pcListPic );
    553501  // delete buffers
     
    620568    m_acTDecTop[layer].init();
    621569    m_acTDecTop[layer].setDecodedPictureHashSEIEnabled(m_decodedPictureHashSEIEnabled);
     570#if Q0074_COLOUR_REMAPPING_SEI
     571    m_acTDecTop[layer].setColourRemappingInfoSEIEnabled(m_colourRemapSEIEnabled);
     572#endif
    622573    m_acTDecTop[layer].setNumLayer( m_tgtLayerId + 1 );
    623574#if OUTPUT_LAYER_SET_INDEX
     
    625576#endif
    626577  }
    627 
    628578#else
    629579  m_cTDecTop.init();
    630580  m_cTDecTop.setDecodedPictureHashSEIEnabled(m_decodedPictureHashSEIEnabled);
     581#if Q0074_COLOUR_REMAPPING_SEI
     582  m_cTDecTop.setColourRemappingInfoSEIEnabled(m_colourRemapSEIEnabled);
     583#endif
    631584#endif
    632585}
     
    727680          TComPicYuv* pPicCYuvRecTop = pcPicTop->getPicYuvRec();
    728681          TComPicYuv* pPicCYuvRecBot = pcPicBottom->getPicYuvRec();
    729 #if Q0074_SEI_COLOR_MAPPING
    730           if( m_acTDecTop[layerId].m_ColorMapping->getColorMappingFlag() )
    731           {
    732             pPicCYuvRecTop = m_acTDecTop[layerId].m_ColorMapping->getColorMapping( pPicCYuvRecTop, 0, layerId );
    733             pPicCYuvRecBot = m_acTDecTop[layerId].m_ColorMapping->getColorMapping( pPicCYuvRecBot, 1, layerId );
    734           }
    735 #endif
    736682#if REPN_FORMAT_IN_VPS
    737683          UInt chromaFormatIdc = pcPic->getSlice(0)->getChromaFormatIdc();
     
    762708          TComPicYuv* pPicCYuvRecTop = pcPicTop->getPicYuvRec();
    763709          TComPicYuv* pPicCYuvRecBot = pcPicBottom->getPicYuvRec();
    764 #if Q0074_SEI_COLOR_MAPPING
    765           if ( m_cTDecTop.m_ColorMapping->getColorMappingFlag() )
    766           {
    767             pPicCYuvRecTop = m_cTDecTop.m_ColorMapping->getColorMapping( pPicCYuvRecTop, 0 );
    768             pPicCYuvRecBot = m_cTDecTop.m_ColorMapping->getColorMapping( pPicCYuvRecBot, 1 );
    769           }
    770 #endif
    771710          m_cTVideoIOYuvReconFile.write( pPicCYuvRecTop, pPicCYuvRecBot,
    772711            conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(),
     
    843782          const Window &defDisp = m_respectDefDispWindow ? pcPic->getDefDisplayWindow() : Window();
    844783          TComPicYuv* pPicCYuvRec = pcPic->getPicYuvRec();
    845 #if Q0074_SEI_COLOR_MAPPING
    846           if ( m_acTDecTop[layerId].m_ColorMapping->getColorMappingFlag() )
    847           {
    848             pPicCYuvRec = m_acTDecTop[layerId].m_ColorMapping->getColorMapping( pPicCYuvRec, 0, layerId );
    849           }
    850 #endif
    851 
    852784#if REPN_FORMAT_IN_VPS
    853785          UInt chromaFormatIdc = pcPic->getSlice(0)->getChromaFormatIdc();
     
    873805        if ( m_pchReconFile )
    874806        {
    875 #if SYNTAX_OUTPUT
    876           TComPicYuv* pPicCYuvRec = pcPic->getPicYuvRec();
    877 #if Q0074_SEI_COLOR_MAPPING
    878           if( m_acTDecTop[layerIdx].m_ColorMapping->getColorMappingFlag() )
    879           {
    880             pPicCYuvRec = m_acTDecTop[layerIdx].m_ColorMapping->getColorMapping( pPicCYuvRec, 0, layerIdx );
    881           }
    882 #endif
    883807          const Window &conf = pcPic->getConformanceWindow();
    884808          const Window &defDisp = m_respectDefDispWindow ? pcPic->getDefDisplayWindow() : Window();
    885           m_cTVideoIOYuvReconFile.write( pPicCYuvRec,
    886             conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(),
    887             conf.getWindowRightOffset() + defDisp.getWindowRightOffset(),
    888             conf.getWindowTopOffset() + defDisp.getWindowTopOffset(),
    889             conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset() );
    890 #endif
     809          m_cTVideoIOYuvReconFile.write( pcPic->getPicYuvRec(),
     810                                        conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(),
     811                                        conf.getWindowRightOffset() + defDisp.getWindowRightOffset(),
     812                                        conf.getWindowTopOffset() + defDisp.getWindowTopOffset(),
     813                                        conf.getWindowBottomOffset() + defDisp.getWindowBottomOffset() );
    891814        }
    892815
     
    959882          TComPicYuv* pPicCYuvRecTop = pcPicTop->getPicYuvRec();
    960883          TComPicYuv* pPicCYuvRecBot = pcPicBottom->getPicYuvRec();
    961 #if Q0074_SEI_COLOR_MAPPING
    962           if( m_acTDecTop[layerId].m_ColorMapping->getColorMappingFlag() )
    963           {
    964             pPicCYuvRecTop = m_acTDecTop[layerId].m_ColorMapping->getColorMapping( pPicCYuvRecTop, 0, layerId );
    965             pPicCYuvRecBot = m_acTDecTop[layerId].m_ColorMapping->getColorMapping( pPicCYuvRecBot, 1, layerId );
    966           }
    967 #endif
    968884#if REPN_FORMAT_IN_VPS
    969885          UInt chromaFormatIdc = pcPic->getSlice(0)->getChromaFormatIdc();
     
    994910          TComPicYuv* pPicCYuvRecTop = pcPicTop->getPicYuvRec();
    995911          TComPicYuv* pPicCYuvRecBot = pcPicBottom->getPicYuvRec();
    996 #if Q0074_SEI_COLOR_MAPPING
    997           if( m_cTDecTop.m_ColorMapping->getColorMappingFlag() )
    998           {
    999             pPicCYuvRecTop = m_cTDecTop.m_ColorMapping->getColorMapping( pPicCYuvRecTop, 0 );
    1000             pPicCYuvRecBot = m_cTDecTop.m_ColorMapping->getColorMapping( pPicCYuvRecBot, 1 );
    1001           }
    1002 #endif
    1003912          m_cTVideoIOYuvReconFile.write( pPicCYuvRecTop, pPicCYuvRecBot,
    1004913            conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(),
     
    1078987          const Window &defDisp = m_respectDefDispWindow ? pcPic->getDefDisplayWindow() : Window();
    1079988          TComPicYuv* pPicCYuvRec = pcPic->getPicYuvRec();
    1080 #if Q0074_SEI_COLOR_MAPPING
    1081           if( m_acTDecTop[layerId].m_ColorMapping->getColorMappingFlag() )
    1082           {
    1083             pPicCYuvRec = m_acTDecTop[layerId].m_ColorMapping->getColorMapping( pPicCYuvRec, 0, layerId );
    1084           }
    1085 #endif
    1086989#if REPN_FORMAT_IN_VPS
    1087990          UInt chromaFormatIdc = pcPic->getSlice(0)->getChromaFormatIdc();
     
    11101013          const Window &defDisp = m_respectDefDispWindow ? pcPic->getDefDisplayWindow() : Window();
    11111014          TComPicYuv* pPicCYuvRec = pcPic->getPicYuvRec();
    1112 #if Q0074_SEI_COLOR_MAPPING
    1113           if( m_cTDecTop.m_ColorMapping->getColorMappingFlag() )
    1114           {
    1115             pPicCYuvRec = m_cTDecTop.m_ColorMapping->getColorMapping( pPicCYuvRec );
    1116           }
    1117 #endif
    11181015          m_cTVideoIOYuvReconFile.write( pPicCYuvRec,
    11191016            conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(),
     
    11981095#endif
    11991096    TComPicYuv* pPicCYuvRec = pic->getPicYuvRec();
    1200 #if Q0074_SEI_COLOR_MAPPING
    1201     pPicCYuvRec = m_acTDecTop[layerIdx].m_ColorMapping->getColorMapping( pPicCYuvRec, 0, layerIdx );
    1202 #endif
    12031097    m_acTVideoIOYuvReconFile[layerIdx].write( pPicCYuvRec,
    12041098      conf.getWindowLeftOffset()  * xScal + defDisp.getWindowLeftOffset(),
     
    12211115    pic->getPicYuvRec()->setBorderExtension( false );
    12221116
     1117#if RESOLUTION_BASED_DPB
    12231118    dpbStatus.m_numPicsInLayer[layerIdx]--;
     1119#endif
     1120    dpbStatus.m_numPicsInSubDpb[layerIdx]--;
    12241121  }
    12251122}
     
    12851182  for(Int i = 0; i < MAX_LAYERS; i++)
    12861183  {
    1287     m_acTDecTop[i].getListPic()->clear();
     1184    markAllPicturesAsErased(i);
    12881185  }
    12891186}
     
    12911188Void TAppDecTop::markAllPicturesAsErased(Int layerIdx)
    12921189{
     1190  TComList<TComPic*>::iterator  iterPic = m_acTDecTop[layerIdx].getListPic()->begin();
     1191  Int iSize = Int( m_acTDecTop[layerIdx].getListPic()->size() );
     1192 
     1193  for (Int i = 0; i < iSize; i++ )
     1194  {
     1195    TComPic* pcPic = *(iterPic++);
     1196
     1197    if( pcPic )
     1198    {
     1199      pcPic->destroy();
     1200
     1201      // pcPic is statically created for the external (AVC) base layer, no need to delete it
     1202#if VPS_AVC_BL_FLAG_REMOVAL
     1203      if( !m_acTDecTop[layerIdx].getParameterSetManager()->getActiveVPS()->getNonHEVCBaseLayerFlag() || layerIdx )
     1204#else
     1205      if( !m_acTDecTop[layerIdx].getParameterSetManager()->getActiveVPS()->getAvcBaseLayerFlag() || layerIdx )
     1206#endif
     1207      {
     1208        delete pcPic;
     1209        pcPic = NULL;
     1210      }
     1211    }
     1212  }
     1213
    12931214  m_acTDecTop[layerIdx].getListPic()->clear();
    12941215}
     
    14341355      maxDpbLimit.m_maxLatencyPictures = sps->getMaxLatencyIncrease( highestTId ) + sps->getNumReorderPics( highestTId ) - 1;
    14351356    }
     1357#if RESOLUTION_BASED_DPB
    14361358    maxDpbLimit.m_numPicsInLayer[0] = sps->getMaxDecPicBuffering( highestTId );
     1359#endif
    14371360    maxDpbLimit.m_numPicsInSubDpb[0] = sps->getMaxDecPicBuffering( highestTId );
    14381361  }
     
    15821505          if( pic->getSlice(0)->isReferenced() || pic->getOutputMark() )
    15831506          {
     1507#if RESOLUTION_BASED_DPB
    15841508            dpbStatus.m_numPicsInLayer[i]++;  // Count pictures that are "used for reference" or "needed for output"
     1509#else
     1510            dpbStatus.m_numPicsInSubDpb[i]++;  // Count pictures that are "used for reference" or "needed for output"
     1511#endif
    15851512          }
    15861513#if POC_RESET_IDC_DECODER
     
    16071534#if RESOLUTION_BASED_DPB
    16081535    dpbStatus.m_numPicsInSubDpb[vps->getSubDpbAssigned(targetLsIdx,i)] += dpbStatus.m_numPicsInLayer[i];
    1609 #else
    16101536    dpbStatus.m_numPicsInSubDpb[i] += dpbStatus.m_numPicsInLayer[i];
    16111537#endif
  • trunk/source/App/TAppDecoder/TAppDecTop.h

    r815 r906  
    135135  Int m_numAUsNotDisplayed;
    136136  Int m_numPicsNotDisplayedInLayer[MAX_LAYERS];
     137#if RESOLUTION_BASED_DPB
    137138  Int m_numPicsInLayer[MAX_LAYERS];   // Pictures marked as used_for_reference or needed for output in the layer
     139#endif
    138140  Int m_numPicsInSubDpb[MAX_LAYERS];  // Pictures marked as used_for_reference or needed for output in the sub-DPB
    139141  Bool m_maxLatencyIncrease;
     
    152154    m_maxLatencyIncrease  = false;
    153155    m_maxLatencyPictures  = 0;
     156#if RESOLUTION_BASED_DPB
    154157    ::memset( m_numPicsInLayer,  0, sizeof(m_numPicsInLayer)  );
     158#endif
    155159    ::memset( m_numPicsInSubDpb, 0, sizeof(m_numPicsInSubDpb) );
    156160    ::memset(m_numPicsNotDisplayedInLayer, 0, sizeof(m_numPicsNotDisplayedInLayer) );
Note: See TracChangeset for help on using the changeset viewer.