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-2014, 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 TComYuv.cpp |
---|
35 | \brief general YUV buffer class |
---|
36 | \todo this should be merged with TComPicYuv |
---|
37 | */ |
---|
38 | |
---|
39 | #include <stdlib.h> |
---|
40 | #include <memory.h> |
---|
41 | #include <assert.h> |
---|
42 | #include <math.h> |
---|
43 | |
---|
44 | #include "CommonDef.h" |
---|
45 | #include "TComYuv.h" |
---|
46 | #include "TComInterpolationFilter.h" |
---|
47 | |
---|
48 | //! \ingroup TLibCommon |
---|
49 | //! \{ |
---|
50 | |
---|
51 | TComYuv::TComYuv() |
---|
52 | { |
---|
53 | m_apiBufY = NULL; |
---|
54 | m_apiBufU = NULL; |
---|
55 | m_apiBufV = NULL; |
---|
56 | } |
---|
57 | |
---|
58 | TComYuv::~TComYuv() |
---|
59 | { |
---|
60 | } |
---|
61 | |
---|
62 | Void TComYuv::create( UInt iWidth, UInt iHeight ) |
---|
63 | { |
---|
64 | // memory allocation |
---|
65 | m_apiBufY = (Pel*)xMalloc( Pel, iWidth*iHeight ); |
---|
66 | m_apiBufU = (Pel*)xMalloc( Pel, iWidth*iHeight >> 2 ); |
---|
67 | m_apiBufV = (Pel*)xMalloc( Pel, iWidth*iHeight >> 2 ); |
---|
68 | |
---|
69 | // set width and height |
---|
70 | m_iWidth = iWidth; |
---|
71 | m_iHeight = iHeight; |
---|
72 | m_iCWidth = iWidth >> 1; |
---|
73 | m_iCHeight = iHeight >> 1; |
---|
74 | } |
---|
75 | |
---|
76 | Void TComYuv::destroy() |
---|
77 | { |
---|
78 | // memory free |
---|
79 | xFree( m_apiBufY ); m_apiBufY = NULL; |
---|
80 | xFree( m_apiBufU ); m_apiBufU = NULL; |
---|
81 | xFree( m_apiBufV ); m_apiBufV = NULL; |
---|
82 | } |
---|
83 | |
---|
84 | Void TComYuv::clear() |
---|
85 | { |
---|
86 | ::memset( m_apiBufY, 0, ( m_iWidth * m_iHeight )*sizeof(Pel) ); |
---|
87 | ::memset( m_apiBufU, 0, ( m_iCWidth * m_iCHeight )*sizeof(Pel) ); |
---|
88 | ::memset( m_apiBufV, 0, ( m_iCWidth * m_iCHeight )*sizeof(Pel) ); |
---|
89 | } |
---|
90 | |
---|
91 | Void TComYuv::copyToPicYuv ( TComPicYuv* pcPicYuvDst, UInt iCuAddr, UInt uiAbsZorderIdx, UInt uiPartDepth, UInt uiPartIdx ) |
---|
92 | { |
---|
93 | copyToPicLuma ( pcPicYuvDst, iCuAddr, uiAbsZorderIdx, uiPartDepth, uiPartIdx ); |
---|
94 | copyToPicChroma( pcPicYuvDst, iCuAddr, uiAbsZorderIdx, uiPartDepth, uiPartIdx ); |
---|
95 | } |
---|
96 | |
---|
97 | Void TComYuv::copyToPicLuma ( TComPicYuv* pcPicYuvDst, UInt iCuAddr, UInt uiAbsZorderIdx, UInt uiPartDepth, UInt uiPartIdx ) |
---|
98 | { |
---|
99 | Int y, iWidth, iHeight; |
---|
100 | iWidth = m_iWidth >>uiPartDepth; |
---|
101 | iHeight = m_iHeight>>uiPartDepth; |
---|
102 | |
---|
103 | Pel* pSrc = getLumaAddr(uiPartIdx, iWidth); |
---|
104 | Pel* pDst = pcPicYuvDst->getLumaAddr ( iCuAddr, uiAbsZorderIdx ); |
---|
105 | |
---|
106 | UInt iSrcStride = getStride(); |
---|
107 | UInt iDstStride = pcPicYuvDst->getStride(); |
---|
108 | |
---|
109 | for ( y = iHeight; y != 0; y-- ) |
---|
110 | { |
---|
111 | ::memcpy( pDst, pSrc, sizeof(Pel)*iWidth); |
---|
112 | #if ENC_DEC_TRACE && H_MV_ENC_DEC_TRAC |
---|
113 | if ( g_traceCopyBack && g_nSymbolCounter >= g_stopAtCounter ) |
---|
114 | { |
---|
115 | for ( Int x = 0; x < iWidth; x++) |
---|
116 | { |
---|
117 | std::cout << pSrc[ x ] << " " ; |
---|
118 | } |
---|
119 | std::cout << std::endl; |
---|
120 | } |
---|
121 | #endif |
---|
122 | pDst += iDstStride; |
---|
123 | pSrc += iSrcStride; |
---|
124 | } |
---|
125 | } |
---|
126 | |
---|
127 | Void TComYuv::copyToPicChroma( TComPicYuv* pcPicYuvDst, UInt iCuAddr, UInt uiAbsZorderIdx, UInt uiPartDepth, UInt uiPartIdx ) |
---|
128 | { |
---|
129 | Int y, iWidth, iHeight; |
---|
130 | iWidth = m_iCWidth >>uiPartDepth; |
---|
131 | iHeight = m_iCHeight>>uiPartDepth; |
---|
132 | |
---|
133 | Pel* pSrcU = getCbAddr(uiPartIdx, iWidth); |
---|
134 | Pel* pSrcV = getCrAddr(uiPartIdx, iWidth); |
---|
135 | Pel* pDstU = pcPicYuvDst->getCbAddr( iCuAddr, uiAbsZorderIdx ); |
---|
136 | Pel* pDstV = pcPicYuvDst->getCrAddr( iCuAddr, uiAbsZorderIdx ); |
---|
137 | |
---|
138 | UInt iSrcStride = getCStride(); |
---|
139 | UInt iDstStride = pcPicYuvDst->getCStride(); |
---|
140 | for ( y = iHeight; y != 0; y-- ) |
---|
141 | { |
---|
142 | ::memcpy( pDstU, pSrcU, sizeof(Pel)*(iWidth) ); |
---|
143 | ::memcpy( pDstV, pSrcV, sizeof(Pel)*(iWidth) ); |
---|
144 | pSrcU += iSrcStride; |
---|
145 | pSrcV += iSrcStride; |
---|
146 | pDstU += iDstStride; |
---|
147 | pDstV += iDstStride; |
---|
148 | } |
---|
149 | } |
---|
150 | |
---|
151 | Void TComYuv::copyFromPicYuv ( TComPicYuv* pcPicYuvSrc, UInt iCuAddr, UInt uiAbsZorderIdx ) |
---|
152 | { |
---|
153 | copyFromPicLuma ( pcPicYuvSrc, iCuAddr, uiAbsZorderIdx ); |
---|
154 | copyFromPicChroma( pcPicYuvSrc, iCuAddr, uiAbsZorderIdx ); |
---|
155 | } |
---|
156 | |
---|
157 | Void TComYuv::copyFromPicLuma ( TComPicYuv* pcPicYuvSrc, UInt iCuAddr, UInt uiAbsZorderIdx ) |
---|
158 | { |
---|
159 | Int y; |
---|
160 | |
---|
161 | Pel* pDst = m_apiBufY; |
---|
162 | Pel* pSrc = pcPicYuvSrc->getLumaAddr ( iCuAddr, uiAbsZorderIdx ); |
---|
163 | |
---|
164 | UInt iDstStride = getStride(); |
---|
165 | UInt iSrcStride = pcPicYuvSrc->getStride(); |
---|
166 | for ( y = m_iHeight; y != 0; y-- ) |
---|
167 | { |
---|
168 | ::memcpy( pDst, pSrc, sizeof(Pel)*m_iWidth); |
---|
169 | pDst += iDstStride; |
---|
170 | pSrc += iSrcStride; |
---|
171 | } |
---|
172 | } |
---|
173 | |
---|
174 | Void TComYuv::copyFromPicChroma( TComPicYuv* pcPicYuvSrc, UInt iCuAddr, UInt uiAbsZorderIdx ) |
---|
175 | { |
---|
176 | Int y; |
---|
177 | |
---|
178 | Pel* pDstU = m_apiBufU; |
---|
179 | Pel* pDstV = m_apiBufV; |
---|
180 | Pel* pSrcU = pcPicYuvSrc->getCbAddr( iCuAddr, uiAbsZorderIdx ); |
---|
181 | Pel* pSrcV = pcPicYuvSrc->getCrAddr( iCuAddr, uiAbsZorderIdx ); |
---|
182 | |
---|
183 | UInt iDstStride = getCStride(); |
---|
184 | UInt iSrcStride = pcPicYuvSrc->getCStride(); |
---|
185 | for ( y = m_iCHeight; y != 0; y-- ) |
---|
186 | { |
---|
187 | ::memcpy( pDstU, pSrcU, sizeof(Pel)*(m_iCWidth) ); |
---|
188 | ::memcpy( pDstV, pSrcV, sizeof(Pel)*(m_iCWidth) ); |
---|
189 | pSrcU += iSrcStride; |
---|
190 | pSrcV += iSrcStride; |
---|
191 | pDstU += iDstStride; |
---|
192 | pDstV += iDstStride; |
---|
193 | } |
---|
194 | } |
---|
195 | |
---|
196 | Void TComYuv::copyToPartYuv( TComYuv* pcYuvDst, UInt uiDstPartIdx ) |
---|
197 | { |
---|
198 | copyToPartLuma ( pcYuvDst, uiDstPartIdx ); |
---|
199 | copyToPartChroma( pcYuvDst, uiDstPartIdx ); |
---|
200 | } |
---|
201 | |
---|
202 | Void TComYuv::copyToPartLuma( TComYuv* pcYuvDst, UInt uiDstPartIdx ) |
---|
203 | { |
---|
204 | Int y; |
---|
205 | |
---|
206 | Pel* pSrc = m_apiBufY; |
---|
207 | Pel* pDst = pcYuvDst->getLumaAddr( uiDstPartIdx ); |
---|
208 | |
---|
209 | UInt iSrcStride = getStride(); |
---|
210 | UInt iDstStride = pcYuvDst->getStride(); |
---|
211 | for ( y = m_iHeight; y != 0; y-- ) |
---|
212 | { |
---|
213 | ::memcpy( pDst, pSrc, sizeof(Pel)*m_iWidth); |
---|
214 | pDst += iDstStride; |
---|
215 | pSrc += iSrcStride; |
---|
216 | } |
---|
217 | } |
---|
218 | |
---|
219 | Void TComYuv::copyToPartChroma( TComYuv* pcYuvDst, UInt uiDstPartIdx ) |
---|
220 | { |
---|
221 | Int y; |
---|
222 | |
---|
223 | Pel* pSrcU = m_apiBufU; |
---|
224 | Pel* pSrcV = m_apiBufV; |
---|
225 | Pel* pDstU = pcYuvDst->getCbAddr( uiDstPartIdx ); |
---|
226 | Pel* pDstV = pcYuvDst->getCrAddr( uiDstPartIdx ); |
---|
227 | |
---|
228 | UInt iSrcStride = getCStride(); |
---|
229 | UInt iDstStride = pcYuvDst->getCStride(); |
---|
230 | for ( y = m_iCHeight; y != 0; y-- ) |
---|
231 | { |
---|
232 | ::memcpy( pDstU, pSrcU, sizeof(Pel)*(m_iCWidth) ); |
---|
233 | ::memcpy( pDstV, pSrcV, sizeof(Pel)*(m_iCWidth) ); |
---|
234 | pSrcU += iSrcStride; |
---|
235 | pSrcV += iSrcStride; |
---|
236 | pDstU += iDstStride; |
---|
237 | pDstV += iDstStride; |
---|
238 | } |
---|
239 | } |
---|
240 | |
---|
241 | Void TComYuv::copyPartToYuv( TComYuv* pcYuvDst, UInt uiSrcPartIdx ) |
---|
242 | { |
---|
243 | copyPartToLuma ( pcYuvDst, uiSrcPartIdx ); |
---|
244 | copyPartToChroma( pcYuvDst, uiSrcPartIdx ); |
---|
245 | } |
---|
246 | |
---|
247 | Void TComYuv::copyPartToLuma( TComYuv* pcYuvDst, UInt uiSrcPartIdx ) |
---|
248 | { |
---|
249 | Int y; |
---|
250 | |
---|
251 | Pel* pSrc = getLumaAddr(uiSrcPartIdx); |
---|
252 | Pel* pDst = pcYuvDst->getLumaAddr( 0 ); |
---|
253 | |
---|
254 | UInt iSrcStride = getStride(); |
---|
255 | UInt iDstStride = pcYuvDst->getStride(); |
---|
256 | |
---|
257 | UInt uiHeight = pcYuvDst->getHeight(); |
---|
258 | UInt uiWidth = pcYuvDst->getWidth(); |
---|
259 | |
---|
260 | for ( y = uiHeight; y != 0; y-- ) |
---|
261 | { |
---|
262 | ::memcpy( pDst, pSrc, sizeof(Pel)*uiWidth); |
---|
263 | pDst += iDstStride; |
---|
264 | pSrc += iSrcStride; |
---|
265 | } |
---|
266 | } |
---|
267 | |
---|
268 | Void TComYuv::copyPartToChroma( TComYuv* pcYuvDst, UInt uiSrcPartIdx ) |
---|
269 | { |
---|
270 | Int y; |
---|
271 | |
---|
272 | Pel* pSrcU = getCbAddr( uiSrcPartIdx ); |
---|
273 | Pel* pSrcV = getCrAddr( uiSrcPartIdx ); |
---|
274 | Pel* pDstU = pcYuvDst->getCbAddr( 0 ); |
---|
275 | Pel* pDstV = pcYuvDst->getCrAddr( 0 ); |
---|
276 | |
---|
277 | UInt iSrcStride = getCStride(); |
---|
278 | UInt iDstStride = pcYuvDst->getCStride(); |
---|
279 | |
---|
280 | UInt uiCHeight = pcYuvDst->getCHeight(); |
---|
281 | UInt uiCWidth = pcYuvDst->getCWidth(); |
---|
282 | |
---|
283 | for ( y = uiCHeight; y != 0; y-- ) |
---|
284 | { |
---|
285 | ::memcpy( pDstU, pSrcU, sizeof(Pel)*(uiCWidth) ); |
---|
286 | ::memcpy( pDstV, pSrcV, sizeof(Pel)*(uiCWidth) ); |
---|
287 | pSrcU += iSrcStride; |
---|
288 | pSrcV += iSrcStride; |
---|
289 | pDstU += iDstStride; |
---|
290 | pDstV += iDstStride; |
---|
291 | } |
---|
292 | } |
---|
293 | |
---|
294 | Void TComYuv::copyPartToPartYuv ( TComYuv* pcYuvDst, UInt uiPartIdx, UInt iWidth, UInt iHeight ) |
---|
295 | { |
---|
296 | copyPartToPartLuma (pcYuvDst, uiPartIdx, iWidth, iHeight ); |
---|
297 | copyPartToPartChroma (pcYuvDst, uiPartIdx, iWidth>>1, iHeight>>1 ); |
---|
298 | } |
---|
299 | |
---|
300 | Void TComYuv::copyPartToPartLuma ( TComYuv* pcYuvDst, UInt uiPartIdx, UInt iWidth, UInt iHeight ) |
---|
301 | { |
---|
302 | Pel* pSrc = getLumaAddr(uiPartIdx); |
---|
303 | Pel* pDst = pcYuvDst->getLumaAddr(uiPartIdx); |
---|
304 | if( pSrc == pDst ) |
---|
305 | { |
---|
306 | //th not a good idea |
---|
307 | //th best would be to fix the caller |
---|
308 | return ; |
---|
309 | } |
---|
310 | |
---|
311 | UInt iSrcStride = getStride(); |
---|
312 | UInt iDstStride = pcYuvDst->getStride(); |
---|
313 | for ( UInt y = iHeight; y != 0; y-- ) |
---|
314 | { |
---|
315 | ::memcpy( pDst, pSrc, iWidth * sizeof(Pel) ); |
---|
316 | pSrc += iSrcStride; |
---|
317 | pDst += iDstStride; |
---|
318 | } |
---|
319 | } |
---|
320 | |
---|
321 | Void TComYuv::copyPartToPartChroma( TComYuv* pcYuvDst, UInt uiPartIdx, UInt iWidth, UInt iHeight ) |
---|
322 | { |
---|
323 | Pel* pSrcU = getCbAddr(uiPartIdx); |
---|
324 | Pel* pSrcV = getCrAddr(uiPartIdx); |
---|
325 | Pel* pDstU = pcYuvDst->getCbAddr(uiPartIdx); |
---|
326 | Pel* pDstV = pcYuvDst->getCrAddr(uiPartIdx); |
---|
327 | |
---|
328 | if( pSrcU == pDstU && pSrcV == pDstV) |
---|
329 | { |
---|
330 | //th not a good idea |
---|
331 | //th best would be to fix the caller |
---|
332 | return ; |
---|
333 | } |
---|
334 | |
---|
335 | UInt iSrcStride = getCStride(); |
---|
336 | UInt iDstStride = pcYuvDst->getCStride(); |
---|
337 | for ( UInt y = iHeight; y != 0; y-- ) |
---|
338 | { |
---|
339 | ::memcpy( pDstU, pSrcU, iWidth * sizeof(Pel) ); |
---|
340 | ::memcpy( pDstV, pSrcV, iWidth * sizeof(Pel) ); |
---|
341 | pSrcU += iSrcStride; |
---|
342 | pSrcV += iSrcStride; |
---|
343 | pDstU += iDstStride; |
---|
344 | pDstV += iDstStride; |
---|
345 | } |
---|
346 | } |
---|
347 | |
---|
348 | Void TComYuv::copyPartToPartChroma( TComYuv* pcYuvDst, UInt uiPartIdx, UInt iWidth, UInt iHeight, UInt chromaId) |
---|
349 | { |
---|
350 | if(chromaId == 0) |
---|
351 | { |
---|
352 | Pel* pSrcU = getCbAddr(uiPartIdx); |
---|
353 | Pel* pDstU = pcYuvDst->getCbAddr(uiPartIdx); |
---|
354 | if( pSrcU == pDstU) |
---|
355 | { |
---|
356 | return ; |
---|
357 | } |
---|
358 | UInt iSrcStride = getCStride(); |
---|
359 | UInt iDstStride = pcYuvDst->getCStride(); |
---|
360 | for ( UInt y = iHeight; y != 0; y-- ) |
---|
361 | { |
---|
362 | ::memcpy( pDstU, pSrcU, iWidth * sizeof(Pel) ); |
---|
363 | pSrcU += iSrcStride; |
---|
364 | pDstU += iDstStride; |
---|
365 | } |
---|
366 | } |
---|
367 | else if (chromaId == 1) |
---|
368 | { |
---|
369 | Pel* pSrcV = getCrAddr(uiPartIdx); |
---|
370 | Pel* pDstV = pcYuvDst->getCrAddr(uiPartIdx); |
---|
371 | if( pSrcV == pDstV) |
---|
372 | { |
---|
373 | return; |
---|
374 | } |
---|
375 | UInt iSrcStride = getCStride(); |
---|
376 | UInt iDstStride = pcYuvDst->getCStride(); |
---|
377 | for ( UInt y = iHeight; y != 0; y-- ) |
---|
378 | { |
---|
379 | ::memcpy( pDstV, pSrcV, iWidth * sizeof(Pel) ); |
---|
380 | pSrcV += iSrcStride; |
---|
381 | pDstV += iDstStride; |
---|
382 | } |
---|
383 | } |
---|
384 | else |
---|
385 | { |
---|
386 | Pel* pSrcU = getCbAddr(uiPartIdx); |
---|
387 | Pel* pSrcV = getCrAddr(uiPartIdx); |
---|
388 | Pel* pDstU = pcYuvDst->getCbAddr(uiPartIdx); |
---|
389 | Pel* pDstV = pcYuvDst->getCrAddr(uiPartIdx); |
---|
390 | |
---|
391 | if( pSrcU == pDstU && pSrcV == pDstV) |
---|
392 | { |
---|
393 | //th not a good idea |
---|
394 | //th best would be to fix the caller |
---|
395 | return ; |
---|
396 | } |
---|
397 | UInt iSrcStride = getCStride(); |
---|
398 | UInt iDstStride = pcYuvDst->getCStride(); |
---|
399 | for ( UInt y = iHeight; y != 0; y-- ) |
---|
400 | { |
---|
401 | ::memcpy( pDstU, pSrcU, iWidth * sizeof(Pel) ); |
---|
402 | ::memcpy( pDstV, pSrcV, iWidth * sizeof(Pel) ); |
---|
403 | pSrcU += iSrcStride; |
---|
404 | pSrcV += iSrcStride; |
---|
405 | pDstU += iDstStride; |
---|
406 | pDstV += iDstStride; |
---|
407 | } |
---|
408 | } |
---|
409 | } |
---|
410 | |
---|
411 | Void TComYuv::addClip( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiTrUnitIdx, UInt uiPartSize ) |
---|
412 | { |
---|
413 | addClipLuma ( pcYuvSrc0, pcYuvSrc1, uiTrUnitIdx, uiPartSize ); |
---|
414 | addClipChroma ( pcYuvSrc0, pcYuvSrc1, uiTrUnitIdx, uiPartSize>>1 ); |
---|
415 | } |
---|
416 | |
---|
417 | Void TComYuv::addClipLuma( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiTrUnitIdx, UInt uiPartSize ) |
---|
418 | { |
---|
419 | Int x, y; |
---|
420 | |
---|
421 | Pel* pSrc0 = pcYuvSrc0->getLumaAddr( uiTrUnitIdx, uiPartSize ); |
---|
422 | Pel* pSrc1 = pcYuvSrc1->getLumaAddr( uiTrUnitIdx, uiPartSize ); |
---|
423 | Pel* pDst = getLumaAddr( uiTrUnitIdx, uiPartSize ); |
---|
424 | |
---|
425 | UInt iSrc0Stride = pcYuvSrc0->getStride(); |
---|
426 | UInt iSrc1Stride = pcYuvSrc1->getStride(); |
---|
427 | UInt iDstStride = getStride(); |
---|
428 | for ( y = uiPartSize-1; y >= 0; y-- ) |
---|
429 | { |
---|
430 | for ( x = uiPartSize-1; x >= 0; x-- ) |
---|
431 | { |
---|
432 | pDst[x] = ClipY( pSrc0[x] + pSrc1[x] ); |
---|
433 | } |
---|
434 | pSrc0 += iSrc0Stride; |
---|
435 | pSrc1 += iSrc1Stride; |
---|
436 | pDst += iDstStride; |
---|
437 | } |
---|
438 | } |
---|
439 | |
---|
440 | Void TComYuv::addClipChroma( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiTrUnitIdx, UInt uiPartSize ) |
---|
441 | { |
---|
442 | Int x, y; |
---|
443 | |
---|
444 | Pel* pSrcU0 = pcYuvSrc0->getCbAddr( uiTrUnitIdx, uiPartSize ); |
---|
445 | Pel* pSrcU1 = pcYuvSrc1->getCbAddr( uiTrUnitIdx, uiPartSize ); |
---|
446 | Pel* pSrcV0 = pcYuvSrc0->getCrAddr( uiTrUnitIdx, uiPartSize ); |
---|
447 | Pel* pSrcV1 = pcYuvSrc1->getCrAddr( uiTrUnitIdx, uiPartSize ); |
---|
448 | Pel* pDstU = getCbAddr( uiTrUnitIdx, uiPartSize ); |
---|
449 | Pel* pDstV = getCrAddr( uiTrUnitIdx, uiPartSize ); |
---|
450 | |
---|
451 | UInt iSrc0Stride = pcYuvSrc0->getCStride(); |
---|
452 | UInt iSrc1Stride = pcYuvSrc1->getCStride(); |
---|
453 | UInt iDstStride = getCStride(); |
---|
454 | for ( y = uiPartSize-1; y >= 0; y-- ) |
---|
455 | { |
---|
456 | for ( x = uiPartSize-1; x >= 0; x-- ) |
---|
457 | { |
---|
458 | pDstU[x] = ClipC( pSrcU0[x] + pSrcU1[x] ); |
---|
459 | pDstV[x] = ClipC( pSrcV0[x] + pSrcV1[x] ); |
---|
460 | } |
---|
461 | |
---|
462 | pSrcU0 += iSrc0Stride; |
---|
463 | pSrcU1 += iSrc1Stride; |
---|
464 | pSrcV0 += iSrc0Stride; |
---|
465 | pSrcV1 += iSrc1Stride; |
---|
466 | pDstU += iDstStride; |
---|
467 | pDstV += iDstStride; |
---|
468 | } |
---|
469 | } |
---|
470 | |
---|
471 | Void TComYuv::subtract( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiTrUnitIdx, UInt uiPartSize ) |
---|
472 | { |
---|
473 | subtractLuma ( pcYuvSrc0, pcYuvSrc1, uiTrUnitIdx, uiPartSize ); |
---|
474 | subtractChroma( pcYuvSrc0, pcYuvSrc1, uiTrUnitIdx, uiPartSize>>1 ); |
---|
475 | } |
---|
476 | |
---|
477 | Void TComYuv::subtractLuma( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiTrUnitIdx, UInt uiPartSize ) |
---|
478 | { |
---|
479 | Int x, y; |
---|
480 | |
---|
481 | Pel* pSrc0 = pcYuvSrc0->getLumaAddr( uiTrUnitIdx, uiPartSize ); |
---|
482 | Pel* pSrc1 = pcYuvSrc1->getLumaAddr( uiTrUnitIdx, uiPartSize ); |
---|
483 | Pel* pDst = getLumaAddr( uiTrUnitIdx, uiPartSize ); |
---|
484 | |
---|
485 | Int iSrc0Stride = pcYuvSrc0->getStride(); |
---|
486 | Int iSrc1Stride = pcYuvSrc1->getStride(); |
---|
487 | Int iDstStride = getStride(); |
---|
488 | for ( y = uiPartSize-1; y >= 0; y-- ) |
---|
489 | { |
---|
490 | for ( x = uiPartSize-1; x >= 0; x-- ) |
---|
491 | { |
---|
492 | pDst[x] = pSrc0[x] - pSrc1[x]; |
---|
493 | } |
---|
494 | pSrc0 += iSrc0Stride; |
---|
495 | pSrc1 += iSrc1Stride; |
---|
496 | pDst += iDstStride; |
---|
497 | } |
---|
498 | } |
---|
499 | |
---|
500 | Void TComYuv::subtractChroma( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiTrUnitIdx, UInt uiPartSize ) |
---|
501 | { |
---|
502 | Int x, y; |
---|
503 | |
---|
504 | Pel* pSrcU0 = pcYuvSrc0->getCbAddr( uiTrUnitIdx, uiPartSize ); |
---|
505 | Pel* pSrcU1 = pcYuvSrc1->getCbAddr( uiTrUnitIdx, uiPartSize ); |
---|
506 | Pel* pSrcV0 = pcYuvSrc0->getCrAddr( uiTrUnitIdx, uiPartSize ); |
---|
507 | Pel* pSrcV1 = pcYuvSrc1->getCrAddr( uiTrUnitIdx, uiPartSize ); |
---|
508 | Pel* pDstU = getCbAddr( uiTrUnitIdx, uiPartSize ); |
---|
509 | Pel* pDstV = getCrAddr( uiTrUnitIdx, uiPartSize ); |
---|
510 | |
---|
511 | Int iSrc0Stride = pcYuvSrc0->getCStride(); |
---|
512 | Int iSrc1Stride = pcYuvSrc1->getCStride(); |
---|
513 | Int iDstStride = getCStride(); |
---|
514 | for ( y = uiPartSize-1; y >= 0; y-- ) |
---|
515 | { |
---|
516 | for ( x = uiPartSize-1; x >= 0; x-- ) |
---|
517 | { |
---|
518 | pDstU[x] = pSrcU0[x] - pSrcU1[x]; |
---|
519 | pDstV[x] = pSrcV0[x] - pSrcV1[x]; |
---|
520 | } |
---|
521 | pSrcU0 += iSrc0Stride; |
---|
522 | pSrcU1 += iSrc1Stride; |
---|
523 | pSrcV0 += iSrc0Stride; |
---|
524 | pSrcV1 += iSrc1Stride; |
---|
525 | pDstU += iDstStride; |
---|
526 | pDstV += iDstStride; |
---|
527 | } |
---|
528 | } |
---|
529 | |
---|
530 | Void TComYuv::addAvg( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt iPartUnitIdx, UInt iWidth, UInt iHeight ) |
---|
531 | { |
---|
532 | Int x, y; |
---|
533 | |
---|
534 | Pel* pSrcY0 = pcYuvSrc0->getLumaAddr( iPartUnitIdx ); |
---|
535 | Pel* pSrcU0 = pcYuvSrc0->getCbAddr ( iPartUnitIdx ); |
---|
536 | Pel* pSrcV0 = pcYuvSrc0->getCrAddr ( iPartUnitIdx ); |
---|
537 | |
---|
538 | Pel* pSrcY1 = pcYuvSrc1->getLumaAddr( iPartUnitIdx ); |
---|
539 | Pel* pSrcU1 = pcYuvSrc1->getCbAddr ( iPartUnitIdx ); |
---|
540 | Pel* pSrcV1 = pcYuvSrc1->getCrAddr ( iPartUnitIdx ); |
---|
541 | |
---|
542 | Pel* pDstY = getLumaAddr( iPartUnitIdx ); |
---|
543 | Pel* pDstU = getCbAddr ( iPartUnitIdx ); |
---|
544 | Pel* pDstV = getCrAddr ( iPartUnitIdx ); |
---|
545 | |
---|
546 | UInt iSrc0Stride = pcYuvSrc0->getStride(); |
---|
547 | UInt iSrc1Stride = pcYuvSrc1->getStride(); |
---|
548 | UInt iDstStride = getStride(); |
---|
549 | Int shiftNum = IF_INTERNAL_PREC + 1 - g_bitDepthY; |
---|
550 | Int offset = ( 1 << ( shiftNum - 1 ) ) + 2 * IF_INTERNAL_OFFS; |
---|
551 | |
---|
552 | for ( y = 0; y < iHeight; y++ ) |
---|
553 | { |
---|
554 | for ( x = 0; x < iWidth; x += 4 ) |
---|
555 | { |
---|
556 | pDstY[ x + 0 ] = ClipY( ( pSrcY0[ x + 0 ] + pSrcY1[ x + 0 ] + offset ) >> shiftNum ); |
---|
557 | pDstY[ x + 1 ] = ClipY( ( pSrcY0[ x + 1 ] + pSrcY1[ x + 1 ] + offset ) >> shiftNum ); |
---|
558 | pDstY[ x + 2 ] = ClipY( ( pSrcY0[ x + 2 ] + pSrcY1[ x + 2 ] + offset ) >> shiftNum ); |
---|
559 | pDstY[ x + 3 ] = ClipY( ( pSrcY0[ x + 3 ] + pSrcY1[ x + 3 ] + offset ) >> shiftNum ); |
---|
560 | } |
---|
561 | pSrcY0 += iSrc0Stride; |
---|
562 | pSrcY1 += iSrc1Stride; |
---|
563 | pDstY += iDstStride; |
---|
564 | } |
---|
565 | |
---|
566 | shiftNum = IF_INTERNAL_PREC + 1 - g_bitDepthC; |
---|
567 | offset = ( 1 << ( shiftNum - 1 ) ) + 2 * IF_INTERNAL_OFFS; |
---|
568 | |
---|
569 | iSrc0Stride = pcYuvSrc0->getCStride(); |
---|
570 | iSrc1Stride = pcYuvSrc1->getCStride(); |
---|
571 | iDstStride = getCStride(); |
---|
572 | |
---|
573 | iWidth >>=1; |
---|
574 | iHeight >>=1; |
---|
575 | |
---|
576 | for ( y = iHeight-1; y >= 0; y-- ) |
---|
577 | { |
---|
578 | for ( x = iWidth-1; x >= 0; ) |
---|
579 | { |
---|
580 | // note: chroma min width is 2 |
---|
581 | pDstU[x] = ClipC((pSrcU0[x] + pSrcU1[x] + offset) >> shiftNum); |
---|
582 | pDstV[x] = ClipC((pSrcV0[x] + pSrcV1[x] + offset) >> shiftNum); x--; |
---|
583 | pDstU[x] = ClipC((pSrcU0[x] + pSrcU1[x] + offset) >> shiftNum); |
---|
584 | pDstV[x] = ClipC((pSrcV0[x] + pSrcV1[x] + offset) >> shiftNum); x--; |
---|
585 | } |
---|
586 | |
---|
587 | pSrcU0 += iSrc0Stride; |
---|
588 | pSrcU1 += iSrc1Stride; |
---|
589 | pSrcV0 += iSrc0Stride; |
---|
590 | pSrcV1 += iSrc1Stride; |
---|
591 | pDstU += iDstStride; |
---|
592 | pDstV += iDstStride; |
---|
593 | } |
---|
594 | } |
---|
595 | |
---|
596 | Void TComYuv::removeHighFreq( TComYuv* pcYuvSrc, UInt uiPartIdx, UInt uiWidht, UInt uiHeight ) |
---|
597 | { |
---|
598 | Int x, y; |
---|
599 | |
---|
600 | Pel* pSrc = pcYuvSrc->getLumaAddr(uiPartIdx); |
---|
601 | Pel* pSrcU = pcYuvSrc->getCbAddr(uiPartIdx); |
---|
602 | Pel* pSrcV = pcYuvSrc->getCrAddr(uiPartIdx); |
---|
603 | |
---|
604 | Pel* pDst = getLumaAddr(uiPartIdx); |
---|
605 | Pel* pDstU = getCbAddr(uiPartIdx); |
---|
606 | Pel* pDstV = getCrAddr(uiPartIdx); |
---|
607 | |
---|
608 | Int iSrcStride = pcYuvSrc->getStride(); |
---|
609 | Int iDstStride = getStride(); |
---|
610 | |
---|
611 | for ( y = uiHeight-1; y >= 0; y-- ) |
---|
612 | { |
---|
613 | for ( x = uiWidht-1; x >= 0; x-- ) |
---|
614 | { |
---|
615 | #if DISABLING_CLIP_FOR_BIPREDME |
---|
616 | pDst[x ] = 2 * pDst[x] - pSrc[x]; |
---|
617 | #else |
---|
618 | pDst[x ] = ClipY(2 * pDst[x] - pSrc[x]); |
---|
619 | #endif |
---|
620 | } |
---|
621 | pSrc += iSrcStride; |
---|
622 | pDst += iDstStride; |
---|
623 | } |
---|
624 | |
---|
625 | iSrcStride = pcYuvSrc->getCStride(); |
---|
626 | iDstStride = getCStride(); |
---|
627 | |
---|
628 | uiHeight >>= 1; |
---|
629 | uiWidht >>= 1; |
---|
630 | |
---|
631 | for ( y = uiHeight-1; y >= 0; y-- ) |
---|
632 | { |
---|
633 | for ( x = uiWidht-1; x >= 0; x-- ) |
---|
634 | { |
---|
635 | #if DISABLING_CLIP_FOR_BIPREDME |
---|
636 | pDstU[x ] = 2 * pDstU[x] - pSrcU[x]; |
---|
637 | pDstV[x ] = 2 * pDstV[x] - pSrcV[x]; |
---|
638 | #else |
---|
639 | pDstU[x ] = ClipC(2 * pDstU[x] - pSrcU[x]); |
---|
640 | pDstV[x ] = ClipC(2 * pDstV[x] - pSrcV[x]); |
---|
641 | #endif |
---|
642 | } |
---|
643 | pSrcU += iSrcStride; |
---|
644 | pSrcV += iSrcStride; |
---|
645 | pDstU += iDstStride; |
---|
646 | pDstV += iDstStride; |
---|
647 | } |
---|
648 | } |
---|
649 | #if H_3D |
---|
650 | Void TComYuv::addClipPartLuma( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiTrUnitIdx, UInt uiPartSize ) |
---|
651 | { |
---|
652 | Int x, y; |
---|
653 | |
---|
654 | Pel* pSrc0 = pcYuvSrc0->getLumaAddr( uiTrUnitIdx); |
---|
655 | Pel* pSrc1 = pcYuvSrc1->getLumaAddr( uiTrUnitIdx); |
---|
656 | Pel* pDst = getLumaAddr( uiTrUnitIdx); |
---|
657 | |
---|
658 | UInt iSrc0Stride = pcYuvSrc0->getStride(); |
---|
659 | UInt iSrc1Stride = pcYuvSrc1->getStride(); |
---|
660 | UInt iDstStride = getStride(); |
---|
661 | for ( y = uiPartSize-1; y >= 0; y-- ) |
---|
662 | { |
---|
663 | for ( x = uiPartSize-1; x >= 0; x-- ) |
---|
664 | { |
---|
665 | pDst[x] = ClipY( pSrc0[x] + pSrc1[x] ); |
---|
666 | } |
---|
667 | pSrc0 += iSrc0Stride; |
---|
668 | pSrc1 += iSrc1Stride; |
---|
669 | pDst += iDstStride; |
---|
670 | } |
---|
671 | } |
---|
672 | |
---|
673 | #if H_3D_ARP |
---|
674 | Void TComYuv::addARP( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight, Bool bClip ) |
---|
675 | { |
---|
676 | addARPLuma ( pcYuvSrc0, pcYuvSrc1, uiAbsPartIdx, uiWidth , uiHeight , bClip ); |
---|
677 | addARPChroma ( pcYuvSrc0, pcYuvSrc1, uiAbsPartIdx, uiWidth>>1, uiHeight>>1 , bClip ); |
---|
678 | } |
---|
679 | |
---|
680 | Void TComYuv::addARPLuma( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight, Bool bClip ) |
---|
681 | { |
---|
682 | Int x, y; |
---|
683 | |
---|
684 | Pel* pSrc0 = pcYuvSrc0->getLumaAddr( uiAbsPartIdx ); |
---|
685 | Pel* pSrc1 = pcYuvSrc1->getLumaAddr( uiAbsPartIdx ); |
---|
686 | Pel* pDst = getLumaAddr( uiAbsPartIdx ); |
---|
687 | |
---|
688 | UInt iSrc0Stride = pcYuvSrc0->getStride(); |
---|
689 | UInt iSrc1Stride = pcYuvSrc1->getStride(); |
---|
690 | UInt iDstStride = getStride(); |
---|
691 | #if QC_I0129_ARP_FIX |
---|
692 | Int iIFshift = IF_INTERNAL_PREC - g_bitDepthY; |
---|
693 | Int iOffSet = ( 1 << ( iIFshift - 1 ) ) + IF_INTERNAL_OFFS; |
---|
694 | #endif |
---|
695 | for ( y = uiHeight-1; y >= 0; y-- ) |
---|
696 | { |
---|
697 | for ( x = uiWidth-1; x >= 0; x-- ) |
---|
698 | { |
---|
699 | pDst[x] = pSrc0[x] + pSrc1[x]; |
---|
700 | if( bClip ) |
---|
701 | { |
---|
702 | #if QC_I0129_ARP_FIX |
---|
703 | pDst[x] = ClipY( ( pDst[x] + iOffSet ) >> iIFshift ); |
---|
704 | #else |
---|
705 | pDst[x] = ClipY( pDst[x] ); |
---|
706 | #endif |
---|
707 | } |
---|
708 | } |
---|
709 | pSrc0 += iSrc0Stride; |
---|
710 | pSrc1 += iSrc1Stride; |
---|
711 | pDst += iDstStride; |
---|
712 | } |
---|
713 | } |
---|
714 | |
---|
715 | Void TComYuv::addARPChroma( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight, Bool bClip ) |
---|
716 | { |
---|
717 | Int x, y; |
---|
718 | |
---|
719 | Pel* pSrcU0 = pcYuvSrc0->getCbAddr( uiAbsPartIdx ); |
---|
720 | Pel* pSrcU1 = pcYuvSrc1->getCbAddr( uiAbsPartIdx ); |
---|
721 | Pel* pSrcV0 = pcYuvSrc0->getCrAddr( uiAbsPartIdx ); |
---|
722 | Pel* pSrcV1 = pcYuvSrc1->getCrAddr( uiAbsPartIdx ); |
---|
723 | Pel* pDstU = getCbAddr( uiAbsPartIdx ); |
---|
724 | Pel* pDstV = getCrAddr( uiAbsPartIdx ); |
---|
725 | |
---|
726 | UInt iSrc0Stride = pcYuvSrc0->getCStride(); |
---|
727 | UInt iSrc1Stride = pcYuvSrc1->getCStride(); |
---|
728 | UInt iDstStride = getCStride(); |
---|
729 | #if QC_I0129_ARP_FIX |
---|
730 | Int iIFshift = IF_INTERNAL_PREC - g_bitDepthC; |
---|
731 | Int iOffSet = ( 1 << ( iIFshift - 1 ) ) + IF_INTERNAL_OFFS; |
---|
732 | #endif |
---|
733 | for ( y = uiHeight-1; y >= 0; y-- ) |
---|
734 | { |
---|
735 | for ( x = uiWidth-1; x >= 0; x-- ) |
---|
736 | { |
---|
737 | pDstU[x] = pSrcU0[x] + pSrcU1[x]; |
---|
738 | pDstV[x] = pSrcV0[x] + pSrcV1[x]; |
---|
739 | if( bClip ) |
---|
740 | { |
---|
741 | #if QC_I0129_ARP_FIX |
---|
742 | pDstU[x] = ClipC( ( pDstU[x] + iOffSet ) >> iIFshift ); |
---|
743 | pDstV[x] = ClipC( ( pDstV[x] + iOffSet ) >> iIFshift ); |
---|
744 | #else |
---|
745 | pDstU[x] = ClipC( pDstU[x] ); |
---|
746 | pDstV[x] = ClipC( pDstV[x] ); |
---|
747 | #endif |
---|
748 | } |
---|
749 | } |
---|
750 | |
---|
751 | pSrcU0 += iSrc0Stride; |
---|
752 | pSrcU1 += iSrc1Stride; |
---|
753 | pSrcV0 += iSrc0Stride; |
---|
754 | pSrcV1 += iSrc1Stride; |
---|
755 | pDstU += iDstStride; |
---|
756 | pDstV += iDstStride; |
---|
757 | } |
---|
758 | } |
---|
759 | |
---|
760 | Void TComYuv::subtractARP( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiAbsPartIdx, UInt uiWidth , UInt uiHeight ) |
---|
761 | { |
---|
762 | subtractARPLuma ( pcYuvSrc0, pcYuvSrc1, uiAbsPartIdx, uiWidth , uiHeight ); |
---|
763 | subtractARPChroma( pcYuvSrc0, pcYuvSrc1, uiAbsPartIdx, uiWidth>>1 , uiHeight>>1 ); |
---|
764 | } |
---|
765 | |
---|
766 | Void TComYuv::subtractARPLuma( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiAbsPartIdx, UInt uiWidth , UInt uiHeight ) |
---|
767 | { |
---|
768 | Int x, y; |
---|
769 | |
---|
770 | Pel* pSrc0 = pcYuvSrc0->getLumaAddr( uiAbsPartIdx ); |
---|
771 | Pel* pSrc1 = pcYuvSrc1->getLumaAddr( uiAbsPartIdx ); |
---|
772 | Pel* pDst = getLumaAddr( uiAbsPartIdx ); |
---|
773 | |
---|
774 | Int iSrc0Stride = pcYuvSrc0->getStride(); |
---|
775 | Int iSrc1Stride = pcYuvSrc1->getStride(); |
---|
776 | Int iDstStride = getStride(); |
---|
777 | for ( y = uiHeight-1; y >= 0; y-- ) |
---|
778 | { |
---|
779 | for ( x = uiWidth-1; x >= 0; x-- ) |
---|
780 | { |
---|
781 | pDst[x] = pSrc0[x] - pSrc1[x]; |
---|
782 | } |
---|
783 | pSrc0 += iSrc0Stride; |
---|
784 | pSrc1 += iSrc1Stride; |
---|
785 | pDst += iDstStride; |
---|
786 | } |
---|
787 | } |
---|
788 | |
---|
789 | Void TComYuv::subtractARPChroma( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, UInt uiAbsPartIdx, UInt uiWidth , UInt uiHeight ) |
---|
790 | { |
---|
791 | Int x, y; |
---|
792 | |
---|
793 | Pel* pSrcU0 = pcYuvSrc0->getCbAddr( uiAbsPartIdx ); |
---|
794 | Pel* pSrcU1 = pcYuvSrc1->getCbAddr( uiAbsPartIdx ); |
---|
795 | Pel* pSrcV0 = pcYuvSrc0->getCrAddr( uiAbsPartIdx ); |
---|
796 | Pel* pSrcV1 = pcYuvSrc1->getCrAddr( uiAbsPartIdx ); |
---|
797 | Pel* pDstU = getCbAddr( uiAbsPartIdx ); |
---|
798 | Pel* pDstV = getCrAddr( uiAbsPartIdx ); |
---|
799 | |
---|
800 | Int iSrc0Stride = pcYuvSrc0->getCStride(); |
---|
801 | Int iSrc1Stride = pcYuvSrc1->getCStride(); |
---|
802 | Int iDstStride = getCStride(); |
---|
803 | for ( y = uiHeight-1; y >= 0; y-- ) |
---|
804 | { |
---|
805 | for ( x = uiWidth-1; x >= 0; x-- ) |
---|
806 | { |
---|
807 | pDstU[x] = pSrcU0[x] - pSrcU1[x]; |
---|
808 | pDstV[x] = pSrcV0[x] - pSrcV1[x]; |
---|
809 | } |
---|
810 | pSrcU0 += iSrc0Stride; |
---|
811 | pSrcU1 += iSrc1Stride; |
---|
812 | pSrcV0 += iSrc0Stride; |
---|
813 | pSrcV1 += iSrc1Stride; |
---|
814 | pDstU += iDstStride; |
---|
815 | pDstV += iDstStride; |
---|
816 | } |
---|
817 | } |
---|
818 | |
---|
819 | Void TComYuv::multiplyARP( UInt uiAbsPartIdx , UInt uiWidth , UInt uiHeight , UChar dW ) |
---|
820 | { |
---|
821 | multiplyARPLuma( uiAbsPartIdx , uiWidth , uiHeight , dW ); |
---|
822 | multiplyARPChroma( uiAbsPartIdx , uiWidth >> 1 , uiHeight >> 1 , dW ); |
---|
823 | } |
---|
824 | |
---|
825 | Void TComYuv::xxMultiplyLine( Pel* pSrcDst , UInt uiWidth , UChar dW ) |
---|
826 | { |
---|
827 | assert( dW == 2 ); |
---|
828 | for( UInt x = 0 ; x < uiWidth ; x++ ) |
---|
829 | pSrcDst[x] = pSrcDst[x] >> 1; |
---|
830 | } |
---|
831 | |
---|
832 | Void TComYuv::multiplyARPLuma( UInt uiAbsPartIdx , UInt uiWidth , UInt uiHeight , UChar dW ) |
---|
833 | { |
---|
834 | Pel* pDst = getLumaAddr( uiAbsPartIdx ); |
---|
835 | Int iDstStride = getStride(); |
---|
836 | for ( Int y = uiHeight-1; y >= 0; y-- ) |
---|
837 | { |
---|
838 | xxMultiplyLine( pDst , uiWidth , dW ); |
---|
839 | pDst += iDstStride; |
---|
840 | } |
---|
841 | } |
---|
842 | |
---|
843 | Void TComYuv::multiplyARPChroma( UInt uiAbsPartIdx , UInt uiWidth , UInt uiHeight , UChar dW ) |
---|
844 | { |
---|
845 | Pel* pDstU = getCbAddr( uiAbsPartIdx ); |
---|
846 | Pel* pDstV = getCrAddr( uiAbsPartIdx ); |
---|
847 | |
---|
848 | Int iDstStride = getCStride(); |
---|
849 | for ( Int y = uiHeight-1; y >= 0; y-- ) |
---|
850 | { |
---|
851 | xxMultiplyLine( pDstU , uiWidth , dW ); |
---|
852 | xxMultiplyLine( pDstV , uiWidth , dW ); |
---|
853 | pDstU += iDstStride; |
---|
854 | pDstV += iDstStride; |
---|
855 | } |
---|
856 | } |
---|
857 | #endif |
---|
858 | #endif |
---|
859 | |
---|
860 | //! \} |
---|