dpb: rename GstVaapiDpbMpeg2 to GstVaapiDpb2.
authorSreerenj Balachandran <sreerenj.balachandran@intel.com>
Thu, 2 Aug 2012 12:56:54 +0000 (15:56 +0300)
committerGwenole Beauchesne <gwenole.beauchesne@intel.com>
Mon, 14 Jan 2013 09:11:21 +0000 (10:11 +0100)
Move GstVaapiDpbMpeg2 API to a more generic version that could also be
useful to other decoders that require 2 reference pictures, e.g. VC-1.

Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
gst-libs/gst/vaapi/gstvaapidecoder_dpb.c
gst-libs/gst/vaapi/gstvaapidecoder_dpb.h
gst-libs/gst/vaapi/gstvaapidecoder_mpeg2.c

index c5a5a76..b674998 100644 (file)
@@ -247,21 +247,21 @@ gst_vaapi_dpb_size(GstVaapiDpb *dpb)
 }
 
 /* ------------------------------------------------------------------------- */
-/* --- MPEG-2 Decoded Picture Buffer                                     --- */
+/* --- Decoded Picture Buffer (optimized for 2 reference pictures)       --- */
 /* ------------------------------------------------------------------------- */
 
-/* At most two reference pictures for MPEG-2 */
-#define MAX_MPEG2_REFERENCES 2
+/* At most two reference pictures for DPB2*/
+#define MAX_DPB2_REFERENCES 2
 
-G_DEFINE_TYPE(GstVaapiDpbMpeg2, gst_vaapi_dpb_mpeg2, GST_VAAPI_TYPE_DPB)
+G_DEFINE_TYPE(GstVaapiDpb2, gst_vaapi_dpb2, GST_VAAPI_TYPE_DPB)
 
 static gboolean
