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