source: SHVCSoftware/branches/SHM-dev/source/Lib/TLibCommon/TComPicSym.cpp @ 1598

Last change on this file since 1598 was 1574, checked in by seregin, 9 years ago

port rev 4764

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