codecparsers: h265: Introduce long_term_ref_pic_set_size

This is the size of the `if( long_term_ref_pics_present_flag )` inside
slice_segment_header( ) syntax. This size in bit, and after de-emulation
is needed by some HW.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1079>
This commit is contained in:
Nicolas Dufresne 2022-04-29 12:10:05 -04:00
parent 0aad12fbce
commit 74a811e718
2 changed files with 19 additions and 1 deletions

View file

@ -2672,7 +2672,6 @@ gst_h265_parser_parse_slice_hdr (GstH265Parser * parser,
nal_reader_skip (&nr, 1);
READ_UE_MAX (&nr, slice->type, 63);
if (pps->output_flag_present_flag)
READ_UINT8 (&nr, slice->pic_output_flag, 1);
if (sps->separate_colour_plane_flag == 1)
@ -2704,6 +2703,8 @@ gst_h265_parser_parse_slice_hdr (GstH265Parser * parser,
if (sps->long_term_ref_pics_present_flag) {
guint32 limit;
guint pos = nal_reader_get_pos (&nr);
guint epb_pos = nal_reader_get_epb_count (&nr);
if (sps->num_long_term_ref_pics_sps > 0)
READ_UE_MAX (&nr, slice->num_long_term_sps,
@ -2733,6 +2734,10 @@ gst_h265_parser_parse_slice_hdr (GstH265Parser * parser,
if (slice->delta_poc_msb_present_flag[i])
READ_UE (&nr, slice->delta_poc_msb_cycle_lt[i]);
}
slice->long_term_ref_pic_set_size =
(nal_reader_get_pos (&nr) - pos) -
(8 * (nal_reader_get_epb_count (&nr) - epb_pos));
}
if (sps->temporal_mvp_enabled_flag)
READ_UINT8 (&nr, slice->temporal_mvp_enabled_flag, 1);

View file

@ -1384,6 +1384,9 @@ struct _GstH265PredWeightTable
* in this slice_header\()
* @short_term_ref_pic_set_size: the calculated size of short_term_ref_pic_set\()
* in bits. (Since: 1.18)
* @long_term_ref_pic_set_size: the calculated size of the branch
* `if( long_term_ref_pics_present_flag )` `inside slice_segment_header()` syntax
* in bits. (Since: 1.22)
*/
struct _GstH265SliceHdr
{
@ -1463,6 +1466,16 @@ struct _GstH265SliceHdr
/* Size of short_term_ref_pic_set() after emulation preventation bytes are
* removed, in bits */
guint short_term_ref_pic_set_size;
/**
* _GstH265SliceHdr.long_term_ref_pic_set_size:
*
* The calculated size of the branch `if( long_term_ref_pics_present_flag )`
* inside `slice_segment_header()` syntax in bits.
*
* Since: 1.22
*/
guint long_term_ref_pic_set_size;
};
struct _GstH265PicTiming