Commit faf6ea14 authored by Frank Bossen's avatar Frank Bossen
Browse files

Remove JVET_K1000_SIMPLIFIED_EMT macro

parent 019b4f56
......@@ -242,12 +242,10 @@ void EncApp::xInitLibCfg()
#if ENABLE_WPP_PARALLELISM
m_cEncLib.setUseAltDQPCoding ( m_AltDQPCoding );
#endif
#if 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 );
m_cEncLib.setFastInterEMT ( ( m_FastEMT >> 1 ) & ( m_EMT >> 1 ) & 1 );
#endif
#if JVET_K0157
m_cEncLib.setUseCompositeRef ( m_compositeRefEnabled );
#endif
......
......@@ -844,7 +844,6 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] )
"\t1: Enable LMChroma\n")
#else
#endif
#if JVET_K1000_SIMPLIFIED_EMT
("EMT,-emt", m_EMT, 0, "Enhanced Multiple Transform (EMT)\n"
"\t0: Disable EMT\n"
"\t1: Enable only Intra EMT\n"
......@@ -855,7 +854,6 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] )
"\t1: Enable fast methods only for Intra EMT\n"
"\t2: Enable fast methods only for Inter EMT\n"
"\t3: Enable fast methods for both Intra & Inter EMT\n")
#endif
#if JVET_K0157
("CompositeLTReference", m_compositeRefEnabled, false, "Enable Composite Long Term Reference Frame")
#endif
......@@ -1956,10 +1954,8 @@ 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 JVET_K1000_SIMPLIFIED_EMT
xConfirmPara( m_EMT, "EMT only allowed with NEXT profile" );
xConfirmPara( m_FastEMT, "EMT only allowed with NEXT profile" );
#endif
#if JVET_K0157
xConfirmPara(m_compositeRefEnabled, "Composite Reference Frame is only allowed with NEXT profile");
#endif
......@@ -2341,10 +2337,8 @@ bool EncAppCfg::xCheckParameter()
{
xConfirmPara( m_maxNumMergeCand > 5, "MaxNumMergeCand must be 5 or smaller." );
}
#if 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)
{
for (uint32_t channelType = 0; channelType < MAX_NUM_CHANNEL_TYPE; channelType++)
......@@ -3226,9 +3220,7 @@ void EncAppCfg::xPrintParameter()
#if JVET_K0190
msg( VERBOSE, "LMChroma:%d ", m_LMChroma );
#endif
#if JVET_K1000_SIMPLIFIED_EMT
msg( VERBOSE, "EMT: %1d(intra) %1d(inter) ", m_EMT & 1, ( m_EMT >> 1 ) & 1 );
#endif
#if JVET_K0157
msg(VERBOSE, "CompositeLTReference:%d ", m_compositeRefEnabled);
#endif
......@@ -3252,9 +3244,7 @@ void EncAppCfg::xPrintParameter()
#if JVET_K0357_AMVR
if( m_ImvMode == 2 ) msg( VERBOSE, "IMV4PelFast:%d ", m_Imv4PelFast );
#endif
#if 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 );
if( m_QTBT ) msg( VERBOSE, "E0023FastEnc:%d ", m_e0023FastEnc );
if( m_QTBT ) msg( VERBOSE, "ContentBasedFastQtbt:%d ", m_contentBasedFastQtbt );
......
......@@ -225,10 +225,8 @@ protected:
#if JVET_K0190
int m_LMChroma;
#endif
#if JVET_K1000_SIMPLIFIED_EMT
int m_EMT; ///< XZ: Enhanced Multiple Transform
int m_FastEMT; ///< XZ: Fast Methods of Enhanced Multiple Transform
#endif
#if JVET_K0157
bool m_compositeRefEnabled;
......
......@@ -110,13 +110,9 @@ enum CodingStatisticsType
#if JVET_K0357_AMVR
STATS__CABAC_BITS__IMV_FLAG,
#endif
#if JVET_K1000_SIMPLIFIED_EMT
STATS__CABAC_BITS__EMT_CU_FLAG,
STATS__CABAC_BITS__EMT_TU_INDEX,
#endif
#if JVET_K1000_SIMPLIFIED_EMT
STATS__TOOL_EMT,
#endif
STATS__TOOL_TOTAL,
STATS__NUM_STATS
};
......@@ -194,10 +190,8 @@ static inline const char* getName(CodingStatisticsType name)
#if JVET_K0357_AMVR
"CABAC_BITS__IMV_FLAG",
#endif
#if JVET_K1000_SIMPLIFIED_EMT
"CABAC_BITS__EMT_CU_FLAG",
"CABAC_BITS__EMT_TU_INDX",
#endif
"CABAC_BITS__OTHER",
"CABAC_BITS__INVALID",
"TOOL_FRAME",
......
......@@ -224,17 +224,10 @@ static const int DM_CHROMA_IDX = NUM_INTRA_MODE; ///< chro
static const uint8_t INTER_MODE_IDX = 255; ///< index for inter modes
#if JVET_K1000_SIMPLIFIED_EMT
static const uint32_t EMT_INTRA_MAX_CU = 32; ///< Max Intra CU size applying EMT, supported values: 8, 16, 32, 64, 128
static const uint32_t 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 uint32_t EMT_INTRA_MAX_CU_WITH_QTBT = 32; ///< Max Intra CU size applying EMT, supported values: 8, 16, 32, 64, 128
static const uint32_t EMT_INTER_MAX_CU_WITH_QTBT = 32; ///< Max Inter CU size applying EMT, supported values: 8, 16, 32, 64, 128
#else
static const uint32_t EMT_INTRA_MAX_CU_WITH_QTBT = 64; ///< Max Intra CU size applying EMT, supported values: 8, 16, 32, 64, 128
static const uint32_t 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;
......@@ -340,9 +333,7 @@ static const int MAX_ENCODER_DEBLOCKING_QUALITY_LAYERS = 8 ;
static const uint32_t LUMA_LEVEL_TO_DQP_LUT_MAXSIZE = 1024; ///< max LUT size for QP offset based on luma
#endif
#if 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.
......
......@@ -297,9 +297,7 @@ CoeffCodingContext::CoeffCodingContext(const TransformUnit& tu, ComponentID comp
#if JVET_K0072
#else
#endif
#if JVET_K1000_SIMPLIFIED_EMT
, m_emtNumSigCoeff (0)
#endif
{
// LOGTODO
unsigned log2sizeX = m_log2BlockWidth;
......
......@@ -431,10 +431,8 @@ public:
}
#endif
#if JVET_K1000_SIMPLIFIED_EMT
unsigned emtNumSigCoeff() const { return m_emtNumSigCoeff; }
void setEmtNumSigCoeff( unsigned val ) { m_emtNumSigCoeff = val; }
#endif
private:
// constant
......@@ -516,9 +514,7 @@ private:
#if JVET_K0072
#else
#endif
#if JVET_K1000_SIMPLIFIED_EMT
unsigned m_emtNumSigCoeff;
#endif
};
......
......@@ -714,7 +714,6 @@ const CtxSet ContextSetCfg::RdpcmDir = ContextSetCfg::addCtxSet
{ CNU, CNU,},
});
#if JVET_K1000_SIMPLIFIED_EMT
const CtxSet ContextSetCfg::EMTTuIndex = ContextSetCfg::addCtxSet
({
{ CNU, CNU, CNU, CNU,},
......@@ -728,7 +727,6 @@ 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
({
......
......@@ -202,10 +202,8 @@ public:
static const CtxSet TransquantBypassFlag;
static const CtxSet RdpcmFlag;
static const CtxSet RdpcmDir;
#if JVET_K1000_SIMPLIFIED_EMT
static const CtxSet EMTTuIndex;
static const CtxSet EMTCuFlag;
#endif
static const CtxSet CrossCompPred;
static const CtxSet ChromaQpAdjFlag;
static const CtxSet ChromaQpAdjIdc;
......
......@@ -257,9 +257,6 @@ void initROM()
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;
}
......@@ -282,17 +279,6 @@ void initROM()
v = sin(PI*(k + 0.5)*(n + 1) / (c + 0.5)) * sqrt(2.0 / (c + 0.5));
iT[DST7*c*c + k*c + n] = (int16_t)(s * v + (v > 0 ? 0.5 : -0.5));
#if !JVET_K1000_SIMPLIFIED_EMT
// DCT-V
w0 = (k == 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] = (int16_t)(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] = (int16_t)(s * v + (v > 0 ? 0.5 : -0.5));
#endif
}
}
c <<= 1;
......@@ -474,13 +460,8 @@ const int g_invQuantScales[SCALING_LIST_REM_NUM] =
//--------------------------------------------------------------------------------------------------
//structures
#if 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 uint8_t g_aucTrSetVert[NUM_INTRA_MODE - 1] =
......@@ -503,7 +484,6 @@ const uint8_t g_aucTrSetHorz35[35] =
//EMT threshold
const uint32_t g_EmtSigNumThr = 2;
#endif
//EMT transform coeficient variable
TMatrixCoeff g_aiTr2 [NUM_TRANS_TYPE][ 2][ 2];
......@@ -512,9 +492,6 @@ 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
......
......@@ -70,25 +70,8 @@ extern uint32_t* g_scanOrderPosXY[SCAN_NUMBER_OF_GROUP_TYPES][SCAN_NUMBER
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
static const int g_transformMatrixShift[TRANSFORM_NUMBER_OF_DIRECTIONS] = { 6, 6 };
#endif
extern const TMatrixCoeff g_aiT2 [TRANSFORM_NUMBER_OF_DIRECTIONS][ 2][ 2];
extern const TMatrixCoeff g_aiT4 [TRANSFORM_NUMBER_OF_DIRECTIONS][ 4][ 4];
extern const TMatrixCoeff g_aiT8 [TRANSFORM_NUMBER_OF_DIRECTIONS][ 8][ 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
// ====================================================================================================================
......@@ -146,7 +129,6 @@ static const unsigned mpmCtx[NUM_INTRA_MODE] =
extern const TMatrixCoeff g_as_DST_MAT_4 [TRANSFORM_NUMBER_OF_DIRECTIONS][4][4];
#endif
#if JVET_K1000_SIMPLIFIED_EMT
extern const int g_aiTrSubsetIntra[3][2];
extern const int g_aiTrSubsetInter[4];
......@@ -157,7 +139,6 @@ extern const uint8_t g_aucTrSetVert35[35];
extern const uint8_t g_aucTrSetHorz35[35];
extern const uint32_t g_EmtSigNumThr;
#endif
extern TMatrixCoeff g_aiTr2 [NUM_TRANS_TYPE][ 2][ 2];
extern TMatrixCoeff g_aiTr4 [NUM_TRANS_TYPE][ 4][ 4];
......@@ -165,9 +146,6 @@ 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
// ====================================================================================================================
......
This diff is collapsed.
......@@ -1669,10 +1669,8 @@ SPSNext::SPSNext( SPS& sps )
#if JVET_K0190
, m_LMChroma ( false )
#endif
#if JVET_K1000_SIMPLIFIED_EMT
, m_IntraEMT ( false )
, m_InterEMT ( false )
#endif
#if JVET_K_AFFINE
, m_Affine ( false )
#if JVET_K0337_AFFINE_6PARA
......
......@@ -820,10 +820,8 @@ private:
#if JVET_K0190
bool m_LMChroma; // 17
#endif
#if JVET_K1000_SIMPLIFIED_EMT
bool m_IntraEMT; // 18
bool m_InterEMT; // 19
#endif
#if JVET_K_AFFINE
bool m_Affine;
#if JVET_K0337_AFFINE_6PARA
......@@ -916,12 +914,10 @@ public:
void setUseLMChroma ( bool b ) { m_LMChroma = b; }
bool getUseLMChroma () const { return m_LMChroma; }
#endif
#if JVET_K1000_SIMPLIFIED_EMT
void setUseIntraEMT ( bool b ) { m_IntraEMT = b; }
bool getUseIntraEMT () const { return m_IntraEMT; }
void setUseInterEMT ( bool b ) { m_InterEMT = b; }
bool getUseInterEMT () const { return m_InterEMT; }
#endif
//===== additional parameters =====
// qtbt
void setCTUSize ( unsigned ctuSize ) { m_CTUSize = ctuSize; }
......
......@@ -68,7 +68,6 @@ struct coeffGroupRDStats
double d64SigCost_0;
};
#if JVET_K1000_SIMPLIFIED_EMT
FwdTrans *fastFwdTrans[NUM_TRANS_TYPE][g_numTransformMatrixSizes] =
{
{ fastForwardDCT2_B2, fastForwardDCT2_B4, fastForwardDCT2_B8, fastForwardDCT2_B16, fastForwardDCT2_B32, fastForwardDCT2_B64 },
......@@ -82,7 +81,6 @@ InvTrans *fastInvTrans[NUM_TRANS_TYPE][g_numTransformMatrixSizes] =
{ nullptr, fastInverseDCT8_B4, fastInverseDCT8_B8, fastInverseDCT8_B16, fastInverseDCT8_B32, nullptr },
{ nullptr, fastInverseDST7_B4, fastInverseDST7_B8, fastInverseDST7_B16, fastInverseDST7_B32, nullptr },
};
#endif
//! \ingroup CommonLib
//! \{
......@@ -100,11 +98,7 @@ 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 );
......@@ -135,7 +129,6 @@ void TrQuant::copyState( const TrQuant& other )
}
#endif
#if 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
......@@ -210,13 +203,8 @@ 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)
......@@ -291,13 +279,8 @@ 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++ )
{
......@@ -307,218 +290,7 @@ 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
* \param stride [in] stride of residual block
* \param coeff [out] transform coefficients
* \param width [in] width of transform
* \param height [in] height of transform
* \param useDST [in]
* \param maxLog2TrDynamicRange [in]
*/
#if HEVC_USE_4x4_DSTVII
void xTrMxN( const int bitDepth, const Pel *residual, size_t stride, TCoeff *coeff, size_t width, size_t height, bool useDST, const int maxLog2TrDynamicRange )
#else
void xTrMxN( const int bitDepth, const Pel *residual, size_t stride, TCoeff *coeff, size_t width, size_t height, const int maxLog2TrDynamicRange )
#endif
{
const int iWidth = (int)width;
const int iHeight = (int)height;
const int TRANSFORM_MATRIX_SHIFT = g_transformMatrixShift[TRANSFORM_FORWARD];
const int shift_1st = (g_aucLog2[iWidth] + bitDepth + TRANSFORM_MATRIX_SHIFT) - maxLog2TrDynamicRange;
const int shift_2nd = g_aucLog2[iHeight] + TRANSFORM_MATRIX_SHIFT;
const int iZeroOutThresh = JVET_C0024_ZERO_OUT_TH;
uint32_t iSkipWidth = (iWidth > iZeroOutThresh ? iWidth - iZeroOutThresh : 0);
uint32_t iSkipHeight = (iHeight > iZeroOutThresh ? iHeight - iZeroOutThresh : 0);
CHECK( shift_1st < 0, "Negative shift" );
CHECK( shift_2nd < 0, "Negative shift" );
ALIGN_DATA( MEMORY_ALIGN_DEF_SIZE, TCoeff block[MAX_TU_SIZE * MAX_TU_SIZE] );
ALIGN_DATA( MEMORY_ALIGN_DEF_SIZE, TCoeff tmp[MAX_TU_SIZE * MAX_TU_SIZE] );
for( int y = 0; y < iHeight; y++ )
{
for( int x = 0; x < iWidth; x++ )
{
block[( y * iWidth ) + x] = residual[( y * stride ) + x];
}
}
{
switch (iWidth)
{
case 2: fastForwardDCT2_B2( block, tmp, shift_1st, iHeight, 0, iSkipWidth, 0 ); break;
case 4:
{
#if HEVC_USE_4x4_DSTVII
if ((iHeight == 4) && useDST) // Check for DCT or DST
{
fastForwardDST7_B4( block, tmp, shift_1st, iHeight, 0, iSkipWidth, 0 );
}
else
#endif
{
fastForwardDCT2_B4( block, tmp, shift_1st, iHeight, 0, iSkipWidth, 0 );
}
}
break;
case 8: fastForwardDCT2_B8 ( block, tmp, shift_1st, iHeight, 0, iSkipWidth, 0 ); break;
case 16: fastForwardDCT2_B16 ( block, tmp, shift_1st, iHeight, 0, iSkipWidth, 0 ); break;
case 32: fastForwardDCT2_B32 ( block, tmp, shift_1st, iHeight, 0, iSkipWidth, 0 ); break;
case 64: fastForwardDCT2_B64 ( block, tmp, shift_1st + COM16_C806_TRANS_PREC, iHeight, 0, iSkipWidth, 0 ); break;
case 128: fastForwardDCT2_B128( block, tmp, shift_1st + COM16_C806_TRANS_PREC, iHeight, 0, iSkipWidth, 0 ); break;
default:
THROW( "Unsupported transformation size" ); break;
}
}
{
switch (iHeight)
{
case 2: fastForwardDCT2_B2( tmp, coeff, shift_2nd, iWidth, iSkipWidth, iSkipHeight, 0 ); break;
case 4:
{
#if HEVC_USE_4x4_DSTVII
if ((iWidth == 4) && useDST) // Check for DCT or DST
{
fastForwardDST7_B4( tmp, coeff, shift_2nd, iWidth, iSkipWidth, iSkipHeight, 0 );
}
else
#endif
{
fastForwardDCT2_B4( tmp, coeff, shift_2nd, iWidth, iSkipWidth, iSkipHeight, 0 );
}
}
break;
case 8: fastForwardDCT2_B8 ( tmp, coeff, shift_2nd, iWidth, iSkipWidth, iSkipHeight, 0 ); break;
case 16: fastForwardDCT2_B16 ( tmp, coeff, shift_2nd, iWidth, iSkipWidth, iSkipHeight, 0 ); break;
case 32: fastForwardDCT2_B32 ( tmp, coeff, shift_2nd, iWidth, iSkipWidth, iSkipHeight, 0 ); break;
case 64: fastForwardDCT2_B64 ( tmp, coeff, shift_2nd + COM16_C806_TRANS_PREC, iWidth, iSkipWidth, iSkipHeight, 0 ); break;
case 128: fastForwardDCT2_B128( tmp, coeff, shift_2nd + COM16_C806_TRANS_PREC, iWidth, iSkipWidth, iSkipHeight, 0 ); break;
default:
THROW( "Unsupported transformation size" ); break;
}
}
}
/** MxN inverse transform (2D)
* \param bitDepth [in] bit depth
* \param coeff [in] transform coefficients
* \param residual [out] residual block
* \param stride [out] stride of the residual block
* \param width [in] width of transform
* \param height [in] height of transform
* \param useDST [in]
* \param maxLog2TrDynamicRange [in]
*/
#if HEVC_USE_4x4_DSTVII
void xITrMxN( const int bitDepth, const TCoeff *coeff, Pel *residual, size_t stride, size_t width, size_t height, bool useDST, const int maxLog2TrDynamicRange )
#else
void xITrMxN( const int bitDepth, const TCoeff *coeff, Pel *residual, size_t stride, size_t width, size_t height, const int maxLog2TrDynamicRange )
#endif
{
const int TRANSFORM_MATRIX_SHIFT = g_transformMatrixShift[TRANSFORM_INVERSE];
const int iWidth = (int)width;
const int iHeight = (int)height;
int shift_1st = TRANSFORM_MATRIX_SHIFT + 1; //1 has been added to shift_1st at the expense of shift_2nd
int shift_2nd = (TRANSFORM_MATRIX_SHIFT + maxLog2TrDynamicRange - 1) - bitDepth;
const TCoeff clipMinimum = -(1 << maxLog2TrDynamicRange);
const TCoeff clipMaximum = (1 << maxLog2TrDynamicRange) - 1;
uint32_t uiSkipWidth = ( iWidth > JVET_C0024_ZERO_OUT_TH ? iWidth - JVET_C0024_ZERO_OUT_TH : 0 );
uint32_t uiSkipHeight = ( iHeight > JVET_C0024_ZERO_OUT_TH ? iHeight - JVET_C0024_ZERO_OUT_TH : 0 );
CHECK( shift_1st < 0, "Negative shift" );
CHECK( shift_2nd < 0, "Negative shift" );
ALIGN_DATA( MEMORY_ALIGN_DEF_SIZE, TCoeff block[MAX_TU_SIZE * MAX_TU_SIZE] );
ALIGN_DATA( MEMORY_ALIGN_DEF_SIZE, TCoeff tmp[MAX_TU_SIZE * MAX_TU_SIZE] );
{
switch (iHeight)
{
case 2: fastInverseDCT2_B2( coeff, tmp, shift_1st, iWidth, uiSkipWidth, uiSkipHeight, 0, clipMinimum, clipMaximum ); break;
case 4:
{
#if HEVC_USE_4x4_DSTVII
if ((iWidth == 4) && useDST) // Check for DCT or DST
{
fastInverseDST7_B4( coeff, tmp, shift_1st, iWidth, uiSkipWidth, uiSkipHeight, 0, clipMinimum, clipMaximum );
}
else
#endif
{
fastInverseDCT2_B4( coeff, tmp, shift_1st, iWidth, uiSkipWidth, uiSkipHeight, 0, clipMinimum, clipMaximum );
}
}
break;
case 8: fastInverseDCT2_B8 ( coeff, tmp, shift_1st, iWidth, uiSkipWidth, uiSkipHeight, 0, clipMinimum, clipMaximum ); break;
case 16: fastInverseDCT2_B16 ( coeff, tmp, shift_1st, iWidth, uiSkipWidth, uiSkipHeight, 0, clipMinimum, clipMaximum ); break;
case 32: fastInverseDCT2_B32 ( coeff, tmp, shift_1st, iWidth, uiSkipWidth, uiSkipHeight, 0, clipMinimum, clipMaximum ); break;
case 64: fastInverseDCT2_B64 ( coeff, tmp, shift_1st + COM16_C806_TRANS_PREC, iWidth, uiSkipWidth, uiSkipHeight, 0, clipMinimum, clipMaximum ); break;
case 128: fastInverseDCT2_B128( coeff, tmp, shift_1st + COM16_C806_TRANS_PREC, iWidth, uiSkipWidth, uiSkipHeight, 0, clipMinimum, clipMaximum ); break;
default:
THROW( "Unsupported transformation size" ); break;
}
}
{
switch (iWidth)
{
case 2: fastInverseDCT2_B2( tmp, block, shift_2nd, iHeight, 0, uiSkipWidth, 0, std::numeric_limits<Pel>::min(), std::numeric_limits<Pel>::max() ); break;
// Clipping here is not in the standard, but is used to protect the "Pel" data type into which the inverse-transformed samples will be copied
case 4:
{
#if HEVC_USE_4x4_DSTVII
if ((iHeight == 4) && useDST) // Check for DCT or DST
{
fastInverseDST7_B4( tmp, block, shift_2nd, iHeight, 0, uiSkipWidth, 0, std::numeric_limits<Pel>::min(), std::numeric_limits<Pel>::max() );
}
else
#endif
{
fastInverseDCT2_B4( tmp, block, shift_2nd, iHeight, 0, uiSkipWidth, 0, std::numeric_limits<Pel>::min(), std::numeric_limits<Pel>::max() );
}
}