diff --git a/source/App/EncoderApp/EncAppCfg.cpp b/source/App/EncoderApp/EncAppCfg.cpp index 5a84c4448866850f995a49286d61aeacbd9767a3..e70dd1a8e5f6317d7a8ec2ede7590ec3ec660e41 100644 --- a/source/App/EncoderApp/EncAppCfg.cpp +++ b/source/App/EncoderApp/EncAppCfg.cpp @@ -1895,6 +1895,10 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) opts.addOptions()("SEINNPostFilterActivationEnabled", m_nnPostFilterSEIActivationEnabled, false, "Control use of the Neural Network Post Filter SEI on current picture"); opts.addOptions()("SEINNPostFilterActivationId", m_nnPostFilterSEIActivationId , 0u, "Id of the Neural Network Post Filter on current picture"); +#if JVET_AB0050 + opts.addOptions()("SEINNPostFilterActivationCancelFlag", m_nnPostFilterSEIActivationCancelFlag, false, "Control use of the target neural network post filter established by any previous NNPFA SEI message"); + opts.addOptions()("SEINNPostFilterActivationPersistenceFlag", m_nnPostFilterSEIActivationPersistenceFlag, false, "Specifies the persistence of the target neural-network post-processing filter for the current layer"); +#endif } po::setDefaults(opts); diff --git a/source/App/EncoderApp/EncAppCfg.h b/source/App/EncoderApp/EncAppCfg.h index 5ab471ef68d08a2bcd307fe75f437cd721bce1d6..7a5cd9af7814bfbd47bb5e3f7535bcbef393db1d 100644 --- a/source/App/EncoderApp/EncAppCfg.h +++ b/source/App/EncoderApp/EncAppCfg.h @@ -775,6 +775,10 @@ protected: uint32_t m_nnPostFilterSEICharacteristicsNumberInputDecodedPicturesMinus2[MAX_NUM_NN_POST_FILTERS]; std::vector<uint32_t> m_nnPostFilterSEICharacteristicsNumberInterpolatedPictures[MAX_NUM_NN_POST_FILTERS]; #endif +#if JVET_AB0050 + bool m_nnPostFilterSEIActivationCancelFlag; + bool m_nnPostFilterSEIActivationPersistenceFlag; +#endif bool m_poSEIEnabled; std::vector<uint16_t> m_poSEIPayloadType; diff --git a/source/Lib/CommonLib/SEI.h b/source/Lib/CommonLib/SEI.h index 42f63bd5914171c2f5ec75fc359fe125bf3c0b4e..43e8da27f8934d39c9531e19728c2896091cf053 100644 --- a/source/Lib/CommonLib/SEI.h +++ b/source/Lib/CommonLib/SEI.h @@ -1297,10 +1297,18 @@ public: PayloadType payloadType() const { return PayloadType::NEURAL_NETWORK_POST_FILTER_ACTIVATION; } SEINeuralNetworkPostFilterActivation() : m_id(0) +#if JVET_AB0050 + , m_cancelFlag(false) + , m_persistenceFlag(false) +#endif {} virtual ~SEINeuralNetworkPostFilterActivation() {} uint32_t m_id; +#if JVET_AB0050 + bool m_cancelFlag; + bool m_persistenceFlag; +#endif }; //! \} diff --git a/source/Lib/CommonLib/TypeDef.h b/source/Lib/CommonLib/TypeDef.h index 0decfb92afadea7f523ecb293cd36a8f9548a08d..43f79436c9a8bf3a1322255b4627f93f06c972bb 100644 --- a/source/Lib/CommonLib/TypeDef.h +++ b/source/Lib/CommonLib/TypeDef.h @@ -55,8 +55,12 @@ // clang-format off //########### place macros to be removed in next cycle below this line ############### +<<<<<<< HEAD #define JVET_AB0051 1 // JVET-AB0051: Modification of SEI processing order SEI message #define JVET_AB0049 1 // JVET-AB0049: Modification of NNPFC +======= +#define JVET_AB0050 1 // JVET-AB0050: Add two flags for NNPFA +>>>>>>> ab8d965b (AB0050: Add two flags for NNPFA) #define JVET_T0056_SEI_MANIFEST 1 // JVET-T0056: SEI manifest SEI message #define JVET_T0056_SEI_PREFIX_INDICATION 1 // JVET-T0056: SEI prefix indication SEI message #define JVET_AB0069_SEI_PROCESSING_ORDER 1 // JVET-AB0069: SEI processing order SEI message update diff --git a/source/Lib/DecoderLib/SEIread.cpp b/source/Lib/DecoderLib/SEIread.cpp index b89db2778752c6bb7c2acd8eb18613cff3aecc03..076b97ba624bf568549672db1ef8900e7075f900 100644 --- a/source/Lib/DecoderLib/SEIread.cpp +++ b/source/Lib/DecoderLib/SEIread.cpp @@ -2927,8 +2927,20 @@ void SEIReader::xParseSEINNPostFilterActivation(SEINeuralNetworkPostFilterActiva sei_read_uvlc( pDecodedMessageOutputStream, val, "nnpfa_id" ); sei.m_id =val; +<<<<<<< HEAD #if JVET_AB0049 CHECK((sei.m_id >= 256 && sei.m_id <= 511) || (sei.m_id >= (1<<31) && sei.m_id <= MAX_NNPFA_ID), "Reserved nnpfa_id value, shall ignore the SEI message"); +======= +#if JVET_AB0050 + sei_read_flag( pDecodedMessageOutputStream, val, "nnpfa_cancel_flag" ); + sei.m_cancelFlag = val; + + if(!sei.m_cancelFlag) + { + sei_read_flag( pDecodedMessageOutputStream, val, "nnpfa_persistence_flag" ); + sei.m_persistenceFlag = val; + } +>>>>>>> ab8d965b (AB0050: Add two flags for NNPFA) #endif } diff --git a/source/Lib/EncoderLib/EncCfg.h b/source/Lib/EncoderLib/EncCfg.h index c9b84e2b99ec7deb48164660e0e5291484e7d9c8..9ff1af8b9b24a29b22a4fed5a7a3f65b99eef7b8 100644 --- a/source/Lib/EncoderLib/EncCfg.h +++ b/source/Lib/EncoderLib/EncCfg.h @@ -737,6 +737,10 @@ protected: bool m_nnPostFilterSEIActivationEnabled; uint32_t m_nnPostFilterSEIActivationId; +#if JVET_AB0050 + bool m_nnPostFilterSEIActivationCancelFlag; + bool m_nnPostFilterSEIActivationPersistenceFlag; +#endif // film grain characterstics sei bool m_fgcSEIEnabled; @@ -1982,6 +1986,12 @@ public: bool getNnPostFilterSEIActivationEnabled() const { return m_nnPostFilterSEIActivationEnabled; } void setNnPostFilterSEIActivationId(uint32_t id) { m_nnPostFilterSEIActivationId = id; } uint32_t getNnPostFilterSEIActivationId() const { return m_nnPostFilterSEIActivationId; } +#if JVET_AB0050 + void setNnPostFilterSEIActivationCancelFlag(bool cancelFlag) { m_nnPostFilterSEIActivationCancelFlag = cancelFlag; } + bool getNnPostFilterSEIActivationCancelFlag() const { return m_nnPostFilterSEIActivationCancelFlag;} + void setNnPostFilterSEIActivationPersistenceFlag(bool persistenceFlag) { m_nnPostFilterSEIActivationPersistenceFlag = persistenceFlag; } + bool getNnPostFilterSEIActivationPersistenceFlag() const { return m_nnPostFilterSEIActivationPersistenceFlag;} +#endif void setBufferingPeriodSEIEnabled(bool b) { m_bufferingPeriodSEIEnabled = b; } bool getBufferingPeriodSEIEnabled() const { return m_bufferingPeriodSEIEnabled; } diff --git a/source/Lib/EncoderLib/SEIEncoder.cpp b/source/Lib/EncoderLib/SEIEncoder.cpp index cc203d354704b93dd1882b47bbff5cd07228cbba..7019bec8dca217c06ed0d19a11f0042a3ca11f1d 100644 --- a/source/Lib/EncoderLib/SEIEncoder.cpp +++ b/source/Lib/EncoderLib/SEIEncoder.cpp @@ -1436,6 +1436,13 @@ void SEIEncoder::initSEINeuralNetworkPostFilterActivation(SEINeuralNetworkPostFi CHECK(!(m_isInitialized), "Unspecified error"); CHECK(!(sei != nullptr), "Unspecified error"); sei->m_id = m_pcCfg->getNnPostFilterSEIActivationId(); +#if JVET_AB0050 + sei->m_cancelFlag = m_pcCfg->getNnPostFilterSEIActivationCancelFlag(); + if(!sei->m_cancelFlag) + { + sei->m_persistenceFlag = m_pcCfg->getNnPostFilterSEIActivationPersistenceFlag(); + } +#endif } diff --git a/source/Lib/EncoderLib/SEIwrite.cpp b/source/Lib/EncoderLib/SEIwrite.cpp index 9930653dc2f21c3ecdf97d72890bbe46224d397c..397206812b4fc5332f04d18ddef3e1f0b7fe2781 100644 --- a/source/Lib/EncoderLib/SEIwrite.cpp +++ b/source/Lib/EncoderLib/SEIwrite.cpp @@ -1907,5 +1907,12 @@ void SEIWriter::xWriteNNPFCComplexityElement(const SEINeuralNetworkPostFilterCha void SEIWriter::xWriteSEINeuralNetworkPostFilterActivation(const SEINeuralNetworkPostFilterActivation &sei) { WRITE_UVLC(sei.m_id, "nnpfa_id"); +#if JVET_AB0050 + WRITE_FLAG(sei.m_cancelFlag, "nnpfa_cancel_flag"); + if(!sei.m_cancelFlag) + { + WRITE_FLAG(sei.m_persistenceFlag, "nnpfa_persistence_flag"); + } +#endif } //! \}