1 | /* The copyright in this software is being made available under the BSD |
---|
2 | * License, included below. This software may be subject to other third party |
---|
3 | * and contributor rights, including patent rights, and no such rights are |
---|
4 | * granted under this license. |
---|
5 | * |
---|
6 | * Copyright (c) 2010-2012, ITU/ISO/IEC |
---|
7 | * All rights reserved. |
---|
8 | * |
---|
9 | * Redistribution and use in source and binary forms, with or without |
---|
10 | * modification, are permitted provided that the following conditions are met: |
---|
11 | * |
---|
12 | * * Redistributions of source code must retain the above copyright notice, |
---|
13 | * this list of conditions and the following disclaimer. |
---|
14 | * * Redistributions in binary form must reproduce the above copyright notice, |
---|
15 | * this list of conditions and the following disclaimer in the documentation |
---|
16 | * and/or other materials provided with the distribution. |
---|
17 | * * Neither the name of the ITU/ISO/IEC nor the names of its contributors may |
---|
18 | * be used to endorse or promote products derived from this software without |
---|
19 | * specific prior written permission. |
---|
20 | * |
---|
21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
---|
22 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
---|
23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
---|
24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS |
---|
25 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
---|
26 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
---|
27 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
---|
28 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
---|
29 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
---|
30 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF |
---|
31 | * THE POSSIBILITY OF SUCH DAMAGE. |
---|
32 | */ |
---|
33 | |
---|
34 | /** \file TComPattern.cpp |
---|
35 | \brief neighbouring pixel access classes |
---|
36 | */ |
---|
37 | |
---|
38 | #include "TComPic.h" |
---|
39 | #include "TComPattern.h" |
---|
40 | #include "TComDataCU.h" |
---|
41 | |
---|
42 | //! \ingroup TLibCommon |
---|
43 | //! \{ |
---|
44 | |
---|
45 | // ==================================================================================================================== |
---|
46 | // Tables |
---|
47 | // ==================================================================================================================== |
---|
48 | |
---|
49 | const UChar TComPattern::m_aucIntraFilter[5] = |
---|
50 | { |
---|
51 | 10, //4x4 |
---|
52 | 7, //8x8 |
---|
53 | 1, //16x16 |
---|
54 | 0, //32x32 |
---|
55 | 10, //64x64 |
---|
56 | }; |
---|
57 | |
---|
58 | // ==================================================================================================================== |
---|
59 | // Public member functions (TComPatternParam) |
---|
60 | // ==================================================================================================================== |
---|
61 | |
---|
62 | /** \param piTexture pixel data |
---|
63 | \param iRoiWidth pattern width |
---|
64 | \param iRoiHeight pattern height |
---|
65 | \param iStride buffer stride |
---|
66 | \param iOffsetLeft neighbour offset (left) |
---|
67 | \param iOffsetRight neighbour offset (right) |
---|
68 | \param iOffsetAbove neighbour offset (above) |
---|
69 | \param iOffsetBottom neighbour offset (bottom) |
---|
70 | */ |
---|
71 | Void TComPatternParam::setPatternParamPel ( Pel* piTexture, |
---|
72 | Int iRoiWidth, |
---|
73 | Int iRoiHeight, |
---|
74 | Int iStride, |
---|
75 | Int iOffsetLeft, |
---|
76 | Int iOffsetRight, |
---|
77 | Int iOffsetAbove, |
---|
78 | Int iOffsetBottom ) |
---|
79 | { |
---|
80 | m_piPatternOrigin = piTexture; |
---|
81 | m_iROIWidth = iRoiWidth; |
---|
82 | m_iROIHeight = iRoiHeight; |
---|
83 | m_iPatternStride = iStride; |
---|
84 | m_iOffsetLeft = iOffsetLeft; |
---|
85 | m_iOffsetAbove = iOffsetAbove; |
---|
86 | m_iOffsetRight = iOffsetRight; |
---|
87 | m_iOffsetBottom = iOffsetBottom; |
---|
88 | } |
---|
89 | |
---|
90 | /** |
---|
91 | \param pcCU CU data structure |
---|
92 | \param iComp component index (0=Y, 1=Cb, 2=Cr) |
---|
93 | \param iRoiWidth pattern width |
---|
94 | \param iRoiHeight pattern height |
---|
95 | \param iStride buffer stride |
---|
96 | \param iOffsetLeft neighbour offset (left) |
---|
97 | \param iOffsetRight neighbour offset (right) |
---|
98 | \param iOffsetAbove neighbour offset (above) |
---|
99 | \param iOffsetBottom neighbour offset (bottom) |
---|
100 | \param uiPartDepth CU depth |
---|
101 | \param uiAbsPartIdx part index |
---|
102 | */ |
---|
103 | Void TComPatternParam::setPatternParamCU( TComDataCU* pcCU, |
---|
104 | UChar iComp, |
---|
105 | UChar iRoiWidth, |
---|
106 | UChar iRoiHeight, |
---|
107 | Int iOffsetLeft, |
---|
108 | Int iOffsetRight, |
---|
109 | Int iOffsetAbove, |
---|
110 | Int iOffsetBottom, |
---|
111 | UInt uiPartDepth, |
---|
112 | UInt uiAbsPartIdx |
---|
113 | #if DEPTH_MAP_GENERATION |
---|
114 | ,Bool bPrdDepthMap |
---|
115 | #endif |
---|
116 | ) |
---|
117 | { |
---|
118 | m_iOffsetLeft = iOffsetLeft; |
---|
119 | m_iOffsetRight = iOffsetRight; |
---|
120 | m_iOffsetAbove = iOffsetAbove; |
---|
121 | m_iOffsetBottom = iOffsetBottom; |
---|
122 | |
---|
123 | m_iROIWidth = iRoiWidth; |
---|
124 | m_iROIHeight = iRoiHeight; |
---|
125 | |
---|
126 | UInt uiAbsZorderIdx = pcCU->getZorderIdxInCU() + uiAbsPartIdx; |
---|
127 | |
---|
128 | #if DEPTH_MAP_GENERATION |
---|
129 | TComPicYuv* pcPic = ( bPrdDepthMap ? pcCU->getPic()->getPredDepthMap() : pcCU->getPic()->getPicYuvRec() ); |
---|
130 | #else |
---|
131 | TComPicYuv* pcPic = pcCU->getPic()->getPicYuvRec(); |
---|
132 | #endif |
---|
133 | |
---|
134 | if ( iComp == 0 ) |
---|
135 | { |
---|
136 | #if DEPTH_MAP_GENERATION |
---|
137 | m_iPatternStride = ( bPrdDepthMap ? pcCU->getPic()->getPredDepthMap()->getStride() : pcCU->getPic()->getStride() ); |
---|
138 | #else |
---|
139 | m_iPatternStride = pcCU->getPic()->getStride(); |
---|
140 | #endif |
---|
141 | m_piPatternOrigin = pcPic->getLumaAddr(pcCU->getAddr(), uiAbsZorderIdx) - m_iOffsetAbove * m_iPatternStride - m_iOffsetLeft; |
---|
142 | } |
---|
143 | else |
---|
144 | { |
---|
145 | #if DEPTH_MAP_GENERATION |
---|
146 | m_iPatternStride = ( bPrdDepthMap ? pcCU->getPic()->getPredDepthMap()->getCStride() : pcCU->getPic()->getCStride() ); |
---|
147 | #else |
---|
148 | m_iPatternStride = pcCU->getPic()->getCStride(); |
---|
149 | #endif |
---|
150 | if ( iComp == 1 ) |
---|
151 | { |
---|
152 | m_piPatternOrigin = pcPic->getCbAddr(pcCU->getAddr(), uiAbsZorderIdx) - m_iOffsetAbove * m_iPatternStride - m_iOffsetLeft; |
---|
153 | } |
---|
154 | else |
---|
155 | { |
---|
156 | m_piPatternOrigin = pcPic->getCrAddr(pcCU->getAddr(), uiAbsZorderIdx) - m_iOffsetAbove * m_iPatternStride - m_iOffsetLeft; |
---|
157 | } |
---|
158 | } |
---|
159 | } |
---|
160 | |
---|
161 | // ==================================================================================================================== |
---|
162 | // Public member functions (TComPattern) |
---|
163 | // ==================================================================================================================== |
---|
164 | |
---|
165 | Void TComPattern::initPattern ( Pel* piY, |
---|
166 | Pel* piCb, |
---|
167 | Pel* piCr, |
---|
168 | Int iRoiWidth, |
---|
169 | Int iRoiHeight, |
---|
170 | Int iStride, |
---|
171 | Int iOffsetLeft, |
---|
172 | Int iOffsetRight, |
---|
173 | Int iOffsetAbove, |
---|
174 | Int iOffsetBottom ) |
---|
175 | { |
---|
176 | m_cPatternY. setPatternParamPel( piY, iRoiWidth, iRoiHeight, iStride, iOffsetLeft, iOffsetRight, iOffsetAbove, iOffsetBottom ); |
---|
177 | m_cPatternCb.setPatternParamPel( piCb, iRoiWidth >> 1, iRoiHeight >> 1, iStride >> 1, iOffsetLeft >> 1, iOffsetRight >> 1, iOffsetAbove >> 1, iOffsetBottom >> 1 ); |
---|
178 | m_cPatternCr.setPatternParamPel( piCr, iRoiWidth >> 1, iRoiHeight >> 1, iStride >> 1, iOffsetLeft >> 1, iOffsetRight >> 1, iOffsetAbove >> 1, iOffsetBottom >> 1 ); |
---|
179 | |
---|
180 | return; |
---|
181 | } |
---|
182 | |
---|
183 | Void TComPattern::initPattern( TComDataCU* pcCU, UInt uiPartDepth, UInt uiAbsPartIdx |
---|
184 | #if DEPTH_MAP_GENERATION |
---|
185 | , Bool bPrdDepthMap |
---|
186 | #endif |
---|
187 | ) |
---|
188 | { |
---|
189 | Int uiOffsetLeft = 0; |
---|
190 | Int uiOffsetRight = 0; |
---|
191 | Int uiOffsetAbove = 0; |
---|
192 | |
---|
193 | TComPic* pcPic = pcCU->getPic(); |
---|
194 | UChar uiWidth = pcCU->getWidth (0)>>uiPartDepth; |
---|
195 | UChar uiHeight = pcCU->getHeight(0)>>uiPartDepth; |
---|
196 | |
---|
197 | UInt uiAbsZorderIdx = pcCU->getZorderIdxInCU() + uiAbsPartIdx; |
---|
198 | UInt uiCurrPicPelX = pcCU->getCUPelX() + g_auiRasterToPelX[ g_auiZscanToRaster[uiAbsZorderIdx] ]; |
---|
199 | UInt uiCurrPicPelY = pcCU->getCUPelY() + g_auiRasterToPelY[ g_auiZscanToRaster[uiAbsZorderIdx] ]; |
---|
200 | |
---|
201 | if( uiCurrPicPelX != 0 ) |
---|
202 | { |
---|
203 | uiOffsetLeft = 1; |
---|
204 | } |
---|
205 | |
---|
206 | if( uiCurrPicPelY != 0 ) |
---|
207 | { |
---|
208 | UInt uiNumPartInWidth = ( uiWidth/pcPic->getMinCUWidth() ); |
---|
209 | uiOffsetAbove = 1; |
---|
210 | |
---|
211 | if( uiCurrPicPelX + uiWidth < pcCU->getSlice()->getSPS()->getPicWidthInLumaSamples() ) |
---|
212 | { |
---|
213 | if( ( g_auiZscanToRaster[uiAbsZorderIdx] + uiNumPartInWidth ) % pcPic->getNumPartInWidth() ) // Not CU boundary |
---|
214 | { |
---|
215 | if( g_auiRasterToZscan[ (Int)g_auiZscanToRaster[uiAbsZorderIdx] - (Int)pcPic->getNumPartInWidth() + (Int)uiNumPartInWidth ] < uiAbsZorderIdx ) |
---|
216 | { |
---|
217 | uiOffsetRight = 1; |
---|
218 | } |
---|
219 | } |
---|
220 | else // if it is CU boundary |
---|
221 | { |
---|
222 | if( g_auiZscanToRaster[uiAbsZorderIdx] < pcPic->getNumPartInWidth() && (uiCurrPicPelX+uiWidth) < pcPic->getPicYuvRec()->getWidth() ) // first line |
---|
223 | { |
---|
224 | uiOffsetRight = 1; |
---|
225 | } |
---|
226 | } |
---|
227 | } |
---|
228 | } |
---|
229 | |
---|
230 | #if DEPTH_MAP_GENERATION |
---|
231 | m_cPatternY .setPatternParamCU( pcCU, 0, uiWidth, uiHeight, uiOffsetLeft, uiOffsetRight, uiOffsetAbove, 0, uiPartDepth, uiAbsPartIdx, bPrdDepthMap ); |
---|
232 | m_cPatternCb.setPatternParamCU( pcCU, 1, uiWidth >> 1, uiHeight >> 1, uiOffsetLeft, uiOffsetRight, uiOffsetAbove, 0, uiPartDepth, uiAbsPartIdx, bPrdDepthMap ); |
---|
233 | m_cPatternCr.setPatternParamCU( pcCU, 2, uiWidth >> 1, uiHeight >> 1, uiOffsetLeft, uiOffsetRight, uiOffsetAbove, 0, uiPartDepth, uiAbsPartIdx, bPrdDepthMap ); |
---|
234 | #else |
---|
235 | m_cPatternY .setPatternParamCU( pcCU, 0, uiWidth, uiHeight, uiOffsetLeft, uiOffsetRight, uiOffsetAbove, 0, uiPartDepth, uiAbsPartIdx ); |
---|
236 | m_cPatternCb.setPatternParamCU( pcCU, 1, uiWidth >> 1, uiHeight >> 1, uiOffsetLeft, uiOffsetRight, uiOffsetAbove, 0, uiPartDepth, uiAbsPartIdx ); |
---|
237 | m_cPatternCr.setPatternParamCU( pcCU, 2, uiWidth >> 1, uiHeight >> 1, uiOffsetLeft, uiOffsetRight, uiOffsetAbove, 0, uiPartDepth, uiAbsPartIdx ); |
---|
238 | #endif |
---|
239 | } |
---|
240 | |
---|
241 | Void TComPattern::initAdiPattern( TComDataCU* pcCU, UInt uiZorderIdxInPart, UInt uiPartDepth, Int* piAdiBuf, Int iOrgBufStride, Int iOrgBufHeight, Bool& bAbove, Bool& bLeft, Bool bLMmode |
---|
242 | #if DEPTH_MAP_GENERATION |
---|
243 | , Bool bPrdDepthMap, UInt uiSubSampExpX, UInt uiSubSampExpY |
---|
244 | #endif |
---|
245 | ) |
---|
246 | { |
---|
247 | Pel* piRoiOrigin; |
---|
248 | Int* piAdiTemp; |
---|
249 | UInt uiCuWidth = pcCU->getWidth(0) >> uiPartDepth; |
---|
250 | UInt uiCuHeight = pcCU->getHeight(0)>> uiPartDepth; |
---|
251 | UInt uiCuWidth2 = uiCuWidth<<1; |
---|
252 | UInt uiCuHeight2 = uiCuHeight<<1; |
---|
253 | UInt uiWidth; |
---|
254 | UInt uiHeight; |
---|
255 | #if DEPTH_MAP_GENERATION |
---|
256 | Int iPicStride = ( bPrdDepthMap ? pcCU->getPic()->getPredDepthMap()->getStride() : pcCU->getPic()->getStride() ); |
---|
257 | #else |
---|
258 | Int iPicStride = pcCU->getPic()->getStride(); |
---|
259 | #endif |
---|
260 | Int iUnitSize = 0; |
---|
261 | Int iNumUnitsInCu = 0; |
---|
262 | Int iTotalUnits = 0; |
---|
263 | Bool bNeighborFlags[4 * MAX_NUM_SPU_W + 1]; |
---|
264 | Int iNumIntraNeighbor = 0; |
---|
265 | |
---|
266 | UInt uiPartIdxLT, uiPartIdxRT, uiPartIdxLB; |
---|
267 | |
---|
268 | |
---|
269 | pcCU->deriveLeftRightTopIdxAdi( uiPartIdxLT, uiPartIdxRT, uiZorderIdxInPart, uiPartDepth ); |
---|
270 | pcCU->deriveLeftBottomIdxAdi ( uiPartIdxLB, uiZorderIdxInPart, uiPartDepth ); |
---|
271 | |
---|
272 | iUnitSize = g_uiMaxCUWidth >> g_uiMaxCUDepth; |
---|
273 | iNumUnitsInCu = uiCuWidth / iUnitSize; |
---|
274 | iTotalUnits = (iNumUnitsInCu << 2) + 1; |
---|
275 | |
---|
276 | bNeighborFlags[iNumUnitsInCu*2] = isAboveLeftAvailable( pcCU, uiPartIdxLT ); |
---|
277 | iNumIntraNeighbor += (Int)(bNeighborFlags[iNumUnitsInCu*2]); |
---|
278 | iNumIntraNeighbor += isAboveAvailable ( pcCU, uiPartIdxLT, uiPartIdxRT, bNeighborFlags+(iNumUnitsInCu*2)+1 ); |
---|
279 | iNumIntraNeighbor += isAboveRightAvailable( pcCU, uiPartIdxLT, uiPartIdxRT, bNeighborFlags+(iNumUnitsInCu*3)+1 ); |
---|
280 | iNumIntraNeighbor += isLeftAvailable ( pcCU, uiPartIdxLT, uiPartIdxLB, bNeighborFlags+(iNumUnitsInCu*2)-1 ); |
---|
281 | iNumIntraNeighbor += isBelowLeftAvailable ( pcCU, uiPartIdxLT, uiPartIdxLB, bNeighborFlags+ iNumUnitsInCu -1 ); |
---|
282 | |
---|
283 | bAbove = true; |
---|
284 | bLeft = true; |
---|
285 | |
---|
286 | #if DEPTH_MAP_GENERATION |
---|
287 | if ( bPrdDepthMap ) |
---|
288 | { |
---|
289 | uiWidth = ( uiCuWidth2 >> uiSubSampExpX ) + 1; |
---|
290 | uiHeight = ( uiCuHeight2 >> uiSubSampExpY ) + 1; |
---|
291 | } |
---|
292 | else |
---|
293 | { |
---|
294 | uiWidth=uiCuWidth2+1; |
---|
295 | uiHeight=uiCuHeight2+1; |
---|
296 | } |
---|
297 | #else |
---|
298 | uiWidth=uiCuWidth2+1; |
---|
299 | uiHeight=uiCuHeight2+1; |
---|
300 | #endif |
---|
301 | |
---|
302 | if (((uiWidth<<2)>iOrgBufStride)||((uiHeight<<2)>iOrgBufHeight)) |
---|
303 | { |
---|
304 | return; |
---|
305 | } |
---|
306 | |
---|
307 | piRoiOrigin = pcCU->getPic()->getPicYuvRec()->getLumaAddr(pcCU->getAddr(), pcCU->getZorderIdxInCU()+uiZorderIdxInPart); |
---|
308 | piAdiTemp = piAdiBuf; |
---|
309 | |
---|
310 | #if DEPTH_MAP_GENERATION |
---|
311 | if( bPrdDepthMap ) |
---|
312 | { |
---|
313 | piRoiOrigin = pcCU->getPic()->getPredDepthMap()->getLumaAddr( pcCU->getAddr(), pcCU->getZorderIdxInCU() + uiZorderIdxInPart ); |
---|
314 | } |
---|
315 | #endif |
---|
316 | |
---|
317 | #if DEPTH_MAP_GENERATION |
---|
318 | if ( bPrdDepthMap ) |
---|
319 | fillReferenceSamples ( pcCU, piRoiOrigin, piAdiTemp, bNeighborFlags, iNumIntraNeighbor, iUnitSize >> uiSubSampExpX, iNumUnitsInCu, iTotalUnits, uiCuWidth >> uiSubSampExpX, uiCuHeight >> uiSubSampExpY, uiWidth, uiHeight, iPicStride, bLMmode, bPrdDepthMap ); |
---|
320 | else |
---|
321 | fillReferenceSamples ( pcCU, piRoiOrigin, piAdiTemp, bNeighborFlags, iNumIntraNeighbor, iUnitSize, iNumUnitsInCu, iTotalUnits, uiCuWidth, uiCuHeight, uiWidth, uiHeight, iPicStride, bLMmode, bPrdDepthMap ); |
---|
322 | #else |
---|
323 | fillReferenceSamples ( pcCU, piRoiOrigin, piAdiTemp, bNeighborFlags, iNumIntraNeighbor, iUnitSize, iNumUnitsInCu, iTotalUnits, uiCuWidth, uiCuHeight, uiWidth, uiHeight, iPicStride, bLMmode); |
---|
324 | #endif |
---|
325 | |
---|
326 | |
---|
327 | Int i; |
---|
328 | // generate filtered intra prediction samples |
---|
329 | Int iBufSize = uiCuHeight2 + uiCuWidth2 + 1; // left and left above border + above and above right border + top left corner = length of 3. filter buffer |
---|
330 | |
---|
331 | UInt uiWH = uiWidth * uiHeight; // number of elements in one buffer |
---|
332 | |
---|
333 | Int* piFilteredBuf1 = piAdiBuf + uiWH; // 1. filter buffer |
---|
334 | Int* piFilteredBuf2 = piFilteredBuf1 + uiWH; // 2. filter buffer |
---|
335 | Int* piFilterBuf = piFilteredBuf2 + uiWH; // buffer for 2. filtering (sequential) |
---|
336 | Int* piFilterBufN = piFilterBuf + iBufSize; // buffer for 1. filtering (sequential) |
---|
337 | |
---|
338 | Int l = 0; |
---|
339 | // left border from bottom to top |
---|
340 | for (i = 0; i < uiCuHeight2; i++) |
---|
341 | { |
---|
342 | piFilterBuf[l++] = piAdiTemp[uiWidth * (uiCuHeight2 - i)]; |
---|
343 | } |
---|
344 | // top left corner |
---|
345 | piFilterBuf[l++] = piAdiTemp[0]; |
---|
346 | // above border from left to right |
---|
347 | for (i=0; i < uiCuWidth2; i++) |
---|
348 | { |
---|
349 | piFilterBuf[l++] = piAdiTemp[1 + i]; |
---|
350 | } |
---|
351 | |
---|
352 | // 1. filtering with [1 2 1] |
---|
353 | piFilterBufN[0] = piFilterBuf[0]; |
---|
354 | piFilterBufN[iBufSize - 1] = piFilterBuf[iBufSize - 1]; |
---|
355 | for (i = 1; i < iBufSize - 1; i++) |
---|
356 | { |
---|
357 | piFilterBufN[i] = (piFilterBuf[i - 1] + 2 * piFilterBuf[i]+piFilterBuf[i + 1] + 2) >> 2; |
---|
358 | } |
---|
359 | |
---|
360 | // fill 1. filter buffer with filtered values |
---|
361 | l=0; |
---|
362 | for (i = 0; i < uiCuHeight2; i++) |
---|
363 | { |
---|
364 | piFilteredBuf1[uiWidth * (uiCuHeight2 - i)] = piFilterBufN[l++]; |
---|
365 | } |
---|
366 | piFilteredBuf1[0] = piFilterBufN[l++]; |
---|
367 | for (i = 0; i < uiCuWidth2; i++) |
---|
368 | { |
---|
369 | piFilteredBuf1[1 + i] = piFilterBufN[l++]; |
---|
370 | } |
---|
371 | } |
---|
372 | |
---|
373 | Void TComPattern::initAdiPatternChroma( TComDataCU* pcCU, UInt uiZorderIdxInPart, UInt uiPartDepth, Int* piAdiBuf, Int iOrgBufStride, Int iOrgBufHeight, Bool& bAbove, Bool& bLeft ) |
---|
374 | { |
---|
375 | Pel* piRoiOrigin; |
---|
376 | Int* piAdiTemp; |
---|
377 | UInt uiCuWidth = pcCU->getWidth (0) >> uiPartDepth; |
---|
378 | UInt uiCuHeight = pcCU->getHeight(0) >> uiPartDepth; |
---|
379 | UInt uiWidth; |
---|
380 | UInt uiHeight; |
---|
381 | Int iPicStride = pcCU->getPic()->getCStride(); |
---|
382 | |
---|
383 | Int iUnitSize = 0; |
---|
384 | Int iNumUnitsInCu = 0; |
---|
385 | Int iTotalUnits = 0; |
---|
386 | Bool bNeighborFlags[4 * MAX_NUM_SPU_W + 1]; |
---|
387 | Int iNumIntraNeighbor = 0; |
---|
388 | |
---|
389 | UInt uiPartIdxLT, uiPartIdxRT, uiPartIdxLB; |
---|
390 | |
---|
391 | pcCU->deriveLeftRightTopIdxAdi( uiPartIdxLT, uiPartIdxRT, uiZorderIdxInPart, uiPartDepth ); |
---|
392 | pcCU->deriveLeftBottomIdxAdi ( uiPartIdxLB, uiZorderIdxInPart, uiPartDepth ); |
---|
393 | |
---|
394 | iUnitSize = (g_uiMaxCUWidth >> g_uiMaxCUDepth) >> 1; // for chroma |
---|
395 | iNumUnitsInCu = (uiCuWidth / iUnitSize) >> 1; // for chroma |
---|
396 | iTotalUnits = (iNumUnitsInCu << 2) + 1; |
---|
397 | |
---|
398 | bNeighborFlags[iNumUnitsInCu*2] = isAboveLeftAvailable( pcCU, uiPartIdxLT ); |
---|
399 | iNumIntraNeighbor += (Int)(bNeighborFlags[iNumUnitsInCu*2]); |
---|
400 | iNumIntraNeighbor += isAboveAvailable ( pcCU, uiPartIdxLT, uiPartIdxRT, bNeighborFlags+(iNumUnitsInCu*2)+1 ); |
---|
401 | iNumIntraNeighbor += isAboveRightAvailable( pcCU, uiPartIdxLT, uiPartIdxRT, bNeighborFlags+(iNumUnitsInCu*3)+1 ); |
---|
402 | iNumIntraNeighbor += isLeftAvailable ( pcCU, uiPartIdxLT, uiPartIdxLB, bNeighborFlags+(iNumUnitsInCu*2)-1 ); |
---|
403 | iNumIntraNeighbor += isBelowLeftAvailable ( pcCU, uiPartIdxLT, uiPartIdxLB, bNeighborFlags+ iNumUnitsInCu -1 ); |
---|
404 | |
---|
405 | bAbove = true; |
---|
406 | bLeft = true; |
---|
407 | |
---|
408 | uiCuWidth=uiCuWidth>>1; // for chroma |
---|
409 | uiCuHeight=uiCuHeight>>1; // for chroma |
---|
410 | |
---|
411 | uiWidth=uiCuWidth*2+1; |
---|
412 | uiHeight=uiCuHeight*2+1; |
---|
413 | |
---|
414 | if ((4*uiWidth>iOrgBufStride)||(4*uiHeight>iOrgBufHeight)) |
---|
415 | { |
---|
416 | return; |
---|
417 | } |
---|
418 | |
---|
419 | // get Cb pattern |
---|
420 | piRoiOrigin = pcCU->getPic()->getPicYuvRec()->getCbAddr(pcCU->getAddr(), pcCU->getZorderIdxInCU()+uiZorderIdxInPart); |
---|
421 | piAdiTemp = piAdiBuf; |
---|
422 | |
---|
423 | #if DEPTH_MAP_GENERATION |
---|
424 | fillReferenceSamples ( pcCU, piRoiOrigin, piAdiTemp, bNeighborFlags, iNumIntraNeighbor, iUnitSize, iNumUnitsInCu, iTotalUnits, uiCuWidth, uiCuHeight, uiWidth, uiHeight, iPicStride, false, false ); |
---|
425 | #else |
---|
426 | fillReferenceSamples ( pcCU, piRoiOrigin, piAdiTemp, bNeighborFlags, iNumIntraNeighbor, iUnitSize, iNumUnitsInCu, iTotalUnits, uiCuWidth, uiCuHeight, uiWidth, uiHeight, iPicStride); |
---|
427 | #endif |
---|
428 | |
---|
429 | // get Cr pattern |
---|
430 | piRoiOrigin = pcCU->getPic()->getPicYuvRec()->getCrAddr(pcCU->getAddr(), pcCU->getZorderIdxInCU()+uiZorderIdxInPart); |
---|
431 | piAdiTemp = piAdiBuf+uiWidth*uiHeight; |
---|
432 | |
---|
433 | #if DEPTH_MAP_GENERATION |
---|
434 | fillReferenceSamples ( pcCU, piRoiOrigin, piAdiTemp, bNeighborFlags, iNumIntraNeighbor, iUnitSize, iNumUnitsInCu, iTotalUnits, uiCuWidth, uiCuHeight, uiWidth, uiHeight, iPicStride, false, false ); |
---|
435 | #else |
---|
436 | fillReferenceSamples ( pcCU, piRoiOrigin, piAdiTemp, bNeighborFlags, iNumIntraNeighbor, iUnitSize, iNumUnitsInCu, iTotalUnits, uiCuWidth, uiCuHeight, uiWidth, uiHeight, iPicStride); |
---|
437 | #endif |
---|
438 | |
---|
439 | } |
---|
440 | |
---|
441 | Void TComPattern::fillReferenceSamples( TComDataCU* pcCU, Pel* piRoiOrigin, Int* piAdiTemp, Bool* bNeighborFlags, Int iNumIntraNeighbor, Int iUnitSize, Int iNumUnitsInCu, Int iTotalUnits, UInt uiCuWidth, UInt uiCuHeight, UInt uiWidth, UInt uiHeight, Int iPicStride, Bool bLMmode |
---|
442 | #if DEPTH_MAP_GENERATION |
---|
443 | , Bool bPrdDepthMap |
---|
444 | #endif |
---|
445 | ) |
---|
446 | { |
---|
447 | Pel* piRoiTemp; |
---|
448 | Int i, j; |
---|
449 | #if DEPTH_MAP_GENERATION |
---|
450 | Int iDCValue = ( bPrdDepthMap ? PDM_UNDEFINED_DEPTH : ( 1<<( g_uiBitDepth + g_uiBitIncrement - 1) ) ); |
---|
451 | #else |
---|
452 | Int iDCValue = ( 1<<( g_uiBitDepth + g_uiBitIncrement - 1) ); |
---|
453 | #endif |
---|
454 | |
---|
455 | if (iNumIntraNeighbor == 0) |
---|
456 | { |
---|
457 | // Fill border with DC value |
---|
458 | for (i=0; i<uiWidth; i++) |
---|
459 | { |
---|
460 | piAdiTemp[i] = iDCValue; |
---|
461 | } |
---|
462 | for (i=1; i<uiHeight; i++) |
---|
463 | { |
---|
464 | piAdiTemp[i*uiWidth] = iDCValue; |
---|
465 | } |
---|
466 | } |
---|
467 | else if (iNumIntraNeighbor == iTotalUnits) |
---|
468 | { |
---|
469 | // Fill top-left border with rec. samples |
---|
470 | piRoiTemp = piRoiOrigin - iPicStride - 1; |
---|
471 | piAdiTemp[0] = piRoiTemp[0]; |
---|
472 | |
---|
473 | // Fill left border with rec. samples |
---|
474 | piRoiTemp = piRoiOrigin - 1; |
---|
475 | |
---|
476 | if (bLMmode) |
---|
477 | { |
---|
478 | piRoiTemp --; // move to the second left column |
---|
479 | } |
---|
480 | |
---|
481 | for (i=0; i<uiCuHeight; i++) |
---|
482 | { |
---|
483 | piAdiTemp[(1+i)*uiWidth] = piRoiTemp[0]; |
---|
484 | piRoiTemp += iPicStride; |
---|
485 | } |
---|
486 | |
---|
487 | // Fill below left border with rec. samples |
---|
488 | for (i=0; i<uiCuHeight; i++) |
---|
489 | { |
---|
490 | piAdiTemp[(1+uiCuHeight+i)*uiWidth] = piRoiTemp[0]; |
---|
491 | piRoiTemp += iPicStride; |
---|
492 | } |
---|
493 | |
---|
494 | // Fill top border with rec. samples |
---|
495 | piRoiTemp = piRoiOrigin - iPicStride; |
---|
496 | for (i=0; i<uiCuWidth; i++) |
---|
497 | { |
---|
498 | piAdiTemp[1+i] = piRoiTemp[i]; |
---|
499 | } |
---|
500 | |
---|
501 | // Fill top right border with rec. samples |
---|
502 | piRoiTemp = piRoiOrigin - iPicStride + uiCuWidth; |
---|
503 | for (i=0; i<uiCuWidth; i++) |
---|
504 | { |
---|
505 | piAdiTemp[1+uiCuWidth+i] = piRoiTemp[i]; |
---|
506 | } |
---|
507 | } |
---|
508 | else // reference samples are partially available |
---|
509 | { |
---|
510 | Int iNumUnits2 = iNumUnitsInCu<<1; |
---|
511 | Int iTotalSamples = iTotalUnits*iUnitSize; |
---|
512 | Pel piAdiLine[5 * MAX_CU_SIZE]; |
---|
513 | Pel *piAdiLineTemp; |
---|
514 | Bool *pbNeighborFlags; |
---|
515 | Int iNext, iCurr; |
---|
516 | Pel piRef = 0; |
---|
517 | |
---|
518 | // Initialize |
---|
519 | for (i=0; i<iTotalSamples; i++) |
---|
520 | { |
---|
521 | piAdiLine[i] = iDCValue; |
---|
522 | } |
---|
523 | |
---|
524 | // Fill top-left sample |
---|
525 | piRoiTemp = piRoiOrigin - iPicStride - 1; |
---|
526 | piAdiLineTemp = piAdiLine + (iNumUnits2*iUnitSize); |
---|
527 | pbNeighborFlags = bNeighborFlags + iNumUnits2; |
---|
528 | if (*pbNeighborFlags) |
---|
529 | { |
---|
530 | piAdiLineTemp[0] = piRoiTemp[0]; |
---|
531 | for (i=1; i<iUnitSize; i++) |
---|
532 | { |
---|
533 | piAdiLineTemp[i] = piAdiLineTemp[0]; |
---|
534 | } |
---|
535 | } |
---|
536 | |
---|
537 | // Fill left & below-left samples |
---|
538 | piRoiTemp += iPicStride; |
---|
539 | if (bLMmode) |
---|
540 | { |
---|
541 | piRoiTemp --; // move the second left column |
---|
542 | } |
---|
543 | piAdiLineTemp--; |
---|
544 | pbNeighborFlags--; |
---|
545 | for (j=0; j<iNumUnits2; j++) |
---|
546 | { |
---|
547 | if (*pbNeighborFlags) |
---|
548 | { |
---|
549 | for (i=0; i<iUnitSize; i++) |
---|
550 | { |
---|
551 | piAdiLineTemp[-i] = piRoiTemp[i*iPicStride]; |
---|
552 | } |
---|
553 | } |
---|
554 | piRoiTemp += iUnitSize*iPicStride; |
---|
555 | piAdiLineTemp -= iUnitSize; |
---|
556 | pbNeighborFlags--; |
---|
557 | } |
---|
558 | |
---|
559 | // Fill above & above-right samples |
---|
560 | piRoiTemp = piRoiOrigin - iPicStride; |
---|
561 | piAdiLineTemp = piAdiLine + ((iNumUnits2+1)*iUnitSize); |
---|
562 | pbNeighborFlags = bNeighborFlags + iNumUnits2 + 1; |
---|
563 | for (j=0; j<iNumUnits2; j++) |
---|
564 | { |
---|
565 | if (*pbNeighborFlags) |
---|
566 | { |
---|
567 | for (i=0; i<iUnitSize; i++) |
---|
568 | { |
---|
569 | piAdiLineTemp[i] = piRoiTemp[i]; |
---|
570 | } |
---|
571 | } |
---|
572 | piRoiTemp += iUnitSize; |
---|
573 | piAdiLineTemp += iUnitSize; |
---|
574 | pbNeighborFlags++; |
---|
575 | } |
---|
576 | |
---|
577 | // Pad reference samples when necessary |
---|
578 | iCurr = 0; |
---|
579 | iNext = 1; |
---|
580 | piAdiLineTemp = piAdiLine; |
---|
581 | while (iCurr < iTotalUnits) |
---|
582 | { |
---|
583 | if (!bNeighborFlags[iCurr]) |
---|
584 | { |
---|
585 | if(iCurr == 0) |
---|
586 | { |
---|
587 | while (iNext < iTotalUnits && !bNeighborFlags[iNext]) |
---|
588 | { |
---|
589 | iNext++; |
---|
590 | } |
---|
591 | piRef = piAdiLine[iNext*iUnitSize]; |
---|
592 | // Pad unavailable samples with new value |
---|
593 | while (iCurr < iNext) |
---|
594 | { |
---|
595 | for (i=0; i<iUnitSize; i++) |
---|
596 | { |
---|
597 | piAdiLineTemp[i] = piRef; |
---|
598 | } |
---|
599 | piAdiLineTemp += iUnitSize; |
---|
600 | iCurr++; |
---|
601 | } |
---|
602 | } |
---|
603 | else |
---|
604 | { |
---|
605 | piRef = piAdiLine[iCurr*iUnitSize-1]; |
---|
606 | for (i=0; i<iUnitSize; i++) |
---|
607 | { |
---|
608 | piAdiLineTemp[i] = piRef; |
---|
609 | } |
---|
610 | piAdiLineTemp += iUnitSize; |
---|
611 | iCurr++; |
---|
612 | } |
---|
613 | } |
---|
614 | else |
---|
615 | { |
---|
616 | piAdiLineTemp += iUnitSize; |
---|
617 | iCurr++; |
---|
618 | } |
---|
619 | } |
---|
620 | |
---|
621 | // Copy processed samples |
---|
622 | piAdiLineTemp = piAdiLine + uiHeight + iUnitSize - 2; |
---|
623 | for (i=0; i<uiWidth; i++) |
---|
624 | { |
---|
625 | piAdiTemp[i] = piAdiLineTemp[i]; |
---|
626 | } |
---|
627 | piAdiLineTemp = piAdiLine + uiHeight - 1; |
---|
628 | for (i=1; i<uiHeight; i++) |
---|
629 | { |
---|
630 | piAdiTemp[i*uiWidth] = piAdiLineTemp[-i]; |
---|
631 | } |
---|
632 | } |
---|
633 | } |
---|
634 | |
---|
635 | Int* TComPattern::getAdiOrgBuf( Int iCuWidth, Int iCuHeight, Int* piAdiBuf) |
---|
636 | { |
---|
637 | return piAdiBuf; |
---|
638 | } |
---|
639 | |
---|
640 | Int* TComPattern::getAdiCbBuf( Int iCuWidth, Int iCuHeight, Int* piAdiBuf) |
---|
641 | { |
---|
642 | return piAdiBuf; |
---|
643 | } |
---|
644 | |
---|
645 | Int* TComPattern::getAdiCrBuf(Int iCuWidth,Int iCuHeight, Int* piAdiBuf) |
---|
646 | { |
---|
647 | return piAdiBuf+(iCuWidth*2+1)*(iCuHeight*2+1); |
---|
648 | } |
---|
649 | |
---|
650 | /** Get pointer to reference samples for intra prediction |
---|
651 | * \param uiDirMode prediction mode index |
---|
652 | * \param log2BlkSize size of block (2 = 4x4, 3 = 8x8, 4 = 16x16, 5 = 32x32, 6 = 64x64) |
---|
653 | * \param piAdiBuf pointer to unfiltered reference samples |
---|
654 | * \return pointer to (possibly filtered) reference samples |
---|
655 | * |
---|
656 | * The prediction mode index is used to determine whether a smoothed reference sample buffer is returned. |
---|
657 | */ |
---|
658 | Int* TComPattern::getPredictorPtr( UInt uiDirMode, UInt log2BlkSize, Int* piAdiBuf ) |
---|
659 | { |
---|
660 | Int* piSrc; |
---|
661 | #if LGE_EDGE_INTRA_A0070 |
---|
662 | mapEdgeIntratoDC( uiDirMode ); |
---|
663 | #endif |
---|
664 | assert(log2BlkSize >= 2 && log2BlkSize < 7); |
---|
665 | #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX |
---|
666 | mapDMMtoIntraMode( uiDirMode ); |
---|
667 | #endif |
---|
668 | Int diff = min<Int>(abs((Int) uiDirMode - HOR_IDX), abs((Int)uiDirMode - VER_IDX)); |
---|
669 | UChar ucFiltIdx = diff > m_aucIntraFilter[log2BlkSize - 2] ? 1 : 0; |
---|
670 | if (uiDirMode == DC_IDX || uiDirMode == LM_CHROMA_IDX) |
---|
671 | { |
---|
672 | ucFiltIdx = 0; //no smoothing for DC or LM chroma |
---|
673 | } |
---|
674 | |
---|
675 | assert( ucFiltIdx <= 1 ); |
---|
676 | |
---|
677 | Int width = 1 << log2BlkSize; |
---|
678 | Int height = 1 << log2BlkSize; |
---|
679 | |
---|
680 | piSrc = getAdiOrgBuf( width, height, piAdiBuf ); |
---|
681 | |
---|
682 | if ( ucFiltIdx ) |
---|
683 | { |
---|
684 | piSrc += (2 * width + 1) * (2 * height + 1); |
---|
685 | } |
---|
686 | |
---|
687 | return piSrc; |
---|
688 | } |
---|
689 | |
---|
690 | Bool TComPattern::isAboveLeftAvailable( TComDataCU* pcCU, UInt uiPartIdxLT ) |
---|
691 | { |
---|
692 | Bool bAboveLeftFlag; |
---|
693 | UInt uiPartAboveLeft; |
---|
694 | TComDataCU* pcCUAboveLeft = pcCU->getPUAboveLeft( uiPartAboveLeft, uiPartIdxLT, true, false ); |
---|
695 | if(pcCU->getSlice()->getPPS()->getConstrainedIntraPred()) |
---|
696 | { |
---|
697 | bAboveLeftFlag = ( pcCUAboveLeft && pcCUAboveLeft->getPredictionMode( uiPartAboveLeft ) == MODE_INTRA ); |
---|
698 | } |
---|
699 | else |
---|
700 | { |
---|
701 | bAboveLeftFlag = (pcCUAboveLeft ? true : false); |
---|
702 | } |
---|
703 | return bAboveLeftFlag; |
---|
704 | } |
---|
705 | |
---|
706 | Int TComPattern::isAboveAvailable( TComDataCU* pcCU, UInt uiPartIdxLT, UInt uiPartIdxRT, Bool *bValidFlags ) |
---|
707 | { |
---|
708 | const UInt uiRasterPartBegin = g_auiZscanToRaster[uiPartIdxLT]; |
---|
709 | const UInt uiRasterPartEnd = g_auiZscanToRaster[uiPartIdxRT]+1; |
---|
710 | const UInt uiIdxStep = 1; |
---|
711 | Bool *pbValidFlags = bValidFlags; |
---|
712 | Int iNumIntra = 0; |
---|
713 | |
---|
714 | for ( UInt uiRasterPart = uiRasterPartBegin; uiRasterPart < uiRasterPartEnd; uiRasterPart += uiIdxStep ) |
---|
715 | { |
---|
716 | UInt uiPartAbove; |
---|
717 | TComDataCU* pcCUAbove = pcCU->getPUAbove( uiPartAbove, g_auiRasterToZscan[uiRasterPart], true, false ); |
---|
718 | if(pcCU->getSlice()->getPPS()->getConstrainedIntraPred()) |
---|
719 | { |
---|
720 | if ( pcCUAbove && pcCUAbove->getPredictionMode( uiPartAbove ) == MODE_INTRA ) |
---|
721 | { |
---|
722 | iNumIntra++; |
---|
723 | *pbValidFlags = true; |
---|
724 | } |
---|
725 | else |
---|
726 | { |
---|
727 | *pbValidFlags = false; |
---|
728 | } |
---|
729 | } |
---|
730 | else |
---|
731 | { |
---|
732 | if (pcCUAbove) |
---|
733 | { |
---|
734 | iNumIntra++; |
---|
735 | *pbValidFlags = true; |
---|
736 | } |
---|
737 | else |
---|
738 | { |
---|
739 | *pbValidFlags = false; |
---|
740 | } |
---|
741 | } |
---|
742 | pbValidFlags++; |
---|
743 | } |
---|
744 | return iNumIntra; |
---|
745 | } |
---|
746 | |
---|
747 | Int TComPattern::isLeftAvailable( TComDataCU* pcCU, UInt uiPartIdxLT, UInt uiPartIdxLB, Bool *bValidFlags ) |
---|
748 | { |
---|
749 | const UInt uiRasterPartBegin = g_auiZscanToRaster[uiPartIdxLT]; |
---|
750 | const UInt uiRasterPartEnd = g_auiZscanToRaster[uiPartIdxLB]+1; |
---|
751 | const UInt uiIdxStep = pcCU->getPic()->getNumPartInWidth(); |
---|
752 | Bool *pbValidFlags = bValidFlags; |
---|
753 | Int iNumIntra = 0; |
---|
754 | |
---|
755 | for ( UInt uiRasterPart = uiRasterPartBegin; uiRasterPart < uiRasterPartEnd; uiRasterPart += uiIdxStep ) |
---|
756 | { |
---|
757 | UInt uiPartLeft; |
---|
758 | TComDataCU* pcCULeft = pcCU->getPULeft( uiPartLeft, g_auiRasterToZscan[uiRasterPart], true, false ); |
---|
759 | if(pcCU->getSlice()->getPPS()->getConstrainedIntraPred()) |
---|
760 | { |
---|
761 | if ( pcCULeft && pcCULeft->getPredictionMode( uiPartLeft ) == MODE_INTRA ) |
---|
762 | { |
---|
763 | iNumIntra++; |
---|
764 | *pbValidFlags = true; |
---|
765 | } |
---|
766 | else |
---|
767 | { |
---|
768 | *pbValidFlags = false; |
---|
769 | } |
---|
770 | } |
---|
771 | else |
---|
772 | { |
---|
773 | if ( pcCULeft ) |
---|
774 | { |
---|
775 | iNumIntra++; |
---|
776 | *pbValidFlags = true; |
---|
777 | } |
---|
778 | else |
---|
779 | { |
---|
780 | *pbValidFlags = false; |
---|
781 | } |
---|
782 | } |
---|
783 | pbValidFlags--; // opposite direction |
---|
784 | } |
---|
785 | |
---|
786 | return iNumIntra; |
---|
787 | } |
---|
788 | |
---|
789 | Int TComPattern::isAboveRightAvailable( TComDataCU* pcCU, UInt uiPartIdxLT, UInt uiPartIdxRT, Bool *bValidFlags ) |
---|
790 | { |
---|
791 | const UInt uiNumUnitsInPU = g_auiZscanToRaster[uiPartIdxRT] - g_auiZscanToRaster[uiPartIdxLT] + 1; |
---|
792 | const UInt uiPuWidth = uiNumUnitsInPU * pcCU->getPic()->getMinCUWidth(); |
---|
793 | Bool *pbValidFlags = bValidFlags; |
---|
794 | Int iNumIntra = 0; |
---|
795 | |
---|
796 | for ( UInt uiOffset = 1; uiOffset <= uiNumUnitsInPU; uiOffset++ ) |
---|
797 | { |
---|
798 | UInt uiPartAboveRight; |
---|
799 | TComDataCU* pcCUAboveRight = pcCU->getPUAboveRightAdi( uiPartAboveRight, uiPuWidth, uiPartIdxRT, uiOffset, true, false ); |
---|
800 | if(pcCU->getSlice()->getPPS()->getConstrainedIntraPred()) |
---|
801 | { |
---|
802 | if ( pcCUAboveRight && pcCUAboveRight->getPredictionMode( uiPartAboveRight ) == MODE_INTRA ) |
---|
803 | { |
---|
804 | iNumIntra++; |
---|
805 | *pbValidFlags = true; |
---|
806 | } |
---|
807 | else |
---|
808 | { |
---|
809 | *pbValidFlags = false; |
---|
810 | } |
---|
811 | } |
---|
812 | else |
---|
813 | { |
---|
814 | if ( pcCUAboveRight ) |
---|
815 | { |
---|
816 | iNumIntra++; |
---|
817 | *pbValidFlags = true; |
---|
818 | } |
---|
819 | else |
---|
820 | { |
---|
821 | *pbValidFlags = false; |
---|
822 | } |
---|
823 | } |
---|
824 | pbValidFlags++; |
---|
825 | } |
---|
826 | |
---|
827 | return iNumIntra; |
---|
828 | } |
---|
829 | |
---|
830 | Int TComPattern::isBelowLeftAvailable( TComDataCU* pcCU, UInt uiPartIdxLT, UInt uiPartIdxLB, Bool *bValidFlags ) |
---|
831 | { |
---|
832 | const UInt uiNumUnitsInPU = (g_auiZscanToRaster[uiPartIdxLB] - g_auiZscanToRaster[uiPartIdxLT]) / pcCU->getPic()->getNumPartInWidth() + 1; |
---|
833 | const UInt uiPuHeight = uiNumUnitsInPU * pcCU->getPic()->getMinCUHeight(); |
---|
834 | Bool *pbValidFlags = bValidFlags; |
---|
835 | Int iNumIntra = 0; |
---|
836 | |
---|
837 | for ( UInt uiOffset = 1; uiOffset <= uiNumUnitsInPU; uiOffset++ ) |
---|
838 | { |
---|
839 | UInt uiPartBelowLeft; |
---|
840 | TComDataCU* pcCUBelowLeft = pcCU->getPUBelowLeftAdi( uiPartBelowLeft, uiPuHeight, uiPartIdxLB, uiOffset, true, false ); |
---|
841 | if(pcCU->getSlice()->getPPS()->getConstrainedIntraPred()) |
---|
842 | { |
---|
843 | if ( pcCUBelowLeft && pcCUBelowLeft->getPredictionMode( uiPartBelowLeft ) == MODE_INTRA ) |
---|
844 | { |
---|
845 | iNumIntra++; |
---|
846 | *pbValidFlags = true; |
---|
847 | } |
---|
848 | else |
---|
849 | { |
---|
850 | *pbValidFlags = false; |
---|
851 | } |
---|
852 | } |
---|
853 | else |
---|
854 | { |
---|
855 | if ( pcCUBelowLeft ) |
---|
856 | { |
---|
857 | iNumIntra++; |
---|
858 | *pbValidFlags = true; |
---|
859 | } |
---|
860 | else |
---|
861 | { |
---|
862 | *pbValidFlags = false; |
---|
863 | } |
---|
864 | } |
---|
865 | pbValidFlags--; // opposite direction |
---|
866 | } |
---|
867 | |
---|
868 | return iNumIntra; |
---|
869 | } |
---|
870 | //! \} |
---|