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).
54 * @GST_VAAPI_FILTER_OP_SKINTONE_LEVEL: Skin tone enhancement (uint).
56 * The set of operations that could be applied to the filter.
59 GST_VAAPI_FILTER_OP_FORMAT = 1,
60 GST_VAAPI_FILTER_OP_CROP,
61 GST_VAAPI_FILTER_OP_DENOISE,
62 GST_VAAPI_FILTER_OP_SHARPEN,
63 GST_VAAPI_FILTER_OP_HUE,
64 GST_VAAPI_FILTER_OP_SATURATION,
65 GST_VAAPI_FILTER_OP_BRIGHTNESS,
66 GST_VAAPI_FILTER_OP_CONTRAST,
67 GST_VAAPI_FILTER_OP_DEINTERLACING,
68 GST_VAAPI_FILTER_OP_SCALING,
69 GST_VAAPI_FILTER_OP_VIDEO_DIRECTION,
70 #ifndef GST_REMOVE_DEPRECATED
71 GST_VAAPI_FILTER_OP_SKINTONE,
73 GST_VAAPI_FILTER_OP_SKINTONE_LEVEL,
77 * GstVaapiFilterOpInfo:
78 * @operation: the #GstVaapiFilterOp
79 * @pspec: the #GParamSpec describing the associated configurable value
81 * A #GstVaapiFilterOp descriptor.
83 struct _GstVaapiFilterOpInfo
85 const GstVaapiFilterOp op;
86 GParamSpec *const pspec;
90 * GstVaapiFilterStatus:
91 * @GST_VAAPI_FILTER_STATUS_SUCCESS: Success.
92 * @GST_VAAPI_FILTER_STATUS_ERROR_ALLOCATION_FAILED: No memory left.
93 * @GST_VAAPI_FILTER_STATUS_ERROR_OPERATION_FAILED: Operation failed.
94 * @GST_VAAPI_FILTER_STATUS_ERROR_INVALID_PARAMETER: Invalid parameter.
95 * @GST_VAAPI_FILTER_STATUS_ERROR_UNSUPPORTED_OPERATION: Unsupported operation.
96 * @GST_VAAPI_FILTER_STATUS_ERROR_UNSUPPORTED_FORMAT: Unsupported target format.
98 * Video processing status for gst_vaapi_filter_process().
101 GST_VAAPI_FILTER_STATUS_SUCCESS = 0,
102 GST_VAAPI_FILTER_STATUS_ERROR_ALLOCATION_FAILED,
103 GST_VAAPI_FILTER_STATUS_ERROR_OPERATION_FAILED,
104 GST_VAAPI_FILTER_STATUS_ERROR_INVALID_PARAMETER,
105 GST_VAAPI_FILTER_STATUS_ERROR_UNSUPPORTED_OPERATION,
106 GST_VAAPI_FILTER_STATUS_ERROR_UNSUPPORTED_FORMAT,
107 } GstVaapiFilterStatus;
110 * GstVaapiScaleMethod:
111 * @GST_VAAPI_SCALE_METHOD_DEFAULT: Default scaling mode.
112 * @GST_VAAPI_SCALE_METHOD_FAST: Fast scaling mode, at the expense of quality.
113 * @GST_VAAPI_SCALE_METHOD_HQ: High quality scaling mode, at the
116 * Scaling algorithms.
119 GST_VAAPI_SCALE_METHOD_DEFAULT,
120 GST_VAAPI_SCALE_METHOD_FAST,
121 GST_VAAPI_SCALE_METHOD_HQ,
122 } GstVaapiScaleMethod;
125 * GstVaapiDeinterlaceMethod:
126 * @GST_VAAPI_DEINTERLACE_METHOD_NONE: No deinterlacing.
127 * @GST_VAAPI_DEINTERLACE_METHOD_BOB: Basic bob deinterlacing algorithm.
128 * @GST_VAAPI_DEINTERLACE_METHOD_WEAVE: Weave deinterlacing algorithm.
129 * @GST_VAAPI_DEINTERLACE_METHOD_MOTION_ADAPTIVE: Motion adaptive
130 * deinterlacing algorithm.
131 * @GST_VAAPI_DEINTERLACE_METHOD_MOTION_COMPENSATED: Motion compensated
132 * deinterlacing algorithm.
134 * Deinterlacing algorithms.
137 GST_VAAPI_DEINTERLACE_METHOD_NONE,
138 GST_VAAPI_DEINTERLACE_METHOD_BOB,
139 GST_VAAPI_DEINTERLACE_METHOD_WEAVE,
140 GST_VAAPI_DEINTERLACE_METHOD_MOTION_ADAPTIVE,
141 GST_VAAPI_DEINTERLACE_METHOD_MOTION_COMPENSATED,
142 } GstVaapiDeinterlaceMethod;
145 * GstVaapiDeinterlaceFlags:
146 * @GST_VAAPI_DEINTERLACE_FLAG_TFF: Top-field first. If this flag is
147 * not set, then bottom-field first order is assumed. Note: this
148 * only affects the way reference frames are organized for advanced
149 * deinterlacing modes.
150 * @GST_VAAPI_DEINTERLACE_FLAG_ONEFIELD: The input frame represents a
151 * single field. If this flag is not set, then the whole frame holds
152 * two interleaved fields.
153 * @GST_VAAPI_DEINTERLACE_FLAG_TOPFIELD: The top field of the input
154 * frame is to be used for deinterlacing. Otherwise, if this flag is
155 * not set, then the bottom field of the input frame will be used
158 * The set of gst_vaapi_filter_set_deinterlacing() flags.
161 GST_VAAPI_DEINTERLACE_FLAG_TFF = 1 << 31,
162 GST_VAAPI_DEINTERLACE_FLAG_ONEFIELD = 1 << 30,
163 GST_VAAPI_DEINTERLACE_FLAG_TOPFIELD = 1 << 29,
164 } GstVaapiDeinterlaceFlags;
166 #define GST_VAAPI_TYPE_SCALE_METHOD \
167 gst_vaapi_scale_method_get_type()
169 #define GST_VAAPI_TYPE_DEINTERLACE_METHOD \
170 gst_vaapi_deinterlace_method_get_type()
172 #define GST_VAAPI_TYPE_DEINTERLACE_FLAGS \
173 gst_vaapi_deinterlace_flags_get_type()
176 gst_vaapiscale_method_get_type (void) G_GNUC_CONST;
179 gst_vaapi_deinterlace_method_get_type (void) G_GNUC_CONST;
182 gst_vaapi_deinterlace_flags_get_type (void) G_GNUC_CONST;
185 gst_vaapi_filter_get_type (void) G_GNUC_CONST;
188 gst_vaapi_filter_new (GstVaapiDisplay * display);
191 gst_vaapi_filter_replace (GstVaapiFilter ** old_filter_ptr,
192 GstVaapiFilter * new_filter);
195 gst_vaapi_filter_get_operations (GstVaapiFilter * filter);
198 gst_vaapi_filter_has_operation (GstVaapiFilter * filter, GstVaapiFilterOp op);
201 gst_vaapi_filter_use_operation (GstVaapiFilter * filter, GstVaapiFilterOp op);
204 gst_vaapi_filter_set_operation (GstVaapiFilter * filter, GstVaapiFilterOp op,
205 const GValue * value);
208 gst_vaapi_filter_process (GstVaapiFilter * filter,
209 GstVaapiSurface * src_surface, GstVaapiSurface * dst_surface, guint flags);
212 gst_vaapi_filter_get_formats (GstVaapiFilter * filter);
215 gst_vaapi_filter_set_format (GstVaapiFilter * filter, GstVideoFormat format);
218 gst_vaapi_filter_append_caps (GstVaapiFilter * filter, GstStructure * structure);
221 gst_vaapi_filter_set_cropping_rectangle (GstVaapiFilter * filter,
222 const GstVaapiRectangle * rect);
225 gst_vaapi_filter_set_target_rectangle (GstVaapiFilter * filter,
226 const GstVaapiRectangle * rect);
229 gst_vaapi_filter_set_denoising_level (GstVaapiFilter * filter, gfloat level);
232 gst_vaapi_filter_set_sharpening_level (GstVaapiFilter * filter, gfloat level);
235 gst_vaapi_filter_set_hue (GstVaapiFilter * filter, gfloat value);
238 gst_vaapi_filter_set_saturation (GstVaapiFilter * filter, gfloat value);
241 gst_vaapi_filter_set_brightness (GstVaapiFilter * filter, gfloat value);
244 gst_vaapi_filter_set_contrast (GstVaapiFilter * filter, gfloat value);
247 gst_vaapi_filter_set_deinterlacing (GstVaapiFilter * filter,
248 GstVaapiDeinterlaceMethod method, guint flags);
251 gst_vaapi_filter_set_deinterlacing_references (GstVaapiFilter * filter,
252 GstVaapiSurface ** forward_references, guint num_forward_references,
253 GstVaapiSurface ** backward_references, guint num_backward_references);
256 gst_vaapi_filter_set_scaling (GstVaapiFilter * filter,
257 GstVaapiScaleMethod method);
260 gst_vaapi_filter_set_video_direction (GstVaapiFilter * filter,
261 GstVideoOrientationMethod method);
263 GstVideoOrientationMethod
264 gst_vaapi_filter_get_video_direction (GstVaapiFilter * filter);
266 #ifndef GST_REMOVE_DEPRECATED
268 gst_vaapi_filter_set_skintone (GstVaapiFilter * filter,
273 gst_vaapi_filter_set_skintone_level (GstVaapiFilter * filter, guint value);
276 gst_vaapi_filter_get_denoising_level_default (GstVaapiFilter * filter);
279 gst_vaapi_filter_get_sharpening_level_default (GstVaapiFilter * filter);
282 gst_vaapi_filter_get_hue_default (GstVaapiFilter * filter);
285 gst_vaapi_filter_get_saturation_default (GstVaapiFilter * filter);
288 gst_vaapi_filter_get_brightness_default (GstVaapiFilter * filter);
291 gst_vaapi_filter_get_contrast_default (GstVaapiFilter * filter);
294 gst_vaapi_filter_get_scaling_default (GstVaapiFilter * filter);
296 GstVideoOrientationMethod
297 gst_vaapi_filter_get_video_direction_default (GstVaapiFilter * filter);
299 #ifndef GST_REMOVE_DEPRECATED
301 gst_vaapi_filter_get_skintone_default (GstVaapiFilter * filter);
305 gst_vaapi_filter_get_skintone_level_default (GstVaapiFilter * filter);
307 #ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC
308 G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstVaapiFilter, gst_object_unref)
311 #endif /* GST_VAAPI_FILTER_H */