diff --git a/source/Lib/CommonLib/Picture.cpp b/source/Lib/CommonLib/Picture.cpp index a52affd8b005e0739a2f1d45264b4413b2cd110e..1236c6bcce95fdad6cb5f9786b93d60b8cd12620 100644 --- a/source/Lib/CommonLib/Picture.cpp +++ b/source/Lib/CommonLib/Picture.cpp @@ -256,13 +256,6 @@ void Picture::destroy() m_hashMap.clearAll(); if (cs) { -#if JVET_Z0118_GDR - if (cs->picHeader) - { - delete cs->picHeader; - } - cs->picHeader = nullptr; -#endif cs->destroy(); delete cs; cs = nullptr; @@ -425,15 +418,31 @@ void Picture::finalInit( const VPS* vps, const SPS& sps, const PPS& pps, PicHead cs->picture = this; cs->slice = nullptr; // the slices for this picture have not been set at this point. update cs->slice after swapSliceObject() cs->pps = &pps; -#if JVET_Z0118_GDR - setCleanDirty(false); -#endif + picHeader->setSPSId( sps.getSPSId() ); picHeader->setPPSId( pps.getPPSId() ); + #if JVET_Z0118_GDR + setCleanDirty(false); + picHeader->setPic(this); -#endif + + PicHeader *ph = new PicHeader; + ph->initPicHeader(); + *ph = *picHeader; + ph->setPic(this); + + if (cs->picHeader) + { + delete cs->picHeader; + cs->picHeader = nullptr; + } + + cs->picHeader = ph; +#else cs->picHeader = picHeader; +#endif + memcpy(cs->alfApss, alfApss, sizeof(cs->alfApss)); cs->lmcsAps = lmcsAps; cs->scalinglistAps = scalingListAps; diff --git a/source/Lib/DecoderLib/DecLib.cpp b/source/Lib/DecoderLib/DecLib.cpp index 157df26e1967c7092a688ba8c8ff00829bc7b14b..b08e4ce0a940900a50f70dde9eb3ba0282b3d747 100644 --- a/source/Lib/DecoderLib/DecLib.cpp +++ b/source/Lib/DecoderLib/DecLib.cpp @@ -1735,18 +1735,11 @@ void DecLib::xActivateParameterSets( const InputNALUnit nalu ) m_pcPic = xGetNewPicBuffer( *sps, *pps, m_apcSlicePilot->getTLayer(), layerId ); m_apcSlicePilot->applyReferencePictureListBasedMarking( m_cListPic, m_apcSlicePilot->getRPL0(), m_apcSlicePilot->getRPL1(), layerId, *pps); -#if JVET_Z0118_GDR - PicHeader *picHeader = new PicHeader; -#if JVET_Z0118_GDR - picHeader->initPicHeader(); -#endif - - *picHeader = m_picHeader; - m_apcSlicePilot->setPicHeader(picHeader); - m_pcPic->finalInit(vps, *sps, *pps, picHeader, apss, lmcsAPS, scalinglistAPS); -#else + m_pcPic->finalInit( vps, *sps, *pps, &m_picHeader, apss, lmcsAPS, scalinglistAPS ); +#if JVET_Z0118_GDR + m_apcSlicePilot->setPicHeader(m_pcPic->cs->picHeader); #endif m_pcPic->createTempBuffers( m_pcPic->cs->pps->pcv->maxCUWidth ); @@ -1760,7 +1753,7 @@ void DecLib::xActivateParameterSets( const InputNALUnit nalu ) // we now have a real slice: Slice *pSlice = m_pcPic->slices[m_uiSliceSegmentIdx]; #if JVET_Z0118_GDR - pSlice->setPicHeader(picHeader); + pSlice->setPicHeader(m_pcPic->cs->picHeader); #endif // Update the PPS and SPS pointers with the ones of the picture. diff --git a/source/Lib/EncoderLib/EncLib.cpp b/source/Lib/EncoderLib/EncLib.cpp index d79986df4c95d8847f01dd0c5aa6c6278ed52c53..096b8dccfe8910fd46caad816ffbd52bc3e37aeb 100644 --- a/source/Lib/EncoderLib/EncLib.cpp +++ b/source/Lib/EncoderLib/EncLib.cpp @@ -557,13 +557,10 @@ void EncLib::init( bool isFieldCoding, AUWriterIf* auWriterIf ) sps0.getMaxCUWidth(), sps0.getMaxCUWidth() + 16, false, m_layerId, getGopBasedTemporalFilterEnabled() ); picBg->getRecoBuf().fill(0); -#if JVET_Z0118_GDR - PicHeader *picHeader = new PicHeader(); - xInitPicHeader(*picHeader, sps0, pps0); - picBg->finalInit( m_vps, sps0, pps0, picHeader, m_apss, m_lmcsAPS, m_scalinglistAPS ); -#else + picBg->finalInit( m_vps, sps0, pps0, &m_picHeader, m_apss, m_lmcsAPS, m_scalinglistAPS ); -#endif + + picBg->allocateNewSlice(); picBg->createSpliceIdx(pps0.pcv->sizeInCtus); m_cGOPEncoder.setPicBg(picBg); @@ -697,13 +694,9 @@ bool EncLib::encodePrep( bool flush, PelStorage* pcPicYuvOrg, PelStorage* cPicYu const SPS *sps = m_spsMap.getPS( pps->getSPSId() ); picCurr->M_BUFS( 0, PIC_ORIGINAL ).copyFrom( m_cGOPEncoder.getPicBg()->getRecoBuf() ); -#if JVET_Z0118_GDR - PicHeader *picHeader = new PicHeader(); - xInitPicHeader(*picHeader, *sps, *pps); - picCurr->finalInit( m_vps, *sps, *pps, picHeader, m_apss, m_lmcsAPS, m_scalinglistAPS ); -#else + picCurr->finalInit( m_vps, *sps, *pps, &m_picHeader, m_apss, m_lmcsAPS, m_scalinglistAPS ); -#endif + picCurr->poc = m_iPOCLast - 1; m_iPOCLast -= 2; if( getUseAdaptiveQP() ) @@ -839,13 +832,8 @@ bool EncLib::encodePrep( bool flush, PelStorage* pcPicYuvOrg, PelStorage* cPicYu } } -#if JVET_Z0118_GDR - PicHeader *picHeader = new PicHeader(); - xInitPicHeader(*picHeader, *pSPS, *pPPS); - pcPicCurr->finalInit( m_vps, *pSPS, *pPPS, picHeader, m_apss, m_lmcsAPS, m_scalinglistAPS ); -#else + pcPicCurr->finalInit( m_vps, *pSPS, *pPPS, &m_picHeader, m_apss, m_lmcsAPS, m_scalinglistAPS ); -#endif pcPicCurr->poc = m_iPOCLast; @@ -995,13 +983,7 @@ bool EncLib::encodePrep( bool flush, PelStorage* pcPicYuvOrg, PelStorage* pcPicY const PPS *pPPS = ( ppsID < 0 ) ? m_ppsMap.getFirstPS() : m_ppsMap.getPS( ppsID ); const SPS *pSPS = m_spsMap.getPS( pPPS->getSPSId() ); -#if JVET_Z0118_GDR - PicHeader *picHeader = new PicHeader(); - xInitPicHeader(*picHeader, *pSPS, *pPPS); - pcField->finalInit( m_vps, *pSPS, *pPPS, picHeader, m_apss, m_lmcsAPS, m_scalinglistAPS ); -#else pcField->finalInit( m_vps, *pSPS, *pPPS, &m_picHeader, m_apss, m_lmcsAPS, m_scalinglistAPS ); -#endif pcField->poc = m_iPOCLast; pcField->reconstructed = false;