[2] | 1 | |
---|
| 2 | |
---|
| 3 | /** \file TComRdCostWeightPrediction.cpp |
---|
| 4 | \brief RD cost computation class with Weighted-Prediction |
---|
| 5 | */ |
---|
| 6 | |
---|
| 7 | #include <math.h> |
---|
| 8 | #include <assert.h> |
---|
| 9 | #include "TComRdCost.h" |
---|
| 10 | #include "TComRdCostWeightPrediction.h" |
---|
| 11 | |
---|
| 12 | #ifdef WEIGHT_PRED |
---|
| 13 | |
---|
| 14 | Int TComRdCostWeightPrediction::m_w0 = 0, |
---|
| 15 | TComRdCostWeightPrediction::m_w1 = 0; |
---|
| 16 | Int TComRdCostWeightPrediction::m_shift = 0; |
---|
| 17 | Int TComRdCostWeightPrediction::m_offset = 0; |
---|
| 18 | Int TComRdCostWeightPrediction::m_round = 0; |
---|
| 19 | Bool TComRdCostWeightPrediction::m_xSetDone = false; |
---|
| 20 | |
---|
| 21 | // ==================================================================================================================== |
---|
| 22 | // Distortion functions |
---|
| 23 | // ==================================================================================================================== |
---|
| 24 | |
---|
| 25 | TComRdCostWeightPrediction::TComRdCostWeightPrediction() |
---|
| 26 | { |
---|
| 27 | } |
---|
| 28 | |
---|
| 29 | TComRdCostWeightPrediction::~TComRdCostWeightPrediction() |
---|
| 30 | { |
---|
| 31 | } |
---|
| 32 | |
---|
| 33 | // -------------------------------------------------------------------------------------------------------------------- |
---|
| 34 | // SAD |
---|
| 35 | // -------------------------------------------------------------------------------------------------------------------- |
---|
| 36 | |
---|
| 37 | UInt TComRdCostWeightPrediction::xGetSADw( DistParam* pcDtParam ) |
---|
| 38 | { |
---|
| 39 | Pel* piOrg = pcDtParam->pOrg; |
---|
| 40 | Pel* piCur = pcDtParam->pCur; |
---|
| 41 | Pel pred; |
---|
| 42 | Int iRows = pcDtParam->iRows; |
---|
| 43 | Int iCols = pcDtParam->iCols; |
---|
| 44 | Int iSubShift = pcDtParam->iSubShift; |
---|
| 45 | Int iSubStep = ( 1 << iSubShift ); |
---|
| 46 | Int iStrideCur = pcDtParam->iStrideCur*iSubStep; |
---|
| 47 | Int iStrideOrg = pcDtParam->iStrideOrg*iSubStep; |
---|
| 48 | |
---|
| 49 | UInt uiComp = pcDtParam->uiComp; |
---|
| 50 | assert(uiComp<3); |
---|
| 51 | wpScalingParam *wpCur = &(pcDtParam->wpCur[uiComp]); |
---|
| 52 | Int w0 = wpCur->w, |
---|
| 53 | offset = wpCur->offset, |
---|
| 54 | shift = wpCur->shift, |
---|
| 55 | round = wpCur->round; |
---|
| 56 | |
---|
| 57 | UInt uiSum = 0; |
---|
| 58 | #if SB_INTERVIEW_SKIP |
---|
| 59 | if( pcDtParam->pUsed ) |
---|
| 60 | { |
---|
| 61 | Pel* piUsed = pcDtParam->pUsed; |
---|
| 62 | Int iStrideUsed = pcDtParam->iStrideUsed; |
---|
| 63 | for( ; iRows != 0; iRows-=iSubStep ) |
---|
| 64 | { |
---|
| 65 | for (Int n = 0; n < iCols; n++ ) |
---|
| 66 | { |
---|
| 67 | if( piUsed[n]) |
---|
| 68 | { |
---|
| 69 | pred = ( (w0*piCur[n] + round) >> shift ) + offset ; |
---|
| 70 | //uiSum += abs( piOrg[n] - piCur[n] ); |
---|
| 71 | uiSum += abs( piOrg[n] - pred ); |
---|
| 72 | } |
---|
| 73 | } |
---|
| 74 | piOrg += iStrideOrg; |
---|
| 75 | piCur += iStrideCur; |
---|
| 76 | piUsed += iStrideUsed; |
---|
| 77 | } |
---|
| 78 | #else |
---|
| 79 | for( ; iRows != 0; iRows-=iSubStep ) |
---|
| 80 | { |
---|
| 81 | for (Int n = 0; n < iCols; n++ ) |
---|
| 82 | { |
---|
| 83 | pred = ( (w0*piCur[n] + round) >> shift ) + offset ; |
---|
| 84 | |
---|
| 85 | //uiSum += abs( piOrg[n] - piCur[n] ); |
---|
| 86 | uiSum += abs( piOrg[n] - pred ); |
---|
| 87 | } |
---|
| 88 | piOrg += iStrideOrg; |
---|
| 89 | piCur += iStrideCur; |
---|
| 90 | } |
---|
| 91 | #endif |
---|
| 92 | #if SB_INTERVIEW_SKIP |
---|
| 93 | } |
---|
| 94 | #endif |
---|
| 95 | pcDtParam->uiComp = 255; // reset for DEBUG (assert test) |
---|
| 96 | |
---|
| 97 | uiSum <<= iSubShift; |
---|
| 98 | return ( uiSum >> g_uiBitIncrement ); |
---|
| 99 | } |
---|
| 100 | |
---|
| 101 | UInt TComRdCostWeightPrediction::xGetSAD4w( DistParam* pcDtParam ) |
---|
| 102 | { |
---|
| 103 | Pel* piOrg = pcDtParam->pOrg; |
---|
| 104 | Pel* piCur = pcDtParam->pCur; |
---|
| 105 | Int iRows = pcDtParam->iRows; |
---|
| 106 | Int iSubShift = pcDtParam->iSubShift; |
---|
| 107 | Int iSubStep = ( 1 << iSubShift ); |
---|
| 108 | Int iStrideCur = pcDtParam->iStrideCur*iSubStep; |
---|
| 109 | Int iStrideOrg = pcDtParam->iStrideOrg*iSubStep; |
---|
| 110 | |
---|
| 111 | UInt uiSum = 0; |
---|
| 112 | |
---|
| 113 | printf("TComRdCostWeightPrediction::xGetSAD4w():\tnot implemented, use xGetSADw().\n"); fflush(stdout); exit(0); |
---|
| 114 | |
---|
| 115 | for( ; iRows != 0; iRows-=iSubStep ) |
---|
| 116 | { |
---|
| 117 | uiSum += abs( piOrg[0] - piCur[0] ); |
---|
| 118 | uiSum += abs( piOrg[1] - piCur[1] ); |
---|
| 119 | uiSum += abs( piOrg[2] - piCur[2] ); |
---|
| 120 | uiSum += abs( piOrg[3] - piCur[3] ); |
---|
| 121 | |
---|
| 122 | piOrg += iStrideOrg; |
---|
| 123 | piCur += iStrideCur; |
---|
| 124 | } |
---|
| 125 | |
---|
| 126 | uiSum <<= iSubShift; |
---|
| 127 | return ( uiSum >> g_uiBitIncrement ); |
---|
| 128 | } |
---|
| 129 | |
---|
| 130 | UInt TComRdCostWeightPrediction::xGetSAD8w( DistParam* pcDtParam ) |
---|
| 131 | { |
---|
| 132 | Pel* piOrg = pcDtParam->pOrg; |
---|
| 133 | Pel* piCur = pcDtParam->pCur; |
---|
| 134 | Int iRows = pcDtParam->iRows; |
---|
| 135 | Int iSubShift = pcDtParam->iSubShift; |
---|
| 136 | Int iSubStep = ( 1 << iSubShift ); |
---|
| 137 | Int iStrideCur = pcDtParam->iStrideCur*iSubStep; |
---|
| 138 | Int iStrideOrg = pcDtParam->iStrideOrg*iSubStep; |
---|
| 139 | |
---|
| 140 | UInt uiSum = 0; |
---|
| 141 | |
---|
| 142 | printf("TComRdCostWeightPrediction::xGetSAD8w():\tnot implemented, use xGetSADw().\n"); fflush(stdout); exit(0); |
---|
| 143 | |
---|
| 144 | for( ; iRows != 0; iRows-=iSubStep ) |
---|
| 145 | { |
---|
| 146 | uiSum += abs( piOrg[0] - piCur[0] ); |
---|
| 147 | uiSum += abs( piOrg[1] - piCur[1] ); |
---|
| 148 | uiSum += abs( piOrg[2] - piCur[2] ); |
---|
| 149 | uiSum += abs( piOrg[3] - piCur[3] ); |
---|
| 150 | uiSum += abs( piOrg[4] - piCur[4] ); |
---|
| 151 | uiSum += abs( piOrg[5] - piCur[5] ); |
---|
| 152 | uiSum += abs( piOrg[6] - piCur[6] ); |
---|
| 153 | uiSum += abs( piOrg[7] - piCur[7] ); |
---|
| 154 | |
---|
| 155 | piOrg += iStrideOrg; |
---|
| 156 | piCur += iStrideCur; |
---|
| 157 | } |
---|
| 158 | |
---|
| 159 | |
---|
| 160 | |
---|
| 161 | uiSum <<= iSubShift; |
---|
| 162 | return ( uiSum >> g_uiBitIncrement ); |
---|
| 163 | } |
---|
| 164 | |
---|
| 165 | UInt TComRdCostWeightPrediction::xGetSAD16w( DistParam* pcDtParam ) |
---|
| 166 | { |
---|
| 167 | Pel* piOrg = pcDtParam->pOrg; |
---|
| 168 | Pel* piCur = pcDtParam->pCur; |
---|
| 169 | Int iRows = pcDtParam->iRows; |
---|
| 170 | Int iSubShift = pcDtParam->iSubShift; |
---|
| 171 | Int iSubStep = ( 1 << iSubShift ); |
---|
| 172 | Int iStrideCur = pcDtParam->iStrideCur*iSubStep; |
---|
| 173 | Int iStrideOrg = pcDtParam->iStrideOrg*iSubStep; |
---|
| 174 | |
---|
| 175 | UInt uiSum = 0; |
---|
| 176 | |
---|
| 177 | printf("TComRdCostWeightPrediction::xGetSAD16w():\tnot implemented, use xGetSADw().\n"); fflush(stdout); exit(0); |
---|
| 178 | |
---|
| 179 | for( ; iRows != 0; iRows-=iSubStep ) |
---|
| 180 | { |
---|
| 181 | uiSum += abs( piOrg[0] - piCur[0] ); |
---|
| 182 | uiSum += abs( piOrg[1] - piCur[1] ); |
---|
| 183 | uiSum += abs( piOrg[2] - piCur[2] ); |
---|
| 184 | uiSum += abs( piOrg[3] - piCur[3] ); |
---|
| 185 | uiSum += abs( piOrg[4] - piCur[4] ); |
---|
| 186 | uiSum += abs( piOrg[5] - piCur[5] ); |
---|
| 187 | uiSum += abs( piOrg[6] - piCur[6] ); |
---|
| 188 | uiSum += abs( piOrg[7] - piCur[7] ); |
---|
| 189 | uiSum += abs( piOrg[8] - piCur[8] ); |
---|
| 190 | uiSum += abs( piOrg[9] - piCur[9] ); |
---|
| 191 | uiSum += abs( piOrg[10] - piCur[10] ); |
---|
| 192 | uiSum += abs( piOrg[11] - piCur[11] ); |
---|
| 193 | uiSum += abs( piOrg[12] - piCur[12] ); |
---|
| 194 | uiSum += abs( piOrg[13] - piCur[13] ); |
---|
| 195 | uiSum += abs( piOrg[14] - piCur[14] ); |
---|
| 196 | uiSum += abs( piOrg[15] - piCur[15] ); |
---|
| 197 | |
---|
| 198 | piOrg += iStrideOrg; |
---|
| 199 | piCur += iStrideCur; |
---|
| 200 | } |
---|
| 201 | |
---|
| 202 | |
---|
| 203 | |
---|
| 204 | uiSum <<= iSubShift; |
---|
| 205 | return ( uiSum >> g_uiBitIncrement ); |
---|
| 206 | } |
---|
| 207 | |
---|
| 208 | UInt TComRdCostWeightPrediction::xGetSAD16Nw( DistParam* pcDtParam ) |
---|
| 209 | { |
---|
| 210 | Pel* piOrg = pcDtParam->pOrg; |
---|
| 211 | Pel* piCur = pcDtParam->pCur; |
---|
| 212 | Int iRows = pcDtParam->iRows; |
---|
| 213 | Int iCols = pcDtParam->iCols; |
---|
| 214 | Int iSubShift = pcDtParam->iSubShift; |
---|
| 215 | Int iSubStep = ( 1 << iSubShift ); |
---|
| 216 | Int iStrideCur = pcDtParam->iStrideCur*iSubStep; |
---|
| 217 | Int iStrideOrg = pcDtParam->iStrideOrg*iSubStep; |
---|
| 218 | |
---|
| 219 | UInt uiSum = 0; |
---|
| 220 | |
---|
| 221 | printf("TComRdCostWeightPrediction::xGetSAD16Nw():\tnot implemented, use xGetSADw().\n"); fflush(stdout); exit(0); |
---|
| 222 | |
---|
| 223 | for( ; iRows != 0; iRows-=iSubStep ) |
---|
| 224 | { |
---|
| 225 | for (Int n = 0; n < iCols; n+=16 ) |
---|
| 226 | { |
---|
| 227 | uiSum += abs( piOrg[n+ 0] - piCur[n+ 0] ); |
---|
| 228 | uiSum += abs( piOrg[n+ 1] - piCur[n+ 1] ); |
---|
| 229 | uiSum += abs( piOrg[n+ 2] - piCur[n+ 2] ); |
---|
| 230 | uiSum += abs( piOrg[n+ 3] - piCur[n+ 3] ); |
---|
| 231 | uiSum += abs( piOrg[n+ 4] - piCur[n+ 4] ); |
---|
| 232 | uiSum += abs( piOrg[n+ 5] - piCur[n+ 5] ); |
---|
| 233 | uiSum += abs( piOrg[n+ 6] - piCur[n+ 6] ); |
---|
| 234 | uiSum += abs( piOrg[n+ 7] - piCur[n+ 7] ); |
---|
| 235 | uiSum += abs( piOrg[n+ 8] - piCur[n+ 8] ); |
---|
| 236 | uiSum += abs( piOrg[n+ 9] - piCur[n+ 9] ); |
---|
| 237 | uiSum += abs( piOrg[n+10] - piCur[n+10] ); |
---|
| 238 | uiSum += abs( piOrg[n+11] - piCur[n+11] ); |
---|
| 239 | uiSum += abs( piOrg[n+12] - piCur[n+12] ); |
---|
| 240 | uiSum += abs( piOrg[n+13] - piCur[n+13] ); |
---|
| 241 | uiSum += abs( piOrg[n+14] - piCur[n+14] ); |
---|
| 242 | uiSum += abs( piOrg[n+15] - piCur[n+15] ); |
---|
| 243 | } |
---|
| 244 | piOrg += iStrideOrg; |
---|
| 245 | piCur += iStrideCur; |
---|
| 246 | } |
---|
| 247 | |
---|
| 248 | uiSum <<= iSubShift; |
---|
| 249 | return ( uiSum >> g_uiBitIncrement ); |
---|
| 250 | } |
---|
| 251 | |
---|
| 252 | UInt TComRdCostWeightPrediction::xGetSAD32w( DistParam* pcDtParam ) |
---|
| 253 | { |
---|
| 254 | Pel* piOrg = pcDtParam->pOrg; |
---|
| 255 | Pel* piCur = pcDtParam->pCur; |
---|
| 256 | Int iRows = pcDtParam->iRows; |
---|
| 257 | Int iSubShift = pcDtParam->iSubShift; |
---|
| 258 | Int iSubStep = ( 1 << iSubShift ); |
---|
| 259 | Int iStrideCur = pcDtParam->iStrideCur*iSubStep; |
---|
| 260 | Int iStrideOrg = pcDtParam->iStrideOrg*iSubStep; |
---|
| 261 | |
---|
| 262 | UInt uiSum = 0; |
---|
| 263 | |
---|
| 264 | printf("TComRdCostWeightPrediction::xGetSAD32w():\tnot implemented, use xGetSADw().\n"); fflush(stdout); exit(0); |
---|
| 265 | |
---|
| 266 | for( ; iRows != 0; iRows-=iSubStep ) |
---|
| 267 | { |
---|
| 268 | uiSum += abs( piOrg[0] - piCur[0] ); |
---|
| 269 | uiSum += abs( piOrg[1] - piCur[1] ); |
---|
| 270 | uiSum += abs( piOrg[2] - piCur[2] ); |
---|
| 271 | uiSum += abs( piOrg[3] - piCur[3] ); |
---|
| 272 | uiSum += abs( piOrg[4] - piCur[4] ); |
---|
| 273 | uiSum += abs( piOrg[5] - piCur[5] ); |
---|
| 274 | uiSum += abs( piOrg[6] - piCur[6] ); |
---|
| 275 | uiSum += abs( piOrg[7] - piCur[7] ); |
---|
| 276 | uiSum += abs( piOrg[8] - piCur[8] ); |
---|
| 277 | uiSum += abs( piOrg[9] - piCur[9] ); |
---|
| 278 | uiSum += abs( piOrg[10] - piCur[10] ); |
---|
| 279 | uiSum += abs( piOrg[11] - piCur[11] ); |
---|
| 280 | uiSum += abs( piOrg[12] - piCur[12] ); |
---|
| 281 | uiSum += abs( piOrg[13] - piCur[13] ); |
---|
| 282 | uiSum += abs( piOrg[14] - piCur[14] ); |
---|
| 283 | uiSum += abs( piOrg[15] - piCur[15] ); |
---|
| 284 | uiSum += abs( piOrg[16] - piCur[16] ); |
---|
| 285 | uiSum += abs( piOrg[17] - piCur[17] ); |
---|
| 286 | uiSum += abs( piOrg[18] - piCur[18] ); |
---|
| 287 | uiSum += abs( piOrg[19] - piCur[19] ); |
---|
| 288 | uiSum += abs( piOrg[20] - piCur[20] ); |
---|
| 289 | uiSum += abs( piOrg[21] - piCur[21] ); |
---|
| 290 | uiSum += abs( piOrg[22] - piCur[22] ); |
---|
| 291 | uiSum += abs( piOrg[23] - piCur[23] ); |
---|
| 292 | uiSum += abs( piOrg[24] - piCur[24] ); |
---|
| 293 | uiSum += abs( piOrg[25] - piCur[25] ); |
---|
| 294 | uiSum += abs( piOrg[26] - piCur[26] ); |
---|
| 295 | uiSum += abs( piOrg[27] - piCur[27] ); |
---|
| 296 | uiSum += abs( piOrg[28] - piCur[28] ); |
---|
| 297 | uiSum += abs( piOrg[29] - piCur[29] ); |
---|
| 298 | uiSum += abs( piOrg[30] - piCur[30] ); |
---|
| 299 | uiSum += abs( piOrg[31] - piCur[31] ); |
---|
| 300 | |
---|
| 301 | piOrg += iStrideOrg; |
---|
| 302 | piCur += iStrideCur; |
---|
| 303 | } |
---|
| 304 | |
---|
| 305 | uiSum <<= iSubShift; |
---|
| 306 | return ( uiSum >> g_uiBitIncrement ); |
---|
| 307 | } |
---|
| 308 | |
---|
| 309 | UInt TComRdCostWeightPrediction::xGetSAD64w( DistParam* pcDtParam ) |
---|
| 310 | { |
---|
| 311 | Pel* piOrg = pcDtParam->pOrg; |
---|
| 312 | Pel* piCur = pcDtParam->pCur; |
---|
| 313 | Int iRows = pcDtParam->iRows; |
---|
| 314 | Int iSubShift = pcDtParam->iSubShift; |
---|
| 315 | Int iSubStep = ( 1 << iSubShift ); |
---|
| 316 | Int iStrideCur = pcDtParam->iStrideCur*iSubStep; |
---|
| 317 | Int iStrideOrg = pcDtParam->iStrideOrg*iSubStep; |
---|
| 318 | |
---|
| 319 | UInt uiSum = 0; |
---|
| 320 | |
---|
| 321 | printf("TComRdCostWeightPrediction::xGetSAD64w():\tnot implemented, use xGetSADw().\n"); fflush(stdout); exit(0); |
---|
| 322 | |
---|
| 323 | for( ; iRows != 0; iRows-=iSubStep ) |
---|
| 324 | { |
---|
| 325 | uiSum += abs( piOrg[0] - piCur[0] ); |
---|
| 326 | uiSum += abs( piOrg[1] - piCur[1] ); |
---|
| 327 | uiSum += abs( piOrg[2] - piCur[2] ); |
---|
| 328 | uiSum += abs( piOrg[3] - piCur[3] ); |
---|
| 329 | uiSum += abs( piOrg[4] - piCur[4] ); |
---|
| 330 | uiSum += abs( piOrg[5] - piCur[5] ); |
---|
| 331 | uiSum += abs( piOrg[6] - piCur[6] ); |
---|
| 332 | uiSum += abs( piOrg[7] - piCur[7] ); |
---|
| 333 | uiSum += abs( piOrg[8] - piCur[8] ); |
---|
| 334 | uiSum += abs( piOrg[9] - piCur[9] ); |
---|
| 335 | uiSum += abs( piOrg[10] - piCur[10] ); |
---|
| 336 | uiSum += abs( piOrg[11] - piCur[11] ); |
---|
| 337 | uiSum += abs( piOrg[12] - piCur[12] ); |
---|
| 338 | uiSum += abs( piOrg[13] - piCur[13] ); |
---|
| 339 | uiSum += abs( piOrg[14] - piCur[14] ); |
---|
| 340 | uiSum += abs( piOrg[15] - piCur[15] ); |
---|
| 341 | uiSum += abs( piOrg[16] - piCur[16] ); |
---|
| 342 | uiSum += abs( piOrg[17] - piCur[17] ); |
---|
| 343 | uiSum += abs( piOrg[18] - piCur[18] ); |
---|
| 344 | uiSum += abs( piOrg[19] - piCur[19] ); |
---|
| 345 | uiSum += abs( piOrg[20] - piCur[20] ); |
---|
| 346 | uiSum += abs( piOrg[21] - piCur[21] ); |
---|
| 347 | uiSum += abs( piOrg[22] - piCur[22] ); |
---|
| 348 | uiSum += abs( piOrg[23] - piCur[23] ); |
---|
| 349 | uiSum += abs( piOrg[24] - piCur[24] ); |
---|
| 350 | uiSum += abs( piOrg[25] - piCur[25] ); |
---|
| 351 | uiSum += abs( piOrg[26] - piCur[26] ); |
---|
| 352 | uiSum += abs( piOrg[27] - piCur[27] ); |
---|
| 353 | uiSum += abs( piOrg[28] - piCur[28] ); |
---|
| 354 | uiSum += abs( piOrg[29] - piCur[29] ); |
---|
| 355 | uiSum += abs( piOrg[30] - piCur[30] ); |
---|
| 356 | uiSum += abs( piOrg[31] - piCur[31] ); |
---|
| 357 | uiSum += abs( piOrg[32] - piCur[32] ); |
---|
| 358 | uiSum += abs( piOrg[33] - piCur[33] ); |
---|
| 359 | uiSum += abs( piOrg[34] - piCur[34] ); |
---|
| 360 | uiSum += abs( piOrg[35] - piCur[35] ); |
---|
| 361 | uiSum += abs( piOrg[36] - piCur[36] ); |
---|
| 362 | uiSum += abs( piOrg[37] - piCur[37] ); |
---|
| 363 | uiSum += abs( piOrg[38] - piCur[38] ); |
---|
| 364 | uiSum += abs( piOrg[39] - piCur[39] ); |
---|
| 365 | uiSum += abs( piOrg[40] - piCur[40] ); |
---|
| 366 | uiSum += abs( piOrg[41] - piCur[41] ); |
---|
| 367 | uiSum += abs( piOrg[42] - piCur[42] ); |
---|
| 368 | uiSum += abs( piOrg[43] - piCur[43] ); |
---|
| 369 | uiSum += abs( piOrg[44] - piCur[44] ); |
---|
| 370 | uiSum += abs( piOrg[45] - piCur[45] ); |
---|
| 371 | uiSum += abs( piOrg[46] - piCur[46] ); |
---|
| 372 | uiSum += abs( piOrg[47] - piCur[47] ); |
---|
| 373 | uiSum += abs( piOrg[48] - piCur[48] ); |
---|
| 374 | uiSum += abs( piOrg[49] - piCur[49] ); |
---|
| 375 | uiSum += abs( piOrg[50] - piCur[50] ); |
---|
| 376 | uiSum += abs( piOrg[51] - piCur[51] ); |
---|
| 377 | uiSum += abs( piOrg[52] - piCur[52] ); |
---|
| 378 | uiSum += abs( piOrg[53] - piCur[53] ); |
---|
| 379 | uiSum += abs( piOrg[54] - piCur[54] ); |
---|
| 380 | uiSum += abs( piOrg[55] - piCur[55] ); |
---|
| 381 | uiSum += abs( piOrg[56] - piCur[56] ); |
---|
| 382 | uiSum += abs( piOrg[57] - piCur[57] ); |
---|
| 383 | uiSum += abs( piOrg[58] - piCur[58] ); |
---|
| 384 | uiSum += abs( piOrg[59] - piCur[59] ); |
---|
| 385 | uiSum += abs( piOrg[60] - piCur[60] ); |
---|
| 386 | uiSum += abs( piOrg[61] - piCur[61] ); |
---|
| 387 | uiSum += abs( piOrg[62] - piCur[62] ); |
---|
| 388 | uiSum += abs( piOrg[63] - piCur[63] ); |
---|
| 389 | |
---|
| 390 | piOrg += iStrideOrg; |
---|
| 391 | piCur += iStrideCur; |
---|
| 392 | } |
---|
| 393 | |
---|
| 394 | uiSum <<= iSubShift; |
---|
| 395 | return ( uiSum >> g_uiBitIncrement ); |
---|
| 396 | } |
---|
| 397 | |
---|
| 398 | // -------------------------------------------------------------------------------------------------------------------- |
---|
| 399 | // SAD with step (used in fractional search) |
---|
| 400 | // -------------------------------------------------------------------------------------------------------------------- |
---|
| 401 | |
---|
| 402 | UInt TComRdCostWeightPrediction::xGetSADsw( DistParam* pcDtParam ) |
---|
| 403 | { |
---|
| 404 | Pel* piOrg = pcDtParam->pOrg; |
---|
| 405 | Pel* piCur = pcDtParam->pCur; |
---|
| 406 | Int iRows = pcDtParam->iRows; |
---|
| 407 | Int iCols = pcDtParam->iCols; |
---|
| 408 | Int iStrideCur = pcDtParam->iStrideCur; |
---|
| 409 | Int iStrideOrg = pcDtParam->iStrideOrg; |
---|
| 410 | Int iStep = pcDtParam->iStep; |
---|
| 411 | |
---|
| 412 | UInt uiSum = 0; |
---|
| 413 | |
---|
| 414 | printf("TComRdCostWeightPrediction::xGetSADsw():\tnot implemented, use xGetSADw().\n"); fflush(stdout); exit(0); |
---|
| 415 | |
---|
| 416 | for( ; iRows != 0; iRows-- ) |
---|
| 417 | { |
---|
| 418 | for (Int n = 0; n < iCols; n++ ) |
---|
| 419 | { |
---|
| 420 | uiSum += abs( piOrg[n] - piCur[n*iStep] ); |
---|
| 421 | } |
---|
| 422 | piOrg += iStrideOrg; |
---|
| 423 | piCur += iStrideCur; |
---|
| 424 | } |
---|
| 425 | |
---|
| 426 | return ( uiSum >> g_uiBitIncrement ); |
---|
| 427 | } |
---|
| 428 | |
---|
| 429 | UInt TComRdCostWeightPrediction::xGetSADs4w( DistParam* pcDtParam ) |
---|
| 430 | { |
---|
| 431 | Pel* piOrg = pcDtParam->pOrg; |
---|
| 432 | Pel* piCur = pcDtParam->pCur; |
---|
| 433 | Int iRows = pcDtParam->iRows; |
---|
| 434 | Int iStrideCur = pcDtParam->iStrideCur; |
---|
| 435 | Int iStrideOrg = pcDtParam->iStrideOrg; |
---|
| 436 | Int iStep = pcDtParam->iStep; |
---|
| 437 | Int iStep2 = iStep<<1; |
---|
| 438 | Int iStep3 = iStep2 + iStep; |
---|
| 439 | |
---|
| 440 | UInt uiSum = 0; |
---|
| 441 | |
---|
| 442 | printf("TComRdCostWeightPrediction::xGetSADs4w():\tnot implemented, use xGetSADw().\n"); fflush(stdout); exit(0); |
---|
| 443 | |
---|
| 444 | for( ; iRows != 0; iRows-- ) |
---|
| 445 | { |
---|
| 446 | uiSum += abs( piOrg[0] - piCur[ 0] ); |
---|
| 447 | uiSum += abs( piOrg[1] - piCur[iStep ] ); |
---|
| 448 | uiSum += abs( piOrg[2] - piCur[iStep2] ); |
---|
| 449 | uiSum += abs( piOrg[3] - piCur[iStep3] ); |
---|
| 450 | |
---|
| 451 | piOrg += iStrideOrg; |
---|
| 452 | piCur += iStrideCur; |
---|
| 453 | } |
---|
| 454 | |
---|
| 455 | return ( uiSum >> g_uiBitIncrement ); |
---|
| 456 | } |
---|
| 457 | |
---|
| 458 | UInt TComRdCostWeightPrediction::xGetSADs8w( DistParam* pcDtParam ) |
---|
| 459 | { |
---|
| 460 | Pel* piOrg = pcDtParam->pOrg; |
---|
| 461 | Pel* piCur = pcDtParam->pCur; |
---|
| 462 | Int iRows = pcDtParam->iRows; |
---|
| 463 | Int iStrideCur = pcDtParam->iStrideCur; |
---|
| 464 | Int iStrideOrg = pcDtParam->iStrideOrg; |
---|
| 465 | Int iStep = pcDtParam->iStep; |
---|
| 466 | Int iStep2 = iStep<<1; |
---|
| 467 | Int iStep3 = iStep2 + iStep; |
---|
| 468 | Int iStep4 = iStep3 + iStep; |
---|
| 469 | Int iStep5 = iStep4 + iStep; |
---|
| 470 | Int iStep6 = iStep5 + iStep; |
---|
| 471 | Int iStep7 = iStep6 + iStep; |
---|
| 472 | |
---|
| 473 | UInt uiSum = 0; |
---|
| 474 | |
---|
| 475 | printf("TComRdCostWeightPrediction::xGetSADs8w():\tnot implemented, use xGetSADw().\n"); fflush(stdout); exit(0); |
---|
| 476 | |
---|
| 477 | for( ; iRows != 0; iRows-- ) |
---|
| 478 | { |
---|
| 479 | uiSum += abs( piOrg[0] - piCur[ 0] ); |
---|
| 480 | uiSum += abs( piOrg[1] - piCur[iStep ] ); |
---|
| 481 | uiSum += abs( piOrg[2] - piCur[iStep2] ); |
---|
| 482 | uiSum += abs( piOrg[3] - piCur[iStep3] ); |
---|
| 483 | uiSum += abs( piOrg[4] - piCur[iStep4] ); |
---|
| 484 | uiSum += abs( piOrg[5] - piCur[iStep5] ); |
---|
| 485 | uiSum += abs( piOrg[6] - piCur[iStep6] ); |
---|
| 486 | uiSum += abs( piOrg[7] - piCur[iStep7] ); |
---|
| 487 | |
---|
| 488 | piOrg += iStrideOrg; |
---|
| 489 | piCur += iStrideCur; |
---|
| 490 | } |
---|
| 491 | |
---|
| 492 | return ( uiSum >> g_uiBitIncrement ); |
---|
| 493 | } |
---|
| 494 | |
---|
| 495 | UInt TComRdCostWeightPrediction::xGetSADs16w( DistParam* pcDtParam ) |
---|
| 496 | { |
---|
| 497 | Pel* piOrg = pcDtParam->pOrg; |
---|
| 498 | Pel* piCur = pcDtParam->pCur; |
---|
| 499 | Int iRows = pcDtParam->iRows; |
---|
| 500 | Int iStrideCur = pcDtParam->iStrideCur; |
---|
| 501 | Int iStrideOrg = pcDtParam->iStrideOrg; |
---|
| 502 | Int iStep = pcDtParam->iStep; |
---|
| 503 | Int iStep2 = iStep<<1; |
---|
| 504 | Int iStep3 = iStep2 + iStep; |
---|
| 505 | Int iStep4 = iStep3 + iStep; |
---|
| 506 | Int iStep5 = iStep4 + iStep; |
---|
| 507 | Int iStep6 = iStep5 + iStep; |
---|
| 508 | Int iStep7 = iStep6 + iStep; |
---|
| 509 | Int iStep8 = iStep7 + iStep; |
---|
| 510 | Int iStep9 = iStep8 + iStep; |
---|
| 511 | Int iStep10 = iStep9 + iStep; |
---|
| 512 | Int iStep11 = iStep10 + iStep; |
---|
| 513 | Int iStep12 = iStep11 + iStep; |
---|
| 514 | Int iStep13 = iStep12 + iStep; |
---|
| 515 | Int iStep14 = iStep13 + iStep; |
---|
| 516 | Int iStep15 = iStep14 + iStep; |
---|
| 517 | |
---|
| 518 | UInt uiSum = 0; |
---|
| 519 | |
---|
| 520 | printf("TComRdCostWeightPrediction::xGetSADs16w():\tnot implemented, use xGetSADw().\n"); fflush(stdout); exit(0); |
---|
| 521 | |
---|
| 522 | for( ; iRows != 0; iRows-- ) |
---|
| 523 | { |
---|
| 524 | uiSum += abs( piOrg[ 0] - piCur[ 0] ); |
---|
| 525 | uiSum += abs( piOrg[ 1] - piCur[iStep ] ); |
---|
| 526 | uiSum += abs( piOrg[ 2] - piCur[iStep2 ] ); |
---|
| 527 | uiSum += abs( piOrg[ 3] - piCur[iStep3 ] ); |
---|
| 528 | uiSum += abs( piOrg[ 4] - piCur[iStep4 ] ); |
---|
| 529 | uiSum += abs( piOrg[ 5] - piCur[iStep5 ] ); |
---|
| 530 | uiSum += abs( piOrg[ 6] - piCur[iStep6 ] ); |
---|
| 531 | uiSum += abs( piOrg[ 7] - piCur[iStep7 ] ); |
---|
| 532 | uiSum += abs( piOrg[ 8] - piCur[iStep8 ] ); |
---|
| 533 | uiSum += abs( piOrg[ 9] - piCur[iStep9 ] ); |
---|
| 534 | uiSum += abs( piOrg[10] - piCur[iStep10] ); |
---|
| 535 | uiSum += abs( piOrg[11] - piCur[iStep11] ); |
---|
| 536 | uiSum += abs( piOrg[12] - piCur[iStep12] ); |
---|
| 537 | uiSum += abs( piOrg[13] - piCur[iStep13] ); |
---|
| 538 | uiSum += abs( piOrg[14] - piCur[iStep14] ); |
---|
| 539 | uiSum += abs( piOrg[15] - piCur[iStep15] ); |
---|
| 540 | |
---|
| 541 | piOrg += iStrideOrg; |
---|
| 542 | piCur += iStrideCur; |
---|
| 543 | } |
---|
| 544 | |
---|
| 545 | return ( uiSum >> g_uiBitIncrement ); |
---|
| 546 | } |
---|
| 547 | |
---|
| 548 | UInt TComRdCostWeightPrediction::xGetSADs16Nw( DistParam* pcDtParam ) |
---|
| 549 | { |
---|
| 550 | Pel* piOrg = pcDtParam->pOrg; |
---|
| 551 | Pel* piCur = pcDtParam->pCur; |
---|
| 552 | Int iRows = pcDtParam->iRows; |
---|
| 553 | Int iCols = pcDtParam->iCols; |
---|
| 554 | Int iStrideCur = pcDtParam->iStrideCur; |
---|
| 555 | Int iStrideOrg = pcDtParam->iStrideOrg; |
---|
| 556 | Int iStep = pcDtParam->iStep; |
---|
| 557 | |
---|
| 558 | UInt uiSum = 0; |
---|
| 559 | |
---|
| 560 | printf("TComRdCostWeightPrediction::xGetSADs16Nw():\tnot implemented, use xGetSADw().\n"); fflush(stdout); exit(0); |
---|
| 561 | |
---|
| 562 | for( ; iRows != 0; iRows-- ) |
---|
| 563 | { |
---|
| 564 | for (Int n = 0; n < iCols; n+=16 ) |
---|
| 565 | { |
---|
| 566 | uiSum += abs( piOrg[n +0] - piCur[iStep*(n +0)] ); |
---|
| 567 | uiSum += abs( piOrg[n +1] - piCur[iStep*(n +1)] ); |
---|
| 568 | uiSum += abs( piOrg[n +2] - piCur[iStep*(n +2)] ); |
---|
| 569 | uiSum += abs( piOrg[n +3] - piCur[iStep*(n +3)] ); |
---|
| 570 | uiSum += abs( piOrg[n +4] - piCur[iStep*(n +4)] ); |
---|
| 571 | uiSum += abs( piOrg[n +5] - piCur[iStep*(n +5)] ); |
---|
| 572 | uiSum += abs( piOrg[n +6] - piCur[iStep*(n +6)] ); |
---|
| 573 | uiSum += abs( piOrg[n +7] - piCur[iStep*(n +7)] ); |
---|
| 574 | uiSum += abs( piOrg[n +8] - piCur[iStep*(n +8)] ); |
---|
| 575 | uiSum += abs( piOrg[n +9] - piCur[iStep*(n +9)] ); |
---|
| 576 | uiSum += abs( piOrg[n+10] - piCur[iStep*(n+10)] ); |
---|
| 577 | uiSum += abs( piOrg[n+11] - piCur[iStep*(n+11)] ); |
---|
| 578 | uiSum += abs( piOrg[n+12] - piCur[iStep*(n+12)] ); |
---|
| 579 | uiSum += abs( piOrg[n+13] - piCur[iStep*(n+13)] ); |
---|
| 580 | uiSum += abs( piOrg[n+14] - piCur[iStep*(n+14)] ); |
---|
| 581 | uiSum += abs( piOrg[n+15] - piCur[iStep*(n+15)] ); |
---|
| 582 | } |
---|
| 583 | piOrg += iStrideOrg; |
---|
| 584 | piCur += iStrideCur; |
---|
| 585 | } |
---|
| 586 | |
---|
| 587 | return ( uiSum >> g_uiBitIncrement ); |
---|
| 588 | } |
---|
| 589 | |
---|
| 590 | UInt TComRdCostWeightPrediction::xGetSADs32w( DistParam* pcDtParam ) |
---|
| 591 | { |
---|
| 592 | Pel* piOrg = pcDtParam->pOrg; |
---|
| 593 | Pel* piCur = pcDtParam->pCur; |
---|
| 594 | Int iRows = pcDtParam->iRows; |
---|
| 595 | Int iStrideCur = pcDtParam->iStrideCur; |
---|
| 596 | Int iStrideOrg = pcDtParam->iStrideOrg; |
---|
| 597 | Int iStep = pcDtParam->iStep; |
---|
| 598 | Int iStep2 = iStep<<1; |
---|
| 599 | Int iStep3 = iStep2 + iStep; |
---|
| 600 | Int iStep4 = iStep3 + iStep; |
---|
| 601 | Int iStep5 = iStep4 + iStep; |
---|
| 602 | Int iStep6 = iStep5 + iStep; |
---|
| 603 | Int iStep7 = iStep6 + iStep; |
---|
| 604 | Int iStep8 = iStep7 + iStep; |
---|
| 605 | Int iStep9 = iStep8 + iStep; |
---|
| 606 | Int iStep10 = iStep9 + iStep; |
---|
| 607 | Int iStep11 = iStep10 + iStep; |
---|
| 608 | Int iStep12 = iStep11 + iStep; |
---|
| 609 | Int iStep13 = iStep12 + iStep; |
---|
| 610 | Int iStep14 = iStep13 + iStep; |
---|
| 611 | Int iStep15 = iStep14 + iStep; |
---|
| 612 | Int iStep16 = iStep15 + iStep; |
---|
| 613 | Int iStep17 = iStep16 + iStep; |
---|
| 614 | Int iStep18 = iStep17 + iStep; |
---|
| 615 | Int iStep19 = iStep18 + iStep; |
---|
| 616 | Int iStep20 = iStep19 + iStep; |
---|
| 617 | Int iStep21 = iStep20 + iStep; |
---|
| 618 | Int iStep22 = iStep21 + iStep; |
---|
| 619 | Int iStep23 = iStep22 + iStep; |
---|
| 620 | Int iStep24 = iStep23 + iStep; |
---|
| 621 | Int iStep25 = iStep24 + iStep; |
---|
| 622 | Int iStep26 = iStep25 + iStep; |
---|
| 623 | Int iStep27 = iStep26 + iStep; |
---|
| 624 | Int iStep28 = iStep27 + iStep; |
---|
| 625 | Int iStep29 = iStep28 + iStep; |
---|
| 626 | Int iStep30 = iStep29 + iStep; |
---|
| 627 | Int iStep31 = iStep30 + iStep; |
---|
| 628 | |
---|
| 629 | UInt uiSum = 0; |
---|
| 630 | |
---|
| 631 | printf("TComRdCostWeightPrediction::xGetSADs32w():\tnot implemented, use xGetSADw().\n"); fflush(stdout); exit(0); |
---|
| 632 | |
---|
| 633 | for( ; iRows != 0; iRows-- ) |
---|
| 634 | { |
---|
| 635 | uiSum += abs( piOrg[ 0] - piCur[ 0] ); |
---|
| 636 | uiSum += abs( piOrg[ 1] - piCur[iStep ] ); |
---|
| 637 | uiSum += abs( piOrg[ 2] - piCur[iStep2 ] ); |
---|
| 638 | uiSum += abs( piOrg[ 3] - piCur[iStep3 ] ); |
---|
| 639 | uiSum += abs( piOrg[ 4] - piCur[iStep4 ] ); |
---|
| 640 | uiSum += abs( piOrg[ 5] - piCur[iStep5 ] ); |
---|
| 641 | uiSum += abs( piOrg[ 6] - piCur[iStep6 ] ); |
---|
| 642 | uiSum += abs( piOrg[ 7] - piCur[iStep7 ] ); |
---|
| 643 | uiSum += abs( piOrg[ 8] - piCur[iStep8 ] ); |
---|
| 644 | uiSum += abs( piOrg[ 9] - piCur[iStep9 ] ); |
---|
| 645 | uiSum += abs( piOrg[10] - piCur[iStep10] ); |
---|
| 646 | uiSum += abs( piOrg[11] - piCur[iStep11] ); |
---|
| 647 | uiSum += abs( piOrg[12] - piCur[iStep12] ); |
---|
| 648 | uiSum += abs( piOrg[13] - piCur[iStep13] ); |
---|
| 649 | uiSum += abs( piOrg[14] - piCur[iStep14] ); |
---|
| 650 | uiSum += abs( piOrg[15] - piCur[iStep15] ); |
---|
| 651 | uiSum += abs( piOrg[16] - piCur[iStep16] ); |
---|
| 652 | uiSum += abs( piOrg[17] - piCur[iStep17] ); |
---|
| 653 | uiSum += abs( piOrg[18] - piCur[iStep18] ); |
---|
| 654 | uiSum += abs( piOrg[19] - piCur[iStep19] ); |
---|
| 655 | uiSum += abs( piOrg[20] - piCur[iStep20] ); |
---|
| 656 | uiSum += abs( piOrg[21] - piCur[iStep21] ); |
---|
| 657 | uiSum += abs( piOrg[22] - piCur[iStep22] ); |
---|
| 658 | uiSum += abs( piOrg[23] - piCur[iStep23] ); |
---|
| 659 | uiSum += abs( piOrg[24] - piCur[iStep24] ); |
---|
| 660 | uiSum += abs( piOrg[25] - piCur[iStep25] ); |
---|
| 661 | uiSum += abs( piOrg[26] - piCur[iStep26] ); |
---|
| 662 | uiSum += abs( piOrg[27] - piCur[iStep27] ); |
---|
| 663 | uiSum += abs( piOrg[28] - piCur[iStep28] ); |
---|
| 664 | uiSum += abs( piOrg[29] - piCur[iStep29] ); |
---|
| 665 | uiSum += abs( piOrg[30] - piCur[iStep30] ); |
---|
| 666 | uiSum += abs( piOrg[31] - piCur[iStep31] ); |
---|
| 667 | |
---|
| 668 | piOrg += iStrideOrg; |
---|
| 669 | piCur += iStrideCur; |
---|
| 670 | } |
---|
| 671 | |
---|
| 672 | return ( uiSum >> g_uiBitIncrement ); |
---|
| 673 | } |
---|
| 674 | |
---|
| 675 | UInt TComRdCostWeightPrediction::xGetSADs64w( DistParam* pcDtParam ) |
---|
| 676 | { |
---|
| 677 | Pel* piOrg = pcDtParam->pOrg; |
---|
| 678 | Pel* piCur = pcDtParam->pCur; |
---|
| 679 | Int iRows = pcDtParam->iRows; |
---|
| 680 | Int iStrideCur = pcDtParam->iStrideCur; |
---|
| 681 | Int iStrideOrg = pcDtParam->iStrideOrg; |
---|
| 682 | Int iStep = pcDtParam->iStep; |
---|
| 683 | Int iStep2 = iStep<<1; |
---|
| 684 | Int iStep3 = iStep2 + iStep; |
---|
| 685 | Int iStep4 = iStep3 + iStep; |
---|
| 686 | Int iStep5 = iStep4 + iStep; |
---|
| 687 | Int iStep6 = iStep5 + iStep; |
---|
| 688 | Int iStep7 = iStep6 + iStep; |
---|
| 689 | Int iStep8 = iStep7 + iStep; |
---|
| 690 | Int iStep9 = iStep8 + iStep; |
---|
| 691 | Int iStep10 = iStep9 + iStep; |
---|
| 692 | Int iStep11 = iStep10 + iStep; |
---|
| 693 | Int iStep12 = iStep11 + iStep; |
---|
| 694 | Int iStep13 = iStep12 + iStep; |
---|
| 695 | Int iStep14 = iStep13 + iStep; |
---|
| 696 | Int iStep15 = iStep14 + iStep; |
---|
| 697 | Int iStep16 = iStep15 + iStep; |
---|
| 698 | Int iStep17 = iStep16 + iStep; |
---|
| 699 | Int iStep18 = iStep17 + iStep; |
---|
| 700 | Int iStep19 = iStep18 + iStep; |
---|
| 701 | Int iStep20 = iStep19 + iStep; |
---|
| 702 | Int iStep21 = iStep20 + iStep; |
---|
| 703 | Int iStep22 = iStep21 + iStep; |
---|
| 704 | Int iStep23 = iStep22 + iStep; |
---|
| 705 | Int iStep24 = iStep23 + iStep; |
---|
| 706 | Int iStep25 = iStep24 + iStep; |
---|
| 707 | Int iStep26 = iStep25 + iStep; |
---|
| 708 | Int iStep27 = iStep26 + iStep; |
---|
| 709 | Int iStep28 = iStep27 + iStep; |
---|
| 710 | Int iStep29 = iStep28 + iStep; |
---|
| 711 | Int iStep30 = iStep29 + iStep; |
---|
| 712 | Int iStep31 = iStep30 + iStep; |
---|
| 713 | Int iStep32 = iStep31 + iStep; |
---|
| 714 | Int iStep33 = iStep32 + iStep; |
---|
| 715 | Int iStep34 = iStep33 + iStep; |
---|
| 716 | Int iStep35 = iStep34 + iStep; |
---|
| 717 | Int iStep36 = iStep35 + iStep; |
---|
| 718 | Int iStep37 = iStep36 + iStep; |
---|
| 719 | Int iStep38 = iStep37 + iStep; |
---|
| 720 | Int iStep39 = iStep38 + iStep; |
---|
| 721 | Int iStep40 = iStep39 + iStep; |
---|
| 722 | Int iStep41 = iStep40 + iStep; |
---|
| 723 | Int iStep42 = iStep41 + iStep; |
---|
| 724 | Int iStep43 = iStep42 + iStep; |
---|
| 725 | Int iStep44 = iStep43 + iStep; |
---|
| 726 | Int iStep45 = iStep44 + iStep; |
---|
| 727 | Int iStep46 = iStep45 + iStep; |
---|
| 728 | Int iStep47 = iStep46 + iStep; |
---|
| 729 | Int iStep48 = iStep47 + iStep; |
---|
| 730 | Int iStep49 = iStep48 + iStep; |
---|
| 731 | Int iStep50 = iStep49 + iStep; |
---|
| 732 | Int iStep51 = iStep50 + iStep; |
---|
| 733 | Int iStep52 = iStep51 + iStep; |
---|
| 734 | Int iStep53 = iStep52 + iStep; |
---|
| 735 | Int iStep54 = iStep53 + iStep; |
---|
| 736 | Int iStep55 = iStep54 + iStep; |
---|
| 737 | Int iStep56 = iStep55 + iStep; |
---|
| 738 | Int iStep57 = iStep56 + iStep; |
---|
| 739 | Int iStep58 = iStep57 + iStep; |
---|
| 740 | Int iStep59 = iStep58 + iStep; |
---|
| 741 | Int iStep60 = iStep59 + iStep; |
---|
| 742 | Int iStep61 = iStep60 + iStep; |
---|
| 743 | Int iStep62 = iStep61 + iStep; |
---|
| 744 | Int iStep63 = iStep62 + iStep; |
---|
| 745 | |
---|
| 746 | UInt uiSum = 0; |
---|
| 747 | |
---|
| 748 | printf("TComRdCostWeightPrediction::xGetSADs64w():\tnot implemented, use xGetSADw().\n"); fflush(stdout); exit(0); |
---|
| 749 | |
---|
| 750 | for( ; iRows != 0; iRows-- ) |
---|
| 751 | { |
---|
| 752 | uiSum += abs( piOrg[ 0] - piCur[ 0] ); |
---|
| 753 | uiSum += abs( piOrg[ 1] - piCur[iStep ] ); |
---|
| 754 | uiSum += abs( piOrg[ 2] - piCur[iStep2 ] ); |
---|
| 755 | uiSum += abs( piOrg[ 3] - piCur[iStep3 ] ); |
---|
| 756 | uiSum += abs( piOrg[ 4] - piCur[iStep4 ] ); |
---|
| 757 | uiSum += abs( piOrg[ 5] - piCur[iStep5 ] ); |
---|
| 758 | uiSum += abs( piOrg[ 6] - piCur[iStep6 ] ); |
---|
| 759 | uiSum += abs( piOrg[ 7] - piCur[iStep7 ] ); |
---|
| 760 | uiSum += abs( piOrg[ 8] - piCur[iStep8 ] ); |
---|
| 761 | uiSum += abs( piOrg[ 9] - piCur[iStep9 ] ); |
---|
| 762 | uiSum += abs( piOrg[10] - piCur[iStep10] ); |
---|
| 763 | uiSum += abs( piOrg[11] - piCur[iStep11] ); |
---|
| 764 | uiSum += abs( piOrg[12] - piCur[iStep12] ); |
---|
| 765 | uiSum += abs( piOrg[13] - piCur[iStep13] ); |
---|
| 766 | uiSum += abs( piOrg[14] - piCur[iStep14] ); |
---|
| 767 | uiSum += abs( piOrg[15] - piCur[iStep15] ); |
---|
| 768 | uiSum += abs( piOrg[16] - piCur[iStep16] ); |
---|
| 769 | uiSum += abs( piOrg[17] - piCur[iStep17] ); |
---|
| 770 | uiSum += abs( piOrg[18] - piCur[iStep18] ); |
---|
| 771 | uiSum += abs( piOrg[19] - piCur[iStep19] ); |
---|
| 772 | uiSum += abs( piOrg[20] - piCur[iStep20] ); |
---|
| 773 | uiSum += abs( piOrg[21] - piCur[iStep21] ); |
---|
| 774 | uiSum += abs( piOrg[22] - piCur[iStep22] ); |
---|
| 775 | uiSum += abs( piOrg[23] - piCur[iStep23] ); |
---|
| 776 | uiSum += abs( piOrg[24] - piCur[iStep24] ); |
---|
| 777 | uiSum += abs( piOrg[25] - piCur[iStep25] ); |
---|
| 778 | uiSum += abs( piOrg[26] - piCur[iStep26] ); |
---|
| 779 | uiSum += abs( piOrg[27] - piCur[iStep27] ); |
---|
| 780 | uiSum += abs( piOrg[28] - piCur[iStep28] ); |
---|
| 781 | uiSum += abs( piOrg[29] - piCur[iStep29] ); |
---|
| 782 | uiSum += abs( piOrg[30] - piCur[iStep30] ); |
---|
| 783 | uiSum += abs( piOrg[31] - piCur[iStep31] ); |
---|
| 784 | uiSum += abs( piOrg[32] - piCur[iStep32] ); |
---|
| 785 | uiSum += abs( piOrg[33] - piCur[iStep33] ); |
---|
| 786 | uiSum += abs( piOrg[34] - piCur[iStep34] ); |
---|
| 787 | uiSum += abs( piOrg[35] - piCur[iStep35] ); |
---|
| 788 | uiSum += abs( piOrg[36] - piCur[iStep36] ); |
---|
| 789 | uiSum += abs( piOrg[37] - piCur[iStep37] ); |
---|
| 790 | uiSum += abs( piOrg[38] - piCur[iStep38] ); |
---|
| 791 | uiSum += abs( piOrg[39] - piCur[iStep39] ); |
---|
| 792 | uiSum += abs( piOrg[40] - piCur[iStep40] ); |
---|
| 793 | uiSum += abs( piOrg[41] - piCur[iStep41] ); |
---|
| 794 | uiSum += abs( piOrg[42] - piCur[iStep42] ); |
---|
| 795 | uiSum += abs( piOrg[43] - piCur[iStep43] ); |
---|
| 796 | uiSum += abs( piOrg[44] - piCur[iStep44] ); |
---|
| 797 | uiSum += abs( piOrg[45] - piCur[iStep45] ); |
---|
| 798 | uiSum += abs( piOrg[46] - piCur[iStep46] ); |
---|
| 799 | uiSum += abs( piOrg[47] - piCur[iStep47] ); |
---|
| 800 | uiSum += abs( piOrg[48] - piCur[iStep48] ); |
---|
| 801 | uiSum += abs( piOrg[49] - piCur[iStep49] ); |
---|
| 802 | uiSum += abs( piOrg[50] - piCur[iStep50] ); |
---|
| 803 | uiSum += abs( piOrg[51] - piCur[iStep51] ); |
---|
| 804 | uiSum += abs( piOrg[52] - piCur[iStep52] ); |
---|
| 805 | uiSum += abs( piOrg[53] - piCur[iStep53] ); |
---|
| 806 | uiSum += abs( piOrg[54] - piCur[iStep54] ); |
---|
| 807 | uiSum += abs( piOrg[55] - piCur[iStep55] ); |
---|
| 808 | uiSum += abs( piOrg[56] - piCur[iStep56] ); |
---|
| 809 | uiSum += abs( piOrg[57] - piCur[iStep57] ); |
---|
| 810 | uiSum += abs( piOrg[58] - piCur[iStep58] ); |
---|
| 811 | uiSum += abs( piOrg[59] - piCur[iStep59] ); |
---|
| 812 | uiSum += abs( piOrg[60] - piCur[iStep60] ); |
---|
| 813 | uiSum += abs( piOrg[61] - piCur[iStep61] ); |
---|
| 814 | uiSum += abs( piOrg[62] - piCur[iStep62] ); |
---|
| 815 | uiSum += abs( piOrg[63] - piCur[iStep63] ); |
---|
| 816 | |
---|
| 817 | piOrg += iStrideOrg; |
---|
| 818 | piCur += iStrideCur; |
---|
| 819 | } |
---|
| 820 | |
---|
| 821 | return ( uiSum >> g_uiBitIncrement ); |
---|
| 822 | } |
---|
| 823 | |
---|
| 824 | // -------------------------------------------------------------------------------------------------------------------- |
---|
| 825 | // SSE |
---|
| 826 | // -------------------------------------------------------------------------------------------------------------------- |
---|
| 827 | |
---|
| 828 | UInt TComRdCostWeightPrediction::xGetSSEw( DistParam* pcDtParam ) |
---|
| 829 | { |
---|
| 830 | Pel* piOrg = pcDtParam->pOrg; |
---|
| 831 | Pel* piCur = pcDtParam->pCur; |
---|
| 832 | Pel pred; |
---|
| 833 | Int iRows = pcDtParam->iRows; |
---|
| 834 | Int iCols = pcDtParam->iCols; |
---|
| 835 | Int iStrideOrg = pcDtParam->iStrideOrg; |
---|
| 836 | Int iStrideCur = pcDtParam->iStrideCur; |
---|
| 837 | |
---|
| 838 | assert( pcDtParam->iSubShift == 0 ); |
---|
| 839 | |
---|
| 840 | UInt uiComp = pcDtParam->uiComp; |
---|
| 841 | assert(uiComp<3); |
---|
| 842 | wpScalingParam *wpCur = &(pcDtParam->wpCur[uiComp]); |
---|
| 843 | Int w0 = wpCur->w, |
---|
| 844 | offset = wpCur->offset, |
---|
| 845 | shift = wpCur->shift, |
---|
| 846 | round = wpCur->round; |
---|
| 847 | |
---|
| 848 | UInt uiSum = 0; |
---|
| 849 | UInt uiShift = g_uiBitIncrement<<1; |
---|
| 850 | |
---|
| 851 | Int iTemp; |
---|
| 852 | |
---|
| 853 | for( ; iRows != 0; iRows-- ) |
---|
| 854 | { |
---|
| 855 | for (Int n = 0; n < iCols; n++ ) |
---|
| 856 | { |
---|
| 857 | pred = ( (w0*piCur[n] + round) >> shift ) + offset ; |
---|
| 858 | |
---|
| 859 | //iTemp = piOrg[n ] - piCur[n ]; |
---|
| 860 | iTemp = piOrg[n ] - pred; |
---|
| 861 | uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 862 | } |
---|
| 863 | piOrg += iStrideOrg; |
---|
| 864 | piCur += iStrideCur; |
---|
| 865 | } |
---|
| 866 | |
---|
| 867 | pcDtParam->uiComp = 255; // reset for DEBUG (assert test) |
---|
| 868 | |
---|
| 869 | return ( uiSum ); |
---|
| 870 | } |
---|
| 871 | |
---|
| 872 | UInt TComRdCostWeightPrediction::xGetSSE4w( DistParam* pcDtParam ) |
---|
| 873 | { |
---|
| 874 | Pel* piOrg = pcDtParam->pOrg; |
---|
| 875 | Pel* piCur = pcDtParam->pCur; |
---|
| 876 | Int iRows = pcDtParam->iRows; |
---|
| 877 | Int iStrideOrg = pcDtParam->iStrideOrg; |
---|
| 878 | Int iStrideCur = pcDtParam->iStrideCur; |
---|
| 879 | |
---|
| 880 | UInt uiSum = 0; |
---|
| 881 | UInt uiShift = g_uiBitIncrement<<1; |
---|
| 882 | |
---|
| 883 | Int iTemp; |
---|
| 884 | |
---|
| 885 | printf("TComRdCostWeightPrediction::xGetSSE4w():\tnot implemented, use xGetSSEw().\n"); fflush(stdout); exit(0); |
---|
| 886 | |
---|
| 887 | for( ; iRows != 0; iRows-- ) |
---|
| 888 | { |
---|
| 889 | |
---|
| 890 | iTemp = piOrg[0] - piCur[0]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 891 | iTemp = piOrg[1] - piCur[1]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 892 | iTemp = piOrg[2] - piCur[2]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 893 | iTemp = piOrg[3] - piCur[3]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 894 | |
---|
| 895 | piOrg += iStrideOrg; |
---|
| 896 | piCur += iStrideCur; |
---|
| 897 | } |
---|
| 898 | |
---|
| 899 | return ( uiSum ); |
---|
| 900 | } |
---|
| 901 | |
---|
| 902 | UInt TComRdCostWeightPrediction::xGetSSE8w( DistParam* pcDtParam ) |
---|
| 903 | { |
---|
| 904 | Pel* piOrg = pcDtParam->pOrg; |
---|
| 905 | Pel* piCur = pcDtParam->pCur; |
---|
| 906 | Int iRows = pcDtParam->iRows; |
---|
| 907 | Int iStrideOrg = pcDtParam->iStrideOrg; |
---|
| 908 | Int iStrideCur = pcDtParam->iStrideCur; |
---|
| 909 | |
---|
| 910 | UInt uiSum = 0; |
---|
| 911 | UInt uiShift = g_uiBitIncrement<<1; |
---|
| 912 | |
---|
| 913 | Int iTemp; |
---|
| 914 | |
---|
| 915 | printf("TComRdCostWeightPrediction::xGetSSE8w():\tnot implemented, use xGetSSEw().\n"); fflush(stdout); exit(0); |
---|
| 916 | |
---|
| 917 | for( ; iRows != 0; iRows-- ) |
---|
| 918 | { |
---|
| 919 | iTemp = piOrg[0] - piCur[0]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 920 | iTemp = piOrg[1] - piCur[1]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 921 | iTemp = piOrg[2] - piCur[2]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 922 | iTemp = piOrg[3] - piCur[3]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 923 | iTemp = piOrg[4] - piCur[4]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 924 | iTemp = piOrg[5] - piCur[5]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 925 | iTemp = piOrg[6] - piCur[6]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 926 | iTemp = piOrg[7] - piCur[7]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 927 | |
---|
| 928 | piOrg += iStrideOrg; |
---|
| 929 | piCur += iStrideCur; |
---|
| 930 | } |
---|
| 931 | |
---|
| 932 | return ( uiSum ); |
---|
| 933 | } |
---|
| 934 | |
---|
| 935 | UInt TComRdCostWeightPrediction::xGetSSE16w( DistParam* pcDtParam ) |
---|
| 936 | { |
---|
| 937 | Pel* piOrg = pcDtParam->pOrg; |
---|
| 938 | Pel* piCur = pcDtParam->pCur; |
---|
| 939 | Int iRows = pcDtParam->iRows; |
---|
| 940 | Int iStrideOrg = pcDtParam->iStrideOrg; |
---|
| 941 | Int iStrideCur = pcDtParam->iStrideCur; |
---|
| 942 | |
---|
| 943 | UInt uiSum = 0; |
---|
| 944 | UInt uiShift = g_uiBitIncrement<<1; |
---|
| 945 | |
---|
| 946 | Int iTemp; |
---|
| 947 | |
---|
| 948 | printf("TComRdCostWeightPrediction::xGetSSE16w():\tnot implemented, use xGetSSEw().\n"); fflush(stdout); exit(0); |
---|
| 949 | |
---|
| 950 | for( ; iRows != 0; iRows-- ) |
---|
| 951 | { |
---|
| 952 | |
---|
| 953 | iTemp = piOrg[ 0] - piCur[ 0]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 954 | iTemp = piOrg[ 1] - piCur[ 1]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 955 | iTemp = piOrg[ 2] - piCur[ 2]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 956 | iTemp = piOrg[ 3] - piCur[ 3]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 957 | iTemp = piOrg[ 4] - piCur[ 4]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 958 | iTemp = piOrg[ 5] - piCur[ 5]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 959 | iTemp = piOrg[ 6] - piCur[ 6]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 960 | iTemp = piOrg[ 7] - piCur[ 7]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 961 | iTemp = piOrg[ 8] - piCur[ 8]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 962 | iTemp = piOrg[ 9] - piCur[ 9]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 963 | iTemp = piOrg[10] - piCur[10]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 964 | iTemp = piOrg[11] - piCur[11]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 965 | iTemp = piOrg[12] - piCur[12]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 966 | iTemp = piOrg[13] - piCur[13]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 967 | iTemp = piOrg[14] - piCur[14]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 968 | iTemp = piOrg[15] - piCur[15]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 969 | |
---|
| 970 | piOrg += iStrideOrg; |
---|
| 971 | piCur += iStrideCur; |
---|
| 972 | } |
---|
| 973 | |
---|
| 974 | return ( uiSum ); |
---|
| 975 | } |
---|
| 976 | |
---|
| 977 | UInt TComRdCostWeightPrediction::xGetSSE16Nw( DistParam* pcDtParam ) |
---|
| 978 | { |
---|
| 979 | Pel* piOrg = pcDtParam->pOrg; |
---|
| 980 | Pel* piCur = pcDtParam->pCur; |
---|
| 981 | Int iRows = pcDtParam->iRows; |
---|
| 982 | Int iCols = pcDtParam->iCols; |
---|
| 983 | Int iStrideOrg = pcDtParam->iStrideOrg; |
---|
| 984 | Int iStrideCur = pcDtParam->iStrideCur; |
---|
| 985 | |
---|
| 986 | UInt uiSum = 0; |
---|
| 987 | UInt uiShift = g_uiBitIncrement<<1; |
---|
| 988 | Int iTemp; |
---|
| 989 | |
---|
| 990 | printf("TComRdCostWeightPrediction::xGetSSE16Nw():\tnot implemented, use xGetSSEw().\n"); fflush(stdout); exit(0); |
---|
| 991 | |
---|
| 992 | for( ; iRows != 0; iRows-- ) |
---|
| 993 | { |
---|
| 994 | for (Int n = 0; n < iCols; n+=16 ) |
---|
| 995 | { |
---|
| 996 | |
---|
| 997 | iTemp = piOrg[n+ 0] - piCur[n+ 0]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 998 | iTemp = piOrg[n+ 1] - piCur[n+ 1]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 999 | iTemp = piOrg[n+ 2] - piCur[n+ 2]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1000 | iTemp = piOrg[n+ 3] - piCur[n+ 3]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1001 | iTemp = piOrg[n+ 4] - piCur[n+ 4]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1002 | iTemp = piOrg[n+ 5] - piCur[n+ 5]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1003 | iTemp = piOrg[n+ 6] - piCur[n+ 6]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1004 | iTemp = piOrg[n+ 7] - piCur[n+ 7]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1005 | iTemp = piOrg[n+ 8] - piCur[n+ 8]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1006 | iTemp = piOrg[n+ 9] - piCur[n+ 9]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1007 | iTemp = piOrg[n+10] - piCur[n+10]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1008 | iTemp = piOrg[n+11] - piCur[n+11]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1009 | iTemp = piOrg[n+12] - piCur[n+12]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1010 | iTemp = piOrg[n+13] - piCur[n+13]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1011 | iTemp = piOrg[n+14] - piCur[n+14]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1012 | iTemp = piOrg[n+15] - piCur[n+15]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1013 | |
---|
| 1014 | } |
---|
| 1015 | piOrg += iStrideOrg; |
---|
| 1016 | piCur += iStrideCur; |
---|
| 1017 | } |
---|
| 1018 | |
---|
| 1019 | return ( uiSum ); |
---|
| 1020 | } |
---|
| 1021 | |
---|
| 1022 | UInt TComRdCostWeightPrediction::xGetSSE32w( DistParam* pcDtParam ) |
---|
| 1023 | { |
---|
| 1024 | Pel* piOrg = pcDtParam->pOrg; |
---|
| 1025 | Pel* piCur = pcDtParam->pCur; |
---|
| 1026 | Int iRows = pcDtParam->iRows; |
---|
| 1027 | Int iStrideOrg = pcDtParam->iStrideOrg; |
---|
| 1028 | Int iStrideCur = pcDtParam->iStrideCur; |
---|
| 1029 | |
---|
| 1030 | UInt uiSum = 0; |
---|
| 1031 | UInt uiShift = g_uiBitIncrement<<1; |
---|
| 1032 | Int iTemp; |
---|
| 1033 | |
---|
| 1034 | printf("TComRdCostWeightPrediction::xGetSSE32w():\tnot implemented, use xGetSSEw().\n"); fflush(stdout); exit(0); |
---|
| 1035 | |
---|
| 1036 | for( ; iRows != 0; iRows-- ) |
---|
| 1037 | { |
---|
| 1038 | |
---|
| 1039 | iTemp = piOrg[ 0] - piCur[ 0]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1040 | iTemp = piOrg[ 1] - piCur[ 1]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1041 | iTemp = piOrg[ 2] - piCur[ 2]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1042 | iTemp = piOrg[ 3] - piCur[ 3]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1043 | iTemp = piOrg[ 4] - piCur[ 4]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1044 | iTemp = piOrg[ 5] - piCur[ 5]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1045 | iTemp = piOrg[ 6] - piCur[ 6]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1046 | iTemp = piOrg[ 7] - piCur[ 7]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1047 | iTemp = piOrg[ 8] - piCur[ 8]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1048 | iTemp = piOrg[ 9] - piCur[ 9]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1049 | iTemp = piOrg[10] - piCur[10]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1050 | iTemp = piOrg[11] - piCur[11]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1051 | iTemp = piOrg[12] - piCur[12]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1052 | iTemp = piOrg[13] - piCur[13]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1053 | iTemp = piOrg[14] - piCur[14]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1054 | iTemp = piOrg[15] - piCur[15]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1055 | iTemp = piOrg[16] - piCur[16]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1056 | iTemp = piOrg[17] - piCur[17]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1057 | iTemp = piOrg[18] - piCur[18]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1058 | iTemp = piOrg[19] - piCur[19]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1059 | iTemp = piOrg[20] - piCur[20]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1060 | iTemp = piOrg[21] - piCur[21]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1061 | iTemp = piOrg[22] - piCur[22]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1062 | iTemp = piOrg[23] - piCur[23]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1063 | iTemp = piOrg[24] - piCur[24]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1064 | iTemp = piOrg[25] - piCur[25]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1065 | iTemp = piOrg[26] - piCur[26]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1066 | iTemp = piOrg[27] - piCur[27]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1067 | iTemp = piOrg[28] - piCur[28]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1068 | iTemp = piOrg[29] - piCur[29]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1069 | iTemp = piOrg[30] - piCur[30]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1070 | iTemp = piOrg[31] - piCur[31]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1071 | |
---|
| 1072 | piOrg += iStrideOrg; |
---|
| 1073 | piCur += iStrideCur; |
---|
| 1074 | } |
---|
| 1075 | |
---|
| 1076 | return ( uiSum ); |
---|
| 1077 | } |
---|
| 1078 | |
---|
| 1079 | UInt TComRdCostWeightPrediction::xGetSSE64w( DistParam* pcDtParam ) |
---|
| 1080 | { |
---|
| 1081 | Pel* piOrg = pcDtParam->pOrg; |
---|
| 1082 | Pel* piCur = pcDtParam->pCur; |
---|
| 1083 | Int iRows = pcDtParam->iRows; |
---|
| 1084 | Int iStrideOrg = pcDtParam->iStrideOrg; |
---|
| 1085 | Int iStrideCur = pcDtParam->iStrideCur; |
---|
| 1086 | |
---|
| 1087 | UInt uiSum = 0; |
---|
| 1088 | UInt uiShift = g_uiBitIncrement<<1; |
---|
| 1089 | Int iTemp; |
---|
| 1090 | |
---|
| 1091 | printf("TComRdCostWeightPrediction::xGetSSE64w():\tnot implemented, use xGetSSEw().\n"); fflush(stdout); exit(0); |
---|
| 1092 | |
---|
| 1093 | for( ; iRows != 0; iRows-- ) |
---|
| 1094 | { |
---|
| 1095 | iTemp = piOrg[ 0] - piCur[ 0]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1096 | iTemp = piOrg[ 1] - piCur[ 1]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1097 | iTemp = piOrg[ 2] - piCur[ 2]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1098 | iTemp = piOrg[ 3] - piCur[ 3]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1099 | iTemp = piOrg[ 4] - piCur[ 4]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1100 | iTemp = piOrg[ 5] - piCur[ 5]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1101 | iTemp = piOrg[ 6] - piCur[ 6]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1102 | iTemp = piOrg[ 7] - piCur[ 7]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1103 | iTemp = piOrg[ 8] - piCur[ 8]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1104 | iTemp = piOrg[ 9] - piCur[ 9]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1105 | iTemp = piOrg[10] - piCur[10]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1106 | iTemp = piOrg[11] - piCur[11]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1107 | iTemp = piOrg[12] - piCur[12]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1108 | iTemp = piOrg[13] - piCur[13]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1109 | iTemp = piOrg[14] - piCur[14]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1110 | iTemp = piOrg[15] - piCur[15]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1111 | iTemp = piOrg[16] - piCur[16]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1112 | iTemp = piOrg[17] - piCur[17]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1113 | iTemp = piOrg[18] - piCur[18]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1114 | iTemp = piOrg[19] - piCur[19]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1115 | iTemp = piOrg[20] - piCur[20]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1116 | iTemp = piOrg[21] - piCur[21]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1117 | iTemp = piOrg[22] - piCur[22]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1118 | iTemp = piOrg[23] - piCur[23]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1119 | iTemp = piOrg[24] - piCur[24]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1120 | iTemp = piOrg[25] - piCur[25]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1121 | iTemp = piOrg[26] - piCur[26]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1122 | iTemp = piOrg[27] - piCur[27]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1123 | iTemp = piOrg[28] - piCur[28]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1124 | iTemp = piOrg[29] - piCur[29]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1125 | iTemp = piOrg[30] - piCur[30]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1126 | iTemp = piOrg[31] - piCur[31]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1127 | iTemp = piOrg[32] - piCur[32]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1128 | iTemp = piOrg[33] - piCur[33]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1129 | iTemp = piOrg[34] - piCur[34]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1130 | iTemp = piOrg[35] - piCur[35]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1131 | iTemp = piOrg[36] - piCur[36]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1132 | iTemp = piOrg[37] - piCur[37]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1133 | iTemp = piOrg[38] - piCur[38]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1134 | iTemp = piOrg[39] - piCur[39]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1135 | iTemp = piOrg[40] - piCur[40]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1136 | iTemp = piOrg[41] - piCur[41]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1137 | iTemp = piOrg[42] - piCur[42]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1138 | iTemp = piOrg[43] - piCur[43]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1139 | iTemp = piOrg[44] - piCur[44]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1140 | iTemp = piOrg[45] - piCur[45]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1141 | iTemp = piOrg[46] - piCur[46]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1142 | iTemp = piOrg[47] - piCur[47]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1143 | iTemp = piOrg[48] - piCur[48]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1144 | iTemp = piOrg[49] - piCur[49]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1145 | iTemp = piOrg[50] - piCur[50]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1146 | iTemp = piOrg[51] - piCur[51]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1147 | iTemp = piOrg[52] - piCur[52]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1148 | iTemp = piOrg[53] - piCur[53]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1149 | iTemp = piOrg[54] - piCur[54]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1150 | iTemp = piOrg[55] - piCur[55]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1151 | iTemp = piOrg[56] - piCur[56]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1152 | iTemp = piOrg[57] - piCur[57]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1153 | iTemp = piOrg[58] - piCur[58]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1154 | iTemp = piOrg[59] - piCur[59]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1155 | iTemp = piOrg[60] - piCur[60]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1156 | iTemp = piOrg[61] - piCur[61]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1157 | iTemp = piOrg[62] - piCur[62]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1158 | iTemp = piOrg[63] - piCur[63]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
| 1159 | |
---|
| 1160 | piOrg += iStrideOrg; |
---|
| 1161 | piCur += iStrideCur; |
---|
| 1162 | } |
---|
| 1163 | |
---|
| 1164 | return ( uiSum ); |
---|
| 1165 | } |
---|
| 1166 | |
---|
| 1167 | // -------------------------------------------------------------------------------------------------------------------- |
---|
| 1168 | // HADAMARD with step (used in fractional search) |
---|
| 1169 | // -------------------------------------------------------------------------------------------------------------------- |
---|
| 1170 | |
---|
| 1171 | UInt TComRdCostWeightPrediction::xCalcHADs2x2w( Pel *piOrg, Pel *piCur, Int iStrideOrg, Int iStrideCur, Int iStep ) |
---|
| 1172 | { |
---|
| 1173 | Int satd = 0, diff[4], m[4]; |
---|
| 1174 | diff[0] = piOrg[0 ] - piCur[0*iStep]; |
---|
| 1175 | diff[1] = piOrg[1 ] - piCur[1*iStep]; |
---|
| 1176 | diff[2] = piOrg[iStrideOrg ] - piCur[0*iStep + iStrideCur]; |
---|
| 1177 | diff[3] = piOrg[iStrideOrg + 1] - piCur[1*iStep + iStrideCur]; |
---|
| 1178 | |
---|
| 1179 | m[0] = diff[0] + diff[2]; |
---|
| 1180 | m[1] = diff[1] + diff[3]; |
---|
| 1181 | m[2] = diff[0] - diff[2]; |
---|
| 1182 | m[3] = diff[1] - diff[3]; |
---|
| 1183 | |
---|
| 1184 | satd += abs(m[0] + m[1]); |
---|
| 1185 | satd += abs(m[0] - m[1]); |
---|
| 1186 | satd += abs(m[2] + m[3]); |
---|
| 1187 | satd += abs(m[2] - m[3]); |
---|
| 1188 | |
---|
| 1189 | return satd; |
---|
| 1190 | } |
---|
| 1191 | |
---|
| 1192 | UInt TComRdCostWeightPrediction::xCalcHADs4x4w( Pel *piOrg, Pel *piCur, Int iStrideOrg, Int iStrideCur, Int iStep ) |
---|
| 1193 | { |
---|
| 1194 | Int k, satd = 0, diff[16], m[16], d[16]; |
---|
| 1195 | |
---|
| 1196 | assert( m_xSetDone ); |
---|
| 1197 | Pel pred; |
---|
| 1198 | |
---|
| 1199 | for( k = 0; k < 16; k+=4 ) |
---|
| 1200 | { |
---|
| 1201 | /* |
---|
| 1202 | diff[k+0] = piOrg[0] - piCur[0*iStep]; |
---|
| 1203 | diff[k+1] = piOrg[1] - piCur[1*iStep]; |
---|
| 1204 | diff[k+2] = piOrg[2] - piCur[2*iStep]; |
---|
| 1205 | diff[k+3] = piOrg[3] - piCur[3*iStep]; |
---|
| 1206 | */ |
---|
| 1207 | pred = ( (m_w0*piCur[0*iStep] + m_round) >> m_shift ) + m_offset ; |
---|
| 1208 | diff[k+0] = piOrg[0] - pred; |
---|
| 1209 | pred = ( (m_w0*piCur[1*iStep] + m_round) >> m_shift ) + m_offset ; |
---|
| 1210 | diff[k+1] = piOrg[1] - pred; |
---|
| 1211 | pred = ( (m_w0*piCur[2*iStep] + m_round) >> m_shift ) + m_offset ; |
---|
| 1212 | diff[k+2] = piOrg[2] - pred; |
---|
| 1213 | pred = ( (m_w0*piCur[3*iStep] + m_round) >> m_shift ) + m_offset ; |
---|
| 1214 | diff[k+3] = piOrg[3] - pred; |
---|
| 1215 | |
---|
| 1216 | piCur += iStrideCur; |
---|
| 1217 | piOrg += iStrideOrg; |
---|
| 1218 | } |
---|
| 1219 | |
---|
| 1220 | /*===== hadamard transform =====*/ |
---|
| 1221 | m[ 0] = diff[ 0] + diff[12]; |
---|
| 1222 | m[ 1] = diff[ 1] + diff[13]; |
---|
| 1223 | m[ 2] = diff[ 2] + diff[14]; |
---|
| 1224 | m[ 3] = diff[ 3] + diff[15]; |
---|
| 1225 | m[ 4] = diff[ 4] + diff[ 8]; |
---|
| 1226 | m[ 5] = diff[ 5] + diff[ 9]; |
---|
| 1227 | m[ 6] = diff[ 6] + diff[10]; |
---|
| 1228 | m[ 7] = diff[ 7] + diff[11]; |
---|
| 1229 | m[ 8] = diff[ 4] - diff[ 8]; |
---|
| 1230 | m[ 9] = diff[ 5] - diff[ 9]; |
---|
| 1231 | m[10] = diff[ 6] - diff[10]; |
---|
| 1232 | m[11] = diff[ 7] - diff[11]; |
---|
| 1233 | m[12] = diff[ 0] - diff[12]; |
---|
| 1234 | m[13] = diff[ 1] - diff[13]; |
---|
| 1235 | m[14] = diff[ 2] - diff[14]; |
---|
| 1236 | m[15] = diff[ 3] - diff[15]; |
---|
| 1237 | |
---|
| 1238 | d[ 0] = m[ 0] + m[ 4]; |
---|
| 1239 | d[ 1] = m[ 1] + m[ 5]; |
---|
| 1240 | d[ 2] = m[ 2] + m[ 6]; |
---|
| 1241 | d[ 3] = m[ 3] + m[ 7]; |
---|
| 1242 | d[ 4] = m[ 8] + m[12]; |
---|
| 1243 | d[ 5] = m[ 9] + m[13]; |
---|
| 1244 | d[ 6] = m[10] + m[14]; |
---|
| 1245 | d[ 7] = m[11] + m[15]; |
---|
| 1246 | d[ 8] = m[ 0] - m[ 4]; |
---|
| 1247 | d[ 9] = m[ 1] - m[ 5]; |
---|
| 1248 | d[10] = m[ 2] - m[ 6]; |
---|
| 1249 | d[11] = m[ 3] - m[ 7]; |
---|
| 1250 | d[12] = m[12] - m[ 8]; |
---|
| 1251 | d[13] = m[13] - m[ 9]; |
---|
| 1252 | d[14] = m[14] - m[10]; |
---|
| 1253 | d[15] = m[15] - m[11]; |
---|
| 1254 | |
---|
| 1255 | m[ 0] = d[ 0] + d[ 3]; |
---|
| 1256 | m[ 1] = d[ 1] + d[ 2]; |
---|
| 1257 | m[ 2] = d[ 1] - d[ 2]; |
---|
| 1258 | m[ 3] = d[ 0] - d[ 3]; |
---|
| 1259 | m[ 4] = d[ 4] + d[ 7]; |
---|
| 1260 | m[ 5] = d[ 5] + d[ 6]; |
---|
| 1261 | m[ 6] = d[ 5] - d[ 6]; |
---|
| 1262 | m[ 7] = d[ 4] - d[ 7]; |
---|
| 1263 | m[ 8] = d[ 8] + d[11]; |
---|
| 1264 | m[ 9] = d[ 9] + d[10]; |
---|
| 1265 | m[10] = d[ 9] - d[10]; |
---|
| 1266 | m[11] = d[ 8] - d[11]; |
---|
| 1267 | m[12] = d[12] + d[15]; |
---|
| 1268 | m[13] = d[13] + d[14]; |
---|
| 1269 | m[14] = d[13] - d[14]; |
---|
| 1270 | m[15] = d[12] - d[15]; |
---|
| 1271 | |
---|
| 1272 | d[ 0] = m[ 0] + m[ 1]; |
---|
| 1273 | d[ 1] = m[ 0] - m[ 1]; |
---|
| 1274 | d[ 2] = m[ 2] + m[ 3]; |
---|
| 1275 | d[ 3] = m[ 3] - m[ 2]; |
---|
| 1276 | d[ 4] = m[ 4] + m[ 5]; |
---|
| 1277 | d[ 5] = m[ 4] - m[ 5]; |
---|
| 1278 | d[ 6] = m[ 6] + m[ 7]; |
---|
| 1279 | d[ 7] = m[ 7] - m[ 6]; |
---|
| 1280 | d[ 8] = m[ 8] + m[ 9]; |
---|
| 1281 | d[ 9] = m[ 8] - m[ 9]; |
---|
| 1282 | d[10] = m[10] + m[11]; |
---|
| 1283 | d[11] = m[11] - m[10]; |
---|
| 1284 | d[12] = m[12] + m[13]; |
---|
| 1285 | d[13] = m[12] - m[13]; |
---|
| 1286 | d[14] = m[14] + m[15]; |
---|
| 1287 | d[15] = m[15] - m[14]; |
---|
| 1288 | |
---|
| 1289 | for (k=0; k<16; ++k) |
---|
| 1290 | { |
---|
| 1291 | satd += abs(d[k]); |
---|
| 1292 | } |
---|
| 1293 | satd = ((satd+1)>>1); |
---|
| 1294 | |
---|
| 1295 | return satd; |
---|
| 1296 | } |
---|
| 1297 | |
---|
| 1298 | UInt TComRdCostWeightPrediction::xCalcHADs8x8w( Pel *piOrg, Pel *piCur, Int iStrideOrg, Int iStrideCur, Int iStep ) |
---|
| 1299 | { |
---|
| 1300 | Int k, i, j, jj, sad=0; |
---|
| 1301 | Int diff[64], m1[8][8], m2[8][8], m3[8][8]; |
---|
| 1302 | Int iStep2 = iStep<<1; |
---|
| 1303 | Int iStep3 = iStep2 + iStep; |
---|
| 1304 | Int iStep4 = iStep3 + iStep; |
---|
| 1305 | Int iStep5 = iStep4 + iStep; |
---|
| 1306 | Int iStep6 = iStep5 + iStep; |
---|
| 1307 | Int iStep7 = iStep6 + iStep; |
---|
| 1308 | |
---|
| 1309 | assert( m_xSetDone ); |
---|
| 1310 | Pel pred; |
---|
| 1311 | |
---|
| 1312 | for( k = 0; k < 64; k+=8 ) |
---|
| 1313 | { |
---|
| 1314 | /* |
---|
| 1315 | diff[k+0] = piOrg[0] - piCur[ 0]; |
---|
| 1316 | diff[k+1] = piOrg[1] - piCur[iStep ]; |
---|
| 1317 | diff[k+2] = piOrg[2] - piCur[iStep2]; |
---|
| 1318 | diff[k+3] = piOrg[3] - piCur[iStep3]; |
---|
| 1319 | diff[k+4] = piOrg[4] - piCur[iStep4]; |
---|
| 1320 | diff[k+5] = piOrg[5] - piCur[iStep5]; |
---|
| 1321 | diff[k+6] = piOrg[6] - piCur[iStep6]; |
---|
| 1322 | diff[k+7] = piOrg[7] - piCur[iStep7]; |
---|
| 1323 | */ |
---|
| 1324 | pred = ( (m_w0*piCur[ 0] + m_round) >> m_shift ) + m_offset ; |
---|
| 1325 | diff[k+0] = piOrg[0] - pred; |
---|
| 1326 | pred = ( (m_w0*piCur[iStep ] + m_round) >> m_shift ) + m_offset ; |
---|
| 1327 | diff[k+1] = piOrg[1] - pred; |
---|
| 1328 | pred = ( (m_w0*piCur[iStep2] + m_round) >> m_shift ) + m_offset ; |
---|
| 1329 | diff[k+2] = piOrg[2] - pred; |
---|
| 1330 | pred = ( (m_w0*piCur[iStep3] + m_round) >> m_shift ) + m_offset ; |
---|
| 1331 | diff[k+3] = piOrg[3] - pred; |
---|
| 1332 | pred = ( (m_w0*piCur[iStep4] + m_round) >> m_shift ) + m_offset ; |
---|
| 1333 | diff[k+4] = piOrg[4] - pred; |
---|
| 1334 | pred = ( (m_w0*piCur[iStep5] + m_round) >> m_shift ) + m_offset ; |
---|
| 1335 | diff[k+5] = piOrg[5] - pred; |
---|
| 1336 | pred = ( (m_w0*piCur[iStep6] + m_round) >> m_shift ) + m_offset ; |
---|
| 1337 | diff[k+6] = piOrg[6] - pred; |
---|
| 1338 | pred = ( (m_w0*piCur[iStep7] + m_round) >> m_shift ) + m_offset ; |
---|
| 1339 | diff[k+7] = piOrg[7] - pred; |
---|
| 1340 | |
---|
| 1341 | piCur += iStrideCur; |
---|
| 1342 | piOrg += iStrideOrg; |
---|
| 1343 | } |
---|
| 1344 | |
---|
| 1345 | //horizontal |
---|
| 1346 | for (j=0; j < 8; j++) |
---|
| 1347 | { |
---|
| 1348 | jj = j << 3; |
---|
| 1349 | m2[j][0] = diff[jj ] + diff[jj+4]; |
---|
| 1350 | m2[j][1] = diff[jj+1] + diff[jj+5]; |
---|
| 1351 | m2[j][2] = diff[jj+2] + diff[jj+6]; |
---|
| 1352 | m2[j][3] = diff[jj+3] + diff[jj+7]; |
---|
| 1353 | m2[j][4] = diff[jj ] - diff[jj+4]; |
---|
| 1354 | m2[j][5] = diff[jj+1] - diff[jj+5]; |
---|
| 1355 | m2[j][6] = diff[jj+2] - diff[jj+6]; |
---|
| 1356 | m2[j][7] = diff[jj+3] - diff[jj+7]; |
---|
| 1357 | |
---|
| 1358 | m1[j][0] = m2[j][0] + m2[j][2]; |
---|
| 1359 | m1[j][1] = m2[j][1] + m2[j][3]; |
---|
| 1360 | m1[j][2] = m2[j][0] - m2[j][2]; |
---|
| 1361 | m1[j][3] = m2[j][1] - m2[j][3]; |
---|
| 1362 | m1[j][4] = m2[j][4] + m2[j][6]; |
---|
| 1363 | m1[j][5] = m2[j][5] + m2[j][7]; |
---|
| 1364 | m1[j][6] = m2[j][4] - m2[j][6]; |
---|
| 1365 | m1[j][7] = m2[j][5] - m2[j][7]; |
---|
| 1366 | |
---|
| 1367 | m2[j][0] = m1[j][0] + m1[j][1]; |
---|
| 1368 | m2[j][1] = m1[j][0] - m1[j][1]; |
---|
| 1369 | m2[j][2] = m1[j][2] + m1[j][3]; |
---|
| 1370 | m2[j][3] = m1[j][2] - m1[j][3]; |
---|
| 1371 | m2[j][4] = m1[j][4] + m1[j][5]; |
---|
| 1372 | m2[j][5] = m1[j][4] - m1[j][5]; |
---|
| 1373 | m2[j][6] = m1[j][6] + m1[j][7]; |
---|
| 1374 | m2[j][7] = m1[j][6] - m1[j][7]; |
---|
| 1375 | } |
---|
| 1376 | |
---|
| 1377 | //vertical |
---|
| 1378 | for (i=0; i < 8; i++) |
---|
| 1379 | { |
---|
| 1380 | m3[0][i] = m2[0][i] + m2[4][i]; |
---|
| 1381 | m3[1][i] = m2[1][i] + m2[5][i]; |
---|
| 1382 | m3[2][i] = m2[2][i] + m2[6][i]; |
---|
| 1383 | m3[3][i] = m2[3][i] + m2[7][i]; |
---|
| 1384 | m3[4][i] = m2[0][i] - m2[4][i]; |
---|
| 1385 | m3[5][i] = m2[1][i] - m2[5][i]; |
---|
| 1386 | m3[6][i] = m2[2][i] - m2[6][i]; |
---|
| 1387 | m3[7][i] = m2[3][i] - m2[7][i]; |
---|
| 1388 | |
---|
| 1389 | m1[0][i] = m3[0][i] + m3[2][i]; |
---|
| 1390 | m1[1][i] = m3[1][i] + m3[3][i]; |
---|
| 1391 | m1[2][i] = m3[0][i] - m3[2][i]; |
---|
| 1392 | m1[3][i] = m3[1][i] - m3[3][i]; |
---|
| 1393 | m1[4][i] = m3[4][i] + m3[6][i]; |
---|
| 1394 | m1[5][i] = m3[5][i] + m3[7][i]; |
---|
| 1395 | m1[6][i] = m3[4][i] - m3[6][i]; |
---|
| 1396 | m1[7][i] = m3[5][i] - m3[7][i]; |
---|
| 1397 | |
---|
| 1398 | m2[0][i] = m1[0][i] + m1[1][i]; |
---|
| 1399 | m2[1][i] = m1[0][i] - m1[1][i]; |
---|
| 1400 | m2[2][i] = m1[2][i] + m1[3][i]; |
---|
| 1401 | m2[3][i] = m1[2][i] - m1[3][i]; |
---|
| 1402 | m2[4][i] = m1[4][i] + m1[5][i]; |
---|
| 1403 | m2[5][i] = m1[4][i] - m1[5][i]; |
---|
| 1404 | m2[6][i] = m1[6][i] + m1[7][i]; |
---|
| 1405 | m2[7][i] = m1[6][i] - m1[7][i]; |
---|
| 1406 | } |
---|
| 1407 | |
---|
| 1408 | for (j=0; j < 8; j++) |
---|
| 1409 | { |
---|
| 1410 | for (i=0; i < 8; i++) |
---|
| 1411 | sad += (abs(m2[j][i])); |
---|
| 1412 | } |
---|
| 1413 | |
---|
| 1414 | sad=((sad+2)>>2); |
---|
| 1415 | |
---|
| 1416 | return sad; |
---|
| 1417 | } |
---|
| 1418 | |
---|
| 1419 | UInt TComRdCostWeightPrediction::xGetHADs4w( DistParam* pcDtParam ) |
---|
| 1420 | { |
---|
| 1421 | Pel* piOrg = pcDtParam->pOrg; |
---|
| 1422 | Pel* piCur = pcDtParam->pCur; |
---|
| 1423 | Int iRows = pcDtParam->iRows; |
---|
| 1424 | Int iStrideCur = pcDtParam->iStrideCur; |
---|
| 1425 | Int iStrideOrg = pcDtParam->iStrideOrg; |
---|
| 1426 | Int iStep = pcDtParam->iStep; |
---|
| 1427 | Int y; |
---|
| 1428 | Int iOffsetOrg = iStrideOrg<<2; |
---|
| 1429 | Int iOffsetCur = iStrideCur<<2; |
---|
| 1430 | |
---|
| 1431 | UInt uiSum = 0; |
---|
| 1432 | |
---|
| 1433 | for ( y=0; y<iRows; y+= 4 ) |
---|
| 1434 | { |
---|
| 1435 | uiSum += xCalcHADs4x4w( piOrg, piCur, iStrideOrg, iStrideCur, iStep ); |
---|
| 1436 | piOrg += iOffsetOrg; |
---|
| 1437 | piCur += iOffsetCur; |
---|
| 1438 | } |
---|
| 1439 | |
---|
| 1440 | return ( uiSum >> g_uiBitIncrement ); |
---|
| 1441 | } |
---|
| 1442 | |
---|
| 1443 | UInt TComRdCostWeightPrediction::xGetHADs8w( DistParam* pcDtParam ) |
---|
| 1444 | { |
---|
| 1445 | Pel* piOrg = pcDtParam->pOrg; |
---|
| 1446 | Pel* piCur = pcDtParam->pCur; |
---|
| 1447 | Int iRows = pcDtParam->iRows; |
---|
| 1448 | Int iStrideCur = pcDtParam->iStrideCur; |
---|
| 1449 | Int iStrideOrg = pcDtParam->iStrideOrg; |
---|
| 1450 | Int iStep = pcDtParam->iStep; |
---|
| 1451 | Int y; |
---|
| 1452 | |
---|
| 1453 | UInt uiSum = 0; |
---|
| 1454 | |
---|
| 1455 | if ( iRows == 4 ) |
---|
| 1456 | { |
---|
| 1457 | uiSum += xCalcHADs4x4w( piOrg+0, piCur , iStrideOrg, iStrideCur, iStep ); |
---|
| 1458 | uiSum += xCalcHADs4x4w( piOrg+4, piCur+4*iStep, iStrideOrg, iStrideCur, iStep ); |
---|
| 1459 | } |
---|
| 1460 | else |
---|
| 1461 | { |
---|
| 1462 | Int iOffsetOrg = iStrideOrg<<3; |
---|
| 1463 | Int iOffsetCur = iStrideCur<<3; |
---|
| 1464 | for ( y=0; y<iRows; y+= 8 ) |
---|
| 1465 | { |
---|
| 1466 | uiSum += xCalcHADs8x8w( piOrg, piCur, iStrideOrg, iStrideCur, iStep ); |
---|
| 1467 | piOrg += iOffsetOrg; |
---|
| 1468 | piCur += iOffsetCur; |
---|
| 1469 | } |
---|
| 1470 | } |
---|
| 1471 | |
---|
| 1472 | return ( uiSum >> g_uiBitIncrement ); |
---|
| 1473 | } |
---|
| 1474 | |
---|
| 1475 | UInt TComRdCostWeightPrediction::xGetHADsw( DistParam* pcDtParam ) |
---|
| 1476 | { |
---|
| 1477 | Pel* piOrg = pcDtParam->pOrg; |
---|
| 1478 | Pel* piCur = pcDtParam->pCur; |
---|
| 1479 | Int iRows = pcDtParam->iRows; |
---|
| 1480 | Int iCols = pcDtParam->iCols; |
---|
| 1481 | Int iStrideCur = pcDtParam->iStrideCur; |
---|
| 1482 | Int iStrideOrg = pcDtParam->iStrideOrg; |
---|
| 1483 | Int iStep = pcDtParam->iStep; |
---|
| 1484 | |
---|
| 1485 | Int x, y; |
---|
| 1486 | |
---|
| 1487 | UInt uiComp = pcDtParam->uiComp; |
---|
| 1488 | assert(uiComp<3); |
---|
| 1489 | wpScalingParam *wpCur = &(pcDtParam->wpCur[uiComp]); |
---|
| 1490 | Int w0 = wpCur->w, |
---|
| 1491 | offset = wpCur->offset, |
---|
| 1492 | shift = wpCur->shift, |
---|
| 1493 | round = wpCur->round; |
---|
| 1494 | xSetWPscale(w0, 0, shift, offset, round); |
---|
| 1495 | |
---|
| 1496 | UInt uiSum = 0; |
---|
| 1497 | |
---|
| 1498 | if( ( iRows % 8 == 0) && (iCols % 8 == 0) ) |
---|
| 1499 | { |
---|
| 1500 | Int iOffsetOrg = iStrideOrg<<3; |
---|
| 1501 | Int iOffsetCur = iStrideCur<<3; |
---|
| 1502 | for ( y=0; y<iRows; y+= 8 ) |
---|
| 1503 | { |
---|
| 1504 | for ( x=0; x<iCols; x+= 8 ) |
---|
| 1505 | { |
---|
| 1506 | uiSum += xCalcHADs8x8w( &piOrg[x], &piCur[x*iStep], iStrideOrg, iStrideCur, iStep ); |
---|
| 1507 | } |
---|
| 1508 | piOrg += iOffsetOrg; |
---|
| 1509 | piCur += iOffsetCur; |
---|
| 1510 | } |
---|
| 1511 | } |
---|
| 1512 | else if( ( iRows % 4 == 0) && (iCols % 4 == 0) ) |
---|
| 1513 | { |
---|
| 1514 | Int iOffsetOrg = iStrideOrg<<2; |
---|
| 1515 | Int iOffsetCur = iStrideCur<<2; |
---|
| 1516 | |
---|
| 1517 | for ( y=0; y<iRows; y+= 4 ) |
---|
| 1518 | { |
---|
| 1519 | for ( x=0; x<iCols; x+= 4 ) |
---|
| 1520 | { |
---|
| 1521 | uiSum += xCalcHADs4x4w( &piOrg[x], &piCur[x*iStep], iStrideOrg, iStrideCur, iStep ); |
---|
| 1522 | } |
---|
| 1523 | piOrg += iOffsetOrg; |
---|
| 1524 | piCur += iOffsetCur; |
---|
| 1525 | } |
---|
| 1526 | } |
---|
| 1527 | #ifdef DCM_RDCOST_TEMP_FIX //Temporary fix since row size can be 1 or 3 for chroma (such a case does not occur under current encoder settings) |
---|
| 1528 | else if( ( iRows % 2 == 0) && (iCols % 2 == 0) ) |
---|
| 1529 | { |
---|
| 1530 | Int iOffsetOrg = iStrideOrg<<1; |
---|
| 1531 | Int iOffsetCur = iStrideCur<<1; |
---|
| 1532 | #else |
---|
| 1533 | else |
---|
| 1534 | { |
---|
| 1535 | #endif |
---|
| 1536 | for ( y=0; y<iRows; y+=2 ) |
---|
| 1537 | { |
---|
| 1538 | for ( x=0; x<iCols; x+=2 ) |
---|
| 1539 | { |
---|
| 1540 | uiSum += xCalcHADs2x2w( &piOrg[x], &piCur[x*iStep], iStrideOrg, iStrideCur, iStep ); |
---|
| 1541 | } |
---|
| 1542 | #ifdef DCM_RDCOST_TEMP_FIX //Temporary fix since we need to increment by 2*iStride instead of iStride |
---|
| 1543 | piOrg += iOffsetOrg; |
---|
| 1544 | piCur += iOffsetCur; |
---|
| 1545 | #else |
---|
| 1546 | piOrg += iStrideOrg; |
---|
| 1547 | piCur += iStrideCur; |
---|
| 1548 | #endif |
---|
| 1549 | } |
---|
| 1550 | } |
---|
| 1551 | #ifdef DCM_RDCOST_TEMP_FIX //Temporary fix to return MAX_UINT until this case is properly handled |
---|
| 1552 | else |
---|
| 1553 | { |
---|
| 1554 | printf("xGetHADsw not supported for this dimension. Skipping computation of HAD and returning MAX_UINT\n"); |
---|
| 1555 | return (MAX_UINT); |
---|
| 1556 | } |
---|
| 1557 | #endif |
---|
| 1558 | |
---|
| 1559 | m_xSetDone = false; |
---|
| 1560 | |
---|
| 1561 | return ( uiSum >> g_uiBitIncrement ); |
---|
| 1562 | } |
---|
| 1563 | |
---|
| 1564 | #endif |
---|
| 1565 | |
---|