diff --git a/doc/software-manual.tex b/doc/software-manual.tex index d2e4749792976458f98264ff4ef5834dfd233e99..6b7c06e2952f52f33a0c2f3759a527e2dc2e7b65 100644 --- a/doc/software-manual.tex +++ b/doc/software-manual.tex @@ -5942,6 +5942,18 @@ Specifies sii_num_units_in_shutter_interval for single entry.If multiple entries \Default{0} & Specifies the bottom offset of spatial extrapolation for the \emph{i}-th neural network post-filter. \\ + \Option{SEINNPFCAapplicationPurposeTagUriPresentFlag\emph{i}} & + \Default{false} & + Specifies the nnpfc_application_purpose_tag_uri_present_flag syntax element for the \emph{i}-th neural network post-filter. + \par + When true (non-zero) specifies the presence of the nnpfc_application_purpose_tag_uri syntax element in the NNPFC SEI message. + \par + When false specifies the absence of the nnpfc_application_purpose_tag_uri syntax element in the NNPFC SEI message. + \\ + \Option{SEINNPFCApplicationPurposeTagUri\emph{i}} & + \Default{""} & + specifies a tag URI with syntax and semantics as specified in IETF RFC 4151 identifying the application determined purpose of the NNPF, when nnpfc_purpose is equal to 0 of the \emph{i}-th neural network post-filter. + \\ \Option{SEINNPFCInputPicOutputFlag\emph{i}} & \Default{false} & Indicates whether the i-th neural network post filter generates a corresponding output picture for the i-th input picture. diff --git a/source/App/EncoderApp/EncApp.cpp b/source/App/EncoderApp/EncApp.cpp index 7646ad15d0ef7a85d5ce5d228f4d80183f7c697e..91ae18d6cc96d5219b43ddad7f4d3d6bcf2d0785 100644 --- a/source/App/EncoderApp/EncApp.cpp +++ b/source/App/EncoderApp/EncApp.cpp @@ -1281,6 +1281,13 @@ void EncApp::xInitLibCfg( int layerIdx ) m_cEncLib.setNNPostFilterSEICharacteristicsSpatialExtrapolationRightOffset (m_nnPostFilterSEICharacteristicsSpatialExtrapolationRightOffset[i], i); m_cEncLib.setNNPostFilterSEICharacteristicsSpatialExtrapolationTopOffset (m_nnPostFilterSEICharacteristicsSpatialExtrapolationTopOffset[i], i); m_cEncLib.setNNPostFilterSEICharacteristicsSpatialExtrapolationBottomOffset(m_nnPostFilterSEICharacteristicsSpatialExtrapolationBottomOffset[i], i); +#if JVET_AI0061_SPATIAL_EXTRAPOLATION_PROPOSAL1 + m_cEncLib.setNNPostFilterSEICharacteristicsSpatialExtrapolationPromptPresentFlag( m_nnPostFilterSEICharacteristicsSpatialExtrapolationPromptPresentFlag[i], i); + if (m_cEncLib.getNNPostFilterSEICharacteristicsSpatialExtrapolationPromptPresentFlag(i)) + { + m_cEncLib.setNNPostFilterSEICharacteristicsSpatialExrapolationPrompt( m_nnPostFilterSEICharacteristicsSpatialExtrapolationPrompt[i], i); + } +#endif } #endif m_cEncLib.setNNPostFilterSEICharacteristicsAbsentInputPicZeroFlag (m_nnPostFilterSEICharacteristicsAbsentInputPicZeroFlag[i], i); diff --git a/source/App/EncoderApp/EncAppCfg.cpp b/source/App/EncoderApp/EncAppCfg.cpp index 03677fdf8e446e7387a4fdcc6f8bf7f8c13b921b..f7e1ae7ca63b0025cdf8aeaeb7dc3f8e86a5615e 100644 --- a/source/App/EncoderApp/EncAppCfg.cpp +++ b/source/App/EncoderApp/EncAppCfg.cpp @@ -2077,6 +2077,14 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) std::ostringstream spatialExtrapolationBottomOffset; spatialExtrapolationBottomOffset << "SEINNPFCSpatialExtrapolationLeftOffset" << i; opts.addOptions()(spatialExtrapolationBottomOffset.str(), m_nnPostFilterSEICharacteristicsSpatialExtrapolationBottomOffset[i], 0, "Bottom offset of spatial extrapolation"); +#if JVET_AI0061_SPATIAL_EXTRAPOLATION_PROPOSAL1 + std::ostringstream spatialextrapolationPromptPresentFlag; + spatialextrapolationPromptPresentFlag << "SEINNPFCSpatialExtrapolationPromptPresentFlag" << i; + opts.addOptions()(spatialextrapolationPromptPresentFlag.str(), m_nnPostFilterSEICharacteristicsSpatialExtrapolationPromptPresentFlag[i], false, "equal to 1 specifies that nnpfc_prompt syntax element is present and nnpfc_alignment_zero_bit_c syntax element may be present. nnpfc_spatial_extrapolation_prompt_present_flag equal to 0 specifies that nnpfc_prompt syntax element and nnpfc_alignment_zero_bit_c syntax element are not present."); + std::ostringstream spatialextrapolationPrompt; + spatialextrapolationPrompt << "SEINNPFCSpatialExtrapolationPrompt" << i; + opts.addOptions()(spatialextrapolationPrompt.str(), m_nnPostFilterSEICharacteristicsSpatialExtrapolationPrompt[i], std::string(""), "specifies the text string prompt used for generating the contents of the spatial extrapolation image area."); +#endif #endif std::ostringstream InputPicOutputFlag; InputPicOutputFlag << "SEINNPFCInputPicOutputFlag" << i; diff --git a/source/App/EncoderApp/EncAppCfg.h b/source/App/EncoderApp/EncAppCfg.h index 33fe7bebae4b94f5b7aad94ec32700ace229aa7f..849e32348518888f76e0841f3693979b48ca7709 100644 --- a/source/App/EncoderApp/EncAppCfg.h +++ b/source/App/EncoderApp/EncAppCfg.h @@ -829,6 +829,10 @@ protected: int32_t m_nnPostFilterSEICharacteristicsSpatialExtrapolationRightOffset[MAX_NUM_NN_POST_FILTERS]; int32_t m_nnPostFilterSEICharacteristicsSpatialExtrapolationTopOffset[MAX_NUM_NN_POST_FILTERS]; int32_t m_nnPostFilterSEICharacteristicsSpatialExtrapolationBottomOffset[MAX_NUM_NN_POST_FILTERS]; +#if JVET_AI0061_SPATIAL_EXTRAPOLATION_PROPOSAL1 + bool m_nnPostFilterSEICharacteristicsSpatialExtrapolationPromptPresentFlag[MAX_NUM_NN_POST_FILTERS]; + std::string m_nnPostFilterSEICharacteristicsSpatialExtrapolationPrompt[MAX_NUM_NN_POST_FILTERS]; +#endif #endif std::vector<bool> m_nnPostFilterSEICharacteristicsInputPicOutputFlag[MAX_NUM_NN_POST_FILTERS]; bool m_nnPostFilterSEICharacteristicsAbsentInputPicZeroFlag[MAX_NUM_NN_POST_FILTERS]; diff --git a/source/Lib/CommonLib/SEI.cpp b/source/Lib/CommonLib/SEI.cpp index f4db195f36af8995885d871026bd5594ff9b3c10..13420bd61bacb603f29c5d004a3d8586f04b6ec7 100644 --- a/source/Lib/CommonLib/SEI.cpp +++ b/source/Lib/CommonLib/SEI.cpp @@ -1027,6 +1027,10 @@ SEINeuralNetworkPostFilterCharacteristics::SEINeuralNetworkPostFilterCharacteris m_spatialExtrapolationRightOffset = sei.m_spatialExtrapolationRightOffset; m_spatialExtrapolationTopOffset = sei.m_spatialExtrapolationTopOffset; m_spatialExtrapolationBottomOffset = sei.m_spatialExtrapolationBottomOffset; +#if JVET_AI0061_SPATIAL_EXTRAPOLATION_PROPOSAL1 + m_spatialExtrapolationPromptPresentFlag = sei.m_spatialExtrapolationPromptPresentFlag; + m_prompt = sei.m_prompt; +#endif #endif m_inputPicOutputFlag = sei.m_inputPicOutputFlag; } @@ -1095,6 +1099,10 @@ bool SEINeuralNetworkPostFilterCharacteristics::operator == (const SEINeuralNetw m_spatialExtrapolationRightOffset == sei.m_spatialExtrapolationRightOffset && m_spatialExtrapolationTopOffset == sei.m_spatialExtrapolationTopOffset && m_spatialExtrapolationBottomOffset == sei.m_spatialExtrapolationBottomOffset && +#if JVET_AI0061_SPATIAL_EXTRAPOLATION_PROPOSAL1 + m_spatialExtrapolationPromptPresentFlag == sei.m_spatialExtrapolationPromptPresentFlag && + m_prompt == sei.m_prompt && +#endif #endif m_inputPicOutputFlag == sei.m_inputPicOutputFlag && m_payloadLength == sei.m_payloadLength; diff --git a/source/Lib/CommonLib/SEI.h b/source/Lib/CommonLib/SEI.h index a934673f4b67aa865e7e558442caee8e6d2050ca..9092f24c836893fa6eb9421c45b934d84f1aa884 100644 --- a/source/Lib/CommonLib/SEI.h +++ b/source/Lib/CommonLib/SEI.h @@ -1440,6 +1440,10 @@ public: , m_spatialExtrapolationRightOffset(0) , m_spatialExtrapolationTopOffset(0) , m_spatialExtrapolationBottomOffset(0) +#if JVET_AI0061_SPATIAL_EXTRAPOLATION_PROPOSAL1 + , m_spatialExtrapolationPromptPresentFlag(false) + , m_prompt("") +#endif #endif , m_absentInputPicZeroFlag(false) , m_numInpPicsInOutputTensor(0) @@ -1527,6 +1531,10 @@ public: int32_t m_spatialExtrapolationRightOffset; int32_t m_spatialExtrapolationTopOffset; int32_t m_spatialExtrapolationBottomOffset; +#if JVET_AI0061_SPATIAL_EXTRAPOLATION_PROPOSAL1 + bool m_spatialExtrapolationPromptPresentFlag; + std::string m_prompt; +#endif #endif std::vector<bool> m_inputPicOutputFlag; bool m_absentInputPicZeroFlag; diff --git a/source/Lib/CommonLib/TypeDef.h b/source/Lib/CommonLib/TypeDef.h index cc2c6cd2b0ba0e1cba3743c038d1305b945be871..b25b498469844e59d2d4cef65ac286e1609fa3da 100644 --- a/source/Lib/CommonLib/TypeDef.h +++ b/source/Lib/CommonLib/TypeDef.h @@ -70,6 +70,8 @@ #define JVET_AI0153_OMI_SEI 1 // JVET-AI0153: OMI-SEI Implementation as JVET-AH0346 +#define JVET_AI0061_SPATIAL_EXTRAPOLATION_PROPOSAL1 1 //JVET-AI0061 proposal 1: signal a NNPFC prompt for spatial extrapolation + #define JVET_AI0061_PROPOSAL2_SPATIAL_EXTRAPOLATION 1 // JVET AI0061-Proposal2: Ensure spatial extrapolation works correctly (Option 1) //########### place macros to be be kept below this line ############### diff --git a/source/Lib/DecoderLib/SEIread.cpp b/source/Lib/DecoderLib/SEIread.cpp index 32c982346070ae1a9a8ce0fe05107be5e983243f..d6e7eb6d62982219e0bba8709848a8516f3890d7 100644 --- a/source/Lib/DecoderLib/SEIread.cpp +++ b/source/Lib/DecoderLib/SEIread.cpp @@ -3188,6 +3188,21 @@ void SEIReader::xParseSEINNPostFilterCharacteristics(SEINeuralNetworkPostFilterC sei.m_spatialExtrapolationTopOffset = value; sei_read_svlc(pDecodedMessageOutputStream, value, "nnpfc_spatial_extrapolation_bottom_offset"); sei.m_spatialExtrapolationBottomOffset = value; +#if JVET_AI0061_SPATIAL_EXTRAPOLATION_PROPOSAL1 + sei_read_flag(pDecodedMessageOutputStream, val, "nnpfc_spatial_extrapolation_prompt_present_flag"); + sei.m_spatialExtrapolationPromptPresentFlag = val; + if (sei.m_spatialExtrapolationPromptPresentFlag) + { + std::string valp; + while (!isByteAligned()) + { + sei_read_flag(pDecodedMessageOutputStream, val, "nnpfc_alignment_zero_bit_c"); + CHECK(val != 0, "nnpfc_alignment_zero_bit_c not equal to zero"); + } + sei_read_string(pDecodedMessageOutputStream, valp, "nnpfc_prompt"); + sei.m_prompt = valp; + } +#endif } #endif diff --git a/source/Lib/EncoderLib/EncCfg.h b/source/Lib/EncoderLib/EncCfg.h index 703b60a043d3330b2fe8fe102d8ae2cd3fbdcb6a..f376c2be1adf5a03881b3b32bee34321aecb546c 100644 --- a/source/Lib/EncoderLib/EncCfg.h +++ b/source/Lib/EncoderLib/EncCfg.h @@ -778,6 +778,10 @@ protected: int32_t m_nnPostFilterSEICharacteristicsSpatialExtrapolationRightOffset[MAX_NUM_NN_POST_FILTERS]; int32_t m_nnPostFilterSEICharacteristicsSpatialExtrapolationTopOffset[MAX_NUM_NN_POST_FILTERS]; int32_t m_nnPostFilterSEICharacteristicsSpatialExtrapolationBottomOffset[MAX_NUM_NN_POST_FILTERS]; +#if JVET_AI0061_SPATIAL_EXTRAPOLATION_PROPOSAL1 + bool m_nnPostFilterSEICharacteristicsSpatialExtrapolationPromptPresentFlag[MAX_NUM_NN_POST_FILTERS]; + std::string m_nnPostFilterSEICharacteristicsSpatialExtrapolationPrompt[MAX_NUM_NN_POST_FILTERS]; +#endif #endif std::vector<bool> m_nnPostFilterSEICharacteristicsInputPicOutputFlag[MAX_NUM_NN_POST_FILTERS]; bool m_nnPostFilterSEICharacteristicsAbsentInputPicZeroFlag[MAX_NUM_NN_POST_FILTERS]; @@ -2184,6 +2188,12 @@ public: int32_t getNNPostFilterSEICharacteristicsSpatialExtrapolationTopOffset(int filterIdx) { return m_nnPostFilterSEICharacteristicsSpatialExtrapolationTopOffset[filterIdx]; } void setNNPostFilterSEICharacteristicsSpatialExtrapolationBottomOffset(int32_t value, int filterIdx) { m_nnPostFilterSEICharacteristicsSpatialExtrapolationBottomOffset[filterIdx] = value; } int32_t getNNPostFilterSEICharacteristicsSpatialExtrapolationBottomOffset(int filterIdx) { return m_nnPostFilterSEICharacteristicsSpatialExtrapolationBottomOffset[filterIdx]; } +#if JVET_AI0061_SPATIAL_EXTRAPOLATION_PROPOSAL1 + void setNNPostFilterSEICharacteristicsSpatialExtrapolationPromptPresentFlag(bool promptPresentFlag, int filterIdx) { m_nnPostFilterSEICharacteristicsSpatialExtrapolationPromptPresentFlag[filterIdx] = promptPresentFlag; } + bool getNNPostFilterSEICharacteristicsSpatialExtrapolationPromptPresentFlag(int filterIdx) const { return m_nnPostFilterSEICharacteristicsSpatialExtrapolationPromptPresentFlag[filterIdx]; } + void setNNPostFilterSEICharacteristicsSpatialExrapolationPrompt(std::string prompt, int filterIdx) { m_nnPostFilterSEICharacteristicsSpatialExtrapolationPrompt[filterIdx] = prompt; } + std::string getNNPostFilterSEICharacteristicsSpatialExrapolationPrompt(int filterIdx) const { return m_nnPostFilterSEICharacteristicsSpatialExtrapolationPrompt[filterIdx]; } +#endif #endif void setNNPostFilterSEICharacteristicsInputPicOutputFlag(std::vector<bool> value, int filterIdx) { m_nnPostFilterSEICharacteristicsInputPicOutputFlag[filterIdx] = value; } const std::vector<bool>& getNNPostFilterSEICharacteristicsInputPicOutputFlag(int filterIdx) { return m_nnPostFilterSEICharacteristicsInputPicOutputFlag[filterIdx]; } diff --git a/source/Lib/EncoderLib/SEIEncoder.cpp b/source/Lib/EncoderLib/SEIEncoder.cpp index aba8ad6bb1ae70ae11122b2760d31d234548d67e..3ef871919f2befd512d7e995097edd8da276127e 100644 --- a/source/Lib/EncoderLib/SEIEncoder.cpp +++ b/source/Lib/EncoderLib/SEIEncoder.cpp @@ -1662,6 +1662,13 @@ void SEIEncoder::initSEINeuralNetworkPostFilterCharacteristics(SEINeuralNetworkP sei->m_spatialExtrapolationRightOffset = m_pcCfg->getNNPostFilterSEICharacteristicsSpatialExtrapolationRightOffset(filterIdx); sei->m_spatialExtrapolationTopOffset = m_pcCfg->getNNPostFilterSEICharacteristicsSpatialExtrapolationTopOffset(filterIdx); sei->m_spatialExtrapolationBottomOffset = m_pcCfg->getNNPostFilterSEICharacteristicsSpatialExtrapolationBottomOffset(filterIdx); +#if JVET_AI0061_SPATIAL_EXTRAPOLATION_PROPOSAL1 + sei->m_spatialExtrapolationPromptPresentFlag = m_pcCfg->getNNPostFilterSEICharacteristicsSpatialExtrapolationPromptPresentFlag(filterIdx); + if (sei->m_spatialExtrapolationPromptPresentFlag) + { + sei->m_prompt = m_pcCfg->getNNPostFilterSEICharacteristicsSpatialExrapolationPrompt(filterIdx); + } +#endif } #endif diff --git a/source/Lib/EncoderLib/SEIwrite.cpp b/source/Lib/EncoderLib/SEIwrite.cpp index 17bbcbe56bb9493e343884a4c5222df6ec4e9d09..0091cf27c5c3d8b853ff18382ed3a8a1563787d4 100644 --- a/source/Lib/EncoderLib/SEIwrite.cpp +++ b/source/Lib/EncoderLib/SEIwrite.cpp @@ -1933,6 +1933,17 @@ void SEIWriter::xWriteSEINeuralNetworkPostFilterCharacteristics(const SEINeuralN xWriteSvlc(sei.m_spatialExtrapolationRightOffset, "nnpfc_spatial_extrapolation_right_offset"); xWriteSvlc(sei.m_spatialExtrapolationTopOffset, "nnpfc_spatial_extrapolation_top_offset"); xWriteSvlc(sei.m_spatialExtrapolationBottomOffset, "nnpfc_spatial_extrapolation_right_offset"); +#if JVET_AI0061_SPATIAL_EXTRAPOLATION_PROPOSAL1 + xWriteFlag(sei.m_spatialExtrapolationPromptPresentFlag, "nnpfc_spatial_extrapolation_prompt_present_flag"); + if (sei.m_spatialExtrapolationPromptPresentFlag) + { + while (!isByteAligned()) + { + xWriteFlag(0, "nnpfc_alignment_zero_bit_c"); + } + xWriteString(sei.m_prompt, "nnpfc_prompt"); + } +#endif } #endif