Changeset 1413 in 3DVCSoftware for trunk/source/Lib/TLibCommon/TComPicSym.cpp


Ignore:
Timestamp:
11 Jul 2018, 15:19:49 (6 years ago)
Author:
tech
Message:

Merged HTM-16.2-dev@1412

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/Lib/TLibCommon/TComPicSym.cpp

    r1405 r1413  
    44 * granted under this license.
    55 *
    6  * Copyright (c) 2010-2016, ITU/ISO/IEC
     6 * Copyright (c) 2010-2017, ITU/ISO/IEC
    77 * All rights reserved.
    88 *
     
    6464,m_puiTileIdxMap(NULL)
    6565,m_ctuRsToTsAddrMap(NULL)
     66#if REDUCED_ENCODER_MEMORY
     67,m_dpbPerCtuData(NULL)
     68#endif
    6669,m_saoBlkParams(NULL)
    6770#if ADAPTIVE_QP_SELECTION
     
    7780
    7881
     82#if REDUCED_ENCODER_MEMORY
     83Void TComPicSym::create  ( const TComSPS &sps, const TComPPS &pps, UInt uiMaxDepth, const Bool bAllocateCtuArray )
     84#else
    7985Void TComPicSym::create  ( const TComSPS &sps, const TComPPS &pps, UInt uiMaxDepth )
    80 {
     86#endif
     87{
     88  destroy();
     89
    8190  m_sps = sps;
    8291  m_pps = pps;
    8392
     93#if !REDUCED_ENCODER_MEMORY
    8494  const ChromaFormat chromaFormatIDC = sps.getChromaFormatIdc();
     95#endif
    8596  const Int iPicWidth      = sps.getPicWidthInLumaSamples();
    8697  const Int iPicHeight     = sps.getPicHeightInLumaSamples();
     
    101112
    102113  m_numCtusInFrame     = m_frameWidthInCtus * m_frameHeightInCtus;
     114#if REDUCED_ENCODER_MEMORY
     115  m_pictureCtuArray    = NULL;
     116#else
    103117  m_pictureCtuArray    = new TComDataCU*[m_numCtusInFrame];
     118#endif
    104119
    105120  clearSliceBuffer();
     
    113128#endif
    114129
     130#if REDUCED_ENCODER_MEMORY
     131  if (bAllocateCtuArray)
     132  {
     133    prepareForReconstruction();
     134  }
     135#else
    115136  for (UInt i=0; i<m_numCtusInFrame ; i++ )
    116137  {
     
    122143      );
    123144  }
     145#endif
    124146
    125147  m_ctuTsToRsAddrMap = new UInt[m_numCtusInFrame+1];
     
    141163}
    142164
     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
    143242Void TComPicSym::destroy()
    144243{
    145244  clearSliceBuffer();
    146245
     246#if REDUCED_ENCODER_MEMORY
     247  releaseAllReconstructionData();
     248#else
    147249  if (m_pictureCtuArray)
    148250  {
     
    159261  m_pictureCtuArray = NULL;
    160262  }
     263#endif
    161264
    162265  delete [] m_ctuTsToRsAddrMap;
     
    497600{
    498601}
     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
    499620//! \}
Note: See TracChangeset for help on using the changeset viewer.