Commit 1d872933 authored by Karsten Suehring's avatar Karsten Suehring

remove macro JVET_L0260_AFFINE_ME

parent 5e9dec8d
......@@ -135,50 +135,28 @@ void AffineGradientSearch::xEqualCoeffComputer( Pel *pResidue, int residueStride
for ( int j = 0; j != height; j++ )
{
#if JVET_L0260_AFFINE_ME
int cy = ((j >> 2) << 2) + 2;
#endif
for ( int k = 0; k != width; k++ )
{
int iC[6];
int idx = j * derivateBufStride + k;
#if JVET_L0260_AFFINE_ME
int cx = ((k >> 2) << 2) + 2;
#endif
if ( !b6Param )
{
iC[0] = ppDerivate[0][idx];
#if JVET_L0260_AFFINE_ME
iC[1] = cx * ppDerivate[0][idx] + cy * ppDerivate[1][idx];
#else
iC[1] = k * ppDerivate[0][idx] + j * ppDerivate[1][idx];
#endif
iC[2] = ppDerivate[1][idx];
#if JVET_L0260_AFFINE_ME
iC[3] = cy * ppDerivate[0][idx] - cx * ppDerivate[1][idx];
#else
iC[3] = j * ppDerivate[0][idx] - k * ppDerivate[1][idx];
#endif
}
else
{
iC[0] = ppDerivate[0][idx];
#if JVET_L0260_AFFINE_ME
iC[1] = cx * ppDerivate[0][idx];
#else
iC[1] = k * ppDerivate[0][idx];
#endif
iC[2] = ppDerivate[1][idx];
#if JVET_L0260_AFFINE_ME
iC[3] = cx * ppDerivate[1][idx];
iC[4] = cy * ppDerivate[0][idx];
iC[5] = cy * ppDerivate[1][idx];
#else
iC[3] = k * ppDerivate[1][idx];
iC[4] = j * ppDerivate[0][idx];
iC[5] = j * ppDerivate[1][idx];
#endif
}
for ( int col = 0; col < affineParamNum; col++ )
{
......
......@@ -110,11 +110,9 @@ typedef enum
AFFINE_MODEL_NUM
} EAffineModel;
#if JVET_L0260_AFFINE_ME
static const int AFFINE_ME_LIST_SIZE = 4;
static const int AFFINE_ME_LIST_SIZE_LD = 3;
static const double AFFINE_ME_LIST_MVP_TH = 1.0;
#endif
// ====================================================================================================================
// Common constants
......
......@@ -77,7 +77,6 @@
#define L0074_SUBBLOCK_DEBLOCKING 1
#define JVET_L0260_AFFINE_ME 1
#define JVET_L0283_MULTI_REF_LINE 1
......
......@@ -198,32 +198,16 @@ static void simdVerticalSobelFilter( Pel *const pPred, const int predStride, int
template<X86_VEXT vext>
static void simdEqualCoeffComputer( Pel *pResidue, int residueStride, int **ppDerivate, int derivateBufStride, int64_t( *pEqualCoeff )[7], int width, int height, bool b6Param )
{
#if JVET_L0260_AFFINE_ME
__m128i mmFour;
#else
__m128i mmTwo, mmFour;
#endif
__m128i mmTmp[4];
__m128i mmIntermediate[4];
#if JVET_L0260_AFFINE_ME
__m128i mmIndxK, mmIndxJ;
#else
__m128i mmIndxK, mmIndxJ[2];
#endif
__m128i mmResidue[2];
__m128i mmC[12];
// Add directly to indexes to get new index
#if !JVET_L0260_AFFINE_ME
mmTwo = _mm_set1_epi32(2);
#endif
mmFour = _mm_set1_epi32(4);
#if JVET_L0260_AFFINE_ME
mmIndxJ = _mm_set1_epi32(-2);
#else
mmIndxJ[0] = _mm_set1_epi32(-2);
mmIndxJ[1] = _mm_set1_epi32(-1);
#endif
int n = b6Param ? 6 : 4;
......@@ -233,15 +217,9 @@ static void simdEqualCoeffComputer( Pel *pResidue, int residueStride, int **ppDe
for ( int j = 0; j < height; j += 2 )
{
#if JVET_L0260_AFFINE_ME
if (!(j & 3))
mmIndxJ = _mm_add_epi32(mmIndxJ, mmFour);
mmIndxK = _mm_set1_epi32(-2);
#else
mmIndxJ[0] = _mm_add_epi32(mmIndxJ[0], mmTwo);
mmIndxJ[1] = _mm_add_epi32(mmIndxJ[1], mmTwo);
mmIndxK = _mm_set_epi32(-1, -2, -3, -4);
#endif
idx1 += (derivateBufStride << 1);
idx2 += (derivateBufStride << 1);
......@@ -258,26 +236,16 @@ static void simdEqualCoeffComputer( Pel *pResidue, int residueStride, int **ppDe
mmC[2] = _mm_loadu_si128( (const __m128i*)&ppDerivate[1][idx1] );
mmC[1] = _mm_mullo_epi32( mmIndxK, mmC[0] );
mmC[3] = _mm_mullo_epi32( mmIndxK, mmC[2] );
#if JVET_L0260_AFFINE_ME
mmC[4] = _mm_mullo_epi32(mmIndxJ, mmC[0]);
mmC[5] = _mm_mullo_epi32(mmIndxJ, mmC[2]);
#else
mmC[4] = _mm_mullo_epi32(mmIndxJ[0], mmC[0]);
mmC[5] = _mm_mullo_epi32(mmIndxJ[0], mmC[2]);
#endif
// mmC[6-11] for iC[0-5] of 2nd row of pixels
mmC[6] = _mm_loadu_si128( (const __m128i*)&ppDerivate[0][idx2] );
mmC[8] = _mm_loadu_si128( (const __m128i*)&ppDerivate[1][idx2] );
mmC[7] = _mm_mullo_epi32( mmIndxK, mmC[6] );
mmC[9] = _mm_mullo_epi32( mmIndxK, mmC[8] );
#if JVET_L0260_AFFINE_ME
mmC[10] = _mm_mullo_epi32(mmIndxJ, mmC[6]);
mmC[11] = _mm_mullo_epi32(mmIndxJ, mmC[8]);
#else
mmC[10] = _mm_mullo_epi32(mmIndxJ[1], mmC[6]);
mmC[11] = _mm_mullo_epi32(mmIndxJ[1], mmC[8]);
#endif
}
else
{
......@@ -285,13 +253,8 @@ static void simdEqualCoeffComputer( Pel *pResidue, int residueStride, int **ppDe
mmC[0] = _mm_loadu_si128( (const __m128i*)&ppDerivate[0][idx1] );
mmC[2] = _mm_loadu_si128( (const __m128i*)&ppDerivate[1][idx1] );
mmC[1] = _mm_mullo_epi32( mmIndxK, mmC[0] );
#if JVET_L0260_AFFINE_ME
mmC[3] = _mm_mullo_epi32(mmIndxJ, mmC[0]);
mmTmp[0] = _mm_mullo_epi32(mmIndxJ, mmC[2]);
#else
mmC[3] = _mm_mullo_epi32(mmIndxJ[0], mmC[0]);
mmTmp[0] = _mm_mullo_epi32(mmIndxJ[0], mmC[2]);
#endif
mmTmp[1] = _mm_mullo_epi32( mmIndxK, mmC[2] );
mmC[1] = _mm_add_epi32( mmC[1], mmTmp[0] );
mmC[3] = _mm_sub_epi32( mmC[3], mmTmp[1] );
......@@ -300,13 +263,8 @@ static void simdEqualCoeffComputer( Pel *pResidue, int residueStride, int **ppDe
mmC[4] = _mm_loadu_si128( (const __m128i*)&ppDerivate[0][idx2] );
mmC[6] = _mm_loadu_si128( (const __m128i*)&ppDerivate[1][idx2] );
mmC[5] = _mm_mullo_epi32( mmIndxK, mmC[4] );
#if JVET_L0260_AFFINE_ME
mmC[7] = _mm_mullo_epi32(mmIndxJ, mmC[4]);
mmTmp[2] = _mm_mullo_epi32(mmIndxJ, mmC[6]);
#else
mmC[7] = _mm_mullo_epi32(mmIndxJ[1], mmC[4]);
mmTmp[2] = _mm_mullo_epi32(mmIndxJ[1], mmC[6]);
#endif
mmTmp[3] = _mm_mullo_epi32( mmIndxK, mmC[6] );
mmC[5] = _mm_add_epi32( mmC[5], mmTmp[2] );
mmC[7] = _mm_sub_epi32( mmC[7], mmTmp[3] );
......
......@@ -1089,11 +1089,9 @@ void EncCu::xCheckModeSplit(CodingStructure *&tempCS, CodingStructure *&bestCS,
m_CurrCtx++;
tempCS->getRecoBuf().fill( 0 );
#if JVET_L0260_AFFINE_ME
AffineMVInfo tmpMVInfo;
bool isAffMVInfoSaved;
m_pcInterSearch->savePrevAffMVInfo(0, tmpMVInfo, isAffMVInfoSaved);
#endif
do
{
......@@ -1261,10 +1259,8 @@ void EncCu::xCheckModeSplit(CodingStructure *&tempCS, CodingStructure *&bestCS,
bool bestCSUpdated =
xCheckBestMode( tempCS, bestCS, partitioner, encTestMode );
#if JVET_L0260_AFFINE_ME
if (isAffMVInfoSaved)
m_pcInterSearch->addAffMVInfo(tmpMVInfo);
#endif
if (!slice.isIntra()
#if JVET_L0293_CPR
......
......@@ -1475,9 +1475,7 @@ void EncSlice::compressSlice( Picture* pcPic, const bool bCompressEntireSlice, c
CHECK(sps == 0, "No SPS present");
writeBlockStatisticsHeader(sps);
#endif
#if JVET_L0260_AFFINE_ME
m_pcInterSearch->resetAffineMVList();
#endif
encodeCtus( pcPic, bCompressEntireSlice, bFastDeltaQP, startCtuTsAddr, boundingCtuTsAddr, m_pcLib );
#if HEVC_DEPENDENT_SLICES
......
......@@ -107,11 +107,9 @@ InterSearch::InterSearch()
}
setWpScalingDistParam( -1, REF_PIC_LIST_X, nullptr );
#if JVET_L0260_AFFINE_ME
m_affMVList = nullptr;
m_affMVListSize = 0;
m_affMVListIdx = 0;
#endif
}
......@@ -147,7 +145,6 @@ void InterSearch::destroy()
{
delete[] m_tmpAffiDeri[1];
}
#if JVET_L0260_AFFINE_ME
if (m_affMVList)
{
delete[] m_affMVList;
......@@ -155,7 +152,6 @@ void InterSearch::destroy()
}
m_affMVListIdx = 0;
m_affMVListSize = 0;
#endif
m_isInitialized = false;
}
......@@ -249,13 +245,11 @@ void InterSearch::init( EncCfg* pcEncCfg,
m_tmpAffiDeri[0] = new int[MAX_CU_SIZE * MAX_CU_SIZE];
m_tmpAffiDeri[1] = new int[MAX_CU_SIZE * MAX_CU_SIZE];
m_pTempPel = new Pel[maxCUWidth*maxCUHeight];
#if JVET_L0260_AFFINE_ME
m_affMVListMaxSize = (pcEncCfg->getIntraPeriod() == (uint32_t)-1) ? AFFINE_ME_LIST_SIZE_LD : AFFINE_ME_LIST_SIZE;
if (!m_affMVList)
m_affMVList = new AffineMVInfo[m_affMVListMaxSize];
m_affMVListIdx = 0;
m_affMVListSize = 0;
#endif
m_isInitialized = true;
}
......@@ -1986,9 +1980,7 @@ void InterSearch::predInterSearch(CodingUnit& cu, Partitioner& partitioner)
#endif
)
{
#if JVET_L0260_AFFINE_ME
m_hevcCost = uiHevcCost;
#endif
// save normal hevc result
uint32_t uiMRGIndex = pu.mergeIdx;
bool bMergeFlag = pu.mergeFlag;
......@@ -2364,11 +2356,7 @@ Distortion InterSearch::xGetAffineTemplateCost( PredictionUnit& pu, PelUnitBuf&
// calc distortion
uiCost = m_pcRdCost->getDistPart( origBuf.Y(), predBuf.Y(), pu.cs->sps->getBitDepth(CHANNEL_TYPE_LUMA), COMPONENT_Y
#if JVET_L0260_AFFINE_ME
, DF_HAD
#else
, DF_SAD
#endif
);
uiCost += m_pcRdCost->getCost( m_auiMVPIdxCost[iMVPIdx][iMVPNum] );
DTRACE( g_trace_ctx, D_COMMON, " (%d) affineTemplateCost=%d\n", DTRACE_GET_COUNTER(g_trace_ctx,D_COMMON), uiCost );
......@@ -3345,7 +3333,6 @@ void InterSearch::xPredAffineInterSearch( PredictionUnit& pu,
Distortion uiCandCost = xGetAffineTemplateCost(pu, origBuf, predBuf, mvHevc, aaiMvpIdx[iRefList][iRefIdxTemp],
AMVP_MAX_NUM_CANDS, eRefPicList, iRefIdxTemp);
#if JVET_L0260_AFFINE_ME
if (pu.cu->affineType == AFFINEMODEL_4PARAM && m_affMVListSize
#if JVET_L0646_GBI
&& (!pu.cu->cs->sps->getSpsNext().getUseGBi() || gbiIdx == GBI_DEFAULT)
......@@ -3412,7 +3399,6 @@ void InterSearch::xPredAffineInterSearch( PredictionUnit& pu,
}
}
}
#endif
if ( pu.cu->affineType == AFFINEMODEL_6PARAM )
{
Mv mvFour[3];
......@@ -3542,7 +3528,6 @@ void InterSearch::xPredAffineInterSearch( PredictionUnit& pu,
if ( pu.cu->affineType == AFFINEMODEL_4PARAM )
{
::memcpy( mvAffine4Para, cMvTemp, sizeof( cMvTemp ) );
#if JVET_L0260_AFFINE_ME
#if JVET_L0646_GBI
if (!pu.cu->cs->sps->getSpsNext().getUseGBi() || gbiIdx == GBI_DEFAULT)
{
......@@ -3575,7 +3560,6 @@ void InterSearch::xPredAffineInterSearch( PredictionUnit& pu,
}
#if JVET_L0646_GBI
}
#endif
#endif
}
......@@ -4332,7 +4316,6 @@ void InterSearch::xAffineMotionEstimation( PredictionUnit& pu,
}
}
#if JVET_L0260_AFFINE_ME
auto checkCPMVRdCost = [&](Mv ctrlPtMv[3])
{
xPredAffineBlk(COMPONENT_Y, pu, refPic, ctrlPtMv, predBuf, false, pu.cu->slice->clpRng(COMPONENT_Y));
......@@ -4430,7 +4413,6 @@ void InterSearch::xAffineMotionEstimation( PredictionUnit& pu,
}
}
}
#endif
acMv[0].changePrecision(MV_PRECISION_INTERNAL, MV_PRECISION_QUARTER);
acMv[1].changePrecision(MV_PRECISION_INTERNAL, MV_PRECISION_QUARTER);
......
......@@ -74,13 +74,11 @@ struct BlkRecord
#endif
class EncModeCtrl;
#if JVET_L0260_AFFINE_ME
struct AffineMVInfo
{
Mv affMVs[2][33][3];
int x, y, w, h;
};
#endif
/// encoder search class
class InterSearch : public InterPrediction, CrossComponentPrediction, AffineGradientSearch
......@@ -108,13 +106,11 @@ private:
#if JVET_L0293_CPR
std::unordered_map< Position, std::unordered_map< Size, BlkRecord> > m_ctuRecord;
#endif
#if JVET_L0260_AFFINE_ME
AffineMVInfo *m_affMVList;
int m_affMVListIdx;
int m_affMVListSize;
int m_affMVListMaxSize;
Distortion m_hevcCost;
#endif
protected:
// interface to option
......@@ -176,7 +172,6 @@ public:
#if JVET_L0646_GBI
void setAffineModeSelected ( bool flag) { m_affineModeSelected = flag; }
#endif
#if JVET_L0260_AFFINE_ME
void resetAffineMVList() { m_affMVListIdx = 0; m_affMVListSize = 0; }
void savePrevAffMVInfo(int idx, AffineMVInfo &tmpMVInfo, bool& isSaved)
{
......@@ -209,7 +204,6 @@ public:
m_affMVListSize = std::min(m_affMVListSize + 1, m_affMVListMaxSize);
}
}
#endif
protected:
/// sub-function for motion vector refinement used in fractional-pel accuracy
......
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