diff --git a/cfg/sei_vui/text_description_information.cfg b/cfg/sei_vui/text_description_information.cfg new file mode 100644 index 0000000000000000000000000000000000000000..c694f5bd9aa0daf32aa0bc3b57791a6055417a2a --- /dev/null +++ b/cfg/sei_vui/text_description_information.cfg @@ -0,0 +1,8 @@ +#======== 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 +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 diff --git a/doc/software-manual.tex b/doc/software-manual.tex index 9991d426e9d8ee3349ea6bff8660d62e82d4bc1e..a570798ee9d620cbd19d4b939d3451598c0aeec1 100644 --- a/doc/software-manual.tex +++ b/doc/software-manual.tex @@ -6100,6 +6100,47 @@ Specifies type of information the of privacy protection optimization that is app \\ \end{OptionTableNoShorthand} +\begin{OptionTableNoShorthand}{Text description information}{tab:sei-text-description-information} +\Option{SEITextDescriptionID} & +\Default{1} & +Specifies the identifier value of this text description SEI message, valid range is 1-16383. +\\ +\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. +\\ +\Option{SEITextDescriptionPersistenceFlag} & +\Default{true} & +Specifies the persistence of the text information SEI message for the current layer. +\\ +\Option{SEITextDescriptionPurpose} & +\Default(0) & +Indicates the purpose of the text description SEI message. +\par + \begin{tabular}{cp{0.46\textwidth}} + 0 & application defined \\ + 1 & copyright information \\ + 2 & ai marking information \\ + 3 & general comment information \\ + 4 & content advisory rating information conforming to US and Canadian rating region tables (RPT) \\ + 5 & tag uri for identifing bitstream \\ + 6..255 & reserved \\ + \end{tabular} +\\ +\Option{SEITextDescriptionsNumStringsMinus1} & +\Default(0) & +Specifies the number plus 1 of txt_description_string_lang and txt_description_string. +\\ +\Option(SEITextDescriptionStringLang[i]) & +\Default("") & +Specifies the language of the txt_description_string[i]. The language shall be given by a language tag as defined by IETF RFC 5646, and the length of string shall be in the range 0-49. +\\ +\Option(SEITextDescriptionString[i]) & +\Default("") & +Specifies the i-th text description information string whose value is interpreted as specified by the txt_description_purpose. +\\ +\end{OptionTableNoShorthand} + \begin{OptionTableNoShorthand}{Source picture timing information SEI message encoder parameters}{tab:sei-source-picture-timing-info} \Option{SEISourcePictureTimingInfo} & \Default{false} & diff --git a/source/App/EncoderApp/EncApp.cpp b/source/App/EncoderApp/EncApp.cpp index 8473d3676ee8cab6859294e5e861fa8038ceb096..adf849d7cf8573d4cc8ca89b86861c0735eef428 100644 --- a/source/App/EncoderApp/EncApp.cpp +++ b/source/App/EncoderApp/EncApp.cpp @@ -1418,6 +1418,15 @@ void EncApp::xInitLibCfg( int layerIdx ) m_cEncLib.setPoSEINumOfPrefixBits (m_poSEINumOfPrefixBits); m_cEncLib.setPoSEIPrefixByte (m_poSEIPrefixByte); + #if JVET_AH2006_TXTDESCRINFO_SEI + m_cEncLib.setTextDescriptionSEIId(m_SEITextDescriptionID); + m_cEncLib.setTextSEICancelFlag(m_SEITextCancelFlag); + m_cEncLib.setTextSEIPersistenceFlag(m_SEITextPersistenceFlag); + m_cEncLib.setTextSEIPurpose(m_SEITextDescriptionPurpose); + m_cEncLib.setTextSEINumStringsMinus1(m_SEITextNumStringsMinus1); + m_cEncLib.setTextSEIDescriptionStringLang(m_SEITextDescriptionStringLang); + m_cEncLib.setTextSEIDescriptionString(m_SEITextDescriptionString); +#endif m_cEncLib.setPostFilterHintSEIEnabled(m_postFilterHintSEIEnabled); diff --git a/source/App/EncoderApp/EncAppCfg.cpp b/source/App/EncoderApp/EncAppCfg.cpp index 418a915e631a5d490e3bad0a85f546e23d2443fe..3330aceb1a6918d9671e73cac97c97f113a04ef0 100644 --- a/source/App/EncoderApp/EncAppCfg.cpp +++ b/source/App/EncoderApp/EncAppCfg.cpp @@ -2018,6 +2018,25 @@ bool EncAppCfg::parseCfg( int argc, char* argv[] ) opts.addOptions()("SEINNPostFilterActivationOutputFlag", cfg_nnPostFilterSEIActivationOutputFlagList, cfg_nnPostFilterSEIActivationOutputFlagList, "Specifies a list indicating whether the NNPF-generated picture that corresponds to the input picture having index InpIdx[i] is output or not"); } +#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"); + opts.addOptions()("SEITextDescriptionCancelFlag", m_SEITextCancelFlag, true, "Cancels the persistence of any previous text description information SEI message with the same txt_descr_id"); + 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 ]"); + m_SEITextDescriptionStringLang.resize(256); + m_SEITextDescriptionString.resize(256); + for (int i=0; i<256; i++) + { + std::ostringstream stringLang; + stringLang << "SEITextDescriptionStringLang" << i; + opts.addOptions()(stringLang.str(), m_SEITextDescriptionStringLang[0], std::string(""), "Specifies the i-th language of the txt_descr_string[ i ]"); + std::ostringstream stringDesc; + stringDesc << "SEITextDescriptionString" << i; + opts.addOptions()(stringDesc.str(), m_SEITextDescriptionString[0], std::string(""), "Specifies the i-th text description information string"); + } +#endif + po::setDefaults(opts); po::ErrorReporter err; const std::list<const char *> &argv_unhandled = po::scanArgv(opts, argc, (const char **) argv, err); @@ -5247,6 +5266,12 @@ bool EncAppCfg::xCheckParameter() xConfirmPara(m_piVerPhaseNumReducedResolution > m_piVerPhaseDenMinus1ReducedResolution + 1, "m_piVerPhaseNumReducedResolution must be in the range of 0 to m_piVerPhaseDenMinus1ReducedResolution + 1, inclusive"); } +#if JVET_AH2006_TXTDESCRINFO_SEI + xConfirmPara(m_SEITextDescriptionID < 1 && m_SEITextDescriptionID > 16383, "m_SEITextDescriptionID must be in the range of 1 to 16383, inclusive"); + xConfirmPara(m_SEITextDescriptionPurpose > 5, "m_SEITextDescriptionPurpose must be in the range of 0 to 5, inclusive"); + xConfirmPara(m_SEITextNumStringsMinus1 > 255, "m_SEITextNumStringsMinus1 must be in the range 0f 0 to 255, inclusive"); +#endif + xConfirmPara(m_log2ParallelMergeLevel < 2, "Log2ParallelMergeLevel should be larger than or equal to 2"); xConfirmPara(m_log2ParallelMergeLevel > m_ctuSize, "Log2ParallelMergeLevel should be less than or equal to CTU size"); xConfirmPara(m_preferredTransferCharacteristics > 255, "transfer_characteristics_idc should not be greater than 255."); diff --git a/source/App/EncoderApp/EncAppCfg.h b/source/App/EncoderApp/EncAppCfg.h index cba5782fc7e6657f04bb51a772d4a120636dba5b..b90fb0a4b24ab5b8171e7608ae2fae694f027038 100644 --- a/source/App/EncoderApp/EncAppCfg.h +++ b/source/App/EncoderApp/EncAppCfg.h @@ -829,6 +829,15 @@ protected: std::vector<uint16_t> m_poSEINumOfPrefixBits; std::vector<std::vector<uint8_t>> m_poSEIPrefixByte; + #if JVET_AH2006_TXTDESCRINFO_SEI + uint32_t m_SEITextDescriptionID; + bool m_SEITextCancelFlag; + bool m_SEITextPersistenceFlag; + uint32_t m_SEITextDescriptionPurpose; + uint32_t m_SEITextNumStringsMinus1; + std::vector<std::string> m_SEITextDescriptionStringLang; + std::vector<std::string> m_SEITextDescriptionString; + #endif bool m_postFilterHintSEIEnabled; bool m_postFilterHintSEICancelFlag; diff --git a/source/Lib/CommonLib/SEI.cpp b/source/Lib/CommonLib/SEI.cpp index 75cc4c3007cb5f0d150d7d1468dfd85c2ca90039..1583e1296fe775dc25b04fdda2b548ee5893ee88 100644 --- a/source/Lib/CommonLib/SEI.cpp +++ b/source/Lib/CommonLib/SEI.cpp @@ -1111,6 +1111,24 @@ SEIPostFilterHint::SEIPostFilterHint(const SEIPostFilterHint& sei) m_filterHintValues = sei.m_filterHintValues; } +#if JVET_AH2006_TXTDESCRINFO_SEI + SEITextDescription::SEITextDescription(const SEITextDescription& sei) + { + m_textDescriptionID = sei.m_textDescriptionID; + m_textCancelFlag = sei.m_textCancelFlag; + m_textPersistenceFlag = sei.m_textPersistenceFlag; + m_textDescriptionPurpose = sei.m_textDescriptionPurpose; + m_textNumStringsMinus1 = sei.m_textNumStringsMinus1; + m_textDescriptionStringLang.resize(m_textNumStringsMinus1+1); + m_textDescriptionString.resize(m_textNumStringsMinus1+1); + for (int i=0; i<=m_textNumStringsMinus1; i++) + { + m_textDescriptionStringLang[i] = sei.m_textDescriptionStringLang[i]; + m_textDescriptionString[i] = sei.m_textDescriptionString[i]; + } + } +#endif + SEINeuralNetworkPostFilterCharacteristics* getNnpfcWithGivenId(const SEIMessages &seiList, uint32_t id) { for (auto sei : seiList) diff --git a/source/Lib/CommonLib/SEI.h b/source/Lib/CommonLib/SEI.h index 27cac5298724827f07ad59e34eeaf355aabf16af..927f1c9f650d94616179ce73d8d296d37c020239 100644 --- a/source/Lib/CommonLib/SEI.h +++ b/source/Lib/CommonLib/SEI.h @@ -106,6 +106,9 @@ public: #endif #if JVET_AG2034_SPTI_SEI SOURCE_PICTURE_TIMING_INFO = 216, +#endif +#if JVET_AH2006_TXTDESCRINFO_SEI + SEI_TEXT_DESCRIPTION = 219, #endif }; @@ -209,7 +212,10 @@ public: case SEI::PayloadType::NEURAL_NETWORK_POST_FILTER_CHARACTERISTICS: case SEI::PayloadType::COLOUR_TRANSFORM_INFO: case SEI::PayloadType::CONTENT_COLOUR_VOLUME: - return true; +#if JVET_AH2006_TXTDESCRINFO_SEI + case SEI::PayloadType::SEI_TEXT_DESCRIPTION: +#endif + return true; default: return false; } @@ -1488,6 +1494,26 @@ public: std::vector<int> m_filterHintValues; // values stored in linear array, [ ( ( component * sizeY + y ) * SizeX ) + x ] }; +#if JVET_AH2006_TXTDESCRINFO_SEI +class SEITextDescription : public SEI +{ +public: + PayloadType payloadType() const { return PayloadType::SEI_TEXT_DESCRIPTION; } + + SEITextDescription() {} + SEITextDescription(const SEITextDescription& sei); + virtual ~SEITextDescription() {} + + uint16_t m_textDescriptionID; + bool m_textCancelFlag; + bool m_textPersistenceFlag; + uint8_t m_textDescriptionPurpose; + uint8_t m_textNumStringsMinus1; + std::vector<std::string> m_textDescriptionStringLang; + std::vector<std::string> m_textDescriptionString; +}; +#endif + SEINeuralNetworkPostFilterCharacteristics* getNnpfcWithGivenId(const SEIMessages &seiList, uint32_t nnpfaTargetId); SEINeuralNetworkPostFilterCharacteristics* getSuperResolutionNnpfc(const SEIMessages &seiList); diff --git a/source/Lib/CommonLib/TypeDef.h b/source/Lib/CommonLib/TypeDef.h index 1685cdd509fe34b0ac3a616f1b6af21c2db9c8b4..36ba91ce11ab68c66255f28c124602d98aa5ace9 100644 --- a/source/Lib/CommonLib/TypeDef.h +++ b/source/Lib/CommonLib/TypeDef.h @@ -90,6 +90,8 @@ #define JVET_AH2006_EOI_SEI 1 // Implementation of Encoder Optimizaion Information SEI message +#define JVET_AH2006_TXTDESCRINFO_SEI 1 // Text description information message + #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 19f2573d36d4d55b15e6cf53b6dbdbd91c829f36..9d3a9858716458bf84b15dfd678a133c9b5711b3 100644 --- a/source/Lib/DecoderLib/SEIread.cpp +++ b/source/Lib/DecoderLib/SEIread.cpp @@ -538,6 +538,12 @@ bool SEIReader::xReadSEImessage(SEIMessages& seis, const NalUnitType nalUnitType xParseSEIProcessingOrderNesting((SEIProcessingOrderNesting&)*sei, nalUnitType, nuh_layer_id, payloadSize, vps, sps, hrd, pDecodedMessageOutputStream); break; +#if JVET_AH2006_TXTDESCRINFO_SEI + case SEI::PayloadType::SEI_TEXT_DESCRIPTION: + sei = new SEITextDescription; + xParseSEITextDescription((SEITextDescription&)*sei, payloadSize, pDecodedMessageOutputStream); + break; +#endif case SEI::PayloadType::POST_FILTER_HINT: sei = new SEIPostFilterHint; xParseSEIPostFilterHint((SEIPostFilterHint &) *sei, payloadSize, pDecodedMessageOutputStream); @@ -3389,6 +3395,34 @@ void SEIReader::xParseSEISourcePictureTimingInfo(SEISourcePictureTimingInfo& sei } #endif +#if JVET_AH2006_TXTDESCRINFO_SEI + void SEIReader::xParseSEITextDescription(SEITextDescription &sei, uint32_t payloadSize, std::ostream *pDecodedMessageOutputStream) + { + uint32_t val; + sei_read_code(pDecodedMessageOutputStream, 14, val, "txt_descr_id"); + sei.m_textDescriptionID = val; + 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++) + { + 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 + #if JVET_S0257_DUMP_360SEI_MESSAGE void SeiCfgFileDump::write360SeiDump (std::string decoded360MessageFileName, SEIMessages& seis, const SPS* sps) { diff --git a/source/Lib/DecoderLib/SEIread.h b/source/Lib/DecoderLib/SEIread.h index 47d52f2d50e7c809934da87fb15273f5316484fe..26df095a2266e738fc35d86a2a8e1f43b959f6a1 100644 --- a/source/Lib/DecoderLib/SEIread.h +++ b/source/Lib/DecoderLib/SEIread.h @@ -128,6 +128,9 @@ protected: void xParseSEISourcePictureTimingInfo(SEISourcePictureTimingInfo& sei, uint32_t payloadSize, std::ostream* pDecodedMessageOutputStream); #endif +#if JVET_AH2006_TXTDESCRINFO_SEI + void xParseSEITextDescription(SEITextDescription &sei, uint32_t payloadSize, std::ostream *pDecodedMessageOutputStream); +#endif void sei_read_scode(std::ostream *pOS, uint32_t length, int& code, const char *pSymbolName); void sei_read_code(std::ostream *pOS, uint32_t length, uint32_t &ruiCode, const char *pSymbolName); diff --git a/source/Lib/EncoderLib/EncCfg.h b/source/Lib/EncoderLib/EncCfg.h index ff898d5789fdb538e365cc39d2b07052d35dec5f..4c82b034cb87ec2feea177a7b34cabcfb5d09fa4 100644 --- a/source/Lib/EncoderLib/EncCfg.h +++ b/source/Lib/EncoderLib/EncCfg.h @@ -935,6 +935,15 @@ protected: uint32_t m_postFilterHintSEIType; bool m_postFilterHintSEIChromaCoeffPresentFlag; std::vector<int32_t> m_postFilterHintValues; +#if JVET_AH2006_TXTDESCRINFO_SEI + uint16_t m_textDescriptionSEIId; + bool m_textSEICancelFlag; + bool m_textSEIPersistenceFlag; + uint8_t m_textSEIDescriptionPurpose; + uint8_t m_textSEINumStringsMinus1; + std::vector<std::string> m_textSEIDescriptionStringLang; + std::vector<std::string> m_textSEIDescriptionString; +#endif bool m_constrainedRaslEncoding; @@ -2697,6 +2706,22 @@ public: bool getPostFilterHintSEIChromaCoeffPresentFlag() { return m_postFilterHintSEIChromaCoeffPresentFlag; } void setPostFilterHintSEIValues(const std::vector<int32_t> &b) { m_postFilterHintValues = b; } int32_t getPostFilterHintSEIValues(int32_t idx) const { return m_postFilterHintValues[idx]; } +#if JVET_AH2006_TXTDESCRINFO_SEI + void setTextDescriptionSEIId(const uint16_t i) {m_textDescriptionSEIId = i;} + uint32_t getTextDescriptionSEIId() {return m_textDescriptionSEIId;} + void setTextSEICancelFlag(bool b) {m_textSEICancelFlag = b;} + bool getTextSEICancelFlag() {return m_textSEICancelFlag;} + void setTextSEIPersistenceFlag(bool b) {m_textSEIPersistenceFlag = b;} + bool getTextSEIPersistenceFlag() {return m_textSEIPersistenceFlag;} + void setTextSEIPurpose(uint8_t i) {m_textSEIDescriptionPurpose = i;} + uint32_t getTextSEIPurpose() {return m_textSEIDescriptionPurpose;} + void setTextSEINumStringsMinus1(uint8_t i) {m_textSEINumStringsMinus1 = i;} + uint32_t getTextSEINumStringsMinus1() { return m_textSEINumStringsMinus1;} + void setTextSEIDescriptionStringLang(const std::vector<std::string> b) {m_textSEIDescriptionStringLang = b;} + std::string getTextSEIDescriptionStringLang(int idx) const {return m_textSEIDescriptionStringLang[idx];} + void setTextSEIDescriptionString(const std::vector<std::string> b) {m_textSEIDescriptionString = b;} + std::string getTextSEIDescriptionString(int idx) const {return m_textSEIDescriptionString[idx];} +#endif void setUseWP ( bool b ) { m_useWeightedPred = b; } void setWPBiPred ( bool b ) { m_useWeightedBiPred = b; } diff --git a/source/Lib/EncoderLib/SEIEncoder.cpp b/source/Lib/EncoderLib/SEIEncoder.cpp index 71ab049bf5eed7ad546c818941d9e55e65e8eaf2..ac32518ee5e83ba782f1147bac55bda09f5ccb3c 100644 --- a/source/Lib/EncoderLib/SEIEncoder.cpp +++ b/source/Lib/EncoderLib/SEIEncoder.cpp @@ -686,6 +686,15 @@ void SEIEncoder::initSEIProcessingOrderInfo(SEIProcessingOrderInfo *seiProcessin seiProcessingOrderNesting->m_ponWrapSeiMessages.push_back(seiPFH); break; } +#if JVET_AH2006_TXTDESCRINFO_SEI + case SEI::PayloadType::SEI_TEXT_DESCRIPTION: + { + SEITextDescription *seiTextDescription = new SEITextDescription(); + initSEITextDescription(seiTextDescription); + seiProcessingOrderNesting->m_ponWrapSeiMessages.push_back(seiTextDescription); + break; + } +#endif default: { msg(ERROR, "not support in sei processing order SEI\n"); @@ -719,6 +728,26 @@ void SEIEncoder::initSEIPostFilterHint(SEIPostFilterHint *seiPostFilterHint) } } +#if JVET_AH2006_TXTDESCRINFO_SEI +void SEIEncoder::initSEITextDescription(SEITextDescription *seiTestDescrition) +{ + CHECK(!(m_isInitialized), "Text description information SEI already initialized"); + CHECK(!(seiTestDescrition != nullptr), "Need a seiTtestDescribtion for initialization (got nullptr)"); + seiTestDescrition->m_textDescriptionID = m_pcCfg->getTextDescriptionSEIId(); + seiTestDescrition->m_textCancelFlag = m_pcCfg->getTextSEICancelFlag(); + seiTestDescrition->m_textPersistenceFlag = m_pcCfg->getTextSEIPersistenceFlag(); + seiTestDescrition->m_textDescriptionPurpose = m_pcCfg->getTextSEIPurpose(); + seiTestDescrition->m_textNumStringsMinus1 = m_pcCfg->getTextSEINumStringsMinus1(); + seiTestDescrition->m_textDescriptionStringLang.resize(seiTestDescrition->m_textNumStringsMinus1+1); + seiTestDescrition->m_textDescriptionString.resize(seiTestDescrition->m_textNumStringsMinus1+1); + for (int i=0; i<=seiTestDescrition->m_textNumStringsMinus1; i++) + { + seiTestDescrition->m_textDescriptionStringLang[i] = m_pcCfg->getTextSEIDescriptionStringLang(i); + seiTestDescrition->m_textDescriptionString[i] = m_pcCfg->getTextSEIDescriptionString(i); + } +} +#endif + template <typename T> static void readTokenValue(T &returnedValue, /// value returned bool &failed, /// used and updated diff --git a/source/Lib/EncoderLib/SEIEncoder.h b/source/Lib/EncoderLib/SEIEncoder.h index bbc2a3dbe448afba45213c2ca1a1dd4102c2eaef..6cb2ac6086e3d8ebed05634878b5dd2eaa881f4d 100644 --- a/source/Lib/EncoderLib/SEIEncoder.h +++ b/source/Lib/EncoderLib/SEIEncoder.h @@ -105,6 +105,9 @@ public: #if JVET_AH2006_EOI_SEI void initSEIEncoderOptimizationInfo(SEIEncoderOptimizationInfo *sei); #endif +#if JVET_AH2006_TXTDESCRINFO_SEI + void initSEITextDescription(SEITextDescription *sei); +#endif #if GREEN_METADATA_SEI_ENABLED void initSEIGreenMetadataInfo(SEIGreenMetadataInfo *sei, FeatureCounterStruct featureCounter, SEIQualityMetrics metrics, SEIComplexityMetrics greenMetadata); #endif diff --git a/source/Lib/EncoderLib/SEIwrite.cpp b/source/Lib/EncoderLib/SEIwrite.cpp index c3417c5a34d6e5a7aa9d8cc7e5817effa330d09b..78b016834b67ee64072bc7211ca1dc03ffa554b4 100644 --- a/source/Lib/EncoderLib/SEIwrite.cpp +++ b/source/Lib/EncoderLib/SEIwrite.cpp @@ -200,6 +200,11 @@ void SEIWriter::xWriteSEIpayloadData(OutputBitstream &bs, const SEI &sei, HRD &h case SEI::PayloadType::SOURCE_PICTURE_TIMING_INFO: xWriteSEISourcePictureTimingInfo(*static_cast<const SEISourcePictureTimingInfo*>(&sei)); break; +#endif +#if JVET_AH2006_TXTDESCRINFO_SEI + case SEI::PayloadType::SEI_TEXT_DESCRIPTION: + xWriteSEITextDescription(*static_cast<const SEITextDescription*>(&sei)); + break; #endif default: THROW("Trying to write unhandled SEI message"); @@ -1964,6 +1969,28 @@ 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"); + xWriteCode(sei.m_textDescriptionID, 14, "txt_descr_id"); + 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++) + { + 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 + void SEIWriter::xWriteSEIPostFilterHint(const SEIPostFilterHint &sei) { xWriteFlag(sei.m_filterHintCancelFlag, "filter_hint_cancel_flag"); diff --git a/source/Lib/EncoderLib/SEIwrite.h b/source/Lib/EncoderLib/SEIwrite.h index 1052b24a1f47dd77e9761ae8a36aeb21357cb99b..f630c167100b9c497346ada467654aea40653ed1 100644 --- a/source/Lib/EncoderLib/SEIwrite.h +++ b/source/Lib/EncoderLib/SEIwrite.h @@ -112,6 +112,9 @@ protected: void xWriteSEIProcessingOrderNesting(OutputBitstream& bs, const SEIProcessingOrderNesting& sei); #if GREEN_METADATA_SEI_ENABLED void xWriteSEIGreenMetadataInfo (const SEIGreenMetadataInfo &sei); +#endif +#if JVET_AH2006_TXTDESCRINFO_SEI + void xWriteSEITextDescription(const SEITextDescription &sei); #endif void xWriteSEIPostFilterHint(const SEIPostFilterHint &sei);