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__
24 #include <gst/video/video-prelude.h>
28 typedef struct _GstVideoResampler GstVideoResampler;
31 * GstVideoResamplerMethod:
32 * @GST_VIDEO_RESAMPLER_METHOD_NEAREST: Duplicates the samples when
33 * upsampling and drops when downsampling
34 * @GST_VIDEO_RESAMPLER_METHOD_LINEAR: Uses linear interpolation to reconstruct
35 * missing samples and averaging to downsample
36 * @GST_VIDEO_RESAMPLER_METHOD_CUBIC: Uses cubic interpolation
37 * @GST_VIDEO_RESAMPLER_METHOD_SINC: Uses sinc interpolation
38 * @GST_VIDEO_RESAMPLER_METHOD_LANCZOS: Uses lanczos interpolation
40 * Different subsampling and upsampling methods
45 GST_VIDEO_RESAMPLER_METHOD_NEAREST,
46 GST_VIDEO_RESAMPLER_METHOD_LINEAR,
47 GST_VIDEO_RESAMPLER_METHOD_CUBIC,
48 GST_VIDEO_RESAMPLER_METHOD_SINC,
49 GST_VIDEO_RESAMPLER_METHOD_LANCZOS
50 } GstVideoResamplerMethod;
53 * GST_VIDEO_RESAMPLER_OPT_CUBIC_B:
55 * G_TYPE_DOUBLE, B parameter of the cubic filter. The B
56 * parameter controls the bluriness. Values between 0.0 and
57 * 2.0 are accepted. 1/3 is the default.
59 * Below are some values of popular filters:
65 * Robidoux 0.3782 0.3109
71 #define GST_VIDEO_RESAMPLER_OPT_CUBIC_B "GstVideoResampler.cubic-b"
73 * GST_VIDEO_RESAMPLER_OPT_CUBIC_C:
75 * G_TYPE_DOUBLE, C parameter of the cubic filter. The C
76 * parameter controls the Keys alpha value. Values between 0.0 and
77 * 2.0 are accepted. 1/3 is the default.
79 * See #GST_VIDEO_RESAMPLER_OPT_CUBIC_B for some more common values
81 #define GST_VIDEO_RESAMPLER_OPT_CUBIC_C "GstVideoResampler.cubic-c"
84 * GST_VIDEO_RESAMPLER_OPT_ENVELOPE:
86 * G_TYPE_DOUBLE, specifies the size of filter envelope for
87 * @GST_VIDEO_RESAMPLER_METHOD_LANCZOS. values are clamped between
88 * 1.0 and 5.0. 2.0 is the default.
90 #define GST_VIDEO_RESAMPLER_OPT_ENVELOPE "GstVideoResampler.envelope"
93 * GST_VIDEO_RESAMPLER_OPT_SHARPNESS:
95 * G_TYPE_DOUBLE, specifies sharpness of the filter for
96 * @GST_VIDEO_RESAMPLER_METHOD_LANCZOS. values are clamped between
97 * 0.5 and 1.5. 1.0 is the default.
99 #define GST_VIDEO_RESAMPLER_OPT_SHARPNESS "GstVideoResampler.sharpness"
102 * GST_VIDEO_RESAMPLER_OPT_SHARPEN:
104 * G_TYPE_DOUBLE, specifies sharpening of the filter for
105 * @GST_VIDEO_RESAMPLER_METHOD_LANCZOS. values are clamped between
106 * 0.0 and 1.0. 0.0 is the default.
108 #define GST_VIDEO_RESAMPLER_OPT_SHARPEN "GstVideoResampler.sharpen"
110 * GST_VIDEO_RESAMPLER_OPT_MAX_TAPS:
112 * G_TYPE_INT, limits the maximum number of taps to use.
115 #define GST_VIDEO_RESAMPLER_OPT_MAX_TAPS "GstVideoResampler.max-taps"
118 * GstVideoResamplerFlags:
119 * @GST_VIDEO_RESAMPLER_FLAG_NONE: no flags
120 * @GST_VIDEO_RESAMPLER_FLAG_HALF_TAPS: when no taps are given, half the
121 * number of calculated taps. This can be used when making scalers
122 * for the different fields of an interlaced picture. Since 1.10
124 * Different resampler flags.
129 GST_VIDEO_RESAMPLER_FLAG_NONE = (0),
130 GST_VIDEO_RESAMPLER_FLAG_HALF_TAPS = (1 << 0),
131 } GstVideoResamplerFlags;
135 * @in_size: the input size
136 * @out_size: the output size
137 * @max_taps: the maximum number of taps
138 * @n_phases: the number of phases
139 * @offset: array with the source offset for each output element
140 * @phase: array with the phase to use for each output element
141 * @n_taps: array with new number of taps for each phase
142 * @taps: the taps for all phases
144 * A structure holding resampler information.
148 struct _GstVideoResampler
160 gpointer _gst_reserved[GST_PADDING];
165 gboolean gst_video_resampler_init (GstVideoResampler *resampler,
166 GstVideoResamplerMethod method,
167 GstVideoResamplerFlags flags,
168 guint n_phases, guint n_taps,
170 guint in_size, guint out_size,
171 GstStructure *options);
174 void gst_video_resampler_clear (GstVideoResampler *resampler);
178 #endif /* __GST_VIDEO_RESAMPLER_H__ */