gavl

- Main Page
- Modules
- Data Structures
- Files

Typedefs | Functions
Scaler
Video

Video scaler. More...

## Typedefs
typedef struct gavl_video_scaler_s | gavl_video_scaler_t
| Opaque scaler structure. More...

## Functions
GAVL_PUBLIC gavl_video_scaler_t * | gavl_video_scaler_create ()
| Create a video scaler. More...
GAVL_PUBLIC void | gavl_video_scaler_destroy (gavl_video_scaler_t *scaler)
| Destroy a video scaler. More...
GAVL_PUBLIC gavl_video_options_t * | gavl_video_scaler_get_options (gavl_video_scaler_t *scaler)
| gets options of a scaler More...
GAVL_PUBLIC int | gavl_video_scaler_init (gavl_video_scaler_t *scaler, const gavl_video_format_t *src_format, const gavl_video_format_t *dst_format)
| Initialize a video scaler. More...
GAVL_PUBLIC int | gavl_video_scaler_init_convolve (gavl_video_scaler_t *scaler, const gavl_video_format_t *format, int h_radius, const float *h_coeffs, int v_radius, const float *v_coeffs)
| Initialize a video scaler as a generic convolver. More...
GAVL_PUBLIC void | gavl_video_scaler_scale (gavl_video_scaler_t *scaler, const gavl_video_frame_t *input_frame, gavl_video_frame_t *output_frame)
| Scale video. More...

## Detailed Description

Video scaler.

The scaler does the elementary operation to take a rectangular area of the source image and scale it into a specified rectangular area of the destination image. The source rectangle has floating point coordinates, the destination rectangle must have integer coordinates, which are aligned to chroma subsampling factors.

The internal scale tables are created for each plane and field separately. This means that:

- We handle all flavors of chroma placement correctly
- We can convert chroma subsampling by scaling the chroma planes and copying the luminance plane.
- Since the scaler knows about fields, it will scale interlaced frames field-wise (not a good idea to scale interlaced frames vertically though).
- Simple deinterlacing (See GAVL_DEINTERLACE_SCALE) can be done by taking one source field and scale it vertically to the entire destination frame.

You can use the scaler directly (through gavl_video_scaler_t). The generic video converter (gavl_video_converter_t) will create an internal scaler if necessary.

## Typedef Documentation

typedef struct gavl_video_scaler_s gavl_video_scaler_t

Opaque scaler structure.

You don't want to know what's inside.

## Function Documentation

GAVL_PUBLIC gavl_video_scaler_t* gavl_video_scaler_create | ( |  | ) |

Create a video scaler.

Returns
  A newly allocated video scaler

GAVL_PUBLIC void gavl_video_scaler_destroy | ( | gavl_video_scaler_t * | scaler | ) |

Destroy a video scaler.

Parameters

  scaler | A video scaler

GAVL_PUBLIC gavl_video_options_t* gavl_video_scaler_get_options | ( | gavl_video_scaler_t * | scaler | ) |

gets options of a scaler

Parameters

  scaler | A video scaler

After you called this, you can use the gavl_video_options_set_*() functions to change the options. Options will become valid with the next call to gavl_video_scaler_init

GAVL_PUBLIC int gavl_video_scaler_init | ( | gavl_video_scaler_t * | scaler,
|  | const gavl_video_format_t * | src_format,
|  | const gavl_video_format_t * | dst_format
| ) |  |

Initialize a video scaler.

Parameters

  scaler | A video scaler
  src_format | Input format
  dst_format | Output format

Returns
  If something goes wrong (should never happen), -1 is returned.

You should have equal pixelformats in the source and destination. This function can be called multiple times with one instance.

GAVL_PUBLIC int gavl_video_scaler_init_convolve | ( | gavl_video_scaler_t * | scaler,
|  | const gavl_video_format_t * | format,
|  | int | h_radius,
|  | const float * | h_coeffs,
|  | int | v_radius,
|  | const float * | v_coeffs
| ) |  |

Initialize a video scaler as a generic convolver.

Parameters

  scaler | A video scaler
  format | Format (must be the same for input and output)
  h_radius | Horizontal radius
  h_coeffs | Horizontal coefficients
  v_radius | Vertical radius
  v_coeffs | Vertical coefficients

Returns
  If something goes wrong (should never happen), -1 is returned.

This initialized a scaler for use as a generic convolver. The h_radius and v_radius arguments denote the numbers of pixels, which are taken in both left and right from the center pixel, i.e. a value of 1 will result in a 3-tap filter. The coefficients must be given for ALL taps (the convolver does not assume the coeffitients to be symmetric)

This function can be called multiple times with one instance.

GAVL_PUBLIC void gavl_video_scaler_scale | ( | gavl_video_scaler_t * | scaler,
|  | const gavl_video_frame_t * | input_frame,
|  | gavl_video_frame_t * | output_frame
| ) |  |

Scale video.

Parameters

  scaler | A video scaler
  input_frame | Input frame
  output_frame | Output frame