Ignore:
Timestamp:
31 Dec 2012, 18:33:14 (12 years ago)
Author:
mitsubishi-htm
Message:

A final release, as planned

  • Migrate to HTM 5.1
  • For VC project files, only VC9 file is updated
  • To be used as an additional anchor for CE1.h for 3rd JCTVC meeting at Geneva
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibEncoder/TEncSearch.cpp

    r193 r213  
    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//! \{
     
    155160                      Int           iSearchRange,
    156161                      Int           bipredSearchRange,
     162#if DV_V_RESTRICTION_B0037
     163                      Bool          bUseDisparitySearchRangeRestriction,
     164                      Int           iVerticalDisparitySearchRange,
     165#endif
    157166                      Int           iFastSearch,
    158167                      Int           iMaxDeltaQP,
     
    167176  m_iSearchRange         = iSearchRange;
    168177  m_bipredSearchRange    = bipredSearchRange;
     178#if DV_V_RESTRICTION_B0037
     179  m_bUseDisparitySearchRangeRestriction = bUseDisparitySearchRangeRestriction;
     180  m_iVerticalDisparitySearchRange = iVerticalDisparitySearchRange;
     181#endif
    169182  m_iFastSearch          = iFastSearch;
    170183  m_iMaxDeltaQP          = iMaxDeltaQP;
     
    195208  const Int iNumAMVPCands = AMVP_MAX_NUM_CANDS + 1;
    196209  for( Int iNum = 0; iNum < iNumAMVPCands+1; iNum++)
    197   {
    198210    for( Int iIdx = 0; iIdx < iNumAMVPCands; iIdx++)
    199211#else
    200212  for( Int iNum = 0; iNum < AMVP_MAX_NUM_CANDS+1; iNum++)
    201   {
    202213    for( Int iIdx = 0; iIdx < AMVP_MAX_NUM_CANDS; iIdx++)
    203214#endif
     
    208219        m_auiMVPIdxCost[iIdx][iNum] = MAX_INT;
    209220    }
    210   }
    211221 
    212222  initTempBuff();
     
    300310
    301311  // distortion
     312#if LGE_ILLUCOMP_B0045
     313  m_cDistParam.bUseIC = pcPatternKey->getICFlag();
     314#endif
    302315  uiSad = m_cDistParam.DistFunc( &m_cDistParam );
    303316 
     
    726739
    727740    m_cDistParam.pCur = piRefPos;
     741#if LGE_ILLUCOMP_B0045
     742    m_cDistParam.bUseIC = pcPatternKey->getICFlag();
     743#endif
    728744    uiDist = m_cDistParam.DistFunc( &m_cDistParam );
    729745    uiDist += m_pcRdCost->getCost( cMvTest.getHor(), cMvTest.getVer() );
     
    975991                                TComYuv*    pcResiYuv,
    976992                                Dist&       ruiDist
    977 #if LG_ZEROINTRADEPTHRESI_M26039
     993#if LG_ZEROINTRADEPTHRESI_A0087
    978994                                ,Bool        bZeroResi
    979995#endif
     
    10101026  pcCU->getPattern()->initAdiPattern( pcCU, uiAbsPartIdx, uiTrDepth, m_piYuvExt, m_iYuvExtStride, m_iYuvExtHeight, bAboveAvail, bLeftAvail );
    10111027 
    1012 #if LGE_EDGE_INTRA
     1028#if LGE_EDGE_INTRA_A0070
    10131029  if( uiLumaPredMode >= EDGE_INTRA_IDX )
    10141030  {
     
    10581074    }
    10591075  }
    1060 #if LG_ZEROINTRADEPTHRESI_M26039
     1076#if LG_ZEROINTRADEPTHRESI_A0087
    10611077  if(bZeroResi)
    10621078  {
     
    13751391#endif
    13761392                                Double&      dRDCost
    1377 #if LG_ZEROINTRADEPTHRESI_M26039
     1393#if LG_ZEROINTRADEPTHRESI_A0087
    13781394                               ,Bool         bZeroResi
    13791395#endif
     
    13971413  }
    13981414#endif
    1399 #if LGE_EDGE_INTRA
     1415#if LGE_EDGE_INTRA_A0070
    14001416  if( pcCU->getLumaIntraDir( uiAbsPartIdx ) >= EDGE_INTRA_IDX )
    14011417  {
     
    14191435    //----- code luma block with given intra prediction mode and store Cbf-----
    14201436    dSingleCost   = 0.0;
    1421 #if LG_ZEROINTRADEPTHRESI_M26039
     1437#if LG_ZEROINTRADEPTHRESI_A0087
    14221438    xIntraCodingLumaBlk( pcCU, uiTrDepth, uiAbsPartIdx, pcOrgYuv, pcPredYuv, pcResiYuv, uiSingleDistY, bZeroResi );
    14231439#else
     
    16111627}
    16121628
     1629#if RWTH_SDC_DLT_B0036
     1630Void TEncSearch::xIntraCodingSDC( TComDataCU* pcCU, UInt uiAbsPartIdx, TComYuv* pcOrgYuv, TComYuv* pcPredYuv, Dist& ruiDist, Double& dRDCost, Bool bResidual )
     1631{
     1632  UInt    uiLumaPredMode    = pcCU     ->getLumaIntraDir( uiAbsPartIdx );
     1633  UInt    uiWidth           = pcCU     ->getWidth   ( 0 );
     1634  UInt    uiHeight          = pcCU     ->getHeight  ( 0 );
     1635  UInt    uiStride          = pcOrgYuv ->getStride  ();
     1636  Pel*    piOrg             = pcOrgYuv ->getLumaAddr( uiAbsPartIdx );
     1637  Pel*    piPred            = pcPredYuv->getLumaAddr( uiAbsPartIdx );
     1638  Pel*    piReco            = pcPredYuv->getLumaAddr( uiAbsPartIdx );
     1639 
     1640  UInt    uiZOrder          = pcCU->getZorderIdxInCU() + uiAbsPartIdx;
     1641  Pel*    piRecIPred        = pcCU->getPic()->getPicYuvRec()->getLumaAddr( pcCU->getAddr(), uiZOrder );
     1642  UInt    uiRecIPredStride  = pcCU->getPic()->getPicYuvRec()->getStride  ();
     1643 
     1644  AOF( uiWidth == uiHeight );
     1645  AOF( uiAbsPartIdx == 0 );
     1646  AOF( pcCU->getSDCAvailable(uiAbsPartIdx) );
     1647  AOF( pcCU->getSDCFlag(uiAbsPartIdx) );
     1648 
     1649  //===== init availability pattern =====
     1650  Bool  bAboveAvail = false;
     1651  Bool  bLeftAvail  = false;
     1652  pcCU->getPattern()->initPattern   ( pcCU, 0, uiAbsPartIdx );
     1653  pcCU->getPattern()->initAdiPattern( pcCU, uiAbsPartIdx, 0, m_piYuvExt, m_iYuvExtStride, m_iYuvExtHeight, bAboveAvail, bLeftAvail );
     1654 
     1655  //===== get prediction signal =====
     1656#if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX
     1657  if( uiLumaPredMode >= NUM_INTRA_MODE )
     1658  {
     1659    predIntraLumaDMM( pcCU, uiAbsPartIdx, uiLumaPredMode, piPred, uiStride, uiWidth, uiHeight, bAboveAvail, bLeftAvail, true );
     1660  }
     1661  else
     1662  {
     1663#endif
     1664    predIntraLumaAng( pcCU->getPattern(), uiLumaPredMode, piPred, uiStride, uiWidth, uiHeight, pcCU, bAboveAvail, bLeftAvail );
     1665#if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX
     1666  }
     1667#endif
     1668 
     1669  // number of segments depends on prediction mode
     1670  UInt uiNumSegments = 1; 
     1671  Bool* pbMask = NULL;
     1672  UInt uiMaskStride = 0;
     1673 
     1674  if( uiLumaPredMode == DMM_WEDGE_FULL_IDX || uiLumaPredMode == DMM_WEDGE_PREDDIR_IDX )
     1675  {
     1676    Int uiTabIdx = (uiLumaPredMode == DMM_WEDGE_FULL_IDX)?pcCU->getWedgeFullTabIdx(uiAbsPartIdx):pcCU->getWedgePredDirTabIdx(uiAbsPartIdx);
     1677   
     1678    WedgeList* pacWedgeList = &g_aacWedgeLists[(g_aucConvertToBit[uiWidth])];
     1679    TComWedgelet* pcWedgelet = &(pacWedgeList->at( uiTabIdx ));
     1680   
     1681    uiNumSegments = 2;
     1682    pbMask = pcWedgelet->getPattern();
     1683    uiMaskStride = pcWedgelet->getStride();
     1684  }
     1685 
     1686  // get DC prediction for each segment
     1687  Pel apDCPredValues[2];
     1688  xAnalyzeSegmentsSDC(piPred, uiStride, uiWidth, apDCPredValues, uiNumSegments, pbMask, uiMaskStride );
     1689 
     1690  // get original DC for each segment
     1691  Pel apDCOrigValues[2];
     1692  xAnalyzeSegmentsSDC(piOrg, uiStride, uiWidth, apDCOrigValues, uiNumSegments, pbMask, uiMaskStride );
     1693 
     1694  for( UInt uiSegment = 0; uiSegment < uiNumSegments; uiSegment++ )
     1695  {
     1696    // remap reconstructed value to valid depth values
     1697    Pel pDCRec = bResidual?apDCOrigValues[uiSegment]:apDCPredValues[uiSegment];
     1698   
     1699    // get residual (idx)
     1700    Pel pResidualIdx = GetDepthValue2Idx( pDCRec ) - GetDepthValue2Idx( apDCPredValues[uiSegment] );
     1701   
     1702    // save SDC DC offset
     1703    pcCU->setSDCSegmentDCOffset(pResidualIdx, uiSegment, uiAbsPartIdx);
     1704  }
     1705 
     1706  // reconstruct residual based on mask + DC residuals
     1707  Pel apDCResiValues[2];
     1708  //Pel apDCRecoValues[2];
     1709  for( UInt uiSegment = 0; uiSegment < uiNumSegments; uiSegment++ )
     1710  {
     1711    Pel   pPredIdx    = GetDepthValue2Idx( apDCPredValues[uiSegment] );
     1712    Pel   pResiIdx    = pcCU->getSDCSegmentDCOffset(uiSegment, uiAbsPartIdx);
     1713    Pel   pRecoValue  = GetIdx2DepthValue( pPredIdx + pResiIdx );
     1714   
     1715    //apDCRecoValues[uiSegment]  = pRecoValue;
     1716    apDCResiValues[uiSegment]  = pRecoValue - apDCPredValues[uiSegment];
     1717  }
     1718 
     1719  //===== reconstruction =====
     1720  Bool* pMask     = pbMask;
     1721  Pel* pPred      = piPred;
     1722  Pel* pReco      = piReco;
     1723  Pel* pRecIPred  = piRecIPred;
     1724 
     1725  for( UInt uiY = 0; uiY < uiHeight; uiY++ )
     1726  {
     1727    for( UInt uiX = 0; uiX < uiWidth; uiX++ )
     1728    {
     1729      UChar ucSegment = pMask?(UChar)pMask[uiX]:0;
     1730      assert( ucSegment < uiNumSegments );
     1731     
     1732      Pel pPredVal= apDCPredValues[ucSegment];
     1733      Pel pResiDC = apDCResiValues[ucSegment];
     1734     
     1735      pReco    [ uiX ] = Clip( pPredVal + pResiDC );
     1736      pRecIPred[ uiX ] = pReco[ uiX ];
     1737    }
     1738    pPred     += uiStride;
     1739    pReco     += uiStride;
     1740    pRecIPred += uiRecIPredStride;
     1741    pMask     += uiMaskStride;
     1742  }
     1743 
     1744  // clear UV
     1745  UInt  uiStrideC     = pcPredYuv->getCStride();
     1746  Pel   *pRecCb       = pcPredYuv->getCbAddr();
     1747  Pel   *pRecCr       = pcPredYuv->getCrAddr();
     1748 
     1749  for (Int y=0; y<uiHeight/2; y++)
     1750  {
     1751    for (Int x=0; x<uiWidth/2; x++)
     1752    {
     1753      pRecCb[x] = (Pel)(128<<g_uiBitIncrement);
     1754      pRecCr[x] = (Pel)(128<<g_uiBitIncrement);
     1755    }
     1756   
     1757    pRecCb += uiStrideC;
     1758    pRecCr += uiStrideC;
     1759  }
     1760 
     1761  //===== determine distortion =====
     1762#if HHI_VSO
     1763  if ( m_pcRdCost->getUseVSO() )
     1764  {
     1765    ruiDist = m_pcRdCost->getDistVS  ( pcCU, uiAbsPartIdx, piReco, uiStride, piOrg, uiStride, uiWidth, uiHeight, false, 0 );
     1766  }
     1767  else
     1768#endif
     1769  {
     1770    ruiDist = m_pcRdCost->getDistPart( piReco, uiStride, piOrg, uiStride, uiWidth, uiHeight );
     1771  }
     1772 
     1773  //----- determine rate and r-d cost -----
     1774  m_pcEntropyCoder->resetBits();
     1775
     1776  // encode reduced intra header
     1777  m_pcEntropyCoder->encodeSkipFlag( pcCU, 0, true );
     1778  m_pcEntropyCoder->encodePredMode( pcCU, 0, true );
     1779 
     1780  // encode pred direction + residual data
     1781  m_pcEntropyCoder->encodePredInfo( pcCU, 0, true );
     1782 
     1783  UInt   uiBits = m_pcEntropyCoder->getNumberOfWrittenBits();
     1784 
     1785#if HHI_VSO
     1786  if ( m_pcRdCost->getUseLambdaScaleVSO())
     1787  {
     1788    dRDCost = m_pcRdCost->calcRdCostVSO( uiBits, ruiDist );
     1789  }
     1790  else
     1791#endif
     1792  {
     1793    dRDCost = m_pcRdCost->calcRdCost( uiBits, ruiDist );
     1794  }
     1795}
     1796#endif
    16131797
    16141798Void
     
    18482032  UInt    uiQNumParts    = pcCU->getTotalNumPart() >> 2;
    18492033  UInt    uiWidthBit     = pcCU->getIntraSizeIdx(0);
     2034#if FIX_RDO_NEGDIST
     2035  Dist    uiOverallDistY = 0;
     2036  Dist    uiOverallDistC = 0;
     2037#else
    18502038  UInt    uiOverallDistY = 0;
    18512039  UInt    uiOverallDistC = 0;
     2040#endif
    18522041  UInt    CandNum;
    18532042  Double  CandCostList[ FAST_UDI_MAX_RDMODE_NUM ];
     
    18852074    Int numModesForFullRD = g_aucIntraModeNumFast[ uiWidthBit ];
    18862075   
    1887 #if LGE_EDGE_INTRA
     2076#if LGE_EDGE_INTRA_A0070
    18882077  Bool bTestEdgeIntra = false;
    18892078  if ( m_pcEncCfg->isDepthCoder() && uiWidth >= LGE_EDGE_INTRA_MIN_SIZE && uiWidth <= LGE_EDGE_INTRA_MAX_SIZE && uiWidth == uiHeight )
     
    19362125            if ( m_pcRdCost->getUseWVSO() )
    19372126            {   
    1938               Int iDWeight = m_pcRdCost->getDWeight();
    1939               Int iVSDWeight = m_pcRdCost->getVSDWeight();
     2127              Int iDWeight = m_pcRdCost->getDWeight() * m_pcRdCost->getDWeight();
     2128              Int iVSDWeight = m_pcRdCost->getVSDWeight() * m_pcRdCost->getVSDWeight();
    19402129              Dist iD = (Dist) m_pcRdCost->calcHAD( piOrg, uiStride, piPred, uiStride, uiWidth, uiHeight );
    19412130              uiSad = (Dist) (iDWeight * iD + iVSDWeight * uiSad) / (iDWeight + iVSDWeight);
     
    19512140            if ( m_pcRdCost->getUseWVSO() )
    19522141            {   
    1953               Int iDWeight = m_pcRdCost->getDWeight()*m_pcRdCost->getDWeight();
    1954               Int iVSDWeight = m_pcRdCost->getVSOWeight()*m_pcRdCost->getVSOWeight();
    1955               Dist iD = (Dist) m_pcRdCost->getDistPart( piOrg, uiStride, piPred, uiStride, uiWidth, uiHeight );
    1956               uiSad = (Dist) (iDWeight * iD + iVSDWeight * uiSad) / (iDWeight + iVSDWeight);
     2142              Int iDWeight = m_pcRdCost->getDWeight() * m_pcRdCost->getDWeight();
     2143              Int iVSOWeight = m_pcRdCost->getVSOWeight() * m_pcRdCost->getDWeight();
     2144              Dist iD = (Dist) m_pcRdCost->calcHAD( piOrg, uiStride, piPred, uiStride, uiWidth, uiHeight );
     2145              uiSad = (Dist) (iDWeight * iD + iVSOWeight * uiSad) / (iDWeight + iVSOWeight);
    19572146            }
    19582147#endif
    19592148          }
    1960 
    19612149        }
    19622150        else
     
    19872175        CandNum += xUpdateCandList( uiMode, cost, numModesForFullRD, uiRdModeList, CandCostList );
    19882176
    1989 #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX
     2177#if (HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX) && !FIX_DMM_NEG_DIST
    19902178        if( bTestDmm ) bTestDmm = uiSad ? true : false;
    19912179#endif
    1992 #if LGE_EDGE_INTRA
     2180#if LGE_EDGE_INTRA_A0070
    19932181        if ( bTestEdgeIntra ) bTestEdgeIntra = uiSad ? true : false;
    19942182#endif
     
    20742262#endif
    20752263#if HHI_DMM_PRED_TEX
     2264     
     2265#if FLEX_CODING_ORDER_M23723
     2266      if ( pcCU->getSlice()->getSPS()->getUseDMM34() )
     2267      {
     2268#endif
    20762269      UInt uiTexTabIdx  = 0;
    20772270      Int  iTexDeltaDC1 = 0;
     
    20972290        uiRdModeList[ numModesForFullRD++ ] = DMM_CONTOUR_PREDTEX_D_IDX;
    20982291      }
    2099 #endif
    2100     }
    2101 #endif
    2102 #if LGE_EDGE_INTRA
     2292#if FLEX_CODING_ORDER_M23723
     2293      }
     2294#endif
     2295#endif
     2296    }
     2297#endif
     2298#if LGE_EDGE_INTRA_A0070
    21032299  if( bTestEdgeIntra )
    21042300  {
     
    21172313   
    21182314    UInt    uiBestPUMode  = 0;
     2315#if FIX_RDO_NEGDIST
     2316    Dist    uiBestPUDistY = 0;
     2317    Dist    uiBestPUDistC = 0;
     2318#else
    21192319    UInt    uiBestPUDistY = 0;
    21202320    UInt    uiBestPUDistC = 0;
     2321#endif
    21212322    Double  dBestPUCost   = MAX_DOUBLE;
     2323#if RWTH_SDC_DLT_B0036
     2324    Bool    bBestUseSDC   = false;
     2325    Pel     apBestDCOffsets[2] = {0,0};
     2326#endif
    21222327    for( UInt uiMode = 0; uiMode < numModesForFullRD; uiMode++ )
    21232328    {
    2124 #if LG_ZEROINTRADEPTHRESI_M26039
     2329#if LG_ZEROINTRADEPTHRESI_A0087
    21252330    Bool bAllowZeroResi = pcCU->getSlice()->getIsDepth() && (pcCU->getSlice()->getPOC()%pcCU->getPic()->getIntraPeriod());// && (uiMode < NUM_INTRA_MODE);
    21262331    for(UInt uiCnt = 0; uiCnt < (bAllowZeroResi ? 2 : 1); uiCnt++)
     
    21322337
    21332338#if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX
     2339#if HHI_DMM_PRED_TEX && FLEX_CODING_ORDER_M23723
     2340      if( m_pcEncCfg->getIsDepth() && !predIntraLumaDMMAvailable( uiOrgMode, uiWidth, uiHeight, pcCU->getSlice()->getSPS()->getUseDMM34() )
     2341#if LGE_EDGE_INTRA_A0070
     2342        && uiOrgMode < EDGE_INTRA_IDX
     2343#endif
     2344        )
     2345
     2346#else
     2347
    21342348      if( m_pcEncCfg->getIsDepth() && !predIntraLumaDMMAvailable( uiOrgMode, uiWidth, uiHeight )
    2135 #if LGE_EDGE_INTRA
     2349#if LGE_EDGE_INTRA_A0070
    21362350        && uiOrgMode < EDGE_INTRA_IDX
    21372351#endif
    21382352        )
     2353#endif
    21392354      {
    21402355        continue;
    21412356      }
     2357#endif
     2358     
     2359#if RWTH_SDC_DLT_B0036
     2360      UInt uiUseSDC = ( m_pcEncCfg->getUseSDC() && pcCU->getPartitionSize(uiPartOffset) == SIZE_2Nx2N )?1:0;
     2361     
     2362      for( UInt uiSDC=0; uiSDC<=uiUseSDC; uiSDC++ )
     2363      {
     2364        for( UInt uiRes = 0; uiRes<=uiUseSDC; uiRes++ )
     2365        {
    21422366#endif
    21432367
     
    21632387      }
    21642388#endif
    2165 
     2389#if RWTH_SDC_DLT_B0036
     2390          // last check: if not available for current intra prediction mode, don't try
     2391          if( uiSDC == 1 && !pcCU->getSDCAvailable(uiPartOffset) )
     2392            continue;
     2393         
     2394          pcCU->setSDCFlagSubParts( uiSDC == 1, uiPartOffset, 0, uiDepth + uiInitTrDepth );
     2395         
     2396          if(uiSDC == 1)
     2397          {
     2398            pcCU->setTrIdxSubParts(0, uiPartOffset, uiDepth + uiInitTrDepth);
     2399            pcCU->setCbfSubParts(1, 1, 1, uiPartOffset, uiDepth + uiInitTrDepth);
     2400           
     2401            // start encoding with SDC
     2402            xIntraCodingSDC(pcCU, uiPartOffset, pcOrgYuv, pcPredYuv, uiPUDistY, dPUCost, (uiRes==1));
     2403          }
     2404          else
     2405          {
     2406#endif
    21662407#if HHI_RQT_INTRA_SPEEDUP
    2167 #if LG_ZEROINTRADEPTHRESI_M26039
     2408#if LG_ZEROINTRADEPTHRESI_A0087
    21682409      xRecurIntraCodingQT( pcCU, uiInitTrDepth, uiPartOffset, bLumaOnly, pcOrgYuv, pcPredYuv, pcResiYuv, uiPUDistY, uiPUDistC, true, dPUCost, bZeroResi );
    21692410#else
     
    21722413#else
    21732414      xRecurIntraCodingQT( pcCU, uiInitTrDepth, uiPartOffset, bLumaOnly, pcOrgYuv, pcPredYuv, pcResiYuv, uiPUDistY, uiPUDistC, dPUCost );
     2415#endif
     2416#if RWTH_SDC_DLT_B0036
     2417          }
    21742418#endif
    21752419     
     
    21852429        uiBestPUDistC = uiPUDistC;
    21862430        dBestPUCost   = dPUCost;
     2431       
     2432#if RWTH_SDC_DLT_B0036
     2433        if( uiSDC == 1 )
     2434        {
     2435          bBestUseSDC = true;
     2436         
     2437          // copy reconstruction
     2438          pcPredYuv->copyPartToPartYuv(pcRecoYuv, uiPartOffset, uiWidth, uiHeight);
     2439         
     2440          // copy DC values
     2441          apBestDCOffsets[0] = pcCU->getSDCSegmentDCOffset(0, uiPartOffset);
     2442          apBestDCOffsets[1] = pcCU->getSDCSegmentDCOffset(1, uiPartOffset);
     2443        }
     2444        else
     2445        {
     2446          bBestUseSDC = false;
     2447#endif
     2448       
     2449        xSetIntraResultQT( pcCU, uiInitTrDepth, uiPartOffset, bLumaOnly, pcRecoYuv );
     2450       
     2451        UInt uiQPartNum = pcCU->getPic()->getNumPartInCU() >> ( ( pcCU->getDepth(0) + uiInitTrDepth ) << 1 );
     2452        ::memcpy( m_puhQTTempTrIdx,  pcCU->getTransformIdx()       + uiPartOffset, uiQPartNum * sizeof( UChar ) );
     2453        ::memcpy( m_puhQTTempCbf[0], pcCU->getCbf( TEXT_LUMA     ) + uiPartOffset, uiQPartNum * sizeof( UChar ) );
     2454        ::memcpy( m_puhQTTempCbf[1], pcCU->getCbf( TEXT_CHROMA_U ) + uiPartOffset, uiQPartNum * sizeof( UChar ) );
     2455        ::memcpy( m_puhQTTempCbf[2], pcCU->getCbf( TEXT_CHROMA_V ) + uiPartOffset, uiQPartNum * sizeof( UChar ) );
     2456#if RWTH_SDC_DLT_B0036
     2457        }
     2458#endif
     2459      }
     2460#if HHI_RQT_INTRA_SPEEDUP_MOD
     2461      else if( dPUCost < dSecondBestPUCost )
     2462      {
     2463        uiSecondBestMode  = uiOrgMode;
     2464        dSecondBestPUCost = dPUCost;
     2465      }
     2466#endif
     2467#if LG_ZEROINTRADEPTHRESI_A0087
     2468    }
     2469#endif
     2470#if RWTH_SDC_DLT_B0036
     2471      } // SDC residual loop
     2472    } // SDC loop
     2473#endif
     2474    } // Mode loop
     2475   
     2476#if HHI_RQT_INTRA_SPEEDUP
     2477#if HHI_RQT_INTRA_SPEEDUP_MOD
     2478    for( UInt ui =0; ui < 2; ++ui )
     2479#endif
     2480    {
     2481#if HHI_RQT_INTRA_SPEEDUP_MOD
     2482      UInt uiOrgMode   = ui ? uiSecondBestMode  : uiBestPUMode;
     2483      if( uiOrgMode == MAX_UINT )
     2484      {
     2485        break;
     2486      }
     2487#else
     2488      UInt uiOrgMode = uiBestPUMode;
     2489#endif
     2490     
     2491      pcCU->setLumaIntraDirSubParts ( uiOrgMode, uiPartOffset, uiDepth + uiInitTrDepth );
     2492     
     2493      // set context models
     2494      if( m_bUseSBACRD )
     2495      {
     2496        m_pcRDGoOnSbacCoder->load( m_pppcRDSbacCoder[uiDepth][CI_CURR_BEST] );
     2497      }
     2498     
     2499      // determine residual for partition
     2500      Dist   uiPUDistY = 0;
     2501      Dist   uiPUDistC = 0;
     2502      Double dPUCost   = 0.0;
     2503
     2504#if HHI_VSO
     2505      // reset Model
     2506      if( m_pcRdCost->getUseRenModel() )
     2507      {
     2508        m_pcRdCost->setRenModelData( pcCU, uiPartOffset, piOrg, uiStride, uiWidth, uiHeight );
     2509      }
     2510#endif
     2511
     2512      xRecurIntraCodingQT( pcCU, uiInitTrDepth, uiPartOffset, bLumaOnly, pcOrgYuv, pcPredYuv, pcResiYuv, uiPUDistY, uiPUDistC, false, dPUCost );
     2513     
     2514      // check r-d cost
     2515      if( dPUCost < dBestPUCost )
     2516      {
     2517        uiBestPUMode  = uiOrgMode;
     2518        uiBestPUDistY = uiPUDistY;
     2519        uiBestPUDistC = uiPUDistC;
     2520        dBestPUCost   = dPUCost;
     2521#if RWTH_SDC_DLT_B0036
     2522        bBestUseSDC   = false;
     2523#endif
    21872524       
    21882525        xSetIntraResultQT( pcCU, uiInitTrDepth, uiPartOffset, bLumaOnly, pcRecoYuv );
     
    21952532       
    21962533      }
    2197 #if HHI_RQT_INTRA_SPEEDUP_MOD
    2198       else if( dPUCost < dSecondBestPUCost )
    2199       {
    2200         uiSecondBestMode  = uiOrgMode;
    2201         dSecondBestPUCost = dPUCost;
    2202       }
    2203 #endif
    2204 #if LG_ZEROINTRADEPTHRESI_M26039
    2205     }
    2206 #endif
    2207     } // Mode loop
    2208    
    2209 #if HHI_RQT_INTRA_SPEEDUP
    2210 #if HHI_RQT_INTRA_SPEEDUP_MOD
    2211     for( UInt ui =0; ui < 2; ++ui )
    2212 #endif
    2213     {
    2214 #if HHI_RQT_INTRA_SPEEDUP_MOD
    2215       UInt uiOrgMode   = ui ? uiSecondBestMode  : uiBestPUMode;
    2216       if( uiOrgMode == MAX_UINT )
    2217       {
    2218         break;
    2219       }
    2220 #else
    2221       UInt uiOrgMode = uiBestPUMode;
    2222 #endif
    2223      
    2224       pcCU->setLumaIntraDirSubParts ( uiOrgMode, uiPartOffset, uiDepth + uiInitTrDepth );
    2225      
    2226       // set context models
    2227       if( m_bUseSBACRD )
    2228       {
    2229         m_pcRDGoOnSbacCoder->load( m_pppcRDSbacCoder[uiDepth][CI_CURR_BEST] );
    2230       }
    2231      
    2232       // determine residual for partition
    2233       Dist   uiPUDistY = 0;
    2234       Dist   uiPUDistC = 0;
    2235       Double dPUCost   = 0.0;
    2236 
    2237 #if HHI_VSO
    2238       // reset Model
    2239       if( m_pcRdCost->getUseRenModel() )
    2240       {
    2241         m_pcRdCost->setRenModelData( pcCU, uiPartOffset, piOrg, uiStride, uiWidth, uiHeight );
    2242       }
    2243 #endif
    2244 
    2245       xRecurIntraCodingQT( pcCU, uiInitTrDepth, uiPartOffset, bLumaOnly, pcOrgYuv, pcPredYuv, pcResiYuv, uiPUDistY, uiPUDistC, false, dPUCost );
    2246      
    2247       // check r-d cost
    2248       if( dPUCost < dBestPUCost )
    2249       {
    2250         uiBestPUMode  = uiOrgMode;
    2251         uiBestPUDistY = uiPUDistY;
    2252         uiBestPUDistC = uiPUDistC;
    2253         dBestPUCost   = dPUCost;
    2254        
    2255         xSetIntraResultQT( pcCU, uiInitTrDepth, uiPartOffset, bLumaOnly, pcRecoYuv );
    2256        
    2257         UInt uiQPartNum = pcCU->getPic()->getNumPartInCU() >> ( ( pcCU->getDepth(0) + uiInitTrDepth ) << 1 );
    2258         ::memcpy( m_puhQTTempTrIdx,  pcCU->getTransformIdx()       + uiPartOffset, uiQPartNum * sizeof( UChar ) );
    2259         ::memcpy( m_puhQTTempCbf[0], pcCU->getCbf( TEXT_LUMA     ) + uiPartOffset, uiQPartNum * sizeof( UChar ) );
    2260         ::memcpy( m_puhQTTempCbf[1], pcCU->getCbf( TEXT_CHROMA_U ) + uiPartOffset, uiQPartNum * sizeof( UChar ) );
    2261         ::memcpy( m_puhQTTempCbf[2], pcCU->getCbf( TEXT_CHROMA_V ) + uiPartOffset, uiQPartNum * sizeof( UChar ) );
    2262        
    2263       }
    22642534    } // Mode loop
    22652535#endif
     
    22682538    uiOverallDistY += uiBestPUDistY;
    22692539    uiOverallDistC += uiBestPUDistC;
     2540   
     2541#if RWTH_SDC_DLT_B0036
     2542    if( bBestUseSDC )
     2543    {
     2544      pcCU->setTrIdxSubParts(0, uiPartOffset, uiDepth + uiInitTrDepth);
     2545      pcCU->setCbfSubParts(1, 1, 1, uiPartOffset, uiDepth + uiInitTrDepth);
     2546     
     2547      //=== copy best DC segment values back to CU ====
     2548      pcCU->setSDCSegmentDCOffset(apBestDCOffsets[0], 0, uiPartOffset);
     2549      pcCU->setSDCSegmentDCOffset(apBestDCOffsets[1], 1, uiPartOffset);
     2550    }
     2551    else
     2552    {
     2553#endif
    22702554   
    22712555    //--- update transform index and cbf ---
     
    22752559    ::memcpy( pcCU->getCbf( TEXT_CHROMA_U ) + uiPartOffset, m_puhQTTempCbf[1], uiQPartNum * sizeof( UChar ) );
    22762560    ::memcpy( pcCU->getCbf( TEXT_CHROMA_V ) + uiPartOffset, m_puhQTTempCbf[2], uiQPartNum * sizeof( UChar ) );
     2561#if RWTH_SDC_DLT_B0036
     2562    }
     2563#endif
    22772564   
    22782565    //--- set reconstruction for next intra prediction blocks ---
     
    23452632    //=== update PU data ====
    23462633    pcCU->setLumaIntraDirSubParts     ( uiBestPUMode, uiPartOffset, uiDepth + uiInitTrDepth );
     2634#if RWTH_SDC_DLT_B0036
     2635    pcCU->setSDCFlagSubParts          ( bBestUseSDC, uiPartOffset, 0, uiDepth + uiInitTrDepth );
     2636#endif
    23472637    pcCU->copyToPic                   ( uiDepth, uiPU, uiInitTrDepth );
    23482638  } // PU loop
     
    26442934                            iWidth, iHeight, m_pcEncCfg->getUseHADME() );
    26452935#endif
     2936#if LGE_ILLUCOMP_B0045
     2937  cDistParam.bUseIC = false;
     2938#endif
    26462939  ruiErr = cDistParam.DistFunc( &cDistParam );
    26472940}
     
    26612954 */
    26622955#if CU_BASED_MRG_CAND_LIST
     2956#if LG_RESTRICTEDRESPRED_M24766
     2957Void TEncSearch::xMergeEstimation( TComDataCU* pcCU, TComYuv* pcYuvOrg, TComYuv* rpcResiPredYuv, Int iPUIdx, UInt& uiInterDir, TComMvField* pacMvField, UInt& uiMergeIndex, UInt& ruiCost, TComMvField* cMvFieldNeighbours, UChar* uhInterDirNeighbours, Int& numValidMergeCand )
     2958#else
    26632959Void TEncSearch::xMergeEstimation( TComDataCU* pcCU, TComYuv* pcYuvOrg, Int iPUIdx, UInt& uiInterDir, TComMvField* pacMvField, UInt& uiMergeIndex, UInt& ruiCost, TComMvField* cMvFieldNeighbours, UChar* uhInterDirNeighbours, Int& numValidMergeCand )
     2960#endif
    26642961#else
    26652962#if LG_RESTRICTEDRESPRED_M24766
     
    29633260    for (Int iNumRef=0; iNumRef < MAX_NUM_REF; iNumRef++) uiCostTempL0[iNumRef] = MAX_UINT;
    29643261    UInt          uiBitsTempL0[MAX_NUM_REF];
    2965 
    29663262#if LG_RESTRICTEDRESPRED_M24766
    29673263    Int iPUResiPredShift[4] = {0, 0, 0, 0};
     
    37724068      UInt uiMRGCost = MAX_UINT;
    37734069#if CU_BASED_MRG_CAND_LIST
     4070#if LG_RESTRICTEDRESPRED_M24766
     4071      xMergeEstimation( pcCU, pcOrgYuv, rpcResiPredYuv, iPartIdx, uiMRGInterDir, cMRGMvField, uiMRGIndex, uiMRGCost, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand);
     4072#else
    37744073      xMergeEstimation( pcCU, pcOrgYuv, iPartIdx, uiMRGInterDir, cMRGMvField, uiMRGIndex, uiMRGCost, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand);
     4074#endif
    37754075#else
    37764076#if LG_RESTRICTEDRESPRED_M24766
     
    41104410    cMvCand <<= 2;
    41114411#endif
     4412
     4413#if LGE_ILLUCOMP_B0045
     4414#if VSP_AIC
     4415  Bool bICFlag = pcCU->getICFlag(uiPartAddr) && (pcCU->getSlice()->getPOC() == pcCU->getSlice()->getRefPOC(eRefPicList, iRefIdx));
     4416#else
     4417  Bool bICFlag = pcCU->getICFlag(uiPartAddr) && (pcCU->getSlice()->getViewId() != pcCU->getSlice()->getRefViewId(eRefPicList, iRefIdx));
     4418#endif
     4419#endif
    41124420  // prediction pattern
    41134421  if ( pcCU->getSlice()->getPPS()->getUseWP() && pcCU->getSlice()->getSliceType()==P_SLICE )
     
    41174425  else
    41184426  {
     4427#if LGE_ILLUCOMP_B0045
     4428    xPredInterLumaBlk( pcCU, pcPicYuvRef, uiPartAddr, &cMvCand, iSizeX, iSizeY, pcTemplateCand, false, bICFlag );
     4429#else
    41194430    xPredInterLumaBlk( pcCU, pcPicYuvRef, uiPartAddr, &cMvCand, iSizeX, iSizeY, pcTemplateCand, false );
     4431#endif
    41204432  }
    41214433
     
    41734485  Int           iSrchRng      = ( bBi ? m_bipredSearchRange : m_iSearchRange );
    41744486#endif
     4487#if DV_V_RESTRICTION_B0037
     4488  Int           iVerDispSrchRng = m_iVerticalDisparitySearchRange; 
     4489#endif
    41754490  TComPattern*  pcPatternKey  = pcCU->getPattern        ();
    41764491 
     
    41794494  pcCU->getPartIndexAndSize( iPartIdx, uiPartAddr, iRoiWidth, iRoiHeight );
    41804495 
     4496#if LGE_ILLUCOMP_B0045
     4497#if VSP_AIC
     4498  Bool bICFlag = pcCU->getICFlag(uiPartAddr) && (pcCU->getSlice()->getPOC() == pcCU->getSlice()->getRefPOC(eRefPicList, iRefIdxPred));
     4499#else
     4500  Bool bICFlag = pcCU->getICFlag(uiPartAddr) && (pcCU->getSlice()->getViewId() != pcCU->getSlice()->getRefViewId(eRefPicList, iRefIdxPred));
     4501#endif
     4502  pcPatternKey->setICFlag(bICFlag);
     4503#endif
     4504
    41814505  if ( bBi )
    41824506  {
     
    42044528 
    42054529  TComMv      cMvPred = *pcMvPred;
    4206  
     4530
     4531#if DV_V_RESTRICTION_B0037
     4532  Bool bMv_VRng_Restricted = false;
     4533  if( pcCU->getSlice()->getViewId() > 0
     4534      &&
     4535      pcCU->getSlice()->getRefPic( eRefPicList, iRefIdxPred )->getPOC() == pcCU->getSlice()->getPOC()
     4536      &&
     4537      m_bUseDisparitySearchRangeRestriction
     4538     )
     4539  {
     4540      bMv_VRng_Restricted = true;
     4541  }
     4542#endif
     4543
     4544#if DV_V_RESTRICTION_B0037
     4545  if ( bBi )  xSetSearchRange   ( pcCU, rcMv   , iSrchRng, cMvSrchRngLT, cMvSrchRngRB, bMv_VRng_Restricted, iVerDispSrchRng );
     4546  else        xSetSearchRange   ( pcCU, cMvPred, iSrchRng, cMvSrchRngLT, cMvSrchRngRB, bMv_VRng_Restricted, iVerDispSrchRng );
     4547#else
    42074548  if ( bBi )  xSetSearchRange   ( pcCU, rcMv   , iSrchRng, cMvSrchRngLT, cMvSrchRngRB );
    42084549  else        xSetSearchRange   ( pcCU, cMvPred, iSrchRng, cMvSrchRngLT, cMvSrchRngRB );
    4209  
     4550#endif
     4551
    42104552  m_pcRdCost->getMotionCost ( 1, 0 );
    42114553 
     
    42354577    if( bMultiviewReg && !bBi )
    42364578    {
     4579#if DV_V_RESTRICTION_B0037
     4580      xSetSearchRange( pcCU, cOrgDepthMapMv, iSrchRng, cMvSrchRngLT, cMvSrchRngRB, bMv_VRng_Restricted, iVerDispSrchRng  );
     4581#else
    42374582      xSetSearchRange( pcCU, cOrgDepthMapMv, iSrchRng, cMvSrchRngLT, cMvSrchRngRB );
     4583#endif
    42384584    }
    42394585  }
     
    42444590  }
    42454591#endif
    4246 
     4592#if QC_MVHEVC_B0046
     4593  m_pcRdCost->setMultiviewReg( 0 );
     4594#endif
    42474595  setWpScalingDistParam( pcCU, iRefIdxPred, eRefPicList );
    42484596  //  Do integer search
     
    42624610 
    42634611  m_pcRdCost->getMotionCost( 1, 0 );
    4264 
    42654612#if HHI_FULL_PEL_DEPTH_MAP_MV_ACC
    42664613  if( ! pcCU->getSlice()->getIsDepth() )
     
    43054652}
    43064653
    4307 
     4654#if DV_V_RESTRICTION_B0037
     4655Void TEncSearch::xSetSearchRange ( TComDataCU* pcCU, TComMv& cMvPred, Int iSrchRng, TComMv& rcMvSrchRngLT, TComMv& rcMvSrchRngRB, Bool bMv_VRng_Restricted, Int iVerDispSrchRng )
     4656#else
    43084657Void TEncSearch::xSetSearchRange ( TComDataCU* pcCU, TComMv& cMvPred, Int iSrchRng, TComMv& rcMvSrchRngLT, TComMv& rcMvSrchRngRB )
     4658#endif
    43094659{
    43104660  Int  iMvShift = 2;
     
    43214671  rcMvSrchRngRB.setHor( cTmpMvPred.getHor() + (iSrchRng << iMvShift) );
    43224672  rcMvSrchRngRB.setVer( cTmpMvPred.getVer() + (iSrchRng << iMvShift) );
     4673
     4674#if DV_V_RESTRICTION_B0037
     4675  if ( bMv_VRng_Restricted ) {
     4676    Int iRestrictMvVrange = ( iVerDispSrchRng ) << iMvShift;   
     4677    if ( rcMvSrchRngRB.getVer() >= iRestrictMvVrange  ){
     4678      rcMvSrchRngRB.setVer( iRestrictMvVrange );
     4679    }
     4680    //restrict minus vector too
     4681    if ( rcMvSrchRngLT.getVer() <= -iRestrictMvVrange ){
     4682      rcMvSrchRngLT.setVer( -iRestrictMvVrange );
     4683    }
     4684  }
     4685#endif
    43234686  pcCU->clipMv        ( rcMvSrchRngLT );
    43244687  pcCU->clipMv        ( rcMvSrchRngRB );
     
    43654728      setDistParamComp(0);
    43664729
     4730#if LGE_ILLUCOMP_B0045
     4731      m_cDistParam.bUseIC = pcPatternKey->getICFlag();
     4732#endif
    43674733      uiSad = m_cDistParam.DistFunc( &m_cDistParam );
    43684734     
     
    47365102    m_pcEntropyCoder->encodeSkipFlag(pcCU, 0, true);
    47375103    m_pcEntropyCoder->encodeMergeIndex( pcCU, 0, 0, true );
     5104#if LGE_ILLUCOMP_B0045
     5105    m_pcEntropyCoder->encodeICFlag(pcCU, 0, true);
     5106#endif
    47385107#if HHI_INTER_VIEW_RESIDUAL_PRED
    47395108    m_pcEntropyCoder->encodeResPredFlag( pcCU, 0, 0, true );
     
    54865855    }
    54875856   
     5857#if FIX_RDO_NEGDIST
     5858    Dist uiDistU = 0;
     5859    Dist uiDistV = 0;
     5860#else
    54885861    UInt uiDistU = 0;
    54895862    UInt uiDistV = 0;
     5863#endif
    54905864    if( bCodeChroma )
    54915865    {
     
    55255899#endif       
    55265900       
     5901#if FIX_RDO_NEGDIST
     5902        const Dist uiNonzeroDistU = m_pcRdCost->getDistPart( m_pcQTTempTComYuv[uiQTTempAccessLayer].getCbAddr( absTUPartIdxC), m_pcQTTempTComYuv[uiQTTempAccessLayer].getCStride(),
     5903          pcResi->getCbAddr( absTUPartIdxC), pcResi->getCStride(), trWidthC, trHeightC
     5904
     5905#else
    55275906        const UInt uiNonzeroDistU = m_pcRdCost->getDistPart( m_pcQTTempTComYuv[uiQTTempAccessLayer].getCbAddr( absTUPartIdxC), m_pcQTTempTComYuv[uiQTTempAccessLayer].getCStride(),
    55285907          pcResi->getCbAddr( absTUPartIdxC), pcResi->getCStride(), trWidthC, trHeightC
     5908#endif
    55295909#if WEIGHTED_CHROMA_DISTORTION
    55305910          , true
     
    56115991        m_pcTrQuant->invtransformNxN( TEXT_CHROMA,REG_DCT, pcResiCurrV, m_pcQTTempTComYuv[uiQTTempAccessLayer].getCStride(), pcCoeffCurrV, trWidthC, trHeightC, scalingListType );
    56125992#endif
    5613        
     5993#if FIX_RDO_NEGDIST
     5994        const Dist uiNonzeroDistV = m_pcRdCost->getDistPart( m_pcQTTempTComYuv[uiQTTempAccessLayer].getCrAddr( absTUPartIdxC ), m_pcQTTempTComYuv[uiQTTempAccessLayer].getCStride(),
     5995          pcResi->getCrAddr( absTUPartIdxC ), pcResi->getCStride(), trWidthC, trHeightC
     5996#else
    56145997        const UInt uiNonzeroDistV = m_pcRdCost->getDistPart( m_pcQTTempTComYuv[uiQTTempAccessLayer].getCrAddr( absTUPartIdxC ), m_pcQTTempTComYuv[uiQTTempAccessLayer].getCStride(),
    56155998          pcResi->getCrAddr( absTUPartIdxC ), pcResi->getCStride(), trWidthC, trHeightC
     5999#endif
    56166000#if WEIGHTED_CHROMA_DISTORTION
    56176001                                                   , true
     
    61106494#endif
    61116495    m_pcEntropyCoder->encodeMergeIndex(pcCU, 0, 0, true);
     6496#if LGE_ILLUCOMP_B0045
     6497    m_pcEntropyCoder->encodeICFlag(pcCU, 0, true);
     6498#endif
    61126499#if HHI_INTER_VIEW_RESIDUAL_PRED
    61136500    m_pcEntropyCoder->encodeResPredFlag( pcCU, 0, 0, true );
     
    61396526    m_pcEntropyCoder->encodePartSize( pcCU, 0, pcCU->getDepth(0), true );
    61406527    m_pcEntropyCoder->encodePredInfo( pcCU, 0, true );
     6528#if LGE_ILLUCOMP_B0045
     6529    m_pcEntropyCoder->encodeICFlag(pcCU, 0, true);
     6530#endif
    61416531#if HHI_INTER_VIEW_RESIDUAL_PRED
    61426532    m_pcEntropyCoder->encodeResPredFlag( pcCU, 0, 0, true );
     
    63966786
    63976787#if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX
     6788#if ((HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX)&&FLEX_CODING_ORDER_M23723)
     6789Bool TEncSearch::predIntraLumaDMMAvailable( UInt uiMode, UInt uiWidth, UInt uiHeight, Bool bDMMAvailable34 )
     6790#else
    63986791Bool TEncSearch::predIntraLumaDMMAvailable( UInt uiMode, UInt uiWidth, UInt uiHeight )
     6792#endif
    63996793{
    64006794  if( uiMode < NUM_INTRA_MODE ) return true;
     
    64246818      bDMMAvailable = false;
    64256819    }
     6820
     6821#if FLEX_CODING_ORDER_M23723
     6822    if ( !bDMMAvailable34 )
     6823    {
     6824      bDMMAvailable = false;
     6825    }
     6826#endif
     6827
    64266828  }
    64276829#endif
     
    64946896       
    64956897        Dist uiActDist = RDO_DIST_MAX;
    6496 #if FIX_RDO_MACRO
    64976898#if SAIT_VSO_EST_A0033
    64986899        if ( m_pcRdCost->getUseEstimatedVSD() )
     
    65256926#endif // LGE_WVSO_A0119
    65266927        }
    6527 #else // FIX_RDO_MACRO
    6528 #if SAIT_VSO_EST_A0033
    6529         if ( m_pcRdCost->getUseEstimatedVSD() )
    6530         {         
    6531           TComPicYuv* pcVirRec = m_pcRdCost->getVideoRecPicYuv();
    6532           TComPicYuv* pcVirOrg = m_pcRdCost->getDepthPicYuv();
    6533           uiActDist = m_pcRdCost->getDistPart( piPredic, uiStride, piOrig, uiStride, pcVirRec->getLumaAddr(pcCU->getAddr(),pcCU->getZorderIdxInCU()), pcVirOrg->getLumaAddr(pcCU->getAddr(),pcCU->getZorderIdxInCU()), pcVirRec->getStride(), uiWidth, uiHeight );
    6534 #if LGE_WVSO_A0119
    6535           if ( m_pcRdCost->getUseWVSO() )
    6536           {   
    6537             Int iDWeight = m_pcRdCost->getDWeight() * m_pcRdCost->getDWeight();
    6538             Int iVSDWeight = m_pcRdCost->getVSDWeight() * m_pcRdCost->getVSDWeight();
    6539             Dist iD = (Dist) m_pcRdCost->getDistPart( piPredic, uiStride, piOrig, uiStride, uiWidth, uiHeight, false, DF_SAD );
    6540             uiActDist = (iDWeight * iD + iVSDWeight * (Dist) uiActDist) / ( iDWeight + iVSDWeight);
    6541           }
    6542 #endif // LGE_WVSO_A0119
    6543         }
    6544         else       
    6545 #else  // SAIT_VSO_EST_A0033 <-- wrong #else statement should be #endif
    6546         {       
    6547           uiActDist = m_pcRdCost->getDistVS( pcCU, 0, piPredic, uiStride,  piOrig, uiStride, uiWidth, uiHeight, false, 0 );
    6548 #if LGE_WVSO_A0119
    6549           if ( m_pcRdCost->getUseWVSO() )
    6550           {   
    6551             Int iDWeight = m_pcRdCost->getDWeight() * m_pcRdCost->getDWeight();
    6552             Int iVSOWeight = m_pcRdCost->getVSOWeight() * m_pcRdCost->getVSOWeight();
    6553             Dist iD = (Dist) m_pcRdCost->getDistPart( piPredic, uiStride, piOrig, uiStride, uiWidth, uiHeight, false, DF_SAD );
    6554             uiActDist = (iDWeight * iD + iVSOWeight * (Dist) uiActDist) / ( iDWeight + iVSOWeight);
    6555           }
    6556 #endif // LGE_WVSO_A0119
    6557         }
    6558 #endif // SAIT_VSO_EST_A0033 <-- wrong #endif should be removed
    6559 #endif // FIX_RDO_MACRO
    65606928
    65616929        if( uiActDist < uiBestDist || uiBestDist == RDO_DIST_MAX )
     
    65996967  WedgeList* pacWedgeList = &g_aacWedgeLists[(g_aucConvertToBit[uiWidth])];
    66006968  Dist iDist = RDO_DIST_MAX;
     6969#if HHIQC_DMMFASTSEARCH_B0039
     6970  WedgeNodeList* pacWedgeNodeList = &g_aacWedgeNodeLists[(g_aucConvertToBit[uiWidth])];
     6971  xSearchWedgeFullMinDistFast( pcCU, uiAbsPtIdx, pacWedgeNodeList, pacWedgeList, piOrig, uiStride, uiWidth, uiHeight, ruiTabIdx, iDist );
     6972#else
    66016973  xSearchWedgeFullMinDist( pcCU, uiAbsPtIdx, pacWedgeList, piOrig, uiStride, uiWidth, uiHeight, ruiTabIdx, iDist );
     6974#endif
    66026975
    66036976  TComWedgelet* pcBestWedgelet = &(pacWedgeList->at(ruiTabIdx));
     
    67107083}
    67117084
     7085#if HHIQC_DMMFASTSEARCH_B0039
     7086Void TEncSearch::xSearchWedgeFullMinDistFast( TComDataCU* pcCU, UInt uiAbsPtIdx, WedgeNodeList* pacWedgeNodeList, WedgeList* pacWedgeList, Pel* piRef, UInt uiRefStride, UInt uiWidth, UInt uiHeight, UInt& ruiTabIdx, Dist& riDist )
     7087{
     7088  ruiTabIdx = 0;
     7089
     7090  // local pred buffer
     7091  TComYuv cPredYuv;
     7092  cPredYuv.create( uiWidth, uiHeight );
     7093  cPredYuv.clear();
     7094
     7095  UInt uiPredStride = cPredYuv.getStride();
     7096  Pel* piPred       = cPredYuv.getLumaAddr();
     7097
     7098  Int  iDC1 = 0;
     7099  Int  iDC2 = 0;
     7100
     7101  // coarse wedge search
     7102  Dist uiBestDist   = RDO_DIST_MAX;
     7103  UInt uiBestNodeId = 0;
     7104  for( UInt uiNodeId = 0; uiNodeId < pacWedgeNodeList->size(); uiNodeId++ )
     7105  {
     7106    calcWedgeDCs       ( &(pacWedgeList->at(pacWedgeNodeList->at(uiNodeId).getPatternIdx())), piRef,  uiRefStride,  iDC1, iDC2 );
     7107    assignWedgeDCs2Pred( &(pacWedgeList->at(pacWedgeNodeList->at(uiNodeId).getPatternIdx())), piPred, uiPredStride, iDC1, iDC2 );
     7108
     7109    Dist uiActDist = RDO_DIST_MAX;
     7110#if HHI_VSO
     7111    if( m_pcRdCost->getUseVSO() )
     7112    {
     7113#if SAIT_VSO_EST_A0033
     7114      if ( m_pcRdCost->getUseEstimatedVSD() )
     7115      {         
     7116        TComPicYuv* pcVirRec = m_pcRdCost->getVideoRecPicYuv();
     7117        TComPicYuv* pcVirOrg = m_pcRdCost->getDepthPicYuv();
     7118        uiActDist = m_pcRdCost->getDistPart( piPred, uiPredStride, piRef, uiRefStride, pcVirRec->getLumaAddr(pcCU->getAddr(),pcCU->getZorderIdxInCU()), pcVirOrg->getLumaAddr(pcCU->getAddr(),pcCU->getZorderIdxInCU()), pcVirRec->getStride(), uiWidth, uiHeight );
     7119#if LGE_WVSO_A0119
     7120        if ( m_pcRdCost->getUseWVSO() )
     7121        {   
     7122          Int iDWeight = m_pcRdCost->getDWeight() * m_pcRdCost->getDWeight();
     7123          Int iVSDWeight = m_pcRdCost->getVSDWeight() * m_pcRdCost->getVSDWeight();
     7124          Dist iD = (Dist) m_pcRdCost->getDistPart( piPred, uiPredStride, piRef, uiRefStride, uiWidth, uiHeight, false, DF_SAD );
     7125          uiActDist = (iDWeight * iD + iVSDWeight * (Int) uiActDist) / ( iDWeight + iVSDWeight);
     7126        }
     7127#endif
     7128      }
     7129      else
     7130#endif
     7131      {
     7132        uiActDist = m_pcRdCost->getDistVS( pcCU, 0, piPred, uiPredStride, piRef, uiRefStride, uiWidth, uiHeight, false, 0 );
     7133#if LGE_WVSO_A0119
     7134        if ( m_pcRdCost->getUseWVSO() )
     7135        {   
     7136          Int iDWeight = m_pcRdCost->getDWeight() * m_pcRdCost->getDWeight();
     7137          Int iVSOWeight = m_pcRdCost->getVSOWeight() * m_pcRdCost->getVSOWeight();
     7138          Dist iD = (Dist) m_pcRdCost->getDistPart( piPred, uiPredStride, piRef, uiRefStride, uiWidth, uiHeight, false, DF_SAD );
     7139          uiActDist = (iDWeight * iD + iVSOWeight * (Int) uiActDist) / ( iDWeight + iVSOWeight);
     7140        }
     7141#endif
     7142      }
     7143    }
     7144    else
     7145    {
     7146      uiActDist = m_pcRdCost->getDistPart( piPred, uiPredStride, piRef, uiRefStride, uiWidth, uiHeight, false, DF_SAD );
     7147    }
     7148#else
     7149    uiActDist = m_pcRdCost->getDistPart( piPred, uiPredStride, piRef, uiRefStride, uiWidth, uiHeight, false, DF_SAD );
     7150#endif
     7151    if( uiActDist < uiBestDist || uiBestDist == RDO_DIST_MAX )
     7152    {
     7153      uiBestDist   = uiActDist;
     7154      uiBestNodeId = uiNodeId;
     7155    }
     7156  }
     7157
     7158  // refinement
     7159  Dist uiBestDistRef = uiBestDist;
     7160  UInt uiBestTabIdxRef  = pacWedgeNodeList->at(uiBestNodeId).getPatternIdx();
     7161  for( UInt uiRefId = 0; uiRefId < NUM_WEDGE_REFINES; uiRefId++ )
     7162  {
     7163    if( pacWedgeNodeList->at(uiBestNodeId).getRefineIdx( uiRefId ) != NO_IDX )
     7164    {
     7165      calcWedgeDCs       ( &(pacWedgeList->at(pacWedgeNodeList->at(uiBestNodeId).getRefineIdx( uiRefId ))), piRef,  uiRefStride,  iDC1, iDC2 );
     7166      assignWedgeDCs2Pred( &(pacWedgeList->at(pacWedgeNodeList->at(uiBestNodeId).getRefineIdx( uiRefId ))), piPred, uiPredStride, iDC1, iDC2 );
     7167
     7168      Dist uiActDist = RDO_DIST_MAX;
     7169#if HHI_VSO
     7170      if( m_pcRdCost->getUseVSO() )
     7171      {
     7172        uiActDist = m_pcRdCost->getDistVS( pcCU, 0, piPred, uiPredStride, piRef, uiRefStride, uiWidth, uiHeight, false, 0 );
     7173#if LGE_WVSO_A0119
     7174        if ( m_pcRdCost->getUseWVSO() )
     7175        {   
     7176          Int iDWeight = m_pcRdCost->getDWeight() * m_pcRdCost->getDWeight();
     7177          Int iVSOWeight = m_pcRdCost->getVSOWeight() * m_pcRdCost->getVSOWeight();
     7178          Dist iD = (Dist) m_pcRdCost->getDistPart( piPred, uiPredStride, piRef, uiRefStride, uiWidth, uiHeight, false, DF_SAD );
     7179          uiActDist = (iDWeight * iD + iVSOWeight * (Int) uiActDist) / ( iDWeight + iVSOWeight);
     7180        }
     7181#endif
     7182      }
     7183      else
     7184      {
     7185        uiActDist = m_pcRdCost->getDistPart( piPred, uiPredStride, piRef, uiRefStride, uiWidth, uiHeight, false, DF_SAD );
     7186      }
     7187#else
     7188      uiActDist = m_pcRdCost->getDistPart( piPred, uiPredStride, piRef, uiRefStride, uiWidth, uiHeight, false, DF_SAD );
     7189#endif
     7190      if( uiActDist < uiBestDistRef || uiBestDistRef == RDO_DIST_MAX )
     7191      {
     7192        uiBestDistRef   = uiActDist;
     7193        uiBestTabIdxRef = pacWedgeNodeList->at(uiBestNodeId).getRefineIdx( uiRefId );
     7194      }
     7195    }
     7196  }
     7197
     7198  riDist    = uiBestDistRef;
     7199  ruiTabIdx = uiBestTabIdxRef;
     7200
     7201  cPredYuv.destroy();
     7202  return;
     7203}
     7204#endif
     7205
    67127206Void TEncSearch::xSearchWedgePredDirMinDist( TComDataCU* pcCU, UInt uiAbsPtIdx, WedgeList* pacWedgeList, Pel* piRef, UInt uiRefStride, UInt uiWidth, UInt uiHeight, UInt& ruiTabIdx, Int& riWedgeDeltaEnd )
    67137207{
     
    68467340#endif
    68477341
    6848 #if LGE_EDGE_INTRA
     7342#if LGE_EDGE_INTRA_A0070
    68497343Bool TEncSearch::xCheckTerminatedEdge( Bool* pbEdge, Int iX, Int iY, Int iWidth, Int iHeight )
    68507344{
     
    79548448#endif
    79558449#endif
     8450 
     8451#if RWTH_SDC_DLT_B0036
     8452Void TEncSearch::xAnalyzeSegmentsSDC( Pel* pOrig, UInt uiStride, UInt uiSize, Pel* rpSegMeans, UInt uiNumSegments, Bool* pMask, UInt uiMaskStride )
     8453{
     8454  Int iSumDepth[2];
     8455  memset(iSumDepth, 0, sizeof(Int)*2);
     8456  Int iSumPix[2];
     8457  memset(iSumPix, 0, sizeof(Int)*2);
     8458 
     8459  for (Int y=0; y<uiSize; y++)
     8460  {
     8461    for (Int x=0; x<uiSize; x++)
     8462    {
     8463      UChar ucSegment = pMask?(UChar)pMask[x]:0;
     8464      assert( ucSegment < uiNumSegments );
     8465     
     8466      iSumDepth[ucSegment] += pOrig[x];
     8467      iSumPix[ucSegment]   += 1;
     8468    }
     8469   
     8470    pOrig  += uiStride;
     8471    pMask  += uiMaskStride;
     8472  }
     8473 
     8474  // compute mean for each segment
     8475  for( UChar ucSeg = 0; ucSeg < uiNumSegments; ucSeg++ )
     8476  {
     8477    if( iSumPix[ucSeg] > 0 )
     8478      rpSegMeans[ucSeg] = iSumDepth[ucSeg] / iSumPix[ucSeg];
     8479    else
     8480      rpSegMeans[ucSeg] = 0;  // this happens for zero-segments
     8481  }
     8482}
     8483#endif
    79568484
    79578485//! \}
Note: See TracChangeset for help on using the changeset viewer.