Changeset 55 in SHVCSoftware for trunk


Ignore:
Timestamp:
4 Mar 2013, 22:43:28 (12 years ago)
Author:
seregin
Message:

Reintegrate SHM-1.1-dev branch into the trunk

Location:
trunk/source
Files:
26 edited

Legend:

Unmodified
Added
Removed
  • trunk/source

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

    r2 r55  
    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
  • trunk/source/App/TAppDecoder/TAppDecCfg.h

    r2 r55  
    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
  • trunk/source/App/TAppDecoder/TAppDecTop.cpp

    r6 r55  
    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 );
  • trunk/source/App/TAppEncoder/TAppEncCfg.cpp

    r21 r55  
    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 );
  • trunk/source/App/TAppEncoder/TAppEncCfg.h

    r2 r55  
    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
  • trunk/source/App/TAppEncoder/TAppEncLayerCfg.cpp

    r2 r55  
    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 );
  • trunk/source/App/TAppEncoder/TAppEncTop.cpp

    r33 r55  
    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();
  • trunk/source/Lib/TLibCommon/CommonDef.h

    r14 r55  
    5656// ====================================================================================================================
    5757
    58 #define NV_VERSION        "1.0"                 ///< Current software version
     58#define NV_VERSION        "1.1"                 ///< Current software version
    5959
    6060// ====================================================================================================================
  • trunk/source/Lib/TLibCommon/TComDataCU.cpp

    r33 r55  
    383383  m_layerId          = pcPic->getLayerId();
    384384#endif
    385 
    386385  for(int i=0; i<pcPic->getNumPartInCU(); i++)
    387386  {
     
    29062905  if(m_layerId) 
    29072906  {
     2907#if MV_SCALING_POS_FIX
     2908    pcColCU = getBaseColCU( xP + nPSW/2, yP + nPSH/2, uiCUAddrBase, uiAbsPartAddrBase );
     2909#else
    29082910    UInt uiPartIdxCenter;
    29092911    xDeriveCenterIdx( cCurPS, uiPUIdx, uiPartIdxCenter );
    29102912    uiPartIdxCenter -= m_uiAbsIdxInLCU;
    29112913    pcColCU = getBaseColCU( uiPartIdxCenter, uiCUAddrBase, uiAbsPartAddrBase );
     2914#endif
    29122915   
    29132916#if INTRA_BL
     
    48434846}
    48444847
    4845 #if INTRA_BL
     4848#if INTRA_BL && !NO_RESIDUAL_FLAG_FOR_BLPRED
    48464849Void TComDataCU::getBaseLumaBlk ( UInt uiWidth, UInt uiHeight, UInt uiAbsPartIdx, Pel* piPred, UInt uiStride )
    48474850{
     
    48834886TComDataCU*  TComDataCU::getBaseColCU( UInt uiCuAbsPartIdx, UInt &uiCUAddrBase, UInt &uiAbsPartIdxBase )
    48844887{
     4888#if 1 // it should provide identical resutls
     4889  UInt uiPelX = getCUPelX() + g_auiRasterToPelX[ g_auiZscanToRaster[uiCuAbsPartIdx] ];
     4890  UInt uiPelY = getCUPelY() + g_auiRasterToPelY[ g_auiZscanToRaster[uiCuAbsPartIdx] ];
     4891
     4892  return getBaseColCU( uiPelX, uiPelY, uiCUAddrBase, uiAbsPartIdxBase );
     4893#else
    48854894  TComPic* cBaseColPic = m_pcSlice->getBaseColPic();
    48864895
     
    49274936
    49284937  return cBaseColPic->getCU(uiCUAddrBase);
     4938#endif
     4939}
     4940
     4941TComDataCU*  TComDataCU::getBaseColCU( UInt uiPelX, UInt uiPelY, UInt &uiCUAddrBase, UInt &uiAbsPartIdxBase )
     4942{
     4943  TComPic* cBaseColPic = m_pcSlice->getBaseColPic();
     4944
     4945#if SVC_UPSAMPLING
     4946  Int iBWidth   = cBaseColPic->getPicYuvRec()->getWidth () - cBaseColPic->getPicYuvRec()->getPicCropLeftOffset() - cBaseColPic->getPicYuvRec()->getPicCropRightOffset();
     4947  Int iBHeight  = cBaseColPic->getPicYuvRec()->getHeight() - cBaseColPic->getPicYuvRec()->getPicCropTopOffset() - cBaseColPic->getPicYuvRec()->getPicCropBottomOffset();
     4948
     4949  Int iEWidth   = m_pcPic->getPicYuvRec()->getWidth() - m_pcPic->getPicYuvRec()->getPicCropLeftOffset() - m_pcPic->getPicYuvRec()->getPicCropRightOffset();
     4950  Int iEHeight  = m_pcPic->getPicYuvRec()->getHeight() - m_pcPic->getPicYuvRec()->getPicCropTopOffset() - m_pcPic->getPicYuvRec()->getPicCropBottomOffset();
     4951#else
     4952  Int iBWidth   = cBaseColPic->getPicYuvRec()->getWidth();
     4953  Int iBHeight  = cBaseColPic->getPicYuvRec()->getHeight();
     4954
     4955  Int iEWidth   = m_pcPic->getPicYuvRec()->getWidth();
     4956  Int iEHeight  = m_pcPic->getPicYuvRec()->getHeight();
     4957#endif
     4958
     4959  uiPelX = (UInt)Clip3<UInt>(0, m_pcPic->getPicYuvRec()->getWidth() - 1, uiPelX);
     4960  uiPelY = (UInt)Clip3<UInt>(0, m_pcPic->getPicYuvRec()->getHeight() - 1, uiPelY);
     4961
     4962  UInt uiMinUnitSize = m_pcPic->getMinCUWidth();
     4963
     4964  Int iBX = (uiPelX*iBWidth + iEWidth/2)/iEWidth;
     4965  Int iBY = (uiPelY*iBHeight+ iEHeight/2)/iEHeight;
     4966
     4967  if ( iBX >= cBaseColPic->getPicYuvRec()->getWidth() || iBY >= cBaseColPic->getPicYuvRec()->getHeight())
     4968  {
     4969    return NULL;
     4970  }
     4971
     4972#if AVC_SYNTAX
     4973  if( iBX >= iBWidth || iBY >= iBHeight ) //outside of the reference layer cropped picture
     4974  {
     4975    return NULL;
     4976  }
     4977#endif
     4978
     4979  uiCUAddrBase = (iBY/g_uiMaxCUHeight)*cBaseColPic->getFrameWidthInCU() + (iBX/g_uiMaxCUWidth);
     4980
     4981  assert(uiCUAddrBase < cBaseColPic->getNumCUsInFrame());
     4982
     4983  UInt uiRasterAddrBase = (iBY - (iBY/g_uiMaxCUHeight)*g_uiMaxCUHeight)/uiMinUnitSize*cBaseColPic->getNumPartInWidth()
     4984    + (iBX - (iBX/g_uiMaxCUWidth)*g_uiMaxCUWidth)/uiMinUnitSize;
     4985
     4986  uiAbsPartIdxBase = g_auiRasterToZscan[uiRasterAddrBase];
     4987
     4988  return cBaseColPic->getCU(uiCUAddrBase);
    49294989}
    49304990
    49314991Void TComDataCU::scaleBaseMV( TComMvField& rcMvFieldEnhance, TComMvField& rcMvFieldBase )
    49324992{
    4933    TComMvField cMvFieldBase;
    4934    TComMv cMv;
    4935 
    4936    Int iBWidth   = m_pcSlice->getBaseColPic()->getPicYuvRec()->getWidth();
    4937    Int iBHeight  = m_pcSlice->getBaseColPic()->getPicYuvRec()->getHeight();
    4938 
    4939    Int iEWidth   = m_pcPic->getPicYuvRec()->getWidth();
    4940    Int iEHeight  = m_pcPic->getPicYuvRec()->getHeight();
    4941 
    4942    Int iMvX = (rcMvFieldBase.getHor()*iEWidth + (iBWidth/2 -1) * (rcMvFieldBase.getHor() > 0 ? 1: -1) )/iBWidth;
    4943    Int iMvY = (rcMvFieldBase.getVer()*iEHeight + (iBHeight/2 -1) * (rcMvFieldBase.getVer() > 0 ? 1: -1) )/iBHeight;
    4944 
    4945    cMv.set(iMvX, iMvY);
    4946 
    4947    rcMvFieldEnhance.setMvField( cMv, rcMvFieldBase.getRefIdx() );
     4993  TComMvField cMvFieldBase;
     4994  TComMv cMv;
     4995
     4996#if MV_SCALING_FIX
     4997  Int iBWidth   = m_pcSlice->getBaseColPic()->getPicYuvRec()->getWidth () - m_pcSlice->getBaseColPic()->getPicYuvRec()->getPicCropLeftOffset() - m_pcSlice->getBaseColPic()->getPicYuvRec()->getPicCropRightOffset();
     4998  Int iBHeight  = m_pcSlice->getBaseColPic()->getPicYuvRec()->getHeight() - m_pcSlice->getBaseColPic()->getPicYuvRec()->getPicCropTopOffset() - m_pcSlice->getBaseColPic()->getPicYuvRec()->getPicCropBottomOffset();
     4999
     5000  Int iEWidth   = m_pcPic->getPicYuvRec()->getWidth() - m_pcPic->getPicYuvRec()->getPicCropLeftOffset() - m_pcPic->getPicYuvRec()->getPicCropRightOffset();
     5001  Int iEHeight  = m_pcPic->getPicYuvRec()->getHeight() - m_pcPic->getPicYuvRec()->getPicCropTopOffset() - m_pcPic->getPicYuvRec()->getPicCropBottomOffset();
     5002#else
     5003  Int iBWidth   = m_pcSlice->getBaseColPic()->getPicYuvRec()->getWidth();
     5004  Int iBHeight  = m_pcSlice->getBaseColPic()->getPicYuvRec()->getHeight();
     5005
     5006  Int iEWidth   = m_pcPic->getPicYuvRec()->getWidth();
     5007  Int iEHeight  = m_pcPic->getPicYuvRec()->getHeight();
     5008#endif
     5009
     5010  Int iMvX = (rcMvFieldBase.getHor()*iEWidth + (iBWidth/2 -1) * (rcMvFieldBase.getHor() > 0 ? 1: -1) )/iBWidth;
     5011  Int iMvY = (rcMvFieldBase.getVer()*iEHeight + (iBHeight/2 -1) * (rcMvFieldBase.getVer() > 0 ? 1: -1) )/iBHeight;
     5012
     5013  cMv.set(iMvX, iMvY);
     5014
     5015  rcMvFieldEnhance.setMvField( cMv, rcMvFieldBase.getRefIdx() );
    49485016}
    49495017#endif
  • trunk/source/Lib/TLibCommon/TComDataCU.h

    r28 r55  
    526526  // -------------------------------------------------------------------------------------------------------------------
    527527 
    528 #if INTRA_BL
     528#if INTRA_BL && !NO_RESIDUAL_FLAG_FOR_BLPRED
    529529  Void          getBaseLumaBlk   ( UInt uiWidth, UInt uiHeight, UInt uiAbsPartIdx, Pel* piPred, UInt uiStride );
    530530  Void          getBaseChromaBlk ( UInt uiWidth, UInt uiHeight, UInt uiAbsPartIdx, Pel* piPred, UInt uiStride, UInt uiChromaId );
     
    593593#if SVC_COL_BLK
    594594  TComDataCU*   getBaseColCU( UInt uiCuAbsPartIdx, UInt &uiCUAddrBase, UInt &uiAbsPartIdxBase );
     595  TComDataCU*   getBaseColCU( UInt uiPelX, UInt uiPelY, UInt &uiCUAddrBase, UInt &uiAbsPartIdxBase );
    595596  Void          scaleBaseMV( TComMvField& rcMvFieldEnhance, TComMvField& rcMvFieldBase );
    596597#endif
  • trunk/source/Lib/TLibCommon/TComMotionInfo.h

    r28 r55  
    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  {
  • trunk/source/Lib/TLibCommon/TComPic.cpp

    r33 r55  
    6666, m_SEIs                                  (NULL)
    6767#if SVC_EXTENSION
     68, m_layerId( 0 )
    6869, m_bSpatialEnhLayer( false )
    6970, m_pcFullPelBaseRec( NULL )
     
    9697    m_pcFullPelBaseRec = new TComPicYuv;  m_pcFullPelBaseRec->create( iWidth, iHeight, uiMaxWidth, uiMaxHeight, uiMaxDepth, pcSps );
    9798  }
     99
     100  m_layerId = pcSps->getLayerId();
    98101
    99102  /* there are no SEI messages associated with this picture initially */
     
    557560
    558561#if REF_IDX_MFM
     562#if !REUSE_BLKMAPPING
    559563Void TComPic::deriveUnitIdxBase( UInt uiUpsamplePelX, UInt uiUpsamplePelY, UInt ratio, UInt& uiBaseCUAddr, UInt& uiBaseAbsPartIdx )
    560564{
     
    565569  UInt uiBaseWidth  = getPicYuvRec()->getWidth();
    566570  UInt uiBaseHeight = getPicYuvRec()->getHeight();
    567 
     571 
    568572  UInt uiWidthInCU       = ( uiBaseWidth % g_uiMaxCUWidth  ) ? uiBaseWidth /g_uiMaxCUWidth  + 1 : uiBaseWidth /g_uiMaxCUWidth;
     573
     574#if MFM_CLIPPING_FIX
     575  uiPelX     = (UInt)Clip3<UInt>(0, getPicYuvRec()->getWidth() - 1, uiPelX);
     576  uiPelY     = (UInt)Clip3<UInt>(0, getPicYuvRec()->getHeight() - 1, uiPelY);
     577#else
    569578  UInt uiHeightInCU      = ( uiBaseHeight% g_uiMaxCUHeight ) ? uiBaseHeight/ g_uiMaxCUHeight + 1 : uiBaseHeight/ g_uiMaxCUHeight;
    570579
    571580  uiPelX     = (UInt)Clip3<UInt>(0, uiWidthInCU * g_uiMaxCUWidth - 1, uiPelX);
    572581  uiPelY     = (UInt)Clip3<UInt>(0, uiHeightInCU * g_uiMaxCUHeight - 1, uiPelY);
     582#endif
    573583 
    574584  uiBaseCUAddr = uiPelY / g_uiMaxCUHeight * uiWidthInCU + uiPelX / g_uiMaxCUWidth;
     
    585595  return;
    586596}
     597#endif
    587598
    588599Void TComPic::copyUpsampledMvField(TComPic* pcPicBase)
    589600{
     601#if !REUSE_MVSCALE || !REUSE_BLKMAPPING || AVC_SYNTAX
    590602  Int iBWidth   = pcPicBase->getPicYuvRec()->getWidth () - pcPicBase->getPicYuvRec()->getPicCropLeftOffset() - pcPicBase->getPicYuvRec()->getPicCropRightOffset();
    591603  Int iBHeight  = pcPicBase->getPicYuvRec()->getHeight() - pcPicBase->getPicYuvRec()->getPicCropTopOffset() - pcPicBase->getPicYuvRec()->getPicCropBottomOffset();
     
    593605  Int iEWidth   = getPicYuvRec()->getWidth() -  getPicYuvRec()->getPicCropLeftOffset() - getPicYuvRec()->getPicCropRightOffset();
    594606  Int iEHeight  = getPicYuvRec()->getHeight() - getPicYuvRec()->getPicCropTopOffset() -  getPicYuvRec()->getPicCropBottomOffset();
     607#endif
    595608 
     609#if !REUSE_MVSCALE  || !REUSE_BLKMAPPING
    596610  UInt upSampleRatio = 0;
    597611  if(iEWidth == iBWidth && iEHeight == iBHeight)
     
    611625    assert(0);
    612626  }
     627#endif
     628
     629  UInt uiNumPartitions   = 1<<(g_uiMaxCUDepth<<1);
     630  UInt uiWidthMinPU      = g_uiMaxCUWidth/(1<<g_uiMaxCUDepth);
     631  UInt uiHeightMinPU     = g_uiMaxCUHeight/(1<<g_uiMaxCUDepth);
     632  Int  unitNum           = max (1, (Int)((16/uiWidthMinPU)*(16/uiHeightMinPU)) );
    613633
    614634  for(UInt cuIdx = 0; cuIdx < getPicSym()->getNumberOfCUsInFrame(); cuIdx++)  //each LCU
    615635  {
    616     UInt uiNumPartitions   = 1<<(g_uiMaxCUDepth<<1);
    617 
    618636    TComDataCU*             pcCUDes = getCU(cuIdx);
    619 
    620     UInt uiWidthMinPU      = g_uiMaxCUWidth/(1<<g_uiMaxCUDepth);
    621     UInt uiHeightMinPU     = g_uiMaxCUHeight/(1<<g_uiMaxCUDepth);
    622     Int unitNum = max (1, (Int)((16/uiWidthMinPU)*(16/uiHeightMinPU)) );
    623637
    624638    for(UInt uiAbsPartIdx = 0; uiAbsPartIdx < uiNumPartitions; uiAbsPartIdx+=unitNum )  //each 16x16 unit
     
    628642      UInt  uiPelY = pcCUDes->getCUPelY() + g_auiRasterToPelY[ g_auiZscanToRaster[uiAbsPartIdx] ];
    629643      UInt uiBaseCUAddr, uiBaseAbsPartIdx;
    630          pcPicBase->deriveUnitIdxBase(uiPelX + 8, uiPelY + 8, upSampleRatio, uiBaseCUAddr, uiBaseAbsPartIdx);
     644
     645#if REUSE_BLKMAPPING
     646      TComDataCU *pcColCU = 0;
     647      pcColCU = pcCUDes->getBaseColCU(uiPelX + 8, uiPelY + 8, uiBaseCUAddr, uiBaseAbsPartIdx);
     648#else
     649      pcPicBase->deriveUnitIdxBase(uiPelX + 8, uiPelY + 8, upSampleRatio, uiBaseCUAddr, uiBaseAbsPartIdx);
     650#endif
     651
     652#if AVC_SYNTAX
     653      Int iBX = ( (uiPelX + 8) * iBWidth + iEWidth/2 ) / iEWidth;
     654      Int iBY = ( (uiPelY + 8) * iBHeight+ iEHeight/2 ) / iEHeight;
     655
     656#if REUSE_BLKMAPPING
     657      if( ( iBX < iBWidth && iBY < iBHeight ) && pcColCU && (pcColCU->getPredictionMode(uiBaseAbsPartIdx) != MODE_NONE) && (pcColCU->getPredictionMode(uiBaseAbsPartIdx) != MODE_INTRA) )  //base layer unit not skip and invalid mode
     658#else
     659      if( ( iBX < iBWidth && iBY < iBHeight ) && (pcPicBase->getCU(uiBaseCUAddr)->getPredictionMode(uiBaseAbsPartIdx) != MODE_NONE) && (pcPicBase->getCU(uiBaseCUAddr)->getPredictionMode(uiBaseAbsPartIdx) != MODE_INTRA) )  //base layer unit not skip and invalid mode
     660#endif
     661#else
     662#if REUSE_BLKMAPPING
     663      if( pcColCU && (pcColCU->getPredictionMode(uiBaseAbsPartIdx) != MODE_NONE) && (pcColCU->getPredictionMode(uiBaseAbsPartIdx) != MODE_INTRA) )  //base layer unit not skip and invalid mode
     664#else
    631665      if( (pcPicBase->getCU(uiBaseCUAddr)->getPredictionMode(uiBaseAbsPartIdx) != MODE_NONE) && (pcPicBase->getCU(uiBaseCUAddr)->getPredictionMode(uiBaseAbsPartIdx) != MODE_INTRA) )  //base layer unit not skip and invalid mode
    632       {
    633         for(UInt list = 0; list < 2; list++)  //each list
    634         {
    635           TComMv cMv = pcPicBase->getCU(uiBaseCUAddr)->getCUMvField((RefPicList)list)->getMv(uiBaseAbsPartIdx);
    636           Int refIdx = pcPicBase->getCU(uiBaseCUAddr)->getCUMvField((RefPicList)list)->getRefIdx(uiBaseAbsPartIdx);
     666#endif
     667#endif
     668      {
     669        for(UInt refPicList = 0; refPicList < 2; refPicList++)  //for each reference list
     670        {
     671#if REUSE_MVSCALE
     672          TComMvField sMvFieldBase, sMvField;
     673#if REUSE_BLKMAPPING
     674          pcColCU->getMvField( pcColCU, uiBaseAbsPartIdx, (RefPicList)refPicList, sMvFieldBase);
     675#else
     676          pcPicBase->getCU(uiBaseCUAddr)->getMvField( pcPicBase->getCU(uiBaseCUAddr), uiBaseAbsPartIdx, (RefPicList)refPicList, sMvFieldBase);
     677#endif
     678          pcCUDes->scaleBaseMV( sMvField, sMvFieldBase );
     679#else
     680          TComMv cMv = pcPicBase->getCU(uiBaseCUAddr)->getCUMvField((RefPicList)refPicList)->getMv(uiBaseAbsPartIdx);
     681          Int refIdx = pcPicBase->getCU(uiBaseCUAddr)->getCUMvField((RefPicList)refPicList)->getRefIdx(uiBaseAbsPartIdx);
    637682
    638683          Int Hor =  ((Int)upSampleRatio * cMv.getHor())/2 ;
     
    642687          TComMvField sMvField;
    643688          sMvField.setMvField(cScaledMv, refIdx);
    644 
    645           pcCUDes->getCUMvField((RefPicList)list)->setMvField(sMvField, uiAbsPartIdx);
     689#endif
     690
     691          pcCUDes->getCUMvField((RefPicList)refPicList)->setMvField(sMvField, uiAbsPartIdx);
    646692          pcCUDes->setPredictionMode(uiAbsPartIdx, MODE_INTER);
    647693        }
     
    669715#endif
    670716
     717#if AVC_SYNTAX
     718Void TComPic::readBLSyntax( fstream* filestream, UInt numBytes )
     719{
     720  if( !filestream->good() )
     721  {
     722    return;
     723  }
     724
     725  UInt   uiWidth      = this->getPicYuvRec()->getWidth() - this->getPicYuvRec()->getPicCropLeftOffset() - this->getPicYuvRec()->getPicCropRightOffset();
     726  UInt   uiHeight     = this->getPicYuvRec()->getHeight() - this->getPicYuvRec()->getPicCropTopOffset() - this->getPicYuvRec()->getPicCropBottomOffset();
     727  UInt64 uiPOC        = (UInt64)this->getPOC();
     728  UInt   uiPartWidth  = uiWidth / 4;
     729  UInt   uiPartHeight = uiHeight / 4;
     730
     731  UInt uiNumPartInWidth    = this->getNumPartInWidth();
     732  UInt uiNumPartInHeight   = this->getNumPartInHeight();
     733  UInt uiNumPartLCUInWidth = this->getFrameWidthInCU();
     734
     735  UInt64 uiPos = (UInt64)uiPOC * uiWidth * uiHeight * numBytes / 16;
     736   
     737  filestream->seekg( uiPos, ios_base::beg );
     738
     739  for( Int i = 0; i < uiPartHeight; i++ )
     740  {
     741    for( Int j = 0; j < uiPartWidth; j++ )
     742    {
     743      UInt uiX = ( j / uiNumPartInWidth );
     744      UInt uiY = ( i / uiNumPartInHeight );
     745
     746      UInt uiLCUAddr = uiY * uiNumPartLCUInWidth + uiX;
     747      UInt uiPartAddr = ( i - uiY * uiNumPartInHeight ) * uiNumPartInWidth + ( j - uiX * uiNumPartInWidth );
     748      uiPartAddr = g_auiRasterToZscan[uiPartAddr];
     749     
     750      TComDataCU* pcCU = this->getCU( uiLCUAddr );
     751     
     752      TComMv mv;
     753      Short temp;
     754
     755      // RefIdxL0
     756      Char refIdxL0 = -1;
     757      filestream->read( &refIdxL0, 1 );
     758      assert( refIdxL0 >= -1 );
     759      pcCU->getCUMvField( REF_PIC_LIST_0 )->setRefIdx( (Int)refIdxL0, uiPartAddr );
     760
     761      // RefIdxL1
     762      Char refIdxL1 = -1;
     763      filestream->read( &refIdxL1, 1 );
     764      assert( refIdxL1 >= -1 );
     765      pcCU->getCUMvField( REF_PIC_LIST_1 )->setRefIdx( (Int)refIdxL1, uiPartAddr );
     766
     767      // MV L0
     768      temp = 0;
     769      filestream->read( reinterpret_cast<char*>(&temp), 2 );
     770      mv.setHor( (Short)temp );
     771      temp = 0;
     772      filestream->read( reinterpret_cast<char*>(&temp), 2 );
     773      mv.setVer( (Short)temp );
     774      pcCU->getCUMvField( REF_PIC_LIST_0 )->setMv( mv, uiPartAddr );
     775
     776      // MV L1
     777      temp = 0;
     778      filestream->read( reinterpret_cast<char*>(&temp), 2 );
     779      mv.setHor( (Short)temp );
     780      temp = 0;
     781      filestream->read( reinterpret_cast<char*>(&temp), 2 );
     782      mv.setVer( (Short)temp );
     783      pcCU->getCUMvField( REF_PIC_LIST_1 )->setMv( mv, uiPartAddr );
     784
     785      // set dependent information
     786      pcCU->setPredictionMode( uiPartAddr, ( refIdxL0 == NOT_VALID && refIdxL1 == NOT_VALID ) ? MODE_INTRA : MODE_INTER );
     787      UInt uiInterDir = ( refIdxL0 != NOT_VALID ) + ( refIdxL1 != NOT_VALID && this->getSlice(0)->isInterB() ) * 2;
     788      assert( uiInterDir >= 0 && uiInterDir <= 3 );
     789      pcCU->setInterDir( uiPartAddr, uiInterDir );     
     790    }
     791  }
     792}
     793#endif
     794
     795#if SYNTAX_OUTPUT
     796Void TComPic::wrireBLSyntax( fstream* filestream, UInt numBytes )
     797{
     798  if( !filestream->good() )
     799  {
     800    return;
     801  }
     802
     803  UInt   uiWidth      = this->getPicYuvRec()->getWidth() - getSlice(0)->getSPS()->getPicCropLeftOffset() - getSlice(0)->getSPS()->getPicCropRightOffset();
     804  UInt   uiHeight     = this->getPicYuvRec()->getHeight() - getSlice(0)->getSPS()->getPicCropTopOffset() - getSlice(0)->getSPS()->getPicCropBottomOffset();
     805  UInt64 uiPOC        = (UInt64)this->getPOC();
     806  UInt   uiPartWidth  = uiWidth / 4;
     807  UInt   uiPartHeight = uiHeight / 4;
     808
     809  UInt uiNumPartInWidth    = this->getNumPartInWidth();
     810  UInt uiNumPartInHeight   = this->getNumPartInHeight();
     811  UInt uiNumPartLCUInWidth = this->getFrameWidthInCU();
     812
     813  filestream->seekg( uiPOC * uiWidth * uiHeight * numBytes / 16 );
     814   
     815  for( Int i = 0; i < uiPartHeight; i++ )
     816  {
     817    for( Int j = 0; j < uiPartWidth; j++ )
     818    {
     819      UInt uiX = ( j / uiNumPartInWidth );
     820      UInt uiY = ( i / uiNumPartInHeight );
     821
     822      UInt uiLCUAddr = uiY * uiNumPartLCUInWidth + uiX;
     823      UInt uiPartAddr = ( i - uiY * uiNumPartInHeight ) * uiNumPartInWidth + ( j - uiX * uiNumPartInWidth );
     824      uiPartAddr = g_auiRasterToZscan[uiPartAddr];
     825     
     826      TComDataCU* pcCU = this->getCU( uiLCUAddr );
     827     
     828      TComMv mv;
     829      Short temp;
     830      Char refIdxL0 = NOT_VALID, refIdxL1 = NOT_VALID;
     831
     832      // RefIdx
     833      if( !pcCU->isIntra( uiPartAddr ) )
     834      {
     835        refIdxL0 = (Char)pcCU->getCUMvField( REF_PIC_LIST_0 )->getRefIdx( uiPartAddr );
     836        refIdxL1 = (Char)pcCU->getCUMvField( REF_PIC_LIST_1 )->getRefIdx( uiPartAddr );
     837      }
     838      assert( refIdxL0 >= - 1 && refIdxL1 >= - 1 );
     839      filestream->put( refIdxL0 );
     840      filestream->put( refIdxL1 );
     841
     842      // MV L0
     843      mv.setZero();
     844      if( refIdxL0 >= 0 )
     845      {
     846        mv = pcCU->getCUMvField( REF_PIC_LIST_0 )->getMv( uiPartAddr );
     847      }
     848      temp = (Short)mv.getHor();
     849      filestream->write( reinterpret_cast<char*>(&temp), 2 );
     850      temp = (Short)mv.getVer();
     851      filestream->write( reinterpret_cast<char*>(&temp), 2 );
     852
     853      // MV L1
     854      mv.setZero();
     855      if( refIdxL1 >= 0 )
     856      {
     857        mv = pcCU->getCUMvField( REF_PIC_LIST_1 )->getMv( uiPartAddr );
     858      }
     859      temp = (Short)mv.getHor();
     860      filestream->write( reinterpret_cast<char*>(&temp), 2 );
     861      temp = (Short)mv.getVer();
     862      filestream->write( reinterpret_cast<char*>(&temp), 2 );
     863    }
     864  }
     865}
     866#endif
     867
     868
    671869//! \}
  • trunk/source/Lib/TLibCommon/TComPic.h

    r28 r55  
    4444#include "TComPicYuv.h"
    4545#include "TComBitStream.h"
     46#if AVC_BASE || SYNTAX_OUTPUT
     47#include <fstream>
     48#endif
     49
    4650
    4751//! \ingroup TLibCommon
     
    125129#if REF_IDX_MFM
    126130  Void          copyUpsampledMvField  (  TComPic* pcPicBase );
     131#if !REUSE_BLKMAPPING
    127132  Void          deriveUnitIdxBase     (  UInt uiUpsamplePelX, UInt uiUpsamplePelY, UInt ratio, UInt& uiBaseCUAddr, UInt& uiBaseAbsPartIdx );
     133#endif
    128134#endif
    129135
     
    209215  Void  copyUpsampledPictureYuv(TComPicYuv*   pcPicYuvIn, TComPicYuv*   pcPicYuvOut);
    210216#endif
     217#if AVC_SYNTAX
     218  Void readBLSyntax( fstream* filestream, UInt numBytes );
     219#endif
     220#if SYNTAX_OUTPUT
     221  Void wrireBLSyntax( fstream* filestream, UInt numBytes );
     222#endif
     223
    211224};// END CLASS DEFINITION TComPic
    212225
     
    214227
    215228#endif // __TCOMPIC__
     229
  • trunk/source/Lib/TLibCommon/TComPicSym.h

    r2 r55  
    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;           }
  • trunk/source/Lib/TLibCommon/TComPrediction.cpp

    r2 r55  
    407407}
    408408
    409 #if INTRA_BL
     409#if INTRA_BL && !NO_RESIDUAL_FLAG_FOR_BLPRED
    410410Void TComPrediction::getBaseBlk( TComDataCU* pcCU, TComYuv* pcYuvPred, Int iPartAddr, Int iWidth, Int iHeight )
    411411{
  • trunk/source/Lib/TLibCommon/TComSlice.cpp

    r33 r55  
    562562  assert(thePoc == pcRefPicBL->getPOC());
    563563
     564#if REUSE_MVSCALE || REUSE_BLKMAPPING
     565  ilpPic[0]->getSlice(0)->setBaseColPic( pcRefPicBL );
     566#endif
     567
    564568  //initialize reference POC of ILP
    565569  for(Int refIdx = 0; refIdx < MAX_NUM_REF; refIdx++)
     
    21912195}
    21922196#endif
     2197
     2198#if SVC_EXTENSION && AVC_SYNTAX
     2199Void TComSlice::initBaseLayerRPL( TComSlice *pcSlice )
     2200{
     2201// Assumed that RPL of the base layer is same to the EL, otherwise this information should be also dumped and read from the metadata file
     2202  setPOC( pcSlice->getPOC() );
     2203  if( pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA )
     2204  {
     2205    setSliceType( I_SLICE );
     2206  }
     2207  else
     2208  {
     2209    setSliceType( pcSlice->getSliceType() );
     2210  }
     2211
     2212  if( this->isIntra() )
     2213  {
     2214    return;
     2215  }
     2216
     2217  //initialize reference POC of BL
     2218  for( Int iRefPicList = 0; iRefPicList < 2; iRefPicList++ )
     2219  {
     2220    RefPicList eRefPicList = RefPicList( iRefPicList );
     2221
     2222    assert( pcSlice->getNumRefIdx( eRefPicList) > 0 );
     2223    setNumRefIdx( eRefPicList, pcSlice->getNumRefIdx( eRefPicList ) - 1 );
     2224    assert( getNumRefIdx( eRefPicList) <= MAX_NUM_REF);
     2225
     2226    for(Int refIdx = 0; refIdx < getNumRefIdx( eRefPicList ); refIdx++)
     2227    {
     2228      setRefPOC( pcSlice->getRefPic( eRefPicList, refIdx )->getPOC(), eRefPicList, refIdx );
     2229      setRefPic( pcSlice->getRefPic( eRefPicList, refIdx ), eRefPicList, refIdx );
     2230      /*
     2231      // should be set if the base layer has its own instance of the reference picture lists, currently EL RPL is reused.
     2232      getRefPic( eRefPicList, refIdx )->setLayerId( 0 );
     2233      getRefPic( eRefPicList, refIdx )->setIsLongTerm( pcSlice->getRefPic( eRefPicList, refIdx )->getIsLongTerm() );
     2234      getRefPic( eRefPicList, refIdx )->setIsUsedAsLongTerm( pcSlice->getRefPic( eRefPicList, refIdx )->getIsUsedAsLongTerm() );
     2235      */
     2236
     2237    }
     2238  } 
     2239  return;
     2240}
     2241#endif
     2242
    21932243//! \}
  • trunk/source/Lib/TLibCommon/TComSlice.h

    r28 r55  
    14541454  Void        setFullPelBaseRec   ( TComPicYuv* p) { m_pcFullPelBaseRec = p; }
    14551455  TComPicYuv* getFullPelBaseRec   ()  { return  m_pcFullPelBaseRec;  }
     1456
     1457#if AVC_SYNTAX
     1458  Void      initBaseLayerRPL( TComSlice *pcSlice );
     1459#endif
    14561460#endif
    14571461
  • trunk/source/Lib/TLibCommon/TComUpsampleFilter.cpp

    r28 r55  
    227227#endif
    228228
    229 
    230 
    231229  assert ( iEWidth == 2*iBWidth || 2*iEWidth == 3*iBWidth );
    232230  assert ( iEHeight == 2*iBHeight || 2*iEHeight == 3*iBHeight );
  • trunk/source/Lib/TLibCommon/TypeDef.h

    r28 r55  
    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 MV_SCALING_FIX                   1      ///< fixing the base layer MV scaling
     57#define MV_SCALING_POS_FIX               1      ///< use center pixels to get co-located base layer block
     58#define MFM_CLIPPING_FIX                 1      ///< set the right picture size for the clipping
     59
     60#define AVC_BASE                         1      ///< YUV BL reading for AVC base SVC
    5661#define REF_IDX_FRAMEWORK                0      ///< inter-layer reference framework
     62
     63#if AVC_BASE
     64#define AVC_SYNTAX                       1      ///< Syntax reading for AVC base
     65#endif
    5766
    5867#if REF_IDX_FRAMEWORK
     
    6069#define REF_IDX_ME_ZEROMV                1      ///< L0051: use zero motion for inter-layer reference picture (without fractional ME)
    6170#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.
     71#if !AVC_BASE || AVC_SYNTAX
    6272#define REF_IDX_MFM                      1      ///< L0336: motion vector mapping of inter-layer reference picture
     73#endif
     74
     75#if REF_IDX_MFM
     76#define REUSE_MVSCALE                    1      ///< using the base layer MV scaling function
     77#define REUSE_BLKMAPPING                 1      ///< using the base layer get co-located block function
     78#endif
     79
    6380#else
    6481#define INTRA_BL                         1      ///< inter-layer texture prediction
     
    6986
    7087// Hooks
    71 #if !AVC_BASE
     88#if !AVC_BASE || AVC_SYNTAX
    7289#define SVC_MVP                          1      ///< motion hook for merge mode as an example
     90#if !AVC_SYNTAX
    7391#define SVC_BL_CAND_INTRA                0      ///< Intra Base Mode Prediction hook as an example
    7492#endif
     
    8098
    8199#endif
     100#endif
     101#else
     102#define SYNTAX_OUTPUT                    1
    82103#endif
    83104
  • trunk/source/Lib/TLibDecoder/TDecCu.cpp

    r17 r55  
    546546 
    547547  //===== get prediction signal =====
    548 #if INTRA_BL
     548#if INTRA_BL && !NO_RESIDUAL_FLAG_FOR_BLPRED
    549549  if(pcCU->isIntraBL ( uiAbsPartIdx ) )
    550550  {
     
    651651 
    652652  //===== get prediction signal =====
    653 #if INTRA_BL
     653#if INTRA_BL && !NO_RESIDUAL_FLAG_FOR_BLPRED
    654654  if(pcCU->isIntraBL ( uiAbsPartIdx ) )
    655655  {
  • trunk/source/Lib/TLibDecoder/TDecTop.cpp

    r30 r55  
    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
     
    554561  if (m_bFirstSliceInPicture)
    555562  {
    556 
    557563#if AVC_BASE
    558564  if( m_layerId == 1 )
    559565  {
    560566    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();
     567    fstream* pFile = m_ppcTDecTop[0]->getBLReconFile();
     568    UInt uiWidth    = pBLPic->getPicYuvRec()->getWidth() - pBLPic->getPicYuvRec()->getPicCropLeftOffset() - pBLPic->getPicYuvRec()->getPicCropRightOffset();;
     569    UInt uiHeight   = pBLPic->getPicYuvRec()->getHeight() - pBLPic->getPicYuvRec()->getPicCropTopOffset() - pBLPic->getPicYuvRec()->getPicCropBottomOffset();
    564570       
    565     if( pFile )
    566     {
    567       fseek( pFile, m_apcSlicePilot->getPOC() * uiWidth * uiHeight * 3 / 2, SEEK_SET );
     571    if( pFile->good() )
     572    {
     573      UInt64 uiPos = (UInt64) m_apcSlicePilot->getPOC() * uiWidth * uiHeight * 3 / 2;
     574
     575      pFile->seekg((UInt)uiPos, ios::beg );
    568576
    569577      Pel* pPel = pBLPic->getPicYuvRec()->getLumaAddr();
     
    573581        for( Int j = 0; j < uiWidth; j++ )
    574582        {
    575           pPel[j] = fgetc( pFile );
     583          pPel[j] = pFile->get();
    576584        }
    577585        pPel += uiStride;
     
    584592        for( Int j = 0; j < uiWidth/2; j++ )
    585593        {
    586           pPel[j] = fgetc( pFile );
     594          pPel[j] = pFile->get();
    587595        }
    588596        pPel += uiStride;
     
    595603        for( Int j = 0; j < uiWidth/2; j++ )
    596604        {
    597           pPel[j] = fgetc( pFile );
     605          pPel[j] = pFile->get();
    598606        }
    599607        pPel += uiStride;
     
    737745  {
    738746    pcSlice->checkCRA(pcSlice->getRPS(), m_pocCRA, m_prevRAPisBLA, m_cListPic);
    739 #if !REF_IDX_FRAMEWORK
     747#if !REF_IDX_FRAMEWORK || AVC_SYNTAX
    740748    // Set reference list
    741749    pcSlice->setRefPicList( m_cListPic );
     
    747755#if AVC_BASE
    748756      pcSlice->setBaseColPic ( *m_ppcTDecTop[0]->getListPic()->begin() );
     757#if AVC_SYNTAX
     758      TComPic* pBLPic = pcSlice->getBaseColPic();
     759      if( pcSlice->getPOC() == 0 )
     760      {
     761        // initialize partition order.
     762        UInt* piTmp = &g_auiZscanToRaster[0];
     763        initZscanToRaster( pBLPic->getPicSym()->getMaxDepth() + 1, 1, 0, piTmp );
     764        initRasterToZscan( pBLPic->getPicSym()->getMaxCUWidth(), pBLPic->getPicSym()->getMaxCUHeight(), pBLPic->getPicSym()->getMaxDepth() + 1 );
     765      }     
     766      pBLPic->getSlice( 0 )->initBaseLayerRPL( pcSlice );
     767      pBLPic->readBLSyntax( m_ppcTDecTop[0]->getBLSyntaxFile(), SYNTAX_BYTES );
     768#endif
     769
    749770#else
    750771      TDecTop *pcTDecTop = (TDecTop *)getLayerDec( m_layerId-1 );
     
    767788
    768789#if REF_IDX_FRAMEWORK
     790#if !AVC_SYNTAX
    769791    // Set reference list
    770792    pcSlice->setRefPicList( m_cListPic );
     793#endif
    771794    if(m_layerId > 0)
    772795    {
     
    9791002        {
    9801003#if SVC_UPSAMPLING
     1004#if AVC_SYNTAX
     1005          TComSPS* sps = new TComSPS();
     1006          pBLPic->create( m_ppcTDecTop[0]->getBLWidth(), m_ppcTDecTop[0]->getBLHeight(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, sps, true);
     1007#else
    9811008          pBLPic->create( m_ppcTDecTop[0]->getBLWidth(), m_ppcTDecTop[0]->getBLHeight(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, NULL, true);
     1009#endif
    9821010#else
    9831011          pBLPic->create( m_ppcTDecTop[0]->getBLWidth(), m_ppcTDecTop[0]->getBLHeight(), g_uiMaxCUWidth, g_uiMaxCUHeight, g_uiMaxCUDepth, true);
  • trunk/source/Lib/TLibDecoder/TDecTop.h

    r28 r55  
    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
  • trunk/source/Lib/TLibEncoder/TEncGOP.cpp

    r28 r55  
    337337    pcSlice->setNalUnitType(getNalUnitType(uiPOCCurr));
    338338#if REF_IDX_FRAMEWORK
    339     if (m_layerId > 0 && (uiPOCCurr % m_pcCfg->getIntraPeriod() == 0))
     339    if( m_layerId > 0 && (uiPOCCurr % m_pcCfg->getIntraPeriod() == 0) )
     340    {
    340341      pcSlice->setNalUnitType(NAL_UNIT_CODED_SLICE_CRA);
     342    }
    341343    if( m_layerId > 0 && !m_pcEncTop->getElRapSliceTypeB() )
    342344    {
    343345      if( (pcSlice->getNalUnitType() >= NAL_UNIT_CODED_SLICE_BLA) &&
    344346          (pcSlice->getNalUnitType() <= NAL_UNIT_CODED_SLICE_CRA) &&
    345            pcSlice->getSliceType() == B_SLICE )
     347           pcSlice->getSliceType() == B_SLICE )
     348      {
    346349        pcSlice->setSliceType(P_SLICE);
     350      }
    347351    }
    348352#endif
     
    466470
    467471#if REF_IDX_FRAMEWORK
    468     if (pcSlice->getSliceType() == B_SLICE)
     472    if( pcSlice->getSliceType() == B_SLICE )
     473    {
    469474      pcSlice->setColFromL0Flag(1-uiColDir);
     475    }
    470476#endif
    471477
     
    774780    {
    775781      pcPic->getPicYuvOrg()->copyToPic( pcPic->getPicYuvRec() );
     782#if AVC_SYNTAX
     783      pcPic->readBLSyntax( m_ppcTEncTop[0]->getBLSyntaxFile(), SYNTAX_BYTES );
     784#endif
    776785      return;
    777786    }
  • trunk/source/Lib/TLibEncoder/TEncSearch.cpp

    r33 r55  
    10571057    pcCU->getPattern()->initAdiPattern( pcCU, uiAbsPartIdx, uiTrDepth, m_piYuvExt, m_iYuvExtStride, m_iYuvExtHeight, bAboveAvail, bLeftAvail );
    10581058    //===== get prediction signal =====
    1059 #if INTRA_BL
     1059#if INTRA_BL && !NO_RESIDUAL_FLAG_FOR_BLPRED
    10601060    if(pcCU->isIntraBL ( uiAbsPartIdx ) )
    10611061    {
     
    12591259
    12601260    //===== get prediction signal =====
    1261 #if INTRA_BL
     1261#if INTRA_BL && !NO_RESIDUAL_FLAG_FOR_BLPRED
    12621262  if(pcCU->isIntraBL ( uiAbsPartIdx ) )
    12631263  {
  • trunk/source/Lib/TLibEncoder/TEncTop.h

    r28 r55  
    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.