h265parser: Calculate short term RPS size in slice header

The calculated size of short_term_ref_pic_set is not a part of
HEVC syntax but the value is used by some stateless decoders
(e.g., vaapi, dxva, vdpau and nvdec) for the purpose of skipping
parsing the syntax by the accelerator.
This commit is contained in:
Seungha Yang 2019-09-20 20:14:57 +09:00 committed by Nicolas Dufresne
parent 29d4db0f8f
commit 6f2ab31d10
2 changed files with 8 additions and 0 deletions

View file

@ -2271,10 +2271,13 @@ gst_h265_parser_parse_slice_hdr (GstH265Parser * parser,
READ_UINT8 (&nr, slice->short_term_ref_pic_set_sps_flag, 1);
if (!slice->short_term_ref_pic_set_sps_flag) {
guint pos = nal_reader_get_pos (&nr);
if (!gst_h265_parser_parse_short_term_ref_pic_sets
(&slice->short_term_ref_pic_sets, &nr,
sps->num_short_term_ref_pic_sets, sps))
goto error;
slice->short_term_ref_pic_set_size = nal_reader_get_pos (&nr) - pos;
} else if (sps->num_short_term_ref_pic_sets > 1) {
const guint n = ceil_log2 (sps->num_short_term_ref_pic_sets);
READ_UINT8 (&nr, slice->short_term_ref_pic_set_idx, n);

View file

@ -1189,6 +1189,8 @@ struct _GstH265PredWeightTable
* @header_size: the calculated size of the slice_header() in bits.
* @n_emulation_prevention_bytes: number of emulation prevention bytes (EPB)
* in this slice_header()
* @short_term_ref_pic_set_size: the calculated size of short_term_ref_pic_set()
* in bits. (Since: 1.18)
*/
struct _GstH265SliceHdr
{
@ -1260,6 +1262,9 @@ struct _GstH265SliceHdr
guint header_size;
/* Number of emulation prevention bytes (EPB) in this slice_header() */
guint n_emulation_prevention_bytes;
/* Size of short_term_ref_pic_set() in bits */
guint short_term_ref_pic_set_size;
};
struct _GstH265PicTiming