Commit 4efb1cca authored by Hilmi Egilmez's avatar Hilmi Egilmez
Browse files

JVET-O0368/O0292/O0521/O0466: disabling LFNST for non-DCT2 MTS candidates normatively

- LNFST is applied only on top of DCT-2
parent 829fd694
......@@ -50,6 +50,8 @@
#include <assert.h>
#include <cassert>
#define JVET_O0368_LFNST_WITH_DCT2_ONLY 1 // JVET-O0368/O0292/O0521/O0466: disable LFNST for non-DCT2 MTS candidates normatively
#define JVET_O0258_REMOVE_CHROMA_IBC_FOR_DUALTREE 1 // JVET-O0258 Remove chroma IBC when dualtree is used
#define JVET_O1161_IBC_MAX_SIZE 1 // Limit largest IBC luma CU size to 64x64 per discussion of JVET-O1161
......
......@@ -2841,8 +2841,12 @@ void CABACReader::residual_lfnst_mode( CodingUnit& cu )
#endif
const int nonZeroCoeffThr = CS::isDualITree( *cu.cs ) ? ( isLuma( cu.chType ) ? LFNST_SIG_NZ_LUMA : LFNST_SIG_NZ_CHROMA ) : LFNST_SIG_NZ_LUMA + LFNST_SIG_NZ_CHROMA;
nonZeroCoeffNonTs = CU::getNumNonZeroCoeffNonTs( cu, lumaFlag, chromaFlag ) > nonZeroCoeffThr;
#if JVET_O0368_LFNST_WITH_DCT2_ONLY
const bool isNonDCT2 = (TU::getCbf(*cu.firstTU, ComponentID(COMPONENT_Y)) && cu.firstTU->mtsIdx != MTS_DCT2_DCT2);
if (!nonZeroCoeffNonTs || nonZeroCoeffNonTsCorner8x8 || isNonDCT2)
#else
if( !nonZeroCoeffNonTs || nonZeroCoeffNonTsCorner8x8 )
#endif
{
cu.lfnstIdx = 0;
return;
......@@ -2856,7 +2860,11 @@ void CABACReader::residual_lfnst_mode( CodingUnit& cu )
unsigned cctx = 0;
#if JVET_O0368_LFNST_WITH_DCT2_ONLY
if ( CS::isDualITree(*cu.cs) ) cctx++;
#else
if( cu.firstTU->mtsIdx < MTS_DST7_DST7 && CS::isDualITree( *cu.cs ) ) cctx++;
#endif
uint32_t idxLFNST = m_BinDecoder.decodeBin( Ctx::LFNSTIdx( cctx ) );
if( idxLFNST )
......
......@@ -2723,8 +2723,12 @@ void CABACWriter::residual_lfnst_mode( const CodingUnit& cu, CUCtx& cuCtx )
const int nonZeroCoeffThr = CS::isDualITree( *cu.cs ) ? ( isLuma( cu.chType ) ? LFNST_SIG_NZ_LUMA : LFNST_SIG_NZ_CHROMA ) : LFNST_SIG_NZ_LUMA + LFNST_SIG_NZ_CHROMA;
cuCtx.numNonZeroCoeffNonTs = CU::getNumNonZeroCoeffNonTs( cu, lumaFlag, chromaFlag );
nonZeroCoeffNonTs = cuCtx.numNonZeroCoeffNonTs > nonZeroCoeffThr;
#if JVET_O0368_LFNST_WITH_DCT2_ONLY
const bool isNonDCT2 = (TU::getCbf(*cu.firstTU, ComponentID(COMPONENT_Y)) && cu.firstTU->mtsIdx != MTS_DCT2_DCT2);
if (!nonZeroCoeffNonTs || nonZeroCoeffNonTsCorner8x8 || isNonDCT2 )
#else
if( !nonZeroCoeffNonTs || nonZeroCoeffNonTsCorner8x8 )
#endif
{
return;
}
......@@ -2736,7 +2740,11 @@ void CABACWriter::residual_lfnst_mode( const CodingUnit& cu, CUCtx& cuCtx )
unsigned cctx = 0;
#if JVET_O0368_LFNST_WITH_DCT2_ONLY
if ( CS::isDualITree(*cu.cs) ) cctx++;
#else
if( cu.firstTU->mtsIdx < MTS_DST7_DST7 && CS::isDualITree( *cu.cs ) ) cctx++;
#endif
const uint32_t idxLFNST = cu.lfnstIdx;
assert( idxLFNST < 3 );
......
......@@ -1395,6 +1395,12 @@ void EncCu::xCheckRDCostIntra( CodingStructure *&tempCS, CodingStructure *&bestC
{
for( uint8_t mtsFlag = startMtsFlag; mtsFlag <= endMtsFlag; mtsFlag++ )
{
#if JVET_O0368_LFNST_WITH_DCT2_ONLY
if (mtsFlag > 0 && lfnstIdx > 0)
{
continue;
}
#endif
//3) if interHad is 0, only try further modes if some intra mode was already better than inter
if( sps.getUseLFNST() && m_pcEncCfg->getUsePbIntraFast() && !tempCS->slice->isIntra() && bestCU && CU::isInter( *bestCS->getCU( partitioner.chType ) ) && interHad == 0 )
{
......
Supports Markdown
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