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