diff --git a/source/Lib/CommonLib/InterPrediction.cpp b/source/Lib/CommonLib/InterPrediction.cpp index cab1812578971b9223faabaecb2846583bad9220..e1b8ee9ff57f6ac96202d5241d60802284b62d56 100644 --- a/source/Lib/CommonLib/InterPrediction.cpp +++ b/source/Lib/CommonLib/InterPrediction.cpp @@ -1531,37 +1531,33 @@ int InterPrediction::rightShiftMSB(int numer, int denom) void InterPrediction::motionCompensationGeo( CodingUnit &cu, MergeCtx &geoMrgCtx ) { const uint8_t splitDir = cu.firstPU->geoSplitDir; - const uint8_t candIdx0 = cu.firstPU->geoMergeIdx0; - const uint8_t candIdx1 = cu.firstPU->geoMergeIdx1; + for( auto &pu : CU::traversePUs( cu ) ) { - const UnitArea localUnitArea( cu.cs->area.chromaFormat, Area( 0, 0, pu.lwidth(), pu.lheight() ) ); - PelUnitBuf tmpGeoBuf0 = m_geoPartBuf[0].getBuf( localUnitArea ); - PelUnitBuf tmpGeoBuf1 = m_geoPartBuf[1].getBuf( localUnitArea ); - PelUnitBuf predBuf = cu.cs->getPredBuf( pu ); + const UnitArea localUnitArea(cu.cs->area.chromaFormat, Area(0, 0, pu.lwidth(), pu.lheight())); - geoMrgCtx.setMergeInfo( pu, candIdx0 ); - PU::spanMotionInfo( pu ); - // TODO: check 4:0:0 interaction with weighted prediction. - motionCompensation(pu, tmpGeoBuf0, REF_PIC_LIST_X, true, isChromaEnabled(pu.chromaFormat), nullptr, false); - if( g_mctsDecCheckEnabled && !MCTSHelper::checkMvBufferForMCTSConstraint( pu, true ) ) - { - printf( "DECODER_GEO_PU: pu motion vector across tile boundaries (%d,%d,%d,%d)\n", pu.lx(), pu.ly(), pu.lwidth(), pu.lheight() ); - } + PelUnitBuf predBuf = cu.cs->getPredBuf(pu); + PelUnitBuf tmpGeoBuf[2]; - geoMrgCtx.setMergeInfo( pu, candIdx1 ); - PU::spanMotionInfo( pu ); - // TODO: check 4:0:0 interaction with weighted prediction. - motionCompensation(pu, tmpGeoBuf1, REF_PIC_LIST_X, true, isChromaEnabled(pu.chromaFormat), nullptr, false); - if( g_mctsDecCheckEnabled && !MCTSHelper::checkMvBufferForMCTSConstraint( pu, true ) ) + for (int i = 0; i < 2; i++) { - printf( "DECODER_GEO_PU: pu motion vector across tile boundaries (%d,%d,%d,%d)\n", pu.lx(), pu.ly(), pu.lwidth(), pu.lheight() ); + tmpGeoBuf[i] = m_geoPartBuf[i].getBuf(localUnitArea); + + geoMrgCtx.setMergeInfo(pu, cu.firstPU->geoMergeIdx[i]); + PU::spanMotionInfo(pu); + // TODO: check 4:0:0 interaction with weighted prediction. + motionCompensation(pu, tmpGeoBuf[i], REF_PIC_LIST_X, true, isChromaEnabled(pu.chromaFormat), nullptr, false); + if (g_mctsDecCheckEnabled && !MCTSHelper::checkMvBufferForMCTSConstraint(pu, true)) + { + printf("DECODER_GEO_PU: pu motion vector across tile boundaries (%d,%d,%d,%d)\n", pu.lx(), pu.ly(), pu.lwidth(), + pu.lheight()); + } } - weightedGeoBlk(pu, splitDir, ChannelType::LUMA, predBuf, tmpGeoBuf0, tmpGeoBuf1); + weightedGeoBlk(pu, splitDir, ChannelType::LUMA, predBuf, tmpGeoBuf[0], tmpGeoBuf[1]); if (isChromaEnabled(pu.chromaFormat)) { - weightedGeoBlk(pu, splitDir, ChannelType::CHROMA, predBuf, tmpGeoBuf0, tmpGeoBuf1); + weightedGeoBlk(pu, splitDir, ChannelType::CHROMA, predBuf, tmpGeoBuf[0], tmpGeoBuf[1]); } } } diff --git a/source/Lib/CommonLib/Unit.cpp b/source/Lib/CommonLib/Unit.cpp index 3eb0586fe3c7a134311eb0288731b55eab62c582..45c4317c45a1cb581027309ddd5e14a1257b21b0 100644 --- a/source/Lib/CommonLib/Unit.cpp +++ b/source/Lib/CommonLib/Unit.cpp @@ -569,8 +569,7 @@ void PredictionUnit::initData() regularMergeFlag = false; mergeIdx = MAX_UCHAR; geoSplitDir = MAX_UCHAR; - geoMergeIdx0 = MAX_UCHAR; - geoMergeIdx1 = MAX_UCHAR; + geoMergeIdx.fill(MAX_UCHAR); mmvdMergeFlag = false; mmvdMergeIdx.val = MmvdIdx::INVALID; interDir = MAX_UCHAR; @@ -621,8 +620,7 @@ PredictionUnit& PredictionUnit::operator=(const InterPredictionData& predData) regularMergeFlag = predData.regularMergeFlag; mergeIdx = predData.mergeIdx; geoSplitDir = predData.geoSplitDir; - geoMergeIdx0 = predData.geoMergeIdx0; - geoMergeIdx1 = predData.geoMergeIdx1; + geoMergeIdx = predData.geoMergeIdx; mmvdMergeFlag = predData.mmvdMergeFlag; mmvdMergeIdx = predData.mmvdMergeIdx; interDir = predData.interDir; @@ -664,8 +662,7 @@ PredictionUnit& PredictionUnit::operator=( const PredictionUnit& other ) regularMergeFlag = other.regularMergeFlag; mergeIdx = other.mergeIdx; geoSplitDir = other.geoSplitDir; - geoMergeIdx0 = other.geoMergeIdx0; - geoMergeIdx1 = other.geoMergeIdx1; + geoMergeIdx = other.geoMergeIdx; mmvdMergeFlag = other.mmvdMergeFlag; mmvdMergeIdx = other.mmvdMergeIdx; interDir = other.interDir; diff --git a/source/Lib/CommonLib/Unit.h b/source/Lib/CommonLib/Unit.h index 605cfab09ec778502d4fd4018f968b45ef436bf8..ad69725f9154307b59600dd03ef15efc06721aa9 100644 --- a/source/Lib/CommonLib/Unit.h +++ b/source/Lib/CommonLib/Unit.h @@ -377,6 +377,8 @@ struct CodingUnit : public UnitArea // prediction unit // --------------------------------------------------------------------------- +using MergeIdxPair = std::array<uint8_t, 2>; + struct IntraPredictionData { EnumArray<uint32_t, ChannelType> intraDir; @@ -390,8 +392,9 @@ struct InterPredictionData bool regularMergeFlag; uint8_t mergeIdx; uint8_t geoSplitDir; - uint8_t geoMergeIdx0; - uint8_t geoMergeIdx1; + + MergeIdxPair geoMergeIdx; + bool mmvdMergeFlag; MmvdIdx mmvdMergeIdx; uint8_t interDir; diff --git a/source/Lib/CommonLib/UnitTools.cpp b/source/Lib/CommonLib/UnitTools.cpp index 43ae7e2f702818766c1815710cce6cf6c6515119..21b3850eb2c0a8aff3fff434d84a6c4406a96b15 100644 --- a/source/Lib/CommonLib/UnitTools.cpp +++ b/source/Lib/CommonLib/UnitTools.cpp @@ -4311,17 +4311,19 @@ void PU::getGeoMergeCandidates( const PredictionUnit &pu, MergeCtx& geoMrgCtx ) } void PU::spanGeoMotionInfo(PredictionUnit &pu, const MergeCtx &geoMrgCtx, const uint8_t splitDir, - const uint8_t candIdx0, const uint8_t candIdx1) + const MergeIdxPair &candIdx) { pu.geoSplitDir = splitDir; - pu.geoMergeIdx0 = candIdx0; - pu.geoMergeIdx1 = candIdx1; + pu.geoMergeIdx = candIdx; MotionBuf mb = pu.getMotionBuf(); MotionInfo biMv; biMv.isInter = true; biMv.sliceIdx = pu.cs->slice->getIndependentSliceIdx(); + const uint8_t &candIdx0 = candIdx[0]; + const uint8_t &candIdx1 = candIdx[1]; + if( geoMrgCtx.interDirNeighbours[candIdx0] == 1 && geoMrgCtx.interDirNeighbours[candIdx1] == 2 ) { biMv.interDir = 3; diff --git a/source/Lib/CommonLib/UnitTools.h b/source/Lib/CommonLib/UnitTools.h index bf06417b81dfb02de83ef48d76e1e081c9853bc7..73137e29aa905feb2f1562e7535550aa0135e3e1 100644 --- a/source/Lib/CommonLib/UnitTools.h +++ b/source/Lib/CommonLib/UnitTools.h @@ -195,8 +195,8 @@ namespace PU bool isLMCMode ( unsigned mode); bool isLMCModeEnabled(const PredictionUnit &pu, unsigned mode); void getGeoMergeCandidates (const PredictionUnit &pu, MergeCtx &GeoMrgCtx); - void spanGeoMotionInfo(PredictionUnit &pu, const MergeCtx &GeoMrgCtx, const uint8_t splitDir, const uint8_t candIdx0, - const uint8_t candIdx1); + void spanGeoMotionInfo(PredictionUnit &pu, const MergeCtx &GeoMrgCtx, const uint8_t splitDir, + const MergeIdxPair &candIdx); bool addNeighborMv (const Mv& currMv, static_vector<Mv, IBC_NUM_CANDIDATES>& neighborMvs); void getIbcMVPsEncOnly(PredictionUnit &pu, static_vector<Mv, IBC_NUM_CANDIDATES>& mvPred); bool getDerivedBV(PredictionUnit &pu, const Mv& currentMv, Mv& derivedMv); diff --git a/source/Lib/CommonLib/dtrace_blockstatistics.cpp b/source/Lib/CommonLib/dtrace_blockstatistics.cpp index 056cf77fdea6f464bb6915b33651e6331d0586f3..74fc19bf1cac8507f5afc8af90a25f79df09585d 100644 --- a/source/Lib/CommonLib/dtrace_blockstatistics.cpp +++ b/source/Lib/CommonLib/dtrace_blockstatistics.cpp @@ -818,8 +818,8 @@ void writeAllData(const CodingStructure& cs, const UnitArea& ctuArea) if (cu.geoFlag) { - const uint8_t candIdx0 = cu.firstPU->geoMergeIdx0; - const uint8_t candIdx1 = cu.firstPU->geoMergeIdx1; + const uint8_t candIdx0 = cu.firstPU->geoMergeIdx[0]; + const uint8_t candIdx1 = cu.firstPU->geoMergeIdx[1]; std::vector<Position> geoPartitions[2]; Position linePositions[2]; retrieveGeoPolygons(cu, geoPartitions, linePositions); diff --git a/source/Lib/DecoderLib/CABACReader.cpp b/source/Lib/DecoderLib/CABACReader.cpp index ef43ee704ad40abd530b868b4c087018c81b20db..f4425900ca2f7e8043af08fef78fcd3e45353932 100644 --- a/source/Lib/DecoderLib/CABACReader.cpp +++ b/source/Lib/DecoderLib/CABACReader.cpp @@ -2399,8 +2399,8 @@ void CABACReader::merge_idx( PredictionUnit& pu ) CHECK(pu.cu->lheight() > 64 || pu.cu->lwidth() > 64, "Incorrect block size of geo flag"); int numCandminus2 = maxNumGeoCand - 2; pu.mergeIdx = 0; - int mergeCand0 = 0; - int mergeCand1 = 0; + uint8_t mergeCand0 = 0; + uint8_t mergeCand1 = 0; if (m_binDecoder.decodeBin(Ctx::MergeIdx())) { mergeCand0 += unary_max_eqprob(numCandminus2) + 1; @@ -2413,8 +2413,7 @@ void CABACReader::merge_idx( PredictionUnit& pu ) } } mergeCand1 += mergeCand1 >= mergeCand0 ? 1 : 0; - pu.geoMergeIdx0 = mergeCand0; - pu.geoMergeIdx1 = mergeCand1; + pu.geoMergeIdx = { mergeCand0, mergeCand1 }; DTRACE(g_trace_ctx, D_SYNTAX, "merge_idx() geo_split_dir=%d\n", splitDir); DTRACE(g_trace_ctx, D_SYNTAX, "merge_idx() geo_idx0=%d\n", mergeCand0); DTRACE(g_trace_ctx, D_SYNTAX, "merge_idx() geo_idx1=%d\n", mergeCand1); diff --git a/source/Lib/DecoderLib/DecCu.cpp b/source/Lib/DecoderLib/DecCu.cpp index 19df1892aab2f837e6b6ec0f55e50f21447d4541..a2bc1168cbe5cdecf8a122a4362643830c032ff2 100644 --- a/source/Lib/DecoderLib/DecCu.cpp +++ b/source/Lib/DecoderLib/DecCu.cpp @@ -616,7 +616,7 @@ void DecCu::xReconInter(CodingUnit &cu) if( cu.geoFlag ) { m_pcInterPred->motionCompensationGeo( cu, m_geoMrgCtx ); - PU::spanGeoMotionInfo( *cu.firstPU, m_geoMrgCtx, cu.firstPU->geoSplitDir, cu.firstPU->geoMergeIdx0, cu.firstPU->geoMergeIdx1 ); + PU::spanGeoMotionInfo(*cu.firstPU, m_geoMrgCtx, cu.firstPU->geoSplitDir, cu.firstPU->geoMergeIdx); } else { diff --git a/source/Lib/EncoderLib/CABACWriter.cpp b/source/Lib/EncoderLib/CABACWriter.cpp index acef1f15e0054cf4296c6f8d155bd66f5f541a89..9d94a48b0184078a0f6d55d5d39d59f1add2aee1 100644 --- a/source/Lib/EncoderLib/CABACWriter.cpp +++ b/source/Lib/EncoderLib/CABACWriter.cpp @@ -2046,8 +2046,8 @@ void CABACWriter::merge_idx( const PredictionUnit& pu ) if( pu.cu->geoFlag ) { uint8_t splitDir = pu.geoSplitDir; - uint8_t candIdx0 = pu.geoMergeIdx0; - uint8_t candIdx1 = pu.geoMergeIdx1; + uint8_t candIdx0 = pu.geoMergeIdx[0]; + uint8_t candIdx1 = pu.geoMergeIdx[1]; DTRACE( g_trace_ctx, D_SYNTAX, "merge_idx() geo_split_dir=%d\n", splitDir ); DTRACE( g_trace_ctx, D_SYNTAX, "merge_idx() geo_idx0=%d\n", candIdx0 ); DTRACE( g_trace_ctx, D_SYNTAX, "merge_idx() geo_idx1=%d\n", candIdx1 ); diff --git a/source/Lib/EncoderLib/EncCu.cpp b/source/Lib/EncoderLib/EncCu.cpp index a113a1cf54b1db5cb04cf2c3e1f556d98caa531e..3f76079f17d8164504920e4f3f6dcc14195d18ed 100644 --- a/source/Lib/EncoderLib/EncCu.cpp +++ b/source/Lib/EncoderLib/EncCu.cpp @@ -60,13 +60,13 @@ using namespace std; // ==================================================================================================================== -const GeoMotionInfo EncCu::m_geoModeTest[GEO_MAX_NUM_CANDS] = { - GeoMotionInfo(0, 1), GeoMotionInfo(1, 0), GeoMotionInfo(0, 2), GeoMotionInfo(1, 2), GeoMotionInfo(2, 0), - GeoMotionInfo(2, 1), GeoMotionInfo(0, 3), GeoMotionInfo(1, 3), GeoMotionInfo(2, 3), GeoMotionInfo(3, 0), - GeoMotionInfo(3, 1), GeoMotionInfo(3, 2), GeoMotionInfo(0, 4), GeoMotionInfo(1, 4), GeoMotionInfo(2, 4), - GeoMotionInfo(3, 4), GeoMotionInfo(4, 0), GeoMotionInfo(4, 1), GeoMotionInfo(4, 2), GeoMotionInfo(4, 3), - GeoMotionInfo(0, 5), GeoMotionInfo(1, 5), GeoMotionInfo(2, 5), GeoMotionInfo(3, 5), GeoMotionInfo(4, 5), - GeoMotionInfo(5, 0), GeoMotionInfo(5, 1), GeoMotionInfo(5, 2), GeoMotionInfo(5, 3), GeoMotionInfo(5, 4) +const MergeIdxPair EncCu::m_geoModeTest[GEO_MAX_NUM_CANDS] = { + MergeIdxPair{ 0, 1 }, MergeIdxPair{ 1, 0 }, MergeIdxPair{ 0, 2 }, MergeIdxPair{ 1, 2 }, MergeIdxPair{ 2, 0 }, + MergeIdxPair{ 2, 1 }, MergeIdxPair{ 0, 3 }, MergeIdxPair{ 1, 3 }, MergeIdxPair{ 2, 3 }, MergeIdxPair{ 3, 0 }, + MergeIdxPair{ 3, 1 }, MergeIdxPair{ 3, 2 }, MergeIdxPair{ 0, 4 }, MergeIdxPair{ 1, 4 }, MergeIdxPair{ 2, 4 }, + MergeIdxPair{ 3, 4 }, MergeIdxPair{ 4, 0 }, MergeIdxPair{ 4, 1 }, MergeIdxPair{ 4, 2 }, MergeIdxPair{ 4, 3 }, + MergeIdxPair{ 0, 5 }, MergeIdxPair{ 1, 5 }, MergeIdxPair{ 2, 5 }, MergeIdxPair{ 3, 5 }, MergeIdxPair{ 4, 5 }, + MergeIdxPair{ 5, 0 }, MergeIdxPair{ 5, 1 }, MergeIdxPair{ 5, 2 }, MergeIdxPair{ 5, 3 }, MergeIdxPair{ 5, 4 } }; EncCu::EncCu() {} @@ -3090,15 +3090,14 @@ void EncCu::xCheckRDCostMergeGeo2Nx2N(CodingStructure *&tempCS, CodingStructure for (int geoMotionIdx = 0; geoMotionIdx < maxNumMergeCandidates * (maxNumMergeCandidates - 1); geoMotionIdx++) { - const int mergeCand0 = m_geoModeTest[geoMotionIdx].m_candIdx0; - const int mergeCand1 = m_geoModeTest[geoMotionIdx].m_candIdx1; + const MergeIdxPair mergeIdxPair = m_geoModeTest[geoMotionIdx]; #if GDR_ENABLED if (isEncodeGdrClean) { - if (!mergeCtx.mvSolid[mergeCand0][0] || !mergeCtx.mvSolid[mergeCand0][1] || !mergeCtx.mvSolid[mergeCand1][0] - || !mergeCtx.mvSolid[mergeCand1][1] || !mergeCtx.mvValid[mergeCand0][0] || !mergeCtx.mvValid[mergeCand0][1] - || !mergeCtx.mvValid[mergeCand1][0] || !mergeCtx.mvValid[mergeCand1][1]) + if (!mergeCtx.mvSolid[mergeIdxPair[0]][0] || !mergeCtx.mvSolid[mergeIdxPair[0]][1] || !mergeCtx.mvSolid[mergeIdxPair[1]][0] + || !mergeCtx.mvSolid[mergeIdxPair[1]][1] || !mergeCtx.mvValid[mergeIdxPair[0]][0] || !mergeCtx.mvValid[mergeIdxPair[0]][1] + || !mergeCtx.mvValid[mergeIdxPair[1]][0] || !mergeCtx.mvValid[mergeIdxPair[1]][1]) { // don't insert candidate into comboList so we don't have to test for cleanliness later continue; @@ -3108,7 +3107,7 @@ void EncCu::xCheckRDCostMergeGeo2Nx2N(CodingStructure *&tempCS, CodingStructure for (int splitDir = 0; splitDir < GEO_NUM_PARTITION_MODE; splitDir++) { - double tempCost = m_geoCostList.getCost(splitDir, mergeCand0, mergeCand1); + double tempCost = m_geoCostList.getCost(splitDir, mergeIdxPair); if (tempCost > bestWholeBlkCost) { @@ -3116,7 +3115,7 @@ void EncCu::xCheckRDCostMergeGeo2Nx2N(CodingStructure *&tempCS, CodingStructure } tempCost = tempCost + (double) bitsForPartitionIdx * sqrtLambdaForFirstPass; - comboList.list.push_back(GeoMergeCombo(splitDir, mergeCand0, mergeCand1, tempCost)); + comboList.list.push_back(GeoMergeCombo(splitDir, mergeIdxPair, tempCost)); } } if (comboList.list.empty()) @@ -3142,8 +3141,8 @@ void EncCu::xCheckRDCostMergeGeo2Nx2N(CodingStructure *&tempCS, CodingStructure for (int candidateIdx = 0; candidateIdx < geoNumMrgSadCand; candidateIdx++) { const int splitDir = comboList.list[candidateIdx].splitDir; - const int mergeCand0 = comboList.list[candidateIdx].mergeIdx0; - const int mergeCand1 = comboList.list[candidateIdx].mergeIdx1; + const int mergeCand0 = comboList.list[candidateIdx].mergeIdx[0]; + const int mergeCand1 = comboList.list[candidateIdx].mergeIdx[1]; PelUnitBuf geoBuf = m_geoWeightedBuffers[candidateIdx].getBuf(localUnitArea); m_pcInterSearch->weightedGeoBlk(pu, splitDir, ChannelType::LUMA, geoBuf, *geoBuffer[mergeCand0], @@ -3175,14 +3174,13 @@ void EncCu::xCheckRDCostMergeGeo2Nx2N(CodingStructure *&tempCS, CodingStructure // Generate chroma predictions for (int i = 0; i < geoNumMrgSatdCand; i++) { - const int candidateIdx = geoRdModeList[i]; - const int splitDir = comboList.list[candidateIdx].splitDir; - const int mergeCand0 = comboList.list[candidateIdx].mergeIdx0; - const int mergeCand1 = comboList.list[candidateIdx].mergeIdx1; + const int candidateIdx = geoRdModeList[i]; + const int splitDir = comboList.list[candidateIdx].splitDir; + const MergeIdxPair mergeCand = comboList.list[candidateIdx].mergeIdx; PelUnitBuf geoBuf = m_geoWeightedBuffers[candidateIdx].getBuf(localUnitArea); - m_pcInterSearch->weightedGeoBlk(pu, splitDir, ChannelType::CHROMA, geoBuf, *geoBuffer[mergeCand0], - *geoBuffer[mergeCand1]); + m_pcInterSearch->weightedGeoBlk(pu, splitDir, ChannelType::CHROMA, geoBuf, *geoBuffer[mergeCand[0]], + *geoBuffer[mergeCand[1]]); } } @@ -3224,12 +3222,11 @@ void EncCu::xCheckRDCostMergeGeo2Nx2N(CodingStructure *&tempCS, CodingStructure pu.mergeFlag = true; pu.regularMergeFlag = false; pu.geoSplitDir = comboList.list[candidateIdx].splitDir; - pu.geoMergeIdx0 = (uint8_t) comboList.list[candidateIdx].mergeIdx0; - pu.geoMergeIdx1 = (uint8_t) comboList.list[candidateIdx].mergeIdx1; + pu.geoMergeIdx = comboList.list[candidateIdx].mergeIdx; pu.mmvdMergeFlag = false; pu.mmvdMergeIdx.val = MmvdIdx::INVALID; - PU::spanGeoMotionInfo(pu, mergeCtx, pu.geoSplitDir, pu.geoMergeIdx0, pu.geoMergeIdx1); + PU::spanGeoMotionInfo(pu, mergeCtx, pu.geoSplitDir, pu.geoMergeIdx); PelUnitBuf geoBuf = m_geoWeightedBuffers[candidateIdx].getBuf(localUnitArea); tempCS->getPredBuf().copyFrom(geoBuf); diff --git a/source/Lib/EncoderLib/EncCu.h b/source/Lib/EncoderLib/EncCu.h index e89d1667dc372abb196d19cefbfad00286997f03..f68814b41e526da069e29b37fc67b8e3e192a33d 100644 --- a/source/Lib/EncoderLib/EncCu.h +++ b/source/Lib/EncoderLib/EncCu.h @@ -70,20 +70,11 @@ class EncSlice; struct GeoMergeCombo { int splitDir; - short mergeIdx0; - short mergeIdx1; + MergeIdxPair mergeIdx; double cost; - GeoMergeCombo() : splitDir(), mergeIdx0(-1), mergeIdx1(-1), cost(0.0) {}; - GeoMergeCombo(int _splitDir, int _mergeIdx0, int _mergeIdx1, double _cost) : splitDir(_splitDir), mergeIdx0(_mergeIdx0), mergeIdx1(_mergeIdx1), cost(_cost) {}; -}; - -struct GeoMotionInfo -{ - uint8_t m_candIdx0; - uint8_t m_candIdx1; - - GeoMotionInfo(uint8_t candIdx0, uint8_t candIdx1) : m_candIdx0(candIdx0), m_candIdx1(candIdx1) { } - GeoMotionInfo() { m_candIdx0 = m_candIdx1 = 0; } + GeoMergeCombo() : splitDir(0), mergeIdx{ 0, 0 }, cost(0.0){}; + GeoMergeCombo(int _splitDir, const MergeIdxPair &idx, double _cost) + : splitDir(_splitDir), mergeIdx(idx), cost(_cost){}; }; class GeoComboCostList @@ -138,9 +129,9 @@ public: m_singleDistList[mergeIdx][geoIdx][partIdx] = cost; } - double getCost(const int splitDir, const int mergeCand0, const int mergeCand1) + double getCost(const int splitDir, const MergeIdxPair &mergeCand) { - return m_singleDistList[mergeCand0][splitDir][0] + m_singleDistList[mergeCand1][splitDir][1]; + return m_singleDistList[mergeCand[0]][splitDir][0] + m_singleDistList[mergeCand[1]][splitDir][1]; } }; @@ -196,7 +187,8 @@ private: std::array<int, 2> m_bestBcwIdx; std::array<double, 2> m_bestBcwCost; - static const GeoMotionInfo m_geoModeTest[GEO_MAX_NUM_CANDS]; + static const MergeIdxPair m_geoModeTest[GEO_MAX_NUM_CANDS]; + #if SHARP_LUMA_DELTA_QP || ENABLE_QPA_SUB_CTU void updateLambda ( Slice* slice, const int dQP, #if WCG_EXT && ER_CHROMA_QP_WCG_PPS