2014-10-24 11:01:12 +00:00
|
|
|
/* GStreamer
|
|
|
|
* Copyright (C) <2014> Wim Taymans <wim.taymans@gmail.com>
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Library General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 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
|
|
|
|
* Library General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
|
|
|
* License along with this library; if not, write to the
|
|
|
|
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
|
|
|
* Boston, MA 02110-1301, USA.
|
|
|
|
*/
|
|
|
|
|
2014-10-30 10:43:52 +00:00
|
|
|
#ifndef __GST_VIDEO_RESAMPLER_H__
|
|
|
|
#define __GST_VIDEO_RESAMPLER_H__
|
2014-10-24 11:01:12 +00:00
|
|
|
|
|
|
|
#include <gst/gst.h>
|
2018-03-13 11:48:31 +00:00
|
|
|
#include <gst/video/video-prelude.h>
|
2014-10-24 11:01:12 +00:00
|
|
|
|
|
|
|
G_BEGIN_DECLS
|
|
|
|
|
2014-10-30 10:43:52 +00:00
|
|
|
typedef struct _GstVideoResampler GstVideoResampler;
|
2014-10-24 11:01:12 +00:00
|
|
|
|
|
|
|
/**
|
2014-10-30 10:43:52 +00:00
|
|
|
* GstVideoResamplerMethod:
|
|
|
|
* @GST_VIDEO_RESAMPLER_METHOD_NEAREST: Duplicates the samples when
|
2014-10-24 11:01:12 +00:00
|
|
|
* upsampling and drops when downsampling
|
2014-10-30 10:43:52 +00:00
|
|
|
* @GST_VIDEO_RESAMPLER_METHOD_LINEAR: Uses linear interpolation to reconstruct
|
2014-10-24 11:01:12 +00:00
|
|
|
* missing samples and averaging to downsample
|
2014-10-30 10:43:52 +00:00
|
|
|
* @GST_VIDEO_RESAMPLER_METHOD_CUBIC: Uses cubic interpolation
|
|
|
|
* @GST_VIDEO_RESAMPLER_METHOD_SINC: Uses sinc interpolation
|
|
|
|
* @GST_VIDEO_RESAMPLER_METHOD_LANCZOS: Uses lanczos interpolation
|
2014-10-24 11:01:12 +00:00
|
|
|
*
|
|
|
|
* Different subsampling and upsampling methods
|
|
|
|
*
|
|
|
|
* Since: 1.6
|
|
|
|
*/
|
|
|
|
typedef enum {
|
2014-10-30 10:43:52 +00:00
|
|
|
GST_VIDEO_RESAMPLER_METHOD_NEAREST,
|
|
|
|
GST_VIDEO_RESAMPLER_METHOD_LINEAR,
|
|
|
|
GST_VIDEO_RESAMPLER_METHOD_CUBIC,
|
|
|
|
GST_VIDEO_RESAMPLER_METHOD_SINC,
|
2015-05-08 11:57:03 +00:00
|
|
|
GST_VIDEO_RESAMPLER_METHOD_LANCZOS
|
2014-10-30 10:43:52 +00:00
|
|
|
} GstVideoResamplerMethod;
|
2014-10-24 11:01:12 +00:00
|
|
|
|
2014-10-26 04:58:56 +00:00
|
|
|
/**
|
2014-10-30 10:43:52 +00:00
|
|
|
* GST_VIDEO_RESAMPLER_OPT_CUBIC_B:
|
2014-10-26 04:58:56 +00:00
|
|
|
*
|
|
|
|
* G_TYPE_DOUBLE, B parameter of the cubic filter. The B
|
|
|
|
* parameter controls the bluriness. Values between 0.0 and
|
|
|
|
* 2.0 are accepted. 1/3 is the default.
|
|
|
|
*
|
|
|
|
* Below are some values of popular filters:
|
|
|
|
* B C
|
|
|
|
* Hermite 0.0 0.0
|
|
|
|
* Spline 1.0 0.0
|
|
|
|
* Catmull-Rom 0.0 1/2
|
|
|
|
* Mitchell 1/3 1/3
|
|
|
|
* Robidoux 0.3782 0.3109
|
|
|
|
* Robidoux
|
|
|
|
* Sharp 0.2620 0.3690
|
|
|
|
* Robidoux
|
|
|
|
* Soft 0.6796 0.1602
|
|
|
|
*/
|
2014-10-30 10:43:52 +00:00
|
|
|
#define GST_VIDEO_RESAMPLER_OPT_CUBIC_B "GstVideoResampler.cubic-b"
|
2014-10-26 04:58:56 +00:00
|
|
|
/**
|
2014-10-30 10:43:52 +00:00
|
|
|
* GST_VIDEO_RESAMPLER_OPT_CUBIC_C:
|
2014-10-26 04:58:56 +00:00
|
|
|
*
|
|
|
|
* G_TYPE_DOUBLE, C parameter of the cubic filter. The C
|
|
|
|
* parameter controls the Keys alpha value. Values between 0.0 and
|
|
|
|
* 2.0 are accepted. 1/3 is the default.
|
|
|
|
*
|
2014-10-30 10:43:52 +00:00
|
|
|
* See #GST_VIDEO_RESAMPLER_OPT_CUBIC_B for some more common values
|
2014-10-26 04:58:56 +00:00
|
|
|
*/
|
2014-10-30 10:43:52 +00:00
|
|
|
#define GST_VIDEO_RESAMPLER_OPT_CUBIC_C "GstVideoResampler.cubic-c"
|
2014-10-26 04:58:56 +00:00
|
|
|
|
2014-10-24 14:23:53 +00:00
|
|
|
/**
|
2014-10-30 10:43:52 +00:00
|
|
|
* GST_VIDEO_RESAMPLER_OPT_ENVELOPE:
|
2014-10-24 14:23:53 +00:00
|
|
|
*
|
|
|
|
* G_TYPE_DOUBLE, specifies the size of filter envelope for
|
2014-10-30 10:43:52 +00:00
|
|
|
* @GST_VIDEO_RESAMPLER_METHOD_LANCZOS. values are clamped between
|
2014-10-24 14:23:53 +00:00
|
|
|
* 1.0 and 5.0. 2.0 is the default.
|
|
|
|
*/
|
2014-10-30 10:43:52 +00:00
|
|
|
#define GST_VIDEO_RESAMPLER_OPT_ENVELOPE "GstVideoResampler.envelope"
|
2014-10-24 14:23:53 +00:00
|
|
|
|
|
|
|
/**
|
2014-10-30 10:43:52 +00:00
|
|
|
* GST_VIDEO_RESAMPLER_OPT_SHARPNESS:
|
2014-10-24 14:23:53 +00:00
|
|
|
*
|
|
|
|
* G_TYPE_DOUBLE, specifies sharpness of the filter for
|
2014-10-30 10:43:52 +00:00
|
|
|
* @GST_VIDEO_RESAMPLER_METHOD_LANCZOS. values are clamped between
|
2014-10-24 14:23:53 +00:00
|
|
|
* 0.5 and 1.5. 1.0 is the default.
|
|
|
|
*/
|
2014-10-30 10:43:52 +00:00
|
|
|
#define GST_VIDEO_RESAMPLER_OPT_SHARPNESS "GstVideoResampler.sharpness"
|
2014-10-24 14:23:53 +00:00
|
|
|
|
|
|
|
/**
|
2014-10-30 10:43:52 +00:00
|
|
|
* GST_VIDEO_RESAMPLER_OPT_SHARPEN:
|
2014-10-24 14:23:53 +00:00
|
|
|
*
|
|
|
|
* G_TYPE_DOUBLE, specifies sharpening of the filter for
|
2014-10-30 10:43:52 +00:00
|
|
|
* @GST_VIDEO_RESAMPLER_METHOD_LANCZOS. values are clamped between
|
2014-10-24 14:23:53 +00:00
|
|
|
* 0.0 and 1.0. 0.0 is the default.
|
|
|
|
*/
|
2014-10-30 10:43:52 +00:00
|
|
|
#define GST_VIDEO_RESAMPLER_OPT_SHARPEN "GstVideoResampler.sharpen"
|
2014-11-21 10:12:50 +00:00
|
|
|
/**
|
|
|
|
* GST_VIDEO_RESAMPLER_OPT_MAX_TAPS:
|
|
|
|
*
|
|
|
|
* G_TYPE_INT, limits the maximum number of taps to use.
|
|
|
|
* 16 is the default.
|
|
|
|
*/
|
|
|
|
#define GST_VIDEO_RESAMPLER_OPT_MAX_TAPS "GstVideoResampler.max-taps"
|
2014-10-24 14:23:53 +00:00
|
|
|
|
2014-10-24 11:01:12 +00:00
|
|
|
/**
|
2014-10-30 10:43:52 +00:00
|
|
|
* GstVideoResamplerFlags:
|
|
|
|
* @GST_VIDEO_RESAMPLER_FLAG_NONE: no flags
|
2016-06-22 14:02:37 +00:00
|
|
|
* @GST_VIDEO_RESAMPLER_FLAG_HALF_TAPS: when no taps are given, half the
|
|
|
|
* number of calculated taps. This can be used when making scalers
|
|
|
|
* for the different fields of an interlaced picture. Since 1.10
|
2014-10-24 11:01:12 +00:00
|
|
|
*
|
|
|
|
* Different resampler flags.
|
|
|
|
*
|
|
|
|
* Since: 1.6
|
|
|
|
*/
|
|
|
|
typedef enum {
|
2014-10-30 10:43:52 +00:00
|
|
|
GST_VIDEO_RESAMPLER_FLAG_NONE = (0),
|
2016-06-22 14:02:37 +00:00
|
|
|
GST_VIDEO_RESAMPLER_FLAG_HALF_TAPS = (1 << 0),
|
2014-10-30 10:43:52 +00:00
|
|
|
} GstVideoResamplerFlags;
|
2014-10-24 11:01:12 +00:00
|
|
|
|
|
|
|
/**
|
2014-10-30 10:43:52 +00:00
|
|
|
* GstVideoResampler:
|
2014-10-24 11:01:12 +00:00
|
|
|
* @in_size: the input size
|
|
|
|
* @out_size: the output size
|
|
|
|
* @max_taps: the maximum number of taps
|
|
|
|
* @n_phases: the number of phases
|
|
|
|
* @offset: array with the source offset for each output element
|
|
|
|
* @phase: array with the phase to use for each output element
|
|
|
|
* @n_taps: array with new number of taps for each phase
|
|
|
|
* @taps: the taps for all phases
|
|
|
|
*
|
|
|
|
* A structure holding resampler information.
|
|
|
|
*
|
|
|
|
* Since: 1.6
|
|
|
|
*/
|
2014-10-30 10:43:52 +00:00
|
|
|
struct _GstVideoResampler
|
2014-10-24 11:01:12 +00:00
|
|
|
{
|
|
|
|
gint in_size;
|
|
|
|
gint out_size;
|
|
|
|
guint max_taps;
|
|
|
|
guint n_phases;
|
2014-10-29 12:17:39 +00:00
|
|
|
guint32 *offset;
|
|
|
|
guint32 *phase;
|
|
|
|
guint32 *n_taps;
|
2014-10-24 11:01:12 +00:00
|
|
|
gdouble *taps;
|
|
|
|
|
2015-03-12 14:06:57 +00:00
|
|
|
/*< private >*/
|
2014-10-24 11:01:12 +00:00
|
|
|
gpointer _gst_reserved[GST_PADDING];
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2018-03-13 11:48:31 +00:00
|
|
|
GST_VIDEO_API
|
2014-10-30 10:43:52 +00:00
|
|
|
gboolean gst_video_resampler_init (GstVideoResampler *resampler,
|
|
|
|
GstVideoResamplerMethod method,
|
|
|
|
GstVideoResamplerFlags flags,
|
2014-10-24 11:01:12 +00:00
|
|
|
guint n_phases, guint n_taps,
|
|
|
|
gdouble shift,
|
|
|
|
guint in_size, guint out_size,
|
|
|
|
GstStructure *options);
|
|
|
|
|
2018-03-13 11:48:31 +00:00
|
|
|
GST_VIDEO_API
|
2014-10-30 10:43:52 +00:00
|
|
|
void gst_video_resampler_clear (GstVideoResampler *resampler);
|
2014-10-24 11:01:12 +00:00
|
|
|
|
|
|
|
G_END_DECLS
|
|
|
|
|
2014-10-30 10:43:52 +00:00
|
|
|
#endif /* __GST_VIDEO_RESAMPLER_H__ */
|