Added a config. file parameter for ISP

parent df51252e
......@@ -98,6 +98,7 @@ MTS : 1
MTSIntraMaxCand : 3
MTSInterMaxCand : 4
SBT : 1
ISP : 1
Affine : 1
SubPuMvp : 1
MaxNumMergeCand : 6
......
......@@ -114,6 +114,7 @@ MTS : 1
MTSIntraMaxCand : 3
MTSInterMaxCand : 4
SBT : 1
ISP : 1
Affine : 1
SubPuMvp : 1
MaxNumMergeCand : 6
......
......@@ -114,6 +114,7 @@ MTS : 1
MTSIntraMaxCand : 3
MTSInterMaxCand : 4
SBT : 1
ISP : 1
Affine : 1
SubPuMvp : 1
MaxNumMergeCand : 6
......
......@@ -128,6 +128,7 @@ MTS : 1
MTSIntraMaxCand : 3
MTSInterMaxCand : 4
SBT : 1
ISP : 1
Affine : 1
SubPuMvp : 1
MaxNumMergeCand : 6
......
......@@ -1771,6 +1771,20 @@ Enables or disables the use of a deblocking across tile boundaries.
Enables or disables the use of asymmetric motion partitions.
\\
\Option{ISP} &
%\ShortOption{\None} &
\Default{false} &
Enables or disables the Intra Sub-Partitions coding mode.
\\
\Option{ISPFast} &
%\ShortOption{\None} &
\Default{false} &
Enables or disables reduced testing of non-DCT-II transforms if ISP is likely to become the best mode for a given CU.
\par
This option has no effect if either ISP or MTS are disabled.
\\
\Option{SAO} &
%\ShortOption{\None} &
\Default{true} &
......
......@@ -346,6 +346,9 @@ void EncApp::xInitLibCfg()
m_cEncLib.setUseBLambdaForNonKeyLowDelayPictures ( m_bUseBLambdaForNonKeyLowDelayPictures );
m_cEncLib.setPCMLog2MinSize ( m_uiPCMLog2MinSize);
m_cEncLib.setUsePCM ( m_usePCM );
#if INCLUDE_ISP_CFG_FLAG
m_cEncLib.setUseISP ( m_ISP );
#endif
m_cEncLib.setUseFastISP ( m_useFastISP );
// set internal bit-depth and constants
......
......@@ -857,6 +857,9 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] )
("MTSInterMaxCand", m_MTSInterMaxCand, 4, "Number of additional candidates to test in encoder search for MTS in inter slices\n")
("MTSImplicit", m_MTSImplicit, 0, "Enable implicit MTS (when explicit MTS is off)\n")
( "SBT", m_SBT, false, "Enable Sub-Block Transform for inter blocks\n" )
#if INCLUDE_ISP_CFG_FLAG
( "ISP", m_ISP, false, "Enable Intra Sub-Partitions\n" )
#endif
#if JVET_N0235_SMVD_SPS
("SMVD", m_SMVD, false, "Enable Symmetric MVD\n")
#endif
......@@ -3147,6 +3150,9 @@ void EncAppCfg::xPrintParameter()
}
msg( VERBOSE, "MTS: %1d(intra) %1d(inter) ", m_MTS & 1, ( m_MTS >> 1 ) & 1 );
msg( VERBOSE, "SBT:%d ", m_SBT );
#if INCLUDE_ISP_CFG_FLAG
msg( VERBOSE, "ISP:%d ", m_ISP );
#endif
#if JVET_N0235_SMVD_SPS
msg( VERBOSE, "SMVD:%d ", m_SMVD );
#endif
......@@ -3188,7 +3194,11 @@ void EncAppCfg::xPrintParameter()
msg( VERBOSE, "PBIntraFast:%d ", m_usePbIntraFast );
if( m_ImvMode ) msg( VERBOSE, "IMV4PelFast:%d ", m_Imv4PelFast );
if( m_MTS ) msg( VERBOSE, "MTSMaxCand: %1d(intra) %1d(inter) ", m_MTSIntraMaxCand, m_MTSInterMaxCand );
#if INCLUDE_ISP_CFG_FLAG
if( m_ISP ) msg( VERBOSE, "ISPFast:%d ", m_useFastISP );
#else
msg( VERBOSE, "ISPFast:%d ", m_useFastISP );
#endif
msg( VERBOSE, "AMaxBT:%d ", m_useAMaxBT );
msg( VERBOSE, "E0023FastEnc:%d ", m_e0023FastEnc );
msg( VERBOSE, "ContentBasedFastQtbt:%d ", m_contentBasedFastQtbt );
......
......@@ -178,6 +178,9 @@ protected:
bool m_rdpcmEnabledFlag[NUMBER_OF_RDPCM_SIGNALLING_MODES];///< control flags for residual DPCM
bool m_persistentRiceAdaptationEnabledFlag; ///< control flag for Golomb-Rice parameter adaptation over each slice
bool m_cabacBypassAlignmentEnabledFlag;
#if INCLUDE_ISP_CFG_FLAG
bool m_ISP;
#endif
bool m_useFastISP; ///< flag for enabling fast methods for ISP
// coding quality
......
......@@ -1788,6 +1788,9 @@ SPS::SPS()
, m_DMVR ( false )
, m_SBT ( false )
, m_MaxSbtSize ( 32 )
#if INCLUDE_ISP_CFG_FLAG
, m_ISP ( false )
#endif
#if HEVC_VPS
, m_VPSId ( 0)
#endif
......
......@@ -1014,6 +1014,9 @@ private:
bool m_DMVR;
bool m_SBT;
uint8_t m_MaxSbtSize;
#if INCLUDE_ISP_CFG_FLAG
bool m_ISP;
#endif
#if HEVC_VPS
int m_VPSId;
#endif
......@@ -1357,6 +1360,10 @@ public:
unsigned getIBCFlag() const { return m_IBCFlag; }
void setUseSBT( bool b ) { m_SBT = b; }
bool getUseSBT() const { return m_SBT; }
#if INCLUDE_ISP_CFG_FLAG
void setUseISP( bool b ) { m_ISP = b; }
bool getUseISP() const { return m_ISP; }
#endif
void setMaxSbtSize( uint8_t val ) { m_MaxSbtSize = val; }
uint8_t getMaxSbtSize() const { return m_MaxSbtSize; }
......
......@@ -705,8 +705,11 @@ void TrQuant::transformNxN( TransformUnit &tu, const ComponentID &compID, const
void TrQuant::xGetCoeffEnergy( TransformUnit &tu, const ComponentID &compID, const CoeffBuf& coeffs, double* diagRatio, double* horVerRatio )
{
if( nullptr == diagRatio || nullptr == horVerRatio ) return;
#if INCLUDE_ISP_CFG_FLAG
if( tu.cu->predMode == MODE_INTRA && !tu.cu->ispMode && isLuma( compID ) && tu.cs->sps->getUseISP() && CU::canUseISPSplit( *tu.cu, compID ) != NOT_INTRA_SUBPARTITIONS )
#else
if( tu.cu->predMode == MODE_INTRA && !tu.cu->ispMode && isLuma( compID ) && CU::canUseISPSplit( *tu.cu, compID ) != NOT_INTRA_SUBPARTITIONS )
#endif
{
const int width = tu.cu->blocks[compID].width;
const int height = tu.cu->blocks[compID].height;
......
......@@ -152,6 +152,7 @@ typedef std::pair<int, bool> TrMode;
typedef std::pair<int, int> TrCost;
// clang-format off
#define INCLUDE_ISP_CFG_FLAG 1
#define ENABLE_JVET_L0283_MRL 1 // 1: Enable MRL, 0: Disable MRL
#define JVET_L0090_PAIR_AVG 1 // Add pairwise average candidates, replace HEVC combined candidates
#define REUSE_CU_RESULTS 1
......
......@@ -2562,7 +2562,11 @@ void CABACReader::mts_coding( TransformUnit& tu, ComponentID compID )
void CABACReader::isp_mode( CodingUnit& cu )
{
#if INCLUDE_ISP_CFG_FLAG
if( !CU::isIntra( cu ) || !isLuma( cu.chType ) || cu.firstPU->multiRefIdx || cu.ipcm || !cu.cs->sps->getUseISP() )
#else
if( !CU::isIntra( cu ) || !isLuma( cu.chType ) || cu.firstPU->multiRefIdx || cu.ipcm )
#endif
{
cu.ispMode = NOT_INTRA_SUBPARTITIONS;
return;
......
......@@ -1143,6 +1143,9 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS)
}
// KJS: not in draft yet
READ_FLAG(uiCode, "sps_reshaper_enable_flag"); pcSPS->setUseReshaper(uiCode == 1);
#if INCLUDE_ISP_CFG_FLAG
READ_FLAG(uiCode, "isp_enable_flag"); pcSPS->setUseISP(uiCode != 0);
#endif
#if LUMA_ADAPTIVE_DEBLOCKING_FILTER_QP_OFFSET
READ_FLAG( uiCode, "sps_ladf_enabled_flag" ); pcSPS->setLadfEnabled( uiCode != 0 );
......
......@@ -2467,7 +2467,11 @@ void CABACWriter::mts_coding( const TransformUnit& tu, ComponentID compID )
void CABACWriter::isp_mode( const CodingUnit& cu )
{
#if INCLUDE_ISP_CFG_FLAG
if( !CU::isIntra( cu ) || !isLuma( cu.chType ) || cu.firstPU->multiRefIdx || cu.ipcm || !cu.cs->sps->getUseISP() )
#else
if( !CU::isIntra( cu ) || !isLuma( cu.chType ) || cu.firstPU->multiRefIdx || cu.ipcm )
#endif
{
CHECK( cu.ispMode != NOT_INTRA_SUBPARTITIONS, "error: cu.intraSubPartitions != 0" );
return;
......
......@@ -373,6 +373,9 @@ protected:
int* m_aidQP;
uint32_t m_uiDeltaQpRD;
bool m_bFastDeltaQP;
#if INCLUDE_ISP_CFG_FLAG
bool m_ISP;
#endif
bool m_useFastISP;
bool m_bUseConstrainedIntraPred;
......@@ -799,7 +802,10 @@ public:
unsigned getWrapAroundOffset () const { return m_wrapAroundOffset; }
// ADD_NEW_TOOL : (encoder lib) add access functions here
#if INCLUDE_ISP_CFG_FLAG
void setUseISP ( bool b ) { m_ISP = b; }
bool getUseISP () const { return m_ISP; }
#endif
void setReshaper ( bool b ) { m_lumaReshapeEnable = b; }
bool getReshaper () const { return m_lumaReshapeEnable; }
void setReshapeSignalType ( uint32_t signalType ) { m_reshapeSignalType = signalType; }
......
......@@ -987,6 +987,9 @@ void EncLib::xInitSPS(SPS &sps)
sps.setWrapAroundEnabledFlag ( m_wrapAround );
sps.setWrapAroundOffset ( m_wrapAroundOffset );
// ADD_NEW_TOOL : (encoder lib) set tool enabling flags and associated parameters here
#if INCLUDE_ISP_CFG_FLAG
sps.setUseISP ( m_ISP );
#endif
sps.setUseReshaper ( m_lumaReshapeEnable );
int minCUSize = sps.getMaxCUWidth() >> sps.getLog2DiffMaxMinCodingBlockSize();
int log2MinCUSize = 0;
......
......@@ -292,7 +292,11 @@ void IntraSearch::estIntraPredLumaQT( CodingUnit &cu, Partitioner &partitioner,
const int width = partitioner.currArea().lwidth();
const int height = partitioner.currArea().lheight();
#if INCLUDE_ISP_CFG_FLAG
int nOptionsForISP = sps.getUseISP() ? NUM_INTRA_SUBPARTITIONS_MODES : 1;
#else
int nOptionsForISP = NUM_INTRA_SUBPARTITIONS_MODES;
#endif
double bestCurrentCost = bestCostSoFar;
int ispOptions[NUM_INTRA_SUBPARTITIONS_MODES] = { 0 };
......@@ -1607,7 +1611,11 @@ 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 INCLUDE_ISP_CFG_FLAG
const bool ispSplitIsAllowed = sps.getUseISP() && CU::canUseISPSplit( *tu.cu, compID );
#else
const bool ispSplitIsAllowed = CU::canUseISPSplit( *tu.cu, compID );
#endif
//===== init availability pattern =====
......@@ -1752,9 +1760,11 @@ void IntraSearch::xIntraCodingTUBlock(TransformUnit &tu, const ComponentID &comp
tu.mtsIdx = trModes->at(0).first;
}
m_pcTrQuant->transformNxN( tu, compID, cQP, uiAbsSum, m_CABACEstimator->getCtx(), loadTr, &diagRatio, &horVerRatio );
if (!tu.cu->ispMode && isLuma(compID) && ispSplitIsAllowed &&
tu.mtsIdx == 0
)
#if INCLUDE_ISP_CFG_FLAG
if ( !tu.cu->ispMode && isLuma(compID) && ispSplitIsAllowed && tu.mtsIdx == 0 && ispSplitIsAllowed )
#else
if ( !tu.cu->ispMode && isLuma(compID) && ispSplitIsAllowed && tu.mtsIdx == 0 )
#endif
{
m_intraModeDiagRatio .push_back(diagRatio);
m_intraModeHorVerRatio .push_back(horVerRatio);
......
......@@ -794,6 +794,9 @@ void HLSWriter::codeSPS( const SPS* pcSPS )
}
// KJS: not in draft yet
WRITE_FLAG(pcSPS->getUseReshaper() ? 1 : 0, "sps_reshaper_enable_flag");
#if INCLUDE_ISP_CFG_FLAG
WRITE_FLAG( pcSPS->getUseISP() ? 1 : 0, "isp_enable_flag");
#endif
#if LUMA_ADAPTIVE_DEBLOCKING_FILTER_QP_OFFSET
WRITE_FLAG( pcSPS->getLadfEnabled() ? 1 : 0, "sps_ladf_enabled_flag" );
......
Markdown is supported
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