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-2015, 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 TComPrediction.cpp |
---|
35 | \brief prediction class |
---|
36 | */ |
---|
37 | |
---|
38 | #include <memory.h> |
---|
39 | #include "TComPrediction.h" |
---|
40 | #include "TComPic.h" |
---|
41 | #include "TComTU.h" |
---|
42 | |
---|
43 | //! \ingroup TLibCommon |
---|
44 | //! \{ |
---|
45 | |
---|
46 | // ==================================================================================================================== |
---|
47 | // Tables |
---|
48 | // ==================================================================================================================== |
---|
49 | |
---|
50 | const UChar TComPrediction::m_aucIntraFilter[MAX_NUM_CHANNEL_TYPE][MAX_INTRA_FILTER_DEPTHS] = |
---|
51 | { |
---|
52 | { // Luma |
---|
53 | 10, //4x4 |
---|
54 | 7, //8x8 |
---|
55 | 1, //16x16 |
---|
56 | 0, //32x32 |
---|
57 | 10, //64x64 |
---|
58 | }, |
---|
59 | { // Chroma |
---|
60 | 10, //4xn |
---|
61 | 7, //8xn |
---|
62 | 1, //16xn |
---|
63 | 0, //32xn |
---|
64 | 10, //64xn |
---|
65 | } |
---|
66 | |
---|
67 | }; |
---|
68 | |
---|
69 | // ==================================================================================================================== |
---|
70 | // Constructor / destructor / initialize |
---|
71 | // ==================================================================================================================== |
---|
72 | |
---|
73 | TComPrediction::TComPrediction() |
---|
74 | : m_pLumaRecBuffer(0) |
---|
75 | , m_iLumaRecStride(0) |
---|
76 | { |
---|
77 | for(UInt ch=0; ch<MAX_NUM_COMPONENT; ch++) |
---|
78 | { |
---|
79 | for(UInt buf=0; buf<2; buf++) |
---|
80 | { |
---|
81 | m_piYuvExt[ch][buf] = NULL; |
---|
82 | } |
---|
83 | } |
---|
84 | } |
---|
85 | |
---|
86 | TComPrediction::~TComPrediction() |
---|
87 | { |
---|
88 | destroy(); |
---|
89 | } |
---|
90 | |
---|
91 | Void TComPrediction::destroy() |
---|
92 | { |
---|
93 | for(UInt ch=0; ch<MAX_NUM_COMPONENT; ch++) |
---|
94 | { |
---|
95 | for(UInt buf=0; buf<NUM_PRED_BUF; buf++) |
---|
96 | { |
---|
97 | delete [] m_piYuvExt[ch][buf]; |
---|
98 | m_piYuvExt[ch][buf] = NULL; |
---|
99 | } |
---|
100 | } |
---|
101 | |
---|
102 | for(UInt i=0; i<NUM_REF_PIC_LIST_01; i++) |
---|
103 | { |
---|
104 | m_acYuvPred[i].destroy(); |
---|
105 | } |
---|
106 | |
---|
107 | m_cYuvPredTemp.destroy(); |
---|
108 | |
---|
109 | if( m_pLumaRecBuffer ) |
---|
110 | { |
---|
111 | delete [] m_pLumaRecBuffer; |
---|
112 | m_pLumaRecBuffer = 0; |
---|
113 | } |
---|
114 | m_iLumaRecStride = 0; |
---|
115 | |
---|
116 | for (UInt i = 0; i < LUMA_INTERPOLATION_FILTER_SUB_SAMPLE_POSITIONS; i++) |
---|
117 | { |
---|
118 | for (UInt j = 0; j < LUMA_INTERPOLATION_FILTER_SUB_SAMPLE_POSITIONS; j++) |
---|
119 | { |
---|
120 | m_filteredBlock[i][j].destroy(); |
---|
121 | } |
---|
122 | m_filteredBlockTmp[i].destroy(); |
---|
123 | } |
---|
124 | } |
---|
125 | |
---|
126 | Void TComPrediction::initTempBuff(ChromaFormat chromaFormatIDC) |
---|
127 | { |
---|
128 | // if it has been initialised before, but the chroma format has changed, release the memory and start again. |
---|
129 | if( m_piYuvExt[COMPONENT_Y][PRED_BUF_UNFILTERED] != NULL && m_cYuvPredTemp.getChromaFormat()!=chromaFormatIDC) |
---|
130 | { |
---|
131 | destroy(); |
---|
132 | } |
---|
133 | |
---|
134 | if( m_piYuvExt[COMPONENT_Y][PRED_BUF_UNFILTERED] == NULL ) // check if first is null (in which case, nothing initialised yet) |
---|
135 | { |
---|
136 | Int extWidth = MAX_CU_SIZE + 16; |
---|
137 | Int extHeight = MAX_CU_SIZE + 1; |
---|
138 | |
---|
139 | for (UInt i = 0; i < LUMA_INTERPOLATION_FILTER_SUB_SAMPLE_POSITIONS; i++) |
---|
140 | { |
---|
141 | m_filteredBlockTmp[i].create(extWidth, extHeight + 7, chromaFormatIDC); |
---|
142 | for (UInt j = 0; j < LUMA_INTERPOLATION_FILTER_SUB_SAMPLE_POSITIONS; j++) |
---|
143 | { |
---|
144 | m_filteredBlock[i][j].create(extWidth, extHeight, chromaFormatIDC); |
---|
145 | } |
---|
146 | } |
---|
147 | |
---|
148 | m_iYuvExtSize = (MAX_CU_SIZE*2+1) * (MAX_CU_SIZE*2+1); |
---|
149 | for(UInt ch=0; ch<MAX_NUM_COMPONENT; ch++) |
---|
150 | { |
---|
151 | for(UInt buf=0; buf<NUM_PRED_BUF; buf++) |
---|
152 | { |
---|
153 | m_piYuvExt[ch][buf] = new Pel[ m_iYuvExtSize ]; |
---|
154 | } |
---|
155 | } |
---|
156 | |
---|
157 | // new structure |
---|
158 | for(UInt i=0; i<NUM_REF_PIC_LIST_01; i++) |
---|
159 | { |
---|
160 | m_acYuvPred[i] .create( MAX_CU_SIZE, MAX_CU_SIZE, chromaFormatIDC ); |
---|
161 | } |
---|
162 | |
---|
163 | m_cYuvPredTemp.create( MAX_CU_SIZE, MAX_CU_SIZE, chromaFormatIDC ); |
---|
164 | } |
---|
165 | |
---|
166 | |
---|
167 | if (m_iLumaRecStride != (MAX_CU_SIZE>>1) + 1) |
---|
168 | { |
---|
169 | m_iLumaRecStride = (MAX_CU_SIZE>>1) + 1; |
---|
170 | if (!m_pLumaRecBuffer) |
---|
171 | { |
---|
172 | m_pLumaRecBuffer = new Pel[ m_iLumaRecStride * m_iLumaRecStride ]; |
---|
173 | } |
---|
174 | } |
---|
175 | } |
---|
176 | |
---|
177 | // ==================================================================================================================== |
---|
178 | // Public member functions |
---|
179 | // ==================================================================================================================== |
---|
180 | |
---|
181 | // Function for calculating DC value of the reference samples used in Intra prediction |
---|
182 | //NOTE: Bit-Limit - 25-bit source |
---|
183 | Pel TComPrediction::predIntraGetPredValDC( const Pel* pSrc, Int iSrcStride, UInt iWidth, UInt iHeight) |
---|
184 | { |
---|
185 | assert(iWidth > 0 && iHeight > 0); |
---|
186 | Int iInd, iSum = 0; |
---|
187 | Pel pDcVal; |
---|
188 | |
---|
189 | for (iInd = 0;iInd < iWidth;iInd++) |
---|
190 | { |
---|
191 | iSum += pSrc[iInd-iSrcStride]; |
---|
192 | } |
---|
193 | for (iInd = 0;iInd < iHeight;iInd++) |
---|
194 | { |
---|
195 | iSum += pSrc[iInd*iSrcStride-1]; |
---|
196 | } |
---|
197 | |
---|
198 | pDcVal = (iSum + iWidth) / (iWidth + iHeight); |
---|
199 | |
---|
200 | return pDcVal; |
---|
201 | } |
---|
202 | |
---|
203 | // Function for deriving the angular Intra predictions |
---|
204 | |
---|
205 | /** Function for deriving the simplified angular intra predictions. |
---|
206 | * \param bitDepth bit depth |
---|
207 | * \param pSrc pointer to reconstructed sample array |
---|
208 | * \param srcStride the stride of the reconstructed sample array |
---|
209 | * \param pTrueDst reference to pointer for the prediction sample array |
---|
210 | * \param dstStrideTrue the stride of the prediction sample array |
---|
211 | * \param uiWidth the width of the block |
---|
212 | * \param uiHeight the height of the block |
---|
213 | * \param channelType type of pel array (luma/chroma) |
---|
214 | * \param format chroma format |
---|
215 | * \param dirMode the intra prediction mode index |
---|
216 | * \param blkAboveAvailable boolean indication if the block above is available |
---|
217 | * \param blkLeftAvailable boolean indication if the block to the left is available |
---|
218 | * \param bEnableEdgeFilters indication whether to enable edge filters |
---|
219 | * |
---|
220 | * This function derives the prediction samples for the angular mode based on the prediction direction indicated by |
---|
221 | * the prediction mode index. The prediction direction is given by the displacement of the bottom row of the block and |
---|
222 | * the reference row above the block in the case of vertical prediction or displacement of the rightmost column |
---|
223 | * of the block and reference column left from the block in the case of the horizontal prediction. The displacement |
---|
224 | * is signalled at 1/32 pixel accuracy. When projection of the predicted pixel falls inbetween reference samples, |
---|
225 | * the predicted value for the pixel is linearly interpolated from the reference samples. All reference samples are taken |
---|
226 | * from the extended main reference. |
---|
227 | */ |
---|
228 | //NOTE: Bit-Limit - 25-bit source |
---|
229 | Void TComPrediction::xPredIntraAng( Int bitDepth, |
---|
230 | const Pel* pSrc, Int srcStride, |
---|
231 | Pel* pTrueDst, Int dstStrideTrue, |
---|
232 | UInt uiWidth, UInt uiHeight, ChannelType channelType, |
---|
233 | UInt dirMode, const Bool bEnableEdgeFilters |
---|
234 | ) |
---|
235 | { |
---|
236 | Int width=Int(uiWidth); |
---|
237 | Int height=Int(uiHeight); |
---|
238 | |
---|
239 | // Map the mode index to main prediction direction and angle |
---|
240 | assert( dirMode != PLANAR_IDX ); //no planar |
---|
241 | const Bool modeDC = dirMode==DC_IDX; |
---|
242 | |
---|
243 | // Do the DC prediction |
---|
244 | if (modeDC) |
---|
245 | { |
---|
246 | const Pel dcval = predIntraGetPredValDC(pSrc, srcStride, width, height); |
---|
247 | |
---|
248 | for (Int y=height;y>0;y--, pTrueDst+=dstStrideTrue) |
---|
249 | { |
---|
250 | for (Int x=0; x<width;) // width is always a multiple of 4. |
---|
251 | { |
---|
252 | pTrueDst[x++] = dcval; |
---|
253 | } |
---|
254 | } |
---|
255 | } |
---|
256 | else // Do angular predictions |
---|
257 | { |
---|
258 | const Bool bIsModeVer = (dirMode >= 18); |
---|
259 | const Int intraPredAngleMode = (bIsModeVer) ? (Int)dirMode - VER_IDX : -((Int)dirMode - HOR_IDX); |
---|
260 | const Int absAngMode = abs(intraPredAngleMode); |
---|
261 | const Int signAng = intraPredAngleMode < 0 ? -1 : 1; |
---|
262 | const Bool edgeFilter = bEnableEdgeFilters && isLuma(channelType) && (width <= MAXIMUM_INTRA_FILTERED_WIDTH) && (height <= MAXIMUM_INTRA_FILTERED_HEIGHT); |
---|
263 | |
---|
264 | // Set bitshifts and scale the angle parameter to block size |
---|
265 | static const Int angTable[9] = {0, 2, 5, 9, 13, 17, 21, 26, 32}; |
---|
266 | static const Int invAngTable[9] = {0, 4096, 1638, 910, 630, 482, 390, 315, 256}; // (256 * 32) / Angle |
---|
267 | Int invAngle = invAngTable[absAngMode]; |
---|
268 | Int absAng = angTable[absAngMode]; |
---|
269 | Int intraPredAngle = signAng * absAng; |
---|
270 | |
---|
271 | Pel* refMain; |
---|
272 | Pel* refSide; |
---|
273 | |
---|
274 | Pel refAbove[2*MAX_CU_SIZE+1]; |
---|
275 | Pel refLeft[2*MAX_CU_SIZE+1]; |
---|
276 | |
---|
277 | // Initialize the Main and Left reference array. |
---|
278 | if (intraPredAngle < 0) |
---|
279 | { |
---|
280 | const Int refMainOffsetPreScale = (bIsModeVer ? height : width ) - 1; |
---|
281 | const Int refMainOffset = height - 1; |
---|
282 | for (Int x=0;x<width+1;x++) |
---|
283 | { |
---|
284 | refAbove[x+refMainOffset] = pSrc[x-srcStride-1]; |
---|
285 | } |
---|
286 | for (Int y=0;y<height+1;y++) |
---|
287 | { |
---|
288 | refLeft[y+refMainOffset] = pSrc[(y-1)*srcStride-1]; |
---|
289 | } |
---|
290 | refMain = (bIsModeVer ? refAbove : refLeft) + refMainOffset; |
---|
291 | refSide = (bIsModeVer ? refLeft : refAbove) + refMainOffset; |
---|
292 | |
---|
293 | // Extend the Main reference to the left. |
---|
294 | Int invAngleSum = 128; // rounding for (shift by 8) |
---|
295 | for (Int k=-1; k>(refMainOffsetPreScale+1)*intraPredAngle>>5; k--) |
---|
296 | { |
---|
297 | invAngleSum += invAngle; |
---|
298 | refMain[k] = refSide[invAngleSum>>8]; |
---|
299 | } |
---|
300 | } |
---|
301 | else |
---|
302 | { |
---|
303 | for (Int x=0;x<2*width+1;x++) |
---|
304 | { |
---|
305 | refAbove[x] = pSrc[x-srcStride-1]; |
---|
306 | } |
---|
307 | for (Int y=0;y<2*height+1;y++) |
---|
308 | { |
---|
309 | refLeft[y] = pSrc[(y-1)*srcStride-1]; |
---|
310 | } |
---|
311 | refMain = bIsModeVer ? refAbove : refLeft ; |
---|
312 | refSide = bIsModeVer ? refLeft : refAbove; |
---|
313 | } |
---|
314 | |
---|
315 | // swap width/height if we are doing a horizontal mode: |
---|
316 | Pel tempArray[MAX_CU_SIZE*MAX_CU_SIZE]; |
---|
317 | const Int dstStride = bIsModeVer ? dstStrideTrue : MAX_CU_SIZE; |
---|
318 | Pel *pDst = bIsModeVer ? pTrueDst : tempArray; |
---|
319 | if (!bIsModeVer) |
---|
320 | { |
---|
321 | std::swap(width, height); |
---|
322 | } |
---|
323 | |
---|
324 | if (intraPredAngle == 0) // pure vertical or pure horizontal |
---|
325 | { |
---|
326 | for (Int y=0;y<height;y++) |
---|
327 | { |
---|
328 | for (Int x=0;x<width;x++) |
---|
329 | { |
---|
330 | pDst[y*dstStride+x] = refMain[x+1]; |
---|
331 | } |
---|
332 | } |
---|
333 | |
---|
334 | if (edgeFilter) |
---|
335 | { |
---|
336 | for (Int y=0;y<height;y++) |
---|
337 | { |
---|
338 | pDst[y*dstStride] = Clip3 (0, ((1 << bitDepth) - 1), pDst[y*dstStride] + (( refSide[y+1] - refSide[0] ) >> 1) ); |
---|
339 | } |
---|
340 | } |
---|
341 | } |
---|
342 | else |
---|
343 | { |
---|
344 | Pel *pDsty=pDst; |
---|
345 | |
---|
346 | for (Int y=0, deltaPos=intraPredAngle; y<height; y++, deltaPos+=intraPredAngle, pDsty+=dstStride) |
---|
347 | { |
---|
348 | const Int deltaInt = deltaPos >> 5; |
---|
349 | const Int deltaFract = deltaPos & (32 - 1); |
---|
350 | |
---|
351 | if (deltaFract) |
---|
352 | { |
---|
353 | // Do linear filtering |
---|
354 | const Pel *pRM=refMain+deltaInt+1; |
---|
355 | Int lastRefMainPel=*pRM++; |
---|
356 | for (Int x=0;x<width;pRM++,x++) |
---|
357 | { |
---|
358 | Int thisRefMainPel=*pRM; |
---|
359 | pDsty[x+0] = (Pel) ( ((32-deltaFract)*lastRefMainPel + deltaFract*thisRefMainPel +16) >> 5 ); |
---|
360 | lastRefMainPel=thisRefMainPel; |
---|
361 | } |
---|
362 | } |
---|
363 | else |
---|
364 | { |
---|
365 | // Just copy the integer samples |
---|
366 | for (Int x=0;x<width; x++) |
---|
367 | { |
---|
368 | pDsty[x] = refMain[x+deltaInt+1]; |
---|
369 | } |
---|
370 | } |
---|
371 | } |
---|
372 | } |
---|
373 | |
---|
374 | // Flip the block if this is the horizontal mode |
---|
375 | if (!bIsModeVer) |
---|
376 | { |
---|
377 | for (Int y=0; y<height; y++) |
---|
378 | { |
---|
379 | for (Int x=0; x<width; x++) |
---|
380 | { |
---|
381 | pTrueDst[x*dstStrideTrue] = pDst[x]; |
---|
382 | } |
---|
383 | pTrueDst++; |
---|
384 | pDst+=dstStride; |
---|
385 | } |
---|
386 | } |
---|
387 | } |
---|
388 | } |
---|
389 | |
---|
390 | Void TComPrediction::predIntraAng( const ComponentID compID, UInt uiDirMode, Pel* piOrg /* Will be null for decoding */, UInt uiOrgStride, Pel* piPred, UInt uiStride, TComTU &rTu, const Bool bUseFilteredPredSamples, const Bool bUseLosslessDPCM ) |
---|
391 | { |
---|
392 | const ChannelType channelType = toChannelType(compID); |
---|
393 | const TComRectangle &rect = rTu.getRect(isLuma(compID) ? COMPONENT_Y : COMPONENT_Cb); |
---|
394 | const Int iWidth = rect.width; |
---|
395 | const Int iHeight = rect.height; |
---|
396 | |
---|
397 | assert( g_aucConvertToBit[ iWidth ] >= 0 ); // 4x 4 |
---|
398 | assert( g_aucConvertToBit[ iWidth ] <= 5 ); // 128x128 |
---|
399 | //assert( iWidth == iHeight ); |
---|
400 | |
---|
401 | Pel *pDst = piPred; |
---|
402 | |
---|
403 | // get starting pixel in block |
---|
404 | const Int sw = (2 * iWidth + 1); |
---|
405 | |
---|
406 | if ( bUseLosslessDPCM ) |
---|
407 | { |
---|
408 | const Pel *ptrSrc = getPredictorPtr( compID, false ); |
---|
409 | // Sample Adaptive intra-Prediction (SAP) |
---|
410 | if (uiDirMode==HOR_IDX) |
---|
411 | { |
---|
412 | // left column filled with reference samples |
---|
413 | // remaining columns filled with piOrg data (if available). |
---|
414 | for(Int y=0; y<iHeight; y++) |
---|
415 | { |
---|
416 | piPred[y*uiStride+0] = ptrSrc[(y+1)*sw]; |
---|
417 | } |
---|
418 | if (piOrg!=0) |
---|
419 | { |
---|
420 | piPred+=1; // miss off first column |
---|
421 | for(Int y=0; y<iHeight; y++, piPred+=uiStride, piOrg+=uiOrgStride) |
---|
422 | { |
---|
423 | memcpy(piPred, piOrg, (iWidth-1)*sizeof(Pel)); |
---|
424 | } |
---|
425 | } |
---|
426 | } |
---|
427 | else // VER_IDX |
---|
428 | { |
---|
429 | // top row filled with reference samples |
---|
430 | // remaining rows filled with piOrd data (if available) |
---|
431 | for(Int x=0; x<iWidth; x++) |
---|
432 | { |
---|
433 | piPred[x] = ptrSrc[x+1]; |
---|
434 | } |
---|
435 | if (piOrg!=0) |
---|
436 | { |
---|
437 | piPred+=uiStride; // miss off the first row |
---|
438 | for(Int y=1; y<iHeight; y++, piPred+=uiStride, piOrg+=uiOrgStride) |
---|
439 | { |
---|
440 | memcpy(piPred, piOrg, iWidth*sizeof(Pel)); |
---|
441 | } |
---|
442 | } |
---|
443 | } |
---|
444 | } |
---|
445 | else |
---|
446 | { |
---|
447 | const Pel *ptrSrc = getPredictorPtr( compID, bUseFilteredPredSamples ); |
---|
448 | |
---|
449 | if ( uiDirMode == PLANAR_IDX ) |
---|
450 | { |
---|
451 | xPredIntraPlanar( ptrSrc+sw+1, sw, pDst, uiStride, iWidth, iHeight ); |
---|
452 | } |
---|
453 | else |
---|
454 | { |
---|
455 | // Create the prediction |
---|
456 | TComDataCU *const pcCU = rTu.getCU(); |
---|
457 | const UInt uiAbsPartIdx = rTu.GetAbsPartIdxTU(); |
---|
458 | const Bool enableEdgeFilters = !(pcCU->isRDPCMEnabled(uiAbsPartIdx) && pcCU->getCUTransquantBypass(uiAbsPartIdx)); |
---|
459 | #if O0043_BEST_EFFORT_DECODING |
---|
460 | const Int channelsBitDepthForPrediction = rTu.getCU()->getSlice()->getSPS()->getStreamBitDepth(channelType); |
---|
461 | #else |
---|
462 | const Int channelsBitDepthForPrediction = rTu.getCU()->getSlice()->getSPS()->getBitDepth(channelType); |
---|
463 | #endif |
---|
464 | xPredIntraAng( channelsBitDepthForPrediction, ptrSrc+sw+1, sw, pDst, uiStride, iWidth, iHeight, channelType, uiDirMode, enableEdgeFilters ); |
---|
465 | |
---|
466 | if( uiDirMode == DC_IDX ) |
---|
467 | { |
---|
468 | xDCPredFiltering( ptrSrc+sw+1, sw, pDst, uiStride, iWidth, iHeight, channelType ); |
---|
469 | } |
---|
470 | } |
---|
471 | } |
---|
472 | |
---|
473 | } |
---|
474 | |
---|
475 | /** Check for identical motion in both motion vector direction of a bi-directional predicted CU |
---|
476 | * \returns true, if motion vectors and reference pictures match |
---|
477 | */ |
---|
478 | Bool TComPrediction::xCheckIdenticalMotion ( TComDataCU* pcCU, UInt PartAddr ) |
---|
479 | { |
---|
480 | if( pcCU->getSlice()->isInterB() && !pcCU->getSlice()->getPPS()->getWPBiPred() ) |
---|
481 | { |
---|
482 | if( pcCU->getCUMvField(REF_PIC_LIST_0)->getRefIdx(PartAddr) >= 0 && pcCU->getCUMvField(REF_PIC_LIST_1)->getRefIdx(PartAddr) >= 0) |
---|
483 | { |
---|
484 | Int RefPOCL0 = pcCU->getSlice()->getRefPic(REF_PIC_LIST_0, pcCU->getCUMvField(REF_PIC_LIST_0)->getRefIdx(PartAddr))->getPOC(); |
---|
485 | Int RefPOCL1 = pcCU->getSlice()->getRefPic(REF_PIC_LIST_1, pcCU->getCUMvField(REF_PIC_LIST_1)->getRefIdx(PartAddr))->getPOC(); |
---|
486 | #if SVC_EXTENSION |
---|
487 | Int layerIdL0 = pcCU->getSlice()->getRefPic(REF_PIC_LIST_0, pcCU->getCUMvField(REF_PIC_LIST_0)->getRefIdx(PartAddr))->getLayerId(); |
---|
488 | Int layerIdL1 = pcCU->getSlice()->getRefPic(REF_PIC_LIST_1, pcCU->getCUMvField(REF_PIC_LIST_1)->getRefIdx(PartAddr))->getLayerId(); |
---|
489 | |
---|
490 | if( layerIdL0 == layerIdL1 && RefPOCL0 == RefPOCL1 && pcCU->getCUMvField(REF_PIC_LIST_0)->getMv(PartAddr) == pcCU->getCUMvField(REF_PIC_LIST_1)->getMv(PartAddr) ) |
---|
491 | #else |
---|
492 | if(RefPOCL0 == RefPOCL1 && pcCU->getCUMvField(REF_PIC_LIST_0)->getMv(PartAddr) == pcCU->getCUMvField(REF_PIC_LIST_1)->getMv(PartAddr)) |
---|
493 | #endif |
---|
494 | { |
---|
495 | return true; |
---|
496 | } |
---|
497 | } |
---|
498 | } |
---|
499 | return false; |
---|
500 | } |
---|
501 | |
---|
502 | Void TComPrediction::motionCompensation ( TComDataCU* pcCU, TComYuv* pcYuvPred, RefPicList eRefPicList, Int iPartIdx ) |
---|
503 | { |
---|
504 | Int iWidth; |
---|
505 | Int iHeight; |
---|
506 | UInt uiPartAddr; |
---|
507 | const TComSlice *pSlice = pcCU->getSlice(); |
---|
508 | const SliceType sliceType = pSlice->getSliceType(); |
---|
509 | const TComPPS &pps = *(pSlice->getPPS()); |
---|
510 | |
---|
511 | if ( iPartIdx >= 0 ) |
---|
512 | { |
---|
513 | pcCU->getPartIndexAndSize( iPartIdx, uiPartAddr, iWidth, iHeight ); |
---|
514 | if ( eRefPicList != REF_PIC_LIST_X ) |
---|
515 | { |
---|
516 | if( (sliceType == P_SLICE && pps.getUseWP()) || (sliceType == B_SLICE && pps.getWPBiPred())) |
---|
517 | { |
---|
518 | xPredInterUni (pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred, true ); |
---|
519 | xWeightedPredictionUni( pcCU, pcYuvPred, uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred ); |
---|
520 | } |
---|
521 | else |
---|
522 | { |
---|
523 | xPredInterUni (pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred ); |
---|
524 | } |
---|
525 | } |
---|
526 | else |
---|
527 | { |
---|
528 | if ( xCheckIdenticalMotion( pcCU, uiPartAddr ) ) |
---|
529 | { |
---|
530 | xPredInterUni (pcCU, uiPartAddr, iWidth, iHeight, REF_PIC_LIST_0, pcYuvPred ); |
---|
531 | } |
---|
532 | else |
---|
533 | { |
---|
534 | xPredInterBi (pcCU, uiPartAddr, iWidth, iHeight, pcYuvPred ); |
---|
535 | } |
---|
536 | } |
---|
537 | return; |
---|
538 | } |
---|
539 | |
---|
540 | for ( iPartIdx = 0; iPartIdx < pcCU->getNumPartitions(); iPartIdx++ ) |
---|
541 | { |
---|
542 | pcCU->getPartIndexAndSize( iPartIdx, uiPartAddr, iWidth, iHeight ); |
---|
543 | |
---|
544 | if ( eRefPicList != REF_PIC_LIST_X ) |
---|
545 | { |
---|
546 | if( (sliceType == P_SLICE && pps.getUseWP()) || (sliceType == B_SLICE && pps.getWPBiPred())) |
---|
547 | { |
---|
548 | xPredInterUni (pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred, true ); |
---|
549 | xWeightedPredictionUni( pcCU, pcYuvPred, uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred ); |
---|
550 | } |
---|
551 | else |
---|
552 | { |
---|
553 | xPredInterUni (pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred ); |
---|
554 | } |
---|
555 | } |
---|
556 | else |
---|
557 | { |
---|
558 | if ( xCheckIdenticalMotion( pcCU, uiPartAddr ) ) |
---|
559 | { |
---|
560 | xPredInterUni (pcCU, uiPartAddr, iWidth, iHeight, REF_PIC_LIST_0, pcYuvPred ); |
---|
561 | } |
---|
562 | else |
---|
563 | { |
---|
564 | xPredInterBi (pcCU, uiPartAddr, iWidth, iHeight, pcYuvPred ); |
---|
565 | } |
---|
566 | } |
---|
567 | } |
---|
568 | return; |
---|
569 | } |
---|
570 | |
---|
571 | Void TComPrediction::xPredInterUni ( TComDataCU* pcCU, UInt uiPartAddr, Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv* pcYuvPred, Bool bi ) |
---|
572 | { |
---|
573 | Int iRefIdx = pcCU->getCUMvField( eRefPicList )->getRefIdx( uiPartAddr ); assert (iRefIdx >= 0); |
---|
574 | TComMv cMv = pcCU->getCUMvField( eRefPicList )->getMv( uiPartAddr ); |
---|
575 | pcCU->clipMv(cMv); |
---|
576 | |
---|
577 | #if SVC_EXTENSION |
---|
578 | if( pcCU->getPic()->getLayerId() > 0 ) |
---|
579 | { |
---|
580 | TComPic* refPic = pcCU->getSlice()->getRefPic(eRefPicList, iRefIdx); |
---|
581 | |
---|
582 | if( refPic->isILR(pcCU->getPic()->getLayerId()) ) |
---|
583 | { |
---|
584 | // It is a requirement of bitstream conformance that when the reference picture represented by the variable refIdxLX is an inter-layer reference picture, |
---|
585 | // VpsInterLayerSamplePredictionEnabled[ LayerIdxInVps[ currLayerId ] ][ LayerIdxInVps[ rLId ] ] shall be equal to 1, where rLId is set equal to nuh_layer_id of the inter-layer picture |
---|
586 | assert( pcCU->getSlice()->getVPS()->isSamplePredictionType( pcCU->getPic()->getLayerIdx(), refPic->getLayerIdx() ) ); |
---|
587 | |
---|
588 | #if REF_IDX_ME_ZEROMV |
---|
589 | // It is a requirement of bitstream conformance that the variables mvLX[ 0 ] and mvLX[ 1 ] shall be equal to 0 if the value of refIdxLX corresponds to an inter-layer reference picture. |
---|
590 | if( pcCU->getSlice()->getVPS()->getScalabilityMask( SCALABILITY_ID ) ) |
---|
591 | { |
---|
592 | assert( cMv.getHor() == 0 && cMv.getVer() == 0 ); |
---|
593 | } |
---|
594 | #endif |
---|
595 | } |
---|
596 | |
---|
597 | } |
---|
598 | #endif |
---|
599 | |
---|
600 | for (UInt comp=COMPONENT_Y; comp<pcYuvPred->getNumberValidComponents(); comp++) |
---|
601 | { |
---|
602 | const ComponentID compID=ComponentID(comp); |
---|
603 | xPredInterBlk (compID, pcCU, pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPicYuvRec(), uiPartAddr, &cMv, iWidth, iHeight, pcYuvPred, bi, pcCU->getSlice()->getSPS()->getBitDepth(toChannelType(compID)) ); |
---|
604 | } |
---|
605 | } |
---|
606 | |
---|
607 | Void TComPrediction::xPredInterBi ( TComDataCU* pcCU, UInt uiPartAddr, Int iWidth, Int iHeight, TComYuv* pcYuvPred ) |
---|
608 | { |
---|
609 | TComYuv* pcMbYuv; |
---|
610 | Int iRefIdx[NUM_REF_PIC_LIST_01] = {-1, -1}; |
---|
611 | |
---|
612 | for ( UInt refList = 0; refList < NUM_REF_PIC_LIST_01; refList++ ) |
---|
613 | { |
---|
614 | RefPicList eRefPicList = (refList ? REF_PIC_LIST_1 : REF_PIC_LIST_0); |
---|
615 | iRefIdx[refList] = pcCU->getCUMvField( eRefPicList )->getRefIdx( uiPartAddr ); |
---|
616 | |
---|
617 | if ( iRefIdx[refList] < 0 ) |
---|
618 | { |
---|
619 | continue; |
---|
620 | } |
---|
621 | |
---|
622 | assert( iRefIdx[refList] < pcCU->getSlice()->getNumRefIdx(eRefPicList) ); |
---|
623 | |
---|
624 | pcMbYuv = &m_acYuvPred[refList]; |
---|
625 | if( pcCU->getCUMvField( REF_PIC_LIST_0 )->getRefIdx( uiPartAddr ) >= 0 && pcCU->getCUMvField( REF_PIC_LIST_1 )->getRefIdx( uiPartAddr ) >= 0 ) |
---|
626 | { |
---|
627 | xPredInterUni ( pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, pcMbYuv, true ); |
---|
628 | } |
---|
629 | else |
---|
630 | { |
---|
631 | if ( ( pcCU->getSlice()->getPPS()->getUseWP() && pcCU->getSlice()->getSliceType() == P_SLICE ) || |
---|
632 | ( pcCU->getSlice()->getPPS()->getWPBiPred() && pcCU->getSlice()->getSliceType() == B_SLICE ) ) |
---|
633 | { |
---|
634 | xPredInterUni ( pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, pcMbYuv, true ); |
---|
635 | } |
---|
636 | else |
---|
637 | { |
---|
638 | xPredInterUni ( pcCU, uiPartAddr, iWidth, iHeight, eRefPicList, pcMbYuv ); |
---|
639 | } |
---|
640 | } |
---|
641 | } |
---|
642 | |
---|
643 | if ( pcCU->getSlice()->getPPS()->getWPBiPred() && pcCU->getSlice()->getSliceType() == B_SLICE ) |
---|
644 | { |
---|
645 | xWeightedPredictionBi( pcCU, &m_acYuvPred[REF_PIC_LIST_0], &m_acYuvPred[REF_PIC_LIST_1], iRefIdx[REF_PIC_LIST_0], iRefIdx[REF_PIC_LIST_1], uiPartAddr, iWidth, iHeight, pcYuvPred ); |
---|
646 | } |
---|
647 | else if ( pcCU->getSlice()->getPPS()->getUseWP() && pcCU->getSlice()->getSliceType() == P_SLICE ) |
---|
648 | { |
---|
649 | xWeightedPredictionUni( pcCU, &m_acYuvPred[REF_PIC_LIST_0], uiPartAddr, iWidth, iHeight, REF_PIC_LIST_0, pcYuvPred ); |
---|
650 | } |
---|
651 | else |
---|
652 | { |
---|
653 | xWeightedAverage( &m_acYuvPred[REF_PIC_LIST_0], &m_acYuvPred[REF_PIC_LIST_1], iRefIdx[REF_PIC_LIST_0], iRefIdx[REF_PIC_LIST_1], uiPartAddr, iWidth, iHeight, pcYuvPred, pcCU->getSlice()->getSPS()->getBitDepths() ); |
---|
654 | } |
---|
655 | } |
---|
656 | |
---|
657 | /** |
---|
658 | * \brief Generate motion-compensated block |
---|
659 | * |
---|
660 | * \param compID Colour component ID |
---|
661 | * \param cu Pointer to current CU |
---|
662 | * \param refPic Pointer to reference picture |
---|
663 | * \param partAddr Address of block within CU |
---|
664 | * \param mv Motion vector |
---|
665 | * \param width Width of block |
---|
666 | * \param height Height of block |
---|
667 | * \param dstPic Pointer to destination picture |
---|
668 | * \param bi Flag indicating whether bipred is used |
---|
669 | * \param bitDepth Bit depth |
---|
670 | */ |
---|
671 | |
---|
672 | |
---|
673 | Void TComPrediction::xPredInterBlk(const ComponentID compID, TComDataCU *cu, TComPicYuv *refPic, UInt partAddr, TComMv *mv, Int width, Int height, TComYuv *dstPic, Bool bi, const Int bitDepth ) |
---|
674 | { |
---|
675 | Int refStride = refPic->getStride(compID); |
---|
676 | Int dstStride = dstPic->getStride(compID); |
---|
677 | Int shiftHor=(2+refPic->getComponentScaleX(compID)); |
---|
678 | Int shiftVer=(2+refPic->getComponentScaleY(compID)); |
---|
679 | |
---|
680 | Int refOffset = (mv->getHor() >> shiftHor) + (mv->getVer() >> shiftVer) * refStride; |
---|
681 | |
---|
682 | Pel* ref = refPic->getAddr(compID, cu->getCtuRsAddr(), cu->getZorderIdxInCtu() + partAddr ) + refOffset; |
---|
683 | |
---|
684 | Pel* dst = dstPic->getAddr( compID, partAddr ); |
---|
685 | |
---|
686 | Int xFrac = mv->getHor() & ((1<<shiftHor)-1); |
---|
687 | Int yFrac = mv->getVer() & ((1<<shiftVer)-1); |
---|
688 | UInt cxWidth = width >> refPic->getComponentScaleX(compID); |
---|
689 | UInt cxHeight = height >> refPic->getComponentScaleY(compID); |
---|
690 | |
---|
691 | const ChromaFormat chFmt = cu->getPic()->getChromaFormat(); |
---|
692 | |
---|
693 | if ( yFrac == 0 ) |
---|
694 | { |
---|
695 | m_if.filterHor(compID, ref, refStride, dst, dstStride, cxWidth, cxHeight, xFrac, !bi, chFmt, bitDepth); |
---|
696 | } |
---|
697 | else if ( xFrac == 0 ) |
---|
698 | { |
---|
699 | m_if.filterVer(compID, ref, refStride, dst, dstStride, cxWidth, cxHeight, yFrac, true, !bi, chFmt, bitDepth); |
---|
700 | } |
---|
701 | else |
---|
702 | { |
---|
703 | Int tmpStride = m_filteredBlockTmp[0].getStride(compID); |
---|
704 | Pel* tmp = m_filteredBlockTmp[0].getAddr(compID); |
---|
705 | |
---|
706 | const Int vFilterSize = isLuma(compID) ? NTAPS_LUMA : NTAPS_CHROMA; |
---|
707 | |
---|
708 | m_if.filterHor(compID, ref - ((vFilterSize>>1) -1)*refStride, refStride, tmp, tmpStride, cxWidth, cxHeight+vFilterSize-1, xFrac, false, chFmt, bitDepth); |
---|
709 | m_if.filterVer(compID, tmp + ((vFilterSize>>1) -1)*tmpStride, tmpStride, dst, dstStride, cxWidth, cxHeight, yFrac, false, !bi, chFmt, bitDepth); |
---|
710 | } |
---|
711 | } |
---|
712 | |
---|
713 | Void TComPrediction::xWeightedAverage( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, Int iRefIdx0, Int iRefIdx1, UInt uiPartIdx, Int iWidth, Int iHeight, TComYuv* pcYuvDst, const BitDepths &clipBitDepths ) |
---|
714 | { |
---|
715 | if( iRefIdx0 >= 0 && iRefIdx1 >= 0 ) |
---|
716 | { |
---|
717 | pcYuvDst->addAvg( pcYuvSrc0, pcYuvSrc1, uiPartIdx, iWidth, iHeight, clipBitDepths ); |
---|
718 | } |
---|
719 | else if ( iRefIdx0 >= 0 && iRefIdx1 < 0 ) |
---|
720 | { |
---|
721 | pcYuvSrc0->copyPartToPartYuv( pcYuvDst, uiPartIdx, iWidth, iHeight ); |
---|
722 | } |
---|
723 | else if ( iRefIdx0 < 0 && iRefIdx1 >= 0 ) |
---|
724 | { |
---|
725 | pcYuvSrc1->copyPartToPartYuv( pcYuvDst, uiPartIdx, iWidth, iHeight ); |
---|
726 | } |
---|
727 | } |
---|
728 | |
---|
729 | // AMVP |
---|
730 | Void TComPrediction::getMvPredAMVP( TComDataCU* pcCU, UInt uiPartIdx, UInt uiPartAddr, RefPicList eRefPicList, TComMv& rcMvPred ) |
---|
731 | { |
---|
732 | AMVPInfo* pcAMVPInfo = pcCU->getCUMvField(eRefPicList)->getAMVPInfo(); |
---|
733 | |
---|
734 | if( pcAMVPInfo->iN <= 1 ) |
---|
735 | { |
---|
736 | rcMvPred = pcAMVPInfo->m_acMvCand[0]; |
---|
737 | |
---|
738 | pcCU->setMVPIdxSubParts( 0, eRefPicList, uiPartAddr, uiPartIdx, pcCU->getDepth(uiPartAddr)); |
---|
739 | pcCU->setMVPNumSubParts( pcAMVPInfo->iN, eRefPicList, uiPartAddr, uiPartIdx, pcCU->getDepth(uiPartAddr)); |
---|
740 | return; |
---|
741 | } |
---|
742 | |
---|
743 | assert(pcCU->getMVPIdx(eRefPicList,uiPartAddr) >= 0); |
---|
744 | rcMvPred = pcAMVPInfo->m_acMvCand[pcCU->getMVPIdx(eRefPicList,uiPartAddr)]; |
---|
745 | return; |
---|
746 | } |
---|
747 | |
---|
748 | /** Function for deriving planar intra prediction. |
---|
749 | * \param pSrc pointer to reconstructed sample array |
---|
750 | * \param srcStride the stride of the reconstructed sample array |
---|
751 | * \param rpDst reference to pointer for the prediction sample array |
---|
752 | * \param dstStride the stride of the prediction sample array |
---|
753 | * \param width the width of the block |
---|
754 | * \param height the height of the block |
---|
755 | * \param channelType type of pel array (luma, chroma) |
---|
756 | * \param format chroma format |
---|
757 | * |
---|
758 | * This function derives the prediction samples for planar mode (intra coding). |
---|
759 | */ |
---|
760 | //NOTE: Bit-Limit - 24-bit source |
---|
761 | Void TComPrediction::xPredIntraPlanar( const Pel* pSrc, Int srcStride, Pel* rpDst, Int dstStride, UInt width, UInt height ) |
---|
762 | { |
---|
763 | assert(width <= height); |
---|
764 | |
---|
765 | Int leftColumn[MAX_CU_SIZE+1], topRow[MAX_CU_SIZE+1], bottomRow[MAX_CU_SIZE], rightColumn[MAX_CU_SIZE]; |
---|
766 | UInt shift1Dhor = g_aucConvertToBit[ width ] + 2; |
---|
767 | UInt shift1Dver = g_aucConvertToBit[ height ] + 2; |
---|
768 | |
---|
769 | // Get left and above reference column and row |
---|
770 | for(Int k=0;k<width+1;k++) |
---|
771 | { |
---|
772 | topRow[k] = pSrc[k-srcStride]; |
---|
773 | } |
---|
774 | |
---|
775 | for (Int k=0; k < height+1; k++) |
---|
776 | { |
---|
777 | leftColumn[k] = pSrc[k*srcStride-1]; |
---|
778 | } |
---|
779 | |
---|
780 | // Prepare intermediate variables used in interpolation |
---|
781 | Int bottomLeft = leftColumn[height]; |
---|
782 | Int topRight = topRow[width]; |
---|
783 | |
---|
784 | for(Int k=0;k<width;k++) |
---|
785 | { |
---|
786 | bottomRow[k] = bottomLeft - topRow[k]; |
---|
787 | topRow[k] <<= shift1Dver; |
---|
788 | } |
---|
789 | |
---|
790 | for(Int k=0;k<height;k++) |
---|
791 | { |
---|
792 | rightColumn[k] = topRight - leftColumn[k]; |
---|
793 | leftColumn[k] <<= shift1Dhor; |
---|
794 | } |
---|
795 | |
---|
796 | const UInt topRowShift = 0; |
---|
797 | |
---|
798 | // Generate prediction signal |
---|
799 | for (Int y=0;y<height;y++) |
---|
800 | { |
---|
801 | Int horPred = leftColumn[y] + width; |
---|
802 | for (Int x=0;x<width;x++) |
---|
803 | { |
---|
804 | horPred += rightColumn[y]; |
---|
805 | topRow[x] += bottomRow[x]; |
---|
806 | |
---|
807 | Int vertPred = ((topRow[x] + topRowShift)>>topRowShift); |
---|
808 | rpDst[y*dstStride+x] = ( horPred + vertPred ) >> (shift1Dhor+1); |
---|
809 | } |
---|
810 | } |
---|
811 | } |
---|
812 | |
---|
813 | /** Function for filtering intra DC predictor. |
---|
814 | * \param pSrc pointer to reconstructed sample array |
---|
815 | * \param iSrcStride the stride of the reconstructed sample array |
---|
816 | * \param pDst reference to pointer for the prediction sample array |
---|
817 | * \param iDstStride the stride of the prediction sample array |
---|
818 | * \param iWidth the width of the block |
---|
819 | * \param iHeight the height of the block |
---|
820 | * \param channelType type of pel array (luma, chroma) |
---|
821 | * |
---|
822 | * This function performs filtering left and top edges of the prediction samples for DC mode (intra coding). |
---|
823 | */ |
---|
824 | Void TComPrediction::xDCPredFiltering( const Pel* pSrc, Int iSrcStride, Pel* pDst, Int iDstStride, Int iWidth, Int iHeight, ChannelType channelType ) |
---|
825 | { |
---|
826 | Int x, y, iDstStride2, iSrcStride2; |
---|
827 | |
---|
828 | if (isLuma(channelType) && (iWidth <= MAXIMUM_INTRA_FILTERED_WIDTH) && (iHeight <= MAXIMUM_INTRA_FILTERED_HEIGHT)) |
---|
829 | { |
---|
830 | //top-left |
---|
831 | pDst[0] = (Pel)((pSrc[-iSrcStride] + pSrc[-1] + 2 * pDst[0] + 2) >> 2); |
---|
832 | |
---|
833 | //top row (vertical filter) |
---|
834 | for ( x = 1; x < iWidth; x++ ) |
---|
835 | { |
---|
836 | pDst[x] = (Pel)((pSrc[x - iSrcStride] + 3 * pDst[x] + 2) >> 2); |
---|
837 | } |
---|
838 | |
---|
839 | //left column (horizontal filter) |
---|
840 | for ( y = 1, iDstStride2 = iDstStride, iSrcStride2 = iSrcStride-1; y < iHeight; y++, iDstStride2+=iDstStride, iSrcStride2+=iSrcStride ) |
---|
841 | { |
---|
842 | pDst[iDstStride2] = (Pel)((pSrc[iSrcStride2] + 3 * pDst[iDstStride2] + 2) >> 2); |
---|
843 | } |
---|
844 | } |
---|
845 | |
---|
846 | return; |
---|
847 | } |
---|
848 | |
---|
849 | /* Static member function */ |
---|
850 | Bool TComPrediction::UseDPCMForFirstPassIntraEstimation(TComTU &rTu, const UInt uiDirMode) |
---|
851 | { |
---|
852 | return (rTu.getCU()->isRDPCMEnabled(rTu.GetAbsPartIdxTU()) ) && |
---|
853 | rTu.getCU()->getCUTransquantBypass(rTu.GetAbsPartIdxTU()) && |
---|
854 | (uiDirMode==HOR_IDX || uiDirMode==VER_IDX); |
---|
855 | } |
---|
856 | |
---|
857 | #if SVC_EXTENSION |
---|
858 | Void TComPrediction::upsampleBasePic( TComSlice* currSlice, UInt refLayerIdc, TComPicYuv* pcUsPic, TComPicYuv* pcBasePic, TComPicYuv* pcTempPic, const Int refBitDepthLuma, const Int refBitDepthChroma ) |
---|
859 | { |
---|
860 | m_cUsf.upsampleBasePic( currSlice, refLayerIdc, pcUsPic, pcBasePic, pcTempPic, refBitDepthLuma, refBitDepthChroma ); |
---|
861 | } |
---|
862 | #endif //SVC_EXTENSION |
---|
863 | //! \} |
---|