Changeset 21 in 3DVCSoftware for trunk/source/Lib/TLibCommon


Ignore:
Timestamp:
15 Feb 2012, 19:05:04 (12 years ago)
Author:
hschwarz
Message:

updated with HHI branch (0.2-HHI)

Location:
trunk/source/Lib/TLibCommon
Files:
17 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/Lib/TLibCommon/CommonDef.h

    r17 r21  
    5858
    5959#define HM_VERSION        "3.0rc2"                 ///< Current software version
    60 #define NV_VERSION        "0.2r1"                  ///< Current software version
     60#define NV_VERSION        "0.3"                    ///< Current software version
    6161
    6262// ====================================================================================================================
     
    145145
    146146//>>>>> generation and usage of virtual prediction depth maps >>>>>
    147 #define PDM_DEPTH_MAP_MCP_FILTER          2         // 0: standard filter, 1:bilinear, 2:nearest neighbour
    148147#define PDM_ONE_DEPTH_PER_PU              1         // use only a single depth for a prediction unit (in update)
    149 #define PDM_NO_INTER_UPDATE               0         // no update for inter (but not inter-view) predicted blocks
     148#define PDM_NO_INTER_UPDATE               1         // no update for inter (but not inter-view) predicted blocks
    150149#define PDM_MERGE_POS                     0         // position of pdm in merge list (0..5)
    151150#define PDM_AMVP_POS                      2         // position of pdm in amvp list  (0..3)
     
    167166#define PDM_USE_FOR_INTER                 2
    168167#define PDM_USE_FOR_MERGE                 4
     168
     169#define PDM_SUBSAMPLING_EXP               2         // subsampling factor is 2^PDM_SUBSAMPLING_EXP
     170#define PDM_SUB_SAMP_EXP_X(Pdm)           ((Pdm)==1?PDM_SUBSAMPLING_EXP:0)
     171#define PDM_SUB_SAMP_EXP_Y(Pdm)           ((Pdm)==1?PDM_SUBSAMPLING_EXP:0)
    169172//<<<<< generation and usage of virtual prediction depth maps <<<<<
    170173
  • trunk/source/Lib/TLibCommon/TComDataCU.cpp

    r5 r21  
    42134213  RefPicList  eColRefPicList;
    42144214  Int iColPOC, iColRefPOC, iCurrPOC, iCurrRefPOC, iScale;
     4215#if SONY_COLPIC_AVAILABILITY
     4216        Int iColViewOrderIdx, iColRefViewOrderIdx, iCurrViewOrderIdx, iCurrRefViewOrderIdx;
     4217#endif
    42154218  TComMv cColMv;
    42164219
    42174220  iCurrPOC = m_pcSlice->getPOC();   
    42184221  iCurrRefPOC = m_pcSlice->getRefPic(eRefPicList, riRefIdx)->getPOC();
    4219 
     4222#if SONY_COLPIC_AVAILABILITY
     4223        iCurrViewOrderIdx    = m_pcSlice->getViewOrderIdx();
     4224        iCurrRefViewOrderIdx = m_pcSlice->getRefPic(eRefPicList, riRefIdx)->getViewOrderIdx();
     4225#endif
    42204226  // use coldir.
    42214227  TComPic *pColPic = getSlice()->getRefPic( RefPicList(getSlice()->isInterB() ? getSlice()->getColDir() : 0), 0);
    42224228  TComDataCU *pColCU = pColPic->getCU( uiCUAddr );
    42234229  iColPOC = pColCU->getSlice()->getPOC(); 
     4230#if SONY_COLPIC_AVAILABILITY
     4231        iColViewOrderIdx = pColCU->getSlice()->getViewOrderIdx();
     4232#endif
    42244233
    42254234  if (pColCU->isIntra(uiAbsPartAddr))
     
    42274236    return false;
    42284237  }
    4229 
     4238#if !SONY_COLPIC_AVAILABILITY
    42304239  if( m_pcSlice->getRefPic(eRefPicList, riRefIdx)->getViewIdx() != m_pcSlice->getViewIdx() )
    42314240    return false;
     4241#endif
    42324242
    42334243  // Prefer a vector crossing us.  Prefer shortest.
     
    42454255    }
    42464256    iColRefPOC = pColCU->getSlice()->getRefPOC(RefPicList(l), iColRefIdx);
     4257#if SONY_COLPIC_AVAILABILITY
     4258                iColRefViewOrderIdx = pColCU->getSlice()->getRefPic(RefPicList(l), iColRefIdx)->getViewOrderIdx();
     4259                bool bCrosses;
     4260                int iColDist;
     4261                if((iColPOC != iColRefPOC)&&(iCurrPOC != iCurrRefPOC)){
     4262                        iColDist = abs(iColRefPOC - iColPOC);
     4263                        bCrosses = iColPOC < iCurrPOC ? iColRefPOC > iCurrPOC : iColRefPOC < iCurrPOC;
     4264                }else if((iColPOC == iColRefPOC)&&(iCurrPOC == iCurrRefPOC)){
     4265                        iColDist = abs(iColRefViewOrderIdx - iColViewOrderIdx);
     4266                        bCrosses = iColViewOrderIdx < iCurrViewOrderIdx ? iColRefViewOrderIdx > iCurrViewOrderIdx : iColRefViewOrderIdx < iCurrViewOrderIdx;
     4267                }else{
     4268                  continue;
     4269                }
     4270#else
    42474271    if( pColCU->getSlice()->getRefViewIdx(RefPicList(l), iColRefIdx) != pColCU->getSlice()->getViewIdx() )
    42484272      continue;
    42494273    int iColDist = abs(iColRefPOC - iColPOC);
    42504274    bool bCrosses = iColPOC < iCurrPOC ? iColRefPOC > iCurrPOC : iColRefPOC < iCurrPOC;
     4275#endif
     4276
    42514277    if (iFirstColDist < 0)
    42524278    {
     
    42774303  iColRefPOC = pColCU->getSlice()->getRefPOC(eColRefPicList, pColCU->getCUMvField(eColRefPicList)->getRefIdx(uiAbsPartAddr));
    42784304  cColMv = pColCU->getCUMvField(eColRefPicList)->getMv(uiAbsPartAddr);
     4305#if SONY_COLPIC_AVAILABILITY
     4306        iColRefViewOrderIdx = pColCU->getSlice()->getRefPic( eColRefPicList, pColCU->getCUMvField(eColRefPicList)->getRefIdx(uiAbsPartAddr))->getViewOrderIdx();
     4307#endif
    42794308
    42804309  iCurrRefPOC = m_pcSlice->getRefPic(eRefPicList, riRefIdx)->getPOC();
     4310#if SONY_COLPIC_AVAILABILITY
     4311        iScale = 0;
     4312        iCurrRefViewOrderIdx = m_pcSlice->getRefPic(eRefPicList, riRefIdx)->getViewOrderIdx();
     4313        if((iColPOC != iColRefPOC)&&(iCurrPOC != iCurrRefPOC))
    42814314  iScale = xGetDistScaleFactor(iCurrPOC, iCurrRefPOC, iColPOC, iColRefPOC);
     4315        else if((iColPOC == iColRefPOC)&&(iCurrPOC == iCurrRefPOC))
     4316                iScale = xGetDistScaleFactor(iCurrViewOrderIdx, iCurrRefViewOrderIdx, iColViewOrderIdx, iColRefViewOrderIdx);
     4317#else
     4318  iScale = xGetDistScaleFactor(iCurrPOC, iCurrRefPOC, iColPOC, iColRefPOC);
     4319#endif
    42824320  if (iScale == 1024)
    42834321  {
  • trunk/source/Lib/TLibCommon/TComDepthMapGenerator.cpp

    r5 r21  
    5757  m_uiMaxDepth          = 0;
    5858  m_uiOrgDepthBitDepth  = 0;
     59  m_uiSubSampExpX       = 0;
     60  m_uiSubSampExpY       = 0;
    5961  m_ppcYuv              = 0;
    6062  m_ppcCU               = 0;
     
    6870
    6971Void
    70 TComDepthMapGenerator::create( Bool bDecoder, UInt uiPicWidth, UInt uiPicHeight, UInt uiMaxCUDepth, UInt uiMaxCUWidth, UInt uiMaxCUHeight, UInt uiOrgBitDepth )
     72TComDepthMapGenerator::create( Bool bDecoder, UInt uiPicWidth, UInt uiPicHeight, UInt uiMaxCUDepth, UInt uiMaxCUWidth, UInt uiMaxCUHeight, UInt uiOrgBitDepth, UInt uiSubSampExpX, UInt uiSubSampExpY )
    7173{
    7274  destroy();
     
    7476  m_uiMaxDepth          = uiMaxCUDepth;
    7577  m_uiOrgDepthBitDepth  = uiOrgBitDepth;
     78  m_uiSubSampExpX       = uiSubSampExpX;
     79  m_uiSubSampExpY       = uiSubSampExpY;
    7680  m_ppcYuv              = new TComYuv*    [ m_uiMaxDepth ];
    7781  m_ppcCU               = new TComDataCU* [ m_uiMaxDepth ];
     
    8286    UInt  uiHeight  = uiMaxCUHeight >> uiDepth;
    8387
    84     m_ppcYuv[ uiDepth ] = new TComYuv;    m_ppcYuv[ uiDepth ]->create(            uiWidth, uiHeight      );
     88    m_ppcYuv[ uiDepth ] = new TComYuv;    m_ppcYuv[ uiDepth ]->create( uiWidth >> m_uiSubSampExpX, uiHeight >> m_uiSubSampExpY );
    8589    m_ppcCU [ uiDepth ] = new TComDataCU; m_ppcCU [ uiDepth ]->create( uiNumPart, uiWidth, uiHeight, true );
    8690  }
    87   m_cTmpPic.create( uiPicWidth, uiPicHeight, uiMaxCUWidth, uiMaxCUHeight, uiMaxCUDepth );
     91  m_cTmpPic.create( uiPicWidth >> m_uiSubSampExpX, uiPicHeight >> m_uiSubSampExpY, uiMaxCUWidth >> m_uiSubSampExpX, uiMaxCUHeight >> m_uiSubSampExpY, uiMaxCUDepth );
    8892  xSetChroma( &m_cTmpPic, ( 1 << uiOrgBitDepth ) >> 1 );
    8993  m_bCreated    = true;
     
    106110    m_uiMaxDepth          = 0;
    107111    m_uiOrgDepthBitDepth  = 0;
     112    m_uiSubSampExpX       = 0;
     113    m_uiSubSampExpY       = 0;
    108114    m_bDecoder            = false;
    109115  }
     
    372378      if( pcBasePic->getPOC() == 0 )
    373379      {
     380        pcBasePic->removePrdDepthMapBuffer();
     381        pcBasePic->addPrdDepthMapBuffer( PDM_SUB_SAMP_EXP_X(m_pcSPSAccess->getPdm()), PDM_SUB_SAMP_EXP_Y(m_pcSPSAccess->getPdm()) );
    374382        xClearDepthMap( pcBasePic );
    375383      }
     
    643651    TComPicYuv* pcBaseRec   = pcBasePic->getPicYuvRec   ();
    644652    Int         iDisparity  = xGetDisparityFromVirtDepth( uiBaseId, iPrdDepth );
    645     Int         iBasePosX   = Clip3( 0, pcBasePdm->getWidth () - 1, iCurrPosX + ( ( iDisparity + 2 ) >> 2 ) );
     653    Int         iShiftX     = m_uiSubSampExpX + 2;
     654    Int         iAddX       = ( 1 << iShiftX ) >> 1;
     655    Int         iBasePosX   = Clip3( 0, pcBasePdm->getWidth () - 1, iCurrPosX + ( ( iDisparity + iAddX ) >> iShiftX ) );
    646656    Int         iBasePosY   = Clip3( 0, pcBasePdm->getHeight() - 1, iCurrPosY                               );
    647657    Int         iBaseCUAddr;
    648658    Int         iBaseAbsPartIdx;
    649     pcBaseRec->getCUAddrAndPartIdx( iBasePosX, iBasePosY, iBaseCUAddr, iBaseAbsPartIdx );
     659    pcBaseRec->getCUAddrAndPartIdx( iBasePosX << m_uiSubSampExpX, iBasePosY << m_uiSubSampExpY, iBaseCUAddr, iBaseAbsPartIdx );
    650660    TComDataCU* pcBaseCU    = pcBasePic->getCU( iBaseCUAddr );
    651661    if( pcBaseCU->getPredictionMode( iBaseAbsPartIdx ) != MODE_INTER && pcBaseCU->getPredictionMode( iBaseAbsPartIdx ) != MODE_SKIP )
     
    744754  Pel*        pRefSamples   =  pcRefDepthMap->getLumaAddr( 0 );
    745755  Int         iRefViewIdx   =  pcRef->getViewIdx();
     756  Int         iShiftX       = m_uiSubSampExpX + 2;
     757  Int         iAddX         = ( 1 << iShiftX ) >> 1;
    746758  for( Int iY = 0; iY < iHeight; iY++, pCurSamples += iCurStride, pRefSamples += iRefStride )
    747759  {
     
    750762      Int iDepth = pCurSamples[ iXCur ];
    751763      Int iDisp  = xGetDisparityFromVirtDepth( iRefViewIdx, iDepth );
    752       Int iXRef  = iXCur + ( ( iDisp + 2 ) >> 2 );
     764      Int iXRef  = iXCur + ( ( iDisp + iAddX ) >> iShiftX );
    753765      if( iXRef >= 0 && iXRef < iWidth && iDepth > pRefSamples[ iXRef ] )
    754766      {
     
    784796  Pel*        pCurSamples   =  pcCurDepthMap->getLumaAddr( 0 );
    785797  Int         iRefViewIdx   =  pcRef->getViewIdx();
     798  Int         iShiftX       = m_uiSubSampExpX + 2;
     799  Int         iAddX         = ( 1 << iShiftX ) >> 1;
    786800  for( Int iY = 0; iY < iHeight; iY++, pRefSamples += iRefStride, pCurSamples += iCurStride )
    787801  {
     
    790804      Int iDepth = pRefSamples[ iXRef ];
    791805      Int iDisp  = xGetDisparityFromVirtDepth( iRefViewIdx, iDepth );
    792       Int iXCur  = iXRef - ( ( iDisp + 2 ) >> 2 );
     806      Int iXCur  = iXRef - ( ( iDisp + iAddX ) >> iShiftX );
    793807      if( iXCur >= 0 && iXCur < iWidth && iDepth > pCurSamples[ iXCur ] )
    794808      {
     
    10221036  if( uiTrMode == uiTrDepth )
    10231037  {
    1024     UInt  uiWidth         = pcCU->getWidth ( 0 ) >> uiTrDepth;
    1025     UInt  uiHeight        = pcCU->getHeight( 0 ) >> uiTrDepth;
     1038    UInt  uiWidth         = pcCU->getWidth ( 0 ) >> ( uiTrDepth + m_uiSubSampExpX );
     1039    UInt  uiHeight        = pcCU->getHeight( 0 ) >> ( uiTrDepth + m_uiSubSampExpY );
    10261040    UInt  uiStride        = pcCUDepthMap->getStride  ();
    1027     Pel*  pDepthMap       = pcCUDepthMap->getLumaAddr( uiAbsPartIdx );
     1041    UInt  uiBlkX          = g_auiRasterToPelX[ g_auiZscanToRaster[ uiAbsPartIdx ] ] >> m_uiSubSampExpX;
     1042    UInt  uiBlkY          = g_auiRasterToPelY[ g_auiZscanToRaster[ uiAbsPartIdx ] ] >> m_uiSubSampExpY;
     1043    Pel*  pDepthMap       = pcCUDepthMap->getLumaAddr() + uiBlkY * pcCUDepthMap->getStride() + uiBlkX;
    10281044    UInt  uiLumaPredMode  = pcCU->getLumaIntraDir    ( uiAbsPartIdx );
    10291045    Bool  bAboveAvail     = false;
     
    10341050                                        m_pcPrediction->getPredicBufWidth  (),
    10351051                                        m_pcPrediction->getPredicBufHeight (),
    1036                                         bAboveAvail, bLeftAvail, true );
     1052                                        bAboveAvail, bLeftAvail, true, m_uiSubSampExpX, m_uiSubSampExpY );
    10371053    m_pcPrediction->predIntraDepthAng ( pcCU->getPattern(), uiLumaPredMode, pDepthMap, uiStride, uiWidth, uiHeight ); // could be replaced with directional intra prediction
    10381054                                                                                                                      // using "predIntraLumaAng", but note:
     
    11061122  UInt  uiAbsPartIdx;
    11071123  pcCU->getPartIndexAndSize( uiPartIdx, uiAbsPartIdx, iWidth, iHeight );
     1124  iWidth  >>= m_uiSubSampExpX;
     1125  iHeight >>= m_uiSubSampExpY;
    11081126
    11091127  // get depth values
     
    11251143  if( aiPrdDepth[ 0 ] != PDM_UNDEFINED_DEPTH && aiPrdDepth[ 1 ] != PDM_UNDEFINED_DEPTH )
    11261144  {
    1127     iDepthValue = ( aiPrdDepth[ 0 ] + aiPrdDepth[ 1 ] + 1 ) >> 2;
     1145    iDepthValue = ( aiPrdDepth[ 0 ] + aiPrdDepth[ 1 ] + 1 ) >> 1;
    11281146  }
    11291147  else
     
    11351153
    11361154  // set depth map for PU
    1137   Pel*  pDMSamples  = pcCUDepthMap->getLumaAddr( uiAbsPartIdx );
     1155  UInt  uiBlkX      = g_auiRasterToPelX[ g_auiZscanToRaster[ uiAbsPartIdx ] ] >> m_uiSubSampExpX;
     1156  UInt  uiBlkY      = g_auiRasterToPelY[ g_auiZscanToRaster[ uiAbsPartIdx ] ] >> m_uiSubSampExpY;
     1157  Pel*  pDMSamples  = pcCUDepthMap->getLumaAddr() + uiBlkY * pcCUDepthMap->getStride() + uiBlkX;
    11381158  Int   iStride     = pcCUDepthMap->getStride  ();
    11391159  for( Int iY = 0; iY < iHeight; iY++, pDMSamples += iStride )
     
    11601180  Int             iNum4x4BlksY      = iHeight >> 2;
    11611181  Int             iNum4x4BlksX      = iWidth  >> 2;
     1182  iWidth  >>= m_uiSubSampExpX;
     1183  iHeight >>= m_uiSubSampExpY;
     1184
    11621185  TComPicYuv*     pcCurrDepthMap    = pcCU->getPic()->getPredDepthMap();
    11631186  Pel*            piCurrDepthMap    = pcCurrDepthMap->getLumaAddr();
     
    11841207  Pel*            piBaseDepthMap    = pcBaseDepthMap->getLumaAddr();
    11851208  Int             iBaseStride       = pcBaseDepthMap->getStride();
     1209  Int             iShiftX           = m_uiSubSampExpX + 2;
     1210  Int             iShiftY           = m_uiSubSampExpY + 2;
     1211  Int             iAddX             = ( 1 << iShiftX ) >> 1;
     1212  Int             iAddY             = ( 1 << iShiftY ) >> 1;
    11861213
    11871214  //===== initialize 4x4 block arrays =====
     
    12021229    {
    12031230      // position parameters
    1204       Int               iCurrBlkPosX        = iCurrPUPosX + ( i4x4BlkX << 2 );
    1205       Int               iCurrBlkPosY        = iCurrPUPosY + ( i4x4BlkY << 2 );
    1206       Int               iCurrSamplePosX     = iCurrBlkPosX + 1;
    1207       Int               iCurrSamplePosY     = iCurrBlkPosY + 1;
     1231      Int               iCurrBlkPosX        = iCurrPUPosX + ( ( i4x4BlkX << 2 ) >> m_uiSubSampExpX );
     1232      Int               iCurrBlkPosY        = iCurrPUPosY + ( ( i4x4BlkY << 2 ) >> m_uiSubSampExpY );
     1233      Int               iCurrSamplePosX     = iCurrBlkPosX + ( 1 >> m_uiSubSampExpX );
     1234      Int               iCurrSamplePosY     = iCurrBlkPosY + ( 1 >> m_uiSubSampExpY );
    12081235      Int               iCurrPredDepth      = piCurrDepthMap[ iCurrSamplePosY * iCurrStride + iCurrSamplePosX ];
    12091236      Int               iCurrPredDisp       = xGetDisparityFromVirtDepth( uiBaseId, iCurrPredDepth );
    1210       Int               iBaseSamplePosX     = iCurrSamplePosX + ( ( iCurrPredDisp + 2 ) >> 2 );
     1237      Int               iBaseSamplePosX     = iCurrSamplePosX + ( ( iCurrPredDisp + iAddX ) >> iShiftX );
    12111238      Int               iBaseSamplePosY     = iCurrSamplePosY;
    12121239      iBaseSamplePosX                       = Clip3( 0, pcBaseDepthMap->getWidth () - 1, iBaseSamplePosX );
     
    12221249      Int               iBaseCUAddr;
    12231250      Int               iBaseAbsPartIdx;
    1224       pcBaseRecPic->getCUAddrAndPartIdx( iBaseSamplePosX, iBaseSamplePosY, iBaseCUAddr, iBaseAbsPartIdx );
     1251      pcBaseRecPic->getCUAddrAndPartIdx( iBaseSamplePosX << m_uiSubSampExpX, iBaseSamplePosY << m_uiSubSampExpY, iBaseCUAddr, iBaseAbsPartIdx );
    12251252      TComDataCU*       pcBaseCU            = pcBasePic->getCU( iBaseCUAddr );
    12261253      if( pcBaseCU->getPredictionMode( iBaseAbsPartIdx ) != MODE_INTER && pcBaseCU->getPredictionMode( iBaseAbsPartIdx ) != MODE_SKIP )
     
    12561283        Int             iCurrRefStride      = pcCurrRefDMap->getStride();
    12571284        TComMv&         rcCurrMv            = aiCurrMvField[ iCurrRefListId ]->getMv( uiAbsPartIdx );
    1258         Int             iCurrRefSamplePosX  = iCurrSamplePosX + ( ( rcCurrMv.getHor() + 2 ) >> 2 );
    1259         Int             iCurrRefSamplePosY  = iCurrSamplePosY + ( ( rcCurrMv.getVer() + 2 ) >> 2 );
     1285        Int             iCurrRefSamplePosX  = iCurrSamplePosX + ( ( rcCurrMv.getHor() + iAddX ) >> iShiftX );
     1286        Int             iCurrRefSamplePosY  = iCurrSamplePosY + ( ( rcCurrMv.getVer() + iAddY ) >> iShiftY );
    12601287        Int             iCurrRefSamplePosXC = Clip3( 0, pcCurrRefDMap->getWidth () - 1, iCurrRefSamplePosX );
    12611288        Int             iCurrRefSamplePosYC = Clip3( 0, pcCurrRefDMap->getHeight() - 1, iCurrRefSamplePosY );
     
    12711298            // location and depth for path currView/currAU -> currView/refAU -> baseView/refAU
    12721299            Int         iCurrRefDisp        = xGetDisparityFromVirtDepth( uiBaseId, iCurrRefDepth );
    1273             Int         iBaseRefSamplePosX  = iCurrRefSamplePosX + ( ( iCurrRefDisp + 2 ) >> 2 );
     1300            Int         iBaseRefSamplePosX  = iCurrRefSamplePosX + ( ( iCurrRefDisp + iAddX ) >> iShiftX );
    12741301            Int         iBaseRefSamplePosY  = iCurrRefSamplePosY;
    12751302            TComPic*    pcBaseRefPic        = pcBaseCU->getSlice()->getRefPic( eBaseRefPicList, aiBaseRefIdx[ iBaseRefListId ] );
     
    13281355      for( Int i4x4BlkX = 0; i4x4BlkX < iNum4x4BlksX; i4x4BlkX++ )
    13291356      {
    1330         Int             iCurrSamplePosX     = iCurrPUPosX + ( i4x4BlkX << 2 ) + 1;
    1331         Int             iCurrSamplePosY     = iCurrPUPosY + ( i4x4BlkY << 2 ) + 1;
     1357        Int             iCurrSamplePosX     = iCurrPUPosX + ( ( ( i4x4BlkX << 2 ) + 1 ) >> m_uiSubSampExpX );
     1358        Int             iCurrSamplePosY     = iCurrPUPosY + ( ( ( i4x4BlkY << 2 ) + 1 ) >> m_uiSubSampExpY );
    13321359        m_aai4x4Depth[i4x4BlkY][i4x4BlkX]   = piCurrDepthMap[ iCurrSamplePosY * iCurrStride + iCurrSamplePosX ];
    13331360        m_aabDepthSet[i4x4BlkY][i4x4BlkX]   = true;
     
    13891416
    13901417  //===== set depth values =====
    1391   Pel* piDepthMap = pcCUDepthMap->getLumaAddr( uiAbsPartIdx );
     1418  UInt uiBlkX     = g_auiRasterToPelX[ g_auiZscanToRaster[ uiAbsPartIdx ] ] >> m_uiSubSampExpX;
     1419  UInt uiBlkY     = g_auiRasterToPelY[ g_auiZscanToRaster[ uiAbsPartIdx ] ] >> m_uiSubSampExpY;
     1420  Pel* piDepthMap = pcCUDepthMap->getLumaAddr() + uiBlkY * pcCUDepthMap->getStride() + uiBlkX;
    13921421  Int  iCUStride  = pcCUDepthMap->getStride  ();
    13931422  for( Int iRow = 0; iRow < iHeight; iRow++, piDepthMap += iCUStride )
     
    13951424    for( Int iCol = 0; iCol < iWidth; iCol++ )
    13961425    {
    1397       piDepthMap[ iCol ] = m_aai4x4Depth[ iRow >> 2 ][ iCol >> 2 ];
     1426      piDepthMap[ iCol ] = m_aai4x4Depth[ (iRow << m_uiSubSampExpY) >> 2  ][ (iCol << m_uiSubSampExpX) >> 2 ];
    13981427    }
    13991428  }
     
    14041433TComDepthMapGenerator::xInterPUDepthMapPrediction( TComDataCU* pcCU, TComYuv* pcCUDepthMap, UInt uiPartIdx )
    14051434{
    1406   m_pcPrediction->motionCompensation( pcCU, pcCUDepthMap, REF_PIC_LIST_X, (Int)uiPartIdx, true ); 
     1435  m_pcPrediction->motionCompensation( pcCU, pcCUDepthMap, REF_PIC_LIST_X, (Int)uiPartIdx, true, m_uiSubSampExpX, m_uiSubSampExpY ); 
    14071436}
    14081437
     
    14321461  Int           iCurrPosY;
    14331462  pcPredDepthMap->getTopLeftSamplePos( pcCU->getAddr(), pcCU->getZorderIdxInCU() + uiPartAddr, iCurrPosX, iCurrPosY );
    1434   iCurrPosX  += ( iWidth - 1 ) >> 1;
    1435   iCurrPosY  += ( iHeight - 1 ) >> 1;
     1463  iCurrPosX  += ( ( iWidth  >> m_uiSubSampExpX ) - 1 ) >> 1;
     1464  iCurrPosY  += ( ( iHeight >> m_uiSubSampExpY ) - 1 ) >> 1;
    14361465  riPrdDepth  = piPredDepthMap[ iCurrPosX + iCurrPosY * iCurrStride ];
    14371466  if( piPosX )
  • trunk/source/Lib/TLibCommon/TComDepthMapGenerator.h

    r5 r21  
    110110  ~TComDepthMapGenerator();
    111111
    112   Void  create                ( Bool bDecoder, UInt uiPicWidth, UInt uiPicHeight, UInt uiMaxCUDepth, UInt uiMaxCUWidth, UInt uiMaxCUHeight, UInt uiOrgBitDepth );
     112  Void  create                ( Bool bDecoder, UInt uiPicWidth, UInt uiPicHeight, UInt uiMaxCUDepth, UInt uiMaxCUWidth, UInt uiMaxCUHeight, UInt uiOrgBitDepth, UInt uiSubSampExpX, UInt uiSubSampExpY );
    113113  Void  destroy               ();
    114114
     
    126126
    127127  UInt  getBaseViewId         ( UInt          uiIdx ) { AOF( uiIdx < m_auiBaseIdList.size() );  return m_auiBaseIdList[uiIdx]; }
     128  UInt  getSubSampExpX        ()                      { return m_uiSubSampExpX; }
     129  UInt  getSubSampExpY        ()                      { return m_uiSubSampExpY; }
    128130  Int   getDisparity          ( TComPic*      pcPic, Int iPosX, Int iPosY, UInt uiRefViewId );
    129131#if HHI_INTER_VIEW_MOTION_PRED
     
    200202  UInt              m_uiMaxDepth;
    201203  UInt              m_uiOrgDepthBitDepth;
     204  UInt              m_uiSubSampExpX;
     205  UInt              m_uiSubSampExpY;
    202206  TComYuv**         m_ppcYuv;
    203207  TComDataCU**      m_ppcCU;
  • trunk/source/Lib/TLibCommon/TComPattern.cpp

    r5 r21  
    147147  if ( iComp == 0 )
    148148  {
     149#if DEPTH_MAP_GENERATION
     150    m_iPatternStride  = ( bPrdDepthMap ? pcCU->getPic()->getPredDepthMap()->getStride() : pcCU->getPic()->getStride() );
     151#else
    149152    m_iPatternStride  = pcCU->getPic()->getStride();
     153#endif
    150154    m_piPatternOrigin = pcPic->getLumaAddr(pcCU->getAddr(), uiAbsZorderIdx) - m_iOffsetAbove * m_iPatternStride - m_iOffsetLeft;
    151155  }
    152156  else
    153157  {
     158#if DEPTH_MAP_GENERATION
     159    m_iPatternStride  = ( bPrdDepthMap ? pcCU->getPic()->getPredDepthMap()->getCStride() : pcCU->getPic()->getCStride() );
     160#else
    154161    m_iPatternStride = pcCU->getPic()->getCStride();
     162#endif
    155163    if ( iComp == 1 )
    156164      m_piPatternOrigin = pcPic->getCbAddr(pcCU->getAddr(), uiAbsZorderIdx) - m_iOffsetAbove * m_iPatternStride - m_iOffsetLeft;
     
    242250Void TComPattern::initAdiPattern( TComDataCU* pcCU, UInt uiZorderIdxInPart, UInt uiPartDepth, Int* piAdiBuf, Int iOrgBufStride, Int iOrgBufHeight, Bool& bAbove, Bool& bLeft
    243251#if DEPTH_MAP_GENERATION
    244                                 , Bool bPrdDepthMap 
     252                                , Bool bPrdDepthMap, UInt uiSubSampExpX, UInt uiSubSampExpY
    245253#endif
    246254                                )
     
    254262  UInt  uiWidth;
    255263  UInt  uiHeight;
     264
     265#if DEPTH_MAP_GENERATION
     266  Int   iPicStride = ( bPrdDepthMap ? pcCU->getPic()->getPredDepthMap()->getStride() : pcCU->getPic()->getStride() );
     267#else
    256268  Int   iPicStride = pcCU->getPic()->getStride();
     269#endif
     270
    257271  Int   iCuAddr;
    258272#if REFERENCE_SAMPLE_PADDING
     
    375389#endif // REFERENCE_SAMPLE_PADDING
    376390 
     391#if DEPTH_MAP_GENERATION
     392  if ( bPrdDepthMap )
     393  {
     394    uiWidth  = ( uiCuWidth2  >> uiSubSampExpX ) + 1;
     395    uiHeight = ( uiCuHeight2 >> uiSubSampExpY ) + 1;
     396  }
     397  else
     398  {
    377399  uiWidth=uiCuWidth2+1;
    378400  uiHeight=uiCuHeight2+1;
     401  }
     402#else
     403  uiWidth=uiCuWidth2+1;
     404  uiHeight=uiCuHeight2+1;
     405#endif
    379406 
    380407  if (((uiWidth<<2)>iOrgBufStride)||((uiHeight<<2)>iOrgBufHeight))
     
    398425#if REFERENCE_SAMPLE_PADDING
    399426#if DEPTH_MAP_GENERATION
     427  if ( bPrdDepthMap )
     428    fillReferenceSamples ( pcCU, piRoiOrigin, piAdiTemp, bNeighborFlags, iNumIntraNeighbor, iUnitSize >> uiSubSampExpX, iNumUnitsInCu, iTotalUnits, uiCuWidth >> uiSubSampExpX, uiCuHeight >> uiSubSampExpY, uiWidth, uiHeight, iPicStride, bPrdDepthMap );
     429  else
    400430  fillReferenceSamples ( pcCU, piRoiOrigin, piAdiTemp, bNeighborFlags, iNumIntraNeighbor, iUnitSize, iNumUnitsInCu, iTotalUnits, uiCuWidth, uiCuHeight, uiWidth, uiHeight, iPicStride, bPrdDepthMap );
    401431#else
  • trunk/source/Lib/TLibCommon/TComPattern.h

    r5 r21  
    174174                                Bool&       bLeft
    175175#if DEPTH_MAP_GENERATION
    176                                ,Bool        bPrdDepthMap = false
     176                               ,
     177                               Bool         bPrdDepthMap = false,
     178                               UInt         uiSubSampExpX = 0,
     179                               UInt         uiSubSampExpY = 0
    177180#endif
    178181                               );
  • trunk/source/Lib/TLibCommon/TComPic.cpp

    r5 r21  
    7373  m_aiNumRefIdx[0]    = 0;
    7474  m_aiNumRefIdx[1]    = 0;
    75 
     75#if SONY_COLPIC_AVAILABILITY
     76  m_iViewOrderIdx     = 0;
     77#endif
    7678  m_iViewIdx          = 0;
    7779  m_aaiCodedScale     = 0;
     
    211213#if DEPTH_MAP_GENERATION
    212214Void
    213 TComPic::addPrdDepthMapBuffer()
     215TComPic::addPrdDepthMapBuffer( UInt uiSubSampExpX, UInt uiSubSampExpY )
    214216{
    215217  AOT( m_pcPredDepthMap );
     
    221223  UInt  uiMaxCuDepth  = m_apcPicYuv[1]->getMaxCuDepth ();
    222224  m_pcPredDepthMap    = new TComPicYuv;
    223   m_pcPredDepthMap    ->create( iWidth, iHeight, uiMaxCuWidth, uiMaxCuHeight, uiMaxCuDepth );
     225  m_pcPredDepthMap    ->create( iWidth >> uiSubSampExpX, iHeight >> uiSubSampExpY, uiMaxCuWidth >> uiSubSampExpX, uiMaxCuHeight >> uiSubSampExpY, uiMaxCuDepth );
    224226}
    225227#endif
  • trunk/source/Lib/TLibCommon/TComPic.h

    r5 r21  
    9090
    9191  Int                   m_iViewIdx;
     92#if SONY_COLPIC_AVAILABILITY
     93  Int                   m_iViewOrderIdx;
     94#endif
    9295  Int**                 m_aaiCodedScale;
    9396  Int**                 m_aaiCodedOffset;
     
    159162  Void          setViewIdx( Int i )                           { m_iViewIdx = i; }
    160163  Int           getViewIdx()                                  { return m_iViewIdx; }
     164#if SONY_COLPIC_AVAILABILITY
     165  Void          setViewOrderIdx(Int i)                        { m_iViewOrderIdx = i; }
     166  Int           getViewOrderIdx()                             { return m_iViewOrderIdx; }
     167#endif
    161168
    162169  Void          setScaleOffset( Int** pS, Int** pO )  { m_aaiCodedScale = pS; m_aaiCodedOffset = pO; }
     
    200207#endif
    201208#if DEPTH_MAP_GENERATION
    202   Void          addPrdDepthMapBuffer    ();
     209  Void          addPrdDepthMapBuffer    ( UInt uiSubSampExpX, UInt uiSubSampExpY );
    203210#endif
    204211#if HHI_INTER_VIEW_MOTION_PRED
  • trunk/source/Lib/TLibCommon/TComPrediction.cpp

    r5 r21  
    15071507#endif
    15081508
    1509 Void TComPrediction::motionCompensation ( TComDataCU* pcCU, TComYuv* pcYuvPred, RefPicList eRefPicList, Int iPartIdx, Bool bPrdDepthMap )
     1509#if DEPTH_MAP_GENERATION
     1510Void TComPrediction::motionCompensation( TComDataCU* pcCU, TComYuv* pcYuvPred, RefPicList eRefPicList, Int iPartIdx, Bool bPrdDepthMap, UInt uiSubSampExpX, UInt uiSubSampExpY )
     1511#else
     1512Void TComPrediction::motionCompensation( TComDataCU* pcCU, TComYuv* pcYuvPred, RefPicList eRefPicList, Int iPartIdx )
     1513#endif
    15101514{
    15111515  Int         iWidth;
     
    15161520  {
    15171521    pcCU->getPartIndexAndSize( iPartIdx, uiPartAddr, iWidth, iHeight );
     1522
     1523#if DEPTH_MAP_GENERATION
     1524    if( bPrdDepthMap )
     1525    {
     1526      iWidth  >>= uiSubSampExpX;
     1527      iHeight >>= uiSubSampExpY;
     1528    }
     1529#endif
     1530
    15181531    if ( eRefPicList != REF_PIC_LIST_X )
    15191532    {
    1520       xPredInterUni (pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred, iPartIdx, bPrdDepthMap );
     1533#if DEPTH_MAP_GENERATION
     1534      xPredInterUni (pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred, iPartIdx, bPrdDepthMap, uiSubSampExpX, uiSubSampExpY );
     1535#else
     1536      xPredInterUni (pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred, iPartIdx );
     1537#endif
    15211538#ifdef WEIGHT_PRED
    15221539      if ( pcCU->getSlice()->getPPS()->getUseWP() )
     
    15281545    else
    15291546    {
    1530       xPredInterBi  (pcCU, uiPartAddr, iWidth, iHeight, pcYuvPred, iPartIdx, bPrdDepthMap );
    1531 
     1547#if DEPTH_MAP_GENERATION
     1548      xPredInterBi  (pcCU, uiPartAddr, iWidth, iHeight, uiSubSampExpX, uiSubSampExpY, pcYuvPred, iPartIdx, bPrdDepthMap );
     1549#else
     1550      xPredInterBi  (pcCU, uiPartAddr, iWidth, iHeight, pcYuvPred, iPartIdx );
     1551#endif
    15321552    }
    15331553    return;
     
    15381558    pcCU->getPartIndexAndSize( iPartIdx, uiPartAddr, iWidth, iHeight );
    15391559
     1560#if DEPTH_MAP_GENERATION
     1561    if( bPrdDepthMap )
     1562    {
     1563      iWidth  >>= uiSubSampExpX;
     1564      iHeight >>= uiSubSampExpY;
     1565    }
     1566#endif
     1567
    15401568    if ( eRefPicList != REF_PIC_LIST_X )
    15411569    {
    1542       xPredInterUni (pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred, iPartIdx, bPrdDepthMap );
     1570#if DEPTH_MAP_GENERATION
     1571      xPredInterUni (pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred, iPartIdx, bPrdDepthMap, uiSubSampExpX, uiSubSampExpY );
     1572#else
     1573      xPredInterUni (pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred, iPartIdx );
     1574#endif
    15431575#ifdef WEIGHT_PRED
    15441576      if ( pcCU->getSlice()->getPPS()->getUseWP() )
     
    15501582    else
    15511583    {
    1552       xPredInterBi  (pcCU, uiPartAddr, iWidth, iHeight, pcYuvPred, iPartIdx, bPrdDepthMap );
     1584#if DEPTH_MAP_GENERATION
     1585      xPredInterBi  (pcCU, uiPartAddr, iWidth, iHeight, uiSubSampExpX, uiSubSampExpY, pcYuvPred, iPartIdx, bPrdDepthMap );
     1586#else
     1587      xPredInterBi  (pcCU, uiPartAddr, iWidth, iHeight, pcYuvPred, iPartIdx );
     1588#endif
    15531589    }
    15541590  }
     
    15581594#if HIGH_ACCURACY_BI
    15591595#if DEPTH_MAP_GENERATION
    1560 Void TComPrediction::xPredInterUni ( TComDataCU* pcCU, UInt uiPartAddr, Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Int iPartIdx, Bool bPrdDepthMap, Bool bi )
     1596Void TComPrediction::xPredInterUni ( TComDataCU* pcCU, UInt uiPartAddr, Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Int iPartIdx, Bool bPrdDepthMap, UInt uiSubSampExpX, UInt uiSubSampExpY, Bool bi )
    15611597#else
    15621598Void TComPrediction::xPredInterUni ( TComDataCU* pcCU, UInt uiPartAddr, Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Int iPartIdx, Bool bi )
     
    15641600#else
    15651601#if DEPTH_MAP_GENERATION
    1566 Void TComPrediction::xPredInterUni ( TComDataCU* pcCU, UInt uiPartAddr, Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Int iPartIdx, Bool bPrdDepthMap )
     1602Void TComPrediction::xPredInterUni ( TComDataCU* pcCU, UInt uiPartAddr, Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Int iPartIdx, Bool bPrdDepthMap, UInt uiSubSampExpX, UInt uiSubSampExpY )
    15671603#else
    15681604Void TComPrediction::xPredInterUni ( TComDataCU* pcCU, UInt uiPartAddr, Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Int iPartIdx )
     
    15761612#if DEPTH_MAP_GENERATION
    15771613  if( bPrdDepthMap )
     1614  {
     1615    UInt uiRShift = 0;
     1616    xPredInterPrdDepthMap( pcCU, pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPredDepthMap(), uiPartAddr, &cMv, iWidth, iHeight, uiSubSampExpX, uiSubSampExpY, rpcYuvPred, uiRShift );
     1617    return;
     1618  }
     1619#endif
     1620
     1621#if HHI_FULL_PEL_DEPTH_MAP_MV_ACC
     1622  if( pcCU->getSlice()->getSPS()->isDepth() )
    15781623  {
    15791624#if HIGH_ACCURACY_BI
     
    15821627    UInt uiRShift = 0;
    15831628#endif
    1584     xPredInterPrdDepthMap( pcCU, pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPredDepthMap(), uiPartAddr, &cMv, iWidth, iHeight, rpcYuvPred, uiRShift, PDM_DEPTH_MAP_MCP_FILTER );
    1585     return;
    1586   }
    1587 #endif
    1588 
    1589 #if HHI_FULL_PEL_DEPTH_MAP_MV_ACC
    1590   if( pcCU->getSlice()->getSPS()->isDepth() )
    1591   {
    1592 #if HIGH_ACCURACY_BI
    1593     UInt uiRShift = ( bi ? 14-g_uiBitDepth-g_uiBitIncrement : 0 );
     1629#if DEPTH_MAP_GENERATION
     1630    xPredInterPrdDepthMap( pcCU, pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPicYuvRec(), uiPartAddr, &cMv, iWidth, iHeight, 0, 0, rpcYuvPred, uiRShift );
    15941631#else
    1595     UInt uiRShift = 0;
    1596 #endif
    1597     xPredInterPrdDepthMap( pcCU, pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPicYuvRec(), uiPartAddr, &cMv, iWidth, iHeight, rpcYuvPred, uiRShift, 2 );
     1632    xPredInterPrdDepthMap( pcCU, pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPicYuvRec(), uiPartAddr, &cMv, iWidth, iHeight, rpcYuvPred, uiRShift );
     1633#endif
    15981634  }
    15991635  else
     
    16301666}
    16311667
    1632 Void TComPrediction::xPredInterBi ( TComDataCU* pcCU, UInt uiPartAddr, Int iWidth, Int iHeight, TComYuv*& rpcYuvPred, Int iPartIdx, Bool bPrdDepthMap )
     1668#if DEPTH_MAP_GENERATION
     1669Void TComPrediction::xPredInterBi ( TComDataCU* pcCU, UInt uiPartAddr, Int iWidth, Int iHeight, UInt uiSubSampExpX, UInt uiSubSampExpY, TComYuv*& rpcYuvPred, Int iPartIdx, Bool bPrdDepthMap )
     1670#else
     1671Void TComPrediction::xPredInterBi ( TComDataCU* pcCU, UInt uiPartAddr, Int iWidth, Int iHeight, TComYuv*& rpcYuvPred, Int iPartIdx )
     1672#endif
    16331673{
    16341674  TComYuv* pcMbYuv;
     
    16511691    if( pcCU->getCUMvField( REF_PIC_LIST_0 )->getRefIdx( uiPartAddr ) >= 0 && pcCU->getCUMvField( REF_PIC_LIST_1 )->getRefIdx( uiPartAddr ) >= 0 )
    16521692#if DEPTH_MAP_GENERATION
    1653       xPredInterUni ( pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, pcMbYuv, iPartIdx, bPrdDepthMap, true );
     1693      xPredInterUni ( pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, pcMbYuv, iPartIdx, bPrdDepthMap, uiSubSampExpX, uiSubSampExpY, true );
    16541694#else
    16551695      xPredInterUni ( pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, pcMbYuv, iPartIdx, true );
     
    16571697    else
    16581698#if DEPTH_MAP_GENERATION
    1659      xPredInterUni ( pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, pcMbYuv, iPartIdx, bPrdDepthMap );
     1699     xPredInterUni ( pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, pcMbYuv, iPartIdx, bPrdDepthMap, uiSubSampExpX, uiSubSampExpY );
    16601700#else
    16611701     xPredInterUni ( pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, pcMbYuv, iPartIdx );
     
    16631703#else
    16641704#if DEPTH_MAP_GENERATION
    1665     xPredInterUni ( pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, pcMbYuv, iPartIdx, bPrdDepthMap );
     1705    xPredInterUni ( pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, pcMbYuv, iPartIdx, bPrdDepthMap, uiSubSampExpX, uiSubSampExpY );
    16661706#else
    16671707    xPredInterUni ( pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, pcMbYuv, iPartIdx );
     
    16771717  else
    16781718#endif
     1719
     1720#if DEPTH_MAP_GENERATION
     1721  if ( bPrdDepthMap )
     1722  {
     1723    xWeightedAveragePdm( pcCU, &m_acYuvPred[0], &m_acYuvPred[1], iRefIdx[0], iRefIdx[1], uiPartAddr, iWidth, iHeight, rpcYuvPred, uiSubSampExpX, uiSubSampExpY );
     1724  }
     1725  else
     1726  {
     1727    xWeightedAverage( pcCU, &m_acYuvPred[0], &m_acYuvPred[1], iRefIdx[0], iRefIdx[1], uiPartAddr, iWidth, iHeight, rpcYuvPred );
     1728  }
     1729#else
    16791730  xWeightedAverage( pcCU, &m_acYuvPred[0], &m_acYuvPred[1], iRefIdx[0], iRefIdx[1], uiPartAddr, iWidth, iHeight, rpcYuvPred );
     1731#endif
     1732
    16801733}
    16811734
    16821735
    16831736Void
    1684 TComPrediction::xPredInterPrdDepthMap( TComDataCU* pcCU, TComPicYuv* pcPicYuvRef, UInt uiPartAddr, TComMv* pcMv, Int iWidth, Int iHeight, TComYuv*& rpcYuv, UInt uiRShift, UInt uiFilterMode ) // 0:std, 1:bilin, 2:nearest neighbour
    1685 {
    1686   AOF( uiFilterMode <= 2 );
    1687 
     1737#if DEPTH_MAP_GENERATION
     1738TComPrediction::xPredInterPrdDepthMap( TComDataCU* pcCU, TComPicYuv* pcPicYuvRef, UInt uiPartAddr, TComMv* pcMv, Int iWidth, Int iHeight, UInt uiSubSampExpX, UInt uiSubSampExpY, TComYuv*& rpcYuv, UInt uiRShift )
     1739#else
     1740TComPrediction::xPredInterPrdDepthMap( TComDataCU* pcCU, TComPicYuv* pcPicYuvRef, UInt uiPartAddr, TComMv* pcMv, Int iWidth, Int iHeight, TComYuv*& rpcYuv, UInt uiRShift )
     1741#endif
     1742{
     1743#if DEPTH_MAP_GENERATION
     1744  Int     iShiftX     = 2 + uiSubSampExpX;
     1745  Int     iShiftY     = 2 + uiSubSampExpY;
     1746  Int     iAddX       = ( 1 << iShiftX ) >> 1;
     1747  Int     iAddY       = ( 1 << iShiftY ) >> 1;
     1748  Int     iHor        = ( pcMv->getHor() + iAddX ) >> iShiftX;
     1749  Int     iVer        = ( pcMv->getVer() + iAddY ) >> iShiftY;
     1750#if HHI_FULL_PEL_DEPTH_MAP_MV_ACC
     1751  if( pcCU->getSlice()->getSPS()->isDepth() )
     1752  {
     1753    iHor = pcMv->getHor();
     1754    iVer = pcMv->getVer();
     1755  }
     1756#endif
     1757  Int     iRefStride  = pcPicYuvRef->getStride();
     1758  Int     iDstStride  = rpcYuv->getStride();
     1759  Int     iRefOffset  = iHor + iVer * iRefStride;
     1760#else
    16881761  Int     iFPelMask   = ~3;
    16891762  Int     iRefStride  = pcPicYuvRef->getStride();
    16901763  Int     iDstStride  = rpcYuv->getStride();
    1691   Int     iHor        = ( uiFilterMode == 2 ? ( pcMv->getHor() + 2 ) & iFPelMask : pcMv->getHor() );
    1692   Int     iVer        = ( uiFilterMode == 2 ? ( pcMv->getVer() + 2 ) & iFPelMask : pcMv->getVer() );
     1764  Int     iHor        = ( pcMv->getHor() + 2 ) & iFPelMask;
     1765  Int     iVer        = ( pcMv->getVer() + 2 ) & iFPelMask;
    16931766#if HHI_FULL_PEL_DEPTH_MAP_MV_ACC
    16941767  if( pcCU->getSlice()->getSPS()->isDepth() )
    16951768  {
    1696     assert( uiFilterMode == 2 );
    16971769    iHor = pcMv->getHor() * 4;
    16981770    iVer = pcMv->getVer() * 4;
    16991771  }
    17001772#endif
    1701   Int     iRefOffset  = ( iHor >> 2 ) + ( iVer >> 2 ) * iRefStride;
    17021773  Int     ixFrac      = iHor & 0x3;
    17031774  Int     iyFrac      = iVer & 0x3;
     1775  Int     iRefOffset  = ( iHor >> 2 ) + ( iVer >> 2 ) * iRefStride;
     1776#endif
     1777
    17041778  Pel*    piRefY      = pcPicYuvRef->getLumaAddr( pcCU->getAddr(), pcCU->getZorderIdxInCU() + uiPartAddr ) + iRefOffset;
    17051779  Pel*    piDstY      = rpcYuv->getLumaAddr( uiPartAddr );
    17061780
    1707   //  Integer position
    1708   if( ixFrac == 0 && iyFrac == 0 )
    1709   {
    17101781    for( Int y = 0; y < iHeight; y++, piDstY += iDstStride, piRefY += iRefStride )
    17111782    {
     
    17151786      }
    17161787    }
    1717     return;
    1718   }
    1719 
    1720   // bi-linear interpolation
    1721   if( uiFilterMode == 1 )
    1722   {
    1723     Int   iW00    = ( 4 - ixFrac ) * ( 4 - iyFrac );
    1724     Int   iW01    = (     ixFrac ) * ( 4 - iyFrac );
    1725     Int   iW10    = ( 4 - ixFrac ) * (     iyFrac );
    1726     Int   iW11    = (     ixFrac ) * (     iyFrac );
    1727     Pel*  piRefY1 = piRefY + iRefStride;
    1728     for( Int y = 0; y < iHeight; y++, piDstY += iDstStride, piRefY += iRefStride, piRefY1 += iRefStride )
    1729     {
    1730       for( Int x = 0; x < iWidth; x++ )
    1731       {
    1732         Int iSV     = iW00 * piRefY [ x ] + iW01 * piRefY [ x + 1 ]
    1733                     + iW10 * piRefY1[ x ] + iW11 * piRefY1[ x + 1 ];
    1734         iSV       <<= uiRShift;
    1735         piDstY[ x ] = ( iSV + 8 ) >> 4;
    1736       }
    1737     }
    1738     return;
    1739   }
    1740 
    1741   xPredInterLumaBlk( pcCU, pcPicYuvRef, uiPartAddr, pcMv, iWidth, iHeight, rpcYuv );
    1742   return;
    17431788}
    17441789
     
    21672212}
    21682213
     2214#endif
     2215
     2216#if DEPTH_MAP_GENERATION
     2217Void TComPrediction::xWeightedAveragePdm( TComDataCU* pcCU, TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, Int iRefIdx0, Int iRefIdx1, UInt uiPartIdx, Int iWidth, Int iHeight, TComYuv*& rpcYuvDst, UInt uiSubSampExpX, UInt uiSubSampExpY )
     2218{
     2219  if( iRefIdx0 >= 0 && iRefIdx1 >= 0 )
     2220  {
     2221    rpcYuvDst->addAvgPdm( pcYuvSrc0, pcYuvSrc1, uiPartIdx, iWidth, iHeight, uiSubSampExpX, uiSubSampExpY );
     2222  }
     2223  else if ( iRefIdx0 >= 0 && iRefIdx1 <  0 )
     2224  {
     2225    pcYuvSrc0->copyPartToPartYuvPdm( rpcYuvDst, uiPartIdx, iWidth, iHeight, uiSubSampExpX, uiSubSampExpY );
     2226  }
     2227  else if ( iRefIdx0 <  0 && iRefIdx1 >= 0 )
     2228  {
     2229    pcYuvSrc1->copyPartToPartYuvPdm( rpcYuvDst, uiPartIdx, iWidth, iHeight, uiSubSampExpX, uiSubSampExpY );
     2230  }
     2231  else
     2232  {
     2233    assert (0);
     2234  }
     2235}
    21692236#endif
    21702237
  • trunk/source/Lib/TLibCommon/TComPrediction.h

    r5 r21  
    8989#if HIGH_ACCURACY_BI
    9090#if DEPTH_MAP_GENERATION
    91   Void xPredInterUni            ( TComDataCU* pcCU,                          UInt uiPartAddr,               Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Int iPartIdx, Bool bPrdDepthMap, Bool bi=false );
     91  Void xPredInterUni            ( TComDataCU* pcCU,                          UInt uiPartAddr,               Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Int iPartIdx, Bool bPrdDepthMap, UInt uiSubSampExpX = 0, UInt uiSubSampExpY = 0, Bool bi=false );
    9292#else
    9393  Void xPredInterUni            ( TComDataCU* pcCU,                          UInt uiPartAddr,               Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Int iPartIdx, Bool bi=false );
     
    9595#else
    9696#if DEPTH_MAP_GENERATION
    97   Void xPredInterUni            ( TComDataCU* pcCU,                          UInt uiPartAddr,               Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Int iPartIdx, Bool bPrdDepthMap );
     97  Void xPredInterUni            ( TComDataCU* pcCU,                          UInt uiPartAddr,               Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Int iPartIdx, Bool bPrdDepthMap, UInt uiSubSampExpX = 0, UInt uiSubSampExpY = 0 );
    9898#else
    9999  Void xPredInterUni            ( TComDataCU* pcCU,                          UInt uiPartAddr,               Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Int iPartIdx );
    100100#endif
    101101#endif
    102   Void xPredInterBi             ( TComDataCU* pcCU,                          UInt uiPartAddr,               Int iWidth, Int iHeight,                         TComYuv*& rpcYuvPred, Int iPartIdx, Bool bPrdDepthMap );
    103   Void xPredInterPrdDepthMap    ( TComDataCU* pcCU, TComPicYuv* pcPicYuvRef, UInt uiPartAddr, TComMv* pcMv, Int iWidth, Int iHeight,                         TComYuv*& rpcYuv, UInt uiRShift, UInt uiFilterMode ); // 0:std, 1:bilin, 2:nearest neighbour
     102#if DEPTH_MAP_GENERATION
     103  Void xPredInterBi             ( TComDataCU* pcCU,                          UInt uiPartAddr,               Int iWidth, Int iHeight, UInt uiSubSampExpX, UInt uiSubSampExpY, TComYuv*& rpcYuvPred, Int iPartIdx, Bool bPrdDepthMap );
     104  Void xPredInterPrdDepthMap    ( TComDataCU* pcCU, TComPicYuv* pcPicYuvRef, UInt uiPartAddr, TComMv* pcMv, Int iWidth, Int iHeight, UInt uiSubSampExpX, UInt uiSubSampExpY, TComYuv*& rpcYuv, UInt uiRShift );
     105#else
     106  Void xPredInterBi             ( TComDataCU* pcCU,                          UInt uiPartAddr,               Int iWidth, Int iHeight,                         TComYuv*& rpcYuvPred, Int iPartIdx );
     107  Void xPredInterPrdDepthMap    ( TComDataCU* pcCU, TComPicYuv* pcPicYuvRef, UInt uiPartAddr, TComMv* pcMv, Int iWidth, Int iHeight,                         TComYuv*& rpcYuv, UInt uiRShift );
     108#endif
    104109  Void xPredInterLumaBlk        ( TComDataCU* pcCU, TComPicYuv* pcPicYuvRef, UInt uiPartAddr, TComMv* pcMv, Int iWidth, Int iHeight,                         TComYuv*& rpcYuv );
    105110  Void xPredInterChromaBlk      ( TComDataCU* pcCU, TComPicYuv* pcPicYuvRef, UInt uiPartAddr, TComMv* pcMv, Int iWidth, Int iHeight,                         TComYuv*& rpcYuv                            );
     111 
     112#if DEPTH_MAP_GENERATION
     113  Void xWeightedAveragePdm      ( TComDataCU* pcCU, TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, Int iRefIdx0, Int iRefIdx1, UInt uiPartAddr, Int iWidth, Int iHeight, TComYuv*& rpcYuvDst, UInt uiSubSampExpX, UInt uiSubSampExpY );
     114#endif
    106115  Void xWeightedAverage         ( TComDataCU* pcCU, TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, Int iRefIdx0, Int iRefIdx1, UInt uiPartAddr, Int iWidth, Int iHeight, TComYuv*& rpcYuvDst );
     116
     117
    107118  Void xDCTIF_FilterC ( Pel*  piRefC, Int iRefStride,Pel*  piDstC,Int iDstStride,Int iWidth, Int iHeight,Int iMVyFrac,Int iMVxFrac);
    108119
     
    145156 
    146157  // inter
    147   Void motionCompensation         ( TComDataCU*  pcCU, TComYuv* pcYuvPred, RefPicList eRefPicList = REF_PIC_LIST_X, Int iPartIdx = -1, Bool bPrdDepthMap = false );
     158#if DEPTH_MAP_GENERATION
     159  Void motionCompensation         ( TComDataCU*  pcCU, TComYuv* pcYuvPred, RefPicList eRefPicList = REF_PIC_LIST_X, Int iPartIdx = -1, Bool bPrdDepthMap = false, UInt uiSubSampExpX = 0, UInt uiSubSampExpY = 0 );
     160#else
     161  Void motionCompensation         ( TComDataCU*  pcCU, TComYuv* pcYuvPred, RefPicList eRefPicList = REF_PIC_LIST_X, Int iPartIdx = -1 );
     162#endif
    148163 
    149164  // motion vector prediction
  • trunk/source/Lib/TLibCommon/TComResidualGenerator.cpp

    r5 r21  
    432432
    433433  //===== get disparity =====
    434   Int           iMidPosX    = Int( uiXPos + ( ( uiBlkWidth  - 1 ) >> 1 ) );
    435   Int           iMidPosY    = Int( uiYPos + ( ( uiBlkHeight - 1 ) >> 1 ) );
     434  Int           iMidPosX    = Int( uiXPos + ( ( uiBlkWidth  - 1 ) >> 1 ) ) >> m_pcDepthMapGenerator->getSubSampExpX();
     435  Int           iMidPosY    = Int( uiYPos + ( ( uiBlkHeight - 1 ) >> 1 ) ) >> m_pcDepthMapGenerator->getSubSampExpY();
    436436  Int           iDisparity  = m_pcDepthMapGenerator->getDisparity( pcPic, iMidPosX, iMidPosY, uiBaseViewId );
    437437
  • trunk/source/Lib/TLibCommon/TComRom.cpp

    r5 r21  
    28152815  assert( uiWidth == uiHeight );
    28162816
    2817   UChar uhStartX, uhStartY, uhEndX, uhEndY;
    2818   Int    iStepStartX, iStepStartY, iStepEndX, iStepEndY;
    2819 
     2817  UChar  uhStartX = 0, uhStartY = 0, uhEndX = 0, uhEndY = 0;
     2818  Int    iStepStartX = 0, iStepStartY = 0, iStepEndX = 0, iStepEndY = 0;
    28202819  UInt uiBlockSize = 0;
    28212820  switch( eWedgeRes )
  • trunk/source/Lib/TLibCommon/TComSlice.cpp

    r5 r21  
    6666  m_iViewIdx = 0 ;
    6767
     68#if SONY_COLPIC_AVAILABILITY
     69  m_iViewOrderIdx = 0;
     70#endif
     71
    6872  initEqualRef();
    6973  m_bNoBackPredFlag = false;
     
    440444  m_iPOC                 = pSrc->m_iPOC;
    441445  m_iViewIdx             = pSrc->m_iViewIdx;
     446#if SONY_COLPIC_AVAILABILITY
     447  m_iViewOrderIdx        = pSrc->m_iViewOrderIdx;
     448#endif
    442449#if DCM_DECODING_REFRESH
    443450  m_eNalUnitType         = pSrc->m_eNalUnitType;
     
    676683  // AMVP parameter
    677684  ::memset( m_aeAMVPMode, 0, sizeof( m_aeAMVPMode ) );
     685
     686#if ( HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX )
    678687  m_bUseDMM = false;
     688#endif
    679689}
    680690
  • trunk/source/Lib/TLibCommon/TComSlice.h

    r5 r21  
    370370  UInt        m_uiPPSId;
    371371  Int         m_iPOC;
     372#if SONY_COLPIC_AVAILABILITY
     373  Int         m_iViewOrderIdx;
     374#endif
    372375#if DCM_DECODING_REFRESH
    373376  NalUnitType m_eNalUnitType;         ///< Nal unit type for the slice
     
    460463  SliceType getSliceType    ()                          { return  m_eSliceType;         }
    461464  Int       getPOC          ()                          { return  m_iPOC;           }
     465#if SONY_COLPIC_AVAILABILITY
     466  Int       getViewOrderIdx ()                          { return  m_iViewOrderIdx;  }
     467#endif
    462468  Int       getSliceQp      ()                          { return  m_iSliceQp;           }
    463469  Int       getSliceQpDelta ()                          { return  m_iSliceQpDelta;      }
     
    495501  Void      setPPSId            ( UInt u )                      { m_uiPPSId           = u;      }
    496502  Void      setPOC              ( Int i )                       { m_iPOC              = i;      }
     503#if SONY_COLPIC_AVAILABILITY
     504  Void      setViewOrderIdx     ( Int i )                       { m_iViewOrderIdx     = i;      }
     505#endif
    497506#if DCM_DECODING_REFRESH
    498507  Void      setNalUnitType      ( NalUnitType e )               { m_eNalUnitType      = e;      }
  • trunk/source/Lib/TLibCommon/TComYuv.cpp

    r5 r21  
    300300}
    301301
     302#if DEPTH_MAP_GENERATION
     303Void TComYuv::copyPartToPartYuvPdm   ( TComYuv* pcYuvDst, UInt uiPartIdx, UInt iWidth, UInt iHeight, UInt uiSubSampExpX, UInt uiSubSampExpY )
     304{
     305  copyPartToPartLumaPdm   (pcYuvDst, uiPartIdx, iWidth, iHeight, uiSubSampExpX, uiSubSampExpY );
     306}
     307#endif
     308   
    302309Void TComYuv::copyPartToPartYuv   ( TComYuv* pcYuvDst, UInt uiPartIdx, UInt iWidth, UInt iHeight )
    303310{
     
    305312  copyPartToPartChroma (pcYuvDst, uiPartIdx, iWidth>>1, iHeight>>1 );
    306313}
     314
     315#if DEPTH_MAP_GENERATION
     316Void TComYuv::copyPartToPartLumaPdm  ( TComYuv* pcYuvDst, UInt uiPartIdx, UInt iWidth, UInt iHeight, UInt uiSubSampExpX, UInt uiSubSampExpY )
     317{
     318  UInt uiBlkX = g_auiRasterToPelX[ g_auiZscanToRaster[ uiPartIdx ] ] >> uiSubSampExpX;
     319  UInt uiBlkY = g_auiRasterToPelY[ g_auiZscanToRaster[ uiPartIdx ] ] >> uiSubSampExpY;
     320  Pel* pSrc   = getLumaAddr(uiPartIdx);
     321  Pel* pDst   = pcYuvDst->getLumaAddr() + uiBlkY * pcYuvDst->getStride() + uiBlkX;
     322 
     323  if( pSrc == pDst )
     324  {
     325    //th not a good idea
     326    //th best would be to fix the caller
     327    return ;
     328  }
     329 
     330  UInt  iSrcStride = getStride();
     331  UInt  iDstStride = pcYuvDst->getStride();
     332  for ( UInt y = iHeight; y != 0; y-- )
     333  {
     334    ::memcpy( pDst, pSrc, iWidth * sizeof(Pel) );
     335    pSrc += iSrcStride;
     336    pDst += iDstStride;
     337  }
     338}
     339#endif
    307340
    308341Void TComYuv::copyPartToPartLuma  ( TComYuv* pcYuvDst, UInt uiPartIdx, UInt iWidth, UInt iHeight )
     
    801834}
    802835
     836#if DEPTH_MAP_GENERATION
     837Void TComYuv::addAvgPdm( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt iPartUnitIdx, UInt iWidth, UInt iHeight, UInt uiSubSampExpX, UInt uiSubSampExpY )
     838{
     839  Int x, y;
     840
     841  UInt uiBlkX  = g_auiRasterToPelX[ g_auiZscanToRaster[ iPartUnitIdx ] ] >> uiSubSampExpX;
     842  UInt uiBlkY  = g_auiRasterToPelY[ g_auiZscanToRaster[ iPartUnitIdx ] ] >> uiSubSampExpY;
     843  Pel* pSrcY0  = pcYuvSrc0->getLumaAddr( iPartUnitIdx );
     844  Pel* pSrcY1  = pcYuvSrc1->getLumaAddr( iPartUnitIdx );
     845  Pel* pDstY   = getLumaAddr() + uiBlkY * getStride() + uiBlkX;
     846 
     847  UInt  iSrc0Stride = pcYuvSrc0->getStride();
     848  UInt  iSrc1Stride = pcYuvSrc1->getStride();
     849  UInt  iDstStride  = getStride();
     850
     851  for ( y = iHeight-1; y >= 0; y-- )
     852  {
     853    for ( x = iWidth-1; x >= 0; x-- )
     854    {
     855      pDstY[x] = (pSrcY0[x] + pSrcY1[x] + 1) >> 1;
     856    }
     857    pSrcY0 += iSrc0Stride;
     858    pSrcY1 += iSrc1Stride;
     859    pDstY  += iDstStride;
     860  }
     861}
     862#endif
     863
     864
    803865Void TComYuv::removeHighFreq( TComYuv* pcYuvSrc, UInt uiWidht, UInt uiHeight )
    804866{
  • trunk/source/Lib/TLibCommon/TComYuv.h

    r5 r21  
    113113  Void    copyPartToPartLuma    ( TComYuv*    pcYuvDst, UInt uiPartIdx, UInt uiWidth, UInt uiHeight );
    114114  Void    copyPartToPartChroma  ( TComYuv*    pcYuvDst, UInt uiPartIdx, UInt uiWidth, UInt uiHeight );
     115#if DEPTH_MAP_GENERATION
     116  Void    copyPartToPartYuvPdm  ( TComYuv*    pcYuvDst, UInt uiPartIdx, UInt uiWidth, UInt uiHeight, UInt uiSubSampExpX, UInt uiSubSampExpY );
     117  Void    copyPartToPartLumaPdm ( TComYuv*    pcYuvDst, UInt uiPartIdx, UInt uiWidth, UInt uiHeight, UInt uiSubSampExpX, UInt uiSubSampExpY );
     118#endif
    115119 
    116120  // ------------------------------------------------------------------------------------------------------------------
     
    135139#endif
    136140  Void    addAvg            ( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt iPartUnitIdx, UInt iWidth, UInt iHeight );
     141#if DEPTH_MAP_GENERATION
     142  Void    addAvgPdm         ( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt iPartUnitIdx, UInt iWidth, UInt iHeight, UInt uiSubSampExpX, UInt uiSubSampExpY );
     143#endif
    137144
    138145  //   Remove High frequency
  • trunk/source/Lib/TLibCommon/TypeDef.h

    r5 r21  
    4040
    4141
     42
     43#define SONY_COLPIC_AVAILABILITY                  1
     44
    4245//>>>>> HHI 3DV tools >>>>>
    4346#define HHI_INTER_VIEW_MOTION_PRED      1   // inter-view motion parameter prediction
     
    5053#define HHI_VSO_COLOR_PLANES            1   // view synthesis optimization in color planes
    5154#define HHI_VSO_DIST_INT                1   // view synthesis optimization integer distorition in rdo process
     55#define HHI_VSO_LS_TABLE                1   // table based lambda scaling
    5256
    5357#if HHI_INTERVIEW_SKIP_LAMBDA_SCALE && !HHI_INTERVIEW_SKIP
     
    6064#define HHI_NO_LowDelayCoding           0   // old-fashioned encoder control, should be adapted to hm5.0
    6165//<<<<< HHI 3DV tools <<<<<
     66
    6267
    6368
Note: See TracChangeset for help on using the changeset viewer.