mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-10 03:19:40 +00:00
dpb: rename GstVaapiDpbMpeg2 to GstVaapiDpb2.
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>
This commit is contained in:
parent
86af31e426
commit
eafdd771ae
3 changed files with 49 additions and 49 deletions
|
@ -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;
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in a new issue