Commit 2405c823 authored by Frank Bossen's avatar Frank Bossen

Merge branch 'master' into 'M0427-INLOOP-RESHAPER'

# Conflicts:
#   cfg/encoder_intra_vtm.cfg
#   source/Lib/CommonLib/TypeDef.h
parents f8566dde cebbfa70
......@@ -121,6 +121,8 @@ PBIntraFast : 1
FastMrg : 1
AMaxBT : 1
# Encoder optimization tools
AffineAmvrEncOpt : 0
### DO NOT ADD ANYTHING BELOW THIS LINE ###
### DO NOT DELETE THE EMPTY LINE BELOW ###
......
......@@ -138,6 +138,9 @@ PBIntraFast : 1
FastMrg : 1
AMaxBT : 1
# Encoder optimization tools
AffineAmvrEncOpt : 0
### DO NOT ADD ANYTHING BELOW THIS LINE ###
### DO NOT DELETE THE EMPTY LINE BELOW ###
......
......@@ -141,6 +141,9 @@ PBIntraFast : 1
FastMrg : 1
AMaxBT : 1
# Encoder optimization tools
AffineAmvrEncOpt : 0
### DO NOT ADD ANYTHING BELOW THIS LINE ###
### DO NOT DELETE THE EMPTY LINE BELOW ###
......
......@@ -156,6 +156,9 @@ PBIntraFast : 1
FastMrg : 1
AMaxBT : 1
# Encoder optimization tools
AffineAmvrEncOpt : 1
### DO NOT ADD ANYTHING BELOW THIS LINE ###
### DO NOT DELETE THE EMPTY LINE BELOW ###
......
......@@ -262,6 +262,9 @@ void EncApp::xInitLibCfg()
#endif
#if JVET_M0246_AFFINE_AMVR
m_cEncLib.setUseAffineAmvr ( m_AffineAmvr );
#endif
#if JVET_M0247_AFFINE_AMVR_ENCOPT
m_cEncLib.setUseAffineAmvrEncOpt ( m_AffineAmvrEncOpt );
#endif
m_cEncLib.setIBCMode ( m_IBCMode );
m_cEncLib.setIBCLocalSearchRangeX ( m_IBCLocalSearchRangeX );
......
......@@ -869,6 +869,9 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] )
#endif
#if JVET_M0246_AFFINE_AMVR
("AffineAmvr", m_AffineAmvr, false, "Eanble AMVR for affine inter mode")
#endif
#if JVET_M0247_AFFINE_AMVR_ENCOPT
("AffineAmvrEncOpt", m_AffineAmvrEncOpt, false, "Enable encoder optimization of affine AMVR")
#endif
( "IBC", m_IBCMode, 0u, "IBCMode (0x1:enabled, 0x0:disabled) [default: disabled]")
( "IBCLocalSearchRangeX", m_IBCLocalSearchRangeX, 128u, "Search range of IBC local search in x direction")
......@@ -3186,6 +3189,10 @@ void EncAppCfg::xPrintParameter()
#endif
#if JVET_M0246_AFFINE_AMVR
msg( VERBOSE, "AffineAmvr:%d ", m_AffineAmvr );
#endif
#if JVET_M0247_AFFINE_AMVR_ENCOPT
m_AffineAmvrEncOpt = m_AffineAmvr ? m_AffineAmvrEncOpt : false;
msg( VERBOSE, "AffineAmvrEncOpt:%d ", m_AffineAmvrEncOpt );
#endif
}
msg(VERBOSE, "IBC:%d ", m_IBCMode);
......
......@@ -243,6 +243,9 @@ protected:
#if JVET_M0246_AFFINE_AMVR
bool m_AffineAmvr;
#endif
#if JVET_M0247_AFFINE_AMVR_ENCOPT
bool m_AffineAmvrEncOpt;
#endif
unsigned m_IBCMode;
unsigned m_IBCLocalSearchRangeX;
......
......@@ -318,7 +318,7 @@ static const int BIO_TEMP_BUFFER_SIZE = (MAX_CU_SIZE
static const int GBI_NUM = 5; ///< the number of weight options
static const int GBI_DEFAULT = ((uint8_t)(GBI_NUM >> 1)); ///< Default weighting index representing for w=0.5
static const int GBI_SIZE_CONSTRAINT = 256; ///< disabling GBi if cu size is smaller than 256
static const int MAX_NUM_HMVP_CANDS = 6; ///< maximum number of HMVP candidates to be stored and used in merge list
static const int MAX_NUM_HMVP_CANDS = 5; ///< maximum number of HMVP candidates to be stored and used in merge list
static const int MAX_NUM_HMVP_AVMPCANDS = 4; ///< maximum number of HMVP candidates to be used in AMVP list
#if W0038_DB_OPT
......
......@@ -1253,7 +1253,7 @@ const CtxSet ContextSetCfg::ImvFlag = ContextSetCfg::addCtxSet
{ 1, 4, 4, 5,},
#endif
#else
#if BD_AFFINE_AMVR
#if JVET_M0246_AFFINE_AMVR
{ 212, 214, 230, 182, 212, 214 },
{ 212, 214, 230, 182, 212, 214 },
{ CNU, CNU, CNU, CNU, CNU, CNU },
......
This diff is collapsed.
......@@ -75,17 +75,32 @@ private:
const Area& area,
const bool bValue,
const bool EdgeIdx = false );
#if JVET_M0471_LONG_DEBLOCKING_FILTERS
void xEdgeFilterLuma ( const CodingUnit& cu, const DeblockEdgeDir edgeDir, const int iEdge, const int initialMaxFilterLengthP, const int initialMaxFilterLengthQ );
#else
void xEdgeFilterLuma ( const CodingUnit& cu, const DeblockEdgeDir edgeDir, const int iEdge );
void xEdgeFilterChroma ( const CodingUnit& cu, const DeblockEdgeDir edgeDir, const int iEdge );
#endif
void xEdgeFilterChroma(const CodingUnit& cu, const DeblockEdgeDir edgeDir, const int iEdge);
#if LUMA_ADAPTIVE_DEBLOCKING_FILTER_QP_OFFSET
void deriveLADFShift( const Pel* src, const int stride, int& shift, const DeblockEdgeDir edgeDir, const SPS sps );
#endif
#if JVET_M0471_LONG_DEBLOCKING_FILTERS
inline void xBilinearFilter ( Pel* srcP, Pel* srcQ, int offset, int refMiddle, int refP, int refQ, int numberPSide, int numberQSide, const int* dbCoeffsP, const int* dbCoeffsQ, int tc ) const;
inline void xFilteringPandQ ( Pel* src, int offset, int numberPSide, int numberQSide, int tc ) const;
inline void xPelFilterLuma ( Pel* piSrc, const int iOffset, const int tc, const bool sw, const bool bPartPNoFilter, const bool bPartQNoFilter, const int iThrCut, const bool bFilterSecondP, const bool bFilterSecondQ, const ClpRng& clpRng, bool sidePisLarge = false, bool sideQisLarge = false, int maxFilterLengthP = 7, int maxFilterLengthQ = 7 ) const;
inline void xPelFilterChroma ( Pel* piSrc, const int iOffset, const int tc, const bool sw, const bool bPartPNoFilter, const bool bPartQNoFilter, const ClpRng& clpRng, const bool largeBoundary ) const;
inline bool xUseStrongFiltering ( Pel* piSrc, const int iOffset, const int d, const int beta, const int tc, bool sidePisLarge = false, bool sideQisLarge = false, int maxFilterLengthP = 7, int maxFilterLengthQ = 7 ) const;//move the computation outside the function
inline unsigned BsSet(unsigned val, const ComponentID compIdx) const;
inline unsigned BsGet(unsigned val, const ComponentID compIdx) const;
#else
inline void xPelFilterLuma ( Pel* piSrc, const int iOffset, const int tc, const bool sw, const bool bPartPNoFilter, const bool bPartQNoFilter, const int iThrCut, const bool bFilterSecondP, const bool bFilterSecondQ, const ClpRng& clpRng ) const;
inline void xPelFilterChroma ( Pel* piSrc, const int iOffset, const int tc, const bool bPartPNoFilter, const bool bPartQNoFilter, const ClpRng& clpRng ) const;
inline bool xUseStrongFiltering ( Pel* piSrc, const int iOffset, const int d, const int beta, const int tc ) const;
#endif
inline int xCalcDP ( Pel* piSrc, const int iOffset ) const;
inline int xCalcDQ ( Pel* piSrc, const int iOffset ) const;
static const uint8_t sm_tcTable[MAX_QP + 3];
......
......@@ -161,6 +161,9 @@ class GBiMotionParam
bool m_readOnlyAffine[2][2][33];
Mv m_mvAffine[2][2][33][3];
Distortion m_distAffine[2][2][33];
#if JVET_M0247_AFFINE_AMVR_ENCOPT
int m_mvpIdx[2][2][33];
#endif
public:
......@@ -182,6 +185,9 @@ public:
memset(m_dist, -1, 2 * 33 * sizeof(Distortion));
memset(m_readOnlyAffine, false, 2 * 2 * 33 * sizeof(bool));
memset(m_distAffine, -1, 2 * 2 * 33 * sizeof(Distortion));
#if JVET_M0247_AFFINE_AMVR_ENCOPT
memset( m_mvpIdx, 0, 2 * 2 * 33 * sizeof( int ) );
#endif
}
void setReadMode(bool b, uint32_t uiRefList, uint32_t uiRefIdx) { m_readOnly[uiRefList][uiRefIdx] = b; }
......@@ -206,16 +212,30 @@ public:
Mv& getAffineMv(uint32_t uiRefList, uint32_t uiRefIdx, uint32_t uiAffineMvIdx, int bP4) { return m_mvAffine[bP4][uiRefList][uiRefIdx][uiAffineMvIdx]; }
void copyAffineMvFrom(Mv(&racAffineMvs)[3], Distortion uiDist, uint32_t uiRefList, uint32_t uiRefIdx, int bP4)
void copyAffineMvFrom(Mv(&racAffineMvs)[3], Distortion uiDist, uint32_t uiRefList, uint32_t uiRefIdx, int bP4
#if JVET_M0247_AFFINE_AMVR_ENCOPT
, const int mvpIdx
#endif
)
{
memcpy(m_mvAffine[bP4][uiRefList][uiRefIdx], racAffineMvs, 3 * sizeof(Mv));
m_distAffine[bP4][uiRefList][uiRefIdx] = uiDist;
#if JVET_M0247_AFFINE_AMVR_ENCOPT
m_mvpIdx[bP4][uiRefList][uiRefIdx] = mvpIdx;
#endif
}
void copyAffineMvTo(Mv acAffineMvs[3], Distortion& ruiDist, uint32_t uiRefList, uint32_t uiRefIdx, int bP4)
void copyAffineMvTo(Mv acAffineMvs[3], Distortion& ruiDist, uint32_t uiRefList, uint32_t uiRefIdx, int bP4
#if JVET_M0247_AFFINE_AMVR_ENCOPT
, int& mvpIdx
#endif
)
{
memcpy(acAffineMvs, m_mvAffine[bP4][uiRefList][uiRefIdx], 3 * sizeof(Mv));
ruiDist = m_distAffine[bP4][uiRefList][uiRefIdx];
#if JVET_M0247_AFFINE_AMVR_ENCOPT
mvpIdx = m_mvpIdx[bP4][uiRefList][uiRefIdx];
#endif
}
};
struct LutMotionCand
......
......@@ -50,8 +50,9 @@
#include <assert.h>
#include <cassert>
#define JVET_M0908_CIIP_DB 1
#define JVET_M0471_LONG_DEBLOCKING_FILTERS 1
#define JVET_M0427_INLOOP_RESHAPER 1
#define JVET_M0470 1 // Fixed GR/TU+EG-k transition point, use limited prefix length for escape codes
#define JVET_M0257 1 // Scan only non zero-out regions of large TUs
......@@ -59,6 +60,8 @@
#define JVET_M0281_AMVP_ROUNDING 1 // Perform all AMVP rounding before pruning even AMVR is off
#define JVET_M0117_AMVP_LIST_GEN 1 // AMVP candidate list generation simplification
#define JVET_M0192_AFF_CHROMA_SIMPL 1 // Affine chroma MV derivation simplification and rounding unification
#define JVET_M0116_ATMVP_LEFT_NB_FOR_OFFSET 1 // Only use left neighbor for ATMVP offset derivation, from M0273, M0240, M0116, M0338, M0204
......@@ -114,6 +117,9 @@ typedef std::pair<int, int> TrCost;
#endif
#define JVET_M0246_AFFINE_AMVR 1
#if JVET_M0246_AFFINE_AMVR
#define JVET_M0247_AFFINE_AMVR_ENCOPT 1
#endif
#define JVET_M0421_SPLIT_SIG 1
#define JVET_M0173_MOVE_GT2_TO_FIRST_PASS 1 // Moving the gtr2 flag to the first coding pass
......
......@@ -1943,7 +1943,7 @@ void PU::fillMvpCand(PredictionUnit &pu, const RefPicList &eRefPicList, const in
}
}
#if JVET_M0281_AMVP_ROUNDING
#if JVET_M0281_AMVP_ROUNDING || JVET_M0117_AMVP_LIST_GEN
for( int i = 0; i < pInfo->numCand; i++ )
{
pInfo->mvCand[i].roundToAmvrSignalPrecision(MV_PRECISION_INTERNAL, pu.cu->imv);
......@@ -1966,7 +1966,7 @@ void PU::fillMvpCand(PredictionUnit &pu, const RefPicList &eRefPicList, const in
}
}
#if JVET_M0281_AMVP_ROUNDING
#if JVET_M0281_AMVP_ROUNDING || JVET_M0117_AMVP_LIST_GEN
if( cs.slice->getEnableTMVPFlag() && pInfo->numCand < AMVP_MAX_NUM_CANDS )
#else
if( cs.slice->getEnableTMVPFlag() )
......@@ -2021,7 +2021,7 @@ void PU::fillMvpCand(PredictionUnit &pu, const RefPicList &eRefPicList, const in
if ((C0Avail && getColocatedMVP(pu, eRefPicList, posC0, cColMv, refIdx_Col)) || getColocatedMVP(pu, eRefPicList, posC1, cColMv, refIdx_Col))
#endif
{
#if JVET_M0281_AMVP_ROUNDING
#if JVET_M0281_AMVP_ROUNDING || JVET_M0117_AMVP_LIST_GEN
cColMv.roundToAmvrSignalPrecision(MV_PRECISION_INTERNAL, pu.cu->imv);
#else
if (pu.cu->imv != 0)
......@@ -2029,6 +2029,9 @@ void PU::fillMvpCand(PredictionUnit &pu, const RefPicList &eRefPicList, const in
cColMv.roundToAmvrSignalPrecision(MV_PRECISION_INTERNAL, pu.cu->imv);
}
#endif
#if JVET_M0117_AMVP_LIST_GEN
pInfo->mvCand[pInfo->numCand++] = cColMv;
#else
int i = 0;
for (i = 0; i < pInfo->numCand; i++)
{
......@@ -2041,6 +2044,7 @@ void PU::fillMvpCand(PredictionUnit &pu, const RefPicList &eRefPicList, const in
{
pInfo->mvCand[pInfo->numCand++] = cColMv;
}
#endif
}
}
......@@ -2065,7 +2069,7 @@ void PU::fillMvpCand(PredictionUnit &pu, const RefPicList &eRefPicList, const in
for (Mv &mv : pInfo->mvCand)
{
mv.changePrecision(MV_PRECISION_INTERNAL, MV_PRECISION_QUARTER);
#if !JVET_M0281_AMVP_ROUNDING
#if !JVET_M0281_AMVP_ROUNDING && !JVET_M0117_AMVP_LIST_GEN
mv.roundToAmvrSignalPrecision(MV_PRECISION_QUARTER, pu.cu->imv);
#endif
}
......@@ -2625,7 +2629,9 @@ void PU::addAMVPHMVPCand(const PredictionUnit &pu, const RefPicList eRefPicList,
const Slice &slice = *(*pu.cs).slice;
MotionInfo neibMi;
#if !JVET_M0117_AMVP_LIST_GEN
int i = 0;
#endif
int num_avai_candInLUT = slice.getAvailableLUTMrgNum();
int num_allowedCand = std::min(MAX_NUM_HMVP_AVMPCANDS, num_avai_candInLUT);
......@@ -2635,7 +2641,11 @@ void PU::addAMVPHMVPCand(const PredictionUnit &pu, const RefPicList eRefPicList,
{
return;
}
#if JVET_M0117_AMVP_LIST_GEN
neibMi = slice.getMotionInfoFromLUTs(mrgIdx - 1);
#else
neibMi = slice.getMotionInfoFromLUTs(num_avai_candInLUT - mrgIdx);
#endif
for (int predictorSource = 0; predictorSource < 2; predictorSource++)
{
......@@ -2645,7 +2655,7 @@ void PU::addAMVPHMVPCand(const PredictionUnit &pu, const RefPicList eRefPicList,
if (neibRefIdx >= 0 && currRefPOC == slice.getRefPOC(eRefPicListIndex, neibRefIdx))
{
Mv pmv = neibMi.mv[eRefPicListIndex];
#if JVET_M0281_AMVP_ROUNDING
#if JVET_M0281_AMVP_ROUNDING || JVET_M0117_AMVP_LIST_GEN
pmv.roundToAmvrSignalPrecision(MV_PRECISION_INTERNAL, pu.cu->imv);
#else
if (imv != 0)
......@@ -2654,6 +2664,13 @@ void PU::addAMVPHMVPCand(const PredictionUnit &pu, const RefPicList eRefPicList,
}
#endif
#if JVET_M0117_AMVP_LIST_GEN
info.mvCand[info.numCand++] = pmv;
if (info.numCand >= AMVP_MAX_NUM_CANDS)
{
return;
}
#else
for (i = 0; i < info.numCand; i++)
{
if (pmv == info.mvCand[i])
......@@ -2669,6 +2686,7 @@ void PU::addAMVPHMVPCand(const PredictionUnit &pu, const RefPicList eRefPicList,
return;
}
}
#endif
}
}
}
......
......@@ -243,6 +243,9 @@ protected:
#endif
#if JVET_M0246_AFFINE_AMVR
bool m_AffineAmvr;
#endif
#if JVET_M0247_AFFINE_AMVR_ENCOPT
bool m_AffineAmvrEncOpt;
#endif
unsigned m_IBCMode;
unsigned m_IBCLocalSearchRangeX;
......@@ -772,6 +775,10 @@ public:
void setUseAffineAmvr ( bool b ) { m_AffineAmvr = b; }
bool getUseAffineAmvr () const { return m_AffineAmvr; }
#endif
#if JVET_M0247_AFFINE_AMVR_ENCOPT
void setUseAffineAmvrEncOpt ( bool b ) { m_AffineAmvrEncOpt = b; }
bool getUseAffineAmvrEncOpt () const { return m_AffineAmvrEncOpt; }
#endif
void setIBCMode (unsigned n) { m_IBCMode = n; }
unsigned getIBCMode () const { return m_IBCMode; }
......
This diff is collapsed.
......@@ -413,6 +413,10 @@ protected:
Mv acMv[3],
uint32_t& ruiBits,
Distortion& ruiCost,
#if JVET_M0247_AFFINE_AMVR_ENCOPT
int& mvpIdx,
const AffineAMVPInfo& aamvpi,
#endif
bool bBi = false
);
......@@ -439,7 +443,11 @@ protected:
void xSymmetricMotionEstimation( PredictionUnit& pu, PelUnitBuf& origBuf, Mv& rcMvCurPred, Mv& rcMvTarPred, RefPicList eRefPicList, MvField& rCurMvField, MvField& rTarMvField, Distortion& ruiCost, int gbiIdx );
#endif
bool xReadBufferedAffineUniMv ( PredictionUnit& pu, RefPicList eRefPicList, int32_t iRefIdx, Mv acMvPred[3], Mv acMv[3], uint32_t& ruiBits, Distortion& ruiCost);
bool xReadBufferedAffineUniMv ( PredictionUnit& pu, RefPicList eRefPicList, int32_t iRefIdx, Mv acMvPred[3], Mv acMv[3], uint32_t& ruiBits, Distortion& ruiCost
#if JVET_M0247_AFFINE_AMVR_ENCOPT
, int& mvpIdx, const AffineAMVPInfo& aamvpi
#endif
);
double xGetMEDistortionWeight ( uint8_t gbiIdx, RefPicList eRefPicList);
bool xReadBufferedUniMv ( PredictionUnit& pu, RefPicList eRefPicList, int32_t iRefIdx, Mv& pcMvPred, Mv& rcMv, uint32_t& ruiBits, Distortion& ruiCost);
......@@ -467,7 +475,9 @@ protected:
void xExtDIFUpSamplingH ( CPelBuf* pcPattern );
void xExtDIFUpSamplingQ ( CPelBuf* pcPatternKey, Mv halfPelRef );
#if JVET_M0247_AFFINE_AMVR_ENCOPT
uint32_t xDetermineBestMvp ( PredictionUnit& pu, Mv acMvTemp[3], int& mvpIdx, const AffineAMVPInfo& aamvpi );
#endif
// -------------------------------------------------------------------------------------------------------------------
// compute symbol bits
// -------------------------------------------------------------------------------------------------------------------
......
Markdown is supported
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