2012-01-26 08:48:11 +00:00
|
|
|
/*
|
|
|
|
* gstvaapidecoder_objects.h - VA decoder objects
|
|
|
|
*
|
|
|
|
* Copyright (C) 2010-2011 Splitted-Desktop Systems
|
2013-01-29 13:14:45 +00:00
|
|
|
* Copyright (C) 2011-2013 Intel Corporation
|
2012-01-26 08:48:11 +00:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2.1
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free
|
|
|
|
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
|
|
|
* Boston, MA 02110-1301 USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef GST_VAAPI_DECODER_OBJECTS_H
|
|
|
|
#define GST_VAAPI_DECODER_OBJECTS_H
|
|
|
|
|
|
|
|
#include <gst/vaapi/gstvaapicodec_objects.h>
|
|
|
|
|
|
|
|
G_BEGIN_DECLS
|
|
|
|
|
|
|
|
typedef struct _GstVaapiPicture GstVaapiPicture;
|
|
|
|
typedef struct _GstVaapiSlice GstVaapiSlice;
|
|
|
|
|
|
|
|
/* ------------------------------------------------------------------------- */
|
|
|
|
/* --- Pictures --- */
|
|
|
|
/* ------------------------------------------------------------------------- */
|
|
|
|
|
|
|
|
#define GST_VAAPI_PICTURE_CAST(obj) \
|
|
|
|
((GstVaapiPicture *)(obj))
|
|
|
|
|
2012-12-03 10:19:08 +00:00
|
|
|
#define GST_VAAPI_PICTURE(obj) \
|
|
|
|
GST_VAAPI_PICTURE_CAST(obj)
|
2012-01-26 08:48:11 +00:00
|
|
|
|
|
|
|
#define GST_VAAPI_IS_PICTURE(obj) \
|
2012-12-03 10:19:08 +00:00
|
|
|
(GST_VAAPI_PICTURE(obj) != NULL)
|
2012-01-26 08:48:11 +00:00
|
|
|
|
2012-09-04 11:40:04 +00:00
|
|
|
typedef enum {
|
2012-01-26 08:48:11 +00:00
|
|
|
GST_VAAPI_PICTURE_TYPE_NONE = 0, // Undefined
|
|
|
|
GST_VAAPI_PICTURE_TYPE_I, // Intra
|
|
|
|
GST_VAAPI_PICTURE_TYPE_P, // Predicted
|
|
|
|
GST_VAAPI_PICTURE_TYPE_B, // Bi-directional predicted
|
|
|
|
GST_VAAPI_PICTURE_TYPE_S, // S(GMC)-VOP (MPEG-4)
|
|
|
|
GST_VAAPI_PICTURE_TYPE_SI, // Switching Intra
|
|
|
|
GST_VAAPI_PICTURE_TYPE_SP, // Switching Predicted
|
|
|
|
GST_VAAPI_PICTURE_TYPE_BI, // BI type (VC-1)
|
2012-09-04 11:40:04 +00:00
|
|
|
} GstVaapiPictureType;
|
2012-01-26 08:48:11 +00:00
|
|
|
|
|
|
|
/**
|
2013-01-14 10:48:58 +00:00
|
|
|
* GstVaapiPictureFlags:
|
2012-01-26 08:48:11 +00:00
|
|
|
* @GST_VAAPI_PICTURE_FLAG_SKIPPED: skipped frame
|
|
|
|
* @GST_VAAPI_PICTURE_FLAG_REFERENCE: reference frame
|
2012-03-28 12:28:26 +00:00
|
|
|
* @GST_VAAPI_PICTURE_FLAG_OUTPUT: frame was output
|
2012-03-28 14:07:44 +00:00
|
|
|
* @GST_VAAPI_PICTURE_FLAG_INTERLACED: interlaced frame
|
2012-03-28 15:50:28 +00:00
|
|
|
* @GST_VAAPI_PICTURE_FLAG_FF: first-field
|
2012-03-28 14:07:44 +00:00
|
|
|
* @GST_VAAPI_PICTURE_FLAG_TFF: top-field-first
|
2012-01-26 08:48:11 +00:00
|
|
|
* @GST_VAAPI_PICTURE_FLAG_LAST: first flag that can be used by subclasses
|
|
|
|
*
|
|
|
|
* Enum values used for #GstVaapiPicture flags.
|
|
|
|
*/
|
2013-01-14 10:48:58 +00:00
|
|
|
typedef enum {
|
2012-03-28 14:07:44 +00:00
|
|
|
GST_VAAPI_PICTURE_FLAG_SKIPPED = (GST_VAAPI_CODEC_OBJECT_FLAG_LAST << 0),
|
|
|
|
GST_VAAPI_PICTURE_FLAG_REFERENCE = (GST_VAAPI_CODEC_OBJECT_FLAG_LAST << 1),
|
|
|
|
GST_VAAPI_PICTURE_FLAG_OUTPUT = (GST_VAAPI_CODEC_OBJECT_FLAG_LAST << 2),
|
|
|
|
GST_VAAPI_PICTURE_FLAG_INTERLACED = (GST_VAAPI_CODEC_OBJECT_FLAG_LAST << 3),
|
2012-03-28 15:50:28 +00:00
|
|
|
GST_VAAPI_PICTURE_FLAG_FF = (GST_VAAPI_CODEC_OBJECT_FLAG_LAST << 4),
|
2012-03-28 14:07:44 +00:00
|
|
|
GST_VAAPI_PICTURE_FLAG_TFF = (GST_VAAPI_CODEC_OBJECT_FLAG_LAST << 5),
|
|
|
|
GST_VAAPI_PICTURE_FLAG_LAST = (GST_VAAPI_CODEC_OBJECT_FLAG_LAST << 6),
|
2013-01-14 10:48:58 +00:00
|
|
|
} GstVaapiPictureFlags;
|
2012-01-26 08:48:11 +00:00
|
|
|
|
2012-12-03 10:19:08 +00:00
|
|
|
#define GST_VAAPI_PICTURE_FLAGS GST_VAAPI_MINI_OBJECT_FLAGS
|
|
|
|
#define GST_VAAPI_PICTURE_FLAG_IS_SET GST_VAAPI_MINI_OBJECT_FLAG_IS_SET
|
|
|
|
#define GST_VAAPI_PICTURE_FLAG_SET GST_VAAPI_MINI_OBJECT_FLAG_SET
|
|
|
|
#define GST_VAAPI_PICTURE_FLAG_UNSET GST_VAAPI_MINI_OBJECT_FLAG_UNSET
|
2012-01-26 08:48:11 +00:00
|
|
|
|
2012-03-28 12:24:40 +00:00
|
|
|
#define GST_VAAPI_PICTURE_IS_SKIPPED(picture) \
|
|
|
|
GST_VAAPI_PICTURE_FLAG_IS_SET(picture, GST_VAAPI_PICTURE_FLAG_SKIPPED)
|
|
|
|
|
2012-01-26 08:48:11 +00:00
|
|
|
#define GST_VAAPI_PICTURE_IS_REFERENCE(picture) \
|
|
|
|
GST_VAAPI_PICTURE_FLAG_IS_SET(picture, GST_VAAPI_PICTURE_FLAG_REFERENCE)
|
|
|
|
|
2012-03-28 12:28:26 +00:00
|
|
|
#define GST_VAAPI_PICTURE_IS_OUTPUT(picture) \
|
|
|
|
GST_VAAPI_PICTURE_FLAG_IS_SET(picture, GST_VAAPI_PICTURE_FLAG_OUTPUT)
|
|
|
|
|
2012-03-28 14:07:44 +00:00
|
|
|
#define GST_VAAPI_PICTURE_IS_INTERLACED(picture) \
|
|
|
|
GST_VAAPI_PICTURE_FLAG_IS_SET(picture, GST_VAAPI_PICTURE_FLAG_INTERLACED)
|
2012-02-23 15:23:27 +00:00
|
|
|
|
2012-03-28 15:50:28 +00:00
|
|
|
#define GST_VAAPI_PICTURE_IS_FIRST_FIELD(picture) \
|
|
|
|
GST_VAAPI_PICTURE_FLAG_IS_SET(picture, GST_VAAPI_PICTURE_FLAG_FF)
|
|
|
|
|
2012-03-28 14:07:44 +00:00
|
|
|
#define GST_VAAPI_PICTURE_IS_TFF(picture) \
|
|
|
|
GST_VAAPI_PICTURE_FLAG_IS_SET(picture, GST_VAAPI_PICTURE_FLAG_TFF)
|
2012-02-23 15:23:27 +00:00
|
|
|
|
2012-03-28 14:08:29 +00:00
|
|
|
#define GST_VAAPI_PICTURE_IS_FRAME(picture) \
|
|
|
|
(GST_VAAPI_PICTURE(picture)->structure == GST_VAAPI_PICTURE_STRUCTURE_FRAME)
|
|
|
|
|
|
|
|
#define GST_VAAPI_PICTURE_IS_COMPLETE(picture) \
|
|
|
|
(GST_VAAPI_PICTURE_IS_FRAME(picture) || \
|
|
|
|
!GST_VAAPI_PICTURE_IS_FIRST_FIELD(picture))
|
|
|
|
|
2012-01-26 08:48:11 +00:00
|
|
|
/**
|
|
|
|
* GstVaapiPicture:
|
|
|
|
*
|
|
|
|
* A #GstVaapiCodecObject holding a picture parameter.
|
|
|
|
*/
|
|
|
|
struct _GstVaapiPicture {
|
|
|
|
/*< private >*/
|
|
|
|
GstVaapiCodecObject parent_instance;
|
2013-06-11 13:11:34 +00:00
|
|
|
GstVaapiPicture *parent_picture;
|
2012-12-13 14:34:10 +00:00
|
|
|
GstVideoCodecFrame *frame;
|
2012-01-26 08:48:11 +00:00
|
|
|
GstVaapiSurface *surface;
|
2012-01-26 14:28:42 +00:00
|
|
|
GstVaapiSurfaceProxy *proxy;
|
2012-01-26 08:48:11 +00:00
|
|
|
VABufferID param_id;
|
2012-03-28 14:05:58 +00:00
|
|
|
guint param_size;
|
2012-01-26 08:48:11 +00:00
|
|
|
|
|
|
|
/*< public >*/
|
|
|
|
GstVaapiPictureType type;
|
|
|
|
VASurfaceID surface_id;
|
|
|
|
gpointer param;
|
|
|
|
GPtrArray *slices;
|
|
|
|
GstVaapiIqMatrix *iq_matrix;
|
2012-02-09 16:21:04 +00:00
|
|
|
GstVaapiHuffmanTable *huf_table;
|
2012-01-26 08:48:11 +00:00
|
|
|
GstVaapiBitPlane *bitplane;
|
|
|
|
GstClockTime pts;
|
2012-03-30 15:03:28 +00:00
|
|
|
gint32 poc;
|
2012-03-28 14:07:44 +00:00
|
|
|
guint structure;
|
2013-02-15 16:42:12 +00:00
|
|
|
GstVaapiRectangle crop_rect;
|
|
|
|
guint has_crop_rect : 1;
|
2012-01-26 08:48:11 +00:00
|
|
|
};
|
|
|
|
|
2012-12-03 10:19:08 +00:00
|
|
|
G_GNUC_INTERNAL
|
|
|
|
void
|
|
|
|
gst_vaapi_picture_destroy(GstVaapiPicture *picture);
|
2012-01-26 08:48:11 +00:00
|
|
|
|
2012-07-19 15:55:00 +00:00
|
|
|
G_GNUC_INTERNAL
|
2012-12-03 10:19:08 +00:00
|
|
|
gboolean
|
|
|
|
gst_vaapi_picture_create(GstVaapiPicture *picture,
|
|
|
|
const GstVaapiCodecObjectConstructorArgs *args);
|
2012-01-26 08:48:11 +00:00
|
|
|
|
2012-07-19 15:55:00 +00:00
|
|
|
G_GNUC_INTERNAL
|
2012-01-26 08:48:11 +00:00
|
|
|
GstVaapiPicture *
|
|
|
|
gst_vaapi_picture_new(
|
|
|
|
GstVaapiDecoder *decoder,
|
|
|
|
gconstpointer param,
|
|
|
|
guint param_size
|
2012-07-19 15:55:00 +00:00
|
|
|
);
|
2012-01-26 08:48:11 +00:00
|
|
|
|
2012-07-19 15:55:00 +00:00
|
|
|
G_GNUC_INTERNAL
|
2012-03-28 14:05:58 +00:00
|
|
|
GstVaapiPicture *
|
2012-07-19 15:55:00 +00:00
|
|
|
gst_vaapi_picture_new_field(GstVaapiPicture *picture);
|
2012-03-28 14:05:58 +00:00
|
|
|
|
2012-07-19 15:55:00 +00:00
|
|
|
G_GNUC_INTERNAL
|
2012-01-26 08:48:11 +00:00
|
|
|
void
|
2012-07-19 15:55:00 +00:00
|
|
|
gst_vaapi_picture_add_slice(GstVaapiPicture *picture, GstVaapiSlice *slice);
|
2012-01-26 08:48:11 +00:00
|
|
|
|
2012-07-19 15:55:00 +00:00
|
|
|
G_GNUC_INTERNAL
|
2012-01-26 08:48:11 +00:00
|
|
|
gboolean
|
2012-07-19 15:55:00 +00:00
|
|
|
gst_vaapi_picture_decode(GstVaapiPicture *picture);
|
2012-01-26 08:48:11 +00:00
|
|
|
|
2012-07-19 15:55:00 +00:00
|
|
|
G_GNUC_INTERNAL
|
2012-01-26 08:48:11 +00:00
|
|
|
gboolean
|
2012-07-19 15:55:00 +00:00
|
|
|
gst_vaapi_picture_output(GstVaapiPicture *picture);
|
2012-01-26 08:48:11 +00:00
|
|
|
|
2013-02-15 16:42:12 +00:00
|
|
|
G_GNUC_INTERNAL
|
|
|
|
void
|
|
|
|
gst_vaapi_picture_set_crop_rect(GstVaapiPicture *picture,
|
|
|
|
const GstVaapiRectangle *crop_rect);
|
|
|
|
|
2012-01-26 08:48:11 +00:00
|
|
|
static inline gpointer
|
|
|
|
gst_vaapi_picture_ref(gpointer ptr)
|
|
|
|
{
|
2012-12-03 10:19:08 +00:00
|
|
|
return gst_vaapi_mini_object_ref(GST_VAAPI_MINI_OBJECT(ptr));
|
2012-01-26 08:48:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline void
|
|
|
|
gst_vaapi_picture_unref(gpointer ptr)
|
|
|
|
{
|
2012-12-03 10:19:08 +00:00
|
|
|
gst_vaapi_mini_object_unref(GST_VAAPI_MINI_OBJECT(ptr));
|
2012-01-26 08:48:11 +00:00
|
|
|
}
|
|
|
|
|
2012-12-03 10:19:08 +00:00
|
|
|
#define gst_vaapi_picture_replace(old_picture_p, new_picture) \
|
|
|
|
gst_vaapi_mini_object_replace((GstVaapiMiniObject **)(old_picture_p), \
|
|
|
|
(GstVaapiMiniObject *)(new_picture))
|
2012-01-26 08:48:11 +00:00
|
|
|
|
|
|
|
/* ------------------------------------------------------------------------- */
|
|
|
|
/* --- Slices --- */
|
|
|
|
/* ------------------------------------------------------------------------- */
|
|
|
|
|
|
|
|
#define GST_VAAPI_SLICE_CAST(obj) \
|
|
|
|
((GstVaapiSlice *)(obj))
|
|
|
|
|
2012-12-03 10:19:08 +00:00
|
|
|
#define GST_VAAPI_SLICE(obj) \
|
|
|
|
GST_VAAPI_SLICE_CAST(obj)
|
2012-01-26 08:48:11 +00:00
|
|
|
|
|
|
|
#define GST_VAAPI_IS_SLICE(obj) \
|
2012-12-03 10:19:08 +00:00
|
|
|
(GST_VAAPI_SLICE(obj) != NULL)
|
2012-01-26 08:48:11 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* GstVaapiSlice:
|
|
|
|
*
|
|
|
|
* A #GstVaapiCodecObject holding a slice parameter.
|
|
|
|
*/
|
|
|
|
struct _GstVaapiSlice {
|
|
|
|
/*< private >*/
|
|
|
|
GstVaapiCodecObject parent_instance;
|
|
|
|
|
|
|
|
/*< public >*/
|
|
|
|
VABufferID param_id;
|
|
|
|
VABufferID data_id;
|
|
|
|
gpointer param;
|
2013-09-23 14:49:41 +00:00
|
|
|
|
|
|
|
/* Per-slice overrides */
|
|
|
|
GstVaapiHuffmanTable *huf_table;
|
2012-01-26 08:48:11 +00:00
|
|
|
};
|
|
|
|
|
2012-12-03 10:19:08 +00:00
|
|
|
G_GNUC_INTERNAL
|
|
|
|
void
|
|
|
|
gst_vaapi_slice_destroy(GstVaapiSlice *slice);
|
2012-01-26 08:48:11 +00:00
|
|
|
|
2012-07-19 15:55:00 +00:00
|
|
|
G_GNUC_INTERNAL
|
2012-12-03 10:19:08 +00:00
|
|
|
gboolean
|
|
|
|
gst_vaapi_slice_create(GstVaapiSlice *slice,
|
|
|
|
const GstVaapiCodecObjectConstructorArgs *args);
|
2012-01-26 08:48:11 +00:00
|
|
|
|
2012-07-19 15:55:00 +00:00
|
|
|
G_GNUC_INTERNAL
|
2012-01-26 08:48:11 +00:00
|
|
|
GstVaapiSlice *
|
|
|
|
gst_vaapi_slice_new(
|
|
|
|
GstVaapiDecoder *decoder,
|
|
|
|
gconstpointer param,
|
|
|
|
guint param_size,
|
|
|
|
const guchar *data,
|
|
|
|
guint data_size
|
2012-07-19 15:55:00 +00:00
|
|
|
);
|
2012-01-26 08:48:11 +00:00
|
|
|
|
|
|
|
/* ------------------------------------------------------------------------- */
|
|
|
|
/* --- Helpers to create codec-dependent objects --- */
|
|
|
|
/* ------------------------------------------------------------------------- */
|
|
|
|
|
|
|
|
#define GST_VAAPI_PICTURE_NEW(codec, decoder) \
|
|
|
|
gst_vaapi_picture_new(GST_VAAPI_DECODER_CAST(decoder), \
|
|
|
|
NULL, sizeof(VAPictureParameterBuffer##codec))
|
|
|
|
|
|
|
|
#define GST_VAAPI_SLICE_NEW(codec, decoder, buf, buf_size) \
|
|
|
|
gst_vaapi_slice_new(GST_VAAPI_DECODER_CAST(decoder), \
|
|
|
|
NULL, sizeof(VASliceParameterBuffer##codec), \
|
|
|
|
buf, buf_size)
|
|
|
|
|
|
|
|
G_END_DECLS
|
|
|
|
|
|
|
|
#endif /* GST_VAAPI_DECODER_OBJECTS_H */
|