Commit 2d967bd1 authored by Hendry's avatar Hendry

Implementation of APS

parent 1781a2f9
......@@ -859,6 +859,9 @@ void EncApp::rateStatsAccum(const AccessUnit& au, const std::vector<uint32_t>& a
#endif
case NAL_UNIT_SPS:
case NAL_UNIT_PPS:
#if JVET_M0132
case NAL_UNIT_APS:
#endif
m_essentialBytes += *it_stats;
break;
default:
......@@ -875,7 +878,11 @@ void EncApp::printRateSummary()
msg( DETAILS,"Bytes written to file: %u (%.3f kbps)\n", m_totalBytes, 0.008 * m_totalBytes / time );
if (m_summaryVerboseness > 0)
{
#if JVET_M0132
msg(DETAILS, "Bytes for SPS/PPS/APS/Slice (Incl. Annex B): %u (%.3f kbps)\n", m_essentialBytes, 0.008 * m_essentialBytes / time);
#else
msg( DETAILS,"Bytes for SPS/PPS/Slice (Incl. Annex B): %u (%.3f kbps)\n", m_essentialBytes, 0.008 * m_essentialBytes / time );
#endif
}
}
......
......@@ -221,6 +221,9 @@ const char * NALU_TYPE[] =
#endif
"SPS_NUT",
"PPS_NUT",
#if JVET_M0132
"APS_NUT",
#endif
"AUD_NUT",
"EOS_NUT",
"EOB_NUT",
......
......@@ -101,6 +101,9 @@ public:
bool isLossless;
const SPS *sps;
const PPS *pps;
#if JVET_M0132
APS * aps;
#endif
#if HEVC_VPS
const VPS *vps;
#endif
......
......@@ -186,6 +186,9 @@ static const int C2FLAG_NUMBER = 1; ///< maxi
static const int MAX_NUM_VPS = 16;
static const int MAX_NUM_SPS = 16;
static const int MAX_NUM_PPS = 64;
#if JVET_M0132
static const int MAX_NUM_APS = 32; //Currently APS ID has 5 bits
#endif
static const int MLS_GRP_NUM = 1024; ///< Max number of coefficient groups, max(16, 256)
......
......@@ -881,7 +881,11 @@ const CPelUnitBuf Picture::getRecoBuf(const UnitArea &unit) const { return g
PelUnitBuf Picture::getRecoBuf() { return M_BUFS(scheduler.getSplitPicId(), PIC_RECONSTRUCTION); }
const CPelUnitBuf Picture::getRecoBuf() const { return M_BUFS(scheduler.getSplitPicId(), PIC_RECONSTRUCTION); }
#if JVET_M0132
void Picture::finalInit(const SPS& sps, const PPS& pps, APS& aps)
#else
void Picture::finalInit( const SPS& sps, const PPS& pps )
#endif
{
for( auto &sei : SEIs )
{
......@@ -917,6 +921,9 @@ void Picture::finalInit( const SPS& sps, const PPS& pps )
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_M0132
cs->aps = &aps;
#endif
#if HEVC_VPS
cs->vps = nullptr;
#endif
......@@ -939,6 +946,9 @@ void Picture::allocateNewSlice()
slices.push_back(new Slice);
Slice& slice = *slices.back();
#if JVET_M0132
slice.setAPS(cs->aps);
#endif
slice.setPPS( cs->pps);
slice.setSPS( cs->sps);
if(slices.size()>=2)
......@@ -952,11 +962,17 @@ Slice *Picture::swapSliceObject(Slice * p, uint32_t i)
{
p->setSPS(cs->sps);
p->setPPS(cs->pps);
#if JVET_M0132
p->setAPS(cs->aps);
#endif
Slice * pTmp = slices[i];
slices[i] = p;
pTmp->setSPS(0);
pTmp->setPPS(0);
#if JVET_M0132
pTmp->setAPS(0);
#endif
return pTmp;
}
......
......@@ -233,7 +233,11 @@ struct Picture : public UnitArea
const CPelUnitBuf getBuf(const UnitArea &unit, const PictureType &type) const;
void extendPicBorder();
#if JVET_M0132
void finalInit(const SPS& sps, const PPS& pps, APS& aps);
#else
void finalInit( const SPS& sps, const PPS& pps );
#endif
int getPOC() const { return poc; }
void setBorderExtension( bool bFlag) { m_bIsBorderExtended = bFlag;}
......
......@@ -86,6 +86,9 @@ const char* nalUnitTypeToString(NalUnitType type)
#endif
case NAL_UNIT_SPS: return "SPS";
case NAL_UNIT_PPS: return "PPS";
#if JVET_M0132
case NAL_UNIT_APS: return "APS";
#endif
case NAL_UNIT_ACCESS_UNIT_DELIMITER: return "AUD";
case NAL_UNIT_EOS: return "EOS";
case NAL_UNIT_EOB: return "EOB";
......
......@@ -139,6 +139,10 @@ Slice::Slice()
, m_uiMaxBTSizeIChroma ( 0 )
, m_uiMaxTTSizeIChroma ( 0 )
, m_uiMaxBTSize ( 0 )
#if JVET_M0132
, m_iAPSId ( -1 )
, m_pcAPS (NULL)
#endif
, m_MotionCandLut (NULL)
#if JVET_M0170_MRG_SHARELIST
, m_MotionCandLuTsBkup (NULL)
......@@ -2102,6 +2106,16 @@ PPS::~PPS()
delete pcv;
}
#if JVET_M0132
APS::APS()
: m_APSId(0)
{
}
APS::~APS()
{
}
#endif
ReferencePictureSet::ReferencePictureSet()
: m_numberOfPictures (0)
, m_numberOfNegativePictures (0)
......@@ -2580,6 +2594,9 @@ ParameterSetManager::ParameterSetManager()
: m_spsMap(MAX_NUM_SPS)
#endif
, m_ppsMap(MAX_NUM_PPS)
#if JVET_M0132
, m_apsMap(MAX_NUM_APS)
#endif
#if HEVC_VPS
, m_activeVPSId(-1)
#endif
......@@ -2690,6 +2707,28 @@ bool ParameterSetManager::activatePPS(int ppsId, bool isIRAP)
return false;
}
#if JVET_M0132
bool ParameterSetManager::activateAPS(int apsId)
{
APS *aps = m_apsMap.getPS(apsId);
if (aps)
{
m_apsMap.setActive(apsId);
return true;
}
else
{
msg(WARNING, "Warning: tried to activate non-existing APS.");
}
return false;
}
template <>
void ParameterSetMap<APS>::setID(APS* parameterSet, const int psId)
{
parameterSet->setAPSId(psId);
}
#endif
template <>
void ParameterSetMap<PPS>::setID(PPS* parameterSet, const int psId)
{
......
......@@ -1573,6 +1573,24 @@ public:
PPSRExt& getPpsRangeExtension() { return m_ppsRangeExtension; }
};
#if JVET_M0132
class APS
{
private:
int m_APSId; // adaptation_parameter_set_id
AlfSliceParam m_alfAPSParam;
public:
APS();
virtual ~APS();
int getAPSId() const { return m_APSId; }
void setAPSId(int i) { m_APSId = i; }
void setAlfAPSParam(AlfSliceParam& alfAPSParam) { m_alfAPSParam = alfAPSParam; }
AlfSliceParam getAlfAPSParam() { return m_alfAPSParam; }
};
#endif
struct WPScalingParam
{
// Explicit weighted prediction parameters parsed in slice header,
......@@ -1730,6 +1748,10 @@ private:
uint32_t m_uiMaxTTSizeIChroma;
uint32_t m_uiMaxBTSize;
#if JVET_M0132
int m_iAPSId;
APS* m_pcAPS;
#endif
AlfSliceParam m_alfSliceParam;
LutMotionCand* m_MotionCandLut;
#if JVET_M0427_INLOOP_RESHAPER
......@@ -1756,6 +1778,12 @@ public:
void setPPSId( int PPSId ) { m_iPPSId = PPSId; }
int getPPSId() const { return m_iPPSId; }
#if JVET_M0132
void setAPS(APS* pcAPS) { m_pcAPS = pcAPS; m_iAPSId = (pcAPS) ? pcAPS->getAPSId() : -1; }
APS* getAPS() { return m_pcAPS; }
void setAPSId(int APSId) { m_iAPSId = APSId; }
int getAPSId() const { return m_iAPSId; }
#endif
void setPicOutputFlag( bool b ) { m_PicOutputFlag = b; }
bool getPicOutputFlag() const { return m_PicOutputFlag; }
void setSaoEnabledFlag(ChannelType chType, bool s) {m_saoEnabledFlag[chType] =s; }
......@@ -2239,6 +2267,14 @@ public:
//! \returns true, if activation is successful
bool activatePPS(int ppsId, bool isIRAP);
#if JVET_M0132
void storeAPS(APS *aps, const std::vector<uint8_t> &naluData) { m_apsMap.storePS(aps->getAPSId(), aps, &naluData); };
APS* getAPS(int apsId) { return m_apsMap.getPS(apsId); };
bool getAPSChangedFlag(int apsId) const { return m_apsMap.getChangedFlag(apsId); }
void clearAPSChangedFlag(int apsId) { m_apsMap.clearChangedFlag(apsId); }
APS* getFirstAPS() { return m_apsMap.getFirstPS(); };
bool activateAPS(int apsId);
#endif
#if HEVC_VPS
const VPS* getActiveVPS()const { return m_vpsMap.getPS(m_activeVPSId); };
#endif
......@@ -2250,6 +2286,9 @@ protected:
#endif
ParameterSetMap<SPS> m_spsMap;
ParameterSetMap<PPS> m_ppsMap;
#if JVET_M0132
ParameterSetMap<APS> m_apsMap;
#endif
#if HEVC_VPS
int m_activeVPSId; // -1 for nothing active
......
......@@ -328,6 +328,7 @@ typedef std::pair<int, int> TrCost;
#define X0038_LAMBDA_FROM_QP_CAPABILITY 1 ///< This approach derives lambda from QP+QPoffset+QPoffset2. QPoffset2 is derived from QP+QPoffset using a linear model that is clipped between 0 and 3.
// To use this capability enable config parameter LambdaFromQpEnable
#define JVET_M0132 1
// ====================================================================================================================
// Tool Switches
// ====================================================================================================================
......@@ -973,6 +974,9 @@ enum NalUnitType
#endif
NAL_UNIT_SPS, // 33
NAL_UNIT_PPS, // 34
#if JVET_M0132
NAL_UNIT_APS, //NAL unit type number needs to be reaaranged.
#endif
NAL_UNIT_ACCESS_UNIT_DELIMITER, // 35
NAL_UNIT_EOS, // 36
NAL_UNIT_EOB, // 37
......
......@@ -739,6 +739,13 @@ void DecLib::xActivateParameterSets()
{
if (m_bFirstSliceInPicture)
{
#if JVET_M0132
APS *aps = m_parameterSetManager.getAPS(m_apcSlicePilot->getAPSId()); // this is a temporary APS object. Do not store this value
if (m_apcSlicePilot->getAPSId() != -1)
{
CHECK(aps == 0, "No APS present");
}
#endif
const PPS *pps = m_parameterSetManager.getPPS(m_apcSlicePilot->getPPSId()); // this is a temporary PPS object. Do not store this value
CHECK(pps == 0, "No PPS present");
......@@ -771,7 +778,11 @@ void DecLib::xActivateParameterSets()
m_apcSlicePilot->applyReferencePictureSet(m_cListPic, m_apcSlicePilot->getRPS());
#if JVET_M0132
m_pcPic->finalInit(*sps, *pps, *aps);
#else
m_pcPic->finalInit( *sps, *pps );
#endif
m_pcPic->createTempBuffers( m_pcPic->cs->pps->pcv->maxCUWidth );
m_pcPic->cs->createCoeffs();
......@@ -785,6 +796,9 @@ void DecLib::xActivateParameterSets()
Slice *pSlice = m_pcPic->slices[m_uiSliceSegmentIdx];
// Update the PPS and SPS pointers with the ones of the picture.
#if JVET_M0132
aps= pSlice->getAPS();
#endif
pps=pSlice->getPPS();
sps=pSlice->getSPS();
......@@ -792,6 +806,9 @@ void DecLib::xActivateParameterSets()
m_pcPic->cs->slice = pSlice;
m_pcPic->cs->sps = sps;
m_pcPic->cs->pps = pps;
#if JVET_M0132
m_pcPic->cs->aps = aps;
#endif
#if HEVC_VPS
m_pcPic->cs->vps = pSlice->getVPS();
#endif
......@@ -863,11 +880,16 @@ void DecLib::xActivateParameterSets()
const SPS *sps = pSlice->getSPS();
const PPS *pps = pSlice->getPPS();
#if JVET_M0132
APS *aps = pSlice->getAPS();
#endif
// fix Parameter Sets, now that we have the real slice
m_pcPic->cs->slice = pSlice;
m_pcPic->cs->sps = sps;
m_pcPic->cs->pps = pps;
#if JVET_M0132
m_pcPic->cs->aps = aps;
#endif
#if HEVC_VPS
m_pcPic->cs->vps = pSlice->getVPS();
#endif
......@@ -882,6 +904,12 @@ void DecLib::xActivateParameterSets()
{
EXIT("Error - a new PPS has been decoded while processing a picture");
}
#if JVET_M0132
if (m_parameterSetManager.getAPSChangedFlag(aps->getAPSId()))
{
EXIT("Error - a new APS has been decoded while processing a picture");
}
#endif
xParsePrefixSEImessages();
......@@ -1046,6 +1074,13 @@ bool DecLib::xDecodeSlice(InputNALUnit &nalu, int &iSkipFrame, int iPOCLastDispl
int iMaxPOClsb = 1 << sps->getBitsForPOC();
m_apcSlicePilot->setPOC( m_apcSlicePilot->getPOC() & (iMaxPOClsb - 1) );
xUpdatePreviousTid0POC(m_apcSlicePilot);
#if JVET_M0132
if (m_apcSlicePilot->getAPSId() != -1)
{
APS *aps = m_parameterSetManager.getAPS(m_apcSlicePilot->getAPSId());
CHECK(aps == 0, "No APS present");
}
#endif
}
// Skip pictures due to random access
......@@ -1401,6 +1436,15 @@ void DecLib::xDecodePPS( InputNALUnit& nalu )
m_parameterSetManager.storePPS( pps, nalu.getBitstream().getFifo() );
}
#if JVET_M0132
void DecLib::xDecodeAPS(InputNALUnit& nalu)
{
APS* aps = new APS();
m_HLSReader.setBitstream(&nalu.getBitstream());
m_HLSReader.parseAPS(aps);
m_parameterSetManager.storeAPS(aps, nalu.getBitstream().getFifo());
}
#endif
bool DecLib::decode(InputNALUnit& nalu, int& iSkipFrame, int& iPOCLastDisplay)
{
bool ret;
......@@ -1426,6 +1470,11 @@ bool DecLib::decode(InputNALUnit& nalu, int& iSkipFrame, int& iPOCLastDisplay)
case NAL_UNIT_PPS:
xDecodePPS( nalu );
return false;
#if JVET_M0132
case NAL_UNIT_APS:
xDecodeAPS(nalu);
return false;
#endif
case NAL_UNIT_PREFIX_SEI:
// Buffer up prefix SEI messages until SPS of associated VCL is known.
......
......@@ -184,6 +184,9 @@ protected:
#endif
void xDecodeSPS( InputNALUnit& nalu );
void xDecodePPS( InputNALUnit& nalu );
#if JVET_M0132
void xDecodeAPS(InputNALUnit& nalu);
#endif
void xUpdatePreviousTid0POC( Slice *pSlice ) { if ((pSlice->getTLayer()==0) && (pSlice->isReferenceNalu() && (pSlice->getNalUnitType()!=NAL_UNIT_CODED_SLICE_RASL_R)&& (pSlice->getNalUnitType()!=NAL_UNIT_CODED_SLICE_RADL_R))) { m_prevTid0POC=pSlice->getPOC(); } }
void xParsePrefixSEImessages();
void xParsePrefixSEIsForUnknownVCLNal();
......
......@@ -91,6 +91,9 @@ void DecSlice::decompressSlice( Slice* slice, InputBitstream* bitstream )
cs.slice = slice;
cs.sps = sps;
cs.pps = slice->getPPS();
#if JVET_M0132
cs.aps = slice->getAPS();
#endif
#if HEVC_VPS
cs.vps = slice->getVPS();
#endif
......
......@@ -607,6 +607,48 @@ void HLSyntaxReader::parsePPS( PPS* pcPPS )
xReadRbspTrailingBits();
}
#if JVET_M0132
void HLSyntaxReader::parseAPS(APS* pcAPS)
{
uint32_t uiCode;
READ_CODE(5, uiCode, "adaptation_parameter_set_id");
pcAPS->setAPSId(uiCode);
uint32_t code = 1;
AlfSliceParam param = pcAPS->getAlfAPSParam();
param.enabledFlag[COMPONENT_Y] = true;
int alfChromaIdc = truncatedUnaryEqProb(3); //alf_chroma_idc
param.enabledFlag[COMPONENT_Cb] = alfChromaIdc >> 1;
param.enabledFlag[COMPONENT_Cr] = alfChromaIdc & 1;
xReadTruncBinCode(code, MAX_NUM_ALF_CLASSES); //number_of_filters_minus1
param.numLumaFilters = code + 1;
if (param.numLumaFilters > 1)
{
for (int i = 0; i < MAX_NUM_ALF_CLASSES; i++)
{
xReadTruncBinCode(code, param.numLumaFilters);
param.filterCoeffDeltaIdx[i] = code;
}
}
else
{
memset(param.filterCoeffDeltaIdx, 0, sizeof(param.filterCoeffDeltaIdx));
}
alfFilter(param, false);
if (alfChromaIdc)
{
alfFilter(param, true);
}
pcAPS->setAlfAPSParam(param);
xReadRbspTrailingBits();
}
#endif
void HLSyntaxReader::parseVUI(VUI* pcVUI, SPS *pcSPS)
{
#if ENABLE_TRACING
......@@ -1602,7 +1644,25 @@ void HLSyntaxReader::parseSliceHeader (Slice* pcSlice, ParameterSetManager *para
if( sps->getALFEnabledFlag() )
{
#if JVET_M0132
READ_FLAG(uiCode, "tile_group_alf_enabled_flag");
if (uiCode)
{
READ_CODE(5, uiCode, "tile_group_aps_id");
pcSlice->setAPSId(uiCode);
pcSlice->setAPS(parameterSetManager->getAPS(uiCode));
pcSlice->setAlfSliceParam(pcSlice->getAPS()->getAlfAPSParam());
pcSlice->getAlfSliceParam().enabledFlag[COMPONENT_Y] = true;
}
else
{
pcSlice->getAlfSliceParam().enabledFlag[COMPONENT_Y] = false;
pcSlice->getAlfSliceParam().enabledFlag[COMPONENT_Cb] = false;
pcSlice->getAlfSliceParam().enabledFlag[COMPONENT_Cr] = false;
}
#else
alf( pcSlice->getAlfSliceParam() );
#endif
}
if (pcSlice->getIdrPicFlag())
......@@ -2427,6 +2487,7 @@ bool HLSyntaxReader::xMoreRbspData()
return (cnt>0);
}
#if !JVET_M0132
void HLSyntaxReader::alf( AlfSliceParam& alfSliceParam )
{
uint32_t code;
......@@ -2465,6 +2526,7 @@ void HLSyntaxReader::alf( AlfSliceParam& alfSliceParam )
alfFilter( alfSliceParam, true );
}
}
#endif
int HLSyntaxReader::alfGolombDecode( const int k )
{
......
......@@ -149,6 +149,9 @@ public:
#endif
void parseSPS ( SPS* pcSPS );
void parsePPS ( PPS* pcPPS );
#if JVET_M0132
void parseAPS ( APS* pcAPS);
#endif
void parseVUI ( VUI* pcVUI, SPS* pcSPS );
void parsePTL ( PTL *rpcPTL, bool profilePresentFlag, int maxNumSubLayersMinus1 );
void parseProfileTier ( ProfileTierLevel *ptl, const bool bIsSubLayer );
......@@ -165,7 +168,9 @@ public:
#if JVET_M0427_INLOOP_RESHAPER
void parseReshaper ( SliceReshapeInfo& sliceReshaperInfo, const SPS* pcSPS, const bool isIntra );
#endif
#if !JVET_M0132
void alf( AlfSliceParam& alfSliceParam );
#endif
void alfFilter( AlfSliceParam& alfSliceParam, const bool isChroma );
private:
......
......@@ -237,6 +237,16 @@ int EncGOP::xWritePPS (AccessUnit &accessUnit, const PPS *pps)
return (int)(accessUnit.back()->m_nalUnitData.str().size()) * 8;
}
#if JVET_M0132
int EncGOP::xWriteAPS(AccessUnit &accessUnit, APS *aps)
{
OutputNALUnit nalu(NAL_UNIT_APS);
m_HLSWriter->setBitstream(&nalu.m_Bitstream);
m_HLSWriter->codeAPS(aps);
accessUnit.push_back(new NALUnitEBSP(nalu));
return (int)(accessUnit.back()->m_nalUnitData.str().size()) * 8;
}
#endif
int EncGOP::xWriteParameterSets (AccessUnit &accessUnit, Slice *slice, const bool bSeqFirst)
{
......@@ -2545,6 +2555,14 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic,
{
xWriteAccessUnitDelimiter(accessUnit, pcSlice);
}
#if JVET_M0132
if (pcSlice->getSPS()->getALFEnabledFlag() && pcSlice->getAlfSliceParam().enabledFlag[COMPONENT_Y])
{
pcSlice->setAPSId(pcSlice->getAPS()->getAPSId());
pcSlice->getAPS()->setAlfAPSParam(pcSlice->getAlfSliceParam());
actualTotalBits += xWriteAPS(accessUnit, pcSlice->getAPS());
}
#endif
// reset presence of BP SEI indication
m_bufferingPeriodSEIPresentInAU = false;
......
......@@ -281,6 +281,9 @@ protected:
#endif
int xWriteSPS (AccessUnit &accessUnit, const SPS *sps);
int xWritePPS (AccessUnit &accessUnit, const PPS *pps);
#if JVET_M0132
int xWriteAPS(AccessUnit &accessUnit, APS *aps);
#endif
int xWriteParameterSets (AccessUnit &accessUnit, Slice *slice, const bool bSeqFirst);
void applyDeblockingFilterMetric( Picture* pcPic, uint32_t uiNumSlices );
......
......@@ -60,6 +60,9 @@
EncLib::EncLib()
: m_spsMap( MAX_NUM_SPS )
, m_ppsMap( MAX_NUM_PPS )
#if JVET_M0132
, m_apsMap( MAX_NUM_APS )
#endif
, m_AUWriterIf( nullptr )
#if JVET_J0090_MEMORY_BANDWITH_MEASURE
, m_cacheModel()
......@@ -214,6 +217,9 @@ void EncLib::init( bool isFieldCoding, AUWriterIf* auWriterIf )
SPS &sps0=*(m_spsMap.allocatePS(0)); // NOTE: implementations that use more than 1 SPS need to be aware of activation issues.
PPS &pps0=*(m_ppsMap.allocatePS(0));
#if JVET_M0132
APS &aps0=*(m_apsMap.allocatePS(0));
#endif
// initialize SPS
xInitSPS(sps0);
......@@ -251,6 +257,10 @@ void EncLib::init( bool isFieldCoding, AUWriterIf* auWriterIf )
// initialize PPS
xInitPPS(pps0, sps0);
#if JVET_M0132
// initialize APS
xInitAPS(aps0);
#endif
xInitRPS(sps0, isFieldCoding);
#if ER_CHROMA_QP_WCG_PPS
......@@ -376,7 +386,11 @@ void EncLib::init( bool isFieldCoding, AUWriterIf* auWriterIf )
Picture *picBg = new Picture;
picBg->create(sps0.getChromaFormatIdc(), Size(sps0.getPicWidthInLumaSamples(), sps0.getPicHeightInLumaSamples()), sps0.getMaxCUWidth(), sps0.getMaxCUWidth() + 16, false);
picBg->getRecoBuf().fill(0);
#if JVET_M0132
picBg->finalInit(sps0, pps0, aps0);
#else
picBg->finalInit(sps0, pps0);
#endif
picBg->allocateNewSlice();
picBg->createSpliceIdx(pps0.pcv->sizeInCtus);
m_cGOPEncoder.setPicBg(picBg);
......@@ -527,7 +541,12 @@ void EncLib::encode( bool flush, PelStorage* pcPicYuvOrg, PelStorage* cPicYuvTru
const SPS *sps = m_spsMap.getPS(pps->getSPSId());
picCurr->M_BUFS(0, PIC_ORIGINAL).copyFrom(m_cGOPEncoder.getPicBg()->getRecoBuf());
#if JVET_M0132
APS *aps = m_apsMap.getPS(0);
picCurr->finalInit(*sps, *pps, *aps);
#else
picCurr->finalInit(*sps, *pps);
#endif
picCurr->poc = m_iPOCLast - 1;
m_iPOCLast -= 2;
if (getUseAdaptiveQP())
......@@ -578,7 +597,12 @@ void EncLib::encode( bool flush, PelStorage* pcPicYuvOrg, PelStorage* cPicYuvTru
pcPicCurr->M_BUFS( 0, PIC_TRUE_ORIGINAL).swap(*cPicYuvTrueOrg);
#endif
#if JVET_M0132
APS *pAPS = m_apsMap.getPS(0);
pcPicCurr->finalInit(*pSPS, *pPPS, *pAPS);
#else
pcPicCurr->finalInit( *pSPS, *pPPS );
#endif
}
pcPicCurr->poc = m_iPOCLast;
......@@ -673,7 +697,12 @@ void EncLib::encode( bool flush, PelStorage* pcPicYuvOrg, PelStorage* pcPicYuvTr
const PPS *pPPS=(ppsID<0) ? m_ppsMap.getFirstPS() : m_ppsMap.getPS(ppsID);
const SPS *pSPS=m_spsMap.getPS(pPPS->getSPSId());
#if JVET_M0132
APS *pAPS = m_apsMap.getPS(0);
pcField->finalInit(*pSPS, *pPPS, *pAPS);
#else
pcField->finalInit( *pSPS, *pPPS );
#endif
}
pcField->poc = m_iPOCLast;
......@@ -1492,6 +1521,12 @@ void EncLib::xInitPPS(PPS &pps, const SPS &sps)
pps.pcv = new PreCalcValues( sps, pps, true );
}
#if JVET_M0132
void EncLib::xInitAPS(APS &aps)
{
//Do nothing now
}
#endif
//Function for initializing m_RPSList, a list of ReferencePictureSet, based on the GOPEntry objects read from the config file.
void EncLib::xInitRPS(SPS &sps, bool isFieldCoding)
{
......@@ -1864,6 +1899,14 @@ void EncLib::setParamSetChanged(int spsId, int ppsId)
m_spsMap.setChangedFlag(spsId);
}
#endif
#if JVET_M0132
bool EncLib::APSNeedsWriting(int apsId)
{
bool bChanged = m_apsMap.getChangedFlag(apsId);
m_apsMap.clearChangedFlag(apsId);
return bChanged;
}
#endif
bool EncLib::PPSNeedsWriting(int ppsId)