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.
Unified · Split
| @@ -1213,30 +1213,30 @@ static int FUNC(sps)(CodedBitstreamContext *ctx, RWContext *rw, · 1212 unmodified lines | |||
| 1213 | infer(sps_loop_filter_across_subpic_enabled_flag[i], 0); | 1213 | infer(sps_loop_filter_across_subpic_enabled_flag[i], 0); |
| 1214 | } | 1214 | } |
| 1215 | } | 1215 | } |
| 1216 | ue(sps_subpic_id_len_minus1, 0, 15); | ||
| 1217 | if ((1 << (current->sps_subpic_id_len_minus1 + 1)) < | ||
| 1218 | current->sps_num_subpics_minus1 + 1) { | ||
| 1219 | av_log(ctx->log_ctx, AV_LOG_ERROR, | ||
| 1220 | "sps_subpic_id_len_minus1(%d) is too small\n", | ||
| 1221 | current->sps_subpic_id_len_minus1); | ||
| 1222 | return AVERROR_INVALIDDATA; | ||
| 1223 | } | ||
| 1224 | flag(sps_subpic_id_mapping_explicitly_signalled_flag); | ||
| 1225 | if (current->sps_subpic_id_mapping_explicitly_signalled_flag) { | ||
| 1226 | flag(sps_subpic_id_mapping_present_flag); | ||
| 1227 | if (current->sps_subpic_id_mapping_present_flag) { | ||
| 1228 | for (i = 0; i <= current->sps_num_subpics_minus1; i++) { | ||
| 1229 | ubs(current->sps_subpic_id_len_minus1 + 1, | ||
| 1230 | sps_subpic_id[i], 1, i); | ||
| 1231 | } | ||
| 1232 | } | ||
| 1233 | } | ||
| 1234 | } else { | 1216 | } else { |
| 1235 | infer(sps_subpic_ctu_top_left_x[0], 0); | 1217 | infer(sps_subpic_ctu_top_left_x[0], 0); |
| 1236 | infer(sps_subpic_ctu_top_left_y[0], 0); | 1218 | infer(sps_subpic_ctu_top_left_y[0], 0); |
| 1237 | infer(sps_subpic_width_minus1[0], tmp_width_val - 1); | 1219 | infer(sps_subpic_width_minus1[0], tmp_width_val - 1); |
| 1238 | infer(sps_subpic_height_minus1[0], tmp_height_val - 1); | 1220 | infer(sps_subpic_height_minus1[0], tmp_height_val - 1); |
| 1239 | } | 1221 | } |
| 1222 | ue(sps_subpic_id_len_minus1, 0, 15); | ||
| 1223 | if ((1 << (current->sps_subpic_id_len_minus1 + 1)) < | ||
| 1224 | current->sps_num_subpics_minus1 + 1) { | ||
| 1225 | av_log(ctx->log_ctx, AV_LOG_ERROR, | ||
| 1226 | "sps_subpic_id_len_minus1(%d) is too small\n", | ||
| 1227 | current->sps_subpic_id_len_minus1); | ||
| 1228 | return AVERROR_INVALIDDATA; | ||
| 1229 | } | ||
| 1230 | flag(sps_subpic_id_mapping_explicitly_signalled_flag); | ||
| 1231 | if (current->sps_subpic_id_mapping_explicitly_signalled_flag) { | ||
| 1232 | flag(sps_subpic_id_mapping_present_flag); | ||
| 1233 | if (current->sps_subpic_id_mapping_present_flag) { | ||
| 1234 | for (i = 0; i <= current->sps_num_subpics_minus1; i++) { | ||
| 1235 | ubs(current->sps_subpic_id_len_minus1 + 1, | ||
| 1236 | sps_subpic_id[i], 1, i); | ||
| 1237 | } | ||
| 1238 | } | ||
| 1239 | } | ||
| 1240 | } else { | 1240 | } else { |
| 1241 | infer(sps_num_subpics_minus1, 0); | 1241 | infer(sps_num_subpics_minus1, 0); |
| 1242 | infer(sps_independent_subpics_flag, 1); | 1242 | infer(sps_independent_subpics_flag, 1); |