Ignore:
Timestamp:
3 May 2013, 17:09:57 (12 years ago)
Author:
tech
Message:

Further minor cleanups.

Location:
branches/HTM-DEV-0.1-dev/source/App/TAppDecoder
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/HTM-DEV-0.1-dev/source/App/TAppDecoder/TAppDecCfg.cpp

    r364 r367  
    4242#include "TAppCommon/program_options_lite.h"
    4343
    44 #if H_MV
    45 #include <cassert>
    46 #endif
    4744#ifdef WIN32
    4845#define strdup _strdup
     
    7875  ("OutputBitDepth,d", m_outputBitDepthY, 0, "bit depth of YUV output luma component (default: use 0 for native depth)")
    7976  ("OutputBitDepthC,d", m_outputBitDepthC, 0, "bit depth of YUV output chroma component (default: use 0 for native depth)")
    80 #if H_MV
    81   ("MaxLayerId,-ls", m_maxLayerId, MAX_NUM_LAYER_IDS-1, "Maximum LayerId to be decoded.")
    82 #endif
    8377  ("MaxTemporalLayer,t", m_iMaxTemporalLayer, -1, "Maximum Temporal Layer to be decoded. -1 to decode all layers")
    8478  ("SEIDecodedPictureHash", m_decodedPictureHashSEIEnabled, 1, "Control handling of decoded picture hash SEI messages\n"
     
    157151    }
    158152  }
    159 #if H_MV
    160   else
    161   {
    162     for ( Int curLayerId = 0; curLayerId <= m_maxLayerId; curLayerId++ )
    163     {
    164       m_targetDecLayerIdSet.push_back( curLayerId );
    165     }
    166   }
    167 #endif
    168153
    169154  return true;
    170155}
    171156
    172 #if H_MV
    173 Void TAppDecCfg::xAppendToFileNameEnd( Char* pchInputFileName, const Char* pchStringToAppend, Char*& rpchOutputFileName)
    174 {
    175   size_t iInLength     = strlen(pchInputFileName);
    176   size_t iAppendLength = strlen(pchStringToAppend);
    177 
    178   rpchOutputFileName = (Char*) malloc(iInLength+iAppendLength+1);                       
    179   Char* pCDot = strrchr(pchInputFileName,'.');         
    180   pCDot = pCDot ? pCDot : pchInputFileName + iInLength;       
    181   size_t iCharsToDot = pCDot - pchInputFileName ;
    182   size_t iCharsToEnd = iInLength - iCharsToDot;         
    183   strncpy(rpchOutputFileName                            ,  pchInputFileName            , iCharsToDot  );
    184   strncpy(rpchOutputFileName+ iCharsToDot               ,  pchStringToAppend           , iAppendLength);
    185   strncpy(rpchOutputFileName+ iCharsToDot+iAppendLength ,  pchInputFileName+iCharsToDot, iCharsToEnd  );       
    186   rpchOutputFileName[iInLength+iAppendLength] = '\0';         
    187 }
    188 #endif
    189157//! \}
  • branches/HTM-DEV-0.1-dev/source/App/TAppDecoder/TAppDecCfg.h

    r365 r367  
    5858protected:
    5959  Char*         m_pchBitstreamFile;                   ///< input bitstream file name
    60 #if H_MV
    61   Int           m_maxLayerId;                         ///< maximum nuh_layer_id decoded
    62   std::vector<Char*> m_pchReconFiles;                 ///< array of output reconstruction file name create from output reconstruction file name
    63 #endif
    6460  Char*         m_pchReconFile;                       ///< output reconstruction file name
    6561  Int           m_iSkipFrame;                         ///< counter for frames prior to the random access point to skip
     
    7369  Int           m_respectDefDispWindow;               ///< Only output content inside the default display window
    7470
    75 #if H_MV
    76   Void xAppendToFileNameEnd( Char* pchInputFileName, const Char* pchStringToAppend, Char*& rpchOutputFileName); ///< create filenames
    77 #endif
    7871public:
    7972  TAppDecCfg()
    8073  : m_pchBitstreamFile(NULL)
    81 #if H_MV
    82   , m_maxLayerId(0)
    83   , m_pchReconFiles(NULL)
    84 #endif
    8574  , m_pchReconFile(NULL)
    8675  , m_iSkipFrame(0)
  • branches/HTM-DEV-0.1-dev/source/App/TAppDecoder/TAppDecTop.cpp

    r366 r367  
    5454
    5555TAppDecTop::TAppDecTop()
    56 #if !H_MV
    5756: m_iPOCLastDisplay(-MAX_INT)
    58 #else
    59 : m_numDecoders( 0 )
    60 #endif
    6157{
    6258  ::memset (m_abDecFlag, 0, sizeof (m_abDecFlag));
    63 #if H_MV
    64   for (Int i = 0; i < MAX_NUM_LAYER_IDS; i++) m_layerIdToDecIdx[i] = -1;
    65 #endif
    6659}
    6760
     
    7770    m_pchBitstreamFile = NULL;
    7871  }
    79 #if H_MV
    80   for (Int decIdx = 0; decIdx < m_numDecoders; decIdx++)
    81   {
    82     if (m_pchReconFiles[decIdx])
    83     {
    84       free (m_pchReconFiles[decIdx]);
    85       m_pchReconFiles[decIdx] = NULL;
    86     }
    87   }
    88 #endif
    8972  if (m_pchReconFile)
    9073  {
     
    10992{
    11093  Int                 poc;
    111 #if H_MV
    112   poc = -1;
    113 #endif
    11494  TComList<TComPic*>* pcListPic = NULL;
    11595
     
    126106  xCreateDecLib();
    127107  xInitDecLib  ();
    128 #if !H_MV
    129108  m_iPOCLastDisplay += m_iSkipFrame;      // set the last displayed POC correctly for skip forward.
    130109
    131110  // main decoder loop
    132111  Bool recon_opened = false; // reconstruction file not yet opened. (must be performed after SPS is seen)
    133 #else
    134   Int  pocCurrPic        = -MAX_INT;     
    135   Int  pocLastPic        = -MAX_INT;   
    136  
    137   Int  layerIdLastPic    = 0;
    138   Int  layerIdCurrPic    = 0;
    139 
    140   Int  decIdxLastPic     = 0;
    141   Int  decIdxCurrPic     = 0;
    142 
    143   Bool firstSlice        = true;
    144 #endif
    145112 
    146113  while (!!bitstreamFile)
     
    152119    streampos location = bitstreamFile.tellg();
    153120    AnnexBStats stats = AnnexBStats();
    154 #if !H_MV
    155121    Bool bPreviousPictureDecoded = false;
    156 #endif
    157122
    158123    vector<uint8_t> nalUnit;
     
    162127    // call actual decoding function
    163128    Bool bNewPicture = false;
    164 #if H_MV
    165     Bool newSliceDiffPoc   = false;
    166     Bool newSliceDiffLayer = false;
    167     Bool allLayersDecoded  = false;     
    168 #endif
    169129    if (nalUnit.empty())
    170130    {
     
    179139    {
    180140      read(nalu, nalUnit);
    181 #if H_MV     
    182       Int decIdx     = xGetDecoderIdx( nalu.m_layerId , true );
    183      
    184       if( (m_iMaxTemporalLayer >= 0 && nalu.m_temporalId > m_iMaxTemporalLayer) || !isNaluWithinTargetDecLayerIdSet(&nalu) )
    185       {
    186         bNewPicture = false;
    187       }
    188       else
    189       {
    190         newSliceDiffLayer = nalu.isSlice() && ( nalu.m_layerId != layerIdCurrPic ) && !firstSlice;
    191         newSliceDiffPoc   = m_tDecTop[decIdx]->decode(nalu, m_iSkipFrame, m_pocLastDisplay[decIdx], newSliceDiffLayer );
    192         // decode function only returns true when all of the following conditions are true
    193         // - poc in particular layer changes
    194         // - nalu does not belong to first slice in layer
    195         // - nalu.isSlice() == true     
    196 
    197         bNewPicture       = newSliceDiffLayer || newSliceDiffPoc;
    198 
    199         if ( nalu.isSlice() && firstSlice )
    200         {
    201           layerIdCurrPic = nalu.m_layerId;
    202           pocCurrPic     = m_tDecTop[decIdx]->getCurrPoc();
    203           decIdxCurrPic  = decIdx;
    204           firstSlice     = false;
    205         }
    206 
    207         if ( bNewPicture || !bitstreamFile )
    208         {
    209           layerIdLastPic    = layerIdCurrPic; 
    210           layerIdCurrPic    = nalu.m_layerId;
    211          
    212           pocLastPic        = pocCurrPic;
    213           pocCurrPic        = m_tDecTop[decIdx]->getCurrPoc();
    214          
    215           decIdxLastPic     = decIdxCurrPic;
    216           decIdxCurrPic     = decIdx;
    217 
    218           allLayersDecoded = ( pocCurrPic != pocLastPic );
    219         }
    220 
    221        
    222 #else
    223141      if( (m_iMaxTemporalLayer >= 0 && nalu.m_temporalId > m_iMaxTemporalLayer) || !isNaluWithinTargetDecLayerIdSet(&nalu)  )
    224142      {
     
    236154      {
    237155        bNewPicture = m_cTDecTop.decode(nalu, m_iSkipFrame, m_iPOCLastDisplay);
    238 #endif
    239156        if (bNewPicture)
    240157        {
     
    247164          bytestream.reset();
    248165        }
    249 #if !H_MV
    250166        bPreviousPictureDecoded = true;
    251 #endif
    252167      }
    253168    }
    254169    if (bNewPicture || !bitstreamFile)
    255170    {
    256 #if H_MV
    257       assert( decIdxLastPic != -1 );
    258       m_tDecTop[decIdxLastPic]->endPicDecoding(poc, pcListPic, m_targetDecLayerIdSet );
    259 #else
    260171      m_cTDecTop.executeLoopFilters(poc, pcListPic);
    261 #endif
    262     }
    263 #if H_3D
    264     if ( allLayersDecoded || !bitstreamFile )
    265     {
    266       for( Int dI = 0; dI < m_numDecoders; dI++ )
    267       {
    268         TComPic* picLastCoded = m_ivPicLists.getPic( m_tDecTop[dI]->getLayerId(), pocLastPic );
    269         assert( picLastCoded != NULL );       
    270         picLastCoded->compressMotion();         
    271       }
    272     }
    273 #endif
     172    }
    274173
    275174    if( pcListPic )
    276175    {
    277 #if H_MV
    278       if ( m_pchReconFiles[decIdxLastPic] && !m_reconOpen[decIdxLastPic] )
    279 #else
    280176      if ( m_pchReconFile && !recon_opened )
    281 #endif
    282177      {
    283178        if (!m_outputBitDepthY) { m_outputBitDepthY = g_bitDepthY; }
    284179        if (!m_outputBitDepthC) { m_outputBitDepthC = g_bitDepthC; }
    285180
    286 #if H_MV
    287         m_tVideoIOYuvReconFile[decIdxLastPic]->open( m_pchReconFiles[decIdxLastPic], true, m_outputBitDepthY, m_outputBitDepthC, g_bitDepthY, g_bitDepthC ); // write mode
    288         m_reconOpen[decIdxLastPic] = true;
    289       }
    290       if ( bNewPicture && newSliceDiffPoc &&
    291 #else
    292181        m_cTVideoIOYuvReconFile.open( m_pchReconFile, true, m_outputBitDepthY, m_outputBitDepthC, g_bitDepthY, g_bitDepthC ); // write mode
    293182        recon_opened = true;
    294183      }
    295184      if ( bNewPicture &&
    296 #endif
    297185           (   nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_IDR_W_RADL
    298186            || nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_IDR_N_LP
     
    301189            || nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_BLA_W_LP ) )
    302190      {
    303 #if H_MV
    304         xFlushOutput( pcListPic, decIdxLastPic );
    305 #else
    306191        xFlushOutput( pcListPic );
    307 #endif
    308192      }
    309193      // write reconstruction to file
    310194      if(bNewPicture)
    311195      {
    312 #if H_MV
    313         xWriteOutput( pcListPic, decIdxLastPic, nalu.m_temporalId );
    314       }
    315     }
    316   }
    317 
    318   for(UInt decIdx = 0; decIdx < m_numDecoders; decIdx++)
    319   {
    320     xFlushOutput( m_tDecTop[decIdx]->getListPic(), decIdx );
    321   }
    322 #else
    323196        xWriteOutput( pcListPic, nalu.m_temporalId );
    324197      }
     
    329202  // delete buffers
    330203  m_cTDecTop.deletePicBuffer();
    331 #endif
    332204     
    333205  // destroy internal classes
     
    341213Void TAppDecTop::xCreateDecLib()
    342214{
    343 #if H_MV
    344   // initialize global variables
    345   initROM(); 
    346 #else
    347215  // create decoder class
    348216  m_cTDecTop.create();
    349 #endif
    350217}
    351218
    352219Void TAppDecTop::xDestroyDecLib()
    353220{
    354 #if H_MV
    355   // destroy ROM
    356   destroyROM();
    357 
    358   for(Int decIdx = 0; decIdx < m_numDecoders ; decIdx++)
    359   {
    360     if( m_tVideoIOYuvReconFile[decIdx] )
    361     {
    362       m_tVideoIOYuvReconFile[decIdx]->close();
    363       delete m_tVideoIOYuvReconFile[decIdx];
    364       m_tVideoIOYuvReconFile[decIdx] = NULL ;
    365     }
    366 
    367     if( m_tDecTop[decIdx] )
    368     {
    369       m_tDecTop[decIdx]->deletePicBuffer();
    370       m_tDecTop[decIdx]->destroy() ;
    371     }
    372     delete m_tDecTop[decIdx] ;
    373     m_tDecTop[decIdx] = NULL ;
    374   }
    375 #else
    376221  if ( m_pchReconFile )
    377222  {
     
    381226  // destroy decoder class
    382227  m_cTDecTop.destroy();
    383 #endif
    384228}
    385229
    386230Void TAppDecTop::xInitDecLib()
    387231{
    388 #if !H_MV
    389232  // initialize decoder class
    390233  m_cTDecTop.init();
    391234  m_cTDecTop.setDecodedPictureHashSEIEnabled(m_decodedPictureHashSEIEnabled);
    392 #endif
    393235}
    394236
     
    396238    \todo            DYN_REF_FREE should be revised
    397239 */
    398 #if H_MV
    399 Void TAppDecTop::xWriteOutput( TComList<TComPic*>* pcListPic, Int decIdx, Int tId )
    400 #else
    401240Void TAppDecTop::xWriteOutput( TComList<TComPic*>* pcListPic, UInt tId )
    402 #endif
    403241{
    404242  TComList<TComPic*>::iterator iterPic   = pcListPic->begin();
     
    408246  {
    409247    TComPic* pcPic = *(iterPic);
    410 #if H_MV
    411     if(pcPic->getOutputMark() && pcPic->getPOC() > m_pocLastDisplay[decIdx])
    412 #else
    413248    if(pcPic->getOutputMark() && pcPic->getPOC() > m_iPOCLastDisplay)
    414 #endif
    415249    {
    416250       not_displayed++;
     
    424258    TComPic* pcPic = *(iterPic);
    425259   
    426 #if H_MV
    427     if ( pcPic->getOutputMark() && (not_displayed >  pcPic->getNumReorderPics(tId) && pcPic->getPOC() > m_pocLastDisplay[decIdx]))
    428 #else
    429260    if ( pcPic->getOutputMark() && (not_displayed >  pcPic->getNumReorderPics(tId) && pcPic->getPOC() > m_iPOCLastDisplay))
    430 #endif
    431261    {
    432262      // write to file
    433263       not_displayed--;
    434 #if H_MV
    435       if ( m_pchReconFiles[decIdx] )
    436 #else
    437264      if ( m_pchReconFile )
    438 #endif
    439265      {
    440266        const Window &conf = pcPic->getConformanceWindow();
    441267        const Window &defDisp = m_respectDefDispWindow ? pcPic->getDefDisplayWindow() : Window();
    442 #if H_MV
    443         m_tVideoIOYuvReconFile[decIdx]->write( pcPic->getPicYuvRec(),
    444 #else
    445268        m_cTVideoIOYuvReconFile.write( pcPic->getPicYuvRec(),
    446 #endif
    447269                                       conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(),
    448270                                       conf.getWindowRightOffset() + defDisp.getWindowRightOffset(),
     
    452274     
    453275      // update POC of display order
    454 #if H_MV
    455       m_pocLastDisplay[decIdx] = pcPic->getPOC();
    456 #else
    457276      m_iPOCLastDisplay = pcPic->getPOC();
    458 #endif
    459277     
    460278      // erase non-referenced picture in the reference picture list after display
     
    484302    \todo            DYN_REF_FREE should be revised
    485303 */
    486 #if H_MV
    487 Void TAppDecTop::xFlushOutput( TComList<TComPic*>* pcListPic, Int decIdx )
    488 #else
    489304Void TAppDecTop::xFlushOutput( TComList<TComPic*>* pcListPic )
    490 #endif
    491305{
    492306  if(!pcListPic)
     
    505319    {
    506320      // write to file
    507 #if H_MV
    508       if ( m_pchReconFiles[decIdx] )
    509 #else
    510321      if ( m_pchReconFile )
    511 #endif
    512322      {
    513323        const Window &conf = pcPic->getConformanceWindow();
    514324        const Window &defDisp = m_respectDefDispWindow ? pcPic->getDefDisplayWindow() : Window();
    515 #if H_MV
    516         m_tVideoIOYuvReconFile[decIdx]->write( pcPic->getPicYuvRec(),
    517 #else
    518325        m_cTVideoIOYuvReconFile.write( pcPic->getPicYuvRec(),
    519 #endif
    520326                                       conf.getWindowLeftOffset() + defDisp.getWindowLeftOffset(),
    521327                                       conf.getWindowRightOffset() + defDisp.getWindowRightOffset(),
     
    525331     
    526332      // update POC of display order
    527 #if H_MV
    528       m_pocLastDisplay[decIdx] = pcPic->getPOC();
    529 #else
    530333      m_iPOCLastDisplay = pcPic->getPOC();
    531 #endif
    532334     
    533335      // erase non-referenced picture in the reference picture list after display
     
    549351      pcPic->setOutputMark(false);
    550352    }
    551 #if !H_MV
    552353#if !DYN_REF_FREE
    553354    if(pcPic)
     
    558359    }
    559360#endif
    560 #endif
    561361    iterPic++;
    562362  }
    563 #if H_MV
    564   m_pocLastDisplay[decIdx] = -MAX_INT;
    565 #else
    566363  pcListPic->clear();
    567364  m_iPOCLastDisplay = -MAX_INT;
    568 #endif
    569365}
    570366
     
    579375  for (std::vector<Int>::iterator it = m_targetDecLayerIdSet.begin(); it != m_targetDecLayerIdSet.end(); it++)
    580376  {
    581 #if H_MV
    582     if ( nalu->m_layerId == (*it) )
    583 #else
    584377    if ( nalu->m_reservedZero6Bits == (*it) )
    585 #endif
    586378    {
    587379      return true;
  • branches/HTM-DEV-0.1-dev/source/App/TAppDecoder/TAppDecTop.h

    r365 r367  
    6161private:
    6262  // class interface
    63 #if H_MV
    64   TDecTop*                        m_tDecTop             [ MAX_NUM_LAYERS ];    ///< decoder classes
    65   TVideoIOYuv*                    m_tVideoIOYuvReconFile[ MAX_NUM_LAYERS ];    ///< reconstruction YUV class
    66   Int                             m_layerIdToDecIdx     [ MAX_NUM_LAYER_IDS ]; ///< maping from layer id to decoder index
    67   Int                             m_numDecoders;                               ///< number of decoder instances
    68   TComPicLists                    m_ivPicLists;                                ///< picture buffers of decoder instances
    69 #else
    7063  TDecTop                         m_cTDecTop;                     ///< decoder class
    7164  TVideoIOYuv                     m_cTVideoIOYuvReconFile;        ///< reconstruction YUV class
    72 #endif
    7365 
    7466  // for output control
    7567  Bool                            m_abDecFlag[ MAX_GOP ];         ///< decoded flag in one GOP
    76 #if H_MV
    77   Int                             m_pocLastDisplay      [ MAX_NUM_LAYERS ]; ///< last POC in display order
    78   Bool                            m_reconOpen           [ MAX_NUM_LAYERS ]; ///< reconstruction file opened
    79 #else
    8068  Int                             m_iPOCLastDisplay;              ///< last POC in display order
    81 #endif
    8269 
    8370public:
     
    9481  Void  xInitDecLib       (); ///< initialize decoder class
    9582 
    96 #if H_MV
    97   Void  xWriteOutput      ( TComList<TComPic*>* pcListPic, Int layerId, Int tId ); ///< write YUV to file
    98   Void  xFlushOutput      ( TComList<TComPic*>* pcListPic, Int layerId ); ///< flush all remaining decoded pictures to file
    99   Int   xGetDecoderIdx    ( Int layerId, Bool createFlag = false )
    100   {
    101     Int decIdx = -1;
    102     if ( m_layerIdToDecIdx[ layerId ] != -1 )
    103     {     
    104       decIdx = m_layerIdToDecIdx[ layerId ];
    105     }
    106     else
    107     {     
    108       assert ( createFlag );
    109       assert( m_numDecoders < MAX_NUM_LAYERS );
    110 
    111       decIdx = m_numDecoders;
    112      
    113       // Init decoder
    114       m_tDecTop[ decIdx ] =  new TDecTop;
    115       m_tDecTop[ decIdx ]->create();
    116       m_tDecTop[ decIdx ]->init( );
    117       m_tDecTop[ decIdx ]->setLayerId( layerId );
    118       m_tDecTop[ decIdx ]->setDecodedPictureHashSEIEnabled(m_decodedPictureHashSEIEnabled);
    119       m_tDecTop[ decIdx ]->setIvPicLists( &m_ivPicLists );
    120      
    121       // append pic list of new decoder to PicLists
    122       assert( m_ivPicLists.size() == m_numDecoders );
    123       m_ivPicLists.push_back( m_tDecTop[ decIdx ]->getListPic() );
    124 
    125       // create recon file related stuff     
    126       Char* pchTempFilename = NULL;
    127       if ( m_pchReconFile )
    128       {     
    129         Char buffer[4];     
    130         sprintf(buffer,"_%i", layerId );
    131         assert ( m_pchReconFile );
    132         xAppendToFileNameEnd( m_pchReconFile , buffer, pchTempFilename );
    133         assert( m_pchReconFiles.size() == m_numDecoders );
    134       }
    135 
    136       m_pchReconFiles.push_back( pchTempFilename );   
    137 
    138       m_tVideoIOYuvReconFile[ decIdx ] = new TVideoIOYuv;
    139       m_reconOpen           [ decIdx ] = false;
    140 
    141       // set others
    142       m_pocLastDisplay      [ decIdx ] = -MAX_INT;
    143       m_layerIdToDecIdx     [ layerId ] = decIdx;
    144 
    145       m_numDecoders++;
    146     };
    147     return decIdx;
    148   }
    149 #else
    15083  Void  xWriteOutput      ( TComList<TComPic*>* pcListPic , UInt tId); ///< write YUV to file
    15184  Void  xFlushOutput      ( TComList<TComPic*>* pcListPic ); ///< flush all remaining decoded pictures to file
    152 #endif
    15385  Bool  isNaluWithinTargetDecLayerIdSet ( InputNALUnit* nalu ); ///< check whether given Nalu is within targetDecLayerIdSet
    15486};
  • branches/HTM-DEV-0.1-dev/source/App/TAppDecoder/decmain.cpp

    r324 r367  
    5656  // print information
    5757  fprintf( stdout, "\n" );
    58 #if H_MV
    59   fprintf( stdout, "3D-HTM Software: Decoder Version [%s] based on HM Version [%s]", NV_VERSION, HM_VERSION ); 
    60 #else
    6158  fprintf( stdout, "HM software: Decoder Version [%s]", NV_VERSION );
    62 #endif
    6359  fprintf( stdout, NVM_ONOS );
    6460  fprintf( stdout, NVM_COMPILEDBY );
Note: See TracChangeset for help on using the changeset viewer.