diff --git a/source/Lib/CommonLib/CodingStructure.cpp b/source/Lib/CommonLib/CodingStructure.cpp index 2d69c798afb0fa3ecbedd0872f64cf2e6639ac03..10258d64bbf8d4af75c42eb7ae51457412bdd96d 100644 --- a/source/Lib/CommonLib/CodingStructure.cpp +++ b/source/Lib/CommonLib/CodingStructure.cpp @@ -1392,8 +1392,6 @@ const TransformUnit* CodingStructure::getTURestricted( const Position &pos, cons IbcLumaCoverage CodingStructure::getIbcLumaCoverage(const CompArea& chromaArea) const { - CHECK(chType != CHANNEL_TYPE_CHROMA, "Error"); - const unsigned int unitAreaSubBlock = MIN_PU_SIZE * MIN_PU_SIZE; CompArea lumaArea = CompArea(COMPONENT_Y, chromaArea.chromaFormat, chromaArea.lumaPos(), recalcSize(chromaArea.chromaFormat, CHANNEL_TYPE_CHROMA, CHANNEL_TYPE_LUMA, chromaArea.size())); lumaArea = clipArea(lumaArea, picture->block(COMPONENT_Y)); diff --git a/source/Lib/CommonLib/CodingStructure.h b/source/Lib/CommonLib/CodingStructure.h index c4d189245a657f854add516d4db8a1b3f9a092f1..68f2ee0549a334f3bd40a5872e297c16f7b300d8 100644 --- a/source/Lib/CommonLib/CodingStructure.h +++ b/source/Lib/CommonLib/CodingStructure.h @@ -84,7 +84,6 @@ public: Slice *slice; UnitScale unitScale[MAX_NUM_COMPONENT]; - ChannelType chType; int baseQP; int prevQP[MAX_NUM_CHANNEL_TYPE]; diff --git a/source/Lib/CommonLib/IbcHashMap.cpp b/source/Lib/CommonLib/IbcHashMap.cpp index 57940cbf7e2061e448d0dd968a7758fbd224c5a0..7107169a25d8a84b2abfe88173f43e84338cc67d 100644 --- a/source/Lib/CommonLib/IbcHashMap.cpp +++ b/source/Lib/CommonLib/IbcHashMap.cpp @@ -310,7 +310,7 @@ bool IbcHashMap::ibcHashMatch(const Area& lumaArea, std::vector<Position>& cand, if (lumaArea.width > MIN_PU_SIZE || lumaArea.height > MIN_PU_SIZE) { #if JVET_N0329_IBC_SEARCH_IMP - if (!cs.isDecomp(bottomRight, cs.chType) || bottomRight.x >= m_picWidth || bottomRight.y >= m_picHeight || topLeft.x < 0 || topLeft.y < 0) + if (!cs.isDecomp(bottomRight, CHANNEL_TYPE_LUMA) || bottomRight.x >= m_picWidth || bottomRight.y >= m_picHeight || topLeft.x < 0 || topLeft.y < 0) #else if (!cs.isDecomp(bottomRight, cs.chType) || bottomRight.x >= m_picWidth || bottomRight.y >= m_picHeight) #endif @@ -334,7 +334,7 @@ bool IbcHashMap::ibcHashMatch(const Area& lumaArea, std::vector<Position>& cand, { #if JVET_N0329_IBC_SEARCH_IMP CHECK(topLeft != *refBlockPos, "4x4 target block should not have offset!"); - if (abs(topLeft.x - lumaArea.x) > searchRange4SmallBlk || abs(topLeft.y - lumaArea.y) > searchRange4SmallBlk || !cs.isDecomp(bottomRight, cs.chType)) + if (abs(topLeft.x - lumaArea.x) > searchRange4SmallBlk || abs(topLeft.y - lumaArea.y) > searchRange4SmallBlk || !cs.isDecomp(bottomRight, CHANNEL_TYPE_LUMA)) #else if (abs(refBlockPos->x - lumaArea.x) > searchRange4SmallBlk || abs(refBlockPos->y - lumaArea.y) > searchRange4SmallBlk || !cs.isDecomp(bottomRight, cs.chType)) #endif diff --git a/source/Lib/CommonLib/UnitTools.cpp b/source/Lib/CommonLib/UnitTools.cpp index 93e3a8322954ded9471c17130d64be2361ba6026..c9c75ad2c4d32174c07f1f122305b52af5edb928 100644 --- a/source/Lib/CommonLib/UnitTools.cpp +++ b/source/Lib/CommonLib/UnitTools.cpp @@ -2327,7 +2327,7 @@ void PU::getIbcMVPsEncOnly(PredictionUnit &pu, Mv* MvPred, int& nbPred) Position posLT = pu.Y().topLeft(); // above-left - const PredictionUnit *aboveLeftPU = pu.cs->getPURestricted(posLT.offset(-1, -1), pu, pu.cs->chType); + const PredictionUnit *aboveLeftPU = pu.cs->getPURestricted(posLT.offset(-1, -1), pu, CHANNEL_TYPE_LUMA); if (aboveLeftPU && CU::isIBC(*aboveLeftPU->cu)) { if (isAddNeighborMv(aboveLeftPU->bv, mvPred, nbPred)) @@ -2339,7 +2339,7 @@ void PU::getIbcMVPsEncOnly(PredictionUnit &pu, Mv* MvPred, int& nbPred) // above neighbors for (uint32_t dx = 0; dx < totalAboveUnits && nbPred < IBC_NUM_CANDIDATES; dx++) { - const PredictionUnit* tmpPU = pu.cs->getPURestricted(posLT.offset((dx << log2UnitWidth), -1), pu, pu.cs->chType); + const PredictionUnit* tmpPU = pu.cs->getPURestricted(posLT.offset((dx << log2UnitWidth), -1), pu, CHANNEL_TYPE_LUMA); if (tmpPU && CU::isIBC(*tmpPU->cu)) { if (isAddNeighborMv(tmpPU->bv, mvPred, nbPred)) @@ -2352,7 +2352,7 @@ void PU::getIbcMVPsEncOnly(PredictionUnit &pu, Mv* MvPred, int& nbPred) // left neighbors for (uint32_t dy = 0; dy < totalLeftUnits && nbPred < IBC_NUM_CANDIDATES; dy++) { - const PredictionUnit* tmpPU = pu.cs->getPURestricted(posLT.offset(-1, (dy << log2UnitHeight)), pu, pu.cs->chType); + const PredictionUnit* tmpPU = pu.cs->getPURestricted(posLT.offset(-1, (dy << log2UnitHeight)), pu, CHANNEL_TYPE_LUMA); if (tmpPU && CU::isIBC(*tmpPU->cu)) { if (isAddNeighborMv(tmpPU->bv, mvPred, nbPred)) @@ -2408,7 +2408,7 @@ void PU::getIbcMVPsEncOnly(PredictionUnit &pu, Mv* MvPred, int& nbPred) //left const PredictionUnit *neibLeftPU = NULL; - neibLeftPU = pu.cs->getPURestricted(posLB.offset(-1, 0), pu, pu.cs->chType); + neibLeftPU = pu.cs->getPURestricted(posLB.offset(-1, 0), pu, CHANNEL_TYPE_LUMA); left = (neibLeftPU) ? CU::isIBC(*neibLeftPU->cu) : 0; if (left) @@ -2420,7 +2420,7 @@ void PU::getIbcMVPsEncOnly(PredictionUnit &pu, Mv* MvPred, int& nbPred) //above const PredictionUnit *neibAbovePU = NULL; - neibAbovePU = pu.cs->getPURestricted(posRT.offset(0, -1), pu, pu.cs->chType); + neibAbovePU = pu.cs->getPURestricted(posRT.offset(0, -1), pu, CHANNEL_TYPE_LUMA); above = (neibAbovePU) ? CU::isIBC(*neibAbovePU->cu) : 0; if (above) @@ -2432,7 +2432,7 @@ void PU::getIbcMVPsEncOnly(PredictionUnit &pu, Mv* MvPred, int& nbPred) // Below Left predictor search const PredictionUnit *neibBelowLeftPU = NULL; - neibBelowLeftPU = pu.cs->getPURestricted(posLB.offset(-1, 1), pu, pu.cs->chType); + neibBelowLeftPU = pu.cs->getPURestricted(posLB.offset(-1, 1), pu, CHANNEL_TYPE_LUMA); unsigned int belowLeft = (neibBelowLeftPU) ? CU::isIBC(*neibBelowLeftPU->cu) : 0; if (belowLeft) @@ -2445,7 +2445,7 @@ void PU::getIbcMVPsEncOnly(PredictionUnit &pu, Mv* MvPred, int& nbPred) // Above Right predictor search const PredictionUnit *neibAboveRightPU = NULL; - neibAboveRightPU = pu.cs->getPURestricted(posRT.offset(1, -1), pu, pu.cs->chType); + neibAboveRightPU = pu.cs->getPURestricted(posRT.offset(1, -1), pu, CHANNEL_TYPE_LUMA); unsigned int aboveRight = (neibAboveRightPU) ? CU::isIBC(*neibAboveRightPU->cu) : 0; if (aboveRight) @@ -2458,7 +2458,7 @@ void PU::getIbcMVPsEncOnly(PredictionUnit &pu, Mv* MvPred, int& nbPred) // Above Left predictor search const PredictionUnit *neibAboveLeftPU = NULL; - neibAboveLeftPU = pu.cs->getPURestricted(posLT.offset(-1, -1), pu, pu.cs->chType); + neibAboveLeftPU = pu.cs->getPURestricted(posLT.offset(-1, -1), pu, CHANNEL_TYPE_LUMA); unsigned int aboveLeft = (neibAboveLeftPU) ? CU::isIBC(*neibAboveLeftPU->cu) : 0; if (aboveLeft) @@ -2486,7 +2486,7 @@ bool PU::getDerivedBV(PredictionUnit &pu, const Mv& currentMv, Mv& derivedMv) } const PredictionUnit *neibRefPU = NULL; - neibRefPU = pu.cs->getPURestricted(pu.lumaPos().offset(offsetX, offsetY), pu, pu.cs->chType); + neibRefPU = pu.cs->getPURestricted(pu.lumaPos().offset(offsetX, offsetY), pu, CHANNEL_TYPE_LUMA); bool isIBC = (neibRefPU) ? CU::isIBC(*neibRefPU->cu) : 0; if (isIBC) diff --git a/source/Lib/DecoderLib/CABACReader.cpp b/source/Lib/DecoderLib/CABACReader.cpp index ea96c5384228ae208bd9a3102f83777db08579a4..535decc8ea6bca74899a495ba63c548d4d508c0f 100644 --- a/source/Lib/DecoderLib/CABACReader.cpp +++ b/source/Lib/DecoderLib/CABACReader.cpp @@ -651,7 +651,6 @@ PartSplit CABACReader::split_cu_mode( CodingStructure& cs, Partitioner &partitio bool CABACReader::coding_unit( CodingUnit &cu, Partitioner &partitioner, CUCtx& cuCtx ) { CodingStructure& cs = *cu.cs; - cs.chType = partitioner.chType; // transquant bypass flag if( cs.pps->getTransquantBypassEnabledFlag() ) { diff --git a/source/Lib/DecoderLib/DecCu.cpp b/source/Lib/DecoderLib/DecCu.cpp index 9165a9be148be034d34fa4b21de9f8b6307d8618..21bafe3a0afdc429aed3b9ca9517f764b37cdde5 100644 --- a/source/Lib/DecoderLib/DecCu.cpp +++ b/source/Lib/DecoderLib/DecCu.cpp @@ -134,7 +134,6 @@ void DecCu::decompressCtu( CodingStructure& cs, const UnitArea& ctuArea ) } prevTmpPos = currCU.shareParentPos; } - cs.chType = chType; if (currCU.predMode != MODE_INTRA && currCU.Y().valid()) { xDeriveCUMV(currCU); diff --git a/source/Lib/EncoderLib/CABACWriter.cpp b/source/Lib/EncoderLib/CABACWriter.cpp index ccc3b84072db95778488cdad6d92343cf1a93de8..34171b4bd0a872bf95660850781a2f193c13e662 100644 --- a/source/Lib/EncoderLib/CABACWriter.cpp +++ b/source/Lib/EncoderLib/CABACWriter.cpp @@ -557,7 +557,6 @@ void CABACWriter::split_cu_mode( const PartSplit split, const CodingStructure& c void CABACWriter::coding_unit( const CodingUnit& cu, Partitioner& partitioner, CUCtx& cuCtx ) { CodingStructure& cs = *cu.cs; - cs.chType = partitioner.chType; // transquant bypass flag if( cs.pps->getTransquantBypassEnabledFlag() ) { diff --git a/source/Lib/EncoderLib/EncCu.cpp b/source/Lib/EncoderLib/EncCu.cpp index 489d32f2e7147b37fe638147cf90e63b7fbc3ff5..b435470fe579042f456f98446f7516225dc557ba 100644 --- a/source/Lib/EncoderLib/EncCu.cpp +++ b/source/Lib/EncoderLib/EncCu.cpp @@ -576,8 +576,6 @@ void EncCu::xCompressCU( CodingStructure *&tempCS, CodingStructure *&bestCS, Par const UnitArea currCsArea = clipArea( CS::getArea( *bestCS, bestCS->area, partitioner.chType ), *tempCS->picture ); - tempCS->chType = partitioner.chType; - bestCS->chType = partitioner.chType; m_modeCtrl->initCULevel( partitioner, *tempCS ); if( partitioner.currQtDepth == 0 && partitioner.currMtDepth == 0 && !tempCS->slice->isIntra() && ( sps.getUseSBT() || sps.getUseInterMTS() ) ) { @@ -759,7 +757,7 @@ void EncCu::xCompressCU( CodingStructure *&tempCS, CodingStructure *&bestCS, Par // QP from last processed CU for further processing bestCS->prevQP[partitioner.chType] = bestCS->cus.back()->qp; if ((!slice.isIntra() || slice.getSPS()->getIBCFlag()) - && bestCS->chType == CHANNEL_TYPE_LUMA + && partitioner.chType == CHANNEL_TYPE_LUMA && bestCS->cus.size() == 1 && (bestCS->cus.back()->predMode == MODE_INTER || bestCS->cus.back()->predMode == MODE_IBC) && bestCS->area.Y() == (*bestCS->cus.back()).Y() ) @@ -2881,7 +2879,7 @@ void EncCu::xCheckRDCostAffineMerge2Nx2N( CodingStructure *&tempCS, CodingStruct // ibc merge/skip mode check void EncCu::xCheckRDCostIBCModeMerge2Nx2N(CodingStructure *&tempCS, CodingStructure *&bestCS, Partitioner &partitioner, const EncTestMode& encTestMode) { - assert(tempCS->chType != CHANNEL_TYPE_CHROMA); // chroma IBC is derived + assert(partitioner.chType != CHANNEL_TYPE_CHROMA); // chroma IBC is derived #if JVET_N0318_N0467_IBC_SIZE if (tempCS->area.lwidth() == 128 && tempCS->area.lheight() == 128) // disable 128x128 IBC mode diff --git a/source/Lib/EncoderLib/EncModeCtrl.cpp b/source/Lib/EncoderLib/EncModeCtrl.cpp index 8a2049f29024aef241cc9f1bb06edc243ca339e5..505cd72b143debec2f63f873f59a879bfb7dd15b 100644 --- a/source/Lib/EncoderLib/EncModeCtrl.cpp +++ b/source/Lib/EncoderLib/EncModeCtrl.cpp @@ -1212,7 +1212,7 @@ void EncModeCtrlMTnoRQT::initCULevel( Partitioner &partitioner, const CodingStru xGetMinMaxQP( minQP, maxQP, cs, partitioner, baseQP, *cs.sps, *cs.pps, CU_QUAD_SPLIT ); bool checkIbc = true; - if (cs.chType == CHANNEL_TYPE_CHROMA) + if (partitioner.chType == CHANNEL_TYPE_CHROMA) { IbcLumaCoverage ibcLumaCoverage = cs.getIbcLumaCoverage(cs.area.Cb()); switch (ibcLumaCoverage) @@ -1343,7 +1343,7 @@ void EncModeCtrlMTnoRQT::initCULevel( Partitioner &partitioner, const CodingStru if (cs.sps->getIBCFlag() && checkIbc) { m_ComprCUCtxList.back().testModes.push_back({ ETM_IBC, ETO_STANDARD, qp, lossless }); - if (cs.chType == CHANNEL_TYPE_LUMA) + if (partitioner.chType == CHANNEL_TYPE_LUMA) { m_ComprCUCtxList.back().testModes.push_back({ ETM_IBC_MERGE, ETO_STANDARD, qp, lossless }); } diff --git a/source/Lib/EncoderLib/InterSearch.cpp b/source/Lib/EncoderLib/InterSearch.cpp index 1612f86a11b3f63345df68ca30c45e20ba3eefd5..9bc95e7943aba5e89c85bdb65110a21895a34682 100644 --- a/source/Lib/EncoderLib/InterSearch.cpp +++ b/source/Lib/EncoderLib/InterSearch.cpp @@ -1687,7 +1687,7 @@ void InterSearch::xxIBCHashSearch(PredictionUnit& pu, Mv* mvPred, int numMvPred, for (std::vector<Position>::iterator pos = candPos.begin(); pos != candPos.end(); pos++) { Position bottomRight = pos->offset(pu.Y().width - 1, pu.Y().height - 1); - if (pu.cs->isDecomp(*pos, pu.cs->chType) && pu.cs->isDecomp(bottomRight, pu.cs->chType)) + if (pu.cs->isDecomp(*pos, CHANNEL_TYPE_LUMA) && pu.cs->isDecomp(bottomRight, CHANNEL_TYPE_LUMA)) { Position tmp = *pos - pu.Y().pos(); Mv candMv;