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 9390eecb06b3a0c89e8b3b95fa00339e006f69c8..cb20c45ca463d9d23561641a331be87aca46f54d 100644 --- a/doc/software-manual.tex +++ b/doc/software-manual.tex @@ -6189,9 +6189,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 5e3c993124a8ffdde69321436ea48b9712c8d907..2c0af94e3b55a80bd89154f7edd239144ecce27b 100644 --- a/source/App/EncoderApp/EncApp.cpp +++ b/source/App/EncoderApp/EncApp.cpp @@ -1465,6 +1465,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 76e3b560b52a90a0eb9ca7341ba7e8f812ca173d..a5402d7bbac73a5cb4d959c00246547849eca9c9 100644 --- a/source/App/EncoderApp/EncAppCfg.cpp +++ b/source/App/EncoderApp/EncAppCfg.cpp @@ -2112,7 +2112,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 9ebbe694c92cfd08adeab789f9f2acc78eab294d..2b58fcea3abf2370a635d7d5341790d43b8008a4 100644 --- a/source/App/EncoderApp/EncAppCfg.h +++ b/source/App/EncoderApp/EncAppCfg.h @@ -881,6 +881,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/RdCost.cpp b/source/Lib/CommonLib/RdCost.cpp index fcbde85d71bb649a26d594e91d7577a10c9fd7be..11457317855c3151c7bfe0b98669be05ee0f11b1 100644 --- a/source/Lib/CommonLib/RdCost.cpp +++ b/source/Lib/CommonLib/RdCost.cpp @@ -347,7 +347,7 @@ void RdCost::setDistParam(DistParam &rcDP, const Pel *pOrg, const Pel *piRefY, p #if WCG_EXT Distortion RdCost::getDistPart(const CPelBuf &org, const CPelBuf &cur, int bitDepth, const ComponentID compID, - DFuncWtd distFuncWtd, const CPelBuf &orgLuma) + DFuncWtd distFuncWtd, const CPelBuf &orgLuma) const { DistParam cDtParam; @@ -357,8 +357,6 @@ Distortion RdCost::getDistPart(const CPelBuf &org, const CPelBuf &cur, int bitDe cDtParam.bitDepth = bitDepth; cDtParam.compID = compID; - cDtParam.cShiftX = getComponentScaleX(compID, m_cf); - cDtParam.cShiftY = getComponentScaleY(compID, m_cf); if (isChroma(compID)) { cDtParam.orgLuma = orgLuma; @@ -368,8 +366,20 @@ Distortion RdCost::getDistPart(const CPelBuf &org, const CPelBuf &cur, int bitDe cDtParam.orgLuma = org; } - cDtParam.distFuncWtd = m_distortionFuncWtd[distFuncWtd + sizeOffset<false>(org.width)]; - Distortion dist = cDtParam.distFuncWtd(this, cDtParam); + Distortion dist; + if (isChroma(compID) && (m_signalType == RESHAPE_SIGNAL_SDR || m_signalType == RESHAPE_SIGNAL_HLG)) + { + cDtParam.distFunc = m_distortionFunc[DFunc::SSE + sizeOffset<false>(org.width)]; + int64_t weight = m_chromaWeight; + dist = (weight * cDtParam.distFunc(cDtParam ) + (1 << MSE_WEIGHT_FRAC_BITS >> 1)) >> (MSE_WEIGHT_FRAC_BITS); + } + else + { + cDtParam.cShiftX = getComponentScaleX(compID, m_cf); + cDtParam.cShiftY = getComponentScaleY(compID, m_cf); + cDtParam.distFuncWtd = m_distortionFuncWtd[distFuncWtd + sizeOffset<false>(org.width)]; + dist = cDtParam.distFuncWtd(this, cDtParam); + } if (isChroma(compID)) { dist = (Distortion)(m_distortionWeight[MAP_CHROMA(compID)] * dist); @@ -378,7 +388,7 @@ Distortion RdCost::getDistPart(const CPelBuf &org, const CPelBuf &cur, int bitDe } #endif Distortion RdCost::getDistPart(const CPelBuf &org, const CPelBuf &cur, int bitDepth, const ComponentID compID, - DFunc distFunc) + DFunc distFunc) const { DistParam cDtParam; @@ -3131,7 +3141,7 @@ void RdCost::updateReshapeLumaLevelToWeightTable(SliceReshapeInfo &sliceReshape, } } -Distortion RdCost::getWeightedMSE(int compIdx, const Pel org, const Pel cur, const uint32_t shift, const Pel orgLuma) +Distortion RdCost::getWeightedMSE(const int compIdx, const Pel org, const Pel cur, const uint32_t shift, const Pel orgLuma) const { CHECKD(org < 0, "Sample value must be positive"); @@ -3143,27 +3153,12 @@ Distortion RdCost::getWeightedMSE(int compIdx, const Pel org, const Pel cur, con Pel diff = org - cur; // use luma to get weight - int64_t weight = MSE_WEIGHT_ONE; - if (m_signalType == RESHAPE_SIGNAL_SDR || m_signalType == RESHAPE_SIGNAL_HLG) - { - if (compIdx == COMPONENT_Y) - { - weight = m_reshapeLumaLevelToWeightPLUT[orgLuma]; - } - else - { - weight = m_chromaWeight; - } - } - else - { - weight = m_reshapeLumaLevelToWeightPLUT[orgLuma]; - } + int64_t weight = m_reshapeLumaLevelToWeightPLUT[orgLuma]; return (weight * (diff * diff) + (1 << MSE_WEIGHT_FRAC_BITS >> 1)) >> (MSE_WEIGHT_FRAC_BITS + shift); } -Distortion RdCost::xGetSSE_WTD( const DistParam &rcDtParam ) +Distortion RdCost::xGetSSE_WTD( const DistParam &rcDtParam ) const { if( rcDtParam.applyWeight ) { @@ -3196,7 +3191,7 @@ Distortion RdCost::xGetSSE_WTD( const DistParam &rcDtParam ) return (sum); } -Distortion RdCost::xGetSSE2_WTD( const DistParam &rcDtParam ) +Distortion RdCost::xGetSSE2_WTD( const DistParam &rcDtParam ) const { if( rcDtParam.applyWeight ) { @@ -3231,7 +3226,7 @@ Distortion RdCost::xGetSSE2_WTD( const DistParam &rcDtParam ) return (sum); } -Distortion RdCost::xGetSSE4_WTD( const DistParam &rcDtParam ) +Distortion RdCost::xGetSSE4_WTD( const DistParam &rcDtParam ) const { if( rcDtParam.applyWeight ) { @@ -3272,7 +3267,7 @@ Distortion RdCost::xGetSSE4_WTD( const DistParam &rcDtParam ) return (sum); } -Distortion RdCost::xGetSSE8_WTD( const DistParam &rcDtParam ) +Distortion RdCost::xGetSSE8_WTD( const DistParam &rcDtParam ) const { if( rcDtParam.applyWeight ) { @@ -3324,7 +3319,7 @@ Distortion RdCost::xGetSSE8_WTD( const DistParam &rcDtParam ) return (sum); } -Distortion RdCost::xGetSSE16_WTD( const DistParam &rcDtParam ) +Distortion RdCost::xGetSSE16_WTD( const DistParam &rcDtParam ) const { if( rcDtParam.applyWeight ) { @@ -3399,7 +3394,7 @@ Distortion RdCost::xGetSSE16_WTD( const DistParam &rcDtParam ) return (sum); } -Distortion RdCost::xGetSSE16N_WTD( const DistParam &rcDtParam ) +Distortion RdCost::xGetSSE16N_WTD( const DistParam &rcDtParam ) const { if( rcDtParam.applyWeight ) { @@ -3477,7 +3472,7 @@ Distortion RdCost::xGetSSE16N_WTD( const DistParam &rcDtParam ) return (sum); } -Distortion RdCost::xGetSSE32_WTD( const DistParam &rcDtParam ) +Distortion RdCost::xGetSSE32_WTD( const DistParam &rcDtParam ) const { if( rcDtParam.applyWeight ) { @@ -3601,7 +3596,7 @@ Distortion RdCost::xGetSSE32_WTD( const DistParam &rcDtParam ) return (sum); } -Distortion RdCost::xGetSSE64_WTD( const DistParam &rcDtParam ) +Distortion RdCost::xGetSSE64_WTD( const DistParam &rcDtParam ) const { if( rcDtParam.applyWeight ) { diff --git a/source/Lib/CommonLib/RdCost.h b/source/Lib/CommonLib/RdCost.h index 51ee4113532f64c3e5c366599106ce02bf34a759..f111375844b10c44e86102f9d5269808176bd741 100644 --- a/source/Lib/CommonLib/RdCost.h +++ b/source/Lib/CommonLib/RdCost.h @@ -61,7 +61,7 @@ using DistFunc = std::function<Distortion(const DistParam &)>; #if WCG_EXT class RdCost; -using DistFuncWtd = std::function<Distortion(RdCost *, const DistParam &)>; +using DistFuncWtd = std::function<Distortion(const RdCost *, const DistParam &)>; #endif // ==================================================================================================================== // Class definition @@ -388,15 +388,15 @@ private: static Distortion xGetSSE16N ( const DistParam& pcDtParam ); #if WCG_EXT - Distortion getWeightedMSE(int compIdx, const Pel org, const Pel cur, const uint32_t shift, const Pel orgLuma); - Distortion xGetSSE_WTD ( const DistParam& pcDtParam ); - Distortion xGetSSE2_WTD ( const DistParam& pcDtParam ); - Distortion xGetSSE4_WTD ( const DistParam& pcDtParam ); - Distortion xGetSSE8_WTD ( const DistParam& pcDtParam ); - Distortion xGetSSE16_WTD ( const DistParam& pcDtParam ); - Distortion xGetSSE32_WTD ( const DistParam& pcDtParam ); - Distortion xGetSSE64_WTD ( const DistParam& pcDtParam ); - Distortion xGetSSE16N_WTD ( const DistParam& pcDtParam ); + Distortion getWeightedMSE(const int compIdx, const Pel org, const Pel cur, const uint32_t shift, const Pel orgLuma) const; + Distortion xGetSSE_WTD ( const DistParam& pcDtParam ) const; + Distortion xGetSSE2_WTD ( const DistParam& pcDtParam ) const; + Distortion xGetSSE4_WTD ( const DistParam& pcDtParam ) const; + Distortion xGetSSE8_WTD ( const DistParam& pcDtParam ) const; + Distortion xGetSSE16_WTD ( const DistParam& pcDtParam ) const; + Distortion xGetSSE32_WTD ( const DistParam& pcDtParam ) const; + Distortion xGetSSE64_WTD ( const DistParam& pcDtParam ) const; + Distortion xGetSSE16N_WTD ( const DistParam& pcDtParam ) const; #endif static Distortion xGetSAD ( const DistParam& pcDtParam ); @@ -476,10 +476,10 @@ public: #if WCG_EXT Distortion getDistPart(const CPelBuf &org, const CPelBuf &cur, int bitDepth, const ComponentID compID, DFuncWtd distFuncWtd, - const CPelBuf &orgLuma); + const CPelBuf &orgLuma) const; #endif Distortion getDistPart(const CPelBuf &org, const CPelBuf &cur, int bitDepth, const ComponentID compID, - DFunc distFunc); + DFunc distFunc) const; Distortion getDistPart(const CPelBuf &org, const CPelBuf &cur, const Pel *mask, int bitDepth, const ComponentID compID, DFunc distFunc); diff --git a/source/Lib/CommonLib/SEI.cpp b/source/Lib/CommonLib/SEI.cpp index 653c00d3ef4fac59d6969e4afed293ff2176c871..4e9de5d13f85992ee27e246238546b5a54d8a2fd 100644 --- a/source/Lib/CommonLib/SEI.cpp +++ b/source/Lib/CommonLib/SEI.cpp @@ -734,16 +734,6 @@ SEIPhaseIndication::SEIPhaseIndication(const SEIPhaseIndication& sei) m_verPhaseDenMinus1 = sei.m_verPhaseDenMinus1; } -SEIuserDataUnregistered::SEIuserDataUnregistered(const SEIuserDataUnregistered& sei) -{ - std::memcpy(uuid_iso_iec_11578, sei.uuid_iso_iec_11578, sizeof(sei.uuid_iso_iec_11578)); - userDataLength = sei.userDataLength; - if (nullptr != userData) - { - userData = new uint8_t(*sei.userData); - } -} - SEIDecodedPictureHash::SEIDecodedPictureHash(const SEIDecodedPictureHash& sei) { method = sei.method; @@ -1142,6 +1132,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 42b56cc9394d02bcf6ca6cddbc7064c763fff0db..7486df67b20c6375968f28678befaff58cd4e543 100644 --- a/source/Lib/CommonLib/SEI.h +++ b/source/Lib/CommonLib/SEI.h @@ -592,25 +592,20 @@ public: int m_verPhaseDenMinus1; }; -static constexpr uint32_t ISO_IEC_11578_LEN=16; - -class SEIuserDataUnregistered : public SEI +class SEIUserDataUnregistered : public SEI { public: PayloadType payloadType() const { return PayloadType::USER_DATA_UNREGISTERED; } - SEIuserDataUnregistered() - {} - SEIuserDataUnregistered(const SEIuserDataUnregistered& sei); + SEIUserDataUnregistered() {} + SEIUserDataUnregistered(const SEIUserDataUnregistered& sei) = default; - virtual ~SEIuserDataUnregistered() - { - delete userData; - } + virtual ~SEIUserDataUnregistered() {} - uint8_t uuid_iso_iec_11578[ISO_IEC_11578_LEN]; - uint32_t userDataLength; - uint8_t *userData = nullptr; + static constexpr uint32_t ISO_IEC_11578_LEN = 16; + + std::array<uint8_t, ISO_IEC_11578_LEN> uuid; + std::vector<uint8_t> data; }; class SEIDecodedPictureHash : public SEI @@ -1591,6 +1586,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/SEINeuralNetworkPostFiltering.cpp b/source/Lib/CommonLib/SEINeuralNetworkPostFiltering.cpp index 31c08b1367835703c7525641301987a42fccfeac..dd3834f98d72953c138115469d9ee58afabae2be 100644 --- a/source/Lib/CommonLib/SEINeuralNetworkPostFiltering.cpp +++ b/source/Lib/CommonLib/SEINeuralNetworkPostFiltering.cpp @@ -186,6 +186,15 @@ void SEINeuralNetworkPostFiltering::filterPictures(PicList& picList) for (auto sei : currCodedPic->m_nnpfcActivated) { auto currNnpfc = (SEINeuralNetworkPostFilterCharacteristics*) sei; +#if JVET_AI0061_PROPOSAL2_SPATIAL_EXTRAPOLATION + if ((currNnpfc->m_purpose & NNPC_PurposeType::SPATIAL_EXTRAPOLATION) != 0) + { + currNnpfc->m_overlap = 0; + currNnpfc->m_constantPatchSizeFlag = 1; + currNnpfc->m_patchWidthMinus1 = croppedWidth - 1; + currNnpfc->m_patchHeightMinus1 = croppedHeight - 1; + } +#endif checkInputPics(currCodedPic, currNnpfc, sourceWidth, sourceHeight, croppedWidth, croppedHeight); } diff --git a/source/Lib/CommonLib/TypeDef.h b/source/Lib/CommonLib/TypeDef.h index cee2a7a7bfbb1cb04218be4a5031b7d6a8bd6593..0de9dfe13daf00b48b66c94ce2693ff5a0c62bb0 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_PROPOSAL2_SPATIAL_EXTRAPOLATION 1 // JVET AI0061-Proposal2: Ensure spatial extrapolation works correctly (Option 1) + //########### place macros to be be kept below this line ############### #define GDR_ENABLED 1 @@ -92,11 +94,15 @@ #define JVET_AH2006_EOI_SEI 1 // Implementation of Encoder Optimizaion Information SEI message +#define JVET_AG0322_MODALITY_INFORMATION 1 // Implementation of Modality Information SEI message + #define NNPFC_SPATIAL_EXTRAPOLATION 1 // Implementation of the spatial extrapolation purpose #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 JVET_AG0322_MODALITY_INFORMATION 1 // Implementation of Modality Information SEI message #define REUSE_CU_RESULTS 1 #if REUSE_CU_RESULTS diff --git a/source/Lib/CommonLib/UnitTools.cpp b/source/Lib/CommonLib/UnitTools.cpp index 410d1bbc77a159d878592d67c97694cb224b44d7..930a9053db1fc5624b91e7fd87b9a07f04c0068c 100644 --- a/source/Lib/CommonLib/UnitTools.cpp +++ b/source/Lib/CommonLib/UnitTools.cpp @@ -2201,8 +2201,8 @@ void PU::fillMvpCand(PredictionUnit &pu, const RefPicList &eRefPicList, const in if (pInfo->numCand < AMVP_MAX_NUM_CANDS) { - const int currRefPOC = cs.slice->getRefPic(eRefPicList, refIdx)->getPOC(); - addAMVPHMVPCand(pu, eRefPicList, currRefPOC, *pInfo); + Picture* currRefPic = cs.slice->getRefPic(eRefPicList, refIdx); + addAMVPHMVPCand(pu, eRefPicList, currRefPic, *pInfo); } if (pInfo->numCand > AMVP_MAX_NUM_CANDS) @@ -2970,7 +2970,7 @@ bool PU::addMVPCandUnscaled(const PredictionUnit &pu, const RefPicList &eRefPicL return false; } -void PU::addAMVPHMVPCand(const PredictionUnit &pu, const RefPicList eRefPicList, const int currRefPOC, AMVPInfo &info) +void PU::addAMVPHMVPCand(const PredictionUnit &pu, const RefPicList eRefPicList, const Picture* currRefPic, AMVPInfo &info) { const Slice &slice = *(*pu.cs).slice; @@ -3011,7 +3011,7 @@ void PU::addAMVPHMVPCand(const PredictionUnit &pu, const RefPicList eRefPicList, const RefPicList eRefPicListIndex = (predictorSource == 0) ? eRefPicList : eRefPicList2nd; const int neibRefIdx = neibMi.refIdx[eRefPicListIndex]; - if (neibRefIdx >= 0 && (CU::isIBC(*pu.cu) || (currRefPOC == slice.getRefPOC(eRefPicListIndex, neibRefIdx)))) + if (neibRefIdx >= 0 && (CU::isIBC(*pu.cu) || (currRefPic == slice.getRefPic(eRefPicListIndex, neibRefIdx)))) { Mv pmv = neibMi.mv[eRefPicListIndex]; pmv.roundTransPrecInternal2Amvr(pu.cu->imv); diff --git a/source/Lib/CommonLib/UnitTools.h b/source/Lib/CommonLib/UnitTools.h index 2bb622bd0cb726758104dcb973bfc1115464e537..1db7377025fd37b7a0712bc89d11cb4f6ef3e160 100644 --- a/source/Lib/CommonLib/UnitTools.h +++ b/source/Lib/CommonLib/UnitTools.h @@ -176,7 +176,7 @@ namespace PU const PredictionUnit &pu, bool &allCandSolidInAbove #endif ); - void addAMVPHMVPCand (const PredictionUnit &pu, const RefPicList eRefPicList, const int currRefPOC, AMVPInfo &info); + void addAMVPHMVPCand (const PredictionUnit &pu, const RefPicList eRefPicList, const Picture* currRefPic, AMVPInfo &info); bool addAffineMVPCandUnscaled ( const PredictionUnit &pu, const RefPicList &refPicList, const int &refIdx, const Position &pos, const MvpDir &dir, AffineAMVPInfo &affiAmvpInfo ); bool isBipredRestriction (const PredictionUnit &pu); void spanMotionInfo ( PredictionUnit &pu, const MergeCtx &mrgCtx = MergeCtx() ); diff --git a/source/Lib/DecoderLib/SEIread.cpp b/source/Lib/DecoderLib/SEIread.cpp index 062b55eefd91c4378b9dc7aafd51987841557462..c3d118e200aa20fe3b29cc64ee0ac9e5d09ac417 100644 --- a/source/Lib/DecoderLib/SEIread.cpp +++ b/source/Lib/DecoderLib/SEIread.cpp @@ -307,9 +307,12 @@ bool SEIReader::xReadSEImessage(SEIMessages& seis, const NalUnitType nalUnitType xParseSEIFillerPayload((SEIFillerPayload&) *sei, payloadSize, pDecodedMessageOutputStream); break; case SEI::PayloadType::USER_DATA_UNREGISTERED: - sei = new SEIuserDataUnregistered; - xParseSEIuserDataUnregistered((SEIuserDataUnregistered&) *sei, payloadSize, pDecodedMessageOutputStream); - break; + { + auto udu = new SEIUserDataUnregistered; + xParseSEIuserDataUnregistered(*udu, payloadSize, pDecodedMessageOutputStream); + sei = udu; + break; + } case SEI::PayloadType::DECODING_UNIT_INFO: { const SEIBufferingPeriod* bp = hrd.getBufferingPeriodSEI(); @@ -592,9 +595,12 @@ bool SEIReader::xReadSEImessage(SEIMessages& seis, const NalUnitType nalUnitType switch (SEI::PayloadType(payloadType)) { case SEI::PayloadType::USER_DATA_UNREGISTERED: - sei = new SEIuserDataUnregistered; - xParseSEIuserDataUnregistered((SEIuserDataUnregistered &) *sei, payloadSize, pDecodedMessageOutputStream); - break; + { + auto udu = new SEIUserDataUnregistered; + xParseSEIuserDataUnregistered(*udu, payloadSize, pDecodedMessageOutputStream); + sei = udu; + break; + } case SEI::PayloadType::DECODED_PICTURE_HASH: sei = new SEIDecodedPictureHash; xParseSEIDecodedPictureHash((SEIDecodedPictureHash &) *sei, payloadSize, pDecodedMessageOutputStream); @@ -726,34 +732,30 @@ void SEIReader::xParseSEIFillerPayload(SEIFillerPayload &sei, uint32_t payloadSi * of payloasSize bytes into sei. */ -void SEIReader::xParseSEIuserDataUnregistered(SEIuserDataUnregistered &sei, uint32_t payloadSize, std::ostream *pDecodedMessageOutputStream) +void SEIReader::xParseSEIuserDataUnregistered(SEIUserDataUnregistered& sei, uint32_t payloadSize, + std::ostream* pDecodedMessageOutputStream) { - CHECK(payloadSize < ISO_IEC_11578_LEN, "Payload too small"); + CHECK(payloadSize < sei.uuid.size(), "Payload too small"); uint32_t val; output_sei_message_header(sei, pDecodedMessageOutputStream, payloadSize); - for (uint32_t i = 0; i < ISO_IEC_11578_LEN; i++) + for (uint32_t i = 0; i < sei.uuid.size(); i++) { - sei_read_code( pDecodedMessageOutputStream, 8, val, "uuid_iso_iec_11578"); - sei.uuid_iso_iec_11578[i] = val; + sei_read_code(pDecodedMessageOutputStream, 8, val, "uuid_iso_iec_11578"); + sei.uuid[i] = val; } - sei.userDataLength = payloadSize - ISO_IEC_11578_LEN; - if (!sei.userDataLength) - { - sei.userData = 0; - return; - } + sei.data.resize(payloadSize - sei.uuid.size()); - sei.userData = new uint8_t[sei.userDataLength]; - for (uint32_t i = 0; i < sei.userDataLength; i++) + for (uint32_t i = 0; i < sei.data.size(); i++) { sei_read_code(nullptr, 8, val, "user_data_payload_byte"); - sei.userData[i] = val; + sei.data[i] = val; } + if (pDecodedMessageOutputStream) { - (*pDecodedMessageOutputStream) << " User data payload size: " << sei.userDataLength << "\n"; + (*pDecodedMessageOutputStream) << " User data payload size: " << sei.data.size() << "\n"; } } @@ -3341,28 +3343,35 @@ void SEIReader::xParseSEINNPostFilterCharacteristics(SEINeuralNetworkPostFilterC CHECK(sei.m_chromaSampleLocTypeFrame > Chroma420LocType::UNSPECIFIED, "The value of nnpfc_chroma_sample_loc_type_frame shall be in the range of 0 to 6, inclusive"); } - sei_read_uvlc(pDecodedMessageOutputStream, val, "nnpfc_overlap"); - sei.m_overlap = val; +#if JVET_AI0061_PROPOSAL2_SPATIAL_EXTRAPOLATION + if((sei.m_purpose & NNPC_PurposeType::SPATIAL_EXTRAPOLATION) == 0) + { +#endif + sei_read_uvlc(pDecodedMessageOutputStream, val, "nnpfc_overlap"); + sei.m_overlap = val; - sei_read_flag(pDecodedMessageOutputStream, val, "nnpfc_constant_patch_size_flag"); - sei.m_constantPatchSizeFlag = val; + sei_read_flag(pDecodedMessageOutputStream, val, "nnpfc_constant_patch_size_flag"); + sei.m_constantPatchSizeFlag = val; - if (sei.m_constantPatchSizeFlag) - { - sei_read_uvlc(pDecodedMessageOutputStream, val, "nnpfc_patch_width_minus1"); - sei.m_patchWidthMinus1 = val; + if (sei.m_constantPatchSizeFlag) + { + sei_read_uvlc(pDecodedMessageOutputStream, val, "nnpfc_patch_width_minus1"); + sei.m_patchWidthMinus1 = val; - sei_read_uvlc(pDecodedMessageOutputStream, val, "nnpfc_patch_height_minus1"); - sei.m_patchHeightMinus1 = val; - } - else - { - sei_read_uvlc(pDecodedMessageOutputStream, val, "nnpfc_extended_patch_width_cd_delta_minus1"); - sei.m_extendedPatchWidthCdDeltaMinus1 = val; + sei_read_uvlc(pDecodedMessageOutputStream, val, "nnpfc_patch_height_minus1"); + sei.m_patchHeightMinus1 = val; + } + else + { + sei_read_uvlc(pDecodedMessageOutputStream, val, "nnpfc_extended_patch_width_cd_delta_minus1"); + sei.m_extendedPatchWidthCdDeltaMinus1 = val; - sei_read_uvlc(pDecodedMessageOutputStream, val, "nnpfc_extended_patch_height_cd_delta_minus1"); - sei.m_extendedPatchHeightCdDeltaMinus1 = val; + sei_read_uvlc(pDecodedMessageOutputStream, val, "nnpfc_extended_patch_height_cd_delta_minus1"); + sei.m_extendedPatchHeightCdDeltaMinus1 = val; + } +#if JVET_AI0061_PROPOSAL2_SPATIAL_EXTRAPOLATION } +#endif sei_read_uvlc(pDecodedMessageOutputStream, val, "nnpfc_padding_type"); sei.m_paddingType = val; @@ -3629,25 +3638,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/DecoderLib/SEIread.h b/source/Lib/DecoderLib/SEIread.h index 1dae825538a48f4ca728bf8c1e55f210dd76519c..076d55d55680c4b114781eea22012ee1bb97a2b0 100644 --- a/source/Lib/DecoderLib/SEIread.h +++ b/source/Lib/DecoderLib/SEIread.h @@ -68,7 +68,8 @@ protected: bool xCheckNnpfcUpdatePresentSeiMsg (uint32_t seiId, const std::vector<int> nnpfcValueList); bool xReadSEImessage (SEIMessages& seis, const NalUnitType nalUnitType, const uint32_t nuh_layer_id, const uint32_t temporalId, const VPS *vps, const SPS *sps, HRD &hrd, std::ostream *pDecodedMessageOutputStream); void xParseSEIFillerPayload (SEIFillerPayload &sei, uint32_t payloadSize, std::ostream *pDecodedMessageOutputStream); - void xParseSEIuserDataUnregistered (SEIuserDataUnregistered &sei, uint32_t payloadSize, std::ostream *pDecodedMessageOutputStream); + void xParseSEIuserDataUnregistered(SEIUserDataUnregistered& sei, uint32_t payloadSize, + std::ostream* pDecodedMessageOutputStream); void xParseSEIDecodingUnitInfo(SEIDecodingUnitInfo& dui, uint32_t payloadSize, const SEIBufferingPeriod& bp, const uint32_t temporalId, std::ostream* pDecodedMessageOutputStream); void xParseSEIDecodedPictureHash (SEIDecodedPictureHash& sei, uint32_t payloadSize, std::ostream *pDecodedMessageOutputStream); diff --git a/source/Lib/DecoderLib/VLCReader.cpp b/source/Lib/DecoderLib/VLCReader.cpp index 91235415dcb3aed17a5a715e3d750a8fdca6db61..3356ceacb1991f64820867f808fd7635e8b7c81f 100644 --- a/source/Lib/DecoderLib/VLCReader.cpp +++ b/source/Lib/DecoderLib/VLCReader.cpp @@ -185,13 +185,13 @@ void VLCReader::xReadFlag( uint32_t& value, const char* ) } #if ENABLE_TRACING || RExt__DECODER_DEBUG_BIT_STATISTICS -void VLCReader::xReadString( std::string& value, const char *symbolName ) +void VLCReader::xReadString( std::string& valueOut, const char *symbolName ) #else -void VLCReader::xReadString( std::string& value, const char* ) +void VLCReader::xReadString( std::string& valueOut, const char* ) #endif { uint32_t code; - value = ""; + std::string value( "" );; do { m_pcBitstream->read(8, code); @@ -204,6 +204,7 @@ void VLCReader::xReadString( std::string& value, const char* ) #if ENABLE_TRACING DTRACE(g_trace_ctx, D_HEADER, "%-50s u(1) : %s\n", symbolName, value.c_str()); #endif + valueOut = value; } #if RExt__DECODER_DEBUG_BIT_STATISTICS || ENABLE_TRACING diff --git a/source/Lib/EncoderLib/EncCfg.h b/source/Lib/EncoderLib/EncCfg.h index 130cdf58bc6368bf71dff4cbd493fb1336942015..f0ea7cad9f2d1e3998ba934cf07efbf30bda4cfe 100644 --- a/source/Lib/EncoderLib/EncCfg.h +++ b/source/Lib/EncoderLib/EncCfg.h @@ -985,6 +985,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; @@ -2824,6 +2827,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 191b015cdf1ebd55fbd1594e30e464688df3429d..42689af050b955164033bb0e2426463a34022e1f 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 411df53a8c5409b54c741b3447f00ddd8e774930..5ccaf963d78fecc047461c5b0b7c330355d2fb4e 100644 --- a/source/Lib/EncoderLib/SEIwrite.cpp +++ b/source/Lib/EncoderLib/SEIwrite.cpp @@ -48,7 +48,7 @@ void SEIWriter::xWriteSEIpayloadData(OutputBitstream &bs, const SEI &sei, HRD &h switch (sei.payloadType()) { case SEI::PayloadType::USER_DATA_UNREGISTERED: - xWriteSEIuserDataUnregistered(*static_cast<const SEIuserDataUnregistered*>(&sei)); + xWriteSEIuserDataUnregistered(reinterpret_cast<const SEIUserDataUnregistered&>(sei)); break; case SEI::PayloadType::DECODING_UNIT_INFO: bp = hrd.getBufferingPeriodSEI(); @@ -292,16 +292,16 @@ void SEIWriter::writeSEImessages(OutputBitstream& bs, const SEIMessages &seiList * marshal a user_data_unregistered SEI message sei, storing the marshalled * representation in bitstream bs. */ -void SEIWriter::xWriteSEIuserDataUnregistered(const SEIuserDataUnregistered &sei) +void SEIWriter::xWriteSEIuserDataUnregistered(const SEIUserDataUnregistered& sei) { - for (uint32_t i = 0; i < ISO_IEC_11578_LEN; i++) + for (uint32_t i = 0; i < sei.uuid.size(); i++) { - xWriteCode(sei.uuid_iso_iec_11578[i], 8 , "uuid_iso_iec_11578[i]"); + xWriteCode(sei.uuid[i], 8, "uuid_iso_iec_11578[i]"); } - for (uint32_t i = 0; i < sei.userDataLength; i++) + for (uint32_t i = 0; i < sei.data.size(); i++) { - xWriteCode(sei.userData[i], 8 , "user_data_payload_byte"); + xWriteCode(sei.data[i], 8, "user_data_payload_byte"); } } @@ -1998,18 +1998,25 @@ void SEIWriter::xWriteSEINeuralNetworkPostFilterCharacteristics(const SEINeuralN xWriteUvlc(to_underlying(sei.m_chromaSampleLocTypeFrame), "nnpfc_chroma_sample_loc_type_frame"); } - xWriteUvlc(sei.m_overlap, "nnpfc_overlap"); - xWriteFlag(sei.m_constantPatchSizeFlag, "nnpfc_constant_patch_size_flag"); - if (sei.m_constantPatchSizeFlag) +#if JVET_AI0061_PROPOSAL2_SPATIAL_EXTRAPOLATION + if((sei.m_purpose & NNPC_PurposeType::SPATIAL_EXTRAPOLATION) == 0) { - xWriteUvlc(sei.m_patchWidthMinus1, "nnpfc_patch_width_minus1"); - xWriteUvlc(sei.m_patchHeightMinus1, "nnpfc_patch_height_minus1"); - } - else - { - xWriteUvlc(sei.m_extendedPatchWidthCdDeltaMinus1, "extended_nnpfc_patch_width_cd_delta_minus1"); - xWriteUvlc(sei.m_extendedPatchHeightCdDeltaMinus1, "extended_nnpfc_patch_height_cd_delta_minus1"); +#endif + xWriteUvlc(sei.m_overlap, "nnpfc_overlap"); + xWriteFlag(sei.m_constantPatchSizeFlag, "nnpfc_constant_patch_size_flag"); + if (sei.m_constantPatchSizeFlag) + { + xWriteUvlc(sei.m_patchWidthMinus1, "nnpfc_patch_width_minus1"); + xWriteUvlc(sei.m_patchHeightMinus1, "nnpfc_patch_height_minus1"); + } + else + { + xWriteUvlc(sei.m_extendedPatchWidthCdDeltaMinus1, "extended_nnpfc_patch_width_cd_delta_minus1"); + xWriteUvlc(sei.m_extendedPatchHeightCdDeltaMinus1, "extended_nnpfc_patch_height_cd_delta_minus1"); + } +#if JVET_AI0061_PROPOSAL2_SPATIAL_EXTRAPOLATION } +#endif xWriteUvlc(sei.m_paddingType, "nnpfc_padding_type"); if (sei.m_paddingType == NNPC_PaddingType::FIXED_PADDING) { @@ -2124,21 +2131,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 diff --git a/source/Lib/EncoderLib/SEIwrite.h b/source/Lib/EncoderLib/SEIwrite.h index 2b4da9d6bfc6e160f9c7d002543e027410ab8dfa..bbf4034026662db0960b7aee1ad623709f1b72ed 100644 --- a/source/Lib/EncoderLib/SEIwrite.h +++ b/source/Lib/EncoderLib/SEIwrite.h @@ -54,7 +54,7 @@ public: void writeSEImessages(OutputBitstream& bs, const SEIMessages &seiList, HRD &hrd, bool isNested, const uint32_t temporalId); protected: - void xWriteSEIuserDataUnregistered(const SEIuserDataUnregistered &sei); + void xWriteSEIuserDataUnregistered(const SEIUserDataUnregistered& sei); void xWriteSEIDecodingUnitInfo(const SEIDecodingUnitInfo& dui, const SEIBufferingPeriod& bp, const uint32_t temporalId); void xWriteSEIDecodedPictureHash(const SEIDecodedPictureHash& sei); diff --git a/source/Lib/Utilities/VideoIOYuv.cpp b/source/Lib/Utilities/VideoIOYuv.cpp index e49e08832341ecafe776e4da181743099b729094..bba8f90bd19019d6a885ce88cb3f8cd71f5dccb5 100644 --- a/source/Lib/Utilities/VideoIOYuv.cpp +++ b/source/Lib/Utilities/VideoIOYuv.cpp @@ -1478,8 +1478,10 @@ bool VideoIOYuv::writeUpscaledPicture(const SPS &sps, const PPS &pps, const CPel else { const Window &conf = pps.getConformanceWindow(); + int curPicWidth = maxWidth - SPS::getWinUnitX( sps.getChromaFormatIdc() ) * ( afterScaleWindowFullResolution.getWindowLeftOffset() + afterScaleWindowFullResolution.getWindowRightOffset() ); + int curPicHeight = maxHeight - SPS::getWinUnitY( sps.getChromaFormatIdc() ) * ( afterScaleWindowFullResolution.getWindowTopOffset() + afterScaleWindowFullResolution.getWindowBottomOffset() ); - ret = write(maxWidth, maxHeight, pic, ipCSC, + ret = write(curPicWidth, curPicHeight, pic, ipCSC, packedYuvOutputMode, conf.getWindowLeftOffset() * SPS::getWinUnitX(chromaFormatIdc), conf.getWindowRightOffset() * SPS::getWinUnitX(chromaFormatIdc), conf.getWindowTopOffset() * SPS::getWinUnitY(chromaFormatIdc),