Commit 171d9630 authored by Amir Said's avatar Amir Said
Browse files

Adopted EMT simplifications described in JVET-K1000:

. single DCT-2, maximum dimension = 64
. only DCT-8 and DST-7 kernels, max. dimension = 32
. 10-bit coefficients for all transform matrices
parent 10b7c079
......@@ -263,6 +263,8 @@ Void EncApp::xInitLibCfg()
#if JEM_TOOLS
m_cEncLib.setIntraPDPC ( m_IntraPDPC );
m_cEncLib.setALF ( m_ALF );
#endif
#if JEM_TOOLS || JVET_K1000_SIMPLIFIED_EMT
m_cEncLib.setIntraEMT ( m_EMT & 1 );
m_cEncLib.setFastIntraEMT ( m_FastEMT & m_EMT & 1 );
m_cEncLib.setInterEMT ( ( m_EMT >> 1 ) & 1 );
......
......@@ -870,7 +870,7 @@ Bool EncAppCfg::parseCfg( Int argc, TChar* argv[] )
"\t4: Enable LMChroma+ ELM (MMLM+MFLM)\n")
#endif
#endif
#if JEM_TOOLS
#if JEM_TOOLS || JVET_K1000_SIMPLIFIED_EMT
("EMT,-emt", m_EMT, 0, "Enhanced Multiple Transform (EMT)\n"
"\t0: Disable EMT\n"
"\t1: Enable only Intra EMT\n"
......@@ -1988,12 +1988,12 @@ Bool EncAppCfg::xCheckParameter()
xConfirmPara( m_useSaveLoadEncInfo, "Encoder decision saving can only be applied when encoding with NEXT profile" );
xConfirmPara( m_useSaveLoadSplitDecision, "Encoder split decision saving can only be applied when encoding with NEXT profile" );
#endif
#if JEM_TOOLS
#if JEM_TOOLS || JVET_K1000_SIMPLIFIED_EMT
xConfirmPara( m_EMT, "EMT only allowed with NEXT profile" );
xConfirmPara( m_FastEMT, "EMT only allowed with NEXT profile" );
xConfirmPara( m_FRUC, "FRUC is only allowed with NEXT profile" );
#endif
#if JEM_TOOLS
xConfirmPara( m_FRUC, "FRUC is only allowed with NEXT profile" );
xConfirmPara( m_CIPF > 0, "CIPF is only allowed with NEXT profile" );
#endif
#if JEM_TOOLS
......@@ -2416,10 +2416,9 @@ Bool EncAppCfg::xCheckParameter()
{
xConfirmPara( m_maxNumMergeCand > 5, "MaxNumMergeCand must be 5 or smaller." );
}
#if JEM_TOOLS
#if JEM_TOOLS || JVET_K1000_SIMPLIFIED_EMT
xConfirmPara( m_EMT < 0 || m_EMT >3, "EMT must be 0, 1, 2 or 3" );
xConfirmPara( m_FastEMT < 0 || m_FastEMT >3, "FEMT must be 0, 1, 2 or 3" );
#endif
if( m_usePCM)
{
......@@ -3303,7 +3302,7 @@ Void EncAppCfg::xPrintParameter()
#if JVET_K0190
msg( VERBOSE, "LMChroma:%d ", m_LMChroma );
#endif
#if JEM_TOOLS
#if JEM_TOOLS || JVET_K1000_SIMPLIFIED_EMT
msg( VERBOSE, "EMT: %1d(intra) %1d(inter) ", m_EMT & 1, ( m_EMT >> 1 ) & 1 );
#endif
#if JEM_TOOLS
......@@ -3348,6 +3347,8 @@ Void EncAppCfg::xPrintParameter()
#if JEM_TOOLS
if( m_LICMode > 0 ) msg( VERBOSE, "FastPicLevelLIC:%d ", m_FastPicLevelLIC );
if( m_ImvMode == 2 ) msg( VERBOSE, "IMV4PelFast:%d ", m_Imv4PelFast );
#endif
#if JEM_TOOLS || JVET_K1000_SIMPLIFIED_EMT
if( m_EMT ) msg( VERBOSE, "EMTFast: %1d(intra) %1d(inter) ", ( m_FastEMT & m_EMT & 1 ), ( m_FastEMT >> 1 ) & ( m_EMT >> 1 ) & 1 );
#endif
if( m_QTBT ) msg( VERBOSE, "AMaxBT:%d ", m_useAMaxBT );
......
......@@ -246,9 +246,11 @@ protected:
#if JEM_TOOLS||JVET_K0190
int m_LMChroma;
#endif
#if JEM_TOOLS
#if JEM_TOOLS || JVET_K1000_SIMPLIFIED_EMT
int m_EMT; ///< XZ: Enhanced Multiple Transform
int m_FastEMT; ///< XZ: Fast Methods of Enhanced Multiple Transform
#endif
#if JEM_TOOLS
bool m_OBMC;
int m_OBMCBlkSize;
bool m_FRUC;
......
......@@ -107,6 +107,8 @@ enum CodingStatisticsType
#if JEM_TOOLS
STATS__CABAC_BITS__OBMC_FLAG,
STATS__CABAC_BITS__IMV_FLAG,
#endif
#if JEM_TOOLS || JVET_K1000_SIMPLIFIED_EMT
STATS__CABAC_BITS__EMT_CU_FLAG,
STATS__CABAC_BITS__EMT_TU_INDEX,
#endif
......@@ -180,6 +182,8 @@ static inline const TChar* getName(CodingStatisticsType name)
#if JEM_TOOLS
"CABAC_BITS__OBMC_FLAG",
"CABAC_BITS__IMV_FLAG",
#endif
#if JEM_TOOLS || JVET_K1000_SIMPLIFIED_EMT
"CABAC_BITS__EMT_CU_FLAG",
"CABAC_BITS__EMT_TU_INDX",
#endif
......
......@@ -230,13 +230,19 @@ static const Int NUM_CHROMA_MODE = 5; ///< tota
static const Int DM_CHROMA_IDX = NUM_INTRA_MODE; ///< chroma mode index for derived from luma intra mode
static const UChar INTER_MODE_IDX = 255; ///< index for inter modes
#if JEM_TOOLS
#if JEM_TOOLS || JVET_K1000_SIMPLIFIED_EMT
static const UInt EMT_INTRA_MAX_CU = 32; ///< Max Intra CU size applying EMT, supported values: 8, 16, 32, 64, 128
static const UInt EMT_INTER_MAX_CU = 32; ///< Max Inter CU size applying EMT, supported values: 8, 16, 32, 64, 128
#if JVET_K1000_SIMPLIFIED_EMT
static const UInt EMT_INTRA_MAX_CU_WITH_QTBT = 32; ///< Max Intra CU size applying EMT, supported values: 8, 16, 32, 64, 128
static const UInt EMT_INTER_MAX_CU_WITH_QTBT = 32; ///< Max Inter CU size applying EMT, supported values: 8, 16, 32, 64, 128
#else
static const UInt EMT_INTRA_MAX_CU_WITH_QTBT = 64; ///< Max Intra CU size applying EMT, supported values: 8, 16, 32, 64, 128
static const UInt EMT_INTER_MAX_CU_WITH_QTBT = 64; ///< Max Inter CU size applying EMT, supported values: 8, 16, 32, 64, 128
#endif
#endif
#if INTRA67_3MPM
static const int NUM_MOST_PROBABLE_MODES = 3;
#else
......@@ -350,10 +356,10 @@ static const Int MAX_ENCODER_DEBLOCKING_QUALITY_LAYERS = 8 ;
static const UInt LUMA_LEVEL_TO_DQP_LUT_MAXSIZE = 1024; ///< max LUT size for QP offset based on luma
#endif
#if JEM_TOOLS
#if JEM_TOOLS || JVET_K1000_SIMPLIFIED_EMT
static const Int NUM_EMT_CU_FLAG_CTX = 6; ///< number of context models for EMT CU-level flag
#endif
//QTBT high level parameters
//for I slice luma CTB configuration para.
static const Int MAX_BT_DEPTH = 4; ///< <=7
......
......@@ -304,7 +304,7 @@ CoeffCodingContext::CoeffCodingContext(const TransformUnit& tu, ComponentID comp
, m_altResiCompId ( tu.cs->sps->getSpsNext().getAltResiCompId() )
#endif
#endif
#if JEM_TOOLS
#if JEM_TOOLS || JVET_K1000_SIMPLIFIED_EMT
, m_emtNumSigCoeff (0)
#endif
{
......
......@@ -434,11 +434,11 @@ public:
}
#endif
#if JEM_TOOLS
#if JEM_TOOLS || JVET_K1000_SIMPLIFIED_EMT
unsigned emtNumSigCoeff() const { return m_emtNumSigCoeff; }
void setEmtNumSigCoeff( unsigned val ) { m_emtNumSigCoeff = val; }
#endif
private:
// constant
const ComponentID m_compID;
......@@ -526,7 +526,7 @@ private:
unsigned m_altResiCompId;
#endif
#endif
#if JEM_TOOLS
#if JEM_TOOLS || JVET_K1000_SIMPLIFIED_EMT
unsigned m_emtNumSigCoeff;
#endif
};
......
......@@ -1364,7 +1364,7 @@ const CtxSet ContextSetCfg::RdpcmDir = ContextSetCfg::addCtxSet
{ CNU, CNU,},
});
#if JEM_TOOLS
#if JEM_TOOLS || JVET_K1000_SIMPLIFIED_EMT
const CtxSet ContextSetCfg::EMTTuIndex = ContextSetCfg::addCtxSet
({
{ CNU, CNU, CNU, CNU,},
......@@ -1378,8 +1378,8 @@ const CtxSet ContextSetCfg::EMTCuFlag = ContextSetCfg::addCtxSet
{ CNU, CNU, CNU, CNU, CNU, CNU,},
{ CNU, CNU, CNU, CNU, CNU, CNU,},
});
#endif
const CtxSet ContextSetCfg::CrossCompPred = ContextSetCfg::addCtxSet
({
{ 154, 154, 154, 154, 154, 154, 154, 154, 154, 154,},
......
......@@ -372,7 +372,7 @@ public:
#endif
static const CtxSet RdpcmFlag;
static const CtxSet RdpcmDir;
#if JEM_TOOLS
#if JEM_TOOLS || JVET_K1000_SIMPLIFIED_EMT
static const CtxSet EMTTuIndex;
static const CtxSet EMTCuFlag;
#endif
......
......@@ -269,51 +269,55 @@ Void initROM()
const Double PI = 3.14159265358979323846;
for (i = 0; i < 7; i++)
for (i = 0; i < g_numTransformMatrixSizes; i++)
{
TMatrixCoeff *iT = NULL;
const Double s = sqrt((Double)c) * (64 << COM16_C806_TRANS_PREC);
switch (i)
{
case 0: iT = g_aiTr2[0][0]; break;
case 1: iT = g_aiTr4[0][0]; break;
case 2: iT = g_aiTr8[0][0]; break;
case 3: iT = g_aiTr16[0][0]; break;
case 4: iT = g_aiTr32[0][0]; break;
case 5: iT = g_aiTr64[0][0]; break;
case 6: iT = g_aiTr128[0][0]; break;
case 7: exit(0); break;
case 0: iT = g_aiTr2[0][0]; break;
case 1: iT = g_aiTr4[0][0]; break;
case 2: iT = g_aiTr8[0][0]; break;
case 3: iT = g_aiTr16[0][0]; break;
case 4: iT = g_aiTr32[0][0]; break;
case 5: iT = g_aiTr64[0][0]; break;
#if !JVET_K1000_SIMPLIFIED_EMT
case 6: iT = g_aiTr128[0][0]; break;
#endif
default: exit(0); break;
}
for (Int k = 0; k < c; k++)
{
for (Int n = 0; n < c; n++)
{
Double w0, w1, v;
Double w0, v;
// DCT-II
w0 = k == 0 ? sqrt(0.5) : 1;
v = cos(PI*(n + 0.5)*k / c) * w0 * sqrt(2.0 / c);
iT[DCT2*c*c + k*c + n] = (Short)(s * v + (v > 0 ? 0.5 : -0.5));
// DCT-VIII
v = cos(PI*(k + 0.5)*(n + 0.5) / (c + 0.5)) * sqrt(2.0 / (c + 0.5));
iT[DCT8*c*c + k*c + n] = (Short)(s * v + (v > 0 ? 0.5 : -0.5));
// DST-VII
v = sin(PI*(k + 0.5)*(n + 1) / (c + 0.5)) * sqrt(2.0 / (c + 0.5));
iT[DST7*c*c + k*c + n] = (Short)(s * v + (v > 0 ? 0.5 : -0.5));
#if !JVET_K1000_SIMPLIFIED_EMT
// DCT-V
w0 = (k == 0) ? sqrt(0.5) : 1.0;
w1 = (n == 0) ? sqrt(0.5) : 1.0;
Double w1 = (n == 0) ? sqrt(0.5) : 1.0;
v = cos(PI*n*k / (c - 0.5)) * w0 * w1 * sqrt(2.0 / (c - 0.5));
iT[DCT5*c*c + k*c + n] = (Short)(s * v + (v > 0 ? 0.5 : -0.5));
// DCT-VIII
v = cos(PI*(k + 0.5)*(n + 0.5) / (c + 0.5)) * sqrt(2.0 / (c + 0.5));
iT[DCT8*c*c + k*c + n] = (Short)(s * v + (v > 0 ? 0.5 : -0.5));
// DST-I
v = sin(PI*(n + 1)*(k + 1) / (c + 1)) * sqrt(2.0 / (c + 1));
iT[DST1*c*c + k*c + n] = (Short)(s * v + (v > 0 ? 0.5 : -0.5));
// DST-VII
v = sin(PI*(k + 0.5)*(n + 1) / (c + 0.5)) * sqrt(2.0 / (c + 0.5));
iT[DST7*c*c + k*c + n] = (Short)(s * v + (v > 0 ? 0.5 : -0.5));
#endif
}
}
c <<= 1;
......@@ -528,9 +532,13 @@ const Int g_invQuantScales[SCALING_LIST_REM_NUM] =
//--------------------------------------------------------------------------------------------------
//structures
#if JEM_TOOLS
#if JEM_TOOLS || JVET_K1000_SIMPLIFIED_EMT
//EMT transform sets
#if JVET_K1000_SIMPLIFIED_EMT
const Int g_aiTrSubsetIntra[3][2] = { { DST7, DCT8 }, { DST7, DCT8 }, { DST7, DCT8 } };
#else
const Int g_aiTrSubsetIntra[3][2] = { { DST7, DCT8 }, { DST7, DST1 }, { DST7, DCT5 } };
#endif
const Int g_aiTrSubsetInter[4] = { DCT8, DST7 };
const UChar g_aucTrSetVert[NUM_INTRA_MODE - 1] =
......@@ -554,6 +562,7 @@ const UChar g_aucTrSetHorz35[35] =
const UInt g_EmtSigNumThr = 2;
#endif
//EMT transform coeficient variable
TMatrixCoeff g_aiTr2 [NUM_TRANS_TYPE][ 2][ 2];
TMatrixCoeff g_aiTr4 [NUM_TRANS_TYPE][ 4][ 4];
......@@ -561,8 +570,9 @@ TMatrixCoeff g_aiTr8 [NUM_TRANS_TYPE][ 8][ 8];
TMatrixCoeff g_aiTr16 [NUM_TRANS_TYPE][ 16][ 16];
TMatrixCoeff g_aiTr32 [NUM_TRANS_TYPE][ 32][ 32];
TMatrixCoeff g_aiTr64 [NUM_TRANS_TYPE][ 64][ 64];
#if !JVET_K1000_SIMPLIFIED_EMT
TMatrixCoeff g_aiTr128[NUM_TRANS_TYPE][128][128];
#endif
//--------------------------------------------------------------------------------------------------
//coefficients
......
......@@ -74,6 +74,11 @@ extern UInt g_auiCoefTopLeftDiagScan8x8[ MAX_CU_SIZE / 2 + 1 ][64];
extern const Int g_quantScales [SCALING_LIST_REM_NUM]; // Q(QP%6)
extern const Int g_invQuantScales[SCALING_LIST_REM_NUM]; // IQ(QP%6)
#if JVET_K1000_SIMPLIFIED_EMT
static const Int g_numTransformMatrixSizes = 6;
static const Int g_transformMatrixShift[TRANSFORM_NUMBER_OF_DIRECTIONS] = { 6, 6 };
#else
static const Int g_numTransformMatrixSizes = 7;
#if RExt__HIGH_PRECISION_FORWARD_TRANSFORM
static const Int g_transformMatrixShift[TRANSFORM_NUMBER_OF_DIRECTIONS] = { 14, 6 };
#else
......@@ -87,6 +92,8 @@ extern const TMatrixCoeff g_aiT16 [TRANSFORM_NUMBER_OF_DIRECTIONS][ 16][ 16];
extern const TMatrixCoeff g_aiT32 [TRANSFORM_NUMBER_OF_DIRECTIONS][ 32][ 32];
extern const TMatrixCoeff g_aiT64 [TRANSFORM_NUMBER_OF_DIRECTIONS][ 64][ 64];
extern const TMatrixCoeff g_aiT128[TRANSFORM_NUMBER_OF_DIRECTIONS][128][128];
#endif
// ====================================================================================================================
// Luma QP to Chroma QP mapping
......@@ -146,9 +153,9 @@ extern const int g_pdpcParam[5][6];
#if HEVC_USE_4x4_DSTVII
extern const TMatrixCoeff g_as_DST_MAT_4 [TRANSFORM_NUMBER_OF_DIRECTIONS][4][4];
#endif
#if JEM_TOOLS
#if JEM_TOOLS || JVET_K1000_SIMPLIFIED_EMT
extern const Int g_aiTrSubsetIntra[3][2];
extern const Int g_aiTrSubsetInter[4];
......@@ -159,15 +166,18 @@ extern const UChar g_aucTrSetVert35[35];
extern const UChar g_aucTrSetHorz35[35];
extern const UInt g_EmtSigNumThr;
#endif
extern TMatrixCoeff g_aiTr2 [NUM_TRANS_TYPE][ 2][ 2];
extern TMatrixCoeff g_aiTr4 [NUM_TRANS_TYPE][ 4][ 4];
extern TMatrixCoeff g_aiTr8 [NUM_TRANS_TYPE][ 8][ 8];
extern TMatrixCoeff g_aiTr16 [NUM_TRANS_TYPE][ 16][ 16];
extern TMatrixCoeff g_aiTr32 [NUM_TRANS_TYPE][ 32][ 32];
extern TMatrixCoeff g_aiTr64 [NUM_TRANS_TYPE][ 64][ 64];
#if !JVET_K1000_SIMPLIFIED_EMT
extern TMatrixCoeff g_aiTr128 [NUM_TRANS_TYPE][128][128];
#endif
#if JEM_TOOLS
extern const UChar g_NsstLut [NUM_INTRA_MODE-1];
struct tabSinCos { Int c, s; };
......
......@@ -37,6 +37,8 @@
#include "Rom.h"
#if !JVET_K1000_SIMPLIFIED_EMT
//--------------------------------------------------------------------------------------------------
// Transformations
......@@ -452,4 +454,6 @@ const TMatrixCoeff g_as_DST_MAT_4[TRANSFORM_NUMBER_OF_DIRECTIONS][4][4] =
#undef DEFINE_DCT64x64_MATRIX
#undef DEFINE_DCT128x128_MATRIX
#endif // !JVET_K1000_SIMPLIFIED_EMT
//--------------------------------------------------------------------------------------------------
......@@ -1764,7 +1764,7 @@ SPSNext::SPSNext( SPS& sps )
#if JEM_TOOLS||JVET_K0190
, m_LMChroma ( false )
#endif
#if JEM_TOOLS
#if JEM_TOOLS || JVET_K1000_SIMPLIFIED_EMT
, m_IntraEMT ( false )
, m_InterEMT ( false )
#endif
......
......@@ -844,7 +844,7 @@ private:
#if JEM_TOOLS||JVET_K0190
bool m_LMChroma; // 17
#endif
#if JEM_TOOLS
#if JEM_TOOLS || JVET_K1000_SIMPLIFIED_EMT
bool m_IntraEMT; // 18
bool m_InterEMT; // 19
#endif
......@@ -1013,7 +1013,7 @@ public:
void setUseLMChroma ( bool b ) { m_LMChroma = b; }
bool getUseLMChroma () const { return m_LMChroma; }
#endif
#if JEM_TOOLS
#if JEM_TOOLS || JVET_K1000_SIMPLIFIED_EMT
void setUseIntraEMT ( bool b ) { m_IntraEMT = b; }
bool getUseIntraEMT () const { return m_IntraEMT; }
void setUseInterEMT ( bool b ) { m_InterEMT = b; }
......
......@@ -65,8 +65,22 @@ struct coeffGroupRDStats
Double d64SigCost_0;
};
#if JEM_TOOLS
FwdTrans *fastFwdTrans[5][7] =
#if JVET_K1000_SIMPLIFIED_EMT
FwdTrans *fastFwdTrans[NUM_TRANS_TYPE][g_numTransformMatrixSizes] =
{
{ fastForwardDCT2_B2, fastForwardDCT2_B4, fastForwardDCT2_B8, fastForwardDCT2_B16, fastForwardDCT2_B32, fastForwardDCT2_B64 },
{ nullptr, fastForwardDCT8_B4, fastForwardDCT8_B8, fastForwardDCT8_B16, fastForwardDCT8_B32, nullptr },
{ nullptr, fastForwardDST7_B4, fastForwardDST7_B8, fastForwardDST7_B16, fastForwardDST7_B32, nullptr },
};
InvTrans *fastInvTrans[NUM_TRANS_TYPE][g_numTransformMatrixSizes] =
{
{ fastInverseDCT2_B2, fastInverseDCT2_B4, fastInverseDCT2_B8, fastInverseDCT2_B16, fastInverseDCT2_B32, fastInverseDCT2_B64 },
{ nullptr, fastInverseDCT8_B4, fastInverseDCT8_B8, fastInverseDCT8_B16, fastInverseDCT8_B32, nullptr },
{ nullptr, fastInverseDST7_B4, fastInverseDST7_B8, fastInverseDST7_B16, fastInverseDST7_B32, nullptr },
};
#elif JEM_TOOLS
FwdTrans *fastFwdTrans[NUM_TRANS_TYPE][g_numTransformMatrixSizes] =
{
{ fastForwardDCT2_B2, fastForwardDCT2_B4, fastForwardDCT2_B8, fastForwardDCT2_B16, fastForwardDCT2_B32, fastForwardDCT2_B64, fastForwardDCT2_B128 },
{ NULL, fastForwardDCT5_B4, fastForwardDCT5_B8, fastForwardDCT5_B16, fastForwardDCT5_B32, fastForwardDCT5_B64, fastForwardDCT5_B128 },
......@@ -75,7 +89,7 @@ FwdTrans *fastFwdTrans[5][7] =
{ NULL, fastForwardDST7_B4, fastForwardDST7_B8, fastForwardDST7_B16, fastForwardDST7_B32, fastForwardDST7_B64, fastForwardDST7_B128 },
};
InvTrans *fastInvTrans[5][7] =
InvTrans *fastInvTrans[NUM_TRANS_TYPE][g_numTransformMatrixSizes] =
{
{ fastInverseDCT2_B2, fastInverseDCT2_B4, fastInverseDCT2_B8, fastInverseDCT2_B16, fastInverseDCT2_B32, fastInverseDCT2_B64, fastInverseDCT2_B128 },
{ NULL, fastInverseDCT5_B4, fastInverseDCT5_B8, fastInverseDCT5_B16, fastInverseDCT5_B32, fastInverseDCT5_B64, fastInverseDCT5_B128 },
......@@ -101,7 +115,11 @@ void xITrMxN( const int bitDepth, const TCoeff *coeff, Pel *residual, size_t str
#endif
#if JVET_K1000_SIMPLIFIED_EMT
TrQuant::TrQuant() : m_quant( nullptr )
#else
TrQuant::TrQuant() : m_quant( nullptr ), m_fTr( xTrMxN ), m_fITr( xITrMxN )
#endif
{
// allocate temporary buffers
m_plTempCoeff = (TCoeff*) xMalloc( TCoeff, MAX_CU_SIZE * MAX_CU_SIZE );
......@@ -132,7 +150,7 @@ void TrQuant::copyState( const TrQuant& other )
}
#endif
#if JEM_TOOLS
#if JEM_TOOLS || JVET_K1000_SIMPLIFIED_EMT
#if HEVC_USE_4x4_DSTVII
void xTrMxN_EMT( const Int bitDepth, const Pel *residual, size_t stride, TCoeff *coeff, Int iWidth, Int iHeight, bool useDST, const int maxLog2TrDynamicRange,
#else
......@@ -207,8 +225,13 @@ void xTrMxN_EMT( const Int bitDepth, const Pel *residual, size_t stride, TCoeff
nTrIdxVer = g_aiTrSubsetInter[ucTrIdx >> 1];
}
#if JVET_K1000_SIMPLIFIED_EMT
fastFwdTrans[nTrIdxHor][transformWidthIndex](block, tmp, shift_1st, iHeight, 0, iSkipWidth);
fastFwdTrans[nTrIdxVer][transformHeightIndex](tmp, coeff, shift_2nd, iWidth, iSkipWidth, iSkipHeight);
#else
fastFwdTrans[nTrIdxHor][transformWidthIndex](block, tmp, shift_1st, iHeight, 0, iSkipWidth, 1);
fastFwdTrans[nTrIdxVer][transformHeightIndex](tmp, coeff, shift_2nd, iWidth, iSkipWidth, iSkipHeight, 1);
#endif
}
/** MxN inverse transform (2D)
......@@ -283,8 +306,13 @@ void xITrMxN_EMT( const Int bitDepth, const TCoeff *coeff, Pel *residual, size_t
nTrIdxVer = g_aiTrSubsetInter[ucTrIdx >> 1];
}
#if JVET_K1000_SIMPLIFIED_EMT
fastInvTrans[nTrIdxVer][transformHeightIndex](coeff, tmp, shift_1st, iWidth, uiSkipWidth, uiSkipHeight, clipMinimum, clipMaximum);
fastInvTrans[nTrIdxHor][transformWidthIndex](tmp, block, shift_2nd, iHeight, 0, uiSkipWidth, clipMinimum, clipMaximum);
#else
fastInvTrans[nTrIdxVer][transformHeightIndex](coeff, tmp, shift_1st, iWidth, uiSkipWidth, uiSkipHeight, 1, clipMinimum, clipMaximum);
fastInvTrans[nTrIdxHor][transformWidthIndex](tmp, block, shift_2nd, iHeight, 0, uiSkipWidth, 1, clipMinimum, clipMaximum);
#endif
for( Int y = 0; y < iHeight; y++ )
{
......@@ -296,6 +324,8 @@ void xITrMxN_EMT( const Int bitDepth, const TCoeff *coeff, Pel *residual, size_t
}
#endif
#if !JVET_K1000_SIMPLIFIED_EMT
/** MxN forward transform (2D)
* \param bitDepth [in] bit depth
* \param residual [in] residual block
......@@ -503,6 +533,7 @@ void xITrMxN( const int bitDepth, const TCoeff *coeff, Pel *residual, size_t str
}
}
#endif // !JVET_K1000_SIMPLIFIED_EMT
Void TrQuant::xDeQuant(const TransformUnit &tu,
......@@ -1025,6 +1056,29 @@ void TrQuant::xT( const TransformUnit &tu, const ComponentID &compID, const CPel
#if HEVC_USE_4x4_DSTVII
const bool useDST = TU::useDST( tu, compID );
#endif
#if JVET_K1000_SIMPLIFIED_EMT
const unsigned ucMode = getEmtMode ( tu, compID );
const unsigned ucTrIdx = getEmtTrIdx( tu, compID );
#if INTRA67_3MPM
#if HEVC_USE_4x4_DSTVII
xTrMxN_EMT(channelBitDepth, resi.buf, resi.stride, dstCoeff.buf, iWidth, iHeight, useDST, maxLog2TrDynamicRange, ucMode, ucTrIdx
#else
xTrMxN_EMT(channelBitDepth, resi.buf, resi.stride, dstCoeff.buf, iWidth, iHeight, maxLog2TrDynamicRange, ucMode, ucTrIdx
#endif
#else
#if HEVC_USE_4x4_DSTVII
xTrMxN_EMT( channelBitDepth, resi.buf, resi.stride, dstCoeff.buf, iWidth, iHeight, useDST, maxLog2TrDynamicRange, ucMode, ucTrIdx, m_use65IntraModes
#else
xTrMxN_EMT( channelBitDepth, resi.buf, resi.stride, dstCoeff.buf, iWidth, iHeight, maxLog2TrDynamicRange, ucMode, ucTrIdx, m_use65IntraModes
#endif
#endif
, m_rectTUs
);
#else
#if JEM_TOOLS
const unsigned ucMode = getEmtMode ( tu, compID );
const unsigned ucTrIdx = getEmtTrIdx( tu, compID );
......@@ -1056,6 +1110,7 @@ void TrQuant::xT( const TransformUnit &tu, const ComponentID &compID, const CPel
m_fTr ( channelBitDepth, resi.buf, resi.stride, dstCoeff.buf, iWidth, iHeight, maxLog2TrDynamicRange );
#endif
}
#endif
}
/** Wrapper function between HM interface and core NxN inverse transform (2D)
......@@ -1068,6 +1123,38 @@ void TrQuant::xIT( const TransformUnit &tu, const ComponentID &compID, const CCo
const bool useDST = TU::useDST( tu, compID );
#endif
#if JVET_K1000_SIMPLIFIED_EMT
const unsigned ucMode = getEmtMode ( tu, compID );
const unsigned ucTrIdx = getEmtTrIdx( tu, compID );
Int iSkipWidth = 0, iSkipHeight = 0;
if( m_rectTUs )
{
iSkipWidth = ( pCoeff.width > JVET_C0024_ZERO_OUT_TH ? pCoeff.width - JVET_C0024_ZERO_OUT_TH : 0 );
iSkipHeight = ( pCoeff.height > JVET_C0024_ZERO_OUT_TH ? pCoeff.height - JVET_C0024_ZERO_OUT_TH : 0 );
}
else if( ( ( ucMode == INTER_MODE_IDX || pCoeff.width == 64 ) && ucTrIdx != DCT2_EMT && pCoeff.width >= JVET_C0024_ZERO_OUT_TH ) || ( ucTrIdx == DCT2_EMT && pCoeff.width == 64 ) )
{
iSkipWidth = pCoeff.width >> 1;
iSkipHeight = pCoeff.height >> 1;
}
#if INTRA67_3MPM
#if HEVC_USE_4x4_DSTVII
xITrMxN_EMT(channelBitDepth, pCoeff.buf, pResidual.buf, pResidual.stride, pCoeff.width, pCoeff.height, iSkipWidth, iSkipHeight, useDST, maxLog2TrDynamicRange, ucMode, ucTrIdx );
#else
xITrMxN_EMT(channelBitDepth, pCoeff.buf, pResidual.buf, pResidual.stride, pCoeff.width, pCoeff.height, iSkipWidth, iSkipHeight, maxLog2TrDynamicRange, ucMode, ucTrIdx );
#endif
#else
#if HEVC_USE_4x4_DSTVII
xITrMxN_EMT( channelBitDepth, pCoeff.buf, pResidual.buf, pResidual.stride, pCoeff.width, pCoeff.height, iSkipWidth, iSkipHeight, useDST, maxLog2TrDynamicRange, ucMode, ucTrIdx, m_use65IntraModes );
#else
xITrMxN_EMT( channelBitDepth, pCoeff.buf, pResidual.buf, pResidual.stride, pCoeff.width, pCoeff.height, iSkipWidth, iSkipHeight, maxLog2TrDynamicRange, ucMode, ucTrIdx, m_use65IntraModes );
#endif
#endif
#else
#if JEM_TOOLS
const unsigned ucMode = getEmtMode ( tu, compID );
const unsigned ucTrIdx = getEmtTrIdx( tu, compID );
......@@ -1109,6 +1196,7 @@ void TrQuant::xIT( const TransformUnit &tu, const ComponentID &compID, const CCo
m_fITr ( channelBitDepth, pCoeff.buf, pResidual.buf, pResidual.stride, pCoeff.width, pCoeff.height, maxLog2TrDynamicRange );
#endif
}
#endif
}
/** Wrapper function between HM interface and core NxN transform skipping
......@@ -1172,10 +1260,14 @@ Void TrQuant::xQuant(TransformUnit &tu, const ComponentID &compID, const CCoeffB
m_quant->quant( tu, compID, pSrc, uiAbsSum, cQP, ctx );
}
#if JEM_TOOLS
#if JEM_TOOLS || JVET_K1000_SIMPLIFIED_EMT
UChar TrQuant::getEmtTrIdx(TransformUnit tu, const ComponentID compID)
{
#if JVET_K1000_SIMPLIFIED_EMT
UChar ucTrIdx = DCT2_EMT;
#else
UChar ucTrIdx = DCT2_HEVC;
#endif
if( compID == COMPONENT_Y )
{
......
......@@ -50,8 +50,13 @@
//! \ingroup CommonLib
//! \{
#if JVET_K1000_SIMPLIFIED_EMT
typedef void FwdTrans(const TCoeff*, TCoeff*, Int, Int, Int, Int);
typedef void InvTrans(const TCoeff*, TCoeff*, Int, Int, Int, Int, const TCoeff, const TCoeff);
#else