Ignore:
Timestamp:
24 Jan 2014, 02:36:31 (10 years ago)
Author:
mediatek-htm
Message:

Integration of DDD (JCT3V-G0063)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/HTM-9.3-dev1-MediaTek/source/Lib/TLibCommon/TComDataCU.cpp

    r793 r795  
    153153  m_pucInterSDCMask       = NULL;
    154154#endif
     155
     156#if MTK_DDD_G0063
     157  m_pucDisparityDerivedDepth = NULL;
     158  m_pbUseDDD = NULL;
     159#endif
    155160}
    156161
     
    298303  m_pcPattern            = (TComPattern*)xMalloc(TComPattern, 1);
    299304 
     305#if MTK_DDD_G0063
     306  m_pucDisparityDerivedDepth         = (UChar*  )xMalloc( UChar,  uiNumPartition);
     307  m_pbUseDDD                         = (Bool*  ) xMalloc( Bool,   uiNumPartition);
     308#endif
     309
    300310  // create motion vector fields
    301311 
     
    375385#if H_3D_NBDV
    376386    if ( m_pDvInfo            ) { xFree(m_pDvInfo);             m_pDvInfo           = NULL; }
     387#endif
     388
     389#if MTK_DDD_G0063
     390    if ( m_pucDisparityDerivedDepth ) { xFree(m_pucDisparityDerivedDepth);          m_pucDisparityDerivedDepth        = NULL; }
     391    if ( m_pbUseDDD                 ) { xFree(m_pbUseDDD);                          m_pbUseDDD                        = NULL; }
    377392#endif
    378393
     
    525540    m_pbICFlag[ui]   =  pcFrom->m_pbICFlag[ui];
    526541#endif
     542
     543#if MTK_DDD_G0063
     544    m_pucDisparityDerivedDepth[ui] = pcFrom->m_pucDisparityDerivedDepth[ui];
     545    m_pbUseDDD[ui] = pcFrom->m_pbUseDDD[ui];
     546#endif
     547
    527548    m_puhWidth  [ui] = pcFrom->getWidth(ui);
    528549    m_puhHeight [ui] = pcFrom->getHeight(ui);
     
    602623    memset( m_pbICFlag          + firstElement, false,                    numElements * sizeof( *m_pbICFlag )   );
    603624#endif
     625
     626#if MTK_DDD_G0063
     627    memset( m_pucDisparityDerivedDepth        + firstElement, 0,           numElements * sizeof( *m_pucDisparityDerivedDepth ) );
     628    memset( m_pbUseDDD                        + firstElement, 0,           numElements * sizeof( *m_pbUseDDD ) );
     629#endif
     630
    604631#if H_3D_DIM
    605632    for( Int i = 0; i < DIM_NUM_TYPE; i++ )
     
    774801      m_pbICFlag[ui]  = false;
    775802#endif
     803
     804#if MTK_DDD_G0063
     805      m_pucDisparityDerivedDepth[ui] = 0;
     806      m_pbUseDDD[ui] = 0;
     807#endif
     808
    776809#if H_3D_DIM
    777810      for( Int i = 0; i < DIM_NUM_TYPE; i++ )
     
    879912  memset( m_puhARPW,            0, iSizeInUchar  );
    880913#endif
     914
     915#if MTK_DDD_G0063
     916  memset( m_pucDisparityDerivedDepth,         0, iSizeInUchar );
     917  memset( m_pbUseDDD,                         0, iSizeInBool );
     918#endif
     919
    881920  UChar uhWidth  = g_uiMaxCUWidth  >> uiDepth;
    882921  UChar uhHeight = g_uiMaxCUHeight >> uiDepth;
     
    9641003      m_pbICFlag          [ui] = pcCU->m_pbICFlag[uiPartOffset+ui];
    9651004#endif
     1005
     1006#if MTK_DDD_G0063
     1007      m_pucDisparityDerivedDepth[ui] = pcCU->m_pucDisparityDerivedDepth[uiPartOffset+ui];
     1008      m_pbUseDDD[ui]                 = pcCU->m_pbUseDDD[uiPartOffset+ui];
     1009#endif
     1010
    9661011#if H_3D_DIM
    9671012      for( Int i = 0; i < DIM_NUM_TYPE; i++ )
     
    11091154#endif
    11101155
     1156#if MTK_DDD_G0063
     1157  m_pucDisparityDerivedDepth          = pcCU->getDDDepth()        + uiPart;
     1158  m_pbUseDDD                          = pcCU->getUseDDD()         + uiPart;
     1159#endif
     1160
    11111161  m_puhLumaIntraDir     = pcCU->getLumaIntraDir()     + uiPart;
    11121162  m_puhChromaIntraDir   = pcCU->getChromaIntraDir()   + uiPart;
     
    12561306#if H_3D_ARP
    12571307  m_puhARPW            = pcCU->getARPW()                  + uiAbsPartIdx;
     1308#endif
     1309
     1310#if MTK_DDD_G0063
     1311  m_pucDisparityDerivedDepth         = pcCU->getDDDepth()              + uiAbsPartIdx;
     1312  m_pbUseDDD                         = pcCU->getUseDDD()              + uiAbsPartIdx;
    12581313#endif
    12591314
     
    13141369  memcpy( m_puhCbf[2] + uiOffset, pcCU->getCbf(TEXT_CHROMA_V), iSizeInUchar );
    13151370 
     1371#if MTK_DDD_G0063
     1372  memcpy( m_pucDisparityDerivedDepth          + uiOffset, pcCU->getDDDepth(),         iSizeInUchar );
     1373  memcpy( m_pbUseDDD                          + uiOffset, pcCU->getUseDDD(),          iSizeInBool );
     1374#endif
     1375
     1376
    13161377#if H_3D_DIM
    13171378  for( Int i = 0; i < DIM_NUM_TYPE; i++ )
     
    14101471#if H_3D_NBDV
    14111472  memcpy( rpcCU->getDvInfo()         + m_uiAbsIdxInLCU, m_pDvInfo,    sizeof(* m_pDvInfo)     * m_uiNumPartition );
     1473#endif
     1474
     1475#if MTK_DDD_G0063
     1476  memcpy( rpcCU->getDDDepth()          + m_uiAbsIdxInLCU, m_pucDisparityDerivedDepth,         iSizeInUchar  );
     1477  memcpy( rpcCU->getUseDDD()           + m_uiAbsIdxInLCU, m_pbUseDDD,                         iSizeInBool  );
    14121478#endif
    14131479
     
    15441610  memcpy( rpcCU->getCbf(TEXT_CHROMA_V) + uiPartOffset, m_puhCbf[2], iSizeInUchar );
    15451611 
     1612#if MTK_DDD_G0063
     1613  memcpy( rpcCU->getDDDepth()          + uiPartOffset, m_pucDisparityDerivedDepth,         iSizeInUchar );
     1614  memcpy( rpcCU->getUseDDD()           + uiPartOffset, m_pbUseDDD,                         iSizeInBool );
     1615#endif
     1616
    15461617#if H_3D_DIM
    15471618  for( Int i = 0; i < DMM_NUM_TYPE; i++ )
     
    16111682#endif
    16121683}
     1684
     1685#if MTK_DDD_G0063
     1686Void TComDataCU::setDDDepthSubParts ( UChar ucDDD, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth )
     1687{
     1688    setSubPart<UChar>( ucDDD, m_pucDisparityDerivedDepth, uiAbsPartIdx, uiDepth, uiPartIdx );
     1689}
     1690
     1691Void TComDataCU::setUseDDD        ( Bool bUseDDD, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth )
     1692{
     1693    setSubPart<Bool>( bUseDDD, m_pbUseDDD, uiAbsPartIdx, uiDepth, uiPartIdx );
     1694}
     1695
     1696Void TComDataCU::setUseDDD( Bool bUseDDD, UInt uiAbsPartIdx, UInt uiDepth )
     1697{
     1698    memset( m_pbUseDDD + uiAbsPartIdx, bUseDDD, (m_pcPic->getNumPartInCU() >> ( 2 * uiDepth ))*sizeof(Bool) );
     1699}
     1700
     1701#endif
    16131702
    16141703// --------------------------------------------------------------------------------------------------------------------
     
    38813970  TComMvField tmpMV[2];
    38823971  UChar tmpDir;
     3972
     3973#if MTK_DDD_G0063
     3974  m_iUseDDDCandIdx = -1;
     3975#endif
    38833976
    38843977  //////////////////////////////////
     
    43284421#endif
    43294422  }
    4330 
     4423#if MTK_DDD_G0063
     4424  if( m_pcSlice->getIsDepth() && m_pcSlice->getViewIndex() != 0  )
     4425  {
     4426      UInt uiPartIdx;
     4427      TComDataCU *pcTextureCU = m_pcSlice->getTexturePic()->getCU( getAddr() );
     4428      TComSlice *pcTextureSlice = pcTextureCU->getSlice(); 
     4429
     4430
     4431      tmpMV[0].setMvField( cZeroMv, NOT_VALID );
     4432      tmpMV[1].setMvField( cZeroMv, NOT_VALID );
     4433      tmpDir = 0;
     4434
     4435      xDeriveCenterIdx( uiPUIdx, uiPartIdx);
     4436
     4437      if ( pcTextureCU && !pcTextureCU->isIntra( uiPartIdx ) )
     4438      {
     4439
     4440          TComMvField cMVField;
     4441          UChar ucInterDir = pcTextureCU->getInterDir( uiPartIdx );
     4442
     4443          Int iDV = 0;
     4444          Int iViewIdx = 0;
     4445          if( ucInterDir & 1 )
     4446          {
     4447              pcTextureCU->getMvField( pcTextureCU, uiPartIdx, REF_PIC_LIST_0, cMVField );
     4448              if( pcTextureSlice->getRefPOC( REF_PIC_LIST_0, cMVField.getRefIdx()) == pcTextureSlice->getPOC() )
     4449              {
     4450                  iViewIdx = pcTextureSlice->getRefPic( REF_PIC_LIST_0, cMVField.getRefIdx())->getViewIndex();
     4451                  iDV = cMVField.getHor();
     4452
     4453
     4454                  Int iValidDepRef = getPic()->isTextRefValid( REF_PIC_LIST_0, cMVField.getRefIdx() );
     4455
     4456                  if( iValidDepRef >= 0 )
     4457                  {
     4458                      const TComMv cAdd( 2, 2 );
     4459                      cMVField.getMv() += cAdd;
     4460                      cMVField.getMv() >>= 2;
     4461                      clipMv( cMVField.getMv() );
     4462                      tmpMV[ 0 ].setMvField( cMVField.getMv(), iValidDepRef );
     4463                      tmpDir = 1;
     4464                  }
     4465              }
     4466          }
     4467          if( !tmpDir && ( ucInterDir & 2 ))
     4468          {
     4469              pcTextureCU->getMvField( pcTextureCU, uiPartIdx, REF_PIC_LIST_1, cMVField );
     4470              if( pcTextureSlice->getRefPOC( REF_PIC_LIST_1, cMVField.getRefIdx()) == pcTextureSlice->getPOC() )
     4471              {
     4472                  iViewIdx = pcTextureSlice->getRefPic( REF_PIC_LIST_1, cMVField.getRefIdx())->getViewIndex();
     4473                  iDV = cMVField.getHor();
     4474
     4475                  Int iValidDepRef = getPic()->isTextRefValid( REF_PIC_LIST_1, cMVField.getRefIdx() );
     4476
     4477                  if( iValidDepRef >= 0 )
     4478                  {
     4479                      const TComMv cAdd( 2, 2 );
     4480                      cMVField.getMv() += cAdd;
     4481                      cMVField.getMv() >>= 2;
     4482                      clipMv( cMVField.getMv() );
     4483                      tmpMV[ 1 ].setMvField( cMVField.getMv(), iValidDepRef );
     4484                      tmpDir = 2;
     4485                  }
     4486              }
     4487          }
     4488          if( tmpDir != 0 )
     4489          {
     4490              rightShiftMergeCandList( pcMvFieldNeighbours, puhInterDirNeighbours, vspFlag, inheritedVSPDisInfo, iCount, 5-iCount, iCount3DV);
     4491              m_ucDDTmpDepth = m_pcSlice->getDepthFromDV( iDV,  iViewIdx );
     4492              m_iUseDDDCandIdx = iCount;
     4493
     4494              if( tmpDir == 1 )
     4495              {
     4496                  pcMvFieldNeighbours[ iCount << 1 ] = tmpMV[ 0 ];
     4497              }
     4498              else if( tmpDir == 2  )
     4499              {
     4500                  pcMvFieldNeighbours[( iCount << 1 ) + 1 ] = tmpMV[ 1 ];
     4501              }
     4502
     4503              abCandIsInter        [ iCount ] = true;
     4504              puhInterDirNeighbours[ iCount ] = tmpDir;
     4505
     4506              if ( mrgCandIdx == iCount )
     4507              {
     4508                  return;
     4509              }
     4510              iCount ++;
     4511
     4512              Int iLeftAboveAvail = 0;
     4513              if( iPosLeftAbove[ 0 ] != -1 )
     4514              {
     4515                  iPosLeftAbove[ 0 ] = iCount;
     4516                  iLeftAboveAvail = 1;
     4517              }
     4518              if( iPosLeftAbove[ 1 ] != -1 )
     4519              {
     4520                  iPosLeftAbove[ 1 ] = iCount + iLeftAboveAvail;
     4521              }
     4522
     4523          }
     4524      }     
     4525
     4526  }
     4527#endif
    43314528  /////////////////////////////////////////////////////////////////
    43324529  //////// DERIVE IvMC, IvMCShift,IvDCShift, IvDC  Candidates /////
     
    43984595      for(; iCnloop >= 0; iCnloop --)
    43994596      {
     4597#if MTK_DDD_G0063
     4598          if( iCnloop == m_iUseDDDCandIdx )
     4599          {
     4600              continue;
     4601          }
     4602#endif
    44004603        if(ivCandDir[0] == puhInterDirNeighbours[iCnloop] && pcMvFieldNeighbours[iCnloop<<1]==tmpMV[0] && pcMvFieldNeighbours[(iCnloop<<1)+1]==tmpMV[1])  // F0125 compatible with F0093
    44014604        {
     
    45954798#endif
    45964799
     4800#if MTK_DDD_G0063
     4801  // early termination
     4802  if ( iCount >= getSlice()->getMaxNumMergeCand())
     4803  {
     4804      return;
     4805  }
     4806#endif
    45974807
    45984808#if H_3D_IV_MERGE
Note: See TracChangeset for help on using the changeset viewer.