diff --git a/source/Lib/CommonLib/TypeDef.h b/source/Lib/CommonLib/TypeDef.h index 26b0947db36db865db195a8d8a4e1bb30af520f1..66095a4279e28feb4272e41722dc1f907c1d5ed7 100644 --- a/source/Lib/CommonLib/TypeDef.h +++ b/source/Lib/CommonLib/TypeDef.h @@ -77,6 +77,8 @@ #define JVET_AE0048_ITEM_1_VALUE_RANGES 1 // JVET-AE0048 item 1: Add missing value ranges for nnpfc_pic_width_num_minus1, nnpfc_pic_width_denom_minus1, nnpfc_pic_height_num_minus1, and nnpfc_pic_height_denom_minus1. +#define JVET_AE0048_ITEM_2_VALUE_RANGES 1 // JVET_AE0048 item 2: Add missing value ranges for nnpfc_inp_format_idc and nnpfc_out_format_idc to be in the range of 0 to 255. + //########### 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 0779dcd4163e43d660bc2231ee5ddfc2835cf151..9a925ffb9c16734a8967a14ae8cc92c003b13d01 100644 --- a/source/Lib/DecoderLib/SEIread.cpp +++ b/source/Lib/DecoderLib/SEIread.cpp @@ -2981,6 +2981,9 @@ void SEIReader::xParseSEINNPostFilterCharacteristics(SEINeuralNetworkPostFilterC sei_read_uvlc(pDecodedMessageOutputStream, val, "nnpfc_inp_format_idc"); sei.m_inpFormatIdc = val; +#if JVET_AE0048_ITEM_2_VALUE_RANGES + CHECK(sei.m_inpFormatIdc > 255, "The value of nnpfc_inp_format_idc shall be in the range of 0 to 255"); +#endif sei_read_uvlc(pDecodedMessageOutputStream,val,"nnpfc_auxiliary_inp_idc"); sei.m_auxInpIdc = val; @@ -3012,6 +3015,9 @@ void SEIReader::xParseSEINNPostFilterCharacteristics(SEINeuralNetworkPostFilterC sei_read_uvlc(pDecodedMessageOutputStream, val, "nnpfc_out_format_idc"); sei.m_outFormatIdc = val; +#if JVET_AE0048_ITEM_2_VALUE_RANGES + CHECK(sei.m_outFormatIdc > 255, "The value of nnpfc_out_format_idc shall be in the range of 0 to 255"); +#endif sei_read_uvlc(pDecodedMessageOutputStream, val, "nnpfc_out_order_idc"); sei.m_outOrderIdc = val; diff --git a/source/Lib/EncoderLib/SEIEncoder.cpp b/source/Lib/EncoderLib/SEIEncoder.cpp index 37240f98dbaebc6f22081fcc46de3c45017c1203..18624892ba6ab24f9d15c60b3f9a29c735ba8a17 100644 --- a/source/Lib/EncoderLib/SEIEncoder.cpp +++ b/source/Lib/EncoderLib/SEIEncoder.cpp @@ -1410,6 +1410,9 @@ void SEIEncoder::initSEINeuralNetworkPostFilterCharacteristics(SEINeuralNetworkP sei->m_componentLastFlag = m_pcCfg->getNNPostFilterSEICharacteristicsComponentLastFlag(filterIdx); sei->m_inpFormatIdc = m_pcCfg->getNNPostFilterSEICharacteristicsInpFormatIdc(filterIdx); +#if JVET_AE0048_ITEM_2_VALUE_RANGES + CHECK(sei->m_inpFormatIdc > 255, "The value of nnpfc_inp_format_idc shall be in the range of 0 to 255"); +#endif if (sei->m_inpFormatIdc == 1) { sei->m_inpTensorBitDepthLumaMinus8 = m_pcCfg->getNNPostFilterSEICharacteristicsInpTensorBitDepthLumaMinus8(filterIdx); @@ -1422,6 +1425,9 @@ void SEIEncoder::initSEINeuralNetworkPostFilterCharacteristics(SEINeuralNetworkP sei->m_outFormatIdc = m_pcCfg->getNNPostFilterSEICharacteristicsOutFormatIdc(filterIdx); +#if JVET_AE0048_ITEM_2_VALUE_RANGES + CHECK(sei->m_outFormatIdc > 255, "The value of nnpfc_out_format_idc shall be in the range of 0 to 255"); +#endif if (sei->m_outFormatIdc == 1) { sei->m_outTensorBitDepthLumaMinus8 = m_pcCfg->getNNPostFilterSEICharacteristicsOutTensorBitDepthLumaMinus8(filterIdx);