mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-25 16:48:11 +00:00
video-scaler: rename resampler to video-resampler
Prefix the resampler with video-. It we would like to reuse the resampler for audio later, we can copy/move it and deprecate this one.
This commit is contained in:
parent
daf20d5e09
commit
ca2bd1cc6b
6 changed files with 97 additions and 98 deletions
|
@ -4,7 +4,7 @@ include $(top_srcdir)/common/orc.mak
|
||||||
|
|
||||||
glib_enum_headers = video.h video-format.h video-color.h video-info.h \
|
glib_enum_headers = video.h video-format.h video-color.h video-info.h \
|
||||||
colorbalance.h navigation.h video-chroma.h video-tile.h video-converter.h \
|
colorbalance.h navigation.h video-chroma.h video-tile.h video-converter.h \
|
||||||
resampler.h
|
video-resampler.h
|
||||||
glib_enum_define = GST_VIDEO
|
glib_enum_define = GST_VIDEO
|
||||||
glib_gen_prefix = gst_video
|
glib_gen_prefix = gst_video
|
||||||
glib_gen_basename = video
|
glib_gen_basename = video
|
||||||
|
@ -41,7 +41,7 @@ libgstvideo_@GST_API_VERSION@_la_SOURCES = \
|
||||||
gstvideodecoder.c \
|
gstvideodecoder.c \
|
||||||
gstvideoencoder.c \
|
gstvideoencoder.c \
|
||||||
gstvideoutils.c \
|
gstvideoutils.c \
|
||||||
resampler.c \
|
video-resampler.c \
|
||||||
video-blend.c \
|
video-blend.c \
|
||||||
video-overlay-composition.c
|
video-overlay-composition.c
|
||||||
|
|
||||||
|
@ -71,7 +71,7 @@ libgstvideo_@GST_API_VERSION@include_HEADERS = \
|
||||||
gstvideodecoder.h \
|
gstvideodecoder.h \
|
||||||
gstvideoencoder.h \
|
gstvideoencoder.h \
|
||||||
gstvideoutils.h \
|
gstvideoutils.h \
|
||||||
resampler.h \
|
video-resampler.h \
|
||||||
video-blend.h \
|
video-blend.h \
|
||||||
video-overlay-composition.h
|
video-overlay-composition.h
|
||||||
|
|
||||||
|
|
|
@ -310,9 +310,9 @@ chain_hscale (GstVideoConverter * convert, GstLineCacheNeedLineFunc need_line)
|
||||||
need_line, convert, NULL);
|
need_line, convert, NULL);
|
||||||
|
|
||||||
if (!gst_structure_get_enum (convert->config,
|
if (!gst_structure_get_enum (convert->config,
|
||||||
GST_VIDEO_CONVERTER_OPT_RESAMPLER_METHOD, GST_TYPE_RESAMPLER_METHOD,
|
GST_VIDEO_CONVERTER_OPT_RESAMPLER_METHOD,
|
||||||
&method))
|
GST_TYPE_VIDEO_RESAMPLER_METHOD, &method))
|
||||||
method = GST_RESAMPLER_METHOD_CUBIC;
|
method = GST_VIDEO_RESAMPLER_METHOD_CUBIC;
|
||||||
if (!gst_structure_get_uint (convert->config,
|
if (!gst_structure_get_uint (convert->config,
|
||||||
GST_VIDEO_CONVERTER_OPT_RESAMPLER_TAPS, &taps))
|
GST_VIDEO_CONVERTER_OPT_RESAMPLER_TAPS, &taps))
|
||||||
taps = 0;
|
taps = 0;
|
||||||
|
@ -339,9 +339,9 @@ chain_vscale (GstVideoConverter * convert, GstLineCacheNeedLineFunc need_line)
|
||||||
need_line, convert, NULL);
|
need_line, convert, NULL);
|
||||||
|
|
||||||
if (!gst_structure_get_enum (convert->config,
|
if (!gst_structure_get_enum (convert->config,
|
||||||
GST_VIDEO_CONVERTER_OPT_RESAMPLER_METHOD, GST_TYPE_RESAMPLER_METHOD,
|
GST_VIDEO_CONVERTER_OPT_RESAMPLER_METHOD,
|
||||||
&method))
|
GST_TYPE_VIDEO_RESAMPLER_METHOD, &method))
|
||||||
method = GST_RESAMPLER_METHOD_CUBIC;
|
method = GST_VIDEO_RESAMPLER_METHOD_CUBIC;
|
||||||
if (!gst_structure_get_uint (convert->config,
|
if (!gst_structure_get_uint (convert->config,
|
||||||
GST_VIDEO_CONVERTER_OPT_RESAMPLER_TAPS, &taps))
|
GST_VIDEO_CONVERTER_OPT_RESAMPLER_TAPS, &taps))
|
||||||
taps = 0;
|
taps = 0;
|
||||||
|
@ -1108,10 +1108,10 @@ do_unpack_lines (GstLineCache * cache, gint line, GstVideoConverter * convert)
|
||||||
gpointer tmpline;
|
gpointer tmpline;
|
||||||
guint cline;;
|
guint cline;;
|
||||||
|
|
||||||
tmpline = get_temp_line (convert);
|
|
||||||
cline = CLAMP (line, 0, convert->in_height - 1);
|
cline = CLAMP (line, 0, convert->in_height - 1);
|
||||||
|
|
||||||
GST_DEBUG ("unpack line %d (%u)", line, cline);
|
GST_DEBUG ("unpack line %d (%u)", line, cline);
|
||||||
|
tmpline = get_temp_line (convert);
|
||||||
UNPACK_FRAME (convert->src, tmpline, cline, convert->in_width);
|
UNPACK_FRAME (convert->src, tmpline, cline, convert->in_width);
|
||||||
|
|
||||||
gst_line_cache_add_line (cache, line, tmpline);
|
gst_line_cache_add_line (cache, line, tmpline);
|
||||||
|
|
|
@ -25,14 +25,14 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
#include "resampler.h"
|
#include "video-resampler.h"
|
||||||
|
|
||||||
typedef struct _ResamplerParams ResamplerParams;
|
typedef struct _ResamplerParams ResamplerParams;
|
||||||
|
|
||||||
struct _ResamplerParams
|
struct _ResamplerParams
|
||||||
{
|
{
|
||||||
GstResamplerMethod method;
|
GstVideoResamplerMethod method;
|
||||||
GstResamplerFlags flags;
|
GstVideoResamplerFlags flags;
|
||||||
|
|
||||||
gdouble shift;
|
gdouble shift;
|
||||||
|
|
||||||
|
@ -47,7 +47,7 @@ struct _ResamplerParams
|
||||||
gdouble sharpness;
|
gdouble sharpness;
|
||||||
gdouble sharpen;
|
gdouble sharpen;
|
||||||
|
|
||||||
GstResampler *resampler;
|
GstVideoResampler *resampler;
|
||||||
};
|
};
|
||||||
|
|
||||||
static double
|
static double
|
||||||
|
@ -152,7 +152,7 @@ get_lanczos_tap (ResamplerParams * params, gint l, gint xi, gdouble x)
|
||||||
static void
|
static void
|
||||||
resampler_calculate_taps (ResamplerParams * params)
|
resampler_calculate_taps (ResamplerParams * params)
|
||||||
{
|
{
|
||||||
GstResampler *resampler = params->resampler;
|
GstVideoResampler *resampler = params->resampler;
|
||||||
gint j;
|
gint j;
|
||||||
guint32 *offset, *n_taps, *phase;
|
guint32 *offset, *n_taps, *phase;
|
||||||
gint tap_offs;
|
gint tap_offs;
|
||||||
|
@ -236,10 +236,10 @@ resampler_calculate_taps (ResamplerParams * params)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gst_resampler_new:
|
* gst_video_resampler_new:
|
||||||
* @resampler: a #GstResampler
|
* @resampler: a #GstVideoResampler
|
||||||
* @method: a #GstResamplerMethod
|
* @method: a #GstVideoResamplerMethod
|
||||||
* @flags: #GstResamplerFlags
|
* @flags: #GstVideoResamplerFlags
|
||||||
* @n_phases: number of phases to use
|
* @n_phases: number of phases to use
|
||||||
* @n_taps: number of taps to use
|
* @n_taps: number of taps to use
|
||||||
* @in_size: number of source elements
|
* @in_size: number of source elements
|
||||||
|
@ -258,8 +258,8 @@ resampler_calculate_taps (ResamplerParams * params)
|
||||||
* Since: 1.6
|
* Since: 1.6
|
||||||
*/
|
*/
|
||||||
gboolean
|
gboolean
|
||||||
gst_resampler_init (GstResampler * resampler,
|
gst_video_resampler_init (GstVideoResampler * resampler,
|
||||||
GstResamplerMethod method, GstResamplerFlags flags,
|
GstVideoResamplerMethod method, GstVideoResamplerFlags flags,
|
||||||
guint n_phases, guint n_taps, gdouble shift, guint in_size, guint out_size,
|
guint n_phases, guint n_taps, gdouble shift, guint in_size, guint out_size,
|
||||||
GstStructure * options)
|
GstStructure * options)
|
||||||
{
|
{
|
||||||
|
@ -281,48 +281,48 @@ gst_resampler_init (GstResampler * resampler,
|
||||||
GST_DEBUG ("%d %u %u->%u", method, n_taps, in_size, out_size);
|
GST_DEBUG ("%d %u %u->%u", method, n_taps, in_size, out_size);
|
||||||
|
|
||||||
switch (method) {
|
switch (method) {
|
||||||
case GST_RESAMPLER_METHOD_NEAREST:
|
case GST_VIDEO_RESAMPLER_METHOD_NEAREST:
|
||||||
params.get_tap = get_nearest_tap;
|
params.get_tap = get_nearest_tap;
|
||||||
if (n_taps == 0)
|
if (n_taps == 0)
|
||||||
n_taps = 1;
|
n_taps = 1;
|
||||||
break;
|
break;
|
||||||
case GST_RESAMPLER_METHOD_LINEAR:
|
case GST_VIDEO_RESAMPLER_METHOD_LINEAR:
|
||||||
params.get_tap = get_linear_tap;
|
params.get_tap = get_linear_tap;
|
||||||
if (n_taps == 0)
|
if (n_taps == 0)
|
||||||
n_taps = 2;
|
n_taps = 2;
|
||||||
break;
|
break;
|
||||||
case GST_RESAMPLER_METHOD_CUBIC:
|
case GST_VIDEO_RESAMPLER_METHOD_CUBIC:
|
||||||
if (!options
|
if (!options
|
||||||
|| !gst_structure_get_double (options, GST_RESAMPLER_OPT_CUBIC_B,
|
|| !gst_structure_get_double (options,
|
||||||
¶ms.b))
|
GST_VIDEO_RESAMPLER_OPT_CUBIC_B, ¶ms.b))
|
||||||
params.b = 1.0 / 3.0;
|
params.b = 1.0 / 3.0;
|
||||||
if (!options
|
if (!options
|
||||||
|| !gst_structure_get_double (options, GST_RESAMPLER_OPT_CUBIC_C,
|
|| !gst_structure_get_double (options,
|
||||||
¶ms.c))
|
GST_VIDEO_RESAMPLER_OPT_CUBIC_C, ¶ms.c))
|
||||||
params.c = 1.0 / 3.0;
|
params.c = 1.0 / 3.0;
|
||||||
n_taps = 4;
|
n_taps = 4;
|
||||||
params.get_tap = get_cubic_tap;
|
params.get_tap = get_cubic_tap;
|
||||||
break;
|
break;
|
||||||
case GST_RESAMPLER_METHOD_SINC:
|
case GST_VIDEO_RESAMPLER_METHOD_SINC:
|
||||||
params.get_tap = get_sinc_tap;
|
params.get_tap = get_sinc_tap;
|
||||||
if (n_taps == 0)
|
if (n_taps == 0)
|
||||||
n_taps = 4;
|
n_taps = 4;
|
||||||
break;
|
break;
|
||||||
case GST_RESAMPLER_METHOD_LANCZOS:
|
case GST_VIDEO_RESAMPLER_METHOD_LANCZOS:
|
||||||
{
|
{
|
||||||
gdouble resample_inc = in_size / (gdouble) out_size;
|
gdouble resample_inc = in_size / (gdouble) out_size;
|
||||||
|
|
||||||
if (!options
|
if (!options
|
||||||
|| !gst_structure_get_double (options, GST_RESAMPLER_OPT_ENVELOPE,
|
|| !gst_structure_get_double (options,
|
||||||
¶ms.envelope))
|
GST_VIDEO_RESAMPLER_OPT_ENVELOPE, ¶ms.envelope))
|
||||||
params.envelope = 2.0;
|
params.envelope = 2.0;
|
||||||
if (!options
|
if (!options
|
||||||
|| !gst_structure_get_double (options, GST_RESAMPLER_OPT_SHARPNESS,
|
|| !gst_structure_get_double (options,
|
||||||
¶ms.sharpness))
|
GST_VIDEO_RESAMPLER_OPT_SHARPNESS, ¶ms.sharpness))
|
||||||
params.sharpness = 1.0;
|
params.sharpness = 1.0;
|
||||||
if (!options
|
if (!options
|
||||||
|| !gst_structure_get_double (options, GST_RESAMPLER_OPT_SHARPEN,
|
|| !gst_structure_get_double (options,
|
||||||
¶ms.sharpen))
|
GST_VIDEO_RESAMPLER_OPT_SHARPEN, ¶ms.sharpen))
|
||||||
params.sharpen = 0.0;
|
params.sharpen = 0.0;
|
||||||
|
|
||||||
if (resample_inc > 1.0) {
|
if (resample_inc > 1.0) {
|
||||||
|
@ -379,15 +379,15 @@ gst_resampler_init (GstResampler * resampler,
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gst_resampler_clear:
|
* gst_video_resampler_clear:
|
||||||
* @resampler: a #GstResampler
|
* @resampler: a #GstVideoResampler
|
||||||
*
|
*
|
||||||
* Clear a previously initialized #GstResampler @resampler.
|
* Clear a previously initialized #GstVideoResampler @resampler.
|
||||||
*
|
*
|
||||||
* Since: 1.6
|
* Since: 1.6
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
gst_resampler_clear (GstResampler * resampler)
|
gst_video_resampler_clear (GstVideoResampler * resampler)
|
||||||
{
|
{
|
||||||
g_return_if_fail (resampler != NULL);
|
g_return_if_fail (resampler != NULL);
|
||||||
|
|
|
@ -17,39 +17,39 @@
|
||||||
* Boston, MA 02110-1301, USA.
|
* Boston, MA 02110-1301, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __GST_RESAMPLER_H__
|
#ifndef __GST_VIDEO_RESAMPLER_H__
|
||||||
#define __GST_RESAMPLER_H__
|
#define __GST_VIDEO_RESAMPLER_H__
|
||||||
|
|
||||||
#include <gst/gst.h>
|
#include <gst/gst.h>
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
typedef struct _GstResampler GstResampler;
|
typedef struct _GstVideoResampler GstVideoResampler;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GstResamplerMethod:
|
* GstVideoResamplerMethod:
|
||||||
* @GST_RESAMPLER_METHOD_NEAREST: Duplicates the samples when
|
* @GST_VIDEO_RESAMPLER_METHOD_NEAREST: Duplicates the samples when
|
||||||
* upsampling and drops when downsampling
|
* upsampling and drops when downsampling
|
||||||
* @GST_RESAMPLER_METHOD_LINEAR: Uses linear interpolation to reconstruct
|
* @GST_VIDEO_RESAMPLER_METHOD_LINEAR: Uses linear interpolation to reconstruct
|
||||||
* missing samples and averaging to downsample
|
* missing samples and averaging to downsample
|
||||||
* @GST_RESAMPLER_METHOD_CUBIC: Uses cubic interpolation
|
* @GST_VIDEO_RESAMPLER_METHOD_CUBIC: Uses cubic interpolation
|
||||||
* @GST_RESAMPLER_METHOD_SINC: Uses sinc interpolation
|
* @GST_VIDEO_RESAMPLER_METHOD_SINC: Uses sinc interpolation
|
||||||
* @GST_RESAMPLER_METHOD_LANCZOS: Uses lanczos interpolation
|
* @GST_VIDEO_RESAMPLER_METHOD_LANCZOS: Uses lanczos interpolation
|
||||||
*
|
*
|
||||||
* Different subsampling and upsampling methods
|
* Different subsampling and upsampling methods
|
||||||
*
|
*
|
||||||
* Since: 1.6
|
* Since: 1.6
|
||||||
*/
|
*/
|
||||||
typedef enum {
|
typedef enum {
|
||||||
GST_RESAMPLER_METHOD_NEAREST,
|
GST_VIDEO_RESAMPLER_METHOD_NEAREST,
|
||||||
GST_RESAMPLER_METHOD_LINEAR,
|
GST_VIDEO_RESAMPLER_METHOD_LINEAR,
|
||||||
GST_RESAMPLER_METHOD_CUBIC,
|
GST_VIDEO_RESAMPLER_METHOD_CUBIC,
|
||||||
GST_RESAMPLER_METHOD_SINC,
|
GST_VIDEO_RESAMPLER_METHOD_SINC,
|
||||||
GST_RESAMPLER_METHOD_LANCZOS,
|
GST_VIDEO_RESAMPLER_METHOD_LANCZOS,
|
||||||
} GstResamplerMethod;
|
} GstVideoResamplerMethod;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GST_RESAMPLER_OPT_CUBIC_B:
|
* GST_VIDEO_RESAMPLER_OPT_CUBIC_B:
|
||||||
*
|
*
|
||||||
* G_TYPE_DOUBLE, B parameter of the cubic filter. The B
|
* G_TYPE_DOUBLE, B parameter of the cubic filter. The B
|
||||||
* parameter controls the bluriness. Values between 0.0 and
|
* parameter controls the bluriness. Values between 0.0 and
|
||||||
|
@ -67,59 +67,59 @@ typedef enum {
|
||||||
* Robidoux
|
* Robidoux
|
||||||
* Soft 0.6796 0.1602
|
* Soft 0.6796 0.1602
|
||||||
*/
|
*/
|
||||||
#define GST_RESAMPLER_OPT_CUBIC_B "GstResampler.cubic-b"
|
#define GST_VIDEO_RESAMPLER_OPT_CUBIC_B "GstVideoResampler.cubic-b"
|
||||||
/**
|
/**
|
||||||
* GST_RESAMPLER_OPT_CUBIC_C:
|
* GST_VIDEO_RESAMPLER_OPT_CUBIC_C:
|
||||||
*
|
*
|
||||||
* G_TYPE_DOUBLE, C parameter of the cubic filter. The C
|
* G_TYPE_DOUBLE, C parameter of the cubic filter. The C
|
||||||
* parameter controls the Keys alpha value. Values between 0.0 and
|
* parameter controls the Keys alpha value. Values between 0.0 and
|
||||||
* 2.0 are accepted. 1/3 is the default.
|
* 2.0 are accepted. 1/3 is the default.
|
||||||
*
|
*
|
||||||
* See #GST_RESAMPLER_OPT_CUBIC_B for some more common values
|
* See #GST_VIDEO_RESAMPLER_OPT_CUBIC_B for some more common values
|
||||||
*/
|
*/
|
||||||
#define GST_RESAMPLER_OPT_CUBIC_C "GstResampler.cubic-c"
|
#define GST_VIDEO_RESAMPLER_OPT_CUBIC_C "GstVideoResampler.cubic-c"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GST_RESAMPLER_OPT_ENVELOPE:
|
* GST_VIDEO_RESAMPLER_OPT_ENVELOPE:
|
||||||
*
|
*
|
||||||
* G_TYPE_DOUBLE, specifies the size of filter envelope for
|
* G_TYPE_DOUBLE, specifies the size of filter envelope for
|
||||||
* @GST_RESAMPLER_METHOD_LANCZOS. values are clamped between
|
* @GST_VIDEO_RESAMPLER_METHOD_LANCZOS. values are clamped between
|
||||||
* 1.0 and 5.0. 2.0 is the default.
|
* 1.0 and 5.0. 2.0 is the default.
|
||||||
*/
|
*/
|
||||||
#define GST_RESAMPLER_OPT_ENVELOPE "GstResampler.envelope"
|
#define GST_VIDEO_RESAMPLER_OPT_ENVELOPE "GstVideoResampler.envelope"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GST_RESAMPLER_OPT_SHARPNESS:
|
* GST_VIDEO_RESAMPLER_OPT_SHARPNESS:
|
||||||
*
|
*
|
||||||
* G_TYPE_DOUBLE, specifies sharpness of the filter for
|
* G_TYPE_DOUBLE, specifies sharpness of the filter for
|
||||||
* @GST_RESAMPLER_METHOD_LANCZOS. values are clamped between
|
* @GST_VIDEO_RESAMPLER_METHOD_LANCZOS. values are clamped between
|
||||||
* 0.5 and 1.5. 1.0 is the default.
|
* 0.5 and 1.5. 1.0 is the default.
|
||||||
*/
|
*/
|
||||||
#define GST_RESAMPLER_OPT_SHARPNESS "GstResampler.sharpness"
|
#define GST_VIDEO_RESAMPLER_OPT_SHARPNESS "GstVideoResampler.sharpness"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GST_RESAMPLER_OPT_SHARPEN:
|
* GST_VIDEO_RESAMPLER_OPT_SHARPEN:
|
||||||
*
|
*
|
||||||
* G_TYPE_DOUBLE, specifies sharpening of the filter for
|
* G_TYPE_DOUBLE, specifies sharpening of the filter for
|
||||||
* @GST_RESAMPLER_METHOD_LANCZOS. values are clamped between
|
* @GST_VIDEO_RESAMPLER_METHOD_LANCZOS. values are clamped between
|
||||||
* 0.0 and 1.0. 0.0 is the default.
|
* 0.0 and 1.0. 0.0 is the default.
|
||||||
*/
|
*/
|
||||||
#define GST_RESAMPLER_OPT_SHARPEN "GstResampler.sharpen"
|
#define GST_VIDEO_RESAMPLER_OPT_SHARPEN "GstVideoResampler.sharpen"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GstResamplerFlags:
|
* GstVideoResamplerFlags:
|
||||||
* @GST_RESAMPLER_FLAG_NONE: no flags
|
* @GST_VIDEO_RESAMPLER_FLAG_NONE: no flags
|
||||||
*
|
*
|
||||||
* Different resampler flags.
|
* Different resampler flags.
|
||||||
*
|
*
|
||||||
* Since: 1.6
|
* Since: 1.6
|
||||||
*/
|
*/
|
||||||
typedef enum {
|
typedef enum {
|
||||||
GST_RESAMPLER_FLAG_NONE = (0),
|
GST_VIDEO_RESAMPLER_FLAG_NONE = (0),
|
||||||
} GstResamplerFlags;
|
} GstVideoResamplerFlags;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GstResampler:
|
* GstVideoResampler:
|
||||||
* @in_size: the input size
|
* @in_size: the input size
|
||||||
* @out_size: the output size
|
* @out_size: the output size
|
||||||
* @max_taps: the maximum number of taps
|
* @max_taps: the maximum number of taps
|
||||||
|
@ -133,7 +133,7 @@ typedef enum {
|
||||||
*
|
*
|
||||||
* Since: 1.6
|
* Since: 1.6
|
||||||
*/
|
*/
|
||||||
struct _GstResampler
|
struct _GstVideoResampler
|
||||||
{
|
{
|
||||||
gint in_size;
|
gint in_size;
|
||||||
gint out_size;
|
gint out_size;
|
||||||
|
@ -148,16 +148,16 @@ struct _GstResampler
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
gboolean gst_resampler_init (GstResampler *resampler,
|
gboolean gst_video_resampler_init (GstVideoResampler *resampler,
|
||||||
GstResamplerMethod method,
|
GstVideoResamplerMethod method,
|
||||||
GstResamplerFlags flags,
|
GstVideoResamplerFlags flags,
|
||||||
guint n_phases, guint n_taps,
|
guint n_phases, guint n_taps,
|
||||||
gdouble shift,
|
gdouble shift,
|
||||||
guint in_size, guint out_size,
|
guint in_size, guint out_size,
|
||||||
GstStructure *options);
|
GstStructure *options);
|
||||||
|
|
||||||
void gst_resampler_clear (GstResampler *resampler);
|
void gst_video_resampler_clear (GstVideoResampler *resampler);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
#endif /* __GST_RESAMPLER_H__ */
|
#endif /* __GST_VIDEO_RESAMPLER_H__ */
|
|
@ -25,7 +25,6 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
#include "resampler.h"
|
|
||||||
#include <orc/orcfunctions.h>
|
#include <orc/orcfunctions.h>
|
||||||
#include "video-orc.h"
|
#include "video-orc.h"
|
||||||
#include "video-scaler.h"
|
#include "video-scaler.h"
|
||||||
|
@ -42,18 +41,18 @@ typedef void (*GstVideoScalerVFunc) (GstVideoScaler * scale,
|
||||||
|
|
||||||
struct _GstVideoScaler
|
struct _GstVideoScaler
|
||||||
{
|
{
|
||||||
GstResamplerMethod method;
|
GstVideoResamplerMethod method;
|
||||||
GstVideoScalerFlags flags;
|
GstVideoScalerFlags flags;
|
||||||
|
|
||||||
GstResampler resampler;
|
GstVideoResampler resampler;
|
||||||
|
|
||||||
/* cached integer coefficients */
|
/* cached integer coefficients */
|
||||||
gint16 *taps_s16;
|
gint16 *taps_s16;
|
||||||
};
|
};
|
||||||
|
|
||||||
static void
|
static void
|
||||||
resampler_zip (GstResampler * resampler, const GstResampler * r1,
|
resampler_zip (GstVideoResampler * resampler, const GstVideoResampler * r1,
|
||||||
const GstResampler * r2)
|
const GstVideoResampler * r2)
|
||||||
{
|
{
|
||||||
guint i, out_size, max_taps;
|
guint i, out_size, max_taps;
|
||||||
gdouble *taps;
|
gdouble *taps;
|
||||||
|
@ -77,7 +76,7 @@ resampler_zip (GstResampler * resampler, const GstResampler * r1,
|
||||||
|
|
||||||
for (i = 0; i < out_size; i++) {
|
for (i = 0; i < out_size; i++) {
|
||||||
guint idx = i / 2;
|
guint idx = i / 2;
|
||||||
const GstResampler *r;
|
const GstVideoResampler *r;
|
||||||
|
|
||||||
r = (i & 1) ? r2 : r1;
|
r = (i & 1) ? r2 : r1;
|
||||||
|
|
||||||
|
@ -91,7 +90,7 @@ resampler_zip (GstResampler * resampler, const GstResampler * r1,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gst_video_scaler_new:
|
* gst_video_scaler_new:
|
||||||
* @method: a #GstResamplerMethod
|
* @method: a #GstVideoResamplerMethod
|
||||||
* @flags: #GstVideoScalerFlags
|
* @flags: #GstVideoScalerFlags
|
||||||
* @n_taps: number of taps to use
|
* @n_taps: number of taps to use
|
||||||
* @in_size: number of source elements
|
* @in_size: number of source elements
|
||||||
|
@ -108,7 +107,7 @@ resampler_zip (GstResampler * resampler, const GstResampler * r1,
|
||||||
* Returns: a #GstVideoResample
|
* Returns: a #GstVideoResample
|
||||||
*/
|
*/
|
||||||
GstVideoScaler *
|
GstVideoScaler *
|
||||||
gst_video_scaler_new (GstResamplerMethod method, GstVideoScalerFlags flags,
|
gst_video_scaler_new (GstVideoResamplerMethod method, GstVideoScalerFlags flags,
|
||||||
guint n_taps, guint in_size, guint out_size, GstStructure * options)
|
guint n_taps, guint in_size, guint out_size, GstStructure * options)
|
||||||
{
|
{
|
||||||
GstVideoScaler *scale;
|
GstVideoScaler *scale;
|
||||||
|
@ -124,21 +123,21 @@ gst_video_scaler_new (GstResamplerMethod method, GstVideoScalerFlags flags,
|
||||||
scale->flags = flags;
|
scale->flags = flags;
|
||||||
|
|
||||||
if (flags & GST_VIDEO_SCALER_FLAG_INTERLACED) {
|
if (flags & GST_VIDEO_SCALER_FLAG_INTERLACED) {
|
||||||
GstResampler tresamp, bresamp;
|
GstVideoResampler tresamp, bresamp;
|
||||||
|
|
||||||
gst_resampler_init (&tresamp, method, 0, (out_size + 1) / 2, n_taps,
|
gst_video_resampler_init (&tresamp, method, 0, (out_size + 1) / 2, n_taps,
|
||||||
0.0, (in_size + 1) / 2, (out_size + 1) / 2, options);
|
0.0, (in_size + 1) / 2, (out_size + 1) / 2, options);
|
||||||
|
|
||||||
gst_resampler_init (&bresamp, method, 0, out_size - tresamp.out_size,
|
gst_video_resampler_init (&bresamp, method, 0, out_size - tresamp.out_size,
|
||||||
n_taps, -1.0, in_size - tresamp.in_size,
|
n_taps, -1.0, in_size - tresamp.in_size,
|
||||||
out_size - tresamp.out_size, options);
|
out_size - tresamp.out_size, options);
|
||||||
|
|
||||||
resampler_zip (&scale->resampler, &tresamp, &bresamp);
|
resampler_zip (&scale->resampler, &tresamp, &bresamp);
|
||||||
gst_resampler_clear (&tresamp);
|
gst_video_resampler_clear (&tresamp);
|
||||||
gst_resampler_clear (&bresamp);
|
gst_video_resampler_clear (&bresamp);
|
||||||
} else {
|
} else {
|
||||||
gst_resampler_init (&scale->resampler, method, flags, out_size, n_taps,
|
gst_video_resampler_init (&scale->resampler, method, flags, out_size,
|
||||||
0.0, in_size, out_size, options);
|
n_taps, 0.0, in_size, out_size, options);
|
||||||
}
|
}
|
||||||
return scale;
|
return scale;
|
||||||
}
|
}
|
||||||
|
@ -154,7 +153,7 @@ gst_video_scaler_free (GstVideoScaler * scale)
|
||||||
{
|
{
|
||||||
g_return_if_fail (scale != NULL);
|
g_return_if_fail (scale != NULL);
|
||||||
|
|
||||||
gst_resampler_clear (&scale->resampler);
|
gst_video_resampler_clear (&scale->resampler);
|
||||||
g_free (scale->taps_s16);
|
g_free (scale->taps_s16);
|
||||||
g_slice_free (GstVideoScaler, scale);
|
g_slice_free (GstVideoScaler, scale);
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
|
|
||||||
#include <gst/video/video-format.h>
|
#include <gst/video/video-format.h>
|
||||||
#include <gst/video/video-color.h>
|
#include <gst/video/video-color.h>
|
||||||
#include <gst/video/resampler.h>
|
#include <gst/video/video-resampler.h>
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@ typedef enum {
|
||||||
|
|
||||||
typedef struct _GstVideoScaler GstVideoScaler;
|
typedef struct _GstVideoScaler GstVideoScaler;
|
||||||
|
|
||||||
GstVideoScaler * gst_video_scaler_new (GstResamplerMethod method,
|
GstVideoScaler * gst_video_scaler_new (GstVideoResamplerMethod method,
|
||||||
GstVideoScalerFlags flags,
|
GstVideoScalerFlags flags,
|
||||||
guint n_taps,
|
guint n_taps,
|
||||||
guint in_size, guint out_size,
|
guint in_size, guint out_size,
|
||||||
|
|
Loading…
Reference in a new issue