diff --git a/cfg/sei_vui/text_description_information.cfg b/cfg/sei_vui/text_description_information.cfg index c694f5bd9aa0daf32aa0bc3b57791a6055417a2a..8029609717a4b6fd05aa2480db7d564ce9c9bdc4 100644 --- a/cfg/sei_vui/text_description_information.cfg +++ b/cfg/sei_vui/text_description_information.cfg @@ -1,8 +1,9 @@ #======== Text Description Information SEI message ===================== -SEITextDescriptionID: 1 # Indentifier value of this text description information SEI message, must be in the range 1 -16383 -SEITextDescriptionCancelFlag: 0 # if 0 cancels the persistence of any previous text description information SEI message with the same txt_descr_id +SEITextDescriptionID: 1 # Indentifier value of this text description information SEI message, must be in the range 1 -16383 +SEITextDescriptionCancelFlag: 0 # if 1 cancels the persistence of any previous text description information SEI message with the same txt_descr_id +SEITextDescriptionIDCancelFlag: 0 # if 1 cancels the persistence of any previous text description information SEI message with the same txt_descr_id and the same txt_descr_purpose SEITextDescriptionPersistenceFlag: 1 # if 1 enables the the persistence of the text information description message for the current layer -SEITextDescriptionPurpose: 1 # Indicates the purpose of the text description, must be in the range 0-5 -SEITextDescriptionsNumStringsMinus1: 0 # Specifies the number of entries plus 1 for SEITextDescriptionStringLang[i] and SEITextDescriptionString[i] -SEITextDescriptionStringLang0: en-US # Specifies the language of the txt_descr_string[ i ] -SEITextDescriptionString0: test # Specifies i-th text description information string +SEITextDescriptionPurpose: 1 # Indicates the purpose of the text description, must be in the range 0-5 +SEITextDescriptionsNumStringsMinus1: 0 # Specifies the number of entries plus 1 for SEITextDescriptionStringLang[i] and SEITextDescriptionString[i] +SEITextDescriptionStringLang0: en-US # Specifies the language of the txt_descr_string[ i ] +SEITextDescriptionString0: test # Specifies i-th text description information string diff --git a/doc/software-manual.tex b/doc/software-manual.tex index 0d7d31d1f0711bcf268c770de2ae7a3b22fab6c3..d2e4749792976458f98264ff4ef5834dfd233e99 100644 --- a/doc/software-manual.tex +++ b/doc/software-manual.tex @@ -6188,9 +6188,13 @@ Specifies type of information the of privacy protection optimization that is app \Default{1} & Specifies the identifier value of this text description SEI message, valid range is 1-16383. \\ +\Option{SEITextDescriptionIDCancelFlag} & +\Default{true} & +Indicates that the text description information SEI cancels the persistence of previous text description SEI with the same txt_desc_id and the same txt_descr_purpose. +\\ \Option{SEITextDescriptionCancelFlag} & \Default{true} & -Indicates that the test description information SEI cancels the persistence of previous text description SEI with the same txt_desc_id. +Indicates that the text description information SEI cancels the persistence of previous text description SEI with the same txt_descr_purpose. \\ \Option{SEITextDescriptionPersistenceFlag} & \Default{true} & diff --git a/source/App/EncoderApp/EncApp.cpp b/source/App/EncoderApp/EncApp.cpp index 386a68eef8d6a42c887771d9879d8e2a7dcbc138..7646ad15d0ef7a85d5ce5d228f4d80183f7c697e 100644 --- a/source/App/EncoderApp/EncApp.cpp +++ b/source/App/EncoderApp/EncApp.cpp @@ -1453,6 +1453,9 @@ void EncApp::xInitLibCfg( int layerIdx ) #if JVET_AH2006_TXTDESCRINFO_SEI m_cEncLib.setTextDescriptionSEIId(m_SEITextDescriptionID); m_cEncLib.setTextSEICancelFlag(m_SEITextCancelFlag); +#if JVET_AI0059_TXTDESCRINFO_SEI_PERSISTANCE + m_cEncLib.setTextSEIIDCancelFlag(m_SEITextIDCancelFlag); +#endif m_cEncLib.setTextSEIPersistenceFlag(m_SEITextPersistenceFlag); m_cEncLib.setTextSEIPurpose(m_SEITextDescriptionPurpose); m_cEncLib.setTextSEINumStringsMinus1(m_SEITextNumStringsMinus1); diff --git a/source/App/EncoderApp/EncAppCfg.cpp b/source/App/EncoderApp/EncAppCfg.cpp index 8705f04ae2f3521a6147ebb250d0a9267f436b3e..03677fdf8e446e7387a4fdcc6f8bf7f8c13b921b 100644 --- a/source/App/EncoderApp/EncAppCfg.cpp +++ b/source/App/EncoderApp/EncAppCfg.cpp @@ -2098,7 +2098,12 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) #if JVET_AH2006_TXTDESCRINFO_SEI opts.addOptions()("SEITextDescriptionID", m_SEITextDescriptionID, 1u, "Identifier value of this text description information SEI message, must be in the range 1-16383"); +#if JVET_AI0059_TXTDESCRINFO_SEI_PERSISTANCE + opts.addOptions()("SEITextDescriptionCancelFlag", m_SEITextCancelFlag, true, "Cancels the persistence of any previous text description information SEI message with the same txt_descr_purpose"); + opts.addOptions()("SEITextDescriptionIDCancelFlag", m_SEITextIDCancelFlag, true, "Cancels the persistence of any previous text description information SEI message with the same txt_descr_id and the same txt_descr_purpose"); +#else opts.addOptions()("SEITextDescriptionCancelFlag", m_SEITextCancelFlag, true, "Cancels the persistence of any previous text description information SEI message with the same txt_descr_id"); +#endif opts.addOptions()("SEITextDescriptionPersistenceFlag", m_SEITextPersistenceFlag, true, "Specifies the persistence of the text information description message for the current layer"); opts.addOptions()("SEITextDescriptionPurpose", m_SEITextDescriptionPurpose, 0u, "Indicates the purpose of the text description, must be in the range 0-5"); opts.addOptions()("SEITextDescriptionsNumStringsMinus1", m_SEITextNumStringsMinus1, 0u, "Indicates the number of entries plus 1 for txt_descr_string_lang[ i ] and txt_descr_string[ i ]"); diff --git a/source/App/EncoderApp/EncAppCfg.h b/source/App/EncoderApp/EncAppCfg.h index 772e92f8d8fcf3678a8a260e5a8fda203e66fd87..33fe7bebae4b94f5b7aad94ec32700ace229aa7f 100644 --- a/source/App/EncoderApp/EncAppCfg.h +++ b/source/App/EncoderApp/EncAppCfg.h @@ -869,6 +869,9 @@ protected: bool m_postFilterHintSEIEnabled; bool m_postFilterHintSEICancelFlag; +#if JVET_AI0059_TXTDESCRINFO_SEI_PERSISTANCE + bool m_SEITextIDCancelFlag; +#endif bool m_postFilterHintSEIPersistenceFlag; uint32_t m_postFilterHintSEISizeY; uint32_t m_postFilterHintSEISizeX; diff --git a/source/Lib/CommonLib/SEI.cpp b/source/Lib/CommonLib/SEI.cpp index 7971342802e899b4c19d4e2a88a8cb1fae972afc..f4db195f36af8995885d871026bd5594ff9b3c10 100644 --- a/source/Lib/CommonLib/SEI.cpp +++ b/source/Lib/CommonLib/SEI.cpp @@ -1139,6 +1139,9 @@ SEIPostFilterHint::SEIPostFilterHint(const SEIPostFilterHint& sei) { m_textDescriptionID = sei.m_textDescriptionID; m_textCancelFlag = sei.m_textCancelFlag; + #if JVET_AI0059_TXTDESCRINFO_SEI_PERSISTANCE + m_textIDCancelFlag = sei.m_textIDCancelFlag; +#endif m_textPersistenceFlag = sei.m_textPersistenceFlag; m_textDescriptionPurpose = sei.m_textDescriptionPurpose; m_textNumStringsMinus1 = sei.m_textNumStringsMinus1; diff --git a/source/Lib/CommonLib/SEI.h b/source/Lib/CommonLib/SEI.h index 9588ae36a3ee6782edea4a223304b4ae36c854c5..a934673f4b67aa865e7e558442caee8e6d2050ca 100644 --- a/source/Lib/CommonLib/SEI.h +++ b/source/Lib/CommonLib/SEI.h @@ -1588,6 +1588,9 @@ public: uint16_t m_textDescriptionID; bool m_textCancelFlag; +#if JVET_AI0059_TXTDESCRINFO_SEI_PERSISTANCE + bool m_textIDCancelFlag; +#endif bool m_textPersistenceFlag; uint8_t m_textDescriptionPurpose; uint8_t m_textNumStringsMinus1; diff --git a/source/Lib/CommonLib/TypeDef.h b/source/Lib/CommonLib/TypeDef.h index cf9b9b7459571f051bce1ef644cd645f2d72b952..bcaa133f909cc509b9478cb96834a573cf981083 100644 --- a/source/Lib/CommonLib/TypeDef.h +++ b/source/Lib/CommonLib/TypeDef.h @@ -96,6 +96,10 @@ #define JVET_AH2006_TXTDESCRINFO_SEI 1 // Text description information message +#if JVET_AH2006_TXTDESCRINFO_SEI +#define JVET_AI0059_TXTDESCRINFO_SEI_PERSISTANCE 1 // Define persistence scop for text description information SEI to be purpose specific +#endif + #define REUSE_CU_RESULTS 1 #if REUSE_CU_RESULTS #define REUSE_CU_RESULTS_WITH_MULTIPLE_TUS 1 diff --git a/source/Lib/DecoderLib/SEIread.cpp b/source/Lib/DecoderLib/SEIread.cpp index acdabd1228834a2e271a68cfa4b7b8029160e031..cf1c734ceefd52a59387c7e0f5ea9cf8d3a05587 100644 --- a/source/Lib/DecoderLib/SEIread.cpp +++ b/source/Lib/DecoderLib/SEIread.cpp @@ -3594,25 +3594,43 @@ void SEIReader::xParseSEISourcePictureTimingInfo(SEISourcePictureTimingInfo& sei void SEIReader::xParseSEITextDescription(SEITextDescription &sei, uint32_t payloadSize, std::ostream *pDecodedMessageOutputStream) { uint32_t val; +#if JVET_AI0059_TXTDESCRINFO_SEI_PERSISTANCE + sei_read_code(pDecodedMessageOutputStream, 8, val, "txt_descr_purpose"); + sei.m_textDescriptionPurpose = val; +#else sei_read_code(pDecodedMessageOutputStream, 14, val, "txt_descr_id"); sei.m_textDescriptionID = val; +#endif sei_read_flag(pDecodedMessageOutputStream, val, "txt_cancel_flag"); sei.m_textCancelFlag = val; if (!sei.m_textCancelFlag) { - sei_read_flag(pDecodedMessageOutputStream, val, "txt_persistence_flag"); - sei.m_textPersistenceFlag = val; - sei_read_code(pDecodedMessageOutputStream, 8, val, "txt_descr_purpose"); - sei.m_textDescriptionPurpose = val; - sei_read_code(pDecodedMessageOutputStream, 8, val, "txt_num_strings_minus1"); - sei.m_textNumStringsMinus1 = val; - sei.m_textDescriptionStringLang.resize(sei.m_textNumStringsMinus1+1); - sei.m_textDescriptionString.resize(sei.m_textNumStringsMinus1+1); - for (int i=0; i<=sei.m_textNumStringsMinus1; i++) +#if JVET_AI0059_TXTDESCRINFO_SEI_PERSISTANCE + sei_read_code(pDecodedMessageOutputStream, 13, val, "txt_descr_id"); + sei.m_textDescriptionID = val; + sei_read_flag(pDecodedMessageOutputStream, val, "txt_id_cancel_flag"); + sei.m_textIDCancelFlag = val; + if (!sei.m_textIDCancelFlag) { - sei_read_string(pDecodedMessageOutputStream, sei.m_textDescriptionStringLang[i], "txt_descr_string_lang[i]"); - sei_read_string(pDecodedMessageOutputStream, sei.m_textDescriptionString[i], "txt_descr_string[i]"); +#endif + sei_read_flag(pDecodedMessageOutputStream, val, "txt_persistence_flag"); + sei.m_textPersistenceFlag = val; +#if !JVET_AI0059_TXTDESCRINFO_SEI_PERSISTANCE + sei_read_code(pDecodedMessageOutputStream, 8, val, "txt_descr_purpose"); + sei.m_textDescriptionPurpose = val; +#endif + sei_read_code(pDecodedMessageOutputStream, 8, val, "txt_num_strings_minus1"); + sei.m_textNumStringsMinus1 = val; + sei.m_textDescriptionStringLang.resize(sei.m_textNumStringsMinus1+1); + sei.m_textDescriptionString.resize(sei.m_textNumStringsMinus1+1); + for (int i=0; i<=sei.m_textNumStringsMinus1; i++) + { + sei_read_string(pDecodedMessageOutputStream, sei.m_textDescriptionStringLang[i], "txt_descr_string_lang[i]"); + sei_read_string(pDecodedMessageOutputStream, sei.m_textDescriptionString[i], "txt_descr_string[i]"); + } +#if JVET_AI0059_TXTDESCRINFO_SEI_PERSISTANCE } +#endif } } diff --git a/source/Lib/EncoderLib/EncCfg.h b/source/Lib/EncoderLib/EncCfg.h index 4395bc76ab549b601b488f93132d3094e8107545..703b60a043d3330b2fe8fe102d8ae2cd3fbdcb6a 100644 --- a/source/Lib/EncoderLib/EncCfg.h +++ b/source/Lib/EncoderLib/EncCfg.h @@ -972,6 +972,9 @@ protected: #if JVET_AH2006_TXTDESCRINFO_SEI uint16_t m_textDescriptionSEIId; bool m_textSEICancelFlag; +#if JVET_AI0059_TXTDESCRINFO_SEI_PERSISTANCE + bool m_textSEIIDCancelFlag; +#endif bool m_textSEIPersistenceFlag; uint8_t m_textSEIDescriptionPurpose; uint8_t m_textSEINumStringsMinus1; @@ -2788,6 +2791,10 @@ public: uint32_t getTextDescriptionSEIId() {return m_textDescriptionSEIId;} void setTextSEICancelFlag(bool b) {m_textSEICancelFlag = b;} bool getTextSEICancelFlag() {return m_textSEICancelFlag;} +#if JVET_AI0059_TXTDESCRINFO_SEI_PERSISTANCE + void setTextSEIIDCancelFlag(bool b) { m_textSEIIDCancelFlag = b; } + bool getTextSEIIDCancelFlag() { return m_textSEIIDCancelFlag; } +#endif void setTextSEIPersistenceFlag(bool b) {m_textSEIPersistenceFlag = b;} bool getTextSEIPersistenceFlag() {return m_textSEIPersistenceFlag;} void setTextSEIPurpose(uint8_t i) {m_textSEIDescriptionPurpose = i;} diff --git a/source/Lib/EncoderLib/SEIEncoder.cpp b/source/Lib/EncoderLib/SEIEncoder.cpp index 83d8275c753bf6a37f5910c0e1b6c75731f9973e..aba8ad6bb1ae70ae11122b2760d31d234548d67e 100644 --- a/source/Lib/EncoderLib/SEIEncoder.cpp +++ b/source/Lib/EncoderLib/SEIEncoder.cpp @@ -742,6 +742,9 @@ void SEIEncoder::initSEITextDescription(SEITextDescription *seiTestDescrition) CHECK(!(seiTestDescrition != nullptr), "Need a seiTtestDescribtion for initialization (got nullptr)"); seiTestDescrition->m_textDescriptionID = m_pcCfg->getTextDescriptionSEIId(); seiTestDescrition->m_textCancelFlag = m_pcCfg->getTextSEICancelFlag(); +#if JVET_AI0059_TXTDESCRINFO_SEI_PERSISTANCE + seiTestDescrition->m_textIDCancelFlag = m_pcCfg->getTextSEIIDCancelFlag(); +#endif seiTestDescrition->m_textPersistenceFlag = m_pcCfg->getTextSEIPersistenceFlag(); seiTestDescrition->m_textDescriptionPurpose = m_pcCfg->getTextSEIPurpose(); seiTestDescrition->m_textNumStringsMinus1 = m_pcCfg->getTextSEINumStringsMinus1(); diff --git a/source/Lib/EncoderLib/SEIwrite.cpp b/source/Lib/EncoderLib/SEIwrite.cpp index 2f0086fa2dd80e4d186e60a53e94c98d1258c06e..958d2a379806a84fe5af0df7045a0091319ab8f8 100644 --- a/source/Lib/EncoderLib/SEIwrite.cpp +++ b/source/Lib/EncoderLib/SEIwrite.cpp @@ -2119,21 +2119,38 @@ void SEIWriter::xWriteSEINeuralNetworkPostFilterActivation(const SEINeuralNetwor #if JVET_AH2006_TXTDESCRINFO_SEI void SEIWriter::xWriteSEITextDescription(const SEITextDescription &sei) { - CHECK((sei.m_textDescriptionID < 1 || sei.m_textDescriptionID > 16383) , "text description id must be in the range 1-16383"); +#if JVET_AI0059_TXTDESCRINFO_SEI_PERSISTANCE + CHECK(sei.m_textDescriptionPurpose > 5, "txt_descr_purpose shall be in the range 0-5"); + xWriteCode(sei.m_textDescriptionPurpose, 8, "txt_descr_purpose"); +#else + CHECK((sei.m_textDescriptionID < 1 || sei.m_textDescriptionID > 16383), "text description id must be in the range 1-16383"); xWriteCode(sei.m_textDescriptionID, 14, "txt_descr_id"); +#endif xWriteFlag(sei.m_textCancelFlag, "txt_cancel_flag"); if (!sei.m_textCancelFlag) { - xWriteFlag(sei.m_textPersistenceFlag, "txt_persistence_flag"); - CHECK(sei.m_textDescriptionPurpose>5, "txt_descr_purpose shall be in the range 0-5"); - xWriteCode(sei.m_textDescriptionPurpose, 8, "txt_descr_purpose"); - xWriteCode(sei.m_textNumStringsMinus1, 8, "txt_num_strings_minus1"); - for (int i=0; i<=sei.m_textNumStringsMinus1; i++) +#if JVET_AI0059_TXTDESCRINFO_SEI_PERSISTANCE + CHECK((sei.m_textDescriptionID < 1 || sei.m_textDescriptionID > 16383), "text description id must be in the range 1-16383"); + xWriteCode(sei.m_textDescriptionID, 13, "txt_descr_id"); + xWriteFlag(sei.m_textIDCancelFlag, "txt_id_cancel_flag"); + if (!sei.m_textIDCancelFlag) { - CHECK(sei.m_textDescriptionStringLang[i].length() > 49, "The length of the text description language string must be in the range 0-49"); - xWriteString(sei.m_textDescriptionStringLang[i], "txt_descr_string_lang[i]"); - xWriteString(sei.m_textDescriptionString[i], "txt_descr_string[i]"); +#endif + xWriteFlag(sei.m_textPersistenceFlag, "txt_persistence_flag"); +#if !JVET_AI0059_TXTDESCRINFO_SEI_PERSISTANCE + CHECK(sei.m_textDescriptionPurpose>5, "txt_descr_purpose shall be in the range 0-5"); + xWriteCode(sei.m_textDescriptionPurpose, 8, "txt_descr_purpose"); +#endif + xWriteCode(sei.m_textNumStringsMinus1, 8, "txt_num_strings_minus1"); + for (int i=0; i<=sei.m_textNumStringsMinus1; i++) + { + CHECK(sei.m_textDescriptionStringLang[i].length() > 49, "The length of the text description language string must be in the range 0-49"); + xWriteString(sei.m_textDescriptionStringLang[i], "txt_descr_string_lang[i]"); + xWriteString(sei.m_textDescriptionString[i], "txt_descr_string[i]"); + } +#if JVET_AI0059_TXTDESCRINFO_SEI_PERSISTANCE } +#endif } } #endif