Ignore:
Timestamp:
20 Feb 2013, 22:07:43 (12 years ago)
Author:
tech
Message:

Reintegrated branch 5.1-dev0 rev. 295.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/Lib/TLibCommon/TComResidualGenerator.cpp

    r189 r296  
    4444
    4545
    46 #if HHI_INTER_VIEW_RESIDUAL_PRED
     46#if H3D_IVRP
    4747
    4848
     
    184184  AOF  ( pcPic );
    185185
     186#if MTK_MDIVRP_C0138
     187  if (pcPic->getSPS()->getViewId() != 0)
     188  {
     189    return;
     190  }
     191#endif
     192
    186193  if( pcPic->getPOC() == 0 )
    187194  {
     
    219226}
    220227
    221 #if QC_MULTI_DIS_CAN_A0097
     228#if H3D_NBDV
     229#if MTK_RELEASE_DV_CONSTRAINT_C0129
    222230Bool
    223 TComResidualGenerator::getResidualSamples( TComDataCU* pcCU, UInt uiPUIdx, TComYuv* pcYuv, Int iDisp
    224 #if QC_SIMPLIFIEDIVRP_M24938
    225   , Bool bRecon
    226 #endif
    227  )
     231TComResidualGenerator::getResidualSamples( TComDataCU* pcCU, UInt uiPUIdx, TComYuv* pcYuv, TComMv iDisp, Bool bRecon  )
    228232#else
    229233Bool
    230 TComResidualGenerator::getResidualSamples( TComDataCU* pcCU, UInt uiPUIdx, TComYuv* pcYuv
    231 #if QC_SIMPLIFIEDIVRP_M24938
    232   , Bool bRecon
    233 #endif
    234   )
    235 #endif
     234TComResidualGenerator::getResidualSamples( TComDataCU* pcCU, UInt uiPUIdx, TComYuv* pcYuv, Int iDisp, Bool bRecon  )
     235#endif
     236#else
     237Bool
     238TComResidualGenerator::getResidualSamples( TComDataCU* pcCU, UInt uiPUIdx, TComYuv* pcYuv, Bool bRecon )
     239#endif //H3D_NBDV
    236240{
    237241  AOF(  pcCU );
     
    243247  iBlkHeight  = pcCU->getHeight ( 0 );
    244248  pcCU->getPic()->getPicYuvRec()->getTopLeftSamplePos( pcCU->getAddr(), pcCU->getZorderIdxInCU() + uiPartAddr, iXPos, iYPos );
    245 #if QC_MULTI_DIS_CAN_A0097
    246   return getResidualSamples( pcCU->getPic(), (UInt)iXPos, (UInt)iYPos, (UInt)iBlkWidth, (UInt)iBlkHeight, pcYuv, iDisp
    247 #if QC_SIMPLIFIEDIVRP_M24938
    248     , bRecon
    249 #endif
    250   );
    251 #else
    252   return getResidualSamples( pcCU->getPic(), (UInt)iXPos, (UInt)iYPos, (UInt)iBlkWidth, (UInt)iBlkHeight, pcYuv
    253 #if QC_SIMPLIFIEDIVRP_M24938
    254     , bRecon
    255 #endif
    256     );
    257 #endif
     249#if H3D_NBDV
     250#if MTK_RELEASE_DV_CONSTRAINT_C0129
     251  return getResidualSamples( pcCU->getPic(), (UInt)iXPos, (UInt)iYPos, (UInt)iBlkWidth, (UInt)iBlkHeight, pcYuv, iDisp, bRecon);   
     252#else
     253  return getResidualSamples( pcCU->getPic(), (UInt)iXPos, (UInt)iYPos, (UInt)iBlkWidth, (UInt)iBlkHeight, pcYuv, iDisp, bRecon);
     254#endif
     255#else
     256  return getResidualSamples( pcCU->getPic(), (UInt)iXPos, (UInt)iYPos, (UInt)iBlkWidth, (UInt)iBlkHeight, pcYuv, bRecon);
     257#endif // H3D_NBDV
    258258}
    259259 
    260 #if QC_MULTI_DIS_CAN_A0097
     260#if H3D_NBDV
     261#if MTK_RELEASE_DV_CONSTRAINT_C0129
    261262Bool
    262 TComResidualGenerator::getResidualSamples( TComPic* pcPic, UInt uiXPos, UInt uiYPos, UInt uiBlkWidth, UInt uiBlkHeight, TComYuv* pcYuv, Int iDisp
    263 #if QC_SIMPLIFIEDIVRP_M24938
    264   , Bool bRecon
    265 #endif
    266 )
     263TComResidualGenerator::getResidualSamples( TComPic* pcPic, UInt uiXPos, UInt uiYPos, UInt uiBlkWidth, UInt uiBlkHeight, TComYuv* pcYuv, TComMv iDisp, Bool bRecon) 
    267264#else
    268265Bool
    269 TComResidualGenerator::getResidualSamples( TComPic* pcPic, UInt uiXPos, UInt uiYPos, UInt uiBlkWidth, UInt uiBlkHeight, TComYuv* pcYuv
    270 #if QC_SIMPLIFIEDIVRP_M24938
    271   , Bool bRecon
    272 #endif
    273   )
    274 #endif
    275 {
     266TComResidualGenerator::getResidualSamples( TComPic* pcPic, UInt uiXPos, UInt uiYPos, UInt uiBlkWidth, UInt uiBlkHeight, TComYuv* pcYuv, Int iDisp, Bool bRecon)
     267#endif
     268#else
     269Bool
     270TComResidualGenerator::getResidualSamples( TComPic* pcPic, UInt uiXPos, UInt uiYPos, UInt uiBlkWidth, UInt uiBlkHeight, TComYuv* pcYuv, Bool bRecon)
     271#endif
     272{
     273#if MTK_C0138_FIXED
     274  UInt  uiBaseViewId  = 0;
     275#else
    276276  UInt  uiBaseViewId  = m_pcDepthMapGenerator->getBaseViewId( 0 );
    277 
     277#endif
    278278  if( !pcYuv )
    279279  {
    280280    pcYuv = m_ppcYuvTmp[1];
    281281  }
    282 #if QC_SIMPLIFIEDIVRP_M24938
    283282  UInt uiXPosInRefView = uiXPos , uiYPosInRefView = uiYPos;
    284 #endif
    285 #if QC_MULTI_DIS_CAN_A0097
    286   xSetPredResidualBlock( pcPic, uiBaseViewId, uiXPos, uiYPos, uiBlkWidth, uiBlkHeight, pcYuv, iDisp
    287 #if QC_SIMPLIFIEDIVRP_M24938
    288     , &uiXPosInRefView , &uiYPosInRefView , bRecon
    289 #endif 
    290   );
    291 #else
    292   xSetPredResidualBlock( pcPic, uiBaseViewId, uiXPos, uiYPos, uiBlkWidth, uiBlkHeight, pcYuv
    293 #if QC_SIMPLIFIEDIVRP_M24938
    294     , &uiXPosInRefView , &uiYPosInRefView , bRecon
    295 #endif
    296     );
    297 #endif
    298 #if QC_SIMPLIFIEDIVRP_M24938
     283#if H3D_NBDV
     284#if MTK_RELEASE_DV_CONSTRAINT_C0129
     285  xSetPredResidualBlock( pcPic, uiBaseViewId, uiXPos, uiYPos, uiBlkWidth, uiBlkHeight, pcYuv, iDisp, &uiXPosInRefView , &uiYPosInRefView , bRecon  );
     286#else
     287  xSetPredResidualBlock( pcPic, uiBaseViewId, uiXPos, uiYPos, uiBlkWidth, uiBlkHeight, pcYuv, iDisp, &uiXPosInRefView , &uiYPosInRefView , bRecon  );
     288#endif
     289#else
     290  xSetPredResidualBlock( pcPic, uiBaseViewId, uiXPos, uiYPos, uiBlkWidth, uiBlkHeight, pcYuv, &uiXPosInRefView , &uiYPosInRefView , bRecon    );
     291#endif
     292#if MTK_MDIVRP_C0138
     293  return true;
     294#else
    299295  return xIsNonZeroByCBF( uiBaseViewId , uiXPosInRefView , uiYPosInRefView , uiBlkWidth , uiBlkHeight );
    300 #else
    301   return xIsNonZero( pcYuv, uiBlkWidth, uiBlkHeight );
    302 #endif
    303 }
    304 
    305 #if QC_SIMPLIFIEDIVRP_M24938
     296#endif
     297}
     298
    306299Bool TComResidualGenerator::xIsNonZeroByCBF( UInt uiBaseViewId , UInt uiXPos , UInt uiYPos, UInt uiBlkWidth , UInt uiBlkHeight )
    307300{
     
    329322  return( false );
    330323}
    331 #endif
    332324
    333325
     
    419411  Pel*    pRes      = pcCUResidual->getLumaAddr();
    420412  UInt    uiLumaTrMode, uiChromaTrMode;
    421 #if LG_RESTRICTEDRESPRED_M24766
     413#if LG_RESTRICTEDRESPRED_M24766  && !MTK_MDIVRP_C0138
    422414  Int     iPUPredResiShift[4];
    423415#endif
    424416  pcCU->convertTransIdx             ( 0, pcCU->getTransformIdx( 0 ), uiLumaTrMode, uiChromaTrMode );
    425 #if H0736_AVC_STYLE_QP_RANGE
    426417    m_pcTrQuant->setQPforQuant      ( pcCU->getQP( 0 ), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), TEXT_LUMA, pcCU->getSlice()->getSPS()->getQpBDOffsetY(), 0 );
    427 #else
    428     m_pcTrQuant->setQPforQuant      ( pcCU->getQP( 0 ), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), TEXT_LUMA, 0 );
    429 #endif
    430418  m_pcTrQuant->invRecurTransformNxN ( pcCU, 0, TEXT_LUMA, pRes, 0, pcCUResidual->getStride(), uiWidth, uiHeight, uiLumaTrMode, 0, piCoeff );
    431419  // chroma Cb
     
    434422  piCoeff     = pcCU->getCoeffCb();
    435423  pRes        = pcCUResidual->getCbAddr();
    436 #if H0736_AVC_STYLE_QP_RANGE
    437424    m_pcTrQuant->setQPforQuant      ( pcCU->getQP( 0 ), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), TEXT_CHROMA, pcCU->getSlice()->getSPS()->getQpBDOffsetC(), pcCU->getSlice()->getPPS()->getChromaQpOffset() );
    438 #else
    439     m_pcTrQuant->setQPforQuant      ( pcCU->getQP( 0 ), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), TEXT_CHROMA, pcCU->getSlice()->getSPS()->getQpBDOffsetC() );
    440 #endif
    441425  m_pcTrQuant->invRecurTransformNxN ( pcCU, 0, TEXT_CHROMA_U, pRes, 0, pcCUResidual->getCStride(), uiWidth, uiHeight, uiChromaTrMode, 0, piCoeff );
    442426  // chroma Cr
     
    445429  m_pcTrQuant->invRecurTransformNxN ( pcCU, 0, TEXT_CHROMA_V, pRes, 0, pcCUResidual->getCStride(), uiWidth, uiHeight, uiChromaTrMode, 0, piCoeff );
    446430
     431#if !MTK_MDIVRP_C0138
    447432  if( pcCU->getResPredFlag( 0 ) )
    448433  {
    449434    AOF( pcCU->getResPredAvail( 0 ) );
    450     Bool bOK = pcCU->getResidualSamples( 0,
    451 #if QC_SIMPLIFIEDIVRP_M24938
    452       true,
    453 #endif
    454       m_ppcYuvTmp[0] );
     435    Bool bOK = pcCU->getResidualSamples( 0, true, m_ppcYuvTmp[0] );
    455436    AOF( bOK );
    456437#if LG_RESTRICTEDRESPRED_M24766
     
    461442#endif
    462443  }
     444#endif
    463445
    464446  //===== clear inter-view predicted parts =====
     
    517499
    518500
    519 #if QC_MULTI_DIS_CAN_A0097
     501#if H3D_NBDV
     502#if MTK_RELEASE_DV_CONSTRAINT_C0129
     503Void 
     504TComResidualGenerator::xSetPredResidualBlock( TComPic* pcPic, UInt uiBaseViewId, UInt uiXPos, UInt uiYPos, UInt uiBlkWidth, UInt uiBlkHeight, TComYuv* pcYuv, TComMv iDisp
     505                                             ,UInt * puiXPosInRefView , UInt * puiYPosInRefView , Bool bRecon )
     506#else // MTK_RELEASE_DV_CONSTRAINT_C0129
    520507Void 
    521508TComResidualGenerator::xSetPredResidualBlock( TComPic* pcPic, UInt uiBaseViewId, UInt uiXPos, UInt uiYPos, UInt uiBlkWidth, UInt uiBlkHeight, TComYuv* pcYuv, Int iDisp
    522 #if QC_SIMPLIFIEDIVRP_M24938
    523   , UInt * puiXPosInRefView , UInt * puiYPosInRefView , Bool bRecon
    524 #endif
    525 )
    526 #else
     509                                             ,UInt * puiXPosInRefView , UInt * puiYPosInRefView , Bool bRecon)
     510#endif // MTK_RELEASE_DV_CONSTRAINT_C0129
     511#else // H3D_NBDV
    527512Void 
    528513TComResidualGenerator::xSetPredResidualBlock( TComPic* pcPic, UInt uiBaseViewId, UInt uiXPos, UInt uiYPos, UInt uiBlkWidth, UInt uiBlkHeight, TComYuv* pcYuv
    529 #if QC_SIMPLIFIEDIVRP_M24938
    530   , UInt * puiXPosInRefView , UInt * puiYPosInRefView , Bool bRecon
    531 #endif
    532   )
    533 #endif
     514                                             , UInt * puiXPosInRefView , UInt * puiYPosInRefView , Bool bRecon  )
     515#endif // H3D_NBDV
    534516{
    535517  //===== set and check some basic variables =====
     
    548530
    549531  //===== get disparity =====
    550 #if QC_MULTI_DIS_CAN_A0097
     532#if H3D_NBDV
     533#if MTK_RELEASE_DV_CONSTRAINT_C0129
     534  Int iDisparity_y = iDisp.getVer();
     535  Int iDisparity   = iDisp.getHor();
     536#else
    551537  Int iDisparity = iDisp;
    552 #else
     538#endif
     539#else //H3D_NBDV
    553540  Int           iMidPosX    = Int( uiXPos + ( ( uiBlkWidth  - 1 ) >> 1 ) ) >> m_pcDepthMapGenerator->getSubSampExpX();
    554541  Int           iMidPosY    = Int( uiYPos + ( ( uiBlkHeight - 1 ) >> 1 ) ) >> m_pcDepthMapGenerator->getSubSampExpY();
    555542  Int           iDisparity  = m_pcDepthMapGenerator->getDisparity( pcPic, iMidPosX, iMidPosY, uiBaseViewId );
    556 #endif
     543#endif //H3D_NBDV
    557544  //===== compensate luma =====
    558545  Int           iYWidth     = Int( uiBlkWidth  );
     
    562549  Int           iYRefPosX0  = Int( uiXPos )     + ( iDisparity >> 2 );
    563550  Int           iYRefPosX1  = iYRefPosX0        + 1;
     551#if MTK_RELEASE_DV_CONSTRAINT_C0129
     552  Int           iYMaxPosY   = Int( uiPicHeight ) - 1;
     553  Int           iYWeight3   = ( iDisparity_y & 3 );
     554  Int           iYWeight2   = 4 - iYWeight3;
     555  Int           iYRefPosY0  = Max( 0, Min( iYMaxPosY, Int( uiYPos )     + ( iDisparity_y >> 2 )) );
     556  Int           iYRefPosY1  = Max( 0, Min( iYMaxPosY, iYRefPosY0 + 1 ));
     557#endif
    564558  Int           iYMaxPosX   = Int( uiPicWidth ) - 1;
    565559  Int           iSrcStrideY = pcBaseRes->getStride   ();
    566560  Int           iDesStrideY = pcYuv    ->getStride   ();
     561#if MTK_RELEASE_DV_CONSTRAINT_C0129
     562  Pel*          pSrcSamplesY0= pcBaseRes->getLumaAddr ( 0 ) + iYRefPosY0 * iSrcStrideY;
     563  Pel*          pSrcSamplesY1= pcBaseRes->getLumaAddr ( 0 ) + iYRefPosY1 * iSrcStrideY;
     564#else
    567565  Pel*          pSrcSamplesY= pcBaseRes->getLumaAddr ( 0 ) + uiYPos * iSrcStrideY;
     566#endif
    568567  Pel*          pDesSamplesY= pcYuv    ->getLumaAddr ();
    569568
    570 #if QC_SIMPLIFIEDIVRP_M24938
     569
    571570  if( puiXPosInRefView != NULL )
    572571    *puiXPosInRefView = Max( 0, Min( iYMaxPosX, iYRefPosX0 ) );
     
    575574  if( bRecon == false )
    576575    return;
    577 #endif
    578 
     576
     577#if MTK_RELEASE_DV_CONSTRAINT_C0129
     578  for(   Int iY = 0; iY < iYHeight; iY++, pSrcSamplesY0 += iSrcStrideY, pSrcSamplesY1 += iSrcStrideY, pDesSamplesY += iDesStrideY )
     579#else
    579580  for(   Int iY = 0; iY < iYHeight; iY++, pSrcSamplesY += iSrcStrideY, pDesSamplesY += iDesStrideY )
     581#endif
    580582  {
    581583    for( Int iX = 0; iX < iYWidth; iX++ )
     
    583585      Int iXPic0        = Max( 0, Min( iYMaxPosX, iYRefPosX0 + iX ) );
    584586      Int iXPic1        = Max( 0, Min( iYMaxPosX, iYRefPosX1 + iX ) );
     587#if MTK_RELEASE_DV_CONSTRAINT_C0129
     588      Pel Temp1,Temp2;
     589      Temp1 =( iYWeight0 * pSrcSamplesY0[iXPic0] + iYWeight1 * pSrcSamplesY0[iXPic1] + 2 ) >> 2;
     590      Temp2 =( iYWeight0 * pSrcSamplesY1[iXPic0] + iYWeight1 * pSrcSamplesY1[iXPic1] + 2 ) >> 2;
     591      pDesSamplesY[iX]  = ( iYWeight2 * Temp1 + iYWeight3 * Temp2 + 2 ) >> 2;
     592#else
    585593      pDesSamplesY[iX]  = ( iYWeight0 * pSrcSamplesY[iXPic0] + iYWeight1 * pSrcSamplesY[iXPic1] + 2 ) >> 2;
     594#endif
    586595    }
    587596  }
     
    594603  Int           iCRefPosX0  = Int( uiXPos     >> 1 ) + ( iDisparity >> 3 );
    595604  Int           iCRefPosX1  = iCRefPosX0             + 1;
     605#if MTK_RELEASE_DV_CONSTRAINT_C0129
     606  Int           iCMaxPosY   = Int( uiPicHeight >> 1 ) - 1;
     607  Int           iCWeight3   = ( iDisparity_y & 7 );
     608  Int           iCWeight2   = 8 - iCWeight3;
     609  Int           iCRefPosY0  = Max( 0, Min( iCMaxPosY, Int( uiYPos >> 1 )     + ( iDisparity_y >> 3 )) );
     610  Int           iCRefPosY1  = Max( 0, Min( iCMaxPosY, iCRefPosY0 + 1 ));
     611#endif
    596612  Int           iCMaxPosX   = Int( uiPicWidth >> 1 ) - 1;
    597613  Int           iSrcStrideC = pcBaseRes->getCStride();
    598614  Int           iDesStrideC = pcYuv    ->getCStride();
     615#if MTK_RELEASE_DV_CONSTRAINT_C0129
     616  Pel*          pSrcSamplesU0= pcBaseRes->getCbAddr ( 0 ) + ( iCRefPosY0 >> 1 ) * iSrcStrideC;
     617  Pel*          pSrcSamplesU1= pcBaseRes->getCbAddr ( 0 ) + ( iCRefPosY1 >> 1 ) * iSrcStrideC;
     618  Pel*          pSrcSamplesV0= pcBaseRes->getCrAddr ( 0 ) + ( iCRefPosY0 >> 1 ) * iSrcStrideC;
     619  Pel*          pSrcSamplesV1= pcBaseRes->getCrAddr ( 0 ) + ( iCRefPosY1 >> 1 ) * iSrcStrideC;
     620#else
    599621  Pel*          pSrcSamplesU= pcBaseRes->getCbAddr ( 0 ) + ( uiYPos >> 1 ) * iSrcStrideC;
    600622  Pel*          pSrcSamplesV= pcBaseRes->getCrAddr ( 0 ) + ( uiYPos >> 1 ) * iSrcStrideC;
     623#endif
    601624  Pel*          pDesSamplesU= pcYuv    ->getCbAddr ();
    602625  Pel*          pDesSamplesV= pcYuv    ->getCrAddr ();
     626#if MTK_RELEASE_DV_CONSTRAINT_C0129
     627  for(   Int iY = 0; iY < iCHeight; iY++, pSrcSamplesU0 += iSrcStrideC, pSrcSamplesU1 += iSrcStrideC, pDesSamplesU += iDesStrideC,
     628                                          pSrcSamplesV0 += iSrcStrideC, pSrcSamplesV1 += iSrcStrideC, pDesSamplesV += iDesStrideC )
     629#else
    603630  for(   Int iY = 0; iY < iCHeight; iY++, pSrcSamplesU += iSrcStrideC, pDesSamplesU += iDesStrideC,
    604631                                          pSrcSamplesV += iSrcStrideC, pDesSamplesV += iDesStrideC )
     632#endif
    605633  {
    606634    for( Int iX = 0; iX < iCWidth; iX++ )
     
    608636      Int iXPic0        = Max( 0, Min( iCMaxPosX, iCRefPosX0 + iX ) );
    609637      Int iXPic1        = Max( 0, Min( iCMaxPosX, iCRefPosX1 + iX ) );
     638#if MTK_RELEASE_DV_CONSTRAINT_C0129
     639      Pel Temp1,Temp2;
     640      Temp1 =( iCWeight0 * pSrcSamplesU0[iXPic0] + iCWeight1 * pSrcSamplesU0[iXPic1] + 4 ) >> 3;
     641      Temp2 =( iCWeight0 * pSrcSamplesU1[iXPic0] + iCWeight1 * pSrcSamplesU1[iXPic1] + 4 ) >> 3;
     642      pDesSamplesU[iX]  = ( iCWeight2 * Temp1 + iCWeight3 * Temp2 + 4 ) >> 3;
     643      Temp1 =( iCWeight0 * pSrcSamplesV0[iXPic0] + iCWeight1 * pSrcSamplesV0[iXPic1] + 4 ) >> 3;
     644      Temp2 =( iCWeight0 * pSrcSamplesV1[iXPic0] + iCWeight1 * pSrcSamplesV1[iXPic1] + 4 ) >> 3;
     645      pDesSamplesV[iX]  = ( iCWeight2 * Temp1 + iCWeight3 * Temp2 + 4 ) >> 3;
     646#else
    610647      pDesSamplesU[iX]  = ( iCWeight0 * pSrcSamplesU[iXPic0] + iCWeight1 * pSrcSamplesU[iXPic1] + 4 ) >> 3;
    611648      pDesSamplesV[iX]  = ( iCWeight0 * pSrcSamplesV[iXPic0] + iCWeight1 * pSrcSamplesV[iXPic1] + 4 ) >> 3;
     649#endif
    612650    }
    613651  }
     
    705743
    706744
    707 #endif // HHI_INTER_VIEW_RESIDUAL_PRED
    708 
     745#endif // H3D_IVRP
     746
Note: See TracChangeset for help on using the changeset viewer.