Changeset 443 in 3DVCSoftware for trunk/source/Lib/TLibEncoder/TEncCu.cpp


Ignore:
Timestamp:
26 May 2013, 15:41:34 (11 years ago)
Author:
tech
Message:
  • Reintegrated branch 6.2-dev0 rev. 442.
  • Changed version number.
  • Added coding results.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/Lib/TLibEncoder/TEncCu.cpp

    r332 r443  
    6464  m_ppcBestCU      = new TComDataCU*[m_uhTotalDepth-1];
    6565  m_ppcTempCU      = new TComDataCU*[m_uhTotalDepth-1];
    66  
     66#if QC_ARP_D0177
     67  m_ppcWeightedTempCU = new TComDataCU*[m_uhTotalDepth-1];
     68#endif
    6769  m_ppcPredYuvBest = new TComYuv*[m_uhTotalDepth-1];
    6870  m_ppcResiYuvBest = new TComYuv*[m_uhTotalDepth-1];
     
    9193    m_ppcBestCU[i] = new TComDataCU; m_ppcBestCU[i]->create( uiNumPartitions, uiWidth, uiHeight, false, uiMaxWidth >> (m_uhTotalDepth - 1) );
    9294    m_ppcTempCU[i] = new TComDataCU; m_ppcTempCU[i]->create( uiNumPartitions, uiWidth, uiHeight, false, uiMaxWidth >> (m_uhTotalDepth - 1) );
    93    
     95#if QC_ARP_D0177
     96    m_ppcWeightedTempCU[i] = new TComDataCU; m_ppcWeightedTempCU[i]->create( uiNumPartitions, uiWidth, uiHeight, false, uiMaxWidth >> (m_uhTotalDepth - 1) );
     97#endif   
    9498    m_ppcPredYuvBest[i] = new TComYuv; m_ppcPredYuvBest[i]->create(uiWidth, uiHeight);
    9599    m_ppcResiYuvBest[i] = new TComYuv; m_ppcResiYuvBest[i]->create(uiWidth, uiHeight);
     
    170174    {
    171175      m_ppcResPredTmp [i]->destroy(); delete m_ppcResPredTmp[i];  m_ppcResPredTmp[i] = NULL;
     176    }
     177#endif
     178#if QC_ARP_D0177
     179    if(m_ppcWeightedTempCU[i])
     180    {
     181      m_ppcWeightedTempCU[i]->destroy(); delete m_ppcWeightedTempCU[i]; m_ppcWeightedTempCU[i] = NULL;
    172182    }
    173183#endif
     
    591601      }
    592602#endif
    593 
     603#if QC_CU_NBDV_D0181
     604      DisInfo DvInfo;
     605      DvInfo.bDV = false;
     606      if( rpcTempCU->getSlice()->getSliceType() != I_SLICE )
     607      {
     608#if QC_ARP_D0177
     609        if(( rpcTempCU->getSlice()->getSPS()->getMultiviewMvPredMode() || rpcTempCU->getSlice()->getSPS()->getUseAdvRP()) && rpcTempCU->getSlice()->getViewId())
     610#else
     611        if(( rpcTempCU->getSlice()->getSPS()->getMultiviewMvPredMode() || rpcTempCU->getSlice()->getSPS()->getMultiviewResPredMode()) && rpcTempCU->getSlice()->getViewId())
     612#endif
     613        { 
     614          PartSize ePartTemp = rpcTempCU->getPartitionSize(0);
     615          rpcTempCU->setPartSizeSubParts( SIZE_2Nx2N, 0, uiDepth );     
     616#if MERL_VSP_C0152
     617          DvInfo.bDV = rpcTempCU->getDisMvpCandNBDV(0, 0, &DvInfo, false, true);
     618#else
     619          DvInfo.bDV = rpcTempCU->getDisMvpCandNBDV(0, 0, &DvInfo, false);
     620#endif
     621          rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth);
     622          rpcBestCU->setDvInfoSubParts(DvInfo, 0, uiDepth);
     623          rpcTempCU->setPartSizeSubParts( ePartTemp, 0, uiDepth );
     624        }
     625
     626        if(DvInfo.bDV==false)
     627        {
     628          DvInfo.iN=1;
     629#if !SEC_DEFAULT_DV_D0112
     630          DvInfo.m_acMvCand[0].setHor(0);
     631          DvInfo.m_acMvCand[0].setVer(0);
     632          DvInfo.m_aVIdxCan[0] = 0;
     633#endif
     634          rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth);
     635          rpcBestCU->setDvInfoSubParts(DvInfo, 0, uiDepth);
     636         }
     637       }
     638#endif
    594639      // do inter modes, SKIP and 2Nx2N
    595640      if( rpcBestCU->getSlice()->getSliceType() != I_SLICE )
    596641      {
    597642#if H3D_IVRP
     643#if QC_ARP_D0177
     644        Bool  bResPredAvailable   = false;
     645        Bool  bResPredAllowed     =                    (!rpcBestCU->getSlice()->getSPS()->isDepth                () );
     646        bResPredAllowed           = bResPredAllowed && ( rpcBestCU->getSlice()->getSPS()->getViewId              () );
     647        if( bResPredAllowed )
     648        {
     649          bResPredAvailable       = rpcBestCU->getResidualSamples( 0, true, m_ppcResPredTmp[uiDepth] );
     650        }
     651        for( UInt uiResPrdId = 0; uiResPrdId < (rpcBestCU->getSlice()->getSPS()->getUseAdvRP()? 1: ( bResPredAvailable ? 2 : 1 )); uiResPrdId++ )
     652#else
    598653        Bool  bResPredAvailable   = false;
    599654        UInt uiResPrdId = 0;
     655#endif
    600656        {
    601657          Bool bResPredFlag  = ( uiResPrdId > 0 );
     
    665721
    666722#if LGE_ILLUCOMP_B0045
     723#if SHARP_ILLUCOMP_PARSE_D0060
     724    bICEnabled = false;
     725#else
    667726    bICEnabled = rpcBestCU->getICFlag(0);
     727#endif
    668728#endif
    669729
     
    715775      {
    716776#if H3D_IVRP
     777#if QC_ARP_D0177
     778        Bool  bResPredAvailable   = false;
     779        Bool  bResPredAllowed     =                    (!rpcBestCU->getSlice()->getSPS()->isDepth                () );
     780        bResPredAllowed           = bResPredAllowed && ( rpcBestCU->getSlice()->getSPS()->getViewId              () );
     781        if( bResPredAllowed )
     782        {
     783          bResPredAvailable       = rpcBestCU->getResidualSamples( 0, true, m_ppcResPredTmp[uiDepth] );
     784        }
     785        for( UInt uiResPrdId = 0; uiResPrdId < (rpcBestCU->getSlice()->getSPS()->getUseAdvRP()? 1: ( bResPredAvailable ? 2 : 1 )); uiResPrdId++ )
     786#else
    717787        Bool  bResPredAvailable   = false;
    718788        UInt uiResPrdId = 0;
     789#endif
    719790        {
    720791          Bool bResPredFlag  = ( uiResPrdId > 0 );
    721792#if LGE_ILLUCOMP_B0045
     793#if SHARP_ILLUCOMP_PARSE_D0060
     794          {
     795            Bool bICFlag = false;
     796            rpcTempCU->setICFlagSubParts(bICFlag, 0, 0, uiDepth);
     797#else
    722798          for(UInt uiICId = 0; uiICId < (bICEnabled ? 2 : 1); uiICId++)
    723799          {
    724800            Bool bICFlag = (uiICId ? true : false);
    725801            rpcTempCU->setICFlagSubParts(bICFlag, 0, 0, uiDepth);
     802#endif
    726803#endif
    727804#endif
     
    16481725  UInt uiTPelY   = pcCU->getCUPelY() + g_auiRasterToPelY[ g_auiZscanToRaster[uiAbsPartIdx] ];
    16491726  UInt uiBPelY   = uiTPelY + (g_uiMaxCUHeight>>uiDepth) - 1;
    1650  
     1727
    16511728  if( getCheckBurstIPCMFlag() )
    16521729  {
     
    17601837  {
    17611838    m_pcEntropyCoder->encodeMergeIndex( pcCU, uiAbsPartIdx, 0 );
     1839
    17621840#if LGE_ILLUCOMP_B0045
    17631841    m_pcEntropyCoder->encodeICFlag  ( pcCU, uiAbsPartIdx
     
    17671845        );
    17681846#endif
     1847#if QC_ARP_D0177
     1848    m_pcEntropyCoder->encodeARPW( pcCU , uiAbsPartIdx, 0, uiDepth);
     1849#endif
    17691850    finishCU(pcCU,uiAbsPartIdx,uiDepth);
    17701851    return;
     
    17751856#endif
    17761857  m_pcEntropyCoder->encodePredMode( pcCU, uiAbsPartIdx );
    1777  
     1858
    17781859  m_pcEntropyCoder->encodePartSize( pcCU, uiAbsPartIdx, uiDepth );
    1779  
     1860
    17801861  if (pcCU->isIntra( uiAbsPartIdx ) && pcCU->getPartitionSize( uiAbsPartIdx ) == SIZE_2Nx2N )
    17811862  {
     
    17921873  // prediction Info ( Intra : direction mode, Inter : Mv, reference idx )
    17931874  m_pcEntropyCoder->encodePredInfo( pcCU, uiAbsPartIdx );
     1875
    17941876#if LGE_ILLUCOMP_B0045
    17951877    m_pcEntropyCoder->encodeICFlag  ( pcCU, uiAbsPartIdx
     
    18331915  Int numValidMergeCand = 0;
    18341916
     1917#if QC_ARP_D0177
     1918  Bool  bResPrdAvail  = rpcTempCU->getResPredAvail( 0 );
     1919  Bool  bResPrdFlag   = rpcTempCU->getResPredFlag ( 0 );
     1920#endif
    18351921#if LGE_ILLUCOMP_B0045
    18361922  Bool  bICFlag = rpcTempCU->getICFlag(0);
     
    18601946  rpcTempCU->setPartSizeSubParts( SIZE_2Nx2N, 0, uhDepth ); // interprets depth relative to LCU level
    18611947#if MERL_VSP_C0152
     1948#if LGE_VSP_INHERIT_D0092
     1949  Int iVSPIndexTrue[MRG_MAX_NUM_CANDS_MEM];
     1950  for (Int i=0; i<MRG_MAX_NUM_CANDS_MEM; i++)
     1951  {
     1952     iVSPIndexTrue[i] = 0;
     1953  }
     1954#else
    18621955  Int iVSPIndexTrue[3] = {-1, -1, -1};
     1956#endif
     1957#if MERL_VSP_NBDV_RefVId_Fix_D0166
     1958  Int iVSPDirTrue[3]   = {-1, -1, -1};
     1959  rpcTempCU->getInterMergeCandidates( 0, 0, uhDepth, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, iVSPIndexTrue, iVSPDirTrue );
     1960#else
    18631961  rpcTempCU->getInterMergeCandidates( 0, 0, uhDepth, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, iVSPIndexTrue );
     1962#endif
    18641963#else
    18651964  rpcTempCU->getInterMergeCandidates( 0, 0, uhDepth, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand );
    18661965#endif
    1867 #if H3D_IVRP
     1966#if H3D_IVRP & !QC_ARP_D0177
    18681967  Bool bResPredAvail = rpcTempCU->getResPredAvail(0);
    18691968#endif
    18701969
    18711970  Bool bestIsSkip = false;
    1872  
     1971#if QC_ARP_D0177
     1972  Int nGRPW = rpcTempCU->getSlice()->getARPStepNum() - 1;
     1973  if(nGRPW < 0 || !bResPrdAvail )
     1974    nGRPW = 0;
     1975  for( ; nGRPW >= 0 ; nGRPW-- )
     1976  {
     1977#endif 
    18731978  for( UInt uiMergeCand = 0; uiMergeCand < numValidMergeCand; ++uiMergeCand )
    18741979  {
    18751980    {
    18761981      TComYuv* pcPredYuvTemp = NULL;
     1982#if SHARP_ILLUCOMP_PARSE_D0060
     1983      if (rpcTempCU->getSlice()->getApplyIC() && rpcTempCU->getSlice()->getIcSkipParseFlag())
     1984      {
     1985        if (bICFlag && uiMergeCand == 0)
     1986        {
     1987          continue;
     1988        }
     1989      }
     1990#endif
    18771991#if LOSSLESS_CODING
    18781992      UInt iteration;
     
    19042018          rpcTempCU->setPredModeSubParts( MODE_SKIP, 0, uhDepth ); // interprets depth relative to LCU level
    19052019          rpcTempCU->setPartSizeSubParts( SIZE_2Nx2N, 0, uhDepth ); // interprets depth relative to LCU level
     2020#if QC_ARP_D0177
     2021          if(rpcTempCU->getSlice()->getSPS()->getUseAdvRP())
     2022            rpcTempCU->setARPWSubParts( ( UChar )nGRPW , 0 , uhDepth );
     2023#endif
    19062024          rpcTempCU->setMergeFlagSubParts( true, 0, 0, uhDepth ); // interprets depth relative to LCU level
    19072025          rpcTempCU->setMergeIndexSubParts( uiMergeCand, 0, 0, uhDepth ); // interprets depth relative to LCU level
    19082026#if MERL_VSP_C0152
     2027
     2028#if MTK_D0156
     2029          if( !rpcTempCU->getSlice()->getSPS()->getUseVSPCompensation() )
     2030          {
     2031              rpcTempCU->setVSPIndexSubParts( 0, 0, 0, uhDepth );
     2032          }
     2033          else
     2034#endif
    19092035          {
    19102036            Int iVSPIdx = 0;
     2037#if LGE_VSP_INHERIT_D0092
     2038            if (iVSPIndexTrue[uiMergeCand] == 1)
     2039            {
     2040                iVSPIdx = 1;
     2041            }
     2042#else
    19112043            Int numVSPIdx;
    19122044            numVSPIdx = 3;
     
    19192051                }
    19202052            }
     2053#endif
    19212054            rpcTempCU->setVSPIndexSubParts( iVSPIdx, 0, 0, uhDepth );
     2055#if MERL_VSP_NBDV_RefVId_Fix_D0166
     2056            rpcTempCU->setVSPDirSubParts(0, 0, 0, uhDepth ); // interprets depth relative to LCU level
     2057#endif
     2058#if QC_BVSP_CleanUP_D0191 && !LGE_VSP_INHERIT_D0092
     2059           if(iVSPIdx != 0)
     2060           {
     2061             Int iIVCIdx = rpcTempCU->getSlice()->getRefPic(REF_PIC_LIST_0, 0)->getPOC()==rpcTempCU->getSlice()->getPOC() ? 0: rpcTempCU->getSlice()->getNewRefIdx(REF_PIC_LIST_0);
     2062             cMvFieldNeighbours[2*uiMergeCand].setRefIdx(iIVCIdx);
     2063           }
     2064#endif
    19222065          }
    19232066#endif
     
    19272070
    19282071#if H3D_IVRP
     2072#if !QC_ARP_D0177
    19292073          rpcTempCU->setResPredAvailSubParts(bResPredAvail, 0, 0, uhDepth);
     2074#else
     2075          rpcTempCU->setResPredAvailSubParts( bResPrdAvail, 0, 0, uhDepth );
     2076          rpcTempCU->setResPredFlagSubParts ( bResPrdFlag,  0, 0, uhDepth );
     2077#endif 
    19302078#endif
    19312079#if LGE_ILLUCOMP_B0045
    19322080          rpcTempCU->setICFlagSubParts(bICFlag, 0, 0, uhDepth);
    19332081#endif
    1934 
     2082#if QC_ARP_D0177
     2083          if(rpcTempCU->getSlice()->getSPS()->getUseAdvRP())
     2084          {
     2085            bool bSignalflag[2] = {true, true};
     2086            for(UInt uiRefListIdx = 0; uiRefListIdx < 2; uiRefListIdx ++ )
     2087            {
     2088              Int iRefIdx = cMvFieldNeighbours[uiRefListIdx + 2*uiMergeCand].getRefIdx();
     2089              RefPicList eRefList = uiRefListIdx ? REF_PIC_LIST_1 : REF_PIC_LIST_0;
     2090              if(iRefIdx < 0 || rpcTempCU->getSlice()->getPOC() == rpcTempCU->getSlice()->getRefPOC(eRefList, iRefIdx))
     2091                bSignalflag[uiRefListIdx] = false;
     2092            }
     2093            if(!bSignalflag[0]&& !bSignalflag[1])
     2094            {
     2095              rpcTempCU->setARPWSubParts( 0 , 0 , uhDepth );
     2096            }
     2097          }
     2098#endif
    19352099          // do MC
    19362100#if HHI_INTERVIEW_SKIP
     
    19452109            m_pcPredSearch->motionCompensation ( rpcTempCU, m_ppcPredYuvTemp[uhDepth] );
    19462110#endif
    1947 #if H3D_IVRP
     2111#if H3D_IVRP & !QC_ARP_D0177
    19482112            if (uiMergeCand == 0 && rpcTempCU->getResPredAvail(0))
    19492113            {
     
    19642128              m_pcPredSearch->motionCompensation ( rpcTempCU, m_ppcPredYuvTemp[uhDepth] );
    19652129#endif
    1966 #if H3D_IVRP
     2130#if H3D_IVRP & !QC_ARP_D0177
    19672131              if (uiMergeCand == 0 && rpcTempCU->getResPredAvail(0))
    19682132              {
     
    20212185    }
    20222186  }
     2187#if QC_ARP_D0177
     2188  }
     2189#endif
    20232190}
    20242191
     
    20382205{
    20392206  UChar uhDepth = rpcTempCU->getDepth( 0 );
    2040  
     2207#if QC_ARP_D0177
     2208  Bool bFirstTime = true;
     2209  Int nARPWMax = rpcTempCU->getSlice()->getARPStepNum() - 1;
     2210  if(nARPWMax < 0 || !rpcTempCU->getResPredAvail( 0 ) )
     2211    nARPWMax = 0;
     2212  if( ePartSize != SIZE_2Nx2N)
     2213    nARPWMax = 0;
     2214  Int nARPWStart = 0 , nARPWStep = 1;
     2215  for( Int nCount = 0 , nGRPW = nARPWStart ; nCount <= nARPWMax ; nCount++ , nGRPW += nARPWStep )
     2216  {
     2217    if( bFirstTime == false && rpcTempCU->getSlice()->getSPS()->getUseAdvRP() )
     2218      rpcTempCU->initEstData( rpcTempCU->getDepth(0), rpcTempCU->getQP(0) );
     2219#endif 
    20412220#if HHI_VSO
    20422221  if( m_pcRdCost->getUseRenModel() )
     
    20652244  rpcTempCU->setPredModeSubParts  ( MODE_INTER, 0, uhDepth );
    20662245
     2246#if QC_ARP_D0177
     2247  if(rpcTempCU->getSlice()->getSPS()->getUseAdvRP())
     2248    rpcTempCU->setARPWSubParts( ( UChar )nGRPW , 0 , uhDepth );
     2249#endif
     2250#if QC_ARP_D0177
     2251  if( bFirstTime == false && rpcTempCU->getSlice()->getSPS()->getUseAdvRP())
     2252  {
     2253    assert(!rpcTempCU->getSlice()->getSPS()->isDepth());
     2254    rpcTempCU->copyPartFrom( m_ppcWeightedTempCU[uhDepth] , 0 , uhDepth, true );
     2255    rpcTempCU->setARPWSubParts( ( UChar )nGRPW , 0 , uhDepth );
     2256#if MERL_VSP_C0152
     2257    m_pcPredSearch->motionCompensation( rpcTempCU , m_ppcPredYuvTemp[uhDepth], 0);
     2258#else
     2259    m_pcPredSearch->motionCompensation( rpcTempCU , m_ppcPredYuvTemp[uhDepth] );
     2260#endif
     2261    if(rpcTempCU->getPartitionSize(0)==SIZE_2Nx2N)
     2262    {
     2263      bool bSignalflag[2] = {true, true};
     2264      for(UInt uiRefListIdx = 0; uiRefListIdx < 2; uiRefListIdx ++ )
     2265      {
     2266        RefPicList eRefList = uiRefListIdx ? REF_PIC_LIST_1 : REF_PIC_LIST_0;
     2267        Int iRefIdx = rpcTempCU->getCUMvField(eRefList)->getRefIdx(0);
     2268        if(iRefIdx < 0 || rpcTempCU->getSlice()->getPOC() == rpcTempCU->getSlice()->getRefPOC(eRefList, iRefIdx))
     2269          bSignalflag[uiRefListIdx] = false;
     2270      }
     2271      if(!bSignalflag[0]&& !bSignalflag[1])
     2272        rpcTempCU->setARPWSubParts( 0 , 0 , uhDepth );
     2273    }
     2274  }
     2275  else
     2276  {
     2277    bFirstTime = false;
     2278#endif
    20672279#if AMP_MRG
    20682280  rpcTempCU->setMergeAMP (true);
     
    20792291#endif
    20802292#endif
     2293#if QC_ARP_D0177
     2294   if(rpcTempCU->getSlice()->getSPS()->getUseAdvRP())
     2295   {
     2296     m_ppcWeightedTempCU[uhDepth]->copyPartFrom( rpcTempCU , 0 , uhDepth );
     2297     if(rpcTempCU->getSlice()->getSPS()->getUseAdvRP() && rpcTempCU->getPartitionSize(0)==SIZE_2Nx2N)
     2298     {
     2299       bool bSignalflag[2] = {true, true};
     2300       for(UInt uiRefListIdx = 0; uiRefListIdx < 2; uiRefListIdx ++ )
     2301       {
     2302         RefPicList eRefList = uiRefListIdx ? REF_PIC_LIST_1 : REF_PIC_LIST_0;
     2303         Int iRefIdx = rpcTempCU->getCUMvField(eRefList)->getRefIdx(0);
     2304         if(iRefIdx < 0 || rpcTempCU->getSlice()->getPOC() == rpcTempCU->getSlice()->getRefPOC(eRefList, iRefIdx))
     2305           bSignalflag[uiRefListIdx] = false;
     2306       }
     2307       if(!bSignalflag[0]&& !bSignalflag[1])
     2308         rpcTempCU->setARPWSubParts( 0 , 0 , uhDepth );
     2309     }
     2310   }
     2311  }
     2312#endif
    20812313
    20822314#if AMP_MRG
    20832315  if ( !rpcTempCU->getMergeAMP() )
    20842316  {
     2317#if QC_ARP_D0177
     2318    if(rpcTempCU->getSlice()->getSPS()->getUseAdvRP())
     2319      continue;
     2320    else
     2321#endif
    20852322    return;
    20862323  }
     
    21232360  xCheckDQP( rpcTempCU );
    21242361  xCheckBestMode(rpcBestCU, rpcTempCU, uhDepth);
     2362#if QC_ARP_D0177
     2363  }
     2364#endif
    21252365}
    21262366
     
    27582998      assert( rpcTempCU->getPredictionMode( ui ) != MODE_NONE );
    27592999#if MERL_VSP_C0152
    2760       Int vspIdx = pcTextureCU->getVSPIndex( rpcTempCU->getZorderIdxInCU() + ui);
     3000      Int vspIdx = pcTextureCU->getVSPIndex( rpcTempCU->getZorderIdxInCU() + ui );
    27613001      rpcTempCU->setVSPIndex( ui , vspIdx);
     3002#if MERL_VSP_NBDV_RefVId_Fix_D0166
     3003      Int vspDir = pcTextureCU->getVSPDir  ( rpcTempCU->getZorderIdxInCU() + ui );
     3004      rpcTempCU->setVSPDir( ui, vspDir);
     3005#endif
    27623006#endif
    27633007    }
Note: See TracChangeset for help on using the changeset viewer.