diff --git a/source/Lib/DecoderLib/VLCReader.cpp b/source/Lib/DecoderLib/VLCReader.cpp index 28fb1d2914862a3ca41cbca8fbeb574d67ee3419..bb1bea9520a7df9b19ed11a99a3669078b6d3527 100644 --- a/source/Lib/DecoderLib/VLCReader.cpp +++ b/source/Lib/DecoderLib/VLCReader.cpp @@ -1238,7 +1238,7 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS) if( pcSPS->getChromaFormatIdc() == CHROMA_444 ) { - READ_FLAG( uiCode, "separate_colour_plane_flag"); CHECK(uiCode != 0, "Invalid code"); + READ_FLAG( uiCode, "separate_colour_plane_flag"); CHECK(uiCode != 0, "separate_colour_plane_flag shall be equal to 0"); pcSPS->setSeparateColourPlaneFlag( uiCode != 0 ); } @@ -1386,7 +1386,7 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS) READ_FLAG( uiCode, "sps_weighted_bipred_flag" ); pcSPS->setUseWPBiPred( uiCode ? true : false ); READ_CODE(4, uiCode, "log2_max_pic_order_cnt_lsb_minus4"); pcSPS->setBitsForPOC( 4 + uiCode ); - CHECK(uiCode > 12, "Invalid code"); + CHECK(uiCode > 12, "log2_max_pic_order_cnt_lsb_minus4 shall be in the range of 0 to 12"); READ_FLAG(uiCode, "sps_poc_msb_flag"); pcSPS->setPocMsbFlag(uiCode ? true : false); if (pcSPS->getPocMsbFlag()) @@ -1487,9 +1487,9 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS) if (maxBTD[0] != 0) { READ_UVLC(uiCode, "sps_log2_diff_max_bt_min_qt_intra_slice_luma"); maxBTSize[0] <<= uiCode; - CHECK(uiCode > ctbLog2SizeY - minQtLog2SizeIntraY, "Invalid code"); + CHECK(uiCode > ctbLog2SizeY - minQtLog2SizeIntraY, "The value of sps_log2_diff_max_bt_min_qt_intra_slice_luma shall be in the range of 0 to CtbLog2SizeY − MinQtLog2SizeIntraY"); READ_UVLC(uiCode, "sps_log2_diff_max_tt_min_qt_intra_slice_luma"); maxTTSize[0] <<= uiCode; - CHECK(uiCode > ctbLog2SizeY - minQtLog2SizeIntraY, "Invalid code"); + CHECK(uiCode > ctbLog2SizeY - minQtLog2SizeIntraY, "The value of sps_log2_diff_max_tt_min_qt_intra_slice_luma shall be in the range of 0 to CtbLog2SizeY − MinQtLog2SizeIntraY"); } READ_UVLC(uiCode, "sps_log2_diff_min_qt_min_cb_inter_slice"); unsigned minQtLog2SizeInterY = uiCode + pcSPS->getLog2MinCodingBlockSize(); @@ -1500,9 +1500,9 @@ void HLSyntaxReader::parseSPS(SPS* pcSPS) if (maxBTD[1] != 0) { READ_UVLC(uiCode, "sps_log2_diff_max_bt_min_qt_inter_slice"); maxBTSize[1] <<= uiCode; - CHECK(uiCode > ctbLog2SizeY - minQtLog2SizeInterY, "Invalid code"); + CHECK(uiCode > ctbLog2SizeY - minQtLog2SizeInterY, "The value of sps_log2_diff_max_bt_min_qt_inter_slice shall be in the range of 0 to CtbLog2SizeY − MinQtLog2SizeInterY"); READ_UVLC(uiCode, "sps_log2_diff_max_tt_min_qt_inter_slice"); maxTTSize[1] <<= uiCode; - CHECK(uiCode > ctbLog2SizeY - minQtLog2SizeInterY, "Invalid code"); + CHECK(uiCode > ctbLog2SizeY - minQtLog2SizeInterY, "The value of sps_log2_diff_max_tt_min_qt_inter_slice shall be in the range of 0 to CtbLog2SizeY − MinQtLog2SizeInterY"); } if (pcSPS->getUseDualITree()) { @@ -1900,12 +1900,12 @@ void HLSyntaxReader::parseVPS(VPS* pcVPS) CHECK( uiCode == 0, "vps_video_parameter_set_id equal to zero is reserved and shall not be used in a bitstream" ); pcVPS->setVPSId(uiCode); - READ_CODE(6, uiCode, "vps_max_layers_minus1"); pcVPS->setMaxLayers(uiCode + 1); CHECK(uiCode + 1 > MAX_VPS_LAYERS, "Invalid code"); + READ_CODE(6, uiCode, "vps_max_layers_minus1"); pcVPS->setMaxLayers(uiCode + 1); CHECK(uiCode + 1 > MAX_VPS_LAYERS, "Signalled number of layers larger than MAX_VPS_LAYERS."); if (pcVPS->getMaxLayers() - 1 == 0) { pcVPS->setEachLayerIsAnOlsFlag(1); } - READ_CODE(3, uiCode, "vps_max_sublayers_minus1"); pcVPS->setMaxSubLayers(uiCode + 1); CHECK(uiCode + 1 > MAX_VPS_SUBLAYERS, "Invalid code"); + READ_CODE(3, uiCode, "vps_max_sublayers_minus1"); pcVPS->setMaxSubLayers(uiCode + 1); CHECK(uiCode + 1 > MAX_VPS_SUBLAYERS, "Signalled number of sublayers larger than MAX_VPS_SUBLAYERS."); if( pcVPS->getMaxLayers() > 1 && pcVPS->getMaxSubLayers() > 1) { READ_FLAG(uiCode, "vps_all_layers_same_num_sublayers_flag"); pcVPS->setAllLayersSameNumSublayersFlag(uiCode); @@ -1962,7 +1962,7 @@ void HLSyntaxReader::parseVPS(VPS* pcVPS) { if (!pcVPS->getAllIndependentLayersFlag()) { - READ_CODE(2, uiCode, "ols_mode_idc"); pcVPS->setOlsModeIdc(uiCode); CHECK(uiCode > MAX_VPS_OLS_MODE_IDC, "Invalid code"); + READ_CODE(2, uiCode, "ols_mode_idc"); pcVPS->setOlsModeIdc(uiCode); CHECK(uiCode > MAX_VPS_OLS_MODE_IDC, "ols_mode_idc shall be in the rage of 0 to 2"); } if (pcVPS->getOlsModeIdc() == 2) { @@ -2583,9 +2583,9 @@ void HLSyntaxReader::parsePictureHeader( PicHeader* picHeader, ParameterSetManag if (maxBTD[0] != 0) { READ_UVLC(uiCode, "ph_log2_diff_max_bt_min_qt_intra_slice_luma"); maxBTSize[0] <<= uiCode; - CHECK(uiCode > ctbLog2SizeY - minQtLog2SizeIntraY, "Invalid code"); + CHECK(uiCode > ctbLog2SizeY - minQtLog2SizeIntraY, "The value of ph_log2_diff_max_bt_min_qt_intra_slice_luma shall be in the range of 0 to CtbLog2SizeY − MinQtLog2SizeIntraY"); READ_UVLC(uiCode, "ph_log2_diff_max_tt_min_qt_intra_slice_luma"); maxTTSize[0] <<= uiCode; - CHECK(uiCode > ctbLog2SizeY - minQtLog2SizeIntraY, "Invalid code"); + CHECK(uiCode > ctbLog2SizeY - minQtLog2SizeIntraY, "The value of ph_log2_diff_max_tt_min_qt_intra_slice_luma shall be in the range of 0 to CtbLog2SizeY − MinQtLog2SizeIntraY"); } if (sps->getUseDualITree()) @@ -2638,9 +2638,9 @@ void HLSyntaxReader::parsePictureHeader( PicHeader* picHeader, ParameterSetManag if (maxBTD[1] != 0) { READ_UVLC(uiCode, "ph_log2_diff_max_bt_min_qt_inter_slice"); maxBTSize[1] <<= uiCode; - CHECK(uiCode > ctbLog2SizeY - minQtLog2SizeInterY, "Invalid code"); + CHECK(uiCode > ctbLog2SizeY - minQtLog2SizeInterY, "The value of ph_log2_diff_max_bt_min_qt_inter_slice shall be in the range of 0 to CtbLog2SizeY − MinQtLog2SizeInterY"); READ_UVLC(uiCode, "ph_log2_diff_max_tt_min_qt_inter_slice"); maxTTSize[1] <<= uiCode; - CHECK(uiCode > ctbLog2SizeY - minQtLog2SizeInterY, "Invalid code"); + CHECK(uiCode > ctbLog2SizeY - minQtLog2SizeInterY, "The value of ph_log2_diff_max_tt_min_qt_inter_slice shall be in the range of 0 to CtbLog2SizeY − MinQtLog2SizeInterY"); } } // delta quantization and chrom and chroma offset @@ -4098,12 +4098,12 @@ void HLSyntaxReader::parsePredWeightTable( Slice* pcSlice, const SPS *sps ) int iDeltaDenom; // decode delta_luma_log2_weight_denom : READ_UVLC( uiLog2WeightDenomLuma, "luma_log2_weight_denom" ); - CHECK( uiLog2WeightDenomLuma > 7, "Invalid code" ); + CHECK( uiLog2WeightDenomLuma > 7, "The value of luma_log2_weight_denom shall be in the range of 0 to 7" ); if( bChroma ) { READ_SVLC( iDeltaDenom, "delta_chroma_log2_weight_denom" ); - CHECK((iDeltaDenom + (int)uiLog2WeightDenomLuma)<0, "Invalid code"); - CHECK((iDeltaDenom + (int)uiLog2WeightDenomLuma)>7, "Invalid code"); + CHECK((iDeltaDenom + (int)uiLog2WeightDenomLuma)<0, "luma_log2_weight_denom + delta_chroma_log2_weight_denom shall be in the range of 0 to 7"); + CHECK((iDeltaDenom + (int)uiLog2WeightDenomLuma)>7, "luma_log2_weight_denom + delta_chroma_log2_weight_denom shall be in the range of 0 to 7"); uiLog2WeightDenomChroma = (uint32_t)(iDeltaDenom + uiLog2WeightDenomLuma); } @@ -4155,13 +4155,13 @@ void HLSyntaxReader::parsePredWeightTable( Slice* pcSlice, const SPS *sps ) { int iDeltaWeight; READ_SVLC( iDeltaWeight, iNumRef==0?"delta_luma_weight_l0[i]":"delta_luma_weight_l1[i]" ); - CHECK( iDeltaWeight < -128, "Invalid code" ); - CHECK( iDeltaWeight > 127, "Invalid code" ); + CHECK( iDeltaWeight < -128, "delta_luma_weight_lx shall be in the rage of -128 to 127" ); + CHECK( iDeltaWeight > 127, "delta_luma_weight_lx shall be in the rage of -128 to 127" ); wp[COMPONENT_Y].iWeight = (iDeltaWeight + (1<<wp[COMPONENT_Y].uiLog2WeightDenom)); READ_SVLC( wp[COMPONENT_Y].iOffset, iNumRef==0?"luma_offset_l0[i]":"luma_offset_l1[i]" ); const int range=sps->getSpsRangeExtension().getHighPrecisionOffsetsEnabledFlag() ? (1<<sps->getBitDepth(CHANNEL_TYPE_LUMA))/2 : 128; - if( wp[0].iOffset < -range ) { THROW("Offset out of range"); } - if( wp[0].iOffset >= range ) { THROW("Offset out of range"); } + CHECK ( wp[0].iOffset < -range , "luma_offset_lx shall be in the rage of -128 to 127"); + CHECK ( wp[0].iOffset >= range , "luma_offset_lx shall be in the rage of -128 to 127"); } else { @@ -4177,14 +4177,14 @@ void HLSyntaxReader::parsePredWeightTable( Slice* pcSlice, const SPS *sps ) { int iDeltaWeight; READ_SVLC( iDeltaWeight, iNumRef==0?"delta_chroma_weight_l0[i]":"delta_chroma_weight_l1[i]" ); - CHECK( iDeltaWeight < -128, "Invalid code" ); - CHECK( iDeltaWeight > 127, "Invalid code" ); + CHECK( iDeltaWeight < -128, "delta_chroma_weight_lx shall be in the rage of -128 to 127" ); + CHECK( iDeltaWeight > 127, "delta_chroma_weight_lx shall be in the rage of -128 to 127" ); wp[j].iWeight = (iDeltaWeight + (1<<wp[j].uiLog2WeightDenom)); int iDeltaChroma; READ_SVLC( iDeltaChroma, iNumRef==0?"delta_chroma_offset_l0[i]":"delta_chroma_offset_l1[i]" ); - CHECK( iDeltaChroma < -4*range, "Invalid code" ); - CHECK( iDeltaChroma >= 4*range, "Invalid code" ); + CHECK( iDeltaChroma < -4*range, "delta_chroma_offset_lx shall be in the range of -4 * 128 to 4 * 127" ); + CHECK( iDeltaChroma >= 4*range, "delta_chroma_offset_lx shall be in the range of -4 * 128 to 4 * 127" ); int pred = ( range - ( ( range*wp[j].iWeight)>>(wp[j].uiLog2WeightDenom) ) ); wp[j].iOffset = Clip3(-range, range-1, (iDeltaChroma + pred) ); } @@ -4224,12 +4224,12 @@ void HLSyntaxReader::parsePredWeightTable(PicHeader *picHeader, const SPS *sps) int deltaDenom; READ_UVLC(log2WeightDenomLuma, "luma_log2_weight_denom"); - CHECK(log2WeightDenomLuma > 7, "Invalid code"); + CHECK(log2WeightDenomLuma > 7, "The value of luma_log2_weight_denom shall be in the range of 0 to 7"); if (chroma) { READ_SVLC(deltaDenom, "delta_chroma_log2_weight_denom"); - CHECK((deltaDenom + (int) log2WeightDenomLuma) < 0, "Invalid code"); - CHECK((deltaDenom + (int) log2WeightDenomLuma) > 7, "Invalid code"); + CHECK((deltaDenom + (int) log2WeightDenomLuma) < 0, "luma_log2_weight_denom + delta_chroma_log2_weight_denom shall be in the range of 0 to 7"); + CHECK((deltaDenom + (int) log2WeightDenomLuma) > 7, "luma_log2_weight_denom + delta_chroma_log2_weight_denom shall be in the range of 0 to 7"); log2WeightDenomChroma = (uint32_t)(deltaDenom + log2WeightDenomLuma); } @@ -4287,19 +4287,13 @@ void HLSyntaxReader::parsePredWeightTable(PicHeader *picHeader, const SPS *sps) { int deltaWeight; READ_SVLC(deltaWeight, numRef == 0 ? "delta_luma_weight_l0[i]" : "delta_luma_weight_l1[i]"); - CHECK(deltaWeight < -128, "Invalid code"); - CHECK(deltaWeight > 127, "Invalid code"); + CHECK(deltaWeight < -128, "delta_luma_weight_lx shall be in the rage of -128 to 127"); + CHECK(deltaWeight > 127, "delta_luma_weight_lx shall be in the rage of -128 to 127"); wp[COMPONENT_Y].iWeight = (deltaWeight + (1 << wp[COMPONENT_Y].uiLog2WeightDenom)); READ_SVLC(wp[COMPONENT_Y].iOffset, numRef == 0 ? "luma_offset_l0[i]" : "luma_offset_l1[i]"); const int range = sps->getSpsRangeExtension().getHighPrecisionOffsetsEnabledFlag() ? (1 << sps->getBitDepth(CHANNEL_TYPE_LUMA)) / 2 : 128; - if (wp[0].iOffset < -range) - { - THROW("Offset out of range"); - } - if (wp[0].iOffset >= range) - { - THROW("Offset out of range"); - } + CHECK ( wp[0].iOffset < -range , "luma_offset_lx shall be in the rage of -128 to 127"); + CHECK ( wp[0].iOffset >= range , "luma_offset_lx shall be in the rage of -128 to 127"); } else { @@ -4315,14 +4309,14 @@ void HLSyntaxReader::parsePredWeightTable(PicHeader *picHeader, const SPS *sps) { int deltaWeight; READ_SVLC(deltaWeight, numRef == 0 ? "delta_chroma_weight_l0[i]" : "delta_chroma_weight_l1[i]"); - CHECK(deltaWeight < -128, "Invalid code"); - CHECK(deltaWeight > 127, "Invalid code"); + CHECK( deltaWeight < -128, "delta_chroma_weight_lx shall be in the rage of -128 to 127" ); + CHECK( deltaWeight > 127, "delta_chroma_weight_lx shall be in the rage of -128 to 127" ); wp[j].iWeight = (deltaWeight + (1 << wp[j].uiLog2WeightDenom)); int deltaChroma; READ_SVLC(deltaChroma, numRef == 0 ? "delta_chroma_offset_l0[i]" : "delta_chroma_offset_l1[i]"); - CHECK(deltaChroma < -4 * range, "Invalid code"); - CHECK(deltaChroma >= 4 * range, "Invalid code"); + CHECK( deltaChroma < -4*range, "delta_chroma_offset_lx shall be in the range of -4 * 128 to 4 * 127" ); + CHECK( deltaChroma >= 4*range, "delta_chroma_offset_lx shall be in the range of -4 * 128 to 4 * 127" ); int pred = (range - ((range * wp[j].iWeight) >> (wp[j].uiLog2WeightDenom))); wp[j].iOffset = Clip3(-range, range - 1, (deltaChroma + pred)); }