codecs: h264decoder: Rename DPB methods
authorSeungha Yang <seungha@centricular.com>
Wed, 4 Nov 2020 19:16:54 +0000 (04:16 +0900)
committerGStreamer Merge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Fri, 13 Nov 2020 15:25:42 +0000 (15:25 +0000)
Clarify wheter it's for picture(field) or frame in order to
support interlaced stream, because DPB size is frame unit, not picture
in case of interlaced stream.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1534>

gst-libs/gst/codecs/gsth264decoder.c
gst-libs/gst/codecs/gsth264picture.c
gst-libs/gst/codecs/gsth264picture.h

index 315d7c9..197e4d1 100644 (file)
@@ -1424,7 +1424,7 @@ gst_h264_decoder_sliding_window_picture_marking (GstH264Decoder * self)
   }
 
   /* 8.2.5.3. Ensure the DPB doesn't overflow by discarding the oldest picture */
-  num_ref_pics = gst_h264_dpb_num_ref_pictures (priv->dpb);
+  num_ref_pics = gst_h264_dpb_num_ref_frames (priv->dpb);
   max_num_ref_frames = MAX (1, sps->num_ref_frames);
 
   if (num_ref_pics < max_num_ref_frames)
@@ -1569,11 +1569,11 @@ gst_h264_decoder_update_max_num_reorder_frames (GstH264Decoder * self,
       && sps->vui_parameters.bitstream_restriction_flag) {
     priv->max_num_reorder_frames = sps->vui_parameters.num_reorder_frames;
     if (priv->max_num_reorder_frames >
-        gst_h264_dpb_get_max_num_pics (priv->dpb)) {
+        gst_h264_dpb_get_max_num_frames (priv->dpb)) {
       GST_WARNING
           ("max_num_reorder_frames present, but larger than MaxDpbFrames (%d > %d)",
           (gint) priv->max_num_reorder_frames,
-          gst_h264_dpb_get_max_num_pics (priv->dpb));
+          gst_h264_dpb_get_max_num_frames (priv->dpb));
 
       priv->max_num_reorder_frames = 0;
       return FALSE;
@@ -1596,11 +1596,11 @@ gst_h264_decoder_update_max_num_reorder_frames (GstH264Decoder * self,
         break;
       default:
         priv->max_num_reorder_frames =
-            gst_h264_dpb_get_max_num_pics (priv->dpb);
+            gst_h264_dpb_get_max_num_frames (priv->dpb);
         break;
     }
   } else {
-    priv->max_num_reorder_frames = gst_h264_dpb_get_max_num_pics (priv->dpb);
+    priv->max_num_reorder_frames = gst_h264_dpb_get_max_num_frames (priv->dpb);
   }
 
   return TRUE;
@@ -1781,7 +1781,7 @@ gst_h264_decoder_process_sps (GstH264Decoder * self, GstH264SPS * sps)
   /* 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);
+  prev_max_dpb_size = gst_h264_dpb_get_max_num_frames (priv->dpb);
   if (priv->width != sps->width || priv->height != sps->height ||
       prev_max_dpb_size != max_dpb_size) {
     GstH264DecoderClass *klass = GST_H264_DECODER_GET_CLASS (self);
@@ -1805,7 +1805,7 @@ gst_h264_decoder_process_sps (GstH264Decoder * self, GstH264SPS * sps)
     priv->height = sps->height;
 
     gst_h264_decoder_set_latency (self, sps, max_dpb_size);
-    gst_h264_dpb_set_max_num_pics (priv->dpb, max_dpb_size);
+    gst_h264_dpb_set_max_num_frames (priv->dpb, max_dpb_size);
   }
 
   return gst_h264_decoder_update_max_num_reorder_frames (self, sps);
index 346582c..a1123d9 100644 (file)
@@ -106,7 +106,7 @@ gst_h264_picture_get_user_data (GstH264Picture * picture)
 struct _GstH264Dpb
 {
   GArray *pic_list;
-  gint max_num_pics;
+  gint max_num_frames;
   gint num_output_needed;
   gint32 last_output_poc;
 };
@@ -143,32 +143,36 @@ gst_h264_dpb_new (void)
 }
 
 /**
- * gst_h264_dpb_set_max_num_pics:
+ * gst_h264_dpb_set_max_num_frames:
  * @dpb: a #GstH264Dpb
- * @max_num_pics: the maximum number of picture
+ * @max_num_frames: the maximum number of picture
  *
- * Set the number of maximum allowed pictures to store
+ * Set the number of maximum allowed frames to store
+ *
+ * Since: 1.20
  */
 void
