Changeset 724 in 3DVCSoftware for trunk/source/Lib/TLibCommon/TComPrediction.cpp


Ignore:
Timestamp:
30 Nov 2013, 12:29:49 (11 years ago)
Author:
tech
Message:

Merged HTM-8.2-dev0@723.

File:
1 edited

Legend:

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

    r655 r724  
    425425  Bool dimDeltaDC = isDimDeltaDC( uiIntraMode );   
    426426  Bool isDmmMode  = (dimType <  DMM_NUM_TYPE);
     427#if !SEC_DMM3_RBC_F0147
    427428  Bool isRbcMode  = (dimType == RBC_IDX);
     429#endif
    428430
    429431  Bool* biSegPattern  = NULL;
     
    441443        dmmSegmentation = &(g_dmmWedgeLists[ g_aucConvertToBit[iWidth] ][ pcCU->getDmmWedgeTabIdx( dimType, uiAbsPartIdx ) ]);
    442444      } break;
     445#if !SEC_DMM3_RBC_F0147
    443446    case( DMM3_IDX ):
    444447      {
     
    452455        dmmSegmentation = &(g_dmmWedgeLists[ g_aucConvertToBit[iWidth] ][ uiTabIdx ]);
    453456      } break;
     457#endif
    454458    case( DMM4_IDX ):
    455459      {
     
    475479  assert( biSegPattern );
    476480  Int* piMask = NULL;
     481#if QC_DIM_DELTADC_UNIFY_F0132 || HHI_DIM_PREDSAMP_FIX_F0171
     482  piMask = pcCU->getPattern()->getAdiOrgBuf( iWidth, iHeight, m_piYuvExt ); // no filtering
     483#else
    477484  if( isDmmMode ) piMask = pcCU->getPattern()->getAdiOrgBuf( iWidth, iHeight, m_piYuvExt ); // no filtering for DMM
    478485  else            piMask = pcCU->getPattern()->getPredictorPtr( 0, g_aucConvertToBit[ iWidth ] + 2, m_piYuvExt );
     486#endif
    479487  assert( piMask );
    480488  Int maskStride = 2*iWidth + 1; 
     
    491499    Pel deltaDC2 = pcCU->getDimDeltaDC( dimType, 1, uiAbsPartIdx );
    492500#if H_3D_DIM_DMM
     501#if QC_DIM_DELTADC_UNIFY_F0132 && !SEC_DMM3_RBC_F0147
     502    if( isDmmMode || isRbcMode)
     503#else
    493504    if( isDmmMode )
     505#endif
    494506    {
    495507#if H_3D_DIM_DLT
     
    502514    }
    503515#endif
    504 #if H_3D_DIM_RBC
     516#if H_3D_DIM_RBC && !QC_DIM_DELTADC_UNIFY_F0132
    505517    if( isRbcMode )
    506518    {
     
    549561}
    550562
     563#if MTK_SPIVMP_F0110
     564Void TComPrediction::xGetSubPUAddrAndMerge(TComDataCU* pcCU, UInt uiPartAddr, Int iSPWidth, Int iSPHeight, Int iNumSPInOneLine, Int iNumSP, UInt* uiMergedSPW, UInt* uiMergedSPH, UInt* uiSPAddr )
     565{
     566  for (Int i = 0; i < iNumSP; i++)
     567  {
     568    uiMergedSPW[i] = iSPWidth;
     569    uiMergedSPH[i] = iSPHeight;
     570    pcCU->getSPAbsPartIdx(uiPartAddr, iSPWidth, iSPHeight, i, iNumSPInOneLine, uiSPAddr[i]);
     571  }
     572  // horizontal sub-PU merge
     573  for (Int i=0; i<iNumSP; i++)
     574  {
     575    if (i % iNumSPInOneLine == iNumSPInOneLine - 1 || uiMergedSPW[i]==0 || uiMergedSPH[i]==0)
     576    {
     577      continue;
     578    }
     579    for (Int j=i+1; j<i+iNumSPInOneLine-i%iNumSPInOneLine; j++)
     580    {
     581      if (xCheckTwoSPMotion(pcCU, uiSPAddr[i], uiSPAddr[j]))
     582      {
     583        uiMergedSPW[i] += iSPWidth;
     584        uiMergedSPW[j] = uiMergedSPH[j] = 0;
     585      }
     586      else
     587      {
     588        break;
     589      }
     590    }
     591  }
     592  //vertical sub-PU merge
     593  for (Int i=0; i<iNumSP-iNumSPInOneLine; i++)
     594  {
     595    if (uiMergedSPW[i]==0 || uiMergedSPH[i]==0)
     596    {
     597      continue;
     598    }
     599    for (Int j=i+iNumSPInOneLine; j<iNumSP; j+=iNumSPInOneLine)
     600    {
     601      if (xCheckTwoSPMotion(pcCU, uiSPAddr[i], uiSPAddr[j]) && uiMergedSPW[i]==uiMergedSPW[j])
     602      {
     603        uiMergedSPH[i] += iSPHeight;
     604        uiMergedSPH[j] = uiMergedSPW[j] = 0;
     605      }
     606      else
     607      {
     608        break;
     609      }
     610    }
     611  }
     612}
     613
     614Bool TComPrediction::xCheckTwoSPMotion ( TComDataCU* pcCU, UInt PartAddr0, UInt PartAddr1 )
     615{
     616  if( pcCU->getCUMvField(REF_PIC_LIST_0)->getRefIdx(PartAddr0) != pcCU->getCUMvField(REF_PIC_LIST_0)->getRefIdx(PartAddr1))
     617  {
     618    return false;
     619  }
     620  if( pcCU->getCUMvField(REF_PIC_LIST_1)->getRefIdx(PartAddr0) != pcCU->getCUMvField(REF_PIC_LIST_1)->getRefIdx(PartAddr1))
     621  {
     622    return false;
     623  }
     624
     625  if (pcCU->getCUMvField(REF_PIC_LIST_0)->getRefIdx(PartAddr0) >= 0)
     626  {
     627    if (pcCU->getCUMvField(REF_PIC_LIST_0)->getMv(PartAddr0) != pcCU->getCUMvField(REF_PIC_LIST_0)->getMv(PartAddr1))
     628    {
     629      return false;
     630    }
     631  }
     632
     633  if (pcCU->getCUMvField(REF_PIC_LIST_1)->getRefIdx(PartAddr0) >= 0)
     634  {
     635    if (pcCU->getCUMvField(REF_PIC_LIST_1)->getMv(PartAddr0) != pcCU->getCUMvField(REF_PIC_LIST_1)->getMv(PartAddr1))
     636    {
     637      return false;
     638    }
     639  }
     640  return true;
     641}
     642#endif
    551643
    552644Void TComPrediction::motionCompensation ( TComDataCU* pcCU, TComYuv* pcYuvPred, RefPicList eRefPicList, Int iPartIdx )
     
    580672      else
    581673      {
    582         if ( xCheckIdenticalMotion( pcCU, uiPartAddr ) )
    583         {
    584           xPredInterUni (pcCU, uiPartAddr, iWidth, iHeight, REF_PIC_LIST_0, pcYuvPred );
     674#if MTK_SPIVMP_F0110
     675        if ( pcCU->getSPIVMPFlag(uiPartAddr)!=0) 
     676        {
     677          Int iNumSPInOneLine, iNumSP, iSPWidth, iSPHeight;
     678
     679          pcCU->getSPPara(iWidth, iHeight, iNumSP, iNumSPInOneLine, iSPWidth, iSPHeight);
     680
     681          UInt uiW[256], uiH[256];
     682          UInt uiSPAddr[256];
     683
     684          xGetSubPUAddrAndMerge(pcCU, uiPartAddr, iSPWidth, iSPHeight, iNumSPInOneLine, iNumSP, uiW, uiH, uiSPAddr);
     685
     686          //MC
     687          for (Int i = 0; i < iNumSP; i++)
     688          {
     689            if (uiW[i]==0 || uiH[i]==0)
     690            {
     691              continue;
     692            }
     693            if( xCheckIdenticalMotion( pcCU, uiSPAddr[i] ))
     694            {
     695              xPredInterUni (pcCU, uiSPAddr[i], uiW[i], uiH[i], REF_PIC_LIST_0, pcYuvPred );
     696            }
     697            else
     698            {
     699              xPredInterBi  (pcCU, uiSPAddr[i], uiW[i], uiH[i], pcYuvPred);
     700            }
     701          }
    585702        }
    586703        else
    587704        {
    588           xPredInterBi  (pcCU, uiPartAddr, iWidth, iHeight, pcYuvPred );
    589         }
     705#endif
     706          if ( xCheckIdenticalMotion( pcCU, uiPartAddr ) )
     707          {
     708            xPredInterUni (pcCU, uiPartAddr, iWidth, iHeight, REF_PIC_LIST_0, pcYuvPred );
     709          }
     710          else
     711          {
     712            xPredInterBi  (pcCU, uiPartAddr, iWidth, iHeight, pcYuvPred );
     713          }
     714#if MTK_SPIVMP_F0110
     715        }
     716#endif
    590717      }
    591718#if H_3D_VSP
     
    631758      else
    632759      {
     760#if MTK_SPIVMP_F0110
     761       if (pcCU->getSPIVMPFlag(uiPartAddr)!=0) 
     762      {
     763        Int iNumSPInOneLine, iNumSP, iSPWidth, iSPHeight;
     764
     765        pcCU->getSPPara(iWidth, iHeight, iNumSP, iNumSPInOneLine, iSPWidth, iSPHeight);
     766
     767        UInt uiW[256], uiH[256];
     768        UInt uiSPAddr[256];
     769
     770        xGetSubPUAddrAndMerge(pcCU, uiPartAddr, iSPWidth, iSPHeight, iNumSPInOneLine, iNumSP, uiW, uiH, uiSPAddr);
     771        //MC
     772        for (Int i = 0; i < iNumSP; i++)
     773        {
     774          if (uiW[i]==0 || uiH[i]==0)
     775          {
     776            continue;
     777          }
     778          if( xCheckIdenticalMotion( pcCU, uiSPAddr[i] ))
     779          {
     780            xPredInterUni (pcCU, uiSPAddr[i], uiW[i], uiH[i], REF_PIC_LIST_0, pcYuvPred );
     781          }
     782          else
     783          {
     784            xPredInterBi  (pcCU, uiSPAddr[i], uiW[i], uiH[i], pcYuvPred);
     785          }
     786        }
     787      }
     788      else
     789      {
     790#endif
    633791        if ( xCheckIdenticalMotion( pcCU, uiPartAddr ) )
    634792        {
     
    639797          xPredInterBi  (pcCU, uiPartAddr, iWidth, iHeight, pcYuvPred );
    640798        }
     799#if MTK_SPIVMP_F0110
     800       }
     801#endif
    641802      }
    642803#if H_3D_VSP
     
    664825  pcCU->clipMv(cMv);
    665826#if H_3D_ARP
     827#if QC_MTK_INTERVIEW_ARP_F0123_F0108
     828  if(pcCU->getARPW( uiPartAddr ) > 0  && pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPOC()== pcCU->getSlice()->getPOC())
     829  {
     830      xPredInterUniARPviewRef( pcCU , uiPartAddr , iWidth , iHeight , eRefPicList , rpcYuvPred , bi );
     831  }
     832  else
     833#endif
    666834  if(  pcCU->getARPW( uiPartAddr ) > 0
    667835    && pcCU->getPartitionSize(uiPartAddr)==SIZE_2Nx2N
     
    744912  // fetch virtual depth map
    745913  pcBaseViewDepthPicYuv->extendPicBorder();
     914
     915#if MTK_F0109_LG_F0120_VSP_BLOCK
     916  Int vspSize=0;
     917  xGetVirtualDepth( pcCU, pcBaseViewDepthPicYuv, &cDv, uiPartAddr, iWidth, iHeight, &m_cYuvDepthOnVsp,vspSize );
     918  // sub-PU based compensation
     919  xPredInterLumaBlkFromDM   ( pcCU, pcBaseViewTxtPicYuv, &m_cYuvDepthOnVsp, pShiftLUT, &cDv, uiPartAddr, iWidth, iHeight, pcCU->getSlice()->getIsDepth(), rpcYuvPred, bi, vspSize);
     920  xPredInterChromaBlkFromDM ( pcCU, pcBaseViewTxtPicYuv, &m_cYuvDepthOnVsp, pShiftLUT, &cDv, uiPartAddr, iWidth, iHeight, pcCU->getSlice()->getIsDepth(), rpcYuvPred, bi, vspSize);
     921#else
    746922  xGetVirtualDepth( pcCU, pcBaseViewDepthPicYuv, &cDv, uiPartAddr, iWidth, iHeight, &m_cYuvDepthOnVsp );
    747923  // sub-PU based compensation
    748924  xPredInterLumaBlkFromDM   ( pcCU, pcBaseViewTxtPicYuv, &m_cYuvDepthOnVsp, pShiftLUT, &cDv, uiPartAddr, iWidth, iHeight, pcCU->getSlice()->getIsDepth(), rpcYuvPred, bi );
    749925  xPredInterChromaBlkFromDM ( pcCU, pcBaseViewTxtPicYuv, &m_cYuvDepthOnVsp, pShiftLUT, &cDv, uiPartAddr, iWidth, iHeight, pcCU->getSlice()->getIsDepth(), rpcYuvPred, bi );
     926#endif
    750927}
    751928#endif
     
    777954  if( cDistparity.bDV )
    778955  {
     956#if SHARP_ARP_REF_CHECK_F0105
     957    Int arpRefIdx = pcCU->getSlice()->getFirstTRefIdx(eRefPicList);
     958    if( dW > 0 && pcCU->getSlice()->getRefPic( eRefPicList, arpRefIdx )->getPOC()!= pcCU->getSlice()->getPOC() )
     959#else
    779960    if( dW > 0 && pcCU->getSlice()->getRefPic( eRefPicList, 0 )->getPOC()!= pcCU->getSlice()->getPOC() )
     961#endif
    780962    {
    781963      bTobeScaled = true;
     
    783965
    784966    pcPicYuvBaseCol =  pcCU->getSlice()->getBaseViewRefPic( pcCU->getSlice()->getPOC(),                              cDistparity.m_aVIdxCan );
     967
     968#if SHARP_ARP_REF_CHECK_F0105
     969    pcPicYuvBaseRef =  pcCU->getSlice()->getBaseViewRefPic( pcCU->getSlice()->getRefPic( eRefPicList, arpRefIdx )->getPOC(), cDistparity.m_aVIdxCan );
     970
     971    if (!pcCU->getSlice()->getArpRefPicAvailable( eRefPicList, cDistparity.m_aVIdxCan))
     972#else
    785973    pcPicYuvBaseRef =  pcCU->getSlice()->getBaseViewRefPic( pcCU->getSlice()->getRefPic( eRefPicList, 0 )->getPOC(), cDistparity.m_aVIdxCan );
    786974   
    787975    if( ( !pcPicYuvBaseCol || pcPicYuvBaseCol->getPOC() != pcCU->getSlice()->getPOC() ) || ( !pcPicYuvBaseRef || pcPicYuvBaseRef->getPOC() != pcCU->getSlice()->getRefPic( eRefPicList, 0 )->getPOC() ) )
     976#endif
    788977    {
    789978      dW = 0;
     
    792981    else
    793982    {
     983#if SHARP_ARP_REF_CHECK_F0105
     984      assert( pcPicYuvBaseCol->getPOC() == pcCU->getSlice()->getPOC() && pcPicYuvBaseRef->getPOC() == pcCU->getSlice()->getRefPic( eRefPicList, arpRefIdx )->getPOC() );
     985#else
    794986      assert( pcPicYuvBaseCol->getPOC() == pcCU->getSlice()->getPOC() && pcPicYuvBaseRef->getPOC() == pcCU->getSlice()->getRefPic( eRefPicList, 0 )->getPOC() );
     987#endif
    795988    }
    796989
     
    8411034  }
    8421035}
     1036#if QC_MTK_INTERVIEW_ARP_F0123_F0108
     1037Void TComPrediction::xPredInterUniARPviewRef( TComDataCU* pcCU, UInt uiPartAddr, Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Bool bi, TComMvField * pNewMvFiled )
     1038{
     1039  Int         iRefIdx       = pcCU->getCUMvField( eRefPicList )->getRefIdx( uiPartAddr );           
     1040  TComMv      cDMv          = pcCU->getCUMvField( eRefPicList )->getMv( uiPartAddr );
     1041  TComMv      cTempDMv      = cDMv;
     1042  UChar       dW            = pcCU->getARPW ( uiPartAddr );
     1043
     1044  TComPic* pcPicYuvBaseTRef = NULL;
     1045  TComPic* pcPicYuvCurrTRef = NULL;
     1046  TComPic* pcPicYuvBaseCol  = pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx ); 
     1047  TComPicYuv* pcYuvBaseCol  = pcPicYuvBaseCol->getPicYuvRec();   
     1048  Bool bTMVAvai = false;     
     1049  TComMv cBaseTMV;
     1050  if( pNewMvFiled )
     1051  {
     1052    iRefIdx = pNewMvFiled->getRefIdx();
     1053    cDMv = pNewMvFiled->getMv();
     1054  }
     1055  pcCU->clipMv(cTempDMv);
     1056
     1057  assert(dW > 0);
     1058#if SHARP_ARP_REF_CHECK_F0105
     1059  if (!pcCU->getSlice()->getArpRefPicAvailable( eRefPicList, pcPicYuvBaseCol->getViewIndex()))
     1060  {
     1061    dW = 0;
     1062  }
     1063#endif
     1064  Int uiLCUAddr,uiAbsPartAddr;
     1065  Int irefPUX = pcCU->getCUPelX() + g_auiRasterToPelX[g_auiZscanToRaster[uiPartAddr]] + iWidth/2  + ((cDMv.getHor() + 2)>>2);
     1066  Int irefPUY = pcCU->getCUPelY() + g_auiRasterToPelY[g_auiZscanToRaster[uiPartAddr]] + iHeight/2 + ((cDMv.getVer() + 2)>>2);
     1067
     1068  irefPUX = (Int)Clip3<Int>(0, pcCU->getSlice()->getSPS()-> getPicWidthInLumaSamples()-1, irefPUX);
     1069  irefPUY = (Int)Clip3<Int>(0, pcCU->getSlice()->getSPS()->getPicHeightInLumaSamples()-1, irefPUY); 
     1070  pcYuvBaseCol->getCUAddrAndPartIdx( irefPUX, irefPUY, uiLCUAddr, uiAbsPartAddr);
     1071  TComDataCU *pColCU = pcPicYuvBaseCol->getCU( uiLCUAddr );
     1072
     1073  if(!pColCU->isIntra(uiAbsPartAddr))
     1074  {
     1075    TComMvField puMVField;
     1076    for(Int iList = 0; iList < (pColCU->getSlice()->isInterB() ? 2: 1) && !bTMVAvai; iList ++)
     1077    {
     1078      RefPicList eRefPicListCurr = RefPicList(iList);
     1079      Int iRef = pColCU->getCUMvField(eRefPicListCurr)->getRefIdx(uiAbsPartAddr);
     1080      if( iRef != -1)
     1081      {
     1082        pcPicYuvBaseTRef = pColCU->getSlice()->getRefPic(eRefPicListCurr, iRef); 
     1083        Int  iCurrPOC    = pColCU->getSlice()->getPOC();
     1084        Int  iCurrRefPOC = pcPicYuvBaseTRef->getPOC();
     1085        Int  iCurrRef    = pcCU->getSlice()->getFirstTRefIdx(eRefPicListCurr);
     1086        if( iCurrRef >= 0)
     1087        {
     1088          pcPicYuvCurrTRef =  pcCU->getSlice()->getRefPic(eRefPicListCurr,iCurrRef); 
     1089          Int iTargetPOC = pcPicYuvCurrTRef->getPOC();
     1090          {
     1091            pcPicYuvBaseTRef =  pcCU->getSlice()->getBaseViewRefPic(iTargetPOC,  pcPicYuvBaseCol->getViewIndex() ); 
     1092            if(pcPicYuvBaseTRef)
     1093            {
     1094              cBaseTMV = pColCU->getCUMvField(eRefPicListCurr)->getMv(uiAbsPartAddr);
     1095              Int iScale = pcCU-> xGetDistScaleFactor(iCurrPOC, iTargetPOC, iCurrPOC, iCurrRefPOC);
     1096              if ( iScale != 4096 )
     1097                cBaseTMV = cBaseTMV.scaleMv( iScale );                 
     1098              bTMVAvai = true;
     1099              break;
     1100            }
     1101          }
     1102        }
     1103      }
     1104    }
     1105  }
     1106  if (bTMVAvai == false)
     1107  {
     1108    bTMVAvai = true;
     1109    cBaseTMV.set(0, 0);
     1110    pcPicYuvBaseTRef =  pColCU->getSlice()->getRefPic(eRefPicList,  pcCU->getSlice()->getFirstTRefIdx(eRefPicList)); 
     1111    pcPicYuvCurrTRef =  pcCU->getSlice()->getRefPic  (eRefPicList,  pcCU->getSlice()->getFirstTRefIdx(eRefPicList));     
     1112  }
     1113
     1114  xPredInterLumaBlk  ( pcCU, pcYuvBaseCol, uiPartAddr, &cTempDMv, iWidth, iHeight, rpcYuvPred, bi,        bTMVAvai);
     1115  xPredInterChromaBlk( pcCU, pcYuvBaseCol, uiPartAddr, &cTempDMv, iWidth, iHeight, rpcYuvPred, bi,        bTMVAvai);
     1116
     1117  if( dW > 0 && bTMVAvai )
     1118  {
     1119    TComYuv*    pYuvCurrTRef    = &m_acYuvPredBase[0];
     1120    TComYuv*    pYuvBaseTRef    = &m_acYuvPredBase[1];
     1121    TComPicYuv* pcYuvCurrTref   = pcPicYuvCurrTRef->getPicYuvRec();       
     1122    TComPicYuv* pcYuvBaseTref   = pcPicYuvBaseTRef->getPicYuvRec(); 
     1123    TComMv      cTempMv         = cDMv + cBaseTMV;
     1124
     1125    pcCU->clipMv(cBaseTMV);
     1126    pcCU->clipMv(cTempMv);
     1127
     1128    xPredInterLumaBlk  ( pcCU, pcYuvCurrTref, uiPartAddr, &cBaseTMV, iWidth, iHeight, pYuvCurrTRef, bi,   true);
     1129    xPredInterChromaBlk( pcCU, pcYuvCurrTref, uiPartAddr, &cBaseTMV, iWidth, iHeight, pYuvCurrTRef, bi,   true);
     1130    xPredInterLumaBlk  ( pcCU, pcYuvBaseTref, uiPartAddr, &cTempMv,  iWidth, iHeight, pYuvBaseTRef, bi,   true);
     1131    xPredInterChromaBlk( pcCU, pcYuvBaseTref, uiPartAddr, &cTempMv,  iWidth, iHeight, pYuvBaseTRef, bi,   true);
     1132
     1133    pYuvCurrTRef->subtractARP( pYuvCurrTRef , pYuvBaseTRef , uiPartAddr , iWidth , iHeight ); 
     1134    if(dW == 2)
     1135    {
     1136      pYuvCurrTRef->multiplyARP( uiPartAddr , iWidth , iHeight , dW );
     1137    }
     1138    rpcYuvPred->addARP( rpcYuvPred , pYuvCurrTRef , uiPartAddr , iWidth , iHeight , !bi );
     1139  }
     1140}
     1141#endif
     1142
    8431143#endif
    8441144
     
    14991799#if H_3D_VSP
    15001800// not fully support iRatioTxtPerDepth* != 1
     1801#if MTK_F0109_LG_F0120_VSP_BLOCK
     1802Void TComPrediction::xGetVirtualDepth( TComDataCU *cu, TComPicYuv *picRefDepth, TComMv *mv, UInt partAddr, Int width, Int height, TComYuv *yuvDepth, Int &vspSize, Int ratioTxtPerDepthX, Int ratioTxtPerDepthY )
     1803#else
    15011804Void TComPrediction::xGetVirtualDepth( TComDataCU *cu, TComPicYuv *picRefDepth, TComMv *mv, UInt partAddr, Int width, Int height, TComYuv *yuvDepth, Int ratioTxtPerDepthX, Int ratioTxtPerDepthY )
     1805#endif
    15021806{
    15031807  Int nTxtPerDepthX = H_3D_VSP_BLOCKSIZE;
     
    15271831  Pel *depth = yuvDepth->getLumaAddr();
    15281832
     1833#if !SHARP_VSP_BLOCK_IN_AMP_F0102
    15291834  if( width<8 || height<8 )
    15301835  { // no split
     
    15461851      depth += depStrideBlock;
    15471852    }
     1853#if MTK_F0109_LG_F0120_VSP_BLOCK
     1854  if(width==4)
     1855    vspSize=0;
     1856  else
     1857    vspSize=1;
     1858#endif
    15481859  }
    15491860  else
     
    15581869    Pel repDepth4x8[2] = {0, 0};
    15591870    Pel repDepth8x4[2] = {0, 0};
    1560 
     1871#endif
     1872
     1873#if !MTK_F0109_LG_F0120_VSP_BLOCK
     1874#if SHARP_VSP_BLOCK_IN_AMP_F0102
     1875    Int blocksize    = 8;
     1876    Int subblocksize = 4;
     1877    Int depStrideBlock = depStride * blocksize;
     1878    Pel *depthTmp = NULL;
     1879    Int depStrideTmp = depStride * nTxtPerDepthY;
     1880    Int offset[4] = { 0, subblocksize-1, subblocksize, blocksize-1 };
     1881    Pel *refDepthTmp[4] = { NULL, NULL, NULL, NULL };
     1882#endif
    15611883    Int refDepStrideBlock    = refDepStride * blocksize;
    15621884    Int refDepStrideSubBlock = refDepStride * subblocksize;
     
    15671889    refDepthTmp[3] = refDepthTmp[1] + refDepStrideSubBlock;
    15681890
     1891#if SHARP_VSP_BLOCK_IN_AMP_F0102
     1892    Int subBlockW, subBlockH;
     1893    Int blockW, blockH;
     1894    subBlockW = subBlockH = 8;
     1895    if (height % 8)
     1896    {
     1897      subBlockW = 8;
     1898      subBlockH = 4;
     1899      blockW = width;  // no further split
     1900      blockH = height; // no further split
     1901    }
     1902    else if (width % 8)
     1903    {
     1904      subBlockW = 4;
     1905      subBlockH = 8;
     1906      blockW = width;  // no further split
     1907      blockH = height; // no further split
     1908    }
     1909    else
     1910    {
     1911      blockW = blockH = 8;
     1912    }
     1913    for( Int y=0; y<height; y+=blockH )
     1914    {
     1915      for( Int x=0; x<width; x+=blockW )
     1916      {
     1917        if (blockW == 8 && blockH == 8)
     1918        {
     1919          Bool ULvsBR = false, URvsBL = false;
     1920          ULvsBR = refDepthTmp[0][x+offset[0]] < refDepthTmp[3][x+offset[3]];
     1921          URvsBL = refDepthTmp[0][x+offset[3]] < refDepthTmp[3][x+offset[0]];
     1922          if( ULvsBR ^ URvsBL )
     1923          { // 4x8
     1924            subBlockW = 4;
     1925            subBlockH = 8;
     1926          }
     1927          else
     1928          {
     1929            subBlockW = 8;
     1930            subBlockH = 4;
     1931          }
     1932        }
     1933        for( Int yy=0; yy<blockH; yy+=subBlockH )
     1934        {
     1935          for( Int xx=0; xx<blockW; xx+=subBlockW )
     1936          {
     1937            Pel  maxDepthVal = 0;
     1938            Int xP0, xP1, yP0, yP1;
     1939            xP0 = x+xx;
     1940            xP1 = x+xx+subBlockW-1;
     1941            yP0 = yy;
     1942            yP1 = yy+subBlockH-1;
     1943            maxDepthVal = std::max( maxDepthVal, refDepthTmp[0][xP0+yP0*refDepStride]);
     1944            maxDepthVal = std::max( maxDepthVal, refDepthTmp[0][xP1+yP0*refDepStride]);
     1945            maxDepthVal = std::max( maxDepthVal, refDepthTmp[0][xP0+yP1*refDepStride]);
     1946            maxDepthVal = std::max( maxDepthVal, refDepthTmp[0][xP1+yP1*refDepStride]);
     1947            depthTmp = &depth[x+xx+yy*depStride];
     1948            for( Int sY=0; sY<subBlockH; sY+=nTxtPerDepthY )
     1949            {
     1950              for( Int sX=0; sX<subBlockW; sX+=nTxtPerDepthX )
     1951              {
     1952                depthTmp[sX] = maxDepthVal;
     1953              }
     1954              depthTmp += depStrideTmp;
     1955            }
     1956          }
     1957        }
     1958      }
     1959      refDepthTmp[0] += refDepStrideBlock;
     1960      depth       += depStrideBlock;
     1961    }
     1962#else // SHARP_VSP_BLOCK_IN_AMP_F0102
    15691963    for( Int y=0; y<height; y+=blocksize )
    15701964    {
     
    16622056      depth       += depStrideBlock;
    16632057    }
    1664   }
    1665 
    1666 
    1667 }
    1668 
     2058#endif // SHARP_VSP_BLOCK_IN_AMP_F0102
     2059#else
     2060#if SHARP_VSP_BLOCK_IN_AMP_F0102
     2061  if ((height % 8))
     2062  {
     2063    vspSize = 1; // 8x4
     2064  }
     2065  else if ((width % 8))
     2066  {
     2067    vspSize = 0; // 4x8
     2068  }
     2069  else
     2070  {
     2071    Bool ULvsBR, URvsBL;
     2072    ULvsBR = refDepth[0]       < refDepth[refDepStride * (height-1) + width-1];
     2073    URvsBL = refDepth[width-1] < refDepth[refDepStride * (height-1)];
     2074    vspSize = ( ULvsBR ^ URvsBL ) ? 0 : 1;
     2075  }
     2076  Int subBlockW, subBlockH;
     2077  Int depStrideTmp = depStride * nTxtPerDepthY;
     2078  if (vspSize)
     2079  {
     2080    subBlockW = 8;
     2081    subBlockH = 4;
     2082  }
     2083  else
     2084  {
     2085    subBlockW = 4;
     2086    subBlockH = 8;
     2087  }
     2088  for( Int y=0; y<height; y+=subBlockH )
     2089  {
     2090    Pel *refDepthTmp[4];
     2091    refDepthTmp[0] = refDepth + refDepStride * y;
     2092    refDepthTmp[1] = refDepthTmp[0] + subBlockW - 1;
     2093    refDepthTmp[2] = refDepthTmp[0] + refDepStride * (subBlockH - 1);
     2094    refDepthTmp[3] = refDepthTmp[2] + subBlockW - 1;
     2095    for( Int x=0; x<width; x+=subBlockW )
     2096    {
     2097      Pel  maxDepthVal;
     2098      maxDepthVal = refDepthTmp[0][x];
     2099      maxDepthVal = std::max( maxDepthVal, refDepthTmp[1][x]);
     2100      maxDepthVal = std::max( maxDepthVal, refDepthTmp[2][x]);
     2101      maxDepthVal = std::max( maxDepthVal, refDepthTmp[3][x]);
     2102      Pel *depthTmp = &depth[x+y*depStride];
     2103      for( Int sY=0; sY<subBlockH; sY+=nTxtPerDepthY )
     2104      {
     2105        for( Int sX=0; sX<subBlockW; sX+=nTxtPerDepthX )
     2106        {
     2107          depthTmp[sX] = maxDepthVal;
     2108        }
     2109        depthTmp += depStrideTmp;
     2110      }
     2111    }
     2112  }
     2113#else // SHARP_VSP_BLOCK_IN_AMP_F0102
     2114    Int refDepStrideBlock    = refDepStride * height;
     2115    Int refDepStrideSubBlock = refDepStride * height/2;
     2116    refDepthTmp[0] = refDepth;
     2117    refDepthTmp[2] = refDepthTmp[0] + refDepStrideSubBlock;
     2118    refDepthTmp[1] = refDepthTmp[2] - refDepStride;
     2119    refDepthTmp[3] = refDepthTmp[1] + refDepStrideSubBlock;
     2120    offset[3] = width-1;
     2121    Bool ULvsBR = false, URvsBL = false;
     2122    ULvsBR = refDepthTmp[0][0+offset[0]] < refDepthTmp[3][0+offset[3]];
     2123    URvsBL = refDepthTmp[0][0+offset[3]] < refDepthTmp[3][0+offset[0]];
     2124    refDepStrideBlock    = refDepStride * blocksize;
     2125    refDepStrideSubBlock = refDepStride * subblocksize;
     2126    refDepthTmp[0] = refDepth;
     2127    refDepthTmp[2] = refDepthTmp[0] + refDepStrideSubBlock;
     2128    refDepthTmp[1] = refDepthTmp[2] - refDepStride;
     2129    refDepthTmp[3] = refDepthTmp[1] + refDepStrideSubBlock;
     2130    offset[3] = blocksize-1;
     2131    if( ULvsBR ^ URvsBL )
     2132    {
     2133    vspSize = 0;//4x8
     2134    for( Int y=0; y<height; y+=blocksize )
     2135    {
     2136      for( Int x=0; x<width; x+=blocksize )
     2137      {
     2138        { // 4x8
     2139          repDepth4x8[0] = refDepthTmp[0][x+offset[0]] > refDepthTmp[0][x+offset[1]] ? refDepthTmp[0][x+offset[0]] : refDepthTmp[0][x+offset[1]];
     2140          if( repDepth4x8[0] < refDepthTmp[3][x+offset[0]] )
     2141          {
     2142            repDepth4x8[0] = refDepthTmp[3][x+offset[0]];
     2143          }
     2144          if( repDepth4x8[0] < refDepthTmp[3][x+offset[1]] )
     2145          {
     2146            repDepth4x8[0] = refDepthTmp[3][x+offset[1]];
     2147          }
     2148          repDepth4x8[1] = refDepthTmp[0][x+offset[2]] > refDepthTmp[0][x+offset[3]] ? refDepthTmp[0][x+offset[2]] : refDepthTmp[0][x+offset[3]];
     2149          if( repDepth4x8[1] < refDepthTmp[3][x+offset[2]] )
     2150          {
     2151            repDepth4x8[1] = refDepthTmp[3][x+offset[2]];
     2152          }
     2153          if( repDepth4x8[1] < refDepthTmp[3][x+offset[3]] )
     2154          {
     2155            repDepth4x8[1] = refDepthTmp[3][x+offset[3]];
     2156  }
     2157
     2158          depthTmp = &depth[x];
     2159          for( Int sY=0; sY<blocksize; sY+=nTxtPerDepthY )
     2160          {
     2161            for( Int sX=0; sX<subblocksize; sX+=nTxtPerDepthX )
     2162            {
     2163              depthTmp[sX] = repDepth4x8[0];
     2164            }
     2165            depthTmp += depStrideTmp;
     2166          }
     2167          depthTmp = &depth[x+subblocksize];
     2168          for( Int sY=0; sY<blocksize; sY+=nTxtPerDepthY )
     2169          {
     2170            for( Int sX=0; sX<subblocksize; sX+=nTxtPerDepthX )
     2171            {
     2172              depthTmp[sX] = repDepth4x8[1];
     2173            }
     2174            depthTmp += depStrideTmp;
     2175          }
     2176        }
     2177      }
     2178      refDepthTmp[0] += refDepStrideBlock;
     2179      refDepthTmp[1] += refDepStrideBlock;
     2180      refDepthTmp[2] += refDepStrideBlock;
     2181      refDepthTmp[3] += refDepStrideBlock;
     2182      depth       += depStrideBlock;
     2183    }
     2184  }
     2185  else
     2186  { // 8x4
     2187    vspSize = 1;
     2188    for( Int y=0; y<height; y+=blocksize )
     2189    {
     2190      for( Int x=0; x<width; x+=blocksize )
     2191      {
     2192        repDepth8x4[0] = refDepthTmp[0][x+offset[0]] > refDepthTmp[0][x+offset[3]] ? refDepthTmp[0][x+offset[0]] : refDepthTmp[0][x+offset[3]];
     2193        if( repDepth8x4[0] < refDepthTmp[1][x+offset[0]] )
     2194        {
     2195          repDepth8x4[0] = refDepthTmp[1][x+offset[0]];
     2196        }
     2197        if( repDepth8x4[0] < refDepthTmp[1][x+offset[3]] )
     2198        {
     2199          repDepth8x4[0] = refDepthTmp[1][x+offset[3]];
     2200        }
     2201        repDepth8x4[1] = refDepthTmp[2][x+offset[0]] > refDepthTmp[2][x+offset[3]] ? refDepthTmp[2][x+offset[0]] : refDepthTmp[2][x+offset[3]];
     2202        if( repDepth8x4[1] < refDepthTmp[3][x+offset[0]] )
     2203        {
     2204          repDepth8x4[1] = refDepthTmp[3][x+offset[0]];
     2205        }
     2206        if( repDepth8x4[1] < refDepthTmp[3][x+offset[3]] )
     2207        {
     2208          repDepth8x4[1] = refDepthTmp[3][x+offset[3]];
     2209        }
     2210
     2211        depthTmp = &depth[x];
     2212        for( Int sY=0; sY<subblocksize; sY+=nTxtPerDepthY )
     2213        {
     2214          for( Int sX=0; sX<blocksize; sX+=nTxtPerDepthX )
     2215          {
     2216            depthTmp[sX] = repDepth8x4[0];
     2217          }
     2218          depthTmp += depStrideTmp;
     2219        }
     2220        for( Int sY=0; sY<subblocksize; sY+=nTxtPerDepthY )
     2221        {
     2222          for( Int sX=0; sX<blocksize; sX+=nTxtPerDepthX )
     2223          {
     2224            depthTmp[sX] = repDepth8x4[1];
     2225          }
     2226          depthTmp += depStrideTmp;
     2227}
     2228      }
     2229      refDepthTmp[0] += refDepStrideBlock;
     2230      refDepthTmp[1] += refDepStrideBlock;
     2231      refDepthTmp[2] += refDepStrideBlock;
     2232      refDepthTmp[3] += refDepStrideBlock;
     2233      depth       += depStrideBlock;
     2234    }
     2235  }
     2236#endif   
     2237#endif
     2238#if !SHARP_VSP_BLOCK_IN_AMP_F0102
     2239  }
     2240#endif
     2241
     2242
     2243}
     2244#if MTK_F0109_LG_F0120_VSP_BLOCK
     2245Void TComPrediction::xPredInterLumaBlkFromDM( TComDataCU *cu, TComPicYuv *picRef, TComYuv *yuvDepth, Int* shiftLUT, TComMv *mv, UInt partAddr, Int width, Int height, Bool isDepth, TComYuv *&yuvDst, Bool isBi, Int vspSize)
     2246#else
    16692247Void TComPrediction::xPredInterLumaBlkFromDM( TComDataCU *cu, TComPicYuv *picRef, TComYuv *yuvDepth, Int* shiftLUT, TComMv *mv, UInt partAddr, Int width, Int height, Bool isDepth, TComYuv *&yuvDst, Bool isBi )
     2248#endif
    16702249{
    16712250  Int nTxtPerDepthX = H_3D_VSP_BLOCKSIZE;
    16722251  Int nTxtPerDepthY = H_3D_VSP_BLOCKSIZE;
    16732252 
     2253#if MTK_F0109_LG_F0120_VSP_BLOCK
     2254  nTxtPerDepthX = nTxtPerDepthX << vspSize;
     2255  nTxtPerDepthY = nTxtPerDepthY << (1-vspSize);
     2256#endif
    16742257  Int refStride = picRef->getStride();
    16752258  Int dstStride = yuvDst->getStride();
     
    17772360}
    17782361
     2362#if MTK_F0109_LG_F0120_VSP_BLOCK
     2363Void TComPrediction::xPredInterChromaBlkFromDM  ( TComDataCU *cu, TComPicYuv *picRef, TComYuv *yuvDepth, Int* shiftLUT, TComMv *mv, UInt partAddr, Int width, Int height, Bool isDepth, TComYuv *&yuvDst, Bool isBi, Int vspSize)
     2364#else
    17792365Void TComPrediction::xPredInterChromaBlkFromDM  ( TComDataCU *cu, TComPicYuv *picRef, TComYuv *yuvDepth, Int* shiftLUT, TComMv *mv, UInt partAddr, Int width, Int height, Bool isDepth, TComYuv *&yuvDst, Bool isBi )
     2366#endif
    17802367{
    17812368#if (H_3D_VSP_BLOCKSIZE==1)
     
    17872374#endif
    17882375
     2376#if MTK_F0109_LG_F0120_VSP_BLOCK
     2377  nTxtPerDepthX = nTxtPerDepthX << vspSize;
     2378  nTxtPerDepthY = nTxtPerDepthY << (1-vspSize);
     2379#endif
    17892380  Int refStride = picRef->getCStride();
    17902381  Int dstStride = yuvDst->getCStride();
     
    19682559
    19692560#if H_3D_DIM_DMM
     2561#if !SEC_DMM3_RBC_F0147
    19702562UInt TComPrediction::xPredWedgeFromTex( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight, UInt intraTabIdx )
    19712563{
     
    19792571  return g_aauiWdgLstM3[g_aucConvertToBit[uiWidth]][uiColTexIntraDir-2].at(intraTabIdx);
    19802572}
     2573#endif
    19812574
    19822575Void TComPrediction::xPredContourFromTex( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight, TComWedgelet* pcContourWedge )
Note: See TracChangeset for help on using the changeset viewer.