Changeset 38 in SHVCSoftware


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
Files:
18 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();
  • branches/SHM-1.1-dev/source/Lib/TLibCommon/CommonDef.h

    r14 r38  
    5656// ====================================================================================================================
    5757
    58 #define NV_VERSION        "1.0"                 ///< Current software version
     58#define NV_VERSION        "1.1"                 ///< Current software version
    5959
    6060// ====================================================================================================================
  • branches/SHM-1.1-dev/source/Lib/TLibCommon/TComDataCU.cpp

    r33 r38  
    383383  m_layerId          = pcPic->getLayerId();
    384384#endif
    385 
    386385  for(int i=0; i<pcPic->getNumPartInCU(); i++)
    387386  {
  • branches/SHM-1.1-dev/source/Lib/TLibCommon/TComMotionInfo.h

    r28 r38  
    141141  Void    setAllMvField( TComMvField const & mvField, PartSize eMbMode, Int iPartAddr, UInt uiDepth, Int iPartIdx=0 );
    142142
     143#if AVC_SYNTAX
     144  Void           setMv    (TComMv cMv,  Int iIdx )         { m_pcMv    [iIdx] = cMv; }
     145  Void           setRefIdx(Int iRefIdx, Int iIdx   )       { m_piRefIdx[iIdx] =  iRefIdx; }
     146#endif
     147
    143148  Void setNumPartition( Int iNumPart )
    144149  {
  • branches/SHM-1.1-dev/source/Lib/TLibCommon/TComPic.cpp

    r33 r38  
    669669#endif
    670670
     671#if AVC_SYNTAX
     672Void TComPic::readBLSyntax( fstream* filestream, UInt numBytes )
     673{
     674  if( !filestream->good() )
     675  {
     676    return;
     677  }
     678
     679  UInt   uiWidth      = this->getPicYuvRec()->getWidth() - this->getPicYuvRec()->getPicCropLeftOffset() - this->getPicYuvRec()->getPicCropRightOffset();
     680  UInt   uiHeight     = this->getPicYuvRec()->getHeight() - this->getPicYuvRec()->getPicCropTopOffset() - this->getPicYuvRec()->getPicCropBottomOffset();
     681  UInt64 uiPOC        = (UInt64)this->getPOC();
     682  UInt   uiPartWidth  = uiWidth / 4;
     683  UInt   uiPartHeight = uiHeight / 4;
     684
     685  UInt uiNumPartInWidth    = this->getNumPartInWidth();
     686  UInt uiNumPartInHeight   = this->getNumPartInHeight();
     687  UInt uiNumPartLCUInWidth = this->getFrameWidthInCU();
     688
     689  UInt64 uiPos = (UInt64)uiPOC * uiWidth * uiHeight * numBytes / 16;
     690   
     691  filestream->seekg( uiPos, ios_base::beg );
     692
     693  for( Int i = 0; i < this->getNumCUsInFrame(); i++ )
     694  {
     695    TComDataCU* pcCU = this->getCU( i );
     696    pcCU->initCU( this, i );
     697  }
     698
     699  for( Int i = 0; i < uiPartHeight; i++ )
     700  {
     701    for( Int j = 0; j < uiPartWidth; j++ )
     702    {
     703      UInt uiX = ( j / uiNumPartInWidth );
     704      UInt uiY = ( i / uiNumPartInHeight );
     705
     706      UInt uiLCUAddr = uiY * uiNumPartLCUInWidth + uiX;
     707      UInt uiPartAddr = ( i - uiY * uiNumPartInHeight ) * uiNumPartInWidth + ( j - uiX * uiNumPartInWidth );
     708      uiPartAddr = g_auiRasterToZscan[uiPartAddr];
     709     
     710      TComDataCU* pcCU = this->getCU( uiLCUAddr );
     711     
     712      TComMv mv;
     713      Short temp;
     714
     715      // RefIdxL0
     716      Char refIdxL0 = -1;
     717      filestream->read( &refIdxL0, 1 );
     718      assert( refIdxL0 >= -1 );
     719      pcCU->getCUMvField( REF_PIC_LIST_0 )->setRefIdx( (Int)refIdxL0, uiPartAddr );
     720
     721      // RefIdxL1
     722      Char refIdxL1 = -1;
     723      filestream->read( &refIdxL1, 1 );
     724      assert( refIdxL1 >= -1 );
     725      pcCU->getCUMvField( REF_PIC_LIST_1 )->setRefIdx( (Int)refIdxL1, uiPartAddr );
     726
     727      // MV L0
     728      temp = 0;
     729      filestream->read( reinterpret_cast<char*>(&temp), 2 );
     730      mv.setHor( (Short)temp );
     731      temp = 0;
     732      filestream->read( reinterpret_cast<char*>(&temp), 2 );
     733      mv.setVer( (Short)temp );
     734      pcCU->getCUMvField( REF_PIC_LIST_0 )->setMv( mv, uiPartAddr );
     735
     736      // MV L1
     737      temp = 0;
     738      filestream->read( reinterpret_cast<char*>(&temp), 2 );
     739      mv.setHor( (Short)temp );
     740      temp = 0;
     741      filestream->read( reinterpret_cast<char*>(&temp), 2 );
     742      mv.setVer( (Short)temp );
     743      pcCU->getCUMvField( REF_PIC_LIST_1 )->setMv( mv, uiPartAddr );
     744
     745      // set dependent information
     746      pcCU->setPredictionMode( uiPartAddr, ( refIdxL0 == NOT_VALID && refIdxL1 == NOT_VALID ) ? MODE_INTRA : MODE_INTER );
     747      UInt uiInterDir = ( refIdxL0 != NOT_VALID ) + ( refIdxL1 != NOT_VALID && pcCU->getSlice()->isInterB() ) * 2;
     748      assert( uiInterDir >= 0 && uiInterDir <= 3 );
     749      pcCU->setInterDir( uiPartAddr, uiInterDir );
     750    }
     751  }
     752}
     753#endif
     754
     755#if SYNTAX_OUTPUT
     756Void TComPic::wrireBLSyntax( fstream* filestream, UInt numBytes )
     757{
     758  if( !filestream->good() )
     759  {
     760    return;
     761  }
     762
     763  UInt   uiWidth      = this->getPicYuvRec()->getWidth() - getSlice(0)->getSPS()->getPicCropLeftOffset() - getSlice(0)->getSPS()->getPicCropRightOffset();
     764  UInt   uiHeight     = this->getPicYuvRec()->getHeight() - getSlice(0)->getSPS()->getPicCropTopOffset() - getSlice(0)->getSPS()->getPicCropBottomOffset();
     765  UInt64 uiPOC        = (UInt64)this->getPOC();
     766  UInt   uiPartWidth  = uiWidth / 4;
     767  UInt   uiPartHeight = uiHeight / 4;
     768
     769  UInt uiNumPartInWidth    = this->getNumPartInWidth();
     770  UInt uiNumPartInHeight   = this->getNumPartInHeight();
     771  UInt uiNumPartLCUInWidth = this->getFrameWidthInCU();
     772
     773  filestream->seekg( uiPOC * uiWidth * uiHeight * numBytes / 16 );
     774   
     775  for( Int i = 0; i < uiPartHeight; i++ )
     776  {
     777    for( Int j = 0; j < uiPartWidth; j++ )
     778    {
     779      UInt uiX = ( j / uiNumPartInWidth );
     780      UInt uiY = ( i / uiNumPartInHeight );
     781
     782      UInt uiLCUAddr = uiY * uiNumPartLCUInWidth + uiX;
     783      UInt uiPartAddr = ( i - uiY * uiNumPartInHeight ) * uiNumPartInWidth + ( j - uiX * uiNumPartInWidth );
     784      uiPartAddr = g_auiRasterToZscan[uiPartAddr];
     785     
     786      TComDataCU* pcCU = this->getCU( uiLCUAddr );
     787     
     788      TComMv mv;
     789      Short temp;
     790      Char refIdxL0 = NOT_VALID, refIdxL1 = NOT_VALID;
     791
     792      // RefIdx
     793      if( !pcCU->isIntra( uiPartAddr ) )
     794      {
     795        refIdxL0 = (Char)pcCU->getCUMvField( REF_PIC_LIST_0 )->getRefIdx( uiPartAddr );
     796        refIdxL1 = (Char)pcCU->getCUMvField( REF_PIC_LIST_1 )->getRefIdx( uiPartAddr );
     797      }
     798      assert( refIdxL0 >= - 1 && refIdxL1 >= - 1 );
     799      filestream->put( refIdxL0 );
     800      filestream->put( refIdxL1 );
     801
     802      // MV L0
     803      mv.setZero();
     804      if( refIdxL0 >= 0 )
     805      {
     806        mv = pcCU->getCUMvField( REF_PIC_LIST_0 )->getMv( uiPartAddr );
     807      }
     808      temp = (Short)mv.getHor();
     809      filestream->write( reinterpret_cast<char*>(&temp), 2 );
     810      temp = (Short)mv.getVer();
     811      filestream->write( reinterpret_cast<char*>(&temp), 2 );
     812
     813      // MV L1
     814      mv.setZero();
     815      if( refIdxL1 >= 0 )
     816      {
     817        mv = pcCU->getCUMvField( REF_PIC_LIST_1 )->getMv( uiPartAddr );
     818      }
     819      temp = (Short)mv.getHor();
     820      filestream->write( reinterpret_cast<char*>(&temp), 2 );
     821      temp = (Short)mv.getVer();
     822      filestream->write( reinterpret_cast<char*>(&temp), 2 );
     823    }
     824  }
     825}
     826#endif
     827
     828
    671829//! \}
  • branches/SHM-1.1-dev/source/Lib/TLibCommon/TComPic.h

    r28 r38  
    4444#include "TComPicYuv.h"
    4545#include "TComBitStream.h"
     46#if AVC_BASE || SYNTAX_OUTPUT
     47#include <fstream>
     48#endif
     49
    4650
    4751//! \ingroup TLibCommon
     
    209213  Void  copyUpsampledPictureYuv(TComPicYuv*   pcPicYuvIn, TComPicYuv*   pcPicYuvOut);
    210214#endif
     215#if AVC_SYNTAX
     216  Void readBLSyntax( fstream* filestream, UInt numBytes );
     217#endif
     218#if SYNTAX_OUTPUT
     219  Void wrireBLSyntax( fstream* filestream, UInt numBytes );
     220#endif
     221
    211222};// END CLASS DEFINITION TComPic
    212223
     
    214225
    215226#endif // __TCOMPIC__
     227
  • branches/SHM-1.1-dev/source/Lib/TLibCommon/TComPicSym.h

    r2 r38  
    125125  UInt        getNumberOfCUsInFrame()   { return m_uiNumCUsInFrame;  }
    126126  TComDataCU*&  getCU( UInt uiCUAddr )  { return m_apcTComDataCU[uiCUAddr];     }
     127
     128#if AVC_SYNTAX
     129  UInt        getMaxCUWidth()           { return m_uiMaxCUWidth;                }
     130  UInt        getMaxCUHeight()          { return m_uiMaxCUHeight;               }
     131  UInt        getMaxDepth()             { return m_uhTotalDepth;               }
     132#endif
    127133 
    128134  Void        setSlice(TComSlice* p, UInt i) { m_apcTComSlice[i] = p;           }
  • branches/SHM-1.1-dev/source/Lib/TLibCommon/TypeDef.h

    r28 r38  
    4040
    4141#define SVC_EXTENSION                    1
     42
     43#define SYNTAX_BYTES                     10      ///< number of bytes taken by syntaxes per 4x4 block [RefIdxL0(1byte), RefIdxL1(1byte), MVxL0(2bytes), MVyL0(2bytes), MVxL1(2bytes), MVyL1(2bytes)]
     44
    4245#if SVC_EXTENSION
    4346#define MAX_LAYERS                       2      ///< max number of layers the codec is supposed to handle
     
    4952#define BUGFIX_925                       1      ///< bug fix ticket #925
    5053#define ENCODER_BUGFIX                   1      ///< L0167: encoder bug fix for inter mode
    51 
    5254#define CHROMA_UPSAMPLING                1      ///< L0335: Chroma upsampling with 5 bits coefficients
    5355
    54 #define AVC_BASE                         0      ///< YUV BL reading for AVC base SVC
    55 
     56#define AVC_BASE                         1      ///< YUV BL reading for AVC base SVC
    5657#define REF_IDX_FRAMEWORK                0      ///< inter-layer reference framework
     58
     59#if AVC_BASE
     60#define AVC_SYNTAX                       1      ///< Syntax reading for AVC base
     61#endif
    5762
    5863#if REF_IDX_FRAMEWORK
     
    6065#define REF_IDX_ME_ZEROMV                1      ///< L0051: use zero motion for inter-layer reference picture (without fractional ME)
    6166#define ENCODER_FAST_MODE                1      ///< L0174: enable encoder fast mode. TestMethod 1 is enabled by setting to 1 and TestMethod 2 is enable by setting to 2. By default it is set to 1.
     67#if !AVC_BASE || AVC_SYNTAX
    6268#define REF_IDX_MFM                      1      ///< L0336: motion vector mapping of inter-layer reference picture
     69#endif
    6370#else
    6471#define INTRA_BL                         1      ///< inter-layer texture prediction
     
    6976
    7077// Hooks
    71 #if !AVC_BASE
     78#if !AVC_BASE || AVC_SYNTAX
    7279#define SVC_MVP                          1      ///< motion hook for merge mode as an example
     80#if !AVC_SYNTAX
    7381#define SVC_BL_CAND_INTRA                0      ///< Intra Base Mode Prediction hook as an example
    7482#endif
     
    8088
    8189#endif
     90#endif
     91#else
     92#define SYNTAX_OUTPUT                    1
    8293#endif
    8394
  • branches/SHM-1.1-dev/source/Lib/TLibDecoder/TDecTop.cpp

    r30 r38  
    8181  memset(m_cIlpPic, 0, sizeof(m_cIlpPic));
    8282#endif
     83#if AVC_SYNTAX || SYNTAX_OUTPUT
     84  m_pBLSyntaxFile = NULL;
     85#endif
    8386
    8487}
     
    335338
    336339  m_cGopDecoder.filterPicture(pcPic);
     340
     341#if SYNTAX_OUTPUT
     342  pcPic->wrireBLSyntax( getBLSyntaxFile(), SYNTAX_BYTES );
     343#endif
    337344
    338345  TComSlice::sortPicList( m_cListPic ); // sorting for application output
     
    559566  {
    560567    TComPic* pBLPic = (*m_ppcTDecTop[0]->getListPic()->begin());
    561     FILE* pFile = m_ppcTDecTop[0]->getBLReconFile();
    562     UInt uiWidth = pBLPic->getPicYuvRec()->getWidth();
    563     UInt uiHeight = pBLPic->getPicYuvRec()->getHeight();
     568    fstream* pFile = m_ppcTDecTop[0]->getBLReconFile();
     569    UInt uiWidth    = pBLPic->getPicYuvRec()->getWidth() - pBLPic->getPicYuvRec()->getPicCropLeftOffset() - pBLPic->getPicYuvRec()->getPicCropRightOffset();;
     570    UInt uiHeight   = pBLPic->getPicYuvRec()->getHeight() - pBLPic->getPicYuvRec()->getPicCropTopOffset() - pBLPic->getPicYuvRec()->getPicCropBottomOffset();
    564571       
    565     if( pFile )
    566     {
    567       fseek( pFile, m_apcSlicePilot->getPOC() * uiWidth * uiHeight * 3 / 2, SEEK_SET );
     572    if( pFile->good() )
     573    {
     574      UInt64 uiPos = (UInt64) m_apcSlicePilot->getPOC() * uiWidth * uiHeight * 3 / 2;
     575
     576      pFile->seekg((UInt)uiPos, ios::beg );
    568577
    569578      Pel* pPel = pBLPic->getPicYuvRec()->getLumaAddr();
     
    573582        for( Int j = 0; j < uiWidth; j++ )
    574583        {
    575           pPel[j] = fgetc( pFile );
     584          pPel[j] = pFile->get();
    576585        }
    577586        pPel += uiStride;
     
    584593        for( Int j = 0; j < uiWidth/2; j++ )
    585594        {
    586           pPel[j] = fgetc( pFile );
     595          pPel[j] = pFile->get();
    587596        }
    588597        pPel += uiStride;
     
    595604        for( Int j = 0; j < uiWidth/2; j++ )
    596605        {
    597           pPel[j] = fgetc( pFile );
     606          pPel[j] = pFile->get();
    598607        }
    599608        pPel += uiStride;
    600609      }
    601610    }
     611#if AVC_SYNTAX
     612    if( m_apcSlicePilot->getPOC() == 0 )
     613    {
     614      // initialize partition order.
     615      UInt* piTmp = &g_auiZscanToRaster[0];
     616      initZscanToRaster( pBLPic->getPicSym()->getMaxDepth() + 1, 1, 0, piTmp );
     617      initRasterToZscan( pBLPic->getPicSym()->getMaxCUWidth(), pBLPic->getPicSym()->getMaxCUHeight(), pBLPic->getPicSym()->getMaxDepth() + 1 );
     618    }
     619    pBLPic->getSlice( 0 )->setPOC( m_apcSlicePilot->getPOC() );
     620    pBLPic->getSlice( 0 )->setSliceType( m_apcSlicePilot->getSliceType() );
     621    pBLPic->readBLSyntax( m_ppcTDecTop[0]->getBLSyntaxFile(), SYNTAX_BYTES );
     622#endif
    602623  }
    603624#endif
     
    9791000        {
    9801001#if SVC_UPSAMPLING
     1002#if AVC_SYNTAX
     1003          TComSPS* sps = new TComSPS();
     1004          pBLPic->create( m_ppcTDecTop[0]->getBLWidth(), m_ppcTDecTop[0]->getBLHeight(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, sps, true);
     1005#else
    9811006          pBLPic->create( m_ppcTDecTop[0]->getBLWidth(), m_ppcTDecTop[0]->getBLHeight(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, NULL, true);
     1007#endif
    9821008#else
    9831009          pBLPic->create( m_ppcTDecTop[0]->getBLWidth(), m_ppcTDecTop[0]->getBLHeight(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, true);
  • branches/SHM-1.1-dev/source/Lib/TLibDecoder/TDecTop.h

    r28 r38  
    127127  TDecTop**               m_ppcTDecTop;
    128128#if AVC_BASE
    129   FILE*                   m_pBLReconFile;
     129  fstream*                m_pBLReconFile;
    130130  Int                     m_iBLSourceWidth;
    131131  Int                     m_iBLSourceHeight;
    132132#endif
    133133#endif
     134#if AVC_SYNTAX || SYNTAX_OUTPUT
     135  fstream*               m_pBLSyntaxFile;
     136#endif
    134137#if REF_IDX_FRAMEWORK
    135138  TComPic*                m_cIlpPic[MAX_NUM_REF];                    ///<  Inter layer Prediction picture =  upsampled picture
     
    165168  TDecTop*            getLayerDec(UInt layer)   { return m_ppcTDecTop[layer]; }
    166169#if AVC_BASE
    167   Void      setBLReconFile( FILE* pFile ) { m_pBLReconFile = pFile; }
    168   FILE*     getBLReconFile() { return m_pBLReconFile; }
     170  Void      setBLReconFile( fstream* pFile ) { m_pBLReconFile = pFile; }
     171  fstream*  getBLReconFile() { return m_pBLReconFile; }
    169172  Void      setBLsize( Int iWidth, Int iHeight ) { m_iBLSourceWidth = iWidth; m_iBLSourceHeight = iHeight; }
    170173  Int       getBLWidth() { return  m_iBLSourceWidth; }
    171174  Int       getBLHeight() { return  m_iBLSourceHeight; }
    172175#endif
     176#endif
     177#if AVC_SYNTAX || SYNTAX_OUTPUT
     178  Void      setBLSyntaxFile( fstream* pFile ) { m_pBLSyntaxFile = pFile; }
     179  fstream* getBLSyntaxFile() { return m_pBLSyntaxFile; }
    173180#endif
    174181#if REF_IDX_FRAMEWORK
  • branches/SHM-1.1-dev/source/Lib/TLibEncoder/TEncGOP.cpp

    r28 r38  
    774774    {
    775775      pcPic->getPicYuvOrg()->copyToPic( pcPic->getPicYuvRec() );
     776#if AVC_SYNTAX
     777      pcPic->readBLSyntax( m_ppcTEncTop[0]->getBLSyntaxFile(), SYNTAX_BYTES );
     778#endif
    776779      return;
    777780    }
  • branches/SHM-1.1-dev/source/Lib/TLibEncoder/TEncTop.h

    r28 r38  
    7777  static Int              m_iSPSIdCnt;                    ///< next Id number for SPS   
    7878  static Int              m_iPPSIdCnt;                    ///< next Id number for PPS   
     79#if AVC_SYNTAX
     80  fstream*                m_pBLSyntaxFile;
     81#endif
    7982#endif
    8083 
     
    223226
    224227  Void encodePrep( bool bEos, TComPicYuv* pcPicYuvOrg );
     228#if AVC_SYNTAX
     229  Void      setBLSyntaxFile( fstream* pFile ) { m_pBLSyntaxFile = pFile; }
     230  fstream*  getBLSyntaxFile() { return m_pBLSyntaxFile; }
     231#endif
    225232#else
    226233  Void encode( bool bEos, TComPicYuv* pcPicYuvOrg, TComList<TComPicYuv*>& rcListPicYuvRecOut,
Note: See TracChangeset for help on using the changeset viewer.