diff --git a/libavcodec/cbs_h266.h b/libavcodec/cbs_h266.h index 21b9a4196c..5f12915b65 100644 --- a/libavcodec/cbs_h266.h +++ b/libavcodec/cbs_h266.h @@ -464,9 +464,9 @@ typedef struct H266RawSPS { uint8_t sps_virtual_boundaries_enabled_flag; uint8_t sps_virtual_boundaries_present_flag; uint8_t sps_num_ver_virtual_boundaries; - uint16_t sps_virtual_boundary_pos_x_minus1[3]; + uint16_t sps_virtual_boundary_pos_x_minus1[VVC_MAX_VBS]; uint8_t sps_num_hor_virtual_boundaries; - uint16_t sps_virtual_boundary_pos_y_minus1[3]; + uint16_t sps_virtual_boundary_pos_y_minus1[VVC_MAX_VBS]; uint8_t sps_timing_hrd_params_present_flag; uint8_t sps_sublayer_cpb_params_present_flag; @@ -703,9 +703,9 @@ typedef struct H266RawPictureHeader { uint8_t ph_virtual_boundaries_present_flag; uint8_t ph_num_ver_virtual_boundaries; - uint16_t ph_virtual_boundary_pos_x_minus1[3]; + uint16_t ph_virtual_boundary_pos_x_minus1[VVC_MAX_VBS]; uint8_t ph_num_hor_virtual_boundaries; - uint16_t ph_virtual_boundary_pos_y_minus1[3]; + uint16_t ph_virtual_boundary_pos_y_minus1[VVC_MAX_VBS]; uint8_t ph_pic_output_flag; H266RefPicLists ph_ref_pic_lists; diff --git a/libavcodec/cbs_h266_syntax_template.c b/libavcodec/cbs_h266_syntax_template.c index 53c4b60b0d..34b766c7af 100644 --- a/libavcodec/cbs_h266_syntax_template.c +++ b/libavcodec/cbs_h266_syntax_template.c @@ -1562,13 +1562,13 @@ static int FUNC(sps)(CodedBitstreamContext *ctx, RWContext *rw, flag(sps_virtual_boundaries_present_flag); if (current->sps_virtual_boundaries_present_flag) { ue(sps_num_ver_virtual_boundaries, - 0, current->sps_pic_width_max_in_luma_samples <= 8 ? 0 : 3); + 0, current->sps_pic_width_max_in_luma_samples <= 8 ? 0 : VVC_MAX_VBS); for (i = 0; i < current->sps_num_ver_virtual_boundaries; i++) ues(sps_virtual_boundary_pos_x_minus1[i], 0, (current->sps_pic_width_max_in_luma_samples + 7) / 8 - 2, 1, i); ue(sps_num_hor_virtual_boundaries, - 0, current->sps_pic_height_max_in_luma_samples <= 8 ? 0 : 3); + 0, current->sps_pic_height_max_in_luma_samples <= 8 ? 0 : VVC_MAX_VBS); for (i = 0; i < current->sps_num_hor_virtual_boundaries; i++) ues(sps_virtual_boundary_pos_y_minus1[i], 0, (current->sps_pic_height_max_in_luma_samples + 7) / @@ -2714,13 +2714,13 @@ static int FUNC(picture_header) (CodedBitstreamContext *ctx, RWContext *rw, flag(ph_virtual_boundaries_present_flag); if (current->ph_virtual_boundaries_present_flag) { ue(ph_num_ver_virtual_boundaries, - 0, pps->pps_pic_width_in_luma_samples <= 8 ? 0 : 3); + 0, pps->pps_pic_width_in_luma_samples <= 8 ? 0 : VVC_MAX_VBS); for (i = 0; i < current->ph_num_ver_virtual_boundaries; i++) { ues(ph_virtual_boundary_pos_x_minus1[i], 0, (pps->pps_pic_width_in_luma_samples + 7) / 8 - 2, 1, i); } ue(ph_num_hor_virtual_boundaries, - 0, pps->pps_pic_height_in_luma_samples <= 8 ? 0 : 3); + 0, pps->pps_pic_height_in_luma_samples <= 8 ? 0 : VVC_MAX_VBS); for (i = 0; i < current->ph_num_hor_virtual_boundaries; i++) { ues(ph_virtual_boundary_pos_y_minus1[i], 0, (pps->pps_pic_height_in_luma_samples + 7) / 8 - 2, 1, i); diff --git a/libavcodec/vvc.h b/libavcodec/vvc.h index c4cec1eb8f..92639779c1 100644 --- a/libavcodec/vvc.h +++ b/libavcodec/vvc.h @@ -151,6 +151,9 @@ enum { // get near that, though, so set a lower limit here with the maximum // possible value for 8K video (at most 135 32x32 Ctb rows). VVC_MAX_ENTRY_POINTS = VVC_MAX_TILE_COLUMNS * 135, + + // {sps, ph}_num_{ver, hor}_virtual_boundaries should in [0, 3] + VVC_MAX_VBS = 3, }; #endif /* AVCODEC_VVC_H */