From 8c6a35068dbdfcf4e26b2d8b2414d5fd8c591d3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=B5=9C=EA=B8=B0=ED=98=B8/Media=20Algorithm=20Lab=28DMC?= =?UTF-8?q?=EC=97=B0=29/E5=28=EC=B1=85=EC=9E=84=29/=EC=82=BC=EC=84=B1?= =?UTF-8?q?=EC=A0=84=EC=9E=90?= Date: Tue, 30 Oct 2018 19:31:12 +0900 Subject: [PATCH] Upload codes for L0059 - Simplification on MTS signaling --- source/Lib/CommonLib/Rom.cpp | 2 ++ source/Lib/CommonLib/TypeDef.h | 2 ++ source/Lib/DecoderLib/CABACReader.cpp | 8 ++++++-- source/Lib/EncoderLib/CABACWriter.cpp | 4 ++++ source/Lib/EncoderLib/IntraSearch.cpp | 12 ++++++++++++ 5 files changed, 26 insertions(+), 2 deletions(-) diff --git a/source/Lib/CommonLib/Rom.cpp b/source/Lib/CommonLib/Rom.cpp index aadd7d8..e9972bf 100644 --- a/source/Lib/CommonLib/Rom.cpp +++ b/source/Lib/CommonLib/Rom.cpp @@ -621,7 +621,9 @@ const uint8_t g_aucTrSetHorz35[35] = }; //EMT threshold +#if !JVET_L0059_MTS_SIMP const uint32_t g_EmtSigNumThr = 2; +#endif #if !JVET_L0285_8BIT_TRANSFORM_CORE //EMT transform coeficient variable diff --git a/source/Lib/CommonLib/TypeDef.h b/source/Lib/CommonLib/TypeDef.h index 61f67ef..918a63e 100644 --- a/source/Lib/CommonLib/TypeDef.h +++ b/source/Lib/CommonLib/TypeDef.h @@ -50,6 +50,8 @@ #include #include +#define JVET_L0059_MTS_SIMP 1 // Simpification on MTS signaling + #define JVET_L0118_ALIGN_MTS_INDEX 1 // Align mts_index on intra and inter #define JVET_L0377_AMVR_ROUNDING_ALIGN 1 // Align AMVR rounding for AMVP candidate diff --git a/source/Lib/DecoderLib/CABACReader.cpp b/source/Lib/DecoderLib/CABACReader.cpp index b58966e..704ae08 100644 --- a/source/Lib/DecoderLib/CABACReader.cpp +++ b/source/Lib/DecoderLib/CABACReader.cpp @@ -2081,14 +2081,18 @@ void CABACReader::residual_coding( TransformUnit& tu, ComponentID compID ) { if( CU::isIntra( *tu.cu ) ) { - if( numSig > g_EmtSigNumThr ) +#if JVET_L0059_MTS_SIMP + emt_tu_index(tu); +#else + if (numSig > g_EmtSigNumThr) { - emt_tu_index( tu ); + emt_tu_index(tu); } else { tu.emtIdx = 0; //default transform } +#endif } else { diff --git a/source/Lib/EncoderLib/CABACWriter.cpp b/source/Lib/EncoderLib/CABACWriter.cpp index 7636c2b..609819e 100644 --- a/source/Lib/EncoderLib/CABACWriter.cpp +++ b/source/Lib/EncoderLib/CABACWriter.cpp @@ -1997,6 +1997,9 @@ void CABACWriter::residual_coding( const TransformUnit& tu, ComponentID compID ) { if( CU::isIntra( *tu.cu ) ) { +#if JVET_L0059_MTS_SIMP + emt_tu_index(tu); +#else if( numSig > g_EmtSigNumThr ) { emt_tu_index( tu ); @@ -2005,6 +2008,7 @@ void CABACWriter::residual_coding( const TransformUnit& tu, ComponentID compID ) { CHECK( tu.emtIdx != 0, "If the number of significant coefficients is <= g_EmtSigNumThr, then the tu index must be 0" ); } +#endif } else { diff --git a/source/Lib/EncoderLib/IntraSearch.cpp b/source/Lib/EncoderLib/IntraSearch.cpp index bf411cc..14486bf 100644 --- a/source/Lib/EncoderLib/IntraSearch.cpp +++ b/source/Lib/EncoderLib/IntraSearch.cpp @@ -1217,7 +1217,9 @@ void IntraSearch::xIntraCodingTUBlock(TransformUnit &tu, const ComponentID &comp const bool bUseCrossCPrediction = pps.getPpsRangeExtension().getCrossComponentPredictionEnabledFlag() && isChroma( compID ) && PU::isChromaIntraModeCrossCheckMode( pu ) && checkCrossCPrediction; const bool ccUseRecoResi = m_pcEncCfg->getUseReconBasedCrossCPredictionEstimate(); +#if !JVET_L0059_MTS_SIMP const uint8_t transformIndex = tu.cu->emtFlag && compID == COMPONENT_Y ? tu.emtIdx : DCT2_EMT ; +#endif //===== init availability pattern ===== PelBuf sharedPredTS( m_pSharedPredTransformSkip[compID], area ); @@ -1291,6 +1293,7 @@ void IntraSearch::xIntraCodingTUBlock(TransformUnit &tu, const ComponentID &comp m_pcTrQuant->transformNxN(tu, compID, cQP, uiAbsSum, m_CABACEstimator->getCtx()); +#if !JVET_L0059_MTS_SIMP if( transformIndex != DCT2_EMT && ( !tu.transformSkip[COMPONENT_Y] ) ) //this can only be true if compID is luma { *numSig = 0; @@ -1312,6 +1315,7 @@ void IntraSearch::xIntraCodingTUBlock(TransformUnit &tu, const ComponentID &comp return; } } +#endif DTRACE( g_trace_ctx, D_TU_ABS_SUM, "%d: comp=%d, abssum=%d\n", DTRACE_GET_COUNTER( g_trace_ctx, D_TU_ABS_SUM ), compID, uiAbsSum ); @@ -1504,12 +1508,20 @@ void IntraSearch::xRecurIntraCodingLumaQT( CodingStructure &cs, Partitioner &par //----- determine rate and r-d cost ----- //the condition (transformIndex != DCT2_EMT) seems to be irrelevant, since DCT2_EMT=7 and the highest value of transformIndex is 4 +#if JVET_L0059_MTS_SIMP +#if ENABLE_BMS + if( ( modeId == lastCheckId && checkTransformSkip && !TU::getCbfAtDepth( tu, COMPONENT_Y, currDepth ) ) ) +#else + if( ( modeId == lastCheckId && checkTransformSkip && !TU::getCbf( tu, COMPONENT_Y ) ) ) +#endif +#else #if ENABLE_BMS if( ( modeId == lastCheckId && checkTransformSkip && !TU::getCbfAtDepth( tu, COMPONENT_Y, currDepth ) ) || ( tu.emtIdx > 0 && ( checkTransformSkip ? transformIndex != lastCheckId : true ) && tu.emtIdx != DCT2_EMT && numSig <= g_EmtSigNumThr ) ) #else if( ( modeId == lastCheckId && checkTransformSkip && !TU::getCbf( tu, COMPONENT_Y ) ) || ( tu.emtIdx > 0 && ( checkTransformSkip ? transformIndex != lastCheckId : true ) && tu.emtIdx != DCT2_EMT && numSig <= g_EmtSigNumThr ) ) +#endif #endif { //In order not to code TS flag when cbf is zero, the case for TS with cbf being zero is forbidden. -- GitLab