mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-24 18:51:11 +00:00
h265parser/bitwriter: add some comments for ceil_log2 use
Validate that the length of field must be calculate with ceil_logs2 and not bit storage. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7429>
This commit is contained in:
parent
8f9ed667cd
commit
ff9100eb4d
2 changed files with 8 additions and 2 deletions
|
@ -1437,6 +1437,7 @@ _h265_slice_bit_writer_ref_pic_list_modification (const GstH265SliceHdr *
|
|||
|
||||
if (rpl_mod->ref_pic_list_modification_flag_l0) {
|
||||
for (i = 0; i <= slice->num_ref_idx_l0_active_minus1; i++) {
|
||||
/* 7.4.7.2 list_entry_l0 */
|
||||
WRITE_BITS (bw, rpl_mod->list_entry_l0[i], n);
|
||||
}
|
||||
}
|
||||
|
@ -1575,7 +1576,7 @@ _h265_bit_writer_slice_header (const GstH265SliceHdr * slice,
|
|||
|
||||
if (slice->pps->dependent_slice_segments_enabled_flag)
|
||||
WRITE_BITS (bw, slice->dependent_slice_segment_flag, 1);
|
||||
/* sice_segment_address parsing */
|
||||
/* 7.4.7.1 slice_segment_address parsing */
|
||||
WRITE_BITS (bw, slice->segment_address, n);
|
||||
}
|
||||
|
||||
|
@ -1610,6 +1611,7 @@ _h265_bit_writer_slice_header (const GstH265SliceHdr * slice,
|
|||
sps->num_short_term_ref_pic_sets - 1)
|
||||
goto error;
|
||||
|
||||
/* 7.4.7.1 short_term_ref_pic_set_idx */
|
||||
WRITE_BITS (bw, slice->short_term_ref_pic_set_idx, n);
|
||||
}
|
||||
|
||||
|
@ -1625,6 +1627,7 @@ _h265_bit_writer_slice_header (const GstH265SliceHdr * slice,
|
|||
for (i = 0; i < limit; i++) {
|
||||
if (i < slice->num_long_term_sps) {
|
||||
if (sps->num_long_term_ref_pics_sps > 1) {
|
||||
/* 7.4.7.1 lt_idx_sps */
|
||||
const guint n =
|
||||
gst_util_ceil_log2 (sps->num_long_term_ref_pics_sps);
|
||||
WRITE_BITS (bw, slice->lt_idx_sps[i], n);
|
||||
|
|
|
@ -926,6 +926,7 @@ gst_h265_slice_parse_ref_pic_list_modification (GstH265SliceHdr * slice,
|
|||
|
||||
if (rpl_mod->ref_pic_list_modification_flag_l0) {
|
||||
for (i = 0; i <= slice->num_ref_idx_l0_active_minus1; i++) {
|
||||
/* 7.4.7.2 list_entry_l0 */
|
||||
READ_UINT32 (nr, rpl_mod->list_entry_l0[i], n);
|
||||
CHECK_ALLOWED_MAX (rpl_mod->list_entry_l0[i], (NumPocTotalCurr - 1));
|
||||
}
|
||||
|
@ -2801,7 +2802,7 @@ gst_h265_parser_parse_slice_hdr (GstH265Parser * parser,
|
|||
|
||||
if (pps->dependent_slice_segments_enabled_flag)
|
||||
READ_UINT8 (&nr, slice->dependent_slice_segment_flag, 1);
|
||||
/* sice_segment_address parsing */
|
||||
/* 7.4.7.1 slice_segment_address parsing */
|
||||
READ_UINT32 (&nr, slice->segment_address, n);
|
||||
}
|
||||
|
||||
|
@ -2835,6 +2836,7 @@ gst_h265_parser_parse_slice_hdr (GstH265Parser * parser,
|
|||
(nal_reader_get_pos (&nr) - pos) -
|
||||
(8 * (nal_reader_get_epb_count (&nr) - epb_pos));
|
||||
} else if (sps->num_short_term_ref_pic_sets > 1) {
|
||||
/* 7.4.7.1 short_term_ref_pic_set_idx */
|
||||
const guint n = gst_util_ceil_log2 (sps->num_short_term_ref_pic_sets);
|
||||
READ_UINT8 (&nr, slice->short_term_ref_pic_set_idx, n);
|
||||
CHECK_ALLOWED_MAX (slice->short_term_ref_pic_set_idx,
|
||||
|
@ -2855,6 +2857,7 @@ gst_h265_parser_parse_slice_hdr (GstH265Parser * parser,
|
|||
for (i = 0; i < limit; i++) {
|
||||
if (i < slice->num_long_term_sps) {
|
||||
if (sps->num_long_term_ref_pics_sps > 1) {
|
||||
/* 7.4.7.1 lt_idx_sps */
|
||||
const guint n =
|
||||
gst_util_ceil_log2 (sps->num_long_term_ref_pics_sps);
|
||||
READ_UINT8 (&nr, slice->lt_idx_sps[i], n);
|
||||
|
|
Loading…
Reference in a new issue