|
Packit |
971217 |
/* GStreamer
|
|
Packit |
971217 |
* Copyright (C) <2014> Wim Taymans <wim.taymans@gmail.com>
|
|
Packit |
971217 |
*
|
|
Packit |
971217 |
* This library is free software; you can redistribute it and/or
|
|
Packit |
971217 |
* modify it under the terms of the GNU Library General Public
|
|
Packit |
971217 |
* License as published by the Free Software Foundation; either
|
|
Packit |
971217 |
* version 2 of the License, or (at your option) any later version.
|
|
Packit |
971217 |
*
|
|
Packit |
971217 |
* This library is distributed in the hope that it will be useful,
|
|
Packit |
971217 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit |
971217 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Packit |
971217 |
* Library General Public License for more details.
|
|
Packit |
971217 |
*
|
|
Packit |
971217 |
* You should have received a copy of the GNU Library General Public
|
|
Packit |
971217 |
* License along with this library; if not, write to the
|
|
Packit |
971217 |
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
|
Packit |
971217 |
* Boston, MA 02110-1301, USA.
|
|
Packit |
971217 |
*/
|
|
Packit |
971217 |
|
|
Packit |
971217 |
#ifndef __GST_VIDEO_RESAMPLER_H__
|
|
Packit |
971217 |
#define __GST_VIDEO_RESAMPLER_H__
|
|
Packit |
971217 |
|
|
Packit |
971217 |
#include <gst/gst.h>
|
|
Packit |
971217 |
#include <gst/video/video-prelude.h>
|
|
Packit |
971217 |
|
|
Packit |
971217 |
G_BEGIN_DECLS
|
|
Packit |
971217 |
|
|
Packit |
971217 |
typedef struct _GstVideoResampler GstVideoResampler;
|
|
Packit |
971217 |
|
|
Packit |
971217 |
/**
|
|
Packit |
971217 |
* GstVideoResamplerMethod:
|
|
Packit |
971217 |
* @GST_VIDEO_RESAMPLER_METHOD_NEAREST: Duplicates the samples when
|
|
Packit |
971217 |
* upsampling and drops when downsampling
|
|
Packit |
971217 |
* @GST_VIDEO_RESAMPLER_METHOD_LINEAR: Uses linear interpolation to reconstruct
|
|
Packit |
971217 |
* missing samples and averaging to downsample
|
|
Packit |
971217 |
* @GST_VIDEO_RESAMPLER_METHOD_CUBIC: Uses cubic interpolation
|
|
Packit |
971217 |
* @GST_VIDEO_RESAMPLER_METHOD_SINC: Uses sinc interpolation
|
|
Packit |
971217 |
* @GST_VIDEO_RESAMPLER_METHOD_LANCZOS: Uses lanczos interpolation
|
|
Packit |
971217 |
*
|
|
Packit |
971217 |
* Different subsampling and upsampling methods
|
|
Packit |
971217 |
*
|
|
Packit |
971217 |
* Since: 1.6
|
|
Packit |
971217 |
*/
|
|
Packit |
971217 |
typedef enum {
|
|
Packit |
971217 |
GST_VIDEO_RESAMPLER_METHOD_NEAREST,
|
|
Packit |
971217 |
GST_VIDEO_RESAMPLER_METHOD_LINEAR,
|
|
Packit |
971217 |
GST_VIDEO_RESAMPLER_METHOD_CUBIC,
|
|
Packit |
971217 |
GST_VIDEO_RESAMPLER_METHOD_SINC,
|
|
Packit |
971217 |
GST_VIDEO_RESAMPLER_METHOD_LANCZOS
|
|
Packit |
971217 |
} GstVideoResamplerMethod;
|
|
Packit |
971217 |
|
|
Packit |
971217 |
/**
|
|
Packit |
971217 |
* GST_VIDEO_RESAMPLER_OPT_CUBIC_B:
|
|
Packit |
971217 |
*
|
|
Packit |
971217 |
* G_TYPE_DOUBLE, B parameter of the cubic filter. The B
|
|
Packit |
971217 |
* parameter controls the bluriness. Values between 0.0 and
|
|
Packit |
971217 |
* 2.0 are accepted. 1/3 is the default.
|
|
Packit |
971217 |
*
|
|
Packit |
971217 |
* Below are some values of popular filters:
|
|
Packit |
971217 |
* B C
|
|
Packit |
971217 |
* Hermite 0.0 0.0
|
|
Packit |
971217 |
* Spline 1.0 0.0
|
|
Packit |
971217 |
* Catmull-Rom 0.0 1/2
|
|
Packit |
971217 |
* Mitchell 1/3 1/3
|
|
Packit |
971217 |
* Robidoux 0.3782 0.3109
|
|
Packit |
971217 |
* Robidoux
|
|
Packit |
971217 |
* Sharp 0.2620 0.3690
|
|
Packit |
971217 |
* Robidoux
|
|
Packit |
971217 |
* Soft 0.6796 0.1602
|
|
Packit |
971217 |
*/
|
|
Packit |
971217 |
#define GST_VIDEO_RESAMPLER_OPT_CUBIC_B "GstVideoResampler.cubic-b"
|
|
Packit |
971217 |
/**
|
|
Packit |
971217 |
* GST_VIDEO_RESAMPLER_OPT_CUBIC_C:
|
|
Packit |
971217 |
*
|
|
Packit |
971217 |
* G_TYPE_DOUBLE, C parameter of the cubic filter. The C
|
|
Packit |
971217 |
* parameter controls the Keys alpha value. Values between 0.0 and
|
|
Packit |
971217 |
* 2.0 are accepted. 1/3 is the default.
|
|
Packit |
971217 |
*
|
|
Packit |
971217 |
* See #GST_VIDEO_RESAMPLER_OPT_CUBIC_B for some more common values
|
|
Packit |
971217 |
*/
|
|
Packit |
971217 |
#define GST_VIDEO_RESAMPLER_OPT_CUBIC_C "GstVideoResampler.cubic-c"
|
|
Packit |
971217 |
|
|
Packit |
971217 |
/**
|
|
Packit |
971217 |
* GST_VIDEO_RESAMPLER_OPT_ENVELOPE:
|
|
Packit |
971217 |
*
|
|
Packit |
971217 |
* G_TYPE_DOUBLE, specifies the size of filter envelope for
|
|
Packit |
971217 |
* @GST_VIDEO_RESAMPLER_METHOD_LANCZOS. values are clamped between
|
|
Packit |
971217 |
* 1.0 and 5.0. 2.0 is the default.
|
|
Packit |
971217 |
*/
|
|
Packit |
971217 |
#define GST_VIDEO_RESAMPLER_OPT_ENVELOPE "GstVideoResampler.envelope"
|
|
Packit |
971217 |
|
|
Packit |
971217 |
/**
|
|
Packit |
971217 |
* GST_VIDEO_RESAMPLER_OPT_SHARPNESS:
|
|
Packit |
971217 |
*
|
|
Packit |
971217 |
* G_TYPE_DOUBLE, specifies sharpness of the filter for
|
|
Packit |
971217 |
* @GST_VIDEO_RESAMPLER_METHOD_LANCZOS. values are clamped between
|
|
Packit |
971217 |
* 0.5 and 1.5. 1.0 is the default.
|
|
Packit |
971217 |
*/
|
|
Packit |
971217 |
#define GST_VIDEO_RESAMPLER_OPT_SHARPNESS "GstVideoResampler.sharpness"
|
|
Packit |
971217 |
|
|
Packit |
971217 |
/**
|
|
Packit |
971217 |
* GST_VIDEO_RESAMPLER_OPT_SHARPEN:
|
|
Packit |
971217 |
*
|
|
Packit |
971217 |
* G_TYPE_DOUBLE, specifies sharpening of the filter for
|
|
Packit |
971217 |
* @GST_VIDEO_RESAMPLER_METHOD_LANCZOS. values are clamped between
|
|
Packit |
971217 |
* 0.0 and 1.0. 0.0 is the default.
|
|
Packit |
971217 |
*/
|
|
Packit |
971217 |
#define GST_VIDEO_RESAMPLER_OPT_SHARPEN "GstVideoResampler.sharpen"
|
|
Packit |
971217 |
/**
|
|
Packit |
971217 |
* GST_VIDEO_RESAMPLER_OPT_MAX_TAPS:
|
|
Packit |
971217 |
*
|
|
Packit |
971217 |
* G_TYPE_INT, limits the maximum number of taps to use.
|
|
Packit |
971217 |
* 16 is the default.
|
|
Packit |
971217 |
*/
|
|
Packit |
971217 |
#define GST_VIDEO_RESAMPLER_OPT_MAX_TAPS "GstVideoResampler.max-taps"
|
|
Packit |
971217 |
|
|
Packit |
971217 |
/**
|
|
Packit |
971217 |
* GstVideoResamplerFlags:
|
|
Packit |
971217 |
* @GST_VIDEO_RESAMPLER_FLAG_NONE: no flags
|
|
Packit |
971217 |
* @GST_VIDEO_RESAMPLER_FLAG_HALF_TAPS: when no taps are given, half the
|
|
Packit |
971217 |
* number of calculated taps. This can be used when making scalers
|
|
Packit |
971217 |
* for the different fields of an interlaced picture. Since 1.10
|
|
Packit |
971217 |
*
|
|
Packit |
971217 |
* Different resampler flags.
|
|
Packit |
971217 |
*
|
|
Packit |
971217 |
* Since: 1.6
|
|
Packit |
971217 |
*/
|
|
Packit |
971217 |
typedef enum {
|
|
Packit |
971217 |
GST_VIDEO_RESAMPLER_FLAG_NONE = (0),
|
|
Packit |
971217 |
GST_VIDEO_RESAMPLER_FLAG_HALF_TAPS = (1 << 0),
|
|
Packit |
971217 |
} GstVideoResamplerFlags;
|
|
Packit |
971217 |
|
|
Packit |
971217 |
/**
|
|
Packit |
971217 |
* GstVideoResampler:
|
|
Packit |
971217 |
* @in_size: the input size
|
|
Packit |
971217 |
* @out_size: the output size
|
|
Packit |
971217 |
* @max_taps: the maximum number of taps
|
|
Packit |
971217 |
* @n_phases: the number of phases
|
|
Packit |
971217 |
* @offset: array with the source offset for each output element
|
|
Packit |
971217 |
* @phase: array with the phase to use for each output element
|
|
Packit |
971217 |
* @n_taps: array with new number of taps for each phase
|
|
Packit |
971217 |
* @taps: the taps for all phases
|
|
Packit |
971217 |
*
|
|
Packit |
971217 |
* A structure holding resampler information.
|
|
Packit |
971217 |
*
|
|
Packit |
971217 |
* Since: 1.6
|
|
Packit |
971217 |
*/
|
|
Packit |
971217 |
struct _GstVideoResampler
|
|
Packit |
971217 |
{
|
|
Packit |
971217 |
gint in_size;
|
|
Packit |
971217 |
gint out_size;
|
|
Packit |
971217 |
guint max_taps;
|
|
Packit |
971217 |
guint n_phases;
|
|
Packit |
971217 |
guint32 *offset;
|
|
Packit |
971217 |
guint32 *phase;
|
|
Packit |
971217 |
guint32 *n_taps;
|
|
Packit |
971217 |
gdouble *taps;
|
|
Packit |
971217 |
|
|
Packit |
971217 |
/*< private >*/
|
|
Packit |
971217 |
gpointer _gst_reserved[GST_PADDING];
|
|
Packit |
971217 |
};
|
|
Packit |
971217 |
|
|
Packit |
971217 |
|
|
Packit |
971217 |
GST_VIDEO_API
|
|
Packit |
971217 |
gboolean gst_video_resampler_init (GstVideoResampler *resampler,
|
|
Packit |
971217 |
GstVideoResamplerMethod method,
|
|
Packit |
971217 |
GstVideoResamplerFlags flags,
|
|
Packit |
971217 |
guint n_phases, guint n_taps,
|
|
Packit |
971217 |
gdouble shift,
|
|
Packit |
971217 |
guint in_size, guint out_size,
|
|
Packit |
971217 |
GstStructure *options);
|
|
Packit |
971217 |
|
|
Packit |
971217 |
GST_VIDEO_API
|
|
Packit |
971217 |
void gst_video_resampler_clear (GstVideoResampler *resampler);
|
|
Packit |
971217 |
|
|
Packit |
971217 |
G_END_DECLS
|
|
Packit |
971217 |
|
|
Packit |
971217 |
#endif /* __GST_VIDEO_RESAMPLER_H__ */
|