...
 
Commits (24)
...@@ -330,7 +330,11 @@ void InterPrediction::xSubPuMC( PredictionUnit& pu, PelUnitBuf& predBuf, const R ...@@ -330,7 +330,11 @@ void InterPrediction::xSubPuMC( PredictionUnit& pu, PelUnitBuf& predBuf, const R
pu.cu->affine = isAffine; pu.cu->affine = isAffine;
} }
#if JVET_O0108_DIS_DMVR_BDOF_CIIP
void InterPrediction::xSubPuBio(PredictionUnit& pu, PelUnitBuf& predBuf, const RefPicList &eRefPicList /*= REF_PIC_LIST_X*/, PelUnitBuf* yuvDstTmp /*= NULL*/)
#else
void InterPrediction::xSubPuBio(PredictionUnit& pu, PelUnitBuf& predBuf, const RefPicList &eRefPicList /*= REF_PIC_LIST_X*/) void InterPrediction::xSubPuBio(PredictionUnit& pu, PelUnitBuf& predBuf, const RefPicList &eRefPicList /*= REF_PIC_LIST_X*/)
#endif
{ {
// compute the location of the current PU // compute the location of the current PU
Position puPos = pu.lumaPos(); Position puPos = pu.lumaPos();
...@@ -344,6 +348,9 @@ void InterPrediction::xSubPuBio(PredictionUnit& pu, PelUnitBuf& predBuf, const R ...@@ -344,6 +348,9 @@ void InterPrediction::xSubPuBio(PredictionUnit& pu, PelUnitBuf& predBuf, const R
subPu.mmvdMergeFlag = pu.mmvdMergeFlag; subPu.mmvdMergeFlag = pu.mmvdMergeFlag;
subPu.mmvdEncOptMode = pu.mmvdEncOptMode; subPu.mmvdEncOptMode = pu.mmvdEncOptMode;
subPu.mergeFlag = pu.mergeFlag; subPu.mergeFlag = pu.mergeFlag;
#if JVET_O0108_DIS_DMVR_BDOF_CIIP
subPu.mhIntraFlag = pu.mhIntraFlag;
#endif
subPu.mvRefine = pu.mvRefine; subPu.mvRefine = pu.mvRefine;
subPu.refIdx[0] = pu.refIdx[0]; subPu.refIdx[0] = pu.refIdx[0];
subPu.refIdx[1] = pu.refIdx[1]; subPu.refIdx[1] = pu.refIdx[1];
...@@ -368,6 +375,14 @@ void InterPrediction::xSubPuBio(PredictionUnit& pu, PelUnitBuf& predBuf, const R ...@@ -368,6 +375,14 @@ void InterPrediction::xSubPuBio(PredictionUnit& pu, PelUnitBuf& predBuf, const R
subPu = curMi; subPu = curMi;
PelUnitBuf subPredBuf = predBuf.subBuf(UnitAreaRelative(pu, subPu)); PelUnitBuf subPredBuf = predBuf.subBuf(UnitAreaRelative(pu, subPu));
#if JVET_O0108_DIS_DMVR_BDOF_CIIP
if (yuvDstTmp)
{
PelUnitBuf subPredBufTmp = yuvDstTmp->subBuf(UnitAreaRelative(pu, subPu));
motionCompensation(subPu, subPredBuf, eRefPicList, true, true, &subPredBufTmp);
}
else
#endif
motionCompensation(subPu, subPredBuf, eRefPicList); motionCompensation(subPu, subPredBuf, eRefPicList);
} }
} }
...@@ -463,7 +478,11 @@ void InterPrediction::xPredInterUni(const PredictionUnit& pu, const RefPicList& ...@@ -463,7 +478,11 @@ void InterPrediction::xPredInterUni(const PredictionUnit& pu, const RefPicList&
} }
} }
#if JVET_O0108_DIS_DMVR_BDOF_CIIP
void InterPrediction::xPredInterBi(PredictionUnit& pu, PelUnitBuf &pcYuvPred, PelUnitBuf* yuvPredTmp /*= NULL*/)
#else
void InterPrediction::xPredInterBi(PredictionUnit& pu, PelUnitBuf &pcYuvPred) void InterPrediction::xPredInterBi(PredictionUnit& pu, PelUnitBuf &pcYuvPred)
#endif
{ {
const PPS &pps = *pu.cs->pps; const PPS &pps = *pu.cs->pps;
const Slice &slice = *pu.cs->slice; const Slice &slice = *pu.cs->slice;
...@@ -496,6 +515,11 @@ void InterPrediction::xPredInterBi(PredictionUnit& pu, PelUnitBuf &pcYuvPred) ...@@ -496,6 +515,11 @@ void InterPrediction::xPredInterBi(PredictionUnit& pu, PelUnitBuf &pcYuvPred)
} }
} }
#if JVET_O0108_DIS_DMVR_BDOF_CIIP
if (bioApplied && pu.mhIntraFlag)
bioApplied = false;
#endif
if (bioApplied && pu.cu->smvdMode) if (bioApplied && pu.cu->smvdMode)
{ {
bioApplied = false; bioApplied = false;
...@@ -532,7 +556,15 @@ void InterPrediction::xPredInterBi(PredictionUnit& pu, PelUnitBuf &pcYuvPred) ...@@ -532,7 +556,15 @@ void InterPrediction::xPredInterBi(PredictionUnit& pu, PelUnitBuf &pcYuvPred)
if (pu.refIdx[0] >= 0 && pu.refIdx[1] >= 0) if (pu.refIdx[0] >= 0 && pu.refIdx[1] >= 0)
{ {
if (dmvrApplied) if (dmvrApplied)
#if JVET_O0108_DIS_DMVR_BDOF_CIIP
{
if (yuvPredTmp)
xPredInterUni(pu, eRefPicList, pcMbBuf, true, false, true, true);
continue;
}
#else
continue; // mc will happen in processDMVR continue; // mc will happen in processDMVR
#endif
xPredInterUni ( pu, eRefPicList, pcMbBuf, true xPredInterUni ( pu, eRefPicList, pcMbBuf, true
, bioApplied , bioApplied
, true, true , true, true
...@@ -565,20 +597,38 @@ void InterPrediction::xPredInterBi(PredictionUnit& pu, PelUnitBuf &pcYuvPred) ...@@ -565,20 +597,38 @@ void InterPrediction::xPredInterBi(PredictionUnit& pu, PelUnitBuf &pcYuvPred)
if( (!dmvrApplied) && (!bioApplied) && pps.getWPBiPred() && slice.getSliceType() == B_SLICE && pu.cu->GBiIdx==GBI_DEFAULT) if( (!dmvrApplied) && (!bioApplied) && pps.getWPBiPred() && slice.getSliceType() == B_SLICE && pu.cu->GBiIdx==GBI_DEFAULT)
{ {
xWeightedPredictionBi( pu, srcPred0, srcPred1, pcYuvPred, m_maxCompIDToPred ); xWeightedPredictionBi( pu, srcPred0, srcPred1, pcYuvPred, m_maxCompIDToPred );
#if JVET_O0108_DIS_DMVR_BDOF_CIIP
if (yuvPredTmp)
yuvPredTmp->copyFrom(pcYuvPred);
#endif
} }
else if( pps.getUseWP() && slice.getSliceType() == P_SLICE ) else if( pps.getUseWP() && slice.getSliceType() == P_SLICE )
{ {
xWeightedPredictionUni( pu, srcPred0, REF_PIC_LIST_0, pcYuvPred, -1, m_maxCompIDToPred ); xWeightedPredictionUni( pu, srcPred0, REF_PIC_LIST_0, pcYuvPred, -1, m_maxCompIDToPred );
#if JVET_O0108_DIS_DMVR_BDOF_CIIP
if (yuvPredTmp)
yuvPredTmp->copyFrom(pcYuvPred);
#endif
} }
else else
{ {
if (dmvrApplied) if (dmvrApplied)
{ {
#if JVET_O0108_DIS_DMVR_BDOF_CIIP
if (yuvPredTmp)
{
yuvPredTmp->addAvg(srcPred0, srcPred1, slice.clpRngs(), false);
}
#endif
xProcessDMVR(pu, pcYuvPred, slice.clpRngs(), bioApplied); xProcessDMVR(pu, pcYuvPred, slice.clpRngs(), bioApplied);
} }
else else
{ {
#if JVET_O0108_DIS_DMVR_BDOF_CIIP
xWeightedAverage( pu, srcPred0, srcPred1, pcYuvPred, slice.getSPS()->getBitDepths(), slice.clpRngs(), bioApplied, yuvPredTmp);
#else
xWeightedAverage( pu, srcPred0, srcPred1, pcYuvPred, slice.getSPS()->getBitDepths(), slice.clpRngs(), bioApplied ); xWeightedAverage( pu, srcPred0, srcPred1, pcYuvPred, slice.getSPS()->getBitDepths(), slice.clpRngs(), bioApplied );
#endif
} }
} }
} }
...@@ -1117,7 +1167,11 @@ void InterPrediction::xCalcBlkGradient(int sx, int sy, int *arraysGx2, int ...@@ -1117,7 +1167,11 @@ void InterPrediction::xCalcBlkGradient(int sx, int sy, int *arraysGx2, int
g_pelBufOP.calcBlkGradient(sx, sy, arraysGx2, arraysGxGy, arraysGxdI, arraysGy2, arraysGydI, sGx2, sGy2, sGxGy, sGxdI, sGydI, width, height, unitSize); g_pelBufOP.calcBlkGradient(sx, sy, arraysGx2, arraysGxGy, arraysGxdI, arraysGy2, arraysGydI, sGx2, sGy2, sGxGy, sGxdI, sGydI, width, height, unitSize);
} }
#if JVET_O0108_DIS_DMVR_BDOF_CIIP
void InterPrediction::xWeightedAverage(const PredictionUnit& pu, const CPelUnitBuf& pcYuvSrc0, const CPelUnitBuf& pcYuvSrc1, PelUnitBuf& pcYuvDst, const BitDepths& clipBitDepths, const ClpRngs& clpRngs, const bool& bioApplied, PelUnitBuf* yuvDstTmp /*= NULL*/)
#else
void InterPrediction::xWeightedAverage(const PredictionUnit& pu, const CPelUnitBuf& pcYuvSrc0, const CPelUnitBuf& pcYuvSrc1, PelUnitBuf& pcYuvDst, const BitDepths& clipBitDepths, const ClpRngs& clpRngs, const bool& bioApplied ) void InterPrediction::xWeightedAverage(const PredictionUnit& pu, const CPelUnitBuf& pcYuvSrc0, const CPelUnitBuf& pcYuvSrc1, PelUnitBuf& pcYuvDst, const BitDepths& clipBitDepths, const ClpRngs& clpRngs, const bool& bioApplied )
#endif
{ {
const int iRefIdx0 = pu.refIdx[0]; const int iRefIdx0 = pu.refIdx[0];
const int iRefIdx1 = pu.refIdx[1]; const int iRefIdx1 = pu.refIdx[1];
...@@ -1128,6 +1182,10 @@ void InterPrediction::xWeightedAverage(const PredictionUnit& pu, const CPelUnitB ...@@ -1128,6 +1182,10 @@ void InterPrediction::xWeightedAverage(const PredictionUnit& pu, const CPelUnitB
{ {
CHECK(bioApplied, "GBi is disallowed with BIO"); CHECK(bioApplied, "GBi is disallowed with BIO");
pcYuvDst.addWeightedAvg(pcYuvSrc0, pcYuvSrc1, clpRngs, pu.cu->GBiIdx); pcYuvDst.addWeightedAvg(pcYuvSrc0, pcYuvSrc1, clpRngs, pu.cu->GBiIdx);
#if JVET_O0108_DIS_DMVR_BDOF_CIIP
if (yuvDstTmp)
yuvDstTmp->copyFrom(pcYuvDst);
#endif
return; return;
} }
if (bioApplied) if (bioApplied)
...@@ -1145,10 +1203,18 @@ void InterPrediction::xWeightedAverage(const PredictionUnit& pu, const CPelUnitB ...@@ -1145,10 +1203,18 @@ void InterPrediction::xWeightedAverage(const PredictionUnit& pu, const CPelUnitB
if (bioEnabled) if (bioEnabled)
{ {
applyBiOptFlow(pu, pcYuvSrc0, pcYuvSrc1, iRefIdx0, iRefIdx1, pcYuvDst, clipBitDepths); applyBiOptFlow(pu, pcYuvSrc0, pcYuvSrc1, iRefIdx0, iRefIdx1, pcYuvDst, clipBitDepths);
#if JVET_O0108_DIS_DMVR_BDOF_CIIP
if (yuvDstTmp)
yuvDstTmp->bufs[0].addAvg(CPelBuf(pSrcY0, src0Stride, pu.lumaSize()), CPelBuf(pSrcY1, src1Stride, pu.lumaSize()), clpRngs.comp[0]);
#endif
} }
else else
{ {
pcYuvDst.bufs[0].addAvg(CPelBuf(pSrcY0, src0Stride, pu.lumaSize()), CPelBuf(pSrcY1, src1Stride, pu.lumaSize()), clpRngs.comp[0]); pcYuvDst.bufs[0].addAvg(CPelBuf(pSrcY0, src0Stride, pu.lumaSize()), CPelBuf(pSrcY1, src1Stride, pu.lumaSize()), clpRngs.comp[0]);
#if JVET_O0108_DIS_DMVR_BDOF_CIIP
if (yuvDstTmp)
yuvDstTmp->bufs[0].copyFrom(pcYuvDst.bufs[0]);
#endif
} }
} }
if (pu.cs->pps->getWPBiPred()) if (pu.cs->pps->getWPBiPred())
...@@ -1169,6 +1235,18 @@ void InterPrediction::xWeightedAverage(const PredictionUnit& pu, const CPelUnitB ...@@ -1169,6 +1235,18 @@ void InterPrediction::xWeightedAverage(const PredictionUnit& pu, const CPelUnitB
{ {
pcYuvDst.addAvg(pcYuvSrc0, pcYuvSrc1, clpRngs, bioApplied); pcYuvDst.addAvg(pcYuvSrc0, pcYuvSrc1, clpRngs, bioApplied);
} }
#if JVET_O0108_DIS_DMVR_BDOF_CIIP
if (yuvDstTmp)
{
if (bioApplied)
{
yuvDstTmp->bufs[1].copyFrom(pcYuvDst.bufs[1]);
yuvDstTmp->bufs[2].copyFrom(pcYuvDst.bufs[2]);
}
else
yuvDstTmp->copyFrom(pcYuvDst);
}
#endif
} }
else if( iRefIdx0 >= 0 && iRefIdx1 < 0 ) else if( iRefIdx0 >= 0 && iRefIdx1 < 0 )
{ {
...@@ -1178,6 +1256,10 @@ void InterPrediction::xWeightedAverage(const PredictionUnit& pu, const CPelUnitB ...@@ -1178,6 +1256,10 @@ void InterPrediction::xWeightedAverage(const PredictionUnit& pu, const CPelUnitB
} }
else else
pcYuvDst.copyClip( pcYuvSrc0, clpRngs ); pcYuvDst.copyClip( pcYuvSrc0, clpRngs );
#if JVET_O0108_DIS_DMVR_BDOF_CIIP
if (yuvDstTmp)
yuvDstTmp->copyFrom(pcYuvDst);
#endif
} }
else if( iRefIdx0 < 0 && iRefIdx1 >= 0 ) else if( iRefIdx0 < 0 && iRefIdx1 >= 0 )
{ {
...@@ -1187,13 +1269,24 @@ void InterPrediction::xWeightedAverage(const PredictionUnit& pu, const CPelUnitB ...@@ -1187,13 +1269,24 @@ void InterPrediction::xWeightedAverage(const PredictionUnit& pu, const CPelUnitB
} }
else else
pcYuvDst.copyClip( pcYuvSrc1, clpRngs ); pcYuvDst.copyClip( pcYuvSrc1, clpRngs );
#if JVET_O0108_DIS_DMVR_BDOF_CIIP
if (yuvDstTmp)
yuvDstTmp->copyFrom(pcYuvDst);
#endif
} }
} }
void InterPrediction::motionCompensation( PredictionUnit &pu, PelUnitBuf &predBuf, const RefPicList &eRefPicList void InterPrediction::motionCompensation( PredictionUnit &pu, PelUnitBuf &predBuf, const RefPicList &eRefPicList
, const bool luma, const bool chroma , const bool luma, const bool chroma
#if JVET_O0108_DIS_DMVR_BDOF_CIIP
, PelUnitBuf* predBufWOBIO /*= NULL*/
#endif
) )
{ {
#if JVET_O0108_DIS_DMVR_BDOF_CIIP
CHECK(predBufWOBIO && pu.mhIntraFlag, "the case should not happen!");
#endif
// dual tree handling for IBC as the only ref // dual tree handling for IBC as the only ref
if ((!luma || !chroma) && eRefPicList == REF_PIC_LIST_0) if ((!luma || !chroma) && eRefPicList == REF_PIC_LIST_0)
{ {
...@@ -1217,6 +1310,9 @@ void InterPrediction::motionCompensation( PredictionUnit &pu, PelUnitBuf &predBu ...@@ -1217,6 +1310,9 @@ void InterPrediction::motionCompensation( PredictionUnit &pu, PelUnitBuf &predBu
if( eRefPicList != REF_PIC_LIST_X ) if( eRefPicList != REF_PIC_LIST_X )
{ {
#if JVET_O0108_DIS_DMVR_BDOF_CIIP
CHECK(predBufWOBIO != NULL, "the case should not happen!");
#endif
if( ( ( sliceType == P_SLICE && pps.getUseWP() ) || ( sliceType == B_SLICE && pps.getWPBiPred() ) ) ) if( ( ( sliceType == P_SLICE && pps.getUseWP() ) || ( sliceType == B_SLICE && pps.getWPBiPred() ) ) )
{ {
xPredInterUni ( pu, eRefPicList, predBuf, true xPredInterUni ( pu, eRefPicList, predBuf, true
...@@ -1266,6 +1362,13 @@ void InterPrediction::motionCompensation( PredictionUnit &pu, PelUnitBuf &predBu ...@@ -1266,6 +1362,13 @@ void InterPrediction::motionCompensation( PredictionUnit &pu, PelUnitBuf &predBu
} }
} }
#if JVET_O0108_DIS_DMVR_BDOF_CIIP
if (bioApplied && pu.mhIntraFlag)
{
bioApplied = false;
}
#endif
if (bioApplied && pu.cu->smvdMode) if (bioApplied && pu.cu->smvdMode)
{ {
bioApplied = false; bioApplied = false;
...@@ -1283,11 +1386,18 @@ void InterPrediction::motionCompensation( PredictionUnit &pu, PelUnitBuf &predBu ...@@ -1283,11 +1386,18 @@ void InterPrediction::motionCompensation( PredictionUnit &pu, PelUnitBuf &predBu
dmvrApplied = (pu.mvRefine) && PU::checkDMVRCondition(pu); dmvrApplied = (pu.mvRefine) && PU::checkDMVRCondition(pu);
if ((pu.lumaSize().width > MAX_BDOF_APPLICATION_REGION || pu.lumaSize().height > MAX_BDOF_APPLICATION_REGION) && pu.mergeType != MRG_TYPE_SUBPU_ATMVP && (bioApplied && !dmvrApplied)) if ((pu.lumaSize().width > MAX_BDOF_APPLICATION_REGION || pu.lumaSize().height > MAX_BDOF_APPLICATION_REGION) && pu.mergeType != MRG_TYPE_SUBPU_ATMVP && (bioApplied && !dmvrApplied))
{ {
#if JVET_O0108_DIS_DMVR_BDOF_CIIP
xSubPuBio(pu, predBuf, eRefPicList, predBufWOBIO);
#else
xSubPuBio(pu, predBuf, eRefPicList); xSubPuBio(pu, predBuf, eRefPicList);
#endif
} }
else else
if (pu.mergeType != MRG_TYPE_DEFAULT_N && pu.mergeType != MRG_TYPE_IBC) if (pu.mergeType != MRG_TYPE_DEFAULT_N && pu.mergeType != MRG_TYPE_IBC)
{ {
#if JVET_O0108_DIS_DMVR_BDOF_CIIP
CHECK(predBufWOBIO != NULL, "the case should not happen!");
#endif
xSubPuMC( pu, predBuf, eRefPicList ); xSubPuMC( pu, predBuf, eRefPicList );
} }
else if( xCheckIdenticalMotion( pu ) ) else if( xCheckIdenticalMotion( pu ) )
...@@ -1296,10 +1406,18 @@ void InterPrediction::motionCompensation( PredictionUnit &pu, PelUnitBuf &predBu ...@@ -1296,10 +1406,18 @@ void InterPrediction::motionCompensation( PredictionUnit &pu, PelUnitBuf &predBu
, false , false
, true, true , true, true
); );
#if JVET_O0108_DIS_DMVR_BDOF_CIIP
if (predBufWOBIO)
predBufWOBIO->copyFrom(predBuf);
#endif
} }
else else
{ {
#if JVET_O0108_DIS_DMVR_BDOF_CIIP
xPredInterBi(pu, predBuf, predBufWOBIO);
#else
xPredInterBi( pu, predBuf ); xPredInterBi( pu, predBuf );
#endif
} }
} }
return; return;
......
...@@ -121,7 +121,11 @@ protected: ...@@ -121,7 +121,11 @@ protected:
, const bool& bioApplied , const bool& bioApplied
, const bool luma, const bool chroma , const bool luma, const bool chroma
); );
#if JVET_O0108_DIS_DMVR_BDOF_CIIP
void xPredInterBi ( PredictionUnit& pu, PelUnitBuf &pcYuvPred, PelUnitBuf* yuvPredTmp = NULL );
#else
void xPredInterBi ( PredictionUnit& pu, PelUnitBuf &pcYuvPred ); void xPredInterBi ( PredictionUnit& pu, PelUnitBuf &pcYuvPred );
#endif
void xPredInterBlk ( const ComponentID& compID, const PredictionUnit& pu, const Picture* refPic, const Mv& _mv, PelUnitBuf& dstPic, const bool& bi, const ClpRng& clpRng void xPredInterBlk ( const ComponentID& compID, const PredictionUnit& pu, const Picture* refPic, const Mv& _mv, PelUnitBuf& dstPic, const bool& bi, const ClpRng& clpRng
, const bool& bioApplied , const bool& bioApplied
, bool isIBC , bool isIBC
...@@ -136,7 +140,11 @@ protected: ...@@ -136,7 +140,11 @@ protected:
void xBioGradFilter (Pel* pSrc, int srcStride, int width, int height, int gradStride, Pel* gradX, Pel* gradY, int bitDepth); void xBioGradFilter (Pel* pSrc, int srcStride, int width, int height, int gradStride, Pel* gradX, Pel* gradY, int bitDepth);
void xCalcBIOPar (const Pel* srcY0Temp, const Pel* srcY1Temp, const Pel* gradX0, const Pel* gradX1, const Pel* gradY0, const Pel* gradY1, int* dotProductTemp1, int* dotProductTemp2, int* dotProductTemp3, int* dotProductTemp5, int* dotProductTemp6, const int src0Stride, const int src1Stride, const int gradStride, const int widthG, const int heightG, int bitDepth); void xCalcBIOPar (const Pel* srcY0Temp, const Pel* srcY1Temp, const Pel* gradX0, const Pel* gradX1, const Pel* gradY0, const Pel* gradY1, int* dotProductTemp1, int* dotProductTemp2, int* dotProductTemp3, int* dotProductTemp5, int* dotProductTemp6, const int src0Stride, const int src1Stride, const int gradStride, const int widthG, const int heightG, int bitDepth);
void xCalcBlkGradient (int sx, int sy, int *arraysGx2, int *arraysGxGy, int *arraysGxdI, int *arraysGy2, int *arraysGydI, int &sGx2, int &sGy2, int &sGxGy, int &sGxdI, int &sGydI, int width, int height, int unitSize); void xCalcBlkGradient (int sx, int sy, int *arraysGx2, int *arraysGxGy, int *arraysGxdI, int *arraysGy2, int *arraysGydI, int &sGx2, int &sGy2, int &sGxGy, int &sGxdI, int &sGydI, int width, int height, int unitSize);
void xWeightedAverage ( const PredictionUnit& pu, const CPelUnitBuf& pcYuvSrc0, const CPelUnitBuf& pcYuvSrc1, PelUnitBuf& pcYuvDst, const BitDepths& clipBitDepths, const ClpRngs& clpRngs, const bool& bioApplied ); #if JVET_O0108_DIS_DMVR_BDOF_CIIP
void xWeightedAverage ( const PredictionUnit& pu, const CPelUnitBuf& pcYuvSrc0, const CPelUnitBuf& pcYuvSrc1, PelUnitBuf& pcYuvDst, const BitDepths& clipBitDepths, const ClpRngs& clpRngs, const bool& bioApplied, PelUnitBuf* yuvDstTmp = NULL );
#else
void xWeightedAverage ( const PredictionUnit& pu, const CPelUnitBuf& pcYuvSrc0, const CPelUnitBuf& pcYuvSrc1, PelUnitBuf& pcYuvDst, const BitDepths& clipBitDepths, const ClpRngs& clpRngs, const bool& bioApplied );
#endif
void xPredAffineBlk( const ComponentID& compID, const PredictionUnit& pu, const Picture* refPic, const Mv* _mv, PelUnitBuf& dstPic, const bool& bi, const ClpRng& clpRng ); void xPredAffineBlk( const ComponentID& compID, const PredictionUnit& pu, const Picture* refPic, const Mv* _mv, PelUnitBuf& dstPic, const bool& bi, const ClpRng& clpRng );
void xWeightedTriangleBlk ( const PredictionUnit &pu, const uint32_t width, const uint32_t height, const ComponentID compIdx, const bool splitDir, PelUnitBuf& predDst, PelUnitBuf& predSrc0, PelUnitBuf& predSrc1 ); void xWeightedTriangleBlk ( const PredictionUnit &pu, const uint32_t width, const uint32_t height, const ComponentID compIdx, const bool splitDir, PelUnitBuf& predDst, PelUnitBuf& predSrc0, PelUnitBuf& predSrc1 );
...@@ -144,7 +152,11 @@ protected: ...@@ -144,7 +152,11 @@ protected:
static bool xCheckIdenticalMotion( const PredictionUnit& pu ); static bool xCheckIdenticalMotion( const PredictionUnit& pu );
void xSubPuMC(PredictionUnit& pu, PelUnitBuf& predBuf, const RefPicList &eRefPicList = REF_PIC_LIST_X); void xSubPuMC(PredictionUnit& pu, PelUnitBuf& predBuf, const RefPicList &eRefPicList = REF_PIC_LIST_X);
#if JVET_O0108_DIS_DMVR_BDOF_CIIP
void xSubPuBio(PredictionUnit& pu, PelUnitBuf& predBuf, const RefPicList &eRefPicList = REF_PIC_LIST_X, PelUnitBuf* yuvDstTmp = NULL);
#else
void xSubPuBio(PredictionUnit& pu, PelUnitBuf& predBuf, const RefPicList &eRefPicList = REF_PIC_LIST_X); void xSubPuBio(PredictionUnit& pu, PelUnitBuf& predBuf, const RefPicList &eRefPicList = REF_PIC_LIST_X);
#endif
void destroy(); void destroy();
...@@ -162,6 +174,9 @@ public: ...@@ -162,6 +174,9 @@ public:
// inter // inter
void motionCompensation (PredictionUnit &pu, PelUnitBuf& predBuf, const RefPicList &eRefPicList = REF_PIC_LIST_X void motionCompensation (PredictionUnit &pu, PelUnitBuf& predBuf, const RefPicList &eRefPicList = REF_PIC_LIST_X
, const bool luma = true, const bool chroma = true , const bool luma = true, const bool chroma = true
#if JVET_O0108_DIS_DMVR_BDOF_CIIP
, PelUnitBuf* predBufWOBIO = NULL
#endif
); );
void motionCompensation (PredictionUnit &pu, const RefPicList &eRefPicList = REF_PIC_LIST_X void motionCompensation (PredictionUnit &pu, const RefPicList &eRefPicList = REF_PIC_LIST_X
, const bool luma = true, const bool chroma = true , const bool luma = true, const bool chroma = true
......
...@@ -177,6 +177,8 @@ void LoopFilter::loopFilterPic( CodingStructure& cs ...@@ -177,6 +177,8 @@ void LoopFilter::loopFilterPic( CodingStructure& cs
m_ctuYLumaSamples = y << pcv.maxCUHeightLog2; m_ctuYLumaSamples = y << pcv.maxCUHeightLog2;
const UnitArea ctuArea( pcv.chrFormat, Area( x << pcv.maxCUWidthLog2, y << pcv.maxCUHeightLog2, pcv.maxCUWidth, pcv.maxCUWidth ) ); const UnitArea ctuArea( pcv.chrFormat, Area( x << pcv.maxCUWidthLog2, y << pcv.maxCUHeightLog2, pcv.maxCUWidth, pcv.maxCUWidth ) );
CodingUnit* firstCU = cs.getCU( ctuArea.lumaPos(), CH_L);
cs.slice = firstCU->slice;
// CU-based deblocking // CU-based deblocking
for( auto &currCU : cs.traverseCUs( CS::getArea( cs, ctuArea, CH_L ), CH_L ) ) for( auto &currCU : cs.traverseCUs( CS::getArea( cs, ctuArea, CH_L ), CH_L ) )
...@@ -214,6 +216,8 @@ void LoopFilter::loopFilterPic( CodingStructure& cs ...@@ -214,6 +216,8 @@ void LoopFilter::loopFilterPic( CodingStructure& cs
m_ctuYLumaSamples = y << pcv.maxCUHeightLog2; m_ctuYLumaSamples = y << pcv.maxCUHeightLog2;
const UnitArea ctuArea( pcv.chrFormat, Area( x << pcv.maxCUWidthLog2, y << pcv.maxCUHeightLog2, pcv.maxCUWidth, pcv.maxCUWidth ) ); const UnitArea ctuArea( pcv.chrFormat, Area( x << pcv.maxCUWidthLog2, y << pcv.maxCUHeightLog2, pcv.maxCUWidth, pcv.maxCUWidth ) );
CodingUnit* firstCU = cs.getCU( ctuArea.lumaPos(), CH_L);
cs.slice = firstCU->slice;
// CU-based deblocking // CU-based deblocking
for( auto &currCU : cs.traverseCUs( CS::getArea( cs, ctuArea, CH_L ), CH_L ) ) for( auto &currCU : cs.traverseCUs( CS::getArea( cs, ctuArea, CH_L ), CH_L ) )
...@@ -1140,7 +1144,8 @@ void LoopFilter::xEdgeFilterChroma(const CodingUnit& cu, const DeblockEdgeDir ed ...@@ -1140,7 +1144,8 @@ void LoopFilter::xEdgeFilterChroma(const CodingUnit& cu, const DeblockEdgeDir ed
if (bS[0] > 0 || bS[1] > 0) if (bS[0] > 0 || bS[1] > 0)
{ {
const CodingUnit& cuQ = cu; const CodingUnit& cuQ = cu;
const CodingUnit& cuP = *cu.cs->getCU( recalcPosition( cu.chromaFormat, CHANNEL_TYPE_LUMA, cu.chType, pos.offset( xoffset - uiNumPelsLuma, yoffset - uiNumPelsLuma ) ), cu.chType ); CodingUnit& cuP1 = *cu.cs->getCU( recalcPosition( cu.chromaFormat, CHANNEL_TYPE_LUMA, cu.chType, pos.offset( xoffset - uiNumPelsLuma, yoffset - uiNumPelsLuma ) ), cu.chType );
CodingUnit& cuP = *cu.cs->getCU( recalcPosition( cu.chromaFormat, CHANNEL_TYPE_LUMA, ((!cuP1.cs->pcv->ISingleTree && cuP1.slice->isIntra()) ? CHANNEL_TYPE_CHROMA : cu.chType), pos.offset( xoffset - uiNumPelsLuma, yoffset - uiNumPelsLuma ) ), ((!cuP1.cs->pcv->ISingleTree && cuP1.slice->isIntra()) ? CHANNEL_TYPE_CHROMA : cu.chType));
if (edgeDir == EDGE_VER) if (edgeDir == EDGE_VER)
{ {
......
...@@ -430,6 +430,10 @@ void initROM() ...@@ -430,6 +430,10 @@ void initROM()
} }
} }
#endif #endif
#if JVET_O0592_ENC_ME_IMP
::memset(g_isReusedUniMVsFilled, 0, sizeof(g_isReusedUniMVsFilled));
#endif
} }
void destroyROM() void destroyROM()
...@@ -753,5 +757,9 @@ uint8_t g_triangleMvStorage[TRIANGLE_DIR_NUM][MAX_CU_DEPTH - MIN_CU_LOG2 + 1][MA ...@@ -753,5 +757,9 @@ uint8_t g_triangleMvStorage[TRIANGLE_DIR_NUM][MAX_CU_DEPTH - MIN_CU_LOG2 + 1][MA
#if JVET_O0280_SIMD_TRIANGLE_WEIGHTING #if JVET_O0280_SIMD_TRIANGLE_WEIGHTING
int16_t *g_triangleWeights[2][TRIANGLE_DIR_NUM][MAX_CU_DEPTH - MIN_CU_LOG2 + 2][MAX_CU_DEPTH - MIN_CU_LOG2 + 2]; int16_t *g_triangleWeights[2][TRIANGLE_DIR_NUM][MAX_CU_DEPTH - MIN_CU_LOG2 + 2][MAX_CU_DEPTH - MIN_CU_LOG2 + 2];
#endif #endif
#if JVET_O0592_ENC_ME_IMP
Mv g_reusedUniMVs[32][32][8][8][2][33];
bool g_isReusedUniMVsFilled[32][32][8][8];
#endif
//! \} //! \}
...@@ -226,5 +226,11 @@ extern int16_t *g_triangleWeights[2][TRIANGLE_DIR_NUM][MAX_CU_DEPTH - MIN_CU_LOG ...@@ -226,5 +226,11 @@ extern int16_t *g_triangleWeights[2][TRIANGLE_DIR_NUM][MAX_CU_DEPTH - MIN_CU_LOG
extern bool g_mctsDecCheckEnabled; extern bool g_mctsDecCheckEnabled;
#if JVET_O0592_ENC_ME_IMP
class Mv;
extern Mv g_reusedUniMVs[32][32][8][8][2][33];
extern bool g_isReusedUniMVsFilled[32][32][8][8];
#endif
#endif //__TCOMROM__ #endif //__TCOMROM__
...@@ -687,13 +687,17 @@ void SampleAdaptiveOffset::xPCMLFDisableProcess(CodingStructure& cs) ...@@ -687,13 +687,17 @@ void SampleAdaptiveOffset::xPCMLFDisableProcess(CodingStructure& cs)
void SampleAdaptiveOffset::xPCMCURestoration(CodingStructure& cs, const UnitArea &ctuArea) void SampleAdaptiveOffset::xPCMCURestoration(CodingStructure& cs, const UnitArea &ctuArea)
{ {
const SPS& sps = *cs.sps; const SPS& sps = *cs.sps;
uint32_t numComponents = CS::isDualITree(cs) ? 1 : m_numberOfComponents; uint32_t numComponents;
bool anyDualTree = false;
for( auto &cu : cs.traverseCUs( ctuArea, CH_L ) ) for( auto &cu : cs.traverseCUs( ctuArea, CH_L ) )
{ {
// restore PCM samples // restore PCM samples
if( ( cu.ipcm && sps.getPCMFilterDisableFlag() ) || CU::isLosslessCoded( cu ) ) if( ( cu.ipcm && sps.getPCMFilterDisableFlag() ) || CU::isLosslessCoded( cu ) )
{ {
cs.slice = cu.slice;
anyDualTree |= CS::isDualITree(cs);
numComponents = CS::isDualITree(cs) ? 1 : m_numberOfComponents;
for( uint32_t comp = 0; comp < numComponents; comp++ ) for( uint32_t comp = 0; comp < numComponents; comp++ )
{ {
xPCMSampleRestoration( cu, ComponentID( comp ) ); xPCMSampleRestoration( cu, ComponentID( comp ) );
...@@ -701,10 +705,15 @@ void SampleAdaptiveOffset::xPCMCURestoration(CodingStructure& cs, const UnitArea ...@@ -701,10 +705,15 @@ void SampleAdaptiveOffset::xPCMCURestoration(CodingStructure& cs, const UnitArea
} }
} }
numComponents = m_numberOfComponents; numComponents = m_numberOfComponents;
if (CS::isDualITree(cs) && numComponents) if (anyDualTree && numComponents)
{ {
for (auto &cu : cs.traverseCUs(ctuArea, CH_C)) for (auto &cu : cs.traverseCUs(ctuArea, CH_C))
{ {
if (cu.slice->isIntra() == false)
{
continue;
}
// restore PCM samples // restore PCM samples
if ((cu.ipcm && sps.getPCMFilterDisableFlag()) || CU::isLosslessCoded(cu)) if ((cu.ipcm && sps.getPCMFilterDisableFlag()) || CU::isLosslessCoded(cu))
{ {
......
...@@ -1458,14 +1458,14 @@ SPS::~SPS() ...@@ -1458,14 +1458,14 @@ SPS::~SPS()
void SPS::createRPLList0(int numRPL) void SPS::createRPLList0(int numRPL)
{ {
m_RPLList0.destroy(); m_RPLList0.destroy();
m_RPLList0.create(numRPL); m_RPLList0.create(numRPL + 1);
m_numRPL0 = numRPL; m_numRPL0 = numRPL;
m_rpl1IdxPresentFlag = (m_numRPL0 != m_numRPL1) ? true : false; m_rpl1IdxPresentFlag = (m_numRPL0 != m_numRPL1) ? true : false;
} }
void SPS::createRPLList1(int numRPL) void SPS::createRPLList1(int numRPL)
{ {
m_RPLList1.destroy(); m_RPLList1.destroy();
m_RPLList1.create(numRPL); m_RPLList1.create(numRPL + 1);
m_numRPL1 = numRPL; m_numRPL1 = numRPL;
m_rpl1IdxPresentFlag = (m_numRPL0 != m_numRPL1) ? true : false; m_rpl1IdxPresentFlag = (m_numRPL0 != m_numRPL1) ? true : false;
......
...@@ -50,6 +50,12 @@ ...@@ -50,6 +50,12 @@
#include <assert.h> #include <assert.h>
#include <cassert> #include <cassert>
#define JVET_O0315_RDPCM_INTRAMODE_ALIGN 1 // JVET-O0200/O0205/O0296/O0342/O0463/O0542: Intra prediction mode alignment for BDPCM
#define JVET_O0284_CONDITION_SMVD_MVDL1ZEROFLAG 1 // JVET-O0284: condition sym_mvd_flag on mvd_l1_zero_flag
#define JVET_O0438_SPS_AFFINE_AMVR_FLAG 1 // JVET-O0438: affine AMVR control flag conditioned on affine control flag in SPS
#define JVET_O0052_TU_LEVEL_CTX_CODED_BIN_CONSTRAINT 1 // JVET-O0052 Method-1: TU-level context coded bin constraint #define JVET_O0052_TU_LEVEL_CTX_CODED_BIN_CONSTRAINT 1 // JVET-O0052 Method-1: TU-level context coded bin constraint
#define JVET_O0105_ICT 1 // JVET-O0105: inter-chroma transform (ICT) as extension of joint chroma coding (JCC) #define JVET_O0105_ICT 1 // JVET-O0105: inter-chroma transform (ICT) as extension of joint chroma coding (JCC)
...@@ -110,6 +116,10 @@ ...@@ -110,6 +116,10 @@
#define JVET_O0126_BPWA_INDEX_CODING_FIX 1 // JVET-O0126 align BPWA index coding with specification #define JVET_O0126_BPWA_INDEX_CODING_FIX 1 // JVET-O0126 align BPWA index coding with specification
#define JVET_O0592_ENC_ME_IMP 1 // JVET-O0592 encoder ME improvement
#define JVET_O0108_DIS_DMVR_BDOF_CIIP 1 // JVET_O0108 CE9-2.2: disable DMVR and BDOF for CIIP
#define FIX_DB_MAX_TRANSFORM_SIZE 1 #define FIX_DB_MAX_TRANSFORM_SIZE 1
#define MRG_SHARELIST_SHARSIZE 32 #define MRG_SHARELIST_SHARSIZE 32
......
...@@ -1601,12 +1601,15 @@ bool PU::checkDMVRCondition(const PredictionUnit& pu) ...@@ -1601,12 +1601,15 @@ bool PU::checkDMVRCondition(const PredictionUnit& pu)
WPScalingParam *wp1; WPScalingParam *wp1;
int refIdx0 = pu.refIdx[REF_PIC_LIST_0]; int refIdx0 = pu.refIdx[REF_PIC_LIST_0];
int refIdx1 = pu.refIdx[REF_PIC_LIST_1]; int refIdx1 = pu.refIdx[REF_PIC_LIST_1];
pu.cs->slice->getWpScaling(REF_PIC_LIST_0, refIdx0, wp0); pu.cu->slice->getWpScaling(REF_PIC_LIST_0, refIdx0, wp0);
pu.cs->slice->getWpScaling(REF_PIC_LIST_1, refIdx1, wp1); pu.cu->slice->getWpScaling(REF_PIC_LIST_1, refIdx1, wp1);
if (pu.cs->sps->getUseDMVR()) if (pu.cs->sps->getUseDMVR())
{ {
return pu.mergeFlag return pu.mergeFlag
&& pu.mergeType == MRG_TYPE_DEFAULT_N && pu.mergeType == MRG_TYPE_DEFAULT_N
#if JVET_O0108_DIS_DMVR_BDOF_CIIP
&& !pu.mhIntraFlag
#endif
&& !pu.cu->affine && !pu.cu->affine
&& !pu.mmvdMergeFlag && !pu.mmvdMergeFlag
&& !pu.cu->mmvdSkip && !pu.cu->mmvdSkip
......
...@@ -1180,10 +1180,14 @@ void CABACReader::intra_luma_pred_modes( CodingUnit &cu ) ...@@ -1180,10 +1180,14 @@ void CABACReader::intra_luma_pred_modes( CodingUnit &cu )
if( cu.bdpcmMode ) if( cu.bdpcmMode )
{ {
#if JVET_O0315_RDPCM_INTRAMODE_ALIGN
cu.firstPU->intraDir[0] = cu.bdpcmMode == 2? VER_IDX : HOR_IDX;
#else
PredictionUnit *pu = cu.firstPU; PredictionUnit *pu = cu.firstPU;
unsigned mpm_pred[NUM_MOST_PROBABLE_MODES]; unsigned mpm_pred[NUM_MOST_PROBABLE_MODES];
PU::getIntraMPMs(*pu, mpm_pred); PU::getIntraMPMs(*pu, mpm_pred);
cu.firstPU->intraDir[0] = mpm_pred[0]; cu.firstPU->intraDir[0] = mpm_pred[0];
#endif
return; return;
} }
......
...@@ -1207,6 +1207,9 @@ bool DecLib::xDecodeSlice(InputNALUnit &nalu, int &iSkipFrame, int iPOCLastDispl ...@@ -1207,6 +1207,9 @@ bool DecLib::xDecodeSlice(InputNALUnit &nalu, int &iSkipFrame, int iPOCLastDispl
} }
if (pcSlice->getSPS()->getUseSMVD() && pcSlice->getCheckLDC() == false if (pcSlice->getSPS()->getUseSMVD() && pcSlice->getCheckLDC() == false
#if JVET_O0284_CONDITION_SMVD_MVDL1ZEROFLAG
&& pcSlice->getMvdL1ZeroFlag() == false
#endif
) )
{ {
int currPOC = pcSlice->getPOC(); int currPOC = pcSlice->getPOC();
......
...@@ -184,7 +184,7 @@ void DecSlice::decompressSlice( Slice* slice, InputBitstream* bitstream, int deb ...@@ -184,7 +184,7 @@ void DecSlice::decompressSlice( Slice* slice, InputBitstream* bitstream, int deb
resetGbiCodingOrder(true, cs); resetGbiCodingOrder(true, cs);
} }
if ((cs.slice->getSliceType() != I_SLICE || cs.sps->getIBCFlag()) && ctuXPosInCtus == 0) if ((cs.slice->getSliceType() != I_SLICE || cs.sps->getIBCFlag()) && ctuXPosInCtus == tileXPosInCtus)
{ {
cs.motionLut.lut.resize(0); cs.motionLut.lut.resize(0);
cs.motionLut.lutIbc.resize(0); cs.motionLut.lutIbc.resize(0);
......
...@@ -1087,7 +1087,7 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS) ...@@ -1087,7 +1087,7 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS)
//Read candidate for List0 //Read candidate for List0
READ_UVLC(uiCode, "num_ref_pic_lists_in_sps[0]"); READ_UVLC(uiCode, "num_ref_pic_lists_in_sps[0]");
uint32_t numberOfRPL = uiCode; uint32_t numberOfRPL = uiCode;
pcSPS->createRPLList0(numberOfRPL + 1); pcSPS->createRPLList0(numberOfRPL);
RPLList* rplList = pcSPS->getRPLList0(); RPLList* rplList = pcSPS->getRPLList0();
ReferencePictureList* rpl; ReferencePictureList* rpl;
for (uint32_t ii = 0; ii < numberOfRPL; ii++) for (uint32_t ii = 0; ii < numberOfRPL; ii++)
...@@ -1101,7 +1101,7 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS) ...@@ -1101,7 +1101,7 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS)
{ {
READ_UVLC(uiCode, "num_ref_pic_lists_in_sps[1]"); READ_UVLC(uiCode, "num_ref_pic_lists_in_sps[1]");
numberOfRPL = uiCode; numberOfRPL = uiCode;
pcSPS->createRPLList1(numberOfRPL + 1); pcSPS->createRPLList1(numberOfRPL);
rplList = pcSPS->getRPLList1(); rplList = pcSPS->getRPLList1();
for (uint32_t ii = 0; ii < numberOfRPL; ii++) for (uint32_t ii = 0; ii < numberOfRPL; ii++)
{ {
...@@ -1216,9 +1216,9 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS) ...@@ -1216,9 +1216,9 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS)
READ_FLAG( uiCode, "sps_amvr_enabled_flag" ); pcSPS->setAMVREnabledFlag ( uiCode != 0 ); READ_FLAG( uiCode, "sps_amvr_enabled_flag" ); pcSPS->setAMVREnabledFlag ( uiCode != 0 );
READ_FLAG( uiCode, "sps_bdof_enabled_flag" ); pcSPS->setBDOFEnabledFlag ( uiCode != 0 ); READ_FLAG( uiCode, "sps_bdof_enabled_flag" ); pcSPS->setBDOFEnabledFlag ( uiCode != 0 );
#if !JVET_O0438_SPS_AFFINE_AMVR_FLAG
READ_FLAG( uiCode, "sps_affine_amvr_enabled_flag" ); pcSPS->setAffineAmvrEnabledFlag ( uiCode != 0 ); READ_FLAG( uiCode, "sps_affine_amvr_enabled_flag" ); pcSPS->setAffineAmvrEnabledFlag ( uiCode != 0 );
#endif
READ_FLAG(uiCode, "sps_dmvr_enable_flag"); pcSPS->setUseDMVR(uiCode != 0); READ_FLAG(uiCode, "sps_dmvr_enable_flag"); pcSPS->setUseDMVR(uiCode != 0);
READ_FLAG(uiCode, "sps_mmvd_enable_flag"); pcSPS->setUseMMVD(uiCode != 0); READ_FLAG(uiCode, "sps_mmvd_enable_flag"); pcSPS->setUseMMVD(uiCode != 0);
// KJS: sps_cclm_enabled_flag // KJS: sps_cclm_enabled_flag
...@@ -1241,6 +1241,9 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS) ...@@ -1241,6 +1241,9 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS)
if ( pcSPS->getUseAffine() ) if ( pcSPS->getUseAffine() )
{ {
READ_FLAG( uiCode, "affine_type_flag" ); pcSPS->setUseAffineType ( uiCode != 0 ); READ_FLAG( uiCode, "affine_type_flag" ); pcSPS->setUseAffineType ( uiCode != 0 );
#if JVET_O0438_SPS_AFFINE_AMVR_FLAG
READ_FLAG( uiCode, "sps_affine_amvr_enabled_flag" ); pcSPS->setAffineAmvrEnabledFlag ( uiCode != 0 );
#endif
} }
READ_FLAG( uiCode, "gbi_flag" ); pcSPS->setUseGBi ( uiCode != 0 ); READ_FLAG( uiCode, "gbi_flag" ); pcSPS->setUseGBi ( uiCode != 0 );
READ_FLAG(uiCode, "ibc_flag"); pcSPS->setIBCFlag(uiCode); READ_FLAG(uiCode, "ibc_flag"); pcSPS->setIBCFlag(uiCode);
......
...@@ -969,10 +969,14 @@ void CABACWriter::intra_luma_pred_modes( const CodingUnit& cu ) ...@@ -969,10 +969,14 @@ void CABACWriter::intra_luma_pred_modes( const CodingUnit& cu )
if( cu.bdpcmMode ) if( cu.bdpcmMode )
{ {
#if JVET_O0315_RDPCM_INTRAMODE_ALIGN
cu.firstPU->intraDir[0] = cu.bdpcmMode == 2? VER_IDX : HOR_IDX;
#else
PredictionUnit *pu = cu.firstPU; PredictionUnit *pu = cu.firstPU;
unsigned mpm_pred[NUM_MOST_PROBABLE_MODES]; unsigned mpm_pred[NUM_MOST_PROBABLE_MODES];
PU::getIntraMPMs( *pu, mpm_pred ); PU::getIntraMPMs( *pu, mpm_pred );
cu.firstPU->intraDir[0] = mpm_pred[0]; cu.firstPU->intraDir[0] = mpm_pred[0];
#endif
return; return;
} }
......
...@@ -130,6 +130,9 @@ void EncCu::create( EncCfg* encCfg ) ...@@ -130,6 +130,9 @@ void EncCu::create( EncCfg* encCfg )
for (unsigned ui = 0; ui < MRG_MAX_NUM_CANDS; ui++) for (unsigned ui = 0; ui < MRG_MAX_NUM_CANDS; ui++)
{ {
m_acRealMergeBuffer[ui].create(chromaFormat, Area(0, 0, uiMaxWidth, uiMaxHeight)); m_acRealMergeBuffer[ui].create(chromaFormat, Area(0, 0, uiMaxWidth, uiMaxHeight));
#if JVET_O0108_DIS_DMVR_BDOF_CIIP
m_acMergeTmpBuffer[ui].create(chromaFormat, Area(0, 0, uiMaxWidth, uiMaxHeight));
#endif
} }
const unsigned maxNumTriangleCand = encCfg->getMaxNumTriangleCand(); const unsigned maxNumTriangleCand = encCfg->getMaxNumTriangleCand();
for (unsigned i = 0; i < maxNumTriangleCand; i++) for (unsigned i = 0; i < maxNumTriangleCand; i++)
...@@ -218,6 +221,9 @@ void EncCu::destroy() ...@@ -218,6 +221,9 @@ void EncCu::destroy()
for (unsigned ui = 0; ui < MRG_MAX_NUM_CANDS; ui++) for (unsigned ui = 0; ui < MRG_MAX_NUM_CANDS; ui++)
{ {
m_acRealMergeBuffer[ui].destroy(); m_acRealMergeBuffer[ui].destroy();
#if JVET_O0108_DIS_DMVR_BDOF_CIIP
m_acMergeTmpBuffer[ui].destroy();
#endif
} }
for( unsigned ui = 0; ui < TRIANGLE_MAX_NUM_CANDS; ui++ ) for( unsigned ui = 0; ui < TRIANGLE_MAX_NUM_CANDS; ui++ )
{ {
...@@ -266,6 +272,9 @@ void EncCu::init( EncLib* pcEncLib, const SPS& sps PARL_PARAM( const int tId ) ) ...@@ -266,6 +272,9 @@ void EncCu::init( EncLib* pcEncLib, const SPS& sps PARL_PARAM( const int tId ) )
m_modeCtrl->init( m_pcEncCfg, m_pcRateCtrl, m_pcRdCost ); m_modeCtrl->init( m_pcEncCfg, m_pcRateCtrl, m_pcRdCost );
m_pcInterSearch->setModeCtrl( m_modeCtrl ); m_pcInterSearch->setModeCtrl( m_modeCtrl );
#if JVET_O0592_ENC_ME_IMP
m_modeCtrl->setInterSearch(m_pcInterSearch);
#endif
m_pcIntraSearch->setModeCtrl( m_modeCtrl ); m_pcIntraSearch->setModeCtrl( m_modeCtrl );
if ( ( m_pcEncCfg->getIBCHashSearch() && m_pcEncCfg->getIBCMode() ) || m_pcEncCfg->getAllowDisFracMMVD() ) if ( ( m_pcEncCfg->getIBCHashSearch() && m_pcEncCfg->getIBCMode() ) || m_pcEncCfg->getAllowDisFracMMVD() )
...@@ -1188,6 +1197,14 @@ void EncCu::xCheckModeSplit(CodingStructure *&tempCS, CodingStructure *&bestCS, ...@@ -1188,6 +1197,14 @@ void EncCu::xCheckModeSplit(CodingStructure *&tempCS, CodingStructure *&bestCS,
AffineMVInfo tmpMVInfo; AffineMVInfo tmpMVInfo;
bool isAffMVInfoSaved; bool isAffMVInfoSaved;
m_pcInterSearch->savePrevAffMVInfo(0, tmpMVInfo, isAffMVInfoSaved); m_pcInterSearch->savePrevAffMVInfo(0, tmpMVInfo, isAffMVInfoSaved);
#if JVET_O0592_ENC_ME_IMP
BlkUniMvInfo tmpUniMvInfo;
bool isUniMvInfoSaved = false;
if (!tempCS->slice->isIntra())
{
m_pcInterSearch->savePrevUniMvInfo(tempCS->area.Y(), tmpUniMvInfo, isUniMvInfoSaved);
}
#endif
do do
{ {
...@@ -1319,6 +1336,12 @@ void EncCu::xCheckModeSplit(CodingStructure *&tempCS, CodingStructure *&bestCS, ...@@ -1319,6 +1336,12 @@ void EncCu::xCheckModeSplit(CodingStructure *&tempCS, CodingStructure *&bestCS,
if (isAffMVInfoSaved) if (isAffMVInfoSaved)
m_pcInterSearch->addAffMVInfo(tmpMVInfo); m_pcInterSearch->addAffMVInfo(tmpMVInfo);
#if JVET_O0592_ENC_ME_IMP
if (!tempCS->slice->isIntra() && isUniMvInfoSaved)
{
m_pcInterSearch->addUniMvInfo(tmpUniMvInfo);
}
#endif
tempCS->motionLut = oldMotionLut; tempCS->motionLut = oldMotionLut;
...@@ -1864,6 +1887,9 @@ void EncCu::xCheckRDCostMerge2Nx2N( CodingStructure *&tempCS, CodingStructure *& ...@@ -1864,6 +1887,9 @@ void EncCu::xCheckRDCostMerge2Nx2N( CodingStructure *&tempCS, CodingStructure *&
bool bestIsSkip = false; bool bestIsSkip = false;
bool bestIsMMVDSkip = true; bool bestIsMMVDSkip = true;
PelUnitBuf acMergeBuffer[MRG_MAX_NUM_CANDS]; PelUnitBuf acMergeBuffer[MRG_MAX_NUM_CANDS];
#if JVET_O0108_DIS_DMVR_BDOF_CIIP
PelUnitBuf acMergeTmpBuffer[MRG_MAX_NUM_CANDS];
#endif
PelUnitBuf acMergeRealBuffer[MMVD_MRG_MAX_RD_BUF_NUM]; PelUnitBuf acMergeRealBuffer[MMVD_MRG_MAX_RD_BUF_NUM];
PelUnitBuf * acMergeTempBuffer[MMVD_MRG_MAX_RD_NUM]; PelUnitBuf * acMergeTempBuffer[MMVD_MRG_MAX_RD_NUM];
PelUnitBuf * singleMergeTempBuffer; PelUnitBuf * singleMergeTempBuffer;
...@@ -1985,7 +2011,12 @@ void EncCu::xCheckRDCostMerge2Nx2N( CodingStructure *&tempCS, CodingStructure *& ...@@ -1985,7 +2011,12 @@ void EncCu::xCheckRDCostMerge2Nx2N( CodingStructure *&tempCS, CodingStructure *&
PU::spanMotionInfo( pu, mergeCtx ); PU::spanMotionInfo( pu, mergeCtx );
pu.mvRefine = true; pu.mvRefine = true;
distParam.cur = singleMergeTempBuffer->Y(); distParam.cur = singleMergeTempBuffer->Y();
#if JVET_O0108_DIS_DMVR_BDOF_CIIP
acMergeTmpBuffer[uiMergeCand] = m_acMergeTmpBuffer[uiMergeCand].getBuf(localUnitArea);
m_pcInterSearch->motionCompensation(pu, *singleMergeTempBuffer, REF_PIC_LIST_X, true, true, &(acMergeTmpBuffer[uiMergeCand]));
#else
m_pcInterSearch->motionCompensation(pu, *singleMergeTempBuffer); m_pcInterSearch->motionCompensation(pu, *singleMergeTempBuffer);
#endif
acMergeBuffer[uiMergeCand] = m_acRealMergeBuffer[uiMergeCand].getBuf(localUnitArea); acMergeBuffer[uiMergeCand] = m_acRealMergeBuffer[uiMergeCand].getBuf(localUnitArea);
acMergeBuffer[uiMergeCand].copyFrom(*singleMergeTempBuffer); acMergeBuffer[uiMergeCand].copyFrom(*singleMergeTempBuffer);
pu.mvRefine = false; pu.mvRefine = false;
...@@ -2049,7 +2080,11 @@ void EncCu::xCheckRDCostMerge2Nx2N( CodingStructure *&tempCS, CodingStructure *& ...@@ -2049,7 +2080,11 @@ void EncCu::xCheckRDCostMerge2Nx2N( CodingStructure *&tempCS, CodingStructure *&
for (uint32_t mergeCnt = 0; mergeCnt < std::min(std::min(NUM_MRG_SATD_CAND, (const int)mergeCtx.numValidMergeCand), 4); mergeCnt++) for (uint32_t mergeCnt = 0; mergeCnt < std::min(std::min(NUM_MRG_SATD_CAND, (const int)mergeCtx.numValidMergeCand), 4); mergeCnt++)
{ {
uint32_t mergeCand = MHIntraMergeCand[mergeCnt]; uint32_t mergeCand = MHIntraMergeCand[mergeCnt];
#if JVET_O0108_DIS_DMVR_BDOF_CIIP
acMergeTmpBuffer[mergeCand] = m_acMergeTmpBuffer[mergeCand].getBuf(localUnitArea);
#else
acMergeBuffer[mergeCand] = m_acRealMergeBuffer[mergeCand].getBuf(localUnitArea); acMergeBuffer[mergeCand] = m_acRealMergeBuffer[mergeCand].getBuf(localUnitArea);
#endif
// estimate merge bits // estimate merge bits
mergeCtx.setMergeInfo(pu, mergeCand); mergeCtx.setMergeInfo(pu, mergeCand);
...@@ -2064,7 +2099,11 @@ void EncCu::xCheckRDCostMerge2Nx2N( CodingStructure *&tempCS, CodingStructure *& ...@@ -2064,7 +2099,11 @@ void EncCu::xCheckRDCostMerge2Nx2N( CodingStructure *&tempCS, CodingStructure *&
m_pcIntraSearch->predIntraAng(COMPONENT_Y, pu.cs->getPredBuf(pu).Y(), pu); m_pcIntraSearch->predIntraAng(COMPONENT_Y, pu.cs->getPredBuf(pu).Y(), pu);
m_pcIntraSearch->switchBuffer(pu, COMPONENT_Y, pu.cs->getPredBuf(pu).Y(), m_pcIntraSearch->getPredictorPtr2(COMPONENT_Y, intraCnt)); m_pcIntraSearch->switchBuffer(pu, COMPONENT_Y, pu.cs->getPredBuf(pu).Y(), m_pcIntraSearch->getPredictorPtr2(COMPONENT_Y, intraCnt));
} }
#if JVET_O0108_DIS_DMVR_BDOF_CIIP
pu.cs->getPredBuf(pu).copyFrom(acMergeTmpBuffer[mergeCand]);
#else
pu.cs->getPredBuf(pu).copyFrom(acMergeBuffer[mergeCand]); pu.cs->getPredBuf(pu).copyFrom(acMergeBuffer[mergeCand]);
#endif
if (pu.cs->slice->getLmcsEnabledFlag() && m_pcReshape->getCTUFlag()) if (pu.cs->slice->getLmcsEnabledFlag() && m_pcReshape->getCTUFlag())
{ {
pu.cs->getPredBuf(pu).Y().rspSignal(m_pcReshape->getFwdLUT()); pu.cs->getPredBuf(pu).Y().rspSignal(m_pcReshape->getFwdLUT());
...@@ -2287,17 +2326,29 @@ void EncCu::xCheckRDCostMerge2Nx2N( CodingStructure *&tempCS, CodingStructure *& ...@@ -2287,17 +2326,29 @@ void EncCu::xCheckRDCostMerge2Nx2N( CodingStructure *&tempCS, CodingStructure *&
{ {
uint32_t bufIdx = 0; uint32_t bufIdx = 0;
PelBuf tmpBuf = tempCS->getPredBuf(pu).Y(); PelBuf tmpBuf = tempCS->getPredBuf(pu).Y();
#if JVET_O0108_DIS_DMVR_BDOF_CIIP
tmpBuf.copyFrom(acMergeTmpBuffer[uiMergeCand].Y());
#else
tmpBuf.copyFrom(acMergeBuffer[uiMergeCand].Y()); tmpBuf.copyFrom(acMergeBuffer[uiMergeCand].Y());
#endif
if (pu.cs->slice->getLmcsEnabledFlag() && m_pcReshape->getCTUFlag()) if (pu.cs->slice->getLmcsEnabledFlag() && m_pcReshape->getCTUFlag())
{ {
tmpBuf.rspSignal(m_pcReshape->getFwdLUT()); tmpBuf.rspSignal(m_pcReshape->getFwdLUT());
} }
m_pcIntraSearch->geneWeightedPred(COMPONENT_Y, tmpBuf, pu, m_pcIntraSearch->getPredictorPtr2(COMPONENT_Y, bufIdx)); m_pcIntraSearch->geneWeightedPred(COMPONENT_Y, tmpBuf, pu, m_pcIntraSearch->getPredictorPtr2(COMPONENT_Y, bufIdx));
tmpBuf = tempCS->getPredBuf(pu).Cb(); tmpBuf = tempCS->getPredBuf(pu).Cb();
#if JVET_O0108_DIS_DMVR_BDOF_CIIP
tmpBuf.copyFrom(acMergeTmpBuffer[uiMergeCand].Cb());
#else
tmpBuf.copyFrom(acMergeBuffer[uiMergeCand].Cb()); tmpBuf.copyFrom(acMergeBuffer[uiMergeCand].Cb());
#endif
m_pcIntraSearch->geneWeightedPred(COMPONENT_Cb, tmpBuf, pu, m_pcIntraSearch->getPredictorPtr2(COMPONENT_Cb, bufIdx)); m_pcIntraSearch->geneWeightedPred(COMPONENT_Cb, tmpBuf, pu, m_pcIntraSearch->getPredictorPtr2(COMPONENT_Cb, bufIdx));
tmpBuf = tempCS->getPredBuf(pu).Cr(); tmpBuf = tempCS->getPredBuf(pu).Cr();
#if JVET_O0108_DIS_DMVR_BDOF_CIIP
tmpBuf.copyFrom(acMergeTmpBuffer[uiMergeCand].Cr());
#else
tmpBuf.copyFrom(acMergeBuffer[uiMergeCand].Cr()); tmpBuf.copyFrom(acMergeBuffer[uiMergeCand].Cr());
#endif
m_pcIntraSearch->geneWeightedPred(COMPONENT_Cr, tmpBuf, pu, m_pcIntraSearch->getPredictorPtr2(COMPONENT_Cr, bufIdx)); m_pcIntraSearch->geneWeightedPred(COMPONENT_Cr, tmpBuf, pu, m_pcIntraSearch->getPredictorPtr2(COMPONENT_Cr, bufIdx));
} }
else else
......
...@@ -123,6 +123,9 @@ private: ...@@ -123,6 +123,9 @@ private:
PelStorage m_acMergeBuffer[MMVD_MRG_MAX_RD_BUF_NUM]; PelStorage m_acMergeBuffer[MMVD_MRG_MAX_RD_BUF_NUM];
PelStorage m_acRealMergeBuffer[MRG_MAX_NUM_CANDS]; PelStorage m_acRealMergeBuffer[MRG_MAX_NUM_CANDS];
#if JVET_O0108_DIS_DMVR_BDOF_CIIP
PelStorage m_acMergeTmpBuffer[MRG_MAX_NUM_CANDS];
#endif
PelStorage m_acTriangleWeightedBuffer[TRIANGLE_MAX_NUM_CANDS]; // to store weighted prediction pixles PelStorage m_acTriangleWeightedBuffer[TRIANGLE_MAX_NUM_CANDS]; // to store weighted prediction pixles
double m_mergeBestSATDCost; double m_mergeBestSATDCost;
MotionInfo m_SubPuMiBuf [( MAX_CU_SIZE * MAX_CU_SIZE ) >> ( MIN_CU_LOG2 << 1 )]; MotionInfo m_SubPuMiBuf [( MAX_CU_SIZE * MAX_CU_SIZE ) >> ( MIN_CU_LOG2 << 1 )];
......
...@@ -1804,6 +1804,9 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic, ...@@ -1804,6 +1804,9 @@ void EncGOP::compressGOP( int iPOCLast, int iNumPicRcvd, PicList& rcListPic,
} }
if ( pcSlice->getSPS()->getUseSMVD() && pcSlice->getCheckLDC() == false if ( pcSlice->getSPS()->getUseSMVD() && pcSlice->getCheckLDC() == false
#if JVET_O0284_CONDITION_SMVD_MVDL1ZEROFLAG
&& pcSlice->getMvdL1ZeroFlag() == false
#endif
) )
{ {
int currPOC = pcSlice->getPOC(); int currPOC = pcSlice->getPOC();
......
...@@ -1291,8 +1291,8 @@ void EncLib::xInitRPL(SPS &sps, bool isFieldCoding) ...@@ -1291,8 +1291,8 @@ void EncLib::xInitRPL(SPS &sps, bool isFieldCoding)
ReferencePictureList* rpl; ReferencePictureList* rpl;
int numRPLCandidates = getRPLCandidateSize(0); int numRPLCandidates = getRPLCandidateSize(0);
sps.createRPLList0(numRPLCandidates + 1); sps.createRPLList0(numRPLCandidates);
sps.createRPLList1(numRPLCandidates + 1); sps.createRPLList1(numRPLCandidates);
RPLList* rplList = 0; RPLList* rplList = 0;
for (int i = 0; i < 2; i++) for (int i = 0; i < 2; i++)
...@@ -1317,7 +1317,7 @@ void EncLib::xInitRPL(SPS &sps, bool isFieldCoding) ...@@ -1317,7 +1317,7 @@ void EncLib::xInitRPL(SPS &sps, bool isFieldCoding)
//Check RPLL0 first //Check RPLL0 first
const RPLList* rplList0 = sps.getRPLList0(); const RPLList* rplList0 = sps.getRPLList0();
const RPLList* rplList1 = sps.getRPLList1(); const RPLList* rplList1 = sps.getRPLList1();
uint32_t numberOfRPL = sps.getNumRPL0() - 1; uint32_t numberOfRPL = sps.getNumRPL0();
bool isAllEntriesinRPLHasSameSignFlag = true; bool isAllEntriesinRPLHasSameSignFlag = true;
bool isFirstEntry = true; bool isFirstEntry = true;
...@@ -1339,7 +1339,7 @@ void EncLib::xInitRPL(SPS &sps, bool isFieldCoding) ...@@ -1339,7 +1339,7 @@ void EncLib::xInitRPL(SPS &sps, bool isFieldCoding)
} }
} }
//Check RPLL1. Skip it if it is already found out that this flag is not true for RPL0 or if RPL1 is the same as RPL0 //Check RPLL1. Skip it if it is already found out that this flag is not true for RPL0 or if RPL1 is the same as RPL0
numberOfRPL = sps.getNumRPL1() - 1; numberOfRPL = sps.getNumRPL1();
isFirstEntry = true; isFirstEntry = true;
lastSign = true; lastSign = true;
for (uint32_t ii = 0; isAllEntriesinRPLHasSameSignFlag && !sps.getRPL1CopyFromRPL0Flag() && ii < numberOfRPL; ii++) for (uint32_t ii = 0; isAllEntriesinRPLHasSameSignFlag && !sps.getRPL1CopyFromRPL0Flag() && ii < numberOfRPL; ii++)
......
...@@ -1795,6 +1795,18 @@ bool EncModeCtrlMTnoRQT::tryMode( const EncTestMode& encTestmode, const CodingSt ...@@ -1795,6 +1795,18 @@ bool EncModeCtrlMTnoRQT::tryMode( const EncTestMode& encTestmode, const CodingSt
{ {
CHECK( encTestmode.type != ETM_POST_DONT_SPLIT, "Unknown mode" ); CHECK( encTestmode.type != ETM_POST_DONT_SPLIT, "Unknown mode" );
#if JVET_O0592_ENC_ME_IMP
if ((cuECtx.get<double>(BEST_NO_IMV_COST) == (MAX_DOUBLE * .5) || cuECtx.get<bool>(IS_REUSING_CU)) && !slice.isIntra())
{
unsigned idx1, idx2, idx3, idx4;
getAreaIdx(partitioner.currArea().Y(), *slice.getPPS()->pcv, idx1, idx2, idx3, idx4);
if (g_isReusedUniMVsFilled[idx1][idx2][idx3][idx4])
{
m_pcInterSearch->insertUniMvCands(partitioner.currArea().Y(), g_reusedUniMVs[idx1][idx2][idx3][idx4]);
}
}
#endif
if( !bestCS || ( bestCS && isModeSplit( bestMode ) ) ) if( !bestCS || ( bestCS && isModeSplit( bestMode ) ) )
{ {
return false; return false;
......
...@@ -43,6 +43,9 @@ ...@@ -43,6 +43,9 @@
#include "CommonLib/CommonDef.h" #include "CommonLib/CommonDef.h"
#include "CommonLib/CodingStructure.h" #include "CommonLib/CodingStructure.h"
#if JVET_O0592_ENC_ME_IMP
#include "InterSearch.h"
#endif
#include <typeinfo> #include <typeinfo>
#include <vector> #include <vector>
...@@ -258,6 +261,9 @@ protected: ...@@ -258,6 +261,9 @@ protected:
#if ENABLE_SPLIT_PARALLELISM #if ENABLE_SPLIT_PARALLELISM
int m_runNextInParallel; int m_runNextInParallel;
#endif #endif
#if JVET_O0592_ENC_ME_IMP
InterSearch* m_pcInterSearch;
#endif
public: public:
...@@ -315,6 +321,9 @@ public: ...@@ -315,6 +321,9 @@ public:
void setBestCostWithoutSplitFlags ( double cost ) { m_ComprCUCtxList.back().bestCostWithoutSplitFlags = cost; } void setBestCostWithoutSplitFlags ( double cost ) { m_ComprCUCtxList.back().bestCostWithoutSplitFlags = cost; }
double getMtsFirstPassNoIspCost () const { return m_ComprCUCtxList.back().bestCostMtsFirstPassNoIsp; } double getMtsFirstPassNoIspCost () const { return m_ComprCUCtxList.back().bestCostMtsFirstPassNoIsp; }
void setMtsFirstPassNoIspCost ( double cost ) { m_ComprCUCtxList.back().bestCostMtsFirstPassNoIsp = cost; } void setMtsFirstPassNoIspCost ( double cost ) { m_ComprCUCtxList.back().bestCostMtsFirstPassNoIsp = cost; }
#if JVET_O0592_ENC_ME_IMP
void setInterSearch (InterSearch* pcInterSearch) { m_pcInterSearch = pcInterSearch; }
#endif
protected: protected:
void xExtractFeatures ( const EncTestMode encTestmode, CodingStructure& cs ); void xExtractFeatures ( const EncTestMode encTestmode, CodingStructure& cs );
......
...@@ -1415,6 +1415,9 @@ void EncSlice::compressSlice( Picture* pcPic, const bool bCompressEntireSlice, c ...@@ -1415,6 +1415,9 @@ void EncSlice::compressSlice( Picture* pcPic, const bool bCompressEntireSlice, c
writeBlockStatisticsHeader(sps); writeBlockStatisticsHeader(sps);
#endif #endif
m_pcInterSearch->resetAffineMVList(); m_pcInterSearch->resetAffineMVList();
#if JVET_O0592_ENC_ME_IMP
m_pcInterSearch->resetUniMvList();
#endif
encodeCtus( pcPic, bCompressEntireSlice, bFastDeltaQP, startCtuTsAddr, boundingCtuTsAddr, m_pcLib ); encodeCtus( pcPic, bCompressEntireSlice, bFastDeltaQP, startCtuTsAddr, boundingCtuTsAddr, m_pcLib );
...@@ -1578,7 +1581,7 @@ void EncSlice::encodeCtus( Picture* pcPic, const bool bCompressEntireSlice, cons ...@@ -1578,7 +1581,7 @@ void EncSlice::encodeCtus( Picture* pcPic, const bool bCompressEntireSlice, cons
DTRACE_UPDATE( g_trace_ctx, std::make_pair( "ctu", ctuRsAddr ) ); DTRACE_UPDATE( g_trace_ctx, std::make_pair( "ctu", ctuRsAddr ) );
if( pCfg->getSwitchPOC() != pcPic->poc || -1 == pCfg->getDebugCTU() ) if( pCfg->getSwitchPOC() != pcPic->poc || -1 == pCfg->getDebugCTU() )
if ((cs.slice->getSliceType() != I_SLICE || cs.sps->getIBCFlag()) && ctuXPosInCtus == 0) if ((cs.slice->getSliceType() != I_SLICE || cs.sps->getIBCFlag()) && ctuXPosInCtus == tileXPosInCtus)
{ {
cs.motionLut.lut.resize(0); cs.motionLut.lut.resize(0);
cs.motionLut.lutIbc.resize(0); cs.motionLut.lutIbc.resize(0);
......
This diff is collapsed.
...@@ -78,6 +78,14 @@ struct AffineMVInfo ...@@ -78,6 +78,14 @@ struct AffineMVInfo
int x, y, w, h; int x, y, w, h;
}; };
#if JVET_O0592_ENC_ME_IMP
struct BlkUniMvInfo
{
Mv uniMvs[2][33];
int x, y, w, h;
};
#endif
typedef struct typedef struct
{ {
Mv acMvAffine4Para[2][3]; Mv acMvAffine4Para[2][3];
...@@ -116,6 +124,12 @@ private: ...@@ -116,6 +124,12 @@ private:
int m_affMVListIdx; int m_affMVListIdx;
int m_affMVListSize; int m_affMVListSize;
int m_affMVListMaxSize; int m_affMVListMaxSize;
#if JVET_O0592_ENC_ME_IMP
BlkUniMvInfo* m_uniMvList;
int m_uniMvListIdx;
int m_uniMvListSize;
int m_uniMvListMaxSize;
#endif
Distortion m_hevcCost; Distortion m_hevcCost;
EncAffineMotion m_affineMotion; EncAffineMotion m_affineMotion;
PatentBvCand m_defaultCachedBvs; PatentBvCand m_defaultCachedBvs;
...@@ -232,6 +246,80 @@ public: ...@@ -232,6 +246,80 @@ public:
m_affMVListSize = std::min(m_affMVListSize + 1, m_affMVListMaxSize); m_affMVListSize = std::min(m_affMVListSize + 1, m_affMVListMaxSize);
} }
} }
#if JVET_O0592_ENC_ME_IMP
void resetUniMvList() { m_uniMvListIdx = 0; m_uniMvListSize = 0; }
void insertUniMvCands(CompArea blkArea, Mv cMvTemp[2][33])
{
BlkUniMvInfo* curMvInfo = m_uniMvList + m_uniMvListIdx;
int j = 0;
for (; j < m_uniMvListSize; j++)
{
BlkUniMvInfo* prevMvInfo = m_uniMvList + ((m_uniMvListIdx - 1 - j + m_uniMvListMaxSize) % (m_uniMvListMaxSize));
if ((blkArea.x == prevMvInfo->x) && (blkArea.y == prevMvInfo->y) && (blkArea.width == prevMvInfo->w) && (blkArea.height == prevMvInfo->h))
{
break;
}
}
if (j < m_uniMvListSize)
{
curMvInfo = m_uniMvList + ((m_uniMvListIdx - 1 - j + m_uniMvListMaxSize) % (m_uniMvListMaxSize));
}
::memcpy(curMvInfo->uniMvs, cMvTemp, 2 * 33 * sizeof(Mv));
if (j == m_uniMvListSize) // new element
{
curMvInfo->x = blkArea.x;
curMvInfo->y = blkArea.y;
curMvInfo->w = blkArea.width;
curMvInfo->h = blkArea.height;
m_uniMvListSize = std::min(m_uniMvListSize + 1, m_uniMvListMaxSize);
m_uniMvListIdx = (m_uniMvListIdx + 1) % (m_uniMvListMaxSize);
}
}
void savePrevUniMvInfo(CompArea blkArea, BlkUniMvInfo &tmpUniMvInfo, bool& isUniMvInfoSaved)
{
int j = 0;
BlkUniMvInfo* curUniMvInfo = nullptr;
for (; j < m_uniMvListSize; j++)
{
curUniMvInfo = m_uniMvList + ((m_uniMvListIdx - 1 - j + m_uniMvListMaxSize) % (m_uniMvListMaxSize));
if ((blkArea.x == curUniMvInfo->x) && (blkArea.y == curUniMvInfo->y) && (blkArea.width == curUniMvInfo->w) && (blkArea.height == curUniMvInfo->h))
{
break;
}
}
if (j < m_uniMvListSize)
{
isUniMvInfoSaved = true;
tmpUniMvInfo = *curUniMvInfo;
}
}
void addUniMvInfo(BlkUniMvInfo &tmpUniMVInfo)
{
int j = 0;
BlkUniMvInfo* prevUniMvInfo = nullptr;
for (; j < m_uniMvListSize; j++)
{
prevUniMvInfo = m_uniMvList + ((m_uniMvListIdx - 1 - j + m_uniMvListMaxSize) % (m_uniMvListMaxSize));
if ((tmpUniMVInfo.x == prevUniMvInfo->x) && (tmpUniMVInfo.y == prevUniMvInfo->y) && (tmpUniMVInfo.w == prevUniMvInfo->w) && (tmpUniMVInfo.h == prevUniMvInfo->h))
{
break;
}
}
if (j < m_uniMvListSize)
{
*prevUniMvInfo = tmpUniMVInfo;
}
else
{
m_uniMvList[m_uniMvListIdx] = tmpUniMVInfo;
m_uniMvListIdx = (m_uniMvListIdx + 1) % m_uniMvListMaxSize;
m_uniMvListSize = std::min(m_uniMvListSize + 1, m_uniMvListMaxSize);
}
}
#endif
void resetSavedAffineMotion(); void resetSavedAffineMotion();
void storeAffineMotion( Mv acAffineMv[2][3], int16_t affineRefIdx[2], EAffineModel affineType, int gbiIdx ); void storeAffineMotion( Mv acAffineMv[2][3], int16_t affineRefIdx[2], EAffineModel affineType, int gbiIdx );
protected: protected:
...@@ -364,6 +452,10 @@ protected: ...@@ -364,6 +452,10 @@ protected:
); );
void xTZSearch ( const PredictionUnit& pu, void xTZSearch ( const PredictionUnit& pu,
#if JVET_O0592_ENC_ME_IMP
RefPicList eRefPicList,
int iRefIdxPred,
#endif
IntTZSearchStruct& cStruct, IntTZSearchStruct& cStruct,
Mv& rcMv, Mv& rcMv,
Distortion& ruiSAD, Distortion& ruiSAD,
...@@ -373,6 +465,10 @@ protected: ...@@ -373,6 +465,10 @@ protected:
); );
void xTZSearchSelective ( const PredictionUnit& pu, void xTZSearchSelective ( const PredictionUnit& pu,
#if JVET_O0592_ENC_ME_IMP
RefPicList eRefPicList,
int iRefIdxPred,
#endif
IntTZSearchStruct& cStruct, IntTZSearchStruct& cStruct,
Mv& rcMv, Mv& rcMv,
Distortion& ruiSAD, Distortion& ruiSAD,
...@@ -387,6 +483,10 @@ protected: ...@@ -387,6 +483,10 @@ protected:
); );
void xPatternSearchFast ( const PredictionUnit& pu, void xPatternSearchFast ( const PredictionUnit& pu,
#if JVET_O0592_ENC_ME_IMP
RefPicList eRefPicList,
int iRefIdxPred,
#endif
IntTZSearchStruct& cStruct, IntTZSearchStruct& cStruct,
Mv& rcMv, Mv& rcMv,
Distortion& ruiSAD, Distortion& ruiSAD,
......
...@@ -962,9 +962,13 @@ bool IntraSearch::estIntraPredLumaQT( CodingUnit &cu, Partitioner &partitioner, ...@@ -962,9 +962,13 @@ bool IntraSearch::estIntraPredLumaQT( CodingUnit &cu, Partitioner &partitioner,
{ {
cu.bdpcmMode = -mode; cu.bdpcmMode = -mode;
#if JVET_O0315_RDPCM_INTRAMODE_ALIGN
uiOrgMode = ModeInfo(false, 0, NOT_INTRA_SUBPARTITIONS, cu.bdpcmMode == 2 ? VER_IDX : HOR_IDX);
#else
unsigned mpm_pred[NUM_MOST_PROBABLE_MODES]; unsigned mpm_pred[NUM_MOST_PROBABLE_MODES];
PU::getIntraMPMs(pu, mpm_pred); PU::getIntraMPMs(pu, mpm_pred);
uiOrgMode = ModeInfo(false, 0, NOT_INTRA_SUBPARTITIONS, mpm_pred[0]); uiOrgMode = ModeInfo(false, 0, NOT_INTRA_SUBPARTITIONS, mpm_pred[0]);
#endif
cu.mipFlag = uiOrgMode.mipFlg; cu.mipFlag = uiOrgMode.mipFlg;
cu.ispMode = uiOrgMode.ispMod; cu.ispMode = uiOrgMode.ispMod;
pu.multiRefIdx = uiOrgMode.mRefId; pu.multiRefIdx = uiOrgMode.mRefId;
...@@ -2781,11 +2785,15 @@ ChromaCbfs IntraSearch::xRecurIntraChromaCodingQT( CodingStructure &cs, Partitio ...@@ -2781,11 +2785,15 @@ ChromaCbfs IntraSearch::xRecurIntraChromaCodingQT( CodingStructure &cs, Partitio
if( doReshaping ) if( doReshaping )
{ {
const Area area = currTU.Y().valid() ? currTU.Y() : Area(recalcPosition(currTU.chromaFormat, currTU.chType, CHANNEL_TYPE_LUMA, currTU.blocks[currTU.chType].pos()), recalcSize(currTU.chromaFormat, currTU.chType, CHANNEL_TYPE_LUMA, currTU.blocks[currTU.chType].size())); const Area area = currTU.Y().valid() ? currTU.Y() : Area(recalcPosition(currTU.chromaFormat, currTU.chType, CHANNEL_TYPE_LUMA, currTU.blocks[currTU.chType].pos()), recalcSize(currTU.chromaFormat, currTU.chType, CHANNEL_TYPE_LUMA, currTU.blocks[currTU.chType].size()));
const CompArea &areaY = CompArea(COMPONENT_Y, currTU.chromaFormat, area ); const CompArea &areaY = CompArea(COMPONENT_Y, currTU.chromaFormat, area);
#if JVET_O1109_UNFIY_CRS
int adj = m_pcReshape->calculateChromaAdjVpduNei(currTU, areaY);
#else
PelBuf piPredY; PelBuf piPredY;
piPredY = cs.picture->getPredBuf(areaY); piPredY = cs.picture->getPredBuf(areaY);
const Pel avgLuma = piPredY.computeAvg(); const Pel avgLuma = piPredY.computeAvg();
int adj = m_pcReshape->calculateChromaAdj(avgLuma); int adj = m_pcReshape->calculateChromaAdj(avgLuma);
#endif
currTU.setChromaAdj(adj); currTU.setChromaAdj(adj);
} }
......
...@@ -722,10 +722,9 @@ void HLSWriter::codeSPS( const SPS* pcSPS ) ...@@ -722,10 +722,9 @@ void HLSWriter::codeSPS( const SPS* pcSPS )
const RPLList* rplList0 = pcSPS->getRPLList0(); const RPLList* rplList0 = pcSPS->getRPLList0();
const RPLList* rplList1 = pcSPS->getRPLList1(); const RPLList* rplList1 = pcSPS->getRPLList1();
uint32_t numberOfRPL = pcSPS->getNumRPL0() - 1;
//Write candidate for List0 //Write candidate for List0
numberOfRPL = pcSPS->getNumRPL0() - 1; uint32_t numberOfRPL = pcSPS->getNumRPL0();
WRITE_UVLC(numberOfRPL, "num_ref_pic_lists_in_sps[0]"); WRITE_UVLC(numberOfRPL, "num_ref_pic_lists_in_sps[0]");
for (int ii = 0; ii < numberOfRPL; ii++) for (int ii = 0; ii < numberOfRPL; ii++)
{ {
...@@ -736,7 +735,7 @@ void HLSWriter::codeSPS( const SPS* pcSPS ) ...@@ -736,7 +735,7 @@ void HLSWriter::codeSPS( const SPS* pcSPS )
//Write candidate for List1 //Write candidate for List1
if (!pcSPS->getRPL1CopyFromRPL0Flag()) if (!pcSPS->getRPL1CopyFromRPL0Flag())
{ {
numberOfRPL = pcSPS->getNumRPL1() - 1; numberOfRPL = pcSPS->getNumRPL1();
WRITE_UVLC(numberOfRPL, "num_ref_pic_lists_in_sps[1]"); WRITE_UVLC(numberOfRPL, "num_ref_pic_lists_in_sps[1]");
for (int ii = 0; ii < numberOfRPL; ii++) for (int ii = 0; ii < numberOfRPL; ii++)
{ {
...@@ -809,9 +808,9 @@ void HLSWriter::codeSPS( const SPS* pcSPS ) ...@@ -809,9 +808,9 @@ void HLSWriter::codeSPS( const SPS* pcSPS )
WRITE_FLAG( pcSPS->getAMVREnabledFlag() ? 1 : 0, "sps_amvr_enabled_flag" ); WRITE_FLAG( pcSPS->getAMVREnabledFlag() ? 1 : 0, "sps_amvr_enabled_flag" );
WRITE_FLAG( pcSPS->getBDOFEnabledFlag() ? 1 : 0, "sps_bdof_enabled_flag" ); WRITE_FLAG( pcSPS->getBDOFEnabledFlag() ? 1 : 0, "sps_bdof_enabled_flag" );
#if !JVET_O0438_SPS_AFFINE_AMVR_FLAG
WRITE_FLAG( pcSPS->getAffineAmvrEnabledFlag() ? 1 : 0, "sps_affine_amvr_enabled_flag" ); WRITE_FLAG( pcSPS->getAffineAmvrEnabledFlag() ? 1 : 0, "sps_affine_amvr_enabled_flag" );
#endif
WRITE_FLAG( pcSPS->getUseDMVR() ? 1 : 0, "sps_dmvr_enable_flag" ); WRITE_FLAG( pcSPS->getUseDMVR() ? 1 : 0, "sps_dmvr_enable_flag" );
WRITE_FLAG(pcSPS->getUseMMVD() ? 1 : 0, "sps_mmvd_enable_flag"); WRITE_FLAG(pcSPS->getUseMMVD() ? 1 : 0, "sps_mmvd_enable_flag");
// KJS: sps_cclm_enabled_flag // KJS: sps_cclm_enabled_flag
...@@ -834,6 +833,9 @@ void HLSWriter::codeSPS( const SPS* pcSPS ) ...@@ -834,6 +833,9 @@ void HLSWriter::codeSPS( const SPS* pcSPS )
if ( pcSPS->getUseAffine() ) if ( pcSPS->getUseAffine() )
{ {
WRITE_FLAG( pcSPS->getUseAffineType() ? 1 : 0, "affine_type_flag" ); WRITE_FLAG( pcSPS->getUseAffineType() ? 1 : 0, "affine_type_flag" );
#if JVET_O0438_SPS_AFFINE_AMVR_FLAG
WRITE_FLAG( pcSPS->getAffineAmvrEnabledFlag() ? 1 : 0, "sps_affine_amvr_enabled_flag" );
#endif
} }
WRITE_FLAG( pcSPS->getUseGBi() ? 1 : 0, "gbi_flag" ); WRITE_FLAG( pcSPS->getUseGBi() ? 1 : 0, "gbi_flag" );
WRITE_FLAG(pcSPS->getIBCFlag() ? 1 : 0, "ibc_flag"); WRITE_FLAG(pcSPS->getIBCFlag() ? 1 : 0, "ibc_flag");
......