Commit 75a30d45 authored by Xiang Li's avatar Xiang Li
Browse files

Merge branch 'hegilmez/VVCSoftware_VTM-Integration_JVET_O0368'

parents 00d3751b 4efb1cca
......@@ -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_O0106_ISP_4xN_PREDREG_FOR_1xN_2xN 1 // JVET-O0106: use 4xN prediction regions for 1xN and 2xN subblocks
#define JVET_O0500_SEP_CTX_AFFINE_SUBBLOCK_MRG 1 // JVET-O0500: Different ctx models for inter affine flag and subblock merge flag
......
......@@ -2845,8 +2845,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;
......@@ -2860,7 +2864,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 )
......
......@@ -2727,8 +2727,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;
}
......@@ -2740,7 +2744,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