[5] | 1 | /* The copyright in this software is being made available under the BSD |
---|
| 2 | * License, included below. This software may be subject to other third party |
---|
| 3 | * and contributor rights, including patent rights, and no such rights are |
---|
[56] | 4 | * granted under this license. |
---|
[5] | 5 | * |
---|
[56] | 6 | * Copyright (c) 2010-2012, ITU/ISO/IEC |
---|
[5] | 7 | * All rights reserved. |
---|
| 8 | * |
---|
| 9 | * Redistribution and use in source and binary forms, with or without |
---|
| 10 | * modification, are permitted provided that the following conditions are met: |
---|
| 11 | * |
---|
| 12 | * * Redistributions of source code must retain the above copyright notice, |
---|
| 13 | * this list of conditions and the following disclaimer. |
---|
| 14 | * * Redistributions in binary form must reproduce the above copyright notice, |
---|
| 15 | * this list of conditions and the following disclaimer in the documentation |
---|
| 16 | * and/or other materials provided with the distribution. |
---|
[56] | 17 | * * Neither the name of the ITU/ISO/IEC nor the names of its contributors may |
---|
[5] | 18 | * be used to endorse or promote products derived from this software without |
---|
| 19 | * specific prior written permission. |
---|
| 20 | * |
---|
| 21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
---|
| 22 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
---|
| 23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
---|
| 24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS |
---|
| 25 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
---|
| 26 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
---|
| 27 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
---|
| 28 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
---|
| 29 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
---|
| 30 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF |
---|
| 31 | * THE POSSIBILITY OF SUCH DAMAGE. |
---|
| 32 | */ |
---|
[2] | 33 | |
---|
| 34 | /** \file TComRdCost.cpp |
---|
| 35 | \brief RD cost computation class |
---|
| 36 | */ |
---|
| 37 | |
---|
| 38 | #include <math.h> |
---|
| 39 | #include <assert.h> |
---|
[56] | 40 | #include "TComRom.h" |
---|
[2] | 41 | #include "TComRdCost.h" |
---|
| 42 | #include "TComDataCU.h" |
---|
| 43 | |
---|
[56] | 44 | //! \ingroup TLibCommon |
---|
| 45 | //! \{ |
---|
[2] | 46 | |
---|
[100] | 47 | #if SAIT_VSO_EST_A0033 |
---|
| 48 | Double TComRdCost::m_dDisparityCoeff = 1.0; |
---|
| 49 | #endif |
---|
| 50 | |
---|
[2] | 51 | TComRdCost::TComRdCost() |
---|
| 52 | { |
---|
| 53 | init(); |
---|
| 54 | } |
---|
| 55 | |
---|
| 56 | TComRdCost::~TComRdCost() |
---|
| 57 | { |
---|
[56] | 58 | #if !FIX203 |
---|
[2] | 59 | xUninit(); |
---|
[56] | 60 | #endif |
---|
[2] | 61 | } |
---|
| 62 | |
---|
| 63 | // Calculate RD functions |
---|
[56] | 64 | Double TComRdCost::calcRdCost( UInt uiBits, UInt uiDistortion, Bool bFlag, DFunc eDFunc ) |
---|
[2] | 65 | { |
---|
| 66 | Double dRdCost = 0.0; |
---|
| 67 | Double dLambda = 0.0; |
---|
| 68 | |
---|
| 69 | switch ( eDFunc ) |
---|
| 70 | { |
---|
| 71 | case DF_SSE: |
---|
| 72 | assert(0); |
---|
| 73 | break; |
---|
| 74 | case DF_SAD: |
---|
| 75 | dLambda = (Double)m_uiLambdaMotionSAD; |
---|
| 76 | break; |
---|
| 77 | case DF_DEFAULT: |
---|
| 78 | dLambda = m_dLambda; |
---|
| 79 | break; |
---|
| 80 | case DF_SSE_FRAME: |
---|
| 81 | dLambda = m_dFrameLambda; |
---|
| 82 | break; |
---|
| 83 | default: |
---|
| 84 | assert (0); |
---|
| 85 | break; |
---|
| 86 | } |
---|
| 87 | |
---|
[5] | 88 | #if HHI_INTERVIEW_SKIP_LAMBDA_SCALE |
---|
[2] | 89 | dLambda = m_dLambdaScale * dLambda ; |
---|
| 90 | #endif |
---|
| 91 | if (bFlag) |
---|
| 92 | { |
---|
| 93 | // Intra8x8, Intra4x4 Block only... |
---|
[56] | 94 | #if LOSSLESS_CODING && SEQUENCE_LEVEL_LOSSLESS |
---|
| 95 | dRdCost = (Double)(uiBits); |
---|
| 96 | #else |
---|
[2] | 97 | dRdCost = (((Double)uiDistortion) + ((Double)uiBits * dLambda)); |
---|
[56] | 98 | #endif |
---|
[2] | 99 | } |
---|
| 100 | else |
---|
| 101 | { |
---|
| 102 | if (eDFunc == DF_SAD) |
---|
| 103 | { |
---|
| 104 | dRdCost = ((Double)uiDistortion + (Double)((Int)(uiBits * dLambda+.5)>>16)); |
---|
[56] | 105 | dRdCost = (Double)(UInt)floor(dRdCost); |
---|
[2] | 106 | } |
---|
| 107 | else |
---|
| 108 | { |
---|
[56] | 109 | #if LOSSLESS_CODING && SEQUENCE_LEVEL_LOSSLESS |
---|
| 110 | dRdCost = (Double)(uiBits); |
---|
| 111 | #else |
---|
[2] | 112 | dRdCost = ((Double)uiDistortion + (Double)((Int)(uiBits * dLambda+.5))); |
---|
[56] | 113 | dRdCost = (Double)(UInt)floor(dRdCost); |
---|
| 114 | #endif |
---|
[2] | 115 | } |
---|
| 116 | } |
---|
| 117 | |
---|
| 118 | return dRdCost; |
---|
| 119 | } |
---|
| 120 | |
---|
| 121 | Double TComRdCost::calcRdCost64( UInt64 uiBits, UInt64 uiDistortion, Bool bFlag, DFunc eDFunc ) |
---|
| 122 | { |
---|
| 123 | Double dRdCost = 0.0; |
---|
| 124 | Double dLambda = 0.0; |
---|
| 125 | |
---|
| 126 | switch ( eDFunc ) |
---|
| 127 | { |
---|
| 128 | case DF_SSE: |
---|
| 129 | assert(0); |
---|
| 130 | break; |
---|
| 131 | case DF_SAD: |
---|
| 132 | dLambda = (Double)m_uiLambdaMotionSAD; |
---|
| 133 | break; |
---|
| 134 | case DF_DEFAULT: |
---|
| 135 | dLambda = m_dLambda; |
---|
| 136 | break; |
---|
| 137 | case DF_SSE_FRAME: |
---|
| 138 | dLambda = m_dFrameLambda; |
---|
| 139 | break; |
---|
| 140 | default: |
---|
| 141 | assert (0); |
---|
| 142 | break; |
---|
| 143 | } |
---|
| 144 | |
---|
| 145 | if (bFlag) |
---|
| 146 | { |
---|
| 147 | // Intra8x8, Intra4x4 Block only... |
---|
[56] | 148 | #if LOSSLESS_CODING && SEQUENCE_LEVEL_LOSSLESS |
---|
| 149 | dRdCost = (Double)(uiBits); |
---|
| 150 | #else |
---|
[2] | 151 | dRdCost = (((Double)(Int64)uiDistortion) + ((Double)(Int64)uiBits * dLambda)); |
---|
[56] | 152 | #endif |
---|
[2] | 153 | } |
---|
| 154 | else |
---|
| 155 | { |
---|
| 156 | if (eDFunc == DF_SAD) |
---|
| 157 | { |
---|
| 158 | dRdCost = ((Double)(Int64)uiDistortion + (Double)((Int)((Int64)uiBits * dLambda+.5)>>16)); |
---|
| 159 | dRdCost = (Double)(UInt)floor(dRdCost); |
---|
| 160 | } |
---|
| 161 | else |
---|
| 162 | { |
---|
[56] | 163 | #if LOSSLESS_CODING && SEQUENCE_LEVEL_LOSSLESS |
---|
| 164 | dRdCost = (Double)(uiBits); |
---|
| 165 | #else |
---|
[2] | 166 | dRdCost = ((Double)(Int64)uiDistortion + (Double)((Int)((Int64)uiBits * dLambda+.5))); |
---|
| 167 | dRdCost = (Double)(UInt)floor(dRdCost); |
---|
[56] | 168 | #endif |
---|
[2] | 169 | } |
---|
| 170 | } |
---|
| 171 | |
---|
| 172 | return dRdCost; |
---|
| 173 | } |
---|
| 174 | |
---|
| 175 | Void TComRdCost::setLambda( Double dLambda ) |
---|
| 176 | { |
---|
| 177 | m_dLambda = dLambda; |
---|
| 178 | m_sqrtLambda = sqrt(m_dLambda); |
---|
| 179 | m_uiLambdaMotionSAD = (UInt)floor(65536.0 * m_sqrtLambda); |
---|
| 180 | m_uiLambdaMotionSSE = (UInt)floor(65536.0 * m_dLambda ); |
---|
| 181 | } |
---|
| 182 | |
---|
[5] | 183 | #if HHI_INTER_VIEW_MOTION_PRED |
---|
[2] | 184 | Void |
---|
| 185 | TComRdCost::setLambdaMVReg( Double dLambda ) |
---|
| 186 | { |
---|
| 187 | m_uiLambdaMVRegSAD = (UInt)floor( 65536.0 * sqrt( dLambda ) ); |
---|
| 188 | m_uiLambdaMVRegSSE = (UInt)floor( 65536.0 * dLambda ); |
---|
| 189 | } |
---|
[5] | 190 | #endif |
---|
[2] | 191 | |
---|
| 192 | // Initalize Function Pointer by [eDFunc] |
---|
| 193 | Void TComRdCost::init() |
---|
| 194 | { |
---|
| 195 | m_afpDistortFunc[0] = NULL; // for DF_DEFAULT |
---|
| 196 | |
---|
| 197 | m_afpDistortFunc[1] = TComRdCost::xGetSSE; |
---|
| 198 | m_afpDistortFunc[2] = TComRdCost::xGetSSE4; |
---|
| 199 | m_afpDistortFunc[3] = TComRdCost::xGetSSE8; |
---|
| 200 | m_afpDistortFunc[4] = TComRdCost::xGetSSE16; |
---|
| 201 | m_afpDistortFunc[5] = TComRdCost::xGetSSE32; |
---|
| 202 | m_afpDistortFunc[6] = TComRdCost::xGetSSE64; |
---|
| 203 | m_afpDistortFunc[7] = TComRdCost::xGetSSE16N; |
---|
| 204 | |
---|
| 205 | m_afpDistortFunc[8] = TComRdCost::xGetSAD; |
---|
| 206 | m_afpDistortFunc[9] = TComRdCost::xGetSAD4; |
---|
| 207 | m_afpDistortFunc[10] = TComRdCost::xGetSAD8; |
---|
| 208 | m_afpDistortFunc[11] = TComRdCost::xGetSAD16; |
---|
| 209 | m_afpDistortFunc[12] = TComRdCost::xGetSAD32; |
---|
| 210 | m_afpDistortFunc[13] = TComRdCost::xGetSAD64; |
---|
| 211 | m_afpDistortFunc[14] = TComRdCost::xGetSAD16N; |
---|
| 212 | |
---|
[56] | 213 | m_afpDistortFunc[15] = TComRdCost::xGetSAD; |
---|
| 214 | m_afpDistortFunc[16] = TComRdCost::xGetSAD4; |
---|
| 215 | m_afpDistortFunc[17] = TComRdCost::xGetSAD8; |
---|
| 216 | m_afpDistortFunc[18] = TComRdCost::xGetSAD16; |
---|
| 217 | m_afpDistortFunc[19] = TComRdCost::xGetSAD32; |
---|
| 218 | m_afpDistortFunc[20] = TComRdCost::xGetSAD64; |
---|
| 219 | m_afpDistortFunc[21] = TComRdCost::xGetSAD16N; |
---|
[2] | 220 | |
---|
[56] | 221 | #if AMP_SAD |
---|
| 222 | m_afpDistortFunc[43] = TComRdCost::xGetSAD12; |
---|
| 223 | m_afpDistortFunc[44] = TComRdCost::xGetSAD24; |
---|
| 224 | m_afpDistortFunc[45] = TComRdCost::xGetSAD48; |
---|
| 225 | |
---|
| 226 | m_afpDistortFunc[46] = TComRdCost::xGetSAD12; |
---|
| 227 | m_afpDistortFunc[47] = TComRdCost::xGetSAD24; |
---|
| 228 | m_afpDistortFunc[48] = TComRdCost::xGetSAD48; |
---|
| 229 | #endif |
---|
[2] | 230 | m_afpDistortFunc[22] = TComRdCost::xGetHADs; |
---|
| 231 | m_afpDistortFunc[23] = TComRdCost::xGetHADs; |
---|
| 232 | m_afpDistortFunc[24] = TComRdCost::xGetHADs; |
---|
| 233 | m_afpDistortFunc[25] = TComRdCost::xGetHADs; |
---|
| 234 | m_afpDistortFunc[26] = TComRdCost::xGetHADs; |
---|
| 235 | m_afpDistortFunc[27] = TComRdCost::xGetHADs; |
---|
| 236 | m_afpDistortFunc[28] = TComRdCost::xGetHADs; |
---|
| 237 | |
---|
[100] | 238 | #if SAIT_VSO_EST_A0033 |
---|
| 239 | m_afpDistortFunc[29] = TComRdCost::xGetVSD; |
---|
| 240 | m_afpDistortFunc[30] = TComRdCost::xGetVSD4; |
---|
| 241 | m_afpDistortFunc[31] = TComRdCost::xGetVSD8; |
---|
| 242 | m_afpDistortFunc[32] = TComRdCost::xGetVSD16; |
---|
| 243 | m_afpDistortFunc[33] = TComRdCost::xGetVSD32; |
---|
| 244 | m_afpDistortFunc[34] = TComRdCost::xGetVSD64; |
---|
| 245 | m_afpDistortFunc[35] = TComRdCost::xGetVSD16N; |
---|
| 246 | #endif |
---|
| 247 | |
---|
[56] | 248 | #if !FIX203 |
---|
[2] | 249 | m_puiComponentCostOriginP = NULL; |
---|
| 250 | m_puiComponentCost = NULL; |
---|
| 251 | m_puiVerCost = NULL; |
---|
| 252 | m_puiHorCost = NULL; |
---|
[56] | 253 | #endif |
---|
[2] | 254 | m_uiCost = 0; |
---|
| 255 | m_iCostScale = 0; |
---|
[56] | 256 | #if !FIX203 |
---|
[2] | 257 | m_iSearchLimit = 0xdeaddead; |
---|
| 258 | |
---|
[5] | 259 | #if HHI_VSO |
---|
[2] | 260 | m_apRefPics = NULL; |
---|
| 261 | m_paaiShiftLUTs = NULL; |
---|
| 262 | m_uiNumberRefPics = 0; |
---|
| 263 | m_bUseVSO = false; |
---|
[100] | 264 | #if SAIT_VSO_EST_A0033 |
---|
| 265 | m_bUseEstimatedVSD = false; |
---|
| 266 | #endif |
---|
[2] | 267 | m_uiVSOMode = 0; |
---|
| 268 | m_fpDistortFuncVSO = NULL; |
---|
| 269 | m_pcRenModel = NULL; |
---|
[5] | 270 | #endif |
---|
[2] | 271 | |
---|
[5] | 272 | #if HHI_INTERVIEW_SKIP_LAMBDA_SCALE |
---|
[2] | 273 | m_dLambdaScale = 1; |
---|
| 274 | #endif |
---|
[56] | 275 | #endif |
---|
[2] | 276 | } |
---|
| 277 | |
---|
[56] | 278 | #if !FIX203 |
---|
[2] | 279 | Void TComRdCost::initRateDistortionModel( Int iSubPelSearchLimit ) |
---|
| 280 | { |
---|
| 281 | // make it larger |
---|
| 282 | iSubPelSearchLimit += 4; |
---|
| 283 | iSubPelSearchLimit *= 8; |
---|
| 284 | |
---|
| 285 | if( m_iSearchLimit != iSubPelSearchLimit ) |
---|
| 286 | { |
---|
| 287 | xUninit(); |
---|
| 288 | |
---|
| 289 | m_iSearchLimit = iSubPelSearchLimit; |
---|
| 290 | |
---|
[56] | 291 | m_puiComponentCostOriginP = new UInt[ 4 * iSubPelSearchLimit ]; |
---|
[81] | 292 | m_puiMultiviewRegCostHorOrgP = new UInt[ 4 * iSubPelSearchLimit ]; |
---|
| 293 | m_puiMultiviewRegCostVerOrgP = new UInt[ 4 * iSubPelSearchLimit ]; |
---|
[100] | 294 | |
---|
[2] | 295 | iSubPelSearchLimit *= 2; |
---|
| 296 | |
---|
[56] | 297 | m_puiComponentCost = m_puiComponentCostOriginP + iSubPelSearchLimit; |
---|
[100] | 298 | |
---|
[81] | 299 | m_puiMultiviewRegCostHor = m_puiMultiviewRegCostHorOrgP + iSubPelSearchLimit; |
---|
| 300 | m_puiMultiviewRegCostVer = m_puiMultiviewRegCostVerOrgP + iSubPelSearchLimit; |
---|
[100] | 301 | |
---|
[2] | 302 | |
---|
| 303 | for( Int n = -iSubPelSearchLimit; n < iSubPelSearchLimit; n++) |
---|
| 304 | { |
---|
[56] | 305 | m_puiComponentCost[n] = xGetComponentBits( n ); |
---|
[81] | 306 | m_puiMultiviewRegCostHor[n] = xGetComponentBits( n ); // first version |
---|
| 307 | m_puiMultiviewRegCostVer[n] = xGetComponentBits( n ); // first version |
---|
[2] | 308 | } |
---|
| 309 | } |
---|
| 310 | } |
---|
| 311 | |
---|
| 312 | Void TComRdCost::xUninit() |
---|
| 313 | { |
---|
| 314 | if( NULL != m_puiComponentCostOriginP ) |
---|
| 315 | { |
---|
| 316 | delete [] m_puiComponentCostOriginP; |
---|
| 317 | m_puiComponentCostOriginP = NULL; |
---|
| 318 | } |
---|
[100] | 319 | |
---|
[81] | 320 | if( m_puiMultiviewRegCostHorOrgP ) |
---|
| 321 | { |
---|
| 322 | delete [] m_puiMultiviewRegCostHorOrgP; |
---|
| 323 | m_puiMultiviewRegCostHorOrgP = NULL; |
---|
| 324 | } |
---|
| 325 | if( m_puiMultiviewRegCostVerOrgP ) |
---|
| 326 | { |
---|
| 327 | delete [] m_puiMultiviewRegCostVerOrgP; |
---|
| 328 | m_puiMultiviewRegCostVerOrgP = NULL; |
---|
| 329 | } |
---|
[56] | 330 | } |
---|
[5] | 331 | #endif |
---|
[2] | 332 | |
---|
| 333 | UInt TComRdCost::xGetComponentBits( Int iVal ) |
---|
| 334 | { |
---|
| 335 | UInt uiLength = 1; |
---|
| 336 | UInt uiTemp = ( iVal <= 0) ? (-iVal<<1)+1: (iVal<<1); |
---|
| 337 | |
---|
| 338 | assert ( uiTemp ); |
---|
| 339 | |
---|
| 340 | while ( 1 != uiTemp ) |
---|
| 341 | { |
---|
| 342 | uiTemp >>= 1; |
---|
| 343 | uiLength += 2; |
---|
| 344 | } |
---|
| 345 | |
---|
| 346 | return uiLength; |
---|
| 347 | } |
---|
| 348 | |
---|
| 349 | Void TComRdCost::setDistParam( UInt uiBlkWidth, UInt uiBlkHeight, DFunc eDFunc, DistParam& rcDistParam ) |
---|
| 350 | { |
---|
| 351 | // set Block Width / Height |
---|
| 352 | rcDistParam.iCols = uiBlkWidth; |
---|
| 353 | rcDistParam.iRows = uiBlkHeight; |
---|
| 354 | rcDistParam.DistFunc = m_afpDistortFunc[eDFunc + g_aucConvertToBit[ rcDistParam.iCols ] + 1 ]; |
---|
| 355 | |
---|
| 356 | // initialize |
---|
| 357 | rcDistParam.iSubShift = 0; |
---|
[5] | 358 | #if HHI_INTERVIEW_SKIP |
---|
[2] | 359 | rcDistParam.pUsed = 0; |
---|
| 360 | rcDistParam.iStrideUsed = 0; |
---|
| 361 | #endif |
---|
| 362 | } |
---|
| 363 | |
---|
| 364 | // Setting the Distortion Parameter for Inter (ME) |
---|
| 365 | Void TComRdCost::setDistParam( TComPattern* pcPatternKey, Pel* piRefY, Int iRefStride, DistParam& rcDistParam ) |
---|
| 366 | { |
---|
| 367 | // set Original & Curr Pointer / Stride |
---|
| 368 | rcDistParam.pOrg = pcPatternKey->getROIY(); |
---|
| 369 | rcDistParam.pCur = piRefY; |
---|
| 370 | |
---|
| 371 | rcDistParam.iStrideOrg = pcPatternKey->getPatternLStride(); |
---|
| 372 | rcDistParam.iStrideCur = iRefStride; |
---|
| 373 | |
---|
| 374 | // set Block Width / Height |
---|
| 375 | rcDistParam.iCols = pcPatternKey->getROIYWidth(); |
---|
| 376 | rcDistParam.iRows = pcPatternKey->getROIYHeight(); |
---|
| 377 | rcDistParam.DistFunc = m_afpDistortFunc[DF_SAD + g_aucConvertToBit[ rcDistParam.iCols ] + 1 ]; |
---|
| 378 | |
---|
[56] | 379 | #if AMP_SAD |
---|
| 380 | if (rcDistParam.iCols == 12) |
---|
| 381 | { |
---|
| 382 | rcDistParam.DistFunc = m_afpDistortFunc[43 ]; |
---|
| 383 | } |
---|
| 384 | else if (rcDistParam.iCols == 24) |
---|
| 385 | { |
---|
| 386 | rcDistParam.DistFunc = m_afpDistortFunc[44 ]; |
---|
| 387 | } |
---|
| 388 | else if (rcDistParam.iCols == 48) |
---|
| 389 | { |
---|
| 390 | rcDistParam.DistFunc = m_afpDistortFunc[45 ]; |
---|
| 391 | } |
---|
| 392 | #endif |
---|
| 393 | |
---|
[2] | 394 | // initialize |
---|
| 395 | rcDistParam.iSubShift = 0; |
---|
[5] | 396 | #if HHI_INTERVIEW_SKIP |
---|
[2] | 397 | rcDistParam.pUsed = 0; |
---|
| 398 | rcDistParam.iStrideUsed = 0; |
---|
| 399 | #endif |
---|
| 400 | } |
---|
| 401 | |
---|
| 402 | // Setting the Distortion Parameter for Inter (subpel ME with step) |
---|
[56] | 403 | #if NS_HAD |
---|
| 404 | Void TComRdCost::setDistParam( TComPattern* pcPatternKey, Pel* piRefY, Int iRefStride, Int iStep, DistParam& rcDistParam, Bool bHADME, Bool bUseNSHAD ) |
---|
| 405 | #else |
---|
[2] | 406 | Void TComRdCost::setDistParam( TComPattern* pcPatternKey, Pel* piRefY, Int iRefStride, Int iStep, DistParam& rcDistParam, Bool bHADME ) |
---|
[56] | 407 | #endif |
---|
[2] | 408 | { |
---|
| 409 | // set Original & Curr Pointer / Stride |
---|
| 410 | rcDistParam.pOrg = pcPatternKey->getROIY(); |
---|
| 411 | rcDistParam.pCur = piRefY; |
---|
| 412 | |
---|
| 413 | rcDistParam.iStrideOrg = pcPatternKey->getPatternLStride(); |
---|
| 414 | rcDistParam.iStrideCur = iRefStride * iStep; |
---|
| 415 | |
---|
| 416 | // set Step for interpolated buffer |
---|
| 417 | rcDistParam.iStep = iStep; |
---|
| 418 | |
---|
| 419 | // set Block Width / Height |
---|
| 420 | rcDistParam.iCols = pcPatternKey->getROIYWidth(); |
---|
| 421 | rcDistParam.iRows = pcPatternKey->getROIYHeight(); |
---|
[56] | 422 | #if NS_HAD |
---|
| 423 | rcDistParam.bUseNSHAD = bUseNSHAD; |
---|
| 424 | #endif |
---|
[2] | 425 | |
---|
| 426 | // set distortion function |
---|
| 427 | if ( !bHADME ) |
---|
| 428 | { |
---|
| 429 | rcDistParam.DistFunc = m_afpDistortFunc[DF_SADS + g_aucConvertToBit[ rcDistParam.iCols ] + 1 ]; |
---|
[56] | 430 | #if AMP_SAD |
---|
| 431 | if (rcDistParam.iCols == 12) |
---|
| 432 | { |
---|
| 433 | rcDistParam.DistFunc = m_afpDistortFunc[46 ]; |
---|
| 434 | } |
---|
| 435 | else if (rcDistParam.iCols == 24) |
---|
| 436 | { |
---|
| 437 | rcDistParam.DistFunc = m_afpDistortFunc[47 ]; |
---|
| 438 | } |
---|
| 439 | else if (rcDistParam.iCols == 48) |
---|
| 440 | { |
---|
| 441 | rcDistParam.DistFunc = m_afpDistortFunc[48 ]; |
---|
| 442 | } |
---|
| 443 | #endif |
---|
[2] | 444 | } |
---|
| 445 | else |
---|
| 446 | { |
---|
| 447 | rcDistParam.DistFunc = m_afpDistortFunc[DF_HADS + g_aucConvertToBit[ rcDistParam.iCols ] + 1 ]; |
---|
| 448 | } |
---|
| 449 | |
---|
| 450 | // initialize |
---|
| 451 | rcDistParam.iSubShift = 0; |
---|
[5] | 452 | #if HHI_INTERVIEW_SKIP |
---|
[2] | 453 | rcDistParam.pUsed = 0; |
---|
| 454 | rcDistParam.iStrideUsed = 0; |
---|
| 455 | #endif |
---|
| 456 | } |
---|
| 457 | |
---|
| 458 | Void |
---|
[56] | 459 | #if NS_HAD |
---|
| 460 | TComRdCost::setDistParam( DistParam& rcDP, Pel* p1, Int iStride1, Pel* p2, Int iStride2, Int iWidth, Int iHeight, Bool bHadamard, Bool bUseNSHAD ) |
---|
| 461 | #else |
---|
[2] | 462 | TComRdCost::setDistParam( DistParam& rcDP, Pel* p1, Int iStride1, Pel* p2, Int iStride2, Int iWidth, Int iHeight, Bool bHadamard ) |
---|
[56] | 463 | #endif |
---|
[2] | 464 | { |
---|
| 465 | rcDP.pOrg = p1; |
---|
| 466 | rcDP.pCur = p2; |
---|
| 467 | rcDP.iStrideOrg = iStride1; |
---|
| 468 | rcDP.iStrideCur = iStride2; |
---|
| 469 | rcDP.iCols = iWidth; |
---|
| 470 | rcDP.iRows = iHeight; |
---|
| 471 | rcDP.iStep = 1; |
---|
| 472 | rcDP.iSubShift = 0; |
---|
| 473 | rcDP.DistFunc = m_afpDistortFunc[ ( bHadamard ? DF_HADS : DF_SADS ) + g_aucConvertToBit[ iWidth ] + 1 ]; |
---|
[5] | 474 | #if HHI_INTERVIEW_SKIP |
---|
[2] | 475 | rcDP.pUsed = 0; |
---|
| 476 | rcDP.iStrideUsed = 0; |
---|
| 477 | #endif |
---|
[56] | 478 | #if NS_HAD |
---|
| 479 | rcDP.bUseNSHAD = bUseNSHAD; |
---|
| 480 | #endif |
---|
[2] | 481 | } |
---|
| 482 | |
---|
| 483 | UInt TComRdCost::calcHAD( Pel* pi0, Int iStride0, Pel* pi1, Int iStride1, Int iWidth, Int iHeight ) |
---|
| 484 | { |
---|
| 485 | UInt uiSum = 0; |
---|
| 486 | Int x, y; |
---|
| 487 | |
---|
| 488 | if ( ( (iWidth % 8) == 0 ) && ( (iHeight % 8) == 0 ) ) |
---|
| 489 | { |
---|
| 490 | for ( y=0; y<iHeight; y+= 8 ) |
---|
| 491 | { |
---|
| 492 | for ( x=0; x<iWidth; x+= 8 ) |
---|
| 493 | { |
---|
| 494 | uiSum += xCalcHADs8x8( &pi0[x], &pi1[x], iStride0, iStride1, 1 ); |
---|
| 495 | } |
---|
| 496 | pi0 += iStride0*8; |
---|
| 497 | pi1 += iStride1*8; |
---|
| 498 | } |
---|
| 499 | } |
---|
| 500 | else if ( ( (iWidth % 4) == 0 ) && ( (iHeight % 4) == 0 ) ) |
---|
| 501 | { |
---|
| 502 | for ( y=0; y<iHeight; y+= 4 ) |
---|
| 503 | { |
---|
| 504 | for ( x=0; x<iWidth; x+= 4 ) |
---|
| 505 | { |
---|
| 506 | uiSum += xCalcHADs4x4( &pi0[x], &pi1[x], iStride0, iStride1, 1 ); |
---|
| 507 | } |
---|
| 508 | pi0 += iStride0*4; |
---|
| 509 | pi1 += iStride1*4; |
---|
| 510 | } |
---|
| 511 | } |
---|
| 512 | else |
---|
| 513 | { |
---|
| 514 | for ( y=0; y<iHeight; y+= 2 ) |
---|
| 515 | { |
---|
| 516 | for ( x=0; x<iWidth; x+= 2 ) |
---|
| 517 | { |
---|
| 518 | uiSum += xCalcHADs8x8( &pi0[x], &pi1[x], iStride0, iStride1, 1 ); |
---|
| 519 | } |
---|
| 520 | pi0 += iStride0*2; |
---|
| 521 | pi1 += iStride1*2; |
---|
| 522 | } |
---|
| 523 | } |
---|
| 524 | |
---|
| 525 | return ( uiSum >> g_uiBitIncrement ); |
---|
| 526 | } |
---|
[5] | 527 | #if HHI_INTERVIEW_SKIP |
---|
[2] | 528 | UInt TComRdCost::getDistPart( Pel* piCur, Int iCurStride, Pel* piOrg, Int iOrgStride, Pel* piUsed, Int iUsedStride, UInt uiBlkWidth, UInt uiBlkHeight, DFunc eDFunc ) |
---|
| 529 | { |
---|
| 530 | DistParam cDtParam; |
---|
| 531 | setDistParam( uiBlkWidth, uiBlkHeight, eDFunc, cDtParam ); |
---|
| 532 | cDtParam.pOrg = piOrg; |
---|
| 533 | cDtParam.pCur = piCur; |
---|
| 534 | cDtParam.pUsed = piUsed; |
---|
| 535 | cDtParam.iStrideOrg = iOrgStride; |
---|
| 536 | cDtParam.iStrideCur = iCurStride; |
---|
| 537 | cDtParam.iStrideUsed= iUsedStride; |
---|
| 538 | #ifdef DCM_RDCOST_TEMP_FIX //Temporary fix since DistParam is lacking a constructor and the variable iStep is not initialized |
---|
| 539 | cDtParam.iStep = 1; |
---|
| 540 | #endif |
---|
| 541 | #ifdef WEIGHT_PRED |
---|
| 542 | cDtParam.applyWeight = false; |
---|
| 543 | cDtParam.uiComp = 255; // just for assert: to be sure it was set before use, since only values 0,1 or 2 are allowed. |
---|
| 544 | #endif |
---|
| 545 | return cDtParam.DistFunc( &cDtParam ); |
---|
| 546 | } |
---|
| 547 | #endif |
---|
| 548 | |
---|
[56] | 549 | #if WEIGHTED_CHROMA_DISTORTION |
---|
| 550 | UInt TComRdCost::getDistPart( Pel* piCur, Int iCurStride, Pel* piOrg, Int iOrgStride, UInt uiBlkWidth, UInt uiBlkHeight, Bool bWeighted, DFunc eDFunc ) |
---|
| 551 | #else |
---|
[2] | 552 | UInt TComRdCost::getDistPart( Pel* piCur, Int iCurStride, Pel* piOrg, Int iOrgStride, UInt uiBlkWidth, UInt uiBlkHeight, DFunc eDFunc ) |
---|
[56] | 553 | #endif |
---|
[2] | 554 | { |
---|
| 555 | DistParam cDtParam; |
---|
| 556 | setDistParam( uiBlkWidth, uiBlkHeight, eDFunc, cDtParam ); |
---|
| 557 | cDtParam.pOrg = piOrg; |
---|
| 558 | cDtParam.pCur = piCur; |
---|
| 559 | cDtParam.iStrideOrg = iOrgStride; |
---|
| 560 | cDtParam.iStrideCur = iCurStride; |
---|
| 561 | cDtParam.iStep = 1; |
---|
[56] | 562 | |
---|
| 563 | cDtParam.bApplyWeight = false; |
---|
[2] | 564 | cDtParam.uiComp = 255; // just for assert: to be sure it was set before use, since only values 0,1 or 2 are allowed. |
---|
[56] | 565 | |
---|
| 566 | #if WEIGHTED_CHROMA_DISTORTION |
---|
| 567 | if (bWeighted) |
---|
| 568 | { |
---|
| 569 | return ((int) (m_chromaDistortionWeight * cDtParam.DistFunc( &cDtParam ))); |
---|
| 570 | } |
---|
| 571 | else |
---|
| 572 | { |
---|
| 573 | return cDtParam.DistFunc( &cDtParam ); |
---|
| 574 | } |
---|
| 575 | #else |
---|
| 576 | return cDtParam.DistFunc( &cDtParam ); |
---|
[2] | 577 | #endif |
---|
| 578 | } |
---|
| 579 | |
---|
[56] | 580 | |
---|
[100] | 581 | #if SAIT_VSO_EST_A0033 |
---|
| 582 | UInt TComRdCost::getDistPart( Pel* piCur, Int iCurStride, Pel* piOrg, Int iOrgStride, Pel* piVirRec, Pel* piVirOrg, Int iVirStride, UInt uiBlkWidth, UInt uiBlkHeight, DFunc eDFunc ) |
---|
| 583 | { |
---|
| 584 | AOT( ( m_dDisparityCoeff <= 0 ) || ( m_dDisparityCoeff > 10 ) ); |
---|
[56] | 585 | |
---|
[100] | 586 | DistParam cDtParam; |
---|
| 587 | setDistParam( uiBlkWidth, uiBlkHeight, eDFunc, cDtParam ); |
---|
| 588 | cDtParam.pOrg = piOrg; |
---|
| 589 | cDtParam.pCur = piCur; |
---|
| 590 | cDtParam.pVirRec = piVirRec; |
---|
| 591 | cDtParam.pVirOrg = piVirOrg; |
---|
| 592 | cDtParam.iStrideVir = iVirStride; |
---|
| 593 | cDtParam.iStrideOrg = iOrgStride; |
---|
| 594 | cDtParam.iStrideCur = iCurStride; |
---|
| 595 | cDtParam.iStep = 1; |
---|
| 596 | |
---|
| 597 | cDtParam.bApplyWeight = false; |
---|
| 598 | cDtParam.uiComp = 255; // just for assert: to be sure it was set before use, since only values 0,1 or 2 are allowed. |
---|
| 599 | |
---|
| 600 | return cDtParam.DistFunc( &cDtParam ); |
---|
| 601 | } |
---|
| 602 | #endif |
---|
| 603 | |
---|
| 604 | |
---|
[2] | 605 | // ==================================================================================================================== |
---|
| 606 | // Distortion functions |
---|
| 607 | // ==================================================================================================================== |
---|
| 608 | |
---|
| 609 | // -------------------------------------------------------------------------------------------------------------------- |
---|
| 610 | // SAD |
---|
| 611 | // -------------------------------------------------------------------------------------------------------------------- |
---|
| 612 | |
---|
[56] | 613 | UInt TComRdCost::xGetSAD( DistParam* pcDtParam ) |
---|
[2] | 614 | { |
---|
[56] | 615 | if ( pcDtParam->bApplyWeight ) |
---|
| 616 | { |
---|
| 617 | return xGetSADw( pcDtParam ); |
---|
| 618 | } |
---|
[2] | 619 | Pel* piOrg = pcDtParam->pOrg; |
---|
| 620 | Pel* piCur = pcDtParam->pCur; |
---|
| 621 | Int iRows = pcDtParam->iRows; |
---|
| 622 | Int iCols = pcDtParam->iCols; |
---|
| 623 | Int iStrideCur = pcDtParam->iStrideCur; |
---|
| 624 | Int iStrideOrg = pcDtParam->iStrideOrg; |
---|
| 625 | |
---|
| 626 | UInt uiSum = 0; |
---|
| 627 | |
---|
| 628 | for( ; iRows != 0; iRows-- ) |
---|
| 629 | { |
---|
| 630 | for (Int n = 0; n < iCols; n++ ) |
---|
| 631 | { |
---|
[56] | 632 | uiSum += abs( piOrg[n] - piCur[n] ); |
---|
[2] | 633 | } |
---|
| 634 | piOrg += iStrideOrg; |
---|
| 635 | piCur += iStrideCur; |
---|
| 636 | } |
---|
| 637 | |
---|
| 638 | return ( uiSum >> g_uiBitIncrement ); |
---|
| 639 | } |
---|
| 640 | |
---|
[56] | 641 | UInt TComRdCost::xGetSAD4( DistParam* pcDtParam ) |
---|
[2] | 642 | { |
---|
[56] | 643 | if ( pcDtParam->bApplyWeight ) |
---|
[2] | 644 | { |
---|
[56] | 645 | return xGetSADw( pcDtParam ); |
---|
[2] | 646 | } |
---|
| 647 | Pel* piOrg = pcDtParam->pOrg; |
---|
| 648 | Pel* piCur = pcDtParam->pCur; |
---|
| 649 | Int iRows = pcDtParam->iRows; |
---|
| 650 | Int iSubShift = pcDtParam->iSubShift; |
---|
| 651 | Int iSubStep = ( 1 << iSubShift ); |
---|
| 652 | Int iStrideCur = pcDtParam->iStrideCur*iSubStep; |
---|
| 653 | Int iStrideOrg = pcDtParam->iStrideOrg*iSubStep; |
---|
| 654 | |
---|
| 655 | UInt uiSum = 0; |
---|
| 656 | |
---|
| 657 | for( ; iRows != 0; iRows-=iSubStep ) |
---|
| 658 | { |
---|
[56] | 659 | uiSum += abs( piOrg[0] - piCur[0] ); |
---|
| 660 | uiSum += abs( piOrg[1] - piCur[1] ); |
---|
| 661 | uiSum += abs( piOrg[2] - piCur[2] ); |
---|
| 662 | uiSum += abs( piOrg[3] - piCur[3] ); |
---|
[2] | 663 | |
---|
| 664 | piOrg += iStrideOrg; |
---|
| 665 | piCur += iStrideCur; |
---|
| 666 | } |
---|
| 667 | |
---|
| 668 | uiSum <<= iSubShift; |
---|
| 669 | return ( uiSum >> g_uiBitIncrement ); |
---|
| 670 | } |
---|
| 671 | |
---|
[56] | 672 | UInt TComRdCost::xGetSAD8( DistParam* pcDtParam ) |
---|
[2] | 673 | { |
---|
[56] | 674 | if ( pcDtParam->bApplyWeight ) |
---|
[2] | 675 | { |
---|
| 676 | return xGetSADw( pcDtParam ); |
---|
| 677 | } |
---|
[56] | 678 | Pel* piOrg = pcDtParam->pOrg; |
---|
| 679 | Pel* piCur = pcDtParam->pCur; |
---|
| 680 | Int iRows = pcDtParam->iRows; |
---|
[2] | 681 | Int iSubShift = pcDtParam->iSubShift; |
---|
| 682 | Int iSubStep = ( 1 << iSubShift ); |
---|
| 683 | Int iStrideCur = pcDtParam->iStrideCur*iSubStep; |
---|
| 684 | Int iStrideOrg = pcDtParam->iStrideOrg*iSubStep; |
---|
| 685 | |
---|
| 686 | UInt uiSum = 0; |
---|
| 687 | |
---|
| 688 | for( ; iRows != 0; iRows-=iSubStep ) |
---|
| 689 | { |
---|
| 690 | uiSum += abs( piOrg[0] - piCur[0] ); |
---|
| 691 | uiSum += abs( piOrg[1] - piCur[1] ); |
---|
| 692 | uiSum += abs( piOrg[2] - piCur[2] ); |
---|
| 693 | uiSum += abs( piOrg[3] - piCur[3] ); |
---|
[56] | 694 | uiSum += abs( piOrg[4] - piCur[4] ); |
---|
| 695 | uiSum += abs( piOrg[5] - piCur[5] ); |
---|
| 696 | uiSum += abs( piOrg[6] - piCur[6] ); |
---|
| 697 | uiSum += abs( piOrg[7] - piCur[7] ); |
---|
[2] | 698 | |
---|
| 699 | piOrg += iStrideOrg; |
---|
| 700 | piCur += iStrideCur; |
---|
| 701 | } |
---|
| 702 | |
---|
| 703 | uiSum <<= iSubShift; |
---|
| 704 | return ( uiSum >> g_uiBitIncrement ); |
---|
| 705 | } |
---|
| 706 | |
---|
[56] | 707 | UInt TComRdCost::xGetSAD16( DistParam* pcDtParam ) |
---|
[2] | 708 | { |
---|
[56] | 709 | if ( pcDtParam->bApplyWeight ) |
---|
[2] | 710 | { |
---|
| 711 | return xGetSADw( pcDtParam ); |
---|
| 712 | } |
---|
[56] | 713 | Pel* piOrg = pcDtParam->pOrg; |
---|
| 714 | Pel* piCur = pcDtParam->pCur; |
---|
| 715 | Int iRows = pcDtParam->iRows; |
---|
[2] | 716 | Int iSubShift = pcDtParam->iSubShift; |
---|
| 717 | Int iSubStep = ( 1 << iSubShift ); |
---|
| 718 | Int iStrideCur = pcDtParam->iStrideCur*iSubStep; |
---|
| 719 | Int iStrideOrg = pcDtParam->iStrideOrg*iSubStep; |
---|
| 720 | |
---|
| 721 | UInt uiSum = 0; |
---|
| 722 | |
---|
| 723 | for( ; iRows != 0; iRows-=iSubStep ) |
---|
| 724 | { |
---|
| 725 | uiSum += abs( piOrg[0] - piCur[0] ); |
---|
| 726 | uiSum += abs( piOrg[1] - piCur[1] ); |
---|
| 727 | uiSum += abs( piOrg[2] - piCur[2] ); |
---|
| 728 | uiSum += abs( piOrg[3] - piCur[3] ); |
---|
| 729 | uiSum += abs( piOrg[4] - piCur[4] ); |
---|
| 730 | uiSum += abs( piOrg[5] - piCur[5] ); |
---|
| 731 | uiSum += abs( piOrg[6] - piCur[6] ); |
---|
| 732 | uiSum += abs( piOrg[7] - piCur[7] ); |
---|
[56] | 733 | uiSum += abs( piOrg[8] - piCur[8] ); |
---|
| 734 | uiSum += abs( piOrg[9] - piCur[9] ); |
---|
| 735 | uiSum += abs( piOrg[10] - piCur[10] ); |
---|
| 736 | uiSum += abs( piOrg[11] - piCur[11] ); |
---|
| 737 | uiSum += abs( piOrg[12] - piCur[12] ); |
---|
| 738 | uiSum += abs( piOrg[13] - piCur[13] ); |
---|
| 739 | uiSum += abs( piOrg[14] - piCur[14] ); |
---|
| 740 | uiSum += abs( piOrg[15] - piCur[15] ); |
---|
[2] | 741 | |
---|
| 742 | piOrg += iStrideOrg; |
---|
| 743 | piCur += iStrideCur; |
---|
| 744 | } |
---|
| 745 | |
---|
| 746 | uiSum <<= iSubShift; |
---|
| 747 | return ( uiSum >> g_uiBitIncrement ); |
---|
| 748 | } |
---|
| 749 | |
---|
[56] | 750 | #if AMP_SAD |
---|
| 751 | UInt TComRdCost::xGetSAD12( DistParam* pcDtParam ) |
---|
[2] | 752 | { |
---|
[56] | 753 | if ( pcDtParam->bApplyWeight ) |
---|
[2] | 754 | { |
---|
| 755 | return xGetSADw( pcDtParam ); |
---|
| 756 | } |
---|
| 757 | Pel* piOrg = pcDtParam->pOrg; |
---|
| 758 | Pel* piCur = pcDtParam->pCur; |
---|
| 759 | Int iRows = pcDtParam->iRows; |
---|
| 760 | Int iSubShift = pcDtParam->iSubShift; |
---|
| 761 | Int iSubStep = ( 1 << iSubShift ); |
---|
| 762 | Int iStrideCur = pcDtParam->iStrideCur*iSubStep; |
---|
| 763 | Int iStrideOrg = pcDtParam->iStrideOrg*iSubStep; |
---|
| 764 | |
---|
| 765 | UInt uiSum = 0; |
---|
| 766 | |
---|
| 767 | for( ; iRows != 0; iRows-=iSubStep ) |
---|
| 768 | { |
---|
| 769 | uiSum += abs( piOrg[0] - piCur[0] ); |
---|
| 770 | uiSum += abs( piOrg[1] - piCur[1] ); |
---|
| 771 | uiSum += abs( piOrg[2] - piCur[2] ); |
---|
| 772 | uiSum += abs( piOrg[3] - piCur[3] ); |
---|
| 773 | uiSum += abs( piOrg[4] - piCur[4] ); |
---|
| 774 | uiSum += abs( piOrg[5] - piCur[5] ); |
---|
| 775 | uiSum += abs( piOrg[6] - piCur[6] ); |
---|
| 776 | uiSum += abs( piOrg[7] - piCur[7] ); |
---|
| 777 | uiSum += abs( piOrg[8] - piCur[8] ); |
---|
| 778 | uiSum += abs( piOrg[9] - piCur[9] ); |
---|
| 779 | uiSum += abs( piOrg[10] - piCur[10] ); |
---|
| 780 | uiSum += abs( piOrg[11] - piCur[11] ); |
---|
| 781 | |
---|
| 782 | piOrg += iStrideOrg; |
---|
| 783 | piCur += iStrideCur; |
---|
| 784 | } |
---|
| 785 | |
---|
| 786 | uiSum <<= iSubShift; |
---|
| 787 | return ( uiSum >> g_uiBitIncrement ); |
---|
| 788 | } |
---|
[56] | 789 | #endif |
---|
[2] | 790 | |
---|
| 791 | UInt TComRdCost::xGetSAD16N( DistParam* pcDtParam ) |
---|
| 792 | { |
---|
| 793 | Pel* piOrg = pcDtParam->pOrg; |
---|
| 794 | Pel* piCur = pcDtParam->pCur; |
---|
| 795 | Int iRows = pcDtParam->iRows; |
---|
| 796 | Int iCols = pcDtParam->iCols; |
---|
| 797 | Int iSubShift = pcDtParam->iSubShift; |
---|
| 798 | Int iSubStep = ( 1 << iSubShift ); |
---|
| 799 | Int iStrideCur = pcDtParam->iStrideCur*iSubStep; |
---|
| 800 | Int iStrideOrg = pcDtParam->iStrideOrg*iSubStep; |
---|
| 801 | |
---|
| 802 | UInt uiSum = 0; |
---|
| 803 | |
---|
| 804 | for( ; iRows != 0; iRows-=iSubStep ) |
---|
| 805 | { |
---|
| 806 | for (Int n = 0; n < iCols; n+=16 ) |
---|
| 807 | { |
---|
| 808 | uiSum += abs( piOrg[n+ 0] - piCur[n+ 0] ); |
---|
| 809 | uiSum += abs( piOrg[n+ 1] - piCur[n+ 1] ); |
---|
| 810 | uiSum += abs( piOrg[n+ 2] - piCur[n+ 2] ); |
---|
| 811 | uiSum += abs( piOrg[n+ 3] - piCur[n+ 3] ); |
---|
| 812 | uiSum += abs( piOrg[n+ 4] - piCur[n+ 4] ); |
---|
| 813 | uiSum += abs( piOrg[n+ 5] - piCur[n+ 5] ); |
---|
| 814 | uiSum += abs( piOrg[n+ 6] - piCur[n+ 6] ); |
---|
| 815 | uiSum += abs( piOrg[n+ 7] - piCur[n+ 7] ); |
---|
| 816 | uiSum += abs( piOrg[n+ 8] - piCur[n+ 8] ); |
---|
| 817 | uiSum += abs( piOrg[n+ 9] - piCur[n+ 9] ); |
---|
| 818 | uiSum += abs( piOrg[n+10] - piCur[n+10] ); |
---|
| 819 | uiSum += abs( piOrg[n+11] - piCur[n+11] ); |
---|
| 820 | uiSum += abs( piOrg[n+12] - piCur[n+12] ); |
---|
| 821 | uiSum += abs( piOrg[n+13] - piCur[n+13] ); |
---|
| 822 | uiSum += abs( piOrg[n+14] - piCur[n+14] ); |
---|
| 823 | uiSum += abs( piOrg[n+15] - piCur[n+15] ); |
---|
| 824 | } |
---|
| 825 | piOrg += iStrideOrg; |
---|
| 826 | piCur += iStrideCur; |
---|
| 827 | } |
---|
| 828 | |
---|
| 829 | uiSum <<= iSubShift; |
---|
| 830 | return ( uiSum >> g_uiBitIncrement ); |
---|
| 831 | } |
---|
| 832 | |
---|
| 833 | UInt TComRdCost::xGetSAD32( DistParam* pcDtParam ) |
---|
| 834 | { |
---|
[56] | 835 | if ( pcDtParam->bApplyWeight ) |
---|
[2] | 836 | { |
---|
| 837 | return xGetSADw( pcDtParam ); |
---|
| 838 | } |
---|
| 839 | Pel* piOrg = pcDtParam->pOrg; |
---|
| 840 | Pel* piCur = pcDtParam->pCur; |
---|
| 841 | Int iRows = pcDtParam->iRows; |
---|
| 842 | Int iSubShift = pcDtParam->iSubShift; |
---|
| 843 | Int iSubStep = ( 1 << iSubShift ); |
---|
| 844 | Int iStrideCur = pcDtParam->iStrideCur*iSubStep; |
---|
| 845 | Int iStrideOrg = pcDtParam->iStrideOrg*iSubStep; |
---|
| 846 | |
---|
| 847 | UInt uiSum = 0; |
---|
| 848 | |
---|
| 849 | for( ; iRows != 0; iRows-=iSubStep ) |
---|
| 850 | { |
---|
| 851 | uiSum += abs( piOrg[0] - piCur[0] ); |
---|
| 852 | uiSum += abs( piOrg[1] - piCur[1] ); |
---|
| 853 | uiSum += abs( piOrg[2] - piCur[2] ); |
---|
| 854 | uiSum += abs( piOrg[3] - piCur[3] ); |
---|
| 855 | uiSum += abs( piOrg[4] - piCur[4] ); |
---|
| 856 | uiSum += abs( piOrg[5] - piCur[5] ); |
---|
| 857 | uiSum += abs( piOrg[6] - piCur[6] ); |
---|
| 858 | uiSum += abs( piOrg[7] - piCur[7] ); |
---|
| 859 | uiSum += abs( piOrg[8] - piCur[8] ); |
---|
| 860 | uiSum += abs( piOrg[9] - piCur[9] ); |
---|
| 861 | uiSum += abs( piOrg[10] - piCur[10] ); |
---|
| 862 | uiSum += abs( piOrg[11] - piCur[11] ); |
---|
| 863 | uiSum += abs( piOrg[12] - piCur[12] ); |
---|
| 864 | uiSum += abs( piOrg[13] - piCur[13] ); |
---|
| 865 | uiSum += abs( piOrg[14] - piCur[14] ); |
---|
| 866 | uiSum += abs( piOrg[15] - piCur[15] ); |
---|
| 867 | uiSum += abs( piOrg[16] - piCur[16] ); |
---|
| 868 | uiSum += abs( piOrg[17] - piCur[17] ); |
---|
| 869 | uiSum += abs( piOrg[18] - piCur[18] ); |
---|
| 870 | uiSum += abs( piOrg[19] - piCur[19] ); |
---|
| 871 | uiSum += abs( piOrg[20] - piCur[20] ); |
---|
| 872 | uiSum += abs( piOrg[21] - piCur[21] ); |
---|
| 873 | uiSum += abs( piOrg[22] - piCur[22] ); |
---|
| 874 | uiSum += abs( piOrg[23] - piCur[23] ); |
---|
| 875 | uiSum += abs( piOrg[24] - piCur[24] ); |
---|
| 876 | uiSum += abs( piOrg[25] - piCur[25] ); |
---|
| 877 | uiSum += abs( piOrg[26] - piCur[26] ); |
---|
| 878 | uiSum += abs( piOrg[27] - piCur[27] ); |
---|
| 879 | uiSum += abs( piOrg[28] - piCur[28] ); |
---|
| 880 | uiSum += abs( piOrg[29] - piCur[29] ); |
---|
| 881 | uiSum += abs( piOrg[30] - piCur[30] ); |
---|
| 882 | uiSum += abs( piOrg[31] - piCur[31] ); |
---|
| 883 | |
---|
| 884 | piOrg += iStrideOrg; |
---|
| 885 | piCur += iStrideCur; |
---|
| 886 | } |
---|
| 887 | |
---|
| 888 | uiSum <<= iSubShift; |
---|
| 889 | return ( uiSum >> g_uiBitIncrement ); |
---|
| 890 | } |
---|
| 891 | |
---|
[56] | 892 | #if AMP_SAD |
---|
| 893 | UInt TComRdCost::xGetSAD24( DistParam* pcDtParam ) |
---|
| 894 | { |
---|
| 895 | if ( pcDtParam->bApplyWeight ) |
---|
| 896 | { |
---|
| 897 | return xGetSADw( pcDtParam ); |
---|
| 898 | } |
---|
| 899 | Pel* piOrg = pcDtParam->pOrg; |
---|
| 900 | Pel* piCur = pcDtParam->pCur; |
---|
| 901 | Int iRows = pcDtParam->iRows; |
---|
| 902 | Int iSubShift = pcDtParam->iSubShift; |
---|
| 903 | Int iSubStep = ( 1 << iSubShift ); |
---|
| 904 | Int iStrideCur = pcDtParam->iStrideCur*iSubStep; |
---|
| 905 | Int iStrideOrg = pcDtParam->iStrideOrg*iSubStep; |
---|
| 906 | |
---|
| 907 | UInt uiSum = 0; |
---|
| 908 | |
---|
| 909 | for( ; iRows != 0; iRows-=iSubStep ) |
---|
| 910 | { |
---|
| 911 | uiSum += abs( piOrg[0] - piCur[0] ); |
---|
| 912 | uiSum += abs( piOrg[1] - piCur[1] ); |
---|
| 913 | uiSum += abs( piOrg[2] - piCur[2] ); |
---|
| 914 | uiSum += abs( piOrg[3] - piCur[3] ); |
---|
| 915 | uiSum += abs( piOrg[4] - piCur[4] ); |
---|
| 916 | uiSum += abs( piOrg[5] - piCur[5] ); |
---|
| 917 | uiSum += abs( piOrg[6] - piCur[6] ); |
---|
| 918 | uiSum += abs( piOrg[7] - piCur[7] ); |
---|
| 919 | uiSum += abs( piOrg[8] - piCur[8] ); |
---|
| 920 | uiSum += abs( piOrg[9] - piCur[9] ); |
---|
| 921 | uiSum += abs( piOrg[10] - piCur[10] ); |
---|
| 922 | uiSum += abs( piOrg[11] - piCur[11] ); |
---|
| 923 | uiSum += abs( piOrg[12] - piCur[12] ); |
---|
| 924 | uiSum += abs( piOrg[13] - piCur[13] ); |
---|
| 925 | uiSum += abs( piOrg[14] - piCur[14] ); |
---|
| 926 | uiSum += abs( piOrg[15] - piCur[15] ); |
---|
| 927 | uiSum += abs( piOrg[16] - piCur[16] ); |
---|
| 928 | uiSum += abs( piOrg[17] - piCur[17] ); |
---|
| 929 | uiSum += abs( piOrg[18] - piCur[18] ); |
---|
| 930 | uiSum += abs( piOrg[19] - piCur[19] ); |
---|
| 931 | uiSum += abs( piOrg[20] - piCur[20] ); |
---|
| 932 | uiSum += abs( piOrg[21] - piCur[21] ); |
---|
| 933 | uiSum += abs( piOrg[22] - piCur[22] ); |
---|
| 934 | uiSum += abs( piOrg[23] - piCur[23] ); |
---|
| 935 | |
---|
| 936 | piOrg += iStrideOrg; |
---|
| 937 | piCur += iStrideCur; |
---|
| 938 | } |
---|
| 939 | |
---|
| 940 | uiSum <<= iSubShift; |
---|
| 941 | return ( uiSum >> g_uiBitIncrement ); |
---|
| 942 | } |
---|
| 943 | |
---|
| 944 | #endif |
---|
| 945 | |
---|
[2] | 946 | UInt TComRdCost::xGetSAD64( DistParam* pcDtParam ) |
---|
| 947 | { |
---|
[56] | 948 | if ( pcDtParam->bApplyWeight ) |
---|
[2] | 949 | { |
---|
| 950 | return xGetSADw( pcDtParam ); |
---|
| 951 | } |
---|
| 952 | Pel* piOrg = pcDtParam->pOrg; |
---|
| 953 | Pel* piCur = pcDtParam->pCur; |
---|
| 954 | Int iRows = pcDtParam->iRows; |
---|
| 955 | Int iSubShift = pcDtParam->iSubShift; |
---|
| 956 | Int iSubStep = ( 1 << iSubShift ); |
---|
| 957 | Int iStrideCur = pcDtParam->iStrideCur*iSubStep; |
---|
| 958 | Int iStrideOrg = pcDtParam->iStrideOrg*iSubStep; |
---|
| 959 | |
---|
| 960 | UInt uiSum = 0; |
---|
| 961 | |
---|
| 962 | for( ; iRows != 0; iRows-=iSubStep ) |
---|
| 963 | { |
---|
| 964 | uiSum += abs( piOrg[0] - piCur[0] ); |
---|
| 965 | uiSum += abs( piOrg[1] - piCur[1] ); |
---|
| 966 | uiSum += abs( piOrg[2] - piCur[2] ); |
---|
| 967 | uiSum += abs( piOrg[3] - piCur[3] ); |
---|
| 968 | uiSum += abs( piOrg[4] - piCur[4] ); |
---|
| 969 | uiSum += abs( piOrg[5] - piCur[5] ); |
---|
| 970 | uiSum += abs( piOrg[6] - piCur[6] ); |
---|
| 971 | uiSum += abs( piOrg[7] - piCur[7] ); |
---|
| 972 | uiSum += abs( piOrg[8] - piCur[8] ); |
---|
| 973 | uiSum += abs( piOrg[9] - piCur[9] ); |
---|
| 974 | uiSum += abs( piOrg[10] - piCur[10] ); |
---|
| 975 | uiSum += abs( piOrg[11] - piCur[11] ); |
---|
| 976 | uiSum += abs( piOrg[12] - piCur[12] ); |
---|
| 977 | uiSum += abs( piOrg[13] - piCur[13] ); |
---|
| 978 | uiSum += abs( piOrg[14] - piCur[14] ); |
---|
| 979 | uiSum += abs( piOrg[15] - piCur[15] ); |
---|
| 980 | uiSum += abs( piOrg[16] - piCur[16] ); |
---|
| 981 | uiSum += abs( piOrg[17] - piCur[17] ); |
---|
| 982 | uiSum += abs( piOrg[18] - piCur[18] ); |
---|
| 983 | uiSum += abs( piOrg[19] - piCur[19] ); |
---|
| 984 | uiSum += abs( piOrg[20] - piCur[20] ); |
---|
| 985 | uiSum += abs( piOrg[21] - piCur[21] ); |
---|
| 986 | uiSum += abs( piOrg[22] - piCur[22] ); |
---|
| 987 | uiSum += abs( piOrg[23] - piCur[23] ); |
---|
| 988 | uiSum += abs( piOrg[24] - piCur[24] ); |
---|
| 989 | uiSum += abs( piOrg[25] - piCur[25] ); |
---|
| 990 | uiSum += abs( piOrg[26] - piCur[26] ); |
---|
| 991 | uiSum += abs( piOrg[27] - piCur[27] ); |
---|
| 992 | uiSum += abs( piOrg[28] - piCur[28] ); |
---|
| 993 | uiSum += abs( piOrg[29] - piCur[29] ); |
---|
| 994 | uiSum += abs( piOrg[30] - piCur[30] ); |
---|
| 995 | uiSum += abs( piOrg[31] - piCur[31] ); |
---|
| 996 | uiSum += abs( piOrg[32] - piCur[32] ); |
---|
| 997 | uiSum += abs( piOrg[33] - piCur[33] ); |
---|
| 998 | uiSum += abs( piOrg[34] - piCur[34] ); |
---|
| 999 | uiSum += abs( piOrg[35] - piCur[35] ); |
---|
| 1000 | uiSum += abs( piOrg[36] - piCur[36] ); |
---|
| 1001 | uiSum += abs( piOrg[37] - piCur[37] ); |
---|
| 1002 | uiSum += abs( piOrg[38] - piCur[38] ); |
---|
| 1003 | uiSum += abs( piOrg[39] - piCur[39] ); |
---|
| 1004 | uiSum += abs( piOrg[40] - piCur[40] ); |
---|
| 1005 | uiSum += abs( piOrg[41] - piCur[41] ); |
---|
| 1006 | uiSum += abs( piOrg[42] - piCur[42] ); |
---|
| 1007 | uiSum += abs( piOrg[43] - piCur[43] ); |
---|
| 1008 | uiSum += abs( piOrg[44] - piCur[44] ); |
---|
| 1009 | uiSum += abs( piOrg[45] - piCur[45] ); |
---|
| 1010 | uiSum += abs( piOrg[46] - piCur[46] ); |
---|
| 1011 | uiSum += abs( piOrg[47] - piCur[47] ); |
---|
| 1012 | uiSum += abs( piOrg[48] - piCur[48] ); |
---|
| 1013 | uiSum += abs( piOrg[49] - piCur[49] ); |
---|
| 1014 | uiSum += abs( piOrg[50] - piCur[50] ); |
---|
| 1015 | uiSum += abs( piOrg[51] - piCur[51] ); |
---|
| 1016 | uiSum += abs( piOrg[52] - piCur[52] ); |
---|
| 1017 | uiSum += abs( piOrg[53] - piCur[53] ); |
---|
| 1018 | uiSum += abs( piOrg[54] - piCur[54] ); |
---|
| 1019 | uiSum += abs( piOrg[55] - piCur[55] ); |
---|
| 1020 | uiSum += abs( piOrg[56] - piCur[56] ); |
---|
| 1021 | uiSum += abs( piOrg[57] - piCur[57] ); |
---|
| 1022 | uiSum += abs( piOrg[58] - piCur[58] ); |
---|
| 1023 | uiSum += abs( piOrg[59] - piCur[59] ); |
---|
| 1024 | uiSum += abs( piOrg[60] - piCur[60] ); |
---|
| 1025 | uiSum += abs( piOrg[61] - piCur[61] ); |
---|
| 1026 | uiSum += abs( piOrg[62] - piCur[62] ); |
---|
| 1027 | uiSum += abs( piOrg[63] - piCur[63] ); |
---|
| 1028 | |
---|
| 1029 | piOrg += iStrideOrg; |
---|
| 1030 | piCur += iStrideCur; |
---|
| 1031 | } |
---|
| 1032 | |
---|
| 1033 | uiSum <<= iSubShift; |
---|
| 1034 | return ( uiSum >> g_uiBitIncrement ); |
---|
| 1035 | } |
---|
| 1036 | |
---|
[56] | 1037 | #if AMP_SAD |
---|
| 1038 | UInt TComRdCost::xGetSAD48( DistParam* pcDtParam ) |
---|
[2] | 1039 | { |
---|
[56] | 1040 | if ( pcDtParam->bApplyWeight ) |
---|
[2] | 1041 | { |
---|
[56] | 1042 | return xGetSADw( pcDtParam ); |
---|
[2] | 1043 | } |
---|
| 1044 | Pel* piOrg = pcDtParam->pOrg; |
---|
| 1045 | Pel* piCur = pcDtParam->pCur; |
---|
| 1046 | Int iRows = pcDtParam->iRows; |
---|
[56] | 1047 | Int iSubShift = pcDtParam->iSubShift; |
---|
| 1048 | Int iSubStep = ( 1 << iSubShift ); |
---|
| 1049 | Int iStrideCur = pcDtParam->iStrideCur*iSubStep; |
---|
| 1050 | Int iStrideOrg = pcDtParam->iStrideOrg*iSubStep; |
---|
[2] | 1051 | |
---|
| 1052 | UInt uiSum = 0; |
---|
| 1053 | |
---|
[56] | 1054 | for( ; iRows != 0; iRows-=iSubStep ) |
---|
[2] | 1055 | { |
---|
[56] | 1056 | uiSum += abs( piOrg[0] - piCur[0] ); |
---|
| 1057 | uiSum += abs( piOrg[1] - piCur[1] ); |
---|
| 1058 | uiSum += abs( piOrg[2] - piCur[2] ); |
---|
| 1059 | uiSum += abs( piOrg[3] - piCur[3] ); |
---|
| 1060 | uiSum += abs( piOrg[4] - piCur[4] ); |
---|
| 1061 | uiSum += abs( piOrg[5] - piCur[5] ); |
---|
| 1062 | uiSum += abs( piOrg[6] - piCur[6] ); |
---|
| 1063 | uiSum += abs( piOrg[7] - piCur[7] ); |
---|
| 1064 | uiSum += abs( piOrg[8] - piCur[8] ); |
---|
| 1065 | uiSum += abs( piOrg[9] - piCur[9] ); |
---|
| 1066 | uiSum += abs( piOrg[10] - piCur[10] ); |
---|
| 1067 | uiSum += abs( piOrg[11] - piCur[11] ); |
---|
| 1068 | uiSum += abs( piOrg[12] - piCur[12] ); |
---|
| 1069 | uiSum += abs( piOrg[13] - piCur[13] ); |
---|
| 1070 | uiSum += abs( piOrg[14] - piCur[14] ); |
---|
| 1071 | uiSum += abs( piOrg[15] - piCur[15] ); |
---|
| 1072 | uiSum += abs( piOrg[16] - piCur[16] ); |
---|
| 1073 | uiSum += abs( piOrg[17] - piCur[17] ); |
---|
| 1074 | uiSum += abs( piOrg[18] - piCur[18] ); |
---|
| 1075 | uiSum += abs( piOrg[19] - piCur[19] ); |
---|
| 1076 | uiSum += abs( piOrg[20] - piCur[20] ); |
---|
| 1077 | uiSum += abs( piOrg[21] - piCur[21] ); |
---|
| 1078 | uiSum += abs( piOrg[22] - piCur[22] ); |
---|
| 1079 | uiSum += abs( piOrg[23] - piCur[23] ); |
---|
| 1080 | uiSum += abs( piOrg[24] - piCur[24] ); |
---|
| 1081 | uiSum += abs( piOrg[25] - piCur[25] ); |
---|
| 1082 | uiSum += abs( piOrg[26] - piCur[26] ); |
---|
| 1083 | uiSum += abs( piOrg[27] - piCur[27] ); |
---|
| 1084 | uiSum += abs( piOrg[28] - piCur[28] ); |
---|
| 1085 | uiSum += abs( piOrg[29] - piCur[29] ); |
---|
| 1086 | uiSum += abs( piOrg[30] - piCur[30] ); |
---|
| 1087 | uiSum += abs( piOrg[31] - piCur[31] ); |
---|
| 1088 | uiSum += abs( piOrg[32] - piCur[32] ); |
---|
| 1089 | uiSum += abs( piOrg[33] - piCur[33] ); |
---|
| 1090 | uiSum += abs( piOrg[34] - piCur[34] ); |
---|
| 1091 | uiSum += abs( piOrg[35] - piCur[35] ); |
---|
| 1092 | uiSum += abs( piOrg[36] - piCur[36] ); |
---|
| 1093 | uiSum += abs( piOrg[37] - piCur[37] ); |
---|
| 1094 | uiSum += abs( piOrg[38] - piCur[38] ); |
---|
| 1095 | uiSum += abs( piOrg[39] - piCur[39] ); |
---|
| 1096 | uiSum += abs( piOrg[40] - piCur[40] ); |
---|
| 1097 | uiSum += abs( piOrg[41] - piCur[41] ); |
---|
| 1098 | uiSum += abs( piOrg[42] - piCur[42] ); |
---|
| 1099 | uiSum += abs( piOrg[43] - piCur[43] ); |
---|
| 1100 | uiSum += abs( piOrg[44] - piCur[44] ); |
---|
| 1101 | uiSum += abs( piOrg[45] - piCur[45] ); |
---|
| 1102 | uiSum += abs( piOrg[46] - piCur[46] ); |
---|
| 1103 | uiSum += abs( piOrg[47] - piCur[47] ); |
---|
[2] | 1104 | |
---|
| 1105 | piOrg += iStrideOrg; |
---|
| 1106 | piCur += iStrideCur; |
---|
| 1107 | } |
---|
| 1108 | |
---|
[56] | 1109 | uiSum <<= iSubShift; |
---|
[2] | 1110 | return ( uiSum >> g_uiBitIncrement ); |
---|
| 1111 | } |
---|
| 1112 | #endif |
---|
| 1113 | |
---|
| 1114 | // -------------------------------------------------------------------------------------------------------------------- |
---|
| 1115 | // SSE |
---|
| 1116 | // -------------------------------------------------------------------------------------------------------------------- |
---|
| 1117 | |
---|
| 1118 | #if IBDI_DISTORTION |
---|
| 1119 | UInt TComRdCost::xGetSSE( DistParam* pcDtParam ) |
---|
| 1120 | { |
---|
| 1121 | Pel* piOrg = pcDtParam->pOrg; |
---|
| 1122 | Pel* piCur = pcDtParam->pCur; |
---|
| 1123 | Int iRows = pcDtParam->iRows; |
---|
| 1124 | Int iCols = pcDtParam->iCols; |
---|
| 1125 | Int iStrideOrg = pcDtParam->iStrideOrg; |
---|
| 1126 | Int iStrideCur = pcDtParam->iStrideCur; |
---|
| 1127 | |
---|
| 1128 | UInt uiSum = 0; |
---|
| 1129 | Int iShift = g_uiBitIncrement; |
---|
| 1130 | Int iOffset = (g_uiBitIncrement>0)? (1<<(g_uiBitIncrement-1)):0; |
---|
| 1131 | |
---|
| 1132 | Int iTemp; |
---|
| 1133 | |
---|
| 1134 | for( ; iRows != 0; iRows-- ) |
---|
| 1135 | { |
---|
| 1136 | for (Int n = 0; n < iCols; n++ ) |
---|
| 1137 | { |
---|
| 1138 | iTemp = ((piOrg[n ]+iOffset)>>iShift) - ((piCur[n ]+iOffset)>>iShift); |
---|
| 1139 | uiSum += iTemp * iTemp; |
---|
| 1140 | } |
---|
| 1141 | piOrg += iStrideOrg; |
---|
| 1142 | piCur += iStrideCur; |
---|
| 1143 | } |
---|
| 1144 | |
---|
| 1145 | return ( uiSum ); |
---|
| 1146 | } |
---|
| 1147 | |
---|
| 1148 | UInt TComRdCost::xGetSSE4( DistParam* pcDtParam ) |
---|
| 1149 | { |
---|
| 1150 | Pel* piOrg = pcDtParam->pOrg; |
---|
| 1151 | Pel* piCur = pcDtParam->pCur; |
---|
| 1152 | Int iRows = pcDtParam->iRows; |
---|
| 1153 | Int iStrideOrg = pcDtParam->iStrideOrg; |
---|
| 1154 | Int iStrideCur = pcDtParam->iStrideCur; |
---|
| 1155 | |
---|
| 1156 | UInt uiSum = 0; |
---|
| 1157 | Int iShift = g_uiBitIncrement; |
---|
| 1158 | Int iOffset = (g_uiBitIncrement>0)? (1<<(g_uiBitIncrement-1)):0; |
---|
| 1159 | |
---|
| 1160 | Int iTemp; |
---|
| 1161 | |
---|
| 1162 | for( ; iRows != 0; iRows-- ) |
---|
| 1163 | { |
---|
| 1164 | |
---|
| 1165 | iTemp = ((piOrg[0]+iOffset)>>iShift) - ((piCur[0]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
| 1166 | iTemp = ((piOrg[1]+iOffset)>>iShift) - ((piCur[1]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
| 1167 | iTemp = ((piOrg[2]+iOffset)>>iShift) - ((piCur[2]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
| 1168 | iTemp = ((piOrg[3]+iOffset)>>iShift) - ((piCur[3]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
| 1169 | |
---|
| 1170 | piOrg += iStrideOrg; |
---|
| 1171 | piCur += iStrideCur; |
---|
| 1172 | } |
---|
| 1173 | |
---|
| 1174 | return ( uiSum ); |
---|
| 1175 | } |
---|
| 1176 | |
---|
| 1177 | UInt TComRdCost::xGetSSE8( DistParam* pcDtParam ) |
---|
| 1178 | { |
---|
| 1179 | Pel* piOrg = pcDtParam->pOrg; |
---|
| 1180 | Pel* piCur = pcDtParam->pCur; |
---|
| 1181 | Int iRows = pcDtParam->iRows; |
---|
| 1182 | Int iStrideOrg = pcDtParam->iStrideOrg; |
---|
| 1183 | Int iStrideCur = pcDtParam->iStrideCur; |
---|
| 1184 | |
---|
| 1185 | UInt uiSum = 0; |
---|
| 1186 | Int iShift = g_uiBitIncrement; |
---|
| 1187 | Int iOffset = (g_uiBitIncrement>0)? (1<<(g_uiBitIncrement-1)):0; |
---|
| 1188 | |
---|
| 1189 | Int iTemp; |
---|
| 1190 | |
---|
| 1191 | for( ; iRows != 0; iRows-- ) |
---|
| 1192 | { |
---|
| 1193 | iTemp = ((piOrg[0]+iOffset)>>iShift) - ((piCur[0]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
| 1194 | iTemp = ((piOrg[1]+iOffset)>>iShift) - ((piCur[1]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
| 1195 | iTemp = ((piOrg[2]+iOffset)>>iShift) - ((piCur[2]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
| 1196 | iTemp = ((piOrg[3]+iOffset)>>iShift) - ((piCur[3]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
| 1197 | iTemp = ((piOrg[4]+iOffset)>>iShift) - ((piCur[4]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
| 1198 | iTemp = ((piOrg[5]+iOffset)>>iShift) - ((piCur[5]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
| 1199 | iTemp = ((piOrg[6]+iOffset)>>iShift) - ((piCur[6]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
| 1200 | iTemp = ((piOrg[7]+iOffset)>>iShift) - ((piCur[7]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
| 1201 | |
---|
| 1202 | piOrg += iStrideOrg; |
---|
| 1203 | piCur += iStrideCur; |
---|
| 1204 | } |
---|
| 1205 | |
---|
| 1206 | return ( uiSum ); |
---|
| 1207 | } |
---|
| 1208 | |
---|
| 1209 | UInt TComRdCost::xGetSSE16( DistParam* pcDtParam ) |
---|
| 1210 | { |
---|
| 1211 | Pel* piOrg = pcDtParam->pOrg; |
---|
| 1212 | Pel* piCur = pcDtParam->pCur; |
---|
| 1213 | Int iRows = pcDtParam->iRows; |
---|
| 1214 | Int iStrideOrg = pcDtParam->iStrideOrg; |
---|
| 1215 | Int iStrideCur = pcDtParam->iStrideCur; |
---|
| 1216 | |
---|
| 1217 | UInt uiSum = 0; |
---|
| 1218 | Int iShift = g_uiBitIncrement; |
---|
| 1219 | Int iOffset = (g_uiBitIncrement>0)? (1<<(g_uiBitIncrement-1)):0; |
---|
| 1220 | |
---|
| 1221 | Int iTemp; |
---|
| 1222 | |
---|
| 1223 | for( ; iRows != 0; iRows-- ) |
---|
| 1224 | { |
---|
| 1225 | |
---|
| 1226 | iTemp = ((piOrg[ 0]+iOffset)>>iShift) - ((piCur[ 0]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
| 1227 | iTemp = ((piOrg[ 1]+iOffset)>>iShift) - ((piCur[ 1]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
| 1228 | iTemp = ((piOrg[ 2]+iOffset)>>iShift) - ((piCur[ 2]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
| 1229 | iTemp = ((piOrg[ 3]+iOffset)>>iShift) - ((piCur[ 3]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
| 1230 | iTemp = ((piOrg[ 4]+iOffset)>>iShift) - ((piCur[ 4]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
| 1231 | iTemp = ((piOrg[ 5]+iOffset)>>iShift) - ((piCur[ 5]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
| 1232 | iTemp = ((piOrg[ 6]+iOffset)>>iShift) - ((piCur[ 6]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
| 1233 | iTemp = ((piOrg[ 7]+iOffset)>>iShift) - ((piCur[ 7]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
| 1234 | iTemp = ((piOrg[ 8]+iOffset)>>iShift) - ((piCur[ 8]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
| 1235 | iTemp = ((piOrg[ 9]+iOffset)>>iShift) - ((piCur[ 9]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
| 1236 | iTemp = ((piOrg[10]+iOffset)>>iShift) - ((piCur[10]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
| 1237 | iTemp = ((piOrg[11]+iOffset)>>iShift) - ((piCur[11]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
| 1238 | iTemp = ((piOrg[12]+iOffset)>>iShift) - ((piCur[12]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
| 1239 | iTemp = ((piOrg[13]+iOffset)>>iShift) - ((piCur[13]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
| 1240 | iTemp = ((piOrg[14]+iOffset)>>iShift) - ((piCur[14]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
| 1241 | iTemp = ((piOrg[15]+iOffset)>>iShift) - ((piCur[15]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
| 1242 | |
---|
| 1243 | piOrg += iStrideOrg; |
---|
| 1244 | piCur += iStrideCur; |
---|
| 1245 | } |
---|
| 1246 | |
---|
| 1247 | return ( uiSum ); |
---|
| 1248 | } |
---|
| 1249 | |
---|
| 1250 | UInt TComRdCost::xGetSSE16N( DistParam* pcDtParam ) |
---|
| 1251 | { |
---|
| 1252 | Pel* piOrg = pcDtParam->pOrg; |
---|
| 1253 | Pel* piCur = pcDtParam->pCur; |
---|
| 1254 | Int iRows = pcDtParam->iRows; |
---|
| 1255 | Int iCols = pcDtParam->iCols; |
---|
| 1256 | Int iStrideOrg = pcDtParam->iStrideOrg; |
---|
| 1257 | Int iStrideCur = pcDtParam->iStrideCur; |
---|
| 1258 | |
---|
| 1259 | UInt uiSum = 0; |
---|
| 1260 | Int iShift = g_uiBitIncrement; |
---|
| 1261 | Int iOffset = (g_uiBitIncrement>0)? (1<<(g_uiBitIncrement-1)):0; |
---|
| 1262 | Int iTemp; |
---|
| 1263 | |
---|
| 1264 | for( ; iRows != 0; iRows-- ) |
---|
| 1265 | { |
---|
| 1266 | for (Int n = 0; n < iCols; n+=16 ) |
---|
| 1267 | { |
---|
| 1268 | |
---|
| 1269 | iTemp = ((piOrg[n+ 0]+iOffset)>>iShift) - ((piCur[n+ 0]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
| 1270 | iTemp = ((piOrg[n+ 1]+iOffset)>>iShift) - ((piCur[n+ 1]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
| 1271 | iTemp = ((piOrg[n+ 2]+iOffset)>>iShift) - ((piCur[n+ 2]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
| 1272 | iTemp = ((piOrg[n+ 3]+iOffset)>>iShift) - ((piCur[n+ 3]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
| 1273 | iTemp = ((piOrg[n+ 4]+iOffset)>>iShift) - ((piCur[n+ 4]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
| 1274 | iTemp = ((piOrg[n+ 5]+iOffset)>>iShift) - ((piCur[n+ 5]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
| 1275 | iTemp = ((piOrg[n+ 6]+iOffset)>>iShift) - ((piCur[n+ 6]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
| 1276 | iTemp = ((piOrg[n+ 7]+iOffset)>>iShift) - ((piCur[n+ 7]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
| 1277 | iTemp = ((piOrg[n+ 8]+iOffset)>>iShift) - ((piCur[n+ 8]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
| 1278 | iTemp = ((piOrg[n+ 9]+iOffset)>>iShift) - ((piCur[n+ 9]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
| 1279 | iTemp = ((piOrg[n+10]+iOffset)>>iShift) - ((piCur[n+10]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
| 1280 | iTemp = ((piOrg[n+11]+iOffset)>>iShift) - ((piCur[n+11]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
| 1281 | iTemp = ((piOrg[n+12]+iOffset)>>iShift) - ((piCur[n+12]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
| 1282 | iTemp = ((piOrg[n+13]+iOffset)>>iShift) - ((piCur[n+13]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
| 1283 | iTemp = ((piOrg[n+14]+iOffset)>>iShift) - ((piCur[n+14]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
| 1284 | iTemp = ((piOrg[n+15]+iOffset)>>iShift) - ((piCur[n+15]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
| 1285 | |
---|
| 1286 | } |
---|
| 1287 | piOrg += iStrideOrg; |
---|
| 1288 | piCur += iStrideCur; |
---|
| 1289 | } |
---|
| 1290 | |
---|
| 1291 | return ( uiSum ); |
---|
| 1292 | } |
---|
| 1293 | |
---|
| 1294 | UInt TComRdCost::xGetSSE32( DistParam* pcDtParam ) |
---|
| 1295 | { |
---|
| 1296 | Pel* piOrg = pcDtParam->pOrg; |
---|
| 1297 | Pel* piCur = pcDtParam->pCur; |
---|
| 1298 | Int iRows = pcDtParam->iRows; |
---|
| 1299 | Int iStrideOrg = pcDtParam->iStrideOrg; |
---|
| 1300 | Int iStrideCur = pcDtParam->iStrideCur; |
---|
| 1301 | |
---|
| 1302 | UInt uiSum = 0; |
---|
| 1303 | Int iShift = g_uiBitIncrement; |
---|
| 1304 | Int iOffset = (g_uiBitIncrement>0)? (1<<(g_uiBitIncrement-1)):0; |
---|
| 1305 | Int iTemp; |
---|
| 1306 | |
---|
| 1307 | for( ; iRows != 0; iRows-- ) |
---|
| 1308 | { |
---|
| 1309 | |
---|
| 1310 | iTemp = ((piOrg[ 0]+iOffset)>>iShift) - ((piCur[ 0]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
| 1311 | iTemp = ((piOrg[ 1]+iOffset)>>iShift) - ((piCur[ 1]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
| 1312 | iTemp = ((piOrg[ 2]+iOffset)>>iShift) - ((piCur[ 2]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
| 1313 | iTemp = ((piOrg[ 3]+iOffset)>>iShift) - ((piCur[ 3]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
| 1314 | iTemp = ((piOrg[ 4]+iOffset)>>iShift) - ((piCur[ 4]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
| 1315 | iTemp = ((piOrg[ 5]+iOffset)>>iShift) - ((piCur[ 5]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
| 1316 | iTemp = ((piOrg[ 6]+iOffset)>>iShift) - ((piCur[ 6]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
| 1317 | iTemp = ((piOrg[ 7]+iOffset)>>iShift) - ((piCur[ 7]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
| 1318 | iTemp = ((piOrg[ 8]+iOffset)>>iShift) - ((piCur[ 8]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
| 1319 | iTemp = ((piOrg[ 9]+iOffset)>>iShift) - ((piCur[ 9]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
| 1320 | iTemp = ((piOrg[10]+iOffset)>>iShift) - ((piCur[10]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
| 1321 | iTemp = ((piOrg[11]+iOffset)>>iShift) - ((piCur[11]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
| 1322 | iTemp = ((piOrg[12]+iOffset)>>iShift) - ((piCur[12]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
| 1323 | iTemp = ((piOrg[13]+iOffset)>>iShift) - ((piCur[13]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
| 1324 | iTemp = ((piOrg[14]+iOffset)>>iShift) - ((piCur[14]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
| 1325 | iTemp = ((piOrg[15]+iOffset)>>iShift) - ((piCur[15]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
| 1326 | iTemp = ((piOrg[16]+iOffset)>>iShift) - ((piCur[16]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
| 1327 | iTemp = ((piOrg[17]+iOffset)>>iShift) - ((piCur[17]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
| 1328 | iTemp = ((piOrg[18]+iOffset)>>iShift) - ((piCur[18]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
| 1329 | iTemp = ((piOrg[19]+iOffset)>>iShift) - ((piCur[19]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
| 1330 | iTemp = ((piOrg[20]+iOffset)>>iShift) - ((piCur[20]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
| 1331 | iTemp = ((piOrg[21]+iOffset)>>iShift) - ((piCur[21]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
| 1332 | iTemp = ((piOrg[22]+iOffset)>>iShift) - ((piCur[22]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
| 1333 | iTemp = ((piOrg[23]+iOffset)>>iShift) - ((piCur[23]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
| 1334 | iTemp = ((piOrg[24]+iOffset)>>iShift) - ((piCur[24]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
| 1335 | iTemp = ((piOrg[25]+iOffset)>>iShift) - ((piCur[25]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
| 1336 | iTemp = ((piOrg[26]+iOffset)>>iShift) - ((piCur[26]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
| 1337 | iTemp = ((piOrg[27]+iOffset)>>iShift) - ((piCur[27]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
| 1338 | iTemp = ((piOrg[28]+iOffset)>>iShift) - ((piCur[28]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
| 1339 | iTemp = ((piOrg[29]+iOffset)>>iShift) - ((piCur[29]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
| 1340 | iTemp = ((piOrg[30]+iOffset)>>iShift) - ((piCur[30]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
| 1341 | iTemp = ((piOrg[31]+iOffset)>>iShift) - ((piCur[31]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
| 1342 | |
---|
| 1343 | piOrg += iStrideOrg; |
---|
| 1344 | piCur += iStrideCur; |
---|
| 1345 | } |
---|
| 1346 | |
---|
| 1347 | return ( uiSum ); |
---|
| 1348 | } |
---|
| 1349 | |
---|
| 1350 | UInt TComRdCost::xGetSSE64( DistParam* pcDtParam ) |
---|
| 1351 | { |
---|
| 1352 | Pel* piOrg = pcDtParam->pOrg; |
---|
| 1353 | Pel* piCur = pcDtParam->pCur; |
---|
| 1354 | Int iRows = pcDtParam->iRows; |
---|
| 1355 | Int iStrideOrg = pcDtParam->iStrideOrg; |
---|
| 1356 | Int iStrideCur = pcDtParam->iStrideCur; |
---|
| 1357 | |
---|
| 1358 | UInt uiSum = 0; |
---|
| 1359 | Int iShift = g_uiBitIncrement; |
---|
| 1360 | Int iOffset = (g_uiBitIncrement>0)? (1<<(g_uiBitIncrement-1)):0; |
---|
| 1361 | Int iTemp; |
---|
| 1362 | |
---|
| 1363 | for( ; iRows != 0; iRows-- ) |
---|
| 1364 | { |
---|
| 1365 | iTemp = ((piOrg[ 0]+iOffset)>>iShift) - ((piCur[ 0]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
| 1366 | iTemp = ((piOrg[ 1]+iOffset)>>iShift) - ((piCur[ 1]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
| 1367 | iTemp = ((piOrg[ 2]+iOffset)>>iShift) - ((piCur[ 2]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
| 1368 | iTemp = ((piOrg[ 3]+iOffset)>>iShift) - ((piCur[ 3]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
| 1369 | iTemp = ((piOrg[ 4]+iOffset)>>iShift) - ((piCur[ 4]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
| 1370 | iTemp = ((piOrg[ 5]+iOffset)>>iShift) - ((piCur[ 5]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
| 1371 | iTemp = ((piOrg[ 6]+iOffset)>>iShift) - ((piCur[ 6]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
| 1372 | iTemp = ((piOrg[ 7]+iOffset)>>iShift) - ((piCur[ 7]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
| 1373 | iTemp = ((piOrg[ 8]+iOffset)>>iShift) - ((piCur[ 8]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
| 1374 | iTemp = ((piOrg[ 9]+iOffset)>>iShift) - ((piCur[ 9]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
| 1375 | iTemp = ((piOrg[10]+iOffset)>>iShift) - ((piCur[10]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
| 1376 | iTemp = ((piOrg[11]+iOffset)>>iShift) - ((piCur[11]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
| 1377 | iTemp = ((piOrg[12]+iOffset)>>iShift) - ((piCur[12]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
| 1378 | iTemp = ((piOrg[13]+iOffset)>>iShift) - ((piCur[13]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
| 1379 | iTemp = ((piOrg[14]+iOffset)>>iShift) - ((piCur[14]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
| 1380 | iTemp = ((piOrg[15]+iOffset)>>iShift) - ((piCur[15]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
| 1381 | iTemp = ((piOrg[16]+iOffset)>>iShift) - ((piCur[16]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
| 1382 | iTemp = ((piOrg[17]+iOffset)>>iShift) - ((piCur[17]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
| 1383 | iTemp = ((piOrg[18]+iOffset)>>iShift) - ((piCur[18]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
| 1384 | iTemp = ((piOrg[19]+iOffset)>>iShift) - ((piCur[19]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
| 1385 | iTemp = ((piOrg[20]+iOffset)>>iShift) - ((piCur[20]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
| 1386 | iTemp = ((piOrg[21]+iOffset)>>iShift) - ((piCur[21]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
| 1387 | iTemp = ((piOrg[22]+iOffset)>>iShift) - ((piCur[22]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
| 1388 | iTemp = ((piOrg[23]+iOffset)>>iShift) - ((piCur[23]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
| 1389 | iTemp = ((piOrg[24]+iOffset)>>iShift) - ((piCur[24]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
| 1390 | iTemp = ((piOrg[25]+iOffset)>>iShift) - ((piCur[25]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
| 1391 | iTemp = ((piOrg[26]+iOffset)>>iShift) - ((piCur[26]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
| 1392 | iTemp = ((piOrg[27]+iOffset)>>iShift) - ((piCur[27]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
| 1393 | iTemp = ((piOrg[28]+iOffset)>>iShift) - ((piCur[28]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
| 1394 | iTemp = ((piOrg[29]+iOffset)>>iShift) - ((piCur[29]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
| 1395 | iTemp = ((piOrg[30]+iOffset)>>iShift) - ((piCur[30]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
| 1396 | iTemp = ((piOrg[31]+iOffset)>>iShift) - ((piCur[31]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
| 1397 | iTemp = ((piOrg[32]+iOffset)>>iShift) - ((piCur[32]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
| 1398 | iTemp = ((piOrg[33]+iOffset)>>iShift) - ((piCur[33]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
| 1399 | iTemp = ((piOrg[34]+iOffset)>>iShift) - ((piCur[34]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
| 1400 | iTemp = ((piOrg[35]+iOffset)>>iShift) - ((piCur[35]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
| 1401 | iTemp = ((piOrg[36]+iOffset)>>iShift) - ((piCur[36]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
| 1402 | iTemp = ((piOrg[37]+iOffset)>>iShift) - ((piCur[37]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
| 1403 | iTemp = ((piOrg[38]+iOffset)>>iShift) - ((piCur[38]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
| 1404 | iTemp = ((piOrg[39]+iOffset)>>iShift) - ((piCur[39]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
| 1405 | iTemp = ((piOrg[40]+iOffset)>>iShift) - ((piCur[40]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
| 1406 | iTemp = ((piOrg[41]+iOffset)>>iShift) - ((piCur[41]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
| 1407 | iTemp = ((piOrg[42]+iOffset)>>iShift) - ((piCur[42]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
| 1408 | iTemp = ((piOrg[43]+iOffset)>>iShift) - ((piCur[43]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
| 1409 | iTemp = ((piOrg[44]+iOffset)>>iShift) - ((piCur[44]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
| 1410 | iTemp = ((piOrg[45]+iOffset)>>iShift) - ((piCur[45]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
| 1411 | iTemp = ((piOrg[46]+iOffset)>>iShift) - ((piCur[46]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
| 1412 | iTemp = ((piOrg[47]+iOffset)>>iShift) - ((piCur[47]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
| 1413 | iTemp = ((piOrg[48]+iOffset)>>iShift) - ((piCur[48]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
| 1414 | iTemp = ((piOrg[49]+iOffset)>>iShift) - ((piCur[49]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
| 1415 | iTemp = ((piOrg[50]+iOffset)>>iShift) - ((piCur[50]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
| 1416 | iTemp = ((piOrg[51]+iOffset)>>iShift) - ((piCur[51]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
| 1417 | iTemp = ((piOrg[52]+iOffset)>>iShift) - ((piCur[52]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
| 1418 | iTemp = ((piOrg[53]+iOffset)>>iShift) - ((piCur[53]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
| 1419 | iTemp = ((piOrg[54]+iOffset)>>iShift) - ((piCur[54]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
| 1420 | iTemp = ((piOrg[55]+iOffset)>>iShift) - ((piCur[55]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
| 1421 | iTemp = ((piOrg[56]+iOffset)>>iShift) - ((piCur[56]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
| 1422 | iTemp = ((piOrg[57]+iOffset)>>iShift) - ((piCur[57]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
| 1423 | iTemp = ((piOrg[58]+iOffset)>>iShift) - ((piCur[58]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
| 1424 | iTemp = ((piOrg[59]+iOffset)>>iShift) - ((piCur[59]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
| 1425 | iTemp = ((piOrg[60]+iOffset)>>iShift) - ((piCur[60]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
| 1426 | iTemp = ((piOrg[61]+iOffset)>>iShift) - ((piCur[61]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
| 1427 | iTemp = ((piOrg[62]+iOffset)>>iShift) - ((piCur[62]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
| 1428 | iTemp = ((piOrg[63]+iOffset)>>iShift) - ((piCur[63]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
| 1429 | |
---|
| 1430 | piOrg += iStrideOrg; |
---|
| 1431 | piCur += iStrideCur; |
---|
| 1432 | } |
---|
| 1433 | |
---|
| 1434 | return ( uiSum ); |
---|
| 1435 | } |
---|
| 1436 | #else |
---|
| 1437 | UInt TComRdCost::xGetSSE( DistParam* pcDtParam ) |
---|
| 1438 | { |
---|
[56] | 1439 | if ( pcDtParam->bApplyWeight ) |
---|
[2] | 1440 | { |
---|
| 1441 | return xGetSSEw( pcDtParam ); |
---|
| 1442 | } |
---|
| 1443 | Pel* piOrg = pcDtParam->pOrg; |
---|
| 1444 | Pel* piCur = pcDtParam->pCur; |
---|
| 1445 | Int iRows = pcDtParam->iRows; |
---|
| 1446 | Int iCols = pcDtParam->iCols; |
---|
| 1447 | Int iStrideOrg = pcDtParam->iStrideOrg; |
---|
| 1448 | Int iStrideCur = pcDtParam->iStrideCur; |
---|
| 1449 | |
---|
| 1450 | UInt uiSum = 0; |
---|
| 1451 | UInt uiShift = g_uiBitIncrement<<1; |
---|
| 1452 | |
---|
| 1453 | Int iTemp; |
---|
| 1454 | |
---|
[5] | 1455 | #if HHI_INTERVIEW_SKIP |
---|
[2] | 1456 | if( pcDtParam->pUsed ) |
---|
| 1457 | { |
---|
| 1458 | Pel* piUsed = pcDtParam->pUsed; |
---|
| 1459 | Int iStrideUsed = pcDtParam->iStrideUsed; |
---|
| 1460 | for( ; iRows != 0; iRows-- ) |
---|
| 1461 | { |
---|
| 1462 | for (Int n = 0; n < iCols; n++ ) |
---|
| 1463 | { |
---|
| 1464 | if( piUsed[n] ) |
---|
[56] | 1465 | { |
---|
| 1466 | iTemp = piOrg[n ] - piCur[n ]; |
---|
| 1467 | uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1468 | } |
---|
[2] | 1469 | } |
---|
| 1470 | piOrg += iStrideOrg; |
---|
| 1471 | piCur += iStrideCur; |
---|
| 1472 | piUsed += iStrideUsed; |
---|
| 1473 | } |
---|
| 1474 | } |
---|
| 1475 | else |
---|
| 1476 | { |
---|
| 1477 | #endif |
---|
| 1478 | for( ; iRows != 0; iRows-- ) |
---|
| 1479 | { |
---|
| 1480 | for (Int n = 0; n < iCols; n++ ) |
---|
| 1481 | { |
---|
| 1482 | iTemp = piOrg[n ] - piCur[n ]; |
---|
| 1483 | uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1484 | } |
---|
| 1485 | piOrg += iStrideOrg; |
---|
| 1486 | piCur += iStrideCur; |
---|
| 1487 | } |
---|
[56] | 1488 | #if HHI_INTERVIEW_SKIP |
---|
[2] | 1489 | } |
---|
| 1490 | #endif |
---|
| 1491 | |
---|
| 1492 | return ( uiSum ); |
---|
| 1493 | } |
---|
| 1494 | |
---|
| 1495 | UInt TComRdCost::xGetSSE4( DistParam* pcDtParam ) |
---|
| 1496 | { |
---|
[56] | 1497 | if ( pcDtParam->bApplyWeight ) |
---|
[2] | 1498 | { |
---|
| 1499 | assert( pcDtParam->iCols == 4 ); |
---|
| 1500 | return xGetSSEw( pcDtParam ); |
---|
| 1501 | } |
---|
| 1502 | Pel* piOrg = pcDtParam->pOrg; |
---|
| 1503 | Pel* piCur = pcDtParam->pCur; |
---|
| 1504 | Int iRows = pcDtParam->iRows; |
---|
| 1505 | Int iStrideOrg = pcDtParam->iStrideOrg; |
---|
| 1506 | Int iStrideCur = pcDtParam->iStrideCur; |
---|
| 1507 | |
---|
| 1508 | UInt uiSum = 0; |
---|
| 1509 | UInt uiShift = g_uiBitIncrement<<1; |
---|
| 1510 | |
---|
| 1511 | Int iTemp; |
---|
| 1512 | |
---|
[5] | 1513 | #if HHI_INTERVIEW_SKIP |
---|
[2] | 1514 | if( pcDtParam->pUsed ) |
---|
| 1515 | { |
---|
| 1516 | Pel* piUsed = pcDtParam->pUsed; |
---|
| 1517 | Int iStrideUsed = pcDtParam->iStrideUsed; |
---|
| 1518 | for( ; iRows != 0; iRows-- ) |
---|
| 1519 | { |
---|
| 1520 | if( piUsed[0] ) { iTemp = piOrg[0] - piCur[0]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
| 1521 | if( piUsed[1] ) { iTemp = piOrg[1] - piCur[1]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
| 1522 | if( piUsed[2] ) { iTemp = piOrg[2] - piCur[2]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
| 1523 | if( piUsed[3] ) { iTemp = piOrg[3] - piCur[3]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
| 1524 | |
---|
| 1525 | piOrg += iStrideOrg; |
---|
| 1526 | piCur += iStrideCur; |
---|
| 1527 | piUsed += iStrideUsed; |
---|
| 1528 | } |
---|
| 1529 | } |
---|
| 1530 | else |
---|
| 1531 | { |
---|
| 1532 | #endif |
---|
| 1533 | for( ; iRows != 0; iRows-- ) |
---|
| 1534 | { |
---|
| 1535 | |
---|
| 1536 | iTemp = piOrg[0] - piCur[0]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1537 | iTemp = piOrg[1] - piCur[1]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1538 | iTemp = piOrg[2] - piCur[2]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1539 | iTemp = piOrg[3] - piCur[3]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1540 | |
---|
| 1541 | piOrg += iStrideOrg; |
---|
| 1542 | piCur += iStrideCur; |
---|
| 1543 | } |
---|
[5] | 1544 | #if HHI_INTERVIEW_SKIP |
---|
[2] | 1545 | } |
---|
| 1546 | #endif |
---|
| 1547 | |
---|
| 1548 | return ( uiSum ); |
---|
| 1549 | } |
---|
| 1550 | |
---|
| 1551 | UInt TComRdCost::xGetSSE8( DistParam* pcDtParam ) |
---|
| 1552 | { |
---|
[56] | 1553 | if ( pcDtParam->bApplyWeight ) |
---|
[2] | 1554 | { |
---|
| 1555 | assert( pcDtParam->iCols == 8 ); |
---|
| 1556 | return xGetSSEw( pcDtParam ); |
---|
| 1557 | } |
---|
| 1558 | Pel* piOrg = pcDtParam->pOrg; |
---|
| 1559 | Pel* piCur = pcDtParam->pCur; |
---|
| 1560 | Int iRows = pcDtParam->iRows; |
---|
| 1561 | Int iStrideOrg = pcDtParam->iStrideOrg; |
---|
| 1562 | Int iStrideCur = pcDtParam->iStrideCur; |
---|
| 1563 | |
---|
| 1564 | UInt uiSum = 0; |
---|
| 1565 | UInt uiShift = g_uiBitIncrement<<1; |
---|
| 1566 | |
---|
| 1567 | Int iTemp; |
---|
| 1568 | |
---|
[5] | 1569 | #if HHI_INTERVIEW_SKIP |
---|
[2] | 1570 | if( pcDtParam->pUsed ) |
---|
| 1571 | { |
---|
| 1572 | Pel* piUsed = pcDtParam->pUsed; |
---|
| 1573 | Int iStrideUsed = pcDtParam->iStrideUsed; |
---|
| 1574 | for( ; iRows != 0; iRows-- ) |
---|
| 1575 | { |
---|
| 1576 | if( piUsed[0] ) { iTemp = piOrg[0] - piCur[0]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
| 1577 | if( piUsed[1] ) { iTemp = piOrg[1] - piCur[1]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
| 1578 | if( piUsed[2] ) { iTemp = piOrg[2] - piCur[2]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
| 1579 | if( piUsed[3] ) { iTemp = piOrg[3] - piCur[3]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
| 1580 | if( piUsed[4] ) { iTemp = piOrg[4] - piCur[4]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
| 1581 | if( piUsed[5] ) { iTemp = piOrg[5] - piCur[5]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
| 1582 | if( piUsed[6] ) { iTemp = piOrg[6] - piCur[6]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
| 1583 | if( piUsed[7] ) { iTemp = piOrg[7] - piCur[7]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
| 1584 | |
---|
| 1585 | piOrg += iStrideOrg; |
---|
| 1586 | piCur += iStrideCur; |
---|
| 1587 | piUsed += iStrideUsed; |
---|
| 1588 | } |
---|
| 1589 | } |
---|
| 1590 | else |
---|
| 1591 | { |
---|
| 1592 | #endif |
---|
| 1593 | for( ; iRows != 0; iRows-- ) |
---|
| 1594 | { |
---|
| 1595 | iTemp = piOrg[0] - piCur[0]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1596 | iTemp = piOrg[1] - piCur[1]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1597 | iTemp = piOrg[2] - piCur[2]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1598 | iTemp = piOrg[3] - piCur[3]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1599 | iTemp = piOrg[4] - piCur[4]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1600 | iTemp = piOrg[5] - piCur[5]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1601 | iTemp = piOrg[6] - piCur[6]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1602 | iTemp = piOrg[7] - piCur[7]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1603 | |
---|
| 1604 | piOrg += iStrideOrg; |
---|
| 1605 | piCur += iStrideCur; |
---|
| 1606 | } |
---|
[5] | 1607 | #if HHI_INTERVIEW_SKIP |
---|
[2] | 1608 | } |
---|
| 1609 | #endif |
---|
| 1610 | |
---|
| 1611 | return ( uiSum ); |
---|
| 1612 | } |
---|
| 1613 | |
---|
| 1614 | UInt TComRdCost::xGetSSE16( DistParam* pcDtParam ) |
---|
| 1615 | { |
---|
[56] | 1616 | if ( pcDtParam->bApplyWeight ) |
---|
[2] | 1617 | { |
---|
| 1618 | assert( pcDtParam->iCols == 16 ); |
---|
| 1619 | return xGetSSEw( pcDtParam ); |
---|
| 1620 | } |
---|
| 1621 | Pel* piOrg = pcDtParam->pOrg; |
---|
| 1622 | Pel* piCur = pcDtParam->pCur; |
---|
| 1623 | Int iRows = pcDtParam->iRows; |
---|
| 1624 | Int iStrideOrg = pcDtParam->iStrideOrg; |
---|
| 1625 | Int iStrideCur = pcDtParam->iStrideCur; |
---|
| 1626 | |
---|
| 1627 | UInt uiSum = 0; |
---|
| 1628 | UInt uiShift = g_uiBitIncrement<<1; |
---|
| 1629 | |
---|
| 1630 | Int iTemp; |
---|
| 1631 | |
---|
[5] | 1632 | #if HHI_INTERVIEW_SKIP |
---|
[2] | 1633 | if( pcDtParam->pUsed ) |
---|
| 1634 | { |
---|
| 1635 | Pel* piUsed = pcDtParam->pUsed; |
---|
| 1636 | Int iStrideUsed = pcDtParam->iStrideUsed; |
---|
| 1637 | for( ; iRows != 0; iRows-- ) |
---|
| 1638 | { |
---|
| 1639 | if( piUsed[ 0] ) { iTemp = piOrg[ 0] - piCur[ 0]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
| 1640 | if( piUsed[ 1] ) { iTemp = piOrg[ 1] - piCur[ 1]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
| 1641 | if( piUsed[ 2] ) { iTemp = piOrg[ 2] - piCur[ 2]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
| 1642 | if( piUsed[ 3] ) { iTemp = piOrg[ 3] - piCur[ 3]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
| 1643 | if( piUsed[ 4] ) { iTemp = piOrg[ 4] - piCur[ 4]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
| 1644 | if( piUsed[ 5] ) { iTemp = piOrg[ 5] - piCur[ 5]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
| 1645 | if( piUsed[ 6] ) { iTemp = piOrg[ 6] - piCur[ 6]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
| 1646 | if( piUsed[ 7] ) { iTemp = piOrg[ 7] - piCur[ 7]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
| 1647 | if( piUsed[ 8] ) { iTemp = piOrg[ 8] - piCur[ 8]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
| 1648 | if( piUsed[ 9] ) { iTemp = piOrg[ 9] - piCur[ 9]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
| 1649 | if( piUsed[10] ) { iTemp = piOrg[10] - piCur[10]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
| 1650 | if( piUsed[11] ) { iTemp = piOrg[11] - piCur[11]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
| 1651 | if( piUsed[12] ) { iTemp = piOrg[12] - piCur[12]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
| 1652 | if( piUsed[13] ) { iTemp = piOrg[13] - piCur[13]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
| 1653 | if( piUsed[14] ) { iTemp = piOrg[14] - piCur[14]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
| 1654 | if( piUsed[15] ) { iTemp = piOrg[15] - piCur[15]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
| 1655 | |
---|
| 1656 | piOrg += iStrideOrg; |
---|
| 1657 | piCur += iStrideCur; |
---|
| 1658 | piUsed += iStrideUsed; |
---|
| 1659 | } |
---|
| 1660 | } |
---|
| 1661 | else |
---|
| 1662 | { |
---|
| 1663 | #endif |
---|
| 1664 | for( ; iRows != 0; iRows-- ) |
---|
| 1665 | { |
---|
| 1666 | |
---|
| 1667 | iTemp = piOrg[ 0] - piCur[ 0]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1668 | iTemp = piOrg[ 1] - piCur[ 1]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1669 | iTemp = piOrg[ 2] - piCur[ 2]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1670 | iTemp = piOrg[ 3] - piCur[ 3]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1671 | iTemp = piOrg[ 4] - piCur[ 4]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1672 | iTemp = piOrg[ 5] - piCur[ 5]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1673 | iTemp = piOrg[ 6] - piCur[ 6]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1674 | iTemp = piOrg[ 7] - piCur[ 7]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1675 | iTemp = piOrg[ 8] - piCur[ 8]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1676 | iTemp = piOrg[ 9] - piCur[ 9]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1677 | iTemp = piOrg[10] - piCur[10]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1678 | iTemp = piOrg[11] - piCur[11]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1679 | iTemp = piOrg[12] - piCur[12]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1680 | iTemp = piOrg[13] - piCur[13]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1681 | iTemp = piOrg[14] - piCur[14]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1682 | iTemp = piOrg[15] - piCur[15]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1683 | |
---|
| 1684 | piOrg += iStrideOrg; |
---|
| 1685 | piCur += iStrideCur; |
---|
| 1686 | } |
---|
[5] | 1687 | #if HHI_INTERVIEW_SKIP |
---|
[2] | 1688 | } |
---|
| 1689 | #endif |
---|
| 1690 | |
---|
| 1691 | return ( uiSum ); |
---|
| 1692 | } |
---|
| 1693 | |
---|
| 1694 | UInt TComRdCost::xGetSSE16N( DistParam* pcDtParam ) |
---|
| 1695 | { |
---|
[56] | 1696 | if ( pcDtParam->bApplyWeight ) |
---|
[2] | 1697 | { |
---|
| 1698 | return xGetSSEw( pcDtParam ); |
---|
| 1699 | } |
---|
| 1700 | Pel* piOrg = pcDtParam->pOrg; |
---|
| 1701 | Pel* piCur = pcDtParam->pCur; |
---|
| 1702 | Int iRows = pcDtParam->iRows; |
---|
| 1703 | Int iCols = pcDtParam->iCols; |
---|
| 1704 | Int iStrideOrg = pcDtParam->iStrideOrg; |
---|
| 1705 | Int iStrideCur = pcDtParam->iStrideCur; |
---|
| 1706 | |
---|
| 1707 | UInt uiSum = 0; |
---|
| 1708 | UInt uiShift = g_uiBitIncrement<<1; |
---|
| 1709 | Int iTemp; |
---|
| 1710 | |
---|
[5] | 1711 | #if HHI_INTERVIEW_SKIP |
---|
[2] | 1712 | if( pcDtParam->pUsed ) |
---|
| 1713 | { |
---|
| 1714 | Pel* piUsed = pcDtParam->pUsed; |
---|
| 1715 | Int iStrideUsed = pcDtParam->iStrideUsed; |
---|
| 1716 | for( ; iRows != 0; iRows-- ) |
---|
| 1717 | { |
---|
| 1718 | for (Int n = 0; n < iCols; n+=16 ) |
---|
| 1719 | { |
---|
| 1720 | if( piUsed[n+ 0] ) { iTemp = piOrg[n+ 0] - piCur[n+ 0]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
| 1721 | if( piUsed[n+ 1] ) { iTemp = piOrg[n+ 1] - piCur[n+ 1]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
| 1722 | if( piUsed[n+ 2] ) { iTemp = piOrg[n+ 2] - piCur[n+ 2]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
| 1723 | if( piUsed[n+ 3] ) { iTemp = piOrg[n+ 3] - piCur[n+ 3]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
| 1724 | if( piUsed[n+ 4] ) { iTemp = piOrg[n+ 4] - piCur[n+ 4]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
| 1725 | if( piUsed[n+ 5] ) { iTemp = piOrg[n+ 5] - piCur[n+ 5]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
| 1726 | if( piUsed[n+ 6] ) { iTemp = piOrg[n+ 6] - piCur[n+ 6]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
| 1727 | if( piUsed[n+ 7] ) { iTemp = piOrg[n+ 7] - piCur[n+ 7]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
| 1728 | if( piUsed[n+ 8] ) { iTemp = piOrg[n+ 8] - piCur[n+ 8]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
| 1729 | if( piUsed[n+ 9] ) { iTemp = piOrg[n+ 9] - piCur[n+ 9]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
| 1730 | if( piUsed[n+10] ) { iTemp = piOrg[n+10] - piCur[n+10]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
| 1731 | if( piUsed[n+11] ) { iTemp = piOrg[n+11] - piCur[n+11]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
| 1732 | if( piUsed[n+12] ) { iTemp = piOrg[n+12] - piCur[n+12]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
| 1733 | if( piUsed[n+13] ) { iTemp = piOrg[n+13] - piCur[n+13]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
| 1734 | if( piUsed[n+14] ) { iTemp = piOrg[n+14] - piCur[n+14]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
| 1735 | if( piUsed[n+15] ) { iTemp = piOrg[n+15] - piCur[n+15]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
| 1736 | } |
---|
| 1737 | piOrg += iStrideOrg; |
---|
| 1738 | piCur += iStrideCur; |
---|
| 1739 | piUsed += iStrideUsed; |
---|
| 1740 | } |
---|
| 1741 | } |
---|
| 1742 | else |
---|
| 1743 | { |
---|
| 1744 | #endif |
---|
| 1745 | for( ; iRows != 0; iRows-- ) |
---|
| 1746 | { |
---|
| 1747 | for (Int n = 0; n < iCols; n+=16 ) |
---|
| 1748 | { |
---|
| 1749 | |
---|
| 1750 | iTemp = piOrg[n+ 0] - piCur[n+ 0]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1751 | iTemp = piOrg[n+ 1] - piCur[n+ 1]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1752 | iTemp = piOrg[n+ 2] - piCur[n+ 2]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1753 | iTemp = piOrg[n+ 3] - piCur[n+ 3]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1754 | iTemp = piOrg[n+ 4] - piCur[n+ 4]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1755 | iTemp = piOrg[n+ 5] - piCur[n+ 5]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1756 | iTemp = piOrg[n+ 6] - piCur[n+ 6]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1757 | iTemp = piOrg[n+ 7] - piCur[n+ 7]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1758 | iTemp = piOrg[n+ 8] - piCur[n+ 8]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1759 | iTemp = piOrg[n+ 9] - piCur[n+ 9]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1760 | iTemp = piOrg[n+10] - piCur[n+10]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1761 | iTemp = piOrg[n+11] - piCur[n+11]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1762 | iTemp = piOrg[n+12] - piCur[n+12]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1763 | iTemp = piOrg[n+13] - piCur[n+13]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1764 | iTemp = piOrg[n+14] - piCur[n+14]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1765 | iTemp = piOrg[n+15] - piCur[n+15]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1766 | |
---|
| 1767 | } |
---|
| 1768 | piOrg += iStrideOrg; |
---|
| 1769 | piCur += iStrideCur; |
---|
| 1770 | } |
---|
[5] | 1771 | #if HHI_INTERVIEW_SKIP |
---|
[2] | 1772 | } |
---|
| 1773 | #endif |
---|
| 1774 | |
---|
| 1775 | return ( uiSum ); |
---|
| 1776 | } |
---|
| 1777 | |
---|
| 1778 | UInt TComRdCost::xGetSSE32( DistParam* pcDtParam ) |
---|
| 1779 | { |
---|
[56] | 1780 | if ( pcDtParam->bApplyWeight ) |
---|
[2] | 1781 | { |
---|
| 1782 | assert( pcDtParam->iCols == 32 ); |
---|
| 1783 | return xGetSSEw( pcDtParam ); |
---|
| 1784 | } |
---|
| 1785 | Pel* piOrg = pcDtParam->pOrg; |
---|
| 1786 | Pel* piCur = pcDtParam->pCur; |
---|
| 1787 | Int iRows = pcDtParam->iRows; |
---|
| 1788 | Int iStrideOrg = pcDtParam->iStrideOrg; |
---|
| 1789 | Int iStrideCur = pcDtParam->iStrideCur; |
---|
| 1790 | |
---|
| 1791 | UInt uiSum = 0; |
---|
| 1792 | UInt uiShift = g_uiBitIncrement<<1; |
---|
| 1793 | Int iTemp; |
---|
| 1794 | |
---|
[5] | 1795 | #if HHI_INTERVIEW_SKIP |
---|
[2] | 1796 | if( pcDtParam->pUsed ) |
---|
| 1797 | { |
---|
| 1798 | Pel* piUsed = pcDtParam->pUsed; |
---|
| 1799 | Int iStrideUsed = pcDtParam->iStrideUsed; |
---|
| 1800 | for( ; iRows != 0; iRows-- ) |
---|
| 1801 | { |
---|
| 1802 | if( piUsed[ 0] ) { iTemp = piOrg[ 0] - piCur[ 0]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
| 1803 | if( piUsed[ 1] ) { iTemp = piOrg[ 1] - piCur[ 1]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
| 1804 | if( piUsed[ 2] ) { iTemp = piOrg[ 2] - piCur[ 2]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
| 1805 | if( piUsed[ 3] ) { iTemp = piOrg[ 3] - piCur[ 3]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
| 1806 | if( piUsed[ 4] ) { iTemp = piOrg[ 4] - piCur[ 4]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
| 1807 | if( piUsed[ 5] ) { iTemp = piOrg[ 5] - piCur[ 5]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
| 1808 | if( piUsed[ 6] ) { iTemp = piOrg[ 6] - piCur[ 6]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
| 1809 | if( piUsed[ 7] ) { iTemp = piOrg[ 7] - piCur[ 7]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
| 1810 | if( piUsed[ 8] ) { iTemp = piOrg[ 8] - piCur[ 8]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
| 1811 | if( piUsed[ 9] ) { iTemp = piOrg[ 9] - piCur[ 9]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
| 1812 | if( piUsed[10] ) { iTemp = piOrg[10] - piCur[10]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
| 1813 | if( piUsed[11] ) { iTemp = piOrg[11] - piCur[11]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
| 1814 | if( piUsed[12] ) { iTemp = piOrg[12] - piCur[12]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
| 1815 | if( piUsed[13] ) { iTemp = piOrg[13] - piCur[13]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
| 1816 | if( piUsed[14] ) { iTemp = piOrg[14] - piCur[14]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
| 1817 | if( piUsed[15] ) { iTemp = piOrg[15] - piCur[15]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
| 1818 | if( piUsed[16] ) { iTemp = piOrg[16] - piCur[16]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
| 1819 | if( piUsed[17] ) { iTemp = piOrg[17] - piCur[17]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
| 1820 | if( piUsed[18] ) { iTemp = piOrg[18] - piCur[18]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
| 1821 | if( piUsed[19] ) { iTemp = piOrg[19] - piCur[19]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
| 1822 | if( piUsed[20] ) { iTemp = piOrg[20] - piCur[20]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
| 1823 | if( piUsed[21] ) { iTemp = piOrg[21] - piCur[21]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
| 1824 | if( piUsed[22] ) { iTemp = piOrg[22] - piCur[22]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
| 1825 | if( piUsed[23] ) { iTemp = piOrg[23] - piCur[23]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
| 1826 | if( piUsed[24] ) { iTemp = piOrg[24] - piCur[24]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
| 1827 | if( piUsed[25] ) { iTemp = piOrg[25] - piCur[25]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
| 1828 | if( piUsed[26] ) { iTemp = piOrg[26] - piCur[26]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
| 1829 | if( piUsed[27] ) { iTemp = piOrg[27] - piCur[27]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
| 1830 | if( piUsed[28] ) { iTemp = piOrg[28] - piCur[28]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
| 1831 | if( piUsed[29] ) { iTemp = piOrg[29] - piCur[29]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
| 1832 | if( piUsed[30] ) { iTemp = piOrg[30] - piCur[30]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
| 1833 | if( piUsed[31] ) { iTemp = piOrg[31] - piCur[31]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
| 1834 | |
---|
| 1835 | piOrg += iStrideOrg; |
---|
| 1836 | piCur += iStrideCur; |
---|
| 1837 | piUsed += iStrideUsed; |
---|
| 1838 | } |
---|
| 1839 | } |
---|
| 1840 | else |
---|
| 1841 | { |
---|
| 1842 | #endif |
---|
| 1843 | for( ; iRows != 0; iRows-- ) |
---|
| 1844 | { |
---|
| 1845 | |
---|
| 1846 | iTemp = piOrg[ 0] - piCur[ 0]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1847 | iTemp = piOrg[ 1] - piCur[ 1]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1848 | iTemp = piOrg[ 2] - piCur[ 2]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1849 | iTemp = piOrg[ 3] - piCur[ 3]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1850 | iTemp = piOrg[ 4] - piCur[ 4]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1851 | iTemp = piOrg[ 5] - piCur[ 5]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1852 | iTemp = piOrg[ 6] - piCur[ 6]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1853 | iTemp = piOrg[ 7] - piCur[ 7]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1854 | iTemp = piOrg[ 8] - piCur[ 8]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1855 | iTemp = piOrg[ 9] - piCur[ 9]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1856 | iTemp = piOrg[10] - piCur[10]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1857 | iTemp = piOrg[11] - piCur[11]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1858 | iTemp = piOrg[12] - piCur[12]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1859 | iTemp = piOrg[13] - piCur[13]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1860 | iTemp = piOrg[14] - piCur[14]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1861 | iTemp = piOrg[15] - piCur[15]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1862 | iTemp = piOrg[16] - piCur[16]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1863 | iTemp = piOrg[17] - piCur[17]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1864 | iTemp = piOrg[18] - piCur[18]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1865 | iTemp = piOrg[19] - piCur[19]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1866 | iTemp = piOrg[20] - piCur[20]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1867 | iTemp = piOrg[21] - piCur[21]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1868 | iTemp = piOrg[22] - piCur[22]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1869 | iTemp = piOrg[23] - piCur[23]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1870 | iTemp = piOrg[24] - piCur[24]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1871 | iTemp = piOrg[25] - piCur[25]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1872 | iTemp = piOrg[26] - piCur[26]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1873 | iTemp = piOrg[27] - piCur[27]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1874 | iTemp = piOrg[28] - piCur[28]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1875 | iTemp = piOrg[29] - piCur[29]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1876 | iTemp = piOrg[30] - piCur[30]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1877 | iTemp = piOrg[31] - piCur[31]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1878 | |
---|
| 1879 | piOrg += iStrideOrg; |
---|
| 1880 | piCur += iStrideCur; |
---|
| 1881 | } |
---|
[5] | 1882 | #if HHI_INTERVIEW_SKIP |
---|
[2] | 1883 | } |
---|
| 1884 | #endif |
---|
| 1885 | |
---|
| 1886 | return ( uiSum ); |
---|
| 1887 | } |
---|
| 1888 | |
---|
| 1889 | UInt TComRdCost::xGetSSE64( DistParam* pcDtParam ) |
---|
| 1890 | { |
---|
[56] | 1891 | if ( pcDtParam->bApplyWeight ) |
---|
[2] | 1892 | { |
---|
| 1893 | assert( pcDtParam->iCols == 64 ); |
---|
| 1894 | return xGetSSEw( pcDtParam ); |
---|
| 1895 | } |
---|
| 1896 | Pel* piOrg = pcDtParam->pOrg; |
---|
| 1897 | Pel* piCur = pcDtParam->pCur; |
---|
| 1898 | Int iRows = pcDtParam->iRows; |
---|
| 1899 | Int iStrideOrg = pcDtParam->iStrideOrg; |
---|
| 1900 | Int iStrideCur = pcDtParam->iStrideCur; |
---|
| 1901 | |
---|
| 1902 | UInt uiSum = 0; |
---|
| 1903 | UInt uiShift = g_uiBitIncrement<<1; |
---|
| 1904 | Int iTemp; |
---|
| 1905 | |
---|
[5] | 1906 | #if HHI_INTERVIEW_SKIP |
---|
[2] | 1907 | if( pcDtParam->pUsed ) |
---|
| 1908 | { |
---|
| 1909 | Pel* piUsed = pcDtParam->pUsed; |
---|
| 1910 | Int iStrideUsed = pcDtParam->iStrideUsed; |
---|
| 1911 | for( ; iRows != 0; iRows-- ) |
---|
| 1912 | { |
---|
| 1913 | if( piUsed[ 0] ) { iTemp = piOrg[ 0] - piCur[ 0]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
| 1914 | if( piUsed[ 1] ) { iTemp = piOrg[ 1] - piCur[ 1]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
| 1915 | if( piUsed[ 2] ) { iTemp = piOrg[ 2] - piCur[ 2]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
| 1916 | if( piUsed[ 3] ) { iTemp = piOrg[ 3] - piCur[ 3]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
| 1917 | if( piUsed[ 4] ) { iTemp = piOrg[ 4] - piCur[ 4]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
| 1918 | if( piUsed[ 5] ) { iTemp = piOrg[ 5] - piCur[ 5]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
| 1919 | if( piUsed[ 6] ) { iTemp = piOrg[ 6] - piCur[ 6]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
| 1920 | if( piUsed[ 7] ) { iTemp = piOrg[ 7] - piCur[ 7]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
| 1921 | if( piUsed[ 8] ) { iTemp = piOrg[ 8] - piCur[ 8]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
| 1922 | if( piUsed[ 9] ) { iTemp = piOrg[ 9] - piCur[ 9]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
| 1923 | if( piUsed[10] ) { iTemp = piOrg[10] - piCur[10]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
| 1924 | if( piUsed[11] ) { iTemp = piOrg[11] - piCur[11]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
| 1925 | if( piUsed[12] ) { iTemp = piOrg[12] - piCur[12]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
| 1926 | if( piUsed[13] ) { iTemp = piOrg[13] - piCur[13]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
| 1927 | if( piUsed[14] ) { iTemp = piOrg[14] - piCur[14]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
| 1928 | if( piUsed[15] ) { iTemp = piOrg[15] - piCur[15]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
| 1929 | if( piUsed[16] ) { iTemp = piOrg[16] - piCur[16]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
| 1930 | if( piUsed[17] ) { iTemp = piOrg[17] - piCur[17]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
| 1931 | if( piUsed[18] ) { iTemp = piOrg[18] - piCur[18]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
| 1932 | if( piUsed[19] ) { iTemp = piOrg[19] - piCur[19]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
| 1933 | if( piUsed[20] ) { iTemp = piOrg[20] - piCur[20]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
| 1934 | if( piUsed[21] ) { iTemp = piOrg[21] - piCur[21]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
| 1935 | if( piUsed[22] ) { iTemp = piOrg[22] - piCur[22]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
| 1936 | if( piUsed[23] ) { iTemp = piOrg[23] - piCur[23]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
| 1937 | if( piUsed[24] ) { iTemp = piOrg[24] - piCur[24]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
| 1938 | if( piUsed[25] ) { iTemp = piOrg[25] - piCur[25]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
| 1939 | if( piUsed[26] ) { iTemp = piOrg[26] - piCur[26]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
| 1940 | if( piUsed[27] ) { iTemp = piOrg[27] - piCur[27]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
| 1941 | if( piUsed[28] ) { iTemp = piOrg[28] - piCur[28]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
| 1942 | if( piUsed[29] ) { iTemp = piOrg[29] - piCur[29]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
| 1943 | if( piUsed[30] ) { iTemp = piOrg[30] - piCur[30]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
| 1944 | if( piUsed[31] ) { iTemp = piOrg[31] - piCur[31]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
| 1945 | if( piUsed[32] ) { iTemp = piOrg[32] - piCur[32]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
| 1946 | if( piUsed[33] ) { iTemp = piOrg[33] - piCur[33]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
| 1947 | if( piUsed[34] ) { iTemp = piOrg[34] - piCur[34]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
| 1948 | if( piUsed[35] ) { iTemp = piOrg[35] - piCur[35]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
| 1949 | if( piUsed[36] ) { iTemp = piOrg[36] - piCur[36]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
| 1950 | if( piUsed[37] ) { iTemp = piOrg[37] - piCur[37]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
| 1951 | if( piUsed[38] ) { iTemp = piOrg[38] - piCur[38]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
| 1952 | if( piUsed[39] ) { iTemp = piOrg[39] - piCur[39]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
| 1953 | if( piUsed[40] ) { iTemp = piOrg[40] - piCur[40]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
| 1954 | if( piUsed[41] ) { iTemp = piOrg[41] - piCur[41]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
| 1955 | if( piUsed[42] ) { iTemp = piOrg[42] - piCur[42]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
| 1956 | if( piUsed[43] ) { iTemp = piOrg[43] - piCur[43]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
| 1957 | if( piUsed[44] ) { iTemp = piOrg[44] - piCur[44]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
| 1958 | if( piUsed[45] ) { iTemp = piOrg[45] - piCur[45]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
| 1959 | if( piUsed[46] ) { iTemp = piOrg[46] - piCur[46]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
| 1960 | if( piUsed[47] ) { iTemp = piOrg[47] - piCur[47]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
| 1961 | if( piUsed[48] ) { iTemp = piOrg[48] - piCur[48]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
| 1962 | if( piUsed[49] ) { iTemp = piOrg[49] - piCur[49]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
| 1963 | if( piUsed[50] ) { iTemp = piOrg[50] - piCur[50]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
| 1964 | if( piUsed[51] ) { iTemp = piOrg[51] - piCur[51]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
| 1965 | if( piUsed[52] ) { iTemp = piOrg[52] - piCur[52]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
| 1966 | if( piUsed[53] ) { iTemp = piOrg[53] - piCur[53]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
| 1967 | if( piUsed[54] ) { iTemp = piOrg[54] - piCur[54]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
| 1968 | if( piUsed[55] ) { iTemp = piOrg[55] - piCur[55]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
| 1969 | if( piUsed[56] ) { iTemp = piOrg[56] - piCur[56]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
| 1970 | if( piUsed[57] ) { iTemp = piOrg[57] - piCur[57]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
| 1971 | if( piUsed[58] ) { iTemp = piOrg[58] - piCur[58]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
| 1972 | if( piUsed[59] ) { iTemp = piOrg[59] - piCur[59]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
| 1973 | if( piUsed[60] ) { iTemp = piOrg[60] - piCur[60]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
| 1974 | if( piUsed[61] ) { iTemp = piOrg[61] - piCur[61]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
| 1975 | if( piUsed[62] ) { iTemp = piOrg[62] - piCur[62]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
| 1976 | if( piUsed[63] ) { iTemp = piOrg[63] - piCur[63]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
| 1977 | |
---|
| 1978 | piOrg += iStrideOrg; |
---|
| 1979 | piCur += iStrideCur; |
---|
| 1980 | piUsed += iStrideUsed; |
---|
| 1981 | } |
---|
| 1982 | } |
---|
| 1983 | else |
---|
| 1984 | { |
---|
| 1985 | #endif |
---|
| 1986 | for( ; iRows != 0; iRows-- ) |
---|
| 1987 | { |
---|
| 1988 | iTemp = piOrg[ 0] - piCur[ 0]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1989 | iTemp = piOrg[ 1] - piCur[ 1]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1990 | iTemp = piOrg[ 2] - piCur[ 2]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1991 | iTemp = piOrg[ 3] - piCur[ 3]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1992 | iTemp = piOrg[ 4] - piCur[ 4]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1993 | iTemp = piOrg[ 5] - piCur[ 5]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1994 | iTemp = piOrg[ 6] - piCur[ 6]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1995 | iTemp = piOrg[ 7] - piCur[ 7]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1996 | iTemp = piOrg[ 8] - piCur[ 8]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1997 | iTemp = piOrg[ 9] - piCur[ 9]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1998 | iTemp = piOrg[10] - piCur[10]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1999 | iTemp = piOrg[11] - piCur[11]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 2000 | iTemp = piOrg[12] - piCur[12]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 2001 | iTemp = piOrg[13] - piCur[13]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 2002 | iTemp = piOrg[14] - piCur[14]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 2003 | iTemp = piOrg[15] - piCur[15]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 2004 | iTemp = piOrg[16] - piCur[16]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 2005 | iTemp = piOrg[17] - piCur[17]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 2006 | iTemp = piOrg[18] - piCur[18]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 2007 | iTemp = piOrg[19] - piCur[19]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 2008 | iTemp = piOrg[20] - piCur[20]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 2009 | iTemp = piOrg[21] - piCur[21]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 2010 | iTemp = piOrg[22] - piCur[22]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 2011 | iTemp = piOrg[23] - piCur[23]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 2012 | iTemp = piOrg[24] - piCur[24]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 2013 | iTemp = piOrg[25] - piCur[25]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 2014 | iTemp = piOrg[26] - piCur[26]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 2015 | iTemp = piOrg[27] - piCur[27]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 2016 | iTemp = piOrg[28] - piCur[28]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 2017 | iTemp = piOrg[29] - piCur[29]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 2018 | iTemp = piOrg[30] - piCur[30]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 2019 | iTemp = piOrg[31] - piCur[31]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 2020 | iTemp = piOrg[32] - piCur[32]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 2021 | iTemp = piOrg[33] - piCur[33]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 2022 | iTemp = piOrg[34] - piCur[34]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 2023 | iTemp = piOrg[35] - piCur[35]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 2024 | iTemp = piOrg[36] - piCur[36]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 2025 | iTemp = piOrg[37] - piCur[37]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 2026 | iTemp = piOrg[38] - piCur[38]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 2027 | iTemp = piOrg[39] - piCur[39]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 2028 | iTemp = piOrg[40] - piCur[40]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 2029 | iTemp = piOrg[41] - piCur[41]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 2030 | iTemp = piOrg[42] - piCur[42]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 2031 | iTemp = piOrg[43] - piCur[43]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 2032 | iTemp = piOrg[44] - piCur[44]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 2033 | iTemp = piOrg[45] - piCur[45]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 2034 | iTemp = piOrg[46] - piCur[46]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 2035 | iTemp = piOrg[47] - piCur[47]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 2036 | iTemp = piOrg[48] - piCur[48]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 2037 | iTemp = piOrg[49] - piCur[49]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 2038 | iTemp = piOrg[50] - piCur[50]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 2039 | iTemp = piOrg[51] - piCur[51]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 2040 | iTemp = piOrg[52] - piCur[52]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 2041 | iTemp = piOrg[53] - piCur[53]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 2042 | iTemp = piOrg[54] - piCur[54]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 2043 | iTemp = piOrg[55] - piCur[55]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 2044 | iTemp = piOrg[56] - piCur[56]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 2045 | iTemp = piOrg[57] - piCur[57]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 2046 | iTemp = piOrg[58] - piCur[58]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 2047 | iTemp = piOrg[59] - piCur[59]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 2048 | iTemp = piOrg[60] - piCur[60]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 2049 | iTemp = piOrg[61] - piCur[61]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 2050 | iTemp = piOrg[62] - piCur[62]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 2051 | iTemp = piOrg[63] - piCur[63]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 2052 | |
---|
| 2053 | piOrg += iStrideOrg; |
---|
| 2054 | piCur += iStrideCur; |
---|
| 2055 | } |
---|
[5] | 2056 | #if HHI_INTERVIEW_SKIP |
---|
[2] | 2057 | } |
---|
| 2058 | #endif |
---|
| 2059 | |
---|
| 2060 | return ( uiSum ); |
---|
| 2061 | } |
---|
| 2062 | #endif |
---|
| 2063 | |
---|
[100] | 2064 | |
---|
| 2065 | #if SAIT_VSO_EST_A0033 |
---|
| 2066 | UInt TComRdCost::getVSDEstimate( Int dDM, Pel* pOrg, Int iOrgStride, Pel* pVirRec, Pel* pVirOrg, Int iVirStride, Int x, Int y ) |
---|
| 2067 | { |
---|
| 2068 | Double dD; |
---|
| 2069 | Int iTemp; |
---|
| 2070 | |
---|
| 2071 | dD = ( (Double) ( dDM >> g_uiBitIncrement ) ) * m_dDisparityCoeff; |
---|
| 2072 | |
---|
| 2073 | iTemp = (Int) ROUND( 0.5 * fabs(dD) * ( abs( (Int) pVirRec[ x+y*iVirStride ] - (Int) pVirRec[ x-1+y*iVirStride ] ) + abs( (Int) pVirRec[ x+y*iVirStride ] - (Int) pVirRec[ x+1+y*iVirStride ] ) ) ); |
---|
| 2074 | |
---|
| 2075 | return (UInt) ( (iTemp*iTemp)>>1 ); |
---|
| 2076 | } |
---|
| 2077 | |
---|
| 2078 | UInt TComRdCost::xGetVSD( DistParam* pcDtParam ) |
---|
| 2079 | { |
---|
| 2080 | Pel* piOrg = pcDtParam->pOrg; |
---|
| 2081 | Pel* piCur = pcDtParam->pCur; |
---|
| 2082 | Pel* piVirRec = pcDtParam->pVirRec; |
---|
| 2083 | Pel* piVirOrg = pcDtParam->pVirOrg; |
---|
| 2084 | Int iRows = pcDtParam->iRows; |
---|
| 2085 | Int iCols = pcDtParam->iCols; |
---|
| 2086 | Int iStrideOrg = pcDtParam->iStrideOrg; |
---|
| 2087 | Int iStrideCur = pcDtParam->iStrideCur; |
---|
| 2088 | Int iStrideVir = pcDtParam->iStrideVir; |
---|
| 2089 | |
---|
| 2090 | UInt uiSum = 0; |
---|
| 2091 | UInt uiShift = g_uiBitIncrement<<1; |
---|
| 2092 | |
---|
| 2093 | Int dDM; |
---|
| 2094 | |
---|
| 2095 | for ( Int y = 0 ; y < iRows ; y++ ) |
---|
| 2096 | { |
---|
| 2097 | for (Int x = 0; x < iCols; x++ ) |
---|
| 2098 | { |
---|
| 2099 | dDM = (Int) ( piOrg[x ] - piCur[x ] ); |
---|
| 2100 | uiSum += getVSDEstimate( dDM, piOrg, iStrideOrg, piVirRec, piVirOrg, iStrideVir, x, y ) >> uiShift; |
---|
| 2101 | } |
---|
| 2102 | piOrg += iStrideOrg; |
---|
| 2103 | piCur += iStrideCur; |
---|
| 2104 | } |
---|
| 2105 | |
---|
| 2106 | return ( uiSum ); |
---|
| 2107 | } |
---|
| 2108 | |
---|
| 2109 | UInt TComRdCost::xGetVSD4( DistParam* pcDtParam ) |
---|
| 2110 | { |
---|
| 2111 | Pel* piOrg = pcDtParam->pOrg; |
---|
| 2112 | Pel* piCur = pcDtParam->pCur; |
---|
| 2113 | Pel* piVirRec = pcDtParam->pVirRec; |
---|
| 2114 | Pel* piVirOrg = pcDtParam->pVirOrg; |
---|
| 2115 | Int iRows = pcDtParam->iRows; |
---|
| 2116 | Int iStrideOrg = pcDtParam->iStrideOrg; |
---|
| 2117 | Int iStrideCur = pcDtParam->iStrideCur; |
---|
| 2118 | Int iStrideVir = pcDtParam->iStrideVir; |
---|
| 2119 | |
---|
| 2120 | UInt uiSum = 0; |
---|
| 2121 | UInt uiShift = g_uiBitIncrement<<1; |
---|
| 2122 | |
---|
| 2123 | Int dDM; |
---|
| 2124 | |
---|
| 2125 | for ( Int y = 0 ; y < iRows ; y++ ) |
---|
| 2126 | { |
---|
| 2127 | dDM = (Int) ( piOrg[0] - piCur[0] ); uiSum += ( getVSDEstimate( dDM, piOrg, iStrideOrg, piVirRec, piVirOrg, iStrideVir, 0, y ) ) >> uiShift; |
---|
| 2128 | dDM = (Int) ( piOrg[1] - piCur[1] ); uiSum += ( getVSDEstimate( dDM, piOrg, iStrideOrg, piVirRec, piVirOrg, iStrideVir, 1, y ) ) >> uiShift; |
---|
| 2129 | dDM = (Int) ( piOrg[2] - piCur[2] ); uiSum += ( getVSDEstimate( dDM, piOrg, iStrideOrg, piVirRec, piVirOrg, iStrideVir, 2, y ) ) >> uiShift; |
---|
| 2130 | dDM = (Int) ( piOrg[3] - piCur[3] ); uiSum += ( getVSDEstimate( dDM, piOrg, iStrideOrg, piVirRec, piVirOrg, iStrideVir, 3, y ) ) >> uiShift; |
---|
| 2131 | |
---|
| 2132 | piOrg += iStrideOrg; |
---|
| 2133 | piCur += iStrideCur; |
---|
| 2134 | } |
---|
| 2135 | |
---|
| 2136 | return ( uiSum ); |
---|
| 2137 | } |
---|
| 2138 | |
---|
| 2139 | UInt TComRdCost::xGetVSD8( DistParam* pcDtParam ) |
---|
| 2140 | { |
---|
| 2141 | Pel* piOrg = pcDtParam->pOrg; |
---|
| 2142 | Pel* piCur = pcDtParam->pCur; |
---|
| 2143 | Pel* piVirRec = pcDtParam->pVirRec; |
---|
| 2144 | Pel* piVirOrg = pcDtParam->pVirOrg; |
---|
| 2145 | Int iRows = pcDtParam->iRows; |
---|
| 2146 | Int iStrideOrg = pcDtParam->iStrideOrg; |
---|
| 2147 | Int iStrideCur = pcDtParam->iStrideCur; |
---|
| 2148 | Int iStrideVir = pcDtParam->iStrideVir; |
---|
| 2149 | |
---|
| 2150 | UInt uiSum = 0; |
---|
| 2151 | UInt uiShift = g_uiBitIncrement<<1; |
---|
| 2152 | |
---|
| 2153 | Int dDM; |
---|
| 2154 | |
---|
| 2155 | for ( Int y = 0 ; y < iRows ; y++ ) |
---|
| 2156 | { |
---|
| 2157 | for (Int x = 0; x < 8; x++ ) |
---|
| 2158 | { |
---|
| 2159 | dDM = (Int) ( piOrg[x] - piCur[x] ); |
---|
| 2160 | uiSum += getVSDEstimate( dDM, piOrg, iStrideOrg, piVirRec, piVirOrg, iStrideVir, x, y ) >> uiShift; |
---|
| 2161 | } |
---|
| 2162 | piOrg += iStrideOrg; |
---|
| 2163 | piCur += iStrideCur; |
---|
| 2164 | } |
---|
| 2165 | |
---|
| 2166 | return ( uiSum ); |
---|
| 2167 | } |
---|
| 2168 | |
---|
| 2169 | UInt TComRdCost::xGetVSD16( DistParam* pcDtParam ) |
---|
| 2170 | { |
---|
| 2171 | Pel* piOrg = pcDtParam->pOrg; |
---|
| 2172 | Pel* piCur = pcDtParam->pCur; |
---|
| 2173 | Pel* piVirRec = pcDtParam->pVirRec; |
---|
| 2174 | Pel* piVirOrg = pcDtParam->pVirOrg; |
---|
| 2175 | Int iRows = pcDtParam->iRows; |
---|
| 2176 | Int iStrideOrg = pcDtParam->iStrideOrg; |
---|
| 2177 | Int iStrideCur = pcDtParam->iStrideCur; |
---|
| 2178 | Int iStrideVir = pcDtParam->iStrideVir; |
---|
| 2179 | |
---|
| 2180 | UInt uiSum = 0; |
---|
| 2181 | UInt uiShift = g_uiBitIncrement<<1; |
---|
| 2182 | |
---|
| 2183 | Int dDM; |
---|
| 2184 | |
---|
| 2185 | for ( Int y = 0 ; y < iRows ; y++ ) |
---|
| 2186 | { |
---|
| 2187 | for (Int x = 0; x < 16; x++ ) |
---|
| 2188 | { |
---|
| 2189 | dDM = (Int) ( piOrg[x] - piCur[x] ); |
---|
| 2190 | uiSum += getVSDEstimate( dDM, piOrg, iStrideOrg, piVirRec, piVirOrg, iStrideVir, x, y ) >> uiShift; |
---|
| 2191 | } |
---|
| 2192 | piOrg += iStrideOrg; |
---|
| 2193 | piCur += iStrideCur; |
---|
| 2194 | } |
---|
| 2195 | |
---|
| 2196 | return ( uiSum ); |
---|
| 2197 | } |
---|
| 2198 | |
---|
| 2199 | UInt TComRdCost::xGetVSD16N( DistParam* pcDtParam ) |
---|
| 2200 | { |
---|
| 2201 | Pel* piOrg = pcDtParam->pOrg; |
---|
| 2202 | Pel* piCur = pcDtParam->pCur; |
---|
| 2203 | Pel* piVirRec = pcDtParam->pVirRec; |
---|
| 2204 | Pel* piVirOrg = pcDtParam->pVirOrg; |
---|
| 2205 | Int iRows = pcDtParam->iRows; |
---|
| 2206 | Int iCols = pcDtParam->iCols; |
---|
| 2207 | Int iStrideOrg = pcDtParam->iStrideOrg; |
---|
| 2208 | Int iStrideCur = pcDtParam->iStrideCur; |
---|
| 2209 | Int iStrideVir = pcDtParam->iStrideVir; |
---|
| 2210 | |
---|
| 2211 | UInt uiSum = 0; |
---|
| 2212 | UInt uiShift = g_uiBitIncrement<<1; |
---|
| 2213 | |
---|
| 2214 | Int dDM; |
---|
| 2215 | |
---|
| 2216 | for ( Int y = 0 ; y < iRows ; y++ ) |
---|
| 2217 | { |
---|
| 2218 | for (Int x = 0; x < iCols; x+=16 ) |
---|
| 2219 | { |
---|
| 2220 | for ( Int k = 0 ; k < 16 ; k++ ) |
---|
| 2221 | { |
---|
| 2222 | dDM = (Int) ( piOrg[x+k] - piCur[x+k] ); |
---|
| 2223 | uiSum += getVSDEstimate( dDM, piOrg, iStrideOrg, piVirRec, piVirOrg, iStrideVir, x+k, y ) >> uiShift; |
---|
| 2224 | } |
---|
| 2225 | } |
---|
| 2226 | piOrg += iStrideOrg; |
---|
| 2227 | piCur += iStrideCur; |
---|
| 2228 | } |
---|
| 2229 | |
---|
| 2230 | return ( uiSum ); |
---|
| 2231 | } |
---|
| 2232 | |
---|
| 2233 | UInt TComRdCost::xGetVSD32( DistParam* pcDtParam ) |
---|
| 2234 | { |
---|
| 2235 | Pel* piOrg = pcDtParam->pOrg; |
---|
| 2236 | Pel* piCur = pcDtParam->pCur; |
---|
| 2237 | Pel* piVirRec = pcDtParam->pVirRec; |
---|
| 2238 | Pel* piVirOrg = pcDtParam->pVirOrg; |
---|
| 2239 | Int iRows = pcDtParam->iRows; |
---|
| 2240 | Int iStrideOrg = pcDtParam->iStrideOrg; |
---|
| 2241 | Int iStrideCur = pcDtParam->iStrideCur; |
---|
| 2242 | Int iStrideVir = pcDtParam->iStrideVir; |
---|
| 2243 | |
---|
| 2244 | UInt uiSum = 0; |
---|
| 2245 | UInt uiShift = g_uiBitIncrement<<1; |
---|
| 2246 | |
---|
| 2247 | Int dDM; |
---|
| 2248 | |
---|
| 2249 | for ( Int y = 0 ; y < iRows ; y++ ) |
---|
| 2250 | { |
---|
| 2251 | for (Int x = 0; x < 32 ; x++ ) |
---|
| 2252 | { |
---|
| 2253 | dDM = (Int) ( piOrg[x] - piCur[x] ); |
---|
| 2254 | uiSum += getVSDEstimate( dDM, piOrg, iStrideOrg, piVirRec, piVirOrg, iStrideVir, x, y ) >> uiShift; |
---|
| 2255 | } |
---|
| 2256 | piOrg += iStrideOrg; |
---|
| 2257 | piCur += iStrideCur; |
---|
| 2258 | } |
---|
| 2259 | |
---|
| 2260 | return ( uiSum ); |
---|
| 2261 | } |
---|
| 2262 | |
---|
| 2263 | UInt TComRdCost::xGetVSD64( DistParam* pcDtParam ) |
---|
| 2264 | { |
---|
| 2265 | Pel* piOrg = pcDtParam->pOrg; |
---|
| 2266 | Pel* piCur = pcDtParam->pCur; |
---|
| 2267 | Pel* piVirRec = pcDtParam->pVirRec; |
---|
| 2268 | Pel* piVirOrg = pcDtParam->pVirOrg; |
---|
| 2269 | Int iRows = pcDtParam->iRows; |
---|
| 2270 | Int iStrideOrg = pcDtParam->iStrideOrg; |
---|
| 2271 | Int iStrideCur = pcDtParam->iStrideCur; |
---|
| 2272 | Int iStrideVir = pcDtParam->iStrideVir; |
---|
| 2273 | |
---|
| 2274 | UInt uiSum = 0; |
---|
| 2275 | UInt uiShift = g_uiBitIncrement<<1; |
---|
| 2276 | |
---|
| 2277 | Int dDM; |
---|
| 2278 | |
---|
| 2279 | for ( Int y = 0 ; y < iRows ; y++ ) |
---|
| 2280 | { |
---|
| 2281 | for (Int x = 0; x < 64; x++ ) |
---|
| 2282 | { |
---|
| 2283 | dDM = (Int) ( piOrg[x] - piCur[x] ); |
---|
| 2284 | uiSum += getVSDEstimate( dDM, piOrg, iStrideOrg, piVirRec, piVirOrg, iStrideVir, x, y ) >> uiShift; |
---|
| 2285 | } |
---|
| 2286 | piOrg += iStrideOrg; |
---|
| 2287 | piCur += iStrideCur; |
---|
| 2288 | } |
---|
| 2289 | |
---|
| 2290 | return ( uiSum ); |
---|
| 2291 | } |
---|
| 2292 | |
---|
| 2293 | #endif |
---|
| 2294 | |
---|
[2] | 2295 | // -------------------------------------------------------------------------------------------------------------------- |
---|
| 2296 | // HADAMARD with step (used in fractional search) |
---|
| 2297 | // -------------------------------------------------------------------------------------------------------------------- |
---|
| 2298 | |
---|
[56] | 2299 | UInt TComRdCost::xCalcHADs2x2( Pel *piOrg, Pel *piCur, Int iStrideOrg, Int iStrideCur, Int iStep ) |
---|
[2] | 2300 | { |
---|
| 2301 | Int satd = 0, diff[4], m[4]; |
---|
[56] | 2302 | assert( iStep == 1 ); |
---|
| 2303 | diff[0] = piOrg[0 ] - piCur[0]; |
---|
| 2304 | diff[1] = piOrg[1 ] - piCur[1]; |
---|
| 2305 | diff[2] = piOrg[iStrideOrg ] - piCur[0 + iStrideCur]; |
---|
| 2306 | diff[3] = piOrg[iStrideOrg + 1] - piCur[1 + iStrideCur]; |
---|
[2] | 2307 | m[0] = diff[0] + diff[2]; |
---|
| 2308 | m[1] = diff[1] + diff[3]; |
---|
| 2309 | m[2] = diff[0] - diff[2]; |
---|
| 2310 | m[3] = diff[1] - diff[3]; |
---|
| 2311 | |
---|
| 2312 | satd += abs(m[0] + m[1]); |
---|
| 2313 | satd += abs(m[0] - m[1]); |
---|
| 2314 | satd += abs(m[2] + m[3]); |
---|
| 2315 | satd += abs(m[2] - m[3]); |
---|
| 2316 | |
---|
| 2317 | return satd; |
---|
| 2318 | } |
---|
| 2319 | |
---|
[56] | 2320 | UInt TComRdCost::xCalcHADs4x4( Pel *piOrg, Pel *piCur, Int iStrideOrg, Int iStrideCur, Int iStep ) |
---|
[2] | 2321 | { |
---|
| 2322 | Int k, satd = 0, diff[16], m[16], d[16]; |
---|
| 2323 | |
---|
[56] | 2324 | assert( iStep == 1 ); |
---|
[2] | 2325 | for( k = 0; k < 16; k+=4 ) |
---|
| 2326 | { |
---|
[56] | 2327 | diff[k+0] = piOrg[0] - piCur[0]; |
---|
| 2328 | diff[k+1] = piOrg[1] - piCur[1]; |
---|
| 2329 | diff[k+2] = piOrg[2] - piCur[2]; |
---|
| 2330 | diff[k+3] = piOrg[3] - piCur[3]; |
---|
| 2331 | |
---|
[2] | 2332 | piCur += iStrideCur; |
---|
| 2333 | piOrg += iStrideOrg; |
---|
| 2334 | } |
---|
| 2335 | |
---|
| 2336 | /*===== hadamard transform =====*/ |
---|
| 2337 | m[ 0] = diff[ 0] + diff[12]; |
---|
| 2338 | m[ 1] = diff[ 1] + diff[13]; |
---|
| 2339 | m[ 2] = diff[ 2] + diff[14]; |
---|
| 2340 | m[ 3] = diff[ 3] + diff[15]; |
---|
| 2341 | m[ 4] = diff[ 4] + diff[ 8]; |
---|
| 2342 | m[ 5] = diff[ 5] + diff[ 9]; |
---|
| 2343 | m[ 6] = diff[ 6] + diff[10]; |
---|
| 2344 | m[ 7] = diff[ 7] + diff[11]; |
---|
| 2345 | m[ 8] = diff[ 4] - diff[ 8]; |
---|
| 2346 | m[ 9] = diff[ 5] - diff[ 9]; |
---|
| 2347 | m[10] = diff[ 6] - diff[10]; |
---|
| 2348 | m[11] = diff[ 7] - diff[11]; |
---|
| 2349 | m[12] = diff[ 0] - diff[12]; |
---|
| 2350 | m[13] = diff[ 1] - diff[13]; |
---|
| 2351 | m[14] = diff[ 2] - diff[14]; |
---|
| 2352 | m[15] = diff[ 3] - diff[15]; |
---|
| 2353 | |
---|
| 2354 | d[ 0] = m[ 0] + m[ 4]; |
---|
| 2355 | d[ 1] = m[ 1] + m[ 5]; |
---|
| 2356 | d[ 2] = m[ 2] + m[ 6]; |
---|
| 2357 | d[ 3] = m[ 3] + m[ 7]; |
---|
| 2358 | d[ 4] = m[ 8] + m[12]; |
---|
| 2359 | d[ 5] = m[ 9] + m[13]; |
---|
| 2360 | d[ 6] = m[10] + m[14]; |
---|
| 2361 | d[ 7] = m[11] + m[15]; |
---|
| 2362 | d[ 8] = m[ 0] - m[ 4]; |
---|
| 2363 | d[ 9] = m[ 1] - m[ 5]; |
---|
| 2364 | d[10] = m[ 2] - m[ 6]; |
---|
| 2365 | d[11] = m[ 3] - m[ 7]; |
---|
| 2366 | d[12] = m[12] - m[ 8]; |
---|
| 2367 | d[13] = m[13] - m[ 9]; |
---|
| 2368 | d[14] = m[14] - m[10]; |
---|
| 2369 | d[15] = m[15] - m[11]; |
---|
| 2370 | |
---|
| 2371 | m[ 0] = d[ 0] + d[ 3]; |
---|
| 2372 | m[ 1] = d[ 1] + d[ 2]; |
---|
| 2373 | m[ 2] = d[ 1] - d[ 2]; |
---|
| 2374 | m[ 3] = d[ 0] - d[ 3]; |
---|
| 2375 | m[ 4] = d[ 4] + d[ 7]; |
---|
| 2376 | m[ 5] = d[ 5] + d[ 6]; |
---|
| 2377 | m[ 6] = d[ 5] - d[ 6]; |
---|
| 2378 | m[ 7] = d[ 4] - d[ 7]; |
---|
| 2379 | m[ 8] = d[ 8] + d[11]; |
---|
| 2380 | m[ 9] = d[ 9] + d[10]; |
---|
| 2381 | m[10] = d[ 9] - d[10]; |
---|
| 2382 | m[11] = d[ 8] - d[11]; |
---|
| 2383 | m[12] = d[12] + d[15]; |
---|
| 2384 | m[13] = d[13] + d[14]; |
---|
| 2385 | m[14] = d[13] - d[14]; |
---|
| 2386 | m[15] = d[12] - d[15]; |
---|
| 2387 | |
---|
| 2388 | d[ 0] = m[ 0] + m[ 1]; |
---|
| 2389 | d[ 1] = m[ 0] - m[ 1]; |
---|
| 2390 | d[ 2] = m[ 2] + m[ 3]; |
---|
| 2391 | d[ 3] = m[ 3] - m[ 2]; |
---|
| 2392 | d[ 4] = m[ 4] + m[ 5]; |
---|
| 2393 | d[ 5] = m[ 4] - m[ 5]; |
---|
| 2394 | d[ 6] = m[ 6] + m[ 7]; |
---|
| 2395 | d[ 7] = m[ 7] - m[ 6]; |
---|
| 2396 | d[ 8] = m[ 8] + m[ 9]; |
---|
| 2397 | d[ 9] = m[ 8] - m[ 9]; |
---|
| 2398 | d[10] = m[10] + m[11]; |
---|
| 2399 | d[11] = m[11] - m[10]; |
---|
| 2400 | d[12] = m[12] + m[13]; |
---|
| 2401 | d[13] = m[12] - m[13]; |
---|
| 2402 | d[14] = m[14] + m[15]; |
---|
| 2403 | d[15] = m[15] - m[14]; |
---|
| 2404 | |
---|
| 2405 | for (k=0; k<16; ++k) |
---|
| 2406 | { |
---|
| 2407 | satd += abs(d[k]); |
---|
| 2408 | } |
---|
| 2409 | satd = ((satd+1)>>1); |
---|
| 2410 | |
---|
| 2411 | return satd; |
---|
| 2412 | } |
---|
| 2413 | |
---|
[56] | 2414 | UInt TComRdCost::xCalcHADs8x8( Pel *piOrg, Pel *piCur, Int iStrideOrg, Int iStrideCur, Int iStep ) |
---|
[2] | 2415 | { |
---|
| 2416 | Int k, i, j, jj, sad=0; |
---|
| 2417 | Int diff[64], m1[8][8], m2[8][8], m3[8][8]; |
---|
[56] | 2418 | assert( iStep == 1 ); |
---|
| 2419 | for( k = 0; k < 64; k += 8 ) |
---|
[2] | 2420 | { |
---|
[56] | 2421 | diff[k+0] = piOrg[0] - piCur[0]; |
---|
| 2422 | diff[k+1] = piOrg[1] - piCur[1]; |
---|
| 2423 | diff[k+2] = piOrg[2] - piCur[2]; |
---|
| 2424 | diff[k+3] = piOrg[3] - piCur[3]; |
---|
| 2425 | diff[k+4] = piOrg[4] - piCur[4]; |
---|
| 2426 | diff[k+5] = piOrg[5] - piCur[5]; |
---|
| 2427 | diff[k+6] = piOrg[6] - piCur[6]; |
---|
| 2428 | diff[k+7] = piOrg[7] - piCur[7]; |
---|
| 2429 | |
---|
[2] | 2430 | piCur += iStrideCur; |
---|
| 2431 | piOrg += iStrideOrg; |
---|
| 2432 | } |
---|
[56] | 2433 | |
---|
[2] | 2434 | //horizontal |
---|
| 2435 | for (j=0; j < 8; j++) |
---|
| 2436 | { |
---|
| 2437 | jj = j << 3; |
---|
| 2438 | m2[j][0] = diff[jj ] + diff[jj+4]; |
---|
| 2439 | m2[j][1] = diff[jj+1] + diff[jj+5]; |
---|
| 2440 | m2[j][2] = diff[jj+2] + diff[jj+6]; |
---|
| 2441 | m2[j][3] = diff[jj+3] + diff[jj+7]; |
---|
| 2442 | m2[j][4] = diff[jj ] - diff[jj+4]; |
---|
| 2443 | m2[j][5] = diff[jj+1] - diff[jj+5]; |
---|
| 2444 | m2[j][6] = diff[jj+2] - diff[jj+6]; |
---|
| 2445 | m2[j][7] = diff[jj+3] - diff[jj+7]; |
---|
| 2446 | |
---|
| 2447 | m1[j][0] = m2[j][0] + m2[j][2]; |
---|
| 2448 | m1[j][1] = m2[j][1] + m2[j][3]; |
---|
| 2449 | m1[j][2] = m2[j][0] - m2[j][2]; |
---|
| 2450 | m1[j][3] = m2[j][1] - m2[j][3]; |
---|
| 2451 | m1[j][4] = m2[j][4] + m2[j][6]; |
---|
| 2452 | m1[j][5] = m2[j][5] + m2[j][7]; |
---|
| 2453 | m1[j][6] = m2[j][4] - m2[j][6]; |
---|
| 2454 | m1[j][7] = m2[j][5] - m2[j][7]; |
---|
| 2455 | |
---|
| 2456 | m2[j][0] = m1[j][0] + m1[j][1]; |
---|
| 2457 | m2[j][1] = m1[j][0] - m1[j][1]; |
---|
| 2458 | m2[j][2] = m1[j][2] + m1[j][3]; |
---|
| 2459 | m2[j][3] = m1[j][2] - m1[j][3]; |
---|
| 2460 | m2[j][4] = m1[j][4] + m1[j][5]; |
---|
| 2461 | m2[j][5] = m1[j][4] - m1[j][5]; |
---|
| 2462 | m2[j][6] = m1[j][6] + m1[j][7]; |
---|
| 2463 | m2[j][7] = m1[j][6] - m1[j][7]; |
---|
| 2464 | } |
---|
| 2465 | |
---|
| 2466 | //vertical |
---|
| 2467 | for (i=0; i < 8; i++) |
---|
| 2468 | { |
---|
| 2469 | m3[0][i] = m2[0][i] + m2[4][i]; |
---|
| 2470 | m3[1][i] = m2[1][i] + m2[5][i]; |
---|
| 2471 | m3[2][i] = m2[2][i] + m2[6][i]; |
---|
| 2472 | m3[3][i] = m2[3][i] + m2[7][i]; |
---|
| 2473 | m3[4][i] = m2[0][i] - m2[4][i]; |
---|
| 2474 | m3[5][i] = m2[1][i] - m2[5][i]; |
---|
| 2475 | m3[6][i] = m2[2][i] - m2[6][i]; |
---|
| 2476 | m3[7][i] = m2[3][i] - m2[7][i]; |
---|
| 2477 | |
---|
| 2478 | m1[0][i] = m3[0][i] + m3[2][i]; |
---|
| 2479 | m1[1][i] = m3[1][i] + m3[3][i]; |
---|
| 2480 | m1[2][i] = m3[0][i] - m3[2][i]; |
---|
| 2481 | m1[3][i] = m3[1][i] - m3[3][i]; |
---|
| 2482 | m1[4][i] = m3[4][i] + m3[6][i]; |
---|
| 2483 | m1[5][i] = m3[5][i] + m3[7][i]; |
---|
| 2484 | m1[6][i] = m3[4][i] - m3[6][i]; |
---|
| 2485 | m1[7][i] = m3[5][i] - m3[7][i]; |
---|
| 2486 | |
---|
| 2487 | m2[0][i] = m1[0][i] + m1[1][i]; |
---|
| 2488 | m2[1][i] = m1[0][i] - m1[1][i]; |
---|
| 2489 | m2[2][i] = m1[2][i] + m1[3][i]; |
---|
| 2490 | m2[3][i] = m1[2][i] - m1[3][i]; |
---|
| 2491 | m2[4][i] = m1[4][i] + m1[5][i]; |
---|
| 2492 | m2[5][i] = m1[4][i] - m1[5][i]; |
---|
| 2493 | m2[6][i] = m1[6][i] + m1[7][i]; |
---|
| 2494 | m2[7][i] = m1[6][i] - m1[7][i]; |
---|
| 2495 | } |
---|
| 2496 | |
---|
[56] | 2497 | for (i = 0; i < 8; i++) |
---|
| 2498 | { |
---|
| 2499 | for (j = 0; j < 8; j++) |
---|
| 2500 | { |
---|
| 2501 | sad += abs(m2[i][j]); |
---|
| 2502 | } |
---|
| 2503 | } |
---|
| 2504 | |
---|
[2] | 2505 | sad=((sad+2)>>2); |
---|
| 2506 | |
---|
| 2507 | return sad; |
---|
| 2508 | } |
---|
| 2509 | |
---|
[56] | 2510 | #if NS_HAD |
---|
| 2511 | UInt TComRdCost::xCalcHADs16x4( Pel *piOrg, Pel *piCur, Int iStrideOrg, Int iStrideCur, Int iStep ) |
---|
[2] | 2512 | { |
---|
[56] | 2513 | Int k, i, j, jj, sad=0; |
---|
| 2514 | Int diff[64], m1[4][16], m2[4][16]; |
---|
| 2515 | assert( iStep == 1 ); |
---|
| 2516 | for( k = 0; k < 64; k += 16 ) |
---|
[2] | 2517 | { |
---|
[56] | 2518 | diff[k+0] = piOrg[0] - piCur[0]; |
---|
| 2519 | diff[k+1] = piOrg[1] - piCur[1]; |
---|
| 2520 | diff[k+2] = piOrg[2] - piCur[2]; |
---|
| 2521 | diff[k+3] = piOrg[3] - piCur[3]; |
---|
| 2522 | diff[k+4] = piOrg[4] - piCur[4]; |
---|
| 2523 | diff[k+5] = piOrg[5] - piCur[5]; |
---|
| 2524 | diff[k+6] = piOrg[6] - piCur[6]; |
---|
| 2525 | diff[k+7] = piOrg[7] - piCur[7]; |
---|
| 2526 | |
---|
| 2527 | diff[k+8] = piOrg[8] - piCur[8] ; |
---|
| 2528 | diff[k+9] = piOrg[9] - piCur[9] ; |
---|
| 2529 | diff[k+10] = piOrg[10] - piCur[10]; |
---|
| 2530 | diff[k+11] = piOrg[11] - piCur[11]; |
---|
| 2531 | diff[k+12] = piOrg[12] - piCur[12]; |
---|
| 2532 | diff[k+13] = piOrg[13] - piCur[13]; |
---|
| 2533 | diff[k+14] = piOrg[14] - piCur[14]; |
---|
| 2534 | diff[k+15] = piOrg[15] - piCur[15]; |
---|
| 2535 | |
---|
| 2536 | piCur += iStrideCur; |
---|
| 2537 | piOrg += iStrideOrg; |
---|
[2] | 2538 | } |
---|
| 2539 | |
---|
[56] | 2540 | //horizontal |
---|
| 2541 | for (j=0; j < 4; j++) |
---|
[2] | 2542 | { |
---|
[56] | 2543 | jj = j << 4; |
---|
| 2544 | |
---|
| 2545 | m2[j][0] = diff[jj ] + diff[jj+8]; |
---|
| 2546 | m2[j][1] = diff[jj+1] + diff[jj+9]; |
---|
| 2547 | m2[j][2] = diff[jj+2] + diff[jj+10]; |
---|
| 2548 | m2[j][3] = diff[jj+3] + diff[jj+11]; |
---|
| 2549 | m2[j][4] = diff[jj+4] + diff[jj+12]; |
---|
| 2550 | m2[j][5] = diff[jj+5] + diff[jj+13]; |
---|
| 2551 | m2[j][6] = diff[jj+6] + diff[jj+14]; |
---|
| 2552 | m2[j][7] = diff[jj+7] + diff[jj+15]; |
---|
| 2553 | m2[j][8] = diff[jj ] - diff[jj+8]; |
---|
| 2554 | m2[j][9] = diff[jj+1] - diff[jj+9]; |
---|
| 2555 | m2[j][10] = diff[jj+2] - diff[jj+10]; |
---|
| 2556 | m2[j][11] = diff[jj+3] - diff[jj+11]; |
---|
| 2557 | m2[j][12] = diff[jj+4] - diff[jj+12]; |
---|
| 2558 | m2[j][13] = diff[jj+5] - diff[jj+13]; |
---|
| 2559 | m2[j][14] = diff[jj+6] - diff[jj+14]; |
---|
| 2560 | m2[j][15] = diff[jj+7] - diff[jj+15]; |
---|
| 2561 | |
---|
| 2562 | m1[j][0] = m2[j][0] + m2[j][4]; |
---|
| 2563 | m1[j][1] = m2[j][1] + m2[j][5]; |
---|
| 2564 | m1[j][2] = m2[j][2] + m2[j][6]; |
---|
| 2565 | m1[j][3] = m2[j][3] + m2[j][7]; |
---|
| 2566 | m1[j][4] = m2[j][0] - m2[j][4]; |
---|
| 2567 | m1[j][5] = m2[j][1] - m2[j][5]; |
---|
| 2568 | m1[j][6] = m2[j][2] - m2[j][6]; |
---|
| 2569 | m1[j][7] = m2[j][3] - m2[j][7]; |
---|
| 2570 | m1[j][8] = m2[j][8] + m2[j][12]; |
---|
| 2571 | m1[j][9] = m2[j][9] + m2[j][13]; |
---|
| 2572 | m1[j][10] = m2[j][10] + m2[j][14]; |
---|
| 2573 | m1[j][11] = m2[j][11] + m2[j][15]; |
---|
| 2574 | m1[j][12] = m2[j][8] - m2[j][12]; |
---|
| 2575 | m1[j][13] = m2[j][9] - m2[j][13]; |
---|
| 2576 | m1[j][14] = m2[j][10] - m2[j][14]; |
---|
| 2577 | m1[j][15] = m2[j][11] - m2[j][15]; |
---|
| 2578 | |
---|
| 2579 | m2[j][0] = m1[j][0] + m1[j][2]; |
---|
| 2580 | m2[j][1] = m1[j][1] + m1[j][3]; |
---|
| 2581 | m2[j][2] = m1[j][0] - m1[j][2]; |
---|
| 2582 | m2[j][3] = m1[j][1] - m1[j][3]; |
---|
| 2583 | m2[j][4] = m1[j][4] + m1[j][6]; |
---|
| 2584 | m2[j][5] = m1[j][5] + m1[j][7]; |
---|
| 2585 | m2[j][6] = m1[j][4] - m1[j][6]; |
---|
| 2586 | m2[j][7] = m1[j][5] - m1[j][7]; |
---|
| 2587 | m2[j][8] = m1[j][8] + m1[j][10]; |
---|
| 2588 | m2[j][9] = m1[j][9] + m1[j][11]; |
---|
| 2589 | m2[j][10] = m1[j][8] - m1[j][10]; |
---|
| 2590 | m2[j][11] = m1[j][9] - m1[j][11]; |
---|
| 2591 | m2[j][12] = m1[j][12] + m1[j][14]; |
---|
| 2592 | m2[j][13] = m1[j][13] + m1[j][15]; |
---|
| 2593 | m2[j][14] = m1[j][12] - m1[j][14]; |
---|
| 2594 | m2[j][15] = m1[j][13] - m1[j][15]; |
---|
| 2595 | |
---|
| 2596 | m1[j][0] = m2[j][0] + m2[j][1]; |
---|
| 2597 | m1[j][1] = m2[j][0] - m2[j][1]; |
---|
| 2598 | m1[j][2] = m2[j][2] + m2[j][3]; |
---|
| 2599 | m1[j][3] = m2[j][2] - m2[j][3]; |
---|
| 2600 | m1[j][4] = m2[j][4] + m2[j][5]; |
---|
| 2601 | m1[j][5] = m2[j][4] - m2[j][5]; |
---|
| 2602 | m1[j][6] = m2[j][6] + m2[j][7]; |
---|
| 2603 | m1[j][7] = m2[j][6] - m2[j][7]; |
---|
| 2604 | m1[j][8] = m2[j][8] + m2[j][9]; |
---|
| 2605 | m1[j][9] = m2[j][8] - m2[j][9]; |
---|
| 2606 | m1[j][10] = m2[j][10] + m2[j][11]; |
---|
| 2607 | m1[j][11] = m2[j][10] - m2[j][11]; |
---|
| 2608 | m1[j][12] = m2[j][12] + m2[j][13]; |
---|
| 2609 | m1[j][13] = m2[j][12] - m2[j][13]; |
---|
| 2610 | m1[j][14] = m2[j][14] + m2[j][15]; |
---|
| 2611 | m1[j][15] = m2[j][14] - m2[j][15]; |
---|
[2] | 2612 | } |
---|
[56] | 2613 | |
---|
| 2614 | //vertical |
---|
| 2615 | for (i=0; i < 16; i++) |
---|
| 2616 | { |
---|
| 2617 | m2[0][i] = m1[0][i] + m1[2][i]; |
---|
| 2618 | m2[1][i] = m1[1][i] + m1[3][i]; |
---|
| 2619 | m2[2][i] = m1[0][i] - m1[2][i]; |
---|
| 2620 | m2[3][i] = m1[1][i] - m1[3][i]; |
---|
| 2621 | |
---|
| 2622 | m1[0][i] = m2[0][i] + m2[1][i]; |
---|
| 2623 | m1[1][i] = m2[0][i] - m2[1][i]; |
---|
| 2624 | m1[2][i] = m2[2][i] + m2[3][i]; |
---|
| 2625 | m1[3][i] = m2[2][i] - m2[3][i]; |
---|
[2] | 2626 | } |
---|
| 2627 | |
---|
[56] | 2628 | for (i = 0; i < 4; i++) |
---|
[2] | 2629 | { |
---|
[56] | 2630 | for (j = 0; j < 16; j++) |
---|
[2] | 2631 | { |
---|
[56] | 2632 | sad += abs(m1[i][j]); |
---|
[2] | 2633 | } |
---|
| 2634 | } |
---|
| 2635 | |
---|
[56] | 2636 | sad=((sad+2)>>2); |
---|
[2] | 2637 | |
---|
[56] | 2638 | return sad; |
---|
[2] | 2639 | } |
---|
| 2640 | |
---|
[56] | 2641 | UInt TComRdCost::xCalcHADs4x16( Pel *piOrg, Pel *piCur, Int iStrideOrg, Int iStrideCur, Int iStep ) |
---|
[2] | 2642 | { |
---|
[56] | 2643 | Int k, i, j, jj, sad=0; |
---|
| 2644 | Int diff[64], m1[16][4], m2[16][4], m3[16][4]; |
---|
| 2645 | assert( iStep == 1 ); |
---|
| 2646 | for( k = 0; k < 64; k += 4 ) |
---|
[2] | 2647 | { |
---|
[56] | 2648 | diff[k+0] = piOrg[0] - piCur[0]; |
---|
| 2649 | diff[k+1] = piOrg[1] - piCur[1]; |
---|
| 2650 | diff[k+2] = piOrg[2] - piCur[2]; |
---|
| 2651 | diff[k+3] = piOrg[3] - piCur[3]; |
---|
| 2652 | |
---|
[2] | 2653 | piCur += iStrideCur; |
---|
| 2654 | piOrg += iStrideOrg; |
---|
| 2655 | } |
---|
| 2656 | |
---|
| 2657 | //horizontal |
---|
[56] | 2658 | for (j=0; j < 16; j++) |
---|
[2] | 2659 | { |
---|
[56] | 2660 | jj = j << 2; |
---|
| 2661 | m2[j][0] = diff[jj ] + diff[jj+2]; |
---|
| 2662 | m2[j][1] = diff[jj+1] + diff[jj+3]; |
---|
| 2663 | m2[j][2] = diff[jj ] - diff[jj+2]; |
---|
| 2664 | m2[j][3] = diff[jj+1] - diff[jj+3]; |
---|
| 2665 | |
---|
| 2666 | m1[j][0] = m2[j][0] + m2[j][1]; |
---|
| 2667 | m1[j][1] = m2[j][0] - m2[j][1]; |
---|
| 2668 | m1[j][2] = m2[j][2] + m2[j][3]; |
---|
| 2669 | m1[j][3] = m2[j][2] - m2[j][3]; |
---|
[2] | 2670 | } |
---|
[56] | 2671 | |
---|
[2] | 2672 | //vertical |
---|
[56] | 2673 | for (i=0; i < 4; i++) |
---|
[2] | 2674 | { |
---|
[56] | 2675 | m2[0][i] = m1[0][i] + m1[8][i]; |
---|
| 2676 | m2[1][i] = m1[1][i] + m1[9][i]; |
---|
| 2677 | m2[2][i] = m1[2][i] + m1[10][i]; |
---|
| 2678 | m2[3][i] = m1[3][i] + m1[11][i]; |
---|
| 2679 | m2[4][i] = m1[4][i] + m1[12][i]; |
---|
| 2680 | m2[5][i] = m1[5][i] + m1[13][i]; |
---|
| 2681 | m2[6][i] = m1[6][i] + m1[14][i]; |
---|
| 2682 | m2[7][i] = m1[7][i] + m1[15][i]; |
---|
| 2683 | m2[8][i] = m1[0][i] - m1[8][i]; |
---|
| 2684 | m2[9][i] = m1[1][i] - m1[9][i]; |
---|
| 2685 | m2[10][i] = m1[2][i] - m1[10][i]; |
---|
| 2686 | m2[11][i] = m1[3][i] - m1[11][i]; |
---|
| 2687 | m2[12][i] = m1[4][i] - m1[12][i]; |
---|
| 2688 | m2[13][i] = m1[5][i] - m1[13][i]; |
---|
| 2689 | m2[14][i] = m1[6][i] - m1[14][i]; |
---|
| 2690 | m2[15][i] = m1[7][i] - m1[15][i]; |
---|
| 2691 | |
---|
| 2692 | m3[0][i] = m2[0][i] + m2[4][i]; |
---|
| 2693 | m3[1][i] = m2[1][i] + m2[5][i]; |
---|
| 2694 | m3[2][i] = m2[2][i] + m2[6][i]; |
---|
| 2695 | m3[3][i] = m2[3][i] + m2[7][i]; |
---|
| 2696 | m3[4][i] = m2[0][i] - m2[4][i]; |
---|
| 2697 | m3[5][i] = m2[1][i] - m2[5][i]; |
---|
| 2698 | m3[6][i] = m2[2][i] - m2[6][i]; |
---|
| 2699 | m3[7][i] = m2[3][i] - m2[7][i]; |
---|
| 2700 | m3[8][i] = m2[8][i] + m2[12][i]; |
---|
| 2701 | m3[9][i] = m2[9][i] + m2[13][i]; |
---|
| 2702 | m3[10][i] = m2[10][i] + m2[14][i]; |
---|
| 2703 | m3[11][i] = m2[11][i] + m2[15][i]; |
---|
| 2704 | m3[12][i] = m2[8][i] - m2[12][i]; |
---|
| 2705 | m3[13][i] = m2[9][i] - m2[13][i]; |
---|
| 2706 | m3[14][i] = m2[10][i] - m2[14][i]; |
---|
| 2707 | m3[15][i] = m2[11][i] - m2[15][i]; |
---|
| 2708 | |
---|
| 2709 | m1[0][i] = m3[0][i] + m3[2][i]; |
---|
| 2710 | m1[1][i] = m3[1][i] + m3[3][i]; |
---|
| 2711 | m1[2][i] = m3[0][i] - m3[2][i]; |
---|
| 2712 | m1[3][i] = m3[1][i] - m3[3][i]; |
---|
| 2713 | m1[4][i] = m3[4][i] + m3[6][i]; |
---|
| 2714 | m1[5][i] = m3[5][i] + m3[7][i]; |
---|
| 2715 | m1[6][i] = m3[4][i] - m3[6][i]; |
---|
| 2716 | m1[7][i] = m3[5][i] - m3[7][i]; |
---|
| 2717 | m1[8][i] = m3[8][i] + m3[10][i]; |
---|
| 2718 | m1[9][i] = m3[9][i] + m3[11][i]; |
---|
| 2719 | m1[10][i] = m3[8][i] - m3[10][i]; |
---|
| 2720 | m1[11][i] = m3[9][i] - m3[11][i]; |
---|
| 2721 | m1[12][i] = m3[12][i] + m3[14][i]; |
---|
| 2722 | m1[13][i] = m3[13][i] + m3[15][i]; |
---|
| 2723 | m1[14][i] = m3[12][i] - m3[14][i]; |
---|
| 2724 | m1[15][i] = m3[13][i] - m3[15][i]; |
---|
| 2725 | |
---|
| 2726 | m2[0][i] = m1[0][i] + m1[1][i]; |
---|
| 2727 | m2[1][i] = m1[0][i] - m1[1][i]; |
---|
| 2728 | m2[2][i] = m1[2][i] + m1[3][i]; |
---|
| 2729 | m2[3][i] = m1[2][i] - m1[3][i]; |
---|
| 2730 | m2[4][i] = m1[4][i] + m1[5][i]; |
---|
| 2731 | m2[5][i] = m1[4][i] - m1[5][i]; |
---|
| 2732 | m2[6][i] = m1[6][i] + m1[7][i]; |
---|
| 2733 | m2[7][i] = m1[6][i] - m1[7][i]; |
---|
| 2734 | m2[8][i] = m1[8][i] + m1[9][i]; |
---|
| 2735 | m2[9][i] = m1[8][i] - m1[9][i]; |
---|
| 2736 | m2[10][i] = m1[10][i] + m1[11][i]; |
---|
| 2737 | m2[11][i] = m1[10][i] - m1[11][i]; |
---|
| 2738 | m2[12][i] = m1[12][i] + m1[13][i]; |
---|
| 2739 | m2[13][i] = m1[12][i] - m1[13][i]; |
---|
| 2740 | m2[14][i] = m1[14][i] + m1[15][i]; |
---|
| 2741 | m2[15][i] = m1[14][i] - m1[15][i]; |
---|
[2] | 2742 | } |
---|
[56] | 2743 | |
---|
| 2744 | for (i = 0; i < 16; i++) |
---|
[2] | 2745 | { |
---|
[56] | 2746 | for (j = 0; j < 4; j++) |
---|
| 2747 | { |
---|
| 2748 | sad += abs(m2[i][j]); |
---|
| 2749 | } |
---|
[2] | 2750 | } |
---|
[56] | 2751 | |
---|
[2] | 2752 | sad=((sad+2)>>2); |
---|
[56] | 2753 | |
---|
[2] | 2754 | return sad; |
---|
| 2755 | } |
---|
[56] | 2756 | #endif |
---|
[2] | 2757 | |
---|
| 2758 | UInt TComRdCost::xGetHADs4( DistParam* pcDtParam ) |
---|
| 2759 | { |
---|
[56] | 2760 | if ( pcDtParam->bApplyWeight ) |
---|
[2] | 2761 | { |
---|
| 2762 | return xGetHADs4w( pcDtParam ); |
---|
| 2763 | } |
---|
| 2764 | Pel* piOrg = pcDtParam->pOrg; |
---|
| 2765 | Pel* piCur = pcDtParam->pCur; |
---|
| 2766 | Int iRows = pcDtParam->iRows; |
---|
| 2767 | Int iStrideCur = pcDtParam->iStrideCur; |
---|
| 2768 | Int iStrideOrg = pcDtParam->iStrideOrg; |
---|
| 2769 | Int iStep = pcDtParam->iStep; |
---|
| 2770 | Int y; |
---|
| 2771 | Int iOffsetOrg = iStrideOrg<<2; |
---|
| 2772 | Int iOffsetCur = iStrideCur<<2; |
---|
| 2773 | |
---|
| 2774 | UInt uiSum = 0; |
---|
| 2775 | |
---|
| 2776 | for ( y=0; y<iRows; y+= 4 ) |
---|
| 2777 | { |
---|
| 2778 | uiSum += xCalcHADs4x4( piOrg, piCur, iStrideOrg, iStrideCur, iStep ); |
---|
| 2779 | piOrg += iOffsetOrg; |
---|
| 2780 | piCur += iOffsetCur; |
---|
| 2781 | } |
---|
| 2782 | |
---|
| 2783 | return ( uiSum >> g_uiBitIncrement ); |
---|
| 2784 | } |
---|
| 2785 | |
---|
| 2786 | UInt TComRdCost::xGetHADs8( DistParam* pcDtParam ) |
---|
| 2787 | { |
---|
[56] | 2788 | if ( pcDtParam->bApplyWeight ) |
---|
[2] | 2789 | { |
---|
| 2790 | return xGetHADs8w( pcDtParam ); |
---|
| 2791 | } |
---|
| 2792 | Pel* piOrg = pcDtParam->pOrg; |
---|
| 2793 | Pel* piCur = pcDtParam->pCur; |
---|
| 2794 | Int iRows = pcDtParam->iRows; |
---|
| 2795 | Int iStrideCur = pcDtParam->iStrideCur; |
---|
| 2796 | Int iStrideOrg = pcDtParam->iStrideOrg; |
---|
| 2797 | Int iStep = pcDtParam->iStep; |
---|
| 2798 | Int y; |
---|
| 2799 | |
---|
| 2800 | UInt uiSum = 0; |
---|
| 2801 | |
---|
| 2802 | if ( iRows == 4 ) |
---|
| 2803 | { |
---|
| 2804 | uiSum += xCalcHADs4x4( piOrg+0, piCur , iStrideOrg, iStrideCur, iStep ); |
---|
| 2805 | uiSum += xCalcHADs4x4( piOrg+4, piCur+4*iStep, iStrideOrg, iStrideCur, iStep ); |
---|
| 2806 | } |
---|
| 2807 | else |
---|
| 2808 | { |
---|
| 2809 | Int iOffsetOrg = iStrideOrg<<3; |
---|
| 2810 | Int iOffsetCur = iStrideCur<<3; |
---|
| 2811 | for ( y=0; y<iRows; y+= 8 ) |
---|
| 2812 | { |
---|
| 2813 | uiSum += xCalcHADs8x8( piOrg, piCur, iStrideOrg, iStrideCur, iStep ); |
---|
| 2814 | piOrg += iOffsetOrg; |
---|
| 2815 | piCur += iOffsetCur; |
---|
| 2816 | } |
---|
| 2817 | } |
---|
| 2818 | |
---|
| 2819 | return ( uiSum >> g_uiBitIncrement ); |
---|
| 2820 | } |
---|
| 2821 | |
---|
| 2822 | UInt TComRdCost::xGetHADs( DistParam* pcDtParam ) |
---|
| 2823 | { |
---|
[56] | 2824 | if ( pcDtParam->bApplyWeight ) |
---|
[2] | 2825 | { |
---|
| 2826 | return xGetHADsw( pcDtParam ); |
---|
| 2827 | } |
---|
| 2828 | Pel* piOrg = pcDtParam->pOrg; |
---|
| 2829 | Pel* piCur = pcDtParam->pCur; |
---|
| 2830 | Int iRows = pcDtParam->iRows; |
---|
| 2831 | Int iCols = pcDtParam->iCols; |
---|
| 2832 | Int iStrideCur = pcDtParam->iStrideCur; |
---|
| 2833 | Int iStrideOrg = pcDtParam->iStrideOrg; |
---|
| 2834 | Int iStep = pcDtParam->iStep; |
---|
| 2835 | |
---|
| 2836 | Int x, y; |
---|
| 2837 | |
---|
| 2838 | UInt uiSum = 0; |
---|
| 2839 | |
---|
[56] | 2840 | #if NS_HAD |
---|
| 2841 | if( ( ( iRows % 8 == 0) && (iCols % 8 == 0) && ( iRows == iCols ) ) || ( ( iRows % 8 == 0 ) && (iCols % 8 == 0) && !pcDtParam->bUseNSHAD ) ) |
---|
| 2842 | #else |
---|
[2] | 2843 | if( ( iRows % 8 == 0) && (iCols % 8 == 0) ) |
---|
[56] | 2844 | #endif |
---|
[2] | 2845 | { |
---|
| 2846 | Int iOffsetOrg = iStrideOrg<<3; |
---|
| 2847 | Int iOffsetCur = iStrideCur<<3; |
---|
| 2848 | for ( y=0; y<iRows; y+= 8 ) |
---|
| 2849 | { |
---|
| 2850 | for ( x=0; x<iCols; x+= 8 ) |
---|
| 2851 | { |
---|
| 2852 | uiSum += xCalcHADs8x8( &piOrg[x], &piCur[x*iStep], iStrideOrg, iStrideCur, iStep ); |
---|
| 2853 | } |
---|
| 2854 | piOrg += iOffsetOrg; |
---|
| 2855 | piCur += iOffsetCur; |
---|
| 2856 | } |
---|
| 2857 | } |
---|
[56] | 2858 | #if NS_HAD |
---|
| 2859 | else if ( ( iCols > 8 ) && ( iCols > iRows ) && pcDtParam->bUseNSHAD ) |
---|
| 2860 | { |
---|
| 2861 | Int iOffsetOrg = iStrideOrg<<2; |
---|
| 2862 | Int iOffsetCur = iStrideCur<<2; |
---|
| 2863 | for ( y=0; y<iRows; y+= 4 ) |
---|
| 2864 | { |
---|
| 2865 | for ( x=0; x<iCols; x+= 16 ) |
---|
| 2866 | { |
---|
| 2867 | uiSum += xCalcHADs16x4( &piOrg[x], &piCur[x*iStep], iStrideOrg, iStrideCur, iStep ); |
---|
| 2868 | } |
---|
| 2869 | piOrg += iOffsetOrg; |
---|
| 2870 | piCur += iOffsetCur; |
---|
| 2871 | } |
---|
| 2872 | } |
---|
| 2873 | else if ( ( iRows > 8 ) && ( iCols < iRows ) && pcDtParam->bUseNSHAD ) |
---|
| 2874 | { |
---|
| 2875 | Int iOffsetOrg = iStrideOrg<<4; |
---|
| 2876 | Int iOffsetCur = iStrideCur<<4; |
---|
| 2877 | for ( y=0; y<iRows; y+= 16 ) |
---|
| 2878 | { |
---|
| 2879 | for ( x=0; x<iCols; x+= 4 ) |
---|
| 2880 | { |
---|
| 2881 | uiSum += xCalcHADs4x16( &piOrg[x], &piCur[x*iStep], iStrideOrg, iStrideCur, iStep ); |
---|
| 2882 | } |
---|
| 2883 | piOrg += iOffsetOrg; |
---|
| 2884 | piCur += iOffsetCur; |
---|
| 2885 | } |
---|
| 2886 | } |
---|
| 2887 | #endif |
---|
[2] | 2888 | else if( ( iRows % 4 == 0) && (iCols % 4 == 0) ) |
---|
| 2889 | { |
---|
| 2890 | Int iOffsetOrg = iStrideOrg<<2; |
---|
| 2891 | Int iOffsetCur = iStrideCur<<2; |
---|
| 2892 | |
---|
| 2893 | for ( y=0; y<iRows; y+= 4 ) |
---|
| 2894 | { |
---|
| 2895 | for ( x=0; x<iCols; x+= 4 ) |
---|
| 2896 | { |
---|
| 2897 | uiSum += xCalcHADs4x4( &piOrg[x], &piCur[x*iStep], iStrideOrg, iStrideCur, iStep ); |
---|
| 2898 | } |
---|
| 2899 | piOrg += iOffsetOrg; |
---|
| 2900 | piCur += iOffsetCur; |
---|
| 2901 | } |
---|
| 2902 | } |
---|
| 2903 | else if( ( iRows % 2 == 0) && (iCols % 2 == 0) ) |
---|
| 2904 | { |
---|
| 2905 | Int iOffsetOrg = iStrideOrg<<1; |
---|
| 2906 | Int iOffsetCur = iStrideCur<<1; |
---|
| 2907 | for ( y=0; y<iRows; y+=2 ) |
---|
| 2908 | { |
---|
| 2909 | for ( x=0; x<iCols; x+=2 ) |
---|
| 2910 | { |
---|
| 2911 | uiSum += xCalcHADs2x2( &piOrg[x], &piCur[x*iStep], iStrideOrg, iStrideCur, iStep ); |
---|
| 2912 | } |
---|
| 2913 | piOrg += iOffsetOrg; |
---|
| 2914 | piCur += iOffsetCur; |
---|
| 2915 | } |
---|
| 2916 | } |
---|
| 2917 | else |
---|
| 2918 | { |
---|
[56] | 2919 | assert(false); |
---|
[2] | 2920 | } |
---|
| 2921 | |
---|
| 2922 | return ( uiSum >> g_uiBitIncrement ); |
---|
| 2923 | } |
---|
| 2924 | |
---|
[5] | 2925 | #if HHI_VSO |
---|
[2] | 2926 | Void TComRdCost::setLambdaVSO( Double dLambdaVSO ) |
---|
| 2927 | { |
---|
| 2928 | m_dLambdaVSO = dLambdaVSO; |
---|
| 2929 | m_dSqrtLambdaVSO = sqrt(m_dLambdaVSO); |
---|
| 2930 | m_uiLambdaMotionSADVSO = (UInt)floor(65536.0 * m_dSqrtLambdaVSO); |
---|
| 2931 | m_uiLambdaMotionSSEVSO = (UInt)floor(65536.0 * m_dLambdaVSO ); |
---|
| 2932 | } |
---|
| 2933 | |
---|
| 2934 | Dist TComRdCost::xGetDistVSOMode4( Int iStartPosX, Int iStartPosY, Pel* piCur, Int iCurStride, Pel* piOrg, Int iOrgStride, UInt uiBlkWidth, UInt uiBlkHeight, Bool bSAD ) |
---|
| 2935 | { |
---|
| 2936 | AOT(bSAD); |
---|
[100] | 2937 | #ifdef LGE_VSO_EARLY_SKIP_A0093 |
---|
| 2938 | RMDist iDist = m_pcRenModel->getDist( iStartPosX, iStartPosY, (Int) uiBlkWidth, (Int) uiBlkHeight, iCurStride, piCur, piOrg, iOrgStride); |
---|
| 2939 | #else |
---|
[2] | 2940 | RMDist iDist = m_pcRenModel->getDist( iStartPosX, iStartPosY, (Int) uiBlkWidth, (Int) uiBlkHeight, iCurStride, piCur ); |
---|
[100] | 2941 | #endif |
---|
[2] | 2942 | |
---|
| 2943 | RMDist iDistMin = (RMDist) RDO_DIST_MIN; |
---|
[5] | 2944 | #if HHI_VSO_DIST_INT |
---|
[2] | 2945 | iDistMin = m_bAllowNegDist ? RDO_DIST_MIN : 0; |
---|
| 2946 | #endif |
---|
| 2947 | |
---|
| 2948 | iDist = Min( iDist, (RMDist) RDO_DIST_MAX); |
---|
| 2949 | iDist = Max( iDist, iDistMin); |
---|
| 2950 | return (Dist) iDist; |
---|
| 2951 | } |
---|
| 2952 | |
---|
| 2953 | |
---|
| 2954 | Dist TComRdCost::getDistVS( TComDataCU* pcCU, UInt uiAbsPartIndex, Pel* piCur, Int iCurStride, Pel* piOrg, Int iOrgStride, UInt uiBlkWidth, UInt uiBlkHeight, Bool bSAD, UInt uiPlane ) |
---|
| 2955 | { |
---|
| 2956 | assert( m_bUseVSO ); |
---|
| 2957 | assert( this->m_fpDistortFuncVSO != 0 ); |
---|
| 2958 | |
---|
| 2959 | Int iPosX; |
---|
| 2960 | Int iPosY; |
---|
| 2961 | |
---|
| 2962 | pcCU->getPosInPic( uiAbsPartIndex, iPosX, iPosY ); |
---|
| 2963 | return (this->*m_fpDistortFuncVSO) ( iPosX, iPosY, piCur, iCurStride, piOrg, iOrgStride, uiBlkWidth, uiBlkHeight, bSAD ); |
---|
| 2964 | }; |
---|
| 2965 | |
---|
| 2966 | |
---|
| 2967 | Void TComRdCost::setVSOMode( UInt uiIn ) |
---|
| 2968 | { |
---|
| 2969 | m_uiVSOMode = uiIn; |
---|
| 2970 | switch (m_uiVSOMode ) |
---|
| 2971 | { |
---|
| 2972 | case 4: |
---|
| 2973 | m_fpDistortFuncVSO = &TComRdCost::xGetDistVSOMode4; |
---|
| 2974 | break; |
---|
| 2975 | default: |
---|
| 2976 | assert(0); |
---|
| 2977 | break; |
---|
| 2978 | } |
---|
| 2979 | } |
---|
| 2980 | |
---|
| 2981 | |
---|
| 2982 | Double TComRdCost::calcRdCostVSO( UInt uiBits, Dist uiDistortion, Bool bFlag, DFunc eDFunc ) |
---|
| 2983 | { |
---|
[56] | 2984 | assert( m_bUseLambdaScaleVSO ); |
---|
[2] | 2985 | |
---|
| 2986 | Double dRdCost = 0.0; |
---|
[56] | 2987 | Double dLambda = 0.0; |
---|
[2] | 2988 | |
---|
| 2989 | switch ( eDFunc ) |
---|
| 2990 | { |
---|
| 2991 | case DF_SSE: |
---|
| 2992 | assert(0); |
---|
| 2993 | break; |
---|
| 2994 | case DF_SAD: |
---|
| 2995 | dLambda = (Double)m_uiLambdaMotionSADVSO; |
---|
| 2996 | break; |
---|
| 2997 | case DF_DEFAULT: |
---|
| 2998 | dLambda = m_dLambdaVSO; |
---|
| 2999 | break; |
---|
| 3000 | case DF_SSE_FRAME: |
---|
| 3001 | dLambda = m_dFrameLambdaVSO; |
---|
| 3002 | break; |
---|
| 3003 | default: |
---|
| 3004 | assert (0); |
---|
| 3005 | break; |
---|
| 3006 | } |
---|
| 3007 | |
---|
| 3008 | if (bFlag) |
---|
| 3009 | { |
---|
| 3010 | // Intra8x8, Intra4x4 Block only... |
---|
| 3011 | dRdCost = (((Double)uiDistortion) + ((Double)uiBits * dLambda)); |
---|
| 3012 | } |
---|
| 3013 | else |
---|
| 3014 | { |
---|
| 3015 | if (eDFunc == DF_SAD) |
---|
| 3016 | { |
---|
| 3017 | dRdCost = ((Double)uiDistortion + (Double)((Int)(uiBits * dLambda+.5)>>16)); |
---|
| 3018 | dRdCost = (Double)(Dist)floor(dRdCost); |
---|
| 3019 | } |
---|
| 3020 | else |
---|
| 3021 | { |
---|
| 3022 | dRdCost = ((Double)uiDistortion + (Double)((Int)(uiBits * dLambda+.5))); |
---|
| 3023 | dRdCost = (Double)(Dist)floor(dRdCost); |
---|
| 3024 | } |
---|
| 3025 | } |
---|
| 3026 | |
---|
| 3027 | return dRdCost; |
---|
| 3028 | } |
---|
| 3029 | |
---|
| 3030 | Void TComRdCost::setRenModelData( TComDataCU* pcCU, UInt uiAbsPartIndex, Pel* piData, Int iStride, Int iBlkWidth, Int iBlkHeight ) |
---|
| 3031 | { |
---|
| 3032 | UInt iBlkX = g_auiRasterToPelX[g_auiZscanToRaster[uiAbsPartIndex]]; |
---|
| 3033 | UInt iBlkY = g_auiRasterToPelY[g_auiZscanToRaster[uiAbsPartIndex]]; |
---|
| 3034 | |
---|
| 3035 | Int iStartPosX = iBlkX + pcCU->getCUPelX(); |
---|
| 3036 | Int iStartPosY = iBlkY + pcCU->getCUPelY(); |
---|
| 3037 | |
---|
| 3038 | m_pcRenModel->setData( iStartPosX, iStartPosY, iBlkWidth, iBlkHeight, iStride, piData ); |
---|
| 3039 | } |
---|
| 3040 | |
---|
[5] | 3041 | #if HHI_VSO_DIST_INT |
---|
[2] | 3042 | Void TComRdCost::setAllowNegDist( Bool bAllowNegDist ) |
---|
| 3043 | { |
---|
| 3044 | m_bAllowNegDist = bAllowNegDist; |
---|
| 3045 | } |
---|
| 3046 | #endif |
---|
| 3047 | |
---|
[5] | 3048 | #endif |
---|
[56] | 3049 | //! \} |
---|