Changeset 55 in SHVCSoftware for trunk/source/Lib/TLibCommon


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:
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/source

  • 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
Note: See TracChangeset for help on using the changeset viewer.