Changeset 189 in 3DVCSoftware for trunk/source/Lib/TLibEncoder/TEncSearch.cpp


Ignore:
Timestamp:
18 Nov 2012, 22:11:37 (12 years ago)
Author:
tech
Message:

Reintegrated branch 4.1-dev0 Rev. 188.

File:
1 edited

Legend:

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

    r125 r189  
    4242#include <math.h>
    4343
     44#if RWTH_SDC_DLT_B0036
     45#define GetDepthValue2Idx(val)     (pcCU->getSlice()->getSPS()->depthValue2idx(val))
     46#define GetIdx2DepthValue(val)     (pcCU->getSlice()->getSPS()->idx2DepthValue(val))
     47#endif
     48
    4449//! \ingroup TLibEncoder
    4550//! \{
     
    195200  const Int iNumAMVPCands = AMVP_MAX_NUM_CANDS + 1;
    196201  for( Int iNum = 0; iNum < iNumAMVPCands+1; iNum++)
    197   {
    198202    for( Int iIdx = 0; iIdx < iNumAMVPCands; iIdx++)
    199203#else
    200204  for( Int iNum = 0; iNum < AMVP_MAX_NUM_CANDS+1; iNum++)
    201   {
    202205    for( Int iIdx = 0; iIdx < AMVP_MAX_NUM_CANDS; iIdx++)
    203206#endif
     
    208211        m_auiMVPIdxCost[iIdx][iNum] = MAX_INT;
    209212    }
    210   }
    211213 
    212214  initTempBuff();
     
    300302
    301303  // distortion
     304#if LGE_ILLUCOMP_B0045
     305  m_cDistParam.bUseIC = pcPatternKey->getICFlag();
     306#endif
    302307  uiSad = m_cDistParam.DistFunc( &m_cDistParam );
    303308 
     
    717722
    718723    m_cDistParam.pCur = piRefPos;
     724#if LGE_ILLUCOMP_B0045
     725    m_cDistParam.bUseIC = pcPatternKey->getICFlag();
     726#endif
    719727    uiDist = m_cDistParam.DistFunc( &m_cDistParam );
    720728    uiDist += m_pcRdCost->getCost( cMvTest.getHor(), cMvTest.getVer() );
     
    957965                                TComYuv*    pcResiYuv,
    958966                                Dist&       ruiDist
    959 #if LG_ZEROINTRADEPTHRESI_M26039
     967#if LG_ZEROINTRADEPTHRESI_A0087
    960968                                ,Bool        bZeroResi
    961969#endif
     
    9921000  pcCU->getPattern()->initAdiPattern( pcCU, uiAbsPartIdx, uiTrDepth, m_piYuvExt, m_iYuvExtStride, m_iYuvExtHeight, bAboveAvail, bLeftAvail );
    9931001 
    994 #if LGE_EDGE_INTRA
     1002#if LGE_EDGE_INTRA_A0070
    9951003  if( uiLumaPredMode >= EDGE_INTRA_IDX )
    9961004  {
     
    10401048    }
    10411049  }
    1042 #if LG_ZEROINTRADEPTHRESI_M26039
     1050#if LG_ZEROINTRADEPTHRESI_A0087
    10431051  if(bZeroResi)
    10441052  {
     
    13571365#endif
    13581366                                Double&      dRDCost
    1359 #if LG_ZEROINTRADEPTHRESI_M26039
     1367#if LG_ZEROINTRADEPTHRESI_A0087
    13601368                               ,Bool         bZeroResi
    13611369#endif
     
    13791387  }
    13801388#endif
    1381 #if LGE_EDGE_INTRA
     1389#if LGE_EDGE_INTRA_A0070
    13821390  if( pcCU->getLumaIntraDir( uiAbsPartIdx ) >= EDGE_INTRA_IDX )
    13831391  {
     
    14011409    //----- code luma block with given intra prediction mode and store Cbf-----
    14021410    dSingleCost   = 0.0;
    1403 #if LG_ZEROINTRADEPTHRESI_M26039
     1411#if LG_ZEROINTRADEPTHRESI_A0087
    14041412    xIntraCodingLumaBlk( pcCU, uiTrDepth, uiAbsPartIdx, pcOrgYuv, pcPredYuv, pcResiYuv, uiSingleDistY, bZeroResi );
    14051413#else
     
    15931601}
    15941602
     1603#if RWTH_SDC_DLT_B0036
     1604Void TEncSearch::xIntraCodingSDC( TComDataCU* pcCU, UInt uiAbsPartIdx, TComYuv* pcOrgYuv, TComYuv* pcPredYuv, Dist& ruiDist, Double& dRDCost, Bool bResidual )
     1605{
     1606  UInt    uiLumaPredMode    = pcCU     ->getLumaIntraDir( uiAbsPartIdx );
     1607  UInt    uiWidth           = pcCU     ->getWidth   ( 0 );
     1608  UInt    uiHeight          = pcCU     ->getHeight  ( 0 );
     1609  UInt    uiStride          = pcOrgYuv ->getStride  ();
     1610  Pel*    piOrg             = pcOrgYuv ->getLumaAddr( uiAbsPartIdx );
     1611  Pel*    piPred            = pcPredYuv->getLumaAddr( uiAbsPartIdx );
     1612  Pel*    piReco            = pcPredYuv->getLumaAddr( uiAbsPartIdx );
     1613 
     1614  UInt    uiZOrder          = pcCU->getZorderIdxInCU() + uiAbsPartIdx;
     1615  Pel*    piRecIPred        = pcCU->getPic()->getPicYuvRec()->getLumaAddr( pcCU->getAddr(), uiZOrder );
     1616  UInt    uiRecIPredStride  = pcCU->getPic()->getPicYuvRec()->getStride  ();
     1617 
     1618  AOF( uiWidth == uiHeight );
     1619  AOF( uiAbsPartIdx == 0 );
     1620  AOF( pcCU->getSDCAvailable(uiAbsPartIdx) );
     1621  AOF( pcCU->getSDCFlag(uiAbsPartIdx) );
     1622 
     1623  //===== init availability pattern =====
     1624  Bool  bAboveAvail = false;
     1625  Bool  bLeftAvail  = false;
     1626  pcCU->getPattern()->initPattern   ( pcCU, 0, uiAbsPartIdx );
     1627  pcCU->getPattern()->initAdiPattern( pcCU, uiAbsPartIdx, 0, m_piYuvExt, m_iYuvExtStride, m_iYuvExtHeight, bAboveAvail, bLeftAvail );
     1628 
     1629  //===== get prediction signal =====
     1630#if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX
     1631  if( uiLumaPredMode >= NUM_INTRA_MODE )
     1632  {
     1633    predIntraLumaDMM( pcCU, uiAbsPartIdx, uiLumaPredMode, piPred, uiStride, uiWidth, uiHeight, bAboveAvail, bLeftAvail, true );
     1634  }
     1635  else
     1636  {
     1637#endif
     1638    predIntraLumaAng( pcCU->getPattern(), uiLumaPredMode, piPred, uiStride, uiWidth, uiHeight, pcCU, bAboveAvail, bLeftAvail );
     1639#if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX
     1640  }
     1641#endif
     1642 
     1643  // number of segments depends on prediction mode
     1644  UInt uiNumSegments = 1; 
     1645  Bool* pbMask = NULL;
     1646  UInt uiMaskStride = 0;
     1647 
     1648  if( uiLumaPredMode == DMM_WEDGE_FULL_IDX || uiLumaPredMode == DMM_WEDGE_PREDDIR_IDX )
     1649  {
     1650    Int uiTabIdx = (uiLumaPredMode == DMM_WEDGE_FULL_IDX)?pcCU->getWedgeFullTabIdx(uiAbsPartIdx):pcCU->getWedgePredDirTabIdx(uiAbsPartIdx);
     1651   
     1652    WedgeList* pacWedgeList = &g_aacWedgeLists[(g_aucConvertToBit[uiWidth])];
     1653    TComWedgelet* pcWedgelet = &(pacWedgeList->at( uiTabIdx ));
     1654   
     1655    uiNumSegments = 2;
     1656    pbMask = pcWedgelet->getPattern();
     1657    uiMaskStride = pcWedgelet->getStride();
     1658  }
     1659 
     1660  // get DC prediction for each segment
     1661  Pel apDCPredValues[2];
     1662  xAnalyzeSegmentsSDC(piPred, uiStride, uiWidth, apDCPredValues, uiNumSegments, pbMask, uiMaskStride );
     1663 
     1664  // get original DC for each segment
     1665  Pel apDCOrigValues[2];
     1666  xAnalyzeSegmentsSDC(piOrg, uiStride, uiWidth, apDCOrigValues, uiNumSegments, pbMask, uiMaskStride );
     1667 
     1668  for( UInt uiSegment = 0; uiSegment < uiNumSegments; uiSegment++ )
     1669  {
     1670    // remap reconstructed value to valid depth values
     1671    Pel pDCRec = bResidual?apDCOrigValues[uiSegment]:apDCPredValues[uiSegment];
     1672   
     1673    // get residual (idx)
     1674    Pel pResidualIdx = GetDepthValue2Idx( pDCRec ) - GetDepthValue2Idx( apDCPredValues[uiSegment] );
     1675   
     1676    // save SDC DC offset
     1677    pcCU->setSDCSegmentDCOffset(pResidualIdx, uiSegment, uiAbsPartIdx);
     1678  }
     1679 
     1680  // reconstruct residual based on mask + DC residuals
     1681  Pel apDCResiValues[2];
     1682  Pel apDCRecoValues[2];
     1683  for( UInt uiSegment = 0; uiSegment < uiNumSegments; uiSegment++ )
     1684  {
     1685    Pel   pPredIdx    = GetDepthValue2Idx( apDCPredValues[uiSegment] );
     1686    Pel   pResiIdx    = pcCU->getSDCSegmentDCOffset(uiSegment, uiAbsPartIdx);
     1687    Pel   pRecoValue  = GetIdx2DepthValue( pPredIdx + pResiIdx );
     1688   
     1689    apDCRecoValues[uiSegment]  = pRecoValue;
     1690    apDCResiValues[uiSegment]  = pRecoValue - apDCPredValues[uiSegment];
     1691  }
     1692 
     1693  //===== reconstruction =====
     1694  Bool* pMask     = pbMask;
     1695  Pel* pPred      = piPred;
     1696  Pel* pReco      = piReco;
     1697  Pel* pRecIPred  = piRecIPred;
     1698 
     1699  for( UInt uiY = 0; uiY < uiHeight; uiY++ )
     1700  {
     1701    for( UInt uiX = 0; uiX < uiWidth; uiX++ )
     1702    {
     1703      UChar ucSegment = pMask?(UChar)pMask[uiX]:0;
     1704      assert( ucSegment < uiNumSegments );
     1705     
     1706      Pel pPredVal= apDCPredValues[ucSegment];
     1707      Pel pResiDC = apDCResiValues[ucSegment];
     1708     
     1709      pReco    [ uiX ] = Clip( pPredVal + pResiDC );
     1710      pRecIPred[ uiX ] = pReco[ uiX ];
     1711    }
     1712    pPred     += uiStride;
     1713    pReco     += uiStride;
     1714    pRecIPred += uiRecIPredStride;
     1715    pMask     += uiMaskStride;
     1716  }
     1717 
     1718  // clear UV
     1719  UInt  uiStrideC     = pcPredYuv->getCStride();
     1720  Pel   *pRecCb       = pcPredYuv->getCbAddr();
     1721  Pel   *pRecCr       = pcPredYuv->getCrAddr();
     1722 
     1723  for (Int y=0; y<uiHeight/2; y++)
     1724  {
     1725    for (Int x=0; x<uiWidth/2; x++)
     1726    {
     1727      pRecCb[x] = (Pel)(128<<g_uiBitIncrement);
     1728      pRecCr[x] = (Pel)(128<<g_uiBitIncrement);
     1729    }
     1730   
     1731    pRecCb += uiStrideC;
     1732    pRecCr += uiStrideC;
     1733  }
     1734 
     1735  //===== determine distortion =====
     1736#if HHI_VSO
     1737  if ( m_pcRdCost->getUseVSO() )
     1738  {
     1739    ruiDist = m_pcRdCost->getDistVS  ( pcCU, uiAbsPartIdx, piReco, uiStride, piOrg, uiStride, uiWidth, uiHeight, false, 0 );
     1740  }
     1741  else
     1742#endif
     1743  {
     1744    ruiDist = m_pcRdCost->getDistPart( piReco, uiStride, piOrg, uiStride, uiWidth, uiHeight );
     1745  }
     1746 
     1747  //----- determine rate and r-d cost -----
     1748  m_pcEntropyCoder->resetBits();
     1749
     1750  // encode reduced intra header
     1751  m_pcEntropyCoder->encodeSkipFlag( pcCU, 0, true );
     1752  m_pcEntropyCoder->encodePredMode( pcCU, 0, true );
     1753 
     1754  // encode pred direction + residual data
     1755  m_pcEntropyCoder->encodePredInfo( pcCU, 0, true );
     1756 
     1757  UInt   uiBits = m_pcEntropyCoder->getNumberOfWrittenBits();
     1758 
     1759#if HHI_VSO
     1760  if ( m_pcRdCost->getUseLambdaScaleVSO())
     1761  {
     1762    dRDCost = m_pcRdCost->calcRdCostVSO( uiBits, ruiDist );
     1763  }
     1764  else
     1765#endif
     1766  {
     1767    dRDCost = m_pcRdCost->calcRdCost( uiBits, ruiDist );
     1768  }
     1769}
     1770#endif
    15951771
    15961772Void
     
    18302006  UInt    uiQNumParts    = pcCU->getTotalNumPart() >> 2;
    18312007  UInt    uiWidthBit     = pcCU->getIntraSizeIdx(0);
     2008#if FIX_RDO_NEGDIST
     2009  Dist    uiOverallDistY = 0;
     2010  Dist    uiOverallDistC = 0;
     2011#else
    18322012  UInt    uiOverallDistY = 0;
    18332013  UInt    uiOverallDistC = 0;
     2014#endif
    18342015  UInt    CandNum;
    18352016  Double  CandCostList[ FAST_UDI_MAX_RDMODE_NUM ];
     
    18672048    Int numModesForFullRD = g_aucIntraModeNumFast[ uiWidthBit ];
    18682049   
    1869 #if LGE_EDGE_INTRA
     2050#if LGE_EDGE_INTRA_A0070
    18702051  Bool bTestEdgeIntra = false;
    18712052  if ( m_pcEncCfg->isDepthCoder() && uiWidth >= LGE_EDGE_INTRA_MIN_SIZE && uiWidth <= LGE_EDGE_INTRA_MAX_SIZE && uiWidth == uiHeight )
     
    19182099            if ( m_pcRdCost->getUseWVSO() )
    19192100            {   
    1920               Int iDWeight = m_pcRdCost->getDWeight();
    1921               Int iVSDWeight = m_pcRdCost->getVSDWeight();
     2101              Int iDWeight = m_pcRdCost->getDWeight() * m_pcRdCost->getDWeight();
     2102              Int iVSDWeight = m_pcRdCost->getVSDWeight() * m_pcRdCost->getVSDWeight();
    19222103              Dist iD = (Dist) m_pcRdCost->calcHAD( piOrg, uiStride, piPred, uiStride, uiWidth, uiHeight );
    19232104              uiSad = (Dist) (iDWeight * iD + iVSDWeight * uiSad) / (iDWeight + iVSDWeight);
     
    19332114            if ( m_pcRdCost->getUseWVSO() )
    19342115            {   
    1935               Int iDWeight = m_pcRdCost->getDWeight()*m_pcRdCost->getDWeight();
    1936               Int iVSDWeight = m_pcRdCost->getVSOWeight()*m_pcRdCost->getVSOWeight();
    1937               Dist iD = (Dist) m_pcRdCost->getDistPart( piOrg, uiStride, piPred, uiStride, uiWidth, uiHeight );
    1938               uiSad = (Dist) (iDWeight * iD + iVSDWeight * uiSad) / (iDWeight + iVSDWeight);
     2116              Int iDWeight = m_pcRdCost->getDWeight() * m_pcRdCost->getDWeight();
     2117              Int iVSOWeight = m_pcRdCost->getVSOWeight() * m_pcRdCost->getDWeight();
     2118              Dist iD = (Dist) m_pcRdCost->calcHAD( piOrg, uiStride, piPred, uiStride, uiWidth, uiHeight );
     2119              uiSad = (Dist) (iDWeight * iD + iVSOWeight * uiSad) / (iDWeight + iVSOWeight);
    19392120            }
    19402121#endif
     
    19682149        CandNum += xUpdateCandList( uiMode, cost, numModesForFullRD, uiRdModeList, CandCostList );
    19692150
    1970 #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX
     2151#if (HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX) && !FIX_DMM_NEG_DIST
    19712152        if( bTestDmm ) bTestDmm = uiSad ? true : false;
    19722153#endif
    1973 #if LGE_EDGE_INTRA
     2154#if LGE_EDGE_INTRA_A0070
    19742155        if ( bTestEdgeIntra ) bTestEdgeIntra = uiSad ? true : false;
    19752156#endif
     
    20812262    }
    20822263#endif
    2083 #if LGE_EDGE_INTRA
     2264#if LGE_EDGE_INTRA_A0070
    20842265  if( bTestEdgeIntra )
    20852266  {
     
    20982279   
    20992280    UInt    uiBestPUMode  = 0;
     2281#if FIX_RDO_NEGDIST
     2282    Dist    uiBestPUDistY = 0;
     2283    Dist    uiBestPUDistC = 0;
     2284#else
    21002285    UInt    uiBestPUDistY = 0;
    21012286    UInt    uiBestPUDistC = 0;
     2287#endif
    21022288    Double  dBestPUCost   = MAX_DOUBLE;
     2289#if RWTH_SDC_DLT_B0036
     2290    Bool    bBestUseSDC   = false;
     2291    Pel     apBestDCOffsets[2] = {0,0};
     2292#endif
    21032293    for( UInt uiMode = 0; uiMode < numModesForFullRD; uiMode++ )
    21042294    {
    2105 #if LG_ZEROINTRADEPTHRESI_M26039
     2295#if LG_ZEROINTRADEPTHRESI_A0087
    21062296    Bool bAllowZeroResi = pcCU->getSlice()->getIsDepth() && (pcCU->getSlice()->getPOC()%pcCU->getPic()->getIntraPeriod());// && (uiMode < NUM_INTRA_MODE);
    21072297    for(UInt uiCnt = 0; uiCnt < (bAllowZeroResi ? 2 : 1); uiCnt++)
     
    21142304#if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX
    21152305      if( m_pcEncCfg->getIsDepth() && !predIntraLumaDMMAvailable( uiOrgMode, uiWidth, uiHeight )
    2116 #if LGE_EDGE_INTRA
     2306#if LGE_EDGE_INTRA_A0070
    21172307        && uiOrgMode < EDGE_INTRA_IDX
    21182308#endif
     
    21212311        continue;
    21222312      }
     2313#endif
     2314     
     2315#if RWTH_SDC_DLT_B0036
     2316      UInt uiUseSDC = ( m_pcEncCfg->getUseSDC() && pcCU->getPartitionSize(uiPartOffset) == SIZE_2Nx2N )?1:0;
     2317     
     2318      for( UInt uiSDC=0; uiSDC<=uiUseSDC; uiSDC++ )
     2319      {
     2320        for( UInt uiRes = 0; uiRes<=uiUseSDC; uiRes++ )
     2321        {
    21232322#endif
    21242323
     
    21442343      }
    21452344#endif
    2146 
     2345#if RWTH_SDC_DLT_B0036
     2346          // last check: if not available for current intra prediction mode, don't try
     2347          if( uiSDC == 1 && !pcCU->getSDCAvailable(uiPartOffset) )
     2348            continue;
     2349         
     2350          pcCU->setSDCFlagSubParts( uiSDC == 1, uiPartOffset, 0, uiDepth + uiInitTrDepth );
     2351         
     2352          if(uiSDC == 1)
     2353          {
     2354            pcCU->setTrIdxSubParts(0, uiPartOffset, uiDepth + uiInitTrDepth);
     2355            pcCU->setCbfSubParts(1, 1, 1, uiPartOffset, uiDepth + uiInitTrDepth);
     2356           
     2357            // start encoding with SDC
     2358            xIntraCodingSDC(pcCU, uiPartOffset, pcOrgYuv, pcPredYuv, uiPUDistY, dPUCost, (uiRes==1));
     2359          }
     2360          else
     2361          {
     2362#endif
    21472363#if HHI_RQT_INTRA_SPEEDUP
    2148 #if LG_ZEROINTRADEPTHRESI_M26039
     2364#if LG_ZEROINTRADEPTHRESI_A0087
    21492365      xRecurIntraCodingQT( pcCU, uiInitTrDepth, uiPartOffset, bLumaOnly, pcOrgYuv, pcPredYuv, pcResiYuv, uiPUDistY, uiPUDistC, true, dPUCost, bZeroResi );
    21502366#else
     
    21532369#else
    21542370      xRecurIntraCodingQT( pcCU, uiInitTrDepth, uiPartOffset, bLumaOnly, pcOrgYuv, pcPredYuv, pcResiYuv, uiPUDistY, uiPUDistC, dPUCost );
     2371#endif
     2372#if RWTH_SDC_DLT_B0036
     2373          }
    21552374#endif
    21562375     
     
    21662385        uiBestPUDistC = uiPUDistC;
    21672386        dBestPUCost   = dPUCost;
     2387       
     2388#if RWTH_SDC_DLT_B0036
     2389        if( uiSDC == 1 )
     2390        {
     2391          bBestUseSDC = true;
     2392         
     2393          // copy reconstruction
     2394          pcPredYuv->copyPartToPartYuv(pcRecoYuv, uiPartOffset, uiWidth, uiHeight);
     2395         
     2396          // copy DC values
     2397          apBestDCOffsets[0] = pcCU->getSDCSegmentDCOffset(0, uiPartOffset);
     2398          apBestDCOffsets[1] = pcCU->getSDCSegmentDCOffset(1, uiPartOffset);
     2399        }
     2400        else
     2401        {
     2402          bBestUseSDC = false;
     2403#endif
     2404       
     2405        xSetIntraResultQT( pcCU, uiInitTrDepth, uiPartOffset, bLumaOnly, pcRecoYuv );
     2406       
     2407        UInt uiQPartNum = pcCU->getPic()->getNumPartInCU() >> ( ( pcCU->getDepth(0) + uiInitTrDepth ) << 1 );
     2408        ::memcpy( m_puhQTTempTrIdx,  pcCU->getTransformIdx()       + uiPartOffset, uiQPartNum * sizeof( UChar ) );
     2409        ::memcpy( m_puhQTTempCbf[0], pcCU->getCbf( TEXT_LUMA     ) + uiPartOffset, uiQPartNum * sizeof( UChar ) );
     2410        ::memcpy( m_puhQTTempCbf[1], pcCU->getCbf( TEXT_CHROMA_U ) + uiPartOffset, uiQPartNum * sizeof( UChar ) );
     2411        ::memcpy( m_puhQTTempCbf[2], pcCU->getCbf( TEXT_CHROMA_V ) + uiPartOffset, uiQPartNum * sizeof( UChar ) );
     2412#if RWTH_SDC_DLT_B0036
     2413        }
     2414#endif
     2415      }
     2416#if HHI_RQT_INTRA_SPEEDUP_MOD
     2417      else if( dPUCost < dSecondBestPUCost )
     2418      {
     2419        uiSecondBestMode  = uiOrgMode;
     2420        dSecondBestPUCost = dPUCost;
     2421      }
     2422#endif
     2423#if LG_ZEROINTRADEPTHRESI_A0087
     2424    }
     2425#endif
     2426#if RWTH_SDC_DLT_B0036
     2427      } // SDC residual loop
     2428    } // SDC loop
     2429#endif
     2430    } // Mode loop
     2431   
     2432#if HHI_RQT_INTRA_SPEEDUP
     2433#if HHI_RQT_INTRA_SPEEDUP_MOD
     2434    for( UInt ui =0; ui < 2; ++ui )
     2435#endif
     2436    {
     2437#if HHI_RQT_INTRA_SPEEDUP_MOD
     2438      UInt uiOrgMode   = ui ? uiSecondBestMode  : uiBestPUMode;
     2439      if( uiOrgMode == MAX_UINT )
     2440      {
     2441        break;
     2442      }
     2443#else
     2444      UInt uiOrgMode = uiBestPUMode;
     2445#endif
     2446     
     2447      pcCU->setLumaIntraDirSubParts ( uiOrgMode, uiPartOffset, uiDepth + uiInitTrDepth );
     2448     
     2449      // set context models
     2450      if( m_bUseSBACRD )
     2451      {
     2452        m_pcRDGoOnSbacCoder->load( m_pppcRDSbacCoder[uiDepth][CI_CURR_BEST] );
     2453      }
     2454     
     2455      // determine residual for partition
     2456      Dist   uiPUDistY = 0;
     2457      Dist   uiPUDistC = 0;
     2458      Double dPUCost   = 0.0;
     2459
     2460#if HHI_VSO
     2461      // reset Model
     2462      if( m_pcRdCost->getUseRenModel() )
     2463      {
     2464        m_pcRdCost->setRenModelData( pcCU, uiPartOffset, piOrg, uiStride, uiWidth, uiHeight );
     2465      }
     2466#endif
     2467
     2468      xRecurIntraCodingQT( pcCU, uiInitTrDepth, uiPartOffset, bLumaOnly, pcOrgYuv, pcPredYuv, pcResiYuv, uiPUDistY, uiPUDistC, false, dPUCost );
     2469     
     2470      // check r-d cost
     2471      if( dPUCost < dBestPUCost )
     2472      {
     2473        uiBestPUMode  = uiOrgMode;
     2474        uiBestPUDistY = uiPUDistY;
     2475        uiBestPUDistC = uiPUDistC;
     2476        dBestPUCost   = dPUCost;
     2477#if RWTH_SDC_DLT_B0036
     2478        bBestUseSDC   = false;
     2479#endif
    21682480       
    21692481        xSetIntraResultQT( pcCU, uiInitTrDepth, uiPartOffset, bLumaOnly, pcRecoYuv );
     
    21762488       
    21772489      }
    2178 #if HHI_RQT_INTRA_SPEEDUP_MOD
    2179       else if( dPUCost < dSecondBestPUCost )
    2180       {
    2181         uiSecondBestMode  = uiOrgMode;
    2182         dSecondBestPUCost = dPUCost;
    2183       }
    2184 #endif
    2185 #if LG_ZEROINTRADEPTHRESI_M26039
    2186     }
    2187 #endif
    2188     } // Mode loop
    2189    
    2190 #if HHI_RQT_INTRA_SPEEDUP
    2191 #if HHI_RQT_INTRA_SPEEDUP_MOD
    2192     for( UInt ui =0; ui < 2; ++ui )
    2193 #endif
    2194     {
    2195 #if HHI_RQT_INTRA_SPEEDUP_MOD
    2196       UInt uiOrgMode   = ui ? uiSecondBestMode  : uiBestPUMode;
    2197       if( uiOrgMode == MAX_UINT )
    2198       {
    2199         break;
    2200       }
    2201 #else
    2202       UInt uiOrgMode = uiBestPUMode;
    2203 #endif
    2204      
    2205       pcCU->setLumaIntraDirSubParts ( uiOrgMode, uiPartOffset, uiDepth + uiInitTrDepth );
    2206      
    2207       // set context models
    2208       if( m_bUseSBACRD )
    2209       {
    2210         m_pcRDGoOnSbacCoder->load( m_pppcRDSbacCoder[uiDepth][CI_CURR_BEST] );
    2211       }
    2212      
    2213       // determine residual for partition
    2214       Dist   uiPUDistY = 0;
    2215       Dist   uiPUDistC = 0;
    2216       Double dPUCost   = 0.0;
    2217 
    2218 #if HHI_VSO
    2219       // reset Model
    2220       if( m_pcRdCost->getUseRenModel() )
    2221       {
    2222         m_pcRdCost->setRenModelData( pcCU, uiPartOffset, piOrg, uiStride, uiWidth, uiHeight );
    2223       }
    2224 #endif
    2225 
    2226       xRecurIntraCodingQT( pcCU, uiInitTrDepth, uiPartOffset, bLumaOnly, pcOrgYuv, pcPredYuv, pcResiYuv, uiPUDistY, uiPUDistC, false, dPUCost );
    2227      
    2228       // check r-d cost
    2229       if( dPUCost < dBestPUCost )
    2230       {
    2231         uiBestPUMode  = uiOrgMode;
    2232         uiBestPUDistY = uiPUDistY;
    2233         uiBestPUDistC = uiPUDistC;
    2234         dBestPUCost   = dPUCost;
    2235        
    2236         xSetIntraResultQT( pcCU, uiInitTrDepth, uiPartOffset, bLumaOnly, pcRecoYuv );
    2237        
    2238         UInt uiQPartNum = pcCU->getPic()->getNumPartInCU() >> ( ( pcCU->getDepth(0) + uiInitTrDepth ) << 1 );
    2239         ::memcpy( m_puhQTTempTrIdx,  pcCU->getTransformIdx()       + uiPartOffset, uiQPartNum * sizeof( UChar ) );
    2240         ::memcpy( m_puhQTTempCbf[0], pcCU->getCbf( TEXT_LUMA     ) + uiPartOffset, uiQPartNum * sizeof( UChar ) );
    2241         ::memcpy( m_puhQTTempCbf[1], pcCU->getCbf( TEXT_CHROMA_U ) + uiPartOffset, uiQPartNum * sizeof( UChar ) );
    2242         ::memcpy( m_puhQTTempCbf[2], pcCU->getCbf( TEXT_CHROMA_V ) + uiPartOffset, uiQPartNum * sizeof( UChar ) );
    2243        
    2244       }
    22452490    } // Mode loop
    22462491#endif
     
    22492494    uiOverallDistY += uiBestPUDistY;
    22502495    uiOverallDistC += uiBestPUDistC;
     2496   
     2497#if RWTH_SDC_DLT_B0036
     2498    if( bBestUseSDC )
     2499    {
     2500      pcCU->setTrIdxSubParts(0, uiPartOffset, uiDepth + uiInitTrDepth);
     2501      pcCU->setCbfSubParts(1, 1, 1, uiPartOffset, uiDepth + uiInitTrDepth);
     2502     
     2503      //=== copy best DC segment values back to CU ====
     2504      pcCU->setSDCSegmentDCOffset(apBestDCOffsets[0], 0, uiPartOffset);
     2505      pcCU->setSDCSegmentDCOffset(apBestDCOffsets[1], 1, uiPartOffset);
     2506    }
     2507    else
     2508    {
     2509#endif
    22512510   
    22522511    //--- update transform index and cbf ---
     
    22562515    ::memcpy( pcCU->getCbf( TEXT_CHROMA_U ) + uiPartOffset, m_puhQTTempCbf[1], uiQPartNum * sizeof( UChar ) );
    22572516    ::memcpy( pcCU->getCbf( TEXT_CHROMA_V ) + uiPartOffset, m_puhQTTempCbf[2], uiQPartNum * sizeof( UChar ) );
     2517#if RWTH_SDC_DLT_B0036
     2518    }
     2519#endif
    22582520   
    22592521    //--- set reconstruction for next intra prediction blocks ---
     
    23262588    //=== update PU data ====
    23272589    pcCU->setLumaIntraDirSubParts     ( uiBestPUMode, uiPartOffset, uiDepth + uiInitTrDepth );
     2590#if RWTH_SDC_DLT_B0036
     2591    pcCU->setSDCFlagSubParts          ( bBestUseSDC, uiPartOffset, 0, uiDepth + uiInitTrDepth );
     2592#endif
    23282593    pcCU->copyToPic                   ( uiDepth, uiPU, uiInitTrDepth );
    23292594  } // PU loop
     
    26252890                            iWidth, iHeight, m_pcEncCfg->getUseHADME() );
    26262891#endif
     2892#if LGE_ILLUCOMP_B0045
     2893  cDistParam.bUseIC = false;
     2894#endif
    26272895  ruiErr = cDistParam.DistFunc( &cDistParam );
    26282896}
     
    26422910 */
    26432911#if CU_BASED_MRG_CAND_LIST
     2912#if LG_RESTRICTEDRESPRED_M24766
     2913Void TEncSearch::xMergeEstimation( TComDataCU* pcCU, TComYuv* pcYuvOrg, TComYuv* rpcResiPredYuv, Int iPUIdx, UInt& uiInterDir, TComMvField* pacMvField, UInt& uiMergeIndex, UInt& ruiCost, TComMvField* cMvFieldNeighbours, UChar* uhInterDirNeighbours, Int& numValidMergeCand )
     2914#else
    26442915Void TEncSearch::xMergeEstimation( TComDataCU* pcCU, TComYuv* pcYuvOrg, Int iPUIdx, UInt& uiInterDir, TComMvField* pacMvField, UInt& uiMergeIndex, UInt& ruiCost, TComMvField* cMvFieldNeighbours, UChar* uhInterDirNeighbours, Int& numValidMergeCand )
     2916#endif
    26452917#else
    26462918#if LG_RESTRICTEDRESPRED_M24766
     
    35393811      UInt uiMRGCost = MAX_UINT;
    35403812#if CU_BASED_MRG_CAND_LIST
     3813#if LG_RESTRICTEDRESPRED_M24766
     3814      xMergeEstimation( pcCU, pcOrgYuv, rpcResiPredYuv, iPartIdx, uiMRGInterDir, cMRGMvField, uiMRGIndex, uiMRGCost, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand);
     3815#else
    35413816      xMergeEstimation( pcCU, pcOrgYuv, iPartIdx, uiMRGInterDir, cMRGMvField, uiMRGIndex, uiMRGCost, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand);
     3817#endif
    35423818#else
    35433819#if LG_RESTRICTEDRESPRED_M24766
     
    38774153    cMvCand <<= 2;
    38784154#endif
     4155
     4156#if LGE_ILLUCOMP_B0045
     4157  Bool bICFlag = pcCU->getICFlag(uiPartAddr) && (pcCU->getSlice()->getViewId() != pcCU->getSlice()->getRefViewId(eRefPicList, iRefIdx));
     4158#endif
    38794159  // prediction pattern
    38804160  if ( pcCU->getSlice()->getPPS()->getUseWP() && pcCU->getSlice()->getSliceType()==P_SLICE )
     
    38844164  else
    38854165  {
     4166#if LGE_ILLUCOMP_B0045
     4167    xPredInterLumaBlk( pcCU, pcPicYuvRef, uiPartAddr, &cMvCand, iSizeX, iSizeY, pcTemplateCand, false, bICFlag );
     4168#else
    38864169    xPredInterLumaBlk( pcCU, pcPicYuvRef, uiPartAddr, &cMvCand, iSizeX, iSizeY, pcTemplateCand, false );
     4170#endif
    38874171  }
    38884172
     
    39384222  pcCU->getPartIndexAndSize( iPartIdx, uiPartAddr, iRoiWidth, iRoiHeight );
    39394223 
     4224#if LGE_ILLUCOMP_B0045
     4225  Bool bICFlag = pcCU->getICFlag(uiPartAddr) && (pcCU->getSlice()->getViewId() != pcCU->getSlice()->getRefViewId(eRefPicList, iRefIdxPred));
     4226  pcPatternKey->setICFlag(bICFlag);
     4227#endif
     4228
    39404229  if ( bBi )
    39414230  {
     
    41014390      setDistParamComp(0);
    41024391
     4392#if LGE_ILLUCOMP_B0045
     4393      m_cDistParam.bUseIC = pcPatternKey->getICFlag();
     4394#endif
    41034395      uiSad = m_cDistParam.DistFunc( &m_cDistParam );
    41044396     
     
    44574749    m_pcEntropyCoder->encodeSkipFlag(pcCU, 0, true);
    44584750    m_pcEntropyCoder->encodeMergeIndex( pcCU, 0, 0, true );
     4751#if LGE_ILLUCOMP_B0045
     4752    m_pcEntropyCoder->encodeICFlag(pcCU, 0, true);
     4753#endif
    44594754#if HHI_INTER_VIEW_RESIDUAL_PRED
    44604755    m_pcEntropyCoder->encodeResPredFlag( pcCU, 0, 0, true );
     
    52075502    }
    52085503   
     5504#if FIX_RDO_NEGDIST
     5505    Dist uiDistU = 0;
     5506    Dist uiDistV = 0;
     5507#else
    52095508    UInt uiDistU = 0;
    52105509    UInt uiDistV = 0;
     5510#endif
    52115511    if( bCodeChroma )
    52125512    {
     
    52465546#endif       
    52475547       
     5548#if FIX_RDO_NEGDIST
     5549        const Dist uiNonzeroDistU = m_pcRdCost->getDistPart( m_pcQTTempTComYuv[uiQTTempAccessLayer].getCbAddr( absTUPartIdxC), m_pcQTTempTComYuv[uiQTTempAccessLayer].getCStride(),
     5550          pcResi->getCbAddr( absTUPartIdxC), pcResi->getCStride(), trWidthC, trHeightC
     5551
     5552#else
    52485553        const UInt uiNonzeroDistU = m_pcRdCost->getDistPart( m_pcQTTempTComYuv[uiQTTempAccessLayer].getCbAddr( absTUPartIdxC), m_pcQTTempTComYuv[uiQTTempAccessLayer].getCStride(),
    52495554          pcResi->getCbAddr( absTUPartIdxC), pcResi->getCStride(), trWidthC, trHeightC
     5555#endif
    52505556#if WEIGHTED_CHROMA_DISTORTION
    52515557          , true
     
    53325638        m_pcTrQuant->invtransformNxN( TEXT_CHROMA,REG_DCT, pcResiCurrV, m_pcQTTempTComYuv[uiQTTempAccessLayer].getCStride(), pcCoeffCurrV, trWidthC, trHeightC, scalingListType );
    53335639#endif
    5334        
     5640#if FIX_RDO_NEGDIST
     5641        const Dist uiNonzeroDistV = m_pcRdCost->getDistPart( m_pcQTTempTComYuv[uiQTTempAccessLayer].getCrAddr( absTUPartIdxC ), m_pcQTTempTComYuv[uiQTTempAccessLayer].getCStride(),
     5642          pcResi->getCrAddr( absTUPartIdxC ), pcResi->getCStride(), trWidthC, trHeightC
     5643#else
    53355644        const UInt uiNonzeroDistV = m_pcRdCost->getDistPart( m_pcQTTempTComYuv[uiQTTempAccessLayer].getCrAddr( absTUPartIdxC ), m_pcQTTempTComYuv[uiQTTempAccessLayer].getCStride(),
    53365645          pcResi->getCrAddr( absTUPartIdxC ), pcResi->getCStride(), trWidthC, trHeightC
     5646#endif
    53375647#if WEIGHTED_CHROMA_DISTORTION
    53385648                                                   , true
     
    58226132    m_pcEntropyCoder->encodeSkipFlag(pcCU, 0, true);
    58236133    m_pcEntropyCoder->encodeMergeIndex(pcCU, 0, 0, true);
     6134#if LGE_ILLUCOMP_B0045
     6135    m_pcEntropyCoder->encodeICFlag(pcCU, 0, true);
     6136#endif
    58246137#if HHI_INTER_VIEW_RESIDUAL_PRED
    58256138    m_pcEntropyCoder->encodeResPredFlag( pcCU, 0, 0, true );
     
    58426155    m_pcEntropyCoder->encodePartSize( pcCU, 0, pcCU->getDepth(0), true );
    58436156    m_pcEntropyCoder->encodePredInfo( pcCU, 0, true );
     6157#if LGE_ILLUCOMP_B0045
     6158    m_pcEntropyCoder->encodeICFlag(pcCU, 0, true);
     6159#endif
    58446160#if HHI_INTER_VIEW_RESIDUAL_PRED
    58456161    m_pcEntropyCoder->encodeResPredFlag( pcCU, 0, 0, true );
     
    61976513       
    61986514        Dist uiActDist = RDO_DIST_MAX;
    6199 #if FIX_RDO_MACRO
    62006515#if SAIT_VSO_EST_A0033
    62016516        if ( m_pcRdCost->getUseEstimatedVSD() )
     
    62286543#endif // LGE_WVSO_A0119
    62296544        }
    6230 #else // FIX_RDO_MACRO
    6231 #if SAIT_VSO_EST_A0033
    6232         if ( m_pcRdCost->getUseEstimatedVSD() )
    6233         {         
    6234           TComPicYuv* pcVirRec = m_pcRdCost->getVideoRecPicYuv();
    6235           TComPicYuv* pcVirOrg = m_pcRdCost->getDepthPicYuv();
    6236           uiActDist = m_pcRdCost->getDistPart( piPredic, uiStride, piOrig, uiStride, pcVirRec->getLumaAddr(pcCU->getAddr(),pcCU->getZorderIdxInCU()), pcVirOrg->getLumaAddr(pcCU->getAddr(),pcCU->getZorderIdxInCU()), pcVirRec->getStride(), uiWidth, uiHeight );
    6237 #if LGE_WVSO_A0119
    6238           if ( m_pcRdCost->getUseWVSO() )
    6239           {   
    6240             Int iDWeight = m_pcRdCost->getDWeight() * m_pcRdCost->getDWeight();
    6241             Int iVSDWeight = m_pcRdCost->getVSDWeight() * m_pcRdCost->getVSDWeight();
    6242             Dist iD = (Dist) m_pcRdCost->getDistPart( piPredic, uiStride, piOrig, uiStride, uiWidth, uiHeight, false, DF_SAD );
    6243             uiActDist = (iDWeight * iD + iVSDWeight * (Dist) uiActDist) / ( iDWeight + iVSDWeight);
    6244           }
    6245 #endif // LGE_WVSO_A0119
    6246         }
    6247         else       
    6248 #else  // SAIT_VSO_EST_A0033 <-- wrong #else statement should be #endif
    6249         {       
    6250           uiActDist = m_pcRdCost->getDistVS( pcCU, 0, piPredic, uiStride,  piOrig, uiStride, uiWidth, uiHeight, false, 0 );
    6251 #if LGE_WVSO_A0119
    6252           if ( m_pcRdCost->getUseWVSO() )
    6253           {   
    6254             Int iDWeight = m_pcRdCost->getDWeight() * m_pcRdCost->getDWeight();
    6255             Int iVSOWeight = m_pcRdCost->getVSOWeight() * m_pcRdCost->getVSOWeight();
    6256             Dist iD = (Dist) m_pcRdCost->getDistPart( piPredic, uiStride, piOrig, uiStride, uiWidth, uiHeight, false, DF_SAD );
    6257             uiActDist = (iDWeight * iD + iVSOWeight * (Dist) uiActDist) / ( iDWeight + iVSOWeight);
    6258           }
    6259 #endif // LGE_WVSO_A0119
    6260         }
    6261 #endif // SAIT_VSO_EST_A0033 <-- wrong #endif should be removed
    6262 #endif // FIX_RDO_MACRO
    62636545
    62646546        if( uiActDist < uiBestDist || uiBestDist == RDO_DIST_MAX )
     
    63026584  WedgeList* pacWedgeList = &g_aacWedgeLists[(g_aucConvertToBit[uiWidth])];
    63036585  Dist iDist = RDO_DIST_MAX;
     6586#if HHIQC_DMMFASTSEARCH_B0039
     6587  WedgeNodeList* pacWedgeNodeList = &g_aacWedgeNodeLists[(g_aucConvertToBit[uiWidth])];
     6588  xSearchWedgeFullMinDistFast( pcCU, uiAbsPtIdx, pacWedgeNodeList, pacWedgeList, piOrig, uiStride, uiWidth, uiHeight, ruiTabIdx, iDist );
     6589#else
    63046590  xSearchWedgeFullMinDist( pcCU, uiAbsPtIdx, pacWedgeList, piOrig, uiStride, uiWidth, uiHeight, ruiTabIdx, iDist );
     6591#endif
    63056592
    63066593  TComWedgelet* pcBestWedgelet = &(pacWedgeList->at(ruiTabIdx));
     
    64136700}
    64146701
     6702#if HHIQC_DMMFASTSEARCH_B0039
     6703Void TEncSearch::xSearchWedgeFullMinDistFast( TComDataCU* pcCU, UInt uiAbsPtIdx, WedgeNodeList* pacWedgeNodeList, WedgeList* pacWedgeList, Pel* piRef, UInt uiRefStride, UInt uiWidth, UInt uiHeight, UInt& ruiTabIdx, Dist& riDist )
     6704{
     6705  ruiTabIdx = 0;
     6706
     6707  // local pred buffer
     6708  TComYuv cPredYuv;
     6709  cPredYuv.create( uiWidth, uiHeight );
     6710  cPredYuv.clear();
     6711
     6712  UInt uiPredStride = cPredYuv.getStride();
     6713  Pel* piPred       = cPredYuv.getLumaAddr();
     6714
     6715  Int  iDC1 = 0;
     6716  Int  iDC2 = 0;
     6717
     6718  // coarse wedge search
     6719  Dist uiBestDist   = RDO_DIST_MAX;
     6720  UInt uiBestNodeId = 0;
     6721  for( UInt uiNodeId = 0; uiNodeId < pacWedgeNodeList->size(); uiNodeId++ )
     6722  {
     6723    calcWedgeDCs       ( &(pacWedgeList->at(pacWedgeNodeList->at(uiNodeId).getPatternIdx())), piRef,  uiRefStride,  iDC1, iDC2 );
     6724    assignWedgeDCs2Pred( &(pacWedgeList->at(pacWedgeNodeList->at(uiNodeId).getPatternIdx())), piPred, uiPredStride, iDC1, iDC2 );
     6725
     6726    Dist uiActDist = RDO_DIST_MAX;
     6727#if HHI_VSO
     6728    if( m_pcRdCost->getUseVSO() )
     6729    {
     6730#if SAIT_VSO_EST_A0033
     6731      if ( m_pcRdCost->getUseEstimatedVSD() )
     6732      {         
     6733        TComPicYuv* pcVirRec = m_pcRdCost->getVideoRecPicYuv();
     6734        TComPicYuv* pcVirOrg = m_pcRdCost->getDepthPicYuv();
     6735        uiActDist = m_pcRdCost->getDistPart( piPred, uiPredStride, piRef, uiRefStride, pcVirRec->getLumaAddr(pcCU->getAddr(),pcCU->getZorderIdxInCU()), pcVirOrg->getLumaAddr(pcCU->getAddr(),pcCU->getZorderIdxInCU()), pcVirRec->getStride(), uiWidth, uiHeight );
     6736#if LGE_WVSO_A0119
     6737        if ( m_pcRdCost->getUseWVSO() )
     6738        {   
     6739          Int iDWeight = m_pcRdCost->getDWeight() * m_pcRdCost->getDWeight();
     6740          Int iVSDWeight = m_pcRdCost->getVSDWeight() * m_pcRdCost->getVSDWeight();
     6741          Dist iD = (Dist) m_pcRdCost->getDistPart( piPred, uiPredStride, piRef, uiRefStride, uiWidth, uiHeight, false, DF_SAD );
     6742          uiActDist = (iDWeight * iD + iVSDWeight * (Int) uiActDist) / ( iDWeight + iVSDWeight);
     6743        }
     6744#endif
     6745      }
     6746      else
     6747#endif
     6748      {
     6749        uiActDist = m_pcRdCost->getDistVS( pcCU, 0, piPred, uiPredStride, piRef, uiRefStride, uiWidth, uiHeight, false, 0 );
     6750#if LGE_WVSO_A0119
     6751        if ( m_pcRdCost->getUseWVSO() )
     6752        {   
     6753          Int iDWeight = m_pcRdCost->getDWeight() * m_pcRdCost->getDWeight();
     6754          Int iVSOWeight = m_pcRdCost->getVSOWeight() * m_pcRdCost->getVSOWeight();
     6755          Dist iD = (Dist) m_pcRdCost->getDistPart( piPred, uiPredStride, piRef, uiRefStride, uiWidth, uiHeight, false, DF_SAD );
     6756          uiActDist = (iDWeight * iD + iVSOWeight * (Int) uiActDist) / ( iDWeight + iVSOWeight);
     6757        }
     6758#endif
     6759      }
     6760    }
     6761    else
     6762    {
     6763      uiActDist = m_pcRdCost->getDistPart( piPred, uiPredStride, piRef, uiRefStride, uiWidth, uiHeight, false, DF_SAD );
     6764    }
     6765#else
     6766    uiActDist = m_pcRdCost->getDistPart( piPred, uiPredStride, piRef, uiRefStride, uiWidth, uiHeight, false, DF_SAD );
     6767#endif
     6768    if( uiActDist < uiBestDist || uiBestDist == RDO_DIST_MAX )
     6769    {
     6770      uiBestDist   = uiActDist;
     6771      uiBestNodeId = uiNodeId;
     6772    }
     6773  }
     6774
     6775  // refinement
     6776  Dist uiBestDistRef = uiBestDist;
     6777  UInt uiBestTabIdxRef  = pacWedgeNodeList->at(uiBestNodeId).getPatternIdx();
     6778  for( UInt uiRefId = 0; uiRefId < NUM_WEDGE_REFINES; uiRefId++ )
     6779  {
     6780    if( pacWedgeNodeList->at(uiBestNodeId).getRefineIdx( uiRefId ) != NO_IDX )
     6781    {
     6782      calcWedgeDCs       ( &(pacWedgeList->at(pacWedgeNodeList->at(uiBestNodeId).getRefineIdx( uiRefId ))), piRef,  uiRefStride,  iDC1, iDC2 );
     6783      assignWedgeDCs2Pred( &(pacWedgeList->at(pacWedgeNodeList->at(uiBestNodeId).getRefineIdx( uiRefId ))), piPred, uiPredStride, iDC1, iDC2 );
     6784
     6785      Dist uiActDist = RDO_DIST_MAX;
     6786#if HHI_VSO
     6787      if( m_pcRdCost->getUseVSO() )
     6788      {
     6789        uiActDist = m_pcRdCost->getDistVS( pcCU, 0, piPred, uiPredStride, piRef, uiRefStride, uiWidth, uiHeight, false, 0 );
     6790#if LGE_WVSO_A0119
     6791        if ( m_pcRdCost->getUseWVSO() )
     6792        {   
     6793          Int iDWeight = m_pcRdCost->getDWeight() * m_pcRdCost->getDWeight();
     6794          Int iVSOWeight = m_pcRdCost->getVSOWeight() * m_pcRdCost->getVSOWeight();
     6795          Dist iD = (Dist) m_pcRdCost->getDistPart( piPred, uiPredStride, piRef, uiRefStride, uiWidth, uiHeight, false, DF_SAD );
     6796          uiActDist = (iDWeight * iD + iVSOWeight * (Int) uiActDist) / ( iDWeight + iVSOWeight);
     6797        }
     6798#endif
     6799      }
     6800      else
     6801      {
     6802        uiActDist = m_pcRdCost->getDistPart( piPred, uiPredStride, piRef, uiRefStride, uiWidth, uiHeight, false, DF_SAD );
     6803      }
     6804#else
     6805      uiActDist = m_pcRdCost->getDistPart( piPred, uiPredStride, piRef, uiRefStride, uiWidth, uiHeight, false, DF_SAD );
     6806#endif
     6807      if( uiActDist < uiBestDistRef || uiBestDistRef == RDO_DIST_MAX )
     6808      {
     6809        uiBestDistRef   = uiActDist;
     6810        uiBestTabIdxRef = pacWedgeNodeList->at(uiBestNodeId).getRefineIdx( uiRefId );
     6811      }
     6812    }
     6813  }
     6814
     6815  riDist    = uiBestDistRef;
     6816  ruiTabIdx = uiBestTabIdxRef;
     6817
     6818  cPredYuv.destroy();
     6819  return;
     6820}
     6821#endif
     6822
    64156823Void TEncSearch::xSearchWedgePredDirMinDist( TComDataCU* pcCU, UInt uiAbsPtIdx, WedgeList* pacWedgeList, Pel* piRef, UInt uiRefStride, UInt uiWidth, UInt uiHeight, UInt& ruiTabIdx, Int& riWedgeDeltaEnd )
    64166824{
     
    65496957#endif
    65506958
    6551 #if LGE_EDGE_INTRA
     6959#if LGE_EDGE_INTRA_A0070
    65526960Bool TEncSearch::xCheckTerminatedEdge( Bool* pbEdge, Int iX, Int iY, Int iWidth, Int iHeight )
    65536961{
     
    76578065#endif
    76588066#endif
     8067 
     8068#if RWTH_SDC_DLT_B0036
     8069Void TEncSearch::xAnalyzeSegmentsSDC( Pel* pOrig, UInt uiStride, UInt uiSize, Pel* rpSegMeans, UInt uiNumSegments, Bool* pMask, UInt uiMaskStride )
     8070{
     8071  Int iSumDepth[2];
     8072  memset(iSumDepth, 0, sizeof(Int)*2);
     8073  Int iSumPix[2];
     8074  memset(iSumPix, 0, sizeof(Int)*2);
     8075 
     8076  for (Int y=0; y<uiSize; y++)
     8077  {
     8078    for (Int x=0; x<uiSize; x++)
     8079    {
     8080      UChar ucSegment = pMask?(UChar)pMask[x]:0;
     8081      assert( ucSegment < uiNumSegments );
     8082     
     8083      iSumDepth[ucSegment] += pOrig[x];
     8084      iSumPix[ucSegment]   += 1;
     8085    }
     8086   
     8087    pOrig  += uiStride;
     8088    pMask  += uiMaskStride;
     8089  }
     8090 
     8091  // compute mean for each segment
     8092  for( UChar ucSeg = 0; ucSeg < uiNumSegments; ucSeg++ )
     8093  {
     8094    if( iSumPix[ucSeg] > 0 )
     8095      rpSegMeans[ucSeg] = iSumDepth[ucSeg] / iSumPix[ucSeg];
     8096    else
     8097      rpSegMeans[ucSeg] = 0;  // this happens for zero-segments
     8098  }
     8099}
     8100#endif
    76598101
    76608102//! \}
Note: See TracChangeset for help on using the changeset viewer.