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