diff --git a/source/App/EncoderApp/EncAppCfg.cpp b/source/App/EncoderApp/EncAppCfg.cpp index b3f03e8b34881e611253a29cbdacf472327f7ac4..7ee1689fe2cfab5549d516ea113c30a55a43f6d8 100644 --- a/source/App/EncoderApp/EncAppCfg.cpp +++ b/source/App/EncoderApp/EncAppCfg.cpp @@ -5181,6 +5181,11 @@ bool EncAppCfg::xCheckParameter() "Output picture height numerator cannot be equal to or less than 0"); xConfirmPara(m_nnPostFilterSEICharacteristicsPicHeightDenominator[i] <= 0, "Output picture height denominator cannot be equal to or less than 0"); +#if JVET_AD0091 + xConfirmPara(m_nnPostFilterSEICharacteristicsLumaPadding[i] > ((1 << m_inputBitDepth[ChannelType::LUMA]) - 1), "SEINNPFCLumaPadding must be in the range of 0 to 2^bitDepthLuma - 1"); + xConfirmPara(m_nnPostFilterSEICharacteristicsCbPadding[i] > ((1 << m_inputBitDepth[ChannelType::CHROMA]) - 1), "SEINNPFCLumaPadding must be in the range of 0 to 2^bitDepthChroma - 1"); + xConfirmPara(m_nnPostFilterSEICharacteristicsCrPadding[i] > ((1 << m_inputBitDepth[ChannelType::CHROMA]) - 1), "SEINNPFCLumaPadding must be in the range of 0 to 2^bitDepthChroma - 1"); +#endif } } diff --git a/source/Lib/CommonLib/TypeDef.h b/source/Lib/CommonLib/TypeDef.h index 73f38582e1810cea134595e6a6ed91e741813e97..f77c109716318454d9f476592f5152150fedb495 100644 --- a/source/Lib/CommonLib/TypeDef.h +++ b/source/Lib/CommonLib/TypeDef.h @@ -85,6 +85,7 @@ #define JVET_AD0056_MOVE_COLOUR_DESC_FLAG 1 // Move nnpfc_separate_colour_description_present_flag and associated flags and add conformance checks +#define JVET_AD0091 1 //########### place macros to be be kept below this line ############### #define GDR_ENABLED 1 diff --git a/source/Lib/DecoderLib/SEIread.cpp b/source/Lib/DecoderLib/SEIread.cpp index d7d7ae3674e52d029a1e29f3d7a1b07deb5fbcc5..65c62b27335ab78531c7d94fe8d352d2eabb7b07 100644 --- a/source/Lib/DecoderLib/SEIread.cpp +++ b/source/Lib/DecoderLib/SEIread.cpp @@ -2925,6 +2925,13 @@ void SEIReader::xParseSEINNPostFilterCharacteristics(SEINeuralNetworkPostFilterC sei.m_picHeightNumeratorMinus1 = val; sei_read_uvlc(pDecodedMessageOutputStream, val, "nnpfc_pic_height_denominator_minus1"); sei.m_picHeightDenominatorMinus1 = val; +#if JVET_AD0091 + int scaledHeightRatio = 16 * (sei.m_picHeightNumeratorMinus1 + 1) / (sei.m_picHeightDenominatorMinus1 + 1); + int scaledWidthRatio = 16 * (sei.m_picWidthNumeratorMinus1 + 1) / (sei.m_picWidthDenominatorMinus1 + 1); + + CHECK((scaledHeightRatio < 1) && (scaledHeightRatio > 256), "The value range of heightRatio shall be in the range of 1/16 to 16, inclusive"); + CHECK((scaledWidthRatio < 1) && (scaledWidthRatio > 256), "The value range of widthRatio shall be in the range of 1/16 to 16, inclusive"); +#endif #else sei_read_flag(pDecodedMessageOutputStream, val, "nnpfc_pic_width_in_luma_samples"); sei.m_picWidthInLumaSamples = val; @@ -3123,6 +3130,14 @@ void SEIReader::xParseSEINNPostFilterCharacteristics(SEINeuralNetworkPostFilterC sei_read_uvlc(pDecodedMessageOutputStream, val, "nnpfc_padding_type"); sei.m_paddingType = val; +#if JVET_AD0091 + if((sei.m_paddingType >= 5) && (sei.m_paddingType <= 15)) + { + std::cout<<"Reserved nnpfc_padding_type value, shall ignore the SEI message"<<std::endl; + return; + } + CHECK(sei.m_paddingType > 15, "Values of nnpfc_padding_type greater than 15 shall not be present in bitstreams"); +#endif if (sei.m_paddingType == NNPC_PaddingType::FIXED_PADDING) { diff --git a/source/Lib/EncoderLib/SEIEncoder.cpp b/source/Lib/EncoderLib/SEIEncoder.cpp index ec82f10a1169c74149151e6ae3c3e0ab2b56e954..8dd777488c0acb1278b8f5034a1ac2a91eea1ae3 100644 --- a/source/Lib/EncoderLib/SEIEncoder.cpp +++ b/source/Lib/EncoderLib/SEIEncoder.cpp @@ -1526,6 +1526,10 @@ void SEIEncoder::initSEINeuralNetworkPostFilterCharacteristics(SEINeuralNetworkP } sei->m_overlap = m_pcCfg->getNNPostFilterSEICharacteristicsOverlap(filterIdx); sei->m_paddingType = m_pcCfg->getNNPostFilterSEICharacteristicsPaddingType(filterIdx); +#if JVET_AD0091 + CHECK((sei->m_paddingType >= 5) && (sei->m_paddingType <= 15), "Reserved nnpfc_padding_type value, shall not be present in bitstreams conforming to this version of VTM"); + CHECK(sei->m_paddingType > 15, "Invalid nnpfc_padding_type value"); +#endif sei->m_lumaPadding = m_pcCfg->getNNPostFilterSEICharacteristicsLumaPadding(filterIdx); sei->m_cbPadding = m_pcCfg->getNNPostFilterSEICharacteristicsCbPadding(filterIdx); sei->m_crPadding = m_pcCfg->getNNPostFilterSEICharacteristicsCrPadding(filterIdx);