Changeset 1574 in SHVCSoftware


Ignore:
Timestamp:
20 Jun 2016, 19:14:44 (8 years ago)
Author:
seregin
Message:

port rev 4764

Location:
branches/SHM-dev/source/Lib
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • branches/SHM-dev/source/Lib/TLibCommon/TComDataCU.cpp

    r1573 r1574  
    29592959  // use coldir.
    29602960  const TComPic    * const pColPic = getSlice()->getRefPic( RefPicList(getSlice()->isInterB() ? 1-getSlice()->getColFromL0Flag() : 0), getSlice()->getColRefIdx());
     2961#if REDUCED_ENCODER_MEMORY
     2962  if (!pColPic->getPicSym()->hasDPBPerCtuData())
     2963  {
     2964    return false;
     2965  }
     2966  const TComPicSym::DPBPerCtuData * const pColDpbCtu = &(pColPic->getPicSym()->getDPBPerCtuData(ctuRsAddr));
     2967  const TComSlice * const pColSlice = pColDpbCtu->getSlice();
     2968  if(pColDpbCtu->getPartitionSize(partUnitIdx)==NUMBER_OF_PART_SIZES)
     2969#else
    29612970  const TComDataCU * const pColCtu = pColPic->getCtu( ctuRsAddr );
    29622971  if(pColCtu->getPic()==0 || pColCtu->getPartitionSize(partUnitIdx)==NUMBER_OF_PART_SIZES)
     2972#endif
    29632973  {
    29642974    return false;
    29652975  }
    29662976
     2977#if REDUCED_ENCODER_MEMORY
     2978  if (!pColDpbCtu->isInter(absPartAddr))
     2979#else
    29672980  if (!pColCtu->isInter(absPartAddr))
     2981#endif
    29682982  {
    29692983    return false;
     
    29712985
    29722986  RefPicList eColRefPicList = getSlice()->getCheckLDC() ? eRefPicList : RefPicList(getSlice()->getColFromL0Flag());
     2987#if REDUCED_ENCODER_MEMORY
     2988  Int iColRefIdx            = pColDpbCtu->getCUMvField(RefPicList(eColRefPicList))->getRefIdx(absPartAddr);
     2989#else
    29732990  Int iColRefIdx            = pColCtu->getCUMvField(RefPicList(eColRefPicList))->getRefIdx(absPartAddr);
     2991#endif
    29742992
    29752993  if (iColRefIdx < 0 )
    29762994  {
    29772995    eColRefPicList = RefPicList(1 - eColRefPicList);
     2996#if REDUCED_ENCODER_MEMORY
     2997    iColRefIdx = pColDpbCtu->getCUMvField(RefPicList(eColRefPicList))->getRefIdx(absPartAddr);
     2998#else
    29782999    iColRefIdx = pColCtu->getCUMvField(RefPicList(eColRefPicList))->getRefIdx(absPartAddr);
     3000#endif
    29793001
    29803002    if (iColRefIdx < 0 )
     
    29853007
    29863008  const Bool bIsCurrRefLongTerm = m_pcSlice->getRefPic(eRefPicList, refIdx)->getIsLongTerm();
     3009#if REDUCED_ENCODER_MEMORY
     3010  const Bool bIsColRefLongTerm  = pColSlice->getIsUsedAsLongTerm(eColRefPicList, iColRefIdx);
     3011#else
    29873012  const Bool bIsColRefLongTerm  = pColCtu->getSlice()->getIsUsedAsLongTerm(eColRefPicList, iColRefIdx);
     3013#endif
    29883014
    29893015  if ( bIsCurrRefLongTerm != bIsColRefLongTerm )
     
    29933019
    29943020  // Scale the vector.
     3021#if REDUCED_ENCODER_MEMORY
     3022  const TComMv &cColMv = pColDpbCtu->getCUMvField(eColRefPicList)->getMv(absPartAddr);
     3023#else
    29953024  const TComMv &cColMv = pColCtu->getCUMvField(eColRefPicList)->getMv(absPartAddr);
     3025#endif
    29963026  if ( bIsCurrRefLongTerm /*|| bIsColRefLongTerm*/ )
    29973027  {
     
    30013031  {
    30023032    const Int currPOC    = m_pcSlice->getPOC();
     3033#if REDUCED_ENCODER_MEMORY
     3034    const Int colPOC     = pColSlice->getPOC();
     3035    const Int colRefPOC  = pColSlice->getRefPOC(eColRefPicList, iColRefIdx);
     3036#else
    30033037    const Int colPOC     = pColCtu->getSlice()->getPOC();
    30043038    const Int colRefPOC  = pColCtu->getSlice()->getRefPOC(eColRefPicList, iColRefIdx);
     3039#endif
    30053040    const Int currRefPOC = m_pcSlice->getRefPic(eRefPicList, refIdx)->getPOC();
    30063041    const Int scale      = xGetDistScaleFactor(currPOC, currRefPOC, colPOC, colRefPOC);
     
    30533088Void TComDataCU::compressMV()
    30543089{
     3090#if REDUCED_ENCODER_MEMORY
     3091  const Int scaleFactor = std::max<Int>(1,4 * AMVP_DECIMATION_FACTOR / m_unitSize);
     3092  TComPicSym &picSym=*(getPic()->getPicSym());
     3093  TComPicSym::DPBPerCtuData &dpbForCtu=picSym.getDPBPerCtuData(getCtuRsAddr());
     3094
     3095  for(UInt i=0; i<NUM_REF_PIC_LIST_01; i++)
     3096  {
     3097    dpbForCtu.m_CUMvField[i].compress(dpbForCtu.m_pePredMode, m_pePredMode, scaleFactor,m_acCUMvField[i]);
     3098    memcpy(dpbForCtu.m_pePartSize, m_pePartSize, sizeof(*m_pePartSize)*m_uiNumPartition);
     3099    dpbForCtu.m_pSlice = getSlice();
     3100  }
     3101#else
    30553102  Int scaleFactor = 4 * AMVP_DECIMATION_FACTOR / m_unitSize;
    30563103  if (scaleFactor > 0)
     
    30613108    }
    30623109  }
     3110#endif
    30633111}
    30643112
  • branches/SHM-dev/source/Lib/TLibCommon/TComMotionInfo.cpp

    r1549 r1574  
    328328 * \param scale      Factor by which to subsample motion information
    329329 */
     330#if REDUCED_ENCODER_MEMORY
     331Void TComCUMvField::compress(SChar *pePredMode, const SChar* pePredModeSource, const Int scale, const TComCUMvField &source)
     332{
     333  const Int numSubpartsWithIdenticalMotion = scale * scale;
     334  assert( numSubpartsWithIdenticalMotion > 0 && numSubpartsWithIdenticalMotion <= m_uiNumPartition);
     335  assert(source.m_uiNumPartition == m_uiNumPartition);
     336
     337  for ( Int partIdx = 0; partIdx < m_uiNumPartition; partIdx += numSubpartsWithIdenticalMotion )
     338  {
     339    TComMv cMv(0,0);
     340    Int iRefIdx = 0;
     341
     342    cMv = source.m_pcMv[ partIdx ];
     343    PredMode predMode = static_cast<PredMode>( pePredModeSource[ partIdx ] );
     344    iRefIdx = source.m_piRefIdx[ partIdx ];
     345    for ( Int i = 0; i < numSubpartsWithIdenticalMotion; i++ )
     346    {
     347      m_pcMv[ partIdx + i ] = cMv;
     348      pePredMode[ partIdx + i ] = predMode;
     349      m_piRefIdx[ partIdx + i ] = iRefIdx;
     350    }
     351  }
     352}
     353#else
    330354Void TComCUMvField::compress(SChar* pePredMode, Int scale)
    331355{
     
    349373  }
    350374}
     375#endif
    351376//! \}
  • branches/SHM-dev/source/Lib/TLibCommon/TComMotionInfo.h

    r1550 r1574  
    153153  }
    154154
     155#if REDUCED_ENCODER_MEMORY
     156  Void compress(SChar *pePredMode, const SChar* pePredModeSource, const Int scale, const TComCUMvField &source);
     157#else
    155158  Void compress(SChar* pePredMode, Int scale);
     159#endif
    156160
    157161#if SVC_EXTENSION
  • branches/SHM-dev/source/Lib/TLibCommon/TComPic.cpp

    r1550 r1574  
    7878}
    7979#if SVC_EXTENSION
     80#if REDUCED_ENCODER_MEMORY
     81Void TComPic::create( const TComSPS &sps, const TComPPS &pps, const Bool bCreateEncoderSourcePicYuv, const Bool bCreateForImmediateReconstruction, const UInt layerId )
     82#else
    8083Void TComPic::create( const TComSPS &sps, const TComPPS &pps, const Bool bIsVirtual, const UInt layerId )
     84#endif
    8185{
    8286  destroy();
     
    9296  m_layerId = layerId;
    9397
     98#if REDUCED_ENCODER_MEMORY
     99  m_picSym.create( sps, pps, uiMaxDepth, bCreateForImmediateReconstruction, layerId );
     100  if (bCreateEncoderSourcePicYuv)
     101#else
    94102  m_picSym.create( sps, pps, uiMaxDepth, layerId );
    95103
    96104  if (!bIsVirtual)
    97   {
    98     m_apcPicYuv[PIC_YUV_ORG]  = new TComPicYuv;  m_apcPicYuv[PIC_YUV_ORG]->create( iWidth, iHeight, chromaFormatIDC, uiMaxCuWidth, uiMaxCuHeight, uiMaxDepth, true, &conformanceWindow );
     105#endif
     106  {
     107    m_apcPicYuv[PIC_YUV_ORG     ]  = new TComPicYuv;  m_apcPicYuv[PIC_YUV_ORG     ]->create( iWidth, iHeight, chromaFormatIDC, uiMaxCuWidth, uiMaxCuHeight, uiMaxDepth, true, &conformanceWindow );
    99108    m_apcPicYuv[PIC_YUV_TRUE_ORG]  = new TComPicYuv;  m_apcPicYuv[PIC_YUV_TRUE_ORG]->create( iWidth, iHeight, chromaFormatIDC, uiMaxCuWidth, uiMaxCuHeight, uiMaxDepth, true, &conformanceWindow );
    100109  }
     110#if REDUCED_ENCODER_MEMORY
     111  if (bCreateForImmediateReconstruction)
     112  {
     113#endif
    101114  m_apcPicYuv[PIC_YUV_REC]  = new TComPicYuv;  m_apcPicYuv[PIC_YUV_REC]->create( iWidth, iHeight, chromaFormatIDC, uiMaxCuWidth, uiMaxCuHeight, uiMaxDepth, true, &conformanceWindow );
     115#if REDUCED_ENCODER_MEMORY
     116  }
     117#endif
    102118
    103119  for( Int i = 0; i < MAX_LAYERS; i++ )
     
    117133}
    118134#else
     135#if REDUCED_ENCODER_MEMORY
     136Void TComPic::create( const TComSPS &sps, const TComPPS &pps, const Bool bCreateEncoderSourcePicYuv, const Bool bCreateForImmediateReconstruction )
     137#else
    119138Void TComPic::create( const TComSPS &sps, const TComPPS &pps, const Bool bIsVirtual)
     139#endif
    120140{
    121141  destroy();
     
    128148  const UInt         uiMaxDepth      = sps.getMaxTotalCUDepth();
    129149
     150#if REDUCED_ENCODER_MEMORY
     151  m_picSym.create( sps, pps, uiMaxDepth, bCreateForImmediateReconstruction );
     152  if (bCreateEncoderSourcePicYuv)
     153#else
    130154  m_picSym.create( sps, pps, uiMaxDepth );
    131155  if (!bIsVirtual)
     156#endif
    132157  {
    133158    m_apcPicYuv[PIC_YUV_ORG    ]   = new TComPicYuv;  m_apcPicYuv[PIC_YUV_ORG     ]->create( iWidth, iHeight, chromaFormatIDC, uiMaxCuWidth, uiMaxCuHeight, uiMaxDepth, true );
    134159    m_apcPicYuv[PIC_YUV_TRUE_ORG]  = new TComPicYuv;  m_apcPicYuv[PIC_YUV_TRUE_ORG]->create( iWidth, iHeight, chromaFormatIDC, uiMaxCuWidth, uiMaxCuHeight, uiMaxDepth, true );
    135160  }
    136   m_apcPicYuv[PIC_YUV_REC]  = new TComPicYuv;  m_apcPicYuv[PIC_YUV_REC]->create( iWidth, iHeight, chromaFormatIDC, uiMaxCuWidth, uiMaxCuHeight, uiMaxDepth, true );
     161#if REDUCED_ENCODER_MEMORY
     162  if (bCreateForImmediateReconstruction)
     163  {
     164#endif
     165    m_apcPicYuv[PIC_YUV_REC]  = new TComPicYuv;  m_apcPicYuv[PIC_YUV_REC]->create( iWidth, iHeight, chromaFormatIDC, uiMaxCuWidth, uiMaxCuHeight, uiMaxDepth, true );
     166#if REDUCED_ENCODER_MEMORY
     167  }
     168#endif
    137169
    138170  // there are no SEI messages associated with this picture initially
     
    142174  }
    143175  m_bUsedByCurr = false;
     176}
     177#endif
     178
     179#if REDUCED_ENCODER_MEMORY
     180Void TComPic::prepareForEncoderSourcePicYuv()
     181{
     182  const TComSPS &sps=m_picSym.getSPS();
     183
     184  const ChromaFormat chromaFormatIDC = sps.getChromaFormatIdc();
     185  const Int          iWidth          = sps.getPicWidthInLumaSamples();
     186  const Int          iHeight         = sps.getPicHeightInLumaSamples();
     187  const UInt         uiMaxCuWidth    = sps.getMaxCUWidth();
     188  const UInt         uiMaxCuHeight   = sps.getMaxCUHeight();
     189  const UInt         uiMaxDepth      = sps.getMaxTotalCUDepth();
     190
     191  if (m_apcPicYuv[PIC_YUV_ORG    ]==NULL)
     192  {
     193    m_apcPicYuv[PIC_YUV_ORG    ]   = new TComPicYuv;  m_apcPicYuv[PIC_YUV_ORG     ]->create( iWidth, iHeight, chromaFormatIDC, uiMaxCuWidth, uiMaxCuHeight, uiMaxDepth, true );
     194  }
     195  if (m_apcPicYuv[PIC_YUV_TRUE_ORG    ]==NULL)
     196  {
     197    m_apcPicYuv[PIC_YUV_TRUE_ORG]  = new TComPicYuv;  m_apcPicYuv[PIC_YUV_TRUE_ORG]->create( iWidth, iHeight, chromaFormatIDC, uiMaxCuWidth, uiMaxCuHeight, uiMaxDepth, true );
     198  }
     199}
     200
     201Void TComPic::prepareForReconstruction()
     202{
     203  if (m_apcPicYuv[PIC_YUV_REC] == NULL)
     204  {
     205    const TComSPS &sps=m_picSym.getSPS();
     206    const ChromaFormat chromaFormatIDC = sps.getChromaFormatIdc();
     207    const Int          iWidth          = sps.getPicWidthInLumaSamples();
     208    const Int          iHeight         = sps.getPicHeightInLumaSamples();
     209    const UInt         uiMaxCuWidth    = sps.getMaxCUWidth();
     210    const UInt         uiMaxCuHeight   = sps.getMaxCUHeight();
     211    const UInt         uiMaxDepth      = sps.getMaxTotalCUDepth();
     212
     213    m_apcPicYuv[PIC_YUV_REC]  = new TComPicYuv;  m_apcPicYuv[PIC_YUV_REC]->create( iWidth, iHeight, chromaFormatIDC, uiMaxCuWidth, uiMaxCuHeight, uiMaxDepth, true );
     214  }
     215
     216  // mark it should be extended
     217  m_apcPicYuv[PIC_YUV_REC]->setBorderExtension(false);
     218
     219  m_picSym.prepareForReconstruction();
     220}
     221
     222Void TComPic::releaseReconstructionIntermediateData()
     223{
     224  m_picSym.releaseReconstructionIntermediateData();
     225}
     226
     227Void TComPic::releaseEncoderSourceImageData()
     228{
     229  if (m_apcPicYuv[PIC_YUV_ORG    ])
     230  {
     231    m_apcPicYuv[PIC_YUV_ORG]->destroy();
     232    delete m_apcPicYuv[PIC_YUV_ORG];
     233    m_apcPicYuv[PIC_YUV_ORG] = NULL;
     234  }
     235  if (m_apcPicYuv[PIC_YUV_TRUE_ORG    ])
     236  {
     237    m_apcPicYuv[PIC_YUV_TRUE_ORG]->destroy();
     238    delete m_apcPicYuv[PIC_YUV_TRUE_ORG];
     239    m_apcPicYuv[PIC_YUV_TRUE_ORG] = NULL;
     240  }
     241}
     242
     243Void TComPic::releaseAllReconstructionData()
     244{
     245  if (m_apcPicYuv[PIC_YUV_REC    ])
     246  {
     247    m_apcPicYuv[PIC_YUV_REC]->destroy();
     248    delete m_apcPicYuv[PIC_YUV_REC];
     249    m_apcPicYuv[PIC_YUV_REC] = NULL;
     250  }
     251  m_picSym.releaseAllReconstructionData();
    144252}
    145253#endif
  • branches/SHM-dev/source/Lib/TLibCommon/TComPic.h

    r1550 r1574  
    101101  virtual ~TComPic();
    102102
     103#if REDUCED_ENCODER_MEMORY
     104#if SVC_EXTENSION
     105  Void          create( const TComSPS &sps, const TComPPS &pps, const Bool bCreateEncoderSourcePicYuv, const Bool bCreateForImmediateReconstruction, const UInt layerId );
     106#else
     107  Void          create( const TComSPS &sps, const TComPPS &pps, const Bool bCreateEncoderSourcePicYuv, const Bool bCreateForImmediateReconstruction );
     108#endif
     109  Void          prepareForEncoderSourcePicYuv();
     110  Void          prepareForReconstruction();
     111  Void          releaseReconstructionIntermediateData();
     112  Void          releaseAllReconstructionData();
     113  Void          releaseEncoderSourceImageData();
     114#else
    103115#if SVC_EXTENSION
    104116  Void          create( const TComSPS &sps, const TComPPS &pps, const Bool bIsVirtual /*= false*/, const UInt layerId );
    105117#else
    106118  Void          create( const TComSPS &sps, const TComPPS &pps, const Bool bIsVirtual /*= false*/ );
     119#endif
    107120#endif
    108121
  • branches/SHM-dev/source/Lib/TLibCommon/TComPicSym.cpp

    r1550 r1574  
    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
     
    8386}
    8487
     88
    8589#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
    8693Void TComPicSym::create  ( const TComSPS &sps, const TComPPS &pps, UInt uiMaxDepth, const UInt layerId )
    87 {
     94#endif
     95{
     96#else
     97#if REDUCED_ENCODER_MEMORY
     98Void TComPicSym::create  ( const TComSPS &sps, const TComPPS &pps, UInt uiMaxDepth, const Bool bAllocateCtuArray )
    8899#else
    89100Void TComPicSym::create  ( const TComSPS &sps, const TComPPS &pps, UInt uiMaxDepth )
     101#endif
    90102{
    91103#endif
     
    95107  m_pps = pps;
    96108
     109#if !REDUCED_ENCODER_MEMORY
    97110  const ChromaFormat chromaFormatIDC = sps.getChromaFormatIdc();
     111#endif
    98112  const Int iPicWidth      = sps.getPicWidthInLumaSamples();
    99113  const Int iPicHeight     = sps.getPicHeightInLumaSamples();
     
    114128
    115129  m_numCtusInFrame     = m_frameWidthInCtus * m_frameHeightInCtus;
     130#if REDUCED_ENCODER_MEMORY
     131  m_pictureCtuArray    = NULL;
     132#else
    116133  m_pictureCtuArray    = new TComDataCU*[m_numCtusInFrame];
     134#endif
    117135
    118136  clearSliceBuffer();
     
    126144  if (m_pParentARLBuffer == NULL)
    127145  {
    128      m_pParentARLBuffer = new TCoeff[uiMaxCuWidth*uiMaxCuHeight*MAX_NUM_COMPONENT];
    129   }
    130 #endif
    131 
     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
    132156  for (UInt i=0; i<m_numCtusInFrame ; i++ )
    133157  {
     
    139163      );
    140164  }
     165#endif
    141166
    142167  m_ctuTsToRsAddrMap = new UInt[m_numCtusInFrame+1];
     
    164189}
    165190
    166 Void TComPicSym::destroy()
    167 {
    168   clearSliceBuffer();
    169 
     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{
    170231  if (m_pictureCtuArray)
    171232  {
     
    182243    m_pictureCtuArray = NULL;
    183244  }
     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
    184290
    185291  delete [] m_ctuTsToRsAddrMap;
  • branches/SHM-dev/source/Lib/TLibCommon/TComPicSym.h

    r1550 r1574  
    106106  UInt*         m_ctuRsToTsAddrMap;    ///< for a given RS (Raster-Scan) address, returns the TS (Tile-Scan; coding order) address. cf CtbAddrRsToTs in specification.
    107107
     108#if REDUCED_ENCODER_MEMORY
     109public:
     110  struct DPBPerCtuData
     111  {
     112    Bool isInter(const UInt absPartAddr)                const { return m_pePredMode[absPartAddr] == MODE_INTER; }
     113    PartSize getPartitionSize( const UInt absPartAddr ) const { return static_cast<PartSize>( m_pePartSize[absPartAddr] ); }
     114    const TComCUMvField* getCUMvField ( RefPicList e )  const { return &m_CUMvField[e];                  }
     115    const TComSlice* getSlice()                         const { return m_pSlice; }
     116
     117    SChar        * m_pePredMode;
     118    SChar        * m_pePartSize;
     119    TComCUMvField  m_CUMvField[NUM_REF_PIC_LIST_01];
     120    TComSlice    * m_pSlice;
     121  };
     122
     123private:
     124  DPBPerCtuData *m_dpbPerCtuData;
     125#endif
    108126  SAOBlkParam  *m_saoBlkParams;
    109127#if ADAPTIVE_QP_SELECTION
     
    130148public:
    131149#if SVC_EXTENSION
    132   Void               create  ( const TComSPS &sps, const TComPPS &pps, UInt uiMaxDepth, const UInt layerId );
     150#if REDUCED_ENCODER_MEMORY
     151Void               create  ( const TComSPS &sps, const TComPPS &pps, UInt uiMaxDepth, const Bool bAllocateCtuArray , const UInt layerId );
     152#else
     153Void               create  ( const TComSPS &sps, const TComPPS &pps, UInt uiMaxDepth, const UInt layerId );
     154#endif
    133155#if CGS_3D_ASYMLUT
    134156  TComPPS*           getPPSToUpdate()                                      { return &m_pps; }
    135157#endif
    136158#else
    137   Void               create  ( const TComSPS &sps, const TComPPS &pps, UInt uiMaxDepth );
     159#if REDUCED_ENCODER_MEMORY
     160Void               create  ( const TComSPS &sps, const TComPPS &pps, UInt uiMaxDepth, const Bool bAllocateCtuArray );
     161#else
     162Void               create  ( const TComSPS &sps, const TComPPS &pps, UInt uiMaxDepth );
     163#endif
     164#endif
     165#if REDUCED_ENCODER_MEMORY 
     166  Void               prepareForReconstruction();
     167  Void               releaseReconstructionIntermediateData();
     168  Void               releaseAllReconstructionData();
    138169#endif
    139170  Void               destroy ();
     
    153184  const TComSPS&     getSPS()                 const                        { return m_sps; }
    154185  const TComPPS&     getPPS()                 const                        { return m_pps; }
     186#if REDUCED_ENCODER_MEMORY
     187  Bool                 hasDPBPerCtuData() const                            { return (m_dpbPerCtuData!=0); };
     188  DPBPerCtuData&       getDPBPerCtuData(UInt ctuRsAddr)                    { return m_dpbPerCtuData[ctuRsAddr]; }
     189  const DPBPerCtuData& getDPBPerCtuData(UInt ctuRsAddr) const              { return m_dpbPerCtuData[ctuRsAddr]; }
     190#endif
    155191
    156192  TComSlice *        swapSliceObject(TComSlice* p, UInt i)                 { p->setSPS(&m_sps); p->setPPS(&m_pps); TComSlice *pTmp=m_apSlices[i];m_apSlices[i] = p; pTmp->setSPS(0); pTmp->setPPS(0); return pTmp; }
  • branches/SHM-dev/source/Lib/TLibCommon/TypeDef.h

    r1555 r1574  
    173173#define W0062_RECALCULATE_QP_TO_ALIGN_WITH_LAMBDA         0 ///< This recalculates QP to align with the derived lambda (same relation as for all intra coding is used). Currently disabled by default.
    174174#define OPTIONAL_RESET_SAO_ENCODING_AFTER_IRAP            1 ///< Adds command line option to reset SAO parameters after each IRAP.
     175#define REDUCED_ENCODER_MEMORY                            1 ///< When 1, the encoder will allocate TComPic memory when required and release it when no longer required.
    175176
    176177// ====================================================================================================================
  • branches/SHM-dev/source/Lib/TLibDecoder/TDecTop.cpp

    r1549 r1574  
    275275    }
    276276
     277#if REDUCED_ENCODER_MEMORY
     278    rpcPic->create ( sps, pps, false, true, m_layerId);
     279#else
    277280    rpcPic->create( sps, pps, true, m_layerId);
     281#endif
    278282#else //SVC_EXTENSION
     283#if REDUCED_ENCODER_MEMORY
     284    rpcPic->create ( sps, pps, false, true);
     285#else
    279286    rpcPic->create ( sps, pps, true);
     287#endif
    280288#endif //SVC_EXTENSION
    281289   
     
    323331    xSetRequireResamplingFlag( vps, sps, pps, rpcPic );
    324332  }
    325 
     333#if REDUCED_ENCODER_MEMORY
     334  rpcPic->create ( sps, pps, false, true, m_layerId);
     335#else
    326336  rpcPic->create( sps, pps, true, m_layerId);
     337#endif
    327338#else  //SVC_EXTENSION
     339#if REDUCED_ENCODER_MEMORY
     340  rpcPic->create ( sps, pps, false, true);
     341#else
    328342  rpcPic->create ( sps, pps, true);
     343#endif
    329344#endif //SVC_EXTENSION
    330345}
     
    522537        pBLPic->getPicSym()->inferSpsForNonHEVCBL(vps, sps->getMaxCUWidth(), sps->getMaxCUHeight());
    523538
     539#if REDUCED_ENCODER_MEMORY
     540        pBLPic->create( pBLPic->getPicSym()->getSPS(), *pps, true, true, refLayerId);
     541#else
    524542        pBLPic->create( pBLPic->getPicSym()->getSPS(), *pps, true, refLayerId);
     543#endif
    525544
    526545        // it is needed where the VPS is accessed through the slice
     
    22782297        m_cIlpPic[j] = new  TComPic;
    22792298
     2299#if REDUCED_ENCODER_MEMORY
     2300        m_cIlpPic[j]->create(*sps, *pps, true, false, m_layerId);
     2301#else
    22802302        m_cIlpPic[j]->create(*sps, *pps, true, m_layerId);
     2303#endif
    22812304
    22822305        for (Int i=0; i<m_cIlpPic[j]->getPicSym()->getNumberOfCtusInFrame(); i++)
  • branches/SHM-dev/source/Lib/TLibEncoder/TEncGOP.cpp

    r1572 r1574  
    14601460    xGetBuffer( rcListPic, rcListPicYuvRecOut, iNumPicRcvd, iTimeOffset, pcPic, pcPicYuvRecOut, pocCurr, isField );
    14611461
     1462#if REDUCED_ENCODER_MEMORY
     1463    pcPic->prepareForReconstruction();
     1464
     1465#endif
    14621466    //  Slice data initialization
    14631467    pcPic->clearSliceBuffer();
     
    28532857      iGOPid=effFieldIRAPMap.restoreGOPid(iGOPid);
    28542858    }
     2859#if REDUCED_ENCODER_MEMORY
     2860
     2861    pcPic->releaseReconstructionIntermediateData();
     2862    if (!isField) // don't release the source data for field-coding because the fields are dealt with in pairs. // TODO: release source data for interlace simulations.
     2863    {
     2864      pcPic->releaseEncoderSourceImageData();
     2865    }
     2866
     2867#endif
    28552868  } // iGOPid-loop
    28562869
  • branches/SHM-dev/source/Lib/TLibEncoder/TEncPic.cpp

    r1549 r1574  
    125125#if SVC_EXTENSION
    126126// * \param vps reference to used VPS
     127#if REDUCED_ENCODER_MEMORY
     128Void TEncPic::create( const TComVPS& vps, const TComSPS &sps, const TComPPS &pps, UInt uiMaxAdaptiveQPDepth, const UInt layerId )
     129{
     130  TComPic::create( sps, pps, true, false, layerId );
     131#else
    127132Void TEncPic::create( const TComVPS& vps, const TComSPS &sps, const TComPPS &pps, UInt uiMaxAdaptiveQPDepth, Bool bIsVirtual, const UInt layerId )
    128133{
    129134  TComPic::create( sps, pps, bIsVirtual, layerId );
     135#endif
     136#else
     137#if REDUCED_ENCODER_MEMORY
     138Void TEncPic::create( const TComSPS &sps, const TComPPS &pps, UInt uiMaxAdaptiveQPDepth )
     139{
     140  TComPic::create( sps, pps, true, false );
    130141#else
    131142Void TEncPic::create( const TComSPS &sps, const TComPPS &pps, UInt uiMaxAdaptiveQPDepth, Bool bIsVirtual )
    132143{
    133144  TComPic::create( sps, pps, bIsVirtual );
     145#endif
    134146#endif
    135147  const Int  iWidth      = sps.getPicWidthInLumaSamples();
  • branches/SHM-dev/source/Lib/TLibEncoder/TEncPic.h

    r1549 r1574  
    106106
    107107#if SVC_EXTENSION
     108#if REDUCED_ENCODER_MEMORY
     109  Void          create( const TComVPS &vps, const TComSPS &sps, const TComPPS &pps, UInt uiMaxAdaptiveQPDepth, const UInt layerId );
     110#else
    108111  Void          create( const TComVPS &vps, const TComSPS &sps, const TComPPS &pps, UInt uiMaxAdaptiveQPDepth, Bool bIsVirtual /* = false*/, const UInt layerId );
     112#endif
    109113#else  //SVC_EXTENSION
     114#if REDUCED_ENCODER_MEMORY
     115  Void          create( const TComSPS &sps, const TComPPS &pps, UInt uiMaxAdaptiveQPDepth );
     116#else
    110117  Void          create( const TComSPS &sps, const TComPPS &pps, UInt uiMaxAdaptiveQPDepth, Bool bIsVirtual /* = false*/ );
     118#endif
    111119#endif //SVC_EXTENSION
    112120
  • branches/SHM-dev/source/Lib/TLibEncoder/TEncTop.cpp

    r1570 r1574  
    532532           
    533533      pcField->getSlice(0)->setPOC( m_iPOCLast );        // superfluous?
     534#if !REDUCED_ENCODER_MEMORY
    534535      pcField->getPicYuvRec()->setBorderExtension(false);// where is this normally?
     536#endif
    535537
    536538      pcField->setTopField(isTopField);                  // interlaced requirement
     
    630632
    631633      pcField->getSlice(0)->setPOC( m_iPOCLast );        // superfluous?
     634#if !REDUCED_ENCODER_MEMORY
    632635      pcField->getPicYuvRec()->setBorderExtension(false);// where is this normally?
     636#endif
    633637
    634638      pcField->setTopField(isTopField);                  // interlaced requirement
     
    704708      }
    705709    }
     710#if REDUCED_ENCODER_MEMORY
     711    rpcPic->releaseAllReconstructionData();
     712    rpcPic->prepareForEncoderSourcePicYuv();
     713#endif
    706714  }
    707715  else
     
    748756        }
    749757      }
    750 
    751       pcEPic->create( m_cVPS, m_cSPS, m_cPPS, m_cPPS.getMaxCuDQPDepth()+1, false, m_layerId);
     758#if REDUCED_ENCODER_MEMORY
     759#else
     760      pcEPic->create( m_cVPS, m_cSPS, m_cPPS, m_cPPS.getMaxCuDQPDepth()+1, m_layerId);
     761#endif
    752762#else  //SVC_EXTENSION
     763#if REDUCED_ENCODER_MEMORY
     764      pcEPic->create( m_cSPS, m_cPPS, m_cPPS.getMaxCuDQPDepth()+1);
     765#else
    753766      pcEPic->create( m_cSPS, m_cPPS, m_cPPS.getMaxCuDQPDepth()+1, false);
     767#endif
    754768#endif //SVC_EXTENSION
    755769      rpcPic = pcEPic;
     
    794808      }
    795809
     810#if REDUCED_ENCODER_MEMORY
     811      rpcPic->create( m_cSPS, m_cPPS, true, false, m_layerId );
     812#else
    796813      rpcPic->create( m_cSPS, m_cPPS, false, m_layerId );
     814#endif
    797815#else  //SVC_EXTENSION
     816#if REDUCED_ENCODER_MEMORY
     817      rpcPic->create( m_cSPS, m_cPPS, true, false );
     818#else
    798819      rpcPic->create( m_cSPS, m_cPPS, false );
     820#endif     
    799821#endif //SVC_EXTENSION
    800822    }
     
    808830
    809831  rpcPic->getSlice(0)->setPOC( m_iPOCLast );
     832#if !REDUCED_ENCODER_MEMORY
    810833  // mark it should be extended
    811834  rpcPic->getPicYuvRec()->setBorderExtension(false);
     835#endif
    812836}
    813837
     
    17321756      {
    17331757        m_cIlpPic[j] = new TComPic;
     1758#if REDUCED_ENCODER_MEMORY
     1759        m_cIlpPic[j]->create(m_cSPS, m_cPPS, true, false, m_layerId);
     1760#else
    17341761        m_cIlpPic[j]->create(m_cSPS, m_cPPS, true, m_layerId);
     1762#endif
    17351763        for (Int i=0; i<m_cIlpPic[j]->getPicSym()->getNumberOfCtusInFrame(); i++)
    17361764        {
Note: See TracChangeset for help on using the changeset viewer.