-gst_vaapi_dpb_mpeg2_add(GstVaapiDpb *dpb, GstVaapiPicture *picture)
+gst_vaapi_dpb2_add(GstVaapiDpb *dpb, GstVaapiPicture *picture)
 {
     GstVaapiPicture *ref_picture;
     gint index = -1;
 
-    g_return_val_if_fail(GST_VAAPI_IS_DPB_MPEG2(dpb), FALSE);
+    g_return_val_if_fail(GST_VAAPI_IS_DPB2(dpb), FALSE);
 
     /*
      * Purpose: only store reference decoded pictures into the DPB
@@ -271,7 +271,7 @@ gst_vaapi_dpb_mpeg2_add(GstVaapiDpb *dpb, GstVaapiPicture *picture)
      * - ... thus causing older reference pictures to be output, if not already
      * - the oldest reference picture is replaced with the new reference picture
      */
-    if (G_LIKELY(dpb->num_pictures == MAX_MPEG2_REFERENCES)) {
+    if (G_LIKELY(dpb->num_pictures == MAX_DPB2_REFERENCES)) {
         index = (dpb->pictures[0]->poc > dpb->pictures[1]->poc);
         ref_picture = dpb->pictures[index];
         if (!GST_VAAPI_PICTURE_IS_OUTPUT(ref_picture)) {
@@ -290,37 +290,37 @@ gst_vaapi_dpb_mpeg2_add(GstVaapiDpb *dpb, GstVaapiPicture *picture)
 }
 
 static void
-gst_vaapi_dpb_mpeg2_init(GstVaapiDpbMpeg2 *dpb)
+gst_vaapi_dpb2_init(GstVaapiDpb2 *dpb)
 {
 }
 
 static void
-gst_vaapi_dpb_mpeg2_class_init(GstVaapiDpbMpeg2Class *klass)
+gst_vaapi_dpb2_class_init(GstVaapiDpb2Class *klass)
 {
     GstVaapiDpbClass * const dpb_class = GST_VAAPI_DPB_CLASS(klass);
 
-    dpb_class->add = gst_vaapi_dpb_mpeg2_add;
+    dpb_class->add = gst_vaapi_dpb2_add;
 }
 
 GstVaapiDpb *
-gst_vaapi_dpb_mpeg2_new(void)
+gst_vaapi_dpb2_new(void)
 {
-    return dpb_new(GST_VAAPI_TYPE_DPB_MPEG2, MAX_MPEG2_REFERENCES);
+    return dpb_new(GST_VAAPI_TYPE_DPB2, MAX_DPB2_REFERENCES);
 }
 
 void
-gst_vaapi_dpb_mpeg2_get_references(
+gst_vaapi_dpb2_get_references(
     GstVaapiDpb        *dpb,
     GstVaapiPicture    *picture,
     GstVaapiPicture   **prev_picture_ptr,
     GstVaapiPicture   **next_picture_ptr
 )
 {
-    GstVaapiPicture *ref_picture, *ref_pictures[MAX_MPEG2_REFERENCES];
+    GstVaapiPicture *ref_picture, *ref_pictures[MAX_DPB2_REFERENCES];
     GstVaapiPicture **picture_ptr;
     guint i, index;
 
-    g_return_if_fail(GST_VAAPI_IS_DPB_MPEG2(dpb));
+    g_return_if_fail(GST_VAAPI_IS_DPB2(dpb));
     g_return_if_fail(GST_VAAPI_IS_PICTURE(picture));
 
     ref_pictures[0] = NULL;
index 3cbaa48..e0ba009 100644 (file)
@@ -28,8 +28,8 @@ G_BEGIN_DECLS
 
 typedef struct _GstVaapiDpb             GstVaapiDpb;
 typedef struct _GstVaapiDpbClass        GstVaapiDpbClass;
-typedef struct _GstVaapiDpbMpeg2        GstVaapiDpbMpeg2;
-typedef struct _GstVaapiDpbMpeg2Class   GstVaapiDpbMpeg2Class;
+typedef struct _GstVaapiDpb2            GstVaapiDpb2;
+typedef struct _GstVaapiDpb2Class       GstVaapiDpb2Class;
 
 /* ------------------------------------------------------------------------- */
 /* --- Base Decoded Picture Buffer                                       --- */
@@ -120,67 +120,67 @@ gst_vaapi_dpb_unref(gpointer ptr)
 }
 
 /* ------------------------------------------------------------------------- */
-/* --- MPEG-2 Decoded Picture Buffer                                     --- */
+/* --- Decoded Picture Buffer (optimized for 2 reference pictures)       --- */
 /* ------------------------------------------------------------------------- */
 
-#define GST_VAAPI_TYPE_DPB_MPEG2 \
-    (gst_vaapi_dpb_mpeg2_get_type())
+#define GST_VAAPI_TYPE_DPB2 \
+    (gst_vaapi_dpb2_get_type())
 
-#define GST_VAAPI_DPB_MPEG2_CAST(obj) \
-    ((GstVaapiDpbMpeg2 *)(obj))
+#define GST_VAAPI_DPB2_CAST(obj) \
+    ((GstVaapiDpb2 *)(obj))
 
-#define GST_VAAPI_DPB_MPEG2(obj)                                \
-    (G_TYPE_CHECK_INSTANCE_CAST((obj),                          \
-                                GST_VAAPI_TYPE_DPB_MPEG2,       \
-                                GstVaapiDpbMpeg2))
+#define GST_VAAPI_DPB2(obj)                             \
+    (G_TYPE_CHECK_INSTANCE_CAST((obj),                  \
+                                GST_VAAPI_TYPE_DPB2,    \
+                                GstVaapiDpb2))
 
-#define GST_VAAPI_DPB_MPEG2_CLASS(klass)                        \
-    (G_TYPE_CHECK_CLASS_CAST((klass),                           \
-                             GST_VAAPI_TYPE_DPB_MPEG2,          \
-                             GstVaapiDpbMpeg2Class))
+#define GST_VAAPI_DPB2_CLASS(klass)                     \
+    (G_TYPE_CHECK_CLASS_CAST((klass),                   \
+                             GST_VAAPI_TYPE_DPB2,       \
+                             GstVaapiDpb2Class))
 
-#define GST_VAAPI_IS_DPB_MPEG2(obj) \
-    (G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_VAAPI_TYPE_DPB_MPEG2))
+#define GST_VAAPI_IS_DPB2(obj) \
+    (G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_VAAPI_TYPE_DPB2))
 
-#define GST_VAAPI_IS_DPB_MPEG2_CLASS(klass) \
-    (G_TYPE_CHECK_CLASS_TYPE((klass), GST_VAAPI_TYPE_DPB_MPEG2))
+#define GST_VAAPI_IS_DPB2_CLASS(klass) \
+    (G_TYPE_CHECK_CLASS_TYPE((klass), GST_VAAPI_TYPE_DPB2))
 
-#define GST_VAAPI_DPB_MPEG2_GET_CLASS(obj)                      \
-    (G_TYPE_INSTANCE_GET_CLASS((obj),                           \
-                               GST_VAAPI_TYPE_DPB_MPEG2,        \
-                               GstVaapiDpbMpeg2Class))
+#define GST_VAAPI_DPB2_GET_CLASS(obj)                   \
+    (G_TYPE_INSTANCE_GET_CLASS((obj),                   \
+                               GST_VAAPI_TYPE_DPB2,     \
+                               GstVaapiDpb2Class))
 
 /**
- * GstVaapiDpbMpeg2:
+ * GstVaapiDpb2:
  *
- * A decoded picture buffer (DPB_MPEG2) object.
+ * A decoded picture buffer (DPB2) object.
  */
-struct _GstVaapiDpbMpeg2 {
+struct _GstVaapiDpb2 {
     /*< private >*/
     GstVaapiDpb         parent_instance;
 };
 
 /**
- * GstVaapiDpbMpeg2Class:
+ * GstVaapiDpb2Class:
  *
- * The #GstVaapiDpbMpeg2 base class.
+ * The #GstVaapiDpb2 base class.
  */
-struct _GstVaapiDpbMpeg2Class {
+struct _GstVaapiDpb2Class {
     /*< private >*/
     GstVaapiDpbClass    parent_class;
 };
 
 G_GNUC_INTERNAL
 GType
-gst_vaapi_dpb_mpeg2_get_type(void) G_GNUC_CONST;
+gst_vaapi_dpb2_get_type(void) G_GNUC_CONST;
 
 G_GNUC_INTERNAL
 GstVaapiDpb *
-gst_vaapi_dpb_mpeg2_new(void);
+gst_vaapi_dpb2_new(void);
 
 G_GNUC_INTERNAL
 void
-gst_vaapi_dpb_mpeg2_get_references(
+gst_vaapi_dpb2_get_references(
     GstVaapiDpb        *dpb,
     GstVaapiPicture    *picture,
     GstVaapiPicture   **prev_picture_ptr,
index cde9278..fcbee06 100644 (file)
@@ -386,7 +386,7 @@ gst_vaapi_decoder_mpeg2_open(GstVaapiDecoderMpeg2 *decoder)
 
     gst_vaapi_decoder_mpeg2_close(decoder);
 
-    priv->dpb = gst_vaapi_dpb_mpeg2_new();
+    priv->dpb = gst_vaapi_dpb2_new();
     if (!priv->dpb)
         return FALSE;
 
@@ -1044,7 +1044,7 @@ fill_picture(GstVaapiDecoderMpeg2 *decoder, GstVaapiPicture *picture)
     COPY_FIELD(picture_coding_extension, bits, repeat_first_field);
     COPY_FIELD(picture_coding_extension, bits, progressive_frame);
 
-    gst_vaapi_dpb_mpeg2_get_references(priv->dpb, picture,
+    gst_vaapi_dpb2_get_references(priv->dpb, picture,
         &prev_picture, &next_picture);
 
     switch (pic_hdr->pic_type) {