Changeset 1397 in SHVCSoftware
- Timestamp:
- 4 Aug 2015, 03:26:38 (9 years ago)
- Location:
- branches/SHM-dev/source/Lib
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/SHM-dev/source/Lib/TLibCommon/TComRdCost.cpp
r1395 r1397 194 194 // initialize 195 195 rcDistParam.iSubShift = 0; 196 rcDistParam.m_maximumDistortionForEarlyExit = std::numeric_limits<Distortion>::max(); 196 197 } 197 198 … … 210 211 rcDistParam.iRows = pcPatternKey->getROIYHeight(); 211 212 rcDistParam.DistFunc = m_afpDistortFunc[DF_SAD + g_aucConvertToBit[ rcDistParam.iCols ] + 1 ]; 213 rcDistParam.m_maximumDistortionForEarlyExit = std::numeric_limits<Distortion>::max(); 212 214 213 215 if (rcDistParam.iCols == 12) … … 244 246 rcDistParam.iCols = pcPatternKey->getROIYWidth(); 245 247 rcDistParam.iRows = pcPatternKey->getROIYHeight(); 248 249 rcDistParam.m_maximumDistortionForEarlyExit = std::numeric_limits<Distortion>::max(); 246 250 247 251 // set distortion function … … 283 287 rcDP.bitDepth = bitDepth; 284 288 rcDP.DistFunc = m_afpDistortFunc[ ( bHadamard ? DF_HADS : DF_SADS ) + g_aucConvertToBit[ iWidth ] + 1 ]; 289 rcDP.m_maximumDistortionForEarlyExit = std::numeric_limits<Distortion>::max(); 285 290 } 286 291 … … 358 363 return TComRdCostWeightPrediction::xGetSADw( pcDtParam ); 359 364 } 360 const Pel* piOrg = pcDtParam->pOrg;361 const Pel* piCur = pcDtParam->pCur;362 Int iRows = pcDtParam->iRows;363 Int iCols = pcDtParam->iCols;364 Int iStrideCur = pcDtParam->iStrideCur;365 Int iStrideOrg = pcDtParam->iStrideOrg;365 const Pel* piOrg = pcDtParam->pOrg; 366 const Pel* piCur = pcDtParam->pCur; 367 const Int iCols = pcDtParam->iCols; 368 const Int iStrideCur = pcDtParam->iStrideCur; 369 const Int iStrideOrg = pcDtParam->iStrideOrg; 370 const UInt distortionShift = DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth - 8); 366 371 367 372 Distortion uiSum = 0; 368 373 369 for( ; iRows != 0; iRows-- )374 for(Int iRows = pcDtParam->iRows ; iRows != 0; iRows-- ) 370 375 { 371 376 for (Int n = 0; n < iCols; n++ ) … … 373 378 uiSum += abs( piOrg[n] - piCur[n] ); 374 379 } 375 piOrg += iStrideOrg; 376 piCur += iStrideCur; 377 } 378 379 return ( uiSum >> DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth-8) ); 380 if (pcDtParam->m_maximumDistortionForEarlyExit < ( uiSum >> distortionShift )) 381 { 382 return ( uiSum >> distortionShift ); 383 } 384 piOrg += iStrideOrg; 385 piCur += iStrideCur; 386 } 387 388 return ( uiSum >> distortionShift ); 380 389 } 381 390 -
branches/SHM-dev/source/Lib/TLibCommon/TComRdCost.h
r1395 r1397 81 81 const WPScalingParam *wpCur; // weighted prediction scaling parameters for current ref 82 82 ComponentID compIdx; 83 Distortion m_maximumDistortionForEarlyExit; /// During cost calculations, if distortion exceeds this value, cost calculations may early-terminate. 83 84 84 85 // (vertical) subsampling shift (for reducing complexity) … … 99 100 wpCur(NULL), 100 101 compIdx(MAX_NUM_COMPONENT), 102 m_maximumDistortionForEarlyExit(std::numeric_limits<Distortion>::max()), 101 103 iSubShift(0) 102 104 { } -
branches/SHM-dev/source/Lib/TLibCommon/TComRdCostWeightPrediction.cpp
r1259 r1397 70 70 const Int shift = wpCur.shift; 71 71 const Int round = wpCur.round; 72 const Int distortionShift = DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth-8); 72 73 73 74 Distortion uiSum = 0; … … 80 81 81 82 uiSum += abs( piOrg[n] - pred ); 83 } 84 if (pcDtParam->m_maximumDistortionForEarlyExit < ( uiSum >> distortionShift)) 85 { 86 return uiSum >> distortionShift; 82 87 } 83 88 piOrg += iStrideOrg; … … 87 92 pcDtParam->compIdx = MAX_NUM_COMPONENT; // reset for DEBUG (assert test) 88 93 89 return uiSum >> DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth-8);94 return uiSum >> distortionShift; 90 95 } 91 96 -
branches/SHM-dev/source/Lib/TLibEncoder/TEncSearch.cpp
r1389 r1397 386 386 // distortion 387 387 m_cDistParam.bitDepth = pcPatternKey->getBitDepthY(); 388 m_cDistParam.m_maximumDistortionForEarlyExit = rcStruct.uiBestSad; 389 388 390 if(m_pcEncCfg->getFastSearch() == SELECTIVE) 389 391 { … … 439 441 rcStruct.uiBestRound = 0; 440 442 rcStruct.ucPointNr = ucPointNr; 443 m_cDistParam.m_maximumDistortionForEarlyExit = uiSad; 441 444 } 442 445 } … … 458 461 rcStruct.uiBestRound = 0; 459 462 rcStruct.ucPointNr = ucPointNr; 463 m_cDistParam.m_maximumDistortionForEarlyExit = uiSad; 460 464 } 461 465 } … … 882 886 uiDistBest = uiDist; 883 887 uiDirecBest = i; 888 m_cDistParam.m_maximumDistortionForEarlyExit = uiDist; 884 889 } 885 890 } … … 3404 3409 } 3405 3410 } 3406 #if (ENCODER_FAST_MODE)3411 #if ENCODER_FAST_MODE 3407 3412 } 3408 3413 #endif 3409 3414 } 3410 #if (ENCODER_FAST_MODE)3415 #if ENCODER_FAST_MODE 3411 3416 } // for loop-iRefIdxTemp 3412 3417 #endif … … 4064 4069 iBestX = x; 4065 4070 iBestY = y; 4071 m_cDistParam.m_maximumDistortionForEarlyExit = uiSad; 4066 4072 } 4067 4073 }
Note: See TracChangeset for help on using the changeset viewer.