~ubuntu-branches/ubuntu/vivid/gstreamer-vaapi/vivid

« back to all changes in this revision

Viewing changes to gst-libs/gst/vaapi/gstvaapidecoder_objects.h

  • Committer: Package Import Robot
  • Author(s): Vincent Cheng
  • Date: 2014-08-06 23:56:00 UTC
  • mfrom: (0.1.4 sid) (1.1.3)
  • Revision ID: package-import@ubuntu.com-20140806235600-fg1kcmiu67k315q5
Tags: 0.5.9-2
* Remove spurious build-deps: libva-drm1, libavcodec-dev. (Closes: #757283)
* Drop Build-Depends-Indep and build docs unconditionally on all archs.

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
 *
4
4
 *  Copyright (C) 2010-2011 Splitted-Desktop Systems
5
5
 *    Author: Gwenole Beauchesne <gwenole.beauchesne@splitted-desktop.com>
6
 
 *  Copyright (C) 2011-2013 Intel Corporation
 
6
 *  Copyright (C) 2011-2014 Intel Corporation
7
7
 *    Author: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
8
8
 *
9
9
 *  This library is free software; you can redistribute it and/or
37
37
/* ------------------------------------------------------------------------- */
38
38
 
39
39
#define GST_VAAPI_PICTURE_CAST(obj) \
40
 
    ((GstVaapiPicture *)(obj))
 
40
  ((GstVaapiPicture *) (obj))
41
41
 
42
42
#define GST_VAAPI_PICTURE(obj) \
43
 
    GST_VAAPI_PICTURE_CAST(obj)
 
43
  GST_VAAPI_PICTURE_CAST (obj)
44
44
 
45
45
#define GST_VAAPI_IS_PICTURE(obj) \
46
 
    (GST_VAAPI_PICTURE(obj) != NULL)
 
46
  (GST_VAAPI_PICTURE (obj) != NULL)
47
47
 
48
 
typedef enum {
49
 
    GST_VAAPI_PICTURE_TYPE_NONE = 0,        // Undefined
50
 
    GST_VAAPI_PICTURE_TYPE_I,               // Intra
51
 
    GST_VAAPI_PICTURE_TYPE_P,               // Predicted
52
 
    GST_VAAPI_PICTURE_TYPE_B,               // Bi-directional predicted
53
 
    GST_VAAPI_PICTURE_TYPE_S,               // S(GMC)-VOP (MPEG-4)
54
 
    GST_VAAPI_PICTURE_TYPE_SI,              // Switching Intra
55
 
    GST_VAAPI_PICTURE_TYPE_SP,              // Switching Predicted
56
 
    GST_VAAPI_PICTURE_TYPE_BI,              // BI type (VC-1)
 
48
typedef enum
 
49
{
 
50
  GST_VAAPI_PICTURE_TYPE_NONE = 0,      // Undefined
 
51
  GST_VAAPI_PICTURE_TYPE_I,             // Intra
 
52
  GST_VAAPI_PICTURE_TYPE_P,             // Predicted
 
53
  GST_VAAPI_PICTURE_TYPE_B,             // Bi-directional predicted
 
54
  GST_VAAPI_PICTURE_TYPE_S,             // S(GMC)-VOP (MPEG-4)
 
55
  GST_VAAPI_PICTURE_TYPE_SI,            // Switching Intra
 
56
  GST_VAAPI_PICTURE_TYPE_SP,            // Switching Predicted
 
57
  GST_VAAPI_PICTURE_TYPE_BI,            // BI type (VC-1)
57
58
} GstVaapiPictureType;
58
59
 
59
60
/**
64
65
 * @GST_VAAPI_PICTURE_FLAG_INTERLACED: interlaced frame
65
66
 * @GST_VAAPI_PICTURE_FLAG_FF: first-field
66
67
 * @GST_VAAPI_PICTURE_FLAG_TFF: top-field-first
 
68
 * @GST_VAAPI_PICTURE_FLAG_ONEFIELD: only one field is valid
 
69
 * @GST_VAAPI_PICTURE_FLAG_MVC: multiview component
67
70
 * @GST_VAAPI_PICTURE_FLAG_LAST: first flag that can be used by subclasses
68
71
 *
69
72
 * Enum values used for #GstVaapiPicture flags.
70
73
 */
71
 
typedef enum {
72
 
    GST_VAAPI_PICTURE_FLAG_SKIPPED    = (GST_VAAPI_CODEC_OBJECT_FLAG_LAST << 0),
73
 
    GST_VAAPI_PICTURE_FLAG_REFERENCE  = (GST_VAAPI_CODEC_OBJECT_FLAG_LAST << 1),
74
 
    GST_VAAPI_PICTURE_FLAG_OUTPUT     = (GST_VAAPI_CODEC_OBJECT_FLAG_LAST << 2),
75
 
    GST_VAAPI_PICTURE_FLAG_INTERLACED = (GST_VAAPI_CODEC_OBJECT_FLAG_LAST << 3),
76
 
    GST_VAAPI_PICTURE_FLAG_FF         = (GST_VAAPI_CODEC_OBJECT_FLAG_LAST << 4),
77
 
    GST_VAAPI_PICTURE_FLAG_TFF        = (GST_VAAPI_CODEC_OBJECT_FLAG_LAST << 5),
78
 
    GST_VAAPI_PICTURE_FLAG_LAST       = (GST_VAAPI_CODEC_OBJECT_FLAG_LAST << 6),
 
74
typedef enum
 
75
{
 
76
  GST_VAAPI_PICTURE_FLAG_SKIPPED    = (GST_VAAPI_CODEC_OBJECT_FLAG_LAST << 0),
 
77
  GST_VAAPI_PICTURE_FLAG_REFERENCE  = (GST_VAAPI_CODEC_OBJECT_FLAG_LAST << 1),
 
78
  GST_VAAPI_PICTURE_FLAG_OUTPUT     = (GST_VAAPI_CODEC_OBJECT_FLAG_LAST << 2),
 
79
  GST_VAAPI_PICTURE_FLAG_INTERLACED = (GST_VAAPI_CODEC_OBJECT_FLAG_LAST << 3),
 
80
  GST_VAAPI_PICTURE_FLAG_FF         = (GST_VAAPI_CODEC_OBJECT_FLAG_LAST << 4),
 
81
  GST_VAAPI_PICTURE_FLAG_TFF        = (GST_VAAPI_CODEC_OBJECT_FLAG_LAST << 5),
 
82
  GST_VAAPI_PICTURE_FLAG_ONEFIELD   = (GST_VAAPI_CODEC_OBJECT_FLAG_LAST << 6),
 
83
  GST_VAAPI_PICTURE_FLAG_MVC        = (GST_VAAPI_CODEC_OBJECT_FLAG_LAST << 7),
 
84
  GST_VAAPI_PICTURE_FLAG_LAST       = (GST_VAAPI_CODEC_OBJECT_FLAG_LAST << 8),
79
85
} GstVaapiPictureFlags;
80
86
 
81
87
#define GST_VAAPI_PICTURE_FLAGS         GST_VAAPI_MINI_OBJECT_FLAGS
84
90
#define GST_VAAPI_PICTURE_FLAG_UNSET    GST_VAAPI_MINI_OBJECT_FLAG_UNSET
85
91
 
86
92
#define GST_VAAPI_PICTURE_IS_SKIPPED(picture) \
87
 
    GST_VAAPI_PICTURE_FLAG_IS_SET(picture, GST_VAAPI_PICTURE_FLAG_SKIPPED)
 
93
  GST_VAAPI_PICTURE_FLAG_IS_SET (picture, GST_VAAPI_PICTURE_FLAG_SKIPPED)
88
94
 
89
95
#define GST_VAAPI_PICTURE_IS_REFERENCE(picture) \
90
 
    GST_VAAPI_PICTURE_FLAG_IS_SET(picture, GST_VAAPI_PICTURE_FLAG_REFERENCE)
 
96
  GST_VAAPI_PICTURE_FLAG_IS_SET (picture, GST_VAAPI_PICTURE_FLAG_REFERENCE)
91
97
 
92
98
#define GST_VAAPI_PICTURE_IS_OUTPUT(picture) \
93
 
    GST_VAAPI_PICTURE_FLAG_IS_SET(picture, GST_VAAPI_PICTURE_FLAG_OUTPUT)
 
99
  GST_VAAPI_PICTURE_FLAG_IS_SET (picture, GST_VAAPI_PICTURE_FLAG_OUTPUT)
94
100
 
95
101
#define GST_VAAPI_PICTURE_IS_INTERLACED(picture) \
96
 
    GST_VAAPI_PICTURE_FLAG_IS_SET(picture, GST_VAAPI_PICTURE_FLAG_INTERLACED)
 
102
  GST_VAAPI_PICTURE_FLAG_IS_SET (picture, GST_VAAPI_PICTURE_FLAG_INTERLACED)
97
103
 
98
104
#define GST_VAAPI_PICTURE_IS_FIRST_FIELD(picture) \
99
 
    GST_VAAPI_PICTURE_FLAG_IS_SET(picture, GST_VAAPI_PICTURE_FLAG_FF)
 
105
  GST_VAAPI_PICTURE_FLAG_IS_SET (picture, GST_VAAPI_PICTURE_FLAG_FF)
100
106
 
101
107
#define GST_VAAPI_PICTURE_IS_TFF(picture) \
102
 
    GST_VAAPI_PICTURE_FLAG_IS_SET(picture, GST_VAAPI_PICTURE_FLAG_TFF)
 
108
  GST_VAAPI_PICTURE_FLAG_IS_SET (picture, GST_VAAPI_PICTURE_FLAG_TFF)
 
109
 
 
110
#define GST_VAAPI_PICTURE_IS_ONEFIELD(picture) \
 
111
  GST_VAAPI_PICTURE_FLAG_IS_SET (picture, GST_VAAPI_PICTURE_FLAG_ONEFIELD)
103
112
 
104
113
#define GST_VAAPI_PICTURE_IS_FRAME(picture) \
105
 
    (GST_VAAPI_PICTURE(picture)->structure == GST_VAAPI_PICTURE_STRUCTURE_FRAME)
 
114
  (GST_VAAPI_PICTURE (picture)->structure == GST_VAAPI_PICTURE_STRUCTURE_FRAME)
106
115
 
107
116
#define GST_VAAPI_PICTURE_IS_COMPLETE(picture)          \
108
 
    (GST_VAAPI_PICTURE_IS_FRAME(picture) ||             \
109
 
     !GST_VAAPI_PICTURE_IS_FIRST_FIELD(picture))
 
117
  (GST_VAAPI_PICTURE_IS_FRAME (picture) ||              \
 
118
   GST_VAAPI_PICTURE_IS_ONEFIELD (picture) ||           \
 
119
   !GST_VAAPI_PICTURE_IS_FIRST_FIELD (picture))
 
120
 
 
121
#define GST_VAAPI_PICTURE_IS_MVC(picture) \
 
122
  (GST_VAAPI_PICTURE_FLAG_IS_SET (picture, GST_VAAPI_PICTURE_FLAG_MVC))
110
123
 
111
124
/**
112
125
 * GstVaapiPicture:
113
126
 *
114
127
 * A #GstVaapiCodecObject holding a picture parameter.
115
128
 */
116
 
struct _GstVaapiPicture {
117
 
    /*< private >*/
118
 
    GstVaapiCodecObject         parent_instance;
119
 
    GstVaapiPicture            *parent_picture;
120
 
    GstVideoCodecFrame         *frame;
121
 
    GstVaapiSurface            *surface;
122
 
    GstVaapiSurfaceProxy       *proxy;
123
 
    VABufferID                  param_id;
124
 
    guint                       param_size;
 
129
struct _GstVaapiPicture
 
130
{
 
131
  /*< private >*/
 
132
  GstVaapiCodecObject parent_instance;
 
133
  GstVaapiPicture *parent_picture;
 
134
  GstVideoCodecFrame *frame;
 
135
  GstVaapiSurface *surface;
 
136
  GstVaapiSurfaceProxy *proxy;
 
137
  VABufferID param_id;
 
138
  guint param_size;
125
139
 
126
 
    /*< public >*/
127
 
    GstVaapiPictureType         type;
128
 
    VASurfaceID                 surface_id;
129
 
    gpointer                    param;
130
 
    GPtrArray                  *slices;
131
 
    GstVaapiIqMatrix           *iq_matrix;
132
 
    GstVaapiHuffmanTable       *huf_table;
133
 
    GstVaapiBitPlane           *bitplane;
134
 
    GstClockTime                pts;
135
 
    gint32                      poc;
136
 
    guint                       structure;
137
 
    GstVaapiRectangle           crop_rect;
138
 
    guint                       has_crop_rect   : 1;
 
140
  /*< public >*/
 
141
  GstVaapiPictureType type;
 
142
  VASurfaceID surface_id;
 
143
  gpointer param;
 
144
  GPtrArray *slices;
 
145
  GstVaapiIqMatrix *iq_matrix;
 
146
  GstVaapiHuffmanTable *huf_table;
 
147
  GstVaapiBitPlane *bitplane;
 
148
  GstVaapiProbabilityTable *prob_table;
 
149
  GstClockTime pts;
 
150
  gint32 poc;
 
151
  guint16 voc;
 
152
  guint16 view_id;
 
153
  guint structure;
 
154
  GstVaapiRectangle crop_rect;
 
155
  guint has_crop_rect:1;
139
156
};
140
157
 
141
158
G_GNUC_INTERNAL
142
159
void
143
 
gst_vaapi_picture_destroy(GstVaapiPicture *picture);
144
 
 
145
 
G_GNUC_INTERNAL
146
 
gboolean
147
 
gst_vaapi_picture_create(GstVaapiPicture *picture,
148
 
    const GstVaapiCodecObjectConstructorArgs *args);
149
 
 
150
 
G_GNUC_INTERNAL
151
 
GstVaapiPicture *
152
 
gst_vaapi_picture_new(
153
 
    GstVaapiDecoder *decoder,
154
 
    gconstpointer    param,
155
 
    guint            param_size
156
 
);
157
 
 
158
 
G_GNUC_INTERNAL
159
 
GstVaapiPicture *
160
 
gst_vaapi_picture_new_field(GstVaapiPicture *picture);
161
 
 
162
 
G_GNUC_INTERNAL
163
 
void
164
 
gst_vaapi_picture_add_slice(GstVaapiPicture *picture, GstVaapiSlice *slice);
165
 
 
166
 
G_GNUC_INTERNAL
167
 
gboolean
168
 
gst_vaapi_picture_decode(GstVaapiPicture *picture);
169
 
 
170
 
G_GNUC_INTERNAL
171
 
gboolean
172
 
gst_vaapi_picture_output(GstVaapiPicture *picture);
173
 
 
174
 
G_GNUC_INTERNAL
175
 
void
176
 
gst_vaapi_picture_set_crop_rect(GstVaapiPicture *picture,
177
 
    const GstVaapiRectangle *crop_rect);
178
 
 
179
 
static inline gpointer
180
 
gst_vaapi_picture_ref(gpointer ptr)
181
 
{
182
 
    return gst_vaapi_mini_object_ref(GST_VAAPI_MINI_OBJECT(ptr));
183
 
}
184
 
 
185
 
static inline void
186
 
gst_vaapi_picture_unref(gpointer ptr)
187
 
{
188
 
    gst_vaapi_mini_object_unref(GST_VAAPI_MINI_OBJECT(ptr));
189
 
}
190
 
 
191
 
#define gst_vaapi_picture_replace(old_picture_p, new_picture)             \
192
 
    gst_vaapi_mini_object_replace((GstVaapiMiniObject **)(old_picture_p), \
193
 
        (GstVaapiMiniObject *)(new_picture))
 
160
gst_vaapi_picture_destroy (GstVaapiPicture * picture);
 
161
 
 
162
G_GNUC_INTERNAL
 
163
gboolean
 
164
gst_vaapi_picture_create (GstVaapiPicture * picture,
 
165
    const GstVaapiCodecObjectConstructorArgs * args);
 
166
 
 
167
G_GNUC_INTERNAL
 
168
GstVaapiPicture *
 
169
gst_vaapi_picture_new (GstVaapiDecoder * decoder,
 
170
    gconstpointer param, guint param_size);
 
171
 
 
172
G_GNUC_INTERNAL
 
173
GstVaapiPicture *
 
174
gst_vaapi_picture_new_field (GstVaapiPicture * picture);
 
175
 
 
176
G_GNUC_INTERNAL
 
177
void
 
178
gst_vaapi_picture_add_slice (GstVaapiPicture * picture, GstVaapiSlice * slice);
 
179
 
 
180
G_GNUC_INTERNAL
 
181
gboolean
 
182
gst_vaapi_picture_decode (GstVaapiPicture * picture);
 
183
 
 
184
G_GNUC_INTERNAL
 
185
gboolean
 
186
gst_vaapi_picture_output (GstVaapiPicture * picture);
 
187
 
 
188
G_GNUC_INTERNAL
 
189
void
 
190
gst_vaapi_picture_set_crop_rect (GstVaapiPicture * picture,
 
191
    const GstVaapiRectangle * crop_rect);
 
192
 
 
193
#define gst_vaapi_picture_ref(picture) \
 
194
  gst_vaapi_codec_object_ref (picture)
 
195
 
 
196
#define gst_vaapi_picture_unref(picture) \
 
197
  gst_vaapi_codec_object_unref (picture)
 
198
 
 
199
#define gst_vaapi_picture_replace(old_picture_ptr, new_picture) \
 
200
  gst_vaapi_codec_object_replace (old_picture_ptr, new_picture)
194
201
 
195
202
/* ------------------------------------------------------------------------- */
196
203
/* --- Slices                                                            --- */
197
204
/* ------------------------------------------------------------------------- */
198
205
 
199
206
#define GST_VAAPI_SLICE_CAST(obj) \
200
 
    ((GstVaapiSlice *)(obj))
 
207
  ((GstVaapiSlice *) (obj))
201
208
 
202
209
#define GST_VAAPI_SLICE(obj) \
203
 
    GST_VAAPI_SLICE_CAST(obj)
 
210
  GST_VAAPI_SLICE_CAST (obj)
204
211
 
205
212
#define GST_VAAPI_IS_SLICE(obj) \
206
 
    (GST_VAAPI_SLICE(obj) != NULL)
 
213
  (GST_VAAPI_SLICE (obj) != NULL)
207
214
 
208
215
/**
209
216
 * GstVaapiSlice:
210
217
 *
211
218
 * A #GstVaapiCodecObject holding a slice parameter.
212
219
 */
213
 
struct _GstVaapiSlice {
214
 
    /*< private >*/
215
 
    GstVaapiCodecObject         parent_instance;
216
 
 
217
 
    /*< public >*/
218
 
    VABufferID                  param_id;
219
 
    VABufferID                  data_id;
220
 
    gpointer                    param;
221
 
 
222
 
    /* Per-slice overrides */
223
 
    GstVaapiHuffmanTable       *huf_table;
 
220
struct _GstVaapiSlice
 
221
{
 
222
  /*< private >*/
 
223
  GstVaapiCodecObject parent_instance;
 
224
 
 
225
  /*< public >*/
 
226
  VABufferID param_id;
 
227
  VABufferID data_id;
 
228
  gpointer param;
 
229
 
 
230
  /* Per-slice overrides */
 
231
  GstVaapiHuffmanTable *huf_table;
224
232
};
225
233
 
226
234
G_GNUC_INTERNAL
227
235
void
228
 
gst_vaapi_slice_destroy(GstVaapiSlice *slice);
 
236
gst_vaapi_slice_destroy (GstVaapiSlice * slice);
229
237
 
230
238
G_GNUC_INTERNAL
231
239
gboolean
232
 
gst_vaapi_slice_create(GstVaapiSlice *slice,
233
 
    const GstVaapiCodecObjectConstructorArgs *args);
 
240
gst_vaapi_slice_create (GstVaapiSlice * slice,
 
241
    const GstVaapiCodecObjectConstructorArgs * args);
234
242
 
235
243
G_GNUC_INTERNAL
236
244
GstVaapiSlice *
237
 
gst_vaapi_slice_new(
238
 
    GstVaapiDecoder *decoder,
239
 
    gconstpointer    param,
240
 
    guint            param_size,
241
 
    const guchar    *data,
242
 
    guint            data_size
243
 
);
 
245
gst_vaapi_slice_new (GstVaapiDecoder * decoder, gconstpointer param,
 
246
    guint param_size, const guchar * data, guint data_size);
244
247
 
245
248
/* ------------------------------------------------------------------------- */
246
249
/* --- Helpers to create codec-dependent objects                         --- */
247
250
/* ------------------------------------------------------------------------- */
248
251
 
249
 
#define GST_VAAPI_PICTURE_NEW(codec, decoder)                           \
250
 
    gst_vaapi_picture_new(GST_VAAPI_DECODER_CAST(decoder),              \
251
 
                          NULL, sizeof(VAPictureParameterBuffer##codec))
 
252
#define GST_VAAPI_PICTURE_NEW(codec, decoder)                   \
 
253
  gst_vaapi_picture_new (GST_VAAPI_DECODER_CAST (decoder),      \
 
254
      NULL, sizeof (G_PASTE (VAPictureParameterBuffer, codec)))
252
255
 
253
 
#define GST_VAAPI_SLICE_NEW(codec, decoder, buf, buf_size)              \
254
 
    gst_vaapi_slice_new(GST_VAAPI_DECODER_CAST(decoder),                \
255
 
                        NULL, sizeof(VASliceParameterBuffer##codec),    \
256
 
                        buf, buf_size)
 
256
#define GST_VAAPI_SLICE_NEW(codec, decoder, buf, buf_size)      \
 
257
  gst_vaapi_slice_new (GST_VAAPI_DECODER_CAST (decoder),        \
 
258
      NULL, sizeof (G_PASTE (VASliceParameterBuffer, codec)),   \
 
259
      buf, buf_size)
257
260
 
258
261
G_END_DECLS
259
262