Ignore:
Timestamp:
28 Nov 2013, 10:04:37 (11 years ago)
Author:
mediatek-htm
Message:

Bug fix for F0093, addded macro is

#define BUGFIX_F0093 1 bug fix for F0093 for depth IvMC pruning

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/HTM-8.2-dev0-MediaTek/source/Lib/TLibCommon/TComDataCU.cpp

    r712 r716  
    146146  m_piVSPFlag            = NULL;
    147147#endif
     148#if MTK_SPIVMP_F0110
     149  m_pbSPIVMPFlag         = NULL;
     150#endif
    148151#if H_3D_ARP
    149152  m_puhARPW              = NULL;
     
    196199#if H_3D_VSP
    197200    m_piVSPFlag          = (Char*  )xMalloc(Char,   uiNumPartition);
     201#endif
     202#if MTK_SPIVMP_F0110
     203    m_pbSPIVMPFlag       = (Bool*  )xMalloc(Bool,   uiNumPartition);
    198204#endif
    199205    m_puhLumaIntraDir    = (UChar* )xMalloc(UChar,  uiNumPartition);
     
    356362    if ( m_piVSPFlag          ) { xFree(m_piVSPFlag);           m_piVSPFlag         = NULL; }
    357363#endif
     364#if MTK_SPIVMP_F0110
     365    if ( m_pbSPIVMPFlag       ) { xFree(m_pbSPIVMPFlag);           m_pbSPIVMPFlag         = NULL; }
     366#endif
    358367    if ( m_puhLumaIntraDir    ) { xFree(m_puhLumaIntraDir);     m_puhLumaIntraDir   = NULL; }
    359368    if ( m_puhChromaIntraDir  ) { xFree(m_puhChromaIntraDir);   m_puhChromaIntraDir = NULL; }
     
    561570#if H_3D_VSP
    562571    m_piVSPFlag[ui] = pcFrom->m_piVSPFlag[ui];
     572#endif
     573#if MTK_SPIVMP_F0110
     574    m_pbSPIVMPFlag[ui] = pcFrom->m_pbSPIVMPFlag[ui];
    563575#endif
    564576    m_puhLumaIntraDir[ui]=pcFrom->m_puhLumaIntraDir[ui];
     
    603615#if H_3D_VSP
    604616    memset( m_piVSPFlag         + firstElement, 0,                        numElements * sizeof( *m_piVSPFlag ) );
     617#endif
     618#if MTK_SPIVMP_F0110
     619    memset( m_pbSPIVMPFlag      + firstElement, 0,                        numElements * sizeof( *m_pbSPIVMPFlag ) );
    605620#endif
    606621    memset( m_puhLumaIntraDir   + firstElement, DC_IDX,                   numElements * sizeof( *m_puhLumaIntraDir ) );
     
    784799      m_piVSPFlag[ui] = 0;
    785800#endif
     801#if MTK_SPIVMP_F0110
     802      m_pbSPIVMPFlag[ui] = 0;
     803#endif
    786804      m_puhLumaIntraDir[ui] = DC_IDX;
    787805      m_puhChromaIntraDir[ui] = 0;
     
    883901#if H_3D_VSP
    884902  memset( m_piVSPFlag,          0, sizeof( Char  ) * m_uiNumPartition );
     903#endif
     904#if MTK_SPIVMP_F0110
     905  memset( m_pbSPIVMPFlag,       0, sizeof( Bool  ) * m_uiNumPartition );
    885906#endif
    886907  memset( m_puhLumaIntraDir,    DC_IDX, iSizeInUchar );
     
    9801001      m_pDvInfo[ ui ] = pcCU->m_pDvInfo[uiPartOffset+ui];
    9811002#endif
     1003#if MTK_SPIVMP_F0110
     1004      m_pbSPIVMPFlag[ui]=pcCU->m_pbSPIVMPFlag[uiPartOffset+ui];
     1005#endif
    9821006      m_puhLumaIntraDir[ui]=pcCU->m_puhLumaIntraDir[uiPartOffset+ui];
    9831007      m_puhChromaIntraDir[ui]=pcCU->m_puhChromaIntraDir[uiPartOffset+ui];
     
    11301154  m_piVSPFlag           = pcCU->getVSPFlag()          + uiPart;
    11311155#endif
     1156#if MTK_SPIVMP_F0110
     1157  m_pbSPIVMPFlag        = pcCU->getSPIVMPFlag()          + uiPart;
     1158#endif
    11321159
    11331160#if H_3D_ARP
     
    12851312  m_piVSPFlag          = pcCU->getVSPFlag()               + uiAbsPartIdx;
    12861313  m_pDvInfo            = pcCU->getDvInfo()                + uiAbsPartIdx;
     1314#endif
     1315#if MTK_SPIVMP_F0110
     1316  m_pbSPIVMPFlag       = pcCU->getSPIVMPFlag()               + uiAbsPartIdx;
    12871317#endif
    12881318
     
    13351365
    13361366#endif
     1367#if MTK_SPIVMP_F0110
     1368  memcpy( m_pbSPIVMPFlag        + uiOffset, pcCU->getSPIVMPFlag(),        sizeof( Bool ) * uiNumPartition );
     1369#endif
    13371370  memcpy( m_puhLumaIntraDir     + uiOffset, pcCU->getLumaIntraDir(),      iSizeInUchar );
    13381371  memcpy( m_puhChromaIntraDir   + uiOffset, pcCU->getChromaIntraDir(),    iSizeInUchar );
     
    14641497  memcpy( rpcCU->getDvInfo()            + m_uiAbsIdxInLCU, m_pDvInfo,             sizeof( *m_pDvInfo ) * m_uiNumPartition );
    14651498#endif
     1499#if MTK_SPIVMP_F0110
     1500  memcpy( rpcCU->getSPIVMPFlag()        + m_uiAbsIdxInLCU, m_pbSPIVMPFlag,        sizeof( Bool ) * m_uiNumPartition );
     1501#endif
    14661502  memcpy( rpcCU->getLumaIntraDir()      + m_uiAbsIdxInLCU, m_puhLumaIntraDir,     iSizeInUchar );
    14671503  memcpy( rpcCU->getChromaIntraDir()    + m_uiAbsIdxInLCU, m_puhChromaIntraDir,   iSizeInUchar );
     
    15791615#if H_3D_VSP
    15801616  memcpy( rpcCU->getVSPFlag()           + uiPartOffset, m_piVSPFlag,           sizeof(Char) * uiQNumPart );
     1617#endif
     1618#if MTK_SPIVMP_F0110
     1619  memcpy( rpcCU->getSPIVMPFlag()        + uiPartOffset, m_pbSPIVMPFlag,        sizeof(Bool) * uiQNumPart );
    15811620#endif
    15821621  memcpy( rpcCU->getLumaIntraDir()      + uiPartOffset, m_puhLumaIntraDir,     iSizeInUchar );
     
    27052744  setSubPart<UChar>( uiMergeIndex, m_puhMergeIndex, uiAbsPartIdx, uiDepth, uiPartIdx );
    27062745}
     2746
     2747#if MTK_SPIVMP_F0110
     2748Void TComDataCU::setSPIVMPFlagSubParts( Bool bSPIVMPFlag, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth )
     2749{
     2750  setSubPart<Bool>( bSPIVMPFlag, m_pbSPIVMPFlag, uiAbsPartIdx, uiDepth, uiPartIdx );
     2751}
     2752#endif
    27072753
    27082754#if H_3D_VSP
     
    39624008      , InheritedVSPDisInfo*  inheritedVSPDisInfo
    39634009#endif
     4010#if MTK_SPIVMP_F0110
     4011      , Bool* pbSPIVMPFlag, TComMvField* pcMvFieldSP, UChar* puhInterDirSP
     4012#endif
    39644013      , Int& numValidMergeCand, Int mrgCandIdx
    39654014)
     
    40304079#if QC_DEPTH_IV_MRG_F0125
    40314080  Bool bIsDepth = getSlice()->getIsDepth();
     4081#if !BUGFIX_F0093
    40324082  Bool bDepthIPMCAvai = false;
     4083#endif
    40334084#endif
    40344085
     
    44334484    , bIsDepth
    44344485#endif
     4486#if MTK_SPIVMP_F0110
     4487    , pcMvFieldSP, puhInterDirSP
     4488#endif
    44354489    );
    44364490  } 
     
    44594513    Int iCnloop=0;
    44604514
    4461     for(Int i = 0; i < 2; i ++)
    4462     {
    4463       iCnloop = iPosLeftAbove[i];
    4464       if ( iCnloop == -1 )
    4465       {
    4466         continue;
    4467       }
    4468       if(ivCandDir[0] == puhInterDirNeighbours[iCnloop] && tmpMV[0]==pcMvFieldNeighbours[(iCnloop<<1)] && tmpMV[1]==pcMvFieldNeighbours[(iCnloop<<1)+1])
    4469       {
    4470         bRemoveSpa                      = true;
    4471         break;
    4472       }     
    4473     }
     4515#if BUGFIX_F0093
     4516    if (!bIsDepth)
     4517    {
     4518#endif
     4519      for(Int i = 0; i < 2; i ++)
     4520      {
     4521        iCnloop = iPosLeftAbove[i];
     4522        if ( iCnloop == -1 )
     4523        {
     4524          continue;
     4525        }
     4526        if(ivCandDir[0] == puhInterDirNeighbours[iCnloop] && tmpMV[0]==pcMvFieldNeighbours[(iCnloop<<1)] && tmpMV[1]==pcMvFieldNeighbours[(iCnloop<<1)+1])
     4527        {
     4528          bRemoveSpa                      = true;
     4529          break;
     4530        }     
     4531      }
     4532#if BUGFIX_F0093
     4533    }
     4534#endif
    44744535#if QC_DEPTH_IV_MRG_F0125
     4536#if BUGFIX_F0093
     4537    if (bIsDepth)
     4538#else
    44754539    if ( bIsDepth && !bRemoveSpa)
     4540#endif
    44764541    {
    44774542      iCnloop = iCount-1;
    44784543      for(; iCnloop >= 0; iCnloop --)
    44794544      {
     4545#if BUGFIX_F0093
     4546        if(ivCandDir[0] == puhInterDirNeighbours[iCnloop] && pcMvFieldNeighbours[iCnloop<<1]==tmpMV[0] && pcMvFieldNeighbours[(iCnloop<<1)+1]==tmpMV[1])  // F0125 compatible with F0093
     4547#else
    44804548        if(puhInterDirNeighbours[iCount] == puhInterDirNeighbours[iCnloop] && pcMvFieldNeighbours[iCnloop<<1]==pcMvFieldNeighbours[(iCount<<1)] && pcMvFieldNeighbours[(iCnloop<<1)+1]==pcMvFieldNeighbours[(iCount<<1)+1])
     4549#endif
    44814550        {
    44824551          bRemoveSpa                      = true;
     
    44844553        }
    44854554      }
     4555#if !BUGFIX_F0093
    44864556      if(!bRemoveSpa)
    44874557      {
    44884558        bDepthIPMCAvai = true;
    44894559      }
     4560#endif
    44904561    }
    44914562#endif
     
    45454616    if (bIvMC)
    45464617    {
     4618#if MTK_SPIVMP_F0110
     4619      pbSPIVMPFlag[iCount] = true;
     4620#endif
    45474621      if( ( ivCandDir[0] & 1 ) == 1 )
    45484622      {
     
    45564630      puhInterDirNeighbours[ iCount ] = ivCandDir[0];
    45574631
     4632#if !BUGFIX_F0093
    45584633#if QC_DEPTH_IV_MRG_F0125
    45594634      if ( bDepthIPMCAvai || !bIsDepth )
    45604635      {
    45614636#endif
    4562       if ( mrgCandIdx == iCount )
    4563       {
    4564         return;
    4565       }
    4566       iCount ++;
     4637#endif
     4638        if ( mrgCandIdx == iCount )
     4639        {
     4640          return;
     4641        }
     4642        iCount ++;
     4643#if !BUGFIX_F0093
    45674644#if QC_DEPTH_IV_MRG_F0125
    45684645      }
     4646#endif
    45694647#endif
    45704648    }
     
    81128190}
    81138191#endif
     8192
     8193#if MTK_SPIVMP_F0110
     8194Void TComDataCU::getSPPara(Int iPUWidth, Int iPUHeight, Int& iNumSP, Int& iNumSPInOneLine, Int& iSPWidth, Int& iSPHeight)
     8195{
     8196  Int iSubPUSize = 1<<getSlice()->getVPS()->getSubPULog2Size(getSlice()->getLayerId());
     8197  iNumSPInOneLine = iPUWidth/iSubPUSize;
     8198  iNumSPInOneLine = iNumSPInOneLine < 1 ? 1: iNumSPInOneLine;
     8199  Int iNumSPInOneColumn = iPUHeight/iSubPUSize;
     8200  iNumSPInOneColumn = iNumSPInOneColumn < 1 ? 1: iNumSPInOneColumn;
     8201  iNumSP = iNumSPInOneLine * iNumSPInOneColumn;
     8202
     8203  iSPWidth = iNumSPInOneLine == 1 ? iPUWidth: iSubPUSize;
     8204  iSPHeight = iNumSPInOneColumn == 1 ? iPUHeight: iSubPUSize;
     8205}
     8206
     8207Void TComDataCU::getSPAbsPartIdx(UInt uiBaseAbsPartIdx, Int iWidth, Int iHeight, Int iPartIdx, Int iNumPartLine, UInt& ruiPartAddr )
     8208{
     8209  uiBaseAbsPartIdx += m_uiAbsIdxInLCU;
     8210  Int iBasePelX = g_auiRasterToPelX[g_auiZscanToRaster[uiBaseAbsPartIdx]];
     8211  Int iBasePelY = g_auiRasterToPelY[g_auiZscanToRaster[uiBaseAbsPartIdx]];
     8212  Int iCurrPelX = iBasePelX + iPartIdx%iNumPartLine * iWidth;
     8213  Int iCurrPelY = iBasePelY + iPartIdx/iNumPartLine * iHeight;
     8214  Int iCurrRaster = iCurrPelY / getPic()->getMinCUHeight() * getPic()->getNumPartInWidth() + iCurrPelX/getPic()->getMinCUWidth();
     8215  ruiPartAddr = g_auiRasterToZscan[iCurrRaster];
     8216  ruiPartAddr -= m_uiAbsIdxInLCU; 
     8217}
     8218
     8219Void TComDataCU::setInterDirSP( UInt uiDir, UInt uiAbsPartIdx, Int iWidth, Int iHeight )
     8220{
     8221  uiAbsPartIdx += getZorderIdxInCU();
     8222  Int iStartPelX = g_auiRasterToPelX[g_auiZscanToRaster[uiAbsPartIdx]];
     8223  Int iStartPelY = g_auiRasterToPelY[g_auiZscanToRaster[uiAbsPartIdx]];
     8224  Int iEndPelX = iStartPelX + iWidth;
     8225  Int iEndPelY = iStartPelY + iHeight;
     8226
     8227  Int iCurrRaster, uiPartAddr;
     8228
     8229  for (Int i=iStartPelY; i<iEndPelY; i+=getPic()->getMinCUHeight())
     8230  {
     8231    for (Int j=iStartPelX; j < iEndPelX; j += getPic()->getMinCUWidth())
     8232    {
     8233      iCurrRaster = i / getPic()->getMinCUHeight() * getPic()->getNumPartInWidth() + j/getPic()->getMinCUWidth();
     8234      uiPartAddr = g_auiRasterToZscan[iCurrRaster];
     8235      uiPartAddr -= getZorderIdxInCU(); 
     8236
     8237      m_puhInterDir[uiPartAddr] = uiDir;
     8238    }
     8239  }
     8240}
     8241#endif
     8242
    81148243#if H_3D_IV_MERGE
    81158244Bool
     
    81188247, Bool bIsDepth           
    81198248#endif
     8249#if MTK_SPIVMP_F0110
     8250, TComMvField* pcMvFieldSP, UChar* puhInterDirSP
     8251#endif
    81208252)
    81218253{
     
    81398271  pcBaseRec->getTopLeftSamplePos( getAddr(), getZorderIdxInCU() + uiPartAddr, iCurrPosX, iCurrPosY );
    81408272
     8273#if !MTK_SPIVMP_F0110
    81418274#if QC_DEPTH_IV_MRG_F0125
    81428275  iCurrPosX  += ( iWidth  >> 1 );
     
    81468279  iCurrPosY  += ( ( iHeight - 1 ) >> 1 );
    81478280#endif
     8281#endif
    81488282
    81498283  Bool depthRefineFlag = false;
     
    81628296#endif
    81638297
     8298#if MTK_SPIVMP_F0110
     8299  ////////////////////////////////
     8300  //////////sub-PU IvMC///////////
     8301  ////////////////////////////////
     8302 
     8303  Int iNumSPInOneLine, iNumSP, iSPWidth, iSPHeight;
     8304  getSPPara(iWidth, iHeight, iNumSP, iNumSPInOneLine, iSPWidth, iSPHeight);
     8305
     8306  for (Int i=0; i<iNumSP; i++)
     8307  {
     8308    puhInterDirSP[i] = 0;
     8309    pcMvFieldSP[2*i].getMv().set(0, 0);
     8310    pcMvFieldSP[2*i+1].getMv().set(0,0);
     8311    pcMvFieldSP[2*i].setRefIdx(-1);
     8312    pcMvFieldSP[2*i+1].setRefIdx(-1);
     8313  }
     8314
     8315  Int         iBaseCUAddr;
     8316  Int         iBaseAbsPartIdx;
     8317  TComDataCU* pcBaseCU;
     8318  Int iPartition = 0;
     8319  Int iInterDirLast = 0;
     8320  TComMvField cMvFieldLast[2];
     8321
     8322  Int iDelX = iSPWidth/2;
     8323  Int iDelY = iSPHeight/2;
     8324
     8325  Int         iBasePosX, iBasePosY;
     8326  for (Int i=iCurrPosY; i < iCurrPosY + iHeight; i += iSPHeight)
     8327  {
     8328    for (Int j = iCurrPosX; j < iCurrPosX + iWidth; j += iSPWidth)
     8329    {
     8330      iBasePosX   = Clip3( 0, pcBaseRec->getWidth () - 1, j + iDelX + ( (cDv.getHor() + 2 ) >> 2 ));
     8331      iBasePosY   = Clip3( 0, pcBaseRec->getHeight() - 1, i + iDelY + ( (cDv.getVer() + 2 ) >> 2 ));
     8332
     8333      pcBaseRec->getCUAddrAndPartIdx( iBasePosX , iBasePosY, iBaseCUAddr, iBaseAbsPartIdx );
     8334      pcBaseCU    = pcBasePic->getCU( iBaseCUAddr );
     8335      if(!( pcBaseCU->getPredictionMode( iBaseAbsPartIdx ) == MODE_INTRA ))
     8336      {
     8337        for( UInt uiCurrRefListId = 0; uiCurrRefListId < 2; uiCurrRefListId++ )
     8338        {
     8339          RefPicList  eCurrRefPicList = RefPicList( uiCurrRefListId );
     8340          Bool bLoop_stop = false;
     8341          for(Int iLoop = 0; iLoop < 2 && !bLoop_stop; ++iLoop)
     8342          {
     8343            RefPicList eBaseRefPicList = (iLoop ==1)? RefPicList( 1 -  uiCurrRefListId ) : RefPicList( uiCurrRefListId );
     8344            TComMvField cBaseMvField;
     8345            pcBaseCU->getMvField( pcBaseCU, iBaseAbsPartIdx, eBaseRefPicList, cBaseMvField );
     8346            Int         iBaseRefIdx     = cBaseMvField.getRefIdx();
     8347            if (iBaseRefIdx >= 0)
     8348            {
     8349              Int iBaseRefPOC = pcBaseCU->getSlice()->getRefPOC(eBaseRefPicList, iBaseRefIdx);
     8350              if (iBaseRefPOC != pcSlice->getPOC())   
     8351              {
     8352                for (Int iPdmRefIdx = 0; iPdmRefIdx < pcSlice->getNumRefIdx( eCurrRefPicList ); iPdmRefIdx++)
     8353                {
     8354                  if (iBaseRefPOC == pcSlice->getRefPOC(eCurrRefPicList, iPdmRefIdx))
     8355                  {
     8356                    abPdmAvailable[ uiCurrRefListId ] = true;
     8357                    TComMv cMv(cBaseMvField.getHor(), cBaseMvField.getVer());
     8358
     8359                    if( !bIsDepth )
     8360                    {
     8361                      cMv.setIDVFlag   (true);
     8362                      cMv.setIDVHor    (cDv.getHor());                 
     8363                      cMv.setIDVVer    (cDv.getVer()); 
     8364                      cMv.setIDVVId    (iViewIndex);
     8365                    }
     8366
     8367                    clipMv( cMv );
     8368                    bLoop_stop = true;
     8369
     8370                    pcMvFieldSP[2*iPartition + uiCurrRefListId].setMvField(cMv, iPdmRefIdx);
     8371                    break;
     8372                  }
     8373                }
     8374              }
     8375            }
     8376          }
     8377        }
     8378      }
     8379
     8380      puhInterDirSP[iPartition] = (pcMvFieldSP[2*iPartition].getRefIdx()!=-1 ? 1: 0) + (pcMvFieldSP[2*iPartition+1].getRefIdx()!=-1 ? 2: 0);
     8381      if (puhInterDirSP[iPartition] == 0)
     8382      {
     8383        if (iInterDirLast != 0)
     8384        {
     8385          puhInterDirSP[iPartition] = iInterDirLast;
     8386          pcMvFieldSP[2*iPartition] = cMvFieldLast[0];
     8387          pcMvFieldSP[2*iPartition + 1] = cMvFieldLast[1];
     8388        }
     8389      }
     8390      else
     8391      {
     8392        if (iInterDirLast ==0)
     8393        {
     8394          availableMcDc[0] = puhInterDirSP[iPartition];
     8395          paiPdmRefIdx  [ 0 ] = pcMvFieldSP[2*iPartition].getRefIdx();
     8396          pacPdmMv      [ 0 ] = pcMvFieldSP[2*iPartition].getMv();
     8397          paiPdmRefIdx  [ 1 ] = pcMvFieldSP[2*iPartition+1].getRefIdx();
     8398          pacPdmMv      [ 1 ] = pcMvFieldSP[2*iPartition+1].getMv();
     8399
     8400          if (iPartition != 0)
     8401          {
     8402            for (Int iPart = iPartition-1; iPart >= 0; iPart--)
     8403            {
     8404              puhInterDirSP[iPart] = puhInterDirSP[iPartition];
     8405              pcMvFieldSP[2*iPart] = pcMvFieldSP[2*iPartition];
     8406              pcMvFieldSP[2*iPart + 1] = pcMvFieldSP[2*iPartition + 1];
     8407            }
     8408          }
     8409        }
     8410        iInterDirLast = puhInterDirSP[iPartition];
     8411        cMvFieldLast[0] = pcMvFieldSP[2*iPartition];
     8412        cMvFieldLast[1] = pcMvFieldSP[2*iPartition + 1];
     8413      }
     8414
     8415      iPartition ++;
     8416
     8417    }
     8418  } 
     8419
     8420  iCurrPosX  += ( iWidth  >> 1 );
     8421  iCurrPosY  += ( iHeight >> 1 );
     8422#endif
     8423
    81648424  ////////////////////////////////
    81658425  /////// IvMC + IvMCShift ///////
    81668426  ////////////////////////////////
    81678427
    8168   for(Int iLoopCan = 0; iLoopCan < 2; iLoopCan ++) 
     8428#if MTK_SPIVMP_F0110
     8429  for(Int iLoopCan = 1; iLoopCan < 2; iLoopCan ++)
     8430#else
     8431  for(Int iLoopCan = 0; iLoopCan < 2; iLoopCan ++)
     8432#endif
    81698433  {
    81708434    // iLoopCan == 0 --> IvMC
     
    82348498    }
    82358499  }
     8500#if MTK_SPIVMP_F0110
     8501  for(Int iLoopCan = 1; iLoopCan < 2; iLoopCan ++)
     8502#else
    82368503  for(Int iLoopCan = 0; iLoopCan < 2; iLoopCan ++)
     8504#endif
    82378505  {
    82388506    availableMcDc[(iLoopCan << 1)] = ( abPdmAvailable[(iLoopCan<<2)] ? 1 : 0 ) + ( abPdmAvailable[1 + (iLoopCan<<2)] ? 2 : 0);
Note: See TracChangeset for help on using the changeset viewer.