source: 3DVCSoftware/branches/HTM-16.2-dev/source/Lib/TLibCommon/TComPicSym.cpp @ 1412

Last change on this file since 1412 was 1412, checked in by tech, 7 years ago
  • Update HM-16.18
  • Cleanups
  • Encoder Extension

-- Representation formats
-- Parameter set sharing
-- GOP configuration

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