Ignore:
Timestamp:
26 May 2013, 16:22:23 (12 years ago)
Author:
tech
Message:

Added missing parts.

Location:
branches/HTM-DEV-0.2-dev/source/App/TAppDecoder
Files:
4 edited

Legend:

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

    r438 r446  
    4545#include <cassert>
    4646#endif
    47 
    4847#ifdef WIN32
    4948#define strdup _strdup
     
    6968  string cfg_ReconFile;
    7069  string cfg_TargetDecLayerIdSetFile;
     70#if H_3D
     71  string cfg_ScaleOffsetFile;
     72#endif
    7173
    7274  po::Options opts;
     
    7678  ("ReconFile,o",     cfg_ReconFile,     string(""), "reconstructed YUV output file name\n"
    7779                                                     "YUV writing is skipped if omitted")
     80#if H_3D
     81  ("ScaleOffsetFile,p", cfg_ScaleOffsetFile, string(""), "file with coded scales and offsets")
     82#endif
    7883  ("SkipFrames,s", m_iSkipFrame, 0, "number of frames to skip before random access")
    7984  ("OutputBitDepth,d", m_outputBitDepthY, 0, "bit depth of YUV output luma component (default: use 0 for native depth)")
    8085  ("OutputBitDepthC,d", m_outputBitDepthC, 0, "bit depth of YUV output chroma component (default: use 0 for native depth)")
    81 
    8286#if H_MV
    8387  ("MaxLayerId,-ls", m_maxLayerId, MAX_NUM_LAYER_IDS-1, "Maximum LayerId to be decoded.")
    8488#endif
    85 
    8689  ("MaxTemporalLayer,t", m_iMaxTemporalLayer, -1, "Maximum Temporal Layer to be decoded. -1 to decode all layers")
    8790  ("SEIDecodedPictureHash", m_decodedPictureHashSEIEnabled, 1, "Control handling of decoded picture hash SEI messages\n"
     
    108111  /* convert std::string to c string for compatability */
    109112  m_pchBitstreamFile = cfg_BitstreamFile.empty() ? NULL : strdup(cfg_BitstreamFile.c_str());
    110 
    111113  m_pchReconFile = cfg_ReconFile.empty() ? NULL : strdup(cfg_ReconFile.c_str());
    112114
     115#if H_3D
     116  m_pchScaleOffsetFile = cfg_ScaleOffsetFile.empty() ? NULL : strdup(cfg_ScaleOffsetFile.c_str());
     117#endif
    113118  if (!m_pchBitstreamFile)
    114119  {
     
    191196}
    192197#endif
    193 
    194198//! \}
  • branches/HTM-DEV-0.2-dev/source/App/TAppDecoder/TAppDecCfg.h

    r368 r446  
    6363#endif
    6464  Char*         m_pchReconFile;                       ///< output reconstruction file name
     65#if H_3D
     66  Char*         m_pchScaleOffsetFile;                 ///< output coded scale and offset parameters
     67#endif
    6568  Int           m_iSkipFrame;                         ///< counter for frames prior to the random access point to skip
    6669  Int           m_outputBitDepthY;                    ///< bit depth used for writing output (luma)
  • branches/HTM-DEV-0.2-dev/source/App/TAppDecoder/TAppDecTop.cpp

    r438 r446  
    5454
    5555TAppDecTop::TAppDecTop()
    56 
    5756#if !H_MV
    5857: m_iPOCLastDisplay(-MAX_INT)
     
    6059: m_numDecoders( 0 )
    6160#endif
    62 
    6361{
    6462  ::memset (m_abDecFlag, 0, sizeof (m_abDecFlag));
    6563#if H_MV
    6664  for (Int i = 0; i < MAX_NUM_LAYER_IDS; i++) m_layerIdToDecIdx[i] = -1;
     65#endif
     66#if H_3D
     67    m_pScaleOffsetFile  = 0;
    6768#endif
    6869}
     
    7980    m_pchBitstreamFile = NULL;
    8081  }
    81 
    8282#if H_MV
    8383  for (Int decIdx = 0; decIdx < m_numDecoders; decIdx++)
     
    115115  poc = -1;
    116116#endif
    117 
    118117  TComList<TComPic*>* pcListPic = NULL;
    119118
     
    125124  }
    126125
     126#if H_3D
     127  if( m_pchScaleOffsetFile )
     128  {
     129    m_pScaleOffsetFile = ::fopen( m_pchScaleOffsetFile, "wt" );
     130    AOF( m_pScaleOffsetFile );
     131  }
     132  m_cCamParsCollector.init( m_pScaleOffsetFile );
     133#endif
    127134  InputByteStream bytestream(bitstreamFile);
    128135
     
    147154  Bool firstSlice        = true;
    148155#endif
    149 
    150156 
    151157  while (!!bitstreamFile)
     
    156162     * nal unit. */
    157163    streampos location = bitstreamFile.tellg();
     164#if H_MV
     165#if ENC_DEC_TRACE
     166    Int64 symCount = g_nSymbolCounter;
     167#endif
     168#endif
    158169    AnnexBStats stats = AnnexBStats();
    159170#if !H_MV
    160171    Bool bPreviousPictureDecoded = false;
    161172#endif
     173
    162174    vector<uint8_t> nalUnit;
    163175    InputNALUnit nalu;
     
    250262          bitstreamFile.seekg(location-streamoff(3));
    251263          bytestream.reset();
     264#if H_MV
     265#if ENC_DEC_TRACE
     266          g_nSymbolCounter = symCount;
     267#endif
     268#endif
    252269        }
    253270#if !H_MV
     
    276293    }
    277294#endif
     295
    278296    if( pcListPic )
    279297    {
     
    286304        if (!m_outputBitDepthY) { m_outputBitDepthY = g_bitDepthY; }
    287305        if (!m_outputBitDepthC) { m_outputBitDepthC = g_bitDepthC; }
     306
    288307#if H_MV
    289308        m_tVideoIOYuvReconFile[decIdxLastPic]->open( m_pchReconFiles[decIdxLastPic], true, m_outputBitDepthY, m_outputBitDepthC, g_bitDepthY, g_bitDepthC ); // write mode
     
    297316      if ( bNewPicture &&
    298317#endif
    299            (   nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_IDR
     318           (   nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_IDR_W_RADL
    300319            || nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_IDR_N_LP
    301320            || nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_BLA_N_LP
    302             || nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_BLANT
    303             || nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_BLA ) )
     321            || nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_BLA_W_RADL
     322            || nalu.m_nalUnitType == NAL_UNIT_CODED_SLICE_BLA_W_LP ) )
    304323      {
    305324#if H_MV
     
    318337  }
    319338
     339#if H_3D
     340  if( m_cCamParsCollector.isInitialized() )
     341  {
     342    m_cCamParsCollector.setSlice( 0 );
     343  }
     344#endif
    320345  for(UInt decIdx = 0; decIdx < m_numDecoders; decIdx++)
    321346  {
     
    383408  // destroy decoder class
    384409  m_cTDecTop.destroy();
     410#endif
     411#if H_3D
     412  m_cCamParsCollector.uninit();
     413  if( m_pScaleOffsetFile )
     414  {
     415    ::fclose( m_pScaleOffsetFile );
     416  }
    385417#endif
    386418}
     
    593625}
    594626
     627#if H_MV
     628Int TAppDecTop::xGetDecoderIdx( Int layerId, Bool createFlag /*= false */ )
     629{
     630  Int decIdx = -1;
     631  if ( m_layerIdToDecIdx[ layerId ] != -1 )
     632  {     
     633    decIdx = m_layerIdToDecIdx[ layerId ];
     634  }
     635  else
     636  {     
     637    assert ( createFlag );
     638    assert( m_numDecoders < MAX_NUM_LAYERS );
     639
     640    decIdx = m_numDecoders;
     641
     642    // Init decoder
     643    m_tDecTop[ decIdx ] =  new TDecTop;
     644    m_tDecTop[ decIdx ]->create();
     645    m_tDecTop[ decIdx ]->init( );
     646    m_tDecTop[ decIdx ]->setLayerId( layerId );
     647    m_tDecTop[ decIdx ]->setDecodedPictureHashSEIEnabled(m_decodedPictureHashSEIEnabled);
     648    m_tDecTop[ decIdx ]->setIvPicLists( &m_ivPicLists );
     649#if H_3D
     650   m_tDecTop[ decIdx ]->setCamParsCollector( &m_cCamParsCollector );
     651#endif
     652
     653    // append pic list of new decoder to PicLists
     654    assert( m_ivPicLists.size() == m_numDecoders );
     655    m_ivPicLists.push_back( m_tDecTop[ decIdx ]->getListPic() );
     656
     657    // create recon file related stuff     
     658    Char* pchTempFilename = NULL;
     659    if ( m_pchReconFile )
     660    {     
     661      Char buffer[4];     
     662      sprintf(buffer,"_%i", layerId );
     663      assert ( m_pchReconFile );
     664      xAppendToFileNameEnd( m_pchReconFile , buffer, pchTempFilename );
     665      assert( m_pchReconFiles.size() == m_numDecoders );
     666    }
     667
     668    m_pchReconFiles.push_back( pchTempFilename );   
     669
     670    m_tVideoIOYuvReconFile[ decIdx ] = new TVideoIOYuv;
     671    m_reconOpen           [ decIdx ] = false;
     672
     673    // set others
     674    m_pocLastDisplay      [ decIdx ] = -MAX_INT;
     675    m_layerIdToDecIdx     [ layerId ] = decIdx;
     676
     677    m_numDecoders++;
     678  };
     679  return decIdx;
     680}
     681#endif
    595682//! \}
  • branches/HTM-DEV-0.2-dev/source/App/TAppDecoder/TAppDecTop.h

    r438 r446  
    7171  TVideoIOYuv                     m_cTVideoIOYuvReconFile;        ///< reconstruction YUV class
    7272#endif
    73  
    74   // for output control
     73    // for output control
    7574  Bool                            m_abDecFlag[ MAX_GOP ];         ///< decoded flag in one GOP
    76 
    7775#if H_MV
    7876  Int                             m_pocLastDisplay      [ MAX_NUM_LAYERS ]; ///< last POC in display order
     
    8179  Int                             m_iPOCLastDisplay;              ///< last POC in display order
    8280#endif
    83  
     81#if H_3D
     82  FILE*                           m_pScaleOffsetFile;
     83  CamParsCollector                m_cCamParsCollector;
     84#endif
    8485public:
    8586  TAppDecTop();
     
    9091  Void  decode            (); ///< main decoding function
    9192 
    92 
    9393protected:
    9494  Void  xCreateDecLib     (); ///< create internal classes
     
    9999  Void  xWriteOutput      ( TComList<TComPic*>* pcListPic, Int layerId, Int tId ); ///< write YUV to file
    100100  Void  xFlushOutput      ( TComList<TComPic*>* pcListPic, Int layerId ); ///< flush all remaining decoded pictures to file
    101   Int   xGetDecoderIdx    ( Int layerId, Bool createFlag = false )
    102   {
    103     Int decIdx = -1;
    104     if ( m_layerIdToDecIdx[ layerId ] != -1 )
    105     {     
    106       decIdx = m_layerIdToDecIdx[ layerId ];
    107     }
    108     else
    109     {     
    110       assert ( createFlag );
    111       assert( m_numDecoders < MAX_NUM_LAYERS );
    112 
    113       decIdx = m_numDecoders;
    114      
    115       // Init decoder
    116       m_tDecTop[ decIdx ] =  new TDecTop;
    117       m_tDecTop[ decIdx ]->create();
    118       m_tDecTop[ decIdx ]->init( );
    119       m_tDecTop[ decIdx ]->setLayerId( layerId );
    120       m_tDecTop[ decIdx ]->setDecodedPictureHashSEIEnabled(m_decodedPictureHashSEIEnabled);
    121       m_tDecTop[ decIdx ]->setIvPicLists( &m_ivPicLists );
    122      
    123       // append pic list of new decoder to PicLists
    124       assert( m_ivPicLists.size() == m_numDecoders );
    125       m_ivPicLists.push_back( m_tDecTop[ decIdx ]->getListPic() );
    126 
    127       // create recon file related stuff     
    128       Char* pchTempFilename = NULL;
    129       if ( m_pchReconFile )
    130       {     
    131         Char buffer[4];     
    132         sprintf(buffer,"_%i", layerId );
    133         assert ( m_pchReconFile );
    134         xAppendToFileNameEnd( m_pchReconFile , buffer, pchTempFilename );
    135         assert( m_pchReconFiles.size() == m_numDecoders );
    136       }
    137 
    138       m_pchReconFiles.push_back( pchTempFilename );   
    139 
    140       m_tVideoIOYuvReconFile[ decIdx ] = new TVideoIOYuv;
    141       m_reconOpen           [ decIdx ] = false;
    142 
    143       // set others
    144       m_pocLastDisplay      [ decIdx ] = -MAX_INT;
    145       m_layerIdToDecIdx     [ layerId ] = decIdx;
    146 
    147       m_numDecoders++;
    148     };
    149     return decIdx;
    150   }
     101  Int   xGetDecoderIdx    ( Int layerId, Bool createFlag = false );
    151102#else
    152103  Void  xWriteOutput      ( TComList<TComPic*>* pcListPic , UInt tId); ///< write YUV to file
    153104  Void  xFlushOutput      ( TComList<TComPic*>* pcListPic ); ///< flush all remaining decoded pictures to file
    154105#endif
    155 
    156106  Bool  isNaluWithinTargetDecLayerIdSet ( InputNALUnit* nalu ); ///< check whether given Nalu is within targetDecLayerIdSet
    157107};
Note: See TracChangeset for help on using the changeset viewer.