diff --git a/source/Lib/CommonLib/InterPrediction.cpp b/source/Lib/CommonLib/InterPrediction.cpp index 0582e3dce2ffcc0c8a7fce19b0694f43f50b84a8..2927a3cc2d4f8ee19efe0575358810f68d10d17a 100644 --- a/source/Lib/CommonLib/InterPrediction.cpp +++ b/source/Lib/CommonLib/InterPrediction.cpp @@ -16049,8 +16049,8 @@ void InterPrediction::deriveMVDcandAffine(const PredictionUnit& pu, RefPicList e const UnitArea blkUnitAreaBuff, PelStorage *pCurBuffYUV) { const int ctuSize = slice.getSPS()->getMaxCUWidth(); - const int iWidthFrm = slice.getSPS()->getMaxPicWidthInLumaSamples(); - const int iHeightFrm = slice.getSPS()->getMaxPicHeightInLumaSamples(); + const int iWidthFrm = slice.getPPS()->getPicWidthInLumaSamples(); + const int iHeightFrm = slice.getPPS()->getPicHeightInLumaSamples(); const int numCtuInWidth = iWidthFrm / ctuSize + (iWidthFrm % ctuSize != 0); const int numCtuInHeight = iHeightFrm / ctuSize + (iHeightFrm % ctuSize != 0); const int xBlkBoundIdx = (iWidthFrm % ctuSize) == 0 ? (ctuSize / 4 - 1) : ((iWidthFrm % ctuSize) / 4) - 1; @@ -16162,7 +16162,7 @@ void InterPrediction::deriveMVDcandAffine(const PredictionUnit& pu, RefPicList e validPadSize = (((subBlkMv[useList].getVer() >> iMVBitShift) + 3) >> 2) << 2; if (subBlkMv[useList].getVer() > 0 - && !slice.getRefPic((useList == 1) ? REF_PIC_LIST_1 : REF_PIC_LIST_0, reflistIdx[useList])->cs->slice->isIntra() + && !slice.getRefPic((useList == 1) ? REF_PIC_LIST_1 : REF_PIC_LIST_0, reflistIdx[useList])->unscaledPic->cs->slice->isIntra() && slice.getTLayer() >= PAD_MORE_TL) { validPadSize = std::max(validPadSize, 4); @@ -16179,7 +16179,7 @@ void InterPrediction::deriveMVDcandAffine(const PredictionUnit& pu, RefPicList e validPadSize = (((-subBlkMv[useList].getVer() >> iMVBitShift) + 3) >> 2) << 2; if (subBlkMv[useList].getVer() < 0 - && !slice.getRefPic((useList == 1) ? REF_PIC_LIST_1 : REF_PIC_LIST_0, reflistIdx[useList])->cs->slice->isIntra() + && !slice.getRefPic((useList == 1) ? REF_PIC_LIST_1 : REF_PIC_LIST_0, reflistIdx[useList])->unscaledPic->cs->slice->isIntra() && slice.getTLayer() >= PAD_MORE_TL) { validPadSize = std::max(validPadSize, 4); @@ -16195,7 +16195,7 @@ void InterPrediction::deriveMVDcandAffine(const PredictionUnit& pu, RefPicList e validPadSize = (((subBlkMv[useList].getHor() >> iMVBitShift) + 3) >> 2) << 2; if (subBlkMv[useList].getHor() > 0 - && !slice.getRefPic((useList == 1) ? REF_PIC_LIST_1 : REF_PIC_LIST_0, reflistIdx[useList])->cs->slice->isIntra() + && !slice.getRefPic((useList == 1) ? REF_PIC_LIST_1 : REF_PIC_LIST_0, reflistIdx[useList])->unscaledPic->cs->slice->isIntra() && slice.getTLayer() >= PAD_MORE_TL) { validPadSize = std::max(validPadSize, 4); @@ -16212,7 +16212,7 @@ void InterPrediction::deriveMVDcandAffine(const PredictionUnit& pu, RefPicList e validPadSize = (((-subBlkMv[useList].getHor() >> iMVBitShift) + 3) >> 2) << 2; if (subBlkMv[useList].getHor() < 0 - && !slice.getRefPic((useList == 1) ? REF_PIC_LIST_1 : REF_PIC_LIST_0, reflistIdx[useList])->cs->slice->isIntra() + && !slice.getRefPic((useList == 1) ? REF_PIC_LIST_1 : REF_PIC_LIST_0, reflistIdx[useList])->unscaledPic->cs->slice->isIntra() && slice.getTLayer() >= PAD_MORE_TL) { validPadSize = std::max(validPadSize, 4); @@ -16546,8 +16546,8 @@ void InterPrediction::deriveMVDcandAffine(const PredictionUnit& pu, RefPicList e const ComponentID ch = ComponentID(chan); Pel * piTxtRec = pcCurPic->getBuf(ch, PIC_RECONSTRUCTION).bufAt(0, 0); const int iStrideRec = pcCurPic->getBuf(ch, PIC_RECONSTRUCTION).stride; - const int iWidthFrm = slice.getSPS()->getMaxPicWidthInLumaSamples() >> getComponentScaleX(ch, CHROMA_420); - const int iHeightFrm = slice.getSPS()->getMaxPicHeightInLumaSamples() >> getComponentScaleY(ch, CHROMA_420); + const int iWidthFrm = slice.getPPS()->getPicWidthInLumaSamples() >> getComponentScaleX(ch, CHROMA_420); + const int iHeightFrm = slice.getPPS()->getPicHeightInLumaSamples() >> getComponentScaleY(ch, CHROMA_420); int ctuSize = slice.getSPS()->getMaxCUWidth() >> getComponentScaleX(ch, CHROMA_420); int extPadSizeX = (16 + MC_PAD_SIZE) >> getComponentScaleX(ch, CHROMA_420); int extPadSizeY = (16 + MC_PAD_SIZE) >> getComponentScaleY(ch, CHROMA_420); diff --git a/source/Lib/EncoderLib/EncGOP.cpp b/source/Lib/EncoderLib/EncGOP.cpp index 50829dbea8b7dd94c3e392d455e0d42d57b5d066..5c5164467b90833febeb5e4db49f7969be909649 100644 --- a/source/Lib/EncoderLib/EncGOP.cpp +++ b/source/Lib/EncoderLib/EncGOP.cpp @@ -3281,6 +3281,14 @@ void EncGOP::compressGOP(int iPOCLast, int iNumPicRcvd, PicList &rcListPic, std: #if JVET_AA0095_ALF_WITH_SAMPLES_BEFORE_DBF if (pcSlice->getSPS()->getALFEnabledFlag()) { + // create ALF object based on the picture size + Size alfSize = m_pcALF->getAlfSize(); + if (alfSize.width != picWidth || alfSize.height != picHeight) + { + m_pcALF->destroy(); + m_pcALF->create(m_pcCfg, picWidth, picHeight, chromaFormatIDC, maxCUWidth, maxCUHeight, maxTotalCUDepth, m_pcCfg->getBitDepth(), m_pcCfg->getInputBitDepth()); + } + m_pcALF->copyDbData(cs); } #endif @@ -3455,7 +3463,7 @@ void EncGOP::compressGOP(int iPOCLast, int iNumPicRcvd, PicList &rcListPic, std: m_pcSAO->jointClipSaoBifCcSao( cs ); #endif -#if RPR_ENABLE +#if RPR_ENABLE && !JVET_AA0095_ALF_WITH_SAMPLES_BEFORE_DBF // create ALF object based on the picture size if ( pcSlice->getSPS()->getALFEnabledFlag() ) {