Changeset 1187 in 3DVCSoftware for branches/HTM-14.0-dev0/source/Lib/TLibEncoder/TEncSearch.cpp
- Timestamp:
- 8 Apr 2015, 15:26:52 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HTM-14.0-dev0/source/Lib/TLibEncoder/TEncSearch.cpp
r1185 r1187 976 976 { 977 977 m_pcEntropyCoder->encodeIntraDirModeLuma ( pcCU, uiPart * uiQNumParts ); 978 #if H_3D_ SDC978 #if H_3D_DIM_SDC 979 979 } 980 980 m_pcEntropyCoder->encodeSDCFlag( pcCU, 0, true ); … … 2211 2211 // encode pred direction + DC residual data 2212 2212 m_pcEntropyCoder->encodePredInfo( pcCU, 0, true ); 2213 #if H_3D_ SDC2213 #if H_3D_DIM_SDC 2214 2214 m_pcEntropyCoder->encodeSDCFlag( pcCU, 0, true ); 2215 2215 #endif … … 3016 3016 pcCU->getPattern()->initPattern ( pcCU, uiInitTrDepth, uiPartOffset ); 3017 3017 pcCU->getPattern()->initAdiPattern( pcCU, uiPartOffset, uiInitTrDepth, m_piYuvExt, m_iYuvExtStride, m_iYuvExtHeight, bAboveAvail, bLeftAvail ); 3018 3018 3019 3019 //===== determine set of modes to be tested (using prediction signal only) ===== 3020 3020 Int numModesAvailable = 35; //total number of Intra modes … … 3024 3024 UInt uiRdModeList[FAST_UDI_MAX_RDMODE_NUM]; 3025 3025 Int numModesForFullRD = g_aucIntraModeNumFast[ uiWidthBit ]; 3026 3026 3027 3027 #if H_3D_DIM 3028 3028 if( bOnlyIVP ) … … 3033 3033 { 3034 3034 #endif 3035 Bool doFastSearch = (numModesForFullRD != numModesAvailable);3036 if (doFastSearch)3037 {3038 assert(numModesForFullRD < numModesAvailable);3039 3040 for( Int i=0; i < numModesForFullRD; i++ )3041 {3042 CandCostList[ i ] = MAX_DOUBLE;3043 }3044 CandNum = 0;3045 3046 for( Int modeIdx = 0; modeIdx < numModesAvailable; modeIdx++ )3047 {3048 UInt uiMode = modeIdx;3049 3050 predIntraLumaAng( pcCU->getPattern(), uiMode, piPred, uiStride, uiWidth, uiHeight, bAboveAvail, bLeftAvail );3035 Bool doFastSearch = (numModesForFullRD != numModesAvailable); 3036 if (doFastSearch) 3037 { 3038 assert(numModesForFullRD < numModesAvailable); 3039 3040 for( Int i=0; i < numModesForFullRD; i++ ) 3041 { 3042 CandCostList[ i ] = MAX_DOUBLE; 3043 } 3044 CandNum = 0; 3045 3046 for( Int modeIdx = 0; modeIdx < numModesAvailable; modeIdx++ ) 3047 { 3048 UInt uiMode = modeIdx; 3049 3050 predIntraLumaAng( pcCU->getPattern(), uiMode, piPred, uiStride, uiWidth, uiHeight, bAboveAvail, bLeftAvail ); 3051 3051 #if H_3D_VSO // M34 3052 Dist uiSad; 3053 if ( m_pcRdCost->getUseVSO() ) 3054 { 3055 if ( m_pcRdCost->getUseEstimatedVSD() ) 3056 { 3057 uiSad = (Dist) ( m_pcRdCost->getDistPartVSD( pcCU, uiPartOffset, piPred, uiStride, piOrg, uiStride, uiWidth, uiHeight, true ) ); 3052 Dist uiSad; 3053 if ( m_pcRdCost->getUseVSO() ) 3054 { 3055 if ( m_pcRdCost->getUseEstimatedVSD() ) 3056 { 3057 uiSad = (Dist) ( m_pcRdCost->getDistPartVSD( pcCU, uiPartOffset, piPred, uiStride, piOrg, uiStride, uiWidth, uiHeight, true ) ); 3058 } 3059 else 3060 { 3061 uiSad = m_pcRdCost->getDistPartVSO(pcCU, uiPartOffset, piPred, uiStride, piOrg, uiStride, uiWidth, uiHeight, true ); 3062 } 3058 3063 } 3059 3064 else 3060 { 3061 uiSad = m_pcRdCost-> getDistPartVSO(pcCU, uiPartOffset, piPred, uiStride, piOrg, uiStride, uiWidth, uiHeight, true);3065 { 3066 uiSad = m_pcRdCost->calcHAD(g_bitDepthY, piOrg, uiStride, piPred, uiStride, uiWidth, uiHeight ); 3062 3067 } 3063 }3064 else3065 {3066 uiSad = m_pcRdCost->calcHAD(g_bitDepthY, piOrg, uiStride, piPred, uiStride, uiWidth, uiHeight );3067 }3068 3068 #else 3069 // use hadamard transform here3070 UInt uiSad = m_pcRdCost->calcHAD(g_bitDepthY, piOrg, uiStride, piPred, uiStride, uiWidth, uiHeight );3071 #endif 3072 3073 UInt iModeBits = xModeBitsIntra( pcCU, uiMode, uiPU, uiPartOffset, uiDepth, uiInitTrDepth );3069 // use hadamard transform here 3070 UInt uiSad = m_pcRdCost->calcHAD(g_bitDepthY, piOrg, uiStride, piPred, uiStride, uiWidth, uiHeight ); 3071 #endif 3072 3073 UInt iModeBits = xModeBitsIntra( pcCU, uiMode, uiPU, uiPartOffset, uiDepth, uiInitTrDepth ); 3074 3074 #if H_3D_VSO // M35 3075 Double dLambda;3076 if ( m_pcRdCost->getUseLambdaScaleVSO() )3077 {3078 dLambda = m_pcRdCost->getUseRenModel() ? m_pcRdCost->getLambdaVSO() : m_pcRdCost->getSqrtLambdaVSO();3079 }3080 else3081 {3082 dLambda = m_pcRdCost->getSqrtLambda();3083 }3084 3085 Double cost = (Double)uiSad + (Double)iModeBits * dLambda;3075 Double dLambda; 3076 if ( m_pcRdCost->getUseLambdaScaleVSO() ) 3077 { 3078 dLambda = m_pcRdCost->getUseRenModel() ? m_pcRdCost->getLambdaVSO() : m_pcRdCost->getSqrtLambdaVSO(); 3079 } 3080 else 3081 { 3082 dLambda = m_pcRdCost->getSqrtLambda(); 3083 } 3084 3085 Double cost = (Double)uiSad + (Double)iModeBits * dLambda; 3086 3086 #else 3087 Double cost = (Double)uiSad + (Double)iModeBits * m_pcRdCost->getSqrtLambda();3088 #endif 3089 3090 CandNum += xUpdateCandList( uiMode, cost, numModesForFullRD, uiRdModeList, CandCostList );3091 }3092 3087 Double cost = (Double)uiSad + (Double)iModeBits * m_pcRdCost->getSqrtLambda(); 3088 #endif 3089 3090 CandNum += xUpdateCandList( uiMode, cost, numModesForFullRD, uiRdModeList, CandCostList ); 3091 } 3092 3093 3093 #if FAST_UDI_USE_MPM 3094 Int uiPreds[3] = {-1, -1, -1}; 3095 Int iMode = -1; 3096 Int numCand = pcCU->getIntraDirLumaPredictor( uiPartOffset, uiPreds, &iMode ); 3097 if( iMode >= 0 ) 3098 { 3099 numCand = iMode; 3100 } 3101 3102 for( Int j=0; j < numCand; j++) 3103 3104 { 3105 Bool mostProbableModeIncluded = false; 3106 Int mostProbableMode = uiPreds[j]; 3107 3094 Int uiPreds[3] = {-1, -1, -1}; 3095 Int iMode = -1; 3096 Int numCand = pcCU->getIntraDirLumaPredictor( uiPartOffset, uiPreds, &iMode ); 3097 if( iMode >= 0 ) 3098 { 3099 numCand = iMode; 3100 } 3101 3102 for( Int j=0; j < numCand; j++) 3103 3104 { 3105 Bool mostProbableModeIncluded = false; 3106 Int mostProbableMode = uiPreds[j]; 3107 3108 for( Int i=0; i < numModesForFullRD; i++) 3109 { 3110 mostProbableModeIncluded |= (mostProbableMode == uiRdModeList[i]); 3111 } 3112 if (!mostProbableModeIncluded) 3113 { 3114 uiRdModeList[numModesForFullRD++] = mostProbableMode; 3115 } 3116 } 3117 #endif // FAST_UDI_USE_MPM 3118 } 3119 else 3120 { 3108 3121 for( Int i=0; i < numModesForFullRD; i++) 3109 3122 { 3110 mostProbableModeIncluded |= (mostProbableMode == uiRdModeList[i]); 3111 } 3112 if (!mostProbableModeIncluded) 3113 { 3114 uiRdModeList[numModesForFullRD++] = mostProbableMode; 3115 } 3116 } 3117 #endif // FAST_UDI_USE_MPM 3118 } 3119 else 3120 { 3121 for( Int i=0; i < numModesForFullRD; i++) 3122 { 3123 uiRdModeList[i] = i; 3124 } 3125 } 3123 uiRdModeList[i] = i; 3124 } 3125 } 3126 3126 #if H_3D_DIM 3127 3127 } 3128 3128 #endif 3129 3129 3130 3130 #if H_3D_DIM 3131 3131 //===== determine set of depth intra modes to be tested ===== … … 3148 3148 { 3149 3149 #if H_3D_FAST_DEPTH_INTRA 3150 Int threshold = max(((pcCU->getQP(0))>>3)-1,3);3151 Int varThreshold = (Int)( threshold * threshold - 8 );3152 UInt varCU = m_pcRdCost->calcVAR(piOrg, uiStride, uiWidth,uiHeight,pcCU->getDepth(0));3150 Int threshold = max(((pcCU->getQP(0))>>3)-1,3); 3151 Int varThreshold = (Int)( threshold * threshold - 8 ); 3152 UInt varCU = m_pcRdCost->calcVAR(piOrg, uiStride, uiWidth,uiHeight,pcCU->getDepth(0)); 3153 3153 #endif 3154 3154 3155 3155 #if H_3D_DIM_DMM 3156 if( ( ( m_pcEncCfg->getUseDMM() && pcCU->getSlice()->getIntraSdcWedgeFlag() ) || pcCU->getSlice()->getIntraContourFlag() )3156 if( ( ( m_pcEncCfg->getUseDMM() && pcCU->getSlice()->getIntraSdcWedgeFlag() ) || pcCU->getSlice()->getIntraContourFlag() ) 3157 3157 #if H_3D_FAST_DEPTH_INTRA 3158 && (uiRdModeList[0] != PLANAR_IDX || varCU >= varThreshold)3159 #endif 3160 )3161 {3162 UInt uiStart, uiEnd;3163 if( ( m_pcEncCfg->getUseDMM() && pcCU->getSlice()->getIntraSdcWedgeFlag() ) && pcCU->getSlice()->getIntraContourFlag() )3164 {3165 uiStart = 0;3166 uiEnd = 2;3167 }3168 else if( ( m_pcEncCfg->getUseDMM() && pcCU->getSlice()->getIntraSdcWedgeFlag() ) )3169 {3170 uiStart = 0;3171 uiEnd = 1;3172 }3173 else if( pcCU->getSlice()->getIntraContourFlag() )3174 {3175 uiStart = 1;3176 uiEnd = 2;3177 }3178 else3179 {3180 uiStart = 0;3181 uiEnd = 0;3182 }3183 for( UInt dmmType = uiStart; dmmType < uiEnd; dmmType++ )3184 {3158 && (uiRdModeList[0] != PLANAR_IDX || varCU >= varThreshold) 3159 #endif 3160 ) 3161 { 3162 UInt uiStart, uiEnd; 3163 if( ( m_pcEncCfg->getUseDMM() && pcCU->getSlice()->getIntraSdcWedgeFlag() ) && pcCU->getSlice()->getIntraContourFlag() ) 3164 { 3165 uiStart = 0; 3166 uiEnd = 2; 3167 } 3168 else if( ( m_pcEncCfg->getUseDMM() && pcCU->getSlice()->getIntraSdcWedgeFlag() ) ) 3169 { 3170 uiStart = 0; 3171 uiEnd = 1; 3172 } 3173 else if( pcCU->getSlice()->getIntraContourFlag() ) 3174 { 3175 uiStart = 1; 3176 uiEnd = 2; 3177 } 3178 else 3179 { 3180 uiStart = 0; 3181 uiEnd = 0; 3182 } 3183 for( UInt dmmType = uiStart; dmmType < uiEnd; dmmType++ ) 3184 { 3185 3185 #if H_3D_FCO 3186 3186 TComPic* picTexture = pcCU->getSlice()->getIvPic(false, pcCU->getSlice()->getViewIndex() ); … … 3191 3191 #endif 3192 3192 { 3193 3193 continue; 3194 3194 } 3195 3195 #endif 3196 UInt uiTabIdx = 0; 3197 TComWedgelet* biSegmentation = NULL; 3198 Pel deltaDC1 = 0; Pel deltaDC2 = 0; 3199 switch( dmmType ) 3200 { 3201 case( DMM1_IDX ): 3196 UInt uiTabIdx = 0; 3197 TComWedgelet* biSegmentation = NULL; 3198 Pel deltaDC1 = 0; Pel deltaDC2 = 0; 3199 switch( dmmType ) 3202 3200 { 3203 xSearchDmm1Wedge( pcCU, uiPartOffset, piOrg, uiStride, uiWidth, uiHeight, uiTabIdx ); 3204 pcCU->setDmmWedgeTabIdxSubParts( uiTabIdx, dmmType, uiPartOffset, uiDepth + uiInitTrDepth ); 3205 biSegmentation = pcCU->isDMM1UpscaleMode( uiWidth ) ? 3201 case( DMM1_IDX ): 3202 { 3203 xSearchDmm1Wedge( pcCU, uiPartOffset, piOrg, uiStride, uiWidth, uiHeight, uiTabIdx ); 3204 pcCU->setDmmWedgeTabIdxSubParts( uiTabIdx, dmmType, uiPartOffset, uiDepth + uiInitTrDepth ); 3205 biSegmentation = pcCU->isDMM1UpscaleMode( uiWidth ) ? 3206 3206 &(g_dmmWedgeLists[(g_aucConvertToBit[pcCU->getDMM1BasePatternWidth(uiWidth)])][uiTabIdx]) : &(g_dmmWedgeLists[(g_aucConvertToBit[uiWidth])][uiTabIdx]); 3207 } break; 3208 3209 case( DMM4_IDX ): 3207 } break; 3208 3209 case( DMM4_IDX ): 3210 { 3211 { 3212 biSegmentation = new TComWedgelet( uiWidth, uiHeight ); 3213 xPredContourFromTex( pcCU, uiPartOffset, uiWidth, uiHeight, biSegmentation ); 3214 } 3215 } break; 3216 default: assert(0); 3217 } 3218 3219 if( biSegmentation ) 3210 3220 { 3221 if( dmmType == DMM1_IDX && pcCU->isDMM1UpscaleMode( uiWidth ) ){ 3222 xSearchDmmDeltaDCs( pcCU, uiPartOffset, piOrg, piPred, uiStride, biSegmentation->getScaledPattern(uiWidth), uiWidth, uiWidth, uiHeight, deltaDC1, deltaDC2 ); 3223 } 3224 else 3211 3225 { 3212 biSegmentation = new TComWedgelet( uiWidth, uiHeight ); 3213 xPredContourFromTex( pcCU, uiPartOffset, uiWidth, uiHeight, biSegmentation ); 3226 xSearchDmmDeltaDCs( pcCU, uiPartOffset, piOrg, piPred, uiStride, biSegmentation->getPattern(), biSegmentation->getStride(), uiWidth, uiHeight, deltaDC1, deltaDC2 ); 3214 3227 } 3215 } break; 3216 default: assert(0); 3228 pcCU->setDimDeltaDC( dmmType, 0, uiPartOffset, deltaDC1 ); 3229 pcCU->setDimDeltaDC( dmmType, 1, uiPartOffset, deltaDC2 ); 3230 3231 uiRdModeList[ numModesForFullRD++ ] = (dmmType +DIM_OFFSET); 3232 if( DMM4_IDX == dmmType ) { biSegmentation->destroy(); delete biSegmentation; } 3233 } 3217 3234 } 3218 3219 if( biSegmentation ) 3220 { 3221 if( dmmType == DMM1_IDX && pcCU->isDMM1UpscaleMode( uiWidth ) ){ 3222 xSearchDmmDeltaDCs( pcCU, uiPartOffset, piOrg, piPred, uiStride, biSegmentation->getScaledPattern(uiWidth), uiWidth, uiWidth, uiHeight, deltaDC1, deltaDC2 ); 3223 } 3224 else 3225 { 3226 xSearchDmmDeltaDCs( pcCU, uiPartOffset, piOrg, piPred, uiStride, biSegmentation->getPattern(), biSegmentation->getStride(), uiWidth, uiHeight, deltaDC1, deltaDC2 ); 3227 } 3228 pcCU->setDimDeltaDC( dmmType, 0, uiPartOffset, deltaDC1 ); 3229 pcCU->setDimDeltaDC( dmmType, 1, uiPartOffset, deltaDC2 ); 3230 3231 uiRdModeList[ numModesForFullRD++ ] = (dmmType +DIM_OFFSET); 3232 if( DMM4_IDX == dmmType ) { biSegmentation->destroy(); delete biSegmentation; } 3233 } 3234 } 3235 } 3235 } 3236 3236 #if H_3D_DIM 3237 3237 } … … 3245 3245 Double dSecondBestPUCost = MAX_DOUBLE; 3246 3246 #endif 3247 3247 3248 3248 UInt uiBestPUMode = 0; 3249 3249 #if H_3D_FAST_INTRA_SDC … … 3279 3279 // set luma prediction mode 3280 3280 #if !H_3D_FAST_INTRA_SDC 3281 UInt uiOrgMode = uiRdModeList[uiMode];3282 #endif 3283 3281 UInt uiOrgMode = uiRdModeList[uiMode]; 3282 #endif 3283 3284 3284 #if H_3D_FAST_INTRA_SDC 3285 3285 UInt uiOrgMode; 3286 3286 if (uiMode < numModesForFullRD) 3287 3287 { 3288 3288 uiOrgMode = uiRdModeList[uiMode]; 3289 3289 } 3290 3290 else 3291 3291 { 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3292 uiOrgMode = uiRdModeList[uiMode - numModesForFullRD]; 3293 3294 if (uiBestPUModeConv <= 1 ) 3295 { 3296 if (uiOrgMode > 1 && varCU < 1) continue; 3297 } 3298 else 3299 { 3300 if (uiOrgMode != uiBestPUModeConv && uiOrgMode != uiSecondBestPUModeConv && uiOrgMode != uiThirdBestPUModeConv 3301 && uiOrgMode > 1 && uiOrgMode < NUM_INTRA_MODE && varCU < 4) 3302 continue; 3303 } 3304 } 3305 3305 #endif 3306 3306 3307 3307 pcCU->setLumaIntraDirSubParts ( uiOrgMode, uiPartOffset, uiDepth + uiInitTrDepth ); 3308 3308 3309 3309 #if H_3D_DIM_SDC 3310 3310 #if H_3D_FAST_INTRA_SDC … … 3313 3313 Bool bTestSDC = ( m_pcEncCfg->getUseSDC() && pcCU->getSDCAvailable(uiPartOffset) ); 3314 3314 #endif 3315 3315 3316 3316 for( UInt uiSDC=0; uiSDC<=(bTestSDC?1:0); uiSDC++ ) 3317 3317 { … … 3352 3352 } 3353 3353 #endif 3354 3354 3355 3355 #if H_3D_DIM_ENC || H_3D_DIM_SDC 3356 Bool bTestZeroResi = false;3356 Bool bTestZeroResi = false; 3357 3357 #if H_3D_DIM_ENC 3358 bTestZeroResi |= pcCU->getSlice()->getIsDepth() && !pcCU->getSlice()->isIRAP();3358 bTestZeroResi |= pcCU->getSlice()->getIsDepth() && !pcCU->getSlice()->isIRAP(); 3359 3359 #endif 3360 3360 #if H_3D_DIM_SDC 3361 bTestZeroResi |= pcCU->getSDCFlag(uiPartOffset);3362 #endif 3363 if( uiSDC != 0 && iSDCDeltaResi != 0 )3364 {3365 bTestZeroResi = false;3366 }3367 #endif 3368 3361 bTestZeroResi |= pcCU->getSDCFlag(uiPartOffset); 3362 #endif 3363 if( uiSDC != 0 && iSDCDeltaResi != 0 ) 3364 { 3365 bTestZeroResi = false; 3366 } 3367 #endif 3368 3369 3369 #if H_3D_DIM_ENC || H_3D_DIM_SDC 3370 for( UInt testZeroResi = 0; testZeroResi <= (bTestZeroResi ? 1 : 0) ; testZeroResi++ )3371 {3372 #endif 3373 // set context models3374 m_pcRDGoOnSbacCoder->load( m_pppcRDSbacCoder[uiDepth][CI_CURR_BEST] );3375 3376 // determine residual for partition3370 for( UInt testZeroResi = 0; testZeroResi <= (bTestZeroResi ? 1 : 0) ; testZeroResi++ ) 3371 { 3372 #endif 3373 // set context models 3374 m_pcRDGoOnSbacCoder->load( m_pppcRDSbacCoder[uiDepth][CI_CURR_BEST] ); 3375 3376 // determine residual for partition 3377 3377 #if H_3D_VSO 3378 Dist uiPUDistY = 0;3378 Dist uiPUDistY = 0; 3379 3379 #else 3380 UInt uiPUDistY = 0;3381 #endif 3382 UInt uiPUDistC = 0;3383 Double dPUCost = 0.0;3380 UInt uiPUDistY = 0; 3381 #endif 3382 UInt uiPUDistC = 0; 3383 Double dPUCost = 0.0; 3384 3384 #if H_3D_VSO // M36 3385 if( m_pcRdCost->getUseRenModel() )3386 {3387 m_pcRdCost->setRenModelData( pcCU, uiPartOffset, piOrg, uiStride, uiWidth, uiHeight );3388 }3385 if( m_pcRdCost->getUseRenModel() ) 3386 { 3387 m_pcRdCost->setRenModelData( pcCU, uiPartOffset, piOrg, uiStride, uiWidth, uiHeight ); 3388 } 3389 3389 #endif 3390 3390 #if H_3D_DIM_SDC 3391 if( pcCU->getSDCFlag(uiPartOffset) )3392 {3393 pcCU->setTrIdxSubParts(0, uiPartOffset, uiDepth + uiInitTrDepth);3394 pcCU->setCbfSubParts(1, 1, 1, uiPartOffset, uiDepth + uiInitTrDepth);3395 3396 // start encoding with SDC3397 xIntraCodingSDC(pcCU, uiPartOffset, pcOrgYuv, pcPredYuv, uiPUDistY, dPUCost, ( testZeroResi != 0 ), iSDCDeltaResi );3398 if ( testZeroResi == 0 && iOffset <= 3 )3399 {3400 dOffsetCost [iOffset -1] = dPUCost;3401 }3402 }3403 else3404 {3391 if( pcCU->getSDCFlag(uiPartOffset) ) 3392 { 3393 pcCU->setTrIdxSubParts(0, uiPartOffset, uiDepth + uiInitTrDepth); 3394 pcCU->setCbfSubParts(1, 1, 1, uiPartOffset, uiDepth + uiInitTrDepth); 3395 3396 // start encoding with SDC 3397 xIntraCodingSDC(pcCU, uiPartOffset, pcOrgYuv, pcPredYuv, uiPUDistY, dPUCost, ( testZeroResi != 0 ), iSDCDeltaResi ); 3398 if ( testZeroResi == 0 && iOffset <= 3 ) 3399 { 3400 dOffsetCost [iOffset -1] = dPUCost; 3401 } 3402 } 3403 else 3404 { 3405 3405 #endif 3406 3406 #if HHI_RQT_INTRA_SPEEDUP 3407 3407 #if H_3D_DIM_ENC 3408 xRecurIntraCodingQT( pcCU, uiInitTrDepth, uiPartOffset, bLumaOnly, pcOrgYuv, pcPredYuv, pcResiYuv, uiPUDistY, uiPUDistC, true, dPUCost, (testZeroResi != 0) );3408 xRecurIntraCodingQT( pcCU, uiInitTrDepth, uiPartOffset, bLumaOnly, pcOrgYuv, pcPredYuv, pcResiYuv, uiPUDistY, uiPUDistC, true, dPUCost, (testZeroResi != 0) ); 3409 3409 #if H_3D_FAST_INTRA_SDC 3410 if( dPUCost < dBestPUCostConv )3411 {3412 uiThirdBestPUModeConv = uiSecondBestPUModeConv;3413 uiSecondBestPUModeConv = uiBestPUModeConv;3414 uiBestPUModeConv = uiOrgMode;3415 dBestPUCostConv = dPUCost;3416 }3410 if( dPUCost < dBestPUCostConv ) 3411 { 3412 uiThirdBestPUModeConv = uiSecondBestPUModeConv; 3413 uiSecondBestPUModeConv = uiBestPUModeConv; 3414 uiBestPUModeConv = uiOrgMode; 3415 dBestPUCostConv = dPUCost; 3416 } 3417 3417 #endif 3418 3418 #else 3419 xRecurIntraCodingQT( pcCU, uiInitTrDepth, uiPartOffset, bLumaOnly, pcOrgYuv, pcPredYuv, pcResiYuv, uiPUDistY, uiPUDistC, true, dPUCost );3419 xRecurIntraCodingQT( pcCU, uiInitTrDepth, uiPartOffset, bLumaOnly, pcOrgYuv, pcPredYuv, pcResiYuv, uiPUDistY, uiPUDistC, true, dPUCost ); 3420 3420 #endif 3421 3421 #else 3422 3422 #if H_3D_DIM_ENC 3423 xRecurIntraCodingQT( pcCU, uiInitTrDepth, uiPartOffset, bLumaOnly, pcOrgYuv, pcPredYuv, pcResiYuv, uiPUDistY, uiPUDistC, dPUCost, (testZeroResi != 0) );3423 xRecurIntraCodingQT( pcCU, uiInitTrDepth, uiPartOffset, bLumaOnly, pcOrgYuv, pcPredYuv, pcResiYuv, uiPUDistY, uiPUDistC, dPUCost, (testZeroResi != 0) ); 3424 3424 #else 3425 xRecurIntraCodingQT( pcCU, uiInitTrDepth, uiPartOffset, bLumaOnly, pcOrgYuv, pcPredYuv, pcResiYuv, uiPUDistY, uiPUDistC, dPUCost );3425 xRecurIntraCodingQT( pcCU, uiInitTrDepth, uiPartOffset, bLumaOnly, pcOrgYuv, pcPredYuv, pcResiYuv, uiPUDistY, uiPUDistC, dPUCost ); 3426 3426 #endif 3427 3427 #endif 3428 3428 #if H_3D_DIM_SDC 3429 }3430 #endif 3431 3432 // check r-d cost3433 if( dPUCost < dBestPUCost )3434 {3429 } 3430 #endif 3431 3432 // check r-d cost 3433 if( dPUCost < dBestPUCost ) 3434 { 3435 3435 #if HHI_RQT_INTRA_SPEEDUP_MOD 3436 uiSecondBestMode = uiBestPUMode;3437 dSecondBestPUCost = dBestPUCost;3438 #endif 3439 uiBestPUMode = uiOrgMode;3440 uiBestPUDistY = uiPUDistY;3441 uiBestPUDistC = uiPUDistC;3442 dBestPUCost = dPUCost;3436 uiSecondBestMode = uiBestPUMode; 3437 dSecondBestPUCost = dBestPUCost; 3438 #endif 3439 uiBestPUMode = uiOrgMode; 3440 uiBestPUDistY = uiPUDistY; 3441 uiBestPUDistC = uiPUDistC; 3442 dBestPUCost = dPUCost; 3443 3443 3444 3444 #if H_3D_DIM_SDC 3445 if( pcCU->getSDCFlag(uiPartOffset) ) 3446 { 3447 bBestUseSDC = true; 3448 3449 // copy reconstruction 3450 pcPredYuv->copyPartToPartYuv(pcRecoYuv, uiPartOffset, uiWidth, uiHeight); 3451 3452 // copy DC values 3453 apBestDCOffsets[0] = pcCU->getSDCSegmentDCOffset(0, uiPartOffset); 3454 apBestDCOffsets[1] = pcCU->getSDCSegmentDCOffset(1, uiPartOffset); 3445 if( pcCU->getSDCFlag(uiPartOffset) ) 3446 { 3447 bBestUseSDC = true; 3448 3449 // copy reconstruction 3450 pcPredYuv->copyPartToPartYuv(pcRecoYuv, uiPartOffset, uiWidth, uiHeight); 3451 3452 // copy DC values 3453 apBestDCOffsets[0] = pcCU->getSDCSegmentDCOffset(0, uiPartOffset); 3454 apBestDCOffsets[1] = pcCU->getSDCSegmentDCOffset(1, uiPartOffset); 3455 } 3456 else 3457 { 3458 bBestUseSDC = false; 3459 #endif 3460 xSetIntraResultQT( pcCU, uiInitTrDepth, uiPartOffset, bLumaOnly, pcRecoYuv ); 3461 3462 UInt uiQPartNum = pcCU->getPic()->getNumPartInCU() >> ( ( pcCU->getDepth(0) + uiInitTrDepth ) << 1 ); 3463 ::memcpy( m_puhQTTempTrIdx, pcCU->getTransformIdx() + uiPartOffset, uiQPartNum * sizeof( UChar ) ); 3464 ::memcpy( m_puhQTTempCbf[0], pcCU->getCbf( TEXT_LUMA ) + uiPartOffset, uiQPartNum * sizeof( UChar ) ); 3465 ::memcpy( m_puhQTTempCbf[1], pcCU->getCbf( TEXT_CHROMA_U ) + uiPartOffset, uiQPartNum * sizeof( UChar ) ); 3466 ::memcpy( m_puhQTTempCbf[2], pcCU->getCbf( TEXT_CHROMA_V ) + uiPartOffset, uiQPartNum * sizeof( UChar ) ); 3467 ::memcpy( m_puhQTTempTransformSkipFlag[0], pcCU->getTransformSkip(TEXT_LUMA) + uiPartOffset, uiQPartNum * sizeof( UChar ) ); 3468 ::memcpy( m_puhQTTempTransformSkipFlag[1], pcCU->getTransformSkip(TEXT_CHROMA_U) + uiPartOffset, uiQPartNum * sizeof( UChar ) ); 3469 ::memcpy( m_puhQTTempTransformSkipFlag[2], pcCU->getTransformSkip(TEXT_CHROMA_V) + uiPartOffset, uiQPartNum * sizeof( UChar ) ); 3470 #if H_3D_DIM_SDC 3471 } 3472 #endif 3473 } 3474 #if HHI_RQT_INTRA_SPEEDUP_MOD 3475 else if( dPUCost < dSecondBestPUCost ) 3476 { 3477 uiSecondBestMode = uiOrgMode; 3478 dSecondBestPUCost = dPUCost; 3479 } 3480 #endif 3481 #if H_3D_DIM_ENC || H_3D_DIM_SDC 3455 3482 } 3456 else3457 {3458 bBestUseSDC = false;3459 #endif3460 xSetIntraResultQT( pcCU, uiInitTrDepth, uiPartOffset, bLumaOnly, pcRecoYuv );3461 3462 UInt uiQPartNum = pcCU->getPic()->getNumPartInCU() >> ( ( pcCU->getDepth(0) + uiInitTrDepth ) << 1 );3463 ::memcpy( m_puhQTTempTrIdx, pcCU->getTransformIdx() + uiPartOffset, uiQPartNum * sizeof( UChar ) );3464 ::memcpy( m_puhQTTempCbf[0], pcCU->getCbf( TEXT_LUMA ) + uiPartOffset, uiQPartNum * sizeof( UChar ) );3465 ::memcpy( m_puhQTTempCbf[1], pcCU->getCbf( TEXT_CHROMA_U ) + uiPartOffset, uiQPartNum * sizeof( UChar ) );3466 ::memcpy( m_puhQTTempCbf[2], pcCU->getCbf( TEXT_CHROMA_V ) + uiPartOffset, uiQPartNum * sizeof( UChar ) );3467 ::memcpy( m_puhQTTempTransformSkipFlag[0], pcCU->getTransformSkip(TEXT_LUMA) + uiPartOffset, uiQPartNum * sizeof( UChar ) );3468 ::memcpy( m_puhQTTempTransformSkipFlag[1], pcCU->getTransformSkip(TEXT_CHROMA_U) + uiPartOffset, uiQPartNum * sizeof( UChar ) );3469 ::memcpy( m_puhQTTempTransformSkipFlag[2], pcCU->getTransformSkip(TEXT_CHROMA_V) + uiPartOffset, uiQPartNum * sizeof( UChar ) );3470 #if H_3D_DIM_SDC3471 }3472 #endif3473 }3474 #if HHI_RQT_INTRA_SPEEDUP_MOD3475 else if( dPUCost < dSecondBestPUCost )3476 {3477 uiSecondBestMode = uiOrgMode;3478 dSecondBestPUCost = dPUCost;3479 }3480 #endif3481 #if H_3D_DIM_ENC || H_3D_DIM_SDC3482 }3483 3483 } // SDC residual loop 3484 3484 #endif … … 3487 3487 #endif 3488 3488 } // Mode loop 3489 3489 3490 3490 #if HHI_RQT_INTRA_SPEEDUP 3491 3491 #if HHI_RQT_INTRA_SPEEDUP_MOD … … 3502 3502 UInt uiOrgMode = uiBestPUMode; 3503 3503 #endif 3504 3504 3505 3505 pcCU->setLumaIntraDirSubParts ( uiOrgMode, uiPartOffset, uiDepth + uiInitTrDepth ); 3506 3506 #if H_3D_DIM_SDC 3507 3507 pcCU->setSDCFlagSubParts(false, uiPartOffset, uiDepth + uiInitTrDepth); 3508 3508 #endif 3509 3509 3510 3510 // set context models 3511 3512 3511 m_pcRDGoOnSbacCoder->load( m_pppcRDSbacCoder[uiDepth][CI_CURR_BEST] ); 3512 3513 3513 // determine residual for partition 3514 3514 #if H_3D_VSO … … 3527 3527 #endif 3528 3528 xRecurIntraCodingQT( pcCU, uiInitTrDepth, uiPartOffset, bLumaOnly, pcOrgYuv, pcPredYuv, pcResiYuv, uiPUDistY, uiPUDistC, false, dPUCost ); 3529 3529 3530 3530 // check r-d cost 3531 3531 if( dPUCost < dBestPUCost ) … … 3538 3538 bBestUseSDC = false; 3539 3539 #endif 3540 3540 3541 3541 xSetIntraResultQT( pcCU, uiInitTrDepth, uiPartOffset, bLumaOnly, pcRecoYuv ); 3542 3542 3543 3543 UInt uiQPartNum = pcCU->getPic()->getNumPartInCU() >> ( ( pcCU->getDepth(0) + uiInitTrDepth ) << 1 ); 3544 3544 ::memcpy( m_puhQTTempTrIdx, pcCU->getTransformIdx() + uiPartOffset, uiQPartNum * sizeof( UChar ) ); … … 3552 3552 } // Mode loop 3553 3553 #endif 3554 3554 3555 3555 //--- update overall distortion --- 3556 3556 uiOverallDistY += uiBestPUDistY; 3557 3557 uiOverallDistC += uiBestPUDistC; 3558 3558 3559 3559 #if H_3D_DIM_SDC 3560 3560 if( bBestUseSDC ) … … 3562 3562 pcCU->setTrIdxSubParts(0, uiPartOffset, uiDepth + uiInitTrDepth); 3563 3563 pcCU->setCbfSubParts(1, 1, 1, uiPartOffset, uiDepth + uiInitTrDepth); 3564 3564 3565 3565 //=== copy best DC segment values back to CU ==== 3566 3566 pcCU->setSDCSegmentDCOffset(apBestDCOffsets[0], 0, uiPartOffset); … … 3570 3570 { 3571 3571 #endif 3572 3573 UInt uiQPartNum = pcCU->getPic()->getNumPartInCU() >> ( ( pcCU->getDepth(0) + uiInitTrDepth ) << 1 );3574 ::memcpy( pcCU->getTransformIdx() + uiPartOffset, m_puhQTTempTrIdx, uiQPartNum * sizeof( UChar ) );3575 ::memcpy( pcCU->getCbf( TEXT_LUMA ) + uiPartOffset, m_puhQTTempCbf[0], uiQPartNum * sizeof( UChar ) );3576 ::memcpy( pcCU->getCbf( TEXT_CHROMA_U ) + uiPartOffset, m_puhQTTempCbf[1], uiQPartNum * sizeof( UChar ) );3577 ::memcpy( pcCU->getCbf( TEXT_CHROMA_V ) + uiPartOffset, m_puhQTTempCbf[2], uiQPartNum * sizeof( UChar ) );3578 ::memcpy( pcCU->getTransformSkip(TEXT_LUMA) + uiPartOffset, m_puhQTTempTransformSkipFlag[0], uiQPartNum * sizeof( UChar ) );3579 ::memcpy( pcCU->getTransformSkip(TEXT_CHROMA_U) + uiPartOffset, m_puhQTTempTransformSkipFlag[1], uiQPartNum * sizeof( UChar ) );3580 ::memcpy( pcCU->getTransformSkip(TEXT_CHROMA_V) + uiPartOffset, m_puhQTTempTransformSkipFlag[2], uiQPartNum * sizeof( UChar ) );3572 //--- update transform index and cbf --- 3573 UInt uiQPartNum = pcCU->getPic()->getNumPartInCU() >> ( ( pcCU->getDepth(0) + uiInitTrDepth ) << 1 ); 3574 ::memcpy( pcCU->getTransformIdx() + uiPartOffset, m_puhQTTempTrIdx, uiQPartNum * sizeof( UChar ) ); 3575 ::memcpy( pcCU->getCbf( TEXT_LUMA ) + uiPartOffset, m_puhQTTempCbf[0], uiQPartNum * sizeof( UChar ) ); 3576 ::memcpy( pcCU->getCbf( TEXT_CHROMA_U ) + uiPartOffset, m_puhQTTempCbf[1], uiQPartNum * sizeof( UChar ) ); 3577 ::memcpy( pcCU->getCbf( TEXT_CHROMA_V ) + uiPartOffset, m_puhQTTempCbf[2], uiQPartNum * sizeof( UChar ) ); 3578 ::memcpy( pcCU->getTransformSkip(TEXT_LUMA) + uiPartOffset, m_puhQTTempTransformSkipFlag[0], uiQPartNum * sizeof( UChar ) ); 3579 ::memcpy( pcCU->getTransformSkip(TEXT_CHROMA_U) + uiPartOffset, m_puhQTTempTransformSkipFlag[1], uiQPartNum * sizeof( UChar ) ); 3580 ::memcpy( pcCU->getTransformSkip(TEXT_CHROMA_V) + uiPartOffset, m_puhQTTempTransformSkipFlag[2], uiQPartNum * sizeof( UChar ) ); 3581 3581 #if H_3D_DIM_SDC 3582 3582 } … … 3594 3594 bChromaSame = true; 3595 3595 } 3596 3596 3597 3597 UInt uiCompWidth = pcCU->getWidth ( 0 ) >> uiInitTrDepth; 3598 3598 UInt uiCompHeight = pcCU->getHeight( 0 ) >> uiInitTrDepth; … … 3646 3646 } 3647 3647 } 3648 3648 3649 3649 //=== update PU data ==== 3650 3650 pcCU->setLumaIntraDirSubParts ( uiBestPUMode, uiPartOffset, uiDepth + uiInitTrDepth ); … … 3974 3974 3975 3975 #if H_3D_DBBP 3976 D BBPTmpData* pDBBPTmpData = pcCU->getDBBPTmpData();3976 DbbpTmpData* pDBBPTmpData = pcCU->getDBBPTmpData(); 3977 3977 if( pcCU->getDBBPFlag(0) ) 3978 3978 { … … 4964 4964 { 4965 4965 #if H_3D_DBBP 4966 D BBPTmpData* pDBBPTmpData = pcCU->getDBBPTmpData();4966 DbbpTmpData* pDBBPTmpData = pcCU->getDBBPTmpData(); 4967 4967 if( pcCU->getDBBPFlag(0) ) 4968 4968 { … … 5326 5326 5327 5327 #if H_MV 5328 Bool bMv_VRng_Restricted = false;5328 Bool motVecVertRngRestricted = false; 5329 5329 if( m_pcEncCfg->getUseDisparitySearchRangeRestriction() 5330 5330 && … … 5332 5332 ) 5333 5333 { 5334 bMv_VRng_Restricted = true;5335 } 5336 if ( bBi ) xSetSearchRange ( pcCU, rcMv , iSrchRng, cMvSrchRngLT, cMvSrchRngRB, bMv_VRng_Restricted, m_pcEncCfg->getVerticalDisparitySearchRange() );5337 else xSetSearchRange ( pcCU, cMvPred, iSrchRng, cMvSrchRngLT, cMvSrchRngRB, bMv_VRng_Restricted, m_pcEncCfg->getVerticalDisparitySearchRange() );5334 motVecVertRngRestricted = true; 5335 } 5336 if ( bBi ) xSetSearchRange ( pcCU, rcMv , iSrchRng, cMvSrchRngLT, cMvSrchRngRB, motVecVertRngRestricted, m_pcEncCfg->getVerticalDisparitySearchRange() ); 5337 else xSetSearchRange ( pcCU, cMvPred, iSrchRng, cMvSrchRngLT, cMvSrchRngRB, motVecVertRngRestricted, m_pcEncCfg->getVerticalDisparitySearchRange() ); 5338 5338 #else 5339 5339 if ( bBi ) xSetSearchRange ( pcCU, rcMv , iSrchRng, cMvSrchRngLT, cMvSrchRngRB ); … … 5523 5523 if( ! pcCU->getSlice()->getIsDepth() ) 5524 5524 #endif 5525 rcMv >>= 2;5525 rcMv >>= 2; 5526 5526 // init TZSearchStruct 5527 5527 IntTZSearchStruct cStruct;
Note: See TracChangeset for help on using the changeset viewer.