Commit 64076002 authored by Xiang Li's avatar Xiang Li
Browse files

Merge branch 'fix_invalid_code_messages' into 'master'

replace all "Invalid code" error messages with more appropriate errors

See merge request jvet/VVCSoftware_VTM!1551
parents 5da016b2 c91fc6cc
......@@ -1244,7 +1244,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 );
}
......@@ -1412,7 +1412,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())
......@@ -1521,9 +1521,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();
......@@ -1534,9 +1534,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())
{
......@@ -1934,12 +1934,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);
......@@ -1996,7 +1996,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)
{
......@@ -2617,9 +2617,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())
......@@ -2672,9 +2672,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
......@@ -4187,12 +4187,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);
}
......@@ -4244,13 +4244,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
{
......@@ -4266,14 +4266,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) );
}
......@@ -4313,12 +4313,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);
}
......@@ -4376,19 +4376,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
{
......@@ -4404,14 +4398,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));
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment