diff --git a/source/App/EncoderApp/EncApp.cpp b/source/App/EncoderApp/EncApp.cpp index 4a0c55cb13e7a0b41b88294a2eb2232d99742286..b6ba6b484544a89012b608fecc234c1132511289 100644 --- a/source/App/EncoderApp/EncApp.cpp +++ b/source/App/EncoderApp/EncApp.cpp @@ -521,12 +521,12 @@ void EncApp::xInitLibCfg() //====== Coding Structure ======== m_cEncLib.setIntraPeriod ( m_iIntraPeriod ); -#if GDR_ENABLED +#if GDR_ENABLED m_cEncLib.setGdrEnabled ( m_gdrEnabled ); m_cEncLib.setGdrPeriod ( m_gdrPeriod ); m_cEncLib.setGdrPocStart ( m_gdrPocStart ); - m_cEncLib.setGdrInterval ( m_gdrInterval); - m_cEncLib.setGdrNoHash ( m_gdrNoHash ); + m_cEncLib.setGdrInterval ( m_gdrInterval); + m_cEncLib.setGdrNoHash ( m_gdrNoHash ); #endif m_cEncLib.setDecodingRefreshType ( m_iDecodingRefreshType ); m_cEncLib.setGOPSize ( m_iGOPSize ); diff --git a/source/App/EncoderApp/EncAppCfg.cpp b/source/App/EncoderApp/EncAppCfg.cpp index 198d45738d871f24334bcc6116ec3e80f475b3e5..cc76095dd27b3b151944e172619e8e5fc4d951fc 100644 --- a/source/App/EncoderApp/EncAppCfg.cpp +++ b/source/App/EncoderApp/EncAppCfg.cpp @@ -1010,8 +1010,8 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) ("GdrEnabled", m_gdrEnabled, false, "GDR enabled") ("GdrPocStart", m_gdrPocStart, -1, "GDR poc start") ("GdrPeriod", m_gdrPeriod, -1, "Number of frames between GDR picture to the next GDR picture") - ("GdrInterval", m_gdrInterval, -1, "Number of frames from GDR picture to the recovery point picture") - ("GdrNoHash", m_gdrNoHash, true, "Do not generate decode picture hash SEI messages for GDR and recovering pictures") + ("GdrInterval", m_gdrInterval, -1, "Number of frames from GDR picture to the recovery point picture") + ("GdrNoHash", m_gdrNoHash, true, "Do not generate decode picture hash SEI messages for GDR and recovering pictures") #endif ("DecodingRefreshType,-dr", m_iDecodingRefreshType, 0, "Intra refresh type (0:none 1:CRA 2:IDR 3:RecPointSEI)") ("GOPSize,g", m_iGOPSize, 1, "GOP size of temporal structure") @@ -1544,7 +1544,7 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) m_BIO = false; m_DMVR = false; m_SMVD = false; - + if (m_gdrPeriod < 0) { m_gdrPeriod = m_iFrameRate * 2; @@ -2278,7 +2278,7 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) } #endif -#if GDR_ENABLED +#if GDR_ENABLED if (m_gdrEnabled) { m_virtualBoundariesEnabledFlag = 1; diff --git a/source/Lib/CommonLib/CodingStructure.cpp b/source/Lib/CommonLib/CodingStructure.cpp index 39d15569279a1df1a3c01d39801a9f38afd0665e..d1331186188258ce46d6c0074f3a5aa9dc261bf2 100644 --- a/source/Lib/CommonLib/CodingStructure.cpp +++ b/source/Lib/CommonLib/CodingStructure.cpp @@ -136,13 +136,13 @@ void CodingStructure::destroy() m_motionBuf = nullptr; #if GDR_ENABLED - if (picHeader) + if (picHeader) { delete picHeader; picHeader = nullptr; } #endif - + m_tuCache.cache( tus ); m_puCache.cache( pus ); m_cuCache.cache( cus ); @@ -157,7 +157,7 @@ void CodingStructure::releaseIntermediateData() #if GDR_ENABLED bool CodingStructure::containRefresh(int begX, int endX) const -{ +{ if (begX == endX) { return false; @@ -170,7 +170,7 @@ bool CodingStructure::containRefresh(int begX, int endX) const { return true; } - + return false; } @@ -198,12 +198,12 @@ bool CodingStructure::overlapRefresh() const const int csWidth = area.lwidth(); bool ret = overlapRefresh(csX, csX + csWidth); - + return ret; } bool CodingStructure::withinRefresh(int begX, int endX) const -{ +{ if (begX == endX) { return false; @@ -257,10 +257,10 @@ bool CodingStructure::refreshCrossBTV(int begX, int endX) const const Area refreshArea = Area(begX, csY, endX - begX, csHeight); const Area csArea0 = Area(csX, csY, (csWidth >> 1), csHeight); - const Area csArea1 = Area(csX + (csWidth >> 1), csY, (csWidth >> 1), csHeight); + const Area csArea1 = Area(csX + (csWidth >> 1), csY, (csWidth >> 1), csHeight); bool overlap0 = csArea0.overlap(refreshArea); - bool overlap1 = csArea1.overlap(refreshArea); + bool overlap1 = csArea1.overlap(refreshArea); int sum = (overlap0 ? 1 : 0) + (overlap1 ? 1 : 0); @@ -289,7 +289,7 @@ bool CodingStructure::overlapDirty() const } bool CodingStructure::dirtyCrossTTV() const -{ +{ const int csX = area.lx(); const int csY = area.ly(); const int csWidth = area.lwidth(); @@ -304,7 +304,7 @@ bool CodingStructure::dirtyCrossTTV() const bool clean2 = isClean(csArea2, CHANNEL_TYPE_LUMA); bool allclean = clean0 && clean1 && clean2; - + if (allclean) { return false; @@ -322,9 +322,9 @@ bool CodingStructure::dirtyCrossBTV() const const Area csArea0 = Area(csX, csY, (csWidth >> 1), csHeight); const Area csArea1 = Area(csX + (csWidth >> 1), csY, (csWidth >> 1), csHeight); - + bool clean0 = isClean(csArea0, CHANNEL_TYPE_LUMA); - bool clean1 = isClean(csArea1, CHANNEL_TYPE_LUMA); + bool clean1 = isClean(csArea1, CHANNEL_TYPE_LUMA); bool allclean = clean0 && clean1; @@ -388,7 +388,7 @@ bool CodingStructure::isClean(const Position &IntPos, Mv FracMv) const return false; } } - + return true; } @@ -399,7 +399,7 @@ bool CodingStructure::isClean(const Position &IntPos, Mv FracMv, const Picture* 2. gdr picture pos in clean area -> true pos in dirty area -> false - */ + */ if (!refPic) { return false; @@ -447,7 +447,7 @@ bool CodingStructure::isClean(const Position &IntPos, Mv FracMv, const Picture* return false; } } - else + else { // refPic is normal picture bool isCurGdrPicture = (slice->getPicHeader()->getNumVerVirtualBoundaries() > 0); @@ -460,7 +460,7 @@ bool CodingStructure::isClean(const Position &IntPos, Mv FracMv, const Picture* { return true; } - } + } } @@ -471,7 +471,7 @@ bool CodingStructure::isClean(const Position &IntPos, Mv FracMv, RefPicList e, i 2. gdr picture pos in clean area -> true pos in dirty area -> false - */ + */ if (refIdx < 0) { return false; @@ -496,11 +496,11 @@ bool CodingStructure::isClean(const Position &IntPos, Mv FracMv, RefPicList e, i { return false; } - + bool isRefGdrPicture = refPh->getInGdrInterval(); if (isRefGdrPicture) - { + { const int lumaPixelAway = 4 + (isProf << 0); const int chromaPixelAway = 4 + (isProf << 1); @@ -519,7 +519,7 @@ bool CodingStructure::isClean(const Position &IntPos, Mv FracMv, RefPicList e, i const int lastChromaPos = ((OrigFracPos.x / iMvChromaFrac) * iMvChromaFrac) + FracMv.getHor() + (isIntChromaMv ? 0 : (chromaPixelAway << iMvShift)) ; const int lastPelPos = std::max(lastLumaPos, lastChromaPos); - + if (lastPelPos < scaledEndX) { return true; @@ -529,7 +529,7 @@ bool CodingStructure::isClean(const Position &IntPos, Mv FracMv, RefPicList e, i return false; } } - else + else { // refPic is normal picture bool isCurGdrPicture = (slice->getPicHeader()->getNumVerVirtualBoundaries() > 0); @@ -572,7 +572,7 @@ bool CodingStructure::isClean(const Position &IntPos, Mv FracMv, RefPicList e, i return false; } - if (refIdx == MAX_NUM_REF) + if (refIdx == MAX_NUM_REF) { refPh = picHeader; } @@ -658,8 +658,8 @@ bool CodingStructure::isClean(const Position &IntPos, RefPicList e, int refIdx) bool isRefGdrPicture = refPh->getInGdrInterval(); if (isRefGdrPicture) - { - if (IntPos.x < refPh->getVirtualBoundariesPosX(0)) + { + if (IntPos.x < refPh->getVirtualBoundariesPosX(0)) { return true; } @@ -668,7 +668,7 @@ bool CodingStructure::isClean(const Position &IntPos, RefPicList e, int refIdx) return false; } } - else + else { // refPic is normal picture bool isCurGdrPicture = (slice->getPicHeader()->getNumVerVirtualBoundaries() > 0); @@ -685,7 +685,7 @@ bool CodingStructure::isClean(const Position &IntPos, RefPicList e, int refIdx) } bool CodingStructure::isClean(const Position &IntPos, const Picture* const refPic) const -{ +{ if (!refPic) { return false; @@ -696,7 +696,7 @@ bool CodingStructure::isClean(const Position &IntPos, const Picture* const refPi if (isRefGdrPicture) { - if (IntPos.x < refPh->getVirtualBoundariesPosX(0)) + if (IntPos.x < refPh->getVirtualBoundariesPosX(0)) { return true; } @@ -705,7 +705,7 @@ bool CodingStructure::isClean(const Position &IntPos, const Picture* const refPi return false; } } - else + else { // refPic is normal picture bool isCurGdrPicture = (slice->getPicHeader()->getNumVerVirtualBoundaries() > 0); @@ -757,7 +757,7 @@ bool CodingStructure::isClean(const Position &IntPos, const ChannelType effChTyp } bool CodingStructure::isClean(const Area &area, const ChannelType effChType) const -{ +{ Position pTopLeft = area.topLeft(); Position pTopRight = area.topRight(); Position pBotLeft = area.bottomLeft(); @@ -772,7 +772,7 @@ bool CodingStructure::isClean(const Area &area, const ChannelType effChType) con } bool CodingStructure::isClean(const ChannelType effChType) const -{ +{ bool ret = isClean(area.Y(), effChType); return ret; @@ -780,38 +780,38 @@ bool CodingStructure::isClean(const ChannelType effChType) const bool CodingStructure::isSubPuClean(PredictionUnit &pu, const Mv *mv) const { - MotionBuf mb = pu.getMotionBuf(); - - if (pu.cu->affine) + MotionBuf mb = pu.getMotionBuf(); + + if (pu.cu->affine) { Position puPos = pu.Y().pos(); Size subPuSize = Size(4, 4); - - int isProf = 1; - for (int y = 0; y < mb.height; y++) + int isProf = 1; + + for (int y = 0; y < mb.height; y++) { - for (int x = 0; x < mb.width; x++) + for (int x = 0; x < mb.width; x++) { - MotionInfo mi = mb.at(x, y); + MotionInfo mi = mb.at(x, y); Position subPuPos = Position{puPos.x + (x << 2), puPos.y + (y << 2)}; Area subPuArea = Area(subPuPos, subPuSize); Position subPuTR = subPuArea.topRight(); // check if SubPu with L0 is Out of boundary - if (mi.refIdx[0] >= 0) + if (mi.refIdx[0] >= 0) { - if (!isClean(subPuTR, mi.mv[0], REF_PIC_LIST_0, mi.refIdx[0], isProf)) + if (!isClean(subPuTR, mi.mv[0], REF_PIC_LIST_0, mi.refIdx[0], isProf)) { return false; } } // check if SubPu wiht L1 is Out of boundary - if (mi.refIdx[1] >= 0) + if (mi.refIdx[1] >= 0) { - if (!isClean(subPuTR, mi.mv[1], REF_PIC_LIST_1, mi.refIdx[1], isProf)) + if (!isClean(subPuTR, mi.mv[1], REF_PIC_LIST_1, mi.refIdx[1], isProf)) { return false; } @@ -1847,7 +1847,7 @@ void CodingStructure::initSubStructure( CodingStructure& subStruct, const Channe subStruct.vps = vps; subStruct.pps = pps; #if GDR_ENABLED - if (!subStruct.picHeader) + if (!subStruct.picHeader) { subStruct.picHeader = new PicHeader; subStruct.picHeader->initPicHeader(); diff --git a/source/Lib/CommonLib/ContextModelling.cpp b/source/Lib/CommonLib/ContextModelling.cpp index 5edbb1cb887eed1fe6973011dda524adcbc83cce..07401019b7673d77da36cd1f5209337dd9ab8852 100644 --- a/source/Lib/CommonLib/ContextModelling.cpp +++ b/source/Lib/CommonLib/ContextModelling.cpp @@ -369,8 +369,8 @@ void MergeCtx::setMergeInfo( PredictionUnit& pu, int candIdx ) CodingStructure &cs = *pu.cs; const bool isEncodeGdrClean = cs.sps->getGDREnabledFlag() && cs.pcv->isEncoder && ((cs.picHeader->getInGdrInterval() && cs.isClean(pu.Y().topRight(), CHANNEL_TYPE_LUMA)) || (cs.picHeader->getNumVerVirtualBoundaries() == 0)); - if (isEncodeGdrClean) - { + if (isEncodeGdrClean) + { Mv mv0 = pu.mv[REF_PIC_LIST_0]; Mv mv1 = pu.mv[REF_PIC_LIST_1]; @@ -380,7 +380,7 @@ void MergeCtx::setMergeInfo( PredictionUnit& pu, int candIdx ) pu.mvSolid[REF_PIC_LIST_0] = mvSolid[(candIdx << 1) + 0]; pu.mvSolid[REF_PIC_LIST_1] = mvSolid[(candIdx << 1) + 1]; pu.mvValid[REF_PIC_LIST_0] = cs.isClean(pu.Y().topRight(), mv0, REF_PIC_LIST_0, refIdx0); - pu.mvValid[REF_PIC_LIST_1] = cs.isClean(pu.Y().topRight(), mv1, REF_PIC_LIST_1, refIdx1); + pu.mvValid[REF_PIC_LIST_1] = cs.isClean(pu.Y().topRight(), mv1, REF_PIC_LIST_1, refIdx1); } #endif @@ -409,7 +409,7 @@ void MergeCtx::setMmvdMergeCandiInfo(PredictionUnit& pu, int candIdx) Mv tempMv[2]; #if GDR_ENABLED - const CodingStructure &cs = *pu.cs; + const CodingStructure &cs = *pu.cs; const bool isEncodeGdrClean = cs.sps->getGDREnabledFlag() && cs.pcv->isEncoder && ((cs.picHeader->getInGdrInterval() && cs.isClean(pu.Y().topRight(), CHANNEL_TYPE_LUMA)) || (cs.picHeader->getNumVerVirtualBoundaries() == 0)); #endif @@ -503,7 +503,7 @@ void MergeCtx::setMmvdMergeCandiInfo(PredictionUnit& pu, int candIdx) pu.mv[REF_PIC_LIST_1] = mmvdBaseMv[fPosBaseIdx][1].mv + tempMv[1]; pu.refIdx[REF_PIC_LIST_1] = refList1; #if GDR_ENABLED - if (isEncodeGdrClean) + if (isEncodeGdrClean) { Mv mv0 = pu.mv[REF_PIC_LIST_0]; Mv mv1 = pu.mv[REF_PIC_LIST_1]; @@ -547,11 +547,11 @@ void MergeCtx::setMmvdMergeCandiInfo(PredictionUnit& pu, int candIdx) pu.refIdx[REF_PIC_LIST_1] = -1; #if GDR_ENABLED - if (isEncodeGdrClean) + if (isEncodeGdrClean) { Mv mv0 = pu.mv[REF_PIC_LIST_0]; //Mv mv1 = pu.mv[REF_PIC_LIST_1]; - + int refIdx0 = pu.refIdx[REF_PIC_LIST_0]; //int refIdx1 = pu.refIdx[REF_PIC_LIST_1]; @@ -590,7 +590,7 @@ void MergeCtx::setMmvdMergeCandiInfo(PredictionUnit& pu, int candIdx) pu.mv[REF_PIC_LIST_1] = mmvdBaseMv[fPosBaseIdx][1].mv + tempMv[1]; pu.refIdx[REF_PIC_LIST_1] = refList1; #if GDR_ENABLED - if (isEncodeGdrClean) + if (isEncodeGdrClean) { // Mv mv0 = pu.mv[REF_PIC_LIST_0]; Mv mv1 = pu.mv[REF_PIC_LIST_1]; diff --git a/source/Lib/CommonLib/InterPrediction.cpp b/source/Lib/CommonLib/InterPrediction.cpp index fe789d9eb94774c5bcb8da555e800cfe170ecf04..34adec56d9fcc87f15a086e5e91a9bbbac2dd1b8 100644 --- a/source/Lib/CommonLib/InterPrediction.cpp +++ b/source/Lib/CommonLib/InterPrediction.cpp @@ -893,7 +893,7 @@ void InterPrediction::xPredAffineBlk(const ComponentID &compID, const Prediction Mv mvLT =_mv[0]; Mv mvRT =_mv[1]; Mv mvLB =_mv[2]; -#if GDR_ENABLED +#if GDR_ENABLED bool allOk = true; const CodingStructure &cs = *pu.cs; const bool isEncodeGdrClean = cs.sps->getGDREnabledFlag() && cs.pcv->isEncoder && ((cs.picHeader->getInGdrInterval() && cs.isClean(pu.Y().topRight(), CHANNEL_TYPE_LUMA)) || (cs.picHeader->getNumVerVirtualBoundaries() == 0)); @@ -1125,7 +1125,7 @@ void InterPrediction::xPredAffineBlk(const ComponentID &compID, const Prediction } } #if GDR_ENABLED - if (isEncodeGdrClean) + if (isEncodeGdrClean) { Position subPuPos = Position(pux + w + blockWidth, puy + h + blockHeight); Mv subPuMv = Mv(iMvScaleTmpHor, iMvScaleTmpVer); @@ -1156,7 +1156,7 @@ void InterPrediction::xPredAffineBlk(const ComponentID &compID, const Prediction iMvScaleTmpVer = curMv.ver; #if GDR_ENABLED - if (isEncodeGdrClean) + if (isEncodeGdrClean) { Position subPuPos = Position(pux + (w + blockWidth) * 2, puy + (h + blockHeight) * 2); Mv subPuMv = Mv(iMvScaleTmpHor, iMvScaleTmpVer); diff --git a/source/Lib/CommonLib/UnitTools.cpp b/source/Lib/CommonLib/UnitTools.cpp index 96b6c031936d1968f437dad921e455ac9fd8a006..f759784f30b2366ed78c3616714a39050b28f077 100644 --- a/source/Lib/CommonLib/UnitTools.cpp +++ b/source/Lib/CommonLib/UnitTools.cpp @@ -387,7 +387,7 @@ void CU::saveMotionInHMVP( const CodingUnit& cu, const bool isToBeDone ) { MotionInfo mi = pu.getMotionInfo(); -#if GDR_ENABLED +#if GDR_ENABLED mi.sourcePos = pu.lumaPos(); mi.sourceClean = pu.cs->isClean(mi.sourcePos, CHANNEL_TYPE_LUMA); #endif @@ -872,11 +872,11 @@ bool PU::addMergeHMVPCand(const CodingStructure &cs, MergeCtx &mrgCtx, const int auto &lut = ibcFlag ? cs.motionLut.lutIbc : cs.motionLut.lut; int num_avai_candInLUT = (int)lut.size(); -#if GDR_ENABLED +#if GDR_ENABLED const bool isEncodeGdrClean = cs.sps->getGDREnabledFlag() && cs.pcv->isEncoder && ((cs.picHeader->getInGdrInterval() && cs.isClean(pu.Y().topRight(), CHANNEL_TYPE_LUMA)) || (cs.picHeader->getNumVerVirtualBoundaries() == 0)); - - bool vbOnCtuBoundary = true; - if (isEncodeGdrClean) + + bool vbOnCtuBoundary = true; + if (isEncodeGdrClean) { vbOnCtuBoundary = (pu.cs->picHeader->getNumVerVirtualBoundaries() == 0) || (pu.cs->picHeader->getVirtualBoundariesPosX(0) % pu.cs->sps->getMaxCUWidth() == 0); allCandSolidInAbove = allCandSolidInAbove && vbOnCtuBoundary; @@ -885,9 +885,9 @@ bool PU::addMergeHMVPCand(const CodingStructure &cs, MergeCtx &mrgCtx, const int for (int mrgIdx = 1; mrgIdx <= num_avai_candInLUT; mrgIdx++) { miNeighbor = lut[num_avai_candInLUT - mrgIdx]; -#if GDR_ENABLED +#if GDR_ENABLED Position sourcePos = Position(0, 0); - if (isEncodeGdrClean) + if (isEncodeGdrClean) { sourcePos = miNeighbor.sourcePos; } @@ -901,8 +901,8 @@ bool PU::addMergeHMVPCand(const CodingStructure &cs, MergeCtx &mrgCtx, const int mrgCtx.BcwIdx [cnt] = (miNeighbor.interDir == 3) ? miNeighbor.BcwIdx : BCW_DEFAULT; mrgCtx.mvFieldNeighbours[cnt << 1].setMvField(miNeighbor.mv[0], miNeighbor.refIdx[0]); -#if GDR_ENABLED - if (isEncodeGdrClean) +#if GDR_ENABLED + if (isEncodeGdrClean) { // note : cannot gaurantee the order/value in the lut if any of the lut is in dirty area mrgCtx.mvPos[(cnt << 1) + 0] = sourcePos; @@ -915,12 +915,12 @@ bool PU::addMergeHMVPCand(const CodingStructure &cs, MergeCtx &mrgCtx, const int { mrgCtx.mvFieldNeighbours[(cnt << 1) + 1].setMvField(miNeighbor.mv[1], miNeighbor.refIdx[1]); #if GDR_ENABLED - if (isEncodeGdrClean) + if (isEncodeGdrClean) { mrgCtx.mvPos[(cnt << 1) + 1] = sourcePos; mrgCtx.mvSolid[(cnt << 1) + 1] = allCandSolidInAbove && vbOnCtuBoundary; mrgCtx.mvValid[(cnt << 1) + 1] = cs.isClean(pu.Y().bottomRight(), miNeighbor.mv[1], REF_PIC_LIST_1, miNeighbor.refIdx[1]); - allCandSolidInAbove = allCandSolidInAbove && vbOnCtuBoundary; + allCandSolidInAbove = allCandSolidInAbove && vbOnCtuBoundary; } #endif } @@ -950,7 +950,7 @@ void PU::getIBCMergeCandidates(const PredictionUnit &pu, MergeCtx& mrgCtx, const { const CodingStructure &cs = *pu.cs; const uint32_t maxNumMergeCand = pu.cs->sps->getMaxNumIBCMergeCand(); -#if GDR_ENABLED +#if GDR_ENABLED const bool isEncodeGdrClean = cs.sps->getGDREnabledFlag() && cs.pcv->isEncoder && ((cs.picHeader->getInGdrInterval() && cs.isClean(pu.Y().topRight(), CHANNEL_TYPE_LUMA)) || (cs.picHeader->getNumVerVirtualBoundaries() == 0)); bool allCandSolidInAbove = true; #endif @@ -962,8 +962,8 @@ void PU::getIBCMergeCandidates(const PredictionUnit &pu, MergeCtx& mrgCtx, const mrgCtx.mrgTypeNeighbours[ui] = MRG_TYPE_IBC; mrgCtx.mvFieldNeighbours[ui * 2].refIdx = NOT_VALID; mrgCtx.mvFieldNeighbours[ui * 2 + 1].refIdx = NOT_VALID; -#if GDR_ENABLED - if (isEncodeGdrClean) +#if GDR_ENABLED + if (isEncodeGdrClean) { mrgCtx.mvSolid[(ui << 1) + 0] = true; mrgCtx.mvSolid[(ui << 1) + 1] = true; @@ -997,7 +997,7 @@ void PU::getIBCMergeCandidates(const PredictionUnit &pu, MergeCtx& mrgCtx, const // get Mv from Left mrgCtx.mvFieldNeighbours[cnt << 1].setMvField(miLeft.mv[0], miLeft.refIdx[0]); #if GDR_ENABLED - if (isEncodeGdrClean) + if (isEncodeGdrClean) { mrgCtx.mvSolid[(cnt << 1) + 0] = cs.isClean(posLB.offset(-1, 0), pu.chType); } @@ -1029,7 +1029,7 @@ void PU::getIBCMergeCandidates(const PredictionUnit &pu, MergeCtx& mrgCtx, const // get Mv from Above mrgCtx.mvFieldNeighbours[cnt << 1].setMvField(miAbove.mv[0], miAbove.refIdx[0]); #if GDR_ENABLED - if (isEncodeGdrClean) + if (isEncodeGdrClean) { mrgCtx.mvSolid[(cnt << 1) + 0] = cs.isClean(posRT.offset(0, -1), pu.chType); } @@ -1077,7 +1077,7 @@ void PU::getIBCMergeCandidates(const PredictionUnit &pu, MergeCtx& mrgCtx, const mrgCtx.interDirNeighbours[cnt] = 1; #if GDR_ENABLED // GDR: zero mv(0,0) - if (isEncodeGdrClean) + if (isEncodeGdrClean) { mrgCtx.mvSolid[cnt << 1] = true && allCandSolidInAbove; allCandSolidInAbove = true && allCandSolidInAbove; @@ -1102,7 +1102,7 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx, const Slice &slice = *pu.cs->slice; const uint32_t maxNumMergeCand = pu.cs->sps->getMaxNumMergeCand(); CHECK (maxNumMergeCand > MRG_MAX_NUM_CANDS, "selected maximum number of merge candidate exceeds global limit"); -#if GDR_ENABLED +#if GDR_ENABLED const bool isEncodeGdrClean = cs.sps->getGDREnabledFlag() && cs.pcv->isEncoder && ((cs.picHeader->getInGdrInterval() && cs.isClean(pu.Y().topRight(), CHANNEL_TYPE_LUMA)) || (cs.picHeader->getNumVerVirtualBoundaries() == 0)); bool allCandSolidInAbove = true; #endif @@ -1113,8 +1113,8 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx, mrgCtx.mrgTypeNeighbours [ui] = MRG_TYPE_DEFAULT_N; mrgCtx.mvFieldNeighbours[(ui << 1) ].refIdx = NOT_VALID; mrgCtx.mvFieldNeighbours[(ui << 1) + 1].refIdx = NOT_VALID; -#if GDR_ENABLED - if (isEncodeGdrClean) +#if GDR_ENABLED + if (isEncodeGdrClean) { mrgCtx.mvSolid[(ui << 1) + 0] = true; mrgCtx.mvSolid[(ui << 1) + 1] = true; @@ -1154,7 +1154,7 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx, mrgCtx.mvFieldNeighbours[cnt << 1].setMvField(miAbove.mv[0], miAbove.refIdx[0]); #if GDR_ENABLED - if (isEncodeGdrClean) + if (isEncodeGdrClean) { Position pos = puAbove->lumaPos(); mrgCtx.mvPos[(cnt << 1) + 0] = pos; @@ -1166,7 +1166,7 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx, { mrgCtx.mvFieldNeighbours[(cnt << 1) + 1].setMvField(miAbove.mv[1], miAbove.refIdx[1]); #if GDR_ENABLED - if (isEncodeGdrClean) + if (isEncodeGdrClean) { Position pos = puAbove->lumaPos(); mrgCtx.mvPos[(cnt << 1) + 1] = pos; @@ -1207,7 +1207,7 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx, // get Mv from Left mrgCtx.mvFieldNeighbours[cnt << 1].setMvField(miLeft.mv[0], miLeft.refIdx[0]); #if GDR_ENABLED - if (isEncodeGdrClean) + if (isEncodeGdrClean) { Position pos = puLeft->lumaPos(); mrgCtx.mvPos[(cnt << 1) + 0] = pos; @@ -1220,7 +1220,7 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx, { mrgCtx.mvFieldNeighbours[(cnt << 1) + 1].setMvField(miLeft.mv[1], miLeft.refIdx[1]); #if GDR_ENABLED - if (isEncodeGdrClean) + if (isEncodeGdrClean) { Position pos = puLeft->lumaPos(); mrgCtx.mvPos[(cnt << 1) + 1] = pos; @@ -1263,7 +1263,7 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx, mrgCtx.BcwIdx[cnt] = (mrgCtx.interDirNeighbours[cnt] == 3) ? puAboveRight->cu->BcwIdx : BCW_DEFAULT; mrgCtx.mvFieldNeighbours[cnt << 1].setMvField( miAboveRight.mv[0], miAboveRight.refIdx[0] ); #if GDR_ENABLED - if (isEncodeGdrClean) + if (isEncodeGdrClean) { Position pos = puAboveRight->lumaPos(); mrgCtx.mvPos[(cnt << 1) + 0] = pos; @@ -1276,7 +1276,7 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx, { mrgCtx.mvFieldNeighbours[( cnt << 1 ) + 1].setMvField( miAboveRight.mv[1], miAboveRight.refIdx[1] ); #if GDR_ENABLED - if (isEncodeGdrClean) + if (isEncodeGdrClean) { Position pos = puAboveRight->lumaPos(); mrgCtx.mvPos[(cnt << 1) + 1] = pos; @@ -1318,7 +1318,7 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx, // get Mv from Bottom-Left mrgCtx.mvFieldNeighbours[cnt << 1].setMvField( miBelowLeft.mv[0], miBelowLeft.refIdx[0] ); #if GDR_ENABLED - if (isEncodeGdrClean) + if (isEncodeGdrClean) { Position pos = puLeftBottom->lumaPos(); mrgCtx.mvPos[(cnt << 1) + 0] = pos; @@ -1331,7 +1331,7 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx, { mrgCtx.mvFieldNeighbours[( cnt << 1 ) + 1].setMvField( miBelowLeft.mv[1], miBelowLeft.refIdx[1] ); #if GDR_ENABLED - if (isEncodeGdrClean) + if (isEncodeGdrClean) { Position pos = puLeftBottom->lumaPos(); mrgCtx.mvPos[(cnt << 1) + 1] = pos; @@ -1376,7 +1376,7 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx, // get Mv from Above-Left mrgCtx.mvFieldNeighbours[cnt << 1].setMvField( miAboveLeft.mv[0], miAboveLeft.refIdx[0] ); #if GDR_ENABLED - if (isEncodeGdrClean) + if (isEncodeGdrClean) { Position pos = puAboveLeft->lumaPos(); mrgCtx.mvPos[(cnt << 1) + 0] = pos; @@ -1389,7 +1389,7 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx, { mrgCtx.mvFieldNeighbours[( cnt << 1 ) + 1].setMvField( miAboveLeft.mv[1], miAboveLeft.refIdx[1] ); #if GDR_ENABLED - if (isEncodeGdrClean) + if (isEncodeGdrClean) { Position pos = puAboveLeft->lumaPos(); mrgCtx.mvPos[(cnt << 1) + 1] = pos; @@ -1458,7 +1458,7 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx, dir |= 1; mrgCtx.mvFieldNeighbours[2 * uiArrayAddr].setMvField(cColMv, iRefIdx); #if GDR_ENABLED - if (isEncodeGdrClean) + if (isEncodeGdrClean) { Mv ccMv; @@ -1486,7 +1486,7 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx, dir |= 2; mrgCtx.mvFieldNeighbours[2 * uiArrayAddr + 1].setMvField(cColMv, iRefIdx); #if GDR_ENABLED - if (isEncodeGdrClean) + if (isEncodeGdrClean) { Mv ccMv; @@ -1567,7 +1567,7 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx, const short refIdxJ = mrgCtx.mvFieldNeighbours[1 * 2 + refListId].refIdx; #if GDR_ENABLED - // GDR: Pairwise average candidate + // GDR: Pairwise average candidate bool mvISolid = mrgCtx.mvSolid[0 * 2 + refListId]; bool mvJSolid = mrgCtx.mvSolid[1 * 2 + refListId]; bool mvSolid = true; @@ -1593,7 +1593,7 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx, mrgCtx.mvFieldNeighbours[cnt * 2 + refListId].setMvField( avgMv, refIdxI ); #if GDR_ENABLED // GDR: Pairwise single I,J candidate - if (isEncodeGdrClean) + if (isEncodeGdrClean) { mvSolid = mvISolid && mvJSolid && allCandSolidInAbove; @@ -1611,7 +1611,7 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx, mrgCtx.mvFieldNeighbours[cnt * 2 + refListId].setMvField( singleMv, refIdxI ); #if GDR_ENABLED // GDR: Pairwise single I,J candidate - if (isEncodeGdrClean) + if (isEncodeGdrClean) { mvSolid = mvISolid && allCandSolidInAbove; @@ -1628,7 +1628,7 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx, mrgCtx.mvFieldNeighbours[cnt * 2 + refListId].setMvField( singleMv, refIdxJ ); #if GDR_ENABLED // GDR: Pairwise single I,J candidate - if (isEncodeGdrClean) + if (isEncodeGdrClean) { mvSolid = mvJSolid && allCandSolidInAbove; @@ -1670,7 +1670,7 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx, #if GDR_ENABLED // GDR: zero mv(0,0) - if (isEncodeGdrClean) + if (isEncodeGdrClean) { mrgCtx.mvPos[uiArrayAddr << 1] = Position(0, 0); mrgCtx.mvSolid[uiArrayAddr << 1] = true && allCandSolidInAbove; @@ -1684,7 +1684,7 @@ void PU::getInterMergeCandidates( const PredictionUnit &pu, MergeCtx& mrgCtx, mrgCtx.mvFieldNeighbours [(uiArrayAddr << 1) + 1].setMvField(Mv(0, 0), r); #if GDR_ENABLED // GDR: zero mv(0,0) - if (isEncodeGdrClean) + if (isEncodeGdrClean) { mrgCtx.mvPos[(uiArrayAddr << 1) + 1] = Position(0, 0); mrgCtx.mvSolid[(uiArrayAddr << 1) + 1] = true && allCandSolidInAbove; @@ -1815,7 +1815,7 @@ void PU::getInterMMVDMergeCandidates(const PredictionUnit &pu, MergeCtx& mrgCtx, #endif #if GDR_ENABLED - for (int k = 0; k < MMVD_BASE_MV_NUM; k++) + for (int k = 0; k < MMVD_BASE_MV_NUM; k++) { mrgCtx.mmvdSolid[k][0] = true; mrgCtx.mmvdSolid[k][1] = true; @@ -1835,7 +1835,7 @@ void PU::getInterMMVDMergeCandidates(const PredictionUnit &pu, MergeCtx& mrgCtx, mrgCtx.mmvdBaseMv[currBaseNum][0] = mrgCtx.mvFieldNeighbours[(k << 1)]; mrgCtx.mmvdBaseMv[currBaseNum][1] = mrgCtx.mvFieldNeighbours[(k << 1) + 1]; #if GDR_ENABLED - if (isEncodeGdrClean) + if (isEncodeGdrClean) { mrgCtx.mmvdSolid[currBaseNum][0] = mrgCtx.mvSolid[(k << 1) + 0]; mrgCtx.mmvdSolid[currBaseNum][1] = mrgCtx.mvSolid[(k << 1) + 1]; @@ -1847,7 +1847,7 @@ void PU::getInterMMVDMergeCandidates(const PredictionUnit &pu, MergeCtx& mrgCtx, mrgCtx.mmvdBaseMv[currBaseNum][0] = mrgCtx.mvFieldNeighbours[(k << 1)]; mrgCtx.mmvdBaseMv[currBaseNum][1] = MvField(Mv(0, 0), -1); #if GDR_ENABLED - if (isEncodeGdrClean) + if (isEncodeGdrClean) { mrgCtx.mmvdSolid[currBaseNum][0] = mrgCtx.mvSolid[(k << 1) + 0]; mrgCtx.mmvdSolid[currBaseNum][1] = true; @@ -1859,7 +1859,7 @@ void PU::getInterMMVDMergeCandidates(const PredictionUnit &pu, MergeCtx& mrgCtx, mrgCtx.mmvdBaseMv[currBaseNum][0] = MvField(Mv(0, 0), -1); mrgCtx.mmvdBaseMv[currBaseNum][1] = mrgCtx.mvFieldNeighbours[(k << 1) + 1]; #if GDR_ENABLED - if (isEncodeGdrClean) + if (isEncodeGdrClean) { mrgCtx.mmvdSolid[currBaseNum][0] = true; mrgCtx.mmvdSolid[currBaseNum][1] = mrgCtx.mvSolid[(k << 1) + 1]; @@ -2281,7 +2281,7 @@ void PU::fillMvpCand(PredictionUnit &pu, const RefPicList &eRefPicList, const in if ( ( C0Avail && getColocatedMVP( pu, eRefPicList, posC0, cColMv, refIdx_Col, false ) ) || getColocatedMVP( pu, eRefPicList, posC1, cColMv, refIdx_Col, false ) ) { #if GDR_ENABLED - if (isEncodeGdrClean) + if (isEncodeGdrClean) { Mv ccMv; bool posC0inCurPicSolid = cs.isClean(posC0, CHANNEL_TYPE_LUMA); @@ -2317,7 +2317,7 @@ void PU::fillMvpCand(PredictionUnit &pu, const RefPicList &eRefPicList, const in while (pInfo->numCand < AMVP_MAX_NUM_CANDS) { #if GDR_ENABLED - if (isEncodeGdrClean) + if (isEncodeGdrClean) { pInfo->mvType[pInfo->numCand] = MVP_ZERO; allCandSolidInAbove = pInfo->mvSolid[pInfo->numCand] = true && allCandSolidInAbove; @@ -2339,7 +2339,7 @@ bool PU::addAffineMVPCandUnscaled( const PredictionUnit &pu, const RefPicList &r const PredictionUnit *neibPU = NULL; Position neibPos; -#if GDR_ENABLED +#if GDR_ENABLED const bool isEncodeGdrClean = cs.sps->getGDREnabledFlag() && cs.pcv->isEncoder && ((cs.picHeader->getInGdrInterval() && cs.isClean(pu.Y().topRight(), CHANNEL_TYPE_LUMA)) || (cs.picHeader->getNumVerVirtualBoundaries() == 0)); #endif switch ( dir ) @@ -2393,11 +2393,11 @@ bool PU::addAffineMVPCandUnscaled( const PredictionUnit &pu, const RefPicList &r #if GDR_ENABLED // note : get MV from neihgbor of neibPu (LB, RB) and save to outputAffineMv - if (isEncodeGdrClean) + if (isEncodeGdrClean) { xInheritedAffineMv(pu, neibPU, eRefPicListIndex, outputAffineMv, outputAffineMvSolid, outputAffineMvType, outputAffineMvPos); } - else + else { xInheritedAffineMv(pu, neibPU, eRefPicListIndex, outputAffineMv); } @@ -2411,18 +2411,18 @@ bool PU::addAffineMVPCandUnscaled( const PredictionUnit &pu, const RefPicList &r #if GDR_ENABLED bool neighClean = true; - if (isEncodeGdrClean) + if (isEncodeGdrClean) { - neighClean = cs.isClean(neibPU->Y().pos(), CHANNEL_TYPE_LUMA); + neighClean = cs.isClean(neibPU->Y().pos(), CHANNEL_TYPE_LUMA); affiAMVPInfo.mvSolidLT[affiAMVPInfo.numCand] = neighClean && outputAffineMvSolid[0]; affiAMVPInfo.mvSolidRT[affiAMVPInfo.numCand] = neighClean && outputAffineMvSolid[1]; - + affiAMVPInfo.mvTypeLT[affiAMVPInfo.numCand] = outputAffineMvType[0]; affiAMVPInfo.mvTypeRT[affiAMVPInfo.numCand] = outputAffineMvType[1]; affiAMVPInfo.mvPosLT[affiAMVPInfo.numCand] = outputAffineMvPos[0]; - affiAMVPInfo.mvPosRT[affiAMVPInfo.numCand] = outputAffineMvPos[1]; + affiAMVPInfo.mvPosRT[affiAMVPInfo.numCand] = outputAffineMvPos[1]; } #endif if ( pu.cu->affineType == AFFINEMODEL_6PARAM ) @@ -2430,13 +2430,13 @@ bool PU::addAffineMVPCandUnscaled( const PredictionUnit &pu, const RefPicList &r outputAffineMv[2].roundAffinePrecInternal2Amvr(pu.cu->imv); affiAMVPInfo.mvCandLB[affiAMVPInfo.numCand] = outputAffineMv[2]; #if GDR_ENABLED - if (isEncodeGdrClean) + if (isEncodeGdrClean) { neighClean = cs.isClean(neibPU->Y().pos(), CHANNEL_TYPE_LUMA); affiAMVPInfo.mvSolidLB[affiAMVPInfo.numCand] = neighClean && outputAffineMvSolid[2]; affiAMVPInfo.mvTypeLB[affiAMVPInfo.numCand] = outputAffineMvType[2]; - affiAMVPInfo.mvPosLB[affiAMVPInfo.numCand] = outputAffineMvPos[2]; + affiAMVPInfo.mvPosLB[affiAMVPInfo.numCand] = outputAffineMvPos[2]; } #endif } @@ -2472,7 +2472,7 @@ void PU::xInheritedAffineMv(const PredictionUnit &pu, const PredictionUnit* puNe #if GDR_ENABLED bool neighClean = true; - if (isEncodeGdrClean) + if (isEncodeGdrClean) { neighClean = cs.isClean(puNeighbour->Y().pos(), CHANNEL_TYPE_LUMA); @@ -2502,7 +2502,7 @@ void PU::xInheritedAffineMv(const PredictionUnit &pu, const PredictionUnit* puNe mvRT = puNeighbour->getMotionInfo(posRB).mv[eRefPicList]; #if GDR_ENABLED - if (isEncodeGdrClean) + if (isEncodeGdrClean) { neighClean = cs.isClean(puNeighbour->Y().pos(), CHANNEL_TYPE_LUMA); @@ -2665,17 +2665,17 @@ void PU::fillAffineMvpCand(PredictionUnit &pu, const RefPicList &eRefPicList, co const bool isEncodeGdrClean = cs.sps->getGDREnabledFlag() && cs.pcv->isEncoder && ((cs.picHeader->getInGdrInterval() && cs.isClean(pu.Y().topRight(), CHANNEL_TYPE_LUMA)) || (cs.picHeader->getNumVerVirtualBoundaries() == 0)); bool &allCandSolidInAbove = affiAMVPInfo.allCandSolidInAbove; - if (isEncodeGdrClean) + if (isEncodeGdrClean) { allCandSolidInAbove = true; - + affiAMVPInfo.allCandSolidInAbove = true; - for (int i = 0; i < AMVP_MAX_NUM_CANDS_MEM; i++) + for (int i = 0; i < AMVP_MAX_NUM_CANDS_MEM; i++) { affiAMVPInfo.mvSolidLT[i] = true; affiAMVPInfo.mvSolidRT[i] = true; affiAMVPInfo.mvSolidLB[i] = true; - } + } } #endif // insert inherited affine candidates @@ -2722,11 +2722,11 @@ void PU::fillAffineMvpCand(PredictionUnit &pu, const RefPicList &eRefPicList, co AMVPInfo amvpInfo0; amvpInfo0.numCand = 0; -#if GDR_ENABLED - if (isEncodeGdrClean) +#if GDR_ENABLED + if (isEncodeGdrClean) { amvpInfo0.allCandSolidInAbove = true; - for (int i = 0; i < AMVP_MAX_NUM_CANDS_MEM; i++) + for (int i = 0; i < AMVP_MAX_NUM_CANDS_MEM; i++) { amvpInfo0.mvSolid[i] = true; amvpInfo0.mvValid[i] = true; @@ -2750,11 +2750,11 @@ void PU::fillAffineMvpCand(PredictionUnit &pu, const RefPicList &eRefPicList, co AMVPInfo amvpInfo1; amvpInfo1.numCand = 0; -#if GDR_ENABLED - if (isEncodeGdrClean) +#if GDR_ENABLED + if (isEncodeGdrClean) { amvpInfo1.allCandSolidInAbove = true; - for (int i = 0; i < AMVP_MAX_NUM_CANDS_MEM; i++) + for (int i = 0; i < AMVP_MAX_NUM_CANDS_MEM; i++) { amvpInfo1.mvSolid[i] = true; amvpInfo1.mvValid[i] = true; @@ -2774,11 +2774,11 @@ void PU::fillAffineMvpCand(PredictionUnit &pu, const RefPicList &eRefPicList, co AMVPInfo amvpInfo2; amvpInfo2.numCand = 0; -#if GDR_ENABLED - if (isEncodeGdrClean) +#if GDR_ENABLED + if (isEncodeGdrClean) { amvpInfo2.allCandSolidInAbove = true; - for (int i = 0; i < AMVP_MAX_NUM_CANDS_MEM; i++) + for (int i = 0; i < AMVP_MAX_NUM_CANDS_MEM; i++) { amvpInfo2.mvSolid[i] = true; amvpInfo2.mvValid[i] = true; @@ -2799,7 +2799,7 @@ void PU::fillAffineMvpCand(PredictionUnit &pu, const RefPicList &eRefPicList, co outputAffineMv[2] = amvpInfo2.mvCand[0]; #if GDR_ENABLED - if (isEncodeGdrClean) + if (isEncodeGdrClean) { outputAffineMvSolid[0] = amvpInfo0.mvSolid[0] && allCandSolidInAbove; outputAffineMvSolid[1] = amvpInfo1.mvSolid[0] && allCandSolidInAbove; @@ -2811,7 +2811,7 @@ void PU::fillAffineMvpCand(PredictionUnit &pu, const RefPicList &eRefPicList, co outputAffineMvType[0] = amvpInfo0.mvType[0]; outputAffineMvType[1] = amvpInfo1.mvType[0]; - outputAffineMvType[2] = amvpInfo2.mvType[0]; + outputAffineMvType[2] = amvpInfo2.mvType[0]; allCandSolidInAbove = allCandSolidInAbove && outputAffineMvSolid[0] && outputAffineMvSolid[1] && outputAffineMvSolid[2]; } @@ -2826,7 +2826,7 @@ void PU::fillAffineMvpCand(PredictionUnit &pu, const RefPicList &eRefPicList, co affiAMVPInfo.mvCandRT[affiAMVPInfo.numCand] = outputAffineMv[1]; affiAMVPInfo.mvCandLB[affiAMVPInfo.numCand] = outputAffineMv[2]; #if GDR_ENABLED - if (isEncodeGdrClean) + if (isEncodeGdrClean) { affiAMVPInfo.mvSolidLT[affiAMVPInfo.numCand] = outputAffineMvSolid[0] && allCandSolidInAbove; affiAMVPInfo.mvSolidRT[affiAMVPInfo.numCand] = outputAffineMvSolid[1] && allCandSolidInAbove; @@ -2842,7 +2842,7 @@ void PU::fillAffineMvpCand(PredictionUnit &pu, const RefPicList &eRefPicList, co allCandSolidInAbove = allCandSolidInAbove && outputAffineMvSolid[0] && outputAffineMvSolid[1] && outputAffineMvSolid[2]; } -#endif +#endif affiAMVPInfo.numCand++; } @@ -2857,11 +2857,11 @@ void PU::fillAffineMvpCand(PredictionUnit &pu, const RefPicList &eRefPicList, co affiAMVPInfo.mvCandRT[affiAMVPInfo.numCand] = outputAffineMv[i]; affiAMVPInfo.mvCandLB[affiAMVPInfo.numCand] = outputAffineMv[i]; #if GDR_ENABLED - if (isEncodeGdrClean) + if (isEncodeGdrClean) { affiAMVPInfo.mvSolidLT[affiAMVPInfo.numCand] = outputAffineMvSolid[i] && allCandSolidInAbove; affiAMVPInfo.mvSolidRT[affiAMVPInfo.numCand] = outputAffineMvSolid[i] && allCandSolidInAbove; - affiAMVPInfo.mvSolidLB[affiAMVPInfo.numCand] = outputAffineMvSolid[i] && allCandSolidInAbove; + affiAMVPInfo.mvSolidLB[affiAMVPInfo.numCand] = outputAffineMvSolid[i] && allCandSolidInAbove; affiAMVPInfo.mvPosLT[affiAMVPInfo.numCand] = outputAffineMvPos[i]; affiAMVPInfo.mvPosRT[affiAMVPInfo.numCand] = outputAffineMvPos[i]; @@ -2914,7 +2914,7 @@ void PU::fillAffineMvpCand(PredictionUnit &pu, const RefPicList &eRefPicList, co affiAMVPInfo.mvCandRT[affiAMVPInfo.numCand] = cColMv; affiAMVPInfo.mvCandLB[affiAMVPInfo.numCand] = cColMv; #if GDR_ENABLED - if (isEncodeGdrClean) + if (isEncodeGdrClean) { Mv ccMv; @@ -2925,11 +2925,11 @@ void PU::fillAffineMvpCand(PredictionUnit &pu, const RefPicList &eRefPicList, co bool isMVP0exist = C0Avail && getColocatedMVP(pu, eRefPicList, posC0, ccMv, refIdxCol, false); - if (isMVP0exist) + if (isMVP0exist) { affiAMVPInfo.mvSolidLT[affiAMVPInfo.numCand] = posC0inCurPicSolid && posC0inRefPicSolid && allCandSolidInAbove; affiAMVPInfo.mvSolidRT[affiAMVPInfo.numCand] = posC0inCurPicSolid && posC0inRefPicSolid && allCandSolidInAbove; - affiAMVPInfo.mvSolidLB[affiAMVPInfo.numCand] = posC0inCurPicSolid && posC0inRefPicSolid && allCandSolidInAbove; + affiAMVPInfo.mvSolidLB[affiAMVPInfo.numCand] = posC0inCurPicSolid && posC0inRefPicSolid && allCandSolidInAbove; affiAMVPInfo.mvPosLT[affiAMVPInfo.numCand] = posC0; affiAMVPInfo.mvPosRT[affiAMVPInfo.numCand] = posC0; @@ -2941,11 +2941,11 @@ void PU::fillAffineMvpCand(PredictionUnit &pu, const RefPicList &eRefPicList, co allCandSolidInAbove = allCandSolidInAbove && affiAMVPInfo.mvSolidLT[affiAMVPInfo.numCand] && affiAMVPInfo.mvSolidRT[affiAMVPInfo.numCand] && affiAMVPInfo.mvSolidLB[affiAMVPInfo.numCand]; } - else + else { affiAMVPInfo.mvSolidLT[affiAMVPInfo.numCand] = posC1inCurPicSolid && posC1inRefPicSolid && allCandSolidInAbove; affiAMVPInfo.mvSolidRT[affiAMVPInfo.numCand] = posC1inCurPicSolid && posC1inRefPicSolid && allCandSolidInAbove; - affiAMVPInfo.mvSolidLB[affiAMVPInfo.numCand] = posC1inCurPicSolid && posC1inRefPicSolid && allCandSolidInAbove; + affiAMVPInfo.mvSolidLB[affiAMVPInfo.numCand] = posC1inCurPicSolid && posC1inRefPicSolid && allCandSolidInAbove; affiAMVPInfo.mvPosLT[affiAMVPInfo.numCand] = posC1; affiAMVPInfo.mvPosRT[affiAMVPInfo.numCand] = posC1; @@ -2972,11 +2972,11 @@ void PU::fillAffineMvpCand(PredictionUnit &pu, const RefPicList &eRefPicList, co affiAMVPInfo.mvCandRT[affiAMVPInfo.numCand].setZero(); affiAMVPInfo.mvCandLB[affiAMVPInfo.numCand].setZero(); #if GDR_ENABLED - if (isEncodeGdrClean) + if (isEncodeGdrClean) { affiAMVPInfo.mvSolidLT[affiAMVPInfo.numCand] = true && allCandSolidInAbove; affiAMVPInfo.mvSolidRT[affiAMVPInfo.numCand] = true && allCandSolidInAbove; - affiAMVPInfo.mvSolidLB[affiAMVPInfo.numCand] = true && allCandSolidInAbove; + affiAMVPInfo.mvSolidLB[affiAMVPInfo.numCand] = true && allCandSolidInAbove; affiAMVPInfo.mvPosLT[affiAMVPInfo.numCand] = Position(0, 0); affiAMVPInfo.mvPosRT[affiAMVPInfo.numCand] = Position(0, 0); @@ -3011,7 +3011,7 @@ bool PU::addMVPCandUnscaled( const PredictionUnit &pu, const RefPicList &eRefPic #if GDR_ENABLED const bool isEncodeGdrClean = cs.sps->getGDREnabledFlag() && cs.pcv->isEncoder && ((cs.picHeader->getInGdrInterval() && cs.isClean(pu.Y().topRight(), CHANNEL_TYPE_LUMA)) || (cs.picHeader->getNumVerVirtualBoundaries() == 0)); bool &allCandSolidInAbove = info.allCandSolidInAbove; -#endif +#endif switch (eDir) { @@ -3054,14 +3054,14 @@ bool PU::addMVPCandUnscaled( const PredictionUnit &pu, const RefPicList &eRefPic if( neibRefIdx >= 0 && currRefPOC == cs.slice->getRefPOC( eRefPicListIndex, neibRefIdx ) ) { #if GDR_ENABLED - if (isEncodeGdrClean) + if (isEncodeGdrClean) { bool isSolid = cs.isClean(neibPos, CHANNEL_TYPE_LUMA); - info.mvSolid[info.numCand] = isSolid && allCandSolidInAbove; + info.mvSolid[info.numCand] = isSolid && allCandSolidInAbove; info.mvType[info.numCand] = (MvpType)eDir; info.mvPos[info.numCand] = neibPos; - + allCandSolidInAbove = isSolid && allCandSolidInAbove; } #endif @@ -3086,14 +3086,14 @@ void PU::addAMVPHMVPCand(const PredictionUnit &pu, const RefPicList eRefPicList, #if GDR_ENABLED CodingStructure &cs = *pu.cs; - const bool isEncodeGdrClean = cs.sps->getGDREnabledFlag() && cs.pcv->isEncoder && ((cs.picHeader->getInGdrInterval() && cs.isClean(pu.Y().topRight(), CHANNEL_TYPE_LUMA)) || (cs.picHeader->getNumVerVirtualBoundaries() == 0)); + const bool isEncodeGdrClean = cs.sps->getGDREnabledFlag() && cs.pcv->isEncoder && ((cs.picHeader->getInGdrInterval() && cs.isClean(pu.Y().topRight(), CHANNEL_TYPE_LUMA)) || (cs.picHeader->getNumVerVirtualBoundaries() == 0)); bool &allCandSolidInAbove = info.allCandSolidInAbove; #endif #if GDR_ENABLED bool vbOnCtuBoundary = true; - if (isEncodeGdrClean) + if (isEncodeGdrClean) { vbOnCtuBoundary = (pu.cs->picHeader->getNumVerVirtualBoundaries() == 0) || (pu.cs->picHeader->getVirtualBoundariesPosX(0) % pu.cs->sps->getMaxCUWidth() == 0); allCandSolidInAbove = allCandSolidInAbove && vbOnCtuBoundary; @@ -3119,7 +3119,7 @@ void PU::addAMVPHMVPCand(const PredictionUnit &pu, const RefPicList eRefPicList, pmv.roundTransPrecInternal2Amvr(pu.cu->imv); #if GDR_ENABLED - if (isEncodeGdrClean) + if (isEncodeGdrClean) { info.mvPos[info.numCand] = neibMi.sourcePos; info.mvType[info.numCand] = MVP_HMVP; @@ -3364,7 +3364,7 @@ void PU::getAffineMergeCand( const PredictionUnit &pu, AffineMergeCtx& affMrgCtx affMrgCtx.mvFieldNeighbours[(i << 1) + 0][mvNum].setMvField( Mv(), -1 ); affMrgCtx.mvFieldNeighbours[(i << 1) + 1][mvNum].setMvField( Mv(), -1 ); #if GDR_ENABLED - if (isEncodeGdrClean) + if (isEncodeGdrClean) { affMrgCtx.mvSolid[(i << 1) + 0][mvNum] = true; affMrgCtx.mvSolid[(i << 1) + 1][mvNum] = true; @@ -3379,11 +3379,11 @@ void PU::getAffineMergeCand( const PredictionUnit &pu, AffineMergeCtx& affMrgCtx affMrgCtx.BcwIdx[i] = BCW_DEFAULT; } #if GDR_ENABLED - if (isEncodeGdrClean) + if (isEncodeGdrClean) { MergeCtx &mrgCtx = *affMrgCtx.mrgCtx; int numMergeCand = MRG_MAX_NUM_CANDS << 1; - for (int i = 0; i < numMergeCand; i++) + for (int i = 0; i < numMergeCand; i++) { mrgCtx.mvSolid[i] = true; mrgCtx.mvValid[i] = true; @@ -3428,7 +3428,7 @@ void PU::getAffineMergeCand( const PredictionUnit &pu, AffineMergeCtx& affMrgCtx } #if GDR_ENABLED // check if the (puLeft) is in clean area - if (isEncodeGdrClean) + if (isEncodeGdrClean) { mrgCtx.mvSolid[(pos << 1) + 0] = cs.isClean(puLeft->Y().bottomRight(), CHANNEL_TYPE_LUMA); mrgCtx.mvSolid[(pos << 1) + 1] = cs.isClean(puLeft->Y().bottomRight(), CHANNEL_TYPE_LUMA); @@ -3447,7 +3447,7 @@ void PU::getAffineMergeCand( const PredictionUnit &pu, AffineMergeCtx& affMrgCtx affMrgCtx.mvFieldNeighbours[(affMrgCtx.numValidMergeCand << 1) + 0][mvNum].setMvField( mrgCtx.mvFieldNeighbours[(pos << 1) + 0].mv, mrgCtx.mvFieldNeighbours[(pos << 1) + 0].refIdx ); affMrgCtx.mvFieldNeighbours[(affMrgCtx.numValidMergeCand << 1) + 1][mvNum].setMvField( mrgCtx.mvFieldNeighbours[(pos << 1) + 1].mv, mrgCtx.mvFieldNeighbours[(pos << 1) + 1].refIdx ); #if GDR_ENABLED - if (isEncodeGdrClean) + if (isEncodeGdrClean) { affMrgCtx.mvSolid[(affMrgCtx.numValidMergeCand << 1) + 0][mvNum] = mrgCtx.mvSolid[(pos << 1) + 0]; affMrgCtx.mvSolid[(affMrgCtx.numValidMergeCand << 1) + 1][mvNum] = mrgCtx.mvSolid[(pos << 1) + 1]; @@ -3493,11 +3493,11 @@ void PU::getAffineMergeCand( const PredictionUnit &pu, AffineMergeCtx& affMrgCtx if ( puNeigh->interDir != 2 ) { #if GDR_ENABLED - if (isEncodeGdrClean) + if (isEncodeGdrClean) { xInheritedAffineMv(pu, puNeigh, REF_PIC_LIST_0, cMv[0], cMvSolid[0], cMvType[0], cMvPos[0]); } - else + else { xInheritedAffineMv(pu, puNeigh, REF_PIC_LIST_0, cMv[0]); } @@ -3510,11 +3510,11 @@ void PU::getAffineMergeCand( const PredictionUnit &pu, AffineMergeCtx& affMrgCtx if ( puNeigh->interDir != 1 ) { #if GDR_ENABLED - if (isEncodeGdrClean) + if (isEncodeGdrClean) { xInheritedAffineMv(pu, puNeigh, REF_PIC_LIST_1, cMv[1], cMvSolid[1], cMvType[1], cMvPos[1]); } - else + else { xInheritedAffineMv(pu, puNeigh, REF_PIC_LIST_1, cMv[1]); } @@ -3529,7 +3529,7 @@ void PU::getAffineMergeCand( const PredictionUnit &pu, AffineMergeCtx& affMrgCtx affMrgCtx.mvFieldNeighbours[(affMrgCtx.numValidMergeCand << 1) + 0][mvNum].setMvField( cMv[0][mvNum], puNeigh->refIdx[0] ); affMrgCtx.mvFieldNeighbours[(affMrgCtx.numValidMergeCand << 1) + 1][mvNum].setMvField( cMv[1][mvNum], puNeigh->refIdx[1] ); #if GDR_ENABLED - if (isEncodeGdrClean) + if (isEncodeGdrClean) { affMrgCtx.mvSolid[(affMrgCtx.numValidMergeCand << 1) + 0][mvNum] = cMvSolid[0][mvNum]; affMrgCtx.mvSolid[(affMrgCtx.numValidMergeCand << 1) + 1][mvNum] = cMvSolid[0][mvNum]; @@ -3576,7 +3576,7 @@ void PU::getAffineMergeCand( const PredictionUnit &pu, AffineMergeCtx& affMrgCtx mi[0] = puNeigh->getMotionInfo( pos ); neighBcw[0] = puNeigh->cu->BcwIdx; #if GDR_ENABLED - if (isEncodeGdrClean) + if (isEncodeGdrClean) { miSolid[0] = cs.isClean(puNeigh->Y().topRight(), CHANNEL_TYPE_LUMA); } @@ -3598,7 +3598,7 @@ void PU::getAffineMergeCand( const PredictionUnit &pu, AffineMergeCtx& affMrgCtx mi[1] = puNeigh->getMotionInfo( pos ); neighBcw[1] = puNeigh->cu->BcwIdx; #if GDR_ENABLED - if (isEncodeGdrClean) + if (isEncodeGdrClean) { miSolid[1] = cs.isClean(puNeigh->Y().topRight(), CHANNEL_TYPE_LUMA); } @@ -3619,7 +3619,7 @@ void PU::getAffineMergeCand( const PredictionUnit &pu, AffineMergeCtx& affMrgCtx isAvailable[2] = true; mi[2] = puNeigh->getMotionInfo( pos ); #if GDR_ENABLED - if (isEncodeGdrClean) + if (isEncodeGdrClean) { miSolid[2] = cs.isClean(puNeigh->Y().topRight(), CHANNEL_TYPE_LUMA); } @@ -3666,7 +3666,7 @@ void PU::getAffineMergeCand( const PredictionUnit &pu, AffineMergeCtx& affMrgCtx mi[3].interDir = 1; isAvailable[3] = true; #if GDR_ENABLED - if (isEncodeGdrClean) + if (isEncodeGdrClean) { bool posL0inCurPicSolid = cs.isClean(posC0, CHANNEL_TYPE_LUMA); bool posL0inRefPicSolid = cs.isClean(posC0, REF_PIC_LIST_0, refIdx); @@ -3686,11 +3686,11 @@ void PU::getAffineMergeCand( const PredictionUnit &pu, AffineMergeCtx& affMrgCtx mi[3].interDir |= 2; isAvailable[3] = true; #if GDR_ENABLED - if (isEncodeGdrClean) + if (isEncodeGdrClean) { bool posL1inCurPicSolid = cs.isClean(posC0, CHANNEL_TYPE_LUMA); bool posL1inRefPicSolid = cs.isClean(posC0, REF_PIC_LIST_1, refIdx); - + miSolid[3] = (mi[3].interDir & 1) ? (miSolid[3] && posL1inCurPicSolid && posL1inRefPicSolid) : (posL1inCurPicSolid && posL1inRefPicSolid); } #endif @@ -3710,8 +3710,8 @@ void PU::getAffineMergeCand( const PredictionUnit &pu, AffineMergeCtx& affMrgCtx { 0, 2 }, // 5: LT, LB }; -#if GDR_ENABLED - bool modelSolid[6] = +#if GDR_ENABLED + bool modelSolid[6] = { miSolid[0] && miSolid[1] && miSolid[2], miSolid[0] && miSolid[1] && miSolid[3], @@ -3726,14 +3726,14 @@ void PU::getAffineMergeCand( const PredictionUnit &pu, AffineMergeCtx& affMrgCtx for ( int idx = startIdx; idx < modelNum; idx++ ) { int modelIdx = order[idx]; -#if GDR_ENABLED - int affinNumValidCand = affMrgCtx.numValidMergeCand; +#if GDR_ENABLED + int affinNumValidCand = affMrgCtx.numValidMergeCand; #endif getAffineControlPointCand(pu, mi, isAvailable, model[modelIdx], ((modelIdx == 3) ? neighBcw[1] : neighBcw[0]), modelIdx, verNum[modelIdx], affMrgCtx); #if GDR_ENABLED - if (isEncodeGdrClean) + if (isEncodeGdrClean) { - for (int i = 0; i < 3; i++) + for (int i = 0; i < 3; i++) { affMrgCtx.mvSolid[(affinNumValidCand << 1) + 0][i] = modelSolid[modelIdx]; affMrgCtx.mvSolid[(affinNumValidCand << 1) + 1][i] = modelSolid[modelIdx]; @@ -3763,7 +3763,7 @@ void PU::getAffineMergeCand( const PredictionUnit &pu, AffineMergeCtx& affMrgCtx { affMrgCtx.mvFieldNeighbours[(cnt << 1) + 0][mvNum].setMvField( Mv( 0, 0 ), 0 ); #if GDR_ENABLED - if (isEncodeGdrClean) + if (isEncodeGdrClean) { affMrgCtx.mvSolid[(cnt << 1) + 0][mvNum] = true; } @@ -3777,7 +3777,7 @@ void PU::getAffineMergeCand( const PredictionUnit &pu, AffineMergeCtx& affMrgCtx { affMrgCtx.mvFieldNeighbours[(cnt << 1) + 1][mvNum].setMvField( Mv( 0, 0 ), 0 ); #if GDR_ENABLED - if (isEncodeGdrClean) + if (isEncodeGdrClean) { affMrgCtx.mvSolid[(cnt << 1) + 1][mvNum] = true; } @@ -3929,17 +3929,17 @@ bool PU::getInterMergeSubPuMvpCand(const PredictionUnit &pu, MergeCtx& mrgCtx, b { cTMv = mrgCtx.mvFieldNeighbours[REF_PIC_LIST_0].mv; #if GDR_ENABLED - if (isEncodeGdrClean) + if (isEncodeGdrClean) { isSubPuSolid[REF_PIC_LIST_0] = mrgCtx.mvSolid[REF_PIC_LIST_0]; } -#endif +#endif } else if ( slice.isInterB() && (mrgCtx.interDirNeighbours[0] & (1 << REF_PIC_LIST_1)) && slice.getRefPic( REF_PIC_LIST_1, mrgCtx.mvFieldNeighbours[REF_PIC_LIST_1].refIdx ) == pColPic ) { cTMv = mrgCtx.mvFieldNeighbours[REF_PIC_LIST_1].mv; #if GDR_ENABLED - if (isEncodeGdrClean) + if (isEncodeGdrClean) { isSubPuSolid[REF_PIC_LIST_1] = mrgCtx.mvSolid[REF_PIC_LIST_1]; } @@ -4000,11 +4000,11 @@ bool PU::getInterMergeSubPuMvpCand(const PredictionUnit &pu, MergeCtx& mrgCtx, b mrgCtx.mvFieldNeighbours[(count << 1) + currRefListId].setMvField(cColMv, 0); mrgCtx.interDirNeighbours[count] |= (1 << currRefListId); #if GDR_ENABLED - if (isEncodeGdrClean) + if (isEncodeGdrClean) { mrgCtx.mvSolid[(count << 1) + currRefListId] = cs.isClean(centerPos, currRefPicList, refIdx); } -#endif +#endif LICFlag = tempLICFlag; mrgCtx.BcwIdx[count] = BCW_DEFAULT; found = true; @@ -4058,8 +4058,8 @@ bool PU::getInterMergeSubPuMvpCand(const PredictionUnit &pu, MergeCtx& mrgCtx, b mi.refIdx[currRefListId] = 0; mi.mv[currRefListId] = cColMv; found = true; -#if GDR_ENABLED - if (isEncodeGdrClean) +#if GDR_ENABLED + if (isEncodeGdrClean) { isSubPuSolid[currRefPicList] = isSubPuSolid[currRefPicList] && cs.isClean(colPos, currRefPicList, refIdx); } @@ -4090,8 +4090,8 @@ bool PU::getInterMergeSubPuMvpCand(const PredictionUnit &pu, MergeCtx& mrgCtx, b } } -#if GDR_ENABLED - if (isEncodeGdrClean) +#if GDR_ENABLED + if (isEncodeGdrClean) { // the final if it is solid mrgCtx.mvSolid[(count << 1) + 0] = mrgCtx.mvSolid[(count << 1) + 0] && isSubPuSolid[0]; @@ -4276,7 +4276,7 @@ void PU::getGeoMergeCandidates( const PredictionUnit &pu, MergeCtx& geoMrgCtx ) const uint32_t maxNumMergeCand = pu.cs->sps->getMaxNumMergeCand(); geoMrgCtx.numValidMergeCand = 0; -#if GDR_ENABLED +#if GDR_ENABLED CodingStructure &cs = *pu.cs; const bool isEncodeGdrClean = cs.sps->getGDREnabledFlag() && cs.pcv->isEncoder && ((cs.picHeader->getInGdrInterval() && cs.isClean(pu.Y().topRight(), CHANNEL_TYPE_LUMA)) || (cs.picHeader->getNumVerVirtualBoundaries() == 0)); #endif @@ -4290,7 +4290,7 @@ void PU::getGeoMergeCandidates( const PredictionUnit &pu, MergeCtx& geoMrgCtx ) geoMrgCtx.mvFieldNeighbours[(i << 1)].mv = Mv(); geoMrgCtx.mvFieldNeighbours[(i << 1) + 1].mv = Mv(); #if GDR_ENABLED - if (isEncodeGdrClean) + if (isEncodeGdrClean) { geoMrgCtx.mvSolid[(i << 1) + 0] = true; geoMrgCtx.mvSolid[(i << 1) + 1] = true; @@ -4313,7 +4313,7 @@ void PU::getGeoMergeCandidates( const PredictionUnit &pu, MergeCtx& geoMrgCtx ) geoMrgCtx.mvFieldNeighbours[(geoMrgCtx.numValidMergeCand << 1) + !parity].refIdx = -1; geoMrgCtx.mvFieldNeighbours[(geoMrgCtx.numValidMergeCand << 1) + parity].refIdx = tmpMergeCtx.mvFieldNeighbours[(i << 1) + parity].refIdx; #if GDR_ENABLED - if (isEncodeGdrClean) + if (isEncodeGdrClean) { Mv mv = tmpMergeCtx.mvFieldNeighbours[(i << 1) + parity].mv; int refIdx = tmpMergeCtx.mvFieldNeighbours[(i << 1) + parity].refIdx; @@ -4341,7 +4341,7 @@ void PU::getGeoMergeCandidates( const PredictionUnit &pu, MergeCtx& geoMrgCtx ) geoMrgCtx.mvFieldNeighbours[(geoMrgCtx.numValidMergeCand << 1) + !parity].refIdx = tmpMergeCtx.mvFieldNeighbours[(i << 1) + !parity].refIdx; geoMrgCtx.mvFieldNeighbours[(geoMrgCtx.numValidMergeCand << 1) + parity].refIdx = -1; #if GDR_ENABLED - if (isEncodeGdrClean) + if (isEncodeGdrClean) { Mv mv = tmpMergeCtx.mvFieldNeighbours[(i << 1) + !parity].mv; int refIdx = tmpMergeCtx.mvFieldNeighbours[(i << 1) + !parity].refIdx; diff --git a/source/Lib/DecoderLib/DecLib.cpp b/source/Lib/DecoderLib/DecLib.cpp index 83bc7ae5fb9431545039f413f45eebfb7f0cacbb..ed881e8c0ab8a2f69fe56f79391b04437bf8a8f1 100644 --- a/source/Lib/DecoderLib/DecLib.cpp +++ b/source/Lib/DecoderLib/DecLib.cpp @@ -2780,7 +2780,7 @@ bool DecLib::xDecodeSlice(InputNALUnit &nalu, int &iSkipFrame, int iPOCLastDispl m_cReshaper.setRecReshaped(false); } -#if GDR_LEAK_TEST +#if GDR_LEAK_TEST if (m_gdrPocRandomAccess == pcSlice->getPOC()) { for (int e = 0; e < 2; e++) diff --git a/source/Lib/DecoderLib/VLCReader.cpp b/source/Lib/DecoderLib/VLCReader.cpp index c1e92a14cd623b63dcc4c35c3a9744b1f2acd9d3..94c86d361cb37e4ad2ed33ce0a38b0da7d3bcc03 100644 --- a/source/Lib/DecoderLib/VLCReader.cpp +++ b/source/Lib/DecoderLib/VLCReader.cpp @@ -4349,8 +4349,8 @@ void HLSyntaxReader::parseSliceHeader (Slice* pcSlice, PicHeader* picHeader, Par if (getLastGdrPoc() > 0 && (getLastGdrPoc() <= curPoc) && (curPoc < (getLastGdrPoc() + recoveryPocCnt))) { picHeader->setInGdrInterval(true); - } - else + } + else { picHeader->setInGdrInterval(false); } diff --git a/source/Lib/EncoderLib/EncCu.cpp b/source/Lib/EncoderLib/EncCu.cpp index 6976aa7aa2e648e1502edef2d126d54df8e1c53c..080d49dad221c9f5e06308633ceae583ed388214 100644 --- a/source/Lib/EncoderLib/EncCu.cpp +++ b/source/Lib/EncoderLib/EncCu.cpp @@ -555,12 +555,12 @@ void EncCu::xCompressCU( CodingStructure*& tempCS, CodingStructure*& bestCS, Par const UnitArea currCsArea = clipArea( CS::getArea( *bestCS, bestCS->area, partitioner.chType ), *tempCS->picture ); m_modeCtrl->initCULevel( partitioner, *tempCS ); -#if GDR_ENABLED +#if GDR_ENABLED if (m_pcEncCfg->getGdrEnabled()) { bool isInGdrInterval = slice.getPicHeader()->getInGdrInterval(); - // 1.0 applicable to inter picture only + // 1.0 applicable to inter picture only if (isInGdrInterval) { int gdrPocStart = m_pcEncCfg->getGdrPocStart(); @@ -597,7 +597,7 @@ void EncCu::xCompressCU( CodingStructure*& tempCS, CodingStructure*& bestCS, Par begGdrX = m1 * n1 + m2 * (gdrPoc - n1); endGdrX = begGdrX + m2; if (picWidth <= endGdrX) - { + { begGdrX = picWidth; endGdrX = picWidth; } @@ -611,7 +611,7 @@ void EncCu::xCompressCU( CodingStructure*& tempCS, CodingStructure*& bestCS, Par } else if (tempCS->containRefresh(begGdrX, endGdrX) || tempCS->overlapRefresh(begGdrX, endGdrX)) { - // 1.3.1 enable only vertical splits (QT, BT_V, TT_V) + // 1.3.1 enable only vertical splits (QT, BT_V, TT_V) m_modeCtrl->forceVerSplitOnly(); // 1.3.2 remove TT_V if it does not satisfy the condition @@ -1448,7 +1448,7 @@ void EncCu::xCheckModeSplit(CodingStructure *&tempCS, CodingStructure *&bestCS, m_pcInterSearch->addAffMVInfo(tmpMVInfo); } #endif - + if (!tempCS->slice->isIntra() && isUniMvInfoSaved) { m_pcInterSearch->addUniMvInfo(tmpUniMvInfo); @@ -2125,7 +2125,7 @@ void EncCu::xCheckRDCostMerge2Nx2N( CodingStructure *&tempCS, CodingStructure *& MergeCtx mergeCtx; const SPS &sps = *tempCS->sps; -#if GDR_ENABLED +#if GDR_ENABLED bool isEncodeGdrClean = false; CodingStructure *cs; #endif @@ -2152,7 +2152,7 @@ void EncCu::xCheckRDCostMerge2Nx2N( CodingStructure *&tempCS, CodingStructure *& PU::getInterMergeCandidates(pu, mergeCtx, 0); PU::getInterMMVDMergeCandidates(pu, mergeCtx); pu.regularMergeFlag = true; -#if GDR_ENABLED +#if GDR_ENABLED cs = pu.cs; isEncodeGdrClean = cs->sps->getGDREnabledFlag() && cs->pcv->isEncoder && ((cs->picHeader->getInGdrInterval() && cs->isClean(pu.Y().topRight(), CHANNEL_TYPE_LUMA)) || (cs->picHeader->getNumVerVirtualBoundaries() == 0)); #endif @@ -2868,11 +2868,11 @@ void EncCu::xCheckRDCostMergeGeo2Nx2N(CodingStructure *&tempCS, CodingStructure cu.bdpcmMode = 0; PredictionUnit &pu = tempCS->addPU(cu, pm.chType); -#if GDR_ENABLED +#if GDR_ENABLED CodingStructure &cs = *pu.cs; const bool isEncodeGdrClean = cs.sps->getGDREnabledFlag() && cs.pcv->isEncoder && ((cs.picHeader->getInGdrInterval() && cs.isClean(pu.Y().topRight(), CHANNEL_TYPE_LUMA)) || (cs.picHeader->getNumVerVirtualBoundaries() == 0)); #endif - + pu.mergeFlag = true; pu.regularMergeFlag = false; PU::getGeoMergeCandidates(pu, mergeCtx); @@ -2895,13 +2895,13 @@ void EncCu::xCheckRDCostMergeGeo2Nx2N(CodingStructure *&tempCS, CodingStructure int pocMrg[GEO_MAX_NUM_UNI_CANDS]; Mv MrgMv[GEO_MAX_NUM_UNI_CANDS]; bool isSkipThisCand[GEO_MAX_NUM_UNI_CANDS]; -#if GDR_ENABLED +#if GDR_ENABLED bool MrgSolid[GEO_MAX_NUM_UNI_CANDS]; bool MrgValid[GEO_MAX_NUM_UNI_CANDS]; - if (isEncodeGdrClean) - { - for (int i = 0; i < maxNumMergeCandidates; i++) + if (isEncodeGdrClean) + { + for (int i = 0; i < maxNumMergeCandidates; i++) { MrgSolid[i] = true; MrgValid[i] = true; @@ -2921,7 +2921,7 @@ void EncCu::xCheckRDCostMergeGeo2Nx2N(CodingStructure *&tempCS, CodingStructure int MrgrefIdx = mergeCtx.mvFieldNeighbours[(mergeCand << 1) + MrgList].refIdx; pocMrg[mergeCand] = tempCS->slice->getRefPic(MrgeRefPicList, MrgrefIdx)->getPOC(); MrgMv[mergeCand] = mergeCtx.mvFieldNeighbours[(mergeCand << 1) + MrgList].mv; -#if GDR_ENABLED +#if GDR_ENABLED if (isEncodeGdrClean) { MrgSolid[mergeCand] = mergeCtx.mvSolid[(mergeCand << 1) + MrgList]; @@ -2952,7 +2952,7 @@ void EncCu::xCheckRDCostMergeGeo2Nx2N(CodingStructure *&tempCS, CodingStructure distParamWholeBlk.cur.buf = geoTempBuf[mergeCand].Y().buf; distParamWholeBlk.cur.stride = geoTempBuf[mergeCand].Y().stride; sadWholeBlk[mergeCand] = distParamWholeBlk.distFunc(distParamWholeBlk); -#if GDR_ENABLED +#if GDR_ENABLED bool allOk = (sadWholeBlk[mergeCand] < bestWholeBlkSad); if (isEncodeGdrClean) { @@ -2960,8 +2960,8 @@ void EncCu::xCheckRDCostMergeGeo2Nx2N(CodingStructure *&tempCS, CodingStructure bool isValid = mergeCtx.mvValid[(mergeCand << 1) + MrgList]; allOk = allOk && isSolid && isValid; } -#endif -#if GDR_ENABLED +#endif +#if GDR_ENABLED if (allOk) #else if (sadWholeBlk[mergeCand] < bestWholeBlkSad) @@ -3013,7 +3013,7 @@ void EncCu::xCheckRDCostMergeGeo2Nx2N(CodingStructure *&tempCS, CodingStructure for (uint8_t mergeCand = 0; mergeCand < maxNumMergeCandidates; mergeCand++) { int bitsCand = mergeCand + 1; -#if GDR_ENABLED +#if GDR_ENABLED if (isEncodeGdrClean) { double cost0, cost1; @@ -3066,7 +3066,7 @@ void EncCu::xCheckRDCostMergeGeo2Nx2N(CodingStructure *&tempCS, CodingStructure continue; } tempCost = tempCost + (double)bitsCandTB * sqrtLambdaForFirstPass; -#if GDR_ENABLED +#if GDR_ENABLED if (isEncodeGdrClean) { int idx0 = mergeCand0; @@ -3120,7 +3120,7 @@ void EncCu::xCheckRDCostMergeGeo2Nx2N(CodingStructure *&tempCS, CodingStructure mvBits += mergeCand0; mvBits += mergeCand1; double updateCost = (double)sad + (double)(bitsCandTB + mvBits) * sqrtLambdaForFirstPass; -#if GDR_ENABLED +#if GDR_ENABLED if (isEncodeGdrClean) { int idx0 = mergeCand0; @@ -3135,7 +3135,7 @@ void EncCu::xCheckRDCostMergeGeo2Nx2N(CodingStructure *&tempCS, CodingStructure updateCost = MAX_DOUBLE; } } -#endif +#endif comboList.list[candidateIdx].cost = updateCost; updateCandList(candidateIdx, updateCost, geoRdModeList, geocandCostList, geoNumMrgSATDCand); } @@ -3200,7 +3200,7 @@ void EncCu::xCheckRDCostMergeGeo2Nx2N(CodingStructure *&tempCS, CodingStructure PU::spanGeoMotionInfo(pu, mergeCtx, pu.geoSplitDir, pu.geoMergeIdx0, pu.geoMergeIdx1); tempCS->getPredBuf().copyFrom(geoCombinations[candidateIdx]); -#if GDR_ENABLED +#if GDR_ENABLED if (isEncodeGdrClean) { int idx0 = pu.geoMergeIdx0; @@ -3250,7 +3250,7 @@ void EncCu::xCheckRDCostAffineMerge2Nx2N( CodingStructure *&tempCS, CodingStruct #if GDR_ENABLED CodingStructure *cs; bool isEncodeGdrClean = false; -#endif +#endif m_bestModeUpdated = tempCS->useDbCost = bestCS->useDbCost = false; const Slice &slice = *tempCS->slice; @@ -3422,7 +3422,7 @@ void EncCu::xCheckRDCostAffineMerge2Nx2N( CodingStructure *&tempCS, CodingStruct cost = MAX_DOUBLE; } } -#endif +#endif updateCandList( uiMergeCand, cost, RdModeList, candCostList , uiNumMrgSATDCand ); @@ -3556,7 +3556,7 @@ void EncCu::xCheckRDCostAffineMerge2Nx2N( CodingStructure *&tempCS, CodingStruct if ( m_pcEncCfg->getUseFastDecisionForMerge() && !bestIsSkip ) { -#if GDR_ENABLED +#if GDR_ENABLED if (bestCS->getCU(partitioner.chType)) { bestIsSkip = bestCS->getCU(partitioner.chType)->rootCbf == 0; @@ -3662,7 +3662,7 @@ void EncCu::xCheckRDCostIBCModeMerge2Nx2N(CodingStructure *&tempCS, CodingStruct candHasNoResidual[ui] = 0; } -#if GDR_ENABLED +#if GDR_ENABLED if (isEncodeGdrClean) { MrgSolid = new bool[MRG_MAX_NUM_CANDS]; @@ -3957,8 +3957,8 @@ void EncCu::xCheckRDCostIBCModeMerge2Nx2N(CodingStructure *&tempCS, CodingStruct { xCalDebCost( *bestCS, partitioner ); } -#if GDR_ENABLED - if (isEncodeGdrClean) +#if GDR_ENABLED + if (isEncodeGdrClean) { delete[] MrgSolid; delete[] MrgValid; @@ -4116,7 +4116,7 @@ void EncCu::xCheckRDCostInter( CodingStructure *&tempCS, CodingStructure *&bestC uint8_t bcwIdx = cu.BcwIdx; bool testBcw = (bcwIdx != BCW_DEFAULT); -#if GDR_ENABLED +#if GDR_ENABLED const bool isEncodeGdrClean = tempCS->sps->getGDREnabledFlag() && tempCS->pcv->isEncoder && ((tempCS->picHeader->getInGdrInterval() && tempCS->isClean(cu.Y().topRight(), CHANNEL_TYPE_LUMA)) || (tempCS->picHeader->getNumVerVirtualBoundaries() == 0)); #endif m_pcInterSearch->predInterSearch(cu, partitioner); @@ -4138,8 +4138,8 @@ void EncCu::xCheckRDCostInter( CodingStructure *&tempCS, CodingStructure *&bestC } } -#if GDR_ENABLED - // 2.0 xCheckRDCostInter: check residual (compare with bestCS) +#if GDR_ENABLED + // 2.0 xCheckRDCostInter: check residual (compare with bestCS) if (isEncodeGdrClean) { bool isClean = true; @@ -4218,9 +4218,9 @@ void EncCu::xCheckRDCostInter( CodingStructure *&tempCS, CodingStructure *&bestC } #else xEncodeInterResidual(tempCS, bestCS, partitioner, encTestMode, 0, 0, &equBcwCost); -#endif +#endif -#if GDR_ENABLED +#if GDR_ENABLED if (g_BcwSearchOrder[bcwLoopIdx] == BCW_DEFAULT && bestCS->cus.size() > 0) m_pcInterSearch->setAffineModeSelected((bestCS->cus.front()->affine && !(bestCS->cus.front()->firstPU->mergeFlag))); #else @@ -4334,7 +4334,7 @@ bool EncCu::xCheckRDCostInterIMV(CodingStructure *&tempCS, CodingStructure *&bes CU::addPUs( cu ); -#if GDR_ENABLED +#if GDR_ENABLED const bool isEncodeGdrClean = tempCS->sps->getGDREnabledFlag() && tempCS->pcv->isEncoder && ((tempCS->picHeader->getInGdrInterval() && tempCS->isClean(cu.Y().topRight(), CHANNEL_TYPE_LUMA)) || (tempCS->picHeader->getNumVerVirtualBoundaries() == 0)); #endif if (testAltHpelFilter) @@ -4408,8 +4408,8 @@ bool EncCu::xCheckRDCostInterIMV(CodingStructure *&tempCS, CodingStructure *&bes } } -#if GDR_ENABLED - // 2.0 xCheckRDCostInter: check residual (compare with bestCS) +#if GDR_ENABLED + // 2.0 xCheckRDCostInter: check residual (compare with bestCS) if (isEncodeGdrClean) { bool isClean = true; diff --git a/source/Lib/EncoderLib/EncGOP.cpp b/source/Lib/EncoderLib/EncGOP.cpp index b920abdc9d354fcb870177e1d41cd2baaff6400f..95fcef3d71630acdb05d146a9179c9444f9d36fa 100644 --- a/source/Lib/EncoderLib/EncGOP.cpp +++ b/source/Lib/EncoderLib/EncGOP.cpp @@ -377,8 +377,8 @@ int EncGOP::xWriteAPS( AccessUnit &accessUnit, APS *aps, const int layerId, cons nalu.m_temporalId = aps->getTemporalId(); aps->setLayerId( layerId ); CHECK( nalu.m_temporalId < accessUnit.temporalId, "TemporalId shall be greater than or equal to the TemporalId of the layer access unit containing the NAL unit" ); - -#if GDR_ENC_TRACE + +#if GDR_ENC_TRACE if (aps) printf("-aps ty:%d id:%d\n", aps->getAPSType(), aps->getAPSId()); #endif @@ -1928,7 +1928,7 @@ void EncGOP::xPicInitLMCS(Picture *pic, PicHeader *picHeader, Slice *slice) else if (m_pcCfg->getReshapeSignalType() == RESHAPE_SIGNAL_SDR || m_pcCfg->getReshapeSignalType() == RESHAPE_SIGNAL_HLG) { int modIP = pic->getPOC() - pic->getPOC() / m_pcCfg->getReshapeCW().rspFpsToIp * m_pcCfg->getReshapeCW().rspFpsToIp; -#if GDR_ENABLED +#if GDR_ENABLED if (slice->isInterGDR()) { modIP = 0; @@ -1952,11 +1952,11 @@ void EncGOP::xPicInitLMCS(Picture *pic, PicHeader *picHeader, Slice *slice) slice->setLmcsEnabledFlag(m_pcReshaper->getSliceReshaperInfo().getUseSliceReshaper()); picHeader->setLmcsChromaResidualScaleFlag(m_pcReshaper->getSliceReshaperInfo().getSliceReshapeChromaAdj() == 1); -#if GDR_ENABLED - if (picHeader->getInGdrInterval()) +#if GDR_ENABLED + if (picHeader->getInGdrInterval()) { picHeader->setLmcsChromaResidualScaleFlag(false); - } + } #endif if (m_pcReshaper->getSliceReshaperInfo().getSliceReshapeModelPresentFlag()) @@ -2169,9 +2169,9 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic, pcSlice->setSliceType(B_SLICE); } - // note : first picture is GDR(I_SLICE) - if (pocCurr == 0) - { + // note : first picture is GDR(I_SLICE) + if (pocCurr == 0) + { pcSlice->setSliceType(I_SLICE); } #endif @@ -2949,10 +2949,10 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic, { picHeader->setLmcsEnabledFlag(true); #if GDR_ENABLED - if (picHeader->getInGdrInterval()) + if (picHeader->getInGdrInterval()) { picHeader->setLmcsChromaResidualScaleFlag(false); - } + } #endif int apsId = std::min<int>(3, m_pcEncLib->getVPS() == nullptr ? 0 : m_pcEncLib->getVPS()->getGeneralLayerIdx(m_pcEncLib->getLayerId())); picHeader->setLmcsAPSId(apsId); @@ -3292,9 +3292,9 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic, APS* aps = apsMap->getPS((apsId << NUM_APS_TYPE_LEN) + LMCS_APS); bool writeAPS = aps && apsMap->getChangedFlag((apsId << NUM_APS_TYPE_LEN) + LMCS_APS); #if GDR_ENABLED // note : insert APS at every GDR picture - if (aps && apsId >= 0) - { - writeAPS |= pcSlice->isInterGDR(); + if (aps && apsId >= 0) + { + writeAPS |= pcSlice->isInterGDR(); } #endif if (writeAPS) @@ -3303,7 +3303,7 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic, actualTotalBits += xWriteAPS( accessUnit, aps, m_pcEncLib->getLayerId(), true ); apsMap->clearChangedFlag((apsId << NUM_APS_TYPE_LEN) + LMCS_APS); #if GDR_ENABLED - if (!pcSlice->isInterGDR()) + if (!pcSlice->isInterGDR()) { CHECK(aps != picHeader->getLmcsAPS(), "Wrong LMCS APS pointer in compressGOP"); } @@ -3321,8 +3321,8 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic, APS* aps = apsMap->getPS( ( apsId << NUM_APS_TYPE_LEN ) + SCALING_LIST_APS ); bool writeAPS = aps && apsMap->getChangedFlag( ( apsId << NUM_APS_TYPE_LEN ) + SCALING_LIST_APS ); #if GDR_ENABLED // note : insert APS at every GDR picture - if (aps && apsId >= 0) - { + if (aps && apsId >= 0) + { writeAPS |= pcSlice->isInterGDR(); } #endif @@ -3332,7 +3332,7 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic, actualTotalBits += xWriteAPS( accessUnit, aps, m_pcEncLib->getLayerId(), true ); apsMap->clearChangedFlag( ( apsId << NUM_APS_TYPE_LEN ) + SCALING_LIST_APS ); #if GDR_ENABLED - if (!pcSlice->isInterGDR()) + if (!pcSlice->isInterGDR()) { CHECK(aps != picHeader->getScalingListAPS(), "Wrong SCALING LIST APS pointer in compressGOP"); } @@ -3368,10 +3368,10 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic, aps = apsMap->getPS((pcSlice->getCcAlfCrApsId() << NUM_APS_TYPE_LEN) + ALF_APS); } #if GDR_ENABLED // note : insert APS at every GDR picture - if (aps && apsId >= 0) - { + if (aps && apsId >= 0) + { writeAPS |= (pcSlice->isInterGDR()); - } + } #endif if (writeAPS ) { @@ -3379,7 +3379,7 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic, actualTotalBits += xWriteAPS( accessUnit, aps, m_pcEncLib->getLayerId(), true ); apsMap->clearChangedFlag((apsId << NUM_APS_TYPE_LEN) + ALF_APS); #if GDR_ENABLED - if (!pcSlice->isInterGDR()) + if (!pcSlice->isInterGDR()) { CHECK(aps != pcSlice->getAlfAPSs()[apsId] && apsId != pcSlice->getCcAlfCbApsId() && apsId != pcSlice->getCcAlfCrApsId(), "Wrong APS pointer in compressGOP"); } @@ -3612,7 +3612,7 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic, std::string digestStr; #if GDR_ENABLED // note : generate hash sei only for non-gdr pictures - bool genHash = !(m_pcCfg->getGdrNoHash() && pcSlice->getPicHeader()->getInGdrInterval()); + bool genHash = !(m_pcCfg->getGdrNoHash() && pcSlice->getPicHeader()->getInGdrInterval()); if (m_pcCfg->getDecodedPictureHashSEIType() != HASHTYPE_NONE && genHash) #else if (m_pcCfg->getDecodedPictureHashSEIType()!=HASHTYPE_NONE) @@ -3658,7 +3658,7 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic, xWriteTrailingSEIMessages(trailingSeiMessages, accessUnit, pcSlice->getTLayer()); #if GDR_ENABLED - if (!(m_pcCfg->getGdrNoHash() && pcSlice->getPicHeader()->getInGdrInterval())) + if (!(m_pcCfg->getGdrNoHash() && pcSlice->getPicHeader()->getInGdrInterval())) { printHash(m_pcCfg->getDecodedPictureHashSEIType(), digestStr); } @@ -5086,12 +5086,12 @@ NalUnitType EncGOP::getNalUnitType(int pocCurr, int lastIDR, bool isField) return NAL_UNIT_CODED_SLICE_TRAIL; } -#if GDR_ENABLED +#if GDR_ENABLED if (m_pcCfg->getGdrEnabled() && m_pcCfg->getDecodingRefreshType() == 3 && (pocCurr >= m_pcCfg->getGdrPocStart())) - { + { int m = pocCurr - m_pcCfg->getGdrPocStart(); int n = m_pcCfg->getGdrPeriod(); - if (m % n == 0) + if (m % n == 0) { return NAL_UNIT_CODED_SLICE_GDR; } @@ -5137,7 +5137,7 @@ NalUnitType EncGOP::getNalUnitType(int pocCurr, int lastIDR, bool isField) return NAL_UNIT_CODED_SLICE_RADL; } } -#if GDR_ENABLED +#if GDR_ENABLED if (m_pcCfg->getGdrEnabled() && pocCurr >= m_pcCfg->getGdrPocStart() && ((pocCurr - m_pcCfg->getGdrPocStart()) % m_pcCfg->getGdrPeriod() == 0)) return NAL_UNIT_CODED_SLICE_GDR; else diff --git a/source/Lib/EncoderLib/EncLib.cpp b/source/Lib/EncoderLib/EncLib.cpp index a9961681c8cae82242680dbefebfe996f4c3c568..26e60df36975b805ca0823ce18ed144e2bc44bfa 100644 --- a/source/Lib/EncoderLib/EncLib.cpp +++ b/source/Lib/EncoderLib/EncLib.cpp @@ -1134,7 +1134,7 @@ void EncLib::xInitSPS( SPS& sps ) { sps.setGDREnabledFlag(true); } - else + else { sps.setGDREnabledFlag(false); } diff --git a/source/Lib/EncoderLib/EncSlice.cpp b/source/Lib/EncoderLib/EncSlice.cpp index 58a8628382c962a9a2f12cfb77fb655e2bd09191..a4d6e07cc2475f18383d2bf32b06dc4e6f3e36a2 100644 --- a/source/Lib/EncoderLib/EncSlice.cpp +++ b/source/Lib/EncoderLib/EncSlice.cpp @@ -759,7 +759,7 @@ void EncSlice::initEncSlice(Picture* pcPic, const int pocLast, const int pocCurr pcPic->cs->picHeader->setNumHorVirtualBoundaries(0); pcPic->cs->picHeader->setNumVerVirtualBoundaries(0); -#if GDR_ENC_TRACE +#if GDR_ENC_TRACE printf("-poc:%d no virtual boundary\n", rpcSlice->getPOC()); #endif } @@ -826,7 +826,7 @@ void EncSlice::initEncSlice(Picture* pcPic, const int pocLast, const int pocCurr #if GDR_ENC_TRACE printf("\n"); printf("-poc:%d beg:%d end:%d\n", rpcSlice->getPOC(), begGdrX, endGdrX); -#endif +#endif } } #endif diff --git a/source/Lib/EncoderLib/InterSearch.cpp b/source/Lib/EncoderLib/InterSearch.cpp index 231822190c967ec7eaa0db292be9bf0977125af5..931943e7f2f9d9a8c1fc25d6e8839362b996475a 100644 --- a/source/Lib/EncoderLib/InterSearch.cpp +++ b/source/Lib/EncoderLib/InterSearch.cpp @@ -748,7 +748,7 @@ Distortion InterSearch::xPatternRefinement( const CPelBuf* pcPatternKey, Mv baseRefMv, int iFrac, Mv& rcMvFrac, bool bAllowUseOfHadamard ) -#endif +#endif { Distortion uiDist; Distortion uiDistBest = std::numeric_limits<Distortion>::max(); @@ -1647,7 +1647,7 @@ bool InterSearch::predIBCSearch(CodingUnit& cu, Partitioner& partitioner, const const bool isEncodeGdrClean = cs.sps->getGDREnabledFlag() && cs.pcv->isEncoder && ((cs.picHeader->getInGdrInterval() && cs.isClean(pu.Y().topRight(), CHANNEL_TYPE_LUMA)) || (cs.picHeader->getNumVerVirtualBoundaries() == 0)); #endif -#if GDR_ENABLED +#if GDR_ENABLED if (isEncodeGdrClean) { pu.mvSolid[0] = false; @@ -2196,7 +2196,7 @@ bool InterSearch::xRectHashInterEstimation(PredictionUnit& pu, RefPicList& bestR unsigned int tempMVPbits = m_pcRdCost->getBitsOfVectorWithPredictor(cMv.getHor(), cMv.getVer(), 0); -#if GDR_ENABLED +#if GDR_ENABLED allOk = (tempMVPbits < curMVPbits); if (isEncodeGdrClean) { @@ -2204,9 +2204,9 @@ bool InterSearch::xRectHashInterEstimation(PredictionUnit& pu, RefPicList& bestR allOk = allOk && isSolid; if (allOk) anyCandOk = true; } -#endif +#endif -#if GDR_ENABLED +#if GDR_ENABLED if (allOk) #else if (tempMVPbits < curMVPbits) @@ -2223,7 +2223,7 @@ bool InterSearch::xRectHashInterEstimation(PredictionUnit& pu, RefPicList& bestR Mv mvPred1Pel = currAMVPInfoPel.mvCand[mvpIdxTemp]; m_pcRdCost->setPredictor(mvPred1Pel); bitsMVP1Pel = m_pcRdCost->getBitsOfVectorWithPredictor(cMv.getHor(), cMv.getVer(), 2); -#if GDR_ENABLED +#if GDR_ENABLED allOk = (bitsMVP1Pel < curMVPbits); if (isEncodeGdrClean) { @@ -2234,9 +2234,9 @@ bool InterSearch::xRectHashInterEstimation(PredictionUnit& pu, RefPicList& bestR anyCandOk = true; } } -#endif +#endif -#if GDR_ENABLED +#if GDR_ENABLED if (allOk) #else if (bitsMVP1Pel < curMVPbits) @@ -2253,8 +2253,8 @@ bool InterSearch::xRectHashInterEstimation(PredictionUnit& pu, RefPicList& bestR Mv mvPred4Pel = currAMVPInfo4Pel.mvCand[mvpIdxTemp]; m_pcRdCost->setPredictor(mvPred4Pel); bitsMVP4Pel = m_pcRdCost->getBitsOfVectorWithPredictor(cMv.getHor(), cMv.getVer(), 4); -#if GDR_ENABLED - allOk = (bitsMVP4Pel < curMVPbits); +#if GDR_ENABLED + allOk = (bitsMVP4Pel < curMVPbits); if (isEncodeGdrClean) { bool isSolid = currAMVPInfo4Pel.mvSolid[mvpIdxTemp]; @@ -2264,9 +2264,9 @@ bool InterSearch::xRectHashInterEstimation(PredictionUnit& pu, RefPicList& bestR anyCandOk = true; } } -#endif +#endif -#if GDR_ENABLED +#if GDR_ENABLED if (allOk) #else if (bitsMVP4Pel < curMVPbits) @@ -2280,7 +2280,7 @@ bool InterSearch::xRectHashInterEstimation(PredictionUnit& pu, RefPicList& bestR } } -#if GDR_ENABLED +#if GDR_ENABLED if (isEncodeGdrClean && !anyCandOk) { continue; @@ -2511,7 +2511,7 @@ bool InterSearch::xHashInterEstimation(PredictionUnit& pu, RefPicList& bestRefPi unsigned int tempMVPbits = m_pcRdCost->getBitsOfVectorWithPredictor(cMv.getHor(), cMv.getVer(), 0); -#if GDR_ENABLED +#if GDR_ENABLED allOk = (tempMVPbits < curMVPbits); if (isEncodeGdrClean) { @@ -2519,13 +2519,13 @@ bool InterSearch::xHashInterEstimation(PredictionUnit& pu, RefPicList& bestRefPi allOk = allOk && isSolid; if (allOk) anyCandOk = true; } -#endif +#endif -#if GDR_ENABLED +#if GDR_ENABLED if (allOk) #else if (tempMVPbits < curMVPbits) -#endif +#endif { curMVPbits = tempMVPbits; curMVPIdx = mvpIdxTemp; @@ -2538,7 +2538,7 @@ bool InterSearch::xHashInterEstimation(PredictionUnit& pu, RefPicList& bestRefPi Mv mvPred1Pel = currAMVPInfoPel.mvCand[mvpIdxTemp]; m_pcRdCost->setPredictor(mvPred1Pel); bitsMVP1Pel = m_pcRdCost->getBitsOfVectorWithPredictor(cMv.getHor(), cMv.getVer(), 2); -#if GDR_ENABLED +#if GDR_ENABLED allOk = (bitsMVP1Pel < curMVPbits); if (isEncodeGdrClean) { @@ -2546,9 +2546,9 @@ bool InterSearch::xHashInterEstimation(PredictionUnit& pu, RefPicList& bestRefPi allOk = allOk && isSolid; if (allOk) anyCandOk = true; } -#endif +#endif -#if GDR_ENABLED +#if GDR_ENABLED if (allOk) #else if (bitsMVP1Pel < curMVPbits) @@ -2566,7 +2566,7 @@ bool InterSearch::xHashInterEstimation(PredictionUnit& pu, RefPicList& bestRefPi m_pcRdCost->setPredictor(mvPred4Pel); bitsMVP4Pel = m_pcRdCost->getBitsOfVectorWithPredictor(cMv.getHor(), cMv.getVer(), 4); -#if GDR_ENABLED +#if GDR_ENABLED allOk = (bitsMVP4Pel < curMVPbits); if (isEncodeGdrClean) { @@ -2574,9 +2574,9 @@ bool InterSearch::xHashInterEstimation(PredictionUnit& pu, RefPicList& bestRefPi allOk = allOk && isSolid; if (allOk) anyCandOk = true; } -#endif +#endif -#if GDR_ENABLED +#if GDR_ENABLED if (allOk) #else if (bitsMVP4Pel < curMVPbits) @@ -2590,7 +2590,7 @@ bool InterSearch::xHashInterEstimation(PredictionUnit& pu, RefPicList& bestRefPi } } -#if GDR_ENABLED +#if GDR_ENABLED if (isEncodeGdrClean && !anyCandOk) { continue; @@ -2718,7 +2718,7 @@ void InterSearch::predInterSearch(CodingUnit& cu, Partitioner& partitioner) int aaiMvpIdx[2][33]; int aaiMvpNum[2][33]; -#if GDR_ENABLED +#if GDR_ENABLED bool cMvSolid[2]; bool cMvValid[2]; bool cMvBiSolid[2]; @@ -2792,7 +2792,7 @@ void InterSearch::predInterSearch(CodingUnit& cu, Partitioner& partitioner) checkNonAffine = m_affineMotion.hevcCost[1] < m_affineMotion.hevcCost[0] * 1.06f; } -#if GDR_ENABLED +#if GDR_ENABLED const bool isEncodeGdrClean = cs.sps->getGDREnabledFlag() && cs.pcv->isEncoder && ((cs.picHeader->getInGdrInterval() && cs.isClean(pu.Y().topRight(), CHANNEL_TYPE_LUMA)) || (cs.picHeader->getNumVerVirtualBoundaries() == 0)); const bool init_value = true; #endif @@ -2801,7 +2801,7 @@ void InterSearch::predInterSearch(CodingUnit& cu, Partitioner& partitioner) amvp[1].numCand = 0; memset(aacAMVPInfo, 0, sizeof(aacAMVPInfo)); -#if GDR_ENABLED +#if GDR_ENABLED if (isEncodeGdrClean) { biPDistTempOk = init_value; @@ -2871,7 +2871,7 @@ void InterSearch::predInterSearch(CodingUnit& cu, Partitioner& partitioner) Distortion uiCostBi = std::numeric_limits<Distortion>::max(); Distortion uiCostTemp; -#if GDR_ENABLED +#if GDR_ENABLED memset(uiCostTempL0Ok, init_value, sizeof(uiCostTempL0Ok)); bool mvValidList1Solid = init_value; @@ -2924,7 +2924,7 @@ void InterSearch::predInterSearch(CodingUnit& cu, Partitioner& partitioner) aaiMvpIdx[iRefList][iRefIdxTemp] = pu.mvpIdx[eRefPicList]; aaiMvpNum[iRefList][iRefIdxTemp] = pu.mvpNum[eRefPicList]; -#if GDR_ENABLED +#if GDR_ENABLED if (isEncodeGdrClean) { biPDistTempOk = true; @@ -2935,7 +2935,7 @@ void InterSearch::predInterSearch(CodingUnit& cu, Partitioner& partitioner) } #endif -#if GDR_ENABLED +#if GDR_ENABLED allOk = (cs.picHeader->getMvdL1ZeroFlag() && iRefList == 1 && biPDistTemp < bestBiPDist); if (isEncodeGdrClean) @@ -2951,7 +2951,7 @@ void InterSearch::predInterSearch(CodingUnit& cu, Partitioner& partitioner) } #endif -#if GDR_ENABLED +#if GDR_ENABLED if (allOk) #else if(cs.picHeader->getMvdL1ZeroFlag() && iRefList==1 && biPDistTemp < bestBiPDist) @@ -2960,7 +2960,7 @@ void InterSearch::predInterSearch(CodingUnit& cu, Partitioner& partitioner) bestBiPDist = biPDistTemp; bestBiPMvpL1 = aaiMvpIdx[iRefList][iRefIdxTemp]; bestBiPRefIdxL1 = iRefIdxTemp; -#if GDR_ENABLED +#if GDR_ENABLED if (isEncodeGdrClean) { bestBiPDistOk = biPDistTempOk; @@ -2975,7 +2975,7 @@ void InterSearch::predInterSearch(CodingUnit& cu, Partitioner& partitioner) if ( cs.slice->getList1IdxToList0Idx( iRefIdxTemp ) >= 0 ) { cMvTemp[1][iRefIdxTemp] = cMvTemp[0][cs.slice->getList1IdxToList0Idx( iRefIdxTemp )]; -#if GDR_ENABLED +#if GDR_ENABLED if (isEncodeGdrClean) { cMvTempSolid[1][iRefIdxTemp] = cMvTempSolid[1][cs.slice->getList1IdxToList0Idx(iRefIdxTemp)]; @@ -2984,7 +2984,7 @@ void InterSearch::predInterSearch(CodingUnit& cu, Partitioner& partitioner) #endif uiCostTemp = uiCostTempL0[cs.slice->getList1IdxToList0Idx( iRefIdxTemp )]; /*first subtract the bit-rate part of the cost of the other list*/ -#if GDR_ENABLED +#if GDR_ENABLED if (isEncodeGdrClean) { uiCostTempOk = uiCostTempL0Ok[cs.slice->getList1IdxToList0Idx(iRefIdxTemp)]; @@ -2999,14 +2999,14 @@ void InterSearch::predInterSearch(CodingUnit& cu, Partitioner& partitioner) } else { -#if GDR_ENABLED +#if GDR_ENABLED bCleanCandExist = false; xMotionEstimation(pu, origBuf, eRefPicList, cMvPred[iRefList][iRefIdxTemp], iRefIdxTemp, cMvTemp[iRefList][iRefIdxTemp], cMvTempSolid[iRefList][iRefIdxTemp], aaiMvpIdx[iRefList][iRefIdxTemp], uiBitsTemp, uiCostTemp, amvp[eRefPicList], bCleanCandExist); #else xMotionEstimation( pu, origBuf, eRefPicList, cMvPred[iRefList][iRefIdxTemp], iRefIdxTemp, cMvTemp[iRefList][iRefIdxTemp], aaiMvpIdx[iRefList][iRefIdxTemp], uiBitsTemp, uiCostTemp, amvp[eRefPicList] ); #endif -#if GDR_ENABLED +#if GDR_ENABLED if (isEncodeGdrClean) { int mvp_idx = aaiMvpIdx[iRefList][iRefIdxTemp]; @@ -3029,14 +3029,14 @@ void InterSearch::predInterSearch(CodingUnit& cu, Partitioner& partitioner) } else { -#if GDR_ENABLED +#if GDR_ENABLED bCleanCandExist = false; xMotionEstimation(pu, origBuf, eRefPicList, cMvPred[iRefList][iRefIdxTemp], iRefIdxTemp, cMvTemp[iRefList][iRefIdxTemp], cMvTempSolid[iRefList][iRefIdxTemp], aaiMvpIdx[iRefList][iRefIdxTemp], uiBitsTemp, uiCostTemp, amvp[eRefPicList], bCleanCandExist); #else xMotionEstimation( pu, origBuf, eRefPicList, cMvPred[iRefList][iRefIdxTemp], iRefIdxTemp, cMvTemp[iRefList][iRefIdxTemp], aaiMvpIdx[iRefList][iRefIdxTemp], uiBitsTemp, uiCostTemp, amvp[eRefPicList] ); -#endif +#endif -#if GDR_ENABLED +#if GDR_ENABLED if (isEncodeGdrClean) { int mvp_idx = aaiMvpIdx[iRefList][iRefIdxTemp]; @@ -3094,14 +3094,14 @@ void InterSearch::predInterSearch(CodingUnit& cu, Partitioner& partitioner) uiCostTempL0[iRefIdxTemp] = uiCostTemp; uiBitsTempL0[iRefIdxTemp] = uiBitsTemp; } -#if GDR_ENABLED +#if GDR_ENABLED if (isEncodeGdrClean) { uiCostTempL0Ok[iRefIdxTemp] = uiCostTempOk; } #endif -#if GDR_ENABLED +#if GDR_ENABLED allOk = (uiCostTemp < uiCost[iRefList]); if (isEncodeGdrClean) { @@ -3132,7 +3132,7 @@ void InterSearch::predInterSearch(CodingUnit& cu, Partitioner& partitioner) cMv [iRefList] = cMvTemp[iRefList][iRefIdxTemp]; iRefIdx[iRefList] = iRefIdxTemp; -#if GDR_ENABLED +#if GDR_ENABLED if (isEncodeGdrClean) { uiCostOk[iRefList] = uiCostTempOk; @@ -3143,7 +3143,7 @@ void InterSearch::predInterSearch(CodingUnit& cu, Partitioner& partitioner) } -#if GDR_ENABLED +#if GDR_ENABLED allOk = (iRefList == 1 && uiCostTemp < costValidList1 && cs.slice->getList1IdxToList0Idx(iRefIdxTemp) < 0); if (isEncodeGdrClean) { @@ -3158,7 +3158,7 @@ void InterSearch::predInterSearch(CodingUnit& cu, Partitioner& partitioner) } #endif -#if GDR_ENABLED +#if GDR_ENABLED if (allOk) #else if ( iRefList == 1 && uiCostTemp < costValidList1 && cs.slice->getList1IdxToList0Idx( iRefIdxTemp ) < 0 ) @@ -3169,7 +3169,7 @@ void InterSearch::predInterSearch(CodingUnit& cu, Partitioner& partitioner) // set motion mvValidList1 = cMvTemp[iRefList][iRefIdxTemp]; -#if GDR_ENABLED +#if GDR_ENABLED if (isEncodeGdrClean) { costValidList1Ok = uiCostTempOk; @@ -3326,7 +3326,7 @@ void InterSearch::predInterSearch(CodingUnit& cu, Partitioner& partitioner) if (m_pcEncCfg->getFastInterSearchMode() == FASTINTERSEARCH_MODE1 || m_pcEncCfg->getFastInterSearchMode() == FASTINTERSEARCH_MODE2) { -#if GDR_ENABLED +#if GDR_ENABLED allOk = (uiCost[0] <= uiCost[1]); if (isEncodeGdrClean) { @@ -3341,7 +3341,7 @@ void InterSearch::predInterSearch(CodingUnit& cu, Partitioner& partitioner) } #endif -#if GDR_ENABLED +#if GDR_ENABLED if (allOk) #else if (uiCost[0] <= uiCost[1]) @@ -3373,7 +3373,7 @@ void InterSearch::predInterSearch(CodingUnit& cu, Partitioner& partitioner) pu.mvSolid[1 - iRefList] = cMvSolid[1 - iRefList]; pu.mvValid[1 - iRefList] = cs.isClean(pu.Y().bottomRight(), pu.mv[1 - iRefList], (RefPicList)(1 - iRefList), pu.refIdx[1 - iRefList]); } -#endif +#endif PelUnitBuf predBufTmp = m_tmpPredStorage[1 - iRefList].getBuf(UnitAreaRelative(cu, pu)); motionCompensation(pu, predBufTmp, RefPicList(1 - iRefList)); } @@ -3424,7 +3424,7 @@ void InterSearch::predInterSearch(CodingUnit& cu, Partitioner& partitioner) cMvTemp[iRefList][iRefIdxTemp], aaiMvpIdxBi[iRefList][iRefIdxTemp], uiBitsTemp, uiCostTemp, amvp[eRefPicList], true); #endif -#if GDR_ENABLED +#if GDR_ENABLED if (isEncodeGdrClean) { int mvp_idx = aaiMvpIdxBi[iRefList][iRefIdxTemp]; @@ -3444,7 +3444,7 @@ void InterSearch::predInterSearch(CodingUnit& cu, Partitioner& partitioner) #endif #if GDR_ENABLED - // note : uiCostTemp is the new Best MVP cost, + // note : uiCostTemp is the new Best MVP cost, // solid info will be at amvp[eRefPicList].mvSolid[aaiMvpIdx[iRefList][iRefIdxTemp]]; xCheckBestMVP(pu, eRefPicList, cMvTemp[iRefList][iRefIdxTemp], cMvPredBi[iRefList][iRefIdxTemp], aaiMvpIdxBi[iRefList][iRefIdxTemp], amvp[eRefPicList], uiBitsTemp, uiCostTemp, pu.cu->imv); @@ -3470,7 +3470,7 @@ void InterSearch::predInterSearch(CodingUnit& cu, Partitioner& partitioner) xCheckBestMVP(eRefPicList, cMvTemp[iRefList][iRefIdxTemp], cMvPredBi[iRefList][iRefIdxTemp], aaiMvpIdxBi[iRefList][iRefIdxTemp], amvp[eRefPicList], uiBitsTemp, uiCostTemp, pu.cu->imv); #endif -#if GDR_ENABLED +#if GDR_ENABLED allOk = (uiCostTemp < uiCostBi); if (isEncodeGdrClean) { @@ -3484,7 +3484,7 @@ void InterSearch::predInterSearch(CodingUnit& cu, Partitioner& partitioner) } } #endif -#if GDR_ENABLED +#if GDR_ENABLED if (allOk) #else if (uiCostTemp < uiCostBi) @@ -3493,7 +3493,7 @@ void InterSearch::predInterSearch(CodingUnit& cu, Partitioner& partitioner) bChanged = true; cMvBi[iRefList] = cMvTemp[iRefList][iRefIdxTemp]; -#if GDR_ENABLED +#if GDR_ENABLED if (isEncodeGdrClean) { cMvBiSolid[iRefList] = cMvTempSolid[iRefList][iRefIdxTemp]; @@ -3503,7 +3503,7 @@ void InterSearch::predInterSearch(CodingUnit& cu, Partitioner& partitioner) iRefIdxBi[iRefList] = iRefIdxTemp; uiCostBi = uiCostTemp; -#if GDR_ENABLED +#if GDR_ENABLED if (isEncodeGdrClean) { uiCostBiOk = uiCostTempOk; @@ -3518,7 +3518,7 @@ void InterSearch::predInterSearch(CodingUnit& cu, Partitioner& partitioner) // Set motion pu.mv[eRefPicList] = cMvBi[iRefList]; pu.refIdx[eRefPicList] = iRefIdxBi[iRefList]; -#if GDR_ENABLED +#if GDR_ENABLED if (isEncodeGdrClean) { pu.mvSolid[eRefPicList] = cMvBiSolid[iRefList]; @@ -3533,7 +3533,7 @@ void InterSearch::predInterSearch(CodingUnit& cu, Partitioner& partitioner) if (!bChanged) { -#if GDR_ENABLED +#if GDR_ENABLED allOk = ((uiCostBi <= uiCost[0] && uiCostBi <= uiCost[1]) || enforceBcwPred); if (isEncodeGdrClean) @@ -3548,7 +3548,7 @@ void InterSearch::predInterSearch(CodingUnit& cu, Partitioner& partitioner) } } #endif -#if GDR_ENABLED +#if GDR_ENABLED if (allOk) #else if ((uiCostBi <= uiCost[0] && uiCostBi <= uiCost[1]) || enforceBcwPred) @@ -3556,7 +3556,7 @@ void InterSearch::predInterSearch(CodingUnit& cu, Partitioner& partitioner) { xCopyAMVPInfo(&aacAMVPInfo[0][iRefIdxBi[0]], &amvp[REF_PIC_LIST_0]); #if GDR_ENABLED - // note : uiCostBi is the new Best MVP cost, + // note : uiCostBi is the new Best MVP cost, // solid info will be at amvp[eRefPicList].mvSolid[aaiMvpIdx[iRefList][iRefIdxTemp]]; xCheckBestMVP(pu, REF_PIC_LIST_0, cMvBi[0], cMvPredBi[0][iRefIdxBi[0]], aaiMvpIdxBi[0][iRefIdxBi[0]], amvp[REF_PIC_LIST_0], uiBits[2], uiCostBi, pu.cu->imv); @@ -3580,12 +3580,12 @@ void InterSearch::predInterSearch(CodingUnit& cu, Partitioner& partitioner) #else xCheckBestMVP(REF_PIC_LIST_0, cMvBi[0], cMvPredBi[0][iRefIdxBi[0]], aaiMvpIdxBi[0][iRefIdxBi[0]], amvp[REF_PIC_LIST_0], uiBits[2], uiCostBi, pu.cu->imv); -#endif +#endif if (!cs.picHeader->getMvdL1ZeroFlag()) { xCopyAMVPInfo(&aacAMVPInfo[1][iRefIdxBi[1]], &amvp[REF_PIC_LIST_1]); #if GDR_ENABLED - // note : uiCostBi is the new Best MVP cost, + // note : uiCostBi is the new Best MVP cost, // solid info will be at amvp[eRefPicList].mvSolid[aaiMvpIdx[iRefList][iRefIdxTemp]]; xCheckBestMVP(pu, REF_PIC_LIST_1, cMvBi[1], cMvPredBi[1][iRefIdxBi[1]], aaiMvpIdxBi[1][iRefIdxBi[1]], amvp[REF_PIC_LIST_1], uiBits[2], uiCostBi, pu.cu->imv); @@ -3666,7 +3666,7 @@ void InterSearch::predInterSearch(CodingUnit& cu, Partitioner& partitioner) cTarMvField.setMvField( aacAMVPInfo[tarRefList][refIdxTar].mvCand[j], refIdxTar ); Distortion cost = xGetSymmetricCost( pu, origBuf, eCurRefList, cCurMvField, cTarMvField, bcwIdx ); -#if GDR_ENABLED +#if GDR_ENABLED if (isEncodeGdrClean) { cCurMvFieldSolid = aacAMVPInfo[curRefList][refIdxCur].mvSolid[i]; @@ -3849,21 +3849,21 @@ void InterSearch::predInterSearch(CodingUnit& cu, Partitioner& partitioner) symCost = costStart - mvpCost; // ME -#if GDR_ENABLED +#if GDR_ENABLED xSymmetricMotionEstimation(pu, origBuf, cMvPredSym[curRefList], cMvPredSym[tarRefList], eCurRefList, cCurMvField, cTarMvField, symCost, bcwIdx, costStartOk); #else xSymmetricMotionEstimation( pu, origBuf, cMvPredSym[curRefList], cMvPredSym[tarRefList], eCurRefList, cCurMvField, cTarMvField, symCost, bcwIdx ); #endif symCost += mvpCost; -#if GDR_ENABLED +#if GDR_ENABLED if (isEncodeGdrClean) { cCurMvFieldValid = cs.isClean(pu.Y().bottomRight(), cCurMvField.mv, (RefPicList)(eCurRefList), cCurMvField.refIdx); cTarMvFieldValid = cs.isClean(pu.Y().bottomRight(), cTarMvField.mv, (RefPicList)(1 - eCurRefList), cTarMvField.refIdx); symCostOk = (cMvPredSymSolid[curRefList] && cMvPredSymSolid[tarRefList]) && (cCurMvFieldValid && cTarMvFieldValid); } -#endif +#endif if (startPtMv != cCurMvField.mv) { // if ME change MV, run a final check for best MVP. #if GDR_ENABLED @@ -3872,7 +3872,7 @@ void InterSearch::predInterSearch(CodingUnit& cu, Partitioner& partitioner) symmvdCheckBestMvp(pu, origBuf, cCurMvField.mv, (RefPicList)curRefList, aacAMVPInfo, bcwIdx, cMvPredSym, mvpIdxSym, symCost, true); #endif -#if GDR_ENABLED +#if GDR_ENABLED if (isEncodeGdrClean) { int mvp_idx0 = mvpIdxSym[0]; @@ -3982,7 +3982,7 @@ void InterSearch::predInterSearch(CodingUnit& cu, Partitioner& partitioner) // Set Motion Field cMv[1] = mvValidList1; -#if GDR_ENABLED +#if GDR_ENABLED if (isEncodeGdrClean) { cMvSolid[1] = mvValidList1Solid; @@ -4059,7 +4059,7 @@ void InterSearch::predInterSearch(CodingUnit& cu, Partitioner& partitioner) if (allOk) #else if ( uiCostBi <= uiCost[0] && uiCostBi <= uiCost[1]) -#endif +#endif { uiLastMode = 2; pu.mv [REF_PIC_LIST_0] = cMvBi[0]; @@ -4085,7 +4085,7 @@ void InterSearch::predInterSearch(CodingUnit& cu, Partitioner& partitioner) pu.mvValid[REF_PIC_LIST_0] = cs.isClean(pu.Y().bottomRight(), pu.mv[REF_PIC_LIST_0], (RefPicList)REF_PIC_LIST_0, pu.refIdx[REF_PIC_LIST_0]); pu.mvValid[REF_PIC_LIST_1] = cs.isClean(pu.Y().bottomRight(), pu.mv[REF_PIC_LIST_1], (RefPicList)REF_PIC_LIST_1, pu.refIdx[REF_PIC_LIST_1]); } -#endif +#endif } #if GDR_ENABLED else if (L0ok) @@ -4199,13 +4199,13 @@ void InterSearch::predInterSearch(CodingUnit& cu, Partitioner& partitioner) #endif int refIdx4Para[2] = { -1, -1 }; -#if GDR_ENABLED +#if GDR_ENABLED xPredAffineInterSearch(pu, origBuf, puIdx, uiLastModeTemp, uiAffineCost, cMvHevcTemp, cMvHevcTempSolid, acMvAffine4Para, acMvAffine4ParaSolid, refIdx4Para, bcwIdx, enforceBcwPred, ((cu.slice->getSPS()->getUseBcw() == true) ? getWeightIdxBits(bcwIdx) : 0)); #else xPredAffineInterSearch(pu, origBuf, puIdx, uiLastModeTemp, uiAffineCost, cMvHevcTemp, acMvAffine4Para, refIdx4Para, bcwIdx, enforceBcwPred, ((cu.slice->getSPS()->getUseBcw() == true) ? getWeightIdxBits(bcwIdx) : 0)); -#endif +#endif if ( pu.cu->imv == 0 ) { @@ -4216,7 +4216,7 @@ void InterSearch::predInterSearch(CodingUnit& cu, Partitioner& partitioner) #endif } -#if GDR_ENABLED +#if GDR_ENABLED if (isEncodeGdrClean) { uiAffineCostOk = true; @@ -4304,7 +4304,7 @@ void InterSearch::predInterSearch(CodingUnit& cu, Partitioner& partitioner) Distortion uiAffine6Cost = std::numeric_limits<Distortion>::max(); cu.affineType = AFFINEMODEL_6PARAM; -#if GDR_ENABLED +#if GDR_ENABLED xPredAffineInterSearch(pu, origBuf, puIdx, uiLastModeTemp, uiAffine6Cost, cMvHevcTemp, cMvHevcTempSolid, acMvAffine4Para, acMvAffine4ParaSolid, refIdx4Para, bcwIdx, enforceBcwPred, ((cu.slice->getSPS()->getUseBcw() == true) ? getWeightIdxBits(bcwIdx) : 0)); #else @@ -4436,7 +4436,7 @@ void InterSearch::predInterSearch(CodingUnit& cu, Partitioner& partitioner) allOk = false; } } -#endif +#endif #if GDR_ENABLED if (allOk) @@ -4539,7 +4539,7 @@ void InterSearch::xEstimateMvPredAMVP( PredictionUnit& pu, PelUnitBuf& origBuf, #if GDR_ENABLED const CodingStructure &cs = *pu.cs; const bool isEncodeGdrClean = cs.sps->getGDREnabledFlag() && cs.pcv->isEncoder && ((cs.picHeader->getInGdrInterval() && cs.isClean(pu.Y().topRight(), CHANNEL_TYPE_LUMA)) || (cs.picHeader->getNumVerVirtualBoundaries() == 0)); -#endif +#endif #if GDR_ENABLED if (isEncodeGdrClean) @@ -4565,7 +4565,7 @@ void InterSearch::xEstimateMvPredAMVP( PredictionUnit& pu, PelUnitBuf& origBuf, // initialize Mvp index & Mvp iBestIdx = 0; cBestMv = pcAMVPInfo->mvCand[0]; -#if GDR_ENABLED +#if GDR_ENABLED if (isEncodeGdrClean) { uiBestCostOk = pcAMVPInfo->mvSolid[0]; @@ -4579,14 +4579,14 @@ void InterSearch::xEstimateMvPredAMVP( PredictionUnit& pu, PelUnitBuf& origBuf, { Distortion uiTmpCost = xGetTemplateCost( pu, origBuf, predBuf, pcAMVPInfo->mvCand[i], i, AMVP_MAX_NUM_CANDS, eRefPicList, iRefIdx ); -#if GDR_ENABLED +#if GDR_ENABLED if (isEncodeGdrClean) { uiTmpCostOk = pcAMVPInfo->mvSolid[i]; } #endif -#if GDR_ENABLED +#if GDR_ENABLED bool allOk = (uiBestCost > uiTmpCost); if (isEncodeGdrClean) @@ -4602,7 +4602,7 @@ void InterSearch::xEstimateMvPredAMVP( PredictionUnit& pu, PelUnitBuf& origBuf, } #endif -#if GDR_ENABLED +#if GDR_ENABLED if (allOk) #else if( uiBestCost > uiTmpCost ) @@ -4692,7 +4692,7 @@ void InterSearch::xCheckBestMVP(PredictionUnit &pu, RefPicList eRefPicList, Mv c void InterSearch::xCheckBestMVP ( RefPicList eRefPicList, Mv cMv, Mv& rcMvPred, int& riMVPIdx, AMVPInfo& amvpInfo, uint32_t& ruiBits, Distortion& ruiCost, const uint8_t imv ) #endif { -#if GDR_ENABLED +#if GDR_ENABLED const CodingStructure &cs = *pu.cs; const bool isEncodeGdrClean = cs.sps->getGDREnabledFlag() && cs.pcv->isEncoder && ((cs.picHeader->getInGdrInterval() && cs.isClean(pu.Y().topRight(), CHANNEL_TYPE_LUMA)) || (cs.picHeader->getNumVerVirtualBoundaries() == 0)); bool iBestMvBitsOk = false; @@ -4725,7 +4725,7 @@ void InterSearch::xCheckBestMVP ( RefPicList eRefPicList, Mv cMv, Mv& rcMvPred, int iOrgMvBits = m_pcRdCost->getBitsOfVectorWithPredictor(mv.getHor(), mv.getVer(), 0); iOrgMvBits += m_auiMVPIdxCost[riMVPIdx][AMVP_MAX_NUM_CANDS]; int iBestMvBits = iOrgMvBits; -#if GDR_ENABLED +#if GDR_ENABLED if (isEncodeGdrClean) { iBestMvBitsOk = pcAMVPInfo->mvSolid[riMVPIdx]; @@ -5067,7 +5067,7 @@ void InterSearch::xMotionEstimation(PredictionUnit& pu, PelUnitBuf& origBuf, Ref else // integer refinement for integer-pel and 4-pel resolution { rcMv.changePrecision(MV_PRECISION_INT, MV_PRECISION_INTERNAL); -#if GDR_ENABLED +#if GDR_ENABLED xPatternSearchIntRefine(pu, cStruct, rcMv, rcMvPred, riMVPIdx, ruiBits, ruiCost, amvpInfo, fWeight, eRefPicList, iRefIdxPred, rbCleanCandExist); #else xPatternSearchIntRefine( pu, cStruct, rcMv, rcMvPred, riMVPIdx, ruiBits, ruiCost, amvpInfo, fWeight); @@ -5305,7 +5305,7 @@ void InterSearch::xTZSearch( const PredictionUnit& pu, #if GDR_ENABLED const CodingStructure &cs = *pu.cs; const bool isEncodeGdrClean = cs.sps->getGDREnabledFlag() && cs.pcv->isEncoder && ((cs.picHeader->getInGdrInterval() && cs.isClean(pu.Y().topRight(), CHANNEL_TYPE_LUMA)) || (cs.picHeader->getNumVerVirtualBoundaries() == 0)); -#endif +#endif int iSearchRange = m_iSearchRange; if( m_pcEncCfg->getMCTSEncConstraint() ) { @@ -5848,7 +5848,7 @@ void InterSearch::xTZSearchSelective( const PredictionUnit& pu, ruiSAD = cStruct.uiBestSad - m_pcRdCost->getCostOfVectorWithPredictor( cStruct.iBestX, cStruct.iBestY, cStruct.imvShift ); } -#if GDR_ENABLED +#if GDR_ENABLED void InterSearch::xPatternSearchIntRefine(PredictionUnit& pu, IntTZSearchStruct& cStruct, Mv& rcMv, Mv& rcMvPred, int& riMVPIdx, uint32_t& ruiBits, Distortion& ruiCost, const AMVPInfo& amvpInfo, double fWeight, RefPicList eRefPicList, int iRefIdxPred, bool& rbCleanCandExist) #else void InterSearch::xPatternSearchIntRefine(PredictionUnit& pu, IntTZSearchStruct& cStruct, Mv& rcMv, Mv& rcMvPred, int& riMVPIdx, uint32_t& ruiBits, Distortion& ruiCost, const AMVPInfo& amvpInfo, double fWeight) @@ -5889,7 +5889,7 @@ void InterSearch::xPatternSearchIntRefine(PredictionUnit& pu, IntTZSearchStruct& cBaseMvd[1].roundTransPrecInternal2Amvr(pu.cu->imv); // test best integer position and all 8 neighboring positions -#if GDR_ENABLED +#if GDR_ENABLED bool allOk = true; bool uiDistOk = false; bool uiBestDistOk = false; @@ -6028,7 +6028,7 @@ void InterSearch::xPatternSearchFracDIF( m_pcRdCost->setCostScale(0); xExtDIFUpSamplingH(&cPatternRoi, cStruct.useAltHpelIf); rcMvQter = rcMvInt; rcMvQter <<= 2; // for mv-cost -#if GDR_ENABLED +#if GDR_ENABLED ruiCost = xPatternRefinement(pu, eRefPicList, iRefIdx, cStruct.pcPatternKey, baseRefMv, 1, rcMvQter, !pu.cs->slice->getDisableSATDForRD(), rbCleanCandExist); #else ruiCost = xPatternRefinement(cStruct.pcPatternKey, baseRefMv, 1, rcMvQter, !pu.cs->slice->getDisableSATDForRD()); @@ -6137,7 +6137,7 @@ Distortion InterSearch::xSymmeticRefineMvSearch( PredictionUnit &pu, PelUnitBuf& , RefPicList eRefPicList, MvField& rCurMvField, MvField& rTarMvField, Distortion uiMinCost, int SearchPattern, int nSearchStepShift, uint32_t uiMaxSearchRounds, int bcwIdx ) #endif { -#if GDR_ENABLED +#if GDR_ENABLED const CodingStructure &cs = *pu.cs; const bool isEncodeGdrClean = cs.sps->getGDREnabledFlag() && cs.pcv->isEncoder && ((cs.picHeader->getInGdrInterval() && cs.isClean(pu.Y().topRight(), CHANNEL_TYPE_LUMA)) || (cs.picHeader->getNumVerVirtualBoundaries() == 0)); bool uiCostOk; @@ -6218,7 +6218,7 @@ Distortion InterSearch::xSymmeticRefineMvSearch( PredictionUnit &pu, PelUnitBuf& uint32_t uiMvBits = m_pcRdCost->getBitsOfVectorWithPredictor( mv.getHor(), mv.getVer(), 0 ); Distortion uiCost = m_pcRdCost->getCost( uiMvBits ); -#if GDR_ENABLED +#if GDR_ENABLED uiCostOk = cs.isClean(pu.Y().bottomRight(), mvCand.mv, eRefPicList, mvCand.refIdx); #endif @@ -6232,7 +6232,7 @@ Distortion InterSearch::xSymmeticRefineMvSearch( PredictionUnit &pu, PelUnitBuf& } uiCost += xGetSymmetricCost( pu, origBuf, eRefPicList, mvCand, mvPair, bcwIdx ); -#if GDR_ENABLED +#if GDR_ENABLED bool allOk = (uiCost < uiMinCost); if (isEncodeGdrClean) { @@ -6242,7 +6242,7 @@ Distortion InterSearch::xSymmeticRefineMvSearch( PredictionUnit &pu, PelUnitBuf& } #endif -#if GDR_ENABLED +#if GDR_ENABLED if (allOk) #else if ( uiCost < uiMinCost ) @@ -6252,12 +6252,12 @@ Distortion InterSearch::xSymmeticRefineMvSearch( PredictionUnit &pu, PelUnitBuf& rCurMvField = mvCand; rTarMvField = mvPair; nBestDirect = nDirect; -#if GDR_ENABLED +#if GDR_ENABLED if (isEncodeGdrClean) { uiMinCostOk = uiCostOk; } -#endif +#endif } } @@ -6274,7 +6274,7 @@ Distortion InterSearch::xSymmeticRefineMvSearch( PredictionUnit &pu, PelUnitBuf& nDirectEnd = nBestDirect + nStep; } -#if GDR_ENABLED +#if GDR_ENABLED rOk = uiMinCostOk; #endif @@ -6282,7 +6282,7 @@ Distortion InterSearch::xSymmeticRefineMvSearch( PredictionUnit &pu, PelUnitBuf& } -#if GDR_ENABLED +#if GDR_ENABLED bool InterSearch::xSymmetricMotionEstimation(PredictionUnit& pu, PelUnitBuf& origBuf, Mv& rcMvCurPred, Mv& rcMvTarPred, RefPicList eRefPicList, MvField& rCurMvField, MvField& rTarMvField, Distortion& ruiCost, int bcwIdx, bool& ruiCostOk) #else void InterSearch::xSymmetricMotionEstimation( PredictionUnit& pu, PelUnitBuf& origBuf, Mv& rcMvCurPred, Mv& rcMvTarPred, RefPicList eRefPicList, MvField& rCurMvField, MvField& rTarMvField, Distortion& ruiCost, int bcwIdx ) @@ -6296,7 +6296,7 @@ void InterSearch::xSymmetricMotionEstimation( PredictionUnit& pu, PelUnitBuf& or nSearchStepShift += pu.cu->imv == IMV_HPEL ? 1 : (pu.cu->imv << 1); nDiamondRound >>= pu.cu->imv; -#if GDR_ENABLED +#if GDR_ENABLED ruiCost = xSymmeticRefineMvSearch(pu, origBuf, rcMvCurPred, rcMvTarPred, eRefPicList, rCurMvField, rTarMvField, ruiCost, 2, nSearchStepShift, nDiamondRound, bcwIdx, ruiCostOk); ruiCost = xSymmeticRefineMvSearch(pu, origBuf, rcMvCurPred, rcMvTarPred, eRefPicList, rCurMvField, rTarMvField, ruiCost, 0, nSearchStepShift, nCrossRound, bcwIdx, ruiCostOk); #else @@ -6304,7 +6304,7 @@ void InterSearch::xSymmetricMotionEstimation( PredictionUnit& pu, PelUnitBuf& or ruiCost = xSymmeticRefineMvSearch( pu, origBuf, rcMvCurPred, rcMvTarPred, eRefPicList, rCurMvField, rTarMvField, ruiCost, 0, nSearchStepShift, nCrossRound, bcwIdx ); #endif -#if GDR_ENABLED +#if GDR_ENABLED return ruiCostOk; #endif } @@ -6392,7 +6392,7 @@ void InterSearch::xPredAffineInterSearch( PredictionUnit& pu, bool bestBiPDistOk = init_value; - // if (isEncodeGdrClean) + // if (isEncodeGdrClean) { memset(mvHevcSolid, init_value, sizeof(mvHevcSolid)); @@ -6440,7 +6440,7 @@ void InterSearch::xPredAffineInterSearch( PredictionUnit& pu, Distortion uiCost[2] = { std::numeric_limits<Distortion>::max(), std::numeric_limits<Distortion>::max() }; Distortion uiCostBi = std::numeric_limits<Distortion>::max(); Distortion uiCostTemp; -#if GDR_ENABLED +#if GDR_ENABLED bool uiCostOk[2] = { init_value, init_value }; bool uiCostBiOk = init_value; bool uiCostTempOk = init_value; @@ -6470,7 +6470,7 @@ void InterSearch::xPredAffineInterSearch( PredictionUnit& pu, int refIdxValidList1 = 0; uint32_t bitsValidList1 = MAX_UINT; Distortion costValidList1 = std::numeric_limits<Distortion>::max(); -#if GDR_ENABLED +#if GDR_ENABLED bool costValidList1Ok = true; #endif Mv mvHevc[3]; @@ -6515,7 +6515,7 @@ void InterSearch::xPredAffineInterSearch( PredictionUnit& pu, aaiMvpIdx[iRefList][iRefIdxTemp] = pu.mvpIdx[eRefPicList]; aaiMvpNum[iRefList][iRefIdxTemp] = pu.mvpNum[eRefPicList]; -#if GDR_ENABLED +#if GDR_ENABLED if (isEncodeGdrClean) { int mvpIdx = aaiMvpIdx[iRefList][iRefIdxTemp]; @@ -6541,7 +6541,7 @@ void InterSearch::xPredAffineInterSearch( PredictionUnit& pu, mvHevc[i] = hevcMv[iRefList][iRefIdxTemp]; mvHevc[i].roundAffinePrecInternal2Amvr(pu.cu->imv); -#if GDR_ENABLED +#if GDR_ENABLED if (isEncodeGdrClean) { mvHevcSolid[i] = hevcMvSolid[iRefList][iRefIdxTemp]; @@ -6549,7 +6549,7 @@ void InterSearch::xPredAffineInterSearch( PredictionUnit& pu, #endif } PelUnitBuf predBuf = m_tmpStorageLCU.getBuf( UnitAreaRelative(*pu.cu, pu) ); -#if GDR_ENABLED +#if GDR_ENABLED bool uiCandCostOk = true; Distortion uiCandCost = xGetAffineTemplateCost(pu, origBuf, predBuf, mvHevc, aaiMvpIdx[iRefList][iRefIdxTemp], AMVP_MAX_NUM_CANDS, eRefPicList, iRefIdxTemp, uiCandCostOk); @@ -6574,14 +6574,14 @@ void InterSearch::xPredAffineInterSearch( PredictionUnit& pu, if ( savedParaAvail ) { Mv mvFour[3]; -#if GDR_ENABLED +#if GDR_ENABLED bool mvFourSolid[3] = { true, true, true }; #endif for ( int i = 0; i < mvNum; i++ ) { mvFour[i] = affine4Para ? m_affineMotion.acMvAffine4Para[iRefList][i] : m_affineMotion.acMvAffine6Para[iRefList][i]; mvFour[i].roundAffinePrecInternal2Amvr(pu.cu->imv); -#if GDR_ENABLED +#if GDR_ENABLED mvFourSolid[i] = affine4Para ? m_affineMotion.acMvAffine4ParaSolid[iRefList][i] : m_affineMotion.acMvAffine6ParaSolid[iRefList][i]; #endif } @@ -6596,7 +6596,7 @@ void InterSearch::xPredAffineInterSearch( PredictionUnit& pu, #endif candCostInherit += m_pcRdCost->getCost( xCalcAffineMVBits( pu, mvFour, cMvPred[iRefList][iRefIdxTemp] ) ); -#if GDR_ENABLED +#if GDR_ENABLED allOk = (candCostInherit < uiCandCost); if (isEncodeGdrClean) { @@ -6611,7 +6611,7 @@ void InterSearch::xPredAffineInterSearch( PredictionUnit& pu, } #endif -#if GDR_ENABLED +#if GDR_ENABLED if (allOk) #else if ( candCostInherit < uiCandCost ) @@ -6619,7 +6619,7 @@ void InterSearch::xPredAffineInterSearch( PredictionUnit& pu, { uiCandCost = candCostInherit; memcpy( mvHevc, mvFour, 3 * sizeof( Mv ) ); -#if GDR_ENABLED +#if GDR_ENABLED if (isEncodeGdrClean) { uiCandCostOk = candCostInheritOk; @@ -6637,7 +6637,7 @@ void InterSearch::xPredAffineInterSearch( PredictionUnit& pu, for (int i = 0; i < m_affMVListSize; i++) { AffineMVInfo *mvInfo = m_affMVList + ((m_affMVListIdx - i - 1 + m_affMVListMaxSize) % (m_affMVListMaxSize)); -#if GDR_ENABLED +#if GDR_ENABLED AffineMVInfoSolid *mvInfoSolid = m_affMVListSolid + ((m_affMVListIdx - i - 1 + m_affMVListMaxSize) % (m_affMVListMaxSize)); #endif @@ -6703,7 +6703,7 @@ void InterSearch::xPredAffineInterSearch( PredictionUnit& pu, { tmpCost += m_pcRdCost->getCost( xCalcAffineMVBits( pu, mvTmp, cMvPred[iRefList][iRefIdxTemp] ) ); } -#if GDR_ENABLED +#if GDR_ENABLED allOk = (tmpCost < uiCandCost); if (isEncodeGdrClean) { @@ -6718,7 +6718,7 @@ void InterSearch::xPredAffineInterSearch( PredictionUnit& pu, } #endif -#if GDR_ENABLED +#if GDR_ENABLED if (allOk) #else if (tmpCost < uiCandCost) @@ -6726,7 +6726,7 @@ void InterSearch::xPredAffineInterSearch( PredictionUnit& pu, { uiCandCost = tmpCost; std::memcpy(mvHevc, mvTmp, 3 * sizeof(Mv)); -#if GDR_ENABLED +#if GDR_ENABLED if (isEncodeGdrClean) { uiCandCostOk = tmpCostOk; @@ -6775,7 +6775,7 @@ void InterSearch::xPredAffineInterSearch( PredictionUnit& pu, { uiCandCostInherit += m_pcRdCost->getCost( xCalcAffineMVBits( pu, mvFour, cMvPred[iRefList][iRefIdxTemp] ) ); } -#if GDR_ENABLED +#if GDR_ENABLED allOk = (uiCandCostInherit < uiCandCost); if (isEncodeGdrClean) @@ -6791,7 +6791,7 @@ void InterSearch::xPredAffineInterSearch( PredictionUnit& pu, } #endif -#if GDR_ENABLED +#if GDR_ENABLED if (allOk) #else if ( uiCandCostInherit < uiCandCost ) @@ -6801,7 +6801,7 @@ void InterSearch::xPredAffineInterSearch( PredictionUnit& pu, for ( int i = 0; i < 3; i++ ) { mvHevc[i] = mvFour[i]; -#if GDR_ENABLED +#if GDR_ENABLED if (isEncodeGdrClean) { uiCandCostOk = uiCandCostInheritOk; @@ -6813,7 +6813,7 @@ void InterSearch::xPredAffineInterSearch( PredictionUnit& pu, } -#if GDR_ENABLED +#if GDR_ENABLED allOk = (uiCandCost < biPDistTemp); if (isEncodeGdrClean) @@ -6829,37 +6829,37 @@ void InterSearch::xPredAffineInterSearch( PredictionUnit& pu, } #endif -#if GDR_ENABLED +#if GDR_ENABLED if (allOk) #else if ( uiCandCost < biPDistTemp ) #endif { ::memcpy( cMvTemp[iRefList][iRefIdxTemp], mvHevc, sizeof(Mv)*3 ); -#if GDR_ENABLED +#if GDR_ENABLED if (isEncodeGdrClean) { cMvTempSolid[iRefList][iRefIdxTemp][0] = mvHevcSolid[0]; cMvTempSolid[iRefList][iRefIdxTemp][1] = mvHevcSolid[1]; cMvTempSolid[iRefList][iRefIdxTemp][2] = mvHevcSolid[2]; } -#endif +#endif } else { ::memcpy( cMvTemp[iRefList][iRefIdxTemp], cMvPred[iRefList][iRefIdxTemp], sizeof(Mv)*3 ); -#if GDR_ENABLED +#if GDR_ENABLED if (isEncodeGdrClean) { cMvTempSolid[iRefList][iRefIdxTemp][0] = cMvPredSolid[iRefList][iRefIdxTemp][0]; cMvTempSolid[iRefList][iRefIdxTemp][1] = cMvPredSolid[iRefList][iRefIdxTemp][1]; cMvTempSolid[iRefList][iRefIdxTemp][2] = cMvPredSolid[iRefList][iRefIdxTemp][2]; } -#endif +#endif } // GPB list 1, save the best MvpIdx, RefIdx and Cost -#if GDR_ENABLED +#if GDR_ENABLED allOk = (slice.getPicHeader()->getMvdL1ZeroFlag() && iRefList == 1 && (biPDistTemp < bestBiPDist)); if (isEncodeGdrClean) @@ -6875,7 +6875,7 @@ void InterSearch::xPredAffineInterSearch( PredictionUnit& pu, } #endif -#if GDR_ENABLED +#if GDR_ENABLED if (allOk) #else if ( slice.getPicHeader()->getMvdL1ZeroFlag() && iRefList==1 && biPDistTemp < bestBiPDist ) @@ -6901,7 +6901,7 @@ void InterSearch::xPredAffineInterSearch( PredictionUnit& pu, { int iList1ToList0Idx = slice.getList1IdxToList0Idx( iRefIdxTemp ); ::memcpy( cMvTemp[1][iRefIdxTemp], cMvTemp[0][iList1ToList0Idx], sizeof(Mv)*3 ); -#if GDR_ENABLED +#if GDR_ENABLED if (isEncodeGdrClean) { ::memcpy(cMvTempSolid[1][iRefIdxTemp], cMvTempSolid[0][iList1ToList0Idx], sizeof(bool) * 3); @@ -6918,7 +6918,7 @@ void InterSearch::xPredAffineInterSearch( PredictionUnit& pu, } else { -#if GDR_ENABLED +#if GDR_ENABLED xAffineMotionEstimation(pu, origBuf, eRefPicList, cMvPred[iRefList][iRefIdxTemp], iRefIdxTemp, cMvTemp[iRefList][iRefIdxTemp], cMvTempSolid[iRefList][iRefIdxTemp], uiBitsTemp, uiCostTemp , aaiMvpIdx[iRefList][iRefIdxTemp], affiAMVPInfoTemp[eRefPicList], bAnyClean #else @@ -6927,7 +6927,7 @@ void InterSearch::xPredAffineInterSearch( PredictionUnit& pu, #endif ); -#if GDR_ENABLED +#if GDR_ENABLED if (isEncodeGdrClean) { int mvp_idx = aaiMvpIdx[iRefList][iRefIdxTemp]; @@ -6961,7 +6961,7 @@ void InterSearch::xPredAffineInterSearch( PredictionUnit& pu, } else { -#if GDR_ENABLED +#if GDR_ENABLED xAffineMotionEstimation(pu, origBuf, eRefPicList, cMvPred[iRefList][iRefIdxTemp], iRefIdxTemp, cMvTemp[iRefList][iRefIdxTemp], cMvTempSolid[iRefList][iRefIdxTemp], uiBitsTemp, uiCostTemp , aaiMvpIdx[iRefList][iRefIdxTemp], affiAMVPInfoTemp[eRefPicList], bAnyClean ); @@ -6971,7 +6971,7 @@ void InterSearch::xPredAffineInterSearch( PredictionUnit& pu, ); #endif -#if GDR_ENABLED +#if GDR_ENABLED if (isEncodeGdrClean) { int mvp_idx = aaiMvpIdx[iRefList][iRefIdxTemp]; @@ -7031,7 +7031,7 @@ void InterSearch::xPredAffineInterSearch( PredictionUnit& pu, } // Set best AMVP Index xCopyAffineAMVPInfo( affiAMVPInfoTemp[eRefPicList], aacAffineAMVPInfo[iRefList][iRefIdxTemp] ); -#if GDR_ENABLED +#if GDR_ENABLED if ( pu.cu->imv != 2 || !m_pcEncCfg->getUseAffineAmvrEncOpt() ) { xCheckBestAffineMVP( pu, affiAMVPInfoTemp[eRefPicList], eRefPicList, cMvTemp[iRefList][iRefIdxTemp], cMvPred[iRefList][iRefIdxTemp], aaiMvpIdx[iRefList][iRefIdxTemp], uiBitsTemp, uiCostTemp ); @@ -7072,7 +7072,7 @@ void InterSearch::xPredAffineInterSearch( PredictionUnit& pu, { uiCostTempL0[iRefIdxTemp] = uiCostTemp; uiBitsTempL0[iRefIdxTemp] = uiBitsTemp; -#if GDR_ENABLED +#if GDR_ENABLED if (isEncodeGdrClean) { uiCostTempL0Ok[iRefIdxTemp] = uiCostTempOk; @@ -7080,7 +7080,7 @@ void InterSearch::xPredAffineInterSearch( PredictionUnit& pu, #endif } DTRACE( g_trace_ctx, D_COMMON, " (%d) uiCostTemp=%d, uiCost[iRefList]=%d\n", DTRACE_GET_COUNTER(g_trace_ctx,D_COMMON), uiCostTemp, uiCost[iRefList] ); -#if GDR_ENABLED +#if GDR_ENABLED allOk = (uiCostTemp < uiCost[iRefList]); if (isEncodeGdrClean) @@ -7094,9 +7094,9 @@ void InterSearch::xPredAffineInterSearch( PredictionUnit& pu, allOk = false; } } -#endif +#endif -#if GDR_ENABLED +#if GDR_ENABLED if (allOk) #else if ( uiCostTemp < uiCost[iRefList] ) @@ -7105,15 +7105,15 @@ void InterSearch::xPredAffineInterSearch( PredictionUnit& pu, uiCost[iRefList] = uiCostTemp; uiBits[iRefList] = uiBitsTemp; // storing for bi-prediction -#if GDR_ENABLED +#if GDR_ENABLED if (isEncodeGdrClean) { uiCostOk[iRefList] = uiCostTempOk; } -#endif +#endif // set best motion ::memcpy( aacMv[iRefList], cMvTemp[iRefList][iRefIdxTemp], sizeof(Mv) * 3 ); -#if GDR_ENABLED +#if GDR_ENABLED if (isEncodeGdrClean) { ::memcpy(aacMvSolid[iRefList], cMvTempSolid[iRefList][iRefIdxTemp], sizeof(bool) * 3); @@ -7124,7 +7124,7 @@ void InterSearch::xPredAffineInterSearch( PredictionUnit& pu, } -#if GDR_ENABLED +#if GDR_ENABLED allOk = (iRefList == 1 && uiCostTemp < costValidList1 && slice.getList1IdxToList0Idx(iRefIdxTemp) < 0); if (isEncodeGdrClean) @@ -7141,7 +7141,7 @@ void InterSearch::xPredAffineInterSearch( PredictionUnit& pu, #endif -#if GDR_ENABLED +#if GDR_ENABLED if (allOk) #else if ( iRefList == 1 && uiCostTemp < costValidList1 && slice.getList1IdxToList0Idx( iRefIdxTemp ) < 0 ) @@ -7153,7 +7153,7 @@ void InterSearch::xPredAffineInterSearch( PredictionUnit& pu, // set motion memcpy( mvValidList1, cMvTemp[iRefList][iRefIdxTemp], sizeof(Mv)*3 ); -#if GDR_ENABLED +#if GDR_ENABLED if (isEncodeGdrClean) { costValidList1Ok = uiCostTempOk; @@ -7169,13 +7169,13 @@ void InterSearch::xPredAffineInterSearch( PredictionUnit& pu, if ( pu.cu->affineType == AFFINEMODEL_4PARAM ) { ::memcpy( mvAffine4Para, cMvTemp, sizeof( cMvTemp ) ); -#if GDR_ENABLED +#if GDR_ENABLED ::memcpy(mvAffine4ParaSolid, cMvTempSolid, sizeof(cMvTempSolid)); #endif if ( pu.cu->imv == 0 && ( !pu.cu->cs->sps->getUseBcw() || bcwIdx == BCW_DEFAULT ) ) { AffineMVInfo *affMVInfo = m_affMVList + m_affMVListIdx; -#if GDR_ENABLED +#if GDR_ENABLED AffineMVInfoSolid *affMVInfoSolid = m_affMVListSolid + m_affMVListIdx; #endif @@ -7189,7 +7189,7 @@ void InterSearch::xPredAffineInterSearch( PredictionUnit& pu, break; } } -#if GDR_ENABLED +#if GDR_ENABLED if (j < m_affMVListSize) { affMVInfo = m_affMVList + ((m_affMVListIdx - j - 1 + m_affMVListMaxSize) % (m_affMVListMaxSize)); @@ -7365,7 +7365,7 @@ void InterSearch::xPredAffineInterSearch( PredictionUnit& pu, int iRefList = iIter % 2; if ( m_pcEncCfg->getFastInterSearchMode()==FASTINTERSEARCH_MODE1 || m_pcEncCfg->getFastInterSearchMode()==FASTINTERSEARCH_MODE2 ) { -#if GDR_ENABLED +#if GDR_ENABLED allOk = (uiCost[0] <= uiCost[1]); if (isEncodeGdrClean) @@ -7381,7 +7381,7 @@ void InterSearch::xPredAffineInterSearch( PredictionUnit& pu, } #endif -#if GDR_ENABLED +#if GDR_ENABLED if (allOk) #else if( uiCost[0] <= uiCost[1] ) @@ -7426,7 +7426,7 @@ void InterSearch::xPredAffineInterSearch( PredictionUnit& pu, pu.mvAffiValid[1 - iRefList][1] = aacMvValid[1 - iRefList][1] = isSubPuYYClean && isSubPuCbClean; pu.mvAffiValid[1 - iRefList][2] = aacMvValid[1 - iRefList][2] = isSubPuYYClean && isSubPuCbClean; } -#endif +#endif PelUnitBuf predBufTmp = m_tmpPredStorage[1 - iRefList].getBuf( UnitAreaRelative(*pu.cu, pu) ); motionCompensation( pu, predBufTmp, RefPicList(1 - iRefList) ); @@ -7470,7 +7470,7 @@ void InterSearch::xPredAffineInterSearch( PredictionUnit& pu, uiBitsTemp += m_auiMVPIdxCost[aaiMvpIdxBi[iRefList][iRefIdxTemp]][AMVP_MAX_NUM_CANDS]; // call Affine ME -#if GDR_ENABLED +#if GDR_ENABLED xAffineMotionEstimation(pu, origBuf, eRefPicList, cMvPredBi[iRefList][iRefIdxTemp], iRefIdxTemp, cMvTemp[iRefList][iRefIdxTemp], cMvTempSolid[iRefList][iRefIdxTemp], uiBitsTemp, uiCostTemp, aaiMvpIdxBi[iRefList][iRefIdxTemp], aacAffineAMVPInfo[iRefList][iRefIdxTemp], bAnyClean, true); @@ -7480,7 +7480,7 @@ void InterSearch::xPredAffineInterSearch( PredictionUnit& pu, true ); #endif -#if GDR_ENABLED +#if GDR_ENABLED if (isEncodeGdrClean) { int mvp_idx = aaiMvpIdx[iRefList][iRefIdxTemp]; @@ -7512,7 +7512,7 @@ void InterSearch::xPredAffineInterSearch( PredictionUnit& pu, #endif xCopyAffineAMVPInfo( aacAffineAMVPInfo[iRefList][iRefIdxTemp], affiAMVPInfoTemp[eRefPicList] ); -#if GDR_ENABLED +#if GDR_ENABLED if ( pu.cu->imv != 2 || !m_pcEncCfg->getUseAffineAmvrEncOpt() ) { xCheckBestAffineMVP( pu, affiAMVPInfoTemp[eRefPicList], eRefPicList, cMvTemp[iRefList][iRefIdxTemp], cMvPredBi[iRefList][iRefIdxTemp], aaiMvpIdxBi[iRefList][iRefIdxTemp], uiBitsTemp, uiCostTemp ); @@ -7551,7 +7551,7 @@ void InterSearch::xPredAffineInterSearch( PredictionUnit& pu, } #endif -#if GDR_ENABLED +#if GDR_ENABLED allOk = (uiCostTemp < uiCostBi); if (isEncodeGdrClean) @@ -7569,7 +7569,7 @@ void InterSearch::xPredAffineInterSearch( PredictionUnit& pu, -#if GDR_ENABLED +#if GDR_ENABLED if (allOk) #else if ( uiCostTemp < uiCostBi ) @@ -7632,7 +7632,7 @@ void InterSearch::xPredAffineInterSearch( PredictionUnit& pu, if ( !bChanged ) { -#if GDR_ENABLED +#if GDR_ENABLED allOk = ((uiCostBi <= uiCost[0] && uiCostBi <= uiCost[1]) || enforceBcwPred); if (isEncodeGdrClean) @@ -7656,7 +7656,7 @@ void InterSearch::xPredAffineInterSearch( PredictionUnit& pu, { xCopyAffineAMVPInfo( aacAffineAMVPInfo[0][iRefIdxBi[0]], affiAMVPInfoTemp[REF_PIC_LIST_0] ); xCheckBestAffineMVP( pu, affiAMVPInfoTemp[REF_PIC_LIST_0], REF_PIC_LIST_0, cMvBi[0], cMvPredBi[0][iRefIdxBi[0]], aaiMvpIdxBi[0][iRefIdxBi[0]], uiBits[2], uiCostBi ); -#if GDR_ENABLED +#if GDR_ENABLED if (isEncodeGdrClean) { int mvp_idx = aaiMvpIdxBi[0][iRefIdxBi[0]]; @@ -7688,7 +7688,7 @@ void InterSearch::xPredAffineInterSearch( PredictionUnit& pu, { xCopyAffineAMVPInfo( aacAffineAMVPInfo[1][iRefIdxBi[1]], affiAMVPInfoTemp[REF_PIC_LIST_1] ); xCheckBestAffineMVP( pu, affiAMVPInfoTemp[REF_PIC_LIST_1], REF_PIC_LIST_1, cMvBi[1], cMvPredBi[1][iRefIdxBi[1]], aaiMvpIdxBi[1][iRefIdxBi[1]], uiBits[2], uiCostBi ); -#if GDR_ENABLED +#if GDR_ENABLED if (isEncodeGdrClean) { int mvp_idx = aaiMvpIdxBi[1][iRefIdxBi[1]]; @@ -7801,7 +7801,7 @@ void InterSearch::xPredAffineInterSearch( PredictionUnit& pu, } #endif -#if GDR_ENABLED +#if GDR_ENABLED if (BiOk) #else if ( uiCostBi <= uiCost[0] && uiCostBi <= uiCost[1] ) // Bi @@ -7864,7 +7864,7 @@ void InterSearch::xPredAffineInterSearch( PredictionUnit& pu, pu.mvpIdx[REF_PIC_LIST_1] = aaiMvpIdxBi[1][iRefIdxBi[1]]; pu.mvpNum[REF_PIC_LIST_1] = aaiMvpNum[1][iRefIdxBi[1]]; -#if GDR_ENABLED +#if GDR_ENABLED if (isEncodeGdrClean) { pu.mvpSolid[REF_PIC_LIST_0] = affiAMVPInfoTemp[0].mvSolidLT[pu.mvpIdx[0]] && affiAMVPInfoTemp[0].mvSolidRT[pu.mvpIdx[0]]; @@ -7878,7 +7878,7 @@ void InterSearch::xPredAffineInterSearch( PredictionUnit& pu, } #endif } -#if GDR_ENABLED +#if GDR_ENABLED else if (L0ok) // List 0 #else else if ( uiCost[0] <= uiCost[1] ) // List 0 @@ -7922,7 +7922,7 @@ void InterSearch::xPredAffineInterSearch( PredictionUnit& pu, pu.mvpIdx[REF_PIC_LIST_0] = aaiMvpIdx[0][iRefIdx[0]]; pu.mvpNum[REF_PIC_LIST_0] = aaiMvpNum[0][iRefIdx[0]]; -#if GDR_ENABLED +#if GDR_ENABLED if (isEncodeGdrClean) { pu.mvpSolid[REF_PIC_LIST_0] = affiAMVPInfoTemp[0].mvSolidLT[pu.mvpIdx[0]] && affiAMVPInfoTemp[0].mvSolidRT[pu.mvpIdx[0]]; @@ -7961,7 +7961,7 @@ void InterSearch::xPredAffineInterSearch( PredictionUnit& pu, pu.mvAffiValid[1][1] = aacMvValid[1][1] = isSubPuYYClean && isSubPuCbClean; pu.mvAffiValid[1][2] = aacMvValid[1][2] = isSubPuYYClean && isSubPuCbClean; } -#endif +#endif for ( int verIdx = 0; verIdx < mvNum; verIdx++ ) { @@ -7974,7 +7974,7 @@ void InterSearch::xPredAffineInterSearch( PredictionUnit& pu, pu.mvpIdx[REF_PIC_LIST_1] = aaiMvpIdx[1][iRefIdx[1]]; pu.mvpNum[REF_PIC_LIST_1] = aaiMvpNum[1][iRefIdx[1]]; -#if GDR_ENABLED +#if GDR_ENABLED if (isEncodeGdrClean) { pu.mvpSolid[REF_PIC_LIST_1] = affiAMVPInfoTemp[1].mvSolidLT[pu.mvpIdx[1]] && affiAMVPInfoTemp[1].mvSolidRT[pu.mvpIdx[1]]; @@ -8103,7 +8103,7 @@ void InterSearch::xCheckBestAffineMVP( PredictionUnit &pu, AffineAMVPInfo &affin int iMvBits = xCalcAffineMVBits( pu, acMv, tmpPredMv ); iMvBits += m_auiMVPIdxCost[iMVPIdx][AMVP_MAX_NUM_CANDS]; -#if GDR_ENABLED +#if GDR_ENABLED bool allOk = (iMvBits < iBestMvBits); if (isEncodeGdrClean) { @@ -8131,7 +8131,7 @@ void InterSearch::xCheckBestAffineMVP( PredictionUnit &pu, AffineAMVPInfo &affin #endif -#if GDR_ENABLED +#if GDR_ENABLED if (allOk) #else if (iMvBits < iBestMvBits) @@ -8528,7 +8528,7 @@ void InterSearch::xAffineMotionEstimation( PredictionUnit& pu, acMvSolid[2] = aamvpi.mvSolidLB[bestMvpIdx]; bool isSubPuYYClean = YYOk; - bool isSubPuCbClean = true; + bool isSubPuCbClean = true; acMvValid[0] = isSubPuYYClean && isSubPuCbClean; acMvValid[1] = isSubPuYYClean && isSubPuCbClean; @@ -8541,7 +8541,7 @@ void InterSearch::xAffineMotionEstimation( PredictionUnit& pu, uiCostTemp = (Distortion)( floor( fWeight * (double)uiCostTemp ) + (double)m_pcRdCost->getCost( uiBitsTemp ) ); // store best cost and mv -#if GDR_ENABLED +#if GDR_ENABLED allOk = (uiCostTemp < uiCostBest); if (isEncodeGdrClean) { @@ -8607,7 +8607,7 @@ void InterSearch::xAffineMotionEstimation( PredictionUnit& pu, bitsTemp += xCalcAffineMVBits( pu, ctrlPtMv, acMvPred ); costTemp = (Distortion)(floor(fWeight * (double)costTemp) + (double)m_pcRdCost->getCost(bitsTemp)); // store best cost and mv -#if GDR_ENABLED +#if GDR_ENABLED bool allOk = (costTemp < uiCostBest); if (isEncodeGdrClean) { @@ -8743,7 +8743,7 @@ void InterSearch::xAffineMotionEstimation( PredictionUnit& pu, bitsTemp += xCalcAffineMVBits(pu, acMvTemp, acMvPred); costTemp = (Distortion)(floor(fWeight * (double)costTemp) + (double)m_pcRdCost->getCost(bitsTemp)); -#if GDR_ENABLED +#if GDR_ENABLED bool allOk = (costTemp < uiCostBest); if (isEncodeGdrClean) { @@ -8839,7 +8839,7 @@ void InterSearch::xEstimateAffineAMVP( PredictionUnit& pu, Distortion uiTmpCost = xGetAffineTemplateCost( pu, origBuf, predBuf, mv, i, AMVP_MAX_NUM_CANDS, eRefPicList, iRefIdx ); #endif -#if GDR_ENABLED +#if GDR_ENABLED bool allOk = uiBestCost > uiTmpCost; if (isEncodeGdrClean) @@ -8855,7 +8855,7 @@ void InterSearch::xEstimateAffineAMVP( PredictionUnit& pu, } #endif -#if GDR_ENABLED +#if GDR_ENABLED if (allOk) #else if ( uiBestCost > uiTmpCost ) @@ -8867,7 +8867,7 @@ void InterSearch::xEstimateAffineAMVP( PredictionUnit& pu, bestMvLB = affineAMVPInfo.mvCandLB[i]; iBestIdx = i; *puiDistBiP = uiTmpCost; -#if GDR_ENABLED +#if GDR_ENABLED if (isEncodeGdrClean) { uiBestCostOk = uiTmpCostOk; @@ -8884,7 +8884,7 @@ void InterSearch::xEstimateAffineAMVP( PredictionUnit& pu, pu.mvpIdx[eRefPicList] = iBestIdx; pu.mvpNum[eRefPicList] = affineAMVPInfo.numCand; -#if GDR_ENABLED +#if GDR_ENABLED pu.mvpSolid[eRefPicList] = uiBestCostOk; #endif DTRACE( g_trace_ctx, D_COMMON, "#estAffi=%d \n", affineAMVPInfo.numCand ); @@ -10992,7 +10992,7 @@ uint32_t InterSearch::xDetermineBestMvp( PredictionUnit& pu, Mv acMvTemp[3], int uint32_t candBits = m_auiMVPIdxCost[i][aamvpi.numCand]; candBits += xCalcAffineMVBits( pu, acMvTemp, mvPred ); -#if GDR_ENABLED +#if GDR_ENABLED bool isSolid = true; if (isEncodeGdrClean) { @@ -11039,7 +11039,7 @@ void InterSearch::symmvdCheckBestMvp( bool skip ) { -#if GDR_ENABLED +#if GDR_ENABLED CodingStructure &cs = *pu.cs; const bool isEncodeGdrClean = cs.sps->getGDREnabledFlag() && cs.pcv->isEncoder && ((cs.picHeader->getInGdrInterval() && cs.isClean(pu.Y().topRight(), CHANNEL_TYPE_LUMA)) || (cs.picHeader->getNumVerVirtualBoundaries() == 0)); bool bestCostOk = true; @@ -11124,7 +11124,7 @@ void InterSearch::symmvdCheckBestMvp( bits += m_auiMVPIdxCost[i][AMVP_MAX_NUM_CANDS]; bits += m_auiMVPIdxCost[j][AMVP_MAX_NUM_CANDS]; cost += m_pcRdCost->getCost(bits); -#if GDR_ENABLED +#if GDR_ENABLED if (isEncodeGdrClean) { bool curSolid = amvpCur.mvSolid[i]; @@ -11134,7 +11134,7 @@ void InterSearch::symmvdCheckBestMvp( #endif -#if GDR_ENABLED +#if GDR_ENABLED allOk = (cost < bestCost); if (isEncodeGdrClean) { @@ -11151,7 +11151,7 @@ void InterSearch::symmvdCheckBestMvp( #if GDR_ENABLED if (allOk) -#else +#else if (cost < bestCost) #endif { diff --git a/source/Lib/EncoderLib/IntraSearch.cpp b/source/Lib/EncoderLib/IntraSearch.cpp index 494057658d60062333c10fab4334c007012b1ff3..75ee1913d246bad0fa43deb9858d2da73fb9ac49 100644 --- a/source/Lib/EncoderLib/IntraSearch.cpp +++ b/source/Lib/EncoderLib/IntraSearch.cpp @@ -373,7 +373,7 @@ int IntraSearch::getNumTopRecons(PredictionUnit &pu, int luma_dirMode, bool isCh int w = isChroma ? pu.Cb().width : pu.Y().width; int h = isChroma ? pu.Cb().height : pu.Y().height; - int numOfTopRecons = w; + int numOfTopRecons = w; static const int angTable[32] = { 0, 1, 2, 3, 4, 6, 8, 10, 12, 14, 16, 18, 20, 23, 26, 29, 32, 35, 39, 45, 51, 57, 64, 73, 86, 102, 128, 171, 256, 341, 512, 1024 }; static const int invAngTable[32] = { @@ -396,14 +396,14 @@ int IntraSearch::getNumTopRecons(PredictionUnit &pu, int luma_dirMode, bool isCh const int sideSize = isModeVer ? h : w; const int maxScale = 2; - const int angularScale = std::min(maxScale, floorLog2(sideSize) - (floorLog2(3 * invAngle - 2) - 8)); + const int angularScale = std::min(maxScale, floorLog2(sideSize) - (floorLog2(3 * invAngle - 2) - 8)); bool applyPDPC; - // 1.0 derive PDPC - applyPDPC = (refIdx == 0) ? true : false; - if (luma_dirMode > DC_IDX && luma_dirMode < NUM_LUMA_MODE) + // 1.0 derive PDPC + applyPDPC = (refIdx == 0) ? true : false; + if (luma_dirMode > DC_IDX && luma_dirMode < NUM_LUMA_MODE) { if (intraPredAngleMode < 0) { @@ -412,11 +412,11 @@ int IntraSearch::getNumTopRecons(PredictionUnit &pu, int luma_dirMode, bool isCh else if (intraPredAngleMode > 0) { applyPDPC &= (angularScale >= 0); - } + } } // 2.0 calculate number of recons - switch (luma_dirMode) + switch (luma_dirMode) { case PLANAR_IDX: numOfTopRecons = applyPDPC ? (w + 1) : (w + 1); @@ -439,24 +439,24 @@ int IntraSearch::getNumTopRecons(PredictionUnit &pu, int luma_dirMode, bool isCh // note: There should be a way to reduce the number of top recons, in case of non PDPC applyPDPC |= isChroma; - if (predModeIntra >= DIA_IDX) + if (predModeIntra >= DIA_IDX) { - if (intraPredAngle < 0) + if (intraPredAngle < 0) { numOfTopRecons = (applyPDPC) ? (w + w) : (w + 1); } - else + else { numOfTopRecons = (applyPDPC) ? (w + w) : (w + w); } } - else + else { - if (intraPredAngle < 0) + if (intraPredAngle < 0) { numOfTopRecons = (applyPDPC) ? (w + w) : (w); } - else + else { numOfTopRecons = (applyPDPC) ? (w + w) : (w); } @@ -469,24 +469,24 @@ int IntraSearch::getNumTopRecons(PredictionUnit &pu, int luma_dirMode, bool isCh bool IntraSearch::isValidIntraPredLuma(PredictionUnit &pu, int luma_dirMode) { - bool isValid = true; + bool isValid = true; PicHeader *ph = pu.cs->picHeader; - if (ph->getInGdrInterval()) + if (ph->getInGdrInterval()) { int x = pu.Y().x; // count num of recons on the top - int virX = ph->getVirtualBoundariesPosX(0); - int numOfTopRecons = getNumTopRecons(pu, luma_dirMode, false); - + int virX = ph->getVirtualBoundariesPosX(0); + int numOfTopRecons = getNumTopRecons(pu, luma_dirMode, false); + // check if recon is out of boundary - if (x < virX && virX < (x + numOfTopRecons)) + if (x < virX && virX < (x + numOfTopRecons)) { isValid = false; - } + } } - + return isValid; } @@ -496,7 +496,7 @@ bool IntraSearch::isValidIntraPredChroma(PredictionUnit &pu, int luma_dirMode, i CodingStructure *cs = pu.cs; PicHeader *ph = cs->picHeader; - if (ph->getInGdrInterval()) + if (ph->getInGdrInterval()) { // note: chroma cordinate int cbX = pu.Cb().x; @@ -511,12 +511,12 @@ bool IntraSearch::isValidIntraPredChroma(PredictionUnit &pu, int luma_dirMode, i // int lumaY = cbY << chromaScaleY; int lumaW = cbW << chromaScaleX; int lumaH = cbH << chromaScaleY; - + int numOfTopRecons = lumaW; int virX = ph->getVirtualBoundariesPosX(0); // count num of recons on the top - switch (chroma_dirMode) + switch (chroma_dirMode) { case LM_CHROMA_IDX : @@ -527,7 +527,7 @@ bool IntraSearch::isValidIntraPredChroma(PredictionUnit &pu, int luma_dirMode, i numOfTopRecons = lumaW; break; - // note: could reduce the actual #of + // note: could reduce the actual #of case MDLM_T_IDX: numOfTopRecons = (lumaW + lumaH); break; @@ -542,12 +542,12 @@ bool IntraSearch::isValidIntraPredChroma(PredictionUnit &pu, int luma_dirMode, i } // check if recon is out of boundary - if (lumaX < virX && virX < (lumaX + numOfTopRecons)) + if (lumaX < virX && virX < (lumaX + numOfTopRecons)) { isValid = false; - } + } } - + return isValid; } #endif @@ -637,7 +637,7 @@ bool IntraSearch::estIntraPredLumaQT(CodingUnit &cu, Partitioner &partitioner, c static_vector<double, FAST_UDI_MAX_RDMODE_NUM> CandHadList; auto &pu = *cu.firstPU; -#if GDR_ENABLED +#if GDR_ENABLED const bool isEncodeGdrClean = cs.sps->getGDREnabledFlag() && cs.pcv->isEncoder && ((cs.picHeader->getInGdrInterval() && cs.isClean(pu.Y().topRight(), CHANNEL_TYPE_LUMA)) || (cs.picHeader->getNumVerVirtualBoundaries() == 0)); #endif bool validReturn = false; @@ -775,9 +775,9 @@ bool IntraSearch::estIntraPredLumaQT(CodingUnit &cu, Partitioner &partitioner, c DTRACE(g_trace_ctx, D_INTRA_COST, "IntraHAD: %u, %llu, %f (%d)\n", minSadHad, fracModeBits, cost, uiMode); #if GDR_ENABLED - if (isEncodeGdrClean) + if (isEncodeGdrClean) { - if (isValidIntraPredLuma(pu, uiMode)) + if (isValidIntraPredLuma(pu, uiMode)) { updateCandList(ModeInfo(false, false, 0, NOT_INTRA_SUBPARTITIONS, uiMode), cost, uiRdModeList, CandCostList, numModesForFullRD); @@ -785,7 +785,7 @@ bool IntraSearch::estIntraPredLumaQT(CodingUnit &cu, Partitioner &partitioner, c CandHadList, numHadCand); } } - else + else { updateCandList(ModeInfo(false, false, 0, NOT_INTRA_SUBPARTITIONS, uiMode), cost, uiRdModeList, CandCostList, numModesForFullRD); @@ -829,7 +829,7 @@ bool IntraSearch::estIntraPredLumaQT(CodingUnit &cu, Partitioner &partitioner, c // Second round of SATD for extended Angular modes #if GDR_ENABLED int nn = numModesForFullRD; - if (isEncodeGdrClean) + if (isEncodeGdrClean) { nn = std::min((int)numModesForFullRD, (int)parentCandList.size()); } @@ -871,9 +871,9 @@ bool IntraSearch::estIntraPredLumaQT(CodingUnit &cu, Partitioner &partitioner, c double cost = (double) minSadHad + (double) fracModeBits * sqrtLambdaForFirstPass; #if GDR_ENABLED - if (isEncodeGdrClean) + if (isEncodeGdrClean) { - if (isValidIntraPredLuma(pu, mode)) + if (isValidIntraPredLuma(pu, mode)) { updateCandList(ModeInfo(false, false, 0, NOT_INTRA_SUBPARTITIONS, mode), cost, uiRdModeList, CandCostList, numModesForFullRD); @@ -881,7 +881,7 @@ bool IntraSearch::estIntraPredLumaQT(CodingUnit &cu, Partitioner &partitioner, c uiHadModeList, CandHadList, numHadCand); } } - else + else { updateCandList(ModeInfo(false, false, 0, NOT_INTRA_SUBPARTITIONS, mode), cost, uiRdModeList, CandCostList, numModesForFullRD); @@ -942,9 +942,9 @@ bool IntraSearch::estIntraPredLumaQT(CodingUnit &cu, Partitioner &partitioner, c double cost = (double) minSadHad + (double) fracModeBits * sqrtLambdaForFirstPass; #if GDR_ENABLED - if (isEncodeGdrClean) + if (isEncodeGdrClean) { - if (isValidIntraPredLuma(pu, mode)) + if (isValidIntraPredLuma(pu, mode)) { updateCandList(ModeInfo(false, false, multiRefIdx, NOT_INTRA_SUBPARTITIONS, mode), cost, uiRdModeList, CandCostList, numModesForFullRD); @@ -952,7 +952,7 @@ bool IntraSearch::estIntraPredLumaQT(CodingUnit &cu, Partitioner &partitioner, c uiHadModeList, CandHadList, numHadCand); } } - else + else { updateCandList(ModeInfo(false, false, multiRefIdx, NOT_INTRA_SUBPARTITIONS, mode), cost, uiRdModeList, CandCostList, numModesForFullRD); @@ -969,7 +969,7 @@ bool IntraSearch::estIntraPredLumaQT(CodingUnit &cu, Partitioner &partitioner, c } } #if GDR_ENABLED - if (!isEncodeGdrClean) + if (!isEncodeGdrClean) { CHECKD(uiRdModeList.size() != numModesForFullRD, "Error: RD mode list size"); } @@ -1047,9 +1047,9 @@ bool IntraSearch::estIntraPredLumaQT(CodingUnit &cu, Partitioner &partitioner, c uiModeFull); #if GDR_ENABLED - if (isEncodeGdrClean) + if (isEncodeGdrClean) { - if (isValidIntraPredLuma(pu, uiMode)) + if (isValidIntraPredLuma(pu, uiMode)) { updateCandList(ModeInfo(true, isTransposed, 0, NOT_INTRA_SUBPARTITIONS, uiMode), cost, uiRdModeList, CandCostList, numModesForFullRD + 1); @@ -1057,7 +1057,7 @@ bool IntraSearch::estIntraPredLumaQT(CodingUnit &cu, Partitioner &partitioner, c 0.8 * double(minSadHad), uiHadModeList, CandHadList, numHadCand); } } - else + else { updateCandList(ModeInfo(true, isTransposed, 0, NOT_INTRA_SUBPARTITIONS, uiMode), cost, uiRdModeList, CandCostList, numModesForFullRD + 1); @@ -1115,7 +1115,7 @@ bool IntraSearch::estIntraPredLumaQT(CodingUnit &cu, Partitioner &partitioner, c #if GDR_ENABLED int nn = numModesForFullRD; - if (isEncodeGdrClean) + if (isEncodeGdrClean) { nn = std::min((int)numModesForFullRD, (int)uiRdModeList.size()); } @@ -1128,7 +1128,7 @@ bool IntraSearch::estIntraPredLumaQT(CodingUnit &cu, Partitioner &partitioner, c mostProbableModeIncluded |= (mostProbableMode == uiRdModeList[i]); } #if GDR_ENABLED - if (!isEncodeGdrClean) + if (!isEncodeGdrClean) { if (!mostProbableModeIncluded) { @@ -1159,7 +1159,7 @@ bool IntraSearch::estIntraPredLumaQT(CodingUnit &cu, Partitioner &partitioner, c mostProbableModeIncluded |= (mostProbableMode == m_ispCandListHor[i]); } #if GDR_ENABLED - if (!isEncodeGdrClean) + if (!isEncodeGdrClean) { if (!mostProbableModeIncluded) { @@ -1217,7 +1217,7 @@ bool IntraSearch::estIntraPredLumaQT(CodingUnit &cu, Partitioner &partitioner, c } #if GDR_ENABLED - if (!isEncodeGdrClean) + if (!isEncodeGdrClean) { CHECK(numModesForFullRD != uiRdModeList.size(), "Inconsistent state!"); } @@ -1290,7 +1290,7 @@ bool IntraSearch::estIntraPredLumaQT(CodingUnit &cu, Partitioner &partitioner, c { // we reserve positions for ISP in the common full RD list #if GDR_ENABLED - if (!isEncodeGdrClean) + if (!isEncodeGdrClean) { const int maxNumRDModesISP = sps.getUseLFNST() ? 16 * NUM_LFNST_NUM_PER_SET : 16; m_curIspLfnstIdx = 0; diff --git a/source/Lib/EncoderLib/VLCWriter.cpp b/source/Lib/EncoderLib/VLCWriter.cpp index a004fa4f199b94c1189ad2fc0bfbd48a90f0998a..b13126437568669f824cafe381e4ecd2e325fa7d 100644 --- a/source/Lib/EncoderLib/VLCWriter.cpp +++ b/source/Lib/EncoderLib/VLCWriter.cpp @@ -1579,7 +1579,7 @@ void HLSWriter::codePictureHeader( PicHeader* picHeader, bool writeRbspTrailingB picHeader->setRecoveryPocCnt( -1 ); } #if GDR_ENC_TRACE - printf("-gdr_pic_flag:%d\n", picHeader->getGdrPicFlag()); + printf("-gdr_pic_flag:%d\n", picHeader->getGdrPicFlag()); printf("-recovery_poc_cnt:%d\n", picHeader->getRecoveryPocCnt()); printf("-InGdrInterval:%d\n", picHeader->getInGdrInterval()); #endif @@ -1678,7 +1678,7 @@ void HLSWriter::codePictureHeader( PicHeader* picHeader, bool writeRbspTrailingB picHeader->setLmcsEnabledFlag(false); picHeader->setLmcsChromaResidualScaleFlag(false); } -#if GDR_ENC_TRACE +#if GDR_ENC_TRACE printf("-pic_lmcs_enabled_flag:%d\n", picHeader->getLmcsEnabledFlag() ? 1 : 0); printf("-pic_chroma_residual_scale_flag:%d\n", picHeader->getLmcsChromaResidualScaleFlag() ? 1 : 0); #endif @@ -1704,7 +1704,7 @@ void HLSWriter::codePictureHeader( PicHeader* picHeader, bool writeRbspTrailingB { WRITE_FLAG( picHeader->getVirtualBoundariesPresentFlag(), "ph_virtual_boundaries_present_flag" ); if( picHeader->getVirtualBoundariesPresentFlag() ) - { + { #if GDR_ENABLED if (sps->getGDREnabledFlag()) {