-gst_h264_dpb_set_max_num_pics (GstH264Dpb * dpb, gint max_num_pics)
+gst_h264_dpb_set_max_num_frames (GstH264Dpb * dpb, gint max_num_frames)
 {
   g_return_if_fail (dpb != NULL);
 
-  dpb->max_num_pics = max_num_pics;
+  dpb->max_num_frames = max_num_frames;
 }
 
 /**
- * gst_h264_dpb_get_max_num_pics:
+ * gst_h264_dpb_get_max_num_frames:
  * @dpb: a #GstH264Dpb
  *
- * Returns: the number of maximum pictures
+ * Returns: the number of maximum frames
+ *
+ * Since: 1.20
  */
 gint
-gst_h264_dpb_get_max_num_pics (GstH264Dpb * dpb)
+gst_h264_dpb_get_max_num_frames (GstH264Dpb * dpb)
 {
   g_return_val_if_fail (dpb != NULL, 0);
 
-  return dpb->max_num_pics;
+  return dpb->max_num_frames;
 }
 
 /**
@@ -258,13 +262,15 @@ gst_h264_dpb_delete_unused (GstH264Dpb * dpb)
 }
 
 /**
- * gst_h264_dpb_num_ref_pictures:
+ * gst_h264_dpb_num_ref_frames:
  * @dpb: a #GstH264Dpb
  *
- * Returns: The number of referenced pictures
+ * Returns: The number of referenced frames
+ *
+ * Since: 1.20
  */
 gint
-gst_h264_dpb_num_ref_pictures (GstH264Dpb * dpb)
+gst_h264_dpb_num_ref_frames (GstH264Dpb * dpb)
 {
   gint i;
   gint ret = 0;
@@ -516,7 +522,7 @@ gst_h264_dpb_get_picture (GstH264Dpb * dpb, guint32 system_frame_number)
 static gboolean
 gst_h264_dpb_has_empty_frame_buffer (GstH264Dpb * dpb)
 {
-  if (dpb->pic_list->len <= dpb->max_num_pics)
+  if (dpb->pic_list->len <= dpb->max_num_frames)
     return TRUE;
 
   return FALSE;
index f439e41..cbc17d3 100644 (file)
@@ -197,11 +197,11 @@ GST_CODECS_API
 GstH264Dpb * gst_h264_dpb_new (void);
 
 GST_CODECS_API
-void  gst_h264_dpb_set_max_num_pics (GstH264Dpb * dpb,
-                                     gint max_num_pics);
+void  gst_h264_dpb_set_max_num_frames (GstH264Dpb * dpb,
+                                       gint max_num_frames);
 
 GST_CODECS_API
-gint gst_h264_dpb_get_max_num_pics  (GstH264Dpb * dpb);
+gint gst_h264_dpb_get_max_num_frames  (GstH264Dpb * dpb);
 
 GST_CODECS_API
 void  gst_h264_dpb_free             (GstH264Dpb * dpb);
@@ -217,7 +217,7 @@ GST_CODECS_API
 void  gst_h264_dpb_delete_unused    (GstH264Dpb * dpb);
 
 GST_CODECS_API
-gint  gst_h264_dpb_num_ref_pictures (GstH264Dpb * dpb);
+gint  gst_h264_dpb_num_ref_frames (GstH264Dpb * dpb);
 
 GST_CODECS_API
 void  gst_h264_dpb_mark_all_non_ref (GstH264Dpb * dpb);