2 * gstvaapifilter.h - Video processing abstraction
4 * Copyright (C) 2013 Intel Corporation
5 * Author: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public License
9 * as published by the Free Software Foundation; either version 2.1
10 * of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free
19 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20 * Boston, MA 02110-1301 USA
23 #ifndef GST_VAAPI_FILTER_H
24 #define GST_VAAPI_FILTER_H
26 #include <gst/vaapi/gstvaapisurface.h>
27 #include <gst/vaapi/video-format.h>
31 #define GST_TYPE_VAAPI_FILTER \
32 (gst_vaapi_filter_get_type ())
33 #define GST_VAAPI_FILTER(obj) \
34 (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_VAAPI_FILTER, GstVaapiFilter))
35 #define GST_VAAPI_IS_FILTER(obj) \
36 (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_VAAPI_FILTER))
38 typedef struct _GstVaapiFilter GstVaapiFilter;
39 typedef struct _GstVaapiFilterOpInfo GstVaapiFilterOpInfo;
42 * @GST_VAAPI_FILTER_OP_FORMAT: Force output pixel format (#GstVideoFormat).
43 * @GST_VAAPI_FILTER_OP_CROP: Crop source surface (#GstVaapiRectangle).
44 * @GST_VAAPI_FILTER_OP_DENOISE: Noise reduction (float).
45 * @GST_VAAPI_FILTER_OP_SHARPEN: Sharpening (float).
46 * @GST_VAAPI_FILTER_OP_HUE: Change color hue (float).
47 * @GST_VAAPI_FILTER_OP_SATURATION: Change saturation (float).
48 * @GST_VAAPI_FILTER_OP_BRIGHTNESS: Change brightness (float).
49 * @GST_VAAPI_FILTER_OP_CONTRAST: Change contrast (float).
50 * @GST_VAAPI_FILTER_OP_SCALING: Change scaling method (#GstVaapiScaleMethod).
51 * @GST_VAAPI_FILTER_OP_VIDEO_DIRECTION: Change video direction
52 * (#GstVideoOrientationMethod).
53 * @GST_VAAPI_FILTER_OP_SKINTONE: Skin tone enhancement (bool).
55 * The set of operations that could be applied to the filter.
58 GST_VAAPI_FILTER_OP_FORMAT = 1,
59 GST_VAAPI_FILTER_OP_CROP,
60 GST_VAAPI_FILTER_OP_DENOISE,
61 GST_VAAPI_FILTER_OP_SHARPEN,
62 GST_VAAPI_FILTER_OP_HUE,
63 GST_VAAPI_FILTER_OP_SATURATION,
64 GST_VAAPI_FILTER_OP_BRIGHTNESS,
65 GST_VAAPI_FILTER_OP_CONTRAST,
66 GST_VAAPI_FILTER_OP_DEINTERLACING,
67 GST_VAAPI_FILTER_OP_SCALING,
68 GST_VAAPI_FILTER_OP_VIDEO_DIRECTION,
69 GST_VAAPI_FILTER_OP_SKINTONE,
73 * GstVaapiFilterOpInfo:
74 * @operation: the #GstVaapiFilterOp
75 * @pspec: the #GParamSpec describing the associated configurable value
77 * A #GstVaapiFilterOp descriptor.
79 struct _GstVaapiFilterOpInfo
81 const GstVaapiFilterOp op;
82 GParamSpec *const pspec;
86 * GstVaapiFilterStatus:
87 * @GST_VAAPI_FILTER_STATUS_SUCCESS: Success.
88 * @GST_VAAPI_FILTER_STATUS_ERROR_ALLOCATION_FAILED: No memory left.
89 * @GST_VAAPI_FILTER_STATUS_ERROR_OPERATION_FAILED: Operation failed.
90 * @GST_VAAPI_FILTER_STATUS_ERROR_INVALID_PARAMETER: Invalid parameter.
91 * @GST_VAAPI_FILTER_STATUS_ERROR_UNSUPPORTED_OPERATION: Unsupported operation.
92 * @GST_VAAPI_FILTER_STATUS_ERROR_UNSUPPORTED_FORMAT: Unsupported target format.
94 * Video processing status for gst_vaapi_filter_process().
97 GST_VAAPI_FILTER_STATUS_SUCCESS = 0,
98 GST_VAAPI_FILTER_STATUS_ERROR_ALLOCATION_FAILED,
99 GST_VAAPI_FILTER_STATUS_ERROR_OPERATION_FAILED,
100 GST_VAAPI_FILTER_STATUS_ERROR_INVALID_PARAMETER,
101 GST_VAAPI_FILTER_STATUS_ERROR_UNSUPPORTED_OPERATION,
102 GST_VAAPI_FILTER_STATUS_ERROR_UNSUPPORTED_FORMAT,
103 } GstVaapiFilterStatus;
106 * GstVaapiScaleMethod:
107 * @GST_VAAPI_SCALE_METHOD_DEFAULT: Default scaling mode.
108 * @GST_VAAPI_SCALE_METHOD_FAST: Fast scaling mode, at the expense of quality.
109 * @GST_VAAPI_SCALE_METHOD_HQ: High quality scaling mode, at the
112 * Scaling algorithms.
115 GST_VAAPI_SCALE_METHOD_DEFAULT,
116 GST_VAAPI_SCALE_METHOD_FAST,
117 GST_VAAPI_SCALE_METHOD_HQ,
118 } GstVaapiScaleMethod;
121 * GstVaapiDeinterlaceMethod:
122 * @GST_VAAPI_DEINTERLACE_METHOD_NONE: No deinterlacing.
123 * @GST_VAAPI_DEINTERLACE_METHOD_BOB: Basic bob deinterlacing algorithm.
124 * @GST_VAAPI_DEINTERLACE_METHOD_WEAVE: Weave deinterlacing algorithm.
125 * @GST_VAAPI_DEINTERLACE_METHOD_MOTION_ADAPTIVE: Motion adaptive
126 * deinterlacing algorithm.
127 * @GST_VAAPI_DEINTERLACE_METHOD_MOTION_COMPENSATED: Motion compensated
128 * deinterlacing algorithm.
130 * Deinterlacing algorithms.
133 GST_VAAPI_DEINTERLACE_METHOD_NONE,
134 GST_VAAPI_DEINTERLACE_METHOD_BOB,
135 GST_VAAPI_DEINTERLACE_METHOD_WEAVE,
136 GST_VAAPI_DEINTERLACE_METHOD_MOTION_ADAPTIVE,
137 GST_VAAPI_DEINTERLACE_METHOD_MOTION_COMPENSATED,
138 } GstVaapiDeinterlaceMethod;
141 * GstVaapiDeinterlaceFlags:
142 * @GST_VAAPI_DEINTERLACE_FLAG_TFF: Top-field first. If this flag is
143 * not set, then bottom-field first order is assumed. Note: this
144 * only affects the way reference frames are organized for advanced
145 * deinterlacing modes.
146 * @GST_VAAPI_DEINTERLACE_FLAG_ONEFIELD: The input frame represents a
147 * single field. If this flag is not set, then the whole frame holds
148 * two interleaved fields.
149 * @GST_VAAPI_DEINTERLACE_FLAG_TOPFIELD: The top field of the input
150 * frame is to be used for deinterlacing. Otherwise, if this flag is
151 * not set, then the bottom field of the input frame will be used
154 * The set of gst_vaapi_filter_set_deinterlacing() flags.
157 GST_VAAPI_DEINTERLACE_FLAG_TFF = 1 << 31,
158 GST_VAAPI_DEINTERLACE_FLAG_ONEFIELD = 1 << 30,
159 GST_VAAPI_DEINTERLACE_FLAG_TOPFIELD = 1 << 29,
160 } GstVaapiDeinterlaceFlags;
162 #define GST_VAAPI_TYPE_SCALE_METHOD \
163 gst_vaapi_scale_method_get_type()
165 #define GST_VAAPI_TYPE_DEINTERLACE_METHOD \
166 gst_vaapi_deinterlace_method_get_type()
168 #define GST_VAAPI_TYPE_DEINTERLACE_FLAGS \
169 gst_vaapi_deinterlace_flags_get_type()
172 gst_vaapiscale_method_get_type (void) G_GNUC_CONST;
175 gst_vaapi_deinterlace_method_get_type (void) G_GNUC_CONST;
178 gst_vaapi_deinterlace_flags_get_type (void) G_GNUC_CONST;
181 gst_vaapi_filter_get_type (void) G_GNUC_CONST;
184 gst_vaapi_filter_new (GstVaapiDisplay * display);
187 gst_vaapi_filter_replace (GstVaapiFilter ** old_filter_ptr,
188 GstVaapiFilter * new_filter);
191 gst_vaapi_filter_get_operations (GstVaapiFilter * filter);
194 gst_vaapi_filter_has_operation (GstVaapiFilter * filter, GstVaapiFilterOp op);
197 gst_vaapi_filter_use_operation (GstVaapiFilter * filter, GstVaapiFilterOp op);
200 gst_vaapi_filter_set_operation (GstVaapiFilter * filter, GstVaapiFilterOp op,
201 const GValue * value);
204 gst_vaapi_filter_process (GstVaapiFilter * filter,
205 GstVaapiSurface * src_surface, GstVaapiSurface * dst_surface, guint flags);
208 gst_vaapi_filter_get_formats (GstVaapiFilter * filter);
211 gst_vaapi_filter_set_format (GstVaapiFilter * filter, GstVideoFormat format);
214 gst_vaapi_filter_append_caps (GstVaapiFilter * filter, GstStructure * structure);
217 gst_vaapi_filter_set_cropping_rectangle (GstVaapiFilter * filter,
218 const GstVaapiRectangle * rect);
221 gst_vaapi_filter_set_target_rectangle (GstVaapiFilter * filter,
222 const GstVaapiRectangle * rect);
225 gst_vaapi_filter_set_denoising_level (GstVaapiFilter * filter, gfloat level);
228 gst_vaapi_filter_set_sharpening_level (GstVaapiFilter * filter, gfloat level);
231 gst_vaapi_filter_set_hue (GstVaapiFilter * filter, gfloat value);
234 gst_vaapi_filter_set_saturation (GstVaapiFilter * filter, gfloat value);
237 gst_vaapi_filter_set_brightness (GstVaapiFilter * filter, gfloat value);
240 gst_vaapi_filter_set_contrast (GstVaapiFilter * filter, gfloat value);
243 gst_vaapi_filter_set_deinterlacing (GstVaapiFilter * filter,
244 GstVaapiDeinterlaceMethod method, guint flags);
247 gst_vaapi_filter_set_deinterlacing_references (GstVaapiFilter * filter,
248 GstVaapiSurface ** forward_references, guint num_forward_references,
249 GstVaapiSurface ** backward_references, guint num_backward_references);
252 gst_vaapi_filter_set_scaling (GstVaapiFilter * filter,
253 GstVaapiScaleMethod method);
256 gst_vaapi_filter_set_video_direction (GstVaapiFilter * filter,
257 GstVideoOrientationMethod method);
259 GstVideoOrientationMethod
260 gst_vaapi_filter_get_video_direction (GstVaapiFilter * filter);
263 gst_vaapi_filter_set_skintone (GstVaapiFilter * filter,
267 gst_vaapi_filter_get_denoising_level_default (GstVaapiFilter * filter);
270 gst_vaapi_filter_get_sharpening_level_default (GstVaapiFilter * filter);
273 gst_vaapi_filter_get_hue_default (GstVaapiFilter * filter);
276 gst_vaapi_filter_get_saturation_default (GstVaapiFilter * filter);
279 gst_vaapi_filter_get_brightness_default (GstVaapiFilter * filter);
282 gst_vaapi_filter_get_contrast_default (GstVaapiFilter * filter);
285 gst_vaapi_filter_get_scaling_default (GstVaapiFilter * filter);
287 GstVideoOrientationMethod
288 gst_vaapi_filter_get_video_direction_default (GstVaapiFilter * filter);
291 gst_vaapi_filter_get_skintone_default (GstVaapiFilter * filter);
293 #ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC
294 G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstVaapiFilter, gst_object_unref)
297 #endif /* GST_VAAPI_FILTER_H */