From 61b5db3108531c37ded731dd23397c68af94fbf4 Mon Sep 17 00:00:00 2001 From: Philip Cowan <cowanp@sharplabs.com> Date: Mon, 9 Dec 2019 10:17:05 -0800 Subject: [PATCH] JVET-P0183: Conditionally signal cpb_removal_delay_delta_enabled_flag --- source/Lib/CommonLib/TypeDef.h | 2 ++ source/Lib/DecoderLib/SEIread.cpp | 30 +++++++++++++++++++++++++++--- source/Lib/EncoderLib/SEIwrite.cpp | 21 ++++++++++++++++++--- 3 files changed, 47 insertions(+), 6 deletions(-) diff --git a/source/Lib/CommonLib/TypeDef.h b/source/Lib/CommonLib/TypeDef.h index c9b72c627..6f9477925 100644 --- a/source/Lib/CommonLib/TypeDef.h +++ b/source/Lib/CommonLib/TypeDef.h @@ -234,6 +234,8 @@ #define JVET_M0497_MATRIX_MULT 0 // 0: Fast method; 1: Matrix multiplication +#define JVET_P0183 1 // JVET-P0183 : conditionally signal cpb_removal_delay_delta_enabled_flag + #define APPLY_SBT_SL_ON_MTS 1 // apply save & load fast algorithm on inter MTS when SBT is on #define HEVC_SEI 0 // SEI messages that are defined in HEVC, but not in VVC diff --git a/source/Lib/DecoderLib/SEIread.cpp b/source/Lib/DecoderLib/SEIread.cpp index 085546b46..2fb72457c 100644 --- a/source/Lib/DecoderLib/SEIread.cpp +++ b/source/Lib/DecoderLib/SEIread.cpp @@ -675,8 +675,20 @@ void SEIReader::xParseSEIPictureTiming(SEIPictureTiming& sei, uint32_t payloadSi sei_read_flag( pDecodedMessageOutputStream, symbol, "pt_sub_layer_delays_present_flag[i]" ); sei.m_ptSubLayerDelaysPresentFlag[i] = (symbol == 1); if( sei.m_ptSubLayerDelaysPresentFlag[ i ] ) { - sei_read_flag( pDecodedMessageOutputStream, symbol, "cpb_removal_delay_delta_enabled_flag[i]" ); - sei.m_cpbRemovalDelayDeltaEnabledFlag[i] = (symbol == 1); +#if JVET_P0183 + if (bp.m_cpbRemovalDelayDeltasPresentFlag) + { + sei_read_flag(pDecodedMessageOutputStream, symbol, "cpb_removal_delay_delta_enabled_flag[i]"); + sei.m_cpbRemovalDelayDeltaEnabledFlag[i] = (symbol == 1); + } + else + { + sei.m_cpbRemovalDelayDeltaEnabledFlag[i] = false; + } +#else + sei_read_flag(pDecodedMessageOutputStream, symbol, "cpb_removal_delay_delta_enabled_flag[i]"); + sei.m_cpbRemovalDelayDeltaEnabledFlag[i] = (symbol == 1); +#endif if( sei.m_cpbRemovalDelayDeltaEnabledFlag[ i ] ) { sei_read_code( pDecodedMessageOutputStream, ceilLog2(bp.m_numCpbRemovalDelayDeltas), symbol, "cpb_removal_delay_delta_idx[i]" ); @@ -699,7 +711,19 @@ void SEIReader::xParseSEIPictureTiming(SEIPictureTiming& sei, uint32_t payloadSi sei_read_flag( pDecodedMessageOutputStream, symbol, "sub_layer_delays_present_flag[i]" ); sei.m_subLayerDelaysPresentFlag[i] = (symbol == 1); if( sei.m_subLayerDelaysPresentFlag[ i ] ) { - sei_read_flag( pDecodedMessageOutputStream, symbol, "cpb_removal_delay_delta_enabled_flag[i]" ); sei.m_cpbRemovalDelayDeltaEnabledFlag[i] = (symbol == 1); +#if JVET_P0183 + if (bp.m_cpbRemovalDelayDeltasPresentFlag) + { + sei_read_flag(pDecodedMessageOutputStream, symbol, "cpb_removal_delay_delta_enabled_flag[i]"); + sei.m_cpbRemovalDelayDeltaEnabledFlag[i] = (symbol == 1); + } + else + { + sei.m_cpbRemovalDelayDeltaEnabledFlag[i] = false; + } +#else + sei_read_flag(pDecodedMessageOutputStream, symbol, "cpb_removal_delay_delta_enabled_flag[i]"); sei.m_cpbRemovalDelayDeltaEnabledFlag[i] = (symbol == 1); +#endif if( sei.m_cpbRemovalDelayDeltaEnabledFlag[ i ] ) { sei_read_code( pDecodedMessageOutputStream, ceilLog2(bp.m_numCpbRemovalDelayDeltas), symbol, "cpb_removal_delay_delta_idx[i]" ); diff --git a/source/Lib/EncoderLib/SEIwrite.cpp b/source/Lib/EncoderLib/SEIwrite.cpp index 8b57a40df..89d0a6548 100644 --- a/source/Lib/EncoderLib/SEIwrite.cpp +++ b/source/Lib/EncoderLib/SEIwrite.cpp @@ -414,7 +414,14 @@ void SEIWriter::xWriteSEIPictureTiming(const SEIPictureTiming& sei, const SPS *s WRITE_FLAG( sei.m_ptSubLayerDelaysPresentFlag[i], "pt_sub_layer_delays_present_flag[i]" ); if( sei.m_ptSubLayerDelaysPresentFlag[i] ) { - WRITE_FLAG( sei.m_cpbRemovalDelayDeltaEnabledFlag[i], "cpb_removal_delay_delta_enabled_flag[i]" ); +#if JVET_P0183 + if (bp.m_cpbRemovalDelayDeltasPresentFlag) + { + WRITE_FLAG(sei.m_cpbRemovalDelayDeltaEnabledFlag[i], "cpb_removal_delay_delta_enabled_flag[i]"); + } +#else + WRITE_FLAG(sei.m_cpbRemovalDelayDeltaEnabledFlag[i], "cpb_removal_delay_delta_enabled_flag[i]"); +#endif if( sei.m_cpbRemovalDelayDeltaEnabledFlag[i] ) { WRITE_CODE( sei.m_cpbRemovalDelayDeltaIdx[i], ceilLog2(bp.m_numCpbRemovalDelayDeltas), "cpb_removal_delay_delta_idx[i]" ); @@ -434,8 +441,16 @@ void SEIWriter::xWriteSEIPictureTiming(const SEIPictureTiming& sei, const SPS *s WRITE_FLAG( sei.m_subLayerDelaysPresentFlag[i], "sub_layer_delays_present_flag[i]" ); if( sei.m_subLayerDelaysPresentFlag[i] ) { - WRITE_FLAG( sei.m_cpbRemovalDelayDeltaEnabledFlag[i], "cpb_removal_delay_delta_enabled_flag[i]" ); - if( sei.m_cpbRemovalDelayDeltaEnabledFlag[i] ) + { +#if JVET_P0183 + if (bp.m_cpbRemovalDelayDeltasPresentFlag) + { + WRITE_FLAG(sei.m_cpbRemovalDelayDeltaEnabledFlag[i], "cpb_removal_delay_delta_enabled_flag[i]"); + } +#else + WRITE_FLAG(sei.m_cpbRemovalDelayDeltaEnabledFlag[i], "cpb_removal_delay_delta_enabled_flag[i]"); +#endif + if( sei.m_cpbRemovalDelayDeltaEnabledFlag[i] ) { WRITE_CODE( sei.m_cpbRemovalDelayDeltaIdx[i], ceilLog2(bp.m_numCpbRemovalDelayDeltas), "cpb_removal_delay_delta_idx[i]" ); } -- GitLab