aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNuo Mi <nuomi2021@gmail.com>2024-11-23 17:32:31 +0800
committerNuo Mi <nuomi2021@gmail.com>2024-11-30 09:58:59 +0800
commit46006529a16efab45c865114a559914afe281341 (patch)
tree524429bebfcbdcb7ff3c93400f4fdf1f9bfe1131
parent4100a2da297bddfacc634f93d0634fc34869cbf1 (diff)
downloadffmpeg-46006529a16efab45c865114a559914afe281341.tar.gz
avcodec/cbs_h266: check subpicture slices number
According to section 6.3.3, 'Spatial or component-wise partitionings,' Subpictures must cover the entire picture. Therefore, the total number of subpicture slices should equal the number of picture slices Co-authored-by: Frank Plowman <post@frankplowman.com>
-rw-r--r--libavcodec/cbs_h266_syntax_template.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/libavcodec/cbs_h266_syntax_template.c b/libavcodec/cbs_h266_syntax_template.c
index 6b2d6534ef..8abd3d1ba7 100644
--- a/libavcodec/cbs_h266_syntax_template.c
+++ b/libavcodec/cbs_h266_syntax_template.c
@@ -1966,7 +1966,7 @@ static int FUNC(pps) (CodedBitstreamContext *ctx, RWContext *rw,
infer(pps_single_slice_per_subpic_flag, 1);
if (current->pps_rect_slice_flag &&
!current->pps_single_slice_per_subpic_flag) {
- int j;
+ int j, num_slices = 0;
uint16_t tile_idx = 0, tile_x, tile_y, ctu_x, ctu_y;
uint16_t slice_top_left_ctu_x[VVC_MAX_SLICES];
uint16_t slice_top_left_ctu_y[VVC_MAX_SLICES];
@@ -2155,7 +2155,10 @@ static int FUNC(pps) (CodedBitstreamContext *ctx, RWContext *rw,
current->num_slices_in_subpic[i]++;
}
}
+ num_slices += current->num_slices_in_subpic[i];
}
+ if (current->pps_num_slices_in_pic_minus1 + 1 != num_slices)
+ return AVERROR_INVALIDDATA;
} else {
if (current->pps_no_pic_partition_flag)
infer(pps_num_slices_in_pic_minus1, 0);