Changeset 1200 in 3DVCSoftware for branches/HTM-14.1-update-dev0/source/Lib/TLibCommon/TComRdCostWeightPrediction.cpp
- Timestamp:
- 4 May 2015, 18:38:08 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HTM-14.1-update-dev0/source/Lib/TLibCommon/TComRdCostWeightPrediction.cpp
r1179 r1200 2 2 * License, included below. This software may be subject to other third party 3 3 * and contributor rights, including patent rights, and no such rights are 4 * granted under this license. 4 * granted under this license. 5 5 * 6 * Copyright (c) 2010-2015, ITU/ISO/IEC6 * Copyright (c) 2010-2015, ITU/ISO/IEC 7 7 * All rights reserved. 8 8 * … … 41 41 #include "TComRdCostWeightPrediction.h" 42 42 43 Int TComRdCostWeightPrediction::m_w0 = 0; 44 Int TComRdCostWeightPrediction::m_w1 = 0; 45 Int TComRdCostWeightPrediction::m_shift = 0; 46 Int TComRdCostWeightPrediction::m_offset = 0; 47 Int TComRdCostWeightPrediction::m_round = 0; 48 Bool TComRdCostWeightPrediction::m_xSetDone = false; 49 50 // ==================================================================================================================== 51 // Distortion functions 52 // ==================================================================================================================== 53 54 TComRdCostWeightPrediction::TComRdCostWeightPrediction() 55 { 56 } 57 58 TComRdCostWeightPrediction::~TComRdCostWeightPrediction() 59 { 60 } 43 static Distortion xCalcHADs2x2w( const WPScalingParam &wpCur, const Pel *piOrg, const Pel *piCurr, Int iStrideOrg, Int iStrideCur, Int iStep ); 44 static Distortion xCalcHADs4x4w( const WPScalingParam &wpCur, const Pel *piOrg, const Pel *piCurr, Int iStrideOrg, Int iStrideCur, Int iStep ); 45 static Distortion xCalcHADs8x8w( const WPScalingParam &wpCur, const Pel *piOrg, const Pel *piCurr, Int iStrideOrg, Int iStrideCur, Int iStep ); 46 61 47 62 48 // -------------------------------------------------------------------------------------------------------------------- … … 65 51 /** get weighted SAD cost 66 52 * \param pcDtParam 67 * \returns UInt53 * \returns Distortion 68 54 */ 69 UIntTComRdCostWeightPrediction::xGetSADw( DistParam* pcDtParam )70 { 71 Pel pred;72 Pel* piOrg = pcDtParam->pOrg;73 Pel* piCur = pcDtParam->pCur;74 Int iRows = pcDtParam->iRows;75 Int iCols = pcDtParam->iCols;76 Int iStrideCur = pcDtParam->iStrideCur;77 Int iStrideOrg = pcDtParam->iStrideOrg; 78 79 UInt uiComp = pcDtParam->uiComp; 80 assert(uiComp<3);81 wpScalingParam *wpCur = &(pcDtParam->wpCur[uiComp]); 82 Int w0 = wpCur->w,83 offset = wpCur->offset,84 shift = wpCur->shift,85 round = wpCur->round;86 87 UIntuiSum = 0;88 89 for( 55 Distortion TComRdCostWeightPrediction::xGetSADw( DistParam* pcDtParam ) 56 { 57 const Pel *piOrg = pcDtParam->pOrg; 58 const Pel *piCur = pcDtParam->pCur; 59 const Int iCols = pcDtParam->iCols; 60 const Int iStrideCur = pcDtParam->iStrideCur; 61 const Int iStrideOrg = pcDtParam->iStrideOrg; 62 const ComponentID compID = pcDtParam->compIdx; 63 64 assert(compID<MAX_NUM_COMPONENT); 65 66 const WPScalingParam &wpCur = pcDtParam->wpCur[compID]; 67 68 const Int w0 = wpCur.w; 69 const Int offset = wpCur.offset; 70 const Int shift = wpCur.shift; 71 const Int round = wpCur.round; 72 73 Distortion uiSum = 0; 74 75 for(Int iRows = pcDtParam->iRows; iRows != 0; iRows-- ) 90 76 { 91 77 for (Int n = 0; n < iCols; n++ ) 92 78 { 93 pred = ( (w0*piCur[n] + round) >> shift ) + offset ;94 79 const Pel pred = ( (w0*piCur[n] + round) >> shift ) + offset ; 80 95 81 uiSum += abs( piOrg[n] - pred ); 96 82 } … … 98 84 piCur += iStrideCur; 99 85 } 100 101 pcDtParam-> uiComp = 255; // reset for DEBUG (assert test)86 87 pcDtParam->compIdx = MAX_NUM_COMPONENT; // reset for DEBUG (assert test) 102 88 103 89 return uiSum >> DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth-8); 104 90 } 91 105 92 106 93 // -------------------------------------------------------------------------------------------------------------------- … … 109 96 /** get weighted SSD cost 110 97 * \param pcDtParam 111 * \returns UInt98 * \returns Distortion 112 99 */ 113 UInt TComRdCostWeightPrediction::xGetSSEw( DistParam* pcDtParam ) 114 { 115 Pel* piOrg = pcDtParam->pOrg; 116 Pel* piCur = pcDtParam->pCur; 117 Pel pred; 118 Int iRows = pcDtParam->iRows; 119 Int iCols = pcDtParam->iCols; 120 Int iStrideOrg = pcDtParam->iStrideOrg; 121 Int iStrideCur = pcDtParam->iStrideCur; 122 123 assert( pcDtParam->iSubShift == 0 ); 124 125 UInt uiComp = pcDtParam->uiComp; 126 assert(uiComp<3); 127 wpScalingParam *wpCur = &(pcDtParam->wpCur[uiComp]); 128 Int w0 = wpCur->w, 129 offset = wpCur->offset, 130 shift = wpCur->shift, 131 round = wpCur->round; 132 133 UInt uiSum = 0; 134 UInt uiShift = DISTORTION_PRECISION_ADJUSTMENT((pcDtParam->bitDepth-8) << 1); 135 136 Int iTemp; 137 138 for( ; iRows != 0; iRows-- ) 100 Distortion TComRdCostWeightPrediction::xGetSSEw( DistParam* pcDtParam ) 101 { 102 const Pel *piOrg = pcDtParam->pOrg; 103 const Pel *piCur = pcDtParam->pCur; 104 const Int iCols = pcDtParam->iCols; 105 const Int iStrideOrg = pcDtParam->iStrideOrg; 106 const Int iStrideCur = pcDtParam->iStrideCur; 107 const ComponentID compIdx = pcDtParam->compIdx; 108 109 assert( pcDtParam->iSubShift == 0 ); // NOTE: what is this protecting? 110 111 assert(compIdx<MAX_NUM_COMPONENT); 112 const WPScalingParam &wpCur = pcDtParam->wpCur[compIdx]; 113 const Int w0 = wpCur.w; 114 const Int offset = wpCur.offset; 115 const Int shift = wpCur.shift; 116 const Int round = wpCur.round; 117 const UInt distortionShift = DISTORTION_PRECISION_ADJUSTMENT((pcDtParam->bitDepth-8) << 1); 118 119 Distortion sum = 0; 120 121 for(Int iRows = pcDtParam->iRows ; iRows != 0; iRows-- ) 139 122 { 140 123 for (Int n = 0; n < iCols; n++ ) 141 124 { 142 pred = ( (w0*piCur[n] + round) >> shift ) + offset ; 143 144 iTemp = piOrg[n ] - pred; 145 uiSum += ( iTemp * iTemp ) >> uiShift; 125 const Pel pred = ( (w0*piCur[n] + round) >> shift ) + offset ; 126 const Pel residual = piOrg[n] - pred; 127 sum += ( Distortion(residual) * Distortion(residual) ) >> distortionShift; 146 128 } 147 129 piOrg += iStrideOrg; 148 130 piCur += iStrideCur; 149 131 } 150 151 pcDtParam->uiComp = 255; // reset for DEBUG (assert test) 152 153 return ( uiSum ); 154 } 132 133 pcDtParam->compIdx = MAX_NUM_COMPONENT; // reset for DEBUG (assert test) 134 135 return sum; 136 } 137 155 138 156 139 // -------------------------------------------------------------------------------------------------------------------- 157 140 // HADAMARD with step (used in fractional search) 158 141 // -------------------------------------------------------------------------------------------------------------------- 159 /** get weighted Hadamard cost for 2x2 block 160 * \param *piOrg 161 * \param *piCur 162 * \param iStrideOrg 163 * \param iStrideCur 164 * \param iStep 165 * \returns UInt 166 */ 167 UInt TComRdCostWeightPrediction::xCalcHADs2x2w( Pel *piOrg, Pel *piCur, Int iStrideOrg, Int iStrideCur, Int iStep ) 168 { 169 Int satd = 0, diff[4], m[4]; 170 171 assert( m_xSetDone ); 142 //! get weighted Hadamard cost for 2x2 block 143 Distortion xCalcHADs2x2w( const WPScalingParam &wpCur, const Pel *piOrg, const Pel *piCur, Int iStrideOrg, Int iStrideCur, Int iStep ) 144 { 145 const Int round = wpCur.round; 146 const Int shift = wpCur.shift; 147 const Int offset = wpCur.offset; 148 const Int w0 = wpCur.w; 149 150 Distortion satd = 0; 151 TCoeff diff[4]; 152 TCoeff m[4]; 153 172 154 Pel pred; 173 155 174 pred = ( ( m_w0*piCur[0*iStep ] + m_round) >> m_shift ) + m_offset ;156 pred = ( (w0*piCur[0*iStep ] + round) >> shift ) + offset ; 175 157 diff[0] = piOrg[0 ] - pred; 176 pred = ( ( m_w0*piCur[1*iStep ] + m_round) >> m_shift ) + m_offset ;158 pred = ( (w0*piCur[1*iStep ] + round) >> shift ) + offset ; 177 159 diff[1] = piOrg[1 ] - pred; 178 pred = ( ( m_w0*piCur[0*iStep + iStrideCur] + m_round) >> m_shift ) + m_offset ;160 pred = ( (w0*piCur[0*iStep + iStrideCur] + round) >> shift ) + offset ; 179 161 diff[2] = piOrg[iStrideOrg ] - pred; 180 pred = ( ( m_w0*piCur[1*iStep + iStrideCur] + m_round) >> m_shift ) + m_offset ;162 pred = ( (w0*piCur[1*iStep + iStrideCur] + round) >> shift ) + offset ; 181 163 diff[3] = piOrg[iStrideOrg + 1] - pred; 182 164 … … 185 167 m[2] = diff[0] - diff[2]; 186 168 m[3] = diff[1] - diff[3]; 187 169 188 170 satd += abs(m[0] + m[1]); 189 171 satd += abs(m[0] - m[1]); 190 172 satd += abs(m[2] + m[3]); 191 173 satd += abs(m[2] - m[3]); 192 174 193 175 return satd; 194 176 } 195 177 196 /** get weighted Hadamard cost for 4x4 block 197 * \param *piOrg 198 * \param *piCur 199 * \param iStrideOrg 200 * \param iStrideCur 201 * \param iStep 202 * \returns UInt 203 */ 204 UInt TComRdCostWeightPrediction::xCalcHADs4x4w( Pel *piOrg, Pel *piCur, Int iStrideOrg, Int iStrideCur, Int iStep ) 205 { 206 Int k, satd = 0, diff[16], m[16], d[16]; 207 208 assert( m_xSetDone ); 209 Pel pred; 210 211 for( k = 0; k < 16; k+=4 ) 212 { 213 pred = ( (m_w0*piCur[0*iStep] + m_round) >> m_shift ) + m_offset ; 178 179 //! get weighted Hadamard cost for 4x4 block 180 Distortion xCalcHADs4x4w( const WPScalingParam &wpCur, const Pel *piOrg, const Pel *piCur, Int iStrideOrg, Int iStrideCur, Int iStep ) 181 { 182 const Int round = wpCur.round; 183 const Int shift = wpCur.shift; 184 const Int offset = wpCur.offset; 185 const Int w0 = wpCur.w; 186 187 Distortion satd = 0; 188 TCoeff diff[16]; 189 TCoeff m[16]; 190 TCoeff d[16]; 191 192 193 for(Int k = 0; k < 16; k+=4 ) 194 { 195 Pel pred; 196 pred = ( (w0*piCur[0*iStep] + round) >> shift ) + offset ; 214 197 diff[k+0] = piOrg[0] - pred; 215 pred = ( ( m_w0*piCur[1*iStep] + m_round) >> m_shift ) + m_offset ;198 pred = ( (w0*piCur[1*iStep] + round) >> shift ) + offset ; 216 199 diff[k+1] = piOrg[1] - pred; 217 pred = ( ( m_w0*piCur[2*iStep] + m_round) >> m_shift ) + m_offset ;200 pred = ( (w0*piCur[2*iStep] + round) >> shift ) + offset ; 218 201 diff[k+2] = piOrg[2] - pred; 219 pred = ( ( m_w0*piCur[3*iStep] + m_round) >> m_shift ) + m_offset ;202 pred = ( (w0*piCur[3*iStep] + round) >> shift ) + offset ; 220 203 diff[k+3] = piOrg[3] - pred; 221 204 … … 223 206 piOrg += iStrideOrg; 224 207 } 225 208 226 209 /*===== hadamard transform =====*/ 227 210 m[ 0] = diff[ 0] + diff[12]; … … 241 224 m[14] = diff[ 2] - diff[14]; 242 225 m[15] = diff[ 3] - diff[15]; 243 226 244 227 d[ 0] = m[ 0] + m[ 4]; 245 228 d[ 1] = m[ 1] + m[ 5]; … … 258 241 d[14] = m[14] - m[10]; 259 242 d[15] = m[15] - m[11]; 260 243 261 244 m[ 0] = d[ 0] + d[ 3]; 262 245 m[ 1] = d[ 1] + d[ 2]; … … 275 258 m[14] = d[13] - d[14]; 276 259 m[15] = d[12] - d[15]; 277 260 278 261 d[ 0] = m[ 0] + m[ 1]; 279 262 d[ 1] = m[ 0] - m[ 1]; … … 292 275 d[14] = m[14] + m[15]; 293 276 d[15] = m[15] - m[14]; 294 295 for ( k=0; k<16; ++k)277 278 for (Int k=0; k<16; ++k) 296 279 { 297 280 satd += abs(d[k]); 298 281 } 299 282 satd = ((satd+1)>>1); 300 283 301 284 return satd; 302 285 } 303 286 304 /** get weighted Hadamard cost for 8x8 block 305 * \param *piOrg 306 * \param *piCur 307 * \param iStrideOrg 308 * \param iStrideCur 309 * \param iStep 310 * \returns UInt 311 */ 312 UInt TComRdCostWeightPrediction::xCalcHADs8x8w( Pel *piOrg, Pel *piCur, Int iStrideOrg, Int iStrideCur, Int iStep ) 313 { 314 Int k, i, j, jj, sad=0; 315 Int diff[64], m1[8][8], m2[8][8], m3[8][8]; 287 288 //! get weighted Hadamard cost for 8x8 block 289 Distortion xCalcHADs8x8w( const WPScalingParam &wpCur, const Pel *piOrg, const Pel *piCur, Int iStrideOrg, Int iStrideCur, Int iStep ) 290 { 291 Distortion sad=0; 292 TCoeff diff[64], m1[8][8], m2[8][8], m3[8][8]; 316 293 Int iStep2 = iStep<<1; 317 294 Int iStep3 = iStep2 + iStep; … … 320 297 Int iStep6 = iStep5 + iStep; 321 298 Int iStep7 = iStep6 + iStep; 322 323 assert( m_xSetDone ); 299 const Int round = wpCur.round; 300 const Int shift = wpCur.shift; 301 const Int offset = wpCur.offset; 302 const Int w0 = wpCur.w; 303 324 304 Pel pred; 325 305 326 for( k = 0; k < 64; k+=8 )327 { 328 pred = ( ( m_w0*piCur[ 0] + m_round) >> m_shift ) + m_offset ;306 for(Int k = 0; k < 64; k+=8 ) 307 { 308 pred = ( (w0*piCur[ 0] + round) >> shift ) + offset ; 329 309 diff[k+0] = piOrg[0] - pred; 330 pred = ( ( m_w0*piCur[iStep ] + m_round) >> m_shift ) + m_offset ;310 pred = ( (w0*piCur[iStep ] + round) >> shift ) + offset ; 331 311 diff[k+1] = piOrg[1] - pred; 332 pred = ( ( m_w0*piCur[iStep2] + m_round) >> m_shift ) + m_offset ;312 pred = ( (w0*piCur[iStep2] + round) >> shift ) + offset ; 333 313 diff[k+2] = piOrg[2] - pred; 334 pred = ( ( m_w0*piCur[iStep3] + m_round) >> m_shift ) + m_offset ;314 pred = ( (w0*piCur[iStep3] + round) >> shift ) + offset ; 335 315 diff[k+3] = piOrg[3] - pred; 336 pred = ( ( m_w0*piCur[iStep4] + m_round) >> m_shift ) + m_offset ;316 pred = ( (w0*piCur[iStep4] + round) >> shift ) + offset ; 337 317 diff[k+4] = piOrg[4] - pred; 338 pred = ( ( m_w0*piCur[iStep5] + m_round) >> m_shift ) + m_offset ;318 pred = ( (w0*piCur[iStep5] + round) >> shift ) + offset ; 339 319 diff[k+5] = piOrg[5] - pred; 340 pred = ( ( m_w0*piCur[iStep6] + m_round) >> m_shift ) + m_offset ;320 pred = ( (w0*piCur[iStep6] + round) >> shift ) + offset ; 341 321 diff[k+6] = piOrg[6] - pred; 342 pred = ( ( m_w0*piCur[iStep7] + m_round) >> m_shift ) + m_offset ;322 pred = ( (w0*piCur[iStep7] + round) >> shift ) + offset ; 343 323 diff[k+7] = piOrg[7] - pred; 344 324 345 325 piCur += iStrideCur; 346 326 piOrg += iStrideOrg; 347 327 } 348 328 349 329 //horizontal 350 for ( j=0; j < 8; j++)351 { 352 jj = j << 3;330 for (Int j=0; j < 8; j++) 331 { 332 const Int jj = j << 3; 353 333 m2[j][0] = diff[jj ] + diff[jj+4]; 354 334 m2[j][1] = diff[jj+1] + diff[jj+5]; … … 359 339 m2[j][6] = diff[jj+2] - diff[jj+6]; 360 340 m2[j][7] = diff[jj+3] - diff[jj+7]; 361 341 362 342 m1[j][0] = m2[j][0] + m2[j][2]; 363 343 m1[j][1] = m2[j][1] + m2[j][3]; … … 368 348 m1[j][6] = m2[j][4] - m2[j][6]; 369 349 m1[j][7] = m2[j][5] - m2[j][7]; 370 350 371 351 m2[j][0] = m1[j][0] + m1[j][1]; 372 352 m2[j][1] = m1[j][0] - m1[j][1]; … … 378 358 m2[j][7] = m1[j][6] - m1[j][7]; 379 359 } 380 360 381 361 //vertical 382 for ( i=0; i < 8; i++)362 for (Int i=0; i < 8; i++) 383 363 { 384 364 m3[0][i] = m2[0][i] + m2[4][i]; … … 390 370 m3[6][i] = m2[2][i] - m2[6][i]; 391 371 m3[7][i] = m2[3][i] - m2[7][i]; 392 372 393 373 m1[0][i] = m3[0][i] + m3[2][i]; 394 374 m1[1][i] = m3[1][i] + m3[3][i]; … … 399 379 m1[6][i] = m3[4][i] - m3[6][i]; 400 380 m1[7][i] = m3[5][i] - m3[7][i]; 401 381 402 382 m2[0][i] = m1[0][i] + m1[1][i]; 403 383 m2[1][i] = m1[0][i] - m1[1][i]; … … 409 389 m2[7][i] = m1[6][i] - m1[7][i]; 410 390 } 411 412 for ( j=0; j < 8; j++)413 { 414 for ( i=0; i < 8; i++)391 392 for (Int j=0; j < 8; j++) 393 { 394 for (Int i=0; i < 8; i++) 415 395 { 416 396 sad += (abs(m2[j][i])); 417 397 } 418 398 } 419 399 420 400 sad=((sad+2)>>2); 421 401 422 402 return sad; 423 403 } 424 404 425 /** get weighted Hadamard cost 426 * \param *pcDtParam 427 * \returns UInt 428 */ 429 UInt TComRdCostWeightPrediction::xGetHADs4w( DistParam* pcDtParam ) 430 { 431 Pel* piOrg = pcDtParam->pOrg; 432 Pel* piCur = pcDtParam->pCur; 433 Int iRows = pcDtParam->iRows; 434 Int iStrideCur = pcDtParam->iStrideCur; 435 Int iStrideOrg = pcDtParam->iStrideOrg; 436 Int iStep = pcDtParam->iStep; 437 Int y; 438 Int iOffsetOrg = iStrideOrg<<2; 439 Int iOffsetCur = iStrideCur<<2; 440 441 UInt uiSum = 0; 442 443 for ( y=0; y<iRows; y+= 4 ) 444 { 445 uiSum += xCalcHADs4x4w( piOrg, piCur, iStrideOrg, iStrideCur, iStep ); 446 piOrg += iOffsetOrg; 447 piCur += iOffsetCur; 448 } 449 450 return uiSum >> DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth-8); 451 } 452 453 /** get weighted Hadamard cost 454 * \param *pcDtParam 455 * \returns UInt 456 */ 457 UInt TComRdCostWeightPrediction::xGetHADs8w( DistParam* pcDtParam ) 458 { 459 Pel* piOrg = pcDtParam->pOrg; 460 Pel* piCur = pcDtParam->pCur; 461 Int iRows = pcDtParam->iRows; 462 Int iStrideCur = pcDtParam->iStrideCur; 463 Int iStrideOrg = pcDtParam->iStrideOrg; 464 Int iStep = pcDtParam->iStep; 465 Int y; 466 467 UInt uiSum = 0; 468 469 if ( iRows == 4 ) 470 { 471 uiSum += xCalcHADs4x4w( piOrg+0, piCur , iStrideOrg, iStrideCur, iStep ); 472 uiSum += xCalcHADs4x4w( piOrg+4, piCur+4*iStep, iStrideOrg, iStrideCur, iStep ); 473 } 474 else 475 { 476 Int iOffsetOrg = iStrideOrg<<3; 477 Int iOffsetCur = iStrideCur<<3; 478 for ( y=0; y<iRows; y+= 8 ) 479 { 480 uiSum += xCalcHADs8x8w( piOrg, piCur, iStrideOrg, iStrideCur, iStep ); 481 piOrg += iOffsetOrg; 482 piCur += iOffsetCur; 483 } 484 } 485 486 return uiSum >> DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth-8); 487 } 488 489 /** get weighted Hadamard cost 490 * \param *pcDtParam 491 * \returns UInt 492 */ 493 UInt TComRdCostWeightPrediction::xGetHADsw( DistParam* pcDtParam ) 494 { 495 Pel* piOrg = pcDtParam->pOrg; 496 Pel* piCur = pcDtParam->pCur; 497 Int iRows = pcDtParam->iRows; 498 Int iCols = pcDtParam->iCols; 499 Int iStrideCur = pcDtParam->iStrideCur; 500 Int iStrideOrg = pcDtParam->iStrideOrg; 501 Int iStep = pcDtParam->iStep; 502 503 Int x, y; 504 505 UInt uiComp = pcDtParam->uiComp; 506 assert(uiComp<3); 507 wpScalingParam *wpCur = &(pcDtParam->wpCur[uiComp]); 508 509 xSetWPscale(wpCur->w, 0, wpCur->shift, wpCur->offset, wpCur->round); 510 511 UInt uiSum = 0; 512 405 406 //! get weighted Hadamard cost 407 Distortion TComRdCostWeightPrediction::xGetHADsw( DistParam* pcDtParam ) 408 { 409 const Pel *piOrg = pcDtParam->pOrg; 410 const Pel *piCur = pcDtParam->pCur; 411 const Int iRows = pcDtParam->iRows; 412 const Int iCols = pcDtParam->iCols; 413 const Int iStrideCur = pcDtParam->iStrideCur; 414 const Int iStrideOrg = pcDtParam->iStrideOrg; 415 const Int iStep = pcDtParam->iStep; 416 const ComponentID compIdx = pcDtParam->compIdx; 417 assert(compIdx<MAX_NUM_COMPONENT); 418 const WPScalingParam wpCur = pcDtParam->wpCur[compIdx]; 419 420 Distortion uiSum = 0; 421 513 422 if( ( iRows % 8 == 0) && (iCols % 8 == 0) ) 514 423 { 515 IntiOffsetOrg = iStrideOrg<<3;516 IntiOffsetCur = iStrideCur<<3;517 for ( y=0; y<iRows; y+= 8 )518 { 519 for ( x=0; x<iCols; x+= 8 )424 const Int iOffsetOrg = iStrideOrg<<3; 425 const Int iOffsetCur = iStrideCur<<3; 426 for (Int y=0; y<iRows; y+= 8 ) 427 { 428 for (Int x=0; x<iCols; x+= 8 ) 520 429 { 521 uiSum += xCalcHADs8x8w( &piOrg[x], &piCur[x*iStep], iStrideOrg, iStrideCur, iStep );430 uiSum += xCalcHADs8x8w( wpCur, &piOrg[x], &piCur[x*iStep], iStrideOrg, iStrideCur, iStep ); 522 431 } 523 432 piOrg += iOffsetOrg; … … 527 436 else if( ( iRows % 4 == 0) && (iCols % 4 == 0) ) 528 437 { 529 IntiOffsetOrg = iStrideOrg<<2;530 IntiOffsetCur = iStrideCur<<2;531 532 for ( y=0; y<iRows; y+= 4 )533 { 534 for ( x=0; x<iCols; x+= 4 )438 const Int iOffsetOrg = iStrideOrg<<2; 439 const Int iOffsetCur = iStrideCur<<2; 440 441 for (Int y=0; y<iRows; y+= 4 ) 442 { 443 for (Int x=0; x<iCols; x+= 4 ) 535 444 { 536 uiSum += xCalcHADs4x4w( &piOrg[x], &piCur[x*iStep], iStrideOrg, iStrideCur, iStep );445 uiSum += xCalcHADs4x4w( wpCur, &piOrg[x], &piCur[x*iStep], iStrideOrg, iStrideCur, iStep ); 537 446 } 538 447 piOrg += iOffsetOrg; … … 542 451 else 543 452 { 544 for ( y=0; y<iRows; y+=2 )545 { 546 for ( x=0; x<iCols; x+=2 )453 for (Int y=0; y<iRows; y+=2 ) 454 { 455 for (Int x=0; x<iCols; x+=2 ) 547 456 { 548 uiSum += xCalcHADs2x2w( &piOrg[x], &piCur[x*iStep], iStrideOrg, iStrideCur, iStep );457 uiSum += xCalcHADs2x2w( wpCur, &piOrg[x], &piCur[x*iStep], iStrideOrg, iStrideCur, iStep ); 549 458 } 550 459 piOrg += iStrideOrg; … … 552 461 } 553 462 } 554 555 m_xSetDone = false;556 463 557 464 return uiSum >> DISTORTION_PRECISION_ADJUSTMENT(pcDtParam->bitDepth-8);
Note: See TracChangeset for help on using the changeset viewer.