GstVideoScaler

GstVideoScaler — Utility object for rescaling video frames

Synopsis

#include <gst/video/video-scaler.h>

                    GstVideoScaler;
enum                GstVideoScalerFlags;
void                gst_video_scaler_2d                 (GstVideoScaler *hscale,
                                                         GstVideoScaler *vscale,
                                                         GstVideoFormat format,
                                                         gpointer src,
                                                         gint src_stride,
                                                         gpointer dest,
                                                         gint dest_stride,
                                                         guint x,
                                                         guint y,
                                                         guint width,
                                                         guint height);
GstVideoScaler *    gst_video_scaler_combine_packed_YUV (GstVideoScaler *y_scale,
                                                         GstVideoScaler *uv_scale,
                                                         GstVideoFormat in_format,
                                                         GstVideoFormat out_format);
void                gst_video_scaler_free               (GstVideoScaler *scale);
const gdouble *     gst_video_scaler_get_coeff          (GstVideoScaler *scale,
                                                         guint out_offset,
                                                         guint *in_offset,
                                                         guint *n_taps);
void                gst_video_scaler_horizontal         (GstVideoScaler *scale,
                                                         GstVideoFormat format,
                                                         gpointer src,
                                                         gpointer dest,
                                                         guint dest_offset,
                                                         guint width);
GstVideoScaler *    gst_video_scaler_new                (GstVideoResamplerMethod method,
                                                         GstVideoScalerFlags flags,
                                                         guint n_taps,
                                                         guint in_size,
                                                         guint out_size,
                                                         GstStructure *options);
void                gst_video_scaler_vertical           (GstVideoScaler *scale,
                                                         GstVideoFormat format,
                                                         gpointer src_lines[],
                                                         gpointer dest,
                                                         guint dest_offset,
                                                         guint width);

Description

GstVideoScaler is a utility object for rescaling and resampling video frames using various interpolation / sampling methods.

Details

GstVideoScaler

typedef struct _GstVideoScaler GstVideoScaler;

enum GstVideoScalerFlags

typedef enum {
  GST_VIDEO_SCALER_FLAG_NONE                 = (0),
  GST_VIDEO_SCALER_FLAG_INTERLACED           = (1 << 0),
} GstVideoScalerFlags;

Different scale flags.

GST_VIDEO_SCALER_FLAG_NONE

no flags

GST_VIDEO_SCALER_FLAG_INTERLACED

Set up a scaler for interlaced content

gst_video_scaler_2d ()

void                gst_video_scaler_2d                 (GstVideoScaler *hscale,
                                                         GstVideoScaler *vscale,
                                                         GstVideoFormat format,
                                                         gpointer src,
                                                         gint src_stride,
                                                         gpointer dest,
                                                         gint dest_stride,
                                                         guint x,
                                                         guint y,
                                                         guint width,
                                                         guint height);

Scale a rectangle of pixels in src with src_stride to dest with dest_stride using the horizontal scaler hscaler and the vertical scaler vscale.

One or both of hscale and vscale can be NULL to only perform scaling in one dimension or do a copy without scaling.

x and y are the coordinates in the destination image to process.

hscale :

a horzontal GstVideoScaler

vscale :

a vertical GstVideoScaler

format :

a GstVideoFormat for srcs and dest

src :

source pixels

src_stride :

source pixels stride

dest :

destination pixels

dest_stride :

destination pixels stride

x :

the horizontal destination offset

y :

the vertical destination offset

width :

the number of output pixels to scale

height :

the number of output lines to scale

gst_video_scaler_combine_packed_YUV ()

GstVideoScaler *    gst_video_scaler_combine_packed_YUV (GstVideoScaler *y_scale,
                                                         GstVideoScaler *uv_scale,
                                                         GstVideoFormat in_format,
                                                         GstVideoFormat out_format);

Combine a scaler for Y and UV into one scaler for the packed format.

y_scale :

a scaler for the Y component

uv_scale :

a scaler for the U and V components

in_format :

the input video format

out_format :

the output video format

Returns :

a new horizontal videoscaler for format.

Since 1.6


gst_video_scaler_free ()

void                gst_video_scaler_free               (GstVideoScaler *scale);

Free a previously allocated GstVideoScaler scale.

scale :

a GstVideoScaler

gst_video_scaler_get_coeff ()

const gdouble *     gst_video_scaler_get_coeff          (GstVideoScaler *scale,
                                                         guint out_offset,
                                                         guint *in_offset,
                                                         guint *n_taps);

For a given pixel at out_offset, get the first required input pixel at in_offset and the n_taps filter coefficients.

Note that for interlaced content, in_offset needs to be incremented with 2 to get the next input line.

scale :

a GstVideoScaler

out_offset :

an output offset

in_offset :

result input offset

n_taps :

result n_taps

Returns :

an array of n_tap gdouble values with filter coefficients.

gst_video_scaler_horizontal ()

void                gst_video_scaler_horizontal         (GstVideoScaler *scale,
                                                         GstVideoFormat format,
                                                         gpointer src,
                                                         gpointer dest,
                                                         guint dest_offset,
                                                         guint width);

Horizontally scale the pixels in src to dest, starting from dest_offset for width samples.

scale :

a GstVideoScaler

format :

a GstVideoFormat for src and dest

src :

source pixels

dest :

destination pixels

dest_offset :

the horizontal destination offset

width :

the number of pixels to scale

gst_video_scaler_new ()

GstVideoScaler *    gst_video_scaler_new                (GstVideoResamplerMethod method,
                                                         GstVideoScalerFlags flags,
                                                         guint n_taps,
                                                         guint in_size,
                                                         guint out_size,
                                                         GstStructure *options);

Make a new method video scaler. in_size source lines/pixels will be scaled to out_size destination lines/pixels.

n_taps specifies the amount of pixels to use from the source for one output pixel. If n_taps is 0, this function chooses a good value automatically based on the method and in_size/out_size.

method :

a GstVideoResamplerMethod

flags :

GstVideoScalerFlags

n_taps :

number of taps to use

in_size :

number of source elements

out_size :

number of destination elements

options :

extra options. [allow-none]

Returns :

a GstVideoResample

gst_video_scaler_vertical ()

void                gst_video_scaler_vertical           (GstVideoScaler *scale,
                                                         GstVideoFormat format,
                                                         gpointer src_lines[],
                                                         gpointer dest,
                                                         guint dest_offset,
                                                         guint width);

Vertically combine width pixels in the lines in src_lines to dest. dest is the location of the target line at dest_offset and srcs are the input lines for dest_offset, as obtained with gst_video_scaler_get_info().

scale :

a GstVideoScaler

format :

a GstVideoFormat for srcs and dest

src_lines :

source pixels lines

dest :

destination pixels

dest_offset :

the vertical destination offset

width :

the number of pixels to scale