lavc/vvc: Read subpic ID when only one subpicture is present

Previously, the following syntax elements were not read in the case
sps_num_subpics_minus is 0:
* sps_subpic_id_len_minus1
* sps_subpic_id_mapping_explicitly_signalled_flag
* sps_subpic_id_mapping_present_flag
* sps_subpic_id[i]
This was causing failures to decode bitstreams, for example the DVB's
"VVC HDR UHDTV1 OpenGOP 3840x2160 50fps HLG10 PiP" V&V bitstream.

Patch fixes this by moving the reads for these syntax elements out a
scope.

Signed-off-by: Frank Plowman <post@frankplowman.com>
Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
Frank Plowman 2024-02-25 22:30:42 +00:00 committed by James Almer
parent 53ab7ff67e
commit 8b6219a99d
1 changed files with 18 additions and 18 deletions

View File

@ -1213,30 +1213,30 @@ static int FUNC(sps)(CodedBitstreamContext *ctx, RWContext *rw,
infer(sps_loop_filter_across_subpic_enabled_flag[i], 0);
}
}
ue(sps_subpic_id_len_minus1, 0, 15);
if ((1 << (current->sps_subpic_id_len_minus1 + 1)) <
current->sps_num_subpics_minus1 + 1) {
av_log(ctx->log_ctx, AV_LOG_ERROR,
"sps_subpic_id_len_minus1(%d) is too small\n",
current->sps_subpic_id_len_minus1);
return AVERROR_INVALIDDATA;
}
flag(sps_subpic_id_mapping_explicitly_signalled_flag);
if (current->sps_subpic_id_mapping_explicitly_signalled_flag) {
flag(sps_subpic_id_mapping_present_flag);
if (current->sps_subpic_id_mapping_present_flag) {
for (i = 0; i <= current->sps_num_subpics_minus1; i++) {
ubs(current->sps_subpic_id_len_minus1 + 1,
sps_subpic_id[i], 1, i);
}
}
}
} else {
infer(sps_subpic_ctu_top_left_x[0], 0);
infer(sps_subpic_ctu_top_left_y[0], 0);
infer(sps_subpic_width_minus1[0], tmp_width_val - 1);
infer(sps_subpic_height_minus1[0], tmp_height_val - 1);
}
ue(sps_subpic_id_len_minus1, 0, 15);
if ((1 << (current->sps_subpic_id_len_minus1 + 1)) <
current->sps_num_subpics_minus1 + 1) {
av_log(ctx->log_ctx, AV_LOG_ERROR,
"sps_subpic_id_len_minus1(%d) is too small\n",
current->sps_subpic_id_len_minus1);
return AVERROR_INVALIDDATA;
}
flag(sps_subpic_id_mapping_explicitly_signalled_flag);
if (current->sps_subpic_id_mapping_explicitly_signalled_flag) {
flag(sps_subpic_id_mapping_present_flag);
if (current->sps_subpic_id_mapping_present_flag) {
for (i = 0; i <= current->sps_num_subpics_minus1; i++) {
ubs(current->sps_subpic_id_len_minus1 + 1,
sps_subpic_id[i], 1, i);
}
}
}
} else {
infer(sps_num_subpics_minus1, 0);
infer(sps_independent_subpics_flag, 1);