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