diff --git a/source/App/DecoderApp/DecApp.cpp b/source/App/DecoderApp/DecApp.cpp index 300086069ed530ba808c673b3ba57558c56e036d..940398c6bb8050985768b2ae48399776a6857d18 100644 --- a/source/App/DecoderApp/DecApp.cpp +++ b/source/App/DecoderApp/DecApp.cpp @@ -377,12 +377,11 @@ uint32_t DecApp::decode() Picture *pcPic = *(iterPic++); pcPic->neededForOutput = true; -#if !JVET_Z0118_GDR // To disable output pictures in gdr interval + // To disable output pictures in gdr interval if (pcPic->layerId == nalu.m_nuhLayerId) { pcPic->neededForOutput = false; } -#endif } } #endif diff --git a/source/Lib/CommonLib/AdaptiveLoopFilter.cpp b/source/Lib/CommonLib/AdaptiveLoopFilter.cpp index 7bafe8e6ee6d23ce31f83f92021eb7ede179d722..416faa7e1d2efa569443f6198e4f790d9f5b5e1a 100644 --- a/source/Lib/CommonLib/AdaptiveLoopFilter.cpp +++ b/source/Lib/CommonLib/AdaptiveLoopFilter.cpp @@ -344,6 +344,10 @@ void AdaptiveLoopFilter::applyCcAlfFilter(CodingStructure &cs, ComponentID compI int verVirBndryPos[] = { 0, 0, 0 }; int ctuIdx = 0; + + const int chromaScaleX = getComponentScaleX( compID, m_chromaFormat ); + const int chromaScaleY = getComponentScaleY( compID, m_chromaFormat ); + for( int yPos = 0; yPos < m_picHeight; yPos += m_maxCUHeight ) { for( int xPos = 0; xPos < m_picWidth; xPos += m_maxCUWidth ) @@ -364,8 +368,6 @@ void AdaptiveLoopFilter::applyCcAlfFilter(CodingStructure &cs, ComponentID compI const int width = (xPos + m_maxCUWidth > m_picWidth) ? (m_picWidth - xPos) : m_maxCUWidth; const int height = (yPos + m_maxCUHeight > m_picHeight) ? (m_picHeight - yPos) : m_maxCUHeight; - const int chromaScaleX = getComponentScaleX(compID, m_chromaFormat); - const int chromaScaleY = getComponentScaleY(compID, m_chromaFormat); int rasterSliceAlfPad = 0; if (isCrossedByVirtualBoundaries(cs, xPos, yPos, width, height, clipTop, clipBottom, clipLeft, clipRight, @@ -1476,9 +1478,12 @@ void AdaptiveLoopFilter::calcClass(AlfClassifier **classifier, const Area &blkDs int transposeIdx = transposeTable[mainDirection * 2 + (secondaryDirection >> 1)]; #if JVET_Z0105_LOOP_FILTER_VIRTUAL_BOUNDARY - for (int ii = blkDst.pos().y + i; ii < blkDst.pos().y + i + subBlkSize; ii++) + int posYDst = blkDst.pos().y; + int posXDst = blkDst.pos().x; + + for (int ii = posYDst + i; ii < posYDst + i + subBlkSize; ii++) { - for (int jj = blkDst.pos().x + j; jj < blkDst.pos().x + j + subBlkSize; jj++) + for (int jj = posXDst + j; jj < posXDst + j + subBlkSize; jj++) { #else for (int ii = curBlk.y + i; ii < curBlk.y + i + subBlkSize; ii++) diff --git a/source/Lib/CommonLib/BilateralFilter.cpp b/source/Lib/CommonLib/BilateralFilter.cpp index ca9dca23e1e9f3390603198e8d508c35f2d185f5..7a2d4fbe9fe46e52641b3a6f2f29f51a20b0d051 100644 --- a/source/Lib/CommonLib/BilateralFilter.cpp +++ b/source/Lib/CommonLib/BilateralFilter.cpp @@ -2548,7 +2548,7 @@ void BilateralFilter::bilateralFilterPicRDOperCTU(CodingStructure& cs, PelUnitBu ctuArea = clipArea(ctuArea, *cs.slice->getPic()); PelBuf piOrg = cs.getOrgBuf(ctuArea).Y(); PelBuf piSrc = src.subBuf(ctuArea).Y(); - double MSEnoBIF = getDist(piSrc, piOrg); + double mseNoBIF = getDist(piSrc, piOrg); for (auto &currCU : cs.traverseCUs(CS::getArea(cs, ctuArea, CH_L), CH_L)) { @@ -2590,17 +2590,17 @@ void BilateralFilter::bilateralFilterPicRDOperCTU(CodingStructure& cs, PelUnitBu } PelBuf piRec = rec.subBuf(ctuArea).Y(); - double MSEafterBIF = getDist(piRec, piOrg); - frameMSEnoBIF += MSEnoBIF; - frameMSEallBIF += MSEafterBIF; - if(MSEnoBIF<MSEafterBIF) + double mseAfterBIF = getDist(piRec, piOrg); + frameMSEnoBIF += mseNoBIF; + frameMSEallBIF += mseAfterBIF; + if( mseNoBIF < mseAfterBIF ) { - frameMSEswitchBIF += MSEnoBIF; + frameMSEswitchBIF += mseNoBIF; bifParams.ctuOn[ctuIdx] = 0; } else { - frameMSEswitchBIF += MSEafterBIF; + frameMSEswitchBIF += mseAfterBIF; bifParams.ctuOn[ctuIdx] = 1; } @@ -2902,6 +2902,11 @@ void BilateralFilter::bilateralFilterPicRDOperCTUChroma(CodingStructure& cs, Pel ChromaBifParams& chromaBifParams = cs.picture->getChromaBifParam(); int ctuIdx = 0; +#if JVET_Z0105_LOOP_FILTER_VIRTUAL_BOUNDARY + const int chromaScaleX = getChannelTypeScaleX( CHANNEL_TYPE_CHROMA, cs.pcv->chrFormat ); + const int chromaScaleY = getChannelTypeScaleY( CHANNEL_TYPE_CHROMA, cs.pcv->chrFormat ); +#endif + for (int y = 0; y < pcv.heightInCtus; y++) { for (int x = 0; x < pcv.widthInCtus; x++) @@ -2954,8 +2959,6 @@ void BilateralFilter::bilateralFilterPicRDOperCTUChroma(CodingStructure& cs, Pel int verVirBndryPos[] = { 0, 0, 0 }; CompArea &myArea = (isCb ? currTU.block(COMPONENT_Cb) : currTU.block(COMPONENT_Cr)); - const int chromaScaleX = getComponentScaleX(COMPONENT_Cb, currTU.cu->cs->pcv->chrFormat); - const int chromaScaleY = getComponentScaleY(COMPONENT_Cb, currTU.cu->cs->pcv->chrFormat); int yPos = myArea.y << chromaScaleY; int xPos = myArea.x << chromaScaleX; bool isTUCrossedByVirtualBoundaries = isCrossedByVirtualBoundaries( @@ -3141,7 +3144,7 @@ void BilateralFilter::bilateralFilterPicRDOperCTUChroma(CodingStructure& cs, Pel } #if JVET_W0066_CCSAO -void BilateralFilter::bilateralFilterDiamond5x5NoClipChroma(const CPelUnitBuf& src, PelUnitBuf& rec, int32_t qp, const ClpRng& clpRng, TransformUnit & currTU, bool isCb +void BilateralFilter::bilateralFilterDiamond5x5NoClipChroma(const CPelUnitBuf& src, PelUnitBuf& rec, int32_t qp, const ClpRng& clpRng, TransformUnit& currTU, bool isCb #if JVET_Z0105_LOOP_FILTER_VIRTUAL_BOUNDARY , bool isTUCrossedByVirtualBoundaries, int horVirBndryPos[], int verVirBndryPos[], int numHorVirBndry, int numVerVirBndry , bool clipTop, bool clipBottom, bool clipLeft, bool clipRight @@ -3149,12 +3152,15 @@ void BilateralFilter::bilateralFilterDiamond5x5NoClipChroma(const CPelUnitBuf& s ) { #if JVET_Z0105_LOOP_FILTER_VIRTUAL_BOUNDARY + const int chromaScaleX = getChannelTypeScaleX( CHANNEL_TYPE_CHROMA, currTU.cu->cs->pcv->chrFormat ); + const int chromaScaleY = getChannelTypeScaleY( CHANNEL_TYPE_CHROMA, currTU.cu->cs->pcv->chrFormat ); + const uint32_t picWidthChroma = currTU.cu->slice->getPPS()->getPicWidthInLumaSamples() >> chromaScaleX; + const uint32_t picHeightChroma = currTU.cu->slice->getPPS()->getPicHeightInLumaSamples() >> chromaScaleY; + if (isTUCrossedByVirtualBoundaries) { ComponentID compID = isCb ? COMPONENT_Cb : COMPONENT_Cr; const CompArea &myArea = isCb ? currTU.blocks[COMPONENT_Cb] : currTU.blocks[COMPONENT_Cr]; - const int chromaScaleX = getComponentScaleX(compID, currTU.cu->cs->pcv->chrFormat); - const int chromaScaleY = getComponentScaleY(compID, currTU.cu->cs->pcv->chrFormat); const unsigned width = myArea.width; const unsigned height = myArea.height; int yPos = myArea.y; @@ -3168,16 +3174,14 @@ void BilateralFilter::bilateralFilterDiamond5x5NoClipChroma(const CPelUnitBuf& s const int yEnd = i == numHorVirBndry ? yPos + height : (horVirBndryPos[i] >> chromaScaleY); const int h = yEnd - yStart; const bool clipT = (i == 0 && clipTop) || (i > 0) || (yStart - 2 < 0); - const bool clipB = - (i == numHorVirBndry && clipBottom) || (i < numHorVirBndry) || (yEnd + 2 >= (curPicHeight >> chromaScaleY)); + const bool clipB = (i == numHorVirBndry && clipBottom) || (i < numHorVirBndry) || (yEnd + 2 >= (curPicHeight >> chromaScaleY)); int xStart = xPos; for (int j = 0; j <= numVerVirBndry; j++) { const int xEnd = j == numVerVirBndry ? xPos + width : (verVirBndryPos[j] >> chromaScaleX); const int w = xEnd - xStart; const bool clipL = (j == 0 && clipLeft) || (j > 0) || (xStart - 2 < 0); - const bool clipR = - (j == numVerVirBndry && clipRight) || (j < numVerVirBndry) || (xEnd + 2 >= (curPicWidth >> chromaScaleX)); + const bool clipR = (j == numVerVirBndry && clipRight) || (j < numVerVirBndry) || (xEnd + 2 >= (curPicWidth >> chromaScaleX)); const unsigned uiWidth = w; const unsigned uiHeight = h; @@ -3209,9 +3213,7 @@ void BilateralFilter::bilateralFilterDiamond5x5NoClipChroma(const CPelUnitBuf& s heightForStrength = currTU.blocks[COMPONENT_Y].height; } - const char *LUTrowPtr = getFilterLutParametersChroma( - std::min(uiWidth, uiHeight), currTU.cu->predMode, qp + currTU.cs->pps->getChromaBIFQPOffset(), bfac, - widthForStrength, heightForStrength, currTU.blocks[COMPONENT_Y].valid()); + const char *LUTrowPtr = getFilterLutParametersChroma( std::min(uiWidth, uiHeight), currTU.cu->predMode, qp + currTU.cs->pps->getChromaBIFQPOffset(), bfac, widthForStrength, heightForStrength, currTU.blocks[COMPONENT_Y].valid()); uint32_t uiWidthExt = uiWidth + (NUMBER_PADDED_SAMPLES << 1); uint32_t uiHeightExt = uiHeight + (NUMBER_PADDED_SAMPLES << 1); @@ -3241,15 +3243,6 @@ void BilateralFilter::bilateralFilterDiamond5x5NoClipChroma(const CPelUnitBuf& s topAltAvailable = topAltAvailable && (blkDst.y - NUMBER_PADDED_SAMPLES >= 0); leftAltAvailable = leftAltAvailable && (blkDst.x - NUMBER_PADDED_SAMPLES >= 0); - - int scaleX = getComponentScaleX(compID, currTU.cu->cs->pcv->chrFormat); - int scaleY = getComponentScaleY(compID, currTU.cu->cs->pcv->chrFormat); - uint32_t picWidthChroma = currTU.cu->slice->getPPS()->getPicWidthInLumaSamples() >> scaleX; - uint32_t picHeightChroma = currTU.cu->slice->getPPS()->getPicHeightInLumaSamples() >> scaleY; - - // bool bottomAltAvailable = myArea.y + myArea.height + 1 < chroma_pic_height; - // bool rightAltAvailable = myArea.x + myArea.width + 1 < chroma_pic_width; - bottomAltAvailable = bottomAltAvailable && (blkDst.y + blkDst.height + 1 < picHeightChroma); rightAltAvailable = rightAltAvailable && (blkDst.x + blkDst.width + 1 < picWidthChroma); @@ -3273,8 +3266,7 @@ void BilateralFilter::bilateralFilterDiamond5x5NoClipChroma(const CPelUnitBuf& s srcPtr = srcPtr - 2 * srcStride - 2; // Move block to temporary block // Check if the block a the top block of a CTU. - int scaleChroma = getComponentScaleX(compID, currTU.cu->chromaFormat); - int ctuSizeChroma = currTU.cs->slice->getSPS()->getCTUSize() >> scaleChroma; + int ctuSizeChroma = currTU.cs->slice->getSPS()->getCTUSize() >> chromaScaleX; bool isCTUboundary = myArea.y % ctuSizeChroma == 0; if (isCTUboundary) @@ -3505,12 +3497,6 @@ void BilateralFilter::bilateralFilterDiamond5x5NoClipChroma(const CPelUnitBuf& s bool topAltAvailable = myArea.y - NUMBER_PADDED_SAMPLES >= 0; bool leftAltAvailable = myArea.x - NUMBER_PADDED_SAMPLES >= 0; - - int scaleX = getComponentScaleX(compID, currTU.cu->cs->pcv->chrFormat); - int scaleY = getComponentScaleY(compID, currTU.cu->cs->pcv->chrFormat); - uint32_t picWidthChroma = currTU.cu->slice->getPPS()->getPicWidthInLumaSamples() >> scaleX; - uint32_t picHeightChroma = currTU.cu->slice->getPPS()->getPicHeightInLumaSamples() >> scaleY; - bool bottomAltAvailable = myArea.y + myArea.height + 1 < picHeightChroma; bool rightAltAvailable = myArea.x + myArea.width + 1 < picWidthChroma; @@ -3534,8 +3520,7 @@ void BilateralFilter::bilateralFilterDiamond5x5NoClipChroma(const CPelUnitBuf& s srcPtr = srcPtr - 2 * srcStride - 2; // Move block to temporary block // Check if the block a the top block of a CTU. - int scaleChroma = getComponentScaleX(compID, currTU.cu->chromaFormat); - int ctuSizeChroma = currTU.cs->slice->getSPS()->getCTUSize() >> scaleChroma; + int ctuSizeChroma = currTU.cs->slice->getSPS()->getCTUSize() >> chromaScaleX; bool isCTUboundary = myArea.y % ctuSizeChroma == 0; if (isCTUboundary) @@ -3969,6 +3954,11 @@ void BilateralFilter::bilateralFilterDiamond5x5Chroma(const CPelUnitBuf& src, Pe ) { #if JVET_Z0105_LOOP_FILTER_VIRTUAL_BOUNDARY + const int chromaScaleX = getChannelTypeScaleX( CHANNEL_TYPE_CHROMA, currTU.cu->cs->pcv->chrFormat ); + const int chromaScaleY = getChannelTypeScaleY( CHANNEL_TYPE_CHROMA, currTU.cu->cs->pcv->chrFormat ); + const uint32_t picWidthChroma = currTU.cu->slice->getPPS()->getPicWidthInLumaSamples() >> chromaScaleX; + const uint32_t picHeightChroma = currTU.cu->slice->getPPS()->getPicHeightInLumaSamples() >> chromaScaleY; + if (isTUCrossedByVirtualBoundaries) { ComponentID compID = isCb ? COMPONENT_Cb : COMPONENT_Cr; @@ -3988,16 +3978,14 @@ void BilateralFilter::bilateralFilterDiamond5x5Chroma(const CPelUnitBuf& src, Pe const int yEnd = i == numHorVirBndry ? yPos + height : (horVirBndryPos[i] >> chromaScaleY); const int h = yEnd - yStart; const bool clipT = (i == 0 && clipTop) || (i > 0) || (yStart - 2 < 0); - const bool clipB = - (i == numHorVirBndry && clipBottom) || (i < numHorVirBndry) || (yEnd + 2 >= (curPicHeight >> chromaScaleY)); + const bool clipB = (i == numHorVirBndry && clipBottom) || (i < numHorVirBndry) || (yEnd + 2 >= (curPicHeight >> chromaScaleY)); int xStart = xPos; for (int j = 0; j <= numVerVirBndry; j++) { const int xEnd = j == numVerVirBndry ? xPos + width : (verVirBndryPos[j] >> chromaScaleX); const int w = xEnd - xStart; const bool clipL = (j == 0 && clipLeft) || (j > 0) || (xStart - 2 < 0); - const bool clipR = - (j == numVerVirBndry && clipRight) || (j < numVerVirBndry) || (xEnd + 2 >= (curPicWidth >> chromaScaleX)); + const bool clipR = (j == numVerVirBndry && clipRight) || (j < numVerVirBndry) || (xEnd + 2 >= (curPicWidth >> chromaScaleX)); const unsigned uiWidth = w; const unsigned uiHeight = h; @@ -4061,12 +4049,6 @@ void BilateralFilter::bilateralFilterDiamond5x5Chroma(const CPelUnitBuf& src, Pe topAltAvailable = topAltAvailable && (blkDst.y - NUMBER_PADDED_SAMPLES >= 0); leftAltAvailable = leftAltAvailable && (blkDst.x - NUMBER_PADDED_SAMPLES >= 0); - - int scaleX = getComponentScaleX(compID, currTU.cu->cs->pcv->chrFormat); - int scaleY = getComponentScaleY(compID, currTU.cu->cs->pcv->chrFormat); - uint32_t picWidthChroma = currTU.cu->slice->getPPS()->getPicWidthInLumaSamples() >> scaleX; - uint32_t picHeightChroma = currTU.cu->slice->getPPS()->getPicHeightInLumaSamples() >> scaleY; - bottomAltAvailable = bottomAltAvailable && (blkDst.y + blkDst.height + 1 < picHeightChroma); rightAltAvailable = rightAltAvailable && (blkDst.x + blkDst.width + 1 < picWidthChroma); @@ -4090,8 +4072,7 @@ void BilateralFilter::bilateralFilterDiamond5x5Chroma(const CPelUnitBuf& src, Pe srcPtr = srcPtr - 2 * srcStride - 2; // Move block to temporary block // Check if the block a the top block of a CTU. - int scaleChroma = getComponentScaleX(compID, currTU.cu->chromaFormat); - int ctuSizeChroma = currTU.cs->slice->getSPS()->getCTUSize() >> scaleChroma; + int ctuSizeChroma = currTU.cs->slice->getSPS()->getCTUSize() >> chromaScaleX; bool isCTUboundary = myArea.y % ctuSizeChroma == 0; if (isCTUboundary) @@ -4321,12 +4302,6 @@ void BilateralFilter::bilateralFilterDiamond5x5Chroma(const CPelUnitBuf& src, Pe bool topAltAvailable = myArea.y - NUMBER_PADDED_SAMPLES >= 0; bool leftAltAvailable = myArea.x - NUMBER_PADDED_SAMPLES >= 0; - - int scaleX = getComponentScaleX(compID, currTU.cu->cs->pcv->chrFormat); - int scaleY = getComponentScaleY(compID, currTU.cu->cs->pcv->chrFormat); - int picWidthChroma = currTU.cu->slice->getPPS()->getPicWidthInLumaSamples() >> scaleX; - int picHeightChroma = currTU.cu->slice->getPPS()->getPicHeightInLumaSamples() >> scaleY; - bool bottomAltAvailable = myArea.y + myArea.height + 1 < picHeightChroma; bool rightAltAvailable = myArea.x + myArea.width + 1 < picWidthChroma; @@ -4349,9 +4324,8 @@ void BilateralFilter::bilateralFilterDiamond5x5Chroma(const CPelUnitBuf& src, Pe // same with image data srcPtr = srcPtr - 2 * srcStride - 2; // Move block to temporary block - // Check if the block a the top block of a CTU. - int scaleChroma = getComponentScaleX(compID, currTU.cu->chromaFormat); - int ctuSizeChroma = currTU.cs->slice->getSPS()->getCTUSize() >> scaleChroma; + // Check if the block a the top block of a CTU. + int ctuSizeChroma = currTU.cs->slice->getSPS()->getCTUSize() >> chromaScaleX; bool isCTUboundary = myArea.y % ctuSizeChroma == 0; if (isCTUboundary) diff --git a/source/Lib/CommonLib/CodingStructure.cpp b/source/Lib/CommonLib/CodingStructure.cpp index f4aacd2511b04e03051157411e79ee434ebea1a0..370d1dd02798857be014f24c687bfcab30f1db18 100644 --- a/source/Lib/CommonLib/CodingStructure.cpp +++ b/source/Lib/CommonLib/CodingStructure.cpp @@ -324,8 +324,13 @@ Area CodingStructure::findOverlappedArea(const Area &a1, const Area &a2) const #if JVET_Z0118_GDR -bool CodingStructure::isInGdrInvervalOrRecoveryPoc() const +bool CodingStructure::isInGdrIntervalOrRecoveryPoc() const { + if( !sps->getGDREnabledFlag() ) + { + return false; + } + PicHeader *curPh = picHeader; bool isCurGdrIntervalPic = curPh->getInGdrInterval(); bool isCurGdrRecoveryPocPic = curPh->getIsGdrRecoveryPocPic(); @@ -340,6 +345,11 @@ bool CodingStructure::isInGdrInvervalOrRecoveryPoc() const bool CodingStructure::isClean(const ChannelType effChType) const { + if( !sps->getGDREnabledFlag() ) + { + return true; + } + bool ret = isClean(area.Y(), effChType); return ret; @@ -364,7 +374,7 @@ bool CodingStructure::isClean(const Position &IntPos, RefPicList e, int refIdx) bool isRefGdrIntervalPic = refPh->getInGdrInterval(); bool isRefGdrRecoveryPocPic = refPh->getIsGdrRecoveryPocPic(); - if (isInGdrInvervalOrRecoveryPoc()) + if (isInGdrIntervalOrRecoveryPoc()) { int virboundaryEndx = 0; @@ -414,7 +424,7 @@ bool CodingStructure::isClean(const Position &IntPos, const Picture* const refPi bool isRefGdrIntervalPic = refPh->getInGdrInterval(); bool isRefGdrRecoveryPocPic = refPh->getIsGdrRecoveryPocPic(); - if (isInGdrInvervalOrRecoveryPoc()) + if (isInGdrIntervalOrRecoveryPoc()) { int virboundaryEndx = 0; @@ -465,7 +475,7 @@ bool CodingStructure::isClean(const int Intx, const int Inty, const ChannelType bool isCurGdrIntervalPic = curPh->getInGdrInterval(); bool isCurGdrRecoveryPocPic = curPh->getIsGdrRecoveryPocPic(); - if (isInGdrInvervalOrRecoveryPoc()) + if (isInGdrIntervalOrRecoveryPoc()) { int virboundaryEndx = 0; @@ -495,6 +505,11 @@ bool CodingStructure::isClean(const int Intx, const int Inty, const ChannelType bool CodingStructure::isClean(const Position &IntPos, const ChannelType effChType) const { + if( !sps->getGDREnabledFlag() ) + { + return true; + } + bool ret = isClean(IntPos.x, IntPos.y, effChType); return ret; @@ -564,7 +579,7 @@ void CodingStructure::updateReconMotIPM(const CompArea &carea, const CPelBuf &pb { const ComponentID compID = carea.compID; - if (!isInGdrInvervalOrRecoveryPoc()) + if (!isInGdrIntervalOrRecoveryPoc()) { picture->getRecoBuf(carea).copyFrom(pbuf); if (compID == COMPONENT_Y) @@ -578,7 +593,6 @@ void CodingStructure::updateReconMotIPM(const CompArea &carea, const CPelBuf &pb return; } - picture->getBuf(carea, PIC_RECONSTRUCTION_0).copyFrom(pbuf); if (compID == COMPONENT_Y) { @@ -611,7 +625,6 @@ void CodingStructure::updateReconMotIPM(const CompArea &carea, const CPelBuf &pb #endif #if JVET_Z0118_GDR - void CodingStructure::rspSignalPicture(const UnitArea &uarea, std::vector<Pel>& pLUT, bool usePred) const { for (int i = 0; i < MAX_NUM_COMPONENT; i++) @@ -630,7 +643,7 @@ void CodingStructure::rspSignalPicture(const CompArea &carea, std::vector<Pel>& ComponentID compID = carea.compID; // 1. normal picture - if (!isInGdrInvervalOrRecoveryPoc()) + if (!isInGdrIntervalOrRecoveryPoc()) { PelBuf picRecoBuff = picture->getRecoBuf(carea); CPelBuf predBuf = usePred ? getPredBuf(carea) : picture->getRecoBuf(carea); @@ -669,7 +682,7 @@ void CodingStructure::reconstructPicture(const CompArea &carea, std::vector<Pel> ComponentID compID = carea.compID; // 1. normal picture - if (!isInGdrInvervalOrRecoveryPoc()) + if (!isInGdrIntervalOrRecoveryPoc()) { PelBuf picRecoBuff = picture->getRecoBuf(carea); @@ -912,20 +925,23 @@ const CodingUnit* CodingStructure::getCU( const Position &pos, const ChannelType const CompArea &_blk = area.blocks[effChType]; #if JVET_Z0118_GDR - Size lumaSize = slice->getPic()->Y().lumaSize(); - if (area.lumaSize() != lumaSize) + if( sps->getGDREnabledFlag() ) { - const Position posRB = (effChType == CHANNEL_TYPE_LUMA) ? area.Y().bottomRight() : area.Cb().bottomRight(); - const Position posTL = (effChType == CHANNEL_TYPE_LUMA) ? area.Y().topLeft() : area.Cb().topLeft(); + Size lumaSize = slice->getPic()->Y().lumaSize(); + if( area.lumaSize() != lumaSize ) + { + const Position posRB = ( effChType == CHANNEL_TYPE_LUMA ) ? area.Y().bottomRight() : area.Cb().bottomRight(); + const Position posTL = ( effChType == CHANNEL_TYPE_LUMA ) ? area.Y().topLeft() : area.Cb().topLeft(); - bool isTLClean = isClean(posTL, effChType); - bool isRBClean = isClean(posRB, effChType); - bool isSrcClean = isTLClean || isRBClean; - bool isTarClean = isClean(pos, effChType); + bool isTLClean = isClean( posTL, effChType ); + bool isRBClean = isClean( posRB, effChType ); + bool isSrcClean = isTLClean || isRBClean; + bool isTarClean = isClean( pos, effChType ); - if (isSrcClean && !isTarClean) - { - return nullptr; + if( isSrcClean && !isTarClean ) + { + return nullptr; + } } } #endif @@ -1002,22 +1018,25 @@ const PredictionUnit * CodingStructure::getPU( const Position &pos, const Channe const CompArea &_blk = area.blocks[effChType]; #if JVET_Z0118_GDR - Size lumaSize = slice->getPic()->Y().lumaSize(); - if (area.lumaSize() != lumaSize) + if( sps->getGDREnabledFlag() ) { - const Position posRB = (effChType == CHANNEL_TYPE_LUMA) ? area.Y().bottomRight() : area.Cb().bottomRight(); - const Position posTL = (effChType == CHANNEL_TYPE_LUMA) ? area.Y().topLeft() : area.Cb().topLeft(); + Size lumaSize = slice->getPic()->Y().lumaSize(); + if( area.lumaSize() != lumaSize ) + { + const Position posRB = ( effChType == CHANNEL_TYPE_LUMA ) ? area.Y().bottomRight() : area.Cb().bottomRight(); + const Position posTL = ( effChType == CHANNEL_TYPE_LUMA ) ? area.Y().topLeft() : area.Cb().topLeft(); - bool isTLClean = isClean(posTL, effChType); - bool isRBClean = isClean(posRB, effChType); - bool isSrcClean = isTLClean || isRBClean; - bool isTarClean = isClean(pos, effChType); + bool isTLClean = isClean( posTL, effChType ); + bool isRBClean = isClean( posRB, effChType ); + bool isSrcClean = isTLClean || isRBClean; + bool isTarClean = isClean( pos, effChType ); - if (isSrcClean && !isTarClean) - { - return nullptr; + if( isSrcClean && !isTarClean ) + { + return nullptr; + } } -} + } #endif @@ -1111,20 +1130,23 @@ const TransformUnit * CodingStructure::getTU( const Position &pos, const Channel const CompArea &_blk = area.blocks[effChType]; #if JVET_Z0118_GDR - Size lumaSize = slice->getPic()->Y().lumaSize(); - if (area.lumaSize() != lumaSize) + if( sps->getGDREnabledFlag() ) { - const Position posRB = (effChType == CHANNEL_TYPE_LUMA) ? area.Y().bottomRight() : area.Cb().bottomRight(); - const Position posTL = (effChType == CHANNEL_TYPE_LUMA) ? area.Y().topLeft() : area.Cb().topLeft(); + Size lumaSize = slice->getPic()->Y().lumaSize(); + if( area.lumaSize() != lumaSize ) + { + const Position posRB = ( effChType == CHANNEL_TYPE_LUMA ) ? area.Y().bottomRight() : area.Cb().bottomRight(); + const Position posTL = ( effChType == CHANNEL_TYPE_LUMA ) ? area.Y().topLeft() : area.Cb().topLeft(); - bool isTLClean = isClean(posTL, effChType); - bool isRBClean = isClean(posRB, effChType); - bool isSrcClean = isTLClean || isRBClean; - bool isTarClean = isClean(pos, effChType); + bool isTLClean = isClean( posTL, effChType ); + bool isRBClean = isClean( posRB, effChType ); + bool isSrcClean = isTLClean || isRBClean; + bool isTarClean = isClean( pos, effChType ); - if (isSrcClean && !isTarClean) - { - return nullptr; + if( isSrcClean && !isTarClean ) + { + return nullptr; + } } } #endif @@ -2141,8 +2163,8 @@ void CodingStructure::useSubStructure( const CodingStructure& subStruct, const C if( cpyPred ) picture->getPredBuf( clippedArea ).copyFrom( subPredBuf ); if( cpyResi ) picture->getResiBuf( clippedArea ).copyFrom( subResiBuf ); - #if JVET_Z0118_GDR - if (isInGdrInvervalOrRecoveryPoc()) +#if JVET_Z0118_GDR + if (isInGdrIntervalOrRecoveryPoc()) { if (cpyReco) { @@ -2345,7 +2367,7 @@ void CodingStructure::copyStructure( const CodingStructure& other, const Channel // copy data to picture #if JVET_Z0118_GDR - if (isInGdrInvervalOrRecoveryPoc()) + if (isInGdrIntervalOrRecoveryPoc()) { updateReconMotIPM(area, recoBuf); // xcomrpessCU - need } @@ -2904,7 +2926,7 @@ const CodingUnit* CodingStructure::getCURestricted( const Position &pos, const C if( cu && CU::isSameSliceAndTile( *cu, curCu ) && ( cu->cs != curCu.cs || cu->idx <= curCu.idx ) && addCheck) { #if JVET_Z0118_GDR - if (cu) + if( sps->getGDREnabledFlag() && cu ) { const Position posRB = (_chType == CHANNEL_TYPE_LUMA) ? curCu.Y().bottomRight() : curCu.Cb().bottomRight(); const Position posTL = (_chType == CHANNEL_TYPE_LUMA) ? curCu.Y().topLeft() : curCu.Cb().topLeft(); @@ -2937,7 +2959,7 @@ const CodingUnit* CodingStructure::getCURestricted(const Position &pos, const Po bool addCheck = (wavefrontsEnabled && (xNbY >> ctuSizeBit) >= (xCurr >> ctuSizeBit) + 1) ? false : true; #if JVET_Z0118_GDR - if (cu) + if( sps->getGDREnabledFlag() && cu ) { bool isSrcClean = isClean(curPos, _chType); bool isTarClean = isClean(pos, _chType); @@ -2965,7 +2987,7 @@ const PredictionUnit* CodingStructure::getPURestricted( const Position &pos, con if (pu && CU::isSameSliceAndTile(*pu->cu, *curPu.cu) && (pu->cs != curPu.cs || pu->idx <= curPu.idx) && addCheck) { #if JVET_Z0118_GDR - if (pu) + if( sps->getGDREnabledFlag() && pu ) { const Position posRB = (_chType == CHANNEL_TYPE_LUMA) ? curPu.Y().bottomRight() : curPu.Cb().bottomRight(); const Position posTL = (_chType == CHANNEL_TYPE_LUMA) ? curPu.Y().topLeft() : curPu.Cb().topLeft(); @@ -3001,7 +3023,7 @@ const TransformUnit* CodingStructure::getTURestricted( const Position &pos, cons if (tu && CU::isSameSliceAndTile(*tu->cu, *curTu.cu) && (tu->cs != curTu.cs || tu->idx <= curTu.idx) && addCheck) { #if JVET_Z0118_GDR - if (tu) + if( sps->getGDREnabledFlag() && tu ) { const Position posRB = (_chType == CHANNEL_TYPE_LUMA) ? curTu.Y().bottomRight() : curTu.Cb().bottomRight(); const Position posTL = (_chType == CHANNEL_TYPE_LUMA) ? curTu.Y().topLeft() : curTu.Cb().topLeft(); diff --git a/source/Lib/CommonLib/CodingStructure.h b/source/Lib/CommonLib/CodingStructure.h index eeef3649cdfa4adf3d402a9f2251ea018044fac9..9e883e73a03a3f4161b1ac51cb7e078f5886cab0 100644 --- a/source/Lib/CommonLib/CodingStructure.h +++ b/source/Lib/CommonLib/CodingStructure.h @@ -120,7 +120,7 @@ public: #endif #if JVET_Z0118_GDR - bool isInGdrInvervalOrRecoveryPoc() const; + bool isInGdrIntervalOrRecoveryPoc() const; bool isClean(const ChannelType effChType) const; bool isClean(const Position &IntPos, RefPicList e, int refIdx) const; diff --git a/source/Lib/CommonLib/Contexts.cpp b/source/Lib/CommonLib/Contexts.cpp index c2eccbb28b594ed1d5e1901fded01f1e9497ad58..6753b760db9102a96057b4ce244384700cae5023 100644 --- a/source/Lib/CommonLib/Contexts.cpp +++ b/source/Lib/CommonLib/Contexts.cpp @@ -3217,6 +3217,30 @@ const CtxSet ContextSetCfg::IntraChromaPredMode = ContextSetCfg::addCtxSet { 5 } }); +#if JVET_Z0050_DIMD_CHROMA_FUSION +#if ENABLE_DIMD +const CtxSet ContextSetCfg::DimdChromaMode = ContextSetCfg::addCtxSet +( { + { CNU, }, + { CNU, }, + { CNU, }, + { DWS, }, + { DWS, }, + { DWS, }, + } ); +#endif + +const CtxSet ContextSetCfg::ChromaFusionMode = ContextSetCfg::addCtxSet +( { + { CNU, }, + { CNU, }, + { CNU, }, + { DWS, }, + { DWS, }, + { DWS, }, + } ); +#endif + const CtxSet ContextSetCfg::MipFlag = ContextSetCfg::addCtxSet ({ { 56, 57, 50, 33 }, diff --git a/source/Lib/CommonLib/InterPrediction.cpp b/source/Lib/CommonLib/InterPrediction.cpp index ed781128614d4f4563d6610f32ab1ea05bc8d365..ecd023c5874499dc90258b503bcd6378c7c7d0be 100644 --- a/source/Lib/CommonLib/InterPrediction.cpp +++ b/source/Lib/CommonLib/InterPrediction.cpp @@ -8083,7 +8083,7 @@ void InterPrediction::xFillIBCBuffer(CodingUnit &cu) { #if JVET_Z0118_GDR bool isCleanCu = cu.cs->isClean(cu); - bool useCleanIBCBuffer = cu.cs->isInGdrInvervalOrRecoveryPoc() && isCleanCu; + bool useCleanIBCBuffer = cu.cs->isInGdrIntervalOrRecoveryPoc() && isCleanCu; #endif for (auto &currPU : CU::traverseTUs(cu)) @@ -8138,7 +8138,7 @@ void InterPrediction::xIntraBlockCopy(PredictionUnit &pu, PelUnitBuf &predBuf, c { #if JVET_Z0118_GDR bool isCleanCu = pu.cs->isClean(pu); - bool useCleanIBCBuffer = pu.cs->isInGdrInvervalOrRecoveryPoc() && isCleanCu; + bool useCleanIBCBuffer = pu.cs->isInGdrIntervalOrRecoveryPoc() && isCleanCu; #endif #if JVET_Z0153_IBC_EXT_REF diff --git a/source/Lib/CommonLib/Picture.cpp b/source/Lib/CommonLib/Picture.cpp index 1236c6bcce95fdad6cb5f9786b93d60b8cd12620..8a7e2a25910cf02415a9c5dbb8d7c29cbc98a5b6 100644 --- a/source/Lib/CommonLib/Picture.cpp +++ b/source/Lib/CommonLib/Picture.cpp @@ -1557,7 +1557,7 @@ void Picture::initCleanCurPicture() void Picture::copyCleanCurPicture() { - if (cs->isInGdrInvervalOrRecoveryPoc()) + if (cs->isInGdrIntervalOrRecoveryPoc()) { ChromaFormat chromaFormat = cs->sps->getChromaFormatIdc(); int gdrEndX = cs->picHeader->getGdrEndX(); diff --git a/source/Lib/CommonLib/SampleAdaptiveOffset.cpp b/source/Lib/CommonLib/SampleAdaptiveOffset.cpp index 4e3346659b60016baa844b26fef1a1437cf0ec4e..a48b2252e174e71fa28ed7937f02328c5ddc3acb 100644 --- a/source/Lib/CommonLib/SampleAdaptiveOffset.cpp +++ b/source/Lib/CommonLib/SampleAdaptiveOffset.cpp @@ -1185,6 +1185,11 @@ void SampleAdaptiveOffset::SAOProcess( CodingStructure& cs, SAOBlkParam* saoBlkP bool applyChromaBIF = false; ChromaBifParams& chromaBifParams = cs.picture->getChromaBifParam(); +#if JVET_Z0105_LOOP_FILTER_VIRTUAL_BOUNDARY + const int chromaScaleX = getChannelTypeScaleX( CHANNEL_TYPE_CHROMA, cs.pcv->chrFormat ); + const int chromaScaleY = getChannelTypeScaleY( CHANNEL_TYPE_CHROMA, cs.pcv->chrFormat ); +#endif + // And now we traverse the CTU to do BIF for (auto &currCU : cs.traverseCUs(CS::getArea(cs, area, chType), chType)) { @@ -1225,8 +1230,6 @@ void SampleAdaptiveOffset::SAOProcess( CodingStructure& cs, SAOBlkParam* saoBlkP int horVirBndryPos[] = { 0, 0, 0 }; int verVirBndryPos[] = { 0, 0, 0 }; CompArea &myArea = currTU.block(compID); - const int chromaScaleX = getComponentScaleX(compID, currTU.cu->cs->pcv->chrFormat); - const int chromaScaleY = getComponentScaleY(compID, currTU.cu->cs->pcv->chrFormat); int yPos = myArea.y << chromaScaleY; int xPos = myArea.x << chromaScaleX; bool isTUCrossedByVirtualBoundaries = m_bilateralFilter.isCrossedByVirtualBoundaries( @@ -4954,6 +4957,6 @@ bool SampleAdaptiveOffset::isCrossedByVirtualBoundaries(const int xPos, const in } } } - return numHorVirBndry > 0 || numVerVirBndry > 0 ; + return numHorVirBndry > 0 || numVerVirBndry > 0; } //! \} diff --git a/source/Lib/CommonLib/TypeDef.h b/source/Lib/CommonLib/TypeDef.h index ef7f014bded36b33e9d56099e4e13c8ee25692b2..8f5f36c8a33b28a836b5d7baa344e2c0d485b5e7 100644 --- a/source/Lib/CommonLib/TypeDef.h +++ b/source/Lib/CommonLib/TypeDef.h @@ -260,7 +260,7 @@ #define JVET_Z0118_GDR 1 // JVET-Z0118: GDR #if JVET_Z0118_GDR -#define GDR_LEAK_TEST 1 +#define GDR_LEAK_TEST 0 #define GDR_ENC_TRACE 0 #define GDR_DEC_TRACE 0 #endif diff --git a/source/Lib/CommonLib/Unit.cpp b/source/Lib/CommonLib/Unit.cpp index 960b06cda648dba1627e3d9a9c07f3bcba243ea9..ed605987d07e0812b4004e5f9ddbcdc93963e2da 100644 --- a/source/Lib/CommonLib/Unit.cpp +++ b/source/Lib/CommonLib/Unit.cpp @@ -1024,6 +1024,7 @@ const MotionInfo& PredictionUnit::getMotionInfo() const const MotionInfo& PredictionUnit::getMotionInfo( const Position& pos ) const { #if JVET_Z0118_GDR + if( cs->sps->getGDREnabledFlag() ) { bool isSrcClean = cs->isClean(Y().bottomRight(), CHANNEL_TYPE_LUMA); bool isTarClean = cs->isClean(pos, CHANNEL_TYPE_LUMA); @@ -1050,7 +1051,6 @@ CMotionBuf PredictionUnit::getMotionBuf() const #if JVET_Y0067_ENHANCED_MMVD_MVD_SIGN_PRED bool PredictionUnit::isMvsdApplicable() const { - if (!cs->sps->getUseMVSD()) { return false; @@ -1071,6 +1071,7 @@ const uint8_t& PredictionUnit::getIpmInfo() const const uint8_t& PredictionUnit::getIpmInfo( const Position& pos ) const { #if JVET_Z0118_GDR + if( cs->sps->getGDREnabledFlag() ) { bool isSrcClean = cs->isClean(Y().bottomRight(), CHANNEL_TYPE_LUMA); bool isTarClean = cs->isClean(pos, CHANNEL_TYPE_LUMA); diff --git a/source/Lib/DecoderLib/DecCu.cpp b/source/Lib/DecoderLib/DecCu.cpp index c56e8df5f010c450de7752abecfd945c4e61e376..4100e0e86b4187962885f0e5216bcfb3bee6ccc3 100644 --- a/source/Lib/DecoderLib/DecCu.cpp +++ b/source/Lib/DecoderLib/DecCu.cpp @@ -121,7 +121,7 @@ void DecCu::decompressCtu( CodingStructure& cs, const UnitArea& ctuArea ) #if JVET_Z0118_GDR // reset current IBC Buffer only when VB pass through - if (cs.isInGdrInvervalOrRecoveryPoc()) + if (cs.isInGdrIntervalOrRecoveryPoc()) { #if JVET_Z0153_IBC_EXT_REF m_pcInterPred->resetCurIBCBuffer( @@ -203,21 +203,21 @@ void DecCu::decompressCtu( CodingStructure& cs, const UnitArea& ctuArea ) if (isInGdrInterval || isRecoveryPocPic) { // 1.01 switch recon based on clean/dirty current area - bool clean_dirty_flag; + bool cleanDirtyFlag; bool isCuClean = currCU.Y().valid() ? cs.isClean(currCU.Y().topLeft(), CHANNEL_TYPE_LUMA) : cs.isClean(currCU.Cb().topLeft(), CHANNEL_TYPE_CHROMA); if (isCuClean) { - clean_dirty_flag = true; + cleanDirtyFlag = true; } else { - clean_dirty_flag = false; + cleanDirtyFlag = false; } - currCU.cs->setReconBuf((clean_dirty_flag) ? PIC_RECONSTRUCTION_1 : PIC_RECONSTRUCTION_0); - currCU.cs->picture->setCleanDirty(clean_dirty_flag); + currCU.cs->setReconBuf(( cleanDirtyFlag ) ? PIC_RECONSTRUCTION_1 : PIC_RECONSTRUCTION_0); + currCU.cs->picture->setCleanDirty( cleanDirtyFlag ); for (int rlist = REF_PIC_LIST_0; rlist < NUM_REF_PIC_LIST_01; rlist++) { @@ -227,7 +227,7 @@ void DecCu::decompressCtu( CodingStructure& cs, const UnitArea& ctuArea ) refPic = slice->getReferencePicture((RefPicList)rlist, idx); if (refPic) { - refPic->setCleanDirty(clean_dirty_flag); + refPic->setCleanDirty( cleanDirtyFlag ); } } } @@ -448,8 +448,8 @@ void DecCu::decompressCtu( CodingStructure& cs, const UnitArea& ctuArea ) } m_pcInterPred->xFillIBCBuffer(currCU); -#if JVET_Z0118_GDR // decompressCtu - cs.updateReconMotIPM(currCU); // decompressCtu : need +#if JVET_Z0118_GDR // decompressCtu + cs.updateReconMotIPM( currCU ); // decompressCtu : need #endif DTRACE_BLOCK_REC( cs.picture->getRecoBuf( currCU ), currCU, currCU.predMode ); @@ -2443,7 +2443,7 @@ void DecCu::xDeriveCUMV( CodingUnit &cu ) if (cu.cs->isClean(cu)) { CHECK(!m_pcInterPred->isLumaBvValid(lcuWidth, cuPelX, cuPelY, roiWidth, roiHeight, xPred, yPred), "invalid block vector for IBC detected."); - } + } } else { diff --git a/source/Lib/EncoderLib/EncAdaptiveLoopFilter.cpp b/source/Lib/EncoderLib/EncAdaptiveLoopFilter.cpp index e2d84da13bd7f87e933bbcb758866d495f52e51e..82279895ebdd085ce19f4e20f0ea09ab761b4062 100644 --- a/source/Lib/EncoderLib/EncAdaptiveLoopFilter.cpp +++ b/source/Lib/EncoderLib/EncAdaptiveLoopFilter.cpp @@ -4947,23 +4947,24 @@ void EncAdaptiveLoopFilter::alfReconstructor(CodingStructure& cs, const PelUnitB #endif } + const int chromaScaleX = getChannelTypeScaleX( CHANNEL_TYPE_CHROMA, recBuf.chromaFormat ); + const int chromaScaleY = getChannelTypeScaleY( CHANNEL_TYPE_CHROMA, recBuf.chromaFormat ); + for (int compIdx = 1; compIdx < MAX_NUM_COMPONENT; compIdx++) { ComponentID compID = ComponentID(compIdx); - const int chromaScaleX = getComponentScaleX(compID, recBuf.chromaFormat); - const int chromaScaleY = getComponentScaleY(compID, recBuf.chromaFormat); if (m_ctuEnableFlag[compIdx][ctuIdx]) { Area blk(xPos >> chromaScaleX, yPos >> chromaScaleY, width >> chromaScaleX, height >> chromaScaleY); - const int alt_num = m_ctuAlternative[compID][ctuIdx]; + const int altNum = m_ctuAlternative[compIdx][ctuIdx]; #if ALF_IMPROVEMENT #if JVET_X0071_ALF_BAND_CLASSIFIER - alfFiltering( m_classifier[0], recBuf, recExtBuf, blk, blk, compID, m_chromaCoeffFinal[alt_num], m_chromaClippFinal[alt_num], m_clpRngs.comp[compIdx], cs, m_filterTypeApsChroma, nullptr, -1 ); + alfFiltering( m_classifier[0], recBuf, recExtBuf, blk, blk, compID, m_chromaCoeffFinal[altNum], m_chromaClippFinal[altNum], m_clpRngs.comp[compIdx], cs, m_filterTypeApsChroma, nullptr, -1 ); #else - alfFiltering( m_classifier, recBuf, recExtBuf, blk, blk, compID, m_chromaCoeffFinal[alt_num], m_chromaClippFinal[alt_num], m_clpRngs.comp[compIdx], cs, m_filterTypeApsChroma, nullptr, -1 ); + alfFiltering( m_classifier, recBuf, recExtBuf, blk, blk, compID, m_chromaCoeffFinal[altNum], m_chromaClippFinal[altNum], m_clpRngs.comp[compIdx], cs, m_filterTypeApsChroma, nullptr, -1 ); #endif #else - m_filter5x5Blk( m_classifier, recBuf, recExtBuf, blk, blk, compID, m_chromaCoeffFinal[alt_num], m_chromaClippFinal[alt_num], m_clpRngs.comp[compIdx], cs, m_alfVBChmaCTUHeight, m_alfVBChmaPos ); + m_filter5x5Blk( m_classifier, recBuf, recExtBuf, blk, blk, compID, m_chromaCoeffFinal[altNum], m_chromaClippFinal[altNum], m_clpRngs.comp[compIdx], cs, m_alfVBChmaCTUHeight, m_alfVBChmaPos ); #endif } } diff --git a/source/Lib/EncoderLib/EncSampleAdaptiveOffset.cpp b/source/Lib/EncoderLib/EncSampleAdaptiveOffset.cpp index f3116ddd11ee5a8d0325aac57806ac77933d4249..130a2dc31787bb1fcfae7b8095ba72ada1432b7b 100644 --- a/source/Lib/EncoderLib/EncSampleAdaptiveOffset.cpp +++ b/source/Lib/EncoderLib/EncSampleAdaptiveOffset.cpp @@ -1453,6 +1453,11 @@ void EncSampleAdaptiveOffset::decideBlkParams(CodingStructure& cs, bool* sliceEn ChannelType chType = isDualTree ? CH_C : CH_L; bool applyChromaBIF = false; +#if JVET_Z0105_LOOP_FILTER_VIRTUAL_BOUNDARY + const int chromaScaleX = getChannelTypeScaleX( CHANNEL_TYPE_CHROMA, cs.pcv->chrFormat ); + const int chromaScaleY = getChannelTypeScaleY( CHANNEL_TYPE_CHROMA, cs.pcv->chrFormat ); +#endif + for (auto &currCU : cs.traverseCUs(CS::getArea(cs, area, chType), chType)) { bool chromaValid = currCU.Cb().valid() && currCU.Cr().valid(); @@ -1491,8 +1496,6 @@ void EncSampleAdaptiveOffset::decideBlkParams(CodingStructure& cs, bool* sliceEn int horVirBndryPos[] = { 0, 0, 0 }; int verVirBndryPos[] = { 0, 0, 0 }; CompArea &myArea = currTU.block(compID); - const int chromaScaleX = getComponentScaleX(compID, currTU.cu->cs->pcv->chrFormat); - const int chromaScaleY = getComponentScaleY(compID, currTU.cu->cs->pcv->chrFormat); int yPos = myArea.y << chromaScaleY; int xPos = myArea.x << chromaScaleX; bool isTUCrossedByVirtualBoundaries = m_bilateralFilter.isCrossedByVirtualBoundaries( @@ -1950,6 +1953,11 @@ void EncSampleAdaptiveOffset::decideBlkParams(CodingStructure& cs, bool* sliceEn bool isDualTree = CS::isDualITree(cs); ChannelType chType = isDualTree ? CH_C : CH_L; bool applyChromaBIF = false; +#if JVET_Z0105_LOOP_FILTER_VIRTUAL_BOUNDARY + const int chromaScaleX = getChannelTypeScaleX( CHANNEL_TYPE_CHROMA, cs.pcv->chrFormat ); + const int chromaScaleY = getChannelTypeScaleY( CHANNEL_TYPE_CHROMA, cs.pcv->chrFormat ); +#endif + for (auto &currCU : cs.traverseCUs(CS::getArea(cs, area, chType), chType)) { bool chromaValid = currCU.Cb().valid() && currCU.Cr().valid(); @@ -1991,8 +1999,6 @@ void EncSampleAdaptiveOffset::decideBlkParams(CodingStructure& cs, bool* sliceEn int horVirBndryPos[] = { 0, 0, 0 }; int verVirBndryPos[] = { 0, 0, 0 }; CompArea &myArea = currTU.block(compID); - const int chromaScaleX = getComponentScaleX(compID, currTU.cu->cs->pcv->chrFormat); - const int chromaScaleY = getComponentScaleY(compID, currTU.cu->cs->pcv->chrFormat); int yPos = myArea.y << chromaScaleY; int xPos = myArea.x << chromaScaleX; bool isTUCrossedByVirtualBoundaries = m_bilateralFilter.isCrossedByVirtualBoundaries( @@ -3330,6 +3336,8 @@ void EncSampleAdaptiveOffset::getCcSaoStatistics(CodingStructure& cs, const Comp int horVirBndryPosComp[] = { -1,-1,-1 }; int verVirBndryPosComp[] = { -1,-1,-1 }; bool isCtuCrossedByVirtualBoundaries = isCrossedByVirtualBoundaries(area.Y().x, area.Y().y, area.Y().width, area.Y().height, numHorVirBndry, numVerVirBndry, horVirBndryPos, verVirBndryPos, cs.picHeader); + + #endif //NOTE: The number of skipped lines during gathering CTU statistics depends on the slice boundary availabilities. diff --git a/source/Lib/EncoderLib/InterSearch.cpp b/source/Lib/EncoderLib/InterSearch.cpp index 55768d287946ef424f2d2b116b06584077263ae7..ad6b6ca2be62a7af53cea7c0d48b3345cba6576b 100644 --- a/source/Lib/EncoderLib/InterSearch.cpp +++ b/source/Lib/EncoderLib/InterSearch.cpp @@ -9229,7 +9229,7 @@ void InterSearch::xEstimateInterResidualQT(CodingStructure &cs, Partitioner &par bool lmcsEnable = cs.picHeader->getLmcsEnabledFlag() && m_pcReshape->getCTUFlag() && isLuma( compID ) && !tu.cu->firstPU->ciipFlag && !CU::isIBC( *tu.cu ); #endif cs.reconstructPicture(tu.blocks[compID], m_pcReshape->getFwdLUT(), csFull, lmcsEnable); -#else // JVET_Z0118_GDR +#else PelBuf picRecoBuff = tu.cs->picture->getRecoBuf( tu.blocks[compID] ); #if JVET_Y0065_GPM_INTRA @@ -9246,9 +9246,9 @@ void InterSearch::xEstimateInterResidualQT(CodingStructure &cs, Partitioner &par picRecoBuff.reconstruct( cs.getPredBuf( tu.blocks[compID] ), csFull->getResiBuf( tu.blocks[compID] ), tu.cu->cs->slice->clpRng( compID ) ); } -#endif // JVET_Z0118_GDR +#endif } -#endif // SIGN_PREDICTION +#endif } // component loop if (colorTransFlag)