Changeset 38 in SHVCSoftware for branches/SHM-1.1-dev/source/App


Ignore:
Timestamp:
20 Feb 2013, 21:24:20 (12 years ago)
Author:
seregin
Message:

AVC_SYNTAX: initial porting of the AVC metadata file reading

Location:
branches/SHM-1.1-dev/source/App
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • branches/SHM-1.1-dev/source/App/TAppDecoder/TAppDecCfg.cpp

    r2 r38  
    7575  string cfg_ReconFile;
    7676#endif
     77#if AVC_SYNTAX || SYNTAX_OUTPUT
     78  string cfg_BLSyntaxFile;
     79#endif
    7780#if TARGET_DECLAYERID_SET
    7881  string cfg_TargetDecLayerIdSetFile;
     
    9093  ("BLSourceWidth,-wdt",    m_iBLSourceWidth,        0, "BL source picture width")
    9194  ("BLSourceHeight,-hgt",   m_iBLSourceHeight,       0, "BL source picture height")
     95#if AVC_SYNTAX
     96  ("BLSyntaxFile,-ibs",    cfg_BLSyntaxFile,  string(""), "BL syntax input file name") 
     97#endif
    9298#endif
    9399#else
    94100  ("ReconFile,o",     cfg_ReconFile,     string(""), "reconstructed YUV output file name\n"
    95101                                                     "YUV writing is skipped if omitted")
     102#endif
     103#if SYNTAX_OUTPUT
     104  ("BLSyntaxFile,-ibs",    cfg_BLSyntaxFile,  string(""), "BL syntax input file name")
     105  ("BLSourceWidth,-wdt",    m_iBLSourceWidth,        0, "BL source picture width")
     106  ("BLSourceHeight,-hgt",   m_iBLSourceHeight,       0, "BL source picture height")
     107  ("BLFrames,-fr",          m_iBLFrames,       0, "BL number of frames")
    96108#endif
    97109  ("SkipFrames,s", m_iSkipFrame, 0, "number of frames to skip before random access")
     
    138150#else
    139151  m_pchReconFile = cfg_ReconFile.empty() ? NULL : strdup(cfg_ReconFile.c_str());
     152#endif
     153#if AVC_SYNTAX || SYNTAX_OUTPUT
     154  m_pchBLSyntaxFile = cfg_BLSyntaxFile.empty() ? NULL : strdup(cfg_BLSyntaxFile.c_str());
    140155#endif
    141156
  • branches/SHM-1.1-dev/source/App/TAppDecoder/TAppDecCfg.h

    r2 r38  
    6666  Int           m_iBLSourceWidth;
    6767  Int           m_iBLSourceHeight;
     68#if AVC_SYNTAX
     69  char*         m_pchBLSyntaxFile;                     ///< input BL syntax file name 
     70#endif
    6871#endif
    6972#else
    7073  char*         m_pchReconFile;                       ///< output reconstruction file name
     74#endif
     75#if SYNTAX_OUTPUT
     76  char*         m_pchBLSyntaxFile;                     ///< input BL syntax file name
     77  Int           m_iBLSourceWidth;
     78  Int           m_iBLSourceHeight;
     79  Int           m_iBLFrames;
    7180#endif
    7281  Int           m_iSkipFrame;                         ///< counter for frames prior to the random access point to skip
  • branches/SHM-1.1-dev/source/App/TAppDecoder/TAppDecTop.cpp

    r6 r38  
    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
    104111}
    105112
     
    147154#if AVC_BASE
    148155  TComPic pcBLPic;
    149   FILE* pFile = fopen( m_pchBLReconFile, "rb" );
    150   if( !pFile )
    151   {
    152     printf( "BL input reading error\n" );
    153     exit(0);
     156  if( !m_pchBLReconFile )
     157  {
     158    printf( "Wrong base layer YUV input file\n" );
     159    exit(EXIT_FAILURE);
     160  }
     161  fstream streamYUV( m_pchBLReconFile, fstream::in | fstream::binary );
     162  if( !streamYUV.good() )
     163  {
     164    printf( "Base layer YUV input reading error\n" );
     165    exit(EXIT_FAILURE);
    154166  }
    155167  TComList<TComPic*> *cListPic = m_acTDecTop[0].getListPic();
    156168  m_acTDecTop[0].setBLsize( m_iBLSourceWidth, m_iBLSourceHeight );
    157   m_acTDecTop[0].setBLReconFile( pFile );
     169  m_acTDecTop[0].setBLReconFile( &streamYUV );
    158170  pcBLPic.setLayerId( 0 );
    159171  cListPic->pushBack( &pcBLPic );
     172#if AVC_SYNTAX
     173  if( !m_pchBLSyntaxFile )
     174  {
     175    printf( "Wrong base layer syntax file\n" );
     176    exit(EXIT_FAILURE);
     177  }
     178  fstream streamSyntaxFile( m_pchBLSyntaxFile, fstream::in | fstream::binary );
     179  if( !streamSyntaxFile.good() )
     180  {
     181    printf( "Base layer syntax input reading error\n" );
     182    exit(EXIT_FAILURE);
     183  }
     184  m_acTDecTop[0].setBLSyntaxFile( &streamSyntaxFile );
     185#endif
    160186#endif
    161187
     
    254280  // delete buffers
    255281#if AVC_BASE
    256   if( pFile )
    257   {
    258     fclose( pFile );
    259   }
     282  if( streamYUV.is_open() )
     283  {
     284    streamYUV.close();
     285  }
     286#if AVC_SYNTAX
     287  if( streamSyntaxFile.is_open() )
     288  {
     289    streamSyntaxFile.close();
     290  }
     291#endif
    260292  pcBLPic.destroy();
    261293
     
    293325  // main decoder loop
    294326  bool recon_opened = false; // reconstruction file not yet opened. (must be performed after SPS is seen)
     327
     328#if SYNTAX_OUTPUT
     329  if( !m_pchBLSyntaxFile )
     330  {
     331    printf( "Wrong base layer syntax file\n" );
     332    exit(EXIT_FAILURE);
     333  }
     334  fstream streamSyntaxFile( m_pchBLSyntaxFile, fstream::out | fstream::binary );
     335  if( !streamSyntaxFile.good() )
     336  {
     337    printf( "Base layer syntax input reading error\n" );
     338    exit(EXIT_FAILURE);
     339  }
     340  m_cTDecTop.setBLSyntaxFile( &streamSyntaxFile );
     341
     342  for( Int i = m_iBLFrames * m_iBLSourceWidth * m_iBLSourceHeight * SYNTAX_BYTES / 16; i >= 0; i-- )
     343  {
     344    streamSyntaxFile.put( 0 );
     345  }
     346  streamSyntaxFile.seekp( 0 );
     347#endif
    295348
    296349  while (!!bitstreamFile)
     
    389442    }
    390443  }
     444
     445#if SYNTAX_OUTPUT
     446  if( streamSyntaxFile.is_open() )
     447  {
     448    streamSyntaxFile.close();
     449  }
     450#endif
    391451 
    392452  xFlushOutput( pcListPic );
  • branches/SHM-1.1-dev/source/App/TAppEncoder/TAppEncCfg.cpp

    r21 r38  
    229229    cfg_CroppingMode[layer] = &m_acLayerCfg[layer].m_croppingMode;
    230230  }
     231#if AVC_SYNTAX
     232  string  cfg_BLSyntaxFile;
     233#endif
    231234#else
    232235  string cfg_InputFile;
     
    259262  ("InternalBitDepth",        m_uiInternalBitDepth, 0u, "Internal bit-depth (BitDepth+BitIncrement)")
    260263#if AVC_BASE
    261   ("InputBLFile,-ibl",        *cfg_InputFile[0],     string(""), "Original BL rec YUV input file name")
     264  ("InputBLFile,-ibl",        *cfg_InputFile[0],     string(""), "Base layer rec YUV input file name")
     265#if AVC_SYNTAX
     266  ("InputBLSyntaxFile,-ibs",  cfg_BLSyntaxFile,     string(""), "Base layer syntax input file name")
     267#endif
    262268#endif
    263269#if REF_IDX_FRAMEWORK
     
    516522#if SVC_EXTENSION
    517523  m_pchBitstreamFile = cfg_BitstreamFile.empty() ? NULL : strdup(cfg_BitstreamFile.c_str());
     524#if AVC_SYNTAX
     525  m_BLSyntaxFile = cfg_BLSyntaxFile.empty() ? NULL : strdup(cfg_BLSyntaxFile.c_str());
     526#endif
    518527#else
    519528  m_pchInputFile = cfg_InputFile.empty() ? NULL : strdup(cfg_InputFile.c_str());
     
    13081317  printf("RecalQP:%d ", m_recalculateQPAccordingToLambda ? 1 : 0 );
    13091318#endif
     1319  printf("AVC_BASE:%d ", AVC_BASE);
    13101320#if REF_IDX_FRAMEWORK
    13111321  printf("REF_IDX_FRAMEWORK:%d ", REF_IDX_FRAMEWORK);
     
    13131323  printf("REF_IDX_ME_AROUND_ZEROMV:%d ", REF_IDX_ME_AROUND_ZEROMV);
    13141324  printf("REF_IDX_ME_ZEROMV: %d", REF_IDX_ME_ZEROMV);
    1315 #else
     1325#elif INTRA_BL
    13161326  printf("INTRA_BL:%d ", INTRA_BL);
    1317   printf("AVC_BASE:%d ", AVC_BASE);
    13181327#if !AVC_BASE
    13191328  printf("SVC_MVP:%d ", SVC_MVP );
  • branches/SHM-1.1-dev/source/App/TAppEncoder/TAppEncCfg.h

    r2 r38  
    6767  unsigned int m_FrameSkip;                                   ///< number of skipped frames from the beginning
    6868  Int       m_iFrameToBeEncoded;                              ///< number of encoded frames
     69#if AVC_SYNTAX
     70  char*     m_BLSyntaxFile;                                   ///< input syntax file
     71#endif
    6972#else
    7073  char*     m_pchInputFile;                                   ///< source file name
     
    305308  Void getDirFilename(string& filename, string& dir, const string path);
    306309  Int  getWaveFrontSynchro()        { return m_iWaveFrontSynchro; }
     310#if AVC_SYNTAX
     311  Char* getBLSyntaxFile()           { return m_BLSyntaxFile;      }
     312#endif
    307313#endif
    308314};// END CLASS DEFINITION TAppEncCfg
  • branches/SHM-1.1-dev/source/App/TAppEncoder/TAppEncLayerCfg.cpp

    r2 r38  
    120120  printf("Input File                    : %s\n", m_cInputFile.c_str()  );
    121121  printf("Reconstruction File           : %s\n", m_cReconFile.c_str()  );
     122#if AVC_SYNTAX
     123  printf("Base layer input file         : %s\n", m_cAppEncCfg->getBLSyntaxFile() );
     124#endif
    122125  printf("Real     Format               : %dx%d %dHz\n", m_iSourceWidth - m_cropLeft - m_cropRight, m_iSourceHeight - m_cropTop - m_cropBottom, m_iFrameRate );
    123126  printf("Internal Format               : %dx%d %dHz\n", m_iSourceWidth, m_iSourceHeight, m_iFrameRate );
  • branches/SHM-1.1-dev/source/App/TAppEncoder/TAppEncTop.cpp

    r33 r38  
    706706  }
    707707
     708#if AVC_SYNTAX
     709  if( !m_BLSyntaxFile )
     710  {
     711    printf( "Wrong base layer syntax input file\n" );
     712    exit(EXIT_FAILURE);
     713  }
     714  fstream streamSyntaxFile( m_BLSyntaxFile, fstream::in | fstream::binary );
     715  if( !streamSyntaxFile.good() )
     716  {
     717    printf( "Base layer syntax input reading error\n" );
     718    exit(EXIT_FAILURE);
     719  }
     720  m_acTEncTop[0].setBLSyntaxFile( &streamSyntaxFile );
     721#endif
     722
    708723  Bool bFirstFrame = true;
    709724  while ( !bEos )
     
    791806  }
    792807 
     808#if AVC_SYNTAX
     809  if( streamSyntaxFile.is_open() )
     810  {
     811    streamSyntaxFile.close();
     812  }
     813#endif
     814
    793815  // delete buffers & classes
    794816  xDeleteBuffer();
Note: See TracChangeset for help on using the changeset viewer.