Commit 26f849fb authored by Xiang Li's avatar Xiang Li Committed by Karsten Suehring
Browse files

Cleanup: Remove chType from coding structure to ease parallelization

parent b0344d15
......@@ -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));
......
......@@ -84,7 +84,6 @@ public:
Slice *slice;
UnitScale unitScale[MAX_NUM_COMPONENT];
ChannelType chType;
int baseQP;
int prevQP[MAX_NUM_CHANNEL_TYPE];
......
......@@ -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
......
......@@ -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)
......
......@@ -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() )
{
......
......@@ -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);
......
......@@ -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() )
{
......
......@@ -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
......
......@@ -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 });
}
......
......@@ -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;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment