Ignore:
Timestamp:
11 Jun 2013, 20:35:00 (11 years ago)
Author:
zhang
Message:

Implementation of ARP from QC

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/HTM-DEV-0.3-dev2a/source/Lib/TLibEncoder/TEncCu.cpp

    r455 r464  
    6565  m_ppcTempCU      = new TComDataCU*[m_uhTotalDepth-1];
    6666   
     67#if H_3D_ARP
     68  m_ppcWeightedTempCU = new TComDataCU*[m_uhTotalDepth-1];
     69#endif
     70
    6771  m_ppcPredYuvBest = new TComYuv*[m_uhTotalDepth-1];
    6872  m_ppcResiYuvBest = new TComYuv*[m_uhTotalDepth-1];
     
    8387    m_ppcTempCU[i] = new TComDataCU; m_ppcTempCU[i]->create( uiNumPartitions, uiWidth, uiHeight, false, uiMaxWidth >> (m_uhTotalDepth - 1) );
    8488   
     89#if H_3D_ARP
     90    m_ppcWeightedTempCU[i] = new TComDataCU; m_ppcWeightedTempCU[i]->create( uiNumPartitions, uiWidth, uiHeight, false, uiMaxWidth >> (m_uhTotalDepth - 1) );
     91#endif 
     92
    8593    m_ppcPredYuvBest[i] = new TComYuv; m_ppcPredYuvBest[i]->create(uiWidth, uiHeight);
    8694    m_ppcResiYuvBest[i] = new TComYuv; m_ppcResiYuvBest[i]->create(uiWidth, uiHeight);
     
    124132      m_ppcTempCU[i]->destroy();      delete m_ppcTempCU[i];      m_ppcTempCU[i] = NULL;
    125133    }
     134#if H_3D_ARP
     135    if(m_ppcWeightedTempCU[i])
     136    {
     137      m_ppcWeightedTempCU[i]->destroy(); delete m_ppcWeightedTempCU[i]; m_ppcWeightedTempCU[i] = NULL;
     138    }
     139#endif
    126140    if(m_ppcPredYuvBest[i])
    127141    {
     
    468482      if( rpcTempCU->getSlice()->getSliceType() != I_SLICE )
    469483      {
     484#if H_3D_ARP
     485        if( rpcTempCU->getSlice()->getVPS()->getUseAdvRP(rpcTempCU->getSlice()->getLayerId()) )
     486#else
    470487        if(rpcTempCU->getSlice()->getViewIndex() && !rpcTempCU->getSlice()->getIsDepth()) //Notes from QC: this condition shall be changed once the configuration is completed, e.g. in pcSlice->getSPS()->getMultiviewMvPredMode() || ARP in prev. HTM. Remove this comment once it is done. Remove this comment once it is done.
     488#endif
    471489        {
    472490          PartSize ePartTemp = rpcTempCU->getPartitionSize(0);
     
    12201238  {
    12211239    m_pcEntropyCoder->encodeMergeIndex( pcCU, uiAbsPartIdx );
     1240#if H_3D_ARP
     1241    m_pcEntropyCoder->encodeARPW( pcCU , uiAbsPartIdx );
     1242#endif
    12221243    finishCU(pcCU,uiAbsPartIdx,uiDepth);
    12231244    return;
     
    12411262  // prediction Info ( Intra : direction mode, Inter : Mv, reference idx )
    12421263  m_pcEntropyCoder->encodePredInfo( pcCU, uiAbsPartIdx );
    1243  
     1264#if H_3D_ARP
     1265  m_pcEntropyCoder->encodeARPW( pcCU , uiAbsPartIdx );
     1266#endif
     1267
    12441268  // Encode Coefficients
    12451269  Bool bCodeDQP = getdQPFlag();
     
    13021326  }
    13031327
     1328#if H_3D_ARP
     1329  Int nARPWMax = rpcTempCU->getSlice()->getARPStepNum() - 1;
     1330  if( nARPWMax < 0 || !rpcTempCU->getDvInfo(0).bDV )
     1331  {
     1332    nARPWMax = 0;
     1333  }
     1334  for( Int nARPW=nARPWMax; nARPW >= 0 ; nARPW-- )
     1335  {
     1336    memset( mergeCandBuffer, 0, MRG_MAX_NUM_CANDS*sizeof(Int) );
     1337#endif
    13041338  for( UInt uiNoResidual = 0; uiNoResidual < iteration; ++uiNoResidual )
    13051339  {
     
    13161350          rpcTempCU->setCUTransquantBypassSubParts( m_pcEncCfg->getCUTransquantBypassFlagValue(),     0, uhDepth );
    13171351          rpcTempCU->setPartSizeSubParts( SIZE_2Nx2N, 0, uhDepth ); // interprets depth relative to LCU level
     1352#if H_3D_ARP
     1353          rpcTempCU->setARPWSubParts( (UChar)nARPW , 0 , uhDepth );
     1354#endif
    13181355          rpcTempCU->setMergeFlagSubParts( true, 0, 0, uhDepth ); // interprets depth relative to LCU level
    13191356          rpcTempCU->setMergeIndexSubParts( uiMergeCand, 0, 0, uhDepth ); // interprets depth relative to LCU level
     
    13221359          rpcTempCU->getCUMvField( REF_PIC_LIST_1 )->setAllMvField( cMvFieldNeighbours[1 + 2*uiMergeCand], SIZE_2Nx2N, 0, 0 ); // interprets depth relative to rpcTempCU level
    13231360
     1361#if H_3D_ARP
     1362          if( nARPW )
     1363          {
     1364            Bool bSignalflag[2] = { true, true };
     1365            for( UInt uiRefListIdx = 0; uiRefListIdx < 2; uiRefListIdx ++ )
     1366            {
     1367              Int iRefIdx = cMvFieldNeighbours[uiRefListIdx + 2*uiMergeCand].getRefIdx();
     1368              RefPicList eRefList = uiRefListIdx ? REF_PIC_LIST_1 : REF_PIC_LIST_0;
     1369              if( iRefIdx < 0 || rpcTempCU->getSlice()->getPOC() == rpcTempCU->getSlice()->getRefPOC(eRefList, iRefIdx) )
     1370              {
     1371                bSignalflag[uiRefListIdx] = false;
     1372              }
     1373            }
     1374            if( !bSignalflag[0] && !bSignalflag[1] )
     1375            {
     1376              rpcTempCU->setARPWSubParts( 0 , 0 , uhDepth );
     1377            }
     1378          }
     1379#endif
    13241380       // do MC
    13251381       m_pcPredSearch->motionCompensation ( rpcTempCU, m_ppcPredYuvTemp[uhDepth] );
     
    14011457  }
    14021458 }
     1459#if H_3D_ARP
     1460 }
     1461#endif
    14031462}
    14041463
     
    14111470{
    14121471  UChar uhDepth = rpcTempCU->getDepth( 0 );
     1472#if H_3D_ARP
     1473  Int iLayerId    = rpcTempCU->getSlice()->getLayerId();
     1474  Bool bFirstTime = true;
     1475  Int nARPWMax    = rpcTempCU->getSlice()->getARPStepNum() - 1;
     1476
     1477  if( nARPWMax < 0 || ePartSize != SIZE_2Nx2N || !rpcTempCU->getDvInfo(0).bDV  )
     1478  {
     1479    nARPWMax = 0;
     1480  }
     1481
     1482  for( Int nARPW = 0; nARPW <= nARPWMax; nARPW++ )
     1483  {
     1484    if( bFirstTime == false && rpcTempCU->getSlice()->getVPS()->getUseAdvRP( iLayerId ) )
     1485    {
     1486      rpcTempCU->initEstData( rpcTempCU->getDepth(0), rpcTempCU->getQP(0) );
     1487    }
     1488#endif
    14131489#if H_3D_VSO // M3
    14141490  if( m_pcRdCost->getUseRenModel() )
     
    14301506  rpcTempCU->setCUTransquantBypassSubParts  ( m_pcEncCfg->getCUTransquantBypassFlagValue(),      0, uhDepth );
    14311507 
     1508#if H_3D_ARP
     1509  rpcTempCU->setARPWSubParts( (UChar)nARPW , 0 , uhDepth );
     1510#endif
     1511
     1512#if H_3D_ARP
     1513  if( bFirstTime == false && nARPWMax )
     1514  {
     1515    rpcTempCU->copyPartFrom( m_ppcWeightedTempCU[uhDepth] , 0 , uhDepth );
     1516    rpcTempCU->setARPWSubParts( (UChar)nARPW , 0 , uhDepth );
     1517
     1518    m_pcPredSearch->motionCompensation( rpcTempCU , m_ppcPredYuvTemp[uhDepth] );
     1519
     1520    if(rpcTempCU->getPartitionSize(0)==SIZE_2Nx2N)
     1521    {
     1522      Bool bSignalflag[2] = { true, true };
     1523      for(UInt uiRefListIdx = 0; uiRefListIdx < 2; uiRefListIdx ++ )
     1524      {
     1525        RefPicList eRefList = uiRefListIdx ? REF_PIC_LIST_1 : REF_PIC_LIST_0;
     1526        Int iRefIdx = rpcTempCU->getCUMvField(eRefList)->getRefIdx(0);
     1527        if( iRefIdx < 0 || rpcTempCU->getSlice()->getPOC() == rpcTempCU->getSlice()->getRefPOC(eRefList, iRefIdx) )
     1528        {
     1529          bSignalflag[uiRefListIdx] = false;
     1530        }
     1531      }
     1532      if( !bSignalflag[0] && !bSignalflag[1] )
     1533      {
     1534        rpcTempCU->setARPWSubParts( 0 , 0 , uhDepth );
     1535      }
     1536    }
     1537  }
     1538  else
     1539  {
     1540    bFirstTime = false;
     1541#endif
    14321542#if AMP_MRG
    14331543  rpcTempCU->setMergeAMP (true);
     
    14361546  m_pcPredSearch->predInterSearch ( rpcTempCU, m_ppcOrigYuv[uhDepth], m_ppcPredYuvTemp[uhDepth], m_ppcResiYuvTemp[uhDepth], m_ppcRecoYuvTemp[uhDepth] );
    14371547#endif
     1548#if H_3D_ARP
     1549   if( nARPWMax )
     1550   {
     1551     m_ppcWeightedTempCU[uhDepth]->copyPartFrom( rpcTempCU , 0 , uhDepth );
     1552
     1553     Bool bSignalflag[2] = { true, true };
     1554     for(UInt uiRefListIdx = 0; uiRefListIdx < 2; uiRefListIdx ++ )
     1555     {
     1556       RefPicList eRefList = uiRefListIdx ? REF_PIC_LIST_1 : REF_PIC_LIST_0;
     1557       Int iRefIdx = rpcTempCU->getCUMvField(eRefList)->getRefIdx(0);
     1558       if( iRefIdx < 0 || rpcTempCU->getSlice()->getPOC() == rpcTempCU->getSlice()->getRefPOC(eRefList, iRefIdx) )
     1559       {
     1560         bSignalflag[uiRefListIdx] = false;
     1561       }
     1562     }
     1563     if( !bSignalflag[0] && !bSignalflag[1])
     1564     {
     1565       rpcTempCU->setARPWSubParts( 0 , 0 , uhDepth );
     1566     }
     1567   }
     1568  }
     1569#endif
    14381570
    14391571#if AMP_MRG
    14401572  if ( !rpcTempCU->getMergeAMP() )
    14411573  {
     1574#if H_3D_ARP
     1575    if( nARPWMax )
     1576    {
     1577      continue;
     1578    }
     1579    else
     1580#endif
    14421581    return;
    14431582  }
     
    14661605  xCheckDQP( rpcTempCU );
    14671606  xCheckBestMode(rpcBestCU, rpcTempCU, uhDepth);
     1607#if H_3D_ARP
     1608  }
     1609#endif
    14681610}
    14691611
Note: See TracChangeset for help on using the changeset viewer.