Changeset 1412 in 3DVCSoftware for branches/HTM-16.2-dev/source/Lib/TLibEncoder/TEncSearch.cpp
- Timestamp:
- 12 Apr 2018, 11:12:21 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HTM-16.2-dev/source/Lib/TLibEncoder/TEncSearch.cpp
r1405 r1412 4 4 * granted under this license. 5 5 * 6 * Copyright (c) 2010-201 6, ITU/ISO/IEC6 * Copyright (c) 2010-2017, ITU/ISO/IEC 7 7 * All rights reserved. 8 8 * … … 316 316 const Pel* const piRefSrch = rcStruct.piRefY + iSearchY * rcStruct.iYStride + iSearchX; 317 317 318 #if NH_3D _IC318 #if NH_3D 319 319 m_cDistParam.bUseIC = pcPatternKey->getICFlag(); 320 #endif321 #if NH_3D_SDC_INTER322 320 m_cDistParam.bUseSDCMRSAD = pcPatternKey->getSDCMRSADFlag(); 323 321 #endif … … 848 846 const TComMv* pcMvRefine = (iFrac == 2 ? s_acMvRefineH : s_acMvRefineQ); 849 847 848 #if MCTS_ENC_CHECK 849 UInt maxRefinements = 9; 850 Int mvShift = 2; 851 852 // filter length of sub-sample generation filter to be considered 853 const UInt LumaLTSampleOffset = 3; 854 const UInt LumaRBSampleOffset = 4; 855 856 if (m_pcEncCfg->getTMCTSSEITileConstraint()) 857 { 858 // if close to tile borders 859 if ( pcPatternKey->getROIYPosX() + (baseRefMv.getHor() >> mvShift ) < pcPatternKey->getTileLeftTopPelPosX() + LumaLTSampleOffset || 860 pcPatternKey->getROIYPosY() + (baseRefMv.getVer() >> mvShift ) < pcPatternKey->getTileLeftTopPelPosY() + LumaLTSampleOffset || 861 pcPatternKey->getROIYPosX() + (baseRefMv.getHor() >> mvShift) > pcPatternKey->getTileRightBottomPelPosX() - pcPatternKey->getROIYWidth() - LumaRBSampleOffset || 862 pcPatternKey->getROIYPosY() + (baseRefMv.getVer() >> mvShift) > pcPatternKey->getTileRightBottomPelPosY() - pcPatternKey->getROIYHeight() - LumaRBSampleOffset 863 ) 864 { 865 // only allow full pel positions to avoid filter dependency 866 maxRefinements = 1; 867 } 868 } 869 870 for (UInt i = 0; i < maxRefinements; i++) 871 #else 850 872 for (UInt i = 0; i < 9; i++) 873 #endif 851 874 { 852 875 TComMv cMvTest = pcMvRefine[i]; … … 868 891 869 892 setDistParamComp(COMPONENT_Y); 870 #if NH_3D _IC893 #if NH_3D 871 894 m_cDistParam.bUseIC = pcPatternKey->getICFlag(); 872 #endif873 #if NH_3D_SDC_INTER874 895 m_cDistParam.bUseSDCMRSAD = pcPatternKey->getSDCMRSADFlag(); 875 896 #endif … … 1020 1041 if( !pcCU->getSlice()->isIntra() ) 1021 1042 { 1022 if (pcCU->getSlice()->getPPS()->getTransquantBypassEnable Flag())1043 if (pcCU->getSlice()->getPPS()->getTransquantBypassEnabledFlag()) 1023 1044 { 1024 1045 m_pcEntropyCoder->encodeCUTransquantBypassFlag( pcCU, 0, true ); 1025 1046 } 1026 1047 m_pcEntropyCoder->encodeSkipFlag( pcCU, 0, true ); 1027 #if NH_3D _DIS1048 #if NH_3D 1028 1049 m_pcEntropyCoder->encodeDIS(pcCU, 0, true ); 1029 1050 if(!pcCU->getDISFlag(uiAbsPartIdx)) 1030 1051 #endif 1031 m_pcEntropyCoder->encodePredMode( pcCU, 0, true );1032 } 1033 #if NH_3D _DIS1052 m_pcEntropyCoder->encodePredMode( pcCU, 0, true ); 1053 } 1054 #if NH_3D 1034 1055 else 1035 1056 { 1036 1057 m_pcEntropyCoder->encodeDIS(pcCU, 0, true ); 1037 1058 } 1038 #endif1039 #if NH_3D_DIS1040 1059 if(!pcCU->getDISFlag(uiAbsPartIdx)) 1041 1060 { 1042 1061 #endif 1043 m_pcEntropyCoder ->encodePartSize( pcCU, 0, pcCU->getDepth(0), true );1044 1045 if (pcCU->isIntra(0) && pcCU->getPartitionSize(0) == SIZE_2Nx2N )1046 {1047 m_pcEntropyCoder->encodeIPCMInfo( pcCU, 0, true );1048 1049 if ( pcCU->getIPCMFlag (0))1050 {1051 #if NH_3D _SDC_INTRA1062 m_pcEntropyCoder ->encodePartSize( pcCU, 0, pcCU->getDepth(0), true ); 1063 1064 if (pcCU->isIntra(0) && pcCU->getPartitionSize(0) == SIZE_2Nx2N ) 1065 { 1066 m_pcEntropyCoder->encodeIPCMInfo( pcCU, 0, true ); 1067 1068 if ( pcCU->getIPCMFlag (0)) 1069 { 1070 #if NH_3D 1052 1071 m_pcEntropyCoder->encodeSDCFlag( pcCU, 0, true ); 1053 1072 #endif 1054 return;1055 }1056 }1057 #if NH_3D _DIS1058 }1059 #endif 1060 }1061 #if NH_3D _DIS1073 return; 1074 } 1075 } 1076 #if NH_3D 1077 } 1078 #endif 1079 } 1080 #if NH_3D 1062 1081 if(!pcCU->getDISFlag(uiAbsPartIdx)) 1063 1082 { 1064 1083 #endif 1065 // luma prediction mode1066 if( pcCU->getPartitionSize(0) == SIZE_2Nx2N )1067 {1068 if (uiAbsPartIdx==0)1069 {1070 m_pcEntropyCoder->encodeIntraDirModeLuma ( pcCU, 0 );1071 #if NH_3D _SDC_INTRA1084 // luma prediction mode 1085 if( pcCU->getPartitionSize(0) == SIZE_2Nx2N ) 1086 { 1087 if (uiAbsPartIdx==0) 1088 { 1089 m_pcEntropyCoder->encodeIntraDirModeLuma ( pcCU, 0 ); 1090 #if NH_3D 1072 1091 m_pcEntropyCoder->encodeSDCFlag( pcCU, 0, true ); 1073 #if NH_3D_DMM1074 1092 if( pcCU->getSlice()->getIsDepth() && ( !pcCU->getSDCFlag( 0 ) ) && isDmmMode( pcCU->getIntraDir( CHANNEL_TYPE_LUMA, 0 ) ) ) 1075 1093 { … … 1077 1095 } 1078 1096 #endif 1079 #endif 1080 } 1081 } 1082 else 1083 { 1084 UInt uiQNumParts = pcCU->getTotalNumPart() >> 2; 1085 if (uiTrDepth>0 && (uiAbsPartIdx%uiQNumParts)==0) 1086 { 1087 m_pcEntropyCoder->encodeIntraDirModeLuma ( pcCU, uiAbsPartIdx ); 1088 #if NH_3D_SDC_INTRA 1097 } 1098 } 1099 else 1100 { 1101 UInt uiQNumParts = pcCU->getTotalNumPart() >> 2; 1102 if (uiTrDepth>0 && (uiAbsPartIdx%uiQNumParts)==0) 1103 { 1104 m_pcEntropyCoder->encodeIntraDirModeLuma ( pcCU, uiAbsPartIdx ); 1105 #if NH_3D 1089 1106 if( uiAbsPartIdx == 0 ) 1090 1107 { 1091 1108 m_pcEntropyCoder->encodeSDCFlag( pcCU, 0, true ); 1092 1109 } 1093 #if NH_3D_DMM1094 1110 if( pcCU->getSlice()->getIsDepth() && ( !pcCU->getSDCFlag( uiAbsPartIdx ) ) && isDmmMode( pcCU->getIntraDir( CHANNEL_TYPE_LUMA, uiAbsPartIdx ) ) ) 1095 1111 { 1096 1112 m_pcEntropyCoder->encodeDeltaDC( pcCU, uiAbsPartIdx ); 1097 1113 } 1098 #endif 1099 #endif 1100 #if NH_3D_DIS 1101 } 1114 } 1102 1115 #endif 1103 1116 } … … 1180 1193 DEBUG_STRING_FN_DECLARE(sDebug) 1181 1194 ,Int default0Save1Load2 1182 #if NH_3D _ENC_DEPTH1195 #if NH_3D 1183 1196 , Bool zeroResiFlag 1184 1197 #endif … … 1253 1266 1254 1267 //===== get prediction signal ===== 1255 #if NH_3D _DMM1268 #if NH_3D 1256 1269 if( bIsLuma && isDmmMode( uiChFinalMode ) ) 1257 1270 { … … 1262 1275 #endif 1263 1276 predIntraAng( compID, uiChFinalMode, piOrg, uiStride, piPred, uiStride, rTu, bUseFilteredPredictions ); 1264 #if NH_3D _DMM1277 #if NH_3D 1265 1278 } 1266 1279 #endif … … 1309 1322 for( UInt uiY = 0; uiY < uiHeight; uiY++ ) 1310 1323 { 1311 #if NH_3D _ENC_DEPTH1324 #if NH_3D 1312 1325 if( zeroResiFlag ) 1313 1326 { … … 1318 1331 { 1319 1332 #endif 1320 for( UInt uiX = 0; uiX < uiWidth; uiX++ ) 1321 { 1322 pResi[ uiX ] = pOrg[ uiX ] - pPred[ uiX ]; 1323 } 1324 1325 pOrg += uiStride; 1326 pResi += uiStride; 1327 pPred += uiStride; 1328 #if NH_3D_ENC_DEPTH 1329 } 1330 #endif 1331 1333 for( UInt uiX = 0; uiX < uiWidth; uiX++ ) 1334 { 1335 pResi[ uiX ] = pOrg[ uiX ] - pPred[ uiX ]; 1336 } 1337 1338 pOrg += uiStride; 1339 pResi += uiStride; 1340 pPred += uiStride; 1341 #if NH_3D 1342 } 1343 #endif 1332 1344 } 1333 1345 } … … 1353 1365 if( useTransformSkip ? m_pcEncCfg->getUseRDOQTS() : m_pcEncCfg->getUseRDOQ() ) 1354 1366 { 1355 m_pcEntropyCoder->estimateBit( m_pcTrQuant->m_pcEstBitsSbac, uiWidth, uiHeight, chType ); 1367 COEFF_SCAN_TYPE scanType = COEFF_SCAN_TYPE(pcCU->getCoefScanIdx(uiAbsPartIdx, uiWidth, uiHeight, compID)); 1368 m_pcEntropyCoder->estimateBit( m_pcTrQuant->m_pcEstBitsSbac, uiWidth, uiHeight, chType, scanType ); 1356 1369 } 1357 1370 … … 1518 1531 TComTU& rTu 1519 1532 DEBUG_STRING_FN_DECLARE(sDebug) 1520 #if NH_3D _ENC_DEPTH1533 #if NH_3D 1521 1534 , Bool zeroResiFlag 1522 1535 #endif … … 1576 1589 } 1577 1590 #endif 1578 #if NH_3D _DMM1591 #if NH_3D 1579 1592 if( isDmmMode( pcCU->getIntraDir( CHANNEL_TYPE_LUMA, uiAbsPartIdx ) ) ) 1580 1593 { … … 1707 1720 //----- code luma/chroma block with given intra prediction mode and store Cbf----- 1708 1721 dSingleCost = 0.0; 1709 #if NH_3D _ENC_DEPTH1722 #if NH_3D 1710 1723 xIntraCodingTUBlock( pcOrgYuv, pcPredYuv, pcResiYuv, resiLumaSingle, false, uiSingleDistLuma, COMPONENT_Y, rTu DEBUG_STRING_PASS_INTO(sDebug), 0, zeroResiFlag ); 1711 1724 #else … … 1886 1899 } 1887 1900 1888 #if NH_3D _DIS1901 #if NH_3D 1889 1902 #if NH_3D_VSO 1890 1903 Void TEncSearch::xIntraCodingDIS( TComDataCU* pcCU, UInt uiAbsPartIdx, TComYuv* pcOrgYuv, TComYuv* pcPredYuv, Dist& ruiDist, Double& dRDCost, UInt uiPredMode ) … … 1984 1997 dRDCost = m_pcRdCost->calcRdCost( uiBits, ruiDist ); 1985 1998 } 1986 #endif 1987 #if NH_3D_SDC_INTRA 1999 1988 2000 #if NH_3D_VSO 1989 2001 Void TEncSearch::xIntraCodingSDC( TComDataCU* pcCU, UInt uiAbsPartIdx, TComYuv* pcOrgYuv, TComYuv* pcPredYuv, Dist& ruiDist, Double& dRDCost, Bool bZeroResidual, Int iSDCDeltaResi ) … … 1991 2003 Void TEncSearch::xIntraCodingSDC( TComDataCU* pcCU, UInt uiAbsPartIdx, TComYuv* pcOrgYuv, TComYuv* pcPredYuv, Distortion& ruiDist, Double& dRDCost, Bool bZeroResidual, Int iSDCDeltaResi ) 1992 2004 #endif 1993 1994 1995 2005 { 1996 2006 UInt uiWidth = pcCU->getWidth ( 0 ); … … 2016 2026 Bool* pbMask = NULL; 2017 2027 UInt uiMaskStride = 0; 2018 #if NH_3D_DMM 2028 2019 2029 if( isDmmMode( uiLumaPredMode ) ) 2020 2030 { … … 2064 2074 else // regular HEVC intra modes 2065 2075 { 2066 #endif 2076 2067 2077 uiNumSegments = 1; 2068 2078 … … 2125 2135 predConstantSDC( piPred, uiStride, uiWidth, apDCPredValues[0] ); apDCPredValues[1] = 0; 2126 2136 xCalcConstantSDC( piOrg, uiStride, uiWidth, apDCOrigValues[0] ); apDCOrigValues[1] = 0; 2127 #if NH_3D_DMM 2128 } 2129 #endif 2137 } 2130 2138 2131 2139 for( UInt uiSegment = 0; uiSegment < uiNumSegments; uiSegment++ ) … … 2134 2142 Pel pDCRec = ( !bZeroResidual ) ? apDCOrigValues[uiSegment] : apDCPredValues[uiSegment]; 2135 2143 // get residual (idx) 2136 #if NH_3D_DLT2137 2144 Pel pResidualIdx = pcCU->getSlice()->getPPS()->getDLT()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), pDCRec ) - pcCU->getSlice()->getPPS()->getDLT()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), apDCPredValues[uiSegment] ); 2138 #else2139 Pel pResidualIdx = pDCRec - apDCPredValues[uiSegment];2140 #endif2141 2145 if( !bZeroResidual ) 2142 2146 { 2143 #if NH_3D_DLT2144 2147 Pel pPredIdx = pcCU->getSlice()->getPPS()->getDLT()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), apDCPredValues[uiSegment] ); 2145 2148 Int pTestIdx = pPredIdx + pResidualIdx + iSDCDeltaResi; … … 2148 2151 pResidualIdx += iSDCDeltaResi; 2149 2152 } 2150 #else2151 pResidualIdx += iSDCDeltaResi;2152 #endif2153 2153 } 2154 2154 // save SDC DC offset … … 2160 2160 for( UInt uiSegment = 0; uiSegment < uiNumSegments; uiSegment++ ) 2161 2161 { 2162 #if NH_3D_DLT2163 2162 Pel pPredIdx = pcCU->getSlice()->getPPS()->getDLT()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), apDCPredValues[uiSegment] ); 2164 2163 Pel pResiIdx = pcCU->getSDCSegmentDCOffset(uiSegment, uiAbsPartIdx); … … 2166 2165 2167 2166 apDCResiValues[uiSegment] = pRecoValue - apDCPredValues[uiSegment]; 2168 #else2169 apDCResiValues[uiSegment] = pcCU->getSDCSegmentDCOffset(uiSegment, uiAbsPartIdx);2170 #endif2171 2167 } 2172 2168 … … 2212 2208 } 2213 2209 2214 #if NH_3D_DMM 2215 if( pbMask ) { delete[] pbMask; } 2216 #endif 2210 if( pbMask ) 2211 { 2212 delete[] pbMask; 2213 } 2217 2214 2218 2215 //===== determine distortion ===== … … 2225 2222 #endif 2226 2223 { 2227 #if NH_3D_FIX_INTRA_SDC_VSO_OFF2228 2224 ruiDist = m_pcRdCost->getDistPart( bitDepthY, piPred, uiStride, piOrg, uiStride, uiWidth, uiHeight, COMPONENT_Y ); 2229 #else2230 ruiDist = m_pcRdCost->getDistPart( bitDepthY, piPred, uiStride, piOrg, uiStride, uiWidth, uiHeight, COMPONENT_Y, DF_SAD );2231 #endif2232 2225 } 2233 2226 … … 2238 2231 if( !pcCU->getSlice()->isIntra() ) 2239 2232 { 2240 if (pcCU->getSlice()->getPPS()->getTransquantBypassEnable Flag())2233 if (pcCU->getSlice()->getPPS()->getTransquantBypassEnabledFlag()) 2241 2234 { 2242 2235 m_pcEntropyCoder->encodeCUTransquantBypassFlag( pcCU, 0, true ); … … 2737 2730 } 2738 2731 2739 #if NH_3D _DIS2732 #if NH_3D 2740 2733 Void TEncSearch::estIntraPredDIS( TComDataCU* pcCU, 2741 2734 TComYuv* pcOrgYuv, … … 2746 2739 Bool bLumaOnly ) 2747 2740 { 2748 #if NH_MV 2741 2749 2742 D_PRINT_INC_INDENT(g_traceModeCheck, "estIntraPredDis"); 2750 #endif2751 2743 2752 2744 UInt uiDepth = pcCU->getDepth(0); … … 2828 2820 Pel resiLuma[NUMBER_OF_STORED_RESIDUAL_TYPES][MAX_CU_SIZE * MAX_CU_SIZE] 2829 2821 DEBUG_STRING_FN_DECLARE(sDebug) 2830 #if NH_3D _ENC_DEPTH2822 #if NH_3D 2831 2823 , Bool bOnlyIVP 2832 2824 #endif … … 2908 2900 assert (tuRecurseWithPU.ProcessComponentSection(COMPONENT_Y)); 2909 2901 initIntraPatternChType( tuRecurseWithPU, COMPONENT_Y, true DEBUG_STRING_PASS_INTO(sTemp2) ); 2910 #if NH_3D _ENC_DEPTH2902 #if NH_3D 2911 2903 if( bOnlyIVP ) 2912 2904 { … … 2917 2909 #endif 2918 2910 2919 Bool doFastSearch = (numModesForFullRD != numModesAvailable); 2920 if (doFastSearch) 2921 { 2922 assert(numModesForFullRD < numModesAvailable); 2923 2924 for( Int i=0; i < numModesForFullRD; i++ ) 2925 { 2926 CandCostList[ i ] = MAX_DOUBLE; 2927 } 2928 CandNum = 0; 2929 2911 Bool doFastSearch = (numModesForFullRD != numModesAvailable); 2912 if (doFastSearch) 2913 { 2914 assert(numModesForFullRD < numModesAvailable); 2915 2916 for( Int i=0; i < numModesForFullRD; i++ ) 2917 { 2918 CandCostList[ i ] = MAX_DOUBLE; 2919 } 2920 CandNum = 0; 2921 2922 const TComRectangle &puRect=tuRecurseWithPU.getRect(COMPONENT_Y); 2923 const UInt uiAbsPartIdx=tuRecurseWithPU.GetAbsPartIdxTU(); 2924 2925 Pel* piOrg = pcOrgYuv ->getAddr( COMPONENT_Y, uiAbsPartIdx ); 2926 Pel* piPred = pcPredYuv->getAddr( COMPONENT_Y, uiAbsPartIdx ); 2927 UInt uiStride = pcPredYuv->getStride( COMPONENT_Y ); 2928 DistParam distParam; 2929 const Bool bUseHadamard=pcCU->getCUTransquantBypass(0) == 0; 2930 m_pcRdCost->setDistParam(distParam, sps.getBitDepth(CHANNEL_TYPE_LUMA), piOrg, uiStride, piPred, uiStride, puRect.width, puRect.height, bUseHadamard); 2931 2932 #if NH_3D 2933 distParam.bUseIC = false; 2934 distParam.bUseSDCMRSAD = false; 2935 #endif 2936 distParam.bApplyWeight = false; 2937 for( Int modeIdx = 0; modeIdx < numModesAvailable; modeIdx++ ) 2938 { 2939 UInt uiMode = modeIdx; 2940 #if !NH_3D_VSO 2941 Distortion uiSad = 0; 2942 #endif 2943 #if NH_MV 2944 D_PRINT_INC_INDENT(g_traceModeCheck, "preTest; uiMode " + n2s(uiMode) ); 2945 #endif 2946 const Bool bUseFilter=TComPrediction::filteringIntraReferenceSamples(COMPONENT_Y, uiMode, puRect.width, puRect.height, chFmt, sps.getSpsRangeExtension().getIntraSmoothingDisabledFlag()); 2947 2948 predIntraAng( COMPONENT_Y, uiMode, piOrg, uiStride, piPred, uiStride, tuRecurseWithPU, bUseFilter, TComPrediction::UseDPCMForFirstPassIntraEstimation(tuRecurseWithPU, uiMode) ); 2949 #if NH_3D_VSO // M34 2950 Dist uiSad; 2951 if ( m_pcRdCost->getUseVSO() ) 2952 { 2953 if ( m_pcRdCost->getUseEstimatedVSD() ) 2954 { 2955 uiSad = (Dist) ( m_pcRdCost->getDistPartVSD( pcCU, uiPartOffset, distParam.bitDepth , piPred, uiStride, piOrg, uiStride, distParam.iCols, distParam.iRows, true ) ); 2956 } 2957 else 2958 { 2959 uiSad = m_pcRdCost->getDistPartVSO( pcCU, uiPartOffset, distParam.bitDepth , piPred, uiStride, piOrg, uiStride, distParam.iCols, distParam.iRows, true ); 2960 } 2961 } 2962 else 2963 { 2964 uiSad = distParam.DistFunc(&distParam); 2965 } 2966 #else 2967 // use hadamard transform here 2968 uiSad+=distParam.DistFunc(&distParam); 2969 #endif 2970 2971 UInt iModeBits = 0; 2972 2973 // NB xModeBitsIntra will not affect the mode for chroma that may have already been pre-estimated. 2974 iModeBits+=xModeBitsIntra( pcCU, uiMode, uiPartOffset, uiDepth, CHANNEL_TYPE_LUMA ); 2975 2976 #if NH_3D_VSO // M35 2977 Double dLambda; 2978 if ( m_pcRdCost->getUseLambdaScaleVSO() ) 2979 { 2980 dLambda = m_pcRdCost->getUseRenModel() ? m_pcRdCost->getLambdaVSO() : sqrtLambdaForFirstPass; 2981 } 2982 else 2983 { 2984 dLambda = m_pcRdCost->getSqrtLambda(); 2985 } 2986 2987 Double cost = (Double)uiSad + (Double)iModeBits * dLambda; 2988 #else 2989 Double cost = (Double)uiSad + (Double)iModeBits * sqrtLambdaForFirstPass; 2990 #endif 2991 2992 #if DEBUG_INTRA_SEARCH_COSTS 2993 std::cout << "1st pass mode " << uiMode << " SAD = " << uiSad << ", mode bits = " << iModeBits << ", cost = " << cost << "\n"; 2994 #endif 2995 2996 CandNum += xUpdateCandList( uiMode, cost, numModesForFullRD, uiRdModeList, CandCostList ); 2997 #if NH_MV 2998 D_DEC_INDENT( g_traceModeCheck ); 2999 #endif 3000 } 3001 3002 if (m_pcEncCfg->getFastUDIUseMPMEnabled()) 3003 { 3004 Int uiPreds[NUM_MOST_PROBABLE_MODES] = {-1, -1, -1}; 3005 3006 Int iMode = -1; 3007 pcCU->getIntraDirPredictor( uiPartOffset, uiPreds, COMPONENT_Y, &iMode ); 3008 3009 const Int numCand = ( iMode >= 0 ) ? iMode : Int(NUM_MOST_PROBABLE_MODES); 3010 3011 for( Int j=0; j < numCand; j++) 3012 { 3013 Bool mostProbableModeIncluded = false; 3014 Int mostProbableMode = uiPreds[j]; 3015 3016 for( Int i=0; i < numModesForFullRD; i++) 3017 { 3018 mostProbableModeIncluded |= (mostProbableMode == uiRdModeList[i]); 3019 } 3020 if (!mostProbableModeIncluded) 3021 { 3022 uiRdModeList[numModesForFullRD++] = mostProbableMode; 3023 } 3024 } 3025 } 3026 } 3027 else 3028 { 3029 for( Int i=0; i < numModesForFullRD; i++) 3030 { 3031 uiRdModeList[i] = i; 3032 } 3033 } 3034 #if NH_3D 3035 } 3036 if( m_pcEncCfg->getIsDepth() ) 3037 { 2930 3038 const TComRectangle &puRect=tuRecurseWithPU.getRect(COMPONENT_Y); 2931 3039 const UInt uiAbsPartIdx=tuRecurseWithPU.GetAbsPartIdxTU(); … … 2934 3042 Pel* piPred = pcPredYuv->getAddr( COMPONENT_Y, uiAbsPartIdx ); 2935 3043 UInt uiStride = pcPredYuv->getStride( COMPONENT_Y ); 2936 DistParam distParam;2937 const Bool bUseHadamard=pcCU->getCUTransquantBypass(0) == 0;2938 m_pcRdCost->setDistParam(distParam, sps.getBitDepth(CHANNEL_TYPE_LUMA), piOrg, uiStride, piPred, uiStride, puRect.width, puRect.height, bUseHadamard);2939 2940 #if NH_3D2941 distParam.bUseIC = false;2942 #endif2943 #if NH_3D_SDC_INTER2944 distParam.bUseSDCMRSAD = false;2945 #endif2946 distParam.bApplyWeight = false;2947 for( Int modeIdx = 0; modeIdx < numModesAvailable; modeIdx++ )2948 {2949 UInt uiMode = modeIdx;2950 #if !NH_3D_VSO2951 Distortion uiSad = 0;2952 #endif2953 #if NH_MV2954 D_PRINT_INC_INDENT(g_traceModeCheck, "preTest; uiMode " + n2s(uiMode) );2955 #endif2956 2957 const Bool bUseFilter=TComPrediction::filteringIntraReferenceSamples(COMPONENT_Y, uiMode, puRect.width, puRect.height, chFmt, sps.getSpsRangeExtension().getIntraSmoothingDisabledFlag());2958 2959 predIntraAng( COMPONENT_Y, uiMode, piOrg, uiStride, piPred, uiStride, tuRecurseWithPU, bUseFilter, TComPrediction::UseDPCMForFirstPassIntraEstimation(tuRecurseWithPU, uiMode) );2960 #if NH_3D_VSO // M342961 Dist uiSad;2962 if ( m_pcRdCost->getUseVSO() )2963 {2964 if ( m_pcRdCost->getUseEstimatedVSD() )2965 {2966 uiSad = (Dist) ( m_pcRdCost->getDistPartVSD( pcCU, uiPartOffset, distParam.bitDepth , piPred, uiStride, piOrg, uiStride, distParam.iCols, distParam.iRows, true ) );2967 }2968 else2969 {2970 uiSad = m_pcRdCost->getDistPartVSO( pcCU, uiPartOffset, distParam.bitDepth , piPred, uiStride, piOrg, uiStride, distParam.iCols, distParam.iRows, true );2971 }2972 }2973 else2974 {2975 uiSad = distParam.DistFunc(&distParam);2976 }2977 #else2978 // use hadamard transform here2979 uiSad+=distParam.DistFunc(&distParam);2980 #endif2981 2982 UInt iModeBits = 0;2983 2984 // NB xModeBitsIntra will not affect the mode for chroma that may have already been pre-estimated.2985 iModeBits+=xModeBitsIntra( pcCU, uiMode, uiPartOffset, uiDepth, CHANNEL_TYPE_LUMA );2986 2987 #if NH_3D_VSO // M352988 Double dLambda;2989 if ( m_pcRdCost->getUseLambdaScaleVSO() )2990 {2991 dLambda = m_pcRdCost->getUseRenModel() ? m_pcRdCost->getLambdaVSO() : sqrtLambdaForFirstPass;2992 }2993 else2994 {2995 dLambda = m_pcRdCost->getSqrtLambda();2996 }2997 2998 Double cost = (Double)uiSad + (Double)iModeBits * dLambda;2999 #else3000 Double cost = (Double)uiSad + (Double)iModeBits * sqrtLambdaForFirstPass;3001 #endif3002 3003 #if DEBUG_INTRA_SEARCH_COSTS3004 std::cout << "1st pass mode " << uiMode << " SAD = " << uiSad << ", mode bits = " << iModeBits << ", cost = " << cost << "\n";3005 #endif3006 3007 CandNum += xUpdateCandList( uiMode, cost, numModesForFullRD, uiRdModeList, CandCostList );3008 #if NH_MV3009 D_DEC_INDENT( g_traceModeCheck );3010 #endif3011 }3012 3013 if (m_pcEncCfg->getFastUDIUseMPMEnabled())3014 {3015 Int uiPreds[NUM_MOST_PROBABLE_MODES] = {-1, -1, -1};3016 3017 Int iMode = -1;3018 pcCU->getIntraDirPredictor( uiPartOffset, uiPreds, COMPONENT_Y, &iMode );3019 3020 const Int numCand = ( iMode >= 0 ) ? iMode : Int(NUM_MOST_PROBABLE_MODES);3021 3022 for( Int j=0; j < numCand; j++)3023 {3024 Bool mostProbableModeIncluded = false;3025 Int mostProbableMode = uiPreds[j];3026 3027 for( Int i=0; i < numModesForFullRD; i++)3028 {3029 mostProbableModeIncluded |= (mostProbableMode == uiRdModeList[i]);3030 }3031 if (!mostProbableModeIncluded)3032 {3033 uiRdModeList[numModesForFullRD++] = mostProbableMode;3034 }3035 }3036 }3037 }3038 else3039 {3040 for( Int i=0; i < numModesForFullRD; i++)3041 {3042 uiRdModeList[i] = i;3043 }3044 }3045 #if NH_3D_ENC_DEPTH3046 }3047 #endif3048 3049 #if NH_3D_DMM3050 if( m_pcEncCfg->getIsDepth() )3051 {3052 const TComRectangle &puRect=tuRecurseWithPU.getRect(COMPONENT_Y);3053 const UInt uiAbsPartIdx=tuRecurseWithPU.GetAbsPartIdxTU();3054 3055 Pel* piOrg = pcOrgYuv ->getAddr( COMPONENT_Y, uiAbsPartIdx );3056 Pel* piPred = pcPredYuv->getAddr( COMPONENT_Y, uiAbsPartIdx );3057 UInt uiStride = pcPredYuv->getStride( COMPONENT_Y );3058 3044 3059 3045 if( puRect.width >= DMM_MIN_SIZE && puRect.width <= DMM_MAX_SIZE && puRect.width == puRect.height && 3060 ((m_pcEncCfg->getUseDMM() && pcCU->getSlice()->getIntraSdcWedgeFlag()) || pcCU->getSlice()->getIntraContourFlag()) ) 3061 { 3062 #if NH_3D_ENC_DEPTH 3046 ((m_pcEncCfg->getUseDMM() && pcCU->getSlice()->getIntraSdcWedgeFlag()) || pcCU->getSlice()->getIntraContourFlag()) ) 3047 { 3063 3048 if( bOnlyIVP ) 3064 3049 { … … 3082 3067 if( uiRdModeList[0] != PLANAR_IDX || varCU >= varThreshold ) 3083 3068 { 3084 #endif3085 3069 UInt startIdx = ( m_pcEncCfg->getUseDMM() && pcCU->getSlice()->getIntraSdcWedgeFlag() ) ? 0 : 1; 3086 3070 UInt endIdx = ( pcCU->getSlice()->getIntraContourFlag() ) ? 1 : 0; 3087 3071 for( UInt dmmType = startIdx; dmmType <= endIdx; dmmType++ ) 3088 3072 { 3089 #if H_3D_FCO3090 if ( !(pcCU->getSlice()->getIvPic(false, pcCU->getSlice()->getViewIndex() )->getReconMark()) && (DMM4_IDX == dmmType ) ) { continue; }3091 #endif3092 3073 Bool* biSegPattern = new Bool[ puRect.width*puRect.height ]; 3093 3074 UInt patternStride = puRect.width; … … 3114 3095 pcCU->setDmmDeltaDC( (DmmID)dmmType, 0, uiPartOffset, deltaDC1 ); 3115 3096 pcCU->setDmmDeltaDC( (DmmID)dmmType, 1, uiPartOffset, deltaDC2 ); 3116 3097 3117 3098 uiRdModeList[ numModesForFullRD++ ] = (dmmType+DMM_OFFSET); 3118 3099 delete[] biSegPattern; 3119 3100 } 3120 3101 } 3121 #if NH_3D_ENC_DEPTH3122 3102 } 3123 3103 } 3124 #endif3125 3104 } 3126 3105 } … … 3134 3113 DEBUG_STRING_NEW(sPU) 3135 3114 UInt uiBestPUMode = 0; 3136 #if NH_3D _ENC_DEPTH3115 #if NH_3D 3137 3116 UInt uiBestPUModeConv = 0; 3138 3117 UInt uiSecondBestPUModeConv = 0; … … 3147 3126 Double dBestPUCost = MAX_DOUBLE; 3148 3127 3149 #if NH_3D _ENC_DEPTH3128 #if NH_3D 3150 3129 Double dBestPUCostConv = MAX_DOUBLE; 3151 3130 UInt rdSDC = m_pcEncCfg->getIsDepth() ? numModesForFullRD : 0; 3152 #endif3153 #if NH_3D_SDC_INTRA3154 3131 Bool bBestUseSDC = false; 3155 3132 Pel apBestDCOffsets[2] = {0,0}; 3156 #endif3157 #if NH_3D_ENC_DEPTH3158 3133 for( UInt uiMode = 0; uiMode < numModesForFullRD + rdSDC; uiMode++ ) 3159 3134 #else … … 3173 3148 { 3174 3149 // set luma prediction mode 3175 #if !NH_3D _ENC_DEPTH3150 #if !NH_3D 3176 3151 UInt uiOrgMode = uiRdModeList[uiMode]; 3177 #endif 3178 3179 #if NH_3D_ENC_DEPTH 3152 #else 3180 3153 UInt uiOrgMode; 3181 3154 if (uiMode < numModesForFullRD) … … 3214 3187 pcCU->setIntraDirSubParts ( CHANNEL_TYPE_LUMA, uiOrgMode, uiPartOffset, uiDepth + uiInitTrDepth ); 3215 3188 3216 #if NH_3D_SDC_INTRA 3217 #if NH_3D_ENC_DEPTH 3189 #if NH_3D 3218 3190 Bool bTestSDC = ( ( m_pcEncCfg->getUseSDC() && pcCU->getSlice()->getIntraSdcWedgeFlag() ) && pcCU->getSDCAvailable(uiPartOffset) && uiMode >= numModesForFullRD); 3219 #else3220 Bool bTestSDC = ( m_pcEncCfg->getUseSDC() && pcCU->getSDCAvailable(uiPartOffset) );3221 #endif3222 3191 3223 3192 for( UInt uiSDC=0; uiSDC<=(bTestSDC?1:0); uiSDC++ ) 3224 3193 { 3225 #if NH_3D_ENC_DEPTH3226 3194 if (!uiSDC && uiMode >= numModesForFullRD) continue; 3227 #endif3228 3195 pcCU->setSDCFlagSubParts( (uiSDC != 0), uiPartOffset, uiDepth + uiInitTrDepth ); 3229 3196 Double dOffsetCost[3] = {MAX_DOUBLE,MAX_DOUBLE,MAX_DOUBLE}; … … 3258 3225 } 3259 3226 } 3260 #endif3261 #if NH_3D_ENC_DEPTH3262 3227 Bool zeroResiTest = (pcCU->getSlice()->getIsDepth() && !pcCU->getSlice()->isIRAP()); 3263 #if NH_3D_SDC_INTRA3264 3228 zeroResiTest = zeroResiTest || pcCU->getSDCFlag(uiPartOffset); 3265 3229 if( uiSDC != 0 && iSDCDeltaResi != 0 ) … … 3267 3231 zeroResiTest = false; 3268 3232 } 3269 #endif3270 3233 for( UInt zeroResi = 0; zeroResi <= ( zeroResiTest ? 1 : 0 ); zeroResi++ ) 3271 3234 { 3272 3235 #endif 3273 DEBUG_STRING_NEW(sMode)3274 // set context models3275 m_pcRDGoOnSbacCoder->load( m_pppcRDSbacCoder[uiDepth][CI_CURR_BEST] );3276 3277 // determine residual for partition3236 DEBUG_STRING_NEW(sMode) 3237 // set context models 3238 m_pcRDGoOnSbacCoder->load( m_pppcRDSbacCoder[uiDepth][CI_CURR_BEST] ); 3239 3240 // determine residual for partition 3278 3241 #if NH_3D_VSO 3279 Dist uiPUDistY = 0;3242 Dist uiPUDistY = 0; 3280 3243 #else 3281 Distortion uiPUDistY = 0;3282 #endif 3283 Double dPUCost = 0.0;3244 Distortion uiPUDistY = 0; 3245 #endif 3246 Double dPUCost = 0.0; 3284 3247 #if NH_3D_VSO // M36 3285 if( m_pcRdCost->getUseRenModel() )3286 {3287 m_pcRdCost->setRenModelData( pcCU, uiPartOffset, pcOrgYuv, &tuRecurseWithPU );3288 }3289 #endif 3290 #if NH_3D _SDC_INTRA3248 if( m_pcRdCost->getUseRenModel() ) 3249 { 3250 m_pcRdCost->setRenModelData( pcCU, uiPartOffset, pcOrgYuv, &tuRecurseWithPU ); 3251 } 3252 #endif 3253 #if NH_3D 3291 3254 if( pcCU->getSDCFlag(uiPartOffset) ) 3292 3255 { … … 3304 3267 { 3305 3268 #endif 3306 3307 3269 #if HHI_RQT_INTRA_SPEEDUP 3308 #if NH_3D_ENC_DEPTH 3309 xRecurIntraCodingLumaQT( pcOrgYuv, pcPredYuv, pcResiYuv, resiLumaPU, uiPUDistY, true, dPUCost, tuRecurseWithPU DEBUG_STRING_PASS_INTO(sMode), (zeroResi != 0) ); 3310 #if NH_3D_ENC_DEPTH 3270 #if NH_3D 3271 xRecurIntraCodingLumaQT( pcOrgYuv, pcPredYuv, pcResiYuv, resiLumaPU, uiPUDistY, true, dPUCost, tuRecurseWithPU DEBUG_STRING_PASS_INTO(sMode), (zeroResi != 0) ); 3311 3272 if( dPUCost < dBestPUCostConv ) 3312 3273 { … … 3316 3277 dBestPUCostConv = dPUCost; 3317 3278 } 3318 #endif3319 3279 #else 3320 xRecurIntraCodingLumaQT( pcOrgYuv, pcPredYuv, pcResiYuv, resiLumaPU, uiPUDistY, true, dPUCost, tuRecurseWithPU DEBUG_STRING_PASS_INTO(sMode) );3280 xRecurIntraCodingLumaQT( pcOrgYuv, pcPredYuv, pcResiYuv, resiLumaPU, uiPUDistY, true, dPUCost, tuRecurseWithPU DEBUG_STRING_PASS_INTO(sMode) ); 3321 3281 #endif 3322 3282 #else 3323 #if NH_3D _ENC_DEPTH3324 xRecurIntraCodingLumaQT( pcOrgYuv, pcPredYuv, pcResiYuv, resiLumaPU, uiPUDistY, dPUCost, tuRecurseWithPU DEBUG_STRING_PASS_INTO(sMode), (zeroResi != 0) );3283 #if NH_3D 3284 xRecurIntraCodingLumaQT( pcOrgYuv, pcPredYuv, pcResiYuv, resiLumaPU, uiPUDistY, dPUCost, tuRecurseWithPU DEBUG_STRING_PASS_INTO(sMode), (zeroResi != 0) ); 3325 3285 #else 3326 xRecurIntraCodingLumaQT( pcOrgYuv, pcPredYuv, pcResiYuv, resiLumaPU, uiPUDistY, dPUCost, tuRecurseWithPU DEBUG_STRING_PASS_INTO(sMode) );3327 #endif 3328 #endif 3329 #if NH_3D _SDC_INTRA3286 xRecurIntraCodingLumaQT( pcOrgYuv, pcPredYuv, pcResiYuv, resiLumaPU, uiPUDistY, dPUCost, tuRecurseWithPU DEBUG_STRING_PASS_INTO(sMode) ); 3287 #endif 3288 #endif 3289 #if NH_3D 3330 3290 } 3331 3291 #endif 3332 3292 3333 3334 3293 #if DEBUG_INTRA_SEARCH_COSTS 3335 std::cout << "2nd pass [luma,chroma] mode [" << Int(pcCU->getIntraDir(CHANNEL_TYPE_LUMA, uiPartOffset)) << "," << Int(pcCU->getIntraDir(CHANNEL_TYPE_CHROMA, uiPartOffset)) << "] cost = " << dPUCost << "\n";3336 #endif 3337 3338 // check r-d cost3339 if( dPUCost < dBestPUCost )3340 {3341 DEBUG_STRING_SWAP(sPU, sMode)3294 std::cout << "2nd pass [luma,chroma] mode [" << Int(pcCU->getIntraDir(CHANNEL_TYPE_LUMA, uiPartOffset)) << "," << Int(pcCU->getIntraDir(CHANNEL_TYPE_CHROMA, uiPartOffset)) << "] cost = " << dPUCost << "\n"; 3295 #endif 3296 3297 // check r-d cost 3298 if( dPUCost < dBestPUCost ) 3299 { 3300 DEBUG_STRING_SWAP(sPU, sMode) 3342 3301 #if HHI_RQT_INTRA_SPEEDUP_MOD 3343 uiSecondBestMode = uiBestPUMode;3344 dSecondBestPUCost = dBestPUCost;3345 #endif 3346 uiBestPUMode = uiOrgMode;3347 uiBestPUDistY = uiPUDistY;3348 dBestPUCost = dPUCost;3349 3350 #if NH_3D _SDC_INTRA3302 uiSecondBestMode = uiBestPUMode; 3303 dSecondBestPUCost = dBestPUCost; 3304 #endif 3305 uiBestPUMode = uiOrgMode; 3306 uiBestPUDistY = uiPUDistY; 3307 dBestPUCost = dPUCost; 3308 3309 #if NH_3D 3351 3310 if( pcCU->getSDCFlag(uiPartOffset) ) 3352 3311 { … … 3370 3329 bBestUseSDC = false; 3371 3330 #endif 3331 xSetIntraResultLumaQT( pcRecoYuv, tuRecurseWithPU ); 3332 3333 if (pps.getPpsRangeExtension().getCrossComponentPredictionEnabledFlag()) 3334 { 3335 const Int xOffset = tuRecurseWithPU.getRect( COMPONENT_Y ).x0; 3336 const Int yOffset = tuRecurseWithPU.getRect( COMPONENT_Y ).y0; 3337 for (UInt storedResidualIndex = 0; storedResidualIndex < NUMBER_OF_STORED_RESIDUAL_TYPES; storedResidualIndex++) 3338 { 3339 if (bMaintainResidual[storedResidualIndex]) 3340 { 3341 xStoreCrossComponentPredictionResult(resiLuma[storedResidualIndex], resiLumaPU[storedResidualIndex], tuRecurseWithPU, xOffset, yOffset, MAX_CU_SIZE, MAX_CU_SIZE ); 3342 } 3343 } 3344 } 3345 3346 UInt uiQPartNum = tuRecurseWithPU.GetAbsPartIdxNumParts(); 3347 3348 ::memcpy( m_puhQTTempTrIdx, pcCU->getTransformIdx() + uiPartOffset, uiQPartNum * sizeof( UChar ) ); 3349 for (UInt component = 0; component < numberValidComponents; component++) 3350 { 3351 const ComponentID compID = ComponentID(component); 3352 ::memcpy( m_puhQTTempCbf[compID], pcCU->getCbf( compID ) + uiPartOffset, uiQPartNum * sizeof( UChar ) ); 3353 ::memcpy( m_puhQTTempTransformSkipFlag[compID], pcCU->getTransformSkip(compID) + uiPartOffset, uiQPartNum * sizeof( UChar ) ); 3354 } 3355 #if NH_3D 3356 } 3357 #endif 3358 } 3359 #if HHI_RQT_INTRA_SPEEDUP_MOD 3360 else if( dPUCost < dSecondBestPUCost ) 3361 { 3362 uiSecondBestMode = uiOrgMode; 3363 dSecondBestPUCost = dPUCost; 3364 } 3365 #endif 3366 3367 #if NH_3D 3368 } 3369 } // SDC residual loop 3370 } // SDC loop 3371 #endif 3372 #if NH_MV 3373 D_DEC_INDENT( g_traceModeCheck ); 3374 #endif 3375 } // Mode loop 3376 3377 #if HHI_RQT_INTRA_SPEEDUP 3378 #if HHI_RQT_INTRA_SPEEDUP_MOD 3379 for( UInt ui =0; ui < 2; ++ui ) 3380 #endif 3381 { 3382 #if HHI_RQT_INTRA_SPEEDUP_MOD 3383 UInt uiOrgMode = ui ? uiSecondBestMode : uiBestPUMode; 3384 if( uiOrgMode == MAX_UINT ) 3385 { 3386 break; 3387 } 3388 #else 3389 UInt uiOrgMode = uiBestPUMode; 3390 #endif 3391 3392 3393 #if ENVIRONMENT_VARIABLE_DEBUG_AND_TEST 3394 if (DebugOptionList::ForceLumaMode.isSet()) 3395 { 3396 uiOrgMode = DebugOptionList::ForceLumaMode.getInt(); 3397 } 3398 #endif 3399 3400 pcCU->setIntraDirSubParts ( CHANNEL_TYPE_LUMA, uiOrgMode, uiPartOffset, uiDepth + uiInitTrDepth ); 3401 #if NH_3D 3402 pcCU->setSDCFlagSubParts(false, uiPartOffset, uiDepth + uiInitTrDepth); 3403 #endif 3404 3405 DEBUG_STRING_NEW(sModeTree) 3406 3407 // set context models 3408 m_pcRDGoOnSbacCoder->load( m_pppcRDSbacCoder[uiDepth][CI_CURR_BEST] ); 3409 3410 // determine residual for partition 3411 #if NH_3D_VSO 3412 Dist uiPUDistY = 0; 3413 #else 3414 Distortion uiPUDistY = 0; 3415 #endif 3416 Double dPUCost = 0.0; 3417 #if NH_3D_VSO // M37 //check if necessary 3418 // reset Model 3419 if( m_pcRdCost->getUseRenModel() ) 3420 { 3421 m_pcRdCost->setRenModelData( pcCU, uiPartOffset, pcOrgYuv, &tuRecurseWithPU ); 3422 } 3423 #endif 3424 3425 xRecurIntraCodingLumaQT( pcOrgYuv, pcPredYuv, pcResiYuv, resiLumaPU, uiPUDistY, false, dPUCost, tuRecurseWithPU DEBUG_STRING_PASS_INTO(sModeTree)); 3426 3427 // check r-d cost 3428 if( dPUCost < dBestPUCost ) 3429 { 3430 DEBUG_STRING_SWAP(sPU, sModeTree) 3431 uiBestPUMode = uiOrgMode; 3432 uiBestPUDistY = uiPUDistY; 3433 dBestPUCost = dPUCost; 3434 #if NH_3D 3435 bBestUseSDC = false; 3436 #endif 3437 3438 3372 3439 xSetIntraResultLumaQT( pcRecoYuv, tuRecurseWithPU ); 3373 3440 … … 3385 3452 } 3386 3453 3387 UInt uiQPartNum = tuRecurseWithPU.GetAbsPartIdxNumParts(); 3388 3454 const UInt uiQPartNum = tuRecurseWithPU.GetAbsPartIdxNumParts(); 3389 3455 ::memcpy( m_puhQTTempTrIdx, pcCU->getTransformIdx() + uiPartOffset, uiQPartNum * sizeof( UChar ) ); 3456 3390 3457 for (UInt component = 0; component < numberValidComponents; component++) 3391 3458 { … … 3394 3461 ::memcpy( m_puhQTTempTransformSkipFlag[compID], pcCU->getTransformSkip(compID) + uiPartOffset, uiQPartNum * sizeof( UChar ) ); 3395 3462 } 3396 #if NH_3D_SDC_INTRA3397 }3398 #endif3399 }3400 #if HHI_RQT_INTRA_SPEEDUP_MOD3401 else if( dPUCost < dSecondBestPUCost )3402 {3403 uiSecondBestMode = uiOrgMode;3404 dSecondBestPUCost = dPUCost;3405 }3406 #endif3407 #if NH_3D_ENC_DEPTH3408 }3409 #endif3410 #if NH_3D_SDC_INTRA3411 } // SDC residual loop3412 } // SDC loop3413 #endif3414 #if NH_MV3415 D_DEC_INDENT( g_traceModeCheck );3416 #endif3417 } // Mode loop3418 3419 #if HHI_RQT_INTRA_SPEEDUP3420 #if HHI_RQT_INTRA_SPEEDUP_MOD3421 for( UInt ui =0; ui < 2; ++ui )3422 #endif3423 {3424 #if HHI_RQT_INTRA_SPEEDUP_MOD3425 UInt uiOrgMode = ui ? uiSecondBestMode : uiBestPUMode;3426 if( uiOrgMode == MAX_UINT )3427 {3428 break;3429 }3430 #else3431 UInt uiOrgMode = uiBestPUMode;3432 #endif3433 3434 3435 #if ENVIRONMENT_VARIABLE_DEBUG_AND_TEST3436 if (DebugOptionList::ForceLumaMode.isSet())3437 {3438 uiOrgMode = DebugOptionList::ForceLumaMode.getInt();3439 }3440 #endif3441 3442 pcCU->setIntraDirSubParts ( CHANNEL_TYPE_LUMA, uiOrgMode, uiPartOffset, uiDepth + uiInitTrDepth );3443 #if NH_3D_SDC_INTRA3444 pcCU->setSDCFlagSubParts(false, uiPartOffset, uiDepth + uiInitTrDepth);3445 #endif3446 3447 DEBUG_STRING_NEW(sModeTree)3448 3449 // set context models3450 m_pcRDGoOnSbacCoder->load( m_pppcRDSbacCoder[uiDepth][CI_CURR_BEST] );3451 3452 // determine residual for partition3453 #if NH_3D_VSO3454 Dist uiPUDistY = 0;3455 #else3456 Distortion uiPUDistY = 0;3457 #endif3458 Double dPUCost = 0.0;3459 #if NH_3D_VSO // M37 //check if necessary3460 // reset Model3461 if( m_pcRdCost->getUseRenModel() )3462 {3463 m_pcRdCost->setRenModelData( pcCU, uiPartOffset, pcOrgYuv, &tuRecurseWithPU );3464 }3465 #endif3466 3467 xRecurIntraCodingLumaQT( pcOrgYuv, pcPredYuv, pcResiYuv, resiLumaPU, uiPUDistY, false, dPUCost, tuRecurseWithPU DEBUG_STRING_PASS_INTO(sModeTree));3468 3469 // check r-d cost3470 if( dPUCost < dBestPUCost )3471 {3472 DEBUG_STRING_SWAP(sPU, sModeTree)3473 uiBestPUMode = uiOrgMode;3474 uiBestPUDistY = uiPUDistY;3475 dBestPUCost = dPUCost;3476 #if NH_3D_SDC_INTRA3477 bBestUseSDC = false;3478 #endif3479 3480 3481 xSetIntraResultLumaQT( pcRecoYuv, tuRecurseWithPU );3482 3483 if (pps.getPpsRangeExtension().getCrossComponentPredictionEnabledFlag())3484 {3485 const Int xOffset = tuRecurseWithPU.getRect( COMPONENT_Y ).x0;3486 const Int yOffset = tuRecurseWithPU.getRect( COMPONENT_Y ).y0;3487 for (UInt storedResidualIndex = 0; storedResidualIndex < NUMBER_OF_STORED_RESIDUAL_TYPES; storedResidualIndex++)3488 {3489 if (bMaintainResidual[storedResidualIndex])3490 {3491 xStoreCrossComponentPredictionResult(resiLuma[storedResidualIndex], resiLumaPU[storedResidualIndex], tuRecurseWithPU, xOffset, yOffset, MAX_CU_SIZE, MAX_CU_SIZE );3492 }3493 }3494 }3495 3496 const UInt uiQPartNum = tuRecurseWithPU.GetAbsPartIdxNumParts();3497 ::memcpy( m_puhQTTempTrIdx, pcCU->getTransformIdx() + uiPartOffset, uiQPartNum * sizeof( UChar ) );3498 3499 for (UInt component = 0; component < numberValidComponents; component++)3500 {3501 const ComponentID compID = ComponentID(component);3502 ::memcpy( m_puhQTTempCbf[compID], pcCU->getCbf( compID ) + uiPartOffset, uiQPartNum * sizeof( UChar ) );3503 ::memcpy( m_puhQTTempTransformSkipFlag[compID], pcCU->getTransformSkip(compID) + uiPartOffset, uiQPartNum * sizeof( UChar ) );3504 }3505 3463 } 3506 3464 } // Mode loop … … 3511 3469 //--- update overall distortion --- 3512 3470 uiOverallDistY += uiBestPUDistY; 3513 #if NH_3D _SDC_INTRA3471 #if NH_3D 3514 3472 if( bBestUseSDC ) 3515 3473 { … … 3533 3491 ::memcpy( pcCU->getCbf( compID ) + uiPartOffset, m_puhQTTempCbf[compID], uiQPartNum * sizeof( UChar ) ); 3534 3492 ::memcpy( pcCU->getTransformSkip( compID ) + uiPartOffset, m_puhQTTempTransformSkipFlag[compID ], uiQPartNum * sizeof( UChar ) ); 3535 #if NH_3D _SDC_INTRA3493 #if NH_3D 3536 3494 } 3537 3495 #endif … … 3570 3528 //=== update PU data ==== 3571 3529 pcCU->setIntraDirSubParts ( CHANNEL_TYPE_LUMA, uiBestPUMode, uiPartOffset, uiDepth + uiInitTrDepth ); 3572 #if NH_3D _SDC_INTRA3530 #if NH_3D 3573 3531 pcCU->setSDCFlagSubParts ( bBestUseSDC, uiPartOffset, uiDepth + uiInitTrDepth ); 3574 3532 #endif … … 3895 3853 iWidth, iHeight, m_pcEncCfg->getUseHADME() && (pcCU->getCUTransquantBypass(iPartIdx) == 0) ); 3896 3854 3897 #if NH_3D _IC3855 #if NH_3D 3898 3856 cDistParam.bUseIC = false; 3899 #endif3900 #if NH_3D_SDC_INTER3901 3857 cDistParam.bUseSDCMRSAD = false; 3902 3858 #endif … … 3907 3863 //! estimation of best merge coding 3908 3864 Void TEncSearch::xMergeEstimation( TComDataCU* pcCU, TComYuv* pcYuvOrg, Int iPUIdx, UInt& uiInterDir, TComMvField* pacMvField, UInt& uiMergeIndex, Distortion& ruiCost, TComMvField* cMvFieldNeighbours, UChar* uhInterDirNeighbours, Int& numValidMergeCand 3909 #if NH_3D_VSP 3910 , Int* vspFlag 3911 #endif 3912 #if NH_3D_SPIVMP 3913 , Bool* pbSPIVMPFlag, TComMvField* pcMvFieldSP, UChar* puhInterDirSP 3865 #if NH_3D 3866 , Int* vspFlag, Bool* pbSPIVMPFlag, TComMvField* pcMvFieldSP, UChar* puhInterDirSP 3914 3867 #endif 3915 3868 ) … … 3926 3879 UInt uiDepth = pcCU->getDepth( uiAbsPartIdx ); 3927 3880 3928 #if NH_3D _DBBP3881 #if NH_3D 3929 3882 DbbpTmpData* pDBBPTmpData = pcCU->getDBBPTmpData(); 3930 3883 if( pcCU->getDBBPFlag(0) ) … … 3958 3911 3959 3912 PartSize partSize = pcCU->getPartitionSize( 0 ); 3960 #if NH_3D _DBBP3913 #if NH_3D 3961 3914 if ( pcCU->getSlice()->getPPS()->getLog2ParallelMergeLevelMinus2() && partSize != SIZE_2Nx2N && pcCU->getWidth( 0 ) <= 8 && pcCU->getDBBPFlag(0) == false ) 3962 3915 #else … … 3967 3920 { 3968 3921 pcCU->setPartSizeSubParts( SIZE_2Nx2N, 0, uiDepth ); // temporarily set 3969 #if NH_3D _MLC3922 #if NH_3D 3970 3923 pcCU->initAvailableFlags(); 3924 #if MCTS_ENC_CHECK 3925 UInt numSpatialMergeCandidates = 0; 3926 pcCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, numSpatialMergeCandidates ); 3927 if (m_pcEncCfg->getTMCTSSEITileConstraint() && pcCU->isLastColumnCTUInTile()) 3928 { 3929 numValidMergeCand = numSpatialMergeCandidates; 3930 } 3931 #else 3971 3932 pcCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours,uhInterDirNeighbours, numValidMergeCand ); 3972 pcCU->xGetInterMergeCandidates( 0, 0, cMvFieldNeighbours,uhInterDirNeighbours 3973 #if NH_3D_SPIVMP 3974 , pcMvFieldSP, puhInterDirSP 3975 #endif 3976 , numValidMergeCand 3977 ); 3978 3979 pcCU->buildMCL( cMvFieldNeighbours,uhInterDirNeighbours 3980 #if NH_3D_VSP 3981 , vspFlag 3982 #endif 3983 #if NH_3D_SPIVMP 3984 , pbSPIVMPFlag 3985 #endif 3986 , numValidMergeCand 3987 ); 3933 #endif 3934 pcCU->xGetInterMergeCandidates( 0, 0, cMvFieldNeighbours,uhInterDirNeighbours , pcMvFieldSP, puhInterDirSP, numValidMergeCand ); 3935 pcCU->buildMCL( cMvFieldNeighbours,uhInterDirNeighbours , vspFlag, pbSPIVMPFlag, numValidMergeCand ); 3936 #else 3937 #if MCTS_ENC_CHECK 3938 UInt numSpatialMergeCandidates = 0; 3939 pcCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, numSpatialMergeCandidates ); 3940 if (m_pcEncCfg->getTMCTSSEITileConstraint() && pcCU->isLastColumnCTUInTile()) 3941 { 3942 numValidMergeCand = numSpatialMergeCandidates; 3943 } 3988 3944 #else 3989 3945 pcCU->getInterMergeCandidates( 0, 0, cMvFieldNeighbours,uhInterDirNeighbours, numValidMergeCand ); 3990 3946 #endif 3947 #endif 3991 3948 pcCU->setPartSizeSubParts( partSize, 0, uiDepth ); // restore 3992 3949 } … … 3994 3951 else 3995 3952 { 3996 #if NH_3D _MLC3953 #if NH_3D 3997 3954 pcCU->initAvailableFlags(); 3955 #if MCTS_ENC_CHECK 3956 UInt numSpatialMergeCandidates = 0; 3957 pcCU->getInterMergeCandidates( uiAbsPartIdx, iPUIdx, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, numSpatialMergeCandidates ); 3958 if (m_pcEncCfg->getTMCTSSEITileConstraint() && pcCU->isLastColumnCTUInTile()) 3959 { 3960 numValidMergeCand = numSpatialMergeCandidates; 3961 } 3962 #else 3998 3963 pcCU->getInterMergeCandidates( uiAbsPartIdx, iPUIdx, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand ); 3999 pcCU->xGetInterMergeCandidates( uiAbsPartIdx, iPUIdx, cMvFieldNeighbours, uhInterDirNeighbours 4000 #if NH_3D_SPIVMP 4001 , pcMvFieldSP, puhInterDirSP 4002 #endif 4003 , numValidMergeCand 4004 ); 4005 4006 pcCU->buildMCL( cMvFieldNeighbours, uhInterDirNeighbours 4007 #if NH_3D_VSP 4008 , vspFlag 4009 #endif 4010 #if NH_3D_SPIVMP 4011 , pbSPIVMPFlag 4012 #endif 4013 , numValidMergeCand 4014 ); 3964 #endif 3965 pcCU->xGetInterMergeCandidates( uiAbsPartIdx, iPUIdx, cMvFieldNeighbours, uhInterDirNeighbours, pcMvFieldSP, puhInterDirSP , numValidMergeCand ); 3966 pcCU->buildMCL( cMvFieldNeighbours, uhInterDirNeighbours , vspFlag, pbSPIVMPFlag, numValidMergeCand ); 3967 #else 3968 #if MCTS_ENC_CHECK 3969 UInt numSpatialMergeCandidates = 0; 3970 pcCU->getInterMergeCandidates( uiAbsPartIdx, iPUIdx, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, numSpatialMergeCandidates ); 3971 if (m_pcEncCfg->getTMCTSSEITileConstraint() && pcCU->isLastColumnCTUInTile()) 3972 { 3973 numValidMergeCand = numSpatialMergeCandidates; 3974 } 4015 3975 #else 4016 3976 pcCU->getInterMergeCandidates( uiAbsPartIdx, iPUIdx, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand ); 4017 3977 #endif 3978 #endif 4018 3979 } 4019 3980 4020 3981 xRestrictBipredMergeCand( pcCU, iPUIdx, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand ); 4021 3982 4022 #if NH_3D _DBBP3983 #if NH_3D 4023 3984 if( pcCU->getDBBPFlag(0) ) 4024 3985 { … … 4046 4007 4047 4008 PartSize ePartSize = pcCU->getPartitionSize( 0 ); 4048 #if NH_3D _VSP4009 #if NH_3D 4049 4010 pcCU->setVSPFlagSubParts( vspFlag[uiMergeCand], uiAbsPartIdx, iPUIdx, pcCU->getDepth( uiAbsPartIdx ) ); 4050 #endif 4051 4052 #if NH_3D_SPIVMP 4011 4053 4012 pcCU->setSPIVMPFlagSubParts( pbSPIVMPFlag[uiMergeCand], uiAbsPartIdx, iPUIdx, pcCU->getDepth( uiAbsPartIdx )); 4054 4013 if (pbSPIVMPFlag[uiMergeCand]) … … 4068 4027 } 4069 4028 else 4070 #endif4071 #if NH_3D_VSP4072 #if NH_3D_DBBP4073 4029 if ( vspFlag[uiMergeCand] && !pcCU->getDBBPFlag(0) ) 4074 #else4075 if ( vspFlag[uiMergeCand] )4076 #endif4077 4030 { 4078 4031 UInt partAddr; … … 4103 4056 { 4104 4057 #endif 4105 4106 pcCU->getCUMvField(REF_PIC_LIST_0)->setAllMvField( cMvFieldNeighbours[0 + 2*uiMergeCand], ePartSize, uiAbsPartIdx, 0, iPUIdx ); 4107 pcCU->getCUMvField(REF_PIC_LIST_1)->setAllMvField( cMvFieldNeighbours[1 + 2*uiMergeCand], ePartSize, uiAbsPartIdx, 0, iPUIdx ); 4108 #if NH_3D_VSP 4109 } 4110 #endif 4111 4112 4058 pcCU->getCUMvField(REF_PIC_LIST_0)->setAllMvField( cMvFieldNeighbours[0 + 2*uiMergeCand], ePartSize, uiAbsPartIdx, 0, iPUIdx ); 4059 pcCU->getCUMvField(REF_PIC_LIST_1)->setAllMvField( cMvFieldNeighbours[1 + 2*uiMergeCand], ePartSize, uiAbsPartIdx, 0, iPUIdx ); 4060 #if NH_3D 4061 } 4062 #endif 4113 4063 xGetInterPredictionError( pcCU, pcYuvOrg, iPUIdx, uiCostCand, m_pcEncCfg->getUseHADME() ); 4114 4064 uiBitsCand = uiMergeCand + 1; … … 4233 4183 Distortion biPDistTemp = std::numeric_limits<Distortion>::max(); 4234 4184 4235 #if NH_3D _IV_MERGE4185 #if NH_3D 4236 4186 TComMvField cMvFieldNeighbours[MRG_MAX_NUM_CANDS_MEM << 1]; // double length for mv of both lists 4237 4187 UChar uhInterDirNeighbours[MRG_MAX_NUM_CANDS_MEM]; … … 4272 4222 4273 4223 pcCU->getPartIndexAndSize( iPartIdx, uiPartAddr, iRoiWidth, iRoiHeight ); 4274 #if NH_3D _VSP4224 #if NH_3D 4275 4225 pcCU->setVSPFlagSubParts( 0, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr) ); 4276 4226 #endif … … 4629 4579 } // end if bTestNormalMC 4630 4580 #endif 4631 #if NH_3D _DBBP4581 #if NH_3D 4632 4582 // test merge mode for DBBP (2Nx2N) 4633 4583 if ( pcCU->getPartitionSize( uiPartAddr ) != SIZE_2Nx2N || pcCU->getDBBPFlag(0) ) … … 4672 4622 Distortion uiMRGCost = std::numeric_limits<Distortion>::max(); 4673 4623 4674 #if NH_3D _VSP4624 #if NH_3D 4675 4625 Int vspFlag[MRG_MAX_NUM_CANDS_MEM]; 4676 4626 memset(vspFlag, 0, sizeof(Int)*MRG_MAX_NUM_CANDS_MEM); … … 4680 4630 pcCU->getPartIndexAndSize( iPartIdx, uiAbsPartIdx, iWidth, iHeight ); 4681 4631 DisInfo OriginalDvInfo = pcCU->getDvInfo(uiAbsPartIdx); 4682 #endif 4683 #if NH_3D_SPIVMP 4632 4684 4633 Bool bSPIVMPFlag[MRG_MAX_NUM_CANDS_MEM]; 4685 4634 memset(bSPIVMPFlag, false, sizeof(Bool)*MRG_MAX_NUM_CANDS_MEM); … … 4690 4639 #endif 4691 4640 xMergeEstimation( pcCU, pcOrgYuv, iPartIdx, uiMRGInterDir, cMRGMvField, uiMRGIndex, uiMRGCost, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand 4692 #if NH_3D_VSP 4693 , vspFlag 4694 #endif 4695 #if NH_3D_SPIVMP 4696 , bSPIVMPFlag, pcMvFieldSP, puhInterDirSP 4641 #if NH_3D 4642 , vspFlag , bSPIVMPFlag, pcMvFieldSP, puhInterDirSP 4697 4643 #endif 4698 4644 ); … … 4703 4649 pcCU->setMergeFlagSubParts ( true, uiPartAddr, iPartIdx, pcCU->getDepth( uiPartAddr ) ); 4704 4650 pcCU->setMergeIndexSubParts( uiMRGIndex, uiPartAddr, iPartIdx, pcCU->getDepth( uiPartAddr ) ); 4705 #if NH_3D _VSP4651 #if NH_3D 4706 4652 pcCU->setVSPFlagSubParts( vspFlag[uiMRGIndex], uiPartAddr, iPartIdx, pcCU->getDepth( uiPartAddr ) ); 4707 #endif4708 #if NH_3D_SPIVMP4709 4653 pcCU->setSPIVMPFlagSubParts(bSPIVMPFlag[uiMRGIndex], uiPartAddr, iPartIdx, pcCU->getDepth( uiPartAddr ) ); 4710 4654 if (bSPIVMPFlag[uiMRGIndex]!=0) … … 4728 4672 } 4729 4673 else 4730 #endif 4731 #if NH_3D_VSP 4732 #if NH_3D_DBBP 4733 if ( vspFlag[uiMRGIndex] && !pcCU->getDBBPFlag(uiPartAddr) ) 4734 #else 4735 if ( vspFlag[uiMRGIndex] ) 4736 #endif 4737 { 4738 UInt partAddrTemp; 4739 Int vspSize; 4740 Int width, height; 4741 pcCU->getPartIndexAndSize( iPartIdx, partAddrTemp, width, height ); // true or pcCU->getTotalNumPart()==256 4742 if( uiMRGInterDir & 0x01 ) 4674 if ( vspFlag[uiMRGIndex] && !pcCU->getDBBPFlag(uiPartAddr) ) 4743 4675 { 4744 pcCU->setMvFieldPUForVSP( pcCU, partAddrTemp, width, height, REF_PIC_LIST_0, cMRGMvField[0].getRefIdx(), vspSize ); 4745 pcCU->setVSPFlag( partAddrTemp, vspSize ); 4676 UInt partAddrTemp; 4677 Int vspSize; 4678 Int width, height; 4679 pcCU->getPartIndexAndSize( iPartIdx, partAddrTemp, width, height ); // true or pcCU->getTotalNumPart()==256 4680 if( uiMRGInterDir & 0x01 ) 4681 { 4682 pcCU->setMvFieldPUForVSP( pcCU, partAddrTemp, width, height, REF_PIC_LIST_0, cMRGMvField[0].getRefIdx(), vspSize ); 4683 pcCU->setVSPFlag( partAddrTemp, vspSize ); 4684 } 4685 else 4686 { 4687 pcCU->getCUMvField( REF_PIC_LIST_0 )->setAllMvField( cMRGMvField[0], ePartSize, uiPartAddr, 0, iPartIdx ); 4688 } 4689 if( uiMRGInterDir & 0x02 ) 4690 { 4691 pcCU->setMvFieldPUForVSP( pcCU, partAddrTemp, width, height, REF_PIC_LIST_1, cMRGMvField[1].getRefIdx(), vspSize ); 4692 pcCU->setVSPFlag( partAddrTemp, vspSize ); 4693 } 4694 else 4695 { 4696 pcCU->getCUMvField( REF_PIC_LIST_1 )->setAllMvField( cMRGMvField[1], ePartSize, uiPartAddr, 0, iPartIdx ); 4697 } 4698 pcCU->setInterDirSubParts ( uiMRGInterDir, uiPartAddr, iPartIdx, pcCU->getDepth( uiPartAddr ) ); 4746 4699 } 4747 4700 else 4748 4701 { 4702 #endif 4703 pcCU->setInterDirSubParts ( uiMRGInterDir, uiPartAddr, iPartIdx, pcCU->getDepth( uiPartAddr ) ); 4749 4704 pcCU->getCUMvField( REF_PIC_LIST_0 )->setAllMvField( cMRGMvField[0], ePartSize, uiPartAddr, 0, iPartIdx ); 4705 pcCU->getCUMvField( REF_PIC_LIST_1 )->setAllMvField( cMRGMvField[1], ePartSize, uiPartAddr, 0, iPartIdx ); 4706 #if NH_3D 4750 4707 } 4751 if( uiMRGInterDir & 0x02 ) 4752 { 4753 pcCU->setMvFieldPUForVSP( pcCU, partAddrTemp, width, height, REF_PIC_LIST_1, cMRGMvField[1].getRefIdx(), vspSize ); 4754 pcCU->setVSPFlag( partAddrTemp, vspSize ); 4755 } 4756 else 4757 { 4758 pcCU->getCUMvField( REF_PIC_LIST_1 )->setAllMvField( cMRGMvField[1], ePartSize, uiPartAddr, 0, iPartIdx ); 4759 } 4760 pcCU->setInterDirSubParts ( uiMRGInterDir, uiPartAddr, iPartIdx, pcCU->getDepth( uiPartAddr ) ); 4761 } 4762 else 4763 { 4764 #endif 4765 pcCU->setInterDirSubParts ( uiMRGInterDir, uiPartAddr, iPartIdx, pcCU->getDepth( uiPartAddr ) ); 4766 pcCU->getCUMvField( REF_PIC_LIST_0 )->setAllMvField( cMRGMvField[0], ePartSize, uiPartAddr, 0, iPartIdx ); 4767 pcCU->getCUMvField( REF_PIC_LIST_1 )->setAllMvField( cMRGMvField[1], ePartSize, uiPartAddr, 0, iPartIdx ); 4768 #if NH_3D_VSP 4769 } 4770 #endif 4771 #if H_3D 4772 } 4773 #endif 4774 pcCU->getCUMvField(REF_PIC_LIST_0)->setAllMvd ( cMvZero, ePartSize, uiPartAddr, 0, iPartIdx ); 4775 pcCU->getCUMvField(REF_PIC_LIST_1)->setAllMvd ( cMvZero, ePartSize, uiPartAddr, 0, iPartIdx ); 4776 4777 pcCU->setMVPIdxSubParts( -1, REF_PIC_LIST_0, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr)); 4778 pcCU->setMVPNumSubParts( -1, REF_PIC_LIST_0, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr)); 4779 pcCU->setMVPIdxSubParts( -1, REF_PIC_LIST_1, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr)); 4780 pcCU->setMVPNumSubParts( -1, REF_PIC_LIST_1, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr)); 4708 #endif 4709 pcCU->getCUMvField(REF_PIC_LIST_0)->setAllMvd ( cMvZero, ePartSize, uiPartAddr, 0, iPartIdx ); 4710 pcCU->getCUMvField(REF_PIC_LIST_1)->setAllMvd ( cMvZero, ePartSize, uiPartAddr, 0, iPartIdx ); 4711 4712 pcCU->setMVPIdxSubParts( -1, REF_PIC_LIST_0, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr)); 4713 pcCU->setMVPNumSubParts( -1, REF_PIC_LIST_0, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr)); 4714 pcCU->setMVPIdxSubParts( -1, REF_PIC_LIST_1, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr)); 4715 pcCU->setMVPNumSubParts( -1, REF_PIC_LIST_1, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr)); 4781 4716 } 4782 4717 else 4783 4718 { 4784 #if NH_3D _SPIVMP4719 #if NH_3D 4785 4720 pcCU->setSPIVMPFlagSubParts(0, uiPartAddr, iPartIdx, pcCU->getDepth( uiPartAddr ) ); 4786 4721 #endif … … 4788 4723 pcCU->setMergeFlagSubParts( false, uiPartAddr, iPartIdx, pcCU->getDepth( uiPartAddr ) ); 4789 4724 pcCU->setInterDirSubParts ( uiMEInterDir, uiPartAddr, iPartIdx, pcCU->getDepth( uiPartAddr ) ); 4790 #if NH_3D _VSP4725 #if NH_3D 4791 4726 pcCU->setVSPFlagSubParts ( 0, uiPartAddr, iPartIdx, pcCU->getDepth( uiPartAddr ) ); 4792 4727 pcCU->setDvInfoSubParts(OriginalDvInfo, uiPartAddr, iPartIdx, pcCU->getDepth( uiPartAddr ) ); … … 4795 4730 pcCU->getCUMvField( REF_PIC_LIST_1 )->setAllMvField( cMEMvField[1], ePartSize, uiPartAddr, 0, iPartIdx ); 4796 4731 } 4797 #if NH_3D _SPIVMP4732 #if NH_3D 4798 4733 delete[] pcMvFieldSP; 4799 4734 delete[] puhInterDirSP; 4800 4735 #endif 4801 4736 } 4737 4738 #if MCTS_ENC_CHECK 4739 if (m_pcEncCfg->getTMCTSSEITileConstraint() && (!checkTMctsMvp(pcCU, iPartIdx))) 4740 { 4741 pcCU->setTMctsMvpIsValid(false); 4742 return; 4743 } 4744 #endif 4802 4745 4803 4746 // MC … … 4834 4777 Int iRoiWidth, iRoiHeight; 4835 4778 Int i; 4779 Int minMVPCand; 4780 Int maxMVPCand; 4836 4781 4837 4782 pcCU->getPartIndexAndSize( uiPartIdx, uiPartAddr, iRoiWidth, iRoiHeight ); … … 4840 4785 { 4841 4786 4842 #if NH_3D _DBBP4787 #if NH_3D 4843 4788 DbbpTmpData* pDBBPTmpData = pcCU->getDBBPTmpData(); 4844 4789 if( pcCU->getDBBPFlag(0) ) … … 4872 4817 4873 4818 pcCU->fillMvpCand( uiPartIdx, uiPartAddr, eRefPicList, iRefIdx, pcAMVPInfo ); 4874 #if NH_3D _DBBP4819 #if NH_3D 4875 4820 if( pcCU->getDBBPFlag(0) ) 4876 4821 { … … 4889 4834 4890 4835 // initialize Mvp index & Mvp 4836 #if MCTS_ENC_CHECK 4837 if (m_pcEncCfg->getTMCTSSEITileConstraint() && pcCU->isLastColumnCTUInTile() && (pcAMVPInfo->numSpatialMVPCandidates < pcAMVPInfo->iN)) 4838 { 4839 iBestIdx = (pcAMVPInfo->numSpatialMVPCandidates == 0) ? 1 : 0; 4840 cBestMv = pcAMVPInfo->m_acMvCand[(pcAMVPInfo->numSpatialMVPCandidates == 0) ? 1 : 0]; 4841 minMVPCand = (pcAMVPInfo->numSpatialMVPCandidates == 0) ? 1 : 0; 4842 maxMVPCand = (pcAMVPInfo->numSpatialMVPCandidates == 0) ? pcAMVPInfo->iN : 1; 4843 } 4844 else 4845 { 4846 iBestIdx = 0; 4847 cBestMv = pcAMVPInfo->m_acMvCand[0]; 4848 minMVPCand = 0; 4849 maxMVPCand = pcAMVPInfo->iN; 4850 } 4851 #else 4891 4852 iBestIdx = 0; 4892 4853 cBestMv = pcAMVPInfo->m_acMvCand[0]; 4854 minMVPCand = 0; 4855 maxMVPCand = pcAMVPInfo->iN; 4856 #endif 4857 4893 4858 if (pcAMVPInfo->iN <= 1) 4894 4859 { … … 4922 4887 m_cYuvPredTemp.clear(); 4923 4888 //-- Check Minimum Cost. 4924 for ( i = 0 ; i < pcAMVPInfo->iN; i++)4889 for ( i = minMVPCand ; i < maxMVPCand; i++) 4925 4890 { 4926 4891 #if NH_MV … … 5064 5029 Int iBestMvBits = iOrgMvBits; 5065 5030 5031 #if MCTS_ENC_CHECK 5032 Int minMVPCand = 0; 5033 Int maxMVPCand = pcAMVPInfo->iN; 5034 5035 if (m_pcEncCfg->getTMCTSSEITileConstraint() && pcCU->isLastColumnCTUInTile()) 5036 { 5037 minMVPCand = (pcAMVPInfo->numSpatialMVPCandidates == 0) ? 1 : 0; 5038 maxMVPCand = (pcAMVPInfo->numSpatialMVPCandidates == 0) ? pcAMVPInfo->iN : 1; 5039 } 5040 for (Int iMVPIdx = minMVPCand; iMVPIdx < maxMVPCand; iMVPIdx++) 5041 #else 5066 5042 for (Int iMVPIdx = 0; iMVPIdx < pcAMVPInfo->iN; iMVPIdx++) 5043 #endif 5067 5044 { 5068 5045 if (iMVPIdx == riMVPIdx) … … 5114 5091 pcCU->clipMv( cMvCand ); 5115 5092 5116 #if NH_3D _IC5093 #if NH_3D 5117 5094 Bool bICFlag = pcCU->getICFlag( uiPartAddr ) && ( pcCU->getSlice()->getViewIndex() != pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getViewIndex() ); 5118 5095 #endif … … 5122 5099 { 5123 5100 xPredInterBlk( COMPONENT_Y, pcCU, pcPicYuvRef, uiPartAddr, &cMvCand, iSizeX, iSizeY, pcTemplateCand, true, pcCU->getSlice()->getSPS()->getBitDepth(CHANNEL_TYPE_LUMA) 5124 #if NH_3D _ARP5101 #if NH_3D 5125 5102 , false //add this for IC, otherwise, it could be removed 5126 5103 #endif … … 5130 5107 { 5131 5108 xPredInterBlk( COMPONENT_Y, pcCU, pcPicYuvRef, uiPartAddr, &cMvCand, iSizeX, iSizeY, pcTemplateCand, false, pcCU->getSlice()->getSPS()->getBitDepth(CHANNEL_TYPE_LUMA) 5132 #if NH_3D_ARP 5133 , false 5134 #endif 5135 #if NH_3D_IC 5136 , bICFlag 5137 #endif 5138 5109 #if NH_3D 5110 , false, bICFlag 5111 #endif 5139 5112 ); 5140 5113 } … … 5175 5148 5176 5149 Int iSrchRng = ( bBi ? m_bipredSearchRange : m_iSearchRange ); 5177 TComPattern tmpPattern; 5178 TComPattern* pcPatternKey = &tmpPattern; 5150 TComPattern cPattern; 5179 5151 5180 5152 Double fWeight = 1.0; … … 5182 5154 pcCU->getPartIndexAndSize( iPartIdx, uiPartAddr, iRoiWidth, iRoiHeight ); 5183 5155 5184 #if NH_3D _IC5156 #if NH_3D 5185 5157 Bool bICFlag = pcCU->getICFlag( uiPartAddr ) && ( pcCU->getSlice()->getViewIndex() != pcCU->getSlice()->getRefPic( eRefPicList, iRefIdxPred )->getViewIndex() ); 5186 pcPatternKey->setICFlag( bICFlag ); 5187 #endif 5188 #if NH_3D_SDC_INTER 5189 pcPatternKey->setSDCMRSADFlag( pcCU->getSlice()->getInterSdcFlag() ); 5158 cPattern.setICFlag( bICFlag ); 5159 cPattern.setSDCMRSADFlag( pcCU->getSlice()->getInterSdcFlag() ); 5190 5160 #endif 5191 5161 … … 5204 5174 5205 5175 // Search key pattern initialization 5206 pcPatternKey->initPattern( pcYuv->getAddr ( COMPONENT_Y, uiPartAddr ), 5176 #if MCTS_ENC_CHECK 5177 Int roiPosX, roiPosY; 5178 Int roiW, roiH; 5179 pcCU->getPartPosition(iPartIdx, roiPosX, roiPosY, roiW, roiH); 5180 assert(roiW == iRoiWidth); 5181 assert(roiH == iRoiHeight); 5182 cPattern.initPattern( pcYuv->getAddr(COMPONENT_Y, uiPartAddr), 5183 iRoiWidth, 5184 iRoiHeight, 5185 pcYuv->getStride(COMPONENT_Y), 5186 pcCU->getSlice()->getSPS()->getBitDepth(CHANNEL_TYPE_LUMA), 5187 roiPosX, 5188 roiPosY); 5189 xInitTileBorders(pcCU, &cPattern); 5190 #else 5191 cPattern.initPattern( pcYuv->getAddr ( COMPONENT_Y, uiPartAddr ), 5207 5192 iRoiWidth, 5208 5193 iRoiHeight, 5209 5194 pcYuv->getStride(COMPONENT_Y), 5210 5195 pcCU->getSlice()->getSPS()->getBitDepth(CHANNEL_TYPE_LUMA) ); 5211 5196 #endif 5212 5197 Pel* piRefY = pcCU->getSlice()->getRefPic( eRefPicList, iRefIdxPred )->getPicYuvRec()->getAddr( COMPONENT_Y, pcCU->getCtuRsAddr(), pcCU->getZorderIdxInCtu() + uiPartAddr ); 5213 5198 Int iRefStride = pcCU->getSlice()->getRefPic( eRefPicList, iRefIdxPred )->getPicYuvRec()->getStride(COMPONENT_Y); … … 5220 5205 if ( bBi ) 5221 5206 { 5207 #if MCTS_ENC_CHECK 5208 xSetSearchRange(pcCU, rcMv, iSrchRng, cMvSrchRngLT, cMvSrchRngRB, &cPattern); 5209 #else 5222 5210 xSetSearchRange ( pcCU, rcMv , iSrchRng, cMvSrchRngLT, cMvSrchRngRB ); 5211 #endif 5223 5212 } 5224 5213 else 5225 5214 { 5215 #if MCTS_ENC_CHECK 5216 xSetSearchRange(pcCU, cMvPred, iSrchRng, cMvSrchRngLT, cMvSrchRngRB, &cPattern); 5217 #else 5226 5218 xSetSearchRange ( pcCU, cMvPred, iSrchRng, cMvSrchRngLT, cMvSrchRngRB ); 5219 #endif 5227 5220 } 5228 5221 … … 5230 5223 5231 5224 m_pcRdCost->setPredictor ( *pcMvPred ); 5232 #if NH_3D _INTEGER_MV_DEPTH5225 #if NH_3D 5233 5226 if( pcCU->getSlice()->getIsDepth() ) 5234 5227 { … … 5239 5232 #endif 5240 5233 m_pcRdCost->setCostScale ( 2 ); 5241 #if NH_3D _INTEGER_MV_DEPTH5234 #if NH_3D 5242 5235 } 5243 5236 #endif … … 5248 5241 if ( (m_motionEstimationSearchMethod==MESEARCH_FULL) || bBi ) 5249 5242 { 5250 xPatternSearch ( pcPatternKey, piRefY, iRefStride, &cMvSrchRngLT, &cMvSrchRngRB, rcMv, ruiCost );5243 xPatternSearch ( &cPattern, piRefY, iRefStride, &cMvSrchRngLT, &cMvSrchRngRB, rcMv, ruiCost ); 5251 5244 } 5252 5245 else 5253 5246 { 5254 5247 rcMv = *pcMvPred; 5255 #if NH_MV _FIX_VERT_MV_REST5248 #if NH_MV 5256 5249 if ( m_vertRestriction ) 5257 5250 { … … 5267 5260 pIntegerMv2Nx2NPred = &(m_integerMv2Nx2N[eRefPicList][iRefIdxPred]); 5268 5261 } 5269 xPatternSearchFast ( pcCU, pcPatternKey, piRefY, iRefStride, &cMvSrchRngLT, &cMvSrchRngRB, rcMv, ruiCost, pIntegerMv2Nx2NPred );5262 xPatternSearchFast ( pcCU, &cPattern, piRefY, iRefStride, &cMvSrchRngLT, &cMvSrchRngRB, rcMv, ruiCost, pIntegerMv2Nx2NPred ); 5270 5263 if (pcCU->getPartitionSize(0) == SIZE_2Nx2N) 5271 5264 { … … 5275 5268 5276 5269 m_pcRdCost->selectMotionLambda( true, 0, pcCU->getCUTransquantBypass(uiPartAddr) ); 5277 #if NH_3D _INTEGER_MV_DEPTH5270 #if NH_3D 5278 5271 if( ! pcCU->getSlice()->getIsDepth() ) 5279 5272 { 5280 5273 #endif 5281 m_pcRdCost->setCostScale ( 1 );5282 5283 const Bool bIsLosslessCoded = pcCU->getCUTransquantBypass(uiPartAddr) != 0;5284 xPatternSearchFracDIF( bIsLosslessCoded, pcPatternKey, piRefY, iRefStride, &rcMv, cMvHalf, cMvQter, ruiCost );5285 5286 m_pcRdCost->setCostScale( 0 );5287 rcMv <<= 2;5288 rcMv += (cMvHalf <<= 1);5289 rcMv += cMvQter;5290 #if NH_3D _INTEGER_MV_DEPTH5274 m_pcRdCost->setCostScale ( 1 ); 5275 5276 const Bool bIsLosslessCoded = pcCU->getCUTransquantBypass(uiPartAddr) != 0; 5277 xPatternSearchFracDIF( bIsLosslessCoded, &cPattern, piRefY, iRefStride, &rcMv, cMvHalf, cMvQter, ruiCost ); 5278 5279 m_pcRdCost->setCostScale( 0 ); 5280 rcMv <<= 2; 5281 rcMv += (cMvHalf <<= 1); 5282 rcMv += cMvQter; 5283 #if NH_3D 5291 5284 } 5292 5285 #endif 5293 5286 5294 5287 UInt uiMvBits = m_pcRdCost->getBitsOfVectorWithPredictor( rcMv.getHor(), rcMv.getVer() ); 5295 #if NH_3D _INTEGER_MV_DEPTH5288 #if NH_3D 5296 5289 if( pcCU->getSlice()->getIsDepth() ) 5297 5290 { … … 5308 5301 } 5309 5302 5303 #if MCTS_ENC_CHECK 5304 Void TEncSearch::xInitTileBorders(const TComDataCU* const pcCU, TComPattern* pcPatternKey) 5305 { 5306 if (m_pcEncCfg->getTMCTSSEITileConstraint()) 5307 { 5308 UInt tileXPosInCtus = 0; 5309 UInt tileYPosInCtus = 0; 5310 UInt tileWidthtInCtus = 0; 5311 UInt tileHeightInCtus = 0; 5312 5313 getTilePosition(pcCU, tileXPosInCtus, tileYPosInCtus, tileWidthtInCtus, tileHeightInCtus); 5314 5315 const Int ctuLength = pcCU->getPic()->getPicSym()->getSPS().getMaxCUWidth(); 5316 5317 // tile position in full pels 5318 const Int tileLeftTopPelPosX = ctuLength * tileXPosInCtus; 5319 const Int tileLeftTopPelPosY = ctuLength * tileYPosInCtus; 5320 const Int tileRightBottomPelPosX = ((tileWidthtInCtus + tileXPosInCtus) * ctuLength) - 1; 5321 const Int tileRightBottomPelPosY = ((tileHeightInCtus + tileYPosInCtus) * ctuLength) - 1; 5322 5323 pcPatternKey->setTileBorders (tileLeftTopPelPosX,tileLeftTopPelPosY,tileRightBottomPelPosX,tileRightBottomPelPosY); 5324 } 5325 } 5326 #endif 5310 5327 5311 5328 Void TEncSearch::xSetSearchRange ( const TComDataCU* const pcCU, const TComMv& cMvPred, const Int iSrchRng, 5329 #if MCTS_ENC_CHECK 5330 TComMv& rcMvSrchRngLT, TComMv& rcMvSrchRngRB, const TComPattern* const pcPatternKey ) 5331 #else 5312 5332 TComMv& rcMvSrchRngLT, TComMv& rcMvSrchRngRB ) 5333 #endif 5313 5334 { 5314 5335 Int iMvShift = 2; 5315 #if NH_3D _INTEGER_MV_DEPTH5336 #if NH_3D 5316 5337 if( pcCU->getSlice()->getIsDepth() ) 5317 5338 { … … 5322 5343 pcCU->clipMv( cTmpMvPred ); 5323 5344 5345 #if MCTS_ENC_CHECK 5346 if (m_pcEncCfg->getTMCTSSEITileConstraint()) 5347 { 5348 const Int lRangeXLeft = max(cTmpMvPred.getHor() - (iSrchRng << iMvShift), (pcPatternKey->getTileLeftTopPelPosX() - pcPatternKey->getROIYPosX()) << iMvShift); 5349 const Int lRangeYTop = max(cTmpMvPred.getVer() - (iSrchRng << iMvShift), (pcPatternKey->getTileLeftTopPelPosY() - pcPatternKey->getROIYPosY()) << iMvShift); 5350 const Int lRangeXRight = min(cTmpMvPred.getHor() + (iSrchRng << iMvShift), (pcPatternKey->getTileRightBottomPelPosX() - (pcPatternKey->getROIYPosX() + pcPatternKey->getROIYWidth())) << iMvShift); 5351 const Int lRangeYBottom = min(cTmpMvPred.getVer() + (iSrchRng << iMvShift), (pcPatternKey->getTileRightBottomPelPosY() - (pcPatternKey->getROIYPosY() + pcPatternKey->getROIYHeight())) << iMvShift); 5352 5353 rcMvSrchRngLT.setHor(lRangeXLeft); 5354 rcMvSrchRngLT.setVer(lRangeYTop); 5355 5356 rcMvSrchRngRB.setHor(lRangeXRight); 5357 rcMvSrchRngRB.setVer(lRangeYBottom); 5358 } 5359 else 5360 { 5361 rcMvSrchRngLT.setHor(cTmpMvPred.getHor() - (iSrchRng << iMvShift)); 5362 rcMvSrchRngLT.setVer(cTmpMvPred.getVer() - (iSrchRng << iMvShift)); 5363 5364 rcMvSrchRngRB.setHor( cTmpMvPred.getHor() + (iSrchRng << iMvShift)); 5365 rcMvSrchRngRB.setVer( cTmpMvPred.getVer() + (iSrchRng << iMvShift) ); 5366 } 5367 #else 5324 5368 rcMvSrchRngLT.setHor( cTmpMvPred.getHor() - (iSrchRng << iMvShift) ); 5325 5369 rcMvSrchRngLT.setVer( cTmpMvPred.getVer() - (iSrchRng << iMvShift) ); … … 5327 5371 rcMvSrchRngRB.setHor( cTmpMvPred.getHor() + (iSrchRng << iMvShift) ); 5328 5372 rcMvSrchRngRB.setVer( cTmpMvPred.getVer() + (iSrchRng << iMvShift) ); 5329 5373 #endif 5330 5374 #if NH_MV 5331 5375 if ( m_vertRestriction ) … … 5394 5438 m_cDistParam.bitDepth = pcPatternKey->getBitDepthY(); 5395 5439 5396 #if NH_3D _IC5440 #if NH_3D 5397 5441 m_cDistParam.bUseIC = pcPatternKey->getICFlag(); 5398 #endif5399 #if NH_3D_SDC_INTER5400 5442 m_cDistParam.bUseSDCMRSAD = pcPatternKey->getSDCMRSADFlag(); 5401 5443 #endif … … 5500 5542 UInt uiSearchRange = m_iSearchRange; 5501 5543 pcCU->clipMv( rcMv ); 5502 #if NH_3D _INTEGER_MV_DEPTH5544 #if NH_3D 5503 5545 if( ! pcCU->getSlice()->getIsDepth() ) 5504 5546 #endif … … 5525 5567 TComMv cMv = m_acMvPredictors[index]; 5526 5568 pcCU->clipMv( cMv ); 5527 #if NH_3D _INTEGER_MV_DEPTH5569 #if NH_3D 5528 5570 if( ! pcCU->getSlice()->getIsDepth() ) 5529 5571 { 5530 5572 #endif 5531 5573 #if ME_ENABLE_ROUNDING_OF_MVS 5532 cMv.divideByPowerOf2(2);5574 cMv.divideByPowerOf2(2); 5533 5575 #else 5534 cMv >>= 2;5535 #endif 5536 5537 #if NH_3D _INTEGER_MV_DEPTH5576 cMv >>= 2; 5577 #endif 5578 5579 #if NH_3D 5538 5580 } 5539 5581 #endif … … 5585 5627 TComMv currBestMv(cStruct.iBestX, cStruct.iBestY ); 5586 5628 currBestMv <<= 2; 5629 #if MCTS_ENC_CHECK 5630 xSetSearchRange(pcCU, currBestMv, iSrchRng, cMvSrchRngLT, cMvSrchRngRB, pcPatternKey); 5631 #else 5587 5632 xSetSearchRange( pcCU, currBestMv, iSrchRng, cMvSrchRngLT, cMvSrchRngRB ); 5633 #endif 5588 5634 iSrchRngHorLeft = cMvSrchRngLT.getHor(); 5589 5635 iSrchRngHorRight = cMvSrchRngRB.getHor(); … … 5875 5921 TComMv currBestMv(cStruct.iBestX, cStruct.iBestY ); 5876 5922 currBestMv <<= 2; 5923 #if MCTS_ENC_CHECK 5924 xSetSearchRange(pcCU, currBestMv, iSrchRng, cMvSrchRngLT, cMvSrchRngRB, pcPatternKey); 5925 #else 5877 5926 xSetSearchRange( pcCU, currBestMv, iSrchRng, cMvSrchRngLT, cMvSrchRngRB ); 5927 #endif 5878 5928 iSrchRngHorLeft = cMvSrchRngLT.getHor(); 5879 5929 iSrchRngHorRight = cMvSrchRngRB.getHor(); … … 5976 6026 pcPatternKey->getROIYHeight(), 5977 6027 iRefStride, 6028 #if MCTS_ENC_CHECK 6029 pcPatternKey->getBitDepthY(), 6030 pcPatternKey->getROIYPosX(), 6031 pcPatternKey->getROIYPosY()); 6032 #else 5978 6033 pcPatternKey->getBitDepthY()); 6034 #endif 6035 #if MCTS_ENC_CHECK 6036 cPatternRoi.setTileBorders(pcPatternKey->getTileLeftTopPelPosX(), pcPatternKey->getTileLeftTopPelPosY(), pcPatternKey->getTileRightBottomPelPosX(), pcPatternKey->getTileRightBottomPelPosY()); 6037 #endif 5979 6038 5980 6039 // Half-pel refinement … … 6052 6111 m_pcEntropyCoder->resetBits(); 6053 6112 6054 if (pcCU->getSlice()->getPPS()->getTransquantBypassEnable Flag())6113 if (pcCU->getSlice()->getPPS()->getTransquantBypassEnabledFlag()) 6055 6114 { 6056 6115 m_pcEntropyCoder->encodeCUTransquantBypassFlag(pcCU, 0, true); … … 6059 6118 m_pcEntropyCoder->encodeSkipFlag(pcCU, 0, true); 6060 6119 m_pcEntropyCoder->encodeMergeIndex( pcCU, 0, true ); 6061 #if NH_3D _ARP6120 #if NH_3D 6062 6121 m_pcEntropyCoder->encodeARPW( pcCU, 0 ); 6063 #endif6064 #if NH_3D_IC6065 6122 m_pcEntropyCoder->encodeICFlag( pcCU, 0, true ); 6066 6123 #endif … … 6176 6233 const Double zeroCost = (pcCU->isLosslessCoded( 0 )) ? (nonZeroCost+1) : (m_pcRdCost->calcRdCost( zeroResiBits, zeroDistortion )); 6177 6234 #endif 6178 #if NH_3D _SPIVMP6235 #if NH_3D 6179 6236 if ( zeroCost < nonZeroCost || pcCU->getQtRootCbf(0)==0) 6180 6237 #else … … 6272 6329 } 6273 6330 6274 #if NH_3D _SDC_INTER6331 #if NH_3D 6275 6332 Void TEncSearch::encodeResAndCalcRdInterSDCCU( TComDataCU* pcCU, TComYuv* pcOrg, TComYuv* pcPred, TComYuv* pcResi, TComYuv* pcRec, Int uiOffest, const UInt uiDepth ) 6276 6333 { … … 6600 6657 if ((compID != COMPONENT_Cr) && ((transformSkipModeId == 1) ? m_pcEncCfg->getUseRDOQTS() : m_pcEncCfg->getUseRDOQ())) 6601 6658 { 6602 m_pcEntropyCoder->estimateBit(m_pcTrQuant->m_pcEstBitsSbac, tuCompRect.width, tuCompRect.height, toChannelType(compID)); 6659 COEFF_SCAN_TYPE scanType = COEFF_SCAN_TYPE(pcCU->getCoefScanIdx(uiAbsPartIdx, tuCompRect.width, tuCompRect.height, compID)); 6660 m_pcEntropyCoder->estimateBit(m_pcTrQuant->m_pcEstBitsSbac, tuCompRect.width, tuCompRect.height, toChannelType(compID), scanType); 6603 6661 } 6604 6662 … … 7365 7423 // Reload only contexts required for coding intra mode information 7366 7424 m_pcRDGoOnSbacCoder->loadIntraDirMode( m_pppcRDSbacCoder[uiDepth][CI_CURR_BEST], chType ); 7367 #if NH_3D _DMM7425 #if NH_3D 7368 7426 if( pcCU->getSlice()->getIsDepth() && isLuma(chType) ) 7369 7427 { … … 7442 7500 7443 7501 m_pcEntropyCoder->resetBits(); 7444 if(pcCU->getSlice()->getPPS()->getTransquantBypassEnable Flag())7502 if(pcCU->getSlice()->getPPS()->getTransquantBypassEnabledFlag()) 7445 7503 { 7446 7504 m_pcEntropyCoder->encodeCUTransquantBypassFlag(pcCU, 0, true); … … 7448 7506 m_pcEntropyCoder->encodeSkipFlag(pcCU, 0, true); 7449 7507 m_pcEntropyCoder->encodeMergeIndex(pcCU, 0, true); 7450 #if NH_3D _ARP7508 #if NH_3D 7451 7509 m_pcEntropyCoder->encodeARPW( pcCU, 0 ); 7452 #endif7453 #if NH_3D_IC7454 7510 m_pcEntropyCoder->encodeICFlag( pcCU, 0, true ); 7455 7511 #endif … … 7460 7516 m_pcEntropyCoder->resetBits(); 7461 7517 7462 if(pcCU->getSlice()->getPPS()->getTransquantBypassEnable Flag())7518 if(pcCU->getSlice()->getPPS()->getTransquantBypassEnabledFlag()) 7463 7519 { 7464 7520 m_pcEntropyCoder->encodeCUTransquantBypassFlag(pcCU, 0, true); … … 7466 7522 7467 7523 m_pcEntropyCoder->encodeSkipFlag ( pcCU, 0, true ); 7468 #if NH_3D _DIS7524 #if NH_3D 7469 7525 m_pcEntropyCoder->encodeDIS ( pcCU, 0, true ); 7470 7526 #endif … … 7472 7528 m_pcEntropyCoder->encodePartSize( pcCU, 0, pcCU->getDepth(0), true ); 7473 7529 m_pcEntropyCoder->encodePredInfo( pcCU, 0 ); 7474 #if NH_3D _SDC_INTRA7530 #if NH_3D 7475 7531 m_pcEntropyCoder->encodeSDCFlag( pcCU, 0, true ); 7476 #endif7477 #if NH_3D_ARP7478 7532 m_pcEntropyCoder->encodeARPW( pcCU , 0 ); 7479 #endif7480 #if NH_3D_IC7481 7533 m_pcEntropyCoder->encodeICFlag( pcCU, 0, true ); 7482 #endif7483 #if NH_3D_DBBP7484 7534 m_pcEntropyCoder->encodeDBBPFlag( pcCU, 0, true ); 7485 7535 #endif … … 7752 7802 } 7753 7803 7754 #if NH_3D _DMM7804 #if NH_3D 7755 7805 // ------------------------------------------------------------------------------------------------------------------- 7756 7806 // Depth intra search … … 7907 7957 #endif 7908 7958 7909 #if NH_3D_DLT7910 7959 rDeltaDC1 = pcCU->getSlice()->getPPS()->getDLT()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), ClipBD(predDC1 + rDeltaDC1, bitDepthY )) - pcCU->getSlice()->getPPS()->getDLT()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), predDC1 ); 7911 7960 rDeltaDC2 = pcCU->getSlice()->getPPS()->getDLT()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), ClipBD(predDC2 + rDeltaDC2, bitDepthY )) - pcCU->getSlice()->getPPS()->getDLT()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), predDC2 ); 7912 #endif7913 7961 } 7914 7962 … … 8027 8075 } 8028 8076 8029 #endif8030 #if NH_3D_SDC_INTRA8031 8077 Void TEncSearch::xCalcConstantSDC( Pel* ptrSrc, UInt srcStride, UInt uiSize, Pel& valDC ) 8032 8078 {
Note: See TracChangeset for help on using the changeset viewer.