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 |
---|
4 | * granted under this license. |
---|
5 | * |
---|
6 | * Copyright (c) 2010-2012, ITU/ISO/IEC |
---|
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. |
---|
17 | * * Neither the name of the ITU/ISO/IEC nor the names of its contributors may |
---|
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 | */ |
---|
33 | |
---|
34 | /** \file TComRdCost.cpp |
---|
35 | \brief RD cost computation class |
---|
36 | */ |
---|
37 | |
---|
38 | #include <math.h> |
---|
39 | #include <assert.h> |
---|
40 | #include "TComRom.h" |
---|
41 | #include "TComRdCost.h" |
---|
42 | #include "TComDataCU.h" |
---|
43 | |
---|
44 | //! \ingroup TLibCommon |
---|
45 | //! \{ |
---|
46 | |
---|
47 | #if SAIT_VSO_EST_A0033 |
---|
48 | Double TComRdCost::m_dDisparityCoeff = 1.0; |
---|
49 | #endif |
---|
50 | |
---|
51 | TComRdCost::TComRdCost() |
---|
52 | { |
---|
53 | init(); |
---|
54 | } |
---|
55 | |
---|
56 | TComRdCost::~TComRdCost() |
---|
57 | { |
---|
58 | #if !FIX203 |
---|
59 | xUninit(); |
---|
60 | #endif |
---|
61 | } |
---|
62 | |
---|
63 | // Calculate RD functions |
---|
64 | Double TComRdCost::calcRdCost( UInt uiBits, UInt uiDistortion, Bool bFlag, DFunc eDFunc ) |
---|
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 | |
---|
88 | #if HHI_INTERVIEW_SKIP_LAMBDA_SCALE |
---|
89 | dLambda = m_dLambdaScale * dLambda ; |
---|
90 | #endif |
---|
91 | if (bFlag) |
---|
92 | { |
---|
93 | // Intra8x8, Intra4x4 Block only... |
---|
94 | #if LOSSLESS_CODING && SEQUENCE_LEVEL_LOSSLESS |
---|
95 | dRdCost = (Double)(uiBits); |
---|
96 | #else |
---|
97 | dRdCost = (((Double)uiDistortion) + ((Double)uiBits * dLambda)); |
---|
98 | #endif |
---|
99 | } |
---|
100 | else |
---|
101 | { |
---|
102 | if (eDFunc == DF_SAD) |
---|
103 | { |
---|
104 | dRdCost = ((Double)uiDistortion + (Double)((Int)(uiBits * dLambda+.5)>>16)); |
---|
105 | dRdCost = (Double)(UInt)floor(dRdCost); |
---|
106 | } |
---|
107 | else |
---|
108 | { |
---|
109 | #if LOSSLESS_CODING && SEQUENCE_LEVEL_LOSSLESS |
---|
110 | dRdCost = (Double)(uiBits); |
---|
111 | #else |
---|
112 | dRdCost = ((Double)uiDistortion + (Double)((Int)(uiBits * dLambda+.5))); |
---|
113 | dRdCost = (Double)(UInt)floor(dRdCost); |
---|
114 | #endif |
---|
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... |
---|
148 | #if LOSSLESS_CODING && SEQUENCE_LEVEL_LOSSLESS |
---|
149 | dRdCost = (Double)(uiBits); |
---|
150 | #else |
---|
151 | dRdCost = (((Double)(Int64)uiDistortion) + ((Double)(Int64)uiBits * dLambda)); |
---|
152 | #endif |
---|
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 | { |
---|
163 | #if LOSSLESS_CODING && SEQUENCE_LEVEL_LOSSLESS |
---|
164 | dRdCost = (Double)(uiBits); |
---|
165 | #else |
---|
166 | dRdCost = ((Double)(Int64)uiDistortion + (Double)((Int)((Int64)uiBits * dLambda+.5))); |
---|
167 | dRdCost = (Double)(UInt)floor(dRdCost); |
---|
168 | #endif |
---|
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 | |
---|
183 | #if HHI_INTER_VIEW_MOTION_PRED |
---|
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 | } |
---|
190 | #endif |
---|
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 | |
---|
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; |
---|
220 | |
---|
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 |
---|
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 | |
---|
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 | |
---|
248 | #if !FIX203 |
---|
249 | m_puiComponentCostOriginP = NULL; |
---|
250 | m_puiComponentCost = NULL; |
---|
251 | m_puiVerCost = NULL; |
---|
252 | m_puiHorCost = NULL; |
---|
253 | #endif |
---|
254 | m_uiCost = 0; |
---|
255 | m_iCostScale = 0; |
---|
256 | #if !FIX203 |
---|
257 | m_iSearchLimit = 0xdeaddead; |
---|
258 | |
---|
259 | #if HHI_VSO |
---|
260 | m_apRefPics = NULL; |
---|
261 | m_paaiShiftLUTs = NULL; |
---|
262 | m_uiNumberRefPics = 0; |
---|
263 | m_bUseVSO = false; |
---|
264 | #if SAIT_VSO_EST_A0033 |
---|
265 | m_bUseEstimatedVSD = false; |
---|
266 | #endif |
---|
267 | m_uiVSOMode = 0; |
---|
268 | m_fpDistortFuncVSO = NULL; |
---|
269 | m_pcRenModel = NULL; |
---|
270 | #endif |
---|
271 | |
---|
272 | #if HHI_INTERVIEW_SKIP_LAMBDA_SCALE |
---|
273 | m_dLambdaScale = 1; |
---|
274 | #endif |
---|
275 | #endif |
---|
276 | } |
---|
277 | |
---|
278 | #if !FIX203 |
---|
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 | |
---|
291 | m_puiComponentCostOriginP = new UInt[ 4 * iSubPelSearchLimit ]; |
---|
292 | m_puiMultiviewRegCostHorOrgP = new UInt[ 4 * iSubPelSearchLimit ]; |
---|
293 | m_puiMultiviewRegCostVerOrgP = new UInt[ 4 * iSubPelSearchLimit ]; |
---|
294 | |
---|
295 | iSubPelSearchLimit *= 2; |
---|
296 | |
---|
297 | m_puiComponentCost = m_puiComponentCostOriginP + iSubPelSearchLimit; |
---|
298 | |
---|
299 | m_puiMultiviewRegCostHor = m_puiMultiviewRegCostHorOrgP + iSubPelSearchLimit; |
---|
300 | m_puiMultiviewRegCostVer = m_puiMultiviewRegCostVerOrgP + iSubPelSearchLimit; |
---|
301 | |
---|
302 | |
---|
303 | for( Int n = -iSubPelSearchLimit; n < iSubPelSearchLimit; n++) |
---|
304 | { |
---|
305 | m_puiComponentCost[n] = xGetComponentBits( n ); |
---|
306 | m_puiMultiviewRegCostHor[n] = xGetComponentBits( n ); // first version |
---|
307 | m_puiMultiviewRegCostVer[n] = xGetComponentBits( n ); // first version |
---|
308 | } |
---|
309 | } |
---|
310 | } |
---|
311 | |
---|
312 | Void TComRdCost::xUninit() |
---|
313 | { |
---|
314 | if( NULL != m_puiComponentCostOriginP ) |
---|
315 | { |
---|
316 | delete [] m_puiComponentCostOriginP; |
---|
317 | m_puiComponentCostOriginP = NULL; |
---|
318 | } |
---|
319 | |
---|
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 | } |
---|
330 | } |
---|
331 | #endif |
---|
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; |
---|
358 | #if HHI_INTERVIEW_SKIP |
---|
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 | |
---|
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 | |
---|
394 | // initialize |
---|
395 | rcDistParam.iSubShift = 0; |
---|
396 | #if HHI_INTERVIEW_SKIP |
---|
397 | rcDistParam.pUsed = 0; |
---|
398 | rcDistParam.iStrideUsed = 0; |
---|
399 | #endif |
---|
400 | } |
---|
401 | |
---|
402 | // Setting the Distortion Parameter for Inter (subpel ME with step) |
---|
403 | #if NS_HAD |
---|
404 | Void TComRdCost::setDistParam( TComPattern* pcPatternKey, Pel* piRefY, Int iRefStride, Int iStep, DistParam& rcDistParam, Bool bHADME, Bool bUseNSHAD ) |
---|
405 | #else |
---|
406 | Void TComRdCost::setDistParam( TComPattern* pcPatternKey, Pel* piRefY, Int iRefStride, Int iStep, DistParam& rcDistParam, Bool bHADME ) |
---|
407 | #endif |
---|
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(); |
---|
422 | #if NS_HAD |
---|
423 | rcDistParam.bUseNSHAD = bUseNSHAD; |
---|
424 | #endif |
---|
425 | |
---|
426 | // set distortion function |
---|
427 | if ( !bHADME ) |
---|
428 | { |
---|
429 | rcDistParam.DistFunc = m_afpDistortFunc[DF_SADS + g_aucConvertToBit[ rcDistParam.iCols ] + 1 ]; |
---|
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 |
---|
444 | } |
---|
445 | else |
---|
446 | { |
---|
447 | rcDistParam.DistFunc = m_afpDistortFunc[DF_HADS + g_aucConvertToBit[ rcDistParam.iCols ] + 1 ]; |
---|
448 | } |
---|
449 | |
---|
450 | // initialize |
---|
451 | rcDistParam.iSubShift = 0; |
---|
452 | #if HHI_INTERVIEW_SKIP |
---|
453 | rcDistParam.pUsed = 0; |
---|
454 | rcDistParam.iStrideUsed = 0; |
---|
455 | #endif |
---|
456 | } |
---|
457 | |
---|
458 | Void |
---|
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 |
---|
462 | TComRdCost::setDistParam( DistParam& rcDP, Pel* p1, Int iStride1, Pel* p2, Int iStride2, Int iWidth, Int iHeight, Bool bHadamard ) |
---|
463 | #endif |
---|
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 ]; |
---|
474 | #if HHI_INTERVIEW_SKIP |
---|
475 | rcDP.pUsed = 0; |
---|
476 | rcDP.iStrideUsed = 0; |
---|
477 | #endif |
---|
478 | #if NS_HAD |
---|
479 | rcDP.bUseNSHAD = bUseNSHAD; |
---|
480 | #endif |
---|
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 | } |
---|
527 | #if HHI_INTERVIEW_SKIP |
---|
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 | #if LGE_ILLUCOMP_B0045 |
---|
546 | cDtParam.bUseIC = false; |
---|
547 | #endif |
---|
548 | return cDtParam.DistFunc( &cDtParam ); |
---|
549 | } |
---|
550 | #endif |
---|
551 | |
---|
552 | #if WEIGHTED_CHROMA_DISTORTION |
---|
553 | UInt TComRdCost::getDistPart( Pel* piCur, Int iCurStride, Pel* piOrg, Int iOrgStride, UInt uiBlkWidth, UInt uiBlkHeight, Bool bWeighted, DFunc eDFunc ) |
---|
554 | #else |
---|
555 | UInt TComRdCost::getDistPart( Pel* piCur, Int iCurStride, Pel* piOrg, Int iOrgStride, UInt uiBlkWidth, UInt uiBlkHeight, DFunc eDFunc ) |
---|
556 | #endif |
---|
557 | { |
---|
558 | DistParam cDtParam; |
---|
559 | setDistParam( uiBlkWidth, uiBlkHeight, eDFunc, cDtParam ); |
---|
560 | cDtParam.pOrg = piOrg; |
---|
561 | cDtParam.pCur = piCur; |
---|
562 | cDtParam.iStrideOrg = iOrgStride; |
---|
563 | cDtParam.iStrideCur = iCurStride; |
---|
564 | cDtParam.iStep = 1; |
---|
565 | |
---|
566 | cDtParam.bApplyWeight = false; |
---|
567 | cDtParam.uiComp = 255; // just for assert: to be sure it was set before use, since only values 0,1 or 2 are allowed. |
---|
568 | |
---|
569 | #if WEIGHTED_CHROMA_DISTORTION |
---|
570 | #if LGE_ILLUCOMP_B0045 |
---|
571 | cDtParam.bUseIC = false; |
---|
572 | #endif |
---|
573 | if (bWeighted) |
---|
574 | { |
---|
575 | return ((int) (m_chromaDistortionWeight * cDtParam.DistFunc( &cDtParam ))); |
---|
576 | } |
---|
577 | else |
---|
578 | { |
---|
579 | return cDtParam.DistFunc( &cDtParam ); |
---|
580 | } |
---|
581 | #else |
---|
582 | return cDtParam.DistFunc( &cDtParam ); |
---|
583 | #endif |
---|
584 | } |
---|
585 | |
---|
586 | |
---|
587 | #if SAIT_VSO_EST_A0033 |
---|
588 | UInt TComRdCost::getDistPart( Pel* piCur, Int iCurStride, Pel* piOrg, Int iOrgStride, Pel* piVirRec, Pel* piVirOrg, Int iVirStride, UInt uiBlkWidth, UInt uiBlkHeight, DFunc eDFunc ) |
---|
589 | { |
---|
590 | AOT( ( m_dDisparityCoeff <= 0 ) || ( m_dDisparityCoeff > 10 ) ); |
---|
591 | |
---|
592 | DistParam cDtParam; |
---|
593 | setDistParam( uiBlkWidth, uiBlkHeight, eDFunc, cDtParam ); |
---|
594 | cDtParam.pOrg = piOrg; |
---|
595 | cDtParam.pCur = piCur; |
---|
596 | cDtParam.pVirRec = piVirRec; |
---|
597 | cDtParam.pVirOrg = piVirOrg; |
---|
598 | cDtParam.iStrideVir = iVirStride; |
---|
599 | cDtParam.iStrideOrg = iOrgStride; |
---|
600 | cDtParam.iStrideCur = iCurStride; |
---|
601 | cDtParam.iStep = 1; |
---|
602 | |
---|
603 | cDtParam.bApplyWeight = false; |
---|
604 | cDtParam.uiComp = 255; // just for assert: to be sure it was set before use, since only values 0,1 or 2 are allowed. |
---|
605 | |
---|
606 | #if LGE_ILLUCOMP_B0045 |
---|
607 | cDtParam.bUseIC = false; |
---|
608 | #endif |
---|
609 | return cDtParam.DistFunc( &cDtParam ); |
---|
610 | } |
---|
611 | #endif |
---|
612 | |
---|
613 | UInt TComRdCost::xGetSAD( DistParam* pcDtParam ) |
---|
614 | { |
---|
615 | if ( pcDtParam->bApplyWeight ) |
---|
616 | { |
---|
617 | return xGetSADw( pcDtParam ); |
---|
618 | } |
---|
619 | #if LGE_ILLUCOMP_B0045 |
---|
620 | if(pcDtParam->bUseIC) |
---|
621 | { |
---|
622 | return xGetSADic( pcDtParam ); |
---|
623 | } |
---|
624 | #endif |
---|
625 | Pel* piOrg = pcDtParam->pOrg; |
---|
626 | Pel* piCur = pcDtParam->pCur; |
---|
627 | Int iRows = pcDtParam->iRows; |
---|
628 | Int iCols = pcDtParam->iCols; |
---|
629 | Int iStrideCur = pcDtParam->iStrideCur; |
---|
630 | Int iStrideOrg = pcDtParam->iStrideOrg; |
---|
631 | |
---|
632 | UInt uiSum = 0; |
---|
633 | |
---|
634 | for( ; iRows != 0; iRows-- ) |
---|
635 | { |
---|
636 | for (Int n = 0; n < iCols; n++ ) |
---|
637 | { |
---|
638 | uiSum += abs( piOrg[n] - piCur[n] ); |
---|
639 | } |
---|
640 | piOrg += iStrideOrg; |
---|
641 | piCur += iStrideCur; |
---|
642 | } |
---|
643 | |
---|
644 | return ( uiSum >> g_uiBitIncrement ); |
---|
645 | } |
---|
646 | |
---|
647 | UInt TComRdCost::xGetSAD4( DistParam* pcDtParam ) |
---|
648 | { |
---|
649 | if ( pcDtParam->bApplyWeight ) |
---|
650 | { |
---|
651 | return xGetSADw( pcDtParam ); |
---|
652 | } |
---|
653 | #if LGE_ILLUCOMP_B0045 |
---|
654 | if(pcDtParam->bUseIC) |
---|
655 | { |
---|
656 | return xGetSAD4ic( pcDtParam ); |
---|
657 | } |
---|
658 | #endif |
---|
659 | Pel* piOrg = pcDtParam->pOrg; |
---|
660 | Pel* piCur = pcDtParam->pCur; |
---|
661 | Int iRows = pcDtParam->iRows; |
---|
662 | Int iSubShift = pcDtParam->iSubShift; |
---|
663 | Int iSubStep = ( 1 << iSubShift ); |
---|
664 | Int iStrideCur = pcDtParam->iStrideCur*iSubStep; |
---|
665 | Int iStrideOrg = pcDtParam->iStrideOrg*iSubStep; |
---|
666 | |
---|
667 | UInt uiSum = 0; |
---|
668 | |
---|
669 | for( ; iRows != 0; iRows-=iSubStep ) |
---|
670 | { |
---|
671 | uiSum += abs( piOrg[0] - piCur[0] ); |
---|
672 | uiSum += abs( piOrg[1] - piCur[1] ); |
---|
673 | uiSum += abs( piOrg[2] - piCur[2] ); |
---|
674 | uiSum += abs( piOrg[3] - piCur[3] ); |
---|
675 | |
---|
676 | piOrg += iStrideOrg; |
---|
677 | piCur += iStrideCur; |
---|
678 | } |
---|
679 | |
---|
680 | uiSum <<= iSubShift; |
---|
681 | return ( uiSum >> g_uiBitIncrement ); |
---|
682 | } |
---|
683 | |
---|
684 | UInt TComRdCost::xGetSAD8( DistParam* pcDtParam ) |
---|
685 | { |
---|
686 | if ( pcDtParam->bApplyWeight ) |
---|
687 | { |
---|
688 | return xGetSADw( pcDtParam ); |
---|
689 | } |
---|
690 | #if LGE_ILLUCOMP_B0045 |
---|
691 | if(pcDtParam->bUseIC) |
---|
692 | { |
---|
693 | return xGetSAD8ic( pcDtParam ); |
---|
694 | } |
---|
695 | #endif |
---|
696 | Pel* piOrg = pcDtParam->pOrg; |
---|
697 | Pel* piCur = pcDtParam->pCur; |
---|
698 | Int iRows = pcDtParam->iRows; |
---|
699 | Int iSubShift = pcDtParam->iSubShift; |
---|
700 | Int iSubStep = ( 1 << iSubShift ); |
---|
701 | Int iStrideCur = pcDtParam->iStrideCur*iSubStep; |
---|
702 | Int iStrideOrg = pcDtParam->iStrideOrg*iSubStep; |
---|
703 | |
---|
704 | UInt uiSum = 0; |
---|
705 | |
---|
706 | for( ; iRows != 0; iRows-=iSubStep ) |
---|
707 | { |
---|
708 | uiSum += abs( piOrg[0] - piCur[0] ); |
---|
709 | uiSum += abs( piOrg[1] - piCur[1] ); |
---|
710 | uiSum += abs( piOrg[2] - piCur[2] ); |
---|
711 | uiSum += abs( piOrg[3] - piCur[3] ); |
---|
712 | uiSum += abs( piOrg[4] - piCur[4] ); |
---|
713 | uiSum += abs( piOrg[5] - piCur[5] ); |
---|
714 | uiSum += abs( piOrg[6] - piCur[6] ); |
---|
715 | uiSum += abs( piOrg[7] - piCur[7] ); |
---|
716 | |
---|
717 | piOrg += iStrideOrg; |
---|
718 | piCur += iStrideCur; |
---|
719 | } |
---|
720 | |
---|
721 | uiSum <<= iSubShift; |
---|
722 | return ( uiSum >> g_uiBitIncrement ); |
---|
723 | } |
---|
724 | |
---|
725 | UInt TComRdCost::xGetSAD16( DistParam* pcDtParam ) |
---|
726 | { |
---|
727 | if ( pcDtParam->bApplyWeight ) |
---|
728 | { |
---|
729 | return xGetSADw( pcDtParam ); |
---|
730 | } |
---|
731 | #if LGE_ILLUCOMP_B0045 |
---|
732 | if(pcDtParam->bUseIC) |
---|
733 | { |
---|
734 | return xGetSAD16ic( pcDtParam ); |
---|
735 | } |
---|
736 | #endif |
---|
737 | Pel* piOrg = pcDtParam->pOrg; |
---|
738 | Pel* piCur = pcDtParam->pCur; |
---|
739 | Int iRows = pcDtParam->iRows; |
---|
740 | Int iSubShift = pcDtParam->iSubShift; |
---|
741 | Int iSubStep = ( 1 << iSubShift ); |
---|
742 | Int iStrideCur = pcDtParam->iStrideCur*iSubStep; |
---|
743 | Int iStrideOrg = pcDtParam->iStrideOrg*iSubStep; |
---|
744 | |
---|
745 | UInt uiSum = 0; |
---|
746 | |
---|
747 | for( ; iRows != 0; iRows-=iSubStep ) |
---|
748 | { |
---|
749 | uiSum += abs( piOrg[0] - piCur[0] ); |
---|
750 | uiSum += abs( piOrg[1] - piCur[1] ); |
---|
751 | uiSum += abs( piOrg[2] - piCur[2] ); |
---|
752 | uiSum += abs( piOrg[3] - piCur[3] ); |
---|
753 | uiSum += abs( piOrg[4] - piCur[4] ); |
---|
754 | uiSum += abs( piOrg[5] - piCur[5] ); |
---|
755 | uiSum += abs( piOrg[6] - piCur[6] ); |
---|
756 | uiSum += abs( piOrg[7] - piCur[7] ); |
---|
757 | uiSum += abs( piOrg[8] - piCur[8] ); |
---|
758 | uiSum += abs( piOrg[9] - piCur[9] ); |
---|
759 | uiSum += abs( piOrg[10] - piCur[10] ); |
---|
760 | uiSum += abs( piOrg[11] - piCur[11] ); |
---|
761 | uiSum += abs( piOrg[12] - piCur[12] ); |
---|
762 | uiSum += abs( piOrg[13] - piCur[13] ); |
---|
763 | uiSum += abs( piOrg[14] - piCur[14] ); |
---|
764 | uiSum += abs( piOrg[15] - piCur[15] ); |
---|
765 | |
---|
766 | piOrg += iStrideOrg; |
---|
767 | piCur += iStrideCur; |
---|
768 | } |
---|
769 | |
---|
770 | uiSum <<= iSubShift; |
---|
771 | return ( uiSum >> g_uiBitIncrement ); |
---|
772 | } |
---|
773 | |
---|
774 | #if AMP_SAD |
---|
775 | UInt TComRdCost::xGetSAD12( DistParam* pcDtParam ) |
---|
776 | { |
---|
777 | if ( pcDtParam->bApplyWeight ) |
---|
778 | { |
---|
779 | return xGetSADw( pcDtParam ); |
---|
780 | } |
---|
781 | #if LGE_ILLUCOMP_B0045 |
---|
782 | if(pcDtParam->bUseIC) |
---|
783 | { |
---|
784 | return xGetSAD12ic( pcDtParam ); |
---|
785 | } |
---|
786 | #endif |
---|
787 | Pel* piOrg = pcDtParam->pOrg; |
---|
788 | Pel* piCur = pcDtParam->pCur; |
---|
789 | Int iRows = pcDtParam->iRows; |
---|
790 | Int iSubShift = pcDtParam->iSubShift; |
---|
791 | Int iSubStep = ( 1 << iSubShift ); |
---|
792 | Int iStrideCur = pcDtParam->iStrideCur*iSubStep; |
---|
793 | Int iStrideOrg = pcDtParam->iStrideOrg*iSubStep; |
---|
794 | |
---|
795 | UInt uiSum = 0; |
---|
796 | |
---|
797 | for( ; iRows != 0; iRows-=iSubStep ) |
---|
798 | { |
---|
799 | uiSum += abs( piOrg[0] - piCur[0] ); |
---|
800 | uiSum += abs( piOrg[1] - piCur[1] ); |
---|
801 | uiSum += abs( piOrg[2] - piCur[2] ); |
---|
802 | uiSum += abs( piOrg[3] - piCur[3] ); |
---|
803 | uiSum += abs( piOrg[4] - piCur[4] ); |
---|
804 | uiSum += abs( piOrg[5] - piCur[5] ); |
---|
805 | uiSum += abs( piOrg[6] - piCur[6] ); |
---|
806 | uiSum += abs( piOrg[7] - piCur[7] ); |
---|
807 | uiSum += abs( piOrg[8] - piCur[8] ); |
---|
808 | uiSum += abs( piOrg[9] - piCur[9] ); |
---|
809 | uiSum += abs( piOrg[10] - piCur[10] ); |
---|
810 | uiSum += abs( piOrg[11] - piCur[11] ); |
---|
811 | |
---|
812 | piOrg += iStrideOrg; |
---|
813 | piCur += iStrideCur; |
---|
814 | } |
---|
815 | |
---|
816 | uiSum <<= iSubShift; |
---|
817 | return ( uiSum >> g_uiBitIncrement ); |
---|
818 | } |
---|
819 | #endif |
---|
820 | |
---|
821 | UInt TComRdCost::xGetSAD16N( DistParam* pcDtParam ) |
---|
822 | { |
---|
823 | #if LGE_ILLUCOMP_B0045 |
---|
824 | if(pcDtParam->bUseIC) |
---|
825 | { |
---|
826 | return xGetSAD16Nic( pcDtParam ); |
---|
827 | } |
---|
828 | #endif |
---|
829 | Pel* piOrg = pcDtParam->pOrg; |
---|
830 | Pel* piCur = pcDtParam->pCur; |
---|
831 | Int iRows = pcDtParam->iRows; |
---|
832 | Int iCols = pcDtParam->iCols; |
---|
833 | Int iSubShift = pcDtParam->iSubShift; |
---|
834 | Int iSubStep = ( 1 << iSubShift ); |
---|
835 | Int iStrideCur = pcDtParam->iStrideCur*iSubStep; |
---|
836 | Int iStrideOrg = pcDtParam->iStrideOrg*iSubStep; |
---|
837 | |
---|
838 | UInt uiSum = 0; |
---|
839 | |
---|
840 | for( ; iRows != 0; iRows-=iSubStep ) |
---|
841 | { |
---|
842 | for (Int n = 0; n < iCols; n+=16 ) |
---|
843 | { |
---|
844 | uiSum += abs( piOrg[n+ 0] - piCur[n+ 0] ); |
---|
845 | uiSum += abs( piOrg[n+ 1] - piCur[n+ 1] ); |
---|
846 | uiSum += abs( piOrg[n+ 2] - piCur[n+ 2] ); |
---|
847 | uiSum += abs( piOrg[n+ 3] - piCur[n+ 3] ); |
---|
848 | uiSum += abs( piOrg[n+ 4] - piCur[n+ 4] ); |
---|
849 | uiSum += abs( piOrg[n+ 5] - piCur[n+ 5] ); |
---|
850 | uiSum += abs( piOrg[n+ 6] - piCur[n+ 6] ); |
---|
851 | uiSum += abs( piOrg[n+ 7] - piCur[n+ 7] ); |
---|
852 | uiSum += abs( piOrg[n+ 8] - piCur[n+ 8] ); |
---|
853 | uiSum += abs( piOrg[n+ 9] - piCur[n+ 9] ); |
---|
854 | uiSum += abs( piOrg[n+10] - piCur[n+10] ); |
---|
855 | uiSum += abs( piOrg[n+11] - piCur[n+11] ); |
---|
856 | uiSum += abs( piOrg[n+12] - piCur[n+12] ); |
---|
857 | uiSum += abs( piOrg[n+13] - piCur[n+13] ); |
---|
858 | uiSum += abs( piOrg[n+14] - piCur[n+14] ); |
---|
859 | uiSum += abs( piOrg[n+15] - piCur[n+15] ); |
---|
860 | } |
---|
861 | piOrg += iStrideOrg; |
---|
862 | piCur += iStrideCur; |
---|
863 | } |
---|
864 | |
---|
865 | uiSum <<= iSubShift; |
---|
866 | return ( uiSum >> g_uiBitIncrement ); |
---|
867 | } |
---|
868 | |
---|
869 | UInt TComRdCost::xGetSAD32( DistParam* pcDtParam ) |
---|
870 | { |
---|
871 | if ( pcDtParam->bApplyWeight ) |
---|
872 | { |
---|
873 | return xGetSADw( pcDtParam ); |
---|
874 | } |
---|
875 | #if LGE_ILLUCOMP_B0045 |
---|
876 | if(pcDtParam->bUseIC) |
---|
877 | { |
---|
878 | return xGetSAD32ic( pcDtParam ); |
---|
879 | } |
---|
880 | #endif |
---|
881 | Pel* piOrg = pcDtParam->pOrg; |
---|
882 | Pel* piCur = pcDtParam->pCur; |
---|
883 | Int iRows = pcDtParam->iRows; |
---|
884 | Int iSubShift = pcDtParam->iSubShift; |
---|
885 | Int iSubStep = ( 1 << iSubShift ); |
---|
886 | Int iStrideCur = pcDtParam->iStrideCur*iSubStep; |
---|
887 | Int iStrideOrg = pcDtParam->iStrideOrg*iSubStep; |
---|
888 | |
---|
889 | UInt uiSum = 0; |
---|
890 | |
---|
891 | for( ; iRows != 0; iRows-=iSubStep ) |
---|
892 | { |
---|
893 | uiSum += abs( piOrg[0] - piCur[0] ); |
---|
894 | uiSum += abs( piOrg[1] - piCur[1] ); |
---|
895 | uiSum += abs( piOrg[2] - piCur[2] ); |
---|
896 | uiSum += abs( piOrg[3] - piCur[3] ); |
---|
897 | uiSum += abs( piOrg[4] - piCur[4] ); |
---|
898 | uiSum += abs( piOrg[5] - piCur[5] ); |
---|
899 | uiSum += abs( piOrg[6] - piCur[6] ); |
---|
900 | uiSum += abs( piOrg[7] - piCur[7] ); |
---|
901 | uiSum += abs( piOrg[8] - piCur[8] ); |
---|
902 | uiSum += abs( piOrg[9] - piCur[9] ); |
---|
903 | uiSum += abs( piOrg[10] - piCur[10] ); |
---|
904 | uiSum += abs( piOrg[11] - piCur[11] ); |
---|
905 | uiSum += abs( piOrg[12] - piCur[12] ); |
---|
906 | uiSum += abs( piOrg[13] - piCur[13] ); |
---|
907 | uiSum += abs( piOrg[14] - piCur[14] ); |
---|
908 | uiSum += abs( piOrg[15] - piCur[15] ); |
---|
909 | uiSum += abs( piOrg[16] - piCur[16] ); |
---|
910 | uiSum += abs( piOrg[17] - piCur[17] ); |
---|
911 | uiSum += abs( piOrg[18] - piCur[18] ); |
---|
912 | uiSum += abs( piOrg[19] - piCur[19] ); |
---|
913 | uiSum += abs( piOrg[20] - piCur[20] ); |
---|
914 | uiSum += abs( piOrg[21] - piCur[21] ); |
---|
915 | uiSum += abs( piOrg[22] - piCur[22] ); |
---|
916 | uiSum += abs( piOrg[23] - piCur[23] ); |
---|
917 | uiSum += abs( piOrg[24] - piCur[24] ); |
---|
918 | uiSum += abs( piOrg[25] - piCur[25] ); |
---|
919 | uiSum += abs( piOrg[26] - piCur[26] ); |
---|
920 | uiSum += abs( piOrg[27] - piCur[27] ); |
---|
921 | uiSum += abs( piOrg[28] - piCur[28] ); |
---|
922 | uiSum += abs( piOrg[29] - piCur[29] ); |
---|
923 | uiSum += abs( piOrg[30] - piCur[30] ); |
---|
924 | uiSum += abs( piOrg[31] - piCur[31] ); |
---|
925 | |
---|
926 | piOrg += iStrideOrg; |
---|
927 | piCur += iStrideCur; |
---|
928 | } |
---|
929 | |
---|
930 | uiSum <<= iSubShift; |
---|
931 | return ( uiSum >> g_uiBitIncrement ); |
---|
932 | } |
---|
933 | |
---|
934 | #if AMP_SAD |
---|
935 | UInt TComRdCost::xGetSAD24( DistParam* pcDtParam ) |
---|
936 | { |
---|
937 | if ( pcDtParam->bApplyWeight ) |
---|
938 | { |
---|
939 | return xGetSADw( pcDtParam ); |
---|
940 | } |
---|
941 | #if LGE_ILLUCOMP_B0045 |
---|
942 | if(pcDtParam->bUseIC) |
---|
943 | { |
---|
944 | return xGetSAD24ic( pcDtParam ); |
---|
945 | } |
---|
946 | #endif |
---|
947 | Pel* piOrg = pcDtParam->pOrg; |
---|
948 | Pel* piCur = pcDtParam->pCur; |
---|
949 | Int iRows = pcDtParam->iRows; |
---|
950 | Int iSubShift = pcDtParam->iSubShift; |
---|
951 | Int iSubStep = ( 1 << iSubShift ); |
---|
952 | Int iStrideCur = pcDtParam->iStrideCur*iSubStep; |
---|
953 | Int iStrideOrg = pcDtParam->iStrideOrg*iSubStep; |
---|
954 | |
---|
955 | UInt uiSum = 0; |
---|
956 | |
---|
957 | for( ; iRows != 0; iRows-=iSubStep ) |
---|
958 | { |
---|
959 | uiSum += abs( piOrg[0] - piCur[0] ); |
---|
960 | uiSum += abs( piOrg[1] - piCur[1] ); |
---|
961 | uiSum += abs( piOrg[2] - piCur[2] ); |
---|
962 | uiSum += abs( piOrg[3] - piCur[3] ); |
---|
963 | uiSum += abs( piOrg[4] - piCur[4] ); |
---|
964 | uiSum += abs( piOrg[5] - piCur[5] ); |
---|
965 | uiSum += abs( piOrg[6] - piCur[6] ); |
---|
966 | uiSum += abs( piOrg[7] - piCur[7] ); |
---|
967 | uiSum += abs( piOrg[8] - piCur[8] ); |
---|
968 | uiSum += abs( piOrg[9] - piCur[9] ); |
---|
969 | uiSum += abs( piOrg[10] - piCur[10] ); |
---|
970 | uiSum += abs( piOrg[11] - piCur[11] ); |
---|
971 | uiSum += abs( piOrg[12] - piCur[12] ); |
---|
972 | uiSum += abs( piOrg[13] - piCur[13] ); |
---|
973 | uiSum += abs( piOrg[14] - piCur[14] ); |
---|
974 | uiSum += abs( piOrg[15] - piCur[15] ); |
---|
975 | uiSum += abs( piOrg[16] - piCur[16] ); |
---|
976 | uiSum += abs( piOrg[17] - piCur[17] ); |
---|
977 | uiSum += abs( piOrg[18] - piCur[18] ); |
---|
978 | uiSum += abs( piOrg[19] - piCur[19] ); |
---|
979 | uiSum += abs( piOrg[20] - piCur[20] ); |
---|
980 | uiSum += abs( piOrg[21] - piCur[21] ); |
---|
981 | uiSum += abs( piOrg[22] - piCur[22] ); |
---|
982 | uiSum += abs( piOrg[23] - piCur[23] ); |
---|
983 | |
---|
984 | piOrg += iStrideOrg; |
---|
985 | piCur += iStrideCur; |
---|
986 | } |
---|
987 | |
---|
988 | uiSum <<= iSubShift; |
---|
989 | return ( uiSum >> g_uiBitIncrement ); |
---|
990 | } |
---|
991 | |
---|
992 | #endif |
---|
993 | |
---|
994 | UInt TComRdCost::xGetSAD64( DistParam* pcDtParam ) |
---|
995 | { |
---|
996 | if ( pcDtParam->bApplyWeight ) |
---|
997 | { |
---|
998 | return xGetSADw( pcDtParam ); |
---|
999 | } |
---|
1000 | #if LGE_ILLUCOMP_B0045 |
---|
1001 | if(pcDtParam->bUseIC) |
---|
1002 | { |
---|
1003 | return xGetSAD64ic( pcDtParam ); |
---|
1004 | } |
---|
1005 | #endif |
---|
1006 | Pel* piOrg = pcDtParam->pOrg; |
---|
1007 | Pel* piCur = pcDtParam->pCur; |
---|
1008 | Int iRows = pcDtParam->iRows; |
---|
1009 | Int iSubShift = pcDtParam->iSubShift; |
---|
1010 | Int iSubStep = ( 1 << iSubShift ); |
---|
1011 | Int iStrideCur = pcDtParam->iStrideCur*iSubStep; |
---|
1012 | Int iStrideOrg = pcDtParam->iStrideOrg*iSubStep; |
---|
1013 | |
---|
1014 | UInt uiSum = 0; |
---|
1015 | |
---|
1016 | for( ; iRows != 0; iRows-=iSubStep ) |
---|
1017 | { |
---|
1018 | uiSum += abs( piOrg[0] - piCur[0] ); |
---|
1019 | uiSum += abs( piOrg[1] - piCur[1] ); |
---|
1020 | uiSum += abs( piOrg[2] - piCur[2] ); |
---|
1021 | uiSum += abs( piOrg[3] - piCur[3] ); |
---|
1022 | uiSum += abs( piOrg[4] - piCur[4] ); |
---|
1023 | uiSum += abs( piOrg[5] - piCur[5] ); |
---|
1024 | uiSum += abs( piOrg[6] - piCur[6] ); |
---|
1025 | uiSum += abs( piOrg[7] - piCur[7] ); |
---|
1026 | uiSum += abs( piOrg[8] - piCur[8] ); |
---|
1027 | uiSum += abs( piOrg[9] - piCur[9] ); |
---|
1028 | uiSum += abs( piOrg[10] - piCur[10] ); |
---|
1029 | uiSum += abs( piOrg[11] - piCur[11] ); |
---|
1030 | uiSum += abs( piOrg[12] - piCur[12] ); |
---|
1031 | uiSum += abs( piOrg[13] - piCur[13] ); |
---|
1032 | uiSum += abs( piOrg[14] - piCur[14] ); |
---|
1033 | uiSum += abs( piOrg[15] - piCur[15] ); |
---|
1034 | uiSum += abs( piOrg[16] - piCur[16] ); |
---|
1035 | uiSum += abs( piOrg[17] - piCur[17] ); |
---|
1036 | uiSum += abs( piOrg[18] - piCur[18] ); |
---|
1037 | uiSum += abs( piOrg[19] - piCur[19] ); |
---|
1038 | uiSum += abs( piOrg[20] - piCur[20] ); |
---|
1039 | uiSum += abs( piOrg[21] - piCur[21] ); |
---|
1040 | uiSum += abs( piOrg[22] - piCur[22] ); |
---|
1041 | uiSum += abs( piOrg[23] - piCur[23] ); |
---|
1042 | uiSum += abs( piOrg[24] - piCur[24] ); |
---|
1043 | uiSum += abs( piOrg[25] - piCur[25] ); |
---|
1044 | uiSum += abs( piOrg[26] - piCur[26] ); |
---|
1045 | uiSum += abs( piOrg[27] - piCur[27] ); |
---|
1046 | uiSum += abs( piOrg[28] - piCur[28] ); |
---|
1047 | uiSum += abs( piOrg[29] - piCur[29] ); |
---|
1048 | uiSum += abs( piOrg[30] - piCur[30] ); |
---|
1049 | uiSum += abs( piOrg[31] - piCur[31] ); |
---|
1050 | uiSum += abs( piOrg[32] - piCur[32] ); |
---|
1051 | uiSum += abs( piOrg[33] - piCur[33] ); |
---|
1052 | uiSum += abs( piOrg[34] - piCur[34] ); |
---|
1053 | uiSum += abs( piOrg[35] - piCur[35] ); |
---|
1054 | uiSum += abs( piOrg[36] - piCur[36] ); |
---|
1055 | uiSum += abs( piOrg[37] - piCur[37] ); |
---|
1056 | uiSum += abs( piOrg[38] - piCur[38] ); |
---|
1057 | uiSum += abs( piOrg[39] - piCur[39] ); |
---|
1058 | uiSum += abs( piOrg[40] - piCur[40] ); |
---|
1059 | uiSum += abs( piOrg[41] - piCur[41] ); |
---|
1060 | uiSum += abs( piOrg[42] - piCur[42] ); |
---|
1061 | uiSum += abs( piOrg[43] - piCur[43] ); |
---|
1062 | uiSum += abs( piOrg[44] - piCur[44] ); |
---|
1063 | uiSum += abs( piOrg[45] - piCur[45] ); |
---|
1064 | uiSum += abs( piOrg[46] - piCur[46] ); |
---|
1065 | uiSum += abs( piOrg[47] - piCur[47] ); |
---|
1066 | uiSum += abs( piOrg[48] - piCur[48] ); |
---|
1067 | uiSum += abs( piOrg[49] - piCur[49] ); |
---|
1068 | uiSum += abs( piOrg[50] - piCur[50] ); |
---|
1069 | uiSum += abs( piOrg[51] - piCur[51] ); |
---|
1070 | uiSum += abs( piOrg[52] - piCur[52] ); |
---|
1071 | uiSum += abs( piOrg[53] - piCur[53] ); |
---|
1072 | uiSum += abs( piOrg[54] - piCur[54] ); |
---|
1073 | uiSum += abs( piOrg[55] - piCur[55] ); |
---|
1074 | uiSum += abs( piOrg[56] - piCur[56] ); |
---|
1075 | uiSum += abs( piOrg[57] - piCur[57] ); |
---|
1076 | uiSum += abs( piOrg[58] - piCur[58] ); |
---|
1077 | uiSum += abs( piOrg[59] - piCur[59] ); |
---|
1078 | uiSum += abs( piOrg[60] - piCur[60] ); |
---|
1079 | uiSum += abs( piOrg[61] - piCur[61] ); |
---|
1080 | uiSum += abs( piOrg[62] - piCur[62] ); |
---|
1081 | uiSum += abs( piOrg[63] - piCur[63] ); |
---|
1082 | |
---|
1083 | piOrg += iStrideOrg; |
---|
1084 | piCur += iStrideCur; |
---|
1085 | } |
---|
1086 | |
---|
1087 | uiSum <<= iSubShift; |
---|
1088 | return ( uiSum >> g_uiBitIncrement ); |
---|
1089 | } |
---|
1090 | |
---|
1091 | #if AMP_SAD |
---|
1092 | UInt TComRdCost::xGetSAD48( DistParam* pcDtParam ) |
---|
1093 | { |
---|
1094 | if ( pcDtParam->bApplyWeight ) |
---|
1095 | { |
---|
1096 | return xGetSADw( pcDtParam ); |
---|
1097 | } |
---|
1098 | #if LGE_ILLUCOMP_B0045 |
---|
1099 | if(pcDtParam->bUseIC) |
---|
1100 | { |
---|
1101 | return xGetSAD48ic( pcDtParam ); |
---|
1102 | } |
---|
1103 | #endif |
---|
1104 | Pel* piOrg = pcDtParam->pOrg; |
---|
1105 | Pel* piCur = pcDtParam->pCur; |
---|
1106 | Int iRows = pcDtParam->iRows; |
---|
1107 | Int iSubShift = pcDtParam->iSubShift; |
---|
1108 | Int iSubStep = ( 1 << iSubShift ); |
---|
1109 | Int iStrideCur = pcDtParam->iStrideCur*iSubStep; |
---|
1110 | Int iStrideOrg = pcDtParam->iStrideOrg*iSubStep; |
---|
1111 | |
---|
1112 | UInt uiSum = 0; |
---|
1113 | |
---|
1114 | for( ; iRows != 0; iRows-=iSubStep ) |
---|
1115 | { |
---|
1116 | uiSum += abs( piOrg[0] - piCur[0] ); |
---|
1117 | uiSum += abs( piOrg[1] - piCur[1] ); |
---|
1118 | uiSum += abs( piOrg[2] - piCur[2] ); |
---|
1119 | uiSum += abs( piOrg[3] - piCur[3] ); |
---|
1120 | uiSum += abs( piOrg[4] - piCur[4] ); |
---|
1121 | uiSum += abs( piOrg[5] - piCur[5] ); |
---|
1122 | uiSum += abs( piOrg[6] - piCur[6] ); |
---|
1123 | uiSum += abs( piOrg[7] - piCur[7] ); |
---|
1124 | uiSum += abs( piOrg[8] - piCur[8] ); |
---|
1125 | uiSum += abs( piOrg[9] - piCur[9] ); |
---|
1126 | uiSum += abs( piOrg[10] - piCur[10] ); |
---|
1127 | uiSum += abs( piOrg[11] - piCur[11] ); |
---|
1128 | uiSum += abs( piOrg[12] - piCur[12] ); |
---|
1129 | uiSum += abs( piOrg[13] - piCur[13] ); |
---|
1130 | uiSum += abs( piOrg[14] - piCur[14] ); |
---|
1131 | uiSum += abs( piOrg[15] - piCur[15] ); |
---|
1132 | uiSum += abs( piOrg[16] - piCur[16] ); |
---|
1133 | uiSum += abs( piOrg[17] - piCur[17] ); |
---|
1134 | uiSum += abs( piOrg[18] - piCur[18] ); |
---|
1135 | uiSum += abs( piOrg[19] - piCur[19] ); |
---|
1136 | uiSum += abs( piOrg[20] - piCur[20] ); |
---|
1137 | uiSum += abs( piOrg[21] - piCur[21] ); |
---|
1138 | uiSum += abs( piOrg[22] - piCur[22] ); |
---|
1139 | uiSum += abs( piOrg[23] - piCur[23] ); |
---|
1140 | uiSum += abs( piOrg[24] - piCur[24] ); |
---|
1141 | uiSum += abs( piOrg[25] - piCur[25] ); |
---|
1142 | uiSum += abs( piOrg[26] - piCur[26] ); |
---|
1143 | uiSum += abs( piOrg[27] - piCur[27] ); |
---|
1144 | uiSum += abs( piOrg[28] - piCur[28] ); |
---|
1145 | uiSum += abs( piOrg[29] - piCur[29] ); |
---|
1146 | uiSum += abs( piOrg[30] - piCur[30] ); |
---|
1147 | uiSum += abs( piOrg[31] - piCur[31] ); |
---|
1148 | uiSum += abs( piOrg[32] - piCur[32] ); |
---|
1149 | uiSum += abs( piOrg[33] - piCur[33] ); |
---|
1150 | uiSum += abs( piOrg[34] - piCur[34] ); |
---|
1151 | uiSum += abs( piOrg[35] - piCur[35] ); |
---|
1152 | uiSum += abs( piOrg[36] - piCur[36] ); |
---|
1153 | uiSum += abs( piOrg[37] - piCur[37] ); |
---|
1154 | uiSum += abs( piOrg[38] - piCur[38] ); |
---|
1155 | uiSum += abs( piOrg[39] - piCur[39] ); |
---|
1156 | uiSum += abs( piOrg[40] - piCur[40] ); |
---|
1157 | uiSum += abs( piOrg[41] - piCur[41] ); |
---|
1158 | uiSum += abs( piOrg[42] - piCur[42] ); |
---|
1159 | uiSum += abs( piOrg[43] - piCur[43] ); |
---|
1160 | uiSum += abs( piOrg[44] - piCur[44] ); |
---|
1161 | uiSum += abs( piOrg[45] - piCur[45] ); |
---|
1162 | uiSum += abs( piOrg[46] - piCur[46] ); |
---|
1163 | uiSum += abs( piOrg[47] - piCur[47] ); |
---|
1164 | |
---|
1165 | piOrg += iStrideOrg; |
---|
1166 | piCur += iStrideCur; |
---|
1167 | } |
---|
1168 | |
---|
1169 | uiSum <<= iSubShift; |
---|
1170 | return ( uiSum >> g_uiBitIncrement ); |
---|
1171 | } |
---|
1172 | #endif |
---|
1173 | |
---|
1174 | // ==================================================================================================================== |
---|
1175 | // Distortion functions |
---|
1176 | // ==================================================================================================================== |
---|
1177 | |
---|
1178 | // -------------------------------------------------------------------------------------------------------------------- |
---|
1179 | // SAD |
---|
1180 | // -------------------------------------------------------------------------------------------------------------------- |
---|
1181 | #if LGE_ILLUCOMP_B0045 |
---|
1182 | UInt TComRdCost::xGetSADic( DistParam* pcDtParam ) |
---|
1183 | { |
---|
1184 | if ( pcDtParam->bApplyWeight ) |
---|
1185 | { |
---|
1186 | return xGetSADw( pcDtParam ); |
---|
1187 | } |
---|
1188 | Pel* piOrg = pcDtParam->pOrg; |
---|
1189 | Pel* piCur = pcDtParam->pCur; |
---|
1190 | Int iRows = pcDtParam->iRows; |
---|
1191 | Int iCols = pcDtParam->iCols; |
---|
1192 | Int iStrideCur = pcDtParam->iStrideCur; |
---|
1193 | Int iStrideOrg = pcDtParam->iStrideOrg; |
---|
1194 | |
---|
1195 | UInt uiSum = 0; |
---|
1196 | |
---|
1197 | Int iOrigAvg = 0, iCurAvg = 0; |
---|
1198 | Int iDeltaC; |
---|
1199 | |
---|
1200 | for( ; iRows != 0; iRows-- ) |
---|
1201 | { |
---|
1202 | for (Int n = 0; n < iCols; n++ ) |
---|
1203 | { |
---|
1204 | iOrigAvg += piOrg[n]; |
---|
1205 | iCurAvg += piCur[n]; |
---|
1206 | } |
---|
1207 | piOrg += iStrideOrg; |
---|
1208 | piCur += iStrideCur; |
---|
1209 | } |
---|
1210 | |
---|
1211 | piOrg = pcDtParam->pOrg; |
---|
1212 | piCur = pcDtParam->pCur; |
---|
1213 | iRows = pcDtParam->iRows; |
---|
1214 | |
---|
1215 | iDeltaC = (iOrigAvg - iCurAvg)/iCols/iRows; |
---|
1216 | |
---|
1217 | for( ; iRows != 0; iRows-- ) |
---|
1218 | { |
---|
1219 | for (Int n = 0; n < iCols; n++ ) |
---|
1220 | { |
---|
1221 | uiSum += abs( piOrg[n] - piCur[n] - iDeltaC ); |
---|
1222 | } |
---|
1223 | piOrg += iStrideOrg; |
---|
1224 | piCur += iStrideCur; |
---|
1225 | } |
---|
1226 | |
---|
1227 | return ( uiSum >> g_uiBitIncrement ); |
---|
1228 | } |
---|
1229 | |
---|
1230 | UInt TComRdCost::xGetSAD4ic( DistParam* pcDtParam ) |
---|
1231 | { |
---|
1232 | if ( pcDtParam->bApplyWeight ) |
---|
1233 | { |
---|
1234 | return xGetSADw( pcDtParam ); |
---|
1235 | } |
---|
1236 | Pel* piOrg = pcDtParam->pOrg; |
---|
1237 | Pel* piCur = pcDtParam->pCur; |
---|
1238 | Int iRows = pcDtParam->iRows; |
---|
1239 | Int iSubShift = pcDtParam->iSubShift; |
---|
1240 | Int iSubStep = ( 1 << iSubShift ); |
---|
1241 | Int iStrideCur = pcDtParam->iStrideCur*iSubStep; |
---|
1242 | Int iStrideOrg = pcDtParam->iStrideOrg*iSubStep; |
---|
1243 | |
---|
1244 | UInt uiSum = 0; |
---|
1245 | |
---|
1246 | Int iOrigAvg = 0, iCurAvg = 0, uiRowCnt = 0; |
---|
1247 | Int iDeltaC; |
---|
1248 | |
---|
1249 | for( ; iRows != 0; iRows-=iSubStep ) |
---|
1250 | { |
---|
1251 | iOrigAvg += piOrg[0]; |
---|
1252 | iOrigAvg += piOrg[1]; |
---|
1253 | iOrigAvg += piOrg[2]; |
---|
1254 | iOrigAvg += piOrg[3]; |
---|
1255 | |
---|
1256 | iCurAvg += piCur[0]; |
---|
1257 | iCurAvg += piCur[1]; |
---|
1258 | iCurAvg += piCur[2]; |
---|
1259 | iCurAvg += piCur[3]; |
---|
1260 | |
---|
1261 | piOrg += iStrideOrg; |
---|
1262 | piCur += iStrideCur; |
---|
1263 | uiRowCnt++; |
---|
1264 | } |
---|
1265 | |
---|
1266 | piOrg = pcDtParam->pOrg; |
---|
1267 | piCur = pcDtParam->pCur; |
---|
1268 | iRows = pcDtParam->iRows; |
---|
1269 | |
---|
1270 | iDeltaC = uiRowCnt ? ((iOrigAvg - iCurAvg)/uiRowCnt/4) : 0; |
---|
1271 | |
---|
1272 | for( ; iRows != 0; iRows-=iSubStep ) |
---|
1273 | { |
---|
1274 | uiSum += abs( piOrg[0] - piCur[0] - iDeltaC ); |
---|
1275 | uiSum += abs( piOrg[1] - piCur[1] - iDeltaC ); |
---|
1276 | uiSum += abs( piOrg[2] - piCur[2] - iDeltaC ); |
---|
1277 | uiSum += abs( piOrg[3] - piCur[3] - iDeltaC ); |
---|
1278 | |
---|
1279 | piOrg += iStrideOrg; |
---|
1280 | piCur += iStrideCur; |
---|
1281 | } |
---|
1282 | |
---|
1283 | uiSum <<= iSubShift; |
---|
1284 | return ( uiSum >> g_uiBitIncrement ); |
---|
1285 | } |
---|
1286 | |
---|
1287 | UInt TComRdCost::xGetSAD8ic( DistParam* pcDtParam ) |
---|
1288 | { |
---|
1289 | if ( pcDtParam->bApplyWeight ) |
---|
1290 | { |
---|
1291 | return xGetSADw( pcDtParam ); |
---|
1292 | } |
---|
1293 | Pel* piOrg = pcDtParam->pOrg; |
---|
1294 | Pel* piCur = pcDtParam->pCur; |
---|
1295 | Int iRows = pcDtParam->iRows; |
---|
1296 | Int iSubShift = pcDtParam->iSubShift; |
---|
1297 | Int iSubStep = ( 1 << iSubShift ); |
---|
1298 | Int iStrideCur = pcDtParam->iStrideCur*iSubStep; |
---|
1299 | Int iStrideOrg = pcDtParam->iStrideOrg*iSubStep; |
---|
1300 | |
---|
1301 | UInt uiSum = 0; |
---|
1302 | |
---|
1303 | Int iOrigAvg = 0, iCurAvg = 0, uiRowCnt = 0; |
---|
1304 | Int iDeltaC; |
---|
1305 | |
---|
1306 | for( ; iRows != 0; iRows-=iSubStep ) |
---|
1307 | { |
---|
1308 | iOrigAvg += piOrg[0]; |
---|
1309 | iOrigAvg += piOrg[1]; |
---|
1310 | iOrigAvg += piOrg[2]; |
---|
1311 | iOrigAvg += piOrg[3]; |
---|
1312 | iOrigAvg += piOrg[4]; |
---|
1313 | iOrigAvg += piOrg[5]; |
---|
1314 | iOrigAvg += piOrg[6]; |
---|
1315 | iOrigAvg += piOrg[7]; |
---|
1316 | |
---|
1317 | iCurAvg += piCur[0]; |
---|
1318 | iCurAvg += piCur[1]; |
---|
1319 | iCurAvg += piCur[2]; |
---|
1320 | iCurAvg += piCur[3]; |
---|
1321 | iCurAvg += piCur[4]; |
---|
1322 | iCurAvg += piCur[5]; |
---|
1323 | iCurAvg += piCur[6]; |
---|
1324 | iCurAvg += piCur[7]; |
---|
1325 | |
---|
1326 | piOrg += iStrideOrg; |
---|
1327 | piCur += iStrideCur; |
---|
1328 | uiRowCnt++; |
---|
1329 | } |
---|
1330 | |
---|
1331 | piOrg = pcDtParam->pOrg; |
---|
1332 | piCur = pcDtParam->pCur; |
---|
1333 | iRows = pcDtParam->iRows; |
---|
1334 | |
---|
1335 | iDeltaC = uiRowCnt ? ((iOrigAvg - iCurAvg)/uiRowCnt/8) : 0; |
---|
1336 | |
---|
1337 | for( ; iRows != 0; iRows-=iSubStep ) |
---|
1338 | { |
---|
1339 | uiSum += abs( piOrg[0] - piCur[0] - iDeltaC ); |
---|
1340 | uiSum += abs( piOrg[1] - piCur[1] - iDeltaC ); |
---|
1341 | uiSum += abs( piOrg[2] - piCur[2] - iDeltaC ); |
---|
1342 | uiSum += abs( piOrg[3] - piCur[3] - iDeltaC ); |
---|
1343 | uiSum += abs( piOrg[4] - piCur[4] - iDeltaC ); |
---|
1344 | uiSum += abs( piOrg[5] - piCur[5] - iDeltaC ); |
---|
1345 | uiSum += abs( piOrg[6] - piCur[6] - iDeltaC ); |
---|
1346 | uiSum += abs( piOrg[7] - piCur[7] - iDeltaC ); |
---|
1347 | |
---|
1348 | piOrg += iStrideOrg; |
---|
1349 | piCur += iStrideCur; |
---|
1350 | } |
---|
1351 | |
---|
1352 | uiSum <<= iSubShift; |
---|
1353 | return ( uiSum >> g_uiBitIncrement ); |
---|
1354 | } |
---|
1355 | |
---|
1356 | UInt TComRdCost::xGetSAD16ic( DistParam* pcDtParam ) |
---|
1357 | { |
---|
1358 | if ( pcDtParam->bApplyWeight ) |
---|
1359 | { |
---|
1360 | return xGetSADw( pcDtParam ); |
---|
1361 | } |
---|
1362 | Pel* piOrg = pcDtParam->pOrg; |
---|
1363 | Pel* piCur = pcDtParam->pCur; |
---|
1364 | Int iRows = pcDtParam->iRows; |
---|
1365 | Int iSubShift = pcDtParam->iSubShift; |
---|
1366 | Int iSubStep = ( 1 << iSubShift ); |
---|
1367 | Int iStrideCur = pcDtParam->iStrideCur*iSubStep; |
---|
1368 | Int iStrideOrg = pcDtParam->iStrideOrg*iSubStep; |
---|
1369 | |
---|
1370 | UInt uiSum = 0; |
---|
1371 | |
---|
1372 | Int iOrigAvg = 0, iCurAvg = 0, uiRowCnt = 0; |
---|
1373 | Int iDeltaC; |
---|
1374 | |
---|
1375 | for( ; iRows != 0; iRows-=iSubStep ) |
---|
1376 | { |
---|
1377 | iOrigAvg += piOrg[0]; |
---|
1378 | iOrigAvg += piOrg[1]; |
---|
1379 | iOrigAvg += piOrg[2]; |
---|
1380 | iOrigAvg += piOrg[3]; |
---|
1381 | iOrigAvg += piOrg[4]; |
---|
1382 | iOrigAvg += piOrg[5]; |
---|
1383 | iOrigAvg += piOrg[6]; |
---|
1384 | iOrigAvg += piOrg[7]; |
---|
1385 | iOrigAvg += piOrg[8]; |
---|
1386 | iOrigAvg += piOrg[9]; |
---|
1387 | iOrigAvg += piOrg[10]; |
---|
1388 | iOrigAvg += piOrg[11]; |
---|
1389 | iOrigAvg += piOrg[12]; |
---|
1390 | iOrigAvg += piOrg[13]; |
---|
1391 | iOrigAvg += piOrg[14]; |
---|
1392 | iOrigAvg += piOrg[15]; |
---|
1393 | |
---|
1394 | iCurAvg += piCur[0]; |
---|
1395 | iCurAvg += piCur[1]; |
---|
1396 | iCurAvg += piCur[2]; |
---|
1397 | iCurAvg += piCur[3]; |
---|
1398 | iCurAvg += piCur[4]; |
---|
1399 | iCurAvg += piCur[5]; |
---|
1400 | iCurAvg += piCur[6]; |
---|
1401 | iCurAvg += piCur[7]; |
---|
1402 | iCurAvg += piCur[8]; |
---|
1403 | iCurAvg += piCur[9]; |
---|
1404 | iCurAvg += piCur[10]; |
---|
1405 | iCurAvg += piCur[11]; |
---|
1406 | iCurAvg += piCur[12]; |
---|
1407 | iCurAvg += piCur[13]; |
---|
1408 | iCurAvg += piCur[14]; |
---|
1409 | iCurAvg += piCur[15]; |
---|
1410 | |
---|
1411 | piOrg += iStrideOrg; |
---|
1412 | piCur += iStrideCur; |
---|
1413 | uiRowCnt++; |
---|
1414 | } |
---|
1415 | |
---|
1416 | piOrg = pcDtParam->pOrg; |
---|
1417 | piCur = pcDtParam->pCur; |
---|
1418 | iRows = pcDtParam->iRows; |
---|
1419 | |
---|
1420 | iDeltaC = uiRowCnt ? ((iOrigAvg - iCurAvg)/uiRowCnt/16) : 0; |
---|
1421 | |
---|
1422 | for( ; iRows != 0; iRows-=iSubStep ) |
---|
1423 | { |
---|
1424 | uiSum += abs( piOrg[0] - piCur[0] - iDeltaC ); |
---|
1425 | uiSum += abs( piOrg[1] - piCur[1] - iDeltaC ); |
---|
1426 | uiSum += abs( piOrg[2] - piCur[2] - iDeltaC ); |
---|
1427 | uiSum += abs( piOrg[3] - piCur[3] - iDeltaC ); |
---|
1428 | uiSum += abs( piOrg[4] - piCur[4] - iDeltaC ); |
---|
1429 | uiSum += abs( piOrg[5] - piCur[5] - iDeltaC ); |
---|
1430 | uiSum += abs( piOrg[6] - piCur[6] - iDeltaC ); |
---|
1431 | uiSum += abs( piOrg[7] - piCur[7] - iDeltaC ); |
---|
1432 | uiSum += abs( piOrg[8] - piCur[8] - iDeltaC ); |
---|
1433 | uiSum += abs( piOrg[9] - piCur[9] - iDeltaC ); |
---|
1434 | uiSum += abs( piOrg[10] - piCur[10] - iDeltaC ); |
---|
1435 | uiSum += abs( piOrg[11] - piCur[11] - iDeltaC ); |
---|
1436 | uiSum += abs( piOrg[12] - piCur[12] - iDeltaC ); |
---|
1437 | uiSum += abs( piOrg[13] - piCur[13] - iDeltaC ); |
---|
1438 | uiSum += abs( piOrg[14] - piCur[14] - iDeltaC ); |
---|
1439 | uiSum += abs( piOrg[15] - piCur[15] - iDeltaC ); |
---|
1440 | |
---|
1441 | piOrg += iStrideOrg; |
---|
1442 | piCur += iStrideCur; |
---|
1443 | } |
---|
1444 | |
---|
1445 | uiSum <<= iSubShift; |
---|
1446 | return ( uiSum >> g_uiBitIncrement ); |
---|
1447 | } |
---|
1448 | |
---|
1449 | #if AMP_SAD |
---|
1450 | UInt TComRdCost::xGetSAD12ic( DistParam* pcDtParam ) |
---|
1451 | { |
---|
1452 | if ( pcDtParam->bApplyWeight ) |
---|
1453 | { |
---|
1454 | return xGetSADw( pcDtParam ); |
---|
1455 | } |
---|
1456 | Pel* piOrg = pcDtParam->pOrg; |
---|
1457 | Pel* piCur = pcDtParam->pCur; |
---|
1458 | Int iRows = pcDtParam->iRows; |
---|
1459 | Int iSubShift = pcDtParam->iSubShift; |
---|
1460 | Int iSubStep = ( 1 << iSubShift ); |
---|
1461 | Int iStrideCur = pcDtParam->iStrideCur*iSubStep; |
---|
1462 | Int iStrideOrg = pcDtParam->iStrideOrg*iSubStep; |
---|
1463 | |
---|
1464 | UInt uiSum = 0; |
---|
1465 | |
---|
1466 | Int iOrigAvg = 0, iCurAvg = 0, uiRowCnt = 0; |
---|
1467 | Int iDeltaC; |
---|
1468 | |
---|
1469 | for( ; iRows != 0; iRows-=iSubStep ) |
---|
1470 | { |
---|
1471 | iOrigAvg += piOrg[0]; |
---|
1472 | iOrigAvg += piOrg[1]; |
---|
1473 | iOrigAvg += piOrg[2]; |
---|
1474 | iOrigAvg += piOrg[3]; |
---|
1475 | iOrigAvg += piOrg[4]; |
---|
1476 | iOrigAvg += piOrg[5]; |
---|
1477 | iOrigAvg += piOrg[6]; |
---|
1478 | iOrigAvg += piOrg[7]; |
---|
1479 | iOrigAvg += piOrg[8]; |
---|
1480 | iOrigAvg += piOrg[9]; |
---|
1481 | iOrigAvg += piOrg[10]; |
---|
1482 | iOrigAvg += piOrg[11]; |
---|
1483 | |
---|
1484 | iCurAvg += piCur[0]; |
---|
1485 | iCurAvg += piCur[1]; |
---|
1486 | iCurAvg += piCur[2]; |
---|
1487 | iCurAvg += piCur[3]; |
---|
1488 | iCurAvg += piCur[4]; |
---|
1489 | iCurAvg += piCur[5]; |
---|
1490 | iCurAvg += piCur[6]; |
---|
1491 | iCurAvg += piCur[7]; |
---|
1492 | iCurAvg += piCur[8]; |
---|
1493 | iCurAvg += piCur[9]; |
---|
1494 | iCurAvg += piCur[10]; |
---|
1495 | iCurAvg += piCur[11]; |
---|
1496 | |
---|
1497 | piOrg += iStrideOrg; |
---|
1498 | piCur += iStrideCur; |
---|
1499 | uiRowCnt++; |
---|
1500 | } |
---|
1501 | |
---|
1502 | piOrg = pcDtParam->pOrg; |
---|
1503 | piCur = pcDtParam->pCur; |
---|
1504 | iRows = pcDtParam->iRows; |
---|
1505 | |
---|
1506 | iDeltaC = uiRowCnt ? ((iOrigAvg - iCurAvg)/uiRowCnt/12) : 0; |
---|
1507 | |
---|
1508 | for( ; iRows != 0; iRows-=iSubStep ) |
---|
1509 | { |
---|
1510 | uiSum += abs( piOrg[0] - piCur[0] - iDeltaC ); |
---|
1511 | uiSum += abs( piOrg[1] - piCur[1] - iDeltaC ); |
---|
1512 | uiSum += abs( piOrg[2] - piCur[2] - iDeltaC ); |
---|
1513 | uiSum += abs( piOrg[3] - piCur[3] - iDeltaC ); |
---|
1514 | uiSum += abs( piOrg[4] - piCur[4] - iDeltaC ); |
---|
1515 | uiSum += abs( piOrg[5] - piCur[5] - iDeltaC ); |
---|
1516 | uiSum += abs( piOrg[6] - piCur[6] - iDeltaC ); |
---|
1517 | uiSum += abs( piOrg[7] - piCur[7] - iDeltaC ); |
---|
1518 | uiSum += abs( piOrg[8] - piCur[8] - iDeltaC ); |
---|
1519 | uiSum += abs( piOrg[9] - piCur[9] - iDeltaC ); |
---|
1520 | uiSum += abs( piOrg[10] - piCur[10] - iDeltaC ); |
---|
1521 | uiSum += abs( piOrg[11] - piCur[11] - iDeltaC ); |
---|
1522 | |
---|
1523 | piOrg += iStrideOrg; |
---|
1524 | piCur += iStrideCur; |
---|
1525 | } |
---|
1526 | |
---|
1527 | uiSum <<= iSubShift; |
---|
1528 | return ( uiSum >> g_uiBitIncrement ); |
---|
1529 | } |
---|
1530 | #endif |
---|
1531 | |
---|
1532 | UInt TComRdCost::xGetSAD16Nic( DistParam* pcDtParam ) |
---|
1533 | { |
---|
1534 | Pel* piOrg = pcDtParam->pOrg; |
---|
1535 | Pel* piCur = pcDtParam->pCur; |
---|
1536 | Int iRows = pcDtParam->iRows; |
---|
1537 | Int iCols = pcDtParam->iCols; |
---|
1538 | Int iSubShift = pcDtParam->iSubShift; |
---|
1539 | Int iSubStep = ( 1 << iSubShift ); |
---|
1540 | Int iStrideCur = pcDtParam->iStrideCur*iSubStep; |
---|
1541 | Int iStrideOrg = pcDtParam->iStrideOrg*iSubStep; |
---|
1542 | |
---|
1543 | UInt uiSum = 0; |
---|
1544 | |
---|
1545 | Int iOrigAvg = 0, iCurAvg = 0, uiRowCnt = 0, uiColCnt = (iCols-1)/16 + 1; |
---|
1546 | Int iDeltaC; |
---|
1547 | |
---|
1548 | for( ; iRows != 0; iRows-=iSubStep ) |
---|
1549 | { |
---|
1550 | for (Int n = 0; n < iCols; n+=16 ) |
---|
1551 | { |
---|
1552 | iOrigAvg += piOrg[n + 0]; |
---|
1553 | iOrigAvg += piOrg[n + 1]; |
---|
1554 | iOrigAvg += piOrg[n + 2]; |
---|
1555 | iOrigAvg += piOrg[n + 3]; |
---|
1556 | iOrigAvg += piOrg[n + 4]; |
---|
1557 | iOrigAvg += piOrg[n + 5]; |
---|
1558 | iOrigAvg += piOrg[n + 6]; |
---|
1559 | iOrigAvg += piOrg[n + 7]; |
---|
1560 | iOrigAvg += piOrg[n + 8]; |
---|
1561 | iOrigAvg += piOrg[n + 9]; |
---|
1562 | iOrigAvg += piOrg[n + 10]; |
---|
1563 | iOrigAvg += piOrg[n + 11]; |
---|
1564 | iOrigAvg += piOrg[n + 12]; |
---|
1565 | iOrigAvg += piOrg[n + 13]; |
---|
1566 | iOrigAvg += piOrg[n + 14]; |
---|
1567 | iOrigAvg += piOrg[n + 15]; |
---|
1568 | |
---|
1569 | iCurAvg += piCur[n + 0]; |
---|
1570 | iCurAvg += piCur[n + 1]; |
---|
1571 | iCurAvg += piCur[n + 2]; |
---|
1572 | iCurAvg += piCur[n + 3]; |
---|
1573 | iCurAvg += piCur[n + 4]; |
---|
1574 | iCurAvg += piCur[n + 5]; |
---|
1575 | iCurAvg += piCur[n + 6]; |
---|
1576 | iCurAvg += piCur[n + 7]; |
---|
1577 | iCurAvg += piCur[n + 8]; |
---|
1578 | iCurAvg += piCur[n + 9]; |
---|
1579 | iCurAvg += piCur[n + 10]; |
---|
1580 | iCurAvg += piCur[n + 11]; |
---|
1581 | iCurAvg += piCur[n + 12]; |
---|
1582 | iCurAvg += piCur[n + 13]; |
---|
1583 | iCurAvg += piCur[n + 14]; |
---|
1584 | iCurAvg += piCur[n + 15]; |
---|
1585 | } |
---|
1586 | piOrg += iStrideOrg; |
---|
1587 | piCur += iStrideCur; |
---|
1588 | uiRowCnt++; |
---|
1589 | } |
---|
1590 | piOrg = pcDtParam->pOrg; |
---|
1591 | piCur = pcDtParam->pCur; |
---|
1592 | iRows = pcDtParam->iRows; |
---|
1593 | |
---|
1594 | iDeltaC = (uiRowCnt && uiColCnt) ? ((iOrigAvg - iCurAvg)/uiRowCnt/uiColCnt/16) : 0; |
---|
1595 | |
---|
1596 | for( ; iRows != 0; iRows-=iSubStep ) |
---|
1597 | { |
---|
1598 | for (Int n = 0; n < iCols; n+=16 ) |
---|
1599 | { |
---|
1600 | uiSum += abs( piOrg[n+ 0] - piCur[n+ 0] - iDeltaC ); |
---|
1601 | uiSum += abs( piOrg[n+ 1] - piCur[n+ 1] - iDeltaC ); |
---|
1602 | uiSum += abs( piOrg[n+ 2] - piCur[n+ 2] - iDeltaC ); |
---|
1603 | uiSum += abs( piOrg[n+ 3] - piCur[n+ 3] - iDeltaC ); |
---|
1604 | uiSum += abs( piOrg[n+ 4] - piCur[n+ 4] - iDeltaC ); |
---|
1605 | uiSum += abs( piOrg[n+ 5] - piCur[n+ 5] - iDeltaC ); |
---|
1606 | uiSum += abs( piOrg[n+ 6] - piCur[n+ 6] - iDeltaC ); |
---|
1607 | uiSum += abs( piOrg[n+ 7] - piCur[n+ 7] - iDeltaC ); |
---|
1608 | uiSum += abs( piOrg[n+ 8] - piCur[n+ 8] - iDeltaC ); |
---|
1609 | uiSum += abs( piOrg[n+ 9] - piCur[n+ 9] - iDeltaC ); |
---|
1610 | uiSum += abs( piOrg[n+10] - piCur[n+10] - iDeltaC ); |
---|
1611 | uiSum += abs( piOrg[n+11] - piCur[n+11] - iDeltaC ); |
---|
1612 | uiSum += abs( piOrg[n+12] - piCur[n+12] - iDeltaC ); |
---|
1613 | uiSum += abs( piOrg[n+13] - piCur[n+13] - iDeltaC ); |
---|
1614 | uiSum += abs( piOrg[n+14] - piCur[n+14] - iDeltaC ); |
---|
1615 | uiSum += abs( piOrg[n+15] - piCur[n+15] - iDeltaC ); |
---|
1616 | } |
---|
1617 | piOrg += iStrideOrg; |
---|
1618 | piCur += iStrideCur; |
---|
1619 | } |
---|
1620 | |
---|
1621 | uiSum <<= iSubShift; |
---|
1622 | return ( uiSum >> g_uiBitIncrement ); |
---|
1623 | } |
---|
1624 | |
---|
1625 | UInt TComRdCost::xGetSAD32ic( DistParam* pcDtParam ) |
---|
1626 | { |
---|
1627 | if ( pcDtParam->bApplyWeight ) |
---|
1628 | { |
---|
1629 | return xGetSADw( pcDtParam ); |
---|
1630 | } |
---|
1631 | Pel* piOrg = pcDtParam->pOrg; |
---|
1632 | Pel* piCur = pcDtParam->pCur; |
---|
1633 | Int iRows = pcDtParam->iRows; |
---|
1634 | Int iSubShift = pcDtParam->iSubShift; |
---|
1635 | Int iSubStep = ( 1 << iSubShift ); |
---|
1636 | Int iStrideCur = pcDtParam->iStrideCur*iSubStep; |
---|
1637 | Int iStrideOrg = pcDtParam->iStrideOrg*iSubStep; |
---|
1638 | |
---|
1639 | UInt uiSum = 0; |
---|
1640 | |
---|
1641 | Int iOrigAvg = 0, iCurAvg = 0, uiRowCnt = 0; |
---|
1642 | Int iDeltaC; |
---|
1643 | |
---|
1644 | for( ; iRows != 0; iRows-=iSubStep ) |
---|
1645 | { |
---|
1646 | iOrigAvg += piOrg[0]; |
---|
1647 | iOrigAvg += piOrg[1]; |
---|
1648 | iOrigAvg += piOrg[2]; |
---|
1649 | iOrigAvg += piOrg[3]; |
---|
1650 | iOrigAvg += piOrg[4]; |
---|
1651 | iOrigAvg += piOrg[5]; |
---|
1652 | iOrigAvg += piOrg[6]; |
---|
1653 | iOrigAvg += piOrg[7]; |
---|
1654 | iOrigAvg += piOrg[8]; |
---|
1655 | iOrigAvg += piOrg[9]; |
---|
1656 | iOrigAvg += piOrg[10]; |
---|
1657 | iOrigAvg += piOrg[11]; |
---|
1658 | iOrigAvg += piOrg[12]; |
---|
1659 | iOrigAvg += piOrg[13]; |
---|
1660 | iOrigAvg += piOrg[14]; |
---|
1661 | iOrigAvg += piOrg[15]; |
---|
1662 | iOrigAvg += piOrg[16]; |
---|
1663 | iOrigAvg += piOrg[17]; |
---|
1664 | iOrigAvg += piOrg[18]; |
---|
1665 | iOrigAvg += piOrg[19]; |
---|
1666 | iOrigAvg += piOrg[20]; |
---|
1667 | iOrigAvg += piOrg[21]; |
---|
1668 | iOrigAvg += piOrg[22]; |
---|
1669 | iOrigAvg += piOrg[23]; |
---|
1670 | iOrigAvg += piOrg[24]; |
---|
1671 | iOrigAvg += piOrg[25]; |
---|
1672 | iOrigAvg += piOrg[26]; |
---|
1673 | iOrigAvg += piOrg[27]; |
---|
1674 | iOrigAvg += piOrg[28]; |
---|
1675 | iOrigAvg += piOrg[29]; |
---|
1676 | iOrigAvg += piOrg[30]; |
---|
1677 | iOrigAvg += piOrg[31]; |
---|
1678 | |
---|
1679 | iCurAvg += piCur[0]; |
---|
1680 | iCurAvg += piCur[1]; |
---|
1681 | iCurAvg += piCur[2]; |
---|
1682 | iCurAvg += piCur[3]; |
---|
1683 | iCurAvg += piCur[4]; |
---|
1684 | iCurAvg += piCur[5]; |
---|
1685 | iCurAvg += piCur[6]; |
---|
1686 | iCurAvg += piCur[7]; |
---|
1687 | iCurAvg += piCur[8]; |
---|
1688 | iCurAvg += piCur[9]; |
---|
1689 | iCurAvg += piCur[10]; |
---|
1690 | iCurAvg += piCur[11]; |
---|
1691 | iCurAvg += piCur[12]; |
---|
1692 | iCurAvg += piCur[13]; |
---|
1693 | iCurAvg += piCur[14]; |
---|
1694 | iCurAvg += piCur[15]; |
---|
1695 | iCurAvg += piCur[16]; |
---|
1696 | iCurAvg += piCur[17]; |
---|
1697 | iCurAvg += piCur[18]; |
---|
1698 | iCurAvg += piCur[19]; |
---|
1699 | iCurAvg += piCur[20]; |
---|
1700 | iCurAvg += piCur[21]; |
---|
1701 | iCurAvg += piCur[22]; |
---|
1702 | iCurAvg += piCur[23]; |
---|
1703 | iCurAvg += piCur[24]; |
---|
1704 | iCurAvg += piCur[25]; |
---|
1705 | iCurAvg += piCur[26]; |
---|
1706 | iCurAvg += piCur[27]; |
---|
1707 | iCurAvg += piCur[28]; |
---|
1708 | iCurAvg += piCur[29]; |
---|
1709 | iCurAvg += piCur[30]; |
---|
1710 | iCurAvg += piCur[31]; |
---|
1711 | |
---|
1712 | piOrg += iStrideOrg; |
---|
1713 | piCur += iStrideCur; |
---|
1714 | uiRowCnt++; |
---|
1715 | } |
---|
1716 | |
---|
1717 | piOrg = pcDtParam->pOrg; |
---|
1718 | piCur = pcDtParam->pCur; |
---|
1719 | iRows = pcDtParam->iRows; |
---|
1720 | |
---|
1721 | iDeltaC = uiRowCnt ? ((iOrigAvg - iCurAvg)/uiRowCnt/32) : 0; |
---|
1722 | |
---|
1723 | for( ; iRows != 0; iRows-=iSubStep ) |
---|
1724 | { |
---|
1725 | uiSum += abs( piOrg[0] - piCur[0] - iDeltaC ); |
---|
1726 | uiSum += abs( piOrg[1] - piCur[1] - iDeltaC ); |
---|
1727 | uiSum += abs( piOrg[2] - piCur[2] - iDeltaC ); |
---|
1728 | uiSum += abs( piOrg[3] - piCur[3] - iDeltaC ); |
---|
1729 | uiSum += abs( piOrg[4] - piCur[4] - iDeltaC ); |
---|
1730 | uiSum += abs( piOrg[5] - piCur[5] - iDeltaC ); |
---|
1731 | uiSum += abs( piOrg[6] - piCur[6] - iDeltaC ); |
---|
1732 | uiSum += abs( piOrg[7] - piCur[7] - iDeltaC ); |
---|
1733 | uiSum += abs( piOrg[8] - piCur[8] - iDeltaC ); |
---|
1734 | uiSum += abs( piOrg[9] - piCur[9] - iDeltaC ); |
---|
1735 | uiSum += abs( piOrg[10] - piCur[10] - iDeltaC ); |
---|
1736 | uiSum += abs( piOrg[11] - piCur[11] - iDeltaC ); |
---|
1737 | uiSum += abs( piOrg[12] - piCur[12] - iDeltaC ); |
---|
1738 | uiSum += abs( piOrg[13] - piCur[13] - iDeltaC ); |
---|
1739 | uiSum += abs( piOrg[14] - piCur[14] - iDeltaC ); |
---|
1740 | uiSum += abs( piOrg[15] - piCur[15] - iDeltaC ); |
---|
1741 | uiSum += abs( piOrg[16] - piCur[16] - iDeltaC ); |
---|
1742 | uiSum += abs( piOrg[17] - piCur[17] - iDeltaC ); |
---|
1743 | uiSum += abs( piOrg[18] - piCur[18] - iDeltaC ); |
---|
1744 | uiSum += abs( piOrg[19] - piCur[19] - iDeltaC ); |
---|
1745 | uiSum += abs( piOrg[20] - piCur[20] - iDeltaC ); |
---|
1746 | uiSum += abs( piOrg[21] - piCur[21] - iDeltaC ); |
---|
1747 | uiSum += abs( piOrg[22] - piCur[22] - iDeltaC ); |
---|
1748 | uiSum += abs( piOrg[23] - piCur[23] - iDeltaC ); |
---|
1749 | uiSum += abs( piOrg[24] - piCur[24] - iDeltaC ); |
---|
1750 | uiSum += abs( piOrg[25] - piCur[25] - iDeltaC ); |
---|
1751 | uiSum += abs( piOrg[26] - piCur[26] - iDeltaC ); |
---|
1752 | uiSum += abs( piOrg[27] - piCur[27] - iDeltaC ); |
---|
1753 | uiSum += abs( piOrg[28] - piCur[28] - iDeltaC ); |
---|
1754 | uiSum += abs( piOrg[29] - piCur[29] - iDeltaC ); |
---|
1755 | uiSum += abs( piOrg[30] - piCur[30] - iDeltaC ); |
---|
1756 | uiSum += abs( piOrg[31] - piCur[31] - iDeltaC ); |
---|
1757 | |
---|
1758 | piOrg += iStrideOrg; |
---|
1759 | piCur += iStrideCur; |
---|
1760 | } |
---|
1761 | |
---|
1762 | uiSum <<= iSubShift; |
---|
1763 | return ( uiSum >> g_uiBitIncrement ); |
---|
1764 | } |
---|
1765 | |
---|
1766 | #if AMP_SAD |
---|
1767 | UInt TComRdCost::xGetSAD24ic( DistParam* pcDtParam ) |
---|
1768 | { |
---|
1769 | if ( pcDtParam->bApplyWeight ) |
---|
1770 | { |
---|
1771 | return xGetSADw( pcDtParam ); |
---|
1772 | } |
---|
1773 | Pel* piOrg = pcDtParam->pOrg; |
---|
1774 | Pel* piCur = pcDtParam->pCur; |
---|
1775 | Int iRows = pcDtParam->iRows; |
---|
1776 | Int iSubShift = pcDtParam->iSubShift; |
---|
1777 | Int iSubStep = ( 1 << iSubShift ); |
---|
1778 | Int iStrideCur = pcDtParam->iStrideCur*iSubStep; |
---|
1779 | Int iStrideOrg = pcDtParam->iStrideOrg*iSubStep; |
---|
1780 | |
---|
1781 | UInt uiSum = 0; |
---|
1782 | |
---|
1783 | Int iOrigAvg = 0, iCurAvg = 0, uiRowCnt = 0; |
---|
1784 | Int iDeltaC; |
---|
1785 | |
---|
1786 | for( ; iRows != 0; iRows-=iSubStep ) |
---|
1787 | { |
---|
1788 | iOrigAvg += piOrg[0]; |
---|
1789 | iOrigAvg += piOrg[1]; |
---|
1790 | iOrigAvg += piOrg[2]; |
---|
1791 | iOrigAvg += piOrg[3]; |
---|
1792 | iOrigAvg += piOrg[4]; |
---|
1793 | iOrigAvg += piOrg[5]; |
---|
1794 | iOrigAvg += piOrg[6]; |
---|
1795 | iOrigAvg += piOrg[7]; |
---|
1796 | iOrigAvg += piOrg[8]; |
---|
1797 | iOrigAvg += piOrg[9]; |
---|
1798 | iOrigAvg += piOrg[10]; |
---|
1799 | iOrigAvg += piOrg[11]; |
---|
1800 | iOrigAvg += piOrg[12]; |
---|
1801 | iOrigAvg += piOrg[13]; |
---|
1802 | iOrigAvg += piOrg[14]; |
---|
1803 | iOrigAvg += piOrg[15]; |
---|
1804 | iOrigAvg += piOrg[16]; |
---|
1805 | iOrigAvg += piOrg[17]; |
---|
1806 | iOrigAvg += piOrg[18]; |
---|
1807 | iOrigAvg += piOrg[19]; |
---|
1808 | iOrigAvg += piOrg[20]; |
---|
1809 | iOrigAvg += piOrg[21]; |
---|
1810 | iOrigAvg += piOrg[22]; |
---|
1811 | iOrigAvg += piOrg[23]; |
---|
1812 | |
---|
1813 | iCurAvg += piCur[0]; |
---|
1814 | iCurAvg += piCur[1]; |
---|
1815 | iCurAvg += piCur[2]; |
---|
1816 | iCurAvg += piCur[3]; |
---|
1817 | iCurAvg += piCur[4]; |
---|
1818 | iCurAvg += piCur[5]; |
---|
1819 | iCurAvg += piCur[6]; |
---|
1820 | iCurAvg += piCur[7]; |
---|
1821 | iCurAvg += piCur[8]; |
---|
1822 | iCurAvg += piCur[9]; |
---|
1823 | iCurAvg += piCur[10]; |
---|
1824 | iCurAvg += piCur[11]; |
---|
1825 | iCurAvg += piCur[12]; |
---|
1826 | iCurAvg += piCur[13]; |
---|
1827 | iCurAvg += piCur[14]; |
---|
1828 | iCurAvg += piCur[15]; |
---|
1829 | iCurAvg += piCur[16]; |
---|
1830 | iCurAvg += piCur[17]; |
---|
1831 | iCurAvg += piCur[18]; |
---|
1832 | iCurAvg += piCur[19]; |
---|
1833 | iCurAvg += piCur[20]; |
---|
1834 | iCurAvg += piCur[21]; |
---|
1835 | iCurAvg += piCur[22]; |
---|
1836 | iCurAvg += piCur[23]; |
---|
1837 | |
---|
1838 | piOrg += iStrideOrg; |
---|
1839 | piCur += iStrideCur; |
---|
1840 | uiRowCnt++; |
---|
1841 | } |
---|
1842 | |
---|
1843 | piOrg = pcDtParam->pOrg; |
---|
1844 | piCur = pcDtParam->pCur; |
---|
1845 | iRows = pcDtParam->iRows; |
---|
1846 | |
---|
1847 | iDeltaC = uiRowCnt ? ((iOrigAvg - iCurAvg)/uiRowCnt/24) : 0; |
---|
1848 | |
---|
1849 | for( ; iRows != 0; iRows-=iSubStep ) |
---|
1850 | { |
---|
1851 | uiSum += abs( piOrg[0] - piCur[0] - iDeltaC ); |
---|
1852 | uiSum += abs( piOrg[1] - piCur[1] - iDeltaC ); |
---|
1853 | uiSum += abs( piOrg[2] - piCur[2] - iDeltaC ); |
---|
1854 | uiSum += abs( piOrg[3] - piCur[3] - iDeltaC ); |
---|
1855 | uiSum += abs( piOrg[4] - piCur[4] - iDeltaC ); |
---|
1856 | uiSum += abs( piOrg[5] - piCur[5] - iDeltaC ); |
---|
1857 | uiSum += abs( piOrg[6] - piCur[6] - iDeltaC ); |
---|
1858 | uiSum += abs( piOrg[7] - piCur[7] - iDeltaC ); |
---|
1859 | uiSum += abs( piOrg[8] - piCur[8] - iDeltaC ); |
---|
1860 | uiSum += abs( piOrg[9] - piCur[9] - iDeltaC ); |
---|
1861 | uiSum += abs( piOrg[10] - piCur[10] - iDeltaC ); |
---|
1862 | uiSum += abs( piOrg[11] - piCur[11] - iDeltaC ); |
---|
1863 | uiSum += abs( piOrg[12] - piCur[12] - iDeltaC ); |
---|
1864 | uiSum += abs( piOrg[13] - piCur[13] - iDeltaC ); |
---|
1865 | uiSum += abs( piOrg[14] - piCur[14] - iDeltaC ); |
---|
1866 | uiSum += abs( piOrg[15] - piCur[15] - iDeltaC ); |
---|
1867 | uiSum += abs( piOrg[16] - piCur[16] - iDeltaC ); |
---|
1868 | uiSum += abs( piOrg[17] - piCur[17] - iDeltaC ); |
---|
1869 | uiSum += abs( piOrg[18] - piCur[18] - iDeltaC ); |
---|
1870 | uiSum += abs( piOrg[19] - piCur[19] - iDeltaC ); |
---|
1871 | uiSum += abs( piOrg[20] - piCur[20] - iDeltaC ); |
---|
1872 | uiSum += abs( piOrg[21] - piCur[21] - iDeltaC ); |
---|
1873 | uiSum += abs( piOrg[22] - piCur[22] - iDeltaC ); |
---|
1874 | uiSum += abs( piOrg[23] - piCur[23] - iDeltaC ); |
---|
1875 | |
---|
1876 | piOrg += iStrideOrg; |
---|
1877 | piCur += iStrideCur; |
---|
1878 | } |
---|
1879 | |
---|
1880 | uiSum <<= iSubShift; |
---|
1881 | return ( uiSum >> g_uiBitIncrement ); |
---|
1882 | } |
---|
1883 | #endif |
---|
1884 | |
---|
1885 | UInt TComRdCost::xGetSAD64ic( DistParam* pcDtParam ) |
---|
1886 | { |
---|
1887 | if ( pcDtParam->bApplyWeight ) |
---|
1888 | { |
---|
1889 | return xGetSADw( pcDtParam ); |
---|
1890 | } |
---|
1891 | Pel* piOrg = pcDtParam->pOrg; |
---|
1892 | Pel* piCur = pcDtParam->pCur; |
---|
1893 | Int iRows = pcDtParam->iRows; |
---|
1894 | Int iSubShift = pcDtParam->iSubShift; |
---|
1895 | Int iSubStep = ( 1 << iSubShift ); |
---|
1896 | Int iStrideCur = pcDtParam->iStrideCur*iSubStep; |
---|
1897 | Int iStrideOrg = pcDtParam->iStrideOrg*iSubStep; |
---|
1898 | |
---|
1899 | UInt uiSum = 0; |
---|
1900 | |
---|
1901 | Int iOrigAvg = 0, iCurAvg = 0, uiRowCnt = 0; |
---|
1902 | Int iDeltaC; |
---|
1903 | |
---|
1904 | for( ; iRows != 0; iRows-=iSubStep ) |
---|
1905 | { |
---|
1906 | iOrigAvg += piOrg[0] ; |
---|
1907 | iOrigAvg += piOrg[1] ; |
---|
1908 | iOrigAvg += piOrg[2] ; |
---|
1909 | iOrigAvg += piOrg[3] ; |
---|
1910 | iOrigAvg += piOrg[4] ; |
---|
1911 | iOrigAvg += piOrg[5] ; |
---|
1912 | iOrigAvg += piOrg[6] ; |
---|
1913 | iOrigAvg += piOrg[7] ; |
---|
1914 | iOrigAvg += piOrg[8] ; |
---|
1915 | iOrigAvg += piOrg[9] ; |
---|
1916 | iOrigAvg += piOrg[10] ; |
---|
1917 | iOrigAvg += piOrg[11] ; |
---|
1918 | iOrigAvg += piOrg[12] ; |
---|
1919 | iOrigAvg += piOrg[13] ; |
---|
1920 | iOrigAvg += piOrg[14] ; |
---|
1921 | iOrigAvg += piOrg[15] ; |
---|
1922 | iOrigAvg += piOrg[16] ; |
---|
1923 | iOrigAvg += piOrg[17] ; |
---|
1924 | iOrigAvg += piOrg[18] ; |
---|
1925 | iOrigAvg += piOrg[19] ; |
---|
1926 | iOrigAvg += piOrg[20] ; |
---|
1927 | iOrigAvg += piOrg[21] ; |
---|
1928 | iOrigAvg += piOrg[22] ; |
---|
1929 | iOrigAvg += piOrg[23] ; |
---|
1930 | iOrigAvg += piOrg[24] ; |
---|
1931 | iOrigAvg += piOrg[25] ; |
---|
1932 | iOrigAvg += piOrg[26] ; |
---|
1933 | iOrigAvg += piOrg[27] ; |
---|
1934 | iOrigAvg += piOrg[28] ; |
---|
1935 | iOrigAvg += piOrg[29] ; |
---|
1936 | iOrigAvg += piOrg[30] ; |
---|
1937 | iOrigAvg += piOrg[31] ; |
---|
1938 | iOrigAvg += piOrg[32] ; |
---|
1939 | iOrigAvg += piOrg[33] ; |
---|
1940 | iOrigAvg += piOrg[34] ; |
---|
1941 | iOrigAvg += piOrg[35] ; |
---|
1942 | iOrigAvg += piOrg[36] ; |
---|
1943 | iOrigAvg += piOrg[37] ; |
---|
1944 | iOrigAvg += piOrg[38] ; |
---|
1945 | iOrigAvg += piOrg[39] ; |
---|
1946 | iOrigAvg += piOrg[40] ; |
---|
1947 | iOrigAvg += piOrg[41] ; |
---|
1948 | iOrigAvg += piOrg[42] ; |
---|
1949 | iOrigAvg += piOrg[43] ; |
---|
1950 | iOrigAvg += piOrg[44] ; |
---|
1951 | iOrigAvg += piOrg[45] ; |
---|
1952 | iOrigAvg += piOrg[46] ; |
---|
1953 | iOrigAvg += piOrg[47] ; |
---|
1954 | iOrigAvg += piOrg[48] ; |
---|
1955 | iOrigAvg += piOrg[49] ; |
---|
1956 | iOrigAvg += piOrg[50] ; |
---|
1957 | iOrigAvg += piOrg[51] ; |
---|
1958 | iOrigAvg += piOrg[52] ; |
---|
1959 | iOrigAvg += piOrg[53] ; |
---|
1960 | iOrigAvg += piOrg[54] ; |
---|
1961 | iOrigAvg += piOrg[55] ; |
---|
1962 | iOrigAvg += piOrg[56] ; |
---|
1963 | iOrigAvg += piOrg[57] ; |
---|
1964 | iOrigAvg += piOrg[58] ; |
---|
1965 | iOrigAvg += piOrg[59] ; |
---|
1966 | iOrigAvg += piOrg[60] ; |
---|
1967 | iOrigAvg += piOrg[61] ; |
---|
1968 | iOrigAvg += piOrg[62] ; |
---|
1969 | iOrigAvg += piOrg[63] ; |
---|
1970 | |
---|
1971 | iCurAvg += piCur[0] ; |
---|
1972 | iCurAvg += piCur[1] ; |
---|
1973 | iCurAvg += piCur[2] ; |
---|
1974 | iCurAvg += piCur[3] ; |
---|
1975 | iCurAvg += piCur[4] ; |
---|
1976 | iCurAvg += piCur[5] ; |
---|
1977 | iCurAvg += piCur[6] ; |
---|
1978 | iCurAvg += piCur[7] ; |
---|
1979 | iCurAvg += piCur[8] ; |
---|
1980 | iCurAvg += piCur[9] ; |
---|
1981 | iCurAvg += piCur[10] ; |
---|
1982 | iCurAvg += piCur[11] ; |
---|
1983 | iCurAvg += piCur[12] ; |
---|
1984 | iCurAvg += piCur[13] ; |
---|
1985 | iCurAvg += piCur[14] ; |
---|
1986 | iCurAvg += piCur[15] ; |
---|
1987 | iCurAvg += piCur[16] ; |
---|
1988 | iCurAvg += piCur[17] ; |
---|
1989 | iCurAvg += piCur[18] ; |
---|
1990 | iCurAvg += piCur[19] ; |
---|
1991 | iCurAvg += piCur[20] ; |
---|
1992 | iCurAvg += piCur[21] ; |
---|
1993 | iCurAvg += piCur[22] ; |
---|
1994 | iCurAvg += piCur[23] ; |
---|
1995 | iCurAvg += piCur[24] ; |
---|
1996 | iCurAvg += piCur[25] ; |
---|
1997 | iCurAvg += piCur[26] ; |
---|
1998 | iCurAvg += piCur[27] ; |
---|
1999 | iCurAvg += piCur[28] ; |
---|
2000 | iCurAvg += piCur[29] ; |
---|
2001 | iCurAvg += piCur[30] ; |
---|
2002 | iCurAvg += piCur[31] ; |
---|
2003 | iCurAvg += piCur[32] ; |
---|
2004 | iCurAvg += piCur[33] ; |
---|
2005 | iCurAvg += piCur[34] ; |
---|
2006 | iCurAvg += piCur[35] ; |
---|
2007 | iCurAvg += piCur[36] ; |
---|
2008 | iCurAvg += piCur[37] ; |
---|
2009 | iCurAvg += piCur[38] ; |
---|
2010 | iCurAvg += piCur[39] ; |
---|
2011 | iCurAvg += piCur[40] ; |
---|
2012 | iCurAvg += piCur[41] ; |
---|
2013 | iCurAvg += piCur[42] ; |
---|
2014 | iCurAvg += piCur[43] ; |
---|
2015 | iCurAvg += piCur[44] ; |
---|
2016 | iCurAvg += piCur[45] ; |
---|
2017 | iCurAvg += piCur[46] ; |
---|
2018 | iCurAvg += piCur[47] ; |
---|
2019 | iCurAvg += piCur[48] ; |
---|
2020 | iCurAvg += piCur[49] ; |
---|
2021 | iCurAvg += piCur[50] ; |
---|
2022 | iCurAvg += piCur[51] ; |
---|
2023 | iCurAvg += piCur[52] ; |
---|
2024 | iCurAvg += piCur[53] ; |
---|
2025 | iCurAvg += piCur[54] ; |
---|
2026 | iCurAvg += piCur[55] ; |
---|
2027 | iCurAvg += piCur[56] ; |
---|
2028 | iCurAvg += piCur[57] ; |
---|
2029 | iCurAvg += piCur[58] ; |
---|
2030 | iCurAvg += piCur[59] ; |
---|
2031 | iCurAvg += piCur[60] ; |
---|
2032 | iCurAvg += piCur[61] ; |
---|
2033 | iCurAvg += piCur[62] ; |
---|
2034 | iCurAvg += piCur[63] ; |
---|
2035 | |
---|
2036 | piOrg += iStrideOrg; |
---|
2037 | piCur += iStrideCur; |
---|
2038 | uiRowCnt++; |
---|
2039 | } |
---|
2040 | |
---|
2041 | piOrg = pcDtParam->pOrg; |
---|
2042 | piCur = pcDtParam->pCur; |
---|
2043 | iRows = pcDtParam->iRows; |
---|
2044 | |
---|
2045 | iDeltaC = uiRowCnt ? ((iOrigAvg - iCurAvg)/uiRowCnt/64) : 0; |
---|
2046 | |
---|
2047 | for( ; iRows != 0; iRows-=iSubStep ) |
---|
2048 | { |
---|
2049 | uiSum += abs( piOrg[0] - piCur[0] - iDeltaC ); |
---|
2050 | uiSum += abs( piOrg[1] - piCur[1] - iDeltaC ); |
---|
2051 | uiSum += abs( piOrg[2] - piCur[2] - iDeltaC ); |
---|
2052 | uiSum += abs( piOrg[3] - piCur[3] - iDeltaC ); |
---|
2053 | uiSum += abs( piOrg[4] - piCur[4] - iDeltaC ); |
---|
2054 | uiSum += abs( piOrg[5] - piCur[5] - iDeltaC ); |
---|
2055 | uiSum += abs( piOrg[6] - piCur[6] - iDeltaC ); |
---|
2056 | uiSum += abs( piOrg[7] - piCur[7] - iDeltaC ); |
---|
2057 | uiSum += abs( piOrg[8] - piCur[8] - iDeltaC ); |
---|
2058 | uiSum += abs( piOrg[9] - piCur[9] - iDeltaC ); |
---|
2059 | uiSum += abs( piOrg[10] - piCur[10] - iDeltaC ); |
---|
2060 | uiSum += abs( piOrg[11] - piCur[11] - iDeltaC ); |
---|
2061 | uiSum += abs( piOrg[12] - piCur[12] - iDeltaC ); |
---|
2062 | uiSum += abs( piOrg[13] - piCur[13] - iDeltaC ); |
---|
2063 | uiSum += abs( piOrg[14] - piCur[14] - iDeltaC ); |
---|
2064 | uiSum += abs( piOrg[15] - piCur[15] - iDeltaC ); |
---|
2065 | uiSum += abs( piOrg[16] - piCur[16] - iDeltaC ); |
---|
2066 | uiSum += abs( piOrg[17] - piCur[17] - iDeltaC ); |
---|
2067 | uiSum += abs( piOrg[18] - piCur[18] - iDeltaC ); |
---|
2068 | uiSum += abs( piOrg[19] - piCur[19] - iDeltaC ); |
---|
2069 | uiSum += abs( piOrg[20] - piCur[20] - iDeltaC ); |
---|
2070 | uiSum += abs( piOrg[21] - piCur[21] - iDeltaC ); |
---|
2071 | uiSum += abs( piOrg[22] - piCur[22] - iDeltaC ); |
---|
2072 | uiSum += abs( piOrg[23] - piCur[23] - iDeltaC ); |
---|
2073 | uiSum += abs( piOrg[24] - piCur[24] - iDeltaC ); |
---|
2074 | uiSum += abs( piOrg[25] - piCur[25] - iDeltaC ); |
---|
2075 | uiSum += abs( piOrg[26] - piCur[26] - iDeltaC ); |
---|
2076 | uiSum += abs( piOrg[27] - piCur[27] - iDeltaC ); |
---|
2077 | uiSum += abs( piOrg[28] - piCur[28] - iDeltaC ); |
---|
2078 | uiSum += abs( piOrg[29] - piCur[29] - iDeltaC ); |
---|
2079 | uiSum += abs( piOrg[30] - piCur[30] - iDeltaC ); |
---|
2080 | uiSum += abs( piOrg[31] - piCur[31] - iDeltaC ); |
---|
2081 | uiSum += abs( piOrg[32] - piCur[32] - iDeltaC ); |
---|
2082 | uiSum += abs( piOrg[33] - piCur[33] - iDeltaC ); |
---|
2083 | uiSum += abs( piOrg[34] - piCur[34] - iDeltaC ); |
---|
2084 | uiSum += abs( piOrg[35] - piCur[35] - iDeltaC ); |
---|
2085 | uiSum += abs( piOrg[36] - piCur[36] - iDeltaC ); |
---|
2086 | uiSum += abs( piOrg[37] - piCur[37] - iDeltaC ); |
---|
2087 | uiSum += abs( piOrg[38] - piCur[38] - iDeltaC ); |
---|
2088 | uiSum += abs( piOrg[39] - piCur[39] - iDeltaC ); |
---|
2089 | uiSum += abs( piOrg[40] - piCur[40] - iDeltaC ); |
---|
2090 | uiSum += abs( piOrg[41] - piCur[41] - iDeltaC ); |
---|
2091 | uiSum += abs( piOrg[42] - piCur[42] - iDeltaC ); |
---|
2092 | uiSum += abs( piOrg[43] - piCur[43] - iDeltaC ); |
---|
2093 | uiSum += abs( piOrg[44] - piCur[44] - iDeltaC ); |
---|
2094 | uiSum += abs( piOrg[45] - piCur[45] - iDeltaC ); |
---|
2095 | uiSum += abs( piOrg[46] - piCur[46] - iDeltaC ); |
---|
2096 | uiSum += abs( piOrg[47] - piCur[47] - iDeltaC ); |
---|
2097 | uiSum += abs( piOrg[48] - piCur[48] - iDeltaC ); |
---|
2098 | uiSum += abs( piOrg[49] - piCur[49] - iDeltaC ); |
---|
2099 | uiSum += abs( piOrg[50] - piCur[50] - iDeltaC ); |
---|
2100 | uiSum += abs( piOrg[51] - piCur[51] - iDeltaC ); |
---|
2101 | uiSum += abs( piOrg[52] - piCur[52] - iDeltaC ); |
---|
2102 | uiSum += abs( piOrg[53] - piCur[53] - iDeltaC ); |
---|
2103 | uiSum += abs( piOrg[54] - piCur[54] - iDeltaC ); |
---|
2104 | uiSum += abs( piOrg[55] - piCur[55] - iDeltaC ); |
---|
2105 | uiSum += abs( piOrg[56] - piCur[56] - iDeltaC ); |
---|
2106 | uiSum += abs( piOrg[57] - piCur[57] - iDeltaC ); |
---|
2107 | uiSum += abs( piOrg[58] - piCur[58] - iDeltaC ); |
---|
2108 | uiSum += abs( piOrg[59] - piCur[59] - iDeltaC ); |
---|
2109 | uiSum += abs( piOrg[60] - piCur[60] - iDeltaC ); |
---|
2110 | uiSum += abs( piOrg[61] - piCur[61] - iDeltaC ); |
---|
2111 | uiSum += abs( piOrg[62] - piCur[62] - iDeltaC ); |
---|
2112 | uiSum += abs( piOrg[63] - piCur[63] - iDeltaC ); |
---|
2113 | |
---|
2114 | piOrg += iStrideOrg; |
---|
2115 | piCur += iStrideCur; |
---|
2116 | } |
---|
2117 | |
---|
2118 | uiSum <<= iSubShift; |
---|
2119 | return ( uiSum >> g_uiBitIncrement ); |
---|
2120 | } |
---|
2121 | |
---|
2122 | #if AMP_SAD |
---|
2123 | UInt TComRdCost::xGetSAD48ic( DistParam* pcDtParam ) |
---|
2124 | { |
---|
2125 | if ( pcDtParam->bApplyWeight ) |
---|
2126 | { |
---|
2127 | return xGetSADw( pcDtParam ); |
---|
2128 | } |
---|
2129 | Pel* piOrg = pcDtParam->pOrg; |
---|
2130 | Pel* piCur = pcDtParam->pCur; |
---|
2131 | Int iRows = pcDtParam->iRows; |
---|
2132 | Int iSubShift = pcDtParam->iSubShift; |
---|
2133 | Int iSubStep = ( 1 << iSubShift ); |
---|
2134 | Int iStrideCur = pcDtParam->iStrideCur*iSubStep; |
---|
2135 | Int iStrideOrg = pcDtParam->iStrideOrg*iSubStep; |
---|
2136 | |
---|
2137 | UInt uiSum = 0; |
---|
2138 | |
---|
2139 | Int iOrigAvg = 0, iCurAvg = 0, uiRowCnt = 0; |
---|
2140 | Int iDeltaC; |
---|
2141 | |
---|
2142 | for( ; iRows != 0; iRows-=iSubStep ) |
---|
2143 | { |
---|
2144 | iOrigAvg += piOrg[0] ; |
---|
2145 | iOrigAvg += piOrg[1] ; |
---|
2146 | iOrigAvg += piOrg[2] ; |
---|
2147 | iOrigAvg += piOrg[3] ; |
---|
2148 | iOrigAvg += piOrg[4] ; |
---|
2149 | iOrigAvg += piOrg[5] ; |
---|
2150 | iOrigAvg += piOrg[6] ; |
---|
2151 | iOrigAvg += piOrg[7] ; |
---|
2152 | iOrigAvg += piOrg[8] ; |
---|
2153 | iOrigAvg += piOrg[9] ; |
---|
2154 | iOrigAvg += piOrg[10] ; |
---|
2155 | iOrigAvg += piOrg[11] ; |
---|
2156 | iOrigAvg += piOrg[12] ; |
---|
2157 | iOrigAvg += piOrg[13] ; |
---|
2158 | iOrigAvg += piOrg[14] ; |
---|
2159 | iOrigAvg += piOrg[15] ; |
---|
2160 | iOrigAvg += piOrg[16] ; |
---|
2161 | iOrigAvg += piOrg[17] ; |
---|
2162 | iOrigAvg += piOrg[18] ; |
---|
2163 | iOrigAvg += piOrg[19] ; |
---|
2164 | iOrigAvg += piOrg[20] ; |
---|
2165 | iOrigAvg += piOrg[21] ; |
---|
2166 | iOrigAvg += piOrg[22] ; |
---|
2167 | iOrigAvg += piOrg[23] ; |
---|
2168 | iOrigAvg += piOrg[24] ; |
---|
2169 | iOrigAvg += piOrg[25] ; |
---|
2170 | iOrigAvg += piOrg[26] ; |
---|
2171 | iOrigAvg += piOrg[27] ; |
---|
2172 | iOrigAvg += piOrg[28] ; |
---|
2173 | iOrigAvg += piOrg[29] ; |
---|
2174 | iOrigAvg += piOrg[30] ; |
---|
2175 | iOrigAvg += piOrg[31] ; |
---|
2176 | iOrigAvg += piOrg[32] ; |
---|
2177 | iOrigAvg += piOrg[33] ; |
---|
2178 | iOrigAvg += piOrg[34] ; |
---|
2179 | iOrigAvg += piOrg[35] ; |
---|
2180 | iOrigAvg += piOrg[36] ; |
---|
2181 | iOrigAvg += piOrg[37] ; |
---|
2182 | iOrigAvg += piOrg[38] ; |
---|
2183 | iOrigAvg += piOrg[39] ; |
---|
2184 | iOrigAvg += piOrg[40] ; |
---|
2185 | iOrigAvg += piOrg[41] ; |
---|
2186 | iOrigAvg += piOrg[42] ; |
---|
2187 | iOrigAvg += piOrg[43] ; |
---|
2188 | iOrigAvg += piOrg[44] ; |
---|
2189 | iOrigAvg += piOrg[45] ; |
---|
2190 | iOrigAvg += piOrg[46] ; |
---|
2191 | iOrigAvg += piOrg[47] ; |
---|
2192 | |
---|
2193 | iCurAvg += piCur[0] ; |
---|
2194 | iCurAvg += piCur[1] ; |
---|
2195 | iCurAvg += piCur[2] ; |
---|
2196 | iCurAvg += piCur[3] ; |
---|
2197 | iCurAvg += piCur[4] ; |
---|
2198 | iCurAvg += piCur[5] ; |
---|
2199 | iCurAvg += piCur[6] ; |
---|
2200 | iCurAvg += piCur[7] ; |
---|
2201 | iCurAvg += piCur[8] ; |
---|
2202 | iCurAvg += piCur[9] ; |
---|
2203 | iCurAvg += piCur[10] ; |
---|
2204 | iCurAvg += piCur[11] ; |
---|
2205 | iCurAvg += piCur[12] ; |
---|
2206 | iCurAvg += piCur[13] ; |
---|
2207 | iCurAvg += piCur[14] ; |
---|
2208 | iCurAvg += piCur[15] ; |
---|
2209 | iCurAvg += piCur[16] ; |
---|
2210 | iCurAvg += piCur[17] ; |
---|
2211 | iCurAvg += piCur[18] ; |
---|
2212 | iCurAvg += piCur[19] ; |
---|
2213 | iCurAvg += piCur[20] ; |
---|
2214 | iCurAvg += piCur[21] ; |
---|
2215 | iCurAvg += piCur[22] ; |
---|
2216 | iCurAvg += piCur[23] ; |
---|
2217 | iCurAvg += piCur[24] ; |
---|
2218 | iCurAvg += piCur[25] ; |
---|
2219 | iCurAvg += piCur[26] ; |
---|
2220 | iCurAvg += piCur[27] ; |
---|
2221 | iCurAvg += piCur[28] ; |
---|
2222 | iCurAvg += piCur[29] ; |
---|
2223 | iCurAvg += piCur[30] ; |
---|
2224 | iCurAvg += piCur[31] ; |
---|
2225 | iCurAvg += piCur[32] ; |
---|
2226 | iCurAvg += piCur[33] ; |
---|
2227 | iCurAvg += piCur[34] ; |
---|
2228 | iCurAvg += piCur[35] ; |
---|
2229 | iCurAvg += piCur[36] ; |
---|
2230 | iCurAvg += piCur[37] ; |
---|
2231 | iCurAvg += piCur[38] ; |
---|
2232 | iCurAvg += piCur[39] ; |
---|
2233 | iCurAvg += piCur[40] ; |
---|
2234 | iCurAvg += piCur[41] ; |
---|
2235 | iCurAvg += piCur[42] ; |
---|
2236 | iCurAvg += piCur[43] ; |
---|
2237 | iCurAvg += piCur[44] ; |
---|
2238 | iCurAvg += piCur[45] ; |
---|
2239 | iCurAvg += piCur[46] ; |
---|
2240 | iCurAvg += piCur[47] ; |
---|
2241 | |
---|
2242 | piOrg += iStrideOrg; |
---|
2243 | piCur += iStrideCur; |
---|
2244 | uiRowCnt++; |
---|
2245 | } |
---|
2246 | |
---|
2247 | piOrg = pcDtParam->pOrg; |
---|
2248 | piCur = pcDtParam->pCur; |
---|
2249 | iRows = pcDtParam->iRows; |
---|
2250 | |
---|
2251 | iDeltaC = uiRowCnt ? ((iOrigAvg - iCurAvg)/uiRowCnt/48) : 0; |
---|
2252 | |
---|
2253 | for( ; iRows != 0; iRows-=iSubStep ) |
---|
2254 | { |
---|
2255 | uiSum += abs( piOrg[0] - piCur[0] - iDeltaC ); |
---|
2256 | uiSum += abs( piOrg[1] - piCur[1] - iDeltaC ); |
---|
2257 | uiSum += abs( piOrg[2] - piCur[2] - iDeltaC ); |
---|
2258 | uiSum += abs( piOrg[3] - piCur[3] - iDeltaC ); |
---|
2259 | uiSum += abs( piOrg[4] - piCur[4] - iDeltaC ); |
---|
2260 | uiSum += abs( piOrg[5] - piCur[5] - iDeltaC ); |
---|
2261 | uiSum += abs( piOrg[6] - piCur[6] - iDeltaC ); |
---|
2262 | uiSum += abs( piOrg[7] - piCur[7] - iDeltaC ); |
---|
2263 | uiSum += abs( piOrg[8] - piCur[8] - iDeltaC ); |
---|
2264 | uiSum += abs( piOrg[9] - piCur[9] - iDeltaC ); |
---|
2265 | uiSum += abs( piOrg[10] - piCur[10] - iDeltaC ); |
---|
2266 | uiSum += abs( piOrg[11] - piCur[11] - iDeltaC ); |
---|
2267 | uiSum += abs( piOrg[12] - piCur[12] - iDeltaC ); |
---|
2268 | uiSum += abs( piOrg[13] - piCur[13] - iDeltaC ); |
---|
2269 | uiSum += abs( piOrg[14] - piCur[14] - iDeltaC ); |
---|
2270 | uiSum += abs( piOrg[15] - piCur[15] - iDeltaC ); |
---|
2271 | uiSum += abs( piOrg[16] - piCur[16] - iDeltaC ); |
---|
2272 | uiSum += abs( piOrg[17] - piCur[17] - iDeltaC ); |
---|
2273 | uiSum += abs( piOrg[18] - piCur[18] - iDeltaC ); |
---|
2274 | uiSum += abs( piOrg[19] - piCur[19] - iDeltaC ); |
---|
2275 | uiSum += abs( piOrg[20] - piCur[20] - iDeltaC ); |
---|
2276 | uiSum += abs( piOrg[21] - piCur[21] - iDeltaC ); |
---|
2277 | uiSum += abs( piOrg[22] - piCur[22] - iDeltaC ); |
---|
2278 | uiSum += abs( piOrg[23] - piCur[23] - iDeltaC ); |
---|
2279 | uiSum += abs( piOrg[24] - piCur[24] - iDeltaC ); |
---|
2280 | uiSum += abs( piOrg[25] - piCur[25] - iDeltaC ); |
---|
2281 | uiSum += abs( piOrg[26] - piCur[26] - iDeltaC ); |
---|
2282 | uiSum += abs( piOrg[27] - piCur[27] - iDeltaC ); |
---|
2283 | uiSum += abs( piOrg[28] - piCur[28] - iDeltaC ); |
---|
2284 | uiSum += abs( piOrg[29] - piCur[29] - iDeltaC ); |
---|
2285 | uiSum += abs( piOrg[30] - piCur[30] - iDeltaC ); |
---|
2286 | uiSum += abs( piOrg[31] - piCur[31] - iDeltaC ); |
---|
2287 | uiSum += abs( piOrg[32] - piCur[32] - iDeltaC ); |
---|
2288 | uiSum += abs( piOrg[33] - piCur[33] - iDeltaC ); |
---|
2289 | uiSum += abs( piOrg[34] - piCur[34] - iDeltaC ); |
---|
2290 | uiSum += abs( piOrg[35] - piCur[35] - iDeltaC ); |
---|
2291 | uiSum += abs( piOrg[36] - piCur[36] - iDeltaC ); |
---|
2292 | uiSum += abs( piOrg[37] - piCur[37] - iDeltaC ); |
---|
2293 | uiSum += abs( piOrg[38] - piCur[38] - iDeltaC ); |
---|
2294 | uiSum += abs( piOrg[39] - piCur[39] - iDeltaC ); |
---|
2295 | uiSum += abs( piOrg[40] - piCur[40] - iDeltaC ); |
---|
2296 | uiSum += abs( piOrg[41] - piCur[41] - iDeltaC ); |
---|
2297 | uiSum += abs( piOrg[42] - piCur[42] - iDeltaC ); |
---|
2298 | uiSum += abs( piOrg[43] - piCur[43] - iDeltaC ); |
---|
2299 | uiSum += abs( piOrg[44] - piCur[44] - iDeltaC ); |
---|
2300 | uiSum += abs( piOrg[45] - piCur[45] - iDeltaC ); |
---|
2301 | uiSum += abs( piOrg[46] - piCur[46] - iDeltaC ); |
---|
2302 | uiSum += abs( piOrg[47] - piCur[47] - iDeltaC ); |
---|
2303 | |
---|
2304 | piOrg += iStrideOrg; |
---|
2305 | piCur += iStrideCur; |
---|
2306 | } |
---|
2307 | |
---|
2308 | uiSum <<= iSubShift; |
---|
2309 | return ( uiSum >> g_uiBitIncrement ); |
---|
2310 | } |
---|
2311 | #endif |
---|
2312 | #endif |
---|
2313 | |
---|
2314 | // -------------------------------------------------------------------------------------------------------------------- |
---|
2315 | // SSE |
---|
2316 | // -------------------------------------------------------------------------------------------------------------------- |
---|
2317 | |
---|
2318 | #if IBDI_DISTORTION |
---|
2319 | UInt TComRdCost::xGetSSE( DistParam* pcDtParam ) |
---|
2320 | { |
---|
2321 | Pel* piOrg = pcDtParam->pOrg; |
---|
2322 | Pel* piCur = pcDtParam->pCur; |
---|
2323 | Int iRows = pcDtParam->iRows; |
---|
2324 | Int iCols = pcDtParam->iCols; |
---|
2325 | Int iStrideOrg = pcDtParam->iStrideOrg; |
---|
2326 | Int iStrideCur = pcDtParam->iStrideCur; |
---|
2327 | |
---|
2328 | UInt uiSum = 0; |
---|
2329 | Int iShift = g_uiBitIncrement; |
---|
2330 | Int iOffset = (g_uiBitIncrement>0)? (1<<(g_uiBitIncrement-1)):0; |
---|
2331 | |
---|
2332 | Int iTemp; |
---|
2333 | |
---|
2334 | for( ; iRows != 0; iRows-- ) |
---|
2335 | { |
---|
2336 | for (Int n = 0; n < iCols; n++ ) |
---|
2337 | { |
---|
2338 | iTemp = ((piOrg[n ]+iOffset)>>iShift) - ((piCur[n ]+iOffset)>>iShift); |
---|
2339 | uiSum += iTemp * iTemp; |
---|
2340 | } |
---|
2341 | piOrg += iStrideOrg; |
---|
2342 | piCur += iStrideCur; |
---|
2343 | } |
---|
2344 | |
---|
2345 | return ( uiSum ); |
---|
2346 | } |
---|
2347 | |
---|
2348 | UInt TComRdCost::xGetSSE4( DistParam* pcDtParam ) |
---|
2349 | { |
---|
2350 | Pel* piOrg = pcDtParam->pOrg; |
---|
2351 | Pel* piCur = pcDtParam->pCur; |
---|
2352 | Int iRows = pcDtParam->iRows; |
---|
2353 | Int iStrideOrg = pcDtParam->iStrideOrg; |
---|
2354 | Int iStrideCur = pcDtParam->iStrideCur; |
---|
2355 | |
---|
2356 | UInt uiSum = 0; |
---|
2357 | Int iShift = g_uiBitIncrement; |
---|
2358 | Int iOffset = (g_uiBitIncrement>0)? (1<<(g_uiBitIncrement-1)):0; |
---|
2359 | |
---|
2360 | Int iTemp; |
---|
2361 | |
---|
2362 | for( ; iRows != 0; iRows-- ) |
---|
2363 | { |
---|
2364 | |
---|
2365 | iTemp = ((piOrg[0]+iOffset)>>iShift) - ((piCur[0]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
2366 | iTemp = ((piOrg[1]+iOffset)>>iShift) - ((piCur[1]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
2367 | iTemp = ((piOrg[2]+iOffset)>>iShift) - ((piCur[2]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
2368 | iTemp = ((piOrg[3]+iOffset)>>iShift) - ((piCur[3]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
2369 | |
---|
2370 | piOrg += iStrideOrg; |
---|
2371 | piCur += iStrideCur; |
---|
2372 | } |
---|
2373 | |
---|
2374 | return ( uiSum ); |
---|
2375 | } |
---|
2376 | |
---|
2377 | UInt TComRdCost::xGetSSE8( DistParam* pcDtParam ) |
---|
2378 | { |
---|
2379 | Pel* piOrg = pcDtParam->pOrg; |
---|
2380 | Pel* piCur = pcDtParam->pCur; |
---|
2381 | Int iRows = pcDtParam->iRows; |
---|
2382 | Int iStrideOrg = pcDtParam->iStrideOrg; |
---|
2383 | Int iStrideCur = pcDtParam->iStrideCur; |
---|
2384 | |
---|
2385 | UInt uiSum = 0; |
---|
2386 | Int iShift = g_uiBitIncrement; |
---|
2387 | Int iOffset = (g_uiBitIncrement>0)? (1<<(g_uiBitIncrement-1)):0; |
---|
2388 | |
---|
2389 | Int iTemp; |
---|
2390 | |
---|
2391 | for( ; iRows != 0; iRows-- ) |
---|
2392 | { |
---|
2393 | iTemp = ((piOrg[0]+iOffset)>>iShift) - ((piCur[0]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
2394 | iTemp = ((piOrg[1]+iOffset)>>iShift) - ((piCur[1]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
2395 | iTemp = ((piOrg[2]+iOffset)>>iShift) - ((piCur[2]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
2396 | iTemp = ((piOrg[3]+iOffset)>>iShift) - ((piCur[3]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
2397 | iTemp = ((piOrg[4]+iOffset)>>iShift) - ((piCur[4]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
2398 | iTemp = ((piOrg[5]+iOffset)>>iShift) - ((piCur[5]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
2399 | iTemp = ((piOrg[6]+iOffset)>>iShift) - ((piCur[6]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
2400 | iTemp = ((piOrg[7]+iOffset)>>iShift) - ((piCur[7]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
2401 | |
---|
2402 | piOrg += iStrideOrg; |
---|
2403 | piCur += iStrideCur; |
---|
2404 | } |
---|
2405 | |
---|
2406 | return ( uiSum ); |
---|
2407 | } |
---|
2408 | |
---|
2409 | UInt TComRdCost::xGetSSE16( DistParam* pcDtParam ) |
---|
2410 | { |
---|
2411 | Pel* piOrg = pcDtParam->pOrg; |
---|
2412 | Pel* piCur = pcDtParam->pCur; |
---|
2413 | Int iRows = pcDtParam->iRows; |
---|
2414 | Int iStrideOrg = pcDtParam->iStrideOrg; |
---|
2415 | Int iStrideCur = pcDtParam->iStrideCur; |
---|
2416 | |
---|
2417 | UInt uiSum = 0; |
---|
2418 | Int iShift = g_uiBitIncrement; |
---|
2419 | Int iOffset = (g_uiBitIncrement>0)? (1<<(g_uiBitIncrement-1)):0; |
---|
2420 | |
---|
2421 | Int iTemp; |
---|
2422 | |
---|
2423 | for( ; iRows != 0; iRows-- ) |
---|
2424 | { |
---|
2425 | |
---|
2426 | iTemp = ((piOrg[ 0]+iOffset)>>iShift) - ((piCur[ 0]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
2427 | iTemp = ((piOrg[ 1]+iOffset)>>iShift) - ((piCur[ 1]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
2428 | iTemp = ((piOrg[ 2]+iOffset)>>iShift) - ((piCur[ 2]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
2429 | iTemp = ((piOrg[ 3]+iOffset)>>iShift) - ((piCur[ 3]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
2430 | iTemp = ((piOrg[ 4]+iOffset)>>iShift) - ((piCur[ 4]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
2431 | iTemp = ((piOrg[ 5]+iOffset)>>iShift) - ((piCur[ 5]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
2432 | iTemp = ((piOrg[ 6]+iOffset)>>iShift) - ((piCur[ 6]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
2433 | iTemp = ((piOrg[ 7]+iOffset)>>iShift) - ((piCur[ 7]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
2434 | iTemp = ((piOrg[ 8]+iOffset)>>iShift) - ((piCur[ 8]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
2435 | iTemp = ((piOrg[ 9]+iOffset)>>iShift) - ((piCur[ 9]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
2436 | iTemp = ((piOrg[10]+iOffset)>>iShift) - ((piCur[10]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
2437 | iTemp = ((piOrg[11]+iOffset)>>iShift) - ((piCur[11]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
2438 | iTemp = ((piOrg[12]+iOffset)>>iShift) - ((piCur[12]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
2439 | iTemp = ((piOrg[13]+iOffset)>>iShift) - ((piCur[13]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
2440 | iTemp = ((piOrg[14]+iOffset)>>iShift) - ((piCur[14]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
2441 | iTemp = ((piOrg[15]+iOffset)>>iShift) - ((piCur[15]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
2442 | |
---|
2443 | piOrg += iStrideOrg; |
---|
2444 | piCur += iStrideCur; |
---|
2445 | } |
---|
2446 | |
---|
2447 | return ( uiSum ); |
---|
2448 | } |
---|
2449 | |
---|
2450 | UInt TComRdCost::xGetSSE16N( DistParam* pcDtParam ) |
---|
2451 | { |
---|
2452 | Pel* piOrg = pcDtParam->pOrg; |
---|
2453 | Pel* piCur = pcDtParam->pCur; |
---|
2454 | Int iRows = pcDtParam->iRows; |
---|
2455 | Int iCols = pcDtParam->iCols; |
---|
2456 | Int iStrideOrg = pcDtParam->iStrideOrg; |
---|
2457 | Int iStrideCur = pcDtParam->iStrideCur; |
---|
2458 | |
---|
2459 | UInt uiSum = 0; |
---|
2460 | Int iShift = g_uiBitIncrement; |
---|
2461 | Int iOffset = (g_uiBitIncrement>0)? (1<<(g_uiBitIncrement-1)):0; |
---|
2462 | Int iTemp; |
---|
2463 | |
---|
2464 | for( ; iRows != 0; iRows-- ) |
---|
2465 | { |
---|
2466 | for (Int n = 0; n < iCols; n+=16 ) |
---|
2467 | { |
---|
2468 | |
---|
2469 | iTemp = ((piOrg[n+ 0]+iOffset)>>iShift) - ((piCur[n+ 0]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
2470 | iTemp = ((piOrg[n+ 1]+iOffset)>>iShift) - ((piCur[n+ 1]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
2471 | iTemp = ((piOrg[n+ 2]+iOffset)>>iShift) - ((piCur[n+ 2]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
2472 | iTemp = ((piOrg[n+ 3]+iOffset)>>iShift) - ((piCur[n+ 3]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
2473 | iTemp = ((piOrg[n+ 4]+iOffset)>>iShift) - ((piCur[n+ 4]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
2474 | iTemp = ((piOrg[n+ 5]+iOffset)>>iShift) - ((piCur[n+ 5]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
2475 | iTemp = ((piOrg[n+ 6]+iOffset)>>iShift) - ((piCur[n+ 6]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
2476 | iTemp = ((piOrg[n+ 7]+iOffset)>>iShift) - ((piCur[n+ 7]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
2477 | iTemp = ((piOrg[n+ 8]+iOffset)>>iShift) - ((piCur[n+ 8]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
2478 | iTemp = ((piOrg[n+ 9]+iOffset)>>iShift) - ((piCur[n+ 9]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
2479 | iTemp = ((piOrg[n+10]+iOffset)>>iShift) - ((piCur[n+10]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
2480 | iTemp = ((piOrg[n+11]+iOffset)>>iShift) - ((piCur[n+11]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
2481 | iTemp = ((piOrg[n+12]+iOffset)>>iShift) - ((piCur[n+12]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
2482 | iTemp = ((piOrg[n+13]+iOffset)>>iShift) - ((piCur[n+13]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
2483 | iTemp = ((piOrg[n+14]+iOffset)>>iShift) - ((piCur[n+14]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
2484 | iTemp = ((piOrg[n+15]+iOffset)>>iShift) - ((piCur[n+15]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
2485 | |
---|
2486 | } |
---|
2487 | piOrg += iStrideOrg; |
---|
2488 | piCur += iStrideCur; |
---|
2489 | } |
---|
2490 | |
---|
2491 | return ( uiSum ); |
---|
2492 | } |
---|
2493 | |
---|
2494 | UInt TComRdCost::xGetSSE32( DistParam* pcDtParam ) |
---|
2495 | { |
---|
2496 | Pel* piOrg = pcDtParam->pOrg; |
---|
2497 | Pel* piCur = pcDtParam->pCur; |
---|
2498 | Int iRows = pcDtParam->iRows; |
---|
2499 | Int iStrideOrg = pcDtParam->iStrideOrg; |
---|
2500 | Int iStrideCur = pcDtParam->iStrideCur; |
---|
2501 | |
---|
2502 | UInt uiSum = 0; |
---|
2503 | Int iShift = g_uiBitIncrement; |
---|
2504 | Int iOffset = (g_uiBitIncrement>0)? (1<<(g_uiBitIncrement-1)):0; |
---|
2505 | Int iTemp; |
---|
2506 | |
---|
2507 | for( ; iRows != 0; iRows-- ) |
---|
2508 | { |
---|
2509 | |
---|
2510 | iTemp = ((piOrg[ 0]+iOffset)>>iShift) - ((piCur[ 0]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
2511 | iTemp = ((piOrg[ 1]+iOffset)>>iShift) - ((piCur[ 1]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
2512 | iTemp = ((piOrg[ 2]+iOffset)>>iShift) - ((piCur[ 2]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
2513 | iTemp = ((piOrg[ 3]+iOffset)>>iShift) - ((piCur[ 3]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
2514 | iTemp = ((piOrg[ 4]+iOffset)>>iShift) - ((piCur[ 4]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
2515 | iTemp = ((piOrg[ 5]+iOffset)>>iShift) - ((piCur[ 5]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
2516 | iTemp = ((piOrg[ 6]+iOffset)>>iShift) - ((piCur[ 6]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
2517 | iTemp = ((piOrg[ 7]+iOffset)>>iShift) - ((piCur[ 7]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
2518 | iTemp = ((piOrg[ 8]+iOffset)>>iShift) - ((piCur[ 8]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
2519 | iTemp = ((piOrg[ 9]+iOffset)>>iShift) - ((piCur[ 9]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
2520 | iTemp = ((piOrg[10]+iOffset)>>iShift) - ((piCur[10]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
2521 | iTemp = ((piOrg[11]+iOffset)>>iShift) - ((piCur[11]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
2522 | iTemp = ((piOrg[12]+iOffset)>>iShift) - ((piCur[12]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
2523 | iTemp = ((piOrg[13]+iOffset)>>iShift) - ((piCur[13]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
2524 | iTemp = ((piOrg[14]+iOffset)>>iShift) - ((piCur[14]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
2525 | iTemp = ((piOrg[15]+iOffset)>>iShift) - ((piCur[15]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
2526 | iTemp = ((piOrg[16]+iOffset)>>iShift) - ((piCur[16]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
2527 | iTemp = ((piOrg[17]+iOffset)>>iShift) - ((piCur[17]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
2528 | iTemp = ((piOrg[18]+iOffset)>>iShift) - ((piCur[18]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
2529 | iTemp = ((piOrg[19]+iOffset)>>iShift) - ((piCur[19]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
2530 | iTemp = ((piOrg[20]+iOffset)>>iShift) - ((piCur[20]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
2531 | iTemp = ((piOrg[21]+iOffset)>>iShift) - ((piCur[21]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
2532 | iTemp = ((piOrg[22]+iOffset)>>iShift) - ((piCur[22]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
2533 | iTemp = ((piOrg[23]+iOffset)>>iShift) - ((piCur[23]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
2534 | iTemp = ((piOrg[24]+iOffset)>>iShift) - ((piCur[24]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
2535 | iTemp = ((piOrg[25]+iOffset)>>iShift) - ((piCur[25]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
2536 | iTemp = ((piOrg[26]+iOffset)>>iShift) - ((piCur[26]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
2537 | iTemp = ((piOrg[27]+iOffset)>>iShift) - ((piCur[27]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
2538 | iTemp = ((piOrg[28]+iOffset)>>iShift) - ((piCur[28]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
2539 | iTemp = ((piOrg[29]+iOffset)>>iShift) - ((piCur[29]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
2540 | iTemp = ((piOrg[30]+iOffset)>>iShift) - ((piCur[30]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
2541 | iTemp = ((piOrg[31]+iOffset)>>iShift) - ((piCur[31]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
2542 | |
---|
2543 | piOrg += iStrideOrg; |
---|
2544 | piCur += iStrideCur; |
---|
2545 | } |
---|
2546 | |
---|
2547 | return ( uiSum ); |
---|
2548 | } |
---|
2549 | |
---|
2550 | UInt TComRdCost::xGetSSE64( DistParam* pcDtParam ) |
---|
2551 | { |
---|
2552 | Pel* piOrg = pcDtParam->pOrg; |
---|
2553 | Pel* piCur = pcDtParam->pCur; |
---|
2554 | Int iRows = pcDtParam->iRows; |
---|
2555 | Int iStrideOrg = pcDtParam->iStrideOrg; |
---|
2556 | Int iStrideCur = pcDtParam->iStrideCur; |
---|
2557 | |
---|
2558 | UInt uiSum = 0; |
---|
2559 | Int iShift = g_uiBitIncrement; |
---|
2560 | Int iOffset = (g_uiBitIncrement>0)? (1<<(g_uiBitIncrement-1)):0; |
---|
2561 | Int iTemp; |
---|
2562 | |
---|
2563 | for( ; iRows != 0; iRows-- ) |
---|
2564 | { |
---|
2565 | iTemp = ((piOrg[ 0]+iOffset)>>iShift) - ((piCur[ 0]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
2566 | iTemp = ((piOrg[ 1]+iOffset)>>iShift) - ((piCur[ 1]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
2567 | iTemp = ((piOrg[ 2]+iOffset)>>iShift) - ((piCur[ 2]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
2568 | iTemp = ((piOrg[ 3]+iOffset)>>iShift) - ((piCur[ 3]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
2569 | iTemp = ((piOrg[ 4]+iOffset)>>iShift) - ((piCur[ 4]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
2570 | iTemp = ((piOrg[ 5]+iOffset)>>iShift) - ((piCur[ 5]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
2571 | iTemp = ((piOrg[ 6]+iOffset)>>iShift) - ((piCur[ 6]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
2572 | iTemp = ((piOrg[ 7]+iOffset)>>iShift) - ((piCur[ 7]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
2573 | iTemp = ((piOrg[ 8]+iOffset)>>iShift) - ((piCur[ 8]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
2574 | iTemp = ((piOrg[ 9]+iOffset)>>iShift) - ((piCur[ 9]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
2575 | iTemp = ((piOrg[10]+iOffset)>>iShift) - ((piCur[10]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
2576 | iTemp = ((piOrg[11]+iOffset)>>iShift) - ((piCur[11]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
2577 | iTemp = ((piOrg[12]+iOffset)>>iShift) - ((piCur[12]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
2578 | iTemp = ((piOrg[13]+iOffset)>>iShift) - ((piCur[13]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
2579 | iTemp = ((piOrg[14]+iOffset)>>iShift) - ((piCur[14]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
2580 | iTemp = ((piOrg[15]+iOffset)>>iShift) - ((piCur[15]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
2581 | iTemp = ((piOrg[16]+iOffset)>>iShift) - ((piCur[16]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
2582 | iTemp = ((piOrg[17]+iOffset)>>iShift) - ((piCur[17]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
2583 | iTemp = ((piOrg[18]+iOffset)>>iShift) - ((piCur[18]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
2584 | iTemp = ((piOrg[19]+iOffset)>>iShift) - ((piCur[19]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
2585 | iTemp = ((piOrg[20]+iOffset)>>iShift) - ((piCur[20]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
2586 | iTemp = ((piOrg[21]+iOffset)>>iShift) - ((piCur[21]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
2587 | iTemp = ((piOrg[22]+iOffset)>>iShift) - ((piCur[22]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
2588 | iTemp = ((piOrg[23]+iOffset)>>iShift) - ((piCur[23]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
2589 | iTemp = ((piOrg[24]+iOffset)>>iShift) - ((piCur[24]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
2590 | iTemp = ((piOrg[25]+iOffset)>>iShift) - ((piCur[25]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
2591 | iTemp = ((piOrg[26]+iOffset)>>iShift) - ((piCur[26]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
2592 | iTemp = ((piOrg[27]+iOffset)>>iShift) - ((piCur[27]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
2593 | iTemp = ((piOrg[28]+iOffset)>>iShift) - ((piCur[28]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
2594 | iTemp = ((piOrg[29]+iOffset)>>iShift) - ((piCur[29]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
2595 | iTemp = ((piOrg[30]+iOffset)>>iShift) - ((piCur[30]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
2596 | iTemp = ((piOrg[31]+iOffset)>>iShift) - ((piCur[31]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
2597 | iTemp = ((piOrg[32]+iOffset)>>iShift) - ((piCur[32]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
2598 | iTemp = ((piOrg[33]+iOffset)>>iShift) - ((piCur[33]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
2599 | iTemp = ((piOrg[34]+iOffset)>>iShift) - ((piCur[34]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
2600 | iTemp = ((piOrg[35]+iOffset)>>iShift) - ((piCur[35]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
2601 | iTemp = ((piOrg[36]+iOffset)>>iShift) - ((piCur[36]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
2602 | iTemp = ((piOrg[37]+iOffset)>>iShift) - ((piCur[37]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
2603 | iTemp = ((piOrg[38]+iOffset)>>iShift) - ((piCur[38]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
2604 | iTemp = ((piOrg[39]+iOffset)>>iShift) - ((piCur[39]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
2605 | iTemp = ((piOrg[40]+iOffset)>>iShift) - ((piCur[40]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
2606 | iTemp = ((piOrg[41]+iOffset)>>iShift) - ((piCur[41]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
2607 | iTemp = ((piOrg[42]+iOffset)>>iShift) - ((piCur[42]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
2608 | iTemp = ((piOrg[43]+iOffset)>>iShift) - ((piCur[43]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
2609 | iTemp = ((piOrg[44]+iOffset)>>iShift) - ((piCur[44]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
2610 | iTemp = ((piOrg[45]+iOffset)>>iShift) - ((piCur[45]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
2611 | iTemp = ((piOrg[46]+iOffset)>>iShift) - ((piCur[46]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
2612 | iTemp = ((piOrg[47]+iOffset)>>iShift) - ((piCur[47]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
2613 | iTemp = ((piOrg[48]+iOffset)>>iShift) - ((piCur[48]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
2614 | iTemp = ((piOrg[49]+iOffset)>>iShift) - ((piCur[49]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
2615 | iTemp = ((piOrg[50]+iOffset)>>iShift) - ((piCur[50]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
2616 | iTemp = ((piOrg[51]+iOffset)>>iShift) - ((piCur[51]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
2617 | iTemp = ((piOrg[52]+iOffset)>>iShift) - ((piCur[52]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
2618 | iTemp = ((piOrg[53]+iOffset)>>iShift) - ((piCur[53]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
2619 | iTemp = ((piOrg[54]+iOffset)>>iShift) - ((piCur[54]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
2620 | iTemp = ((piOrg[55]+iOffset)>>iShift) - ((piCur[55]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
2621 | iTemp = ((piOrg[56]+iOffset)>>iShift) - ((piCur[56]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
2622 | iTemp = ((piOrg[57]+iOffset)>>iShift) - ((piCur[57]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
2623 | iTemp = ((piOrg[58]+iOffset)>>iShift) - ((piCur[58]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
2624 | iTemp = ((piOrg[59]+iOffset)>>iShift) - ((piCur[59]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
2625 | iTemp = ((piOrg[60]+iOffset)>>iShift) - ((piCur[60]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
2626 | iTemp = ((piOrg[61]+iOffset)>>iShift) - ((piCur[61]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
2627 | iTemp = ((piOrg[62]+iOffset)>>iShift) - ((piCur[62]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
2628 | iTemp = ((piOrg[63]+iOffset)>>iShift) - ((piCur[63]+iOffset)>>iShift); uiSum += iTemp * iTemp; |
---|
2629 | |
---|
2630 | piOrg += iStrideOrg; |
---|
2631 | piCur += iStrideCur; |
---|
2632 | } |
---|
2633 | |
---|
2634 | return ( uiSum ); |
---|
2635 | } |
---|
2636 | #else |
---|
2637 | UInt TComRdCost::xGetSSE( DistParam* pcDtParam ) |
---|
2638 | { |
---|
2639 | if ( pcDtParam->bApplyWeight ) |
---|
2640 | { |
---|
2641 | return xGetSSEw( pcDtParam ); |
---|
2642 | } |
---|
2643 | Pel* piOrg = pcDtParam->pOrg; |
---|
2644 | Pel* piCur = pcDtParam->pCur; |
---|
2645 | Int iRows = pcDtParam->iRows; |
---|
2646 | Int iCols = pcDtParam->iCols; |
---|
2647 | Int iStrideOrg = pcDtParam->iStrideOrg; |
---|
2648 | Int iStrideCur = pcDtParam->iStrideCur; |
---|
2649 | |
---|
2650 | UInt uiSum = 0; |
---|
2651 | UInt uiShift = g_uiBitIncrement<<1; |
---|
2652 | |
---|
2653 | Int iTemp; |
---|
2654 | |
---|
2655 | #if HHI_INTERVIEW_SKIP |
---|
2656 | if( pcDtParam->pUsed ) |
---|
2657 | { |
---|
2658 | Pel* piUsed = pcDtParam->pUsed; |
---|
2659 | Int iStrideUsed = pcDtParam->iStrideUsed; |
---|
2660 | for( ; iRows != 0; iRows-- ) |
---|
2661 | { |
---|
2662 | for (Int n = 0; n < iCols; n++ ) |
---|
2663 | { |
---|
2664 | if( piUsed[n] ) |
---|
2665 | { |
---|
2666 | iTemp = piOrg[n ] - piCur[n ]; |
---|
2667 | uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
2668 | } |
---|
2669 | } |
---|
2670 | piOrg += iStrideOrg; |
---|
2671 | piCur += iStrideCur; |
---|
2672 | piUsed += iStrideUsed; |
---|
2673 | } |
---|
2674 | } |
---|
2675 | else |
---|
2676 | { |
---|
2677 | #endif |
---|
2678 | for( ; iRows != 0; iRows-- ) |
---|
2679 | { |
---|
2680 | for (Int n = 0; n < iCols; n++ ) |
---|
2681 | { |
---|
2682 | iTemp = piOrg[n ] - piCur[n ]; |
---|
2683 | uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
2684 | } |
---|
2685 | piOrg += iStrideOrg; |
---|
2686 | piCur += iStrideCur; |
---|
2687 | } |
---|
2688 | #if HHI_INTERVIEW_SKIP |
---|
2689 | } |
---|
2690 | #endif |
---|
2691 | |
---|
2692 | return ( uiSum ); |
---|
2693 | } |
---|
2694 | |
---|
2695 | UInt TComRdCost::xGetSSE4( DistParam* pcDtParam ) |
---|
2696 | { |
---|
2697 | if ( pcDtParam->bApplyWeight ) |
---|
2698 | { |
---|
2699 | assert( pcDtParam->iCols == 4 ); |
---|
2700 | return xGetSSEw( pcDtParam ); |
---|
2701 | } |
---|
2702 | Pel* piOrg = pcDtParam->pOrg; |
---|
2703 | Pel* piCur = pcDtParam->pCur; |
---|
2704 | Int iRows = pcDtParam->iRows; |
---|
2705 | Int iStrideOrg = pcDtParam->iStrideOrg; |
---|
2706 | Int iStrideCur = pcDtParam->iStrideCur; |
---|
2707 | |
---|
2708 | UInt uiSum = 0; |
---|
2709 | UInt uiShift = g_uiBitIncrement<<1; |
---|
2710 | |
---|
2711 | Int iTemp; |
---|
2712 | |
---|
2713 | #if HHI_INTERVIEW_SKIP |
---|
2714 | if( pcDtParam->pUsed ) |
---|
2715 | { |
---|
2716 | Pel* piUsed = pcDtParam->pUsed; |
---|
2717 | Int iStrideUsed = pcDtParam->iStrideUsed; |
---|
2718 | for( ; iRows != 0; iRows-- ) |
---|
2719 | { |
---|
2720 | if( piUsed[0] ) { iTemp = piOrg[0] - piCur[0]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
2721 | if( piUsed[1] ) { iTemp = piOrg[1] - piCur[1]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
2722 | if( piUsed[2] ) { iTemp = piOrg[2] - piCur[2]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
2723 | if( piUsed[3] ) { iTemp = piOrg[3] - piCur[3]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
2724 | |
---|
2725 | piOrg += iStrideOrg; |
---|
2726 | piCur += iStrideCur; |
---|
2727 | piUsed += iStrideUsed; |
---|
2728 | } |
---|
2729 | } |
---|
2730 | else |
---|
2731 | { |
---|
2732 | #endif |
---|
2733 | for( ; iRows != 0; iRows-- ) |
---|
2734 | { |
---|
2735 | |
---|
2736 | iTemp = piOrg[0] - piCur[0]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
2737 | iTemp = piOrg[1] - piCur[1]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
2738 | iTemp = piOrg[2] - piCur[2]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
2739 | iTemp = piOrg[3] - piCur[3]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
2740 | |
---|
2741 | piOrg += iStrideOrg; |
---|
2742 | piCur += iStrideCur; |
---|
2743 | } |
---|
2744 | #if HHI_INTERVIEW_SKIP |
---|
2745 | } |
---|
2746 | #endif |
---|
2747 | |
---|
2748 | return ( uiSum ); |
---|
2749 | } |
---|
2750 | |
---|
2751 | UInt TComRdCost::xGetSSE8( DistParam* pcDtParam ) |
---|
2752 | { |
---|
2753 | if ( pcDtParam->bApplyWeight ) |
---|
2754 | { |
---|
2755 | assert( pcDtParam->iCols == 8 ); |
---|
2756 | return xGetSSEw( pcDtParam ); |
---|
2757 | } |
---|
2758 | Pel* piOrg = pcDtParam->pOrg; |
---|
2759 | Pel* piCur = pcDtParam->pCur; |
---|
2760 | Int iRows = pcDtParam->iRows; |
---|
2761 | Int iStrideOrg = pcDtParam->iStrideOrg; |
---|
2762 | Int iStrideCur = pcDtParam->iStrideCur; |
---|
2763 | |
---|
2764 | UInt uiSum = 0; |
---|
2765 | UInt uiShift = g_uiBitIncrement<<1; |
---|
2766 | |
---|
2767 | Int iTemp; |
---|
2768 | |
---|
2769 | #if HHI_INTERVIEW_SKIP |
---|
2770 | if( pcDtParam->pUsed ) |
---|
2771 | { |
---|
2772 | Pel* piUsed = pcDtParam->pUsed; |
---|
2773 | Int iStrideUsed = pcDtParam->iStrideUsed; |
---|
2774 | for( ; iRows != 0; iRows-- ) |
---|
2775 | { |
---|
2776 | if( piUsed[0] ) { iTemp = piOrg[0] - piCur[0]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
2777 | if( piUsed[1] ) { iTemp = piOrg[1] - piCur[1]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
2778 | if( piUsed[2] ) { iTemp = piOrg[2] - piCur[2]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
2779 | if( piUsed[3] ) { iTemp = piOrg[3] - piCur[3]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
2780 | if( piUsed[4] ) { iTemp = piOrg[4] - piCur[4]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
2781 | if( piUsed[5] ) { iTemp = piOrg[5] - piCur[5]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
2782 | if( piUsed[6] ) { iTemp = piOrg[6] - piCur[6]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
2783 | if( piUsed[7] ) { iTemp = piOrg[7] - piCur[7]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
2784 | |
---|
2785 | piOrg += iStrideOrg; |
---|
2786 | piCur += iStrideCur; |
---|
2787 | piUsed += iStrideUsed; |
---|
2788 | } |
---|
2789 | } |
---|
2790 | else |
---|
2791 | { |
---|
2792 | #endif |
---|
2793 | for( ; iRows != 0; iRows-- ) |
---|
2794 | { |
---|
2795 | iTemp = piOrg[0] - piCur[0]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
2796 | iTemp = piOrg[1] - piCur[1]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
2797 | iTemp = piOrg[2] - piCur[2]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
2798 | iTemp = piOrg[3] - piCur[3]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
2799 | iTemp = piOrg[4] - piCur[4]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
2800 | iTemp = piOrg[5] - piCur[5]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
2801 | iTemp = piOrg[6] - piCur[6]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
2802 | iTemp = piOrg[7] - piCur[7]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
2803 | |
---|
2804 | piOrg += iStrideOrg; |
---|
2805 | piCur += iStrideCur; |
---|
2806 | } |
---|
2807 | #if HHI_INTERVIEW_SKIP |
---|
2808 | } |
---|
2809 | #endif |
---|
2810 | |
---|
2811 | return ( uiSum ); |
---|
2812 | } |
---|
2813 | |
---|
2814 | UInt TComRdCost::xGetSSE16( DistParam* pcDtParam ) |
---|
2815 | { |
---|
2816 | if ( pcDtParam->bApplyWeight ) |
---|
2817 | { |
---|
2818 | assert( pcDtParam->iCols == 16 ); |
---|
2819 | return xGetSSEw( pcDtParam ); |
---|
2820 | } |
---|
2821 | Pel* piOrg = pcDtParam->pOrg; |
---|
2822 | Pel* piCur = pcDtParam->pCur; |
---|
2823 | Int iRows = pcDtParam->iRows; |
---|
2824 | Int iStrideOrg = pcDtParam->iStrideOrg; |
---|
2825 | Int iStrideCur = pcDtParam->iStrideCur; |
---|
2826 | |
---|
2827 | UInt uiSum = 0; |
---|
2828 | UInt uiShift = g_uiBitIncrement<<1; |
---|
2829 | |
---|
2830 | Int iTemp; |
---|
2831 | |
---|
2832 | #if HHI_INTERVIEW_SKIP |
---|
2833 | if( pcDtParam->pUsed ) |
---|
2834 | { |
---|
2835 | Pel* piUsed = pcDtParam->pUsed; |
---|
2836 | Int iStrideUsed = pcDtParam->iStrideUsed; |
---|
2837 | for( ; iRows != 0; iRows-- ) |
---|
2838 | { |
---|
2839 | if( piUsed[ 0] ) { iTemp = piOrg[ 0] - piCur[ 0]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
2840 | if( piUsed[ 1] ) { iTemp = piOrg[ 1] - piCur[ 1]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
2841 | if( piUsed[ 2] ) { iTemp = piOrg[ 2] - piCur[ 2]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
2842 | if( piUsed[ 3] ) { iTemp = piOrg[ 3] - piCur[ 3]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
2843 | if( piUsed[ 4] ) { iTemp = piOrg[ 4] - piCur[ 4]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
2844 | if( piUsed[ 5] ) { iTemp = piOrg[ 5] - piCur[ 5]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
2845 | if( piUsed[ 6] ) { iTemp = piOrg[ 6] - piCur[ 6]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
2846 | if( piUsed[ 7] ) { iTemp = piOrg[ 7] - piCur[ 7]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
2847 | if( piUsed[ 8] ) { iTemp = piOrg[ 8] - piCur[ 8]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
2848 | if( piUsed[ 9] ) { iTemp = piOrg[ 9] - piCur[ 9]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
2849 | if( piUsed[10] ) { iTemp = piOrg[10] - piCur[10]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
2850 | if( piUsed[11] ) { iTemp = piOrg[11] - piCur[11]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
2851 | if( piUsed[12] ) { iTemp = piOrg[12] - piCur[12]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
2852 | if( piUsed[13] ) { iTemp = piOrg[13] - piCur[13]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
2853 | if( piUsed[14] ) { iTemp = piOrg[14] - piCur[14]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
2854 | if( piUsed[15] ) { iTemp = piOrg[15] - piCur[15]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
2855 | |
---|
2856 | piOrg += iStrideOrg; |
---|
2857 | piCur += iStrideCur; |
---|
2858 | piUsed += iStrideUsed; |
---|
2859 | } |
---|
2860 | } |
---|
2861 | else |
---|
2862 | { |
---|
2863 | #endif |
---|
2864 | for( ; iRows != 0; iRows-- ) |
---|
2865 | { |
---|
2866 | |
---|
2867 | iTemp = piOrg[ 0] - piCur[ 0]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
2868 | iTemp = piOrg[ 1] - piCur[ 1]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
2869 | iTemp = piOrg[ 2] - piCur[ 2]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
2870 | iTemp = piOrg[ 3] - piCur[ 3]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
2871 | iTemp = piOrg[ 4] - piCur[ 4]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
2872 | iTemp = piOrg[ 5] - piCur[ 5]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
2873 | iTemp = piOrg[ 6] - piCur[ 6]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
2874 | iTemp = piOrg[ 7] - piCur[ 7]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
2875 | iTemp = piOrg[ 8] - piCur[ 8]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
2876 | iTemp = piOrg[ 9] - piCur[ 9]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
2877 | iTemp = piOrg[10] - piCur[10]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
2878 | iTemp = piOrg[11] - piCur[11]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
2879 | iTemp = piOrg[12] - piCur[12]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
2880 | iTemp = piOrg[13] - piCur[13]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
2881 | iTemp = piOrg[14] - piCur[14]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
2882 | iTemp = piOrg[15] - piCur[15]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
2883 | |
---|
2884 | piOrg += iStrideOrg; |
---|
2885 | piCur += iStrideCur; |
---|
2886 | } |
---|
2887 | #if HHI_INTERVIEW_SKIP |
---|
2888 | } |
---|
2889 | #endif |
---|
2890 | |
---|
2891 | return ( uiSum ); |
---|
2892 | } |
---|
2893 | |
---|
2894 | UInt TComRdCost::xGetSSE16N( DistParam* pcDtParam ) |
---|
2895 | { |
---|
2896 | if ( pcDtParam->bApplyWeight ) |
---|
2897 | { |
---|
2898 | return xGetSSEw( pcDtParam ); |
---|
2899 | } |
---|
2900 | Pel* piOrg = pcDtParam->pOrg; |
---|
2901 | Pel* piCur = pcDtParam->pCur; |
---|
2902 | Int iRows = pcDtParam->iRows; |
---|
2903 | Int iCols = pcDtParam->iCols; |
---|
2904 | Int iStrideOrg = pcDtParam->iStrideOrg; |
---|
2905 | Int iStrideCur = pcDtParam->iStrideCur; |
---|
2906 | |
---|
2907 | UInt uiSum = 0; |
---|
2908 | UInt uiShift = g_uiBitIncrement<<1; |
---|
2909 | Int iTemp; |
---|
2910 | |
---|
2911 | #if HHI_INTERVIEW_SKIP |
---|
2912 | if( pcDtParam->pUsed ) |
---|
2913 | { |
---|
2914 | Pel* piUsed = pcDtParam->pUsed; |
---|
2915 | Int iStrideUsed = pcDtParam->iStrideUsed; |
---|
2916 | for( ; iRows != 0; iRows-- ) |
---|
2917 | { |
---|
2918 | for (Int n = 0; n < iCols; n+=16 ) |
---|
2919 | { |
---|
2920 | if( piUsed[n+ 0] ) { iTemp = piOrg[n+ 0] - piCur[n+ 0]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
2921 | if( piUsed[n+ 1] ) { iTemp = piOrg[n+ 1] - piCur[n+ 1]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
2922 | if( piUsed[n+ 2] ) { iTemp = piOrg[n+ 2] - piCur[n+ 2]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
2923 | if( piUsed[n+ 3] ) { iTemp = piOrg[n+ 3] - piCur[n+ 3]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
2924 | if( piUsed[n+ 4] ) { iTemp = piOrg[n+ 4] - piCur[n+ 4]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
2925 | if( piUsed[n+ 5] ) { iTemp = piOrg[n+ 5] - piCur[n+ 5]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
2926 | if( piUsed[n+ 6] ) { iTemp = piOrg[n+ 6] - piCur[n+ 6]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
2927 | if( piUsed[n+ 7] ) { iTemp = piOrg[n+ 7] - piCur[n+ 7]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
2928 | if( piUsed[n+ 8] ) { iTemp = piOrg[n+ 8] - piCur[n+ 8]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
2929 | if( piUsed[n+ 9] ) { iTemp = piOrg[n+ 9] - piCur[n+ 9]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
2930 | if( piUsed[n+10] ) { iTemp = piOrg[n+10] - piCur[n+10]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
2931 | if( piUsed[n+11] ) { iTemp = piOrg[n+11] - piCur[n+11]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
2932 | if( piUsed[n+12] ) { iTemp = piOrg[n+12] - piCur[n+12]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
2933 | if( piUsed[n+13] ) { iTemp = piOrg[n+13] - piCur[n+13]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
2934 | if( piUsed[n+14] ) { iTemp = piOrg[n+14] - piCur[n+14]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
2935 | if( piUsed[n+15] ) { iTemp = piOrg[n+15] - piCur[n+15]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
2936 | } |
---|
2937 | piOrg += iStrideOrg; |
---|
2938 | piCur += iStrideCur; |
---|
2939 | piUsed += iStrideUsed; |
---|
2940 | } |
---|
2941 | } |
---|
2942 | else |
---|
2943 | { |
---|
2944 | #endif |
---|
2945 | for( ; iRows != 0; iRows-- ) |
---|
2946 | { |
---|
2947 | for (Int n = 0; n < iCols; n+=16 ) |
---|
2948 | { |
---|
2949 | |
---|
2950 | iTemp = piOrg[n+ 0] - piCur[n+ 0]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
2951 | iTemp = piOrg[n+ 1] - piCur[n+ 1]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
2952 | iTemp = piOrg[n+ 2] - piCur[n+ 2]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
2953 | iTemp = piOrg[n+ 3] - piCur[n+ 3]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
2954 | iTemp = piOrg[n+ 4] - piCur[n+ 4]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
2955 | iTemp = piOrg[n+ 5] - piCur[n+ 5]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
2956 | iTemp = piOrg[n+ 6] - piCur[n+ 6]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
2957 | iTemp = piOrg[n+ 7] - piCur[n+ 7]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
2958 | iTemp = piOrg[n+ 8] - piCur[n+ 8]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
2959 | iTemp = piOrg[n+ 9] - piCur[n+ 9]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
2960 | iTemp = piOrg[n+10] - piCur[n+10]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
2961 | iTemp = piOrg[n+11] - piCur[n+11]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
2962 | iTemp = piOrg[n+12] - piCur[n+12]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
2963 | iTemp = piOrg[n+13] - piCur[n+13]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
2964 | iTemp = piOrg[n+14] - piCur[n+14]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
2965 | iTemp = piOrg[n+15] - piCur[n+15]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
2966 | |
---|
2967 | } |
---|
2968 | piOrg += iStrideOrg; |
---|
2969 | piCur += iStrideCur; |
---|
2970 | } |
---|
2971 | #if HHI_INTERVIEW_SKIP |
---|
2972 | } |
---|
2973 | #endif |
---|
2974 | |
---|
2975 | return ( uiSum ); |
---|
2976 | } |
---|
2977 | |
---|
2978 | UInt TComRdCost::xGetSSE32( DistParam* pcDtParam ) |
---|
2979 | { |
---|
2980 | if ( pcDtParam->bApplyWeight ) |
---|
2981 | { |
---|
2982 | assert( pcDtParam->iCols == 32 ); |
---|
2983 | return xGetSSEw( pcDtParam ); |
---|
2984 | } |
---|
2985 | Pel* piOrg = pcDtParam->pOrg; |
---|
2986 | Pel* piCur = pcDtParam->pCur; |
---|
2987 | Int iRows = pcDtParam->iRows; |
---|
2988 | Int iStrideOrg = pcDtParam->iStrideOrg; |
---|
2989 | Int iStrideCur = pcDtParam->iStrideCur; |
---|
2990 | |
---|
2991 | UInt uiSum = 0; |
---|
2992 | UInt uiShift = g_uiBitIncrement<<1; |
---|
2993 | Int iTemp; |
---|
2994 | |
---|
2995 | #if HHI_INTERVIEW_SKIP |
---|
2996 | if( pcDtParam->pUsed ) |
---|
2997 | { |
---|
2998 | Pel* piUsed = pcDtParam->pUsed; |
---|
2999 | Int iStrideUsed = pcDtParam->iStrideUsed; |
---|
3000 | for( ; iRows != 0; iRows-- ) |
---|
3001 | { |
---|
3002 | if( piUsed[ 0] ) { iTemp = piOrg[ 0] - piCur[ 0]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
3003 | if( piUsed[ 1] ) { iTemp = piOrg[ 1] - piCur[ 1]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
3004 | if( piUsed[ 2] ) { iTemp = piOrg[ 2] - piCur[ 2]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
3005 | if( piUsed[ 3] ) { iTemp = piOrg[ 3] - piCur[ 3]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
3006 | if( piUsed[ 4] ) { iTemp = piOrg[ 4] - piCur[ 4]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
3007 | if( piUsed[ 5] ) { iTemp = piOrg[ 5] - piCur[ 5]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
3008 | if( piUsed[ 6] ) { iTemp = piOrg[ 6] - piCur[ 6]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
3009 | if( piUsed[ 7] ) { iTemp = piOrg[ 7] - piCur[ 7]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
3010 | if( piUsed[ 8] ) { iTemp = piOrg[ 8] - piCur[ 8]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
3011 | if( piUsed[ 9] ) { iTemp = piOrg[ 9] - piCur[ 9]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
3012 | if( piUsed[10] ) { iTemp = piOrg[10] - piCur[10]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
3013 | if( piUsed[11] ) { iTemp = piOrg[11] - piCur[11]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
3014 | if( piUsed[12] ) { iTemp = piOrg[12] - piCur[12]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
3015 | if( piUsed[13] ) { iTemp = piOrg[13] - piCur[13]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
3016 | if( piUsed[14] ) { iTemp = piOrg[14] - piCur[14]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
3017 | if( piUsed[15] ) { iTemp = piOrg[15] - piCur[15]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
3018 | if( piUsed[16] ) { iTemp = piOrg[16] - piCur[16]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
3019 | if( piUsed[17] ) { iTemp = piOrg[17] - piCur[17]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
3020 | if( piUsed[18] ) { iTemp = piOrg[18] - piCur[18]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
3021 | if( piUsed[19] ) { iTemp = piOrg[19] - piCur[19]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
3022 | if( piUsed[20] ) { iTemp = piOrg[20] - piCur[20]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
3023 | if( piUsed[21] ) { iTemp = piOrg[21] - piCur[21]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
3024 | if( piUsed[22] ) { iTemp = piOrg[22] - piCur[22]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
3025 | if( piUsed[23] ) { iTemp = piOrg[23] - piCur[23]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
3026 | if( piUsed[24] ) { iTemp = piOrg[24] - piCur[24]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
3027 | if( piUsed[25] ) { iTemp = piOrg[25] - piCur[25]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
3028 | if( piUsed[26] ) { iTemp = piOrg[26] - piCur[26]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
3029 | if( piUsed[27] ) { iTemp = piOrg[27] - piCur[27]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
3030 | if( piUsed[28] ) { iTemp = piOrg[28] - piCur[28]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
3031 | if( piUsed[29] ) { iTemp = piOrg[29] - piCur[29]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
3032 | if( piUsed[30] ) { iTemp = piOrg[30] - piCur[30]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
3033 | if( piUsed[31] ) { iTemp = piOrg[31] - piCur[31]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
3034 | |
---|
3035 | piOrg += iStrideOrg; |
---|
3036 | piCur += iStrideCur; |
---|
3037 | piUsed += iStrideUsed; |
---|
3038 | } |
---|
3039 | } |
---|
3040 | else |
---|
3041 | { |
---|
3042 | #endif |
---|
3043 | for( ; iRows != 0; iRows-- ) |
---|
3044 | { |
---|
3045 | |
---|
3046 | iTemp = piOrg[ 0] - piCur[ 0]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
3047 | iTemp = piOrg[ 1] - piCur[ 1]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
3048 | iTemp = piOrg[ 2] - piCur[ 2]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
3049 | iTemp = piOrg[ 3] - piCur[ 3]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
3050 | iTemp = piOrg[ 4] - piCur[ 4]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
3051 | iTemp = piOrg[ 5] - piCur[ 5]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
3052 | iTemp = piOrg[ 6] - piCur[ 6]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
3053 | iTemp = piOrg[ 7] - piCur[ 7]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
3054 | iTemp = piOrg[ 8] - piCur[ 8]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
3055 | iTemp = piOrg[ 9] - piCur[ 9]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
3056 | iTemp = piOrg[10] - piCur[10]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
3057 | iTemp = piOrg[11] - piCur[11]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
3058 | iTemp = piOrg[12] - piCur[12]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
3059 | iTemp = piOrg[13] - piCur[13]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
3060 | iTemp = piOrg[14] - piCur[14]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
3061 | iTemp = piOrg[15] - piCur[15]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
3062 | iTemp = piOrg[16] - piCur[16]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
3063 | iTemp = piOrg[17] - piCur[17]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
3064 | iTemp = piOrg[18] - piCur[18]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
3065 | iTemp = piOrg[19] - piCur[19]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
3066 | iTemp = piOrg[20] - piCur[20]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
3067 | iTemp = piOrg[21] - piCur[21]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
3068 | iTemp = piOrg[22] - piCur[22]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
3069 | iTemp = piOrg[23] - piCur[23]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
3070 | iTemp = piOrg[24] - piCur[24]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
3071 | iTemp = piOrg[25] - piCur[25]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
3072 | iTemp = piOrg[26] - piCur[26]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
3073 | iTemp = piOrg[27] - piCur[27]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
3074 | iTemp = piOrg[28] - piCur[28]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
3075 | iTemp = piOrg[29] - piCur[29]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
3076 | iTemp = piOrg[30] - piCur[30]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
3077 | iTemp = piOrg[31] - piCur[31]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
3078 | |
---|
3079 | piOrg += iStrideOrg; |
---|
3080 | piCur += iStrideCur; |
---|
3081 | } |
---|
3082 | #if HHI_INTERVIEW_SKIP |
---|
3083 | } |
---|
3084 | #endif |
---|
3085 | |
---|
3086 | return ( uiSum ); |
---|
3087 | } |
---|
3088 | |
---|
3089 | UInt TComRdCost::xGetSSE64( DistParam* pcDtParam ) |
---|
3090 | { |
---|
3091 | if ( pcDtParam->bApplyWeight ) |
---|
3092 | { |
---|
3093 | assert( pcDtParam->iCols == 64 ); |
---|
3094 | return xGetSSEw( pcDtParam ); |
---|
3095 | } |
---|
3096 | Pel* piOrg = pcDtParam->pOrg; |
---|
3097 | Pel* piCur = pcDtParam->pCur; |
---|
3098 | Int iRows = pcDtParam->iRows; |
---|
3099 | Int iStrideOrg = pcDtParam->iStrideOrg; |
---|
3100 | Int iStrideCur = pcDtParam->iStrideCur; |
---|
3101 | |
---|
3102 | UInt uiSum = 0; |
---|
3103 | UInt uiShift = g_uiBitIncrement<<1; |
---|
3104 | Int iTemp; |
---|
3105 | |
---|
3106 | #if HHI_INTERVIEW_SKIP |
---|
3107 | if( pcDtParam->pUsed ) |
---|
3108 | { |
---|
3109 | Pel* piUsed = pcDtParam->pUsed; |
---|
3110 | Int iStrideUsed = pcDtParam->iStrideUsed; |
---|
3111 | for( ; iRows != 0; iRows-- ) |
---|
3112 | { |
---|
3113 | if( piUsed[ 0] ) { iTemp = piOrg[ 0] - piCur[ 0]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
3114 | if( piUsed[ 1] ) { iTemp = piOrg[ 1] - piCur[ 1]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
3115 | if( piUsed[ 2] ) { iTemp = piOrg[ 2] - piCur[ 2]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
3116 | if( piUsed[ 3] ) { iTemp = piOrg[ 3] - piCur[ 3]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
3117 | if( piUsed[ 4] ) { iTemp = piOrg[ 4] - piCur[ 4]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
3118 | if( piUsed[ 5] ) { iTemp = piOrg[ 5] - piCur[ 5]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
3119 | if( piUsed[ 6] ) { iTemp = piOrg[ 6] - piCur[ 6]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
3120 | if( piUsed[ 7] ) { iTemp = piOrg[ 7] - piCur[ 7]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
3121 | if( piUsed[ 8] ) { iTemp = piOrg[ 8] - piCur[ 8]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
3122 | if( piUsed[ 9] ) { iTemp = piOrg[ 9] - piCur[ 9]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
3123 | if( piUsed[10] ) { iTemp = piOrg[10] - piCur[10]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
3124 | if( piUsed[11] ) { iTemp = piOrg[11] - piCur[11]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
3125 | if( piUsed[12] ) { iTemp = piOrg[12] - piCur[12]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
3126 | if( piUsed[13] ) { iTemp = piOrg[13] - piCur[13]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
3127 | if( piUsed[14] ) { iTemp = piOrg[14] - piCur[14]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
3128 | if( piUsed[15] ) { iTemp = piOrg[15] - piCur[15]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
3129 | if( piUsed[16] ) { iTemp = piOrg[16] - piCur[16]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
3130 | if( piUsed[17] ) { iTemp = piOrg[17] - piCur[17]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
3131 | if( piUsed[18] ) { iTemp = piOrg[18] - piCur[18]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
3132 | if( piUsed[19] ) { iTemp = piOrg[19] - piCur[19]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
3133 | if( piUsed[20] ) { iTemp = piOrg[20] - piCur[20]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
3134 | if( piUsed[21] ) { iTemp = piOrg[21] - piCur[21]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
3135 | if( piUsed[22] ) { iTemp = piOrg[22] - piCur[22]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
3136 | if( piUsed[23] ) { iTemp = piOrg[23] - piCur[23]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
3137 | if( piUsed[24] ) { iTemp = piOrg[24] - piCur[24]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
3138 | if( piUsed[25] ) { iTemp = piOrg[25] - piCur[25]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
3139 | if( piUsed[26] ) { iTemp = piOrg[26] - piCur[26]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
3140 | if( piUsed[27] ) { iTemp = piOrg[27] - piCur[27]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
3141 | if( piUsed[28] ) { iTemp = piOrg[28] - piCur[28]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
3142 | if( piUsed[29] ) { iTemp = piOrg[29] - piCur[29]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
3143 | if( piUsed[30] ) { iTemp = piOrg[30] - piCur[30]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
3144 | if( piUsed[31] ) { iTemp = piOrg[31] - piCur[31]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
3145 | if( piUsed[32] ) { iTemp = piOrg[32] - piCur[32]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
3146 | if( piUsed[33] ) { iTemp = piOrg[33] - piCur[33]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
3147 | if( piUsed[34] ) { iTemp = piOrg[34] - piCur[34]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
3148 | if( piUsed[35] ) { iTemp = piOrg[35] - piCur[35]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
3149 | if( piUsed[36] ) { iTemp = piOrg[36] - piCur[36]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
3150 | if( piUsed[37] ) { iTemp = piOrg[37] - piCur[37]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
3151 | if( piUsed[38] ) { iTemp = piOrg[38] - piCur[38]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
3152 | if( piUsed[39] ) { iTemp = piOrg[39] - piCur[39]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
3153 | if( piUsed[40] ) { iTemp = piOrg[40] - piCur[40]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
3154 | if( piUsed[41] ) { iTemp = piOrg[41] - piCur[41]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
3155 | if( piUsed[42] ) { iTemp = piOrg[42] - piCur[42]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
3156 | if( piUsed[43] ) { iTemp = piOrg[43] - piCur[43]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
3157 | if( piUsed[44] ) { iTemp = piOrg[44] - piCur[44]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
3158 | if( piUsed[45] ) { iTemp = piOrg[45] - piCur[45]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
3159 | if( piUsed[46] ) { iTemp = piOrg[46] - piCur[46]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
3160 | if( piUsed[47] ) { iTemp = piOrg[47] - piCur[47]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
3161 | if( piUsed[48] ) { iTemp = piOrg[48] - piCur[48]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
3162 | if( piUsed[49] ) { iTemp = piOrg[49] - piCur[49]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
3163 | if( piUsed[50] ) { iTemp = piOrg[50] - piCur[50]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
3164 | if( piUsed[51] ) { iTemp = piOrg[51] - piCur[51]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
3165 | if( piUsed[52] ) { iTemp = piOrg[52] - piCur[52]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
3166 | if( piUsed[53] ) { iTemp = piOrg[53] - piCur[53]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
3167 | if( piUsed[54] ) { iTemp = piOrg[54] - piCur[54]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
3168 | if( piUsed[55] ) { iTemp = piOrg[55] - piCur[55]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
3169 | if( piUsed[56] ) { iTemp = piOrg[56] - piCur[56]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
3170 | if( piUsed[57] ) { iTemp = piOrg[57] - piCur[57]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
3171 | if( piUsed[58] ) { iTemp = piOrg[58] - piCur[58]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
3172 | if( piUsed[59] ) { iTemp = piOrg[59] - piCur[59]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
3173 | if( piUsed[60] ) { iTemp = piOrg[60] - piCur[60]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
3174 | if( piUsed[61] ) { iTemp = piOrg[61] - piCur[61]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
3175 | if( piUsed[62] ) { iTemp = piOrg[62] - piCur[62]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
3176 | if( piUsed[63] ) { iTemp = piOrg[63] - piCur[63]; uiSum += ( iTemp * iTemp ) >> uiShift; } |
---|
3177 | |
---|
3178 | piOrg += iStrideOrg; |
---|
3179 | piCur += iStrideCur; |
---|
3180 | piUsed += iStrideUsed; |
---|
3181 | } |
---|
3182 | } |
---|
3183 | else |
---|
3184 | { |
---|
3185 | #endif |
---|
3186 | for( ; iRows != 0; iRows-- ) |
---|
3187 | { |
---|
3188 | iTemp = piOrg[ 0] - piCur[ 0]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
3189 | iTemp = piOrg[ 1] - piCur[ 1]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
3190 | iTemp = piOrg[ 2] - piCur[ 2]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
3191 | iTemp = piOrg[ 3] - piCur[ 3]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
3192 | iTemp = piOrg[ 4] - piCur[ 4]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
3193 | iTemp = piOrg[ 5] - piCur[ 5]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
3194 | iTemp = piOrg[ 6] - piCur[ 6]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
3195 | iTemp = piOrg[ 7] - piCur[ 7]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
3196 | iTemp = piOrg[ 8] - piCur[ 8]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
3197 | iTemp = piOrg[ 9] - piCur[ 9]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
3198 | iTemp = piOrg[10] - piCur[10]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
3199 | iTemp = piOrg[11] - piCur[11]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
3200 | iTemp = piOrg[12] - piCur[12]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
3201 | iTemp = piOrg[13] - piCur[13]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
3202 | iTemp = piOrg[14] - piCur[14]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
3203 | iTemp = piOrg[15] - piCur[15]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
3204 | iTemp = piOrg[16] - piCur[16]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
3205 | iTemp = piOrg[17] - piCur[17]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
3206 | iTemp = piOrg[18] - piCur[18]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
3207 | iTemp = piOrg[19] - piCur[19]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
3208 | iTemp = piOrg[20] - piCur[20]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
3209 | iTemp = piOrg[21] - piCur[21]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
3210 | iTemp = piOrg[22] - piCur[22]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
3211 | iTemp = piOrg[23] - piCur[23]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
3212 | iTemp = piOrg[24] - piCur[24]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
3213 | iTemp = piOrg[25] - piCur[25]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
3214 | iTemp = piOrg[26] - piCur[26]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
3215 | iTemp = piOrg[27] - piCur[27]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
3216 | iTemp = piOrg[28] - piCur[28]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
3217 | iTemp = piOrg[29] - piCur[29]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
3218 | iTemp = piOrg[30] - piCur[30]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
3219 | iTemp = piOrg[31] - piCur[31]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
3220 | iTemp = piOrg[32] - piCur[32]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
3221 | iTemp = piOrg[33] - piCur[33]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
3222 | iTemp = piOrg[34] - piCur[34]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
3223 | iTemp = piOrg[35] - piCur[35]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
3224 | iTemp = piOrg[36] - piCur[36]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
3225 | iTemp = piOrg[37] - piCur[37]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
3226 | iTemp = piOrg[38] - piCur[38]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
3227 | iTemp = piOrg[39] - piCur[39]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
3228 | iTemp = piOrg[40] - piCur[40]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
3229 | iTemp = piOrg[41] - piCur[41]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
3230 | iTemp = piOrg[42] - piCur[42]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
3231 | iTemp = piOrg[43] - piCur[43]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
3232 | iTemp = piOrg[44] - piCur[44]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
3233 | iTemp = piOrg[45] - piCur[45]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
3234 | iTemp = piOrg[46] - piCur[46]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
3235 | iTemp = piOrg[47] - piCur[47]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
3236 | iTemp = piOrg[48] - piCur[48]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
3237 | iTemp = piOrg[49] - piCur[49]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
3238 | iTemp = piOrg[50] - piCur[50]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
3239 | iTemp = piOrg[51] - piCur[51]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
3240 | iTemp = piOrg[52] - piCur[52]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
3241 | iTemp = piOrg[53] - piCur[53]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
3242 | iTemp = piOrg[54] - piCur[54]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
3243 | iTemp = piOrg[55] - piCur[55]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
3244 | iTemp = piOrg[56] - piCur[56]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
3245 | iTemp = piOrg[57] - piCur[57]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
3246 | iTemp = piOrg[58] - piCur[58]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
3247 | iTemp = piOrg[59] - piCur[59]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
3248 | iTemp = piOrg[60] - piCur[60]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
3249 | iTemp = piOrg[61] - piCur[61]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
3250 | iTemp = piOrg[62] - piCur[62]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
3251 | iTemp = piOrg[63] - piCur[63]; uiSum += ( iTemp * iTemp ) >> uiShift; |
---|
3252 | |
---|
3253 | piOrg += iStrideOrg; |
---|
3254 | piCur += iStrideCur; |
---|
3255 | } |
---|
3256 | #if HHI_INTERVIEW_SKIP |
---|
3257 | } |
---|
3258 | #endif |
---|
3259 | |
---|
3260 | return ( uiSum ); |
---|
3261 | } |
---|
3262 | #endif |
---|
3263 | |
---|
3264 | |
---|
3265 | #if SAIT_VSO_EST_A0033 |
---|
3266 | UInt TComRdCost::getVSDEstimate( Int dDM, Pel* pOrg, Int iOrgStride, Pel* pVirRec, Pel* pVirOrg, Int iVirStride, Int x, Int y ) |
---|
3267 | { |
---|
3268 | Double dD; |
---|
3269 | Int iTemp; |
---|
3270 | |
---|
3271 | dD = ( (Double) ( dDM >> g_uiBitIncrement ) ) * m_dDisparityCoeff; |
---|
3272 | |
---|
3273 | 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 ] ) ) ); |
---|
3274 | |
---|
3275 | return (UInt) ( (iTemp*iTemp)>>1 ); |
---|
3276 | } |
---|
3277 | |
---|
3278 | UInt TComRdCost::xGetVSD( DistParam* pcDtParam ) |
---|
3279 | { |
---|
3280 | Pel* piOrg = pcDtParam->pOrg; |
---|
3281 | Pel* piCur = pcDtParam->pCur; |
---|
3282 | Pel* piVirRec = pcDtParam->pVirRec; |
---|
3283 | Pel* piVirOrg = pcDtParam->pVirOrg; |
---|
3284 | Int iRows = pcDtParam->iRows; |
---|
3285 | Int iCols = pcDtParam->iCols; |
---|
3286 | Int iStrideOrg = pcDtParam->iStrideOrg; |
---|
3287 | Int iStrideCur = pcDtParam->iStrideCur; |
---|
3288 | Int iStrideVir = pcDtParam->iStrideVir; |
---|
3289 | |
---|
3290 | UInt uiSum = 0; |
---|
3291 | UInt uiShift = g_uiBitIncrement<<1; |
---|
3292 | |
---|
3293 | Int dDM; |
---|
3294 | |
---|
3295 | for ( Int y = 0 ; y < iRows ; y++ ) |
---|
3296 | { |
---|
3297 | for (Int x = 0; x < iCols; x++ ) |
---|
3298 | { |
---|
3299 | dDM = (Int) ( piOrg[x ] - piCur[x ] ); |
---|
3300 | uiSum += getVSDEstimate( dDM, piOrg, iStrideOrg, piVirRec, piVirOrg, iStrideVir, x, y ) >> uiShift; |
---|
3301 | } |
---|
3302 | piOrg += iStrideOrg; |
---|
3303 | piCur += iStrideCur; |
---|
3304 | } |
---|
3305 | |
---|
3306 | return ( uiSum ); |
---|
3307 | } |
---|
3308 | |
---|
3309 | UInt TComRdCost::xGetVSD4( DistParam* pcDtParam ) |
---|
3310 | { |
---|
3311 | Pel* piOrg = pcDtParam->pOrg; |
---|
3312 | Pel* piCur = pcDtParam->pCur; |
---|
3313 | Pel* piVirRec = pcDtParam->pVirRec; |
---|
3314 | Pel* piVirOrg = pcDtParam->pVirOrg; |
---|
3315 | Int iRows = pcDtParam->iRows; |
---|
3316 | Int iStrideOrg = pcDtParam->iStrideOrg; |
---|
3317 | Int iStrideCur = pcDtParam->iStrideCur; |
---|
3318 | Int iStrideVir = pcDtParam->iStrideVir; |
---|
3319 | |
---|
3320 | UInt uiSum = 0; |
---|
3321 | UInt uiShift = g_uiBitIncrement<<1; |
---|
3322 | |
---|
3323 | Int dDM; |
---|
3324 | |
---|
3325 | for ( Int y = 0 ; y < iRows ; y++ ) |
---|
3326 | { |
---|
3327 | dDM = (Int) ( piOrg[0] - piCur[0] ); uiSum += ( getVSDEstimate( dDM, piOrg, iStrideOrg, piVirRec, piVirOrg, iStrideVir, 0, y ) ) >> uiShift; |
---|
3328 | dDM = (Int) ( piOrg[1] - piCur[1] ); uiSum += ( getVSDEstimate( dDM, piOrg, iStrideOrg, piVirRec, piVirOrg, iStrideVir, 1, y ) ) >> uiShift; |
---|
3329 | dDM = (Int) ( piOrg[2] - piCur[2] ); uiSum += ( getVSDEstimate( dDM, piOrg, iStrideOrg, piVirRec, piVirOrg, iStrideVir, 2, y ) ) >> uiShift; |
---|
3330 | dDM = (Int) ( piOrg[3] - piCur[3] ); uiSum += ( getVSDEstimate( dDM, piOrg, iStrideOrg, piVirRec, piVirOrg, iStrideVir, 3, y ) ) >> uiShift; |
---|
3331 | |
---|
3332 | piOrg += iStrideOrg; |
---|
3333 | piCur += iStrideCur; |
---|
3334 | } |
---|
3335 | |
---|
3336 | return ( uiSum ); |
---|
3337 | } |
---|
3338 | |
---|
3339 | UInt TComRdCost::xGetVSD8( DistParam* pcDtParam ) |
---|
3340 | { |
---|
3341 | Pel* piOrg = pcDtParam->pOrg; |
---|
3342 | Pel* piCur = pcDtParam->pCur; |
---|
3343 | Pel* piVirRec = pcDtParam->pVirRec; |
---|
3344 | Pel* piVirOrg = pcDtParam->pVirOrg; |
---|
3345 | Int iRows = pcDtParam->iRows; |
---|
3346 | Int iStrideOrg = pcDtParam->iStrideOrg; |
---|
3347 | Int iStrideCur = pcDtParam->iStrideCur; |
---|
3348 | Int iStrideVir = pcDtParam->iStrideVir; |
---|
3349 | |
---|
3350 | UInt uiSum = 0; |
---|
3351 | UInt uiShift = g_uiBitIncrement<<1; |
---|
3352 | |
---|
3353 | Int dDM; |
---|
3354 | |
---|
3355 | for ( Int y = 0 ; y < iRows ; y++ ) |
---|
3356 | { |
---|
3357 | for (Int x = 0; x < 8; x++ ) |
---|
3358 | { |
---|
3359 | dDM = (Int) ( piOrg[x] - piCur[x] ); |
---|
3360 | uiSum += getVSDEstimate( dDM, piOrg, iStrideOrg, piVirRec, piVirOrg, iStrideVir, x, y ) >> uiShift; |
---|
3361 | } |
---|
3362 | piOrg += iStrideOrg; |
---|
3363 | piCur += iStrideCur; |
---|
3364 | } |
---|
3365 | |
---|
3366 | return ( uiSum ); |
---|
3367 | } |
---|
3368 | |
---|
3369 | UInt TComRdCost::xGetVSD16( DistParam* pcDtParam ) |
---|
3370 | { |
---|
3371 | Pel* piOrg = pcDtParam->pOrg; |
---|
3372 | Pel* piCur = pcDtParam->pCur; |
---|
3373 | Pel* piVirRec = pcDtParam->pVirRec; |
---|
3374 | Pel* piVirOrg = pcDtParam->pVirOrg; |
---|
3375 | Int iRows = pcDtParam->iRows; |
---|
3376 | Int iStrideOrg = pcDtParam->iStrideOrg; |
---|
3377 | Int iStrideCur = pcDtParam->iStrideCur; |
---|
3378 | Int iStrideVir = pcDtParam->iStrideVir; |
---|
3379 | |
---|
3380 | UInt uiSum = 0; |
---|
3381 | UInt uiShift = g_uiBitIncrement<<1; |
---|
3382 | |
---|
3383 | Int dDM; |
---|
3384 | |
---|
3385 | for ( Int y = 0 ; y < iRows ; y++ ) |
---|
3386 | { |
---|
3387 | for (Int x = 0; x < 16; x++ ) |
---|
3388 | { |
---|
3389 | dDM = (Int) ( piOrg[x] - piCur[x] ); |
---|
3390 | uiSum += getVSDEstimate( dDM, piOrg, iStrideOrg, piVirRec, piVirOrg, iStrideVir, x, y ) >> uiShift; |
---|
3391 | } |
---|
3392 | piOrg += iStrideOrg; |
---|
3393 | piCur += iStrideCur; |
---|
3394 | } |
---|
3395 | |
---|
3396 | return ( uiSum ); |
---|
3397 | } |
---|
3398 | |
---|
3399 | UInt TComRdCost::xGetVSD16N( DistParam* pcDtParam ) |
---|
3400 | { |
---|
3401 | Pel* piOrg = pcDtParam->pOrg; |
---|
3402 | Pel* piCur = pcDtParam->pCur; |
---|
3403 | Pel* piVirRec = pcDtParam->pVirRec; |
---|
3404 | Pel* piVirOrg = pcDtParam->pVirOrg; |
---|
3405 | Int iRows = pcDtParam->iRows; |
---|
3406 | Int iCols = pcDtParam->iCols; |
---|
3407 | Int iStrideOrg = pcDtParam->iStrideOrg; |
---|
3408 | Int iStrideCur = pcDtParam->iStrideCur; |
---|
3409 | Int iStrideVir = pcDtParam->iStrideVir; |
---|
3410 | |
---|
3411 | UInt uiSum = 0; |
---|
3412 | UInt uiShift = g_uiBitIncrement<<1; |
---|
3413 | |
---|
3414 | Int dDM; |
---|
3415 | |
---|
3416 | for ( Int y = 0 ; y < iRows ; y++ ) |
---|
3417 | { |
---|
3418 | for (Int x = 0; x < iCols; x+=16 ) |
---|
3419 | { |
---|
3420 | for ( Int k = 0 ; k < 16 ; k++ ) |
---|
3421 | { |
---|
3422 | dDM = (Int) ( piOrg[x+k] - piCur[x+k] ); |
---|
3423 | uiSum += getVSDEstimate( dDM, piOrg, iStrideOrg, piVirRec, piVirOrg, iStrideVir, x+k, y ) >> uiShift; |
---|
3424 | } |
---|
3425 | } |
---|
3426 | piOrg += iStrideOrg; |
---|
3427 | piCur += iStrideCur; |
---|
3428 | } |
---|
3429 | |
---|
3430 | return ( uiSum ); |
---|
3431 | } |
---|
3432 | |
---|
3433 | UInt TComRdCost::xGetVSD32( DistParam* pcDtParam ) |
---|
3434 | { |
---|
3435 | Pel* piOrg = pcDtParam->pOrg; |
---|
3436 | Pel* piCur = pcDtParam->pCur; |
---|
3437 | Pel* piVirRec = pcDtParam->pVirRec; |
---|
3438 | Pel* piVirOrg = pcDtParam->pVirOrg; |
---|
3439 | Int iRows = pcDtParam->iRows; |
---|
3440 | Int iStrideOrg = pcDtParam->iStrideOrg; |
---|
3441 | Int iStrideCur = pcDtParam->iStrideCur; |
---|
3442 | Int iStrideVir = pcDtParam->iStrideVir; |
---|
3443 | |
---|
3444 | UInt uiSum = 0; |
---|
3445 | UInt uiShift = g_uiBitIncrement<<1; |
---|
3446 | |
---|
3447 | Int dDM; |
---|
3448 | |
---|
3449 | for ( Int y = 0 ; y < iRows ; y++ ) |
---|
3450 | { |
---|
3451 | for (Int x = 0; x < 32 ; x++ ) |
---|
3452 | { |
---|
3453 | dDM = (Int) ( piOrg[x] - piCur[x] ); |
---|
3454 | uiSum += getVSDEstimate( dDM, piOrg, iStrideOrg, piVirRec, piVirOrg, iStrideVir, x, y ) >> uiShift; |
---|
3455 | } |
---|
3456 | piOrg += iStrideOrg; |
---|
3457 | piCur += iStrideCur; |
---|
3458 | } |
---|
3459 | |
---|
3460 | return ( uiSum ); |
---|
3461 | } |
---|
3462 | |
---|
3463 | UInt TComRdCost::xGetVSD64( DistParam* pcDtParam ) |
---|
3464 | { |
---|
3465 | Pel* piOrg = pcDtParam->pOrg; |
---|
3466 | Pel* piCur = pcDtParam->pCur; |
---|
3467 | Pel* piVirRec = pcDtParam->pVirRec; |
---|
3468 | Pel* piVirOrg = pcDtParam->pVirOrg; |
---|
3469 | Int iRows = pcDtParam->iRows; |
---|
3470 | Int iStrideOrg = pcDtParam->iStrideOrg; |
---|
3471 | Int iStrideCur = pcDtParam->iStrideCur; |
---|
3472 | Int iStrideVir = pcDtParam->iStrideVir; |
---|
3473 | |
---|
3474 | UInt uiSum = 0; |
---|
3475 | UInt uiShift = g_uiBitIncrement<<1; |
---|
3476 | |
---|
3477 | Int dDM; |
---|
3478 | |
---|
3479 | for ( Int y = 0 ; y < iRows ; y++ ) |
---|
3480 | { |
---|
3481 | for (Int x = 0; x < 64; x++ ) |
---|
3482 | { |
---|
3483 | dDM = (Int) ( piOrg[x] - piCur[x] ); |
---|
3484 | uiSum += getVSDEstimate( dDM, piOrg, iStrideOrg, piVirRec, piVirOrg, iStrideVir, x, y ) >> uiShift; |
---|
3485 | } |
---|
3486 | piOrg += iStrideOrg; |
---|
3487 | piCur += iStrideCur; |
---|
3488 | } |
---|
3489 | |
---|
3490 | return ( uiSum ); |
---|
3491 | } |
---|
3492 | |
---|
3493 | #endif |
---|
3494 | |
---|
3495 | // -------------------------------------------------------------------------------------------------------------------- |
---|
3496 | // HADAMARD with step (used in fractional search) |
---|
3497 | // -------------------------------------------------------------------------------------------------------------------- |
---|
3498 | |
---|
3499 | UInt TComRdCost::xCalcHADs2x2( Pel *piOrg, Pel *piCur, Int iStrideOrg, Int iStrideCur, Int iStep ) |
---|
3500 | { |
---|
3501 | Int satd = 0, diff[4], m[4]; |
---|
3502 | assert( iStep == 1 ); |
---|
3503 | diff[0] = piOrg[0 ] - piCur[0]; |
---|
3504 | diff[1] = piOrg[1 ] - piCur[1]; |
---|
3505 | diff[2] = piOrg[iStrideOrg ] - piCur[0 + iStrideCur]; |
---|
3506 | diff[3] = piOrg[iStrideOrg + 1] - piCur[1 + iStrideCur]; |
---|
3507 | m[0] = diff[0] + diff[2]; |
---|
3508 | m[1] = diff[1] + diff[3]; |
---|
3509 | m[2] = diff[0] - diff[2]; |
---|
3510 | m[3] = diff[1] - diff[3]; |
---|
3511 | |
---|
3512 | satd += abs(m[0] + m[1]); |
---|
3513 | satd += abs(m[0] - m[1]); |
---|
3514 | satd += abs(m[2] + m[3]); |
---|
3515 | satd += abs(m[2] - m[3]); |
---|
3516 | |
---|
3517 | return satd; |
---|
3518 | } |
---|
3519 | |
---|
3520 | UInt TComRdCost::xCalcHADs4x4( Pel *piOrg, Pel *piCur, Int iStrideOrg, Int iStrideCur, Int iStep ) |
---|
3521 | { |
---|
3522 | Int k, satd = 0, diff[16], m[16], d[16]; |
---|
3523 | |
---|
3524 | assert( iStep == 1 ); |
---|
3525 | for( k = 0; k < 16; k+=4 ) |
---|
3526 | { |
---|
3527 | diff[k+0] = piOrg[0] - piCur[0]; |
---|
3528 | diff[k+1] = piOrg[1] - piCur[1]; |
---|
3529 | diff[k+2] = piOrg[2] - piCur[2]; |
---|
3530 | diff[k+3] = piOrg[3] - piCur[3]; |
---|
3531 | |
---|
3532 | piCur += iStrideCur; |
---|
3533 | piOrg += iStrideOrg; |
---|
3534 | } |
---|
3535 | |
---|
3536 | /*===== hadamard transform =====*/ |
---|
3537 | m[ 0] = diff[ 0] + diff[12]; |
---|
3538 | m[ 1] = diff[ 1] + diff[13]; |
---|
3539 | m[ 2] = diff[ 2] + diff[14]; |
---|
3540 | m[ 3] = diff[ 3] + diff[15]; |
---|
3541 | m[ 4] = diff[ 4] + diff[ 8]; |
---|
3542 | m[ 5] = diff[ 5] + diff[ 9]; |
---|
3543 | m[ 6] = diff[ 6] + diff[10]; |
---|
3544 | m[ 7] = diff[ 7] + diff[11]; |
---|
3545 | m[ 8] = diff[ 4] - diff[ 8]; |
---|
3546 | m[ 9] = diff[ 5] - diff[ 9]; |
---|
3547 | m[10] = diff[ 6] - diff[10]; |
---|
3548 | m[11] = diff[ 7] - diff[11]; |
---|
3549 | m[12] = diff[ 0] - diff[12]; |
---|
3550 | m[13] = diff[ 1] - diff[13]; |
---|
3551 | m[14] = diff[ 2] - diff[14]; |
---|
3552 | m[15] = diff[ 3] - diff[15]; |
---|
3553 | |
---|
3554 | d[ 0] = m[ 0] + m[ 4]; |
---|
3555 | d[ 1] = m[ 1] + m[ 5]; |
---|
3556 | d[ 2] = m[ 2] + m[ 6]; |
---|
3557 | d[ 3] = m[ 3] + m[ 7]; |
---|
3558 | d[ 4] = m[ 8] + m[12]; |
---|
3559 | d[ 5] = m[ 9] + m[13]; |
---|
3560 | d[ 6] = m[10] + m[14]; |
---|
3561 | d[ 7] = m[11] + m[15]; |
---|
3562 | d[ 8] = m[ 0] - m[ 4]; |
---|
3563 | d[ 9] = m[ 1] - m[ 5]; |
---|
3564 | d[10] = m[ 2] - m[ 6]; |
---|
3565 | d[11] = m[ 3] - m[ 7]; |
---|
3566 | d[12] = m[12] - m[ 8]; |
---|
3567 | d[13] = m[13] - m[ 9]; |
---|
3568 | d[14] = m[14] - m[10]; |
---|
3569 | d[15] = m[15] - m[11]; |
---|
3570 | |
---|
3571 | m[ 0] = d[ 0] + d[ 3]; |
---|
3572 | m[ 1] = d[ 1] + d[ 2]; |
---|
3573 | m[ 2] = d[ 1] - d[ 2]; |
---|
3574 | m[ 3] = d[ 0] - d[ 3]; |
---|
3575 | m[ 4] = d[ 4] + d[ 7]; |
---|
3576 | m[ 5] = d[ 5] + d[ 6]; |
---|
3577 | m[ 6] = d[ 5] - d[ 6]; |
---|
3578 | m[ 7] = d[ 4] - d[ 7]; |
---|
3579 | m[ 8] = d[ 8] + d[11]; |
---|
3580 | m[ 9] = d[ 9] + d[10]; |
---|
3581 | m[10] = d[ 9] - d[10]; |
---|
3582 | m[11] = d[ 8] - d[11]; |
---|
3583 | m[12] = d[12] + d[15]; |
---|
3584 | m[13] = d[13] + d[14]; |
---|
3585 | m[14] = d[13] - d[14]; |
---|
3586 | m[15] = d[12] - d[15]; |
---|
3587 | |
---|
3588 | d[ 0] = m[ 0] + m[ 1]; |
---|
3589 | d[ 1] = m[ 0] - m[ 1]; |
---|
3590 | d[ 2] = m[ 2] + m[ 3]; |
---|
3591 | d[ 3] = m[ 3] - m[ 2]; |
---|
3592 | d[ 4] = m[ 4] + m[ 5]; |
---|
3593 | d[ 5] = m[ 4] - m[ 5]; |
---|
3594 | d[ 6] = m[ 6] + m[ 7]; |
---|
3595 | d[ 7] = m[ 7] - m[ 6]; |
---|
3596 | d[ 8] = m[ 8] + m[ 9]; |
---|
3597 | d[ 9] = m[ 8] - m[ 9]; |
---|
3598 | d[10] = m[10] + m[11]; |
---|
3599 | d[11] = m[11] - m[10]; |
---|
3600 | d[12] = m[12] + m[13]; |
---|
3601 | d[13] = m[12] - m[13]; |
---|
3602 | d[14] = m[14] + m[15]; |
---|
3603 | d[15] = m[15] - m[14]; |
---|
3604 | |
---|
3605 | for (k=0; k<16; ++k) |
---|
3606 | { |
---|
3607 | satd += abs(d[k]); |
---|
3608 | } |
---|
3609 | satd = ((satd+1)>>1); |
---|
3610 | |
---|
3611 | return satd; |
---|
3612 | } |
---|
3613 | |
---|
3614 | UInt TComRdCost::xCalcHADs8x8( Pel *piOrg, Pel *piCur, Int iStrideOrg, Int iStrideCur, Int iStep ) |
---|
3615 | { |
---|
3616 | Int k, i, j, jj, sad=0; |
---|
3617 | Int diff[64], m1[8][8], m2[8][8], m3[8][8]; |
---|
3618 | assert( iStep == 1 ); |
---|
3619 | for( k = 0; k < 64; k += 8 ) |
---|
3620 | { |
---|
3621 | diff[k+0] = piOrg[0] - piCur[0]; |
---|
3622 | diff[k+1] = piOrg[1] - piCur[1]; |
---|
3623 | diff[k+2] = piOrg[2] - piCur[2]; |
---|
3624 | diff[k+3] = piOrg[3] - piCur[3]; |
---|
3625 | diff[k+4] = piOrg[4] - piCur[4]; |
---|
3626 | diff[k+5] = piOrg[5] - piCur[5]; |
---|
3627 | diff[k+6] = piOrg[6] - piCur[6]; |
---|
3628 | diff[k+7] = piOrg[7] - piCur[7]; |
---|
3629 | |
---|
3630 | piCur += iStrideCur; |
---|
3631 | piOrg += iStrideOrg; |
---|
3632 | } |
---|
3633 | |
---|
3634 | //horizontal |
---|
3635 | for (j=0; j < 8; j++) |
---|
3636 | { |
---|
3637 | jj = j << 3; |
---|
3638 | m2[j][0] = diff[jj ] + diff[jj+4]; |
---|
3639 | m2[j][1] = diff[jj+1] + diff[jj+5]; |
---|
3640 | m2[j][2] = diff[jj+2] + diff[jj+6]; |
---|
3641 | m2[j][3] = diff[jj+3] + diff[jj+7]; |
---|
3642 | m2[j][4] = diff[jj ] - diff[jj+4]; |
---|
3643 | m2[j][5] = diff[jj+1] - diff[jj+5]; |
---|
3644 | m2[j][6] = diff[jj+2] - diff[jj+6]; |
---|
3645 | m2[j][7] = diff[jj+3] - diff[jj+7]; |
---|
3646 | |
---|
3647 | m1[j][0] = m2[j][0] + m2[j][2]; |
---|
3648 | m1[j][1] = m2[j][1] + m2[j][3]; |
---|
3649 | m1[j][2] = m2[j][0] - m2[j][2]; |
---|
3650 | m1[j][3] = m2[j][1] - m2[j][3]; |
---|
3651 | m1[j][4] = m2[j][4] + m2[j][6]; |
---|
3652 | m1[j][5] = m2[j][5] + m2[j][7]; |
---|
3653 | m1[j][6] = m2[j][4] - m2[j][6]; |
---|
3654 | m1[j][7] = m2[j][5] - m2[j][7]; |
---|
3655 | |
---|
3656 | m2[j][0] = m1[j][0] + m1[j][1]; |
---|
3657 | m2[j][1] = m1[j][0] - m1[j][1]; |
---|
3658 | m2[j][2] = m1[j][2] + m1[j][3]; |
---|
3659 | m2[j][3] = m1[j][2] - m1[j][3]; |
---|
3660 | m2[j][4] = m1[j][4] + m1[j][5]; |
---|
3661 | m2[j][5] = m1[j][4] - m1[j][5]; |
---|
3662 | m2[j][6] = m1[j][6] + m1[j][7]; |
---|
3663 | m2[j][7] = m1[j][6] - m1[j][7]; |
---|
3664 | } |
---|
3665 | |
---|
3666 | //vertical |
---|
3667 | for (i=0; i < 8; i++) |
---|
3668 | { |
---|
3669 | m3[0][i] = m2[0][i] + m2[4][i]; |
---|
3670 | m3[1][i] = m2[1][i] + m2[5][i]; |
---|
3671 | m3[2][i] = m2[2][i] + m2[6][i]; |
---|
3672 | m3[3][i] = m2[3][i] + m2[7][i]; |
---|
3673 | m3[4][i] = m2[0][i] - m2[4][i]; |
---|
3674 | m3[5][i] = m2[1][i] - m2[5][i]; |
---|
3675 | m3[6][i] = m2[2][i] - m2[6][i]; |
---|
3676 | m3[7][i] = m2[3][i] - m2[7][i]; |
---|
3677 | |
---|
3678 | m1[0][i] = m3[0][i] + m3[2][i]; |
---|
3679 | m1[1][i] = m3[1][i] + m3[3][i]; |
---|
3680 | m1[2][i] = m3[0][i] - m3[2][i]; |
---|
3681 | m1[3][i] = m3[1][i] - m3[3][i]; |
---|
3682 | m1[4][i] = m3[4][i] + m3[6][i]; |
---|
3683 | m1[5][i] = m3[5][i] + m3[7][i]; |
---|
3684 | m1[6][i] = m3[4][i] - m3[6][i]; |
---|
3685 | m1[7][i] = m3[5][i] - m3[7][i]; |
---|
3686 | |
---|
3687 | m2[0][i] = m1[0][i] + m1[1][i]; |
---|
3688 | m2[1][i] = m1[0][i] - m1[1][i]; |
---|
3689 | m2[2][i] = m1[2][i] + m1[3][i]; |
---|
3690 | m2[3][i] = m1[2][i] - m1[3][i]; |
---|
3691 | m2[4][i] = m1[4][i] + m1[5][i]; |
---|
3692 | m2[5][i] = m1[4][i] - m1[5][i]; |
---|
3693 | m2[6][i] = m1[6][i] + m1[7][i]; |
---|
3694 | m2[7][i] = m1[6][i] - m1[7][i]; |
---|
3695 | } |
---|
3696 | |
---|
3697 | for (i = 0; i < 8; i++) |
---|
3698 | { |
---|
3699 | for (j = 0; j < 8; j++) |
---|
3700 | { |
---|
3701 | sad += abs(m2[i][j]); |
---|
3702 | } |
---|
3703 | } |
---|
3704 | |
---|
3705 | sad=((sad+2)>>2); |
---|
3706 | |
---|
3707 | return sad; |
---|
3708 | } |
---|
3709 | |
---|
3710 | #if NS_HAD |
---|
3711 | UInt TComRdCost::xCalcHADs16x4( Pel *piOrg, Pel *piCur, Int iStrideOrg, Int iStrideCur, Int iStep ) |
---|
3712 | { |
---|
3713 | Int k, i, j, jj, sad=0; |
---|
3714 | Int diff[64], m1[4][16], m2[4][16]; |
---|
3715 | assert( iStep == 1 ); |
---|
3716 | for( k = 0; k < 64; k += 16 ) |
---|
3717 | { |
---|
3718 | diff[k+0] = piOrg[0] - piCur[0]; |
---|
3719 | diff[k+1] = piOrg[1] - piCur[1]; |
---|
3720 | diff[k+2] = piOrg[2] - piCur[2]; |
---|
3721 | diff[k+3] = piOrg[3] - piCur[3]; |
---|
3722 | diff[k+4] = piOrg[4] - piCur[4]; |
---|
3723 | diff[k+5] = piOrg[5] - piCur[5]; |
---|
3724 | diff[k+6] = piOrg[6] - piCur[6]; |
---|
3725 | diff[k+7] = piOrg[7] - piCur[7]; |
---|
3726 | |
---|
3727 | diff[k+8] = piOrg[8] - piCur[8] ; |
---|
3728 | diff[k+9] = piOrg[9] - piCur[9] ; |
---|
3729 | diff[k+10] = piOrg[10] - piCur[10]; |
---|
3730 | diff[k+11] = piOrg[11] - piCur[11]; |
---|
3731 | diff[k+12] = piOrg[12] - piCur[12]; |
---|
3732 | diff[k+13] = piOrg[13] - piCur[13]; |
---|
3733 | diff[k+14] = piOrg[14] - piCur[14]; |
---|
3734 | diff[k+15] = piOrg[15] - piCur[15]; |
---|
3735 | |
---|
3736 | piCur += iStrideCur; |
---|
3737 | piOrg += iStrideOrg; |
---|
3738 | } |
---|
3739 | |
---|
3740 | //horizontal |
---|
3741 | for (j=0; j < 4; j++) |
---|
3742 | { |
---|
3743 | jj = j << 4; |
---|
3744 | |
---|
3745 | m2[j][0] = diff[jj ] + diff[jj+8]; |
---|
3746 | m2[j][1] = diff[jj+1] + diff[jj+9]; |
---|
3747 | m2[j][2] = diff[jj+2] + diff[jj+10]; |
---|
3748 | m2[j][3] = diff[jj+3] + diff[jj+11]; |
---|
3749 | m2[j][4] = diff[jj+4] + diff[jj+12]; |
---|
3750 | m2[j][5] = diff[jj+5] + diff[jj+13]; |
---|
3751 | m2[j][6] = diff[jj+6] + diff[jj+14]; |
---|
3752 | m2[j][7] = diff[jj+7] + diff[jj+15]; |
---|
3753 | m2[j][8] = diff[jj ] - diff[jj+8]; |
---|
3754 | m2[j][9] = diff[jj+1] - diff[jj+9]; |
---|
3755 | m2[j][10] = diff[jj+2] - diff[jj+10]; |
---|
3756 | m2[j][11] = diff[jj+3] - diff[jj+11]; |
---|
3757 | m2[j][12] = diff[jj+4] - diff[jj+12]; |
---|
3758 | m2[j][13] = diff[jj+5] - diff[jj+13]; |
---|
3759 | m2[j][14] = diff[jj+6] - diff[jj+14]; |
---|
3760 | m2[j][15] = diff[jj+7] - diff[jj+15]; |
---|
3761 | |
---|
3762 | m1[j][0] = m2[j][0] + m2[j][4]; |
---|
3763 | m1[j][1] = m2[j][1] + m2[j][5]; |
---|
3764 | m1[j][2] = m2[j][2] + m2[j][6]; |
---|
3765 | m1[j][3] = m2[j][3] + m2[j][7]; |
---|
3766 | m1[j][4] = m2[j][0] - m2[j][4]; |
---|
3767 | m1[j][5] = m2[j][1] - m2[j][5]; |
---|
3768 | m1[j][6] = m2[j][2] - m2[j][6]; |
---|
3769 | m1[j][7] = m2[j][3] - m2[j][7]; |
---|
3770 | m1[j][8] = m2[j][8] + m2[j][12]; |
---|
3771 | m1[j][9] = m2[j][9] + m2[j][13]; |
---|
3772 | m1[j][10] = m2[j][10] + m2[j][14]; |
---|
3773 | m1[j][11] = m2[j][11] + m2[j][15]; |
---|
3774 | m1[j][12] = m2[j][8] - m2[j][12]; |
---|
3775 | m1[j][13] = m2[j][9] - m2[j][13]; |
---|
3776 | m1[j][14] = m2[j][10] - m2[j][14]; |
---|
3777 | m1[j][15] = m2[j][11] - m2[j][15]; |
---|
3778 | |
---|
3779 | m2[j][0] = m1[j][0] + m1[j][2]; |
---|
3780 | m2[j][1] = m1[j][1] + m1[j][3]; |
---|
3781 | m2[j][2] = m1[j][0] - m1[j][2]; |
---|
3782 | m2[j][3] = m1[j][1] - m1[j][3]; |
---|
3783 | m2[j][4] = m1[j][4] + m1[j][6]; |
---|
3784 | m2[j][5] = m1[j][5] + m1[j][7]; |
---|
3785 | m2[j][6] = m1[j][4] - m1[j][6]; |
---|
3786 | m2[j][7] = m1[j][5] - m1[j][7]; |
---|
3787 | m2[j][8] = m1[j][8] + m1[j][10]; |
---|
3788 | m2[j][9] = m1[j][9] + m1[j][11]; |
---|
3789 | m2[j][10] = m1[j][8] - m1[j][10]; |
---|
3790 | m2[j][11] = m1[j][9] - m1[j][11]; |
---|
3791 | m2[j][12] = m1[j][12] + m1[j][14]; |
---|
3792 | m2[j][13] = m1[j][13] + m1[j][15]; |
---|
3793 | m2[j][14] = m1[j][12] - m1[j][14]; |
---|
3794 | m2[j][15] = m1[j][13] - m1[j][15]; |
---|
3795 | |
---|
3796 | m1[j][0] = m2[j][0] + m2[j][1]; |
---|
3797 | m1[j][1] = m2[j][0] - m2[j][1]; |
---|
3798 | m1[j][2] = m2[j][2] + m2[j][3]; |
---|
3799 | m1[j][3] = m2[j][2] - m2[j][3]; |
---|
3800 | m1[j][4] = m2[j][4] + m2[j][5]; |
---|
3801 | m1[j][5] = m2[j][4] - m2[j][5]; |
---|
3802 | m1[j][6] = m2[j][6] + m2[j][7]; |
---|
3803 | m1[j][7] = m2[j][6] - m2[j][7]; |
---|
3804 | m1[j][8] = m2[j][8] + m2[j][9]; |
---|
3805 | m1[j][9] = m2[j][8] - m2[j][9]; |
---|
3806 | m1[j][10] = m2[j][10] + m2[j][11]; |
---|
3807 | m1[j][11] = m2[j][10] - m2[j][11]; |
---|
3808 | m1[j][12] = m2[j][12] + m2[j][13]; |
---|
3809 | m1[j][13] = m2[j][12] - m2[j][13]; |
---|
3810 | m1[j][14] = m2[j][14] + m2[j][15]; |
---|
3811 | m1[j][15] = m2[j][14] - m2[j][15]; |
---|
3812 | } |
---|
3813 | |
---|
3814 | //vertical |
---|
3815 | for (i=0; i < 16; i++) |
---|
3816 | { |
---|
3817 | m2[0][i] = m1[0][i] + m1[2][i]; |
---|
3818 | m2[1][i] = m1[1][i] + m1[3][i]; |
---|
3819 | m2[2][i] = m1[0][i] - m1[2][i]; |
---|
3820 | m2[3][i] = m1[1][i] - m1[3][i]; |
---|
3821 | |
---|
3822 | m1[0][i] = m2[0][i] + m2[1][i]; |
---|
3823 | m1[1][i] = m2[0][i] - m2[1][i]; |
---|
3824 | m1[2][i] = m2[2][i] + m2[3][i]; |
---|
3825 | m1[3][i] = m2[2][i] - m2[3][i]; |
---|
3826 | } |
---|
3827 | |
---|
3828 | for (i = 0; i < 4; i++) |
---|
3829 | { |
---|
3830 | for (j = 0; j < 16; j++) |
---|
3831 | { |
---|
3832 | sad += abs(m1[i][j]); |
---|
3833 | } |
---|
3834 | } |
---|
3835 | |
---|
3836 | sad=((sad+2)>>2); |
---|
3837 | |
---|
3838 | return sad; |
---|
3839 | } |
---|
3840 | |
---|
3841 | UInt TComRdCost::xCalcHADs4x16( Pel *piOrg, Pel *piCur, Int iStrideOrg, Int iStrideCur, Int iStep ) |
---|
3842 | { |
---|
3843 | Int k, i, j, jj, sad=0; |
---|
3844 | Int diff[64], m1[16][4], m2[16][4], m3[16][4]; |
---|
3845 | assert( iStep == 1 ); |
---|
3846 | for( k = 0; k < 64; k += 4 ) |
---|
3847 | { |
---|
3848 | diff[k+0] = piOrg[0] - piCur[0]; |
---|
3849 | diff[k+1] = piOrg[1] - piCur[1]; |
---|
3850 | diff[k+2] = piOrg[2] - piCur[2]; |
---|
3851 | diff[k+3] = piOrg[3] - piCur[3]; |
---|
3852 | |
---|
3853 | piCur += iStrideCur; |
---|
3854 | piOrg += iStrideOrg; |
---|
3855 | } |
---|
3856 | |
---|
3857 | //horizontal |
---|
3858 | for (j=0; j < 16; j++) |
---|
3859 | { |
---|
3860 | jj = j << 2; |
---|
3861 | m2[j][0] = diff[jj ] + diff[jj+2]; |
---|
3862 | m2[j][1] = diff[jj+1] + diff[jj+3]; |
---|
3863 | m2[j][2] = diff[jj ] - diff[jj+2]; |
---|
3864 | m2[j][3] = diff[jj+1] - diff[jj+3]; |
---|
3865 | |
---|
3866 | m1[j][0] = m2[j][0] + m2[j][1]; |
---|
3867 | m1[j][1] = m2[j][0] - m2[j][1]; |
---|
3868 | m1[j][2] = m2[j][2] + m2[j][3]; |
---|
3869 | m1[j][3] = m2[j][2] - m2[j][3]; |
---|
3870 | } |
---|
3871 | |
---|
3872 | //vertical |
---|
3873 | for (i=0; i < 4; i++) |
---|
3874 | { |
---|
3875 | m2[0][i] = m1[0][i] + m1[8][i]; |
---|
3876 | m2[1][i] = m1[1][i] + m1[9][i]; |
---|
3877 | m2[2][i] = m1[2][i] + m1[10][i]; |
---|
3878 | m2[3][i] = m1[3][i] + m1[11][i]; |
---|
3879 | m2[4][i] = m1[4][i] + m1[12][i]; |
---|
3880 | m2[5][i] = m1[5][i] + m1[13][i]; |
---|
3881 | m2[6][i] = m1[6][i] + m1[14][i]; |
---|
3882 | m2[7][i] = m1[7][i] + m1[15][i]; |
---|
3883 | m2[8][i] = m1[0][i] - m1[8][i]; |
---|
3884 | m2[9][i] = m1[1][i] - m1[9][i]; |
---|
3885 | m2[10][i] = m1[2][i] - m1[10][i]; |
---|
3886 | m2[11][i] = m1[3][i] - m1[11][i]; |
---|
3887 | m2[12][i] = m1[4][i] - m1[12][i]; |
---|
3888 | m2[13][i] = m1[5][i] - m1[13][i]; |
---|
3889 | m2[14][i] = m1[6][i] - m1[14][i]; |
---|
3890 | m2[15][i] = m1[7][i] - m1[15][i]; |
---|
3891 | |
---|
3892 | m3[0][i] = m2[0][i] + m2[4][i]; |
---|
3893 | m3[1][i] = m2[1][i] + m2[5][i]; |
---|
3894 | m3[2][i] = m2[2][i] + m2[6][i]; |
---|
3895 | m3[3][i] = m2[3][i] + m2[7][i]; |
---|
3896 | m3[4][i] = m2[0][i] - m2[4][i]; |
---|
3897 | m3[5][i] = m2[1][i] - m2[5][i]; |
---|
3898 | m3[6][i] = m2[2][i] - m2[6][i]; |
---|
3899 | m3[7][i] = m2[3][i] - m2[7][i]; |
---|
3900 | m3[8][i] = m2[8][i] + m2[12][i]; |
---|
3901 | m3[9][i] = m2[9][i] + m2[13][i]; |
---|
3902 | m3[10][i] = m2[10][i] + m2[14][i]; |
---|
3903 | m3[11][i] = m2[11][i] + m2[15][i]; |
---|
3904 | m3[12][i] = m2[8][i] - m2[12][i]; |
---|
3905 | m3[13][i] = m2[9][i] - m2[13][i]; |
---|
3906 | m3[14][i] = m2[10][i] - m2[14][i]; |
---|
3907 | m3[15][i] = m2[11][i] - m2[15][i]; |
---|
3908 | |
---|
3909 | m1[0][i] = m3[0][i] + m3[2][i]; |
---|
3910 | m1[1][i] = m3[1][i] + m3[3][i]; |
---|
3911 | m1[2][i] = m3[0][i] - m3[2][i]; |
---|
3912 | m1[3][i] = m3[1][i] - m3[3][i]; |
---|
3913 | m1[4][i] = m3[4][i] + m3[6][i]; |
---|
3914 | m1[5][i] = m3[5][i] + m3[7][i]; |
---|
3915 | m1[6][i] = m3[4][i] - m3[6][i]; |
---|
3916 | m1[7][i] = m3[5][i] - m3[7][i]; |
---|
3917 | m1[8][i] = m3[8][i] + m3[10][i]; |
---|
3918 | m1[9][i] = m3[9][i] + m3[11][i]; |
---|
3919 | m1[10][i] = m3[8][i] - m3[10][i]; |
---|
3920 | m1[11][i] = m3[9][i] - m3[11][i]; |
---|
3921 | m1[12][i] = m3[12][i] + m3[14][i]; |
---|
3922 | m1[13][i] = m3[13][i] + m3[15][i]; |
---|
3923 | m1[14][i] = m3[12][i] - m3[14][i]; |
---|
3924 | m1[15][i] = m3[13][i] - m3[15][i]; |
---|
3925 | |
---|
3926 | m2[0][i] = m1[0][i] + m1[1][i]; |
---|
3927 | m2[1][i] = m1[0][i] - m1[1][i]; |
---|
3928 | m2[2][i] = m1[2][i] + m1[3][i]; |
---|
3929 | m2[3][i] = m1[2][i] - m1[3][i]; |
---|
3930 | m2[4][i] = m1[4][i] + m1[5][i]; |
---|
3931 | m2[5][i] = m1[4][i] - m1[5][i]; |
---|
3932 | m2[6][i] = m1[6][i] + m1[7][i]; |
---|
3933 | m2[7][i] = m1[6][i] - m1[7][i]; |
---|
3934 | m2[8][i] = m1[8][i] + m1[9][i]; |
---|
3935 | m2[9][i] = m1[8][i] - m1[9][i]; |
---|
3936 | m2[10][i] = m1[10][i] + m1[11][i]; |
---|
3937 | m2[11][i] = m1[10][i] - m1[11][i]; |
---|
3938 | m2[12][i] = m1[12][i] + m1[13][i]; |
---|
3939 | m2[13][i] = m1[12][i] - m1[13][i]; |
---|
3940 | m2[14][i] = m1[14][i] + m1[15][i]; |
---|
3941 | m2[15][i] = m1[14][i] - m1[15][i]; |
---|
3942 | } |
---|
3943 | |
---|
3944 | for (i = 0; i < 16; i++) |
---|
3945 | { |
---|
3946 | for (j = 0; j < 4; j++) |
---|
3947 | { |
---|
3948 | sad += abs(m2[i][j]); |
---|
3949 | } |
---|
3950 | } |
---|
3951 | |
---|
3952 | sad=((sad+2)>>2); |
---|
3953 | |
---|
3954 | return sad; |
---|
3955 | } |
---|
3956 | #endif |
---|
3957 | |
---|
3958 | UInt TComRdCost::xGetHADs4( DistParam* pcDtParam ) |
---|
3959 | { |
---|
3960 | if ( pcDtParam->bApplyWeight ) |
---|
3961 | { |
---|
3962 | return xGetHADs4w( pcDtParam ); |
---|
3963 | } |
---|
3964 | Pel* piOrg = pcDtParam->pOrg; |
---|
3965 | Pel* piCur = pcDtParam->pCur; |
---|
3966 | Int iRows = pcDtParam->iRows; |
---|
3967 | Int iStrideCur = pcDtParam->iStrideCur; |
---|
3968 | Int iStrideOrg = pcDtParam->iStrideOrg; |
---|
3969 | Int iStep = pcDtParam->iStep; |
---|
3970 | Int y; |
---|
3971 | Int iOffsetOrg = iStrideOrg<<2; |
---|
3972 | Int iOffsetCur = iStrideCur<<2; |
---|
3973 | |
---|
3974 | UInt uiSum = 0; |
---|
3975 | |
---|
3976 | for ( y=0; y<iRows; y+= 4 ) |
---|
3977 | { |
---|
3978 | uiSum += xCalcHADs4x4( piOrg, piCur, iStrideOrg, iStrideCur, iStep ); |
---|
3979 | piOrg += iOffsetOrg; |
---|
3980 | piCur += iOffsetCur; |
---|
3981 | } |
---|
3982 | |
---|
3983 | return ( uiSum >> g_uiBitIncrement ); |
---|
3984 | } |
---|
3985 | |
---|
3986 | UInt TComRdCost::xGetHADs8( DistParam* pcDtParam ) |
---|
3987 | { |
---|
3988 | if ( pcDtParam->bApplyWeight ) |
---|
3989 | { |
---|
3990 | return xGetHADs8w( pcDtParam ); |
---|
3991 | } |
---|
3992 | Pel* piOrg = pcDtParam->pOrg; |
---|
3993 | Pel* piCur = pcDtParam->pCur; |
---|
3994 | Int iRows = pcDtParam->iRows; |
---|
3995 | Int iStrideCur = pcDtParam->iStrideCur; |
---|
3996 | Int iStrideOrg = pcDtParam->iStrideOrg; |
---|
3997 | Int iStep = pcDtParam->iStep; |
---|
3998 | Int y; |
---|
3999 | |
---|
4000 | UInt uiSum = 0; |
---|
4001 | |
---|
4002 | if ( iRows == 4 ) |
---|
4003 | { |
---|
4004 | uiSum += xCalcHADs4x4( piOrg+0, piCur , iStrideOrg, iStrideCur, iStep ); |
---|
4005 | uiSum += xCalcHADs4x4( piOrg+4, piCur+4*iStep, iStrideOrg, iStrideCur, iStep ); |
---|
4006 | } |
---|
4007 | else |
---|
4008 | { |
---|
4009 | Int iOffsetOrg = iStrideOrg<<3; |
---|
4010 | Int iOffsetCur = iStrideCur<<3; |
---|
4011 | for ( y=0; y<iRows; y+= 8 ) |
---|
4012 | { |
---|
4013 | uiSum += xCalcHADs8x8( piOrg, piCur, iStrideOrg, iStrideCur, iStep ); |
---|
4014 | piOrg += iOffsetOrg; |
---|
4015 | piCur += iOffsetCur; |
---|
4016 | } |
---|
4017 | } |
---|
4018 | |
---|
4019 | return ( uiSum >> g_uiBitIncrement ); |
---|
4020 | } |
---|
4021 | |
---|
4022 | UInt TComRdCost::xGetHADs( DistParam* pcDtParam ) |
---|
4023 | { |
---|
4024 | if ( pcDtParam->bApplyWeight ) |
---|
4025 | { |
---|
4026 | return xGetHADsw( pcDtParam ); |
---|
4027 | } |
---|
4028 | #if LGE_ILLUCOMP_B0045 |
---|
4029 | if(pcDtParam->bUseIC) |
---|
4030 | { |
---|
4031 | return xGetHADsic( pcDtParam ); |
---|
4032 | } |
---|
4033 | #endif |
---|
4034 | Pel* piOrg = pcDtParam->pOrg; |
---|
4035 | Pel* piCur = pcDtParam->pCur; |
---|
4036 | Int iRows = pcDtParam->iRows; |
---|
4037 | Int iCols = pcDtParam->iCols; |
---|
4038 | Int iStrideCur = pcDtParam->iStrideCur; |
---|
4039 | Int iStrideOrg = pcDtParam->iStrideOrg; |
---|
4040 | Int iStep = pcDtParam->iStep; |
---|
4041 | |
---|
4042 | Int x, y; |
---|
4043 | |
---|
4044 | UInt uiSum = 0; |
---|
4045 | |
---|
4046 | #if NS_HAD |
---|
4047 | if( ( ( iRows % 8 == 0) && (iCols % 8 == 0) && ( iRows == iCols ) ) || ( ( iRows % 8 == 0 ) && (iCols % 8 == 0) && !pcDtParam->bUseNSHAD ) ) |
---|
4048 | #else |
---|
4049 | if( ( iRows % 8 == 0) && (iCols % 8 == 0) ) |
---|
4050 | #endif |
---|
4051 | { |
---|
4052 | Int iOffsetOrg = iStrideOrg<<3; |
---|
4053 | Int iOffsetCur = iStrideCur<<3; |
---|
4054 | for ( y=0; y<iRows; y+= 8 ) |
---|
4055 | { |
---|
4056 | for ( x=0; x<iCols; x+= 8 ) |
---|
4057 | { |
---|
4058 | uiSum += xCalcHADs8x8( &piOrg[x], &piCur[x*iStep], iStrideOrg, iStrideCur, iStep ); |
---|
4059 | } |
---|
4060 | piOrg += iOffsetOrg; |
---|
4061 | piCur += iOffsetCur; |
---|
4062 | } |
---|
4063 | } |
---|
4064 | #if NS_HAD |
---|
4065 | else if ( ( iCols > 8 ) && ( iCols > iRows ) && pcDtParam->bUseNSHAD ) |
---|
4066 | { |
---|
4067 | Int iOffsetOrg = iStrideOrg<<2; |
---|
4068 | Int iOffsetCur = iStrideCur<<2; |
---|
4069 | for ( y=0; y<iRows; y+= 4 ) |
---|
4070 | { |
---|
4071 | for ( x=0; x<iCols; x+= 16 ) |
---|
4072 | { |
---|
4073 | uiSum += xCalcHADs16x4( &piOrg[x], &piCur[x*iStep], iStrideOrg, iStrideCur, iStep ); |
---|
4074 | } |
---|
4075 | piOrg += iOffsetOrg; |
---|
4076 | piCur += iOffsetCur; |
---|
4077 | } |
---|
4078 | } |
---|
4079 | else if ( ( iRows > 8 ) && ( iCols < iRows ) && pcDtParam->bUseNSHAD ) |
---|
4080 | { |
---|
4081 | Int iOffsetOrg = iStrideOrg<<4; |
---|
4082 | Int iOffsetCur = iStrideCur<<4; |
---|
4083 | for ( y=0; y<iRows; y+= 16 ) |
---|
4084 | { |
---|
4085 | for ( x=0; x<iCols; x+= 4 ) |
---|
4086 | { |
---|
4087 | uiSum += xCalcHADs4x16( &piOrg[x], &piCur[x*iStep], iStrideOrg, iStrideCur, iStep ); |
---|
4088 | } |
---|
4089 | piOrg += iOffsetOrg; |
---|
4090 | piCur += iOffsetCur; |
---|
4091 | } |
---|
4092 | } |
---|
4093 | #endif |
---|
4094 | else if( ( iRows % 4 == 0) && (iCols % 4 == 0) ) |
---|
4095 | { |
---|
4096 | Int iOffsetOrg = iStrideOrg<<2; |
---|
4097 | Int iOffsetCur = iStrideCur<<2; |
---|
4098 | |
---|
4099 | for ( y=0; y<iRows; y+= 4 ) |
---|
4100 | { |
---|
4101 | for ( x=0; x<iCols; x+= 4 ) |
---|
4102 | { |
---|
4103 | uiSum += xCalcHADs4x4( &piOrg[x], &piCur[x*iStep], iStrideOrg, iStrideCur, iStep ); |
---|
4104 | } |
---|
4105 | piOrg += iOffsetOrg; |
---|
4106 | piCur += iOffsetCur; |
---|
4107 | } |
---|
4108 | } |
---|
4109 | else if( ( iRows % 2 == 0) && (iCols % 2 == 0) ) |
---|
4110 | { |
---|
4111 | Int iOffsetOrg = iStrideOrg<<1; |
---|
4112 | Int iOffsetCur = iStrideCur<<1; |
---|
4113 | for ( y=0; y<iRows; y+=2 ) |
---|
4114 | { |
---|
4115 | for ( x=0; x<iCols; x+=2 ) |
---|
4116 | { |
---|
4117 | uiSum += xCalcHADs2x2( &piOrg[x], &piCur[x*iStep], iStrideOrg, iStrideCur, iStep ); |
---|
4118 | } |
---|
4119 | piOrg += iOffsetOrg; |
---|
4120 | piCur += iOffsetCur; |
---|
4121 | } |
---|
4122 | } |
---|
4123 | else |
---|
4124 | { |
---|
4125 | assert(false); |
---|
4126 | } |
---|
4127 | |
---|
4128 | return ( uiSum >> g_uiBitIncrement ); |
---|
4129 | } |
---|
4130 | |
---|
4131 | #if LGE_ILLUCOMP_B0045 |
---|
4132 | UInt TComRdCost::xGetHADsic( DistParam* pcDtParam ) |
---|
4133 | { |
---|
4134 | if ( pcDtParam->bApplyWeight ) |
---|
4135 | { |
---|
4136 | return xGetHADsw( pcDtParam ); |
---|
4137 | } |
---|
4138 | Pel* piOrg = pcDtParam->pOrg; |
---|
4139 | Pel* piCur = pcDtParam->pCur; |
---|
4140 | Int iRows = pcDtParam->iRows; |
---|
4141 | Int iCols = pcDtParam->iCols; |
---|
4142 | Int iStrideCur = pcDtParam->iStrideCur; |
---|
4143 | Int iStrideOrg = pcDtParam->iStrideOrg; |
---|
4144 | Int iStep = pcDtParam->iStep; |
---|
4145 | |
---|
4146 | Int x, y; |
---|
4147 | |
---|
4148 | UInt uiSum = 0; |
---|
4149 | |
---|
4150 | Int iOrigAvg = 0, iCurAvg = 0; |
---|
4151 | Int iDeltaC; |
---|
4152 | |
---|
4153 | for ( y=0; y<iRows; y++ ) |
---|
4154 | { |
---|
4155 | for ( x=0; x<iCols; x++ ) |
---|
4156 | { |
---|
4157 | iOrigAvg += piOrg[x]; |
---|
4158 | iCurAvg += piCur[x]; |
---|
4159 | } |
---|
4160 | piOrg += iStrideOrg; |
---|
4161 | piCur += iStrideCur; |
---|
4162 | } |
---|
4163 | |
---|
4164 | piOrg = pcDtParam->pOrg; |
---|
4165 | piCur = pcDtParam->pCur; |
---|
4166 | |
---|
4167 | iDeltaC = (iOrigAvg - iCurAvg)/iRows/iCols; |
---|
4168 | |
---|
4169 | for ( y=0; y<iRows; y++ ) |
---|
4170 | { |
---|
4171 | for ( x=0; x<iCols; x++ ) |
---|
4172 | { |
---|
4173 | piOrg[x] -= iDeltaC; |
---|
4174 | } |
---|
4175 | piOrg += iStrideOrg; |
---|
4176 | } |
---|
4177 | |
---|
4178 | piOrg = pcDtParam->pOrg; |
---|
4179 | |
---|
4180 | #if NS_HAD |
---|
4181 | if( ( ( iRows % 8 == 0) && (iCols % 8 == 0) && ( iRows == iCols ) ) || ( ( iRows % 8 == 0 ) && (iCols % 8 == 0) && !pcDtParam->bUseNSHAD ) ) |
---|
4182 | #else |
---|
4183 | if( ( iRows % 8 == 0) && (iCols % 8 == 0) ) |
---|
4184 | #endif |
---|
4185 | { |
---|
4186 | Int iOffsetOrg = iStrideOrg<<3; |
---|
4187 | Int iOffsetCur = iStrideCur<<3; |
---|
4188 | for ( y=0; y<iRows; y+= 8 ) |
---|
4189 | { |
---|
4190 | for ( x=0; x<iCols; x+= 8 ) |
---|
4191 | { |
---|
4192 | uiSum += xCalcHADs8x8( &piOrg[x], &piCur[x*iStep], iStrideOrg, iStrideCur, iStep ); |
---|
4193 | } |
---|
4194 | piOrg += iOffsetOrg; |
---|
4195 | piCur += iOffsetCur; |
---|
4196 | } |
---|
4197 | } |
---|
4198 | #if NS_HAD |
---|
4199 | else if ( ( iCols > 8 ) && ( iCols > iRows ) && pcDtParam->bUseNSHAD ) |
---|
4200 | { |
---|
4201 | Int iOffsetOrg = iStrideOrg<<2; |
---|
4202 | Int iOffsetCur = iStrideCur<<2; |
---|
4203 | for ( y=0; y<iRows; y+= 4 ) |
---|
4204 | { |
---|
4205 | for ( x=0; x<iCols; x+= 16 ) |
---|
4206 | { |
---|
4207 | uiSum += xCalcHADs16x4( &piOrg[x], &piCur[x*iStep], iStrideOrg, iStrideCur, iStep ); |
---|
4208 | } |
---|
4209 | piOrg += iOffsetOrg; |
---|
4210 | piCur += iOffsetCur; |
---|
4211 | } |
---|
4212 | } |
---|
4213 | else if ( ( iRows > 8 ) && ( iCols < iRows ) && pcDtParam->bUseNSHAD ) |
---|
4214 | { |
---|
4215 | Int iOffsetOrg = iStrideOrg<<4; |
---|
4216 | Int iOffsetCur = iStrideCur<<4; |
---|
4217 | for ( y=0; y<iRows; y+= 16 ) |
---|
4218 | { |
---|
4219 | for ( x=0; x<iCols; x+= 4 ) |
---|
4220 | { |
---|
4221 | uiSum += xCalcHADs4x16( &piOrg[x], &piCur[x*iStep], iStrideOrg, iStrideCur, iStep ); |
---|
4222 | } |
---|
4223 | piOrg += iOffsetOrg; |
---|
4224 | piCur += iOffsetCur; |
---|
4225 | } |
---|
4226 | } |
---|
4227 | #endif |
---|
4228 | else if( ( iRows % 4 == 0) && (iCols % 4 == 0) ) |
---|
4229 | { |
---|
4230 | Int iOffsetOrg = iStrideOrg<<2; |
---|
4231 | Int iOffsetCur = iStrideCur<<2; |
---|
4232 | |
---|
4233 | for ( y=0; y<iRows; y+= 4 ) |
---|
4234 | { |
---|
4235 | for ( x=0; x<iCols; x+= 4 ) |
---|
4236 | { |
---|
4237 | uiSum += xCalcHADs4x4( &piOrg[x], &piCur[x*iStep], iStrideOrg, iStrideCur, iStep ); |
---|
4238 | } |
---|
4239 | piOrg += iOffsetOrg; |
---|
4240 | piCur += iOffsetCur; |
---|
4241 | } |
---|
4242 | } |
---|
4243 | else if( ( iRows % 2 == 0) && (iCols % 2 == 0) ) |
---|
4244 | { |
---|
4245 | Int iOffsetOrg = iStrideOrg<<1; |
---|
4246 | Int iOffsetCur = iStrideCur<<1; |
---|
4247 | for ( y=0; y<iRows; y+=2 ) |
---|
4248 | { |
---|
4249 | for ( x=0; x<iCols; x+=2 ) |
---|
4250 | { |
---|
4251 | uiSum += xCalcHADs2x2( &piOrg[x], &piCur[x*iStep], iStrideOrg, iStrideCur, iStep ); |
---|
4252 | } |
---|
4253 | piOrg += iOffsetOrg; |
---|
4254 | piCur += iOffsetCur; |
---|
4255 | } |
---|
4256 | } |
---|
4257 | else |
---|
4258 | { |
---|
4259 | assert(false); |
---|
4260 | } |
---|
4261 | |
---|
4262 | piOrg = pcDtParam->pOrg; |
---|
4263 | |
---|
4264 | for ( y=0; y<iRows; y++ ) |
---|
4265 | { |
---|
4266 | for ( x=0; x<iCols; x++ ) |
---|
4267 | { |
---|
4268 | piOrg[x] += iDeltaC; |
---|
4269 | } |
---|
4270 | piOrg += iStrideOrg; |
---|
4271 | } |
---|
4272 | |
---|
4273 | return ( uiSum >> g_uiBitIncrement ); |
---|
4274 | } |
---|
4275 | #endif |
---|
4276 | |
---|
4277 | #if HHI_VSO |
---|
4278 | Void TComRdCost::setLambdaVSO( Double dLambdaVSO ) |
---|
4279 | { |
---|
4280 | m_dLambdaVSO = dLambdaVSO; |
---|
4281 | m_dSqrtLambdaVSO = sqrt(m_dLambdaVSO); |
---|
4282 | m_uiLambdaMotionSADVSO = (UInt)floor(65536.0 * m_dSqrtLambdaVSO); |
---|
4283 | m_uiLambdaMotionSSEVSO = (UInt)floor(65536.0 * m_dLambdaVSO ); |
---|
4284 | } |
---|
4285 | |
---|
4286 | Dist TComRdCost::xGetDistVSOMode4( Int iStartPosX, Int iStartPosY, Pel* piCur, Int iCurStride, Pel* piOrg, Int iOrgStride, UInt uiBlkWidth, UInt uiBlkHeight, Bool bSAD ) |
---|
4287 | { |
---|
4288 | AOT(bSAD); |
---|
4289 | #ifdef LGE_VSO_EARLY_SKIP_A0093 |
---|
4290 | RMDist iDist = m_pcRenModel->getDist( iStartPosX, iStartPosY, (Int) uiBlkWidth, (Int) uiBlkHeight, iCurStride, piCur, piOrg, iOrgStride); |
---|
4291 | #else |
---|
4292 | RMDist iDist = m_pcRenModel->getDist( iStartPosX, iStartPosY, (Int) uiBlkWidth, (Int) uiBlkHeight, iCurStride, piCur ); |
---|
4293 | #endif |
---|
4294 | |
---|
4295 | RMDist iDistMin = (RMDist) RDO_DIST_MIN; |
---|
4296 | #if HHI_VSO_DIST_INT |
---|
4297 | iDistMin = m_bAllowNegDist ? RDO_DIST_MIN : 0; |
---|
4298 | #endif |
---|
4299 | |
---|
4300 | iDist = Min( iDist, (RMDist) RDO_DIST_MAX); |
---|
4301 | iDist = Max( iDist, iDistMin); |
---|
4302 | return (Dist) iDist; |
---|
4303 | } |
---|
4304 | |
---|
4305 | |
---|
4306 | Dist TComRdCost::getDistVS( TComDataCU* pcCU, UInt uiAbsPartIndex, Pel* piCur, Int iCurStride, Pel* piOrg, Int iOrgStride, UInt uiBlkWidth, UInt uiBlkHeight, Bool bSAD, UInt uiPlane ) |
---|
4307 | { |
---|
4308 | assert( m_bUseVSO ); |
---|
4309 | assert( this->m_fpDistortFuncVSO != 0 ); |
---|
4310 | |
---|
4311 | Int iPosX; |
---|
4312 | Int iPosY; |
---|
4313 | |
---|
4314 | pcCU->getPosInPic( uiAbsPartIndex, iPosX, iPosY ); |
---|
4315 | return (this->*m_fpDistortFuncVSO) ( iPosX, iPosY, piCur, iCurStride, piOrg, iOrgStride, uiBlkWidth, uiBlkHeight, bSAD ); |
---|
4316 | }; |
---|
4317 | |
---|
4318 | |
---|
4319 | Void TComRdCost::setVSOMode( UInt uiIn ) |
---|
4320 | { |
---|
4321 | m_uiVSOMode = uiIn; |
---|
4322 | switch (m_uiVSOMode ) |
---|
4323 | { |
---|
4324 | case 4: |
---|
4325 | m_fpDistortFuncVSO = &TComRdCost::xGetDistVSOMode4; |
---|
4326 | break; |
---|
4327 | default: |
---|
4328 | assert(0); |
---|
4329 | break; |
---|
4330 | } |
---|
4331 | } |
---|
4332 | |
---|
4333 | |
---|
4334 | Double TComRdCost::calcRdCostVSO( UInt uiBits, Dist uiDistortion, Bool bFlag, DFunc eDFunc ) |
---|
4335 | { |
---|
4336 | assert( m_bUseLambdaScaleVSO ); |
---|
4337 | |
---|
4338 | Double dRdCost = 0.0; |
---|
4339 | Double dLambda = 0.0; |
---|
4340 | |
---|
4341 | switch ( eDFunc ) |
---|
4342 | { |
---|
4343 | case DF_SSE: |
---|
4344 | assert(0); |
---|
4345 | break; |
---|
4346 | case DF_SAD: |
---|
4347 | dLambda = (Double)m_uiLambdaMotionSADVSO; |
---|
4348 | break; |
---|
4349 | case DF_DEFAULT: |
---|
4350 | dLambda = m_dLambdaVSO; |
---|
4351 | break; |
---|
4352 | case DF_SSE_FRAME: |
---|
4353 | dLambda = m_dFrameLambdaVSO; |
---|
4354 | break; |
---|
4355 | default: |
---|
4356 | assert (0); |
---|
4357 | break; |
---|
4358 | } |
---|
4359 | |
---|
4360 | if (bFlag) |
---|
4361 | { |
---|
4362 | // Intra8x8, Intra4x4 Block only... |
---|
4363 | dRdCost = (((Double)uiDistortion) + ((Double)uiBits * dLambda)); |
---|
4364 | } |
---|
4365 | else |
---|
4366 | { |
---|
4367 | if (eDFunc == DF_SAD) |
---|
4368 | { |
---|
4369 | dRdCost = ((Double)uiDistortion + (Double)((Int)(uiBits * dLambda+.5)>>16)); |
---|
4370 | dRdCost = (Double)(Dist)floor(dRdCost); |
---|
4371 | } |
---|
4372 | else |
---|
4373 | { |
---|
4374 | dRdCost = ((Double)uiDistortion + (Double)((Int)(uiBits * dLambda+.5))); |
---|
4375 | dRdCost = (Double)(Dist)floor(dRdCost); |
---|
4376 | } |
---|
4377 | } |
---|
4378 | |
---|
4379 | return dRdCost; |
---|
4380 | } |
---|
4381 | |
---|
4382 | Void TComRdCost::setRenModelData( TComDataCU* pcCU, UInt uiAbsPartIndex, Pel* piData, Int iStride, Int iBlkWidth, Int iBlkHeight ) |
---|
4383 | { |
---|
4384 | UInt iBlkX = g_auiRasterToPelX[g_auiZscanToRaster[uiAbsPartIndex]]; |
---|
4385 | UInt iBlkY = g_auiRasterToPelY[g_auiZscanToRaster[uiAbsPartIndex]]; |
---|
4386 | |
---|
4387 | Int iStartPosX = iBlkX + pcCU->getCUPelX(); |
---|
4388 | Int iStartPosY = iBlkY + pcCU->getCUPelY(); |
---|
4389 | |
---|
4390 | m_pcRenModel->setData( iStartPosX, iStartPosY, iBlkWidth, iBlkHeight, iStride, piData ); |
---|
4391 | } |
---|
4392 | |
---|
4393 | #if HHI_VSO_DIST_INT |
---|
4394 | Void TComRdCost::setAllowNegDist( Bool bAllowNegDist ) |
---|
4395 | { |
---|
4396 | m_bAllowNegDist = bAllowNegDist; |
---|
4397 | } |
---|
4398 | #endif |
---|
4399 | |
---|
4400 | #endif |
---|
4401 | //! \} |
---|