Changeset 213 in 3DVCSoftware for branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibEncoder/TEncSearch.cpp
- Timestamp:
- 31 Dec 2012, 18:33:14 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HTM-4.0.1-VSP-dev0/source/Lib/TLibEncoder/TEncSearch.cpp
r193 r213 42 42 #include <math.h> 43 43 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 44 49 //! \ingroup TLibEncoder 45 50 //! \{ … … 155 160 Int iSearchRange, 156 161 Int bipredSearchRange, 162 #if DV_V_RESTRICTION_B0037 163 Bool bUseDisparitySearchRangeRestriction, 164 Int iVerticalDisparitySearchRange, 165 #endif 157 166 Int iFastSearch, 158 167 Int iMaxDeltaQP, … … 167 176 m_iSearchRange = iSearchRange; 168 177 m_bipredSearchRange = bipredSearchRange; 178 #if DV_V_RESTRICTION_B0037 179 m_bUseDisparitySearchRangeRestriction = bUseDisparitySearchRangeRestriction; 180 m_iVerticalDisparitySearchRange = iVerticalDisparitySearchRange; 181 #endif 169 182 m_iFastSearch = iFastSearch; 170 183 m_iMaxDeltaQP = iMaxDeltaQP; … … 195 208 const Int iNumAMVPCands = AMVP_MAX_NUM_CANDS + 1; 196 209 for( Int iNum = 0; iNum < iNumAMVPCands+1; iNum++) 197 {198 210 for( Int iIdx = 0; iIdx < iNumAMVPCands; iIdx++) 199 211 #else 200 212 for( Int iNum = 0; iNum < AMVP_MAX_NUM_CANDS+1; iNum++) 201 {202 213 for( Int iIdx = 0; iIdx < AMVP_MAX_NUM_CANDS; iIdx++) 203 214 #endif … … 208 219 m_auiMVPIdxCost[iIdx][iNum] = MAX_INT; 209 220 } 210 }211 221 212 222 initTempBuff(); … … 300 310 301 311 // distortion 312 #if LGE_ILLUCOMP_B0045 313 m_cDistParam.bUseIC = pcPatternKey->getICFlag(); 314 #endif 302 315 uiSad = m_cDistParam.DistFunc( &m_cDistParam ); 303 316 … … 726 739 727 740 m_cDistParam.pCur = piRefPos; 741 #if LGE_ILLUCOMP_B0045 742 m_cDistParam.bUseIC = pcPatternKey->getICFlag(); 743 #endif 728 744 uiDist = m_cDistParam.DistFunc( &m_cDistParam ); 729 745 uiDist += m_pcRdCost->getCost( cMvTest.getHor(), cMvTest.getVer() ); … … 975 991 TComYuv* pcResiYuv, 976 992 Dist& ruiDist 977 #if LG_ZEROINTRADEPTHRESI_ M26039993 #if LG_ZEROINTRADEPTHRESI_A0087 978 994 ,Bool bZeroResi 979 995 #endif … … 1010 1026 pcCU->getPattern()->initAdiPattern( pcCU, uiAbsPartIdx, uiTrDepth, m_piYuvExt, m_iYuvExtStride, m_iYuvExtHeight, bAboveAvail, bLeftAvail ); 1011 1027 1012 #if LGE_EDGE_INTRA 1028 #if LGE_EDGE_INTRA_A0070 1013 1029 if( uiLumaPredMode >= EDGE_INTRA_IDX ) 1014 1030 { … … 1058 1074 } 1059 1075 } 1060 #if LG_ZEROINTRADEPTHRESI_ M260391076 #if LG_ZEROINTRADEPTHRESI_A0087 1061 1077 if(bZeroResi) 1062 1078 { … … 1375 1391 #endif 1376 1392 Double& dRDCost 1377 #if LG_ZEROINTRADEPTHRESI_ M260391393 #if LG_ZEROINTRADEPTHRESI_A0087 1378 1394 ,Bool bZeroResi 1379 1395 #endif … … 1397 1413 } 1398 1414 #endif 1399 #if LGE_EDGE_INTRA 1415 #if LGE_EDGE_INTRA_A0070 1400 1416 if( pcCU->getLumaIntraDir( uiAbsPartIdx ) >= EDGE_INTRA_IDX ) 1401 1417 { … … 1419 1435 //----- code luma block with given intra prediction mode and store Cbf----- 1420 1436 dSingleCost = 0.0; 1421 #if LG_ZEROINTRADEPTHRESI_ M260391437 #if LG_ZEROINTRADEPTHRESI_A0087 1422 1438 xIntraCodingLumaBlk( pcCU, uiTrDepth, uiAbsPartIdx, pcOrgYuv, pcPredYuv, pcResiYuv, uiSingleDistY, bZeroResi ); 1423 1439 #else … … 1611 1627 } 1612 1628 1629 #if RWTH_SDC_DLT_B0036 1630 Void 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 1613 1797 1614 1798 Void … … 1848 2032 UInt uiQNumParts = pcCU->getTotalNumPart() >> 2; 1849 2033 UInt uiWidthBit = pcCU->getIntraSizeIdx(0); 2034 #if FIX_RDO_NEGDIST 2035 Dist uiOverallDistY = 0; 2036 Dist uiOverallDistC = 0; 2037 #else 1850 2038 UInt uiOverallDistY = 0; 1851 2039 UInt uiOverallDistC = 0; 2040 #endif 1852 2041 UInt CandNum; 1853 2042 Double CandCostList[ FAST_UDI_MAX_RDMODE_NUM ]; … … 1885 2074 Int numModesForFullRD = g_aucIntraModeNumFast[ uiWidthBit ]; 1886 2075 1887 #if LGE_EDGE_INTRA 2076 #if LGE_EDGE_INTRA_A0070 1888 2077 Bool bTestEdgeIntra = false; 1889 2078 if ( m_pcEncCfg->isDepthCoder() && uiWidth >= LGE_EDGE_INTRA_MIN_SIZE && uiWidth <= LGE_EDGE_INTRA_MAX_SIZE && uiWidth == uiHeight ) … … 1936 2125 if ( m_pcRdCost->getUseWVSO() ) 1937 2126 { 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(); 1940 2129 Dist iD = (Dist) m_pcRdCost->calcHAD( piOrg, uiStride, piPred, uiStride, uiWidth, uiHeight ); 1941 2130 uiSad = (Dist) (iDWeight * iD + iVSDWeight * uiSad) / (iDWeight + iVSDWeight); … … 1951 2140 if ( m_pcRdCost->getUseWVSO() ) 1952 2141 { 1953 Int iDWeight = m_pcRdCost->getDWeight() *m_pcRdCost->getDWeight();1954 Int iVS DWeight = m_pcRdCost->getVSOWeight()*m_pcRdCost->getVSOWeight();1955 Dist iD = (Dist) m_pcRdCost-> getDistPart( piOrg, uiStride, piPred, uiStride, uiWidth, uiHeight );1956 uiSad = (Dist) (iDWeight * iD + iVS DWeight * 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); 1957 2146 } 1958 2147 #endif 1959 2148 } 1960 1961 2149 } 1962 2150 else … … 1987 2175 CandNum += xUpdateCandList( uiMode, cost, numModesForFullRD, uiRdModeList, CandCostList ); 1988 2176 1989 #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX2177 #if (HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX) && !FIX_DMM_NEG_DIST 1990 2178 if( bTestDmm ) bTestDmm = uiSad ? true : false; 1991 2179 #endif 1992 #if LGE_EDGE_INTRA 2180 #if LGE_EDGE_INTRA_A0070 1993 2181 if ( bTestEdgeIntra ) bTestEdgeIntra = uiSad ? true : false; 1994 2182 #endif … … 2074 2262 #endif 2075 2263 #if HHI_DMM_PRED_TEX 2264 2265 #if FLEX_CODING_ORDER_M23723 2266 if ( pcCU->getSlice()->getSPS()->getUseDMM34() ) 2267 { 2268 #endif 2076 2269 UInt uiTexTabIdx = 0; 2077 2270 Int iTexDeltaDC1 = 0; … … 2097 2290 uiRdModeList[ numModesForFullRD++ ] = DMM_CONTOUR_PREDTEX_D_IDX; 2098 2291 } 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 2103 2299 if( bTestEdgeIntra ) 2104 2300 { … … 2117 2313 2118 2314 UInt uiBestPUMode = 0; 2315 #if FIX_RDO_NEGDIST 2316 Dist uiBestPUDistY = 0; 2317 Dist uiBestPUDistC = 0; 2318 #else 2119 2319 UInt uiBestPUDistY = 0; 2120 2320 UInt uiBestPUDistC = 0; 2321 #endif 2121 2322 Double dBestPUCost = MAX_DOUBLE; 2323 #if RWTH_SDC_DLT_B0036 2324 Bool bBestUseSDC = false; 2325 Pel apBestDCOffsets[2] = {0,0}; 2326 #endif 2122 2327 for( UInt uiMode = 0; uiMode < numModesForFullRD; uiMode++ ) 2123 2328 { 2124 #if LG_ZEROINTRADEPTHRESI_ M260392329 #if LG_ZEROINTRADEPTHRESI_A0087 2125 2330 Bool bAllowZeroResi = pcCU->getSlice()->getIsDepth() && (pcCU->getSlice()->getPOC()%pcCU->getPic()->getIntraPeriod());// && (uiMode < NUM_INTRA_MODE); 2126 2331 for(UInt uiCnt = 0; uiCnt < (bAllowZeroResi ? 2 : 1); uiCnt++) … … 2132 2337 2133 2338 #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 2134 2348 if( m_pcEncCfg->getIsDepth() && !predIntraLumaDMMAvailable( uiOrgMode, uiWidth, uiHeight ) 2135 #if LGE_EDGE_INTRA 2349 #if LGE_EDGE_INTRA_A0070 2136 2350 && uiOrgMode < EDGE_INTRA_IDX 2137 2351 #endif 2138 2352 ) 2353 #endif 2139 2354 { 2140 2355 continue; 2141 2356 } 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 { 2142 2366 #endif 2143 2367 … … 2163 2387 } 2164 2388 #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 2166 2407 #if HHI_RQT_INTRA_SPEEDUP 2167 #if LG_ZEROINTRADEPTHRESI_ M260392408 #if LG_ZEROINTRADEPTHRESI_A0087 2168 2409 xRecurIntraCodingQT( pcCU, uiInitTrDepth, uiPartOffset, bLumaOnly, pcOrgYuv, pcPredYuv, pcResiYuv, uiPUDistY, uiPUDistC, true, dPUCost, bZeroResi ); 2169 2410 #else … … 2172 2413 #else 2173 2414 xRecurIntraCodingQT( pcCU, uiInitTrDepth, uiPartOffset, bLumaOnly, pcOrgYuv, pcPredYuv, pcResiYuv, uiPUDistY, uiPUDistC, dPUCost ); 2415 #endif 2416 #if RWTH_SDC_DLT_B0036 2417 } 2174 2418 #endif 2175 2419 … … 2185 2429 uiBestPUDistC = uiPUDistC; 2186 2430 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 2187 2524 2188 2525 xSetIntraResultQT( pcCU, uiInitTrDepth, uiPartOffset, bLumaOnly, pcRecoYuv ); … … 2195 2532 2196 2533 } 2197 #if HHI_RQT_INTRA_SPEEDUP_MOD2198 else if( dPUCost < dSecondBestPUCost )2199 {2200 uiSecondBestMode = uiOrgMode;2201 dSecondBestPUCost = dPUCost;2202 }2203 #endif2204 #if LG_ZEROINTRADEPTHRESI_M260392205 }2206 #endif2207 } // Mode loop2208 2209 #if HHI_RQT_INTRA_SPEEDUP2210 #if HHI_RQT_INTRA_SPEEDUP_MOD2211 for( UInt ui =0; ui < 2; ++ui )2212 #endif2213 {2214 #if HHI_RQT_INTRA_SPEEDUP_MOD2215 UInt uiOrgMode = ui ? uiSecondBestMode : uiBestPUMode;2216 if( uiOrgMode == MAX_UINT )2217 {2218 break;2219 }2220 #else2221 UInt uiOrgMode = uiBestPUMode;2222 #endif2223 2224 pcCU->setLumaIntraDirSubParts ( uiOrgMode, uiPartOffset, uiDepth + uiInitTrDepth );2225 2226 // set context models2227 if( m_bUseSBACRD )2228 {2229 m_pcRDGoOnSbacCoder->load( m_pppcRDSbacCoder[uiDepth][CI_CURR_BEST] );2230 }2231 2232 // determine residual for partition2233 Dist uiPUDistY = 0;2234 Dist uiPUDistC = 0;2235 Double dPUCost = 0.0;2236 2237 #if HHI_VSO2238 // reset Model2239 if( m_pcRdCost->getUseRenModel() )2240 {2241 m_pcRdCost->setRenModelData( pcCU, uiPartOffset, piOrg, uiStride, uiWidth, uiHeight );2242 }2243 #endif2244 2245 xRecurIntraCodingQT( pcCU, uiInitTrDepth, uiPartOffset, bLumaOnly, pcOrgYuv, pcPredYuv, pcResiYuv, uiPUDistY, uiPUDistC, false, dPUCost );2246 2247 // check r-d cost2248 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 }2264 2534 } // Mode loop 2265 2535 #endif … … 2268 2538 uiOverallDistY += uiBestPUDistY; 2269 2539 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 2270 2554 2271 2555 //--- update transform index and cbf --- … … 2275 2559 ::memcpy( pcCU->getCbf( TEXT_CHROMA_U ) + uiPartOffset, m_puhQTTempCbf[1], uiQPartNum * sizeof( UChar ) ); 2276 2560 ::memcpy( pcCU->getCbf( TEXT_CHROMA_V ) + uiPartOffset, m_puhQTTempCbf[2], uiQPartNum * sizeof( UChar ) ); 2561 #if RWTH_SDC_DLT_B0036 2562 } 2563 #endif 2277 2564 2278 2565 //--- set reconstruction for next intra prediction blocks --- … … 2345 2632 //=== update PU data ==== 2346 2633 pcCU->setLumaIntraDirSubParts ( uiBestPUMode, uiPartOffset, uiDepth + uiInitTrDepth ); 2634 #if RWTH_SDC_DLT_B0036 2635 pcCU->setSDCFlagSubParts ( bBestUseSDC, uiPartOffset, 0, uiDepth + uiInitTrDepth ); 2636 #endif 2347 2637 pcCU->copyToPic ( uiDepth, uiPU, uiInitTrDepth ); 2348 2638 } // PU loop … … 2644 2934 iWidth, iHeight, m_pcEncCfg->getUseHADME() ); 2645 2935 #endif 2936 #if LGE_ILLUCOMP_B0045 2937 cDistParam.bUseIC = false; 2938 #endif 2646 2939 ruiErr = cDistParam.DistFunc( &cDistParam ); 2647 2940 } … … 2661 2954 */ 2662 2955 #if CU_BASED_MRG_CAND_LIST 2956 #if LG_RESTRICTEDRESPRED_M24766 2957 Void 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 2663 2959 Void TEncSearch::xMergeEstimation( TComDataCU* pcCU, TComYuv* pcYuvOrg, Int iPUIdx, UInt& uiInterDir, TComMvField* pacMvField, UInt& uiMergeIndex, UInt& ruiCost, TComMvField* cMvFieldNeighbours, UChar* uhInterDirNeighbours, Int& numValidMergeCand ) 2960 #endif 2664 2961 #else 2665 2962 #if LG_RESTRICTEDRESPRED_M24766 … … 2963 3260 for (Int iNumRef=0; iNumRef < MAX_NUM_REF; iNumRef++) uiCostTempL0[iNumRef] = MAX_UINT; 2964 3261 UInt uiBitsTempL0[MAX_NUM_REF]; 2965 2966 3262 #if LG_RESTRICTEDRESPRED_M24766 2967 3263 Int iPUResiPredShift[4] = {0, 0, 0, 0}; … … 3772 4068 UInt uiMRGCost = MAX_UINT; 3773 4069 #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 3774 4073 xMergeEstimation( pcCU, pcOrgYuv, iPartIdx, uiMRGInterDir, cMRGMvField, uiMRGIndex, uiMRGCost, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand); 4074 #endif 3775 4075 #else 3776 4076 #if LG_RESTRICTEDRESPRED_M24766 … … 4110 4410 cMvCand <<= 2; 4111 4411 #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 4112 4420 // prediction pattern 4113 4421 if ( pcCU->getSlice()->getPPS()->getUseWP() && pcCU->getSlice()->getSliceType()==P_SLICE ) … … 4117 4425 else 4118 4426 { 4427 #if LGE_ILLUCOMP_B0045 4428 xPredInterLumaBlk( pcCU, pcPicYuvRef, uiPartAddr, &cMvCand, iSizeX, iSizeY, pcTemplateCand, false, bICFlag ); 4429 #else 4119 4430 xPredInterLumaBlk( pcCU, pcPicYuvRef, uiPartAddr, &cMvCand, iSizeX, iSizeY, pcTemplateCand, false ); 4431 #endif 4120 4432 } 4121 4433 … … 4173 4485 Int iSrchRng = ( bBi ? m_bipredSearchRange : m_iSearchRange ); 4174 4486 #endif 4487 #if DV_V_RESTRICTION_B0037 4488 Int iVerDispSrchRng = m_iVerticalDisparitySearchRange; 4489 #endif 4175 4490 TComPattern* pcPatternKey = pcCU->getPattern (); 4176 4491 … … 4179 4494 pcCU->getPartIndexAndSize( iPartIdx, uiPartAddr, iRoiWidth, iRoiHeight ); 4180 4495 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 4181 4505 if ( bBi ) 4182 4506 { … … 4204 4528 4205 4529 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 4207 4548 if ( bBi ) xSetSearchRange ( pcCU, rcMv , iSrchRng, cMvSrchRngLT, cMvSrchRngRB ); 4208 4549 else xSetSearchRange ( pcCU, cMvPred, iSrchRng, cMvSrchRngLT, cMvSrchRngRB ); 4209 4550 #endif 4551 4210 4552 m_pcRdCost->getMotionCost ( 1, 0 ); 4211 4553 … … 4235 4577 if( bMultiviewReg && !bBi ) 4236 4578 { 4579 #if DV_V_RESTRICTION_B0037 4580 xSetSearchRange( pcCU, cOrgDepthMapMv, iSrchRng, cMvSrchRngLT, cMvSrchRngRB, bMv_VRng_Restricted, iVerDispSrchRng ); 4581 #else 4237 4582 xSetSearchRange( pcCU, cOrgDepthMapMv, iSrchRng, cMvSrchRngLT, cMvSrchRngRB ); 4583 #endif 4238 4584 } 4239 4585 } … … 4244 4590 } 4245 4591 #endif 4246 4592 #if QC_MVHEVC_B0046 4593 m_pcRdCost->setMultiviewReg( 0 ); 4594 #endif 4247 4595 setWpScalingDistParam( pcCU, iRefIdxPred, eRefPicList ); 4248 4596 // Do integer search … … 4262 4610 4263 4611 m_pcRdCost->getMotionCost( 1, 0 ); 4264 4265 4612 #if HHI_FULL_PEL_DEPTH_MAP_MV_ACC 4266 4613 if( ! pcCU->getSlice()->getIsDepth() ) … … 4305 4652 } 4306 4653 4307 4654 #if DV_V_RESTRICTION_B0037 4655 Void TEncSearch::xSetSearchRange ( TComDataCU* pcCU, TComMv& cMvPred, Int iSrchRng, TComMv& rcMvSrchRngLT, TComMv& rcMvSrchRngRB, Bool bMv_VRng_Restricted, Int iVerDispSrchRng ) 4656 #else 4308 4657 Void TEncSearch::xSetSearchRange ( TComDataCU* pcCU, TComMv& cMvPred, Int iSrchRng, TComMv& rcMvSrchRngLT, TComMv& rcMvSrchRngRB ) 4658 #endif 4309 4659 { 4310 4660 Int iMvShift = 2; … … 4321 4671 rcMvSrchRngRB.setHor( cTmpMvPred.getHor() + (iSrchRng << iMvShift) ); 4322 4672 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 4323 4686 pcCU->clipMv ( rcMvSrchRngLT ); 4324 4687 pcCU->clipMv ( rcMvSrchRngRB ); … … 4365 4728 setDistParamComp(0); 4366 4729 4730 #if LGE_ILLUCOMP_B0045 4731 m_cDistParam.bUseIC = pcPatternKey->getICFlag(); 4732 #endif 4367 4733 uiSad = m_cDistParam.DistFunc( &m_cDistParam ); 4368 4734 … … 4736 5102 m_pcEntropyCoder->encodeSkipFlag(pcCU, 0, true); 4737 5103 m_pcEntropyCoder->encodeMergeIndex( pcCU, 0, 0, true ); 5104 #if LGE_ILLUCOMP_B0045 5105 m_pcEntropyCoder->encodeICFlag(pcCU, 0, true); 5106 #endif 4738 5107 #if HHI_INTER_VIEW_RESIDUAL_PRED 4739 5108 m_pcEntropyCoder->encodeResPredFlag( pcCU, 0, 0, true ); … … 5486 5855 } 5487 5856 5857 #if FIX_RDO_NEGDIST 5858 Dist uiDistU = 0; 5859 Dist uiDistV = 0; 5860 #else 5488 5861 UInt uiDistU = 0; 5489 5862 UInt uiDistV = 0; 5863 #endif 5490 5864 if( bCodeChroma ) 5491 5865 { … … 5525 5899 #endif 5526 5900 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 5527 5906 const UInt uiNonzeroDistU = m_pcRdCost->getDistPart( m_pcQTTempTComYuv[uiQTTempAccessLayer].getCbAddr( absTUPartIdxC), m_pcQTTempTComYuv[uiQTTempAccessLayer].getCStride(), 5528 5907 pcResi->getCbAddr( absTUPartIdxC), pcResi->getCStride(), trWidthC, trHeightC 5908 #endif 5529 5909 #if WEIGHTED_CHROMA_DISTORTION 5530 5910 , true … … 5611 5991 m_pcTrQuant->invtransformNxN( TEXT_CHROMA,REG_DCT, pcResiCurrV, m_pcQTTempTComYuv[uiQTTempAccessLayer].getCStride(), pcCoeffCurrV, trWidthC, trHeightC, scalingListType ); 5612 5992 #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 5614 5997 const UInt uiNonzeroDistV = m_pcRdCost->getDistPart( m_pcQTTempTComYuv[uiQTTempAccessLayer].getCrAddr( absTUPartIdxC ), m_pcQTTempTComYuv[uiQTTempAccessLayer].getCStride(), 5615 5998 pcResi->getCrAddr( absTUPartIdxC ), pcResi->getCStride(), trWidthC, trHeightC 5999 #endif 5616 6000 #if WEIGHTED_CHROMA_DISTORTION 5617 6001 , true … … 6110 6494 #endif 6111 6495 m_pcEntropyCoder->encodeMergeIndex(pcCU, 0, 0, true); 6496 #if LGE_ILLUCOMP_B0045 6497 m_pcEntropyCoder->encodeICFlag(pcCU, 0, true); 6498 #endif 6112 6499 #if HHI_INTER_VIEW_RESIDUAL_PRED 6113 6500 m_pcEntropyCoder->encodeResPredFlag( pcCU, 0, 0, true ); … … 6139 6526 m_pcEntropyCoder->encodePartSize( pcCU, 0, pcCU->getDepth(0), true ); 6140 6527 m_pcEntropyCoder->encodePredInfo( pcCU, 0, true ); 6528 #if LGE_ILLUCOMP_B0045 6529 m_pcEntropyCoder->encodeICFlag(pcCU, 0, true); 6530 #endif 6141 6531 #if HHI_INTER_VIEW_RESIDUAL_PRED 6142 6532 m_pcEntropyCoder->encodeResPredFlag( pcCU, 0, 0, true ); … … 6396 6786 6397 6787 #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX 6788 #if ((HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX)&&FLEX_CODING_ORDER_M23723) 6789 Bool TEncSearch::predIntraLumaDMMAvailable( UInt uiMode, UInt uiWidth, UInt uiHeight, Bool bDMMAvailable34 ) 6790 #else 6398 6791 Bool TEncSearch::predIntraLumaDMMAvailable( UInt uiMode, UInt uiWidth, UInt uiHeight ) 6792 #endif 6399 6793 { 6400 6794 if( uiMode < NUM_INTRA_MODE ) return true; … … 6424 6818 bDMMAvailable = false; 6425 6819 } 6820 6821 #if FLEX_CODING_ORDER_M23723 6822 if ( !bDMMAvailable34 ) 6823 { 6824 bDMMAvailable = false; 6825 } 6826 #endif 6827 6426 6828 } 6427 6829 #endif … … 6494 6896 6495 6897 Dist uiActDist = RDO_DIST_MAX; 6496 #if FIX_RDO_MACRO6497 6898 #if SAIT_VSO_EST_A0033 6498 6899 if ( m_pcRdCost->getUseEstimatedVSD() ) … … 6525 6926 #endif // LGE_WVSO_A0119 6526 6927 } 6527 #else // FIX_RDO_MACRO6528 #if SAIT_VSO_EST_A00336529 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_A01196535 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_A01196543 }6544 else6545 #else // SAIT_VSO_EST_A0033 <-- wrong #else statement should be #endif6546 {6547 uiActDist = m_pcRdCost->getDistVS( pcCU, 0, piPredic, uiStride, piOrig, uiStride, uiWidth, uiHeight, false, 0 );6548 #if LGE_WVSO_A01196549 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_A01196557 }6558 #endif // SAIT_VSO_EST_A0033 <-- wrong #endif should be removed6559 #endif // FIX_RDO_MACRO6560 6928 6561 6929 if( uiActDist < uiBestDist || uiBestDist == RDO_DIST_MAX ) … … 6599 6967 WedgeList* pacWedgeList = &g_aacWedgeLists[(g_aucConvertToBit[uiWidth])]; 6600 6968 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 6601 6973 xSearchWedgeFullMinDist( pcCU, uiAbsPtIdx, pacWedgeList, piOrig, uiStride, uiWidth, uiHeight, ruiTabIdx, iDist ); 6974 #endif 6602 6975 6603 6976 TComWedgelet* pcBestWedgelet = &(pacWedgeList->at(ruiTabIdx)); … … 6710 7083 } 6711 7084 7085 #if HHIQC_DMMFASTSEARCH_B0039 7086 Void 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 6712 7206 Void TEncSearch::xSearchWedgePredDirMinDist( TComDataCU* pcCU, UInt uiAbsPtIdx, WedgeList* pacWedgeList, Pel* piRef, UInt uiRefStride, UInt uiWidth, UInt uiHeight, UInt& ruiTabIdx, Int& riWedgeDeltaEnd ) 6713 7207 { … … 6846 7340 #endif 6847 7341 6848 #if LGE_EDGE_INTRA 7342 #if LGE_EDGE_INTRA_A0070 6849 7343 Bool TEncSearch::xCheckTerminatedEdge( Bool* pbEdge, Int iX, Int iY, Int iWidth, Int iHeight ) 6850 7344 { … … 7954 8448 #endif 7955 8449 #endif 8450 8451 #if RWTH_SDC_DLT_B0036 8452 Void 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 7956 8484 7957 8485 //! \}
Note: See TracChangeset for help on using the changeset viewer.