Ignore:
Timestamp:
12 Apr 2018, 11:12:21 (7 years ago)
Author:
tech
Message:
  • Update HM-16.18
  • Cleanups
  • Encoder Extension

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/HTM-16.2-dev/source/Lib/TLibCommon/TComPic.cpp

    r1405 r1412  
    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 *
     
    7373    m_apcPicYuv[i]      = NULL;
    7474  }
    75 #if NH_3D_QTLPC
     75#if NH_3D
    7676  m_bReduceBitsQTL    = 0;
    77 #endif
    78 #if NH_3D_NBDV
    7977  m_iNumDdvCandPics   = 0;
    8078  m_eRapRefList       = REF_PIC_LIST_0;
     
    10098}
    10199
     100#if REDUCED_ENCODER_MEMORY
     101Void TComPic::create( const TComSPS &sps, const TComPPS &pps, const Bool bCreateEncoderSourcePicYuv, const Bool bCreateForImmediateReconstruction )
     102#else
    102103Void TComPic::create( const TComSPS &sps, const TComPPS &pps, const Bool bIsVirtual)
     104#endif
    103105{
    104106  destroy();
     
    111113  const UInt         uiMaxDepth      = sps.getMaxTotalCUDepth();
    112114
     115#if REDUCED_ENCODER_MEMORY
     116  m_picSym.create( sps, pps, uiMaxDepth, bCreateForImmediateReconstruction );
     117  if (bCreateEncoderSourcePicYuv)
     118#else
    113119  m_picSym.create( sps, pps, uiMaxDepth );
    114120  if (!bIsVirtual)
     121#endif
    115122  {
    116123    m_apcPicYuv[PIC_YUV_ORG    ]   = new TComPicYuv;  m_apcPicYuv[PIC_YUV_ORG     ]->create( iWidth, iHeight, chromaFormatIDC, uiMaxCuWidth, uiMaxCuHeight, uiMaxDepth, true );
    117124    m_apcPicYuv[PIC_YUV_TRUE_ORG]  = new TComPicYuv;  m_apcPicYuv[PIC_YUV_TRUE_ORG]->create( iWidth, iHeight, chromaFormatIDC, uiMaxCuWidth, uiMaxCuHeight, uiMaxDepth, true );
    118125  }
     126#if REDUCED_ENCODER_MEMORY
     127  if (bCreateForImmediateReconstruction)
     128  {
     129#endif
    119130  m_apcPicYuv[PIC_YUV_REC]  = new TComPicYuv;  m_apcPicYuv[PIC_YUV_REC]->create( iWidth, iHeight, chromaFormatIDC, uiMaxCuWidth, uiMaxCuHeight, uiMaxDepth, true );
     131#if REDUCED_ENCODER_MEMORY
     132  }
     133#endif
    120134
    121135  // there are no SEI messages associated with this picture initially
     
    125139  }
    126140  m_bUsedByCurr = false;
    127 
    128 #if H_3D_FCO
    129 /* initialize the texture to depth reference status */
    130   for (int j=0; j<2; j++)
    131   {
    132       for (int i=0; i<MAX_NUM_REF; i++)
    133       {
    134           m_aiTexToDepRef[j][i] = -1;
    135       }
    136   }
    137 #endif
    138 
    139 }
     141}
     142
     143#if REDUCED_ENCODER_MEMORY
     144Void TComPic::prepareForEncoderSourcePicYuv()
     145{
     146  const TComSPS &sps=m_picSym.getSPS();
     147
     148  const ChromaFormat chromaFormatIDC = sps.getChromaFormatIdc();
     149  const Int          iWidth          = sps.getPicWidthInLumaSamples();
     150  const Int          iHeight         = sps.getPicHeightInLumaSamples();
     151  const UInt         uiMaxCuWidth    = sps.getMaxCUWidth();
     152  const UInt         uiMaxCuHeight   = sps.getMaxCUHeight();
     153  const UInt         uiMaxDepth      = sps.getMaxTotalCUDepth();
     154
     155  if (m_apcPicYuv[PIC_YUV_ORG    ]==NULL)
     156  {
     157    m_apcPicYuv[PIC_YUV_ORG    ]   = new TComPicYuv;  m_apcPicYuv[PIC_YUV_ORG     ]->create( iWidth, iHeight, chromaFormatIDC, uiMaxCuWidth, uiMaxCuHeight, uiMaxDepth, true );
     158  }
     159  if (m_apcPicYuv[PIC_YUV_TRUE_ORG    ]==NULL)
     160  {
     161    m_apcPicYuv[PIC_YUV_TRUE_ORG]  = new TComPicYuv;  m_apcPicYuv[PIC_YUV_TRUE_ORG]->create( iWidth, iHeight, chromaFormatIDC, uiMaxCuWidth, uiMaxCuHeight, uiMaxDepth, true );
     162  }
     163}
     164
     165Void TComPic::prepareForReconstruction()
     166{
     167  if (m_apcPicYuv[PIC_YUV_REC] == NULL)
     168  {
     169    const TComSPS &sps=m_picSym.getSPS();
     170    const ChromaFormat chromaFormatIDC = sps.getChromaFormatIdc();
     171    const Int          iWidth          = sps.getPicWidthInLumaSamples();
     172    const Int          iHeight         = sps.getPicHeightInLumaSamples();
     173    const UInt         uiMaxCuWidth    = sps.getMaxCUWidth();
     174    const UInt         uiMaxCuHeight   = sps.getMaxCUHeight();
     175    const UInt         uiMaxDepth      = sps.getMaxTotalCUDepth();
     176
     177    m_apcPicYuv[PIC_YUV_REC]  = new TComPicYuv;  m_apcPicYuv[PIC_YUV_REC]->create( iWidth, iHeight, chromaFormatIDC, uiMaxCuWidth, uiMaxCuHeight, uiMaxDepth, true );
     178  }
     179
     180  // mark it should be extended
     181  m_apcPicYuv[PIC_YUV_REC]->setBorderExtension(false);
     182
     183  m_picSym.prepareForReconstruction();
     184}
     185
     186Void TComPic::releaseReconstructionIntermediateData()
     187{
     188  m_picSym.releaseReconstructionIntermediateData();
     189}
     190
     191Void TComPic::releaseEncoderSourceImageData()
     192{
     193  if (m_apcPicYuv[PIC_YUV_ORG    ])
     194  {
     195    m_apcPicYuv[PIC_YUV_ORG]->destroy();
     196    delete m_apcPicYuv[PIC_YUV_ORG];
     197    m_apcPicYuv[PIC_YUV_ORG] = NULL;
     198  }
     199  if (m_apcPicYuv[PIC_YUV_TRUE_ORG    ])
     200  {
     201    m_apcPicYuv[PIC_YUV_TRUE_ORG]->destroy();
     202    delete m_apcPicYuv[PIC_YUV_TRUE_ORG];
     203    m_apcPicYuv[PIC_YUV_TRUE_ORG] = NULL;
     204  }
     205}
     206
     207Void TComPic::releaseAllReconstructionData()
     208{
     209  if (m_apcPicYuv[PIC_YUV_REC    ])
     210  {
     211    m_apcPicYuv[PIC_YUV_REC]->destroy();
     212    delete m_apcPicYuv[PIC_YUV_REC];
     213    m_apcPicYuv[PIC_YUV_REC] = NULL;
     214  }
     215  m_picSym.releaseAllReconstructionData();
     216}
     217#endif
     218
    140219
    141220Void TComPic::destroy()
     
    156235}
    157236#if NH_3D
    158 #if NH_3D_ARP
    159237Void TComPic::getCUAddrAndPartIdx( Int iX, Int iY, Int& riCuAddr, Int& riAbsZorderIdx )
    160238{
     
    180258  riAbsZorderIdx      = g_auiRasterToZscan[ iRastPartIdx ];
    181259}
    182 #endif
    183260Void TComPic::compressMotion(Int scale)
    184261#else
     
    343420}
    344421
    345 #if NH_3D_NBDV
    346422Int TComPic::getDisCandRefPictures(Int iColPOC)
    347423{
     
    486562  TComSlice* pcCurrSlice = getSlice(getCurrSliceIdx());
    487563  TComPic* pcTextPic = pcCurrSlice->getIvPic(0, getViewIndex());
    488 #if H_3D_FCO
    489   if ( pcTextPic )
    490   {
    491 #endif
    492     TComSlice* pcTextSlice = pcTextPic->getSlice(0); // currently only support single slice
    493 
    494     for(Int iTextRefDir = 0; (iTextRefDir < (pcTextSlice->isInterB() ? 2 :1) ) && !pcTextSlice->isIntra(); iTextRefDir++)
    495     {
    496       for(Int iTextRefIdx =0; iTextRefIdx < pcTextSlice->getNumRefIdx((RefPicList)iTextRefDir); iTextRefIdx++)
    497       {
    498         Int iTextRefPOC    = pcTextSlice->getRefPOC((RefPicList)iTextRefDir, iTextRefIdx);
    499         Int iTextRefViewId = pcTextSlice->getRefPic((RefPicList)iTextRefDir, iTextRefIdx)->getViewIndex();
    500         m_aiTexToDepRef[iTextRefDir][iTextRefIdx] = -1;
    501         Int iCurrRefDir = iTextRefDir;
    502 
    503         for(Int iCurrRefIdx = 0; (iCurrRefIdx<pcCurrSlice->getNumRefIdx((RefPicList)iCurrRefDir)) && (m_aiTexToDepRef[iTextRefDir][iTextRefIdx] < 0); iCurrRefIdx++)
    504         {
    505           if(pcCurrSlice->getRefPOC((RefPicList)iCurrRefDir, iCurrRefIdx ) == iTextRefPOC &&
    506             pcCurrSlice->getRefPic((RefPicList)iCurrRefDir, iCurrRefIdx)->getViewIndex() == iTextRefViewId)
    507           { 
    508             m_aiTexToDepRef[iTextRefDir][iTextRefIdx] = iCurrRefIdx;           
    509           }
     564  TComSlice* pcTextSlice = pcTextPic->getSlice(0); // currently only support single slice
     565
     566  for(Int iTextRefDir = 0; (iTextRefDir < (pcTextSlice->isInterB() ? 2 :1) ) && !pcTextSlice->isIntra(); iTextRefDir++)
     567  {
     568    for(Int iTextRefIdx =0; iTextRefIdx < pcTextSlice->getNumRefIdx((RefPicList)iTextRefDir); iTextRefIdx++)
     569    {
     570      Int iTextRefPOC    = pcTextSlice->getRefPOC((RefPicList)iTextRefDir, iTextRefIdx);
     571      Int iTextRefViewId = pcTextSlice->getRefPic((RefPicList)iTextRefDir, iTextRefIdx)->getViewIndex();
     572      m_aiTexToDepRef[iTextRefDir][iTextRefIdx] = -1;
     573      Int iCurrRefDir = iTextRefDir;
     574
     575      for(Int iCurrRefIdx = 0; (iCurrRefIdx<pcCurrSlice->getNumRefIdx((RefPicList)iCurrRefDir)) && (m_aiTexToDepRef[iTextRefDir][iTextRefIdx] < 0); iCurrRefIdx++)
     576      {
     577        if(pcCurrSlice->getRefPOC((RefPicList)iCurrRefDir, iCurrRefIdx ) == iTextRefPOC &&
     578          pcCurrSlice->getRefPic((RefPicList)iCurrRefDir, iCurrRefIdx)->getViewIndex() == iTextRefViewId)
     579        { 
     580          m_aiTexToDepRef[iTextRefDir][iTextRefIdx] = iCurrRefIdx;           
    510581        }
    511582      }
    512583    }
    513 #if H_3D_FCO
    514   }
    515 #endif
     584  }
    516585}
    517586
     
    520589  return m_aiTexToDepRef[iTextRefDir][iTextRefIdx];
    521590}
    522 #endif
     591
    523592#endif
    524593
Note: See TracChangeset for help on using the changeset viewer.