2 * Copyright (C) <2014> Wim Taymans <wim.taymans@gmail.com>
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details.
14 * You should have received a copy of the GNU Library General Public
15 * License along with this library; if not, write to the
16 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
20 #ifndef __GST_VIDEO_RESAMPLER_H__
21 #define __GST_VIDEO_RESAMPLER_H__
27 typedef struct _GstVideoResampler GstVideoResampler;
30 * GstVideoResamplerMethod:
31 * @GST_VIDEO_RESAMPLER_METHOD_NEAREST: Duplicates the samples when
32 * upsampling and drops when downsampling
33 * @GST_VIDEO_RESAMPLER_METHOD_LINEAR: Uses linear interpolation to reconstruct
34 * missing samples and averaging to downsample
35 * @GST_VIDEO_RESAMPLER_METHOD_CUBIC: Uses cubic interpolation
36 * @GST_VIDEO_RESAMPLER_METHOD_SINC: Uses sinc interpolation
37 * @GST_VIDEO_RESAMPLER_METHOD_LANCZOS: Uses lanczos interpolation
39 * Different subsampling and upsampling methods
44 GST_VIDEO_RESAMPLER_METHOD_NEAREST,
45 GST_VIDEO_RESAMPLER_METHOD_LINEAR,
46 GST_VIDEO_RESAMPLER_METHOD_CUBIC,
47 GST_VIDEO_RESAMPLER_METHOD_SINC,
48 GST_VIDEO_RESAMPLER_METHOD_LANCZOS
49 } GstVideoResamplerMethod;
52 * GST_VIDEO_RESAMPLER_OPT_CUBIC_B:
54 * G_TYPE_DOUBLE, B parameter of the cubic filter. The B
55 * parameter controls the bluriness. Values between 0.0 and
56 * 2.0 are accepted. 1/3 is the default.
58 * Below are some values of popular filters:
64 * Robidoux 0.3782 0.3109
70 #define GST_VIDEO_RESAMPLER_OPT_CUBIC_B "GstVideoResampler.cubic-b"
72 * GST_VIDEO_RESAMPLER_OPT_CUBIC_C:
74 * G_TYPE_DOUBLE, C parameter of the cubic filter. The C
75 * parameter controls the Keys alpha value. Values between 0.0 and
76 * 2.0 are accepted. 1/3 is the default.
78 * See #GST_VIDEO_RESAMPLER_OPT_CUBIC_B for some more common values
80 #define GST_VIDEO_RESAMPLER_OPT_CUBIC_C "GstVideoResampler.cubic-c"
83 * GST_VIDEO_RESAMPLER_OPT_ENVELOPE:
85 * G_TYPE_DOUBLE, specifies the size of filter envelope for
86 * @GST_VIDEO_RESAMPLER_METHOD_LANCZOS. values are clamped between
87 * 1.0 and 5.0. 2.0 is the default.
89 #define GST_VIDEO_RESAMPLER_OPT_ENVELOPE "GstVideoResampler.envelope"
92 * GST_VIDEO_RESAMPLER_OPT_SHARPNESS:
94 * G_TYPE_DOUBLE, specifies sharpness of the filter for
95 * @GST_VIDEO_RESAMPLER_METHOD_LANCZOS. values are clamped between
96 * 0.5 and 1.5. 1.0 is the default.
98 #define GST_VIDEO_RESAMPLER_OPT_SHARPNESS "GstVideoResampler.sharpness"
101 * GST_VIDEO_RESAMPLER_OPT_SHARPEN:
103 * G_TYPE_DOUBLE, specifies sharpening of the filter for
104 * @GST_VIDEO_RESAMPLER_METHOD_LANCZOS. values are clamped between
105 * 0.0 and 1.0. 0.0 is the default.
107 #define GST_VIDEO_RESAMPLER_OPT_SHARPEN "GstVideoResampler.sharpen"
109 * GST_VIDEO_RESAMPLER_OPT_MAX_TAPS:
111 * G_TYPE_INT, limits the maximum number of taps to use.
114 #define GST_VIDEO_RESAMPLER_OPT_MAX_TAPS "GstVideoResampler.max-taps"
117 * GstVideoResamplerFlags:
118 * @GST_VIDEO_RESAMPLER_FLAG_NONE: no flags
119 * @GST_VIDEO_RESAMPLER_FLAG_HALF_TAPS: when no taps are given, half the
120 * number of calculated taps. This can be used when making scalers
121 * for the different fields of an interlaced picture. Since 1.10
123 * Different resampler flags.
128 GST_VIDEO_RESAMPLER_FLAG_NONE = (0),
129 GST_VIDEO_RESAMPLER_FLAG_HALF_TAPS = (1 << 0),
130 } GstVideoResamplerFlags;
134 * @in_size: the input size
135 * @out_size: the output size
136 * @max_taps: the maximum number of taps
137 * @n_phases: the number of phases
138 * @offset: array with the source offset for each output element
139 * @phase: array with the phase to use for each output element
140 * @n_taps: array with new number of taps for each phase
141 * @taps: the taps for all phases
143 * A structure holding resampler information.
147 struct _GstVideoResampler
159 gpointer _gst_reserved[GST_PADDING];
164 gboolean gst_video_resampler_init (GstVideoResampler *resampler,
165 GstVideoResamplerMethod method,
166 GstVideoResamplerFlags flags,
167 guint n_phases, guint n_taps,
169 guint in_size, guint out_size,
170 GstStructure *options);
173 void gst_video_resampler_clear (GstVideoResampler *resampler);
177 #endif /* __GST_VIDEO_RESAMPLER_H__ */