2012-01-26 08:48:11 +00:00
|
|
|
/*
|
|
|
|
* gstvaapicodec_objects.h - VA codec objects abstraction
|
|
|
|
*
|
|
|
|
* Copyright (C) 2010-2011 Splitted-Desktop Systems
|
2013-11-22 04:57:18 +00:00
|
|
|
* Author: Gwenole Beauchesne <gwenole.beauchesne@splitted-desktop.com>
|
2014-01-22 17:54:14 +00:00
|
|
|
* Copyright (C) 2011-2014 Intel Corporation
|
2013-11-22 04:57:18 +00:00
|
|
|
* Author: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
|
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_CODEC_COMMON_H
|
|
|
|
#define GST_VAAPI_CODEC_COMMON_H
|
|
|
|
|
2012-12-03 10:19:08 +00:00
|
|
|
#include <gst/vaapi/gstvaapiminiobject.h>
|
2012-01-26 08:48:11 +00:00
|
|
|
#include <gst/vaapi/gstvaapidecoder.h>
|
|
|
|
|
|
|
|
G_BEGIN_DECLS
|
|
|
|
|
|
|
|
typedef gpointer GstVaapiCodecBase;
|
|
|
|
typedef struct _GstVaapiCodecObject GstVaapiCodecObject;
|
|
|
|
typedef struct _GstVaapiCodecObjectClass GstVaapiCodecObjectClass;
|
|
|
|
typedef struct _GstVaapiIqMatrix GstVaapiIqMatrix;
|
|
|
|
typedef struct _GstVaapiBitPlane GstVaapiBitPlane;
|
2012-02-09 16:21:04 +00:00
|
|
|
typedef struct _GstVaapiHuffmanTable GstVaapiHuffmanTable;
|
2013-12-26 23:18:24 +00:00
|
|
|
typedef struct _GstVaapiProbabilityTable GstVaapiProbabilityTable;
|
2012-01-26 08:48:11 +00:00
|
|
|
|
|
|
|
/* ------------------------------------------------------------------------- */
|
|
|
|
/* --- Base Codec Object --- */
|
|
|
|
/* ------------------------------------------------------------------------- */
|
|
|
|
|
|
|
|
/* XXX: remove when a common base class for decoder and encoder is available */
|
|
|
|
#define GST_VAAPI_CODEC_BASE(obj) \
|
2014-01-09 08:10:21 +00:00
|
|
|
((GstVaapiCodecBase *) (obj))
|
2012-01-26 08:48:11 +00:00
|
|
|
|
2012-12-03 10:19:08 +00:00
|
|
|
#define GST_VAAPI_CODEC_OBJECT(obj) \
|
2014-01-09 08:10:21 +00:00
|
|
|
((GstVaapiCodecObject *) (obj))
|
2012-01-26 08:48:11 +00:00
|
|
|
|
2014-01-09 08:10:21 +00:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
GST_VAAPI_CODEC_OBJECT_FLAG_CONSTRUCTED = (1 << 0),
|
|
|
|
GST_VAAPI_CODEC_OBJECT_FLAG_LAST = (1 << 1)
|
2012-01-26 08:48:11 +00:00
|
|
|
};
|
|
|
|
|
2014-01-09 08:10:21 +00:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
gconstpointer param;
|
|
|
|
guint param_size;
|
2020-08-27 13:39:35 +00:00
|
|
|
guint param_num;
|
2014-01-09 08:10:21 +00:00
|
|
|
gconstpointer data;
|
|
|
|
guint data_size;
|
|
|
|
guint flags;
|
2012-01-26 08:48:11 +00:00
|
|
|
} GstVaapiCodecObjectConstructorArgs;
|
|
|
|
|
2012-12-03 10:19:08 +00:00
|
|
|
typedef gboolean
|
2014-01-09 08:10:21 +00:00
|
|
|
(*GstVaapiCodecObjectCreateFunc)(GstVaapiCodecObject * object,
|
|
|
|
const GstVaapiCodecObjectConstructorArgs * args);
|
2012-12-03 10:19:08 +00:00
|
|
|
|
|
|
|
typedef GDestroyNotify GstVaapiCodecObjectDestroyFunc;
|
|
|
|
|
2012-01-26 08:48:11 +00:00
|
|
|
/**
|
|
|
|
* GstVaapiCodecObject:
|
|
|
|
*
|
2012-12-03 10:19:08 +00:00
|
|
|
* A #GstVaapiMiniObject holding the base codec object data
|
2012-01-26 08:48:11 +00:00
|
|
|
*/
|
2014-01-09 08:10:21 +00:00
|
|
|
struct _GstVaapiCodecObject
|
|
|
|
{
|
|
|
|
/*< private >*/
|
|
|
|
GstVaapiMiniObject parent_instance;
|
|
|
|
GstVaapiCodecBase *codec;
|
2012-01-26 08:48:11 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* GstVaapiCodecObjectClass:
|
|
|
|
*
|
|
|
|
* The #GstVaapiCodecObject base class.
|
|
|
|
*/
|
2014-01-09 08:10:21 +00:00
|
|
|
struct _GstVaapiCodecObjectClass
|
|
|
|
{
|
|
|
|
/*< private >*/
|
|
|
|
GstVaapiMiniObjectClass parent_class;
|
2012-01-26 08:48:11 +00:00
|
|
|
|
2014-01-09 08:10:21 +00:00
|
|
|
GstVaapiCodecObjectCreateFunc create;
|
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
|
|
|
const GstVaapiCodecObjectClass *
|
2014-01-09 08:10:21 +00:00
|
|
|
gst_vaapi_codec_object_get_class (GstVaapiCodecObject * object) G_GNUC_CONST;
|
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
|
|
|
GstVaapiCodecObject *
|
2014-01-09 08:10:21 +00:00
|
|
|
gst_vaapi_codec_object_new (const GstVaapiCodecObjectClass * object_class,
|
|
|
|
GstVaapiCodecBase * codec, gconstpointer param, guint param_size,
|
2012-12-03 10:19:08 +00:00
|
|
|
gconstpointer data, guint data_size, guint flags);
|
2012-01-26 08:48:11 +00:00
|
|
|
|
2020-08-27 13:39:35 +00:00
|
|
|
G_GNUC_INTERNAL
|
|
|
|
GstVaapiCodecObject *
|
|
|
|
gst_vaapi_codec_object_new_with_param_num (const GstVaapiCodecObjectClass *
|
|
|
|
object_class, GstVaapiCodecBase * codec, gconstpointer param,
|
|
|
|
guint param_size, guint param_num, gconstpointer data,
|
|
|
|
guint data_size, guint flags);
|
|
|
|
|
2014-01-09 08:27:40 +00:00
|
|
|
#define gst_vaapi_codec_object_ref(object) \
|
|
|
|
((gpointer) gst_vaapi_mini_object_ref (GST_VAAPI_MINI_OBJECT (object)))
|
|
|
|
|
|
|
|
#define gst_vaapi_codec_object_unref(object) \
|
|
|
|
gst_vaapi_mini_object_unref (GST_VAAPI_MINI_OBJECT (object))
|
|
|
|
|
|
|
|
#define gst_vaapi_codec_object_replace(old_object_ptr, new_object) \
|
|
|
|
gst_vaapi_mini_object_replace ((GstVaapiMiniObject **) (old_object_ptr), \
|
|
|
|
GST_VAAPI_MINI_OBJECT (new_object))
|
|
|
|
|
2012-01-26 08:48:11 +00:00
|
|
|
/* ------------------------------------------------------------------------- */
|
|
|
|
/* --- Inverse Quantization Matrices --- */
|
|
|
|
/* ------------------------------------------------------------------------- */
|
|
|
|
|
|
|
|
#define GST_VAAPI_IQ_MATRIX_CAST(obj) \
|
2014-01-09 08:10:21 +00:00
|
|
|
((GstVaapiIqMatrix *) (obj))
|
2012-01-26 08:48:11 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* GstVaapiIqMatrix:
|
|
|
|
*
|
|
|
|
* A #GstVaapiCodecObject holding an inverse quantization matrix parameter.
|
|
|
|
*/
|
2014-01-09 08:10:21 +00:00
|
|
|
struct _GstVaapiIqMatrix
|
|
|
|
{
|
|
|
|
/*< private >*/
|
|
|
|
GstVaapiCodecObject parent_instance;
|
|
|
|
VABufferID param_id;
|
|
|
|
|
|
|
|
/*< public >*/
|
|
|
|
gpointer param;
|
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
|
|
|
GstVaapiIqMatrix *
|
2014-01-09 08:10:21 +00:00
|
|
|
gst_vaapi_iq_matrix_new (GstVaapiDecoder * decoder, gconstpointer param,
|
|
|
|
guint param_size);
|
2012-01-26 08:48:11 +00:00
|
|
|
|
|
|
|
/* ------------------------------------------------------------------------- */
|
|
|
|
/* --- VC-1 Bit Planes --- */
|
|
|
|
/* ------------------------------------------------------------------------- */
|
|
|
|
|
|
|
|
#define GST_VAAPI_BITPLANE_CAST(obj) \
|
2014-01-09 08:10:21 +00:00
|
|
|
((GstVaapiBitPlane *) (obj))
|
2012-01-26 08:48:11 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* GstVaapiBitPlane:
|
|
|
|
*
|
|
|
|
* A #GstVaapiCodecObject holding a VC-1 bit plane parameter.
|
|
|
|
*/
|
2014-01-09 08:10:21 +00:00
|
|
|
struct _GstVaapiBitPlane
|
|
|
|
{
|
|
|
|
/*< private >*/
|
|
|
|
GstVaapiCodecObject parent_instance;
|
|
|
|
VABufferID data_id;
|
|
|
|
|
|
|
|
/*< public >*/
|
|
|
|
guint8 *data;
|
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
|
|
|
GstVaapiBitPlane *
|
2014-01-09 08:10:21 +00:00
|
|
|
gst_vaapi_bitplane_new (GstVaapiDecoder * decoder, guint8 * data,
|
|
|
|
guint data_size);
|
2012-01-26 08:48:11 +00:00
|
|
|
|
2012-02-09 16:21:04 +00:00
|
|
|
/* ------------------------------------------------------------------------- */
|
|
|
|
/* --- JPEG Huffman Tables --- */
|
|
|
|
/* ------------------------------------------------------------------------- */
|
|
|
|
|
|
|
|
#define GST_VAAPI_HUFFMAN_TABLE_CAST(obj) \
|
2014-01-09 08:10:21 +00:00
|
|
|
((GstVaapiHuffmanTable *) (obj))
|
2012-02-09 16:21:04 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* GstVaapiHuffmanTable:
|
|
|
|
*
|
|
|
|
* A #GstVaapiCodecObject holding huffman table.
|
|
|
|
*/
|
2014-01-09 08:10:21 +00:00
|
|
|
struct _GstVaapiHuffmanTable
|
|
|
|
{
|
|
|
|
/*< private >*/
|
|
|
|
GstVaapiCodecObject parent_instance;
|
|
|
|
VABufferID param_id;
|
|
|
|
|
|
|
|
/*< public >*/
|
|
|
|
gpointer param;
|
2012-02-09 16:21:04 +00:00
|
|
|
};
|
|
|
|
|
2012-07-19 15:55:00 +00:00
|
|
|
G_GNUC_INTERNAL
|
2012-02-09 16:21:04 +00:00
|
|
|
GstVaapiHuffmanTable *
|
2014-01-09 08:10:21 +00:00
|
|
|
gst_vaapi_huffman_table_new (GstVaapiDecoder * decoder, guint8 * data,
|
|
|
|
guint data_size);
|
2012-02-09 16:21:04 +00:00
|
|
|
|
2013-12-26 23:18:24 +00:00
|
|
|
/* ------------------------------------------------------------------------- */
|
|
|
|
/* --- Probability (Update) Table --- */
|
|
|
|
/* ------------------------------------------------------------------------- */
|
|
|
|
|
|
|
|
#define GST_VAAPI_PROBABILITY_TABLE_CAST(obj) \
|
|
|
|
((GstVaapiProbabilityTable *)(obj))
|
|
|
|
|
|
|
|
/**
|
|
|
|
* GstVaapiProbabilityTable:
|
|
|
|
*
|
|
|
|
* A #GstVaapiCodecObject holding an Probability (Update) Table for RAC decoding
|
|
|
|
*/
|
|
|
|
struct _GstVaapiProbabilityTable
|
|
|
|
{
|
|
|
|
/*< private > */
|
|
|
|
GstVaapiCodecObject parent_instance;
|
|
|
|
VABufferID param_id;
|
|
|
|
|
|
|
|
/*< public > */
|
|
|
|
gpointer param;
|
|
|
|
};
|
|
|
|
|
|
|
|
G_GNUC_INTERNAL
|
|
|
|
GstVaapiProbabilityTable *
|
|
|
|
gst_vaapi_probability_table_new (GstVaapiDecoder * decoder,
|
|
|
|
gconstpointer param, guint param_size);
|
|
|
|
|
2012-01-26 08:48:11 +00:00
|
|
|
/* ------------------------------------------------------------------------- */
|
|
|
|
/* --- Helpers to create codec-dependent objects --- */
|
|
|
|
/* ------------------------------------------------------------------------- */
|
|
|
|
|
2014-01-09 08:10:21 +00:00
|
|
|
#define GST_VAAPI_CODEC_DEFINE_TYPE(type, prefix) \
|
|
|
|
G_GNUC_INTERNAL \
|
|
|
|
void \
|
|
|
|
G_PASTE (prefix, _destroy) (type *); \
|
|
|
|
\
|
|
|
|
G_GNUC_INTERNAL \
|
|
|
|
gboolean \
|
|
|
|
G_PASTE (prefix, _create) (type *, \
|
|
|
|
const GstVaapiCodecObjectConstructorArgs * args); \
|
|
|
|
\
|
|
|
|
static const GstVaapiCodecObjectClass G_PASTE (type, Class) = { \
|
|
|
|
.parent_class = { \
|
|
|
|
.size = sizeof (type), \
|
|
|
|
.finalize = (GstVaapiCodecObjectDestroyFunc) \
|
|
|
|
G_PASTE (prefix, _destroy) \
|
|
|
|
}, \
|
|
|
|
.create = (GstVaapiCodecObjectCreateFunc) \
|
|
|
|
G_PASTE (prefix, _create), \
|
2012-01-26 08:48:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#define GST_VAAPI_IQ_MATRIX_NEW(codec, decoder) \
|
2014-01-09 08:10:21 +00:00
|
|
|
gst_vaapi_iq_matrix_new (GST_VAAPI_DECODER_CAST (decoder), \
|
|
|
|
NULL, sizeof (G_PASTE (VAIQMatrixBuffer, codec)))
|
2012-01-26 08:48:11 +00:00
|
|
|
|
|
|
|
#define GST_VAAPI_BITPLANE_NEW(decoder, size) \
|
2014-01-09 08:10:21 +00:00
|
|
|
gst_vaapi_bitplane_new (GST_VAAPI_DECODER_CAST (decoder), NULL, size)
|
2012-07-31 09:51:57 +00:00
|
|
|
|
|
|
|
#define GST_VAAPI_HUFFMAN_TABLE_NEW(codec, decoder) \
|
2014-01-09 08:10:21 +00:00
|
|
|
gst_vaapi_huffman_table_new (GST_VAAPI_DECODER_CAST (decoder), \
|
|
|
|
NULL, sizeof (G_PASTE (VAHuffmanTableBuffer, codec)))
|
2012-01-26 08:48:11 +00:00
|
|
|
|
2013-12-26 23:18:24 +00:00
|
|
|
#define GST_VAAPI_PROBABILITY_TABLE_NEW(codec, decoder) \
|
|
|
|
gst_vaapi_probability_table_new (GST_VAAPI_DECODER_CAST (decoder), \
|
|
|
|
NULL, sizeof (G_PASTE (VAProbabilityDataBuffer, codec)))
|
|
|
|
|
2012-01-26 08:48:11 +00:00
|
|
|
G_END_DECLS
|
|
|
|
|
|
|
|
#endif /* GST_VAAPI_CODEC_OBJECTS_H */
|