Commit fd970b23 authored by Xiaoyu Xiu's avatar Xiaoyu Xiu Committed by Xiang Li

use m_pcEncCfg->getUseAffineAmvrEncOpt() to control the effect of...

use m_pcEncCfg->getUseAffineAmvrEncOpt() to control the effect of m_pcEncCfg->getIntraPeriod() != ( uint32_t ) -1, i.e., low delay setting.
parent 1aeb5bfd
......@@ -430,6 +430,10 @@ void initROM()
}
}
#endif
#if JVET_O0592_ENC_ME_IMP
::memset(g_isReusedUniMVsFilled, 0, sizeof(g_isReusedUniMVsFilled));
#endif
}
void destroyROM()
......@@ -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
int16_t *g_triangleWeights[2][TRIANGLE_DIR_NUM][MAX_CU_DEPTH - MIN_CU_LOG2 + 2][MAX_CU_DEPTH - MIN_CU_LOG2 + 2];
#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
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__
......@@ -114,6 +114,8 @@
#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 FIX_DB_MAX_TRANSFORM_SIZE 1
#define MRG_SHARELIST_SHARSIZE 32
......
......@@ -266,6 +266,9 @@ void EncCu::init( EncLib* pcEncLib, const SPS& sps PARL_PARAM( const int tId ) )
m_modeCtrl->init( m_pcEncCfg, m_pcRateCtrl, m_pcRdCost );
m_pcInterSearch->setModeCtrl( m_modeCtrl );
#if JVET_O0592_ENC_ME_IMP
m_modeCtrl->setInterSearch(m_pcInterSearch);
#endif
m_pcIntraSearch->setModeCtrl( m_modeCtrl );
if ( ( m_pcEncCfg->getIBCHashSearch() && m_pcEncCfg->getIBCMode() ) || m_pcEncCfg->getAllowDisFracMMVD() )
......@@ -1188,6 +1191,14 @@ void EncCu::xCheckModeSplit(CodingStructure *&tempCS, CodingStructure *&bestCS,
AffineMVInfo tmpMVInfo;
bool 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
{
......@@ -1319,6 +1330,12 @@ void EncCu::xCheckModeSplit(CodingStructure *&tempCS, CodingStructure *&bestCS,
if (isAffMVInfoSaved)
m_pcInterSearch->addAffMVInfo(tmpMVInfo);
#if JVET_O0592_ENC_ME_IMP
if (!tempCS->slice->isIntra() && isUniMvInfoSaved)
{
m_pcInterSearch->addUniMvInfo(tmpUniMvInfo);
}
#endif
tempCS->motionLut = oldMotionLut;
......
......@@ -1795,6 +1795,18 @@ bool EncModeCtrlMTnoRQT::tryMode( const EncTestMode& encTestmode, const CodingSt
{
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 ) ) )
{
return false;
......
......@@ -43,6 +43,9 @@
#include "CommonLib/CommonDef.h"
#include "CommonLib/CodingStructure.h"
#if JVET_O0592_ENC_ME_IMP
#include "InterSearch.h"
#endif
#include <typeinfo>
#include <vector>
......@@ -258,6 +261,9 @@ protected:
#if ENABLE_SPLIT_PARALLELISM
int m_runNextInParallel;
#endif
#if JVET_O0592_ENC_ME_IMP
InterSearch* m_pcInterSearch;
#endif
public:
......@@ -315,6 +321,9 @@ public:
void setBestCostWithoutSplitFlags ( double cost ) { m_ComprCUCtxList.back().bestCostWithoutSplitFlags = cost; }
double getMtsFirstPassNoIspCost () const { return m_ComprCUCtxList.back().bestCostMtsFirstPassNoIsp; }
void setMtsFirstPassNoIspCost ( double cost ) { m_ComprCUCtxList.back().bestCostMtsFirstPassNoIsp = cost; }
#if JVET_O0592_ENC_ME_IMP
void setInterSearch (InterSearch* pcInterSearch) { m_pcInterSearch = pcInterSearch; }
#endif
protected:
void xExtractFeatures ( const EncTestMode encTestmode, CodingStructure& cs );
......
......@@ -1415,6 +1415,9 @@ void EncSlice::compressSlice( Picture* pcPic, const bool bCompressEntireSlice, c
writeBlockStatisticsHeader(sps);
#endif
m_pcInterSearch->resetAffineMVList();
#if JVET_O0592_ENC_ME_IMP
m_pcInterSearch->resetUniMvList();
#endif
encodeCtus( pcPic, bCompressEntireSlice, bFastDeltaQP, startCtuTsAddr, boundingCtuTsAddr, m_pcLib );
......
This diff is collapsed.
......@@ -78,6 +78,14 @@ struct AffineMVInfo
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
{
Mv acMvAffine4Para[2][3];
......@@ -116,6 +124,12 @@ private:
int m_affMVListIdx;
int m_affMVListSize;
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;
EncAffineMotion m_affineMotion;
PatentBvCand m_defaultCachedBvs;
......@@ -232,6 +246,80 @@ public:
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 storeAffineMotion( Mv acAffineMv[2][3], int16_t affineRefIdx[2], EAffineModel affineType, int gbiIdx );
protected:
......@@ -364,6 +452,10 @@ protected:
);
void xTZSearch ( const PredictionUnit& pu,
#if JVET_O0592_ENC_ME_IMP
RefPicList eRefPicList,
int iRefIdxPred,
#endif
IntTZSearchStruct& cStruct,
Mv& rcMv,
Distortion& ruiSAD,
......@@ -373,6 +465,10 @@ protected:
);
void xTZSearchSelective ( const PredictionUnit& pu,
#if JVET_O0592_ENC_ME_IMP
RefPicList eRefPicList,
int iRefIdxPred,
#endif
IntTZSearchStruct& cStruct,
Mv& rcMv,
Distortion& ruiSAD,
......@@ -387,6 +483,10 @@ protected:
);
void xPatternSearchFast ( const PredictionUnit& pu,
#if JVET_O0592_ENC_ME_IMP
RefPicList eRefPicList,
int iRefIdxPred,
#endif
IntTZSearchStruct& cStruct,
Mv& rcMv,
Distortion& ruiSAD,
......
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