Changeset 916 in SHVCSoftware for branches/SHM-upgrade/source/Lib/TLibCommon/TComRdCost.cpp
- Timestamp:
- 12 Nov 2014, 08:09:17 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/SHM-upgrade/source/Lib/TLibCommon/TComRdCost.cpp
r595 r916 51 51 TComRdCost::~TComRdCost() 52 52 { 53 #if !FIX20354 xUninit();55 #endif56 53 } 57 54 58 55 // Calculate RD functions 59 Double TComRdCost::calcRdCost( UInt uiBits, UIntuiDistortion, Bool bFlag, DFunc eDFunc )56 Double TComRdCost::calcRdCost( UInt uiBits, Distortion uiDistortion, Bool bFlag, DFunc eDFunc ) 60 57 { 61 58 Double dRdCost = 0.0; … … 68 65 break; 69 66 case DF_SAD: 70 dLambda = (Double)m_uiLambdaMotionSAD; 67 #if RExt__HIGH_BIT_DEPTH_SUPPORT 68 dLambda = m_dLambdaMotionSAD[0]; // 0 is valid, because for lossless blocks, the cost equation is modified to compensate. 69 #else 70 dLambda = (Double)m_uiLambdaMotionSAD[0]; // 0 is valid, because for lossless blocks, the cost equation is modified to compensate. 71 #endif 71 72 break; 72 73 case DF_DEFAULT: … … 81 82 } 82 83 83 if (bFlag) 84 if (bFlag) //NOTE: this "bFlag" is never true 84 85 { 85 86 // Intra8x8, Intra4x4 Block only... 86 #if SEQUENCE_LEVEL_LOSSLESS 87 dRdCost = (Double)(uiBits); 88 #else 89 dRdCost = (((Double)uiDistortion) + ((Double)uiBits * dLambda)); 90 #endif 87 if (m_costMode != COST_STANDARD_LOSSY) 88 { 89 dRdCost = (Double(uiDistortion) / dLambda) + Double(uiBits); // all lossless costs would have uiDistortion=0, and therefore this cost function can be used. 90 } 91 else 92 { 93 dRdCost = (((Double)uiDistortion) + ((Double)uiBits * dLambda)); 94 } 91 95 } 92 96 else … … 94 98 if (eDFunc == DF_SAD) 95 99 { 96 dRdCost = ((Double)uiDistortion + (Double)((Int)(uiBits * dLambda+.5)>>16)); 97 dRdCost = (Double)(UInt)floor(dRdCost); 100 if (m_costMode != COST_STANDARD_LOSSY) 101 { 102 dRdCost = ((Double(uiDistortion) * 65536) / dLambda) + Double(uiBits); // all lossless costs would have uiDistortion=0, and therefore this cost function can be used. 103 } 104 else 105 { 106 dRdCost = floor(Double(uiDistortion) + (floor((Double(uiBits) * dLambda) + 0.5) / 65536.0)); 107 } 98 108 } 99 109 else 100 110 { 101 #if SEQUENCE_LEVEL_LOSSLESS 102 dRdCost = (Double)(uiBits); 103 #else 104 dRdCost = ((Double)uiDistortion + (Double)((Int)(uiBits * dLambda+.5))); 105 dRdCost = (Double)(UInt)floor(dRdCost); 106 #endif 111 if (m_costMode != COST_STANDARD_LOSSY) 112 { 113 dRdCost = (Double(uiDistortion) / dLambda) + Double(uiBits); // all lossless costs would have uiDistortion=0, and therefore this cost function can be used. 114 } 115 else 116 { 117 dRdCost = floor(Double(uiDistortion) + (Double(uiBits) * dLambda) + 0.5); 118 } 107 119 } 108 120 } … … 122 134 break; 123 135 case DF_SAD: 124 dLambda = (Double)m_uiLambdaMotionSAD; 136 #if RExt__HIGH_BIT_DEPTH_SUPPORT 137 dLambda = m_dLambdaMotionSAD[0]; // 0 is valid, because for lossless blocks, the cost equation is modified to compensate. 138 #else 139 dLambda = (Double)m_uiLambdaMotionSAD[0]; // 0 is valid, because for lossless blocks, the cost equation is modified to compensate. 140 #endif 125 141 break; 126 142 case DF_DEFAULT: … … 135 151 } 136 152 137 if (bFlag) 153 if (bFlag) //NOTE: this "bFlag" is never true 138 154 { 139 155 // Intra8x8, Intra4x4 Block only... 140 #if SEQUENCE_LEVEL_LOSSLESS 141 dRdCost = (Double)(uiBits); 142 #else 143 dRdCost = (((Double)(Int64)uiDistortion) + ((Double)(Int64)uiBits * dLambda)); 144 #endif 156 if (m_costMode != COST_STANDARD_LOSSY) 157 { 158 dRdCost = (Double(uiDistortion) / dLambda) + Double(uiBits); // all lossless costs would have uiDistortion=0, and therefore this cost function can be used. 159 } 160 else 161 { 162 dRdCost = (((Double)(Int64)uiDistortion) + ((Double)(Int64)uiBits * dLambda)); 163 } 145 164 } 146 165 else … … 148 167 if (eDFunc == DF_SAD) 149 168 { 150 dRdCost = ((Double)(Int64)uiDistortion + (Double)((Int)((Int64)uiBits * dLambda+.5)>>16)); 151 dRdCost = (Double)(UInt)floor(dRdCost); 169 if (m_costMode != COST_STANDARD_LOSSY) 170 { 171 dRdCost = ((Double(uiDistortion) * 65536) / dLambda) + Double(uiBits); // all lossless costs would have uiDistortion=0, and therefore this cost function can be used. 172 } 173 else 174 { 175 dRdCost = floor(Double(uiDistortion) + (floor((Double(uiBits) * dLambda) + 0.5) / 65536.0)); 176 } 152 177 } 153 178 else 154 179 { 155 #if SEQUENCE_LEVEL_LOSSLESS 156 dRdCost = (Double)(uiBits); 157 #else 158 dRdCost = ((Double)(Int64)uiDistortion + (Double)((Int)((Int64)uiBits * dLambda+.5))); 159 dRdCost = (Double)(UInt)floor(dRdCost); 160 #endif 180 if (m_costMode != COST_STANDARD_LOSSY) 181 { 182 dRdCost = (Double(uiDistortion) / dLambda) + Double(uiBits); // all lossless costs would have uiDistortion=0, and therefore this cost function can be used. 183 } 184 else 185 { 186 dRdCost = floor(Double(uiDistortion) + (Double(uiBits) * dLambda) + 0.5); 187 } 161 188 } 162 189 } … … 169 196 m_dLambda = dLambda; 170 197 m_sqrtLambda = sqrt(m_dLambda); 171 m_uiLambdaMotionSAD = (UInt)floor(65536.0 * m_sqrtLambda); 172 m_uiLambdaMotionSSE = (UInt)floor(65536.0 * m_dLambda ); 198 #if RExt__HIGH_BIT_DEPTH_SUPPORT 199 m_dLambdaMotionSAD[0] = 65536.0 * m_sqrtLambda; 200 m_dLambdaMotionSSE[0] = 65536.0 * m_dLambda; 201 #if FULL_NBIT 202 dLambda = 0.57 * pow(2.0, ((LOSSLESS_AND_MIXED_LOSSLESS_RD_COST_TEST_QP_PRIME - 12) / 3.0)); 203 #else 204 dLambda = 0.57 * pow(2.0, ((LOSSLESS_AND_MIXED_LOSSLESS_RD_COST_TEST_QP_PRIME - 12 - 6 * (g_bitDepth[CHANNEL_TYPE_LUMA] - 8)) / 3.0)); 205 #endif 206 m_dLambdaMotionSAD[1] = 65536.0 * sqrt(dLambda); 207 m_dLambdaMotionSSE[1] = 65536.0 * dLambda; 208 #else 209 m_uiLambdaMotionSAD[0] = (UInt)floor(65536.0 * m_sqrtLambda); 210 m_uiLambdaMotionSSE[0] = (UInt)floor(65536.0 * m_dLambda ); 211 #if FULL_NBIT 212 dLambda = 0.57 * pow(2.0, ((LOSSLESS_AND_MIXED_LOSSLESS_RD_COST_TEST_QP_PRIME - 12) / 3.0)); 213 #else 214 dLambda = 0.57 * pow(2.0, ((LOSSLESS_AND_MIXED_LOSSLESS_RD_COST_TEST_QP_PRIME - 12 - 6 * (g_bitDepth[CHANNEL_TYPE_LUMA] - 8)) / 3.0)); 215 #endif 216 m_uiLambdaMotionSAD[1] = (UInt)floor(65536.0 * sqrt(dLambda)); 217 m_uiLambdaMotionSSE[1] = (UInt)floor(65536.0 * dLambda ); 218 #endif 173 219 } 174 220 … … 177 223 Void TComRdCost::init() 178 224 { 179 m_afpDistortFunc[ 0]= NULL; // for DF_DEFAULT180 181 m_afpDistortFunc[ 1]= TComRdCost::xGetSSE;182 m_afpDistortFunc[ 2]= TComRdCost::xGetSSE4;183 m_afpDistortFunc[ 3]= TComRdCost::xGetSSE8;184 m_afpDistortFunc[ 4]= TComRdCost::xGetSSE16;185 m_afpDistortFunc[ 5]= TComRdCost::xGetSSE32;186 m_afpDistortFunc[ 6]= TComRdCost::xGetSSE64;187 m_afpDistortFunc[ 7]= TComRdCost::xGetSSE16N;188 189 m_afpDistortFunc[ 8]= TComRdCost::xGetSAD;190 m_afpDistortFunc[ 9]= TComRdCost::xGetSAD4;191 m_afpDistortFunc[ 10] = TComRdCost::xGetSAD8;192 m_afpDistortFunc[ 11] = TComRdCost::xGetSAD16;193 m_afpDistortFunc[ 12] = TComRdCost::xGetSAD32;194 m_afpDistortFunc[ 13] = TComRdCost::xGetSAD64;195 m_afpDistortFunc[ 14] = TComRdCost::xGetSAD16N;196 197 m_afpDistortFunc[ 15] = TComRdCost::xGetSAD;198 m_afpDistortFunc[ 16] = TComRdCost::xGetSAD4;199 m_afpDistortFunc[ 17] = TComRdCost::xGetSAD8;200 m_afpDistortFunc[ 18] = TComRdCost::xGetSAD16;201 m_afpDistortFunc[ 19] = TComRdCost::xGetSAD32;202 m_afpDistortFunc[ 20] = TComRdCost::xGetSAD64;203 m_afpDistortFunc[ 21] = TComRdCost::xGetSAD16N;225 m_afpDistortFunc[DF_DEFAULT] = NULL; // for DF_DEFAULT 226 227 m_afpDistortFunc[DF_SSE ] = TComRdCost::xGetSSE; 228 m_afpDistortFunc[DF_SSE4 ] = TComRdCost::xGetSSE4; 229 m_afpDistortFunc[DF_SSE8 ] = TComRdCost::xGetSSE8; 230 m_afpDistortFunc[DF_SSE16 ] = TComRdCost::xGetSSE16; 231 m_afpDistortFunc[DF_SSE32 ] = TComRdCost::xGetSSE32; 232 m_afpDistortFunc[DF_SSE64 ] = TComRdCost::xGetSSE64; 233 m_afpDistortFunc[DF_SSE16N ] = TComRdCost::xGetSSE16N; 234 235 m_afpDistortFunc[DF_SAD ] = TComRdCost::xGetSAD; 236 m_afpDistortFunc[DF_SAD4 ] = TComRdCost::xGetSAD4; 237 m_afpDistortFunc[DF_SAD8 ] = TComRdCost::xGetSAD8; 238 m_afpDistortFunc[DF_SAD16 ] = TComRdCost::xGetSAD16; 239 m_afpDistortFunc[DF_SAD32 ] = TComRdCost::xGetSAD32; 240 m_afpDistortFunc[DF_SAD64 ] = TComRdCost::xGetSAD64; 241 m_afpDistortFunc[DF_SAD16N ] = TComRdCost::xGetSAD16N; 242 243 m_afpDistortFunc[DF_SADS ] = TComRdCost::xGetSAD; 244 m_afpDistortFunc[DF_SADS4 ] = TComRdCost::xGetSAD4; 245 m_afpDistortFunc[DF_SADS8 ] = TComRdCost::xGetSAD8; 246 m_afpDistortFunc[DF_SADS16 ] = TComRdCost::xGetSAD16; 247 m_afpDistortFunc[DF_SADS32 ] = TComRdCost::xGetSAD32; 248 m_afpDistortFunc[DF_SADS64 ] = TComRdCost::xGetSAD64; 249 m_afpDistortFunc[DF_SADS16N] = TComRdCost::xGetSAD16N; 204 250 205 251 #if AMP_SAD 206 m_afpDistortFunc[ 43] = TComRdCost::xGetSAD12;207 m_afpDistortFunc[ 44] = TComRdCost::xGetSAD24;208 m_afpDistortFunc[ 45] = TComRdCost::xGetSAD48;209 210 m_afpDistortFunc[ 46] = TComRdCost::xGetSAD12;211 m_afpDistortFunc[ 47] = TComRdCost::xGetSAD24;212 m_afpDistortFunc[ 48] = TComRdCost::xGetSAD48;252 m_afpDistortFunc[DF_SAD12 ] = TComRdCost::xGetSAD12; 253 m_afpDistortFunc[DF_SAD24 ] = TComRdCost::xGetSAD24; 254 m_afpDistortFunc[DF_SAD48 ] = TComRdCost::xGetSAD48; 255 256 m_afpDistortFunc[DF_SADS12 ] = TComRdCost::xGetSAD12; 257 m_afpDistortFunc[DF_SADS24 ] = TComRdCost::xGetSAD24; 258 m_afpDistortFunc[DF_SADS48 ] = TComRdCost::xGetSAD48; 213 259 #endif 214 m_afpDistortFunc[22] = TComRdCost::xGetHADs; 215 m_afpDistortFunc[23] = TComRdCost::xGetHADs; 216 m_afpDistortFunc[24] = TComRdCost::xGetHADs; 217 m_afpDistortFunc[25] = TComRdCost::xGetHADs; 218 m_afpDistortFunc[26] = TComRdCost::xGetHADs; 219 m_afpDistortFunc[27] = TComRdCost::xGetHADs; 220 m_afpDistortFunc[28] = TComRdCost::xGetHADs; 221 222 #if !FIX203 223 m_puiComponentCostOriginP = NULL; 224 m_puiComponentCost = NULL; 225 m_puiVerCost = NULL; 226 m_puiHorCost = NULL; 260 m_afpDistortFunc[DF_HADS ] = TComRdCost::xGetHADs; 261 m_afpDistortFunc[DF_HADS4 ] = TComRdCost::xGetHADs; 262 m_afpDistortFunc[DF_HADS8 ] = TComRdCost::xGetHADs; 263 m_afpDistortFunc[DF_HADS16 ] = TComRdCost::xGetHADs; 264 m_afpDistortFunc[DF_HADS32 ] = TComRdCost::xGetHADs; 265 m_afpDistortFunc[DF_HADS64 ] = TComRdCost::xGetHADs; 266 m_afpDistortFunc[DF_HADS16N] = TComRdCost::xGetHADs; 267 268 m_costMode = COST_STANDARD_LOSSY; 269 270 #if RExt__HIGH_BIT_DEPTH_SUPPORT 271 m_dCost = 0; 272 #else 273 m_uiCost = 0; 227 274 #endif 228 m_uiCost = 0; 229 m_iCostScale = 0; 230 #if !FIX203 231 m_iSearchLimit = 0xdeaddead; 232 #endif 233 } 234 235 #if !FIX203 236 Void TComRdCost::initRateDistortionModel( Int iSubPelSearchLimit ) 237 { 238 // make it larger 239 iSubPelSearchLimit += 4; 240 iSubPelSearchLimit *= 8; 241 242 if( m_iSearchLimit != iSubPelSearchLimit ) 243 { 244 xUninit(); 245 246 m_iSearchLimit = iSubPelSearchLimit; 247 248 m_puiComponentCostOriginP = new UInt[ 4 * iSubPelSearchLimit ]; 249 iSubPelSearchLimit *= 2; 250 251 m_puiComponentCost = m_puiComponentCostOriginP + iSubPelSearchLimit; 252 253 for( Int n = -iSubPelSearchLimit; n < iSubPelSearchLimit; n++) 254 { 255 m_puiComponentCost[n] = xGetComponentBits( n ); 256 } 257 } 258 } 259 260 Void TComRdCost::xUninit() 261 { 262 if( NULL != m_puiComponentCostOriginP ) 263 { 264 delete [] m_puiComponentCostOriginP; 265 m_puiComponentCostOriginP = NULL; 266 } 267 } 268 #endif 275 m_iCostScale = 0; 276 } 269 277 270 278 UInt TComRdCost::xGetComponentBits( Int iVal ) … … 313 321 if (rcDistParam.iCols == 12) 314 322 { 315 rcDistParam.DistFunc = m_afpDistortFunc[ 43];323 rcDistParam.DistFunc = m_afpDistortFunc[DF_SAD12]; 316 324 } 317 325 else if (rcDistParam.iCols == 24) 318 326 { 319 rcDistParam.DistFunc = m_afpDistortFunc[ 44];327 rcDistParam.DistFunc = m_afpDistortFunc[DF_SAD24]; 320 328 } 321 329 else if (rcDistParam.iCols == 48) 322 330 { 323 rcDistParam.DistFunc = m_afpDistortFunc[ 45];331 rcDistParam.DistFunc = m_afpDistortFunc[DF_SAD48]; 324 332 } 325 333 #endif … … 334 342 #if O0194_WEIGHTED_PREDICTION_CGS 335 343 // Bug fix: The correct bit depth has not been used for weighted cost calculation 336 rcDistParam.bitDepth = g_bitDepth Y;344 rcDistParam.bitDepth = g_bitDepth[CHANNEL_TYPE_LUMA]; 337 345 #endif 338 346 // set Original & Curr Pointer / Stride … … 357 365 if (rcDistParam.iCols == 12) 358 366 { 359 rcDistParam.DistFunc = m_afpDistortFunc[ 46];367 rcDistParam.DistFunc = m_afpDistortFunc[DF_SADS12]; 360 368 } 361 369 else if (rcDistParam.iCols == 24) 362 370 { 363 rcDistParam.DistFunc = m_afpDistortFunc[ 47];371 rcDistParam.DistFunc = m_afpDistortFunc[DF_SADS24]; 364 372 } 365 373 else if (rcDistParam.iCols == 48) 366 374 { 367 rcDistParam.DistFunc = m_afpDistortFunc[ 48];375 rcDistParam.DistFunc = m_afpDistortFunc[DF_SADS48]; 368 376 } 369 377 #endif … … 378 386 } 379 387 380 Void 381 TComRdCost::setDistParam( DistParam& rcDP, Int bitDepth, Pel* p1, Int iStride1, Pel* p2, Int iStride2, Int iWidth, Int iHeight, Bool bHadamard ) 388 Void TComRdCost::setDistParam( DistParam& rcDP, Int bitDepth, Pel* p1, Int iStride1, Pel* p2, Int iStride2, Int iWidth, Int iHeight, Bool bHadamard ) 382 389 { 383 390 rcDP.pOrg = p1; … … 393 400 } 394 401 395 UInt TComRdCost::calcHAD(Int bitDepth, Pel* pi0, Int iStride0, Pel* pi1, Int iStride1, Int iWidth, Int iHeight )396 { 397 UIntuiSum = 0;402 Distortion TComRdCost::calcHAD( Int bitDepth, Pel* pi0, Int iStride0, Pel* pi1, Int iStride1, Int iWidth, Int iHeight ) 403 { 404 Distortion uiSum = 0; 398 405 Int x, y; 399 406 … … 412 419 else 413 420 { 414 assert (iWidth % 4 == 0 && iHeight % 4 == 0);415 421 assert ( ( (iWidth % 4) == 0 ) && ( (iHeight % 4) == 0 ) ); 422 416 423 for ( y=0; y<iHeight; y+= 4 ) 417 424 { … … 425 432 } 426 433 427 return uiSum >> DISTORTION_PRECISION_ADJUSTMENT(bitDepth-8); 428 429 } 430 431 UInt TComRdCost::getDistPart(Int bitDepth, Pel* piCur, Int iCurStride, Pel* piOrg, Int iOrgStride, UInt uiBlkWidth, UInt uiBlkHeight, TextType eText, DFunc eDFunc) 434 return ( uiSum >> DISTORTION_PRECISION_ADJUSTMENT(bitDepth-8) ); 435 } 436 437 Distortion TComRdCost::getDistPart( Int bitDepth, Pel* piCur, Int iCurStride, Pel* piOrg, Int iOrgStride, UInt uiBlkWidth, UInt uiBlkHeight, const ComponentID compID, DFunc eDFunc ) 432 438 { 433 439 DistParam cDtParam; … … 440 446 441 447 cDtParam.bApplyWeight = false; 442 cDtParam.uiComp = 255; // just for assert: to be sure it was set before use, since only values 0,1 or 2 are allowed. 443 cDtParam.bitDepth = bitDepth; 444 445 if (eText == TEXT_CHROMA_U) 446 { 447 return ((Int) (m_cbDistortionWeight * cDtParam.DistFunc( &cDtParam ))); 448 } 449 else if (eText == TEXT_CHROMA_V) 450 { 451 return ((Int) (m_crDistortionWeight * cDtParam.DistFunc( &cDtParam ))); 448 cDtParam.compIdx = MAX_NUM_COMPONENT; // just for assert: to be sure it was set before use 449 cDtParam.bitDepth = bitDepth; 450 451 if (isChroma(compID)) 452 { 453 return ((Distortion) (m_distortionWeight[compID] * cDtParam.DistFunc( &cDtParam ))); 452 454 } 453 455 else … … 465 467 // -------------------------------------------------------------------------------------------------------------------- 466 468 467 UIntTComRdCost::xGetSAD( DistParam* pcDtParam )469 Distortion TComRdCost::xGetSAD( DistParam* pcDtParam ) 468 470 { 469 471 if ( pcDtParam->bApplyWeight ) 470 472 { 471 return xGetSADw( pcDtParam );472 } 473 Pel* piOrg = pcDtParam->pOrg;474 Pel* piCur = pcDtParam->pCur;473 return TComRdCostWeightPrediction::xGetSADw( pcDtParam ); 474 } 475 const Pel* piOrg = pcDtParam->pOrg; 476 const Pel* piCur = pcDtParam->pCur; 475 477 Int iRows = pcDtParam->iRows; 476 478 Int iCols = pcDtParam->iCols; … … 478 480 Int iStrideOrg = pcDtParam->iStrideOrg; 479 481 480 UIntuiSum = 0;482 Distortion uiSum = 0; 481 483 482 484 for( ; iRows != 0; iRows-- ) … … 490 492 } 491 493 492 return uiSum >> DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth-8);493 } 494 495 UIntTComRdCost::xGetSAD4( DistParam* pcDtParam )494 return ( uiSum >> DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth-8) ); 495 } 496 497 Distortion TComRdCost::xGetSAD4( DistParam* pcDtParam ) 496 498 { 497 499 if ( pcDtParam->bApplyWeight ) 498 500 { 499 return xGetSADw( pcDtParam );500 } 501 Pel* piOrg = pcDtParam->pOrg;502 Pel* piCur = pcDtParam->pCur;501 return TComRdCostWeightPrediction::xGetSADw( pcDtParam ); 502 } 503 const Pel* piOrg = pcDtParam->pOrg; 504 const Pel* piCur = pcDtParam->pCur; 503 505 Int iRows = pcDtParam->iRows; 504 506 Int iSubShift = pcDtParam->iSubShift; … … 507 509 Int iStrideOrg = pcDtParam->iStrideOrg*iSubStep; 508 510 509 UIntuiSum = 0;511 Distortion uiSum = 0; 510 512 511 513 for( ; iRows != 0; iRows-=iSubStep ) … … 521 523 522 524 uiSum <<= iSubShift; 523 return uiSum >> DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth-8);524 } 525 526 UIntTComRdCost::xGetSAD8( DistParam* pcDtParam )525 return ( uiSum >> DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth-8) ); 526 } 527 528 Distortion TComRdCost::xGetSAD8( DistParam* pcDtParam ) 527 529 { 528 530 if ( pcDtParam->bApplyWeight ) 529 531 { 530 return xGetSADw( pcDtParam );531 } 532 Pel* piOrg = pcDtParam->pOrg;533 Pel* piCur = pcDtParam->pCur;532 return TComRdCostWeightPrediction::xGetSADw( pcDtParam ); 533 } 534 const Pel* piOrg = pcDtParam->pOrg; 535 const Pel* piCur = pcDtParam->pCur; 534 536 Int iRows = pcDtParam->iRows; 535 537 Int iSubShift = pcDtParam->iSubShift; … … 538 540 Int iStrideOrg = pcDtParam->iStrideOrg*iSubStep; 539 541 540 UIntuiSum = 0;542 Distortion uiSum = 0; 541 543 542 544 for( ; iRows != 0; iRows-=iSubStep ) … … 556 558 557 559 uiSum <<= iSubShift; 558 return uiSum >> DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth-8);559 } 560 561 UIntTComRdCost::xGetSAD16( DistParam* pcDtParam )560 return ( uiSum >> DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth-8) ); 561 } 562 563 Distortion TComRdCost::xGetSAD16( DistParam* pcDtParam ) 562 564 { 563 565 if ( pcDtParam->bApplyWeight ) 564 566 { 565 return xGetSADw( pcDtParam );566 } 567 Pel* piOrg = pcDtParam->pOrg;568 Pel* piCur = pcDtParam->pCur;567 return TComRdCostWeightPrediction::xGetSADw( pcDtParam ); 568 } 569 const Pel* piOrg = pcDtParam->pOrg; 570 const Pel* piCur = pcDtParam->pCur; 569 571 Int iRows = pcDtParam->iRows; 570 572 Int iSubShift = pcDtParam->iSubShift; … … 573 575 Int iStrideOrg = pcDtParam->iStrideOrg*iSubStep; 574 576 575 UIntuiSum = 0;577 Distortion uiSum = 0; 576 578 577 579 for( ; iRows != 0; iRows-=iSubStep ) … … 599 601 600 602 uiSum <<= iSubShift; 601 return uiSum >> DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth-8);603 return ( uiSum >> DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth-8) ); 602 604 } 603 605 604 606 #if AMP_SAD 605 UIntTComRdCost::xGetSAD12( DistParam* pcDtParam )607 Distortion TComRdCost::xGetSAD12( DistParam* pcDtParam ) 606 608 { 607 609 if ( pcDtParam->bApplyWeight ) 608 610 { 609 return xGetSADw( pcDtParam );610 } 611 Pel* piOrg = pcDtParam->pOrg;612 Pel* piCur = pcDtParam->pCur;611 return TComRdCostWeightPrediction::xGetSADw( pcDtParam ); 612 } 613 const Pel* piOrg = pcDtParam->pOrg; 614 const Pel* piCur = pcDtParam->pCur; 613 615 Int iRows = pcDtParam->iRows; 614 616 Int iSubShift = pcDtParam->iSubShift; … … 617 619 Int iStrideOrg = pcDtParam->iStrideOrg*iSubStep; 618 620 619 UIntuiSum = 0;621 Distortion uiSum = 0; 620 622 621 623 for( ; iRows != 0; iRows-=iSubStep ) … … 639 641 640 642 uiSum <<= iSubShift; 641 return uiSum >> DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth-8);643 return ( uiSum >> DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth-8) ); 642 644 } 643 645 #endif 644 646 645 UIntTComRdCost::xGetSAD16N( DistParam* pcDtParam )646 { 647 Pel* piOrg = pcDtParam->pOrg;648 Pel* piCur = pcDtParam->pCur;647 Distortion TComRdCost::xGetSAD16N( DistParam* pcDtParam ) 648 { 649 const Pel* piOrg = pcDtParam->pOrg; 650 const Pel* piCur = pcDtParam->pCur; 649 651 Int iRows = pcDtParam->iRows; 650 652 Int iCols = pcDtParam->iCols; … … 654 656 Int iStrideOrg = pcDtParam->iStrideOrg*iSubStep; 655 657 656 UIntuiSum = 0;658 Distortion uiSum = 0; 657 659 658 660 for( ; iRows != 0; iRows-=iSubStep ) … … 682 684 683 685 uiSum <<= iSubShift; 684 return uiSum >> DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth-8);685 } 686 687 UIntTComRdCost::xGetSAD32( DistParam* pcDtParam )686 return ( uiSum >> DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth-8) ); 687 } 688 689 Distortion TComRdCost::xGetSAD32( DistParam* pcDtParam ) 688 690 { 689 691 if ( pcDtParam->bApplyWeight ) 690 692 { 691 return xGetSADw( pcDtParam );692 } 693 Pel* piOrg = pcDtParam->pOrg;694 Pel* piCur = pcDtParam->pCur;693 return TComRdCostWeightPrediction::xGetSADw( pcDtParam ); 694 } 695 const Pel* piOrg = pcDtParam->pOrg; 696 const Pel* piCur = pcDtParam->pCur; 695 697 Int iRows = pcDtParam->iRows; 696 698 Int iSubShift = pcDtParam->iSubShift; … … 699 701 Int iStrideOrg = pcDtParam->iStrideOrg*iSubStep; 700 702 701 UIntuiSum = 0;703 Distortion uiSum = 0; 702 704 703 705 for( ; iRows != 0; iRows-=iSubStep ) … … 741 743 742 744 uiSum <<= iSubShift; 743 return uiSum >> DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth-8);745 return ( uiSum >> DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth-8) ); 744 746 } 745 747 746 748 #if AMP_SAD 747 UIntTComRdCost::xGetSAD24( DistParam* pcDtParam )749 Distortion TComRdCost::xGetSAD24( DistParam* pcDtParam ) 748 750 { 749 751 if ( pcDtParam->bApplyWeight ) 750 752 { 751 return xGetSADw( pcDtParam );752 } 753 Pel* piOrg = pcDtParam->pOrg;754 Pel* piCur = pcDtParam->pCur;753 return TComRdCostWeightPrediction::xGetSADw( pcDtParam ); 754 } 755 const Pel* piOrg = pcDtParam->pOrg; 756 const Pel* piCur = pcDtParam->pCur; 755 757 Int iRows = pcDtParam->iRows; 756 758 Int iSubShift = pcDtParam->iSubShift; … … 759 761 Int iStrideOrg = pcDtParam->iStrideOrg*iSubStep; 760 762 761 UIntuiSum = 0;763 Distortion uiSum = 0; 762 764 763 765 for( ; iRows != 0; iRows-=iSubStep ) … … 793 795 794 796 uiSum <<= iSubShift; 795 return uiSum >> DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth-8);797 return ( uiSum >> DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth-8) ); 796 798 } 797 799 798 800 #endif 799 801 800 UIntTComRdCost::xGetSAD64( DistParam* pcDtParam )802 Distortion TComRdCost::xGetSAD64( DistParam* pcDtParam ) 801 803 { 802 804 if ( pcDtParam->bApplyWeight ) 803 805 { 804 return xGetSADw( pcDtParam );805 } 806 Pel* piOrg = pcDtParam->pOrg;807 Pel* piCur = pcDtParam->pCur;806 return TComRdCostWeightPrediction::xGetSADw( pcDtParam ); 807 } 808 const Pel* piOrg = pcDtParam->pOrg; 809 const Pel* piCur = pcDtParam->pCur; 808 810 Int iRows = pcDtParam->iRows; 809 811 Int iSubShift = pcDtParam->iSubShift; … … 812 814 Int iStrideOrg = pcDtParam->iStrideOrg*iSubStep; 813 815 814 UIntuiSum = 0;816 Distortion uiSum = 0; 815 817 816 818 for( ; iRows != 0; iRows-=iSubStep ) … … 886 888 887 889 uiSum <<= iSubShift; 888 return uiSum >> DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth-8);890 return ( uiSum >> DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth-8) ); 889 891 } 890 892 891 893 #if AMP_SAD 892 UIntTComRdCost::xGetSAD48( DistParam* pcDtParam )894 Distortion TComRdCost::xGetSAD48( DistParam* pcDtParam ) 893 895 { 894 896 if ( pcDtParam->bApplyWeight ) 895 897 { 896 return xGetSADw( pcDtParam );897 } 898 Pel* piOrg = pcDtParam->pOrg;899 Pel* piCur = pcDtParam->pCur;898 return TComRdCostWeightPrediction::xGetSADw( pcDtParam ); 899 } 900 const Pel* piOrg = pcDtParam->pOrg; 901 const Pel* piCur = pcDtParam->pCur; 900 902 Int iRows = pcDtParam->iRows; 901 903 Int iSubShift = pcDtParam->iSubShift; … … 904 906 Int iStrideOrg = pcDtParam->iStrideOrg*iSubStep; 905 907 906 UIntuiSum = 0;908 Distortion uiSum = 0; 907 909 908 910 for( ; iRows != 0; iRows-=iSubStep ) … … 962 964 963 965 uiSum <<= iSubShift; 964 return uiSum >> DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth-8);966 return ( uiSum >> DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth-8) ); 965 967 } 966 968 #endif … … 970 972 // -------------------------------------------------------------------------------------------------------------------- 971 973 972 UIntTComRdCost::xGetSSE( DistParam* pcDtParam )974 Distortion TComRdCost::xGetSSE( DistParam* pcDtParam ) 973 975 { 974 976 if ( pcDtParam->bApplyWeight ) 975 977 { 976 return xGetSSEw( pcDtParam );977 } 978 Pel* piOrg = pcDtParam->pOrg;979 Pel* piCur = pcDtParam->pCur;978 return TComRdCostWeightPrediction::xGetSSEw( pcDtParam ); 979 } 980 const Pel* piOrg = pcDtParam->pOrg; 981 const Pel* piCur = pcDtParam->pCur; 980 982 Int iRows = pcDtParam->iRows; 981 983 Int iCols = pcDtParam->iCols; … … 983 985 Int iStrideCur = pcDtParam->iStrideCur; 984 986 985 UInt uiSum= 0;986 UInt uiShift = DISTORTION_PRECISION_ADJUSTMENT((pcDtParam->bitDepth-8) << 1);987 988 Int iTemp;987 Distortion uiSum = 0; 988 UInt uiShift = DISTORTION_PRECISION_ADJUSTMENT((pcDtParam->bitDepth-8) << 1); 989 990 Intermediate_Int iTemp; 989 991 990 992 for( ; iRows != 0; iRows-- ) … … 993 995 { 994 996 iTemp = piOrg[n ] - piCur[n ]; 995 uiSum += ( iTemp * iTemp ) >> uiShift;997 uiSum += Distortion(( iTemp * iTemp ) >> uiShift); 996 998 } 997 999 piOrg += iStrideOrg; … … 1002 1004 } 1003 1005 1004 UIntTComRdCost::xGetSSE4( DistParam* pcDtParam )1006 Distortion TComRdCost::xGetSSE4( DistParam* pcDtParam ) 1005 1007 { 1006 1008 if ( pcDtParam->bApplyWeight ) 1007 1009 { 1008 1010 assert( pcDtParam->iCols == 4 ); 1009 return xGetSSEw( pcDtParam );1010 } 1011 Pel* piOrg = pcDtParam->pOrg;1012 Pel* piCur = pcDtParam->pCur;1011 return TComRdCostWeightPrediction::xGetSSEw( pcDtParam ); 1012 } 1013 const Pel* piOrg = pcDtParam->pOrg; 1014 const Pel* piCur = pcDtParam->pCur; 1013 1015 Int iRows = pcDtParam->iRows; 1014 1016 Int iStrideOrg = pcDtParam->iStrideOrg; 1015 1017 Int iStrideCur = pcDtParam->iStrideCur; 1016 1018 1017 UInt uiSum= 0;1018 UInt uiShift = DISTORTION_PRECISION_ADJUSTMENT((pcDtParam->bitDepth-8) << 1);1019 1020 Int iTemp;1019 Distortion uiSum = 0; 1020 UInt uiShift = DISTORTION_PRECISION_ADJUSTMENT((pcDtParam->bitDepth-8) << 1); 1021 1022 Intermediate_Int iTemp; 1021 1023 1022 1024 for( ; iRows != 0; iRows-- ) 1023 1025 { 1024 1026 1025 iTemp = piOrg[0] - piCur[0]; uiSum += ( iTemp * iTemp ) >> uiShift;1026 iTemp = piOrg[1] - piCur[1]; uiSum += ( iTemp * iTemp ) >> uiShift;1027 iTemp = piOrg[2] - piCur[2]; uiSum += ( iTemp * iTemp ) >> uiShift;1028 iTemp = piOrg[3] - piCur[3]; uiSum += ( iTemp * iTemp ) >> uiShift;1027 iTemp = piOrg[0] - piCur[0]; uiSum += Distortion(( iTemp * iTemp ) >> uiShift); 1028 iTemp = piOrg[1] - piCur[1]; uiSum += Distortion(( iTemp * iTemp ) >> uiShift); 1029 iTemp = piOrg[2] - piCur[2]; uiSum += Distortion(( iTemp * iTemp ) >> uiShift); 1030 iTemp = piOrg[3] - piCur[3]; uiSum += Distortion(( iTemp * iTemp ) >> uiShift); 1029 1031 1030 1032 piOrg += iStrideOrg; … … 1035 1037 } 1036 1038 1037 UIntTComRdCost::xGetSSE8( DistParam* pcDtParam )1039 Distortion TComRdCost::xGetSSE8( DistParam* pcDtParam ) 1038 1040 { 1039 1041 if ( pcDtParam->bApplyWeight ) 1040 1042 { 1041 1043 assert( pcDtParam->iCols == 8 ); 1042 return xGetSSEw( pcDtParam );1043 } 1044 Pel* piOrg = pcDtParam->pOrg;1045 Pel* piCur = pcDtParam->pCur;1044 return TComRdCostWeightPrediction::xGetSSEw( pcDtParam ); 1045 } 1046 const Pel* piOrg = pcDtParam->pOrg; 1047 const Pel* piCur = pcDtParam->pCur; 1046 1048 Int iRows = pcDtParam->iRows; 1047 1049 Int iStrideOrg = pcDtParam->iStrideOrg; 1048 1050 Int iStrideCur = pcDtParam->iStrideCur; 1049 1051 1050 UInt uiSum= 0;1051 UInt uiShift = DISTORTION_PRECISION_ADJUSTMENT((pcDtParam->bitDepth-8) << 1);1052 1053 Int iTemp;1052 Distortion uiSum = 0; 1053 UInt uiShift = DISTORTION_PRECISION_ADJUSTMENT((pcDtParam->bitDepth-8) << 1); 1054 1055 Intermediate_Int iTemp; 1054 1056 1055 1057 for( ; iRows != 0; iRows-- ) 1056 1058 { 1057 iTemp = piOrg[0] - piCur[0]; uiSum += ( iTemp * iTemp ) >> uiShift;1058 iTemp = piOrg[1] - piCur[1]; uiSum += ( iTemp * iTemp ) >> uiShift;1059 iTemp = piOrg[2] - piCur[2]; uiSum += ( iTemp * iTemp ) >> uiShift;1060 iTemp = piOrg[3] - piCur[3]; uiSum += ( iTemp * iTemp ) >> uiShift;1061 iTemp = piOrg[4] - piCur[4]; uiSum += ( iTemp * iTemp ) >> uiShift;1062 iTemp = piOrg[5] - piCur[5]; uiSum += ( iTemp * iTemp ) >> uiShift;1063 iTemp = piOrg[6] - piCur[6]; uiSum += ( iTemp * iTemp ) >> uiShift;1064 iTemp = piOrg[7] - piCur[7]; uiSum += ( iTemp * iTemp ) >> uiShift;1059 iTemp = piOrg[0] - piCur[0]; uiSum += Distortion(( iTemp * iTemp ) >> uiShift); 1060 iTemp = piOrg[1] - piCur[1]; uiSum += Distortion(( iTemp * iTemp ) >> uiShift); 1061 iTemp = piOrg[2] - piCur[2]; uiSum += Distortion(( iTemp * iTemp ) >> uiShift); 1062 iTemp = piOrg[3] - piCur[3]; uiSum += Distortion(( iTemp * iTemp ) >> uiShift); 1063 iTemp = piOrg[4] - piCur[4]; uiSum += Distortion(( iTemp * iTemp ) >> uiShift); 1064 iTemp = piOrg[5] - piCur[5]; uiSum += Distortion(( iTemp * iTemp ) >> uiShift); 1065 iTemp = piOrg[6] - piCur[6]; uiSum += Distortion(( iTemp * iTemp ) >> uiShift); 1066 iTemp = piOrg[7] - piCur[7]; uiSum += Distortion(( iTemp * iTemp ) >> uiShift); 1065 1067 1066 1068 piOrg += iStrideOrg; … … 1071 1073 } 1072 1074 1073 UIntTComRdCost::xGetSSE16( DistParam* pcDtParam )1075 Distortion TComRdCost::xGetSSE16( DistParam* pcDtParam ) 1074 1076 { 1075 1077 if ( pcDtParam->bApplyWeight ) 1076 1078 { 1077 1079 assert( pcDtParam->iCols == 16 ); 1078 return xGetSSEw( pcDtParam );1079 } 1080 Pel* piOrg = pcDtParam->pOrg;1081 Pel* piCur = pcDtParam->pCur;1080 return TComRdCostWeightPrediction::xGetSSEw( pcDtParam ); 1081 } 1082 const Pel* piOrg = pcDtParam->pOrg; 1083 const Pel* piCur = pcDtParam->pCur; 1082 1084 Int iRows = pcDtParam->iRows; 1083 1085 Int iStrideOrg = pcDtParam->iStrideOrg; 1084 1086 Int iStrideCur = pcDtParam->iStrideCur; 1085 1087 1086 UInt uiSum= 0;1087 UInt uiShift = DISTORTION_PRECISION_ADJUSTMENT((pcDtParam->bitDepth-8) << 1);1088 1089 Int iTemp;1088 Distortion uiSum = 0; 1089 UInt uiShift = DISTORTION_PRECISION_ADJUSTMENT((pcDtParam->bitDepth-8) << 1); 1090 1091 Intermediate_Int iTemp; 1090 1092 1091 1093 for( ; iRows != 0; iRows-- ) 1092 1094 { 1093 1095 1094 iTemp = piOrg[ 0] - piCur[ 0]; uiSum += ( iTemp * iTemp ) >> uiShift;1095 iTemp = piOrg[ 1] - piCur[ 1]; uiSum += ( iTemp * iTemp ) >> uiShift;1096 iTemp = piOrg[ 2] - piCur[ 2]; uiSum += ( iTemp * iTemp ) >> uiShift;1097 iTemp = piOrg[ 3] - piCur[ 3]; uiSum += ( iTemp * iTemp ) >> uiShift;1098 iTemp = piOrg[ 4] - piCur[ 4]; uiSum += ( iTemp * iTemp ) >> uiShift;1099 iTemp = piOrg[ 5] - piCur[ 5]; uiSum += ( iTemp * iTemp ) >> uiShift;1100 iTemp = piOrg[ 6] - piCur[ 6]; uiSum += ( iTemp * iTemp ) >> uiShift;1101 iTemp = piOrg[ 7] - piCur[ 7]; uiSum += ( iTemp * iTemp ) >> uiShift;1102 iTemp = piOrg[ 8] - piCur[ 8]; uiSum += ( iTemp * iTemp ) >> uiShift;1103 iTemp = piOrg[ 9] - piCur[ 9]; uiSum += ( iTemp * iTemp ) >> uiShift;1104 iTemp = piOrg[10] - piCur[10]; uiSum += ( iTemp * iTemp ) >> uiShift;1105 iTemp = piOrg[11] - piCur[11]; uiSum += ( iTemp * iTemp ) >> uiShift;1106 iTemp = piOrg[12] - piCur[12]; uiSum += ( iTemp * iTemp ) >> uiShift;1107 iTemp = piOrg[13] - piCur[13]; uiSum += ( iTemp * iTemp ) >> uiShift;1108 iTemp = piOrg[14] - piCur[14]; uiSum += ( iTemp * iTemp ) >> uiShift;1109 iTemp = piOrg[15] - piCur[15]; uiSum += ( iTemp * iTemp ) >> uiShift;1096 iTemp = piOrg[ 0] - piCur[ 0]; uiSum += Distortion(( iTemp * iTemp ) >> uiShift); 1097 iTemp = piOrg[ 1] - piCur[ 1]; uiSum += Distortion(( iTemp * iTemp ) >> uiShift); 1098 iTemp = piOrg[ 2] - piCur[ 2]; uiSum += Distortion(( iTemp * iTemp ) >> uiShift); 1099 iTemp = piOrg[ 3] - piCur[ 3]; uiSum += Distortion(( iTemp * iTemp ) >> uiShift); 1100 iTemp = piOrg[ 4] - piCur[ 4]; uiSum += Distortion(( iTemp * iTemp ) >> uiShift); 1101 iTemp = piOrg[ 5] - piCur[ 5]; uiSum += Distortion(( iTemp * iTemp ) >> uiShift); 1102 iTemp = piOrg[ 6] - piCur[ 6]; uiSum += Distortion(( iTemp * iTemp ) >> uiShift); 1103 iTemp = piOrg[ 7] - piCur[ 7]; uiSum += Distortion(( iTemp * iTemp ) >> uiShift); 1104 iTemp = piOrg[ 8] - piCur[ 8]; uiSum += Distortion(( iTemp * iTemp ) >> uiShift); 1105 iTemp = piOrg[ 9] - piCur[ 9]; uiSum += Distortion(( iTemp * iTemp ) >> uiShift); 1106 iTemp = piOrg[10] - piCur[10]; uiSum += Distortion(( iTemp * iTemp ) >> uiShift); 1107 iTemp = piOrg[11] - piCur[11]; uiSum += Distortion(( iTemp * iTemp ) >> uiShift); 1108 iTemp = piOrg[12] - piCur[12]; uiSum += Distortion(( iTemp * iTemp ) >> uiShift); 1109 iTemp = piOrg[13] - piCur[13]; uiSum += Distortion(( iTemp * iTemp ) >> uiShift); 1110 iTemp = piOrg[14] - piCur[14]; uiSum += Distortion(( iTemp * iTemp ) >> uiShift); 1111 iTemp = piOrg[15] - piCur[15]; uiSum += Distortion(( iTemp * iTemp ) >> uiShift); 1110 1112 1111 1113 piOrg += iStrideOrg; … … 1116 1118 } 1117 1119 1118 UIntTComRdCost::xGetSSE16N( DistParam* pcDtParam )1120 Distortion TComRdCost::xGetSSE16N( DistParam* pcDtParam ) 1119 1121 { 1120 1122 if ( pcDtParam->bApplyWeight ) 1121 1123 { 1122 return xGetSSEw( pcDtParam );1123 } 1124 Pel* piOrg = pcDtParam->pOrg;1125 Pel* piCur = pcDtParam->pCur;1124 return TComRdCostWeightPrediction::xGetSSEw( pcDtParam ); 1125 } 1126 const Pel* piOrg = pcDtParam->pOrg; 1127 const Pel* piCur = pcDtParam->pCur; 1126 1128 Int iRows = pcDtParam->iRows; 1127 1129 Int iCols = pcDtParam->iCols; … … 1129 1131 Int iStrideCur = pcDtParam->iStrideCur; 1130 1132 1131 UInt uiSum = 0; 1132 UInt uiShift = DISTORTION_PRECISION_ADJUSTMENT((pcDtParam->bitDepth-8) << 1); 1133 Int iTemp; 1133 Distortion uiSum = 0; 1134 UInt uiShift = DISTORTION_PRECISION_ADJUSTMENT((pcDtParam->bitDepth-8) << 1); 1135 1136 Intermediate_Int iTemp; 1134 1137 1135 1138 for( ; iRows != 0; iRows-- ) … … 1138 1141 { 1139 1142 1140 iTemp = piOrg[n+ 0] - piCur[n+ 0]; uiSum += ( iTemp * iTemp ) >> uiShift;1141 iTemp = piOrg[n+ 1] - piCur[n+ 1]; uiSum += ( iTemp * iTemp ) >> uiShift;1142 iTemp = piOrg[n+ 2] - piCur[n+ 2]; uiSum += ( iTemp * iTemp ) >> uiShift;1143 iTemp = piOrg[n+ 3] - piCur[n+ 3]; uiSum += ( iTemp * iTemp ) >> uiShift;1144 iTemp = piOrg[n+ 4] - piCur[n+ 4]; uiSum += ( iTemp * iTemp ) >> uiShift;1145 iTemp = piOrg[n+ 5] - piCur[n+ 5]; uiSum += ( iTemp * iTemp ) >> uiShift;1146 iTemp = piOrg[n+ 6] - piCur[n+ 6]; uiSum += ( iTemp * iTemp ) >> uiShift;1147 iTemp = piOrg[n+ 7] - piCur[n+ 7]; uiSum += ( iTemp * iTemp ) >> uiShift;1148 iTemp = piOrg[n+ 8] - piCur[n+ 8]; uiSum += ( iTemp * iTemp ) >> uiShift;1149 iTemp = piOrg[n+ 9] - piCur[n+ 9]; uiSum += ( iTemp * iTemp ) >> uiShift;1150 iTemp = piOrg[n+10] - piCur[n+10]; uiSum += ( iTemp * iTemp ) >> uiShift;1151 iTemp = piOrg[n+11] - piCur[n+11]; uiSum += ( iTemp * iTemp ) >> uiShift;1152 iTemp = piOrg[n+12] - piCur[n+12]; uiSum += ( iTemp * iTemp ) >> uiShift;1153 iTemp = piOrg[n+13] - piCur[n+13]; uiSum += ( iTemp * iTemp ) >> uiShift;1154 iTemp = piOrg[n+14] - piCur[n+14]; uiSum += ( iTemp * iTemp ) >> uiShift;1155 iTemp = piOrg[n+15] - piCur[n+15]; uiSum += ( iTemp * iTemp ) >> uiShift;1143 iTemp = piOrg[n+ 0] - piCur[n+ 0]; uiSum += Distortion(( iTemp * iTemp ) >> uiShift); 1144 iTemp = piOrg[n+ 1] - piCur[n+ 1]; uiSum += Distortion(( iTemp * iTemp ) >> uiShift); 1145 iTemp = piOrg[n+ 2] - piCur[n+ 2]; uiSum += Distortion(( iTemp * iTemp ) >> uiShift); 1146 iTemp = piOrg[n+ 3] - piCur[n+ 3]; uiSum += Distortion(( iTemp * iTemp ) >> uiShift); 1147 iTemp = piOrg[n+ 4] - piCur[n+ 4]; uiSum += Distortion(( iTemp * iTemp ) >> uiShift); 1148 iTemp = piOrg[n+ 5] - piCur[n+ 5]; uiSum += Distortion(( iTemp * iTemp ) >> uiShift); 1149 iTemp = piOrg[n+ 6] - piCur[n+ 6]; uiSum += Distortion(( iTemp * iTemp ) >> uiShift); 1150 iTemp = piOrg[n+ 7] - piCur[n+ 7]; uiSum += Distortion(( iTemp * iTemp ) >> uiShift); 1151 iTemp = piOrg[n+ 8] - piCur[n+ 8]; uiSum += Distortion(( iTemp * iTemp ) >> uiShift); 1152 iTemp = piOrg[n+ 9] - piCur[n+ 9]; uiSum += Distortion(( iTemp * iTemp ) >> uiShift); 1153 iTemp = piOrg[n+10] - piCur[n+10]; uiSum += Distortion(( iTemp * iTemp ) >> uiShift); 1154 iTemp = piOrg[n+11] - piCur[n+11]; uiSum += Distortion(( iTemp * iTemp ) >> uiShift); 1155 iTemp = piOrg[n+12] - piCur[n+12]; uiSum += Distortion(( iTemp * iTemp ) >> uiShift); 1156 iTemp = piOrg[n+13] - piCur[n+13]; uiSum += Distortion(( iTemp * iTemp ) >> uiShift); 1157 iTemp = piOrg[n+14] - piCur[n+14]; uiSum += Distortion(( iTemp * iTemp ) >> uiShift); 1158 iTemp = piOrg[n+15] - piCur[n+15]; uiSum += Distortion(( iTemp * iTemp ) >> uiShift); 1156 1159 1157 1160 } … … 1163 1166 } 1164 1167 1165 UIntTComRdCost::xGetSSE32( DistParam* pcDtParam )1168 Distortion TComRdCost::xGetSSE32( DistParam* pcDtParam ) 1166 1169 { 1167 1170 if ( pcDtParam->bApplyWeight ) 1168 1171 { 1169 1172 assert( pcDtParam->iCols == 32 ); 1170 return xGetSSEw( pcDtParam );1171 } 1172 Pel* piOrg = pcDtParam->pOrg;1173 Pel* piCur = pcDtParam->pCur;1173 return TComRdCostWeightPrediction::xGetSSEw( pcDtParam ); 1174 } 1175 const Pel* piOrg = pcDtParam->pOrg; 1176 const Pel* piCur = pcDtParam->pCur; 1174 1177 Int iRows = pcDtParam->iRows; 1175 1178 Int iStrideOrg = pcDtParam->iStrideOrg; 1176 1179 Int iStrideCur = pcDtParam->iStrideCur; 1177 1180 1178 UInt uiSum = 0; 1179 UInt uiShift = DISTORTION_PRECISION_ADJUSTMENT((pcDtParam->bitDepth-8) << 1); 1180 Int iTemp; 1181 Distortion uiSum = 0; 1182 UInt uiShift = DISTORTION_PRECISION_ADJUSTMENT((pcDtParam->bitDepth-8) << 1); 1183 1184 Intermediate_Int iTemp; 1181 1185 1182 1186 for( ; iRows != 0; iRows-- ) 1183 1187 { 1184 1188 1185 iTemp = piOrg[ 0] - piCur[ 0]; uiSum += ( iTemp * iTemp ) >> uiShift;1186 iTemp = piOrg[ 1] - piCur[ 1]; uiSum += ( iTemp * iTemp ) >> uiShift;1187 iTemp = piOrg[ 2] - piCur[ 2]; uiSum += ( iTemp * iTemp ) >> uiShift;1188 iTemp = piOrg[ 3] - piCur[ 3]; uiSum += ( iTemp * iTemp ) >> uiShift;1189 iTemp = piOrg[ 4] - piCur[ 4]; uiSum += ( iTemp * iTemp ) >> uiShift;1190 iTemp = piOrg[ 5] - piCur[ 5]; uiSum += ( iTemp * iTemp ) >> uiShift;1191 iTemp = piOrg[ 6] - piCur[ 6]; uiSum += ( iTemp * iTemp ) >> uiShift;1192 iTemp = piOrg[ 7] - piCur[ 7]; uiSum += ( iTemp * iTemp ) >> uiShift;1193 iTemp = piOrg[ 8] - piCur[ 8]; uiSum += ( iTemp * iTemp ) >> uiShift;1194 iTemp = piOrg[ 9] - piCur[ 9]; uiSum += ( iTemp * iTemp ) >> uiShift;1195 iTemp = piOrg[10] - piCur[10]; uiSum += ( iTemp * iTemp ) >> uiShift;1196 iTemp = piOrg[11] - piCur[11]; uiSum += ( iTemp * iTemp ) >> uiShift;1197 iTemp = piOrg[12] - piCur[12]; uiSum += ( iTemp * iTemp ) >> uiShift;1198 iTemp = piOrg[13] - piCur[13]; uiSum += ( iTemp * iTemp ) >> uiShift;1199 iTemp = piOrg[14] - piCur[14]; uiSum += ( iTemp * iTemp ) >> uiShift;1200 iTemp = piOrg[15] - piCur[15]; uiSum += ( iTemp * iTemp ) >> uiShift;1201 iTemp = piOrg[16] - piCur[16]; uiSum += ( iTemp * iTemp ) >> uiShift;1202 iTemp = piOrg[17] - piCur[17]; uiSum += ( iTemp * iTemp ) >> uiShift;1203 iTemp = piOrg[18] - piCur[18]; uiSum += ( iTemp * iTemp ) >> uiShift;1204 iTemp = piOrg[19] - piCur[19]; uiSum += ( iTemp * iTemp ) >> uiShift;1205 iTemp = piOrg[20] - piCur[20]; uiSum += ( iTemp * iTemp ) >> uiShift;1206 iTemp = piOrg[21] - piCur[21]; uiSum += ( iTemp * iTemp ) >> uiShift;1207 iTemp = piOrg[22] - piCur[22]; uiSum += ( iTemp * iTemp ) >> uiShift;1208 iTemp = piOrg[23] - piCur[23]; uiSum += ( iTemp * iTemp ) >> uiShift;1209 iTemp = piOrg[24] - piCur[24]; uiSum += ( iTemp * iTemp ) >> uiShift;1210 iTemp = piOrg[25] - piCur[25]; uiSum += ( iTemp * iTemp ) >> uiShift;1211 iTemp = piOrg[26] - piCur[26]; uiSum += ( iTemp * iTemp ) >> uiShift;1212 iTemp = piOrg[27] - piCur[27]; uiSum += ( iTemp * iTemp ) >> uiShift;1213 iTemp = piOrg[28] - piCur[28]; uiSum += ( iTemp * iTemp ) >> uiShift;1214 iTemp = piOrg[29] - piCur[29]; uiSum += ( iTemp * iTemp ) >> uiShift;1215 iTemp = piOrg[30] - piCur[30]; uiSum += ( iTemp * iTemp ) >> uiShift;1216 iTemp = piOrg[31] - piCur[31]; uiSum += ( iTemp * iTemp ) >> uiShift;1189 iTemp = piOrg[ 0] - piCur[ 0]; uiSum += Distortion(( iTemp * iTemp ) >> uiShift); 1190 iTemp = piOrg[ 1] - piCur[ 1]; uiSum += Distortion(( iTemp * iTemp ) >> uiShift); 1191 iTemp = piOrg[ 2] - piCur[ 2]; uiSum += Distortion(( iTemp * iTemp ) >> uiShift); 1192 iTemp = piOrg[ 3] - piCur[ 3]; uiSum += Distortion(( iTemp * iTemp ) >> uiShift); 1193 iTemp = piOrg[ 4] - piCur[ 4]; uiSum += Distortion(( iTemp * iTemp ) >> uiShift); 1194 iTemp = piOrg[ 5] - piCur[ 5]; uiSum += Distortion(( iTemp * iTemp ) >> uiShift); 1195 iTemp = piOrg[ 6] - piCur[ 6]; uiSum += Distortion(( iTemp * iTemp ) >> uiShift); 1196 iTemp = piOrg[ 7] - piCur[ 7]; uiSum += Distortion(( iTemp * iTemp ) >> uiShift); 1197 iTemp = piOrg[ 8] - piCur[ 8]; uiSum += Distortion(( iTemp * iTemp ) >> uiShift); 1198 iTemp = piOrg[ 9] - piCur[ 9]; uiSum += Distortion(( iTemp * iTemp ) >> uiShift); 1199 iTemp = piOrg[10] - piCur[10]; uiSum += Distortion(( iTemp * iTemp ) >> uiShift); 1200 iTemp = piOrg[11] - piCur[11]; uiSum += Distortion(( iTemp * iTemp ) >> uiShift); 1201 iTemp = piOrg[12] - piCur[12]; uiSum += Distortion(( iTemp * iTemp ) >> uiShift); 1202 iTemp = piOrg[13] - piCur[13]; uiSum += Distortion(( iTemp * iTemp ) >> uiShift); 1203 iTemp = piOrg[14] - piCur[14]; uiSum += Distortion(( iTemp * iTemp ) >> uiShift); 1204 iTemp = piOrg[15] - piCur[15]; uiSum += Distortion(( iTemp * iTemp ) >> uiShift); 1205 iTemp = piOrg[16] - piCur[16]; uiSum += Distortion(( iTemp * iTemp ) >> uiShift); 1206 iTemp = piOrg[17] - piCur[17]; uiSum += Distortion(( iTemp * iTemp ) >> uiShift); 1207 iTemp = piOrg[18] - piCur[18]; uiSum += Distortion(( iTemp * iTemp ) >> uiShift); 1208 iTemp = piOrg[19] - piCur[19]; uiSum += Distortion(( iTemp * iTemp ) >> uiShift); 1209 iTemp = piOrg[20] - piCur[20]; uiSum += Distortion(( iTemp * iTemp ) >> uiShift); 1210 iTemp = piOrg[21] - piCur[21]; uiSum += Distortion(( iTemp * iTemp ) >> uiShift); 1211 iTemp = piOrg[22] - piCur[22]; uiSum += Distortion(( iTemp * iTemp ) >> uiShift); 1212 iTemp = piOrg[23] - piCur[23]; uiSum += Distortion(( iTemp * iTemp ) >> uiShift); 1213 iTemp = piOrg[24] - piCur[24]; uiSum += Distortion(( iTemp * iTemp ) >> uiShift); 1214 iTemp = piOrg[25] - piCur[25]; uiSum += Distortion(( iTemp * iTemp ) >> uiShift); 1215 iTemp = piOrg[26] - piCur[26]; uiSum += Distortion(( iTemp * iTemp ) >> uiShift); 1216 iTemp = piOrg[27] - piCur[27]; uiSum += Distortion(( iTemp * iTemp ) >> uiShift); 1217 iTemp = piOrg[28] - piCur[28]; uiSum += Distortion(( iTemp * iTemp ) >> uiShift); 1218 iTemp = piOrg[29] - piCur[29]; uiSum += Distortion(( iTemp * iTemp ) >> uiShift); 1219 iTemp = piOrg[30] - piCur[30]; uiSum += Distortion(( iTemp * iTemp ) >> uiShift); 1220 iTemp = piOrg[31] - piCur[31]; uiSum += Distortion(( iTemp * iTemp ) >> uiShift); 1217 1221 1218 1222 piOrg += iStrideOrg; … … 1223 1227 } 1224 1228 1225 UIntTComRdCost::xGetSSE64( DistParam* pcDtParam )1229 Distortion TComRdCost::xGetSSE64( DistParam* pcDtParam ) 1226 1230 { 1227 1231 if ( pcDtParam->bApplyWeight ) 1228 1232 { 1229 1233 assert( pcDtParam->iCols == 64 ); 1230 return xGetSSEw( pcDtParam );1231 } 1232 Pel* piOrg = pcDtParam->pOrg;1233 Pel* piCur = pcDtParam->pCur;1234 return TComRdCostWeightPrediction::xGetSSEw( pcDtParam ); 1235 } 1236 const Pel* piOrg = pcDtParam->pOrg; 1237 const Pel* piCur = pcDtParam->pCur; 1234 1238 Int iRows = pcDtParam->iRows; 1235 1239 Int iStrideOrg = pcDtParam->iStrideOrg; 1236 1240 Int iStrideCur = pcDtParam->iStrideCur; 1237 1241 1238 UInt uiSum = 0; 1239 UInt uiShift = DISTORTION_PRECISION_ADJUSTMENT((pcDtParam->bitDepth-8) << 1); 1240 Int iTemp; 1242 Distortion uiSum = 0; 1243 UInt uiShift = DISTORTION_PRECISION_ADJUSTMENT((pcDtParam->bitDepth-8) << 1); 1244 1245 Intermediate_Int iTemp; 1241 1246 1242 1247 for( ; iRows != 0; iRows-- ) 1243 1248 { 1244 iTemp = piOrg[ 0] - piCur[ 0]; uiSum += ( iTemp * iTemp ) >> uiShift;1245 iTemp = piOrg[ 1] - piCur[ 1]; uiSum += ( iTemp * iTemp ) >> uiShift;1246 iTemp = piOrg[ 2] - piCur[ 2]; uiSum += ( iTemp * iTemp ) >> uiShift;1247 iTemp = piOrg[ 3] - piCur[ 3]; uiSum += ( iTemp * iTemp ) >> uiShift;1248 iTemp = piOrg[ 4] - piCur[ 4]; uiSum += ( iTemp * iTemp ) >> uiShift;1249 iTemp = piOrg[ 5] - piCur[ 5]; uiSum += ( iTemp * iTemp ) >> uiShift;1250 iTemp = piOrg[ 6] - piCur[ 6]; uiSum += ( iTemp * iTemp ) >> uiShift;1251 iTemp = piOrg[ 7] - piCur[ 7]; uiSum += ( iTemp * iTemp ) >> uiShift;1252 iTemp = piOrg[ 8] - piCur[ 8]; uiSum += ( iTemp * iTemp ) >> uiShift;1253 iTemp = piOrg[ 9] - piCur[ 9]; uiSum += ( iTemp * iTemp ) >> uiShift;1254 iTemp = piOrg[10] - piCur[10]; uiSum += ( iTemp * iTemp ) >> uiShift;1255 iTemp = piOrg[11] - piCur[11]; uiSum += ( iTemp * iTemp ) >> uiShift;1256 iTemp = piOrg[12] - piCur[12]; uiSum += ( iTemp * iTemp ) >> uiShift;1257 iTemp = piOrg[13] - piCur[13]; uiSum += ( iTemp * iTemp ) >> uiShift;1258 iTemp = piOrg[14] - piCur[14]; uiSum += ( iTemp * iTemp ) >> uiShift;1259 iTemp = piOrg[15] - piCur[15]; uiSum += ( iTemp * iTemp ) >> uiShift;1260 iTemp = piOrg[16] - piCur[16]; uiSum += ( iTemp * iTemp ) >> uiShift;1261 iTemp = piOrg[17] - piCur[17]; uiSum += ( iTemp * iTemp ) >> uiShift;1262 iTemp = piOrg[18] - piCur[18]; uiSum += ( iTemp * iTemp ) >> uiShift;1263 iTemp = piOrg[19] - piCur[19]; uiSum += ( iTemp * iTemp ) >> uiShift;1264 iTemp = piOrg[20] - piCur[20]; uiSum += ( iTemp * iTemp ) >> uiShift;1265 iTemp = piOrg[21] - piCur[21]; uiSum += ( iTemp * iTemp ) >> uiShift;1266 iTemp = piOrg[22] - piCur[22]; uiSum += ( iTemp * iTemp ) >> uiShift;1267 iTemp = piOrg[23] - piCur[23]; uiSum += ( iTemp * iTemp ) >> uiShift;1268 iTemp = piOrg[24] - piCur[24]; uiSum += ( iTemp * iTemp ) >> uiShift;1269 iTemp = piOrg[25] - piCur[25]; uiSum += ( iTemp * iTemp ) >> uiShift;1270 iTemp = piOrg[26] - piCur[26]; uiSum += ( iTemp * iTemp ) >> uiShift;1271 iTemp = piOrg[27] - piCur[27]; uiSum += ( iTemp * iTemp ) >> uiShift;1272 iTemp = piOrg[28] - piCur[28]; uiSum += ( iTemp * iTemp ) >> uiShift;1273 iTemp = piOrg[29] - piCur[29]; uiSum += ( iTemp * iTemp ) >> uiShift;1274 iTemp = piOrg[30] - piCur[30]; uiSum += ( iTemp * iTemp ) >> uiShift;1275 iTemp = piOrg[31] - piCur[31]; uiSum += ( iTemp * iTemp ) >> uiShift;1276 iTemp = piOrg[32] - piCur[32]; uiSum += ( iTemp * iTemp ) >> uiShift;1277 iTemp = piOrg[33] - piCur[33]; uiSum += ( iTemp * iTemp ) >> uiShift;1278 iTemp = piOrg[34] - piCur[34]; uiSum += ( iTemp * iTemp ) >> uiShift;1279 iTemp = piOrg[35] - piCur[35]; uiSum += ( iTemp * iTemp ) >> uiShift;1280 iTemp = piOrg[36] - piCur[36]; uiSum += ( iTemp * iTemp ) >> uiShift;1281 iTemp = piOrg[37] - piCur[37]; uiSum += ( iTemp * iTemp ) >> uiShift;1282 iTemp = piOrg[38] - piCur[38]; uiSum += ( iTemp * iTemp ) >> uiShift;1283 iTemp = piOrg[39] - piCur[39]; uiSum += ( iTemp * iTemp ) >> uiShift;1284 iTemp = piOrg[40] - piCur[40]; uiSum += ( iTemp * iTemp ) >> uiShift;1285 iTemp = piOrg[41] - piCur[41]; uiSum += ( iTemp * iTemp ) >> uiShift;1286 iTemp = piOrg[42] - piCur[42]; uiSum += ( iTemp * iTemp ) >> uiShift;1287 iTemp = piOrg[43] - piCur[43]; uiSum += ( iTemp * iTemp ) >> uiShift;1288 iTemp = piOrg[44] - piCur[44]; uiSum += ( iTemp * iTemp ) >> uiShift;1289 iTemp = piOrg[45] - piCur[45]; uiSum += ( iTemp * iTemp ) >> uiShift;1290 iTemp = piOrg[46] - piCur[46]; uiSum += ( iTemp * iTemp ) >> uiShift;1291 iTemp = piOrg[47] - piCur[47]; uiSum += ( iTemp * iTemp ) >> uiShift;1292 iTemp = piOrg[48] - piCur[48]; uiSum += ( iTemp * iTemp ) >> uiShift;1293 iTemp = piOrg[49] - piCur[49]; uiSum += ( iTemp * iTemp ) >> uiShift;1294 iTemp = piOrg[50] - piCur[50]; uiSum += ( iTemp * iTemp ) >> uiShift;1295 iTemp = piOrg[51] - piCur[51]; uiSum += ( iTemp * iTemp ) >> uiShift;1296 iTemp = piOrg[52] - piCur[52]; uiSum += ( iTemp * iTemp ) >> uiShift;1297 iTemp = piOrg[53] - piCur[53]; uiSum += ( iTemp * iTemp ) >> uiShift;1298 iTemp = piOrg[54] - piCur[54]; uiSum += ( iTemp * iTemp ) >> uiShift;1299 iTemp = piOrg[55] - piCur[55]; uiSum += ( iTemp * iTemp ) >> uiShift;1300 iTemp = piOrg[56] - piCur[56]; uiSum += ( iTemp * iTemp ) >> uiShift;1301 iTemp = piOrg[57] - piCur[57]; uiSum += ( iTemp * iTemp ) >> uiShift;1302 iTemp = piOrg[58] - piCur[58]; uiSum += ( iTemp * iTemp ) >> uiShift;1303 iTemp = piOrg[59] - piCur[59]; uiSum += ( iTemp * iTemp ) >> uiShift;1304 iTemp = piOrg[60] - piCur[60]; uiSum += ( iTemp * iTemp ) >> uiShift;1305 iTemp = piOrg[61] - piCur[61]; uiSum += ( iTemp * iTemp ) >> uiShift;1306 iTemp = piOrg[62] - piCur[62]; uiSum += ( iTemp * iTemp ) >> uiShift;1307 iTemp = piOrg[63] - piCur[63]; uiSum += ( iTemp * iTemp ) >> uiShift;1249 iTemp = piOrg[ 0] - piCur[ 0]; uiSum += Distortion(( iTemp * iTemp ) >> uiShift); 1250 iTemp = piOrg[ 1] - piCur[ 1]; uiSum += Distortion(( iTemp * iTemp ) >> uiShift); 1251 iTemp = piOrg[ 2] - piCur[ 2]; uiSum += Distortion(( iTemp * iTemp ) >> uiShift); 1252 iTemp = piOrg[ 3] - piCur[ 3]; uiSum += Distortion(( iTemp * iTemp ) >> uiShift); 1253 iTemp = piOrg[ 4] - piCur[ 4]; uiSum += Distortion(( iTemp * iTemp ) >> uiShift); 1254 iTemp = piOrg[ 5] - piCur[ 5]; uiSum += Distortion(( iTemp * iTemp ) >> uiShift); 1255 iTemp = piOrg[ 6] - piCur[ 6]; uiSum += Distortion(( iTemp * iTemp ) >> uiShift); 1256 iTemp = piOrg[ 7] - piCur[ 7]; uiSum += Distortion(( iTemp * iTemp ) >> uiShift); 1257 iTemp = piOrg[ 8] - piCur[ 8]; uiSum += Distortion(( iTemp * iTemp ) >> uiShift); 1258 iTemp = piOrg[ 9] - piCur[ 9]; uiSum += Distortion(( iTemp * iTemp ) >> uiShift); 1259 iTemp = piOrg[10] - piCur[10]; uiSum += Distortion(( iTemp * iTemp ) >> uiShift); 1260 iTemp = piOrg[11] - piCur[11]; uiSum += Distortion(( iTemp * iTemp ) >> uiShift); 1261 iTemp = piOrg[12] - piCur[12]; uiSum += Distortion(( iTemp * iTemp ) >> uiShift); 1262 iTemp = piOrg[13] - piCur[13]; uiSum += Distortion(( iTemp * iTemp ) >> uiShift); 1263 iTemp = piOrg[14] - piCur[14]; uiSum += Distortion(( iTemp * iTemp ) >> uiShift); 1264 iTemp = piOrg[15] - piCur[15]; uiSum += Distortion(( iTemp * iTemp ) >> uiShift); 1265 iTemp = piOrg[16] - piCur[16]; uiSum += Distortion(( iTemp * iTemp ) >> uiShift); 1266 iTemp = piOrg[17] - piCur[17]; uiSum += Distortion(( iTemp * iTemp ) >> uiShift); 1267 iTemp = piOrg[18] - piCur[18]; uiSum += Distortion(( iTemp * iTemp ) >> uiShift); 1268 iTemp = piOrg[19] - piCur[19]; uiSum += Distortion(( iTemp * iTemp ) >> uiShift); 1269 iTemp = piOrg[20] - piCur[20]; uiSum += Distortion(( iTemp * iTemp ) >> uiShift); 1270 iTemp = piOrg[21] - piCur[21]; uiSum += Distortion(( iTemp * iTemp ) >> uiShift); 1271 iTemp = piOrg[22] - piCur[22]; uiSum += Distortion(( iTemp * iTemp ) >> uiShift); 1272 iTemp = piOrg[23] - piCur[23]; uiSum += Distortion(( iTemp * iTemp ) >> uiShift); 1273 iTemp = piOrg[24] - piCur[24]; uiSum += Distortion(( iTemp * iTemp ) >> uiShift); 1274 iTemp = piOrg[25] - piCur[25]; uiSum += Distortion(( iTemp * iTemp ) >> uiShift); 1275 iTemp = piOrg[26] - piCur[26]; uiSum += Distortion(( iTemp * iTemp ) >> uiShift); 1276 iTemp = piOrg[27] - piCur[27]; uiSum += Distortion(( iTemp * iTemp ) >> uiShift); 1277 iTemp = piOrg[28] - piCur[28]; uiSum += Distortion(( iTemp * iTemp ) >> uiShift); 1278 iTemp = piOrg[29] - piCur[29]; uiSum += Distortion(( iTemp * iTemp ) >> uiShift); 1279 iTemp = piOrg[30] - piCur[30]; uiSum += Distortion(( iTemp * iTemp ) >> uiShift); 1280 iTemp = piOrg[31] - piCur[31]; uiSum += Distortion(( iTemp * iTemp ) >> uiShift); 1281 iTemp = piOrg[32] - piCur[32]; uiSum += Distortion(( iTemp * iTemp ) >> uiShift); 1282 iTemp = piOrg[33] - piCur[33]; uiSum += Distortion(( iTemp * iTemp ) >> uiShift); 1283 iTemp = piOrg[34] - piCur[34]; uiSum += Distortion(( iTemp * iTemp ) >> uiShift); 1284 iTemp = piOrg[35] - piCur[35]; uiSum += Distortion(( iTemp * iTemp ) >> uiShift); 1285 iTemp = piOrg[36] - piCur[36]; uiSum += Distortion(( iTemp * iTemp ) >> uiShift); 1286 iTemp = piOrg[37] - piCur[37]; uiSum += Distortion(( iTemp * iTemp ) >> uiShift); 1287 iTemp = piOrg[38] - piCur[38]; uiSum += Distortion(( iTemp * iTemp ) >> uiShift); 1288 iTemp = piOrg[39] - piCur[39]; uiSum += Distortion(( iTemp * iTemp ) >> uiShift); 1289 iTemp = piOrg[40] - piCur[40]; uiSum += Distortion(( iTemp * iTemp ) >> uiShift); 1290 iTemp = piOrg[41] - piCur[41]; uiSum += Distortion(( iTemp * iTemp ) >> uiShift); 1291 iTemp = piOrg[42] - piCur[42]; uiSum += Distortion(( iTemp * iTemp ) >> uiShift); 1292 iTemp = piOrg[43] - piCur[43]; uiSum += Distortion(( iTemp * iTemp ) >> uiShift); 1293 iTemp = piOrg[44] - piCur[44]; uiSum += Distortion(( iTemp * iTemp ) >> uiShift); 1294 iTemp = piOrg[45] - piCur[45]; uiSum += Distortion(( iTemp * iTemp ) >> uiShift); 1295 iTemp = piOrg[46] - piCur[46]; uiSum += Distortion(( iTemp * iTemp ) >> uiShift); 1296 iTemp = piOrg[47] - piCur[47]; uiSum += Distortion(( iTemp * iTemp ) >> uiShift); 1297 iTemp = piOrg[48] - piCur[48]; uiSum += Distortion(( iTemp * iTemp ) >> uiShift); 1298 iTemp = piOrg[49] - piCur[49]; uiSum += Distortion(( iTemp * iTemp ) >> uiShift); 1299 iTemp = piOrg[50] - piCur[50]; uiSum += Distortion(( iTemp * iTemp ) >> uiShift); 1300 iTemp = piOrg[51] - piCur[51]; uiSum += Distortion(( iTemp * iTemp ) >> uiShift); 1301 iTemp = piOrg[52] - piCur[52]; uiSum += Distortion(( iTemp * iTemp ) >> uiShift); 1302 iTemp = piOrg[53] - piCur[53]; uiSum += Distortion(( iTemp * iTemp ) >> uiShift); 1303 iTemp = piOrg[54] - piCur[54]; uiSum += Distortion(( iTemp * iTemp ) >> uiShift); 1304 iTemp = piOrg[55] - piCur[55]; uiSum += Distortion(( iTemp * iTemp ) >> uiShift); 1305 iTemp = piOrg[56] - piCur[56]; uiSum += Distortion(( iTemp * iTemp ) >> uiShift); 1306 iTemp = piOrg[57] - piCur[57]; uiSum += Distortion(( iTemp * iTemp ) >> uiShift); 1307 iTemp = piOrg[58] - piCur[58]; uiSum += Distortion(( iTemp * iTemp ) >> uiShift); 1308 iTemp = piOrg[59] - piCur[59]; uiSum += Distortion(( iTemp * iTemp ) >> uiShift); 1309 iTemp = piOrg[60] - piCur[60]; uiSum += Distortion(( iTemp * iTemp ) >> uiShift); 1310 iTemp = piOrg[61] - piCur[61]; uiSum += Distortion(( iTemp * iTemp ) >> uiShift); 1311 iTemp = piOrg[62] - piCur[62]; uiSum += Distortion(( iTemp * iTemp ) >> uiShift); 1312 iTemp = piOrg[63] - piCur[63]; uiSum += Distortion(( iTemp * iTemp ) >> uiShift); 1308 1313 1309 1314 piOrg += iStrideOrg; … … 1318 1323 // -------------------------------------------------------------------------------------------------------------------- 1319 1324 1320 UInt TComRdCost::xCalcHADs2x2( Pel *piOrg, Pel *piCur, Int iStrideOrg, Int iStrideCur, Int iStep ) 1321 { 1322 Int satd = 0, diff[4], m[4]; 1325 Distortion TComRdCost::xCalcHADs2x2( Pel *piOrg, Pel *piCur, Int iStrideOrg, Int iStrideCur, Int iStep ) 1326 { 1327 Distortion satd = 0; 1328 TCoeff diff[4], m[4]; 1323 1329 assert( iStep == 1 ); 1324 1330 diff[0] = piOrg[0 ] - piCur[0]; … … 1339 1345 } 1340 1346 1341 UInt TComRdCost::xCalcHADs4x4( Pel *piOrg, Pel *piCur, Int iStrideOrg, Int iStrideCur, Int iStep ) 1342 { 1343 Int k, satd = 0, diff[16], m[16], d[16]; 1347 Distortion TComRdCost::xCalcHADs4x4( Pel *piOrg, Pel *piCur, Int iStrideOrg, Int iStrideCur, Int iStep ) 1348 { 1349 Int k; 1350 Distortion satd = 0; 1351 TCoeff diff[16], m[16], d[16]; 1344 1352 1345 1353 assert( iStep == 1 ); … … 1433 1441 } 1434 1442 1435 UInt TComRdCost::xCalcHADs8x8( Pel *piOrg, Pel *piCur, Int iStrideOrg, Int iStrideCur, Int iStep ) 1436 { 1437 Int k, i, j, jj, sad=0; 1438 Int diff[64], m1[8][8], m2[8][8], m3[8][8]; 1443 Distortion TComRdCost::xCalcHADs8x8( Pel *piOrg, Pel *piCur, Int iStrideOrg, Int iStrideCur, Int iStep ) 1444 { 1445 Int k, i, j, jj; 1446 Distortion sad = 0; 1447 TCoeff diff[64], m1[8][8], m2[8][8], m3[8][8]; 1439 1448 assert( iStep == 1 ); 1440 1449 for( k = 0; k < 64; k += 8 ) … … 1529 1538 } 1530 1539 1531 UInt TComRdCost::xGetHADs4( DistParam* pcDtParam ) 1540 1541 Distortion TComRdCost::xGetHADs( DistParam* pcDtParam ) 1532 1542 { 1533 1543 if ( pcDtParam->bApplyWeight ) 1534 1544 { 1535 return xGetHADs4w( pcDtParam ); 1536 } 1537 Pel* piOrg = pcDtParam->pOrg; 1538 Pel* piCur = pcDtParam->pCur; 1539 Int iRows = pcDtParam->iRows; 1540 Int iStrideCur = pcDtParam->iStrideCur; 1541 Int iStrideOrg = pcDtParam->iStrideOrg; 1542 Int iStep = pcDtParam->iStep; 1543 Int y; 1544 Int iOffsetOrg = iStrideOrg<<2; 1545 Int iOffsetCur = iStrideCur<<2; 1546 1547 UInt uiSum = 0; 1548 1549 for ( y=0; y<iRows; y+= 4 ) 1550 { 1551 uiSum += xCalcHADs4x4( piOrg, piCur, iStrideOrg, iStrideCur, iStep ); 1552 piOrg += iOffsetOrg; 1553 piCur += iOffsetCur; 1554 } 1555 1556 return uiSum >> DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth-8); 1557 } 1558 1559 UInt TComRdCost::xGetHADs8( DistParam* pcDtParam ) 1560 { 1561 if ( pcDtParam->bApplyWeight ) 1562 { 1563 return xGetHADs8w( pcDtParam ); 1564 } 1565 Pel* piOrg = pcDtParam->pOrg; 1566 Pel* piCur = pcDtParam->pCur; 1567 Int iRows = pcDtParam->iRows; 1568 Int iStrideCur = pcDtParam->iStrideCur; 1569 Int iStrideOrg = pcDtParam->iStrideOrg; 1570 Int iStep = pcDtParam->iStep; 1571 Int y; 1572 1573 UInt uiSum = 0; 1574 1575 if ( iRows == 4 ) 1576 { 1577 uiSum += xCalcHADs4x4( piOrg+0, piCur , iStrideOrg, iStrideCur, iStep ); 1578 uiSum += xCalcHADs4x4( piOrg+4, piCur+4*iStep, iStrideOrg, iStrideCur, iStep ); 1579 } 1580 else 1581 { 1582 Int iOffsetOrg = iStrideOrg<<3; 1583 Int iOffsetCur = iStrideCur<<3; 1584 for ( y=0; y<iRows; y+= 8 ) 1585 { 1586 uiSum += xCalcHADs8x8( piOrg, piCur, iStrideOrg, iStrideCur, iStep ); 1587 piOrg += iOffsetOrg; 1588 piCur += iOffsetCur; 1589 } 1590 } 1591 1592 return uiSum >> DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth-8); 1593 } 1594 1595 UInt TComRdCost::xGetHADs( DistParam* pcDtParam ) 1596 { 1597 if ( pcDtParam->bApplyWeight ) 1598 { 1599 return xGetHADsw( pcDtParam ); 1545 return TComRdCostWeightPrediction::xGetHADsw( pcDtParam ); 1600 1546 } 1601 1547 Pel* piOrg = pcDtParam->pOrg; … … 1609 1555 Int x, y; 1610 1556 1611 UIntuiSum = 0;1557 Distortion uiSum = 0; 1612 1558 1613 1559 if( ( iRows % 8 == 0) && (iCols % 8 == 0) ) … … 1659 1605 } 1660 1606 1661 return uiSum >> DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth-8);1607 return ( uiSum >> DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth-8) ); 1662 1608 } 1663 1609
Note: See TracChangeset for help on using the changeset viewer.