Commit 6c4cddb3 authored by Xiang Li's avatar Xiang Li

Merge branch 'JVET-S0074-SPS-reorder' into 'master'

JVET-S0074: aspect 1, rearrange some SPS syntax elements

See merge request jvet/VVCSoftware_VTM!1721
parents acc47e45 44934a38
......@@ -52,7 +52,7 @@
//########### place macros to be removed in next cycle below this line ###############
#define JVET_S0074_SPS_REORDER 1 // JVET-S0074: aspect 1, rearrange some syntax elements in SPS
//########### place macros to be be kept below this line ###############
......
......@@ -1572,6 +1572,23 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS)
pcSPS->setLog2MaxTbSize(5);
}
#if JVET_S0074_SPS_REORDER
READ_FLAG(uiCode, "sps_transform_skip_enabled_flag"); pcSPS->setTransformSkipEnabledFlag(uiCode ? true : false);
if (pcSPS->getTransformSkipEnabledFlag())
{
READ_UVLC(uiCode, "log2_transform_skip_max_size_minus2");
pcSPS->setLog2MaxTransformSkipBlockSize(uiCode + 2);
READ_FLAG(uiCode, "sps_bdpcm_enabled_flag"); pcSPS->setBDPCMEnabledFlag(uiCode ? true : false);
}
READ_FLAG(uiCode, "sps_mts_enabled_flag"); pcSPS->setUseMTS(uiCode != 0);
if (pcSPS->getUseMTS())
{
READ_FLAG(uiCode, "sps_explicit_mts_intra_enabled_flag"); pcSPS->setUseIntraMTS(uiCode != 0);
READ_FLAG(uiCode, "sps_explicit_mts_inter_enabled_flag"); pcSPS->setUseInterMTS(uiCode != 0);
}
READ_FLAG(uiCode, "sps_lfnst_enabled_flag"); pcSPS->setUseLFNST(uiCode != 0);
#endif
if (chromaArrayType != CHROMA_400)
{
READ_FLAG(uiCode, "sps_joint_cbcr_enabled_flag"); pcSPS->setJointCbCrEnabledFlag(uiCode ? true : false);
......@@ -1611,6 +1628,9 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS)
pcSPS->setCCALFEnabledFlag(false);
}
#if JVET_S0074_SPS_REORDER
READ_FLAG(uiCode, "sps_lmcs_enable_flag"); pcSPS->setUseLmcs(uiCode == 1);
#else
READ_FLAG(uiCode, "sps_transform_skip_enabled_flag"); pcSPS->setTransformSkipEnabledFlag(uiCode ? true : false);
if (pcSPS->getTransformSkipEnabledFlag())
{
......@@ -1618,6 +1638,7 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS)
pcSPS->setLog2MaxTransformSkipBlockSize(uiCode + 2);
READ_FLAG(uiCode, "sps_bdpcm_enabled_flag"); pcSPS->setBDPCMEnabledFlag(uiCode ? true : false);
}
#endif
READ_FLAG( uiCode, "sps_weighted_pred_flag" ); pcSPS->setUseWP( uiCode ? true : false );
READ_FLAG( uiCode, "sps_weighted_bipred_flag" ); pcSPS->setUseWPBiPred( uiCode ? true : false );
......@@ -1795,13 +1816,14 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS)
pcSPS->setHorCollocatedChromaFlag(true);
pcSPS->setVerCollocatedChromaFlag(true);
}
#if !JVET_S0074_SPS_REORDER
READ_FLAG( uiCode, "sps_mts_enabled_flag" ); pcSPS->setUseMTS ( uiCode != 0 );
if ( pcSPS->getUseMTS() )
{
READ_FLAG( uiCode, "sps_explicit_mts_intra_enabled_flag" ); pcSPS->setUseIntraMTS ( uiCode != 0 );
READ_FLAG( uiCode, "sps_explicit_mts_inter_enabled_flag" ); pcSPS->setUseInterMTS ( uiCode != 0 );
}
#endif
READ_FLAG( uiCode, "sps_palette_enabled_flag"); pcSPS->setPLTMode ( uiCode != 0 );
if (chromaArrayType == CHROMA_444 && pcSPS->getLog2MaxTbSize() != 6)
{
......@@ -1827,8 +1849,11 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS)
}
else
pcSPS->setMaxNumIBCMergeCand(0);
#if !JVET_S0074_SPS_REORDER
READ_FLAG(uiCode, "sps_lmcs_enable_flag"); pcSPS->setUseLmcs(uiCode == 1);
READ_FLAG( uiCode, "sps_lfnst_enabled_flag" ); pcSPS->setUseLFNST( uiCode != 0 );
#endif
#if LUMA_ADAPTIVE_DEBLOCKING_FILTER_QP_OFFSET
READ_FLAG( uiCode, "sps_ladf_enabled_flag" ); pcSPS->setLadfEnabled( uiCode != 0 );
......
......@@ -917,6 +917,26 @@ void HLSWriter::codeSPS( const SPS* pcSPS )
if (pcSPS->getCTUSize() > 32)
WRITE_FLAG( (pcSPS->getLog2MaxTbSize() - 5) ? 1 : 0, "sps_max_luma_transform_size_64_flag" );
#if JVET_S0074_SPS_REORDER
WRITE_FLAG(pcSPS->getTransformSkipEnabledFlag() ? 1 : 0, "sps_transform_skip_enabled_flag");
if (pcSPS->getTransformSkipEnabledFlag())
{
WRITE_UVLC(pcSPS->getLog2MaxTransformSkipBlockSize() - 2, "log2_transform_skip_max_size_minus2");
WRITE_FLAG(pcSPS->getBDPCMEnabledFlag() ? 1 : 0, "sps_bdpcm_enabled_flag");
}
else
{
CHECK(pcSPS->getBDPCMEnabledFlag(), "BDPCM cannot be used when transform skip is disabled");
}
WRITE_FLAG(pcSPS->getUseMTS() ? 1 : 0, "sps_mts_enabled_flag");
if (pcSPS->getUseMTS())
{
WRITE_FLAG(pcSPS->getUseIntraMTS() ? 1 : 0, "sps_explicit_mts_intra_enabled_flag");
WRITE_FLAG(pcSPS->getUseInterMTS() ? 1 : 0, "sps_explicit_mts_inter_enabled_flag");
}
WRITE_FLAG(pcSPS->getUseLFNST() ? 1 : 0, "sps_lfnst_enabled_flag");
#endif
if (chromaArrayType != CHROMA_400)
{
WRITE_FLAG(pcSPS->getJointCbCrEnabledFlag(), "sps_joint_cbcr_enabled_flag");
......@@ -944,7 +964,9 @@ void HLSWriter::codeSPS( const SPS* pcSPS )
{
WRITE_FLAG( pcSPS->getCCALFEnabledFlag(), "sps_ccalf_enabled_flag" );
}
#if JVET_S0074_SPS_REORDER
WRITE_FLAG(pcSPS->getUseLmcs() ? 1 : 0, "sps_lmcs_enable_flag");
#else
WRITE_FLAG(pcSPS->getTransformSkipEnabledFlag() ? 1 : 0, "sps_transform_skip_enabled_flag");
if (pcSPS->getTransformSkipEnabledFlag())
{
......@@ -955,7 +977,7 @@ void HLSWriter::codeSPS( const SPS* pcSPS )
{
CHECK(pcSPS->getBDPCMEnabledFlag(), "BDPCM cannot be used when transform skip is disabled");
}
#endif
WRITE_FLAG(pcSPS->getUseWP() ? 1 : 0, "sps_weighted_pred_flag"); // Use of Weighting Prediction (P_SLICE)
WRITE_FLAG(pcSPS->getUseWPBiPred() ? 1 : 0, "sps_weighted_bipred_flag"); // Use of Weighting Bi-Prediction (B_SLICE)
......@@ -1068,13 +1090,14 @@ void HLSWriter::codeSPS( const SPS* pcSPS )
CHECK(pcSPS->getHorCollocatedChromaFlag() != 1, "Invalid value for horizontal collocated chroma flag");
CHECK(pcSPS->getVerCollocatedChromaFlag() != 1, "Invalid value for vertical collocated chroma flag");
}
#if !JVET_S0074_SPS_REORDER
WRITE_FLAG( pcSPS->getUseMTS() ? 1 : 0, "sps_mts_enabled_flag" );
if ( pcSPS->getUseMTS() )
{
WRITE_FLAG( pcSPS->getUseIntraMTS() ? 1 : 0, "sps_explicit_mts_intra_enabled_flag" );
WRITE_FLAG( pcSPS->getUseInterMTS() ? 1 : 0, "sps_explicit_mts_inter_enabled_flag" );
}
#endif
CHECK(pcSPS->getMaxNumMergeCand() > MRG_MAX_NUM_CANDS, "More merge candidates signalled than supported");
WRITE_FLAG(pcSPS->getPLTMode() ? 1 : 0, "sps_palette_enabled_flag" );
if (pcSPS->getChromaFormatIdc() == CHROMA_444 && pcSPS->getLog2MaxTbSize() != 6)
......@@ -1091,9 +1114,10 @@ void HLSWriter::codeSPS( const SPS* pcSPS )
CHECK(pcSPS->getMaxNumIBCMergeCand() > IBC_MRG_MAX_NUM_CANDS, "More IBC merge candidates signalled than supported");
WRITE_UVLC(IBC_MRG_MAX_NUM_CANDS - pcSPS->getMaxNumIBCMergeCand(), "six_minus_max_num_ibc_merge_cand");
}
#if !JVET_S0074_SPS_REORDER
WRITE_FLAG(pcSPS->getUseLmcs() ? 1 : 0, "sps_lmcs_enable_flag");
WRITE_FLAG( pcSPS->getUseLFNST() ? 1 : 0, "sps_lfnst_enabled_flag" );
#endif
#if LUMA_ADAPTIVE_DEBLOCKING_FILTER_QP_OFFSET
WRITE_FLAG( pcSPS->getLadfEnabled() ? 1 : 0, "sps_ladf_enabled_flag" );
if ( pcSPS->getLadfEnabled() )
......
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