mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 12:11:13 +00:00
codecs: h264: Fix DPB size calculation
As per specification in A.3.1 h) and A.3.2 f), the maximum size of the DPB is 16. Fix the maximum in the fine and fix the formula to use MIN instead of MAX so that we no longer always use the maximum for the profile/level.
This commit is contained in:
parent
00baed3ebe
commit
b79c949789
2 changed files with 6 additions and 2 deletions
|
@ -1684,9 +1684,12 @@ gst_h264_decoder_process_sps (GstH264Decoder * self, GstH264SPS * sps)
|
|||
max_dpb_frames = MIN (max_dpb_mbs / (width_mb * height_mb),
|
||||
GST_H264_DPB_MAX_SIZE);
|
||||
|
||||
max_dpb_size = MAX (max_dpb_frames,
|
||||
max_dpb_size = MIN (max_dpb_frames,
|
||||
MAX (sps->num_ref_frames, sps->vui_parameters.max_dec_frame_buffering));
|
||||
|
||||
/* Safety, so that subclass don't need bound checking */
|
||||
g_return_val_if_fail (max_dpb_size <= GST_H264_DPB_MAX_SIZE, FALSE);
|
||||
|
||||
prev_max_dpb_size = gst_h264_dpb_get_max_num_pics (priv->dpb);
|
||||
if (priv->width != sps->width || priv->height != sps->height ||
|
||||
prev_max_dpb_size != max_dpb_size) {
|
||||
|
|
|
@ -34,7 +34,8 @@ G_BEGIN_DECLS
|
|||
typedef struct _GstH264Slice GstH264Slice;
|
||||
typedef struct _GstH264Picture GstH264Picture;
|
||||
|
||||
#define GST_H264_DPB_MAX_SIZE 32
|
||||
/* As specified in A.3.1 h) and A.3.2 f) */
|
||||
#define GST_H264_DPB_MAX_SIZE 16
|
||||
|
||||
struct _GstH264Slice
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue