diff --git a/source/Lib/CommonLib/TypeDef.h b/source/Lib/CommonLib/TypeDef.h index 791574f8259a9a512b5267ca85c3ddb8f1f84d7f..07d08dbb8ffd19adf25df27844f292c37f5e4508 100644 --- a/source/Lib/CommonLib/TypeDef.h +++ b/source/Lib/CommonLib/TypeDef.h @@ -54,6 +54,7 @@ //########### place macros to be removed in next cycle below this line ############### +#define JVET_Y0273_GCI_BUGFIX 1 // JVET-Y0273 option C bugfix for GCI signalling #define JVET_X0143_ALF_APS_ID_OFFSET 0 // A value between 0 to 7 inclusive. This macro should be kept, or to be defined as a configuration parameter if possible. //########### place macros to be be kept below this line ############### diff --git a/source/Lib/DecoderLib/VLCReader.cpp b/source/Lib/DecoderLib/VLCReader.cpp index 3b3cbca1391b3b24b2b002f7c80b35a76ebba7e0..b59a4a58b83092c3866a273bb27642f7d070605a 100644 --- a/source/Lib/DecoderLib/VLCReader.cpp +++ b/source/Lib/DecoderLib/VLCReader.cpp @@ -4593,7 +4593,11 @@ void HLSyntaxReader::parseConstraintInfo(ConstraintInfo *cinfo, const ProfileTie READ_CODE(8, symbol, "gci_num_additional_bits"); uint32_t const numAdditionalBits = symbol; int numAdditionalBitsUsed; +#if JVET_Y0273_GCI_BUGFIX + if (numAdditionalBits > 5) +#else if (numAdditionalBits > 0) +#endif { READ_FLAG(symbol, "gci_all_rap_pictures_flag"); cinfo->setAllRapPicturesFlag(symbol > 0 ? true : false); READ_FLAG(symbol, "gci_no_extended_precision_processing_constraint_flag"); cinfo->setNoExtendedPrecisionProcessingConstraintFlag(symbol > 0 ? true : false); @@ -4603,13 +4607,25 @@ void HLSyntaxReader::parseConstraintInfo(ConstraintInfo *cinfo, const ProfileTie READ_FLAG(symbol, "gci_no_reverse_last_sig_coeff_constraint_flag"); cinfo->setNoReverseLastSigCoeffConstraintFlag(symbol > 0 ? true : false); numAdditionalBitsUsed = 6; } +#if JVET_Y0273_GCI_BUGFIX + else if (numAdditionalBits > 0) + { + msg(ERROR, "Warning: the current bitstream is illegal because gci_num_additional_bits was set to the value %d. \ + gci_num_additional_bits may only be set to 0, 6, or greater than 6.", numAdditionalBits); + numAdditionalBitsUsed = 0; + } +#endif else { numAdditionalBitsUsed = 0; } for (int i = 0; i < numAdditionalBits - numAdditionalBitsUsed; i++) { +#if JVET_Y0273_GCI_BUGFIX + READ_FLAG(symbol, "gci_reserved_bit"); +#else READ_FLAG(symbol, "gci_reserved_zero_bit"); CHECK(symbol != 0, "gci_reserved_zero_bit not equal to zero"); +#endif } } while (!isByteAligned())