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 TComPicSym.cpp |
---|
35 | \brief picture symbol class |
---|
36 | */ |
---|
37 | |
---|
38 | #include "TComPicSym.h" |
---|
39 | #include "TComSampleAdaptiveOffset.h" |
---|
40 | #include "TComSlice.h" |
---|
41 | |
---|
42 | //! \ingroup TLibCommon |
---|
43 | //! \{ |
---|
44 | |
---|
45 | // ==================================================================================================================== |
---|
46 | // Constructor / destructor / create / destroy |
---|
47 | // ==================================================================================================================== |
---|
48 | |
---|
49 | TComPicSym::TComPicSym() |
---|
50 | :m_frameWidthInCtus(0) |
---|
51 | ,m_frameHeightInCtus(0) |
---|
52 | ,m_uiMaxCUWidth(0) |
---|
53 | ,m_uiMaxCUHeight(0) |
---|
54 | ,m_uiMinCUWidth(0) |
---|
55 | ,m_uiMinCUHeight(0) |
---|
56 | ,m_uhTotalDepth(0) |
---|
57 | ,m_numPartitionsInCtu(0) |
---|
58 | ,m_numPartInCtuWidth(0) |
---|
59 | ,m_numPartInCtuHeight(0) |
---|
60 | ,m_numCtusInFrame(0) |
---|
61 | ,m_apcTComSlice(NULL) |
---|
62 | ,m_uiNumAllocatedSlice(0) |
---|
63 | ,m_pictureCtuArray(NULL) |
---|
64 | ,m_numTileColumnsMinus1(0) |
---|
65 | ,m_numTileRowsMinus1(0) |
---|
66 | ,m_ctuTsToRsAddrMap(NULL) |
---|
67 | ,m_puiTileIdxMap(NULL) |
---|
68 | ,m_ctuRsToTsAddrMap(NULL) |
---|
69 | ,m_saoBlkParams(NULL) |
---|
70 | {} |
---|
71 | |
---|
72 | |
---|
73 | Void TComPicSym::create ( ChromaFormat chromaFormatIDC, Int iPicWidth, Int iPicHeight, UInt uiMaxWidth, UInt uiMaxHeight, UInt uiMaxDepth ) |
---|
74 | { |
---|
75 | UInt i; |
---|
76 | |
---|
77 | m_uhTotalDepth = uiMaxDepth; |
---|
78 | m_numPartitionsInCtu = 1<<(m_uhTotalDepth<<1); |
---|
79 | |
---|
80 | m_uiMaxCUWidth = uiMaxWidth; |
---|
81 | m_uiMaxCUHeight = uiMaxHeight; |
---|
82 | |
---|
83 | m_uiMinCUWidth = uiMaxWidth >> m_uhTotalDepth; |
---|
84 | m_uiMinCUHeight = uiMaxHeight >> m_uhTotalDepth; |
---|
85 | |
---|
86 | m_numPartInCtuWidth = m_uiMaxCUWidth / m_uiMinCUWidth; // equivalent to 1<<m_uhTotalDepth |
---|
87 | m_numPartInCtuHeight = m_uiMaxCUHeight / m_uiMinCUHeight; // equivalent to 1<<m_uhTotalDepth |
---|
88 | |
---|
89 | m_frameWidthInCtus = ( iPicWidth %m_uiMaxCUWidth ) ? iPicWidth /m_uiMaxCUWidth + 1 : iPicWidth /m_uiMaxCUWidth; |
---|
90 | m_frameHeightInCtus = ( iPicHeight%m_uiMaxCUHeight ) ? iPicHeight/m_uiMaxCUHeight + 1 : iPicHeight/m_uiMaxCUHeight; |
---|
91 | |
---|
92 | m_numCtusInFrame = m_frameWidthInCtus * m_frameHeightInCtus; |
---|
93 | m_pictureCtuArray = new TComDataCU*[m_numCtusInFrame]; |
---|
94 | |
---|
95 | if (m_uiNumAllocatedSlice>0) |
---|
96 | { |
---|
97 | for ( i=0; i<m_uiNumAllocatedSlice ; i++ ) |
---|
98 | { |
---|
99 | delete m_apcTComSlice[i]; |
---|
100 | } |
---|
101 | delete [] m_apcTComSlice; |
---|
102 | } |
---|
103 | m_apcTComSlice = new TComSlice*[m_numCtusInFrame]; |
---|
104 | m_apcTComSlice[0] = new TComSlice; |
---|
105 | m_uiNumAllocatedSlice = 1; |
---|
106 | for ( i=0; i<m_numCtusInFrame ; i++ ) |
---|
107 | { |
---|
108 | m_pictureCtuArray[i] = new TComDataCU; |
---|
109 | m_pictureCtuArray[i]->create( chromaFormatIDC, m_numPartitionsInCtu, m_uiMaxCUWidth, m_uiMaxCUHeight, false, m_uiMaxCUWidth >> m_uhTotalDepth |
---|
110 | #if ADAPTIVE_QP_SELECTION |
---|
111 | , true |
---|
112 | #endif |
---|
113 | ); |
---|
114 | } |
---|
115 | |
---|
116 | m_ctuTsToRsAddrMap = new UInt[m_numCtusInFrame+1]; |
---|
117 | m_puiTileIdxMap = new UInt[m_numCtusInFrame]; |
---|
118 | m_ctuRsToTsAddrMap = new UInt[m_numCtusInFrame+1]; |
---|
119 | |
---|
120 | #if N0383_IL_CONSTRAINED_TILE_SETS_SEI |
---|
121 | m_piTileSetIdxMap = new Int[m_numCtusInFrame]; |
---|
122 | m_pucTileSetType = new UChar[m_numCtusInFrame]; |
---|
123 | m_pbSkippedTileSetFlag = new Bool[m_numCtusInFrame]; |
---|
124 | #endif |
---|
125 | |
---|
126 | for( i=0; i<m_numCtusInFrame; i++ ) |
---|
127 | { |
---|
128 | m_ctuTsToRsAddrMap[i] = i; |
---|
129 | m_ctuRsToTsAddrMap[i] = i; |
---|
130 | } |
---|
131 | |
---|
132 | m_saoBlkParams = new SAOBlkParam[m_numCtusInFrame]; |
---|
133 | } |
---|
134 | |
---|
135 | Void TComPicSym::destroy() |
---|
136 | { |
---|
137 | if (m_uiNumAllocatedSlice>0) |
---|
138 | { |
---|
139 | for (Int i = 0; i<m_uiNumAllocatedSlice ; i++ ) |
---|
140 | { |
---|
141 | delete m_apcTComSlice[i]; |
---|
142 | } |
---|
143 | delete [] m_apcTComSlice; |
---|
144 | } |
---|
145 | m_apcTComSlice = NULL; |
---|
146 | |
---|
147 | for (Int i = 0; i < m_numCtusInFrame; i++) |
---|
148 | { |
---|
149 | m_pictureCtuArray[i]->destroy(); |
---|
150 | delete m_pictureCtuArray[i]; |
---|
151 | m_pictureCtuArray[i] = NULL; |
---|
152 | } |
---|
153 | delete [] m_pictureCtuArray; |
---|
154 | m_pictureCtuArray = NULL; |
---|
155 | |
---|
156 | delete [] m_ctuTsToRsAddrMap; |
---|
157 | m_ctuTsToRsAddrMap = NULL; |
---|
158 | |
---|
159 | delete [] m_puiTileIdxMap; |
---|
160 | m_puiTileIdxMap = NULL; |
---|
161 | #if N0383_IL_CONSTRAINED_TILE_SETS_SEI |
---|
162 | delete [] m_piTileSetIdxMap; |
---|
163 | m_piTileSetIdxMap = NULL; |
---|
164 | delete [] m_pucTileSetType; |
---|
165 | m_pucTileSetType = NULL; |
---|
166 | delete [] m_pbSkippedTileSetFlag; |
---|
167 | m_pbSkippedTileSetFlag = NULL; |
---|
168 | #endif |
---|
169 | |
---|
170 | delete [] m_ctuRsToTsAddrMap; |
---|
171 | m_ctuRsToTsAddrMap = NULL; |
---|
172 | |
---|
173 | if(m_saoBlkParams) |
---|
174 | { |
---|
175 | delete[] m_saoBlkParams; m_saoBlkParams = NULL; |
---|
176 | } |
---|
177 | } |
---|
178 | |
---|
179 | Void TComPicSym::allocateNewSlice() |
---|
180 | { |
---|
181 | assert ((m_uiNumAllocatedSlice + 1) <= m_numCtusInFrame); |
---|
182 | m_apcTComSlice[m_uiNumAllocatedSlice ++] = new TComSlice; |
---|
183 | if (m_uiNumAllocatedSlice>=2) |
---|
184 | { |
---|
185 | m_apcTComSlice[m_uiNumAllocatedSlice-1]->copySliceInfo( m_apcTComSlice[m_uiNumAllocatedSlice-2] ); |
---|
186 | #if SVC_EXTENSION |
---|
187 | m_apcTComSlice[m_uiNumAllocatedSlice-1]->initSlice( m_apcTComSlice[m_uiNumAllocatedSlice-1]->getLayerId() ); |
---|
188 | #else |
---|
189 | m_apcTComSlice[m_uiNumAllocatedSlice-1]->initSlice(); |
---|
190 | #endif |
---|
191 | } |
---|
192 | } |
---|
193 | |
---|
194 | Void TComPicSym::clearSliceBuffer() |
---|
195 | { |
---|
196 | UInt i; |
---|
197 | for (i = 1; i < m_uiNumAllocatedSlice; i++) |
---|
198 | { |
---|
199 | delete m_apcTComSlice[i]; |
---|
200 | } |
---|
201 | m_uiNumAllocatedSlice = 1; |
---|
202 | } |
---|
203 | |
---|
204 | Void TComPicSym::initCtuTsRsAddrMaps() |
---|
205 | { |
---|
206 | //generate the Coding Order Map and Inverse Coding Order Map |
---|
207 | for(Int ctuTsAddr=0, ctuRsAddr=0; ctuTsAddr<getNumberOfCtusInFrame(); ctuTsAddr++, ctuRsAddr = xCalculateNextCtuRSAddr(ctuRsAddr)) |
---|
208 | { |
---|
209 | setCtuTsToRsAddrMap(ctuTsAddr, ctuRsAddr); |
---|
210 | setCtuRsToTsAddrMap(ctuRsAddr, ctuTsAddr); |
---|
211 | } |
---|
212 | setCtuTsToRsAddrMap(getNumberOfCtusInFrame(), getNumberOfCtusInFrame()); |
---|
213 | setCtuRsToTsAddrMap(getNumberOfCtusInFrame(), getNumberOfCtusInFrame()); |
---|
214 | } |
---|
215 | |
---|
216 | Void TComPicSym::initTiles(TComPPS *pps) |
---|
217 | { |
---|
218 | //set NumColumnsMinus1 and NumRowsMinus1 |
---|
219 | setNumTileColumnsMinus1( pps->getNumTileColumnsMinus1() ); |
---|
220 | setNumTileRowsMinus1( pps->getNumTileRowsMinus1() ); |
---|
221 | |
---|
222 | const Int numCols = pps->getNumTileColumnsMinus1() + 1; |
---|
223 | const Int numRows = pps->getNumTileRowsMinus1() + 1; |
---|
224 | const Int numTiles = numRows * numCols; |
---|
225 | |
---|
226 | // allocate memory for tile parameters |
---|
227 | m_tileParameters.resize(numTiles); |
---|
228 | |
---|
229 | if( pps->getTileUniformSpacingFlag() ) |
---|
230 | { |
---|
231 | //set width and height for each (uniform) tile |
---|
232 | for(Int row=0; row < numRows; row++) |
---|
233 | { |
---|
234 | for(Int col=0; col < numCols; col++) |
---|
235 | { |
---|
236 | const Int tileIdx = row * numCols + col; |
---|
237 | m_tileParameters[tileIdx].setTileWidthInCtus( (col+1)*getFrameWidthInCtus( )/numCols - (col*getFrameWidthInCtus( ))/numCols ); |
---|
238 | m_tileParameters[tileIdx].setTileHeightInCtus( (row+1)*getFrameHeightInCtus()/numRows - (row*getFrameHeightInCtus())/numRows ); |
---|
239 | } |
---|
240 | } |
---|
241 | } |
---|
242 | else |
---|
243 | { |
---|
244 | //set the width for each tile |
---|
245 | for(Int row=0; row < numRows; row++) |
---|
246 | { |
---|
247 | Int cumulativeTileWidth = 0; |
---|
248 | for(Int col=0; col < getNumTileColumnsMinus1(); col++) |
---|
249 | { |
---|
250 | m_tileParameters[row * numCols + col].setTileWidthInCtus( pps->getTileColumnWidth(col) ); |
---|
251 | cumulativeTileWidth += pps->getTileColumnWidth(col); |
---|
252 | } |
---|
253 | m_tileParameters[row * numCols + getNumTileColumnsMinus1()].setTileWidthInCtus( getFrameWidthInCtus()-cumulativeTileWidth ); |
---|
254 | } |
---|
255 | |
---|
256 | //set the height for each tile |
---|
257 | for(Int col=0; col < numCols; col++) |
---|
258 | { |
---|
259 | Int cumulativeTileHeight = 0; |
---|
260 | for(Int row=0; row < getNumTileRowsMinus1(); row++) |
---|
261 | { |
---|
262 | m_tileParameters[row * numCols + col].setTileHeightInCtus( pps->getTileRowHeight(row) ); |
---|
263 | cumulativeTileHeight += pps->getTileRowHeight(row); |
---|
264 | } |
---|
265 | m_tileParameters[getNumTileRowsMinus1() * numCols + col].setTileHeightInCtus( getFrameHeightInCtus()-cumulativeTileHeight ); |
---|
266 | } |
---|
267 | } |
---|
268 | |
---|
269 | #if TILE_SIZE_CHECK |
---|
270 | Int minWidth = 1; |
---|
271 | Int minHeight = 1; |
---|
272 | const Int profileIdc = pps->getSPS()->getPTL()->getGeneralPTL()->getProfileIdc(); |
---|
273 | if ( profileIdc == Profile::MAIN || profileIdc == Profile::MAIN10) //TODO: add more profiles to the tile-size check... |
---|
274 | { |
---|
275 | if (pps->getTilesEnabledFlag()) |
---|
276 | { |
---|
277 | minHeight = 64 / g_uiMaxCUHeight; |
---|
278 | minWidth = 256 / g_uiMaxCUWidth; |
---|
279 | } |
---|
280 | } |
---|
281 | for(Int row=0; row < numRows; row++) |
---|
282 | { |
---|
283 | for(Int col=0; col < numCols; col++) |
---|
284 | { |
---|
285 | const Int tileIdx = row * numCols + col; |
---|
286 | assert (m_tileParameters[tileIdx].getTileWidthInCtus() >= minWidth); |
---|
287 | assert (m_tileParameters[tileIdx].getTileHeightInCtus() >= minHeight); |
---|
288 | } |
---|
289 | } |
---|
290 | #endif |
---|
291 | |
---|
292 | //initialize each tile of the current picture |
---|
293 | for( Int row=0; row < numRows; row++ ) |
---|
294 | { |
---|
295 | for( Int col=0; col < numCols; col++ ) |
---|
296 | { |
---|
297 | const Int tileIdx = row * numCols + col; |
---|
298 | |
---|
299 | //initialize the RightEdgePosInCU for each tile |
---|
300 | Int rightEdgePosInCTU = 0; |
---|
301 | for( Int i=0; i <= col; i++ ) |
---|
302 | { |
---|
303 | rightEdgePosInCTU += m_tileParameters[row * numCols + i].getTileWidthInCtus(); |
---|
304 | } |
---|
305 | m_tileParameters[tileIdx].setRightEdgePosInCtus(rightEdgePosInCTU-1); |
---|
306 | |
---|
307 | //initialize the BottomEdgePosInCU for each tile |
---|
308 | Int bottomEdgePosInCTU = 0; |
---|
309 | for( Int i=0; i <= row; i++ ) |
---|
310 | { |
---|
311 | bottomEdgePosInCTU += m_tileParameters[i * numCols + col].getTileHeightInCtus(); |
---|
312 | } |
---|
313 | m_tileParameters[tileIdx].setBottomEdgePosInCtus(bottomEdgePosInCTU-1); |
---|
314 | |
---|
315 | //initialize the FirstCUAddr for each tile |
---|
316 | m_tileParameters[tileIdx].setFirstCtuRsAddr( (m_tileParameters[tileIdx].getBottomEdgePosInCtus() - m_tileParameters[tileIdx].getTileHeightInCtus() + 1) * getFrameWidthInCtus() + |
---|
317 | m_tileParameters[tileIdx].getRightEdgePosInCtus() - m_tileParameters[tileIdx].getTileWidthInCtus() + 1); |
---|
318 | } |
---|
319 | } |
---|
320 | |
---|
321 | Int columnIdx = 0; |
---|
322 | Int rowIdx = 0; |
---|
323 | |
---|
324 | //initialize the TileIdxMap |
---|
325 | for( Int i=0; i<m_numCtusInFrame; i++) |
---|
326 | { |
---|
327 | for( Int col=0; col < numCols; col++) |
---|
328 | { |
---|
329 | if(i % getFrameWidthInCtus() <= m_tileParameters[col].getRightEdgePosInCtus()) |
---|
330 | { |
---|
331 | columnIdx = col; |
---|
332 | break; |
---|
333 | } |
---|
334 | } |
---|
335 | for(Int row=0; row < numRows; row++) |
---|
336 | { |
---|
337 | if(i / getFrameWidthInCtus() <= m_tileParameters[row*numCols].getBottomEdgePosInCtus()) |
---|
338 | { |
---|
339 | rowIdx = row; |
---|
340 | break; |
---|
341 | } |
---|
342 | } |
---|
343 | m_puiTileIdxMap[i] = rowIdx * numCols + columnIdx; |
---|
344 | } |
---|
345 | } |
---|
346 | UInt TComPicSym::xCalculateNextCtuRSAddr( UInt currCtuRsAddr ) |
---|
347 | { |
---|
348 | UInt nextCtuRsAddr; |
---|
349 | |
---|
350 | //get the tile index for the current CTU |
---|
351 | const UInt uiTileIdx = getTileIdxMap(currCtuRsAddr); |
---|
352 | |
---|
353 | //get the raster scan address for the next CTU |
---|
354 | if( currCtuRsAddr % m_frameWidthInCtus == getTComTile(uiTileIdx)->getRightEdgePosInCtus() && currCtuRsAddr / m_frameWidthInCtus == getTComTile(uiTileIdx)->getBottomEdgePosInCtus() ) |
---|
355 | //the current CTU is the last CTU of the tile |
---|
356 | { |
---|
357 | if(uiTileIdx+1 == getNumTiles()) |
---|
358 | { |
---|
359 | nextCtuRsAddr = m_numCtusInFrame; |
---|
360 | } |
---|
361 | else |
---|
362 | { |
---|
363 | nextCtuRsAddr = getTComTile(uiTileIdx+1)->getFirstCtuRsAddr(); |
---|
364 | } |
---|
365 | } |
---|
366 | else //the current CTU is not the last CTU of the tile |
---|
367 | { |
---|
368 | if( currCtuRsAddr % m_frameWidthInCtus == getTComTile(uiTileIdx)->getRightEdgePosInCtus() ) //the current CTU is on the rightmost edge of the tile |
---|
369 | { |
---|
370 | nextCtuRsAddr = currCtuRsAddr + m_frameWidthInCtus - getTComTile(uiTileIdx)->getTileWidthInCtus() + 1; |
---|
371 | } |
---|
372 | else |
---|
373 | { |
---|
374 | nextCtuRsAddr = currCtuRsAddr + 1; |
---|
375 | } |
---|
376 | } |
---|
377 | |
---|
378 | return nextCtuRsAddr; |
---|
379 | } |
---|
380 | |
---|
381 | Void TComPicSym::deriveLoopFilterBoundaryAvailibility(Int ctuRsAddr, |
---|
382 | Bool& isLeftAvail, |
---|
383 | Bool& isRightAvail, |
---|
384 | Bool& isAboveAvail, |
---|
385 | Bool& isBelowAvail, |
---|
386 | Bool& isAboveLeftAvail, |
---|
387 | Bool& isAboveRightAvail, |
---|
388 | Bool& isBelowLeftAvail, |
---|
389 | Bool& isBelowRightAvail |
---|
390 | ) |
---|
391 | { |
---|
392 | |
---|
393 | isLeftAvail = (ctuRsAddr % m_frameWidthInCtus != 0); |
---|
394 | isRightAvail = (ctuRsAddr % m_frameWidthInCtus != m_frameWidthInCtus-1); |
---|
395 | isAboveAvail = (ctuRsAddr >= m_frameWidthInCtus ); |
---|
396 | isBelowAvail = (ctuRsAddr < m_numCtusInFrame - m_frameWidthInCtus); |
---|
397 | isAboveLeftAvail = (isAboveAvail && isLeftAvail); |
---|
398 | isAboveRightAvail= (isAboveAvail && isRightAvail); |
---|
399 | isBelowLeftAvail = (isBelowAvail && isLeftAvail); |
---|
400 | isBelowRightAvail= (isBelowAvail && isRightAvail); |
---|
401 | |
---|
402 | Bool isLoopFiltAcrossTilePPS = getCtu(ctuRsAddr)->getSlice()->getPPS()->getLoopFilterAcrossTilesEnabledFlag(); |
---|
403 | |
---|
404 | { |
---|
405 | TComDataCU* ctuCurr = getCtu(ctuRsAddr); |
---|
406 | TComDataCU* ctuLeft = isLeftAvail ?getCtu(ctuRsAddr-1):NULL; |
---|
407 | TComDataCU* ctuRight = isRightAvail?getCtu(ctuRsAddr+1):NULL; |
---|
408 | TComDataCU* ctuAbove = isAboveAvail?getCtu(ctuRsAddr-m_frameWidthInCtus):NULL; |
---|
409 | TComDataCU* ctuBelow = isBelowAvail?getCtu(ctuRsAddr+m_frameWidthInCtus):NULL; |
---|
410 | TComDataCU* ctuAboveLeft = isAboveLeftAvail ? getCtu(ctuRsAddr-m_frameWidthInCtus-1):NULL; |
---|
411 | TComDataCU* ctuAboveRight = isAboveRightAvail? getCtu(ctuRsAddr-m_frameWidthInCtus+1):NULL; |
---|
412 | TComDataCU* ctuBelowLeft = isBelowLeftAvail ? getCtu(ctuRsAddr+m_frameWidthInCtus-1):NULL; |
---|
413 | TComDataCU* ctuBelowRight = isBelowRightAvail? getCtu(ctuRsAddr+m_frameWidthInCtus+1):NULL; |
---|
414 | |
---|
415 | { |
---|
416 | //left |
---|
417 | if(ctuLeft != NULL) |
---|
418 | { |
---|
419 | isLeftAvail = (ctuCurr->getSlice()->getSliceCurStartCtuTsAddr() != ctuLeft->getSlice()->getSliceCurStartCtuTsAddr())?ctuCurr->getSlice()->getLFCrossSliceBoundaryFlag():true; |
---|
420 | } |
---|
421 | //above |
---|
422 | if(ctuAbove != NULL) |
---|
423 | { |
---|
424 | isAboveAvail = (ctuCurr->getSlice()->getSliceCurStartCtuTsAddr() != ctuAbove->getSlice()->getSliceCurStartCtuTsAddr())?ctuCurr->getSlice()->getLFCrossSliceBoundaryFlag():true; |
---|
425 | } |
---|
426 | //right |
---|
427 | if(ctuRight != NULL) |
---|
428 | { |
---|
429 | isRightAvail = (ctuCurr->getSlice()->getSliceCurStartCtuTsAddr() != ctuRight->getSlice()->getSliceCurStartCtuTsAddr())?ctuRight->getSlice()->getLFCrossSliceBoundaryFlag():true; |
---|
430 | } |
---|
431 | //below |
---|
432 | if(ctuBelow != NULL) |
---|
433 | { |
---|
434 | isBelowAvail = (ctuCurr->getSlice()->getSliceCurStartCtuTsAddr() != ctuBelow->getSlice()->getSliceCurStartCtuTsAddr())?ctuBelow->getSlice()->getLFCrossSliceBoundaryFlag():true; |
---|
435 | } |
---|
436 | //above-left |
---|
437 | if(ctuAboveLeft != NULL) |
---|
438 | { |
---|
439 | isAboveLeftAvail = (ctuCurr->getSlice()->getSliceCurStartCtuTsAddr() != ctuAboveLeft->getSlice()->getSliceCurStartCtuTsAddr())?ctuCurr->getSlice()->getLFCrossSliceBoundaryFlag():true; |
---|
440 | } |
---|
441 | //below-right |
---|
442 | if(ctuBelowRight != NULL) |
---|
443 | { |
---|
444 | isBelowRightAvail = (ctuCurr->getSlice()->getSliceCurStartCtuTsAddr() != ctuBelowRight->getSlice()->getSliceCurStartCtuTsAddr())?ctuBelowRight->getSlice()->getLFCrossSliceBoundaryFlag():true; |
---|
445 | } |
---|
446 | |
---|
447 | //above-right |
---|
448 | if(ctuAboveRight != NULL) |
---|
449 | { |
---|
450 | Int curSliceStartTsAddr = ctuCurr->getSlice()->getSliceCurStartCtuTsAddr(); |
---|
451 | Int aboveRightSliceStartTsAddr = ctuAboveRight->getSlice()->getSliceCurStartCtuTsAddr(); |
---|
452 | |
---|
453 | isAboveRightAvail = (curSliceStartTsAddr == aboveRightSliceStartTsAddr)?(true): |
---|
454 | ( |
---|
455 | (curSliceStartTsAddr > aboveRightSliceStartTsAddr)?(ctuCurr->getSlice()->getLFCrossSliceBoundaryFlag()) |
---|
456 | :(ctuAboveRight->getSlice()->getLFCrossSliceBoundaryFlag()) |
---|
457 | ); |
---|
458 | } |
---|
459 | //below-left |
---|
460 | if(ctuBelowLeft != NULL) |
---|
461 | { |
---|
462 | Int curSliceStartTsAddr = ctuCurr->getSlice()->getSliceCurStartCtuTsAddr(); |
---|
463 | Int belowLeftSliceStartTsAddr = ctuBelowLeft->getSlice()->getSliceCurStartCtuTsAddr(); |
---|
464 | |
---|
465 | isBelowLeftAvail = (curSliceStartTsAddr == belowLeftSliceStartTsAddr)?(true): |
---|
466 | ( |
---|
467 | (curSliceStartTsAddr > belowLeftSliceStartTsAddr)?(ctuCurr->getSlice()->getLFCrossSliceBoundaryFlag()) |
---|
468 | :(ctuBelowLeft->getSlice()->getLFCrossSliceBoundaryFlag()) |
---|
469 | ); |
---|
470 | } |
---|
471 | } |
---|
472 | |
---|
473 | if(!isLoopFiltAcrossTilePPS) |
---|
474 | { |
---|
475 | isLeftAvail = (!isLeftAvail ) ?false:(getTileIdxMap( ctuLeft->getCtuRsAddr() ) == getTileIdxMap( ctuRsAddr )); |
---|
476 | isAboveAvail = (!isAboveAvail ) ?false:(getTileIdxMap( ctuAbove->getCtuRsAddr() ) == getTileIdxMap( ctuRsAddr )); |
---|
477 | isRightAvail = (!isRightAvail ) ?false:(getTileIdxMap( ctuRight->getCtuRsAddr() ) == getTileIdxMap( ctuRsAddr )); |
---|
478 | isBelowAvail = (!isBelowAvail ) ?false:(getTileIdxMap( ctuBelow->getCtuRsAddr() ) == getTileIdxMap( ctuRsAddr )); |
---|
479 | isAboveLeftAvail = (!isAboveLeftAvail ) ?false:(getTileIdxMap( ctuAboveLeft->getCtuRsAddr() ) == getTileIdxMap( ctuRsAddr )); |
---|
480 | isAboveRightAvail= (!isAboveRightAvail) ?false:(getTileIdxMap( ctuAboveRight->getCtuRsAddr() ) == getTileIdxMap( ctuRsAddr )); |
---|
481 | isBelowLeftAvail = (!isBelowLeftAvail ) ?false:(getTileIdxMap( ctuBelowLeft->getCtuRsAddr() ) == getTileIdxMap( ctuRsAddr )); |
---|
482 | isBelowRightAvail= (!isBelowRightAvail) ?false:(getTileIdxMap( ctuBelowRight->getCtuRsAddr() ) == getTileIdxMap( ctuRsAddr )); |
---|
483 | } |
---|
484 | } |
---|
485 | |
---|
486 | } |
---|
487 | |
---|
488 | |
---|
489 | TComTile::TComTile() |
---|
490 | : m_tileWidthInCtus (0) |
---|
491 | , m_tileHeightInCtus (0) |
---|
492 | , m_rightEdgePosInCtus (0) |
---|
493 | , m_bottomEdgePosInCtus (0) |
---|
494 | , m_firstCtuRsAddr (0) |
---|
495 | { |
---|
496 | } |
---|
497 | |
---|
498 | TComTile::~TComTile() |
---|
499 | { |
---|
500 | } |
---|
501 | //! \} |
---|