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