Changeset 54 in SHVCSoftware for branches/HM-10.0-dev-SHM/source/Lib/TLibCommon


Ignore:
Timestamp:
2 Mar 2013, 09:25:00 (12 years ago)
Author:
seregin
Message:

port simulcast

Location:
branches/HM-10.0-dev-SHM/source/Lib/TLibCommon
Files:
2 added
21 edited

Legend:

Unmodified
Added
Removed
  • branches/HM-10.0-dev-SHM/source/Lib/TLibCommon/CommonDef.h

    r51 r54  
    5656// ====================================================================================================================
    5757
    58 #define NV_VERSION        "10.0"                 ///< Current software version
     58#define NV_VERSION        "1.2"                 ///< Current software version
    5959
    6060// ====================================================================================================================
  • branches/HM-10.0-dev-SHM/source/Lib/TLibCommon/ContextTables.h

    r51 r54  
    9292#define NUM_SAO_MERGE_FLAG_CTX        1       ///< number of context models for SAO merge flags
    9393#define NUM_SAO_TYPE_IDX_CTX          1       ///< number of context models for SAO type index
     94#if INTRA_BL
     95#define NUM_INTRA_BL_PRED_CTX         3
     96#endif
    9497
    9598#define NUM_TRANSFORMSKIP_FLAG_CTX    1       ///< number of context models for transform skipping
     
    327330};
    328331
     332#if INTRA_BL
     333static const UChar
     334INIT_INTRA_BL_PRED_FLAG[3][NUM_INTRA_BL_PRED_CTX] =
     335{
     336  { 185,  185,  201, },
     337  { 197,  197,  185, },
     338  { 197,  197,  185, },
     339};
     340#endif
    329341static const UChar
    330342INIT_TRANSFORMSKIP_FLAG[3][2*NUM_TRANSFORMSKIP_FLAG_CTX] =
  • branches/HM-10.0-dev-SHM/source/Lib/TLibCommon/NAL.h

    r51 r54  
    4747  NalUnitType m_nalUnitType; ///< nal_unit_type
    4848  UInt        m_temporalId;  ///< temporal_id
     49#if SVC_EXTENSION
     50  UInt        m_layerId;   ///< layer id
     51#endif
    4952  UInt        m_reservedZero6Bits; ///< reserved_zero_6bits
    5053
     
    5356    NalUnitType nalUnitType,
    5457    Int         temporalId = 0,
     58#if SVC_EXTENSION
     59    UInt        layerId = 0,
     60#endif
    5561    Int         reservedZero6Bits = 0)
    5662    :m_nalUnitType (nalUnitType)
    5763    ,m_temporalId  (temporalId)
     64#if SVC_EXTENSION
     65    ,m_layerId   (layerId)
     66#endif
    5867    ,m_reservedZero6Bits(reservedZero6Bits)
    5968  {}
  • branches/HM-10.0-dev-SHM/source/Lib/TLibCommon/TComDataCU.cpp

    r51 r54  
    359359  m_uiTotalBins        = 0;
    360360  m_uiNumPartition     = pcPic->getNumPartInCU();
     361
     362#if SVC_EXTENSION
     363  m_layerId           = pcPic->getLayerId();
     364#endif
    361365 
    362366  for(Int i=0; i<pcPic->getNumPartInCU(); i++)
     
    16471651  pcTempCU = getPULeft( uiTempPartIdx, m_uiAbsIdxInLCU + uiAbsPartIdx );
    16481652 
     1653#if INTRA_BL
     1654  iLeftIntraDir  = pcTempCU ? ( pcTempCU->isIntra( uiTempPartIdx ) && ( !pcTempCU->isIntraBL( uiTempPartIdx ) ) ? pcTempCU->getLumaIntraDir( uiTempPartIdx ) : DC_IDX ) : DC_IDX;
     1655#else
    16491656  iLeftIntraDir  = pcTempCU ? ( pcTempCU->isIntra( uiTempPartIdx ) ? pcTempCU->getLumaIntraDir( uiTempPartIdx ) : DC_IDX ) : DC_IDX;
     1657#endif
    16501658 
    16511659  // Get intra direction of above PU
    16521660  pcTempCU = getPUAbove( uiTempPartIdx, m_uiAbsIdxInLCU + uiAbsPartIdx, true, true );
    16531661 
     1662#if INTRA_BL
     1663  iAboveIntraDir = pcTempCU ? ( pcTempCU->isIntra( uiTempPartIdx ) && ( !pcTempCU->isIntraBL( uiTempPartIdx ) ) ? pcTempCU->getLumaIntraDir( uiTempPartIdx ) : DC_IDX ) : DC_IDX;
     1664#else
    16541665  iAboveIntraDir = pcTempCU ? ( pcTempCU->isIntra( uiTempPartIdx ) ? pcTempCU->getLumaIntraDir( uiTempPartIdx ) : DC_IDX ) : DC_IDX;
     1666#endif
     1667 
     1668#if SVC_BL_CAND_INTRA
     1669  if(m_layerId > 0)
     1670  {
     1671    UInt uiCUAddrBase, uiAbsPartAddrBase;
     1672    pcTempCU = getBaseColCU( uiAbsPartIdx, uiCUAddrBase, uiAbsPartAddrBase );
     1673
     1674    if(pcTempCU->getPredictionMode( uiAbsPartAddrBase ) == MODE_INTRA )
     1675    {
     1676      Int iColBaseDir = pcTempCU->getLumaIntraDir( uiAbsPartAddrBase );
     1677      if( iColBaseDir != iAboveIntraDir && iColBaseDir != iLeftIntraDir && iAboveIntraDir != iLeftIntraDir)
     1678      {
     1679        uiIntraDirPred[0] = iColBaseDir;
     1680        uiIntraDirPred[1] = iLeftIntraDir;
     1681        uiIntraDirPred[2] = iAboveIntraDir;
     1682        if( piMode )
     1683        {
     1684          *piMode = 2;
     1685        }
     1686        uiPredNum = 3;
     1687        return uiPredNum;
     1688      }
     1689      else
     1690      {
     1691        iAboveIntraDir = (iColBaseDir == iLeftIntraDir) ? iAboveIntraDir : iLeftIntraDir;
     1692        iLeftIntraDir  = iColBaseDir;
     1693      }
     1694    }
     1695  }
     1696#endif
    16551697 
    16561698  uiPredNum = 3;
     
    17301772  UInt log2CbSize = g_aucConvertToBit[getWidth( absPartIdx )] + 2;
    17311773  PartSize  partSize  = getPartitionSize( absPartIdx );
     1774#if INTRA_BL
     1775  UInt quadtreeTUMaxDepth = isIntra( absPartIdx ) ? m_pcSlice->getSPS()->getQuadtreeTUMaxDepthIntra() : m_pcSlice->getSPS()->getQuadtreeTUMaxDepthInter();
     1776#else
    17321777  UInt quadtreeTUMaxDepth = getPredictionMode( absPartIdx ) == MODE_INTRA ? m_pcSlice->getSPS()->getQuadtreeTUMaxDepthIntra() : m_pcSlice->getSPS()->getQuadtreeTUMaxDepthInter();
     1778#endif
    17331779  Int intraSplitFlag = ( getPredictionMode( absPartIdx ) == MODE_INTRA && partSize == SIZE_NxN ) ? 1 : 0;
    17341780  Int interSplitFlag = ((quadtreeTUMaxDepth == 1) && (getPredictionMode( absPartIdx ) == MODE_INTER) && (partSize != SIZE_2Nx2N) );
     
    17521798  return log2MinTUSizeInCU;
    17531799}
     1800
     1801#if INTRA_BL
     1802UInt TComDataCU::getCtxIntraBLFlag( UInt uiAbsPartIdx )
     1803{
     1804  TComDataCU* pcTempCU;
     1805  UInt        uiTempPartIdx;
     1806  UInt        uiCtx = 0;
     1807 
     1808  // Get BCBP of left PU
     1809#if DEPENDENT_SLICES
     1810  Bool bDepSliceRestriction = ( !m_pcSlice->getPPS()->getDependentSliceEnabledFlag());
     1811  pcTempCU = getPULeft( uiTempPartIdx, m_uiAbsIdxInLCU + uiAbsPartIdx, true, bDepSliceRestriction );
     1812#else
     1813  pcTempCU = getPULeft( uiTempPartIdx, m_uiAbsIdxInLCU + uiAbsPartIdx );
     1814#endif 
     1815  uiCtx    = ( pcTempCU ) ? pcTempCU->isIntraBL( uiTempPartIdx ) : 0;
     1816 
     1817  // Get BCBP of above PU
     1818#if DEPENDENT_SLICES
     1819  pcTempCU = getPUAbove( uiTempPartIdx, m_uiAbsIdxInLCU + uiAbsPartIdx, true, bDepSliceRestriction );
     1820#else
     1821  pcTempCU = getPUAbove( uiTempPartIdx, m_uiAbsIdxInLCU + uiAbsPartIdx );
     1822#endif 
     1823  uiCtx   += ( pcTempCU ) ? pcTempCU->isIntraBL( uiTempPartIdx ) : 0;
     1824 
     1825  return uiCtx;
     1826}
     1827#endif
     1828
     1829#if REF_IDX_ME_ZEROMV
     1830Bool TComDataCU::xCheckZeroMVILRMerge(UChar uhInterDir, TComMvField& cMvFieldL0, TComMvField& cMvFieldL1)
     1831{
     1832  Bool checkZeroMVILR = true;
     1833
     1834  if(uhInterDir&0x1)  //list0
     1835  {
     1836    Int refIdxL0 = cMvFieldL0.getRefIdx();
     1837    if(getSlice()->getRefPic(REF_PIC_LIST_0, refIdxL0)->getIsILR())
     1838      checkZeroMVILR &= (cMvFieldL0.getHor() == 0 && cMvFieldL0.getVer() == 0);
     1839  }
     1840  if(uhInterDir&0x2)  //list1
     1841  {
     1842    Int refIdxL1  = cMvFieldL1.getRefIdx();
     1843    if(getSlice()->getRefPic(REF_PIC_LIST_1, refIdxL1)->getIsILR())
     1844      checkZeroMVILR &= (cMvFieldL1.getHor() == 0 && cMvFieldL1.getVer() == 0);
     1845  }
     1846
     1847  return checkZeroMVILR;
     1848}
     1849
     1850Bool TComDataCU::xCheckZeroMVILRMvdL1Zero(Int iRefList, Int iRefIdx, Int MvpIdx)
     1851{
     1852  RefPicList eRefPicList = iRefList > 0? REF_PIC_LIST_1: REF_PIC_LIST_0;
     1853  assert(eRefPicList == REF_PIC_LIST_1);
     1854
     1855  Bool checkZeroMVILR = true;
     1856
     1857  if(getSlice()->getRefPic(eRefPicList, iRefIdx)->getIsILR())
     1858  {
     1859    AMVPInfo* pcAMVPInfo = getCUMvField(eRefPicList)->getAMVPInfo();
     1860    TComMv    cMv        = pcAMVPInfo->m_acMvCand[MvpIdx];
     1861    checkZeroMVILR &= (cMv.getHor() == 0 && cMv.getVer() == 0);
     1862  }
     1863
     1864  return checkZeroMVILR;
     1865}
     1866#endif
    17541867
    17551868UInt TComDataCU::getCtxSkipFlag( UInt uiAbsPartIdx )
     
    24062519  deriveLeftRightTopIdxGeneral( uiAbsPartIdx, uiPUIdx, uiPartIdxLT, uiPartIdxRT );
    24072520  deriveLeftBottomIdxGeneral  ( uiAbsPartIdx, uiPUIdx, uiPartIdxLB );
     2521#if SVC_MVP
     2522  // BL collocated
     2523  TComDataCU *pcColCU = 0;
     2524  UInt uiCUAddrBase, uiAbsPartAddrBase ;
     2525  TComMvField cMvFieldBaseColCU[2];
     2526  if(m_layerId) 
     2527  {
     2528#if MV_SCALING_POS_FIX
     2529    pcColCU = getBaseColCU( xP + nPSW/2, yP + nPSH/2, uiCUAddrBase, uiAbsPartAddrBase );
     2530#else
     2531    UInt uiPartIdxCenter;
     2532    xDeriveCenterIdx( cCurPS, uiPUIdx, uiPartIdxCenter );
     2533    uiPartIdxCenter -= m_uiAbsIdxInLCU;
     2534    pcColCU = getBaseColCU( uiPartIdxCenter, uiCUAddrBase, uiAbsPartAddrBase );
     2535#endif
     2536   
     2537#if INTRA_BL
     2538    if( pcColCU && pcColCU->isIntraBL( uiAbsPartAddrBase ) )
     2539    {
     2540      pcColCU = NULL;
     2541    }
     2542#endif
     2543   
     2544    if(pcColCU && !pcColCU->isIntra( uiAbsPartAddrBase ) )
     2545    {
     2546      abCandIsInter[iCount] = true;
     2547
     2548      // get interDir
     2549      puhInterDirNeighbours[iCount] = pcColCU->getInterDir( uiAbsPartAddrBase );
     2550
     2551      pcMvFieldNeighbours[(iCount << 1)].setMvField( TComMv(0,0), -1);
     2552      pcMvFieldNeighbours[(iCount << 1) + 1].setMvField( TComMv(0,0), -1);
     2553
     2554      if( puhInterDirNeighbours[iCount] & 1 )
     2555      {
     2556        pcColCU->getMvField( pcColCU, uiAbsPartAddrBase, REF_PIC_LIST_0, cMvFieldBaseColCU[0]);
     2557        scaleBaseMV( pcMvFieldNeighbours[iCount<<1], cMvFieldBaseColCU[0] );
     2558      }
     2559
     2560      if ( getSlice()->isInterB() && puhInterDirNeighbours[iCount] & 2 )
     2561      {
     2562        pcColCU->getMvField( pcColCU, uiAbsPartAddrBase, REF_PIC_LIST_1, cMvFieldBaseColCU[1] );
     2563        scaleBaseMV( pcMvFieldNeighbours[(iCount<<1)+1], cMvFieldBaseColCU[1] );
     2564      }
     2565
     2566      if( puhInterDirNeighbours[iCount] > 0 )
     2567      {
     2568        if ( mrgCandIdx == iCount )
     2569        {
     2570          return;
     2571        }
     2572        iCount ++;
     2573      }
     2574    }
     2575  }
     2576#endif
    24082577
    24092578  //left
     
    24112580  TComDataCU* pcCULeft = 0;
    24122581  pcCULeft = getPULeft( uiLeftPartIdx, uiPartIdxLB );
     2582#if INTRA_BL
     2583  if( pcCULeft && pcCULeft->isIntraBL( uiLeftPartIdx ) )
     2584  {
     2585    pcCULeft = NULL;
     2586  }
     2587#endif
    24132588  Bool isAvailableA1 = pcCULeft &&
    24142589  pcCULeft->isDiffMER(xP -1, yP+nPSH-1, xP, yP) &&
     2590#if SVC_MVP
     2591  ( !pcColCU || pcColCU->isIntra( uiAbsPartAddrBase ) || !pcCULeft->hasEqualMotion( uiLeftPartIdx, puhInterDirNeighbours[0], &pcMvFieldNeighbours[0])) &&
     2592#endif
    24152593  !( uiPUIdx == 1 && (cCurPS == SIZE_Nx2N || cCurPS == SIZE_nLx2N || cCurPS == SIZE_nRx2N) ) &&
    24162594  !pcCULeft->isIntra( uiLeftPartIdx ) ;
     
    24422620  TComDataCU* pcCUAbove = 0;
    24432621  pcCUAbove = getPUAbove( uiAbovePartIdx, uiPartIdxRT );
     2622#if INTRA_BL
     2623  if( pcCUAbove && pcCUAbove->isIntraBL( uiAbovePartIdx ) )
     2624  {
     2625    pcCUAbove = NULL;
     2626  }
     2627#endif
    24442628  Bool isAvailableB1 = pcCUAbove &&
     2629#if SVC_MVP
     2630  ( !pcColCU || pcColCU->isIntra( uiAbsPartAddrBase ) || !pcCUAbove->hasEqualMotion( uiAbovePartIdx, puhInterDirNeighbours[0], &pcMvFieldNeighbours[0] )) &&
     2631#endif
    24452632  pcCUAbove->isDiffMER(xP+nPSW-1, yP-1, xP, yP) &&
    24462633  !( uiPUIdx == 1 && (cCurPS == SIZE_2NxN || cCurPS == SIZE_2NxnU || cCurPS == SIZE_2NxnD) ) &&
     
    24732660  TComDataCU* pcCUAboveRight = 0;
    24742661  pcCUAboveRight = getPUAboveRight( uiAboveRightPartIdx, uiPartIdxRT );
     2662#if INTRA_BL
     2663  if( pcCUAboveRight && pcCUAboveRight->isIntraBL( uiAboveRightPartIdx ) )
     2664  {
     2665    pcCUAboveRight = NULL;
     2666  }
     2667#endif
    24752668  Bool isAvailableB0 = pcCUAboveRight &&
     2669#if SVC_MVP
     2670  ( !pcColCU || pcColCU->isIntra( uiAbsPartAddrBase ) || !pcCUAboveRight->hasEqualMotion( uiAboveRightPartIdx, puhInterDirNeighbours[0], &pcMvFieldNeighbours[0] )) &&
     2671#endif
    24762672  pcCUAboveRight->isDiffMER(xP+nPSW, yP-1, xP, yP) &&
    24772673  !pcCUAboveRight->isIntra( uiAboveRightPartIdx );
     
    25002696
    25012697  //left bottom
     2698#if SVC_MVP
     2699  if( iCount < 4 )
     2700  {
     2701#endif
    25022702  UInt uiLeftBottomPartIdx = 0;
    25032703  TComDataCU* pcCULeftBottom = 0;
    25042704  pcCULeftBottom = this->getPUBelowLeft( uiLeftBottomPartIdx, uiPartIdxLB );
     2705#if INTRA_BL
     2706  if( pcCULeftBottom && pcCULeftBottom->isIntraBL( uiLeftBottomPartIdx ) )
     2707  {
     2708    pcCULeftBottom = NULL;
     2709  }
     2710#endif
    25052711  Bool isAvailableA0 = pcCULeftBottom &&
    25062712  pcCULeftBottom->isDiffMER(xP-1, yP+nPSH, xP, yP) &&
     2713#if SVC_MVP
     2714  ( !pcColCU || pcColCU->isIntra( uiAbsPartAddrBase ) || !pcCULeftBottom->hasEqualMotion( uiLeftBottomPartIdx, puhInterDirNeighbours[0], &pcMvFieldNeighbours[0]))
     2715#endif
    25072716  !pcCULeftBottom->isIntra( uiLeftBottomPartIdx ) ;
    25082717  if ( isAvailableA0 && ( !isAvailableA1 || !pcCULeft->hasEqualMotion( uiLeftPartIdx, pcCULeftBottom, uiLeftBottomPartIdx ) ) )
     
    25282737    return;
    25292738  }
     2739#if SVC_MVP
     2740  }
     2741#endif
     2742
    25302743  // above left
    25312744  if( iCount < 4 )
     
    25342747    TComDataCU* pcCUAboveLeft = 0;
    25352748    pcCUAboveLeft = getPUAboveLeft( uiAboveLeftPartIdx, uiAbsPartAddr );
     2749#if INTRA_BL
     2750    if( pcCUAboveLeft && pcCUAboveLeft->isIntraBL( uiAboveLeftPartIdx ) )
     2751    {
     2752      pcCUAboveLeft = NULL;
     2753    }
     2754#endif
    25362755    Bool isAvailableB2 = pcCUAboveLeft &&
    25372756    pcCUAboveLeft->isDiffMER(xP-1, yP-1, xP, yP) &&
     2757#if SVC_MVP
     2758    ( !pcColCU || pcColCU->isIntra( uiAbsPartAddrBase ) || !pcCUAboveLeft->hasEqualMotion( uiAboveLeftPartIdx, puhInterDirNeighbours[0], &pcMvFieldNeighbours[0] ))
     2759#endif
    25382760    !pcCUAboveLeft->isIntra( uiAboveLeftPartIdx );
    25392761    if ( isAvailableB2 && ( !isAvailableA1 || !pcCULeft->hasEqualMotion( uiLeftPartIdx, pcCUAboveLeft, uiAboveLeftPartIdx ) )
     
    28403062  UInt idx;
    28413063  tmpCU = getPUBelowLeft(idx, uiPartIdxLB);
     3064#if INTRA_BL
     3065  bAddedSmvp = (tmpCU != NULL) && (!tmpCU->isIntra(idx));
     3066#else
    28423067  bAddedSmvp = (tmpCU != NULL) && (tmpCU->getPredictionMode(idx) != MODE_INTRA);
     3068#endif
    28433069
    28443070  if (!bAddedSmvp)
    28453071  {
    28463072    tmpCU = getPULeft(idx, uiPartIdxLB);
     3073#if INTRA_BL
     3074    bAddedSmvp = (tmpCU != NULL) && (!tmpCU->isIntra(idx));
     3075#else
    28473076    bAddedSmvp = (tmpCU != NULL) && (tmpCU->getPredictionMode(idx) != MODE_INTRA);
     3077#endif
    28483078  }
    28493079
     
    34063636  if (scaleFactor > 0)
    34073637  {
     3638#if SVC_MVP
     3639    m_acCUMvField[0].compress(m_pePredMode, m_puhInterDir, scaleFactor);
     3640    m_acCUMvField[1].compress(m_pePredMode, m_puhInterDir, scaleFactor);   
     3641#else
    34083642    m_acCUMvField[0].compress(m_pePredMode, scaleFactor);
    34093643    m_acCUMvField[1].compress(m_pePredMode, scaleFactor);   
     3644#endif
    34103645  }
    34113646}
     
    38394074}
    38404075
     4076#if INTRA_BL && !NO_RESIDUAL_FLAG_FOR_BLPRED
     4077Void TComDataCU::getBaseLumaBlk ( UInt uiWidth, UInt uiHeight, UInt uiAbsPartIdx, Pel* piPred, UInt uiStride )
     4078{
     4079  TComPicYuv* pcBaseRec = getSlice()->getFullPelBaseRec();
     4080  UInt uiStrideBase = pcBaseRec->getStride();
     4081  Pel* piBase = pcBaseRec->getLumaAddr( getAddr(), getZorderIdxInCU() + uiAbsPartIdx );
     4082 
     4083  for ( UInt y = 0; y < uiHeight; y ++ )
     4084  {
     4085    memcpy( piPred + y * uiStride, piBase + y * uiStrideBase, uiWidth * sizeof( Pel ) );
     4086  }
     4087}
     4088
     4089Void TComDataCU::getBaseChromaBlk ( UInt uiWidth, UInt uiHeight, UInt uiAbsPartIdx, Pel* piPred, UInt uiStride, UInt uiChromaId )
     4090{
     4091  TComPicYuv* pcBaseRec = getSlice()->getFullPelBaseRec();
     4092
     4093  UInt uiStrideBase = pcBaseRec->getCStride();
     4094  Pel* piBase;
     4095 
     4096  if( uiChromaId == 0 )
     4097  {
     4098    piBase = pcBaseRec->getCbAddr( getAddr(), getZorderIdxInCU() + uiAbsPartIdx );
     4099  }
     4100  else
     4101  {
     4102    piBase = pcBaseRec->getCrAddr( getAddr(), getZorderIdxInCU() + uiAbsPartIdx );
     4103  }
     4104 
     4105  for ( UInt y = 0; y < uiHeight; y ++ )
     4106  {
     4107    memcpy( piPred + y * uiStride, piBase + y * uiStrideBase, uiWidth * sizeof( Pel ) );
     4108  }
     4109}
     4110
     4111#endif
     4112
     4113#if SVC_COL_BLK
     4114TComDataCU*  TComDataCU::getBaseColCU( UInt uiCuAbsPartIdx, UInt &uiCUAddrBase, UInt &uiAbsPartIdxBase )
     4115{
     4116#if 1 // it should provide identical resutls
     4117  UInt uiPelX = getCUPelX() + g_auiRasterToPelX[ g_auiZscanToRaster[uiCuAbsPartIdx] ];
     4118  UInt uiPelY = getCUPelY() + g_auiRasterToPelY[ g_auiZscanToRaster[uiCuAbsPartIdx] ];
     4119
     4120  return getBaseColCU( uiPelX, uiPelY, uiCUAddrBase, uiAbsPartIdxBase );
     4121#else
     4122  TComPic* cBaseColPic = m_pcSlice->getBaseColPic();
     4123
     4124#if SVC_UPSAMPLING
     4125  Int iBWidth   = cBaseColPic->getPicYuvRec()->getWidth () - cBaseColPic->getPicYuvRec()->getPicCropLeftOffset() - cBaseColPic->getPicYuvRec()->getPicCropRightOffset();
     4126  Int iBHeight  = cBaseColPic->getPicYuvRec()->getHeight() - cBaseColPic->getPicYuvRec()->getPicCropTopOffset() - cBaseColPic->getPicYuvRec()->getPicCropBottomOffset();
     4127
     4128  Int iEWidth   = m_pcPic->getPicYuvRec()->getWidth() - m_pcPic->getPicYuvRec()->getPicCropLeftOffset() - m_pcPic->getPicYuvRec()->getPicCropRightOffset();
     4129  Int iEHeight  = m_pcPic->getPicYuvRec()->getHeight() - m_pcPic->getPicYuvRec()->getPicCropTopOffset() - m_pcPic->getPicYuvRec()->getPicCropBottomOffset();
     4130#else
     4131  Int iBWidth   = cBaseColPic->getPicYuvRec()->getWidth();
     4132  Int iBHeight  = cBaseColPic->getPicYuvRec()->getHeight();
     4133
     4134  Int iEWidth   = m_pcPic->getPicYuvRec()->getWidth();
     4135  Int iEHeight  = m_pcPic->getPicYuvRec()->getHeight();
     4136#endif
     4137
     4138  if (iBWidth == iEWidth && iEHeight == iBHeight)
     4139  {
     4140    uiAbsPartIdxBase = uiCuAbsPartIdx + m_uiAbsIdxInLCU;
     4141    uiCUAddrBase = m_uiCUAddr;
     4142  }
     4143  else
     4144  {
     4145    UInt uiMinUnitSize = m_pcPic->getMinCUWidth();
     4146    UInt uiRasterAddr  = g_auiZscanToRaster[uiCuAbsPartIdx];
     4147    UInt uiNumPartInCUWidth = m_pcPic->getNumPartInWidth();
     4148
     4149    Int iEX = m_uiCUPelX + uiMinUnitSize*(uiRasterAddr%uiNumPartInCUWidth);
     4150    Int iEY = m_uiCUPelY + uiMinUnitSize*(uiRasterAddr/uiNumPartInCUWidth);
     4151
     4152    Int iBX = (iEX*iBWidth + iEWidth/2)/iEWidth;
     4153    Int iBY = (iEY*iBHeight+ iEHeight/2)/iEHeight;
     4154
     4155    uiCUAddrBase = (iBY/g_uiMaxCUHeight)*cBaseColPic->getFrameWidthInCU() + (iBX/g_uiMaxCUWidth);
     4156
     4157    assert(uiCUAddrBase < cBaseColPic->getNumCUsInFrame());
     4158   
     4159    UInt uiRasterAddrBase = (iBY - (iBY/g_uiMaxCUHeight)*g_uiMaxCUHeight)/uiMinUnitSize*cBaseColPic->getNumPartInWidth()
     4160                          + (iBX - (iBX/g_uiMaxCUWidth)*g_uiMaxCUWidth)/uiMinUnitSize;
     4161
     4162    uiAbsPartIdxBase = g_auiRasterToZscan[uiRasterAddrBase];
     4163  }
     4164
     4165  return cBaseColPic->getCU(uiCUAddrBase);
     4166#endif
     4167}
     4168
     4169TComDataCU*  TComDataCU::getBaseColCU( UInt uiPelX, UInt uiPelY, UInt &uiCUAddrBase, UInt &uiAbsPartIdxBase )
     4170{
     4171  TComPic* cBaseColPic = m_pcSlice->getBaseColPic();
     4172
     4173#if SVC_UPSAMPLING
     4174  const Window &confBL = cBaseColPic->getPicYuvRec()->getConformanceWindow();
     4175  const Window &confEL = m_pcPic->getPicYuvRec()->getConformanceWindow();
     4176
     4177  Int iBWidth   = m_pcSlice->getBaseColPic()->getPicYuvRec()->getWidth () - confBL.getWindowLeftOffset() - confBL.getWindowRightOffset();
     4178  Int iBHeight  = m_pcSlice->getBaseColPic()->getPicYuvRec()->getHeight() - confBL.getWindowTopOffset() - confBL.getWindowBottomOffset();
     4179
     4180  Int iEWidth   = m_pcPic->getPicYuvRec()->getWidth() - confEL.getWindowLeftOffset() - confEL.getWindowRightOffset();
     4181  Int iEHeight  = m_pcPic->getPicYuvRec()->getHeight() - confEL.getWindowTopOffset() - confEL.getWindowBottomOffset();
     4182#else
     4183  Int iBWidth   = cBaseColPic->getPicYuvRec()->getWidth();
     4184  Int iBHeight  = cBaseColPic->getPicYuvRec()->getHeight();
     4185
     4186  Int iEWidth   = m_pcPic->getPicYuvRec()->getWidth();
     4187  Int iEHeight  = m_pcPic->getPicYuvRec()->getHeight();
     4188#endif
     4189
     4190  uiPelX = (UInt)Clip3<UInt>(0, m_pcPic->getPicYuvRec()->getWidth() - 1, uiPelX);
     4191  uiPelY = (UInt)Clip3<UInt>(0, m_pcPic->getPicYuvRec()->getHeight() - 1, uiPelY);
     4192
     4193  UInt uiMinUnitSize = m_pcPic->getMinCUWidth();
     4194
     4195  Int iBX = (uiPelX*iBWidth + iEWidth/2)/iEWidth;
     4196  Int iBY = (uiPelY*iBHeight+ iEHeight/2)/iEHeight;
     4197
     4198  if ( iBX >= cBaseColPic->getPicYuvRec()->getWidth() || iBY >= cBaseColPic->getPicYuvRec()->getHeight())
     4199  {
     4200    return NULL;
     4201  }
     4202
     4203#if AVC_SYNTAX
     4204  if( iBX >= iBWidth || iBY >= iBHeight ) //outside of the reference layer cropped picture
     4205  {
     4206    return NULL;
     4207  }
     4208#endif
     4209
     4210  uiCUAddrBase = (iBY/g_uiMaxCUHeight)*cBaseColPic->getFrameWidthInCU() + (iBX/g_uiMaxCUWidth);
     4211
     4212  assert(uiCUAddrBase < cBaseColPic->getNumCUsInFrame());
     4213
     4214  UInt uiRasterAddrBase = (iBY - (iBY/g_uiMaxCUHeight)*g_uiMaxCUHeight)/uiMinUnitSize*cBaseColPic->getNumPartInWidth()
     4215    + (iBX - (iBX/g_uiMaxCUWidth)*g_uiMaxCUWidth)/uiMinUnitSize;
     4216
     4217  uiAbsPartIdxBase = g_auiRasterToZscan[uiRasterAddrBase];
     4218
     4219  return cBaseColPic->getCU(uiCUAddrBase);
     4220}
     4221
     4222Void TComDataCU::scaleBaseMV( TComMvField& rcMvFieldEnhance, TComMvField& rcMvFieldBase )
     4223{
     4224  TComMvField cMvFieldBase;
     4225  TComMv cMv;
     4226
     4227#if MV_SCALING_FIX
     4228  const Window &confBL = m_pcSlice->getBaseColPic()->getPicYuvRec()->getConformanceWindow();
     4229  const Window &confEL = m_pcPic->getPicYuvRec()->getConformanceWindow();
     4230
     4231  Int iBWidth   = m_pcSlice->getBaseColPic()->getPicYuvRec()->getWidth () - confBL.getWindowLeftOffset() - confBL.getWindowRightOffset();
     4232  Int iBHeight  = m_pcSlice->getBaseColPic()->getPicYuvRec()->getHeight() - confBL.getWindowTopOffset() - confBL.getWindowBottomOffset();
     4233
     4234  Int iEWidth   = m_pcPic->getPicYuvRec()->getWidth() - confEL.getWindowLeftOffset() - confEL.getWindowRightOffset();
     4235  Int iEHeight  = m_pcPic->getPicYuvRec()->getHeight() - confEL.getWindowTopOffset() - confEL.getWindowBottomOffset();
     4236#else
     4237  Int iBWidth   = m_pcSlice->getBaseColPic()->getPicYuvRec()->getWidth();
     4238  Int iBHeight  = m_pcSlice->getBaseColPic()->getPicYuvRec()->getHeight();
     4239
     4240  Int iEWidth   = m_pcPic->getPicYuvRec()->getWidth();
     4241  Int iEHeight  = m_pcPic->getPicYuvRec()->getHeight();
     4242#endif
     4243
     4244  Int iMvX = (rcMvFieldBase.getHor()*iEWidth + (iBWidth/2 -1) * (rcMvFieldBase.getHor() > 0 ? 1: -1) )/iBWidth;
     4245  Int iMvY = (rcMvFieldBase.getVer()*iEHeight + (iBHeight/2 -1) * (rcMvFieldBase.getVer() > 0 ? 1: -1) )/iBHeight;
     4246
     4247  cMv.set(iMvX, iMvY);
     4248
     4249  rcMvFieldEnhance.setMvField( cMv, rcMvFieldBase.getRefIdx() );
     4250}
     4251#endif
     4252
     4253#if SVC_MVP
     4254Bool TComDataCU::hasEqualMotion( UInt uiAbsPartIdx, UChar uchInterDir, TComMvField* pcMvField  )
     4255{
     4256  if ( getInterDir( uiAbsPartIdx ) != uchInterDir )
     4257  {
     4258    return false;
     4259  }
     4260
     4261  for ( UInt uiRefListIdx = 0; uiRefListIdx < 2; uiRefListIdx++ )
     4262  {
     4263    if ( getInterDir( uiAbsPartIdx ) & ( 1 << uiRefListIdx ) )
     4264    {
     4265      if ( getCUMvField( RefPicList( uiRefListIdx ) )->getMv( uiAbsPartIdx )  != pcMvField[uiRefListIdx].getMv() ||
     4266        getCUMvField( RefPicList( uiRefListIdx ) )->getRefIdx( uiAbsPartIdx ) != pcMvField[uiRefListIdx].getRefIdx() )
     4267      {
     4268        return false;
     4269      }
     4270    }
     4271  }
     4272
     4273  return true;
     4274}
     4275#endif
    38414276
    38424277//! \}
  • branches/HM-10.0-dev-SHM/source/Lib/TLibCommon/TComDataCU.h

    r51 r54  
    125125  Int           m_unitSize;           ///< size of a "minimum partition"
    126126 
     127#if SVC_EXTENSION
     128  UInt          m_layerId;          ///< layer id
     129#endif
     130
    127131  // -------------------------------------------------------------------------------------------------------------------
    128132  // CU data
     
    434438  Void          compressMV            ();
    435439 
     440#if SVC_EXTENSION
     441  Void          setLayerId (UInt layerId) { m_layerId = layerId; }
     442  UInt          getLayerId ()               { return m_layerId; }
     443#endif
     444 
    436445  // -------------------------------------------------------------------------------------------------------------------
    437446  // utility functions for neighbouring information
     
    476485  Void          deriveLeftBottomIdxGeneral    ( UInt uiAbsPartIdx, UInt uiPartIdx, UInt& ruiPartIdxLB );
    477486 
     487#if SVC_MVP
     488  Bool          hasEqualMotion              ( UInt uiAbsPartIdx, UChar uchInterDir, TComMvField* pcMvField  );
     489#endif
    478490 
    479491  // -------------------------------------------------------------------------------------------------------------------
     
    481493  // -------------------------------------------------------------------------------------------------------------------
    482494 
     495#if INTRA_BL && !NO_RESIDUAL_FLAG_FOR_BLPRED
     496  Void          getBaseLumaBlk   ( UInt uiWidth, UInt uiHeight, UInt uiAbsPartIdx, Pel* piPred, UInt uiStride );
     497  Void          getBaseChromaBlk ( UInt uiWidth, UInt uiHeight, UInt uiAbsPartIdx, Pel* piPred, UInt uiStride, UInt uiChromaId );
     498#endif
     499#if INTRA_BL
     500  Bool          isIntraBL ( UInt uiPartIdx )  { return m_pePredMode[ uiPartIdx ] == MODE_INTRA_BL; }
     501  Bool          isIntra   ( UInt uiPartIdx )  { return m_pePredMode[ uiPartIdx ] == MODE_INTRA || m_pePredMode[ uiPartIdx ] == MODE_INTRA_BL; }
     502#else
    483503  Bool          isIntra   ( UInt uiPartIdx )  { return m_pePredMode[ uiPartIdx ] == MODE_INTRA; }
     504#endif
    484505  Bool          isSkipped ( UInt uiPartIdx );                                                     ///< SKIP (no residual)
    485506  Bool          isBipredRestriction( UInt puIdx );
     
    507528  UInt          getSliceSegmentStartCU  ( UInt pos )                  { return m_sliceSegmentStartCU[pos-m_uiAbsIdxInLCU];                                                                                   }
    508529  UInt&         getTotalBins            ()                            { return m_uiTotalBins;                                                                                                  }
     530
     531#if INTRA_BL
     532  UInt          getCtxIntraBLFlag               ( UInt   uiAbsPartIdx                                 );
     533#endif 
     534
     535#if REF_IDX_ME_ZEROMV
     536  Bool xCheckZeroMVILRMerge(UChar uhInterDir, TComMvField& cMvFieldL0, TComMvField& cMvFieldL1);
     537  Bool xCheckZeroMVILRMvdL1Zero(Int iRefList, Int iRefIdx, Int MvpIdx);
     538#endif
     539
    509540  // -------------------------------------------------------------------------------------------------------------------
    510541  // member functions for RD cost storage
     
    518549  UInt          getCoefScanIdx(UInt uiAbsPartIdx, UInt uiWidth, Bool bIsLuma, Bool bIsIntra);
    519550
     551#if SVC_COL_BLK
     552  TComDataCU*   getBaseColCU( UInt uiCuAbsPartIdx, UInt &uiCUAddrBase, UInt &uiAbsPartIdxBase );
     553  TComDataCU*   getBaseColCU( UInt uiPelX, UInt uiPelY, UInt &uiCUAddrBase, UInt &uiAbsPartIdxBase );
     554  Void          scaleBaseMV( TComMvField& rcMvFieldEnhance, TComMvField& rcMvFieldBase );
     555#endif
    520556};
    521557
  • branches/HM-10.0-dev-SHM/source/Lib/TLibCommon/TComMotionInfo.cpp

    r51 r54  
    328328 * \param scale      Factor by which to subsample motion information
    329329 */
     330#if SVC_MVP
     331Void TComCUMvField::compress(Char* pePredMode, UChar* peInterDir, Int scale)
     332#else
    330333Void TComCUMvField::compress(Char* pePredMode, Int scale)
     334#endif
    331335{
    332336  Int N = scale * scale;
     
    347351      pePredMode[ uiPartIdx + i ] = predMode;
    348352      m_piRefIdx[ uiPartIdx + i ] = iRefIdx;
     353#if SVC_MVP
     354      peInterDir[ uiPartIdx + i ] = peInterDir[ uiPartIdx ];
     355#endif
    349356    }
    350357  }
  • branches/HM-10.0-dev-SHM/source/Lib/TLibCommon/TComMotionInfo.h

    r51 r54  
    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  {
     
    153158  }
    154159 
     160#if SVC_MVP
     161  Void compress(Char* pePredMode, UChar* peInterDir, Int scale);
     162#else
    155163  Void compress(Char* pePredMode, Int scale);
     164#endif
     165
     166#if REF_IDX_MFM
     167  Void setMvField( TComMvField const& mvField, Int iIdx )
     168  {
     169    m_pcMv[iIdx]      = mvField.getMv();
     170    m_piRefIdx[iIdx]  = mvField.getRefIdx();
     171    return;
     172  }
     173
     174  Void setMvField( TComMv cMv, Int iRefIdx, Int iIdx )
     175  {
     176    m_pcMv[iIdx]      = cMv;
     177    m_piRefIdx[iIdx]  = iRefIdx;
     178    return;
     179  }
     180#endif
    156181};
    157182
  • branches/HM-10.0-dev-SHM/source/Lib/TLibCommon/TComPic.cpp

    r51 r54  
    6464, m_pNDBFilterYuvTmp                      (NULL)
    6565, m_bCheckLTMSB                           (false)
     66#if SVC_EXTENSION
     67, m_layerId( 0 )
     68, m_bSpatialEnhLayer( false )
     69, m_pcFullPelBaseRec( NULL )
     70#if REF_IDX_ME_AROUND_ZEROMV || REF_IDX_ME_ZEROMV || ENCODER_FAST_MODE || REF_IDX_MFM
     71, m_bIsILR                                (false)
     72#endif
     73#endif
    6674{
    6775  m_apcPicYuv[0]      = NULL;
     
    7280{
    7381}
    74 
     82#if SVC_UPSAMPLING
     83Void TComPic::create( Int iWidth, Int iHeight, UInt uiMaxWidth, UInt uiMaxHeight, UInt uiMaxDepth, Window &conformanceWindow, Window &defaultDisplayWindow,
     84                      Int *numReorderPics, TComSPS* pcSps, Bool bIsVirtual)
     85
     86{
     87  m_apcPicSym     = new TComPicSym;  m_apcPicSym   ->create( iWidth, iHeight, uiMaxWidth, uiMaxHeight, uiMaxDepth );
     88  if (!bIsVirtual)
     89  {
     90    m_apcPicYuv[0]  = new TComPicYuv;  m_apcPicYuv[0]->create( iWidth, iHeight, uiMaxWidth, uiMaxHeight, uiMaxDepth, pcSps );
     91  }
     92  m_apcPicYuv[1]  = new TComPicYuv;  m_apcPicYuv[1]->create( iWidth, iHeight, uiMaxWidth, uiMaxHeight, uiMaxDepth, pcSps );
     93
     94  if (m_bSpatialEnhLayer)
     95  {
     96    m_pcFullPelBaseRec = new TComPicYuv;  m_pcFullPelBaseRec->create( iWidth, iHeight, uiMaxWidth, uiMaxHeight, uiMaxDepth, pcSps );
     97  }
     98
     99  m_layerId = pcSps->getLayerId(); 
     100
     101  // there are no SEI messages associated with this picture initially
     102  if (m_SEIs.size() > 0)
     103  {
     104    deleteSEIs (m_SEIs);
     105  }
     106  m_bUsedByCurr = false;
     107
     108  /* store conformance window parameters with picture */
     109  m_conformanceWindow = conformanceWindow;
     110 
     111  /* store display window parameters with picture */
     112  m_defaultDisplayWindow = defaultDisplayWindow;
     113
     114  /* store number of reorder pics with picture */
     115  memcpy(m_numReorderPics, numReorderPics, MAX_TLAYER*sizeof(Int));
     116
     117  return;
     118}
     119#if REF_IDX_FRAMEWORK
     120Void TComPic::createWithOutYuv( Int iWidth, Int iHeight, UInt uiMaxWidth, UInt uiMaxHeight, UInt uiMaxDepth, TComSPS* pcSps,  Bool bIsVirtual)
     121{
     122  m_apcPicSym     = new TComPicSym;  m_apcPicSym   ->create( iWidth, iHeight, uiMaxWidth, uiMaxHeight, uiMaxDepth );
     123  if (!bIsVirtual)
     124  {
     125    m_apcPicYuv[0]  = new TComPicYuv;  m_apcPicYuv[0]->create( iWidth, iHeight, uiMaxWidth, uiMaxHeight, uiMaxDepth, pcSps );
     126  }
     127  m_apcPicYuv[1]  = NULL;
     128 
     129#if SVC_UPSAMPLING
     130  if (m_bSpatialEnhLayer)
     131  {
     132    m_pcFullPelBaseRec = new TComPicYuv;  m_pcFullPelBaseRec->create( iWidth, iHeight, uiMaxWidth, uiMaxHeight, uiMaxDepth, pcSps );
     133  }
     134#endif
     135
     136  /* there are no SEI messages associated with this picture initially */
     137  m_SEIs = NULL;
     138  m_bUsedByCurr = false;
     139  return;
     140}
     141#endif
     142#else
    75143Void TComPic::create( Int iWidth, Int iHeight, UInt uiMaxWidth, UInt uiMaxHeight, UInt uiMaxDepth, Window &conformanceWindow, Window &defaultDisplayWindow,
    76144                      Int *numReorderPics, Bool bIsVirtual)
     
    102170  return;
    103171}
     172#endif
    104173
    105174Void TComPic::destroy()
     
    127196 
    128197  deleteSEIs(m_SEIs);
     198#if SVC_EXTENSION && SVC_UPSAMPLING
     199  if (m_bSpatialEnhLayer)
     200  {
     201    m_pcFullPelBaseRec->destroy();
     202    delete m_pcFullPelBaseRec;
     203    m_pcFullPelBaseRec  = NULL;
     204  }
     205#endif
    129206}
    130207
     
    465542}
    466543
     544#if REF_IDX_FRAMEWORK
     545Void copyOnetoOnePicture(    // SVC_NONCOLL
     546                  Pel *in,       
     547                  Pel *out,     
     548                  Int nCols,
     549                  Int nRows,
     550                  Int fullRowWidth)
     551{
     552  Int rX;
     553
     554  for (rX = 0; rX < nRows; rX++)       
     555  {
     556    memcpy( out, in, sizeof(Pel) * nCols );
     557    in = in + fullRowWidth;
     558    out = out + fullRowWidth;
     559  }
     560}
     561
     562Void TComPic:: copyUpsampledPictureYuv(TComPicYuv*   pcPicYuvIn, TComPicYuv*   pcPicYuvOut)
     563{
     564  Int upsampledRowWidthLuma = pcPicYuvOut->getStride(); // 2 * pcPicYuvOut->getLumaMargin() + pcPicYuvOut->getWidth();
     565  Int upsampledRowWidthCroma = pcPicYuvOut->getCStride(); //2 * pcPicYuvOut->getChromaMargin() + (pcPicYuvOut->getWidth()>>1);
     566
     567  copyOnetoOnePicture(
     568    pcPicYuvIn->getLumaAddr(),       
     569    pcPicYuvOut->getLumaAddr(),     
     570    pcPicYuvOut->getWidth(),
     571    pcPicYuvOut->getHeight(),
     572    upsampledRowWidthLuma);
     573  copyOnetoOnePicture(
     574    pcPicYuvIn->getCrAddr(),       
     575    pcPicYuvOut->getCrAddr(),     
     576    pcPicYuvOut->getWidth()>>1,
     577    pcPicYuvOut->getHeight()>>1,
     578    upsampledRowWidthCroma);
     579  copyOnetoOnePicture(
     580    pcPicYuvIn->getCbAddr(),       
     581    pcPicYuvOut->getCbAddr(),     
     582    pcPicYuvOut->getWidth()>>1,
     583    pcPicYuvOut->getHeight()>>1,
     584    upsampledRowWidthCroma);
     585}
     586
     587#if REF_IDX_MFM
     588#if !REUSE_BLKMAPPING
     589Void TComPic::deriveUnitIdxBase( UInt uiUpsamplePelX, UInt uiUpsamplePelY, UInt ratio, UInt& uiBaseCUAddr, UInt& uiBaseAbsPartIdx )
     590{
     591  //pixel in the base layer
     592
     593  UInt uiPelX       = (uiUpsamplePelX<<1)/ratio;
     594  UInt uiPelY       = (uiUpsamplePelY<<1)/ratio;
     595  UInt uiBaseWidth  = getPicYuvRec()->getWidth();
     596  UInt uiBaseHeight = getPicYuvRec()->getHeight();
     597 
     598  UInt uiWidthInCU       = ( uiBaseWidth % g_uiMaxCUWidth  ) ? uiBaseWidth /g_uiMaxCUWidth  + 1 : uiBaseWidth /g_uiMaxCUWidth;
     599
     600#if MFM_CLIPPING_FIX
     601  uiPelX     = (UInt)Clip3<UInt>(0, getPicYuvRec()->getWidth() - 1, uiPelX);
     602  uiPelY     = (UInt)Clip3<UInt>(0, getPicYuvRec()->getHeight() - 1, uiPelY);
     603#else
     604  UInt uiHeightInCU      = ( uiBaseHeight% g_uiMaxCUHeight ) ? uiBaseHeight/ g_uiMaxCUHeight + 1 : uiBaseHeight/ g_uiMaxCUHeight;
     605
     606  uiPelX     = (UInt)Clip3<UInt>(0, uiWidthInCU * g_uiMaxCUWidth - 1, uiPelX);
     607  uiPelY     = (UInt)Clip3<UInt>(0, uiHeightInCU * g_uiMaxCUHeight - 1, uiPelY);
     608#endif
     609 
     610  uiBaseCUAddr = uiPelY / g_uiMaxCUHeight * uiWidthInCU + uiPelX / g_uiMaxCUWidth;
     611
     612  UInt uiWidthMinPU = g_uiMaxCUWidth / (1<<g_uiMaxCUDepth);
     613  UInt uiHeightMinPU = g_uiMaxCUHeight/(1<<g_uiMaxCUDepth);
     614 
     615  UInt uiAbsPelX = uiPelX - (uiPelX / g_uiMaxCUWidth) * g_uiMaxCUWidth;
     616  UInt uiAbsPelY = uiPelY - (uiPelY / g_uiMaxCUHeight) * g_uiMaxCUHeight;
     617
     618  UInt RasterIdx = uiAbsPelY / uiHeightMinPU * (g_uiMaxCUWidth/uiWidthMinPU) + uiAbsPelX / uiWidthMinPU;
     619  uiBaseAbsPartIdx = g_auiRasterToZscan[RasterIdx];
     620
     621  return;
     622}
     623#endif
     624
     625Void TComPic::copyUpsampledMvField(TComPic* pcPicBase)
     626{
     627#if !REUSE_MVSCALE || !REUSE_BLKMAPPING || AVC_SYNTAX
     628  Int iBWidth   = pcPicBase->getPicYuvRec()->getWidth () - pcPicBase->getPicYuvRec()->getPicCropLeftOffset() - pcPicBase->getPicYuvRec()->getPicCropRightOffset();
     629  Int iBHeight  = pcPicBase->getPicYuvRec()->getHeight() - pcPicBase->getPicYuvRec()->getPicCropTopOffset() - pcPicBase->getPicYuvRec()->getPicCropBottomOffset();
     630
     631  Int iEWidth   = getPicYuvRec()->getWidth() -  getPicYuvRec()->getPicCropLeftOffset() - getPicYuvRec()->getPicCropRightOffset();
     632  Int iEHeight  = getPicYuvRec()->getHeight() - getPicYuvRec()->getPicCropTopOffset() -  getPicYuvRec()->getPicCropBottomOffset();
     633#endif
     634 
     635#if !REUSE_MVSCALE  || !REUSE_BLKMAPPING
     636  UInt upSampleRatio = 0;
     637  if(iEWidth == iBWidth && iEHeight == iBHeight)
     638  {
     639    upSampleRatio = 2;
     640  }
     641  else if(2*iEWidth == 3*iBWidth && 2*iEHeight == 3*iBHeight)
     642  {
     643    upSampleRatio = 3;
     644  }
     645  else if(iEWidth == 2*iBWidth && iEHeight == 2*iBHeight)
     646  {
     647    upSampleRatio = 4;
     648  }
     649  else
     650  {
     651    assert(0);
     652  }
     653#endif
     654
     655  UInt uiNumPartitions   = 1<<(g_uiMaxCUDepth<<1);
     656  UInt uiWidthMinPU      = g_uiMaxCUWidth/(1<<g_uiMaxCUDepth);
     657  UInt uiHeightMinPU     = g_uiMaxCUHeight/(1<<g_uiMaxCUDepth);
     658  Int  unitNum           = max (1, (Int)((16/uiWidthMinPU)*(16/uiHeightMinPU)) );
     659
     660  for(UInt cuIdx = 0; cuIdx < getPicSym()->getNumberOfCUsInFrame(); cuIdx++)  //each LCU
     661  {
     662    TComDataCU*             pcCUDes = getCU(cuIdx);
     663
     664    for(UInt uiAbsPartIdx = 0; uiAbsPartIdx < uiNumPartitions; uiAbsPartIdx+=unitNum )  //each 16x16 unit
     665    {
     666      //pixel position of each unit in up-sampled layer
     667      UInt  uiPelX = pcCUDes->getCUPelX() + g_auiRasterToPelX[ g_auiZscanToRaster[uiAbsPartIdx] ];
     668      UInt  uiPelY = pcCUDes->getCUPelY() + g_auiRasterToPelY[ g_auiZscanToRaster[uiAbsPartIdx] ];
     669      UInt uiBaseCUAddr, uiBaseAbsPartIdx;
     670
     671#if REUSE_BLKMAPPING
     672      TComDataCU *pcColCU = 0;
     673      pcColCU = pcCUDes->getBaseColCU(uiPelX + 8, uiPelY + 8, uiBaseCUAddr, uiBaseAbsPartIdx);
     674#else
     675      pcPicBase->deriveUnitIdxBase(uiPelX + 8, uiPelY + 8, upSampleRatio, uiBaseCUAddr, uiBaseAbsPartIdx);
     676#endif
     677
     678#if AVC_SYNTAX
     679      Int iBX = ( (uiPelX + 8) * iBWidth + iEWidth/2 ) / iEWidth;
     680      Int iBY = ( (uiPelY + 8) * iBHeight+ iEHeight/2 ) / iEHeight;
     681
     682#if REUSE_BLKMAPPING
     683      if( ( iBX < iBWidth && iBY < iBHeight ) && pcColCU && (pcColCU->getPredictionMode(uiBaseAbsPartIdx) != MODE_NONE) && (pcColCU->getPredictionMode(uiBaseAbsPartIdx) != MODE_INTRA) )  //base layer unit not skip and invalid mode
     684#else
     685      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
     686#endif
     687#else
     688#if REUSE_BLKMAPPING
     689      if( pcColCU && (pcColCU->getPredictionMode(uiBaseAbsPartIdx) != MODE_NONE) && (pcColCU->getPredictionMode(uiBaseAbsPartIdx) != MODE_INTRA) )  //base layer unit not skip and invalid mode
     690#else
     691      if( (pcPicBase->getCU(uiBaseCUAddr)->getPredictionMode(uiBaseAbsPartIdx) != MODE_NONE) && (pcPicBase->getCU(uiBaseCUAddr)->getPredictionMode(uiBaseAbsPartIdx) != MODE_INTRA) )  //base layer unit not skip and invalid mode
     692#endif
     693#endif
     694      {
     695        for(UInt refPicList = 0; refPicList < 2; refPicList++)  //for each reference list
     696        {
     697#if REUSE_MVSCALE
     698          TComMvField sMvFieldBase, sMvField;
     699#if REUSE_BLKMAPPING
     700          pcColCU->getMvField( pcColCU, uiBaseAbsPartIdx, (RefPicList)refPicList, sMvFieldBase);
     701#else
     702          pcPicBase->getCU(uiBaseCUAddr)->getMvField( pcPicBase->getCU(uiBaseCUAddr), uiBaseAbsPartIdx, (RefPicList)refPicList, sMvFieldBase);
     703#endif
     704          pcCUDes->scaleBaseMV( sMvField, sMvFieldBase );
     705#else
     706          TComMv cMv = pcPicBase->getCU(uiBaseCUAddr)->getCUMvField((RefPicList)refPicList)->getMv(uiBaseAbsPartIdx);
     707          Int refIdx = pcPicBase->getCU(uiBaseCUAddr)->getCUMvField((RefPicList)refPicList)->getRefIdx(uiBaseAbsPartIdx);
     708
     709          Int Hor =  ((Int)upSampleRatio * cMv.getHor())/2 ;
     710          Int Ver =  ((Int)upSampleRatio * cMv.getVer())/2 ;
     711
     712          TComMv cScaledMv(Hor, Ver);
     713          TComMvField sMvField;
     714          sMvField.setMvField(cScaledMv, refIdx);
     715#endif
     716
     717          pcCUDes->getCUMvField((RefPicList)refPicList)->setMvField(sMvField, uiAbsPartIdx);
     718          pcCUDes->setPredictionMode(uiAbsPartIdx, MODE_INTER);
     719        }
     720      }
     721      else
     722      {
     723        TComMvField zeroMvField;  //zero MV and invalid reference index
     724        pcCUDes->getCUMvField(REF_PIC_LIST_0)->setMvField(zeroMvField, uiAbsPartIdx);
     725        pcCUDes->getCUMvField(REF_PIC_LIST_1)->setMvField(zeroMvField, uiAbsPartIdx);
     726        pcCUDes->setPredictionMode(uiAbsPartIdx, MODE_INTRA);
     727      }
     728
     729      for(UInt i = 1; i < unitNum; i++ ) 
     730      {
     731        pcCUDes->getCUMvField(REF_PIC_LIST_0)->setMvField(pcCUDes->getCUMvField(REF_PIC_LIST_0)->getMv(uiAbsPartIdx), pcCUDes->getCUMvField(REF_PIC_LIST_0)->getRefIdx(uiAbsPartIdx), uiAbsPartIdx + i);
     732        pcCUDes->getCUMvField(REF_PIC_LIST_1)->setMvField(pcCUDes->getCUMvField(REF_PIC_LIST_1)->getMv(uiAbsPartIdx), pcCUDes->getCUMvField(REF_PIC_LIST_1)->getRefIdx(uiAbsPartIdx), uiAbsPartIdx + i);
     733        pcCUDes->setPredictionMode(uiAbsPartIdx+i, pcCUDes->getPredictionMode(uiAbsPartIdx))  ;
     734      }
     735    }
     736      memset( pcCUDes->getPartitionSize(), SIZE_2Nx2N, sizeof(char)*uiNumPartitions);
     737  }
     738}
     739#endif
     740
     741#endif
     742
     743#if AVC_SYNTAX
     744Void TComPic::readBLSyntax( fstream* filestream, UInt numBytes )
     745{
     746  if( !filestream->good() )
     747  {
     748    return;
     749  }
     750
     751  UInt   uiWidth      = this->getPicYuvRec()->getWidth() - this->getPicYuvRec()->getPicCropLeftOffset() - this->getPicYuvRec()->getPicCropRightOffset();
     752  UInt   uiHeight     = this->getPicYuvRec()->getHeight() - this->getPicYuvRec()->getPicCropTopOffset() - this->getPicYuvRec()->getPicCropBottomOffset();
     753  UInt64 uiPOC        = (UInt64)this->getPOC();
     754  UInt   uiPartWidth  = uiWidth / 4;
     755  UInt   uiPartHeight = uiHeight / 4;
     756
     757  UInt uiNumPartInWidth    = this->getNumPartInWidth();
     758  UInt uiNumPartInHeight   = this->getNumPartInHeight();
     759  UInt uiNumPartLCUInWidth = this->getFrameWidthInCU();
     760
     761  UInt64 uiPos = (UInt64)uiPOC * uiWidth * uiHeight * numBytes / 16;
     762   
     763  filestream->seekg( uiPos, ios_base::beg );
     764
     765  for( Int i = 0; i < uiPartHeight; i++ )
     766  {
     767    for( Int j = 0; j < uiPartWidth; j++ )
     768    {
     769      UInt uiX = ( j / uiNumPartInWidth );
     770      UInt uiY = ( i / uiNumPartInHeight );
     771
     772      UInt uiLCUAddr = uiY * uiNumPartLCUInWidth + uiX;
     773      UInt uiPartAddr = ( i - uiY * uiNumPartInHeight ) * uiNumPartInWidth + ( j - uiX * uiNumPartInWidth );
     774      uiPartAddr = g_auiRasterToZscan[uiPartAddr];
     775     
     776      TComDataCU* pcCU = this->getCU( uiLCUAddr );
     777     
     778      TComMv mv;
     779      Short temp;
     780
     781      // RefIdxL0
     782      Char refIdxL0 = -1;
     783      filestream->read( &refIdxL0, 1 );
     784      assert( refIdxL0 >= -1 );
     785      pcCU->getCUMvField( REF_PIC_LIST_0 )->setRefIdx( (Int)refIdxL0, uiPartAddr );
     786
     787      // RefIdxL1
     788      Char refIdxL1 = -1;
     789      filestream->read( &refIdxL1, 1 );
     790      assert( refIdxL1 >= -1 );
     791      pcCU->getCUMvField( REF_PIC_LIST_1 )->setRefIdx( (Int)refIdxL1, uiPartAddr );
     792
     793      // MV L0
     794      temp = 0;
     795      filestream->read( reinterpret_cast<char*>(&temp), 2 );
     796      mv.setHor( (Short)temp );
     797      temp = 0;
     798      filestream->read( reinterpret_cast<char*>(&temp), 2 );
     799      mv.setVer( (Short)temp );
     800      pcCU->getCUMvField( REF_PIC_LIST_0 )->setMv( mv, uiPartAddr );
     801
     802      // MV L1
     803      temp = 0;
     804      filestream->read( reinterpret_cast<char*>(&temp), 2 );
     805      mv.setHor( (Short)temp );
     806      temp = 0;
     807      filestream->read( reinterpret_cast<char*>(&temp), 2 );
     808      mv.setVer( (Short)temp );
     809      pcCU->getCUMvField( REF_PIC_LIST_1 )->setMv( mv, uiPartAddr );
     810
     811      // set dependent information
     812      pcCU->setPredictionMode( uiPartAddr, ( refIdxL0 == NOT_VALID && refIdxL1 == NOT_VALID ) ? MODE_INTRA : MODE_INTER );
     813      UInt uiInterDir = ( refIdxL0 != NOT_VALID ) + ( refIdxL1 != NOT_VALID && this->getSlice(0)->isInterB() ) * 2;
     814      assert( uiInterDir >= 0 && uiInterDir <= 3 );
     815      pcCU->setInterDir( uiPartAddr, uiInterDir );     
     816    }
     817  }
     818}
     819#endif
     820
     821#if SYNTAX_OUTPUT
     822Void TComPic::wrireBLSyntax( fstream* filestream, UInt numBytes )
     823{
     824  if( !filestream->good() )
     825  {
     826    return;
     827  }
     828
     829  UInt   uiWidth      = this->getPicYuvRec()->getWidth() - getSlice(0)->getSPS()->getPicCropLeftOffset() - getSlice(0)->getSPS()->getPicCropRightOffset();
     830  UInt   uiHeight     = this->getPicYuvRec()->getHeight() - getSlice(0)->getSPS()->getPicCropTopOffset() - getSlice(0)->getSPS()->getPicCropBottomOffset();
     831  UInt64 uiPOC        = (UInt64)this->getPOC();
     832  UInt   uiPartWidth  = uiWidth / 4;
     833  UInt   uiPartHeight = uiHeight / 4;
     834
     835  UInt uiNumPartInWidth    = this->getNumPartInWidth();
     836  UInt uiNumPartInHeight   = this->getNumPartInHeight();
     837  UInt uiNumPartLCUInWidth = this->getFrameWidthInCU();
     838
     839  filestream->seekg( uiPOC * uiWidth * uiHeight * numBytes / 16 );
     840   
     841  for( Int i = 0; i < uiPartHeight; i++ )
     842  {
     843    for( Int j = 0; j < uiPartWidth; j++ )
     844    {
     845      UInt uiX = ( j / uiNumPartInWidth );
     846      UInt uiY = ( i / uiNumPartInHeight );
     847
     848      UInt uiLCUAddr = uiY * uiNumPartLCUInWidth + uiX;
     849      UInt uiPartAddr = ( i - uiY * uiNumPartInHeight ) * uiNumPartInWidth + ( j - uiX * uiNumPartInWidth );
     850      uiPartAddr = g_auiRasterToZscan[uiPartAddr];
     851     
     852      TComDataCU* pcCU = this->getCU( uiLCUAddr );
     853     
     854      TComMv mv;
     855      Short temp;
     856      Char refIdxL0 = NOT_VALID, refIdxL1 = NOT_VALID;
     857
     858      // RefIdx
     859      if( !pcCU->isIntra( uiPartAddr ) )
     860      {
     861        refIdxL0 = (Char)pcCU->getCUMvField( REF_PIC_LIST_0 )->getRefIdx( uiPartAddr );
     862        refIdxL1 = (Char)pcCU->getCUMvField( REF_PIC_LIST_1 )->getRefIdx( uiPartAddr );
     863      }
     864      assert( refIdxL0 >= - 1 && refIdxL1 >= - 1 );
     865      filestream->put( refIdxL0 );
     866      filestream->put( refIdxL1 );
     867
     868      // MV L0
     869      mv.setZero();
     870      if( refIdxL0 >= 0 )
     871      {
     872        mv = pcCU->getCUMvField( REF_PIC_LIST_0 )->getMv( uiPartAddr );
     873      }
     874      temp = (Short)mv.getHor();
     875      filestream->write( reinterpret_cast<char*>(&temp), 2 );
     876      temp = (Short)mv.getVer();
     877      filestream->write( reinterpret_cast<char*>(&temp), 2 );
     878
     879      // MV L1
     880      mv.setZero();
     881      if( refIdxL1 >= 0 )
     882      {
     883        mv = pcCU->getCUMvField( REF_PIC_LIST_1 )->getMv( uiPartAddr );
     884      }
     885      temp = (Short)mv.getHor();
     886      filestream->write( reinterpret_cast<char*>(&temp), 2 );
     887      temp = (Short)mv.getVer();
     888      filestream->write( reinterpret_cast<char*>(&temp), 2 );
     889    }
     890  }
     891}
     892#endif
     893
    467894
    468895//! \}
  • branches/HM-10.0-dev-SHM/source/Lib/TLibCommon/TComPic.h

    r51 r54  
    4545#include "TComBitStream.h"
    4646#include "SEI.h"
     47#if AVC_BASE || SYNTAX_OUTPUT
     48#include <fstream>
     49#endif
    4750
    4851//! \ingroup TLibCommon
     
    5861private:
    5962  UInt                  m_uiTLayer;               //  Temporal layer
     63#if SVC_EXTENSION
     64  UInt                  m_layerId;              //  Layer ID
     65#endif
    6066  Bool                  m_bUsedByCurr;            //  Used by current picture
    6167  Bool                  m_bIsLongTerm;            //  IS long term picture
     
    8591
    8692  SEIMessages  m_SEIs; ///< Any SEI messages that have been received.  If !NULL we own the object.
     93#if SVC_EXTENSION
     94  Bool                  m_bSpatialEnhLayer;       // whether current layer is a spatial enhancement layer,
     95  TComPicYuv*           m_pcFullPelBaseRec;    // upsampled base layer recontruction for difference domain inter prediction
     96#if REF_IDX_ME_AROUND_ZEROMV || REF_IDX_ME_ZEROMV || ENCODER_FAST_MODE || REF_IDX_MFM
     97  Bool                  m_bIsILR;                 //  Is ILR picture
     98#endif
     99#endif
    87100
    88101public:
     
    90103  virtual ~TComPic();
    91104 
     105#if SVC_UPSAMPLING
    92106  Void          create( Int iWidth, Int iHeight, UInt uiMaxWidth, UInt uiMaxHeight, UInt uiMaxDepth, Window &conformanceWindow, Window &defaultDisplayWindow,
    93                         Int *numReorderPics, Bool bIsVirtual = false );
    94                        
     107                        Int *numReorderPics, TComSPS* pcSps = NULL, Bool bIsVirtual = false );
     108#if REF_IDX_FRAMEWORK
     109  Void          createWithOutYuv( Int iWidth, Int iHeight, UInt uiMaxWidth, UInt uiMaxHeight, UInt uiMaxDepth, TComSPS* pcSps = NULL, Bool bIsVirtual = false ); 
     110  Void          setPicYuvRec(TComPicYuv *pPicYuv) { m_apcPicYuv[1]=pPicYuv; }
     111#endif
     112#else
     113  Void          create( Int iWidth, Int iHeight, UInt uiMaxWidth, UInt uiMaxHeight, UInt uiMaxDepth, Window &conformanceWindow, Window &defaultDisplayWindow,
     114                        Int *numReorderPics, Bool bIsVirtual = false );                       
     115#endif
    95116  virtual Void  destroy();
    96117 
    97118  UInt          getTLayer()                { return m_uiTLayer;   }
    98119  Void          setTLayer( UInt uiTLayer ) { m_uiTLayer = uiTLayer; }
     120#if SVC_EXTENSION
     121  Void          setLayerId (UInt layerId) { m_layerId = layerId; }
     122  UInt          getLayerId ()               { return m_layerId; }
     123  Bool          isSpatialEnhLayer()             { return m_bSpatialEnhLayer; }
     124  Void          setSpatialEnhLayerFlag (Bool b) { m_bSpatialEnhLayer = b; }
     125  Void          setFullPelBaseRec   ( TComPicYuv* p) { m_pcFullPelBaseRec = p; }
     126  TComPicYuv*   getFullPelBaseRec   ()  { return  m_pcFullPelBaseRec;  }
     127#endif
     128#if REF_IDX_ME_AROUND_ZEROMV || REF_IDX_ME_ZEROMV || ENCODER_FAST_MODE || REF_IDX_MFM
     129  Void          setIsILR( Bool bIsILR)      {m_bIsILR = bIsILR;}
     130  Bool          getIsILR()                  {return m_bIsILR;}
     131#endif
     132
     133#if REF_IDX_MFM
     134  Void          copyUpsampledMvField  (  TComPic* pcPicBase );
     135#if !REUSE_BLKMAPPING
     136  Void          deriveUnitIdxBase     (  UInt uiUpsamplePelX, UInt uiUpsamplePelY, UInt ratio, UInt& uiBaseCUAddr, UInt& uiBaseAbsPartIdx );
     137#endif
     138#endif
    99139
    100140  Bool          getUsedByCurr()             { return m_bUsedByCurr; }
     
    177217  const SEIMessages& getSEIs() const { return m_SEIs; }
    178218
     219#if REF_IDX_FRAMEWORK
     220  Void  copyUpsampledPictureYuv(TComPicYuv*   pcPicYuvIn, TComPicYuv*   pcPicYuvOut);
     221#endif
     222#if AVC_SYNTAX
     223  Void readBLSyntax( fstream* filestream, UInt numBytes );
     224#endif
     225#if SYNTAX_OUTPUT
     226  Void wrireBLSyntax( fstream* filestream, UInt numBytes );
     227#endif
     228
    179229};// END CLASS DEFINITION TComPic
    180230
  • branches/HM-10.0-dev-SHM/source/Lib/TLibCommon/TComPicSym.cpp

    r51 r54  
    147147  m_apcTComDataCU = NULL;
    148148
     149#if AVC_BASE || REF_IDX_FRAMEWORK
     150  if( m_apcTComTile )
     151  {
     152#endif
    149153  for(Int i = 0; i < (m_iNumColumnsMinus1+1)*(m_iNumRowsMinus1+1); i++ )
    150154  {
     
    152156  }
    153157  delete [] m_apcTComTile;
     158#if AVC_BASE || REF_IDX_FRAMEWORK
     159  }
     160#endif
    154161
    155162  m_apcTComTile = NULL;
     
    178185  {
    179186    m_apcTComSlice[m_uiNumAllocatedSlice-1]->copySliceInfo( m_apcTComSlice[m_uiNumAllocatedSlice-2] );
     187#if SET_SLICE_LAYER_ID
     188    m_apcTComSlice[m_uiNumAllocatedSlice-1]->initSlice( m_apcTComSlice[m_uiNumAllocatedSlice-1]->getLayerId() );
     189#else
    180190    m_apcTComSlice[m_uiNumAllocatedSlice-1]->initSlice();
     191#endif
    181192  }
    182193}
  • branches/HM-10.0-dev-SHM/source/Lib/TLibCommon/TComPicSym.h

    r51 r54  
    122122  TComDataCU*&  getCU( UInt uiCUAddr )  { return m_apcTComDataCU[uiCUAddr];     }
    123123 
     124#if AVC_SYNTAX
     125  UInt        getMaxCUWidth()           { return m_uiMaxCUWidth;                }
     126  UInt        getMaxCUHeight()          { return m_uiMaxCUHeight;               }
     127  UInt        getMaxDepth()             { return m_uhTotalDepth;               }
     128#endif
     129 
    124130  Void        setSlice(TComSlice* p, UInt i) { m_apcTComSlice[i] = p;           }
    125131  UInt        getNumAllocatedSlice()    { return m_uiNumAllocatedSlice;         }
  • branches/HM-10.0-dev-SHM/source/Lib/TLibCommon/TComPicYuv.cpp

    r51 r54  
    6060  m_piPicOrgU       = NULL;
    6161  m_piPicOrgV       = NULL;
    62  
    6362  m_bIsBorderExtended = false;
    6463}
     
    6766{
    6867}
    69 
     68#if SVC_UPSAMPLING
     69Void TComPicYuv::create( Int iPicWidth, Int iPicHeight, UInt uiMaxCUWidth, UInt uiMaxCUHeight, UInt uiMaxCUDepth, TComSPS* pcSps )
     70#else
    7071Void TComPicYuv::create( Int iPicWidth, Int iPicHeight, UInt uiMaxCUWidth, UInt uiMaxCUHeight, UInt uiMaxCUDepth )
     72#endif
    7173{
    7274  m_iPicWidth       = iPicWidth;
    7375  m_iPicHeight      = iPicHeight;
    7476 
     77#if SVC_UPSAMPLING
     78  if(pcSps != NULL)
     79  {
     80    m_conformanceWindow = pcSps->getConformanceWindow();
     81  }
     82#endif
     83
    7584  // --> After config finished!
    7685  m_iCuWidth        = uiMaxCUWidth;
  • branches/HM-10.0-dev-SHM/source/Lib/TLibCommon/TComPicYuv.h

    r51 r54  
    4242#include "CommonDef.h"
    4343#include "TComRom.h"
    44 
     44#if SVC_UPSAMPLING
     45#include "TComSlice.h"
     46#endif
    4547//! \ingroup TLibCommon
    4648//! \{
     
    8688  Int   m_iChromaMarginY;
    8789 
     90#if SVC_UPSAMPLING
     91  Window  m_conformanceWindow;
     92#endif
     93
    8894  Bool  m_bIsBorderExtended;
    8995 
     
    98104  //  Memory management
    99105  // ------------------------------------------------------------------------------------------------
     106#if SVC_UPSAMPLING
     107  Void  create      ( Int iPicWidth, Int iPicHeight, UInt uiMaxCUWidth, UInt uiMaxCUHeight, UInt uiMaxCUDepth, TComSPS* pcSps = NULL);
     108#else
     109  Void  create      ( Int iPicWidth, Int iPicHeight, UInt uiMaxCUWidth, UInt uiMaxCUHeight, UInt uiMaxCUDepth );
     110#endif 
    100111 
    101   Void  create      ( Int iPicWidth, Int iPicHeight, UInt uiMaxCUWidth, UInt uiMaxCUHeight, UInt uiMaxCUDepth );
    102112  Void  destroy     ();
    103113 
     
    112122  Int   getHeight   ()     { return  m_iPicHeight;   }
    113123 
     124#if SVC_EXTENSION
     125  Void   setHeight   ( Int iPicHeight )     { m_iPicHeight = iPicHeight; }
     126#endif
     127
     128#if JCTVC_L0178
     129  Void   setWidth   ( Int iPicWidth )     { m_iPicWidth = iPicWidth; }
     130#endif
    114131  Int   getStride   ()     { return (m_iPicWidth     ) + (m_iLumaMarginX  <<1); }
    115132  Int   getCStride  ()     { return (m_iPicWidth >> 1) + (m_iChromaMarginX<<1); }
     
    140157  Pel*  getCrAddr   ( Int iCuAddr, Int uiAbsZorderIdx ) { return m_piPicOrgV + m_cuOffsetC[iCuAddr] + m_buOffsetC[g_auiZscanToRaster[uiAbsZorderIdx]]; }
    141158 
     159#if SVC_UPSAMPLING
     160  Window& getConformanceWindow()                           { return  m_conformanceWindow;             }
     161  Void    setConformanceWindow(Window& conformanceWindow ) { m_conformanceWindow = conformanceWindow; }
     162#endif
     163
    142164  // ------------------------------------------------------------------------------------------------
    143165  //  Miscellaneous
  • branches/HM-10.0-dev-SHM/source/Lib/TLibCommon/TComPrediction.cpp

    r51 r54  
    407407}
    408408
     409#if INTRA_BL && !NO_RESIDUAL_FLAG_FOR_BLPRED
     410Void TComPrediction::getBaseBlk( TComDataCU* pcCU, TComYuv* pcYuvPred, Int iPartAddr, Int iWidth, Int iHeight )
     411{
     412  pcCU->getBaseLumaBlk( iWidth, iHeight, iPartAddr, pcYuvPred->getLumaAddr( iPartAddr ), pcYuvPred->getStride() );
     413  pcCU->getBaseChromaBlk( iWidth >> 1, iHeight >> 1, iPartAddr, pcYuvPred->getCbAddr( iPartAddr ), pcYuvPred->getCStride(), 0 );
     414  pcCU->getBaseChromaBlk( iWidth >> 1, iHeight >> 1, iPartAddr, pcYuvPred->getCrAddr( iPartAddr ), pcYuvPred->getCStride(), 1 );
     415}
     416#endif
    409417
    410418Void TComPrediction::motionCompensation ( TComDataCU* pcCU, TComYuv* pcYuvPred, RefPicList eRefPicList, Int iPartIdx )
     
    758766  return;
    759767}
     768
     769#if SVC_UPSAMPLING
     770Void TComPrediction::upsampleBasePic( TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic)
     771{
     772  m_cUsf.upsampleBasePic( pcUsPic, pcBasePic, pcTempPic);
     773}
     774#endif
    760775//! \}
  • branches/HM-10.0-dev-SHM/source/Lib/TLibCommon/TComPrediction.h

    r51 r54  
    4848#include "TComWeightPrediction.h"
    4949
     50#if SVC_UPSAMPLING
     51#include "TComDataCU.h"
     52#include "TComUpsampleFilter.h"
     53#endif
    5054//! \ingroup TLibCommon
    5155//! \{
     
    7074  TComInterpolationFilter m_if;
    7175 
     76#if SVC_UPSAMPLING
     77  TComUpsampleFilter      m_cUsf;
     78#endif
     79
    7280  Pel*   m_pLumaRecBuffer;       ///< array for downsampled reconstructed luma sample
    7381  Int    m_iLumaRecStride;       ///< stride of #m_pLumaRecBuffer array
     
    94102  Void    initTempBuff();
    95103 
     104#if INTRA_BL
     105  Void getBaseBlk ( TComDataCU* pcCU, TComYuv* pcYuvPred, Int iPartAddr, Int iWidth, Int iHeight );
     106#endif
    96107  // inter
    97108  Void motionCompensation         ( TComDataCU*  pcCU, TComYuv* pcYuvPred, RefPicList eRefPicList = REF_PIC_LIST_X, Int iPartIdx = -1 );
     
    110121  Int  getPredicBufHeight()       { return m_iYuvExtHeight; }
    111122
     123#if SVC_UPSAMPLING
     124  Void upsampleBasePic( TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic );
     125#endif
    112126};
    113127
  • branches/HM-10.0-dev-SHM/source/Lib/TLibCommon/TComSlice.cpp

    r51 r54  
    8181, m_bNoBackPredFlag               ( false )
    8282, m_uiTLayer                      ( 0 )
     83#if SVC_EXTENSION
     84, m_layerId                     ( 0 )
     85, m_pcBaseColPic                  ( NULL )
     86#endif
    8387, m_bTLayerSwitchingFlag          ( false )
    8488, m_sliceMode                   ( 0 )
     
    136140
    137141
     142#if SET_SLICE_LAYER_ID
     143Void TComSlice::initSlice( UInt layerId )
     144#else
    138145Void TComSlice::initSlice()
    139 {
     146#endif
     147{
     148#if SET_SLICE_LAYER_ID
     149  m_layerId = layerId;
     150#endif
    140151  m_aiNumRefIdx[0]      = 0;
    141152  m_aiNumRefIdx[1]      = 0;
     
    344355Void TComSlice::setRefPicList( TComList<TComPic*>& rcListPic )
    345356{
     357#if REF_IDX_FRAMEWORK
     358  if( m_eSliceType == I_SLICE || ( getSPS()->getLayerId() &&
     359      (getNalUnitType() >= NAL_UNIT_CODED_SLICE_BLA) &&
     360      (getNalUnitType() <= NAL_UNIT_CODED_SLICE_CRA) ) )
     361#else
    346362  if (m_eSliceType == I_SLICE)
     363#endif
    347364  {
    348365    ::memset( m_apcRefPicList, 0, sizeof (m_apcRefPicList));
     
    12611278, m_vuiParametersPresentFlag  (false)
    12621279, m_vuiParameters             ()
     1280#if SVC_EXTENSION
     1281, m_layerId(0)
     1282#endif
    12631283{
    12641284  for ( Int i = 0; i < MAX_TLAYER; i++ )
     
    19261946//! activate a PPS and depending on isIDR parameter also SPS and VPS
    19271947//! \returns true, if activation is successful
     1948#if SVC_EXTENSION
     1949Bool ParameterSetManager::activatePPS(Int ppsId, Bool isIDR, UInt layerId)
     1950#else
    19281951Bool ParameterSetManager::activatePPS(Int ppsId, Bool isIDR)
     1952#endif
    19291953{
    19301954  TComPPS *pps = m_ppsMap.getPS(ppsId);
     
    19321956  {
    19331957    Int spsId = pps->getSPSId();
     1958#if SVC_EXTENSION
     1959    if (!isIDR && (spsId != layerId ))
     1960#else
    19341961    if (!isIDR && (spsId != m_activeSPSId))
     1962#endif
    19351963    {
    19361964      printf("Warning: tried to activate PPS referring to a inactive SPS at non-IDR.");
     
    20012029}
    20022030#endif
     2031
     2032#if SVC_EXTENSION
     2033#if AVC_SYNTAX
     2034Void TComSlice::initBaseLayerRPL( TComSlice *pcSlice )
     2035{
     2036// 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
     2037  setPOC( pcSlice->getPOC() );
     2038  if( pcSlice->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA )
     2039  {
     2040    setSliceType( I_SLICE );
     2041  }
     2042  else
     2043  {
     2044    setSliceType( pcSlice->getSliceType() );
     2045  }
     2046
     2047  if( this->isIntra() )
     2048  {
     2049    return;
     2050  }
     2051
     2052  //initialize reference POC of BL
     2053  for( Int iRefPicList = 0; iRefPicList < 2; iRefPicList++ )
     2054  {
     2055    RefPicList eRefPicList = RefPicList( iRefPicList );
     2056
     2057    assert( pcSlice->getNumRefIdx( eRefPicList) > 0 );
     2058    setNumRefIdx( eRefPicList, pcSlice->getNumRefIdx( eRefPicList ) - 1 );
     2059    assert( getNumRefIdx( eRefPicList) <= MAX_NUM_REF);
     2060
     2061    for(Int refIdx = 0; refIdx < getNumRefIdx( eRefPicList ); refIdx++)
     2062    {
     2063      setRefPOC( pcSlice->getRefPic( eRefPicList, refIdx )->getPOC(), eRefPicList, refIdx );
     2064      setRefPic( pcSlice->getRefPic( eRefPicList, refIdx ), eRefPicList, refIdx );
     2065      /*
     2066      // should be set if the base layer has its own instance of the reference picture lists, currently EL RPL is reused.
     2067      getRefPic( eRefPicList, refIdx )->setLayerId( 0 );
     2068      getRefPic( eRefPicList, refIdx )->setIsLongTerm( pcSlice->getRefPic( eRefPicList, refIdx )->getIsLongTerm() );
     2069      getRefPic( eRefPicList, refIdx )->setIsUsedAsLongTerm( pcSlice->getRefPic( eRefPicList, refIdx )->getIsUsedAsLongTerm() );
     2070      */
     2071
     2072    }
     2073  } 
     2074  return;
     2075}
     2076#endif
     2077
     2078Void TComSlice::setBaseColPic(  TComList<TComPic*>& rcListPic, UInt layerID )
     2079
     2080  if (layerID == 0)
     2081  {
     2082    m_pcBaseColPic = NULL;
     2083    return;
     2084  }       
     2085  setBaseColPic(xGetRefPic(rcListPic, getPOC()));
     2086}
     2087#endif
     2088
     2089#if REF_IDX_FRAMEWORK
     2090Void TComSlice::addRefPicList( TComPic **pIlpPicList, Int iRefPicNum, Int iInsertOffset )
     2091{
     2092  if(getSPS()->getLayerId() && m_eSliceType != I_SLICE)
     2093  {
     2094#if REF_IDX_MFM
     2095    assert(iRefPicNum == 1);
     2096    if( getPOC() != 0 )
     2097    {
     2098      pIlpPicList[0]->copyUpsampledMvField(getBaseColPic());
     2099    }
     2100#endif
     2101    //add to list 0;
     2102    Int iOffset;
     2103    m_aiNumRefIdx[REF_PIC_LIST_0] += iInsertOffset;
     2104    iOffset = m_aiNumRefIdx[REF_PIC_LIST_0];
     2105    for (Int i=0; i<iRefPicNum; i++)
     2106    {
     2107      pIlpPicList[i]->setIsLongTerm(1);  //mark ilp as long-term reference
     2108      pIlpPicList[i]->setIsUsedAsLongTerm(1);  //mark ilp as long-term reference
     2109      m_apcRefPicList[REF_PIC_LIST_0][iOffset + i] = pIlpPicList[i];
     2110      m_aiNumRefIdx[REF_PIC_LIST_0]++;
     2111      //m_aiNumRefIdx[REF_PIC_LIST_C]++;
     2112    }
     2113    if(m_eSliceType == B_SLICE)
     2114    {
     2115      m_aiNumRefIdx[REF_PIC_LIST_1] += iInsertOffset;
     2116      iOffset = m_aiNumRefIdx[REF_PIC_LIST_1];
     2117      for (Int i=0; i<iRefPicNum; i++)
     2118      {
     2119        pIlpPicList[i]->setIsLongTerm(1);  //mark ilp as long-term reference
     2120        pIlpPicList[i]->setIsUsedAsLongTerm(1);  //mark ilp as long-term reference
     2121        m_apcRefPicList[REF_PIC_LIST_1][iOffset + i] = pIlpPicList[i];
     2122        m_aiNumRefIdx[REF_PIC_LIST_1]++;
     2123        //m_aiNumRefIdx[REF_PIC_LIST_C]++;
     2124      }
     2125    }
     2126  }
     2127}
     2128
     2129#if REF_IDX_MFM
     2130Void TComSlice::setRefPOCListILP( TComPic** ilpPic, TComPic *pcRefPicBL )
     2131{
     2132  //set reference picture POC of each ILP reference
     2133  Int thePoc = ilpPic[0]->getPOC();
     2134  assert(thePoc >= 0);
     2135  assert(thePoc == pcRefPicBL->getPOC());
     2136
     2137#if REUSE_MVSCALE || REUSE_BLKMAPPING
     2138  ilpPic[0]->getSlice(0)->setBaseColPic( pcRefPicBL );
     2139#endif
     2140
     2141  //initialize reference POC of ILP
     2142  for(Int refIdx = 0; refIdx < MAX_NUM_REF; refIdx++)
     2143  {
     2144    ilpPic[0]->getSlice(0)->setRefPOC(0, REF_PIC_LIST_0, refIdx);
     2145    ilpPic[0]->getSlice(0)->setRefPOC(0, REF_PIC_LIST_1, refIdx);
     2146
     2147    ilpPic[0]->getSlice(0)->setRefPic(NULL, REF_PIC_LIST_0, refIdx);
     2148    ilpPic[0]->getSlice(0)->setRefPic(NULL, REF_PIC_LIST_1, refIdx);
     2149  }
     2150
     2151  //set reference POC of ILP
     2152  ilpPic[0]->getSlice(0)->setNumRefIdx(REF_PIC_LIST_0, pcRefPicBL->getSlice(0)->getNumRefIdx(REF_PIC_LIST_0));
     2153  assert(ilpPic[0]->getSlice(0)->getNumRefIdx(REF_PIC_LIST_0) <= MAX_NUM_REF);
     2154  ilpPic[0]->getSlice(0)->setNumRefIdx(REF_PIC_LIST_1, pcRefPicBL->getSlice(0)->getNumRefIdx(REF_PIC_LIST_1));
     2155  assert(ilpPic[0]->getSlice(0)->getNumRefIdx(REF_PIC_LIST_1) <= MAX_NUM_REF);
     2156
     2157  for(Int refIdx = 0; refIdx < pcRefPicBL->getSlice(0)->getNumRefIdx(REF_PIC_LIST_0); refIdx++)
     2158  {
     2159    ilpPic[0]->getSlice(0)->setRefPOC(pcRefPicBL->getSlice(0)->getRefPOC(REF_PIC_LIST_0, refIdx), REF_PIC_LIST_0, refIdx);
     2160  }
     2161  for(Int refIdx = 0; refIdx < pcRefPicBL->getSlice(0)->getNumRefIdx(REF_PIC_LIST_1); refIdx++)
     2162  {
     2163    ilpPic[0]->getSlice(0)->setRefPOC(pcRefPicBL->getSlice(0)->getRefPOC(REF_PIC_LIST_1, refIdx), REF_PIC_LIST_1, refIdx);
     2164  }
     2165  for(Int refIdx = 0; refIdx < pcRefPicBL->getSlice(0)->getNumRefIdx(REF_PIC_LIST_0); refIdx++)
     2166  {
     2167    ilpPic[0]->getSlice(0)->setRefPic(pcRefPicBL->getSlice(0)->getRefPic(REF_PIC_LIST_0, refIdx), REF_PIC_LIST_0, refIdx);
     2168  }
     2169  for(Int refIdx = 0; refIdx < pcRefPicBL->getSlice(0)->getNumRefIdx(REF_PIC_LIST_1); refIdx++)
     2170  {
     2171    ilpPic[0]->getSlice(0)->setRefPic(pcRefPicBL->getSlice(0)->getRefPic(REF_PIC_LIST_1, refIdx), REF_PIC_LIST_1, refIdx);
     2172  }
     2173  return;
     2174}
     2175#endif
     2176
     2177
     2178#endif
    20032179//! \}
  • branches/HM-10.0-dev-SHM/source/Lib/TLibCommon/TComSlice.h

    r51 r54  
    5151class TComPic;
    5252class TComTrQuant;
     53
     54#if SVC_EXTENSION
     55class TComPicYuv;
     56#endif
    5357// ====================================================================================================================
    5458// Constants
     
    850854  static const Int   m_winUnitY[MAX_CHROMA_FORMAT_IDC+1];
    851855  TComPTL     m_pcPTL;
     856
     857#if SVC_EXTENSION
     858  UInt m_layerId;
     859#endif
     860#if REF_IDX_MFM
     861  Bool m_bMFMEnabledFlag;
     862#endif
    852863public:
    853864  TComSPS();
     
    976987
    977988  TComPTL* getPTL()     { return &m_pcPTL; }
     989
     990#if SVC_EXTENSION
     991  Void     setLayerId(UInt layerId) { m_layerId = layerId; }
     992  UInt     getLayerId() { return m_layerId; }
     993#endif
     994#if REF_IDX_MFM
     995  Void     setMFMEnabledFlag(Bool flag) {m_bMFMEnabledFlag = flag;}
     996  Bool     getMFMEnabledFlag()          {return m_bMFMEnabledFlag;}
     997#endif
    978998};
    979999
     
    12831303  Bool        m_bNoBackPredFlag;
    12841304  UInt        m_uiTLayer;
     1305#if SVC_EXTENSION
     1306  UInt        m_layerId;
     1307  TComPic*    m_pcBaseColPic;
     1308  TComPicYuv* m_pcFullPelBaseRec;
     1309#endif
    12851310  Bool        m_bTLayerSwitchingFlag;
    12861311
     
    13191344  TComSlice();
    13201345  virtual ~TComSlice();
     1346#if SET_SLICE_LAYER_ID
     1347  Void      initSlice       ( UInt layerId );
     1348#else
    13211349  Void      initSlice       ();
     1350#endif
    13221351
    13231352  Void      setVPS          ( TComVPS* pcVPS ) { m_pcVPS = pcVPS; }
     
    14171446  Void      setDepth            ( Int iDepth )                  { m_iDepth            = iDepth; }
    14181447 
     1448#if SVC_EXTENSION 
     1449  Void      setBaseColPic       ( TComPic* p)                   { m_pcBaseColPic = p; }
     1450  Void      setBaseColPic       ( TComList<TComPic*>& rcListPic , UInt layerID );
     1451  TComPic*  getBaseColPic       ()  { return m_pcBaseColPic; }
     1452
     1453  Void      setLayerId (UInt layerId) { m_layerId = layerId; }
     1454  UInt      getLayerId ()               { return m_layerId; }
     1455
     1456  Void        setFullPelBaseRec   ( TComPicYuv* p) { m_pcFullPelBaseRec = p; }
     1457  TComPicYuv* getFullPelBaseRec   ()  { return  m_pcFullPelBaseRec;  }
     1458
     1459#if AVC_SYNTAX
     1460  Void      initBaseLayerRPL( TComSlice *pcSlice );
     1461#endif
     1462#endif
     1463
     1464#if REF_IDX_MFM
     1465  Void      setRefPOCListILP(TComPic** ilpPic, TComPic *pcRefPicBL);
     1466#endif
     1467
    14191468  Void      setRefPicList       ( TComList<TComPic*>& rcListPic );
    14201469  Void      setRefPOCList       ();
     
    15361585  Void      setEnableTMVPFlag     ( Bool   b )    { m_enableTMVPFlag = b; }
    15371586  Bool      getEnableTMVPFlag     ()              { return m_enableTMVPFlag;}
    1538 
     1587#if REF_IDX_FRAMEWORK
     1588  Void      addRefPicList( TComPic **pIlpPicList, Int iRefPicNum, Int iInsertOffset=0 );
     1589#endif
    15391590protected:
    15401591  TComPic*  xGetRefPic  (TComList<TComPic*>& rcListPic,
     
    16251676  //! activate a PPS and depending on isIDR parameter also SPS and VPS
    16261677  //! \returns true, if activation is successful
     1678#if SVC_EXTENSION
     1679  Bool activatePPS(Int ppsId, Bool isIDR, UInt layerId);
     1680#else
    16271681  Bool activatePPS(Int ppsId, Bool isIDR);
     1682#endif
    16281683
    16291684  TComVPS* getActiveVPS(){ return m_vpsMap.getPS(m_activeVPSId); };
  • branches/HM-10.0-dev-SHM/source/Lib/TLibCommon/TComTrQuant.cpp

    r51 r54  
    12361236    uiMode = pcCU->getLumaIntraDir( uiAbsPartIdx );
    12371237  }
     1238#if INTRA_BL_DST4x4
     1239  else if(eTType == TEXT_LUMA && pcCU->isIntraBL(uiAbsPartIdx) )
     1240  {
     1241    uiMode = DC_IDX; //Using DST
     1242  }
     1243#endif
    12381244  else
    12391245  {
     
    13091315    Int scalingListType = (pcCU->isIntra(uiAbsPartIdx) ? 0 : 3) + g_eTTable[(Int)eTxt];
    13101316    assert(scalingListType < 6);
     1317#if NO_RESIDUAL_FLAG_FOR_BLPRED
     1318    if(pcCU->isIntraBL(uiAbsPartIdx) && eTxt == TEXT_LUMA)
     1319    {
     1320      invtransformNxN( pcCU->getCUTransquantBypass(uiAbsPartIdx), eTxt, DC_IDX, pResi, uiStride, rpcCoeff, uiWidth, uiHeight, scalingListType, pcCU->getTransformSkip(uiAbsPartIdx, eTxt) );
     1321    }
     1322    else
     1323    {
     1324      invtransformNxN( pcCU->getCUTransquantBypass(uiAbsPartIdx), eTxt, REG_DCT, pResi, uiStride, rpcCoeff, uiWidth, uiHeight, scalingListType, pcCU->getTransformSkip(uiAbsPartIdx, eTxt) );
     1325    }
     1326#else
    13111327    invtransformNxN( pcCU->getCUTransquantBypass(uiAbsPartIdx), eTxt, REG_DCT, pResi, uiStride, rpcCoeff, uiWidth, uiHeight, scalingListType, pcCU->getTransformSkip(uiAbsPartIdx, eTxt) );
     1328#endif
    13121329  }
    13131330  else
     
    18031820  Int     ui16CtxCbf          = 0;
    18041821  Int     iBestLastIdxP1      = 0;
     1822#if NO_RESIDUAL_FLAG_FOR_BLPRED
     1823  if( (!pcCU->isIntra( uiAbsPartIdx ) || pcCU->isIntraBL( uiAbsPartIdx )) && eTType == TEXT_LUMA && pcCU->getTransformIdx( uiAbsPartIdx ) == 0 )
     1824#else
    18051825  if( !pcCU->isIntra( uiAbsPartIdx ) && eTType == TEXT_LUMA && pcCU->getTransformIdx( uiAbsPartIdx ) == 0 )
     1826#endif
    18061827  {
    18071828    ui16CtxCbf   = 0;
  • branches/HM-10.0-dev-SHM/source/Lib/TLibCommon/TComYuv.cpp

    r51 r54  
    184184}
    185185
     186#if NO_RESIDUAL_FLAG_FOR_BLPRED
     187Void TComYuv::copyFromPicLuma  ( TComPicYuv* pcPicYuvSrc, UInt iCuAddr, UInt uiZorderIdxInCU, UInt uiAbsZorderIdx, UInt uiWidth, UInt uiHeight )
     188{
     189  Int  y;
     190
     191  Pel* pDst     = getLumaAddr(uiAbsZorderIdx);
     192  Pel* pSrc     = pcPicYuvSrc->getLumaAddr ( iCuAddr, uiZorderIdxInCU + uiAbsZorderIdx );
     193
     194  UInt  iDstStride  = getStride();
     195  UInt  iSrcStride  = pcPicYuvSrc->getStride();
     196  for ( y = uiHeight; y != 0; y-- )
     197  {
     198    ::memcpy( pDst, pSrc, sizeof(Pel)*uiWidth);
     199    pDst += iDstStride;
     200    pSrc += iSrcStride;
     201  }
     202}
     203
     204Void TComYuv::copyFromPicChroma( TComPicYuv* pcPicYuvSrc, UInt iCuAddr, UInt uiZorderIdxInCU, UInt uiAbsZorderIdx, UInt uiCWidth, UInt uiCHeight, UInt uiChromaId  )
     205{
     206  Int  y;
     207
     208  if (!uiChromaId)
     209  {
     210    Pel* pDstU      = getCbAddr(uiAbsZorderIdx);
     211    Pel* pSrcU      = pcPicYuvSrc->getCbAddr( iCuAddr, uiZorderIdxInCU + uiAbsZorderIdx );
     212
     213    UInt  iDstStride = getCStride();
     214    UInt  iSrcStride = pcPicYuvSrc->getCStride();
     215    for ( y = uiCHeight; y != 0; y-- )
     216    {
     217      ::memcpy( pDstU, pSrcU, sizeof(Pel)*(uiCWidth) );
     218      pSrcU += iSrcStride;
     219      pDstU += iDstStride;
     220    }
     221  }
     222  else
     223  {
     224    Pel* pDstV      = getCrAddr(uiAbsZorderIdx);
     225    Pel* pSrcV      = pcPicYuvSrc->getCrAddr( iCuAddr, uiZorderIdxInCU + uiAbsZorderIdx );
     226
     227    UInt  iDstStride = getCStride();
     228    UInt  iSrcStride = pcPicYuvSrc->getCStride();
     229    for ( y = uiCHeight; y != 0; y-- )
     230    {
     231      ::memcpy( pDstV, pSrcV, sizeof(Pel)*(uiCWidth) );
     232      pSrcV += iSrcStride;
     233      pDstV += iDstStride;
     234    }
     235  }
     236}
     237#endif
     238
    186239Void TComYuv::copyToPartYuv( TComYuv* pcYuvDst, UInt uiDstPartIdx )
    187240{
  • branches/HM-10.0-dev-SHM/source/Lib/TLibCommon/TComYuv.h

    r51 r54  
    115115  Void    copyFromPicLuma      ( TComPicYuv* pcPicYuvSrc, UInt iCuAddr, UInt uiAbsZorderIdx );
    116116  Void    copyFromPicChroma    ( TComPicYuv* pcPicYuvSrc, UInt iCuAddr, UInt uiAbsZorderIdx );
     117#if NO_RESIDUAL_FLAG_FOR_BLPRED
     118  Void    copyFromPicLuma  ( TComPicYuv* pcPicYuvSrc, UInt iCuAddr, UInt uiZorderIdxInCU, UInt uiAbsZorderIdx, UInt uiWidth, UInt uiHeight );
     119  Void    copyFromPicChroma( TComPicYuv* pcPicYuvSrc, UInt iCuAddr, UInt uiZorderIdxInCU, UInt uiAbsZorderIdx, UInt uiCWidth, UInt uiCHeight, UInt uiChromaId  );
     120#endif
    117121 
    118122  //  Copy Small YUV buffer to the part of other Big YUV buffer
  • branches/HM-10.0-dev-SHM/source/Lib/TLibCommon/TypeDef.h

    r51 r54  
    3838#ifndef _TYPEDEF__
    3939#define _TYPEDEF__
     40
     41#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
     45#if SVC_EXTENSION
     46#define MAX_LAYERS                       2      ///< max number of layers the codec is supposed to handle
     47
     48#define SVC_COL_BLK                      1      ///< get co-located block
     49#define SVC_UPSAMPLING                   1      ///< upsampling filters
     50#define PHASE_DERIVATION_IN_INTEGER      1      ///< upsampling filters implementation using only integer arithmetic
     51#define SET_SLICE_LAYER_ID               1      ///< set layerId to the slice
     52#define BUGFIX_925                       1      ///< bug fix ticket #925
     53#define ENCODER_BUGFIX                   1      ///< L0167: encoder bug fix for inter mode
     54#define CHROMA_UPSAMPLING                1      ///< L0335: Chroma upsampling with 5 bits coefficients
     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                         0      ///< YUV BL reading for AVC base SVC
     61#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
     66
     67#if REF_IDX_FRAMEWORK
     68#define REF_IDX_ME_AROUND_ZEROMV         0      ///< added ME around zero MV for inter-layer reference picture
     69#define REF_IDX_ME_ZEROMV                1      ///< L0051: use zero motion for inter-layer reference picture (without fractional ME)
     70#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
     72#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
     80#else
     81#define INTRA_BL                         0      ///< inter-layer texture prediction
     82
     83#if INTRA_BL
     84#define INTRA_BL_DST4x4                  1      ///< L0067/L0204: DST4x4 for Intra BL
     85#define NO_RESIDUAL_FLAG_FOR_BLPRED      1      ///< L0437: Root cbf for Intra_BL
     86
     87// Hooks
     88#if !AVC_BASE || AVC_SYNTAX
     89#define SVC_MVP                          1      ///< motion hook for merge mode as an example
     90#if !AVC_SYNTAX
     91#define SVC_BL_CAND_INTRA                0      ///< Intra Base Mode Prediction hook as an example
     92#endif
     93#endif
     94
     95#if SVC_UPSAMPLING
     96#define JCTVC_L0178                      1      ///< implementation of JCTVC-L0178 (code only supports right and bottom croppping offsets)
     97#endif
     98
     99#endif
     100#endif
     101#else
     102#define SYNTAX_OUTPUT                    0
     103#endif
    40104
    41105//! \ingroup TLibCommon
Note: See TracChangeset for help on using the changeset viewer.