Image transformation
Video

## Typedefs

typedef struct gavl_image_transform_s | gavl_image_transform_t
| Opaque image transformation engine. More...
typedef void(* | gavl_image_transform_func) (void *priv, double xdst, double ydst, double *xsrc, double *ysrc)
| Function describing the method. More...

## Functions

GAVL_PUBLIC gavl_image_transform_t * | gavl_image_transform_create ()
| Create a transformation engine. More...
GAVL_PUBLIC void | gavl_image_transform_destroy (gavl_image_transform_t *t)
| Destroy a transformation engine. More...
GAVL_PUBLIC int | gavl_image_transform_init (gavl_image_transform_t *t, gavl_video_format_t *format, gavl_image_transform_func func, void *priv)
| Initialize a transformation engine. More...
GAVL_PUBLIC void | gavl_image_transform_transform (gavl_image_transform_t *t, gavl_video_frame_t *in_frame, gavl_video_frame_t *out_frame)
| Transform an image. More...
GAVL_PUBLIC gavl_video_options_t * | gavl_image_transform_get_options (gavl_image_transform_t *t)
| Get transformation options. More...

## Detailed Description

gavl includes a generic image transformation engine. You pass a function pointer to the init function, which transforms the destination coordinates into source coordinates.

The interpolation method is set with gavl_video_options_set_scale_mode, but not all modes are supported. When initialized with an invalid scale mode, the transformation engine will silently choose the closest one.

## Typedef Documentation

## gavl_image_transform_t

typedef struct gavl_image_transform_s gavl_image_transform_t

Opaque image transformation engine.

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

## gavl_image_transform_func

typedef void(* gavl_image_transform_func) (void *priv, double xdst, double ydst, double *xsrc, double *ysrc)

Function describing the method.

Parameters

  priv | User data
  xdst | X-coordinate of the destination
  ydst | Y-coordinate of the destination
  xsrc | Returns X-coordinate of the source
  ysrc | Returns Y-coordinate of the source

All coordinates are in fractional pixels. 0,0 is the upper left corner. Return negative values or values larger than the dimesion to signal that a pixel is outside the source image.

## Function Documentation

## gavl_image_transform_create()

GAVL_PUBLIC gavl_image_transform_t * gavl_image_transform_create | ( |  | ) |

Create a transformation engine.

Returns
  A newly allocated transformation engine

Since 1.1.0.

## gavl_image_transform_destroy()

GAVL_PUBLIC void gavl_image_transform_destroy | ( | gavl_image_transform_t * | t | ) |

Destroy a transformation engine.

Parameters

  t | A transformation engine Since 1.1.0.

## gavl_image_transform_init()

GAVL_PUBLIC int gavl_image_transform_init | ( | gavl_image_transform_t * | t,
|  | gavl_video_format_t * | format,
|  | gavl_image_transform_func | func,
|  | void * | priv
| ) |  |

Initialize a transformation engine.

Parameters

  t | A transformation engine
  format | Format (can be changed)
  func | Coordinate transform function
  priv | The priv argument for func

Returns
  1 if the transform was sucessfully initialized, 0 else.

If you enabled multithreading support, func will be called from multiple threads at the same time. Make sure, that it doesn't access any global data.

Return type was changed from void to in in version 1.1.2 Under normal circumstances, this function always returns 1.

Since 1.1.0.

## gavl_image_transform_transform()

GAVL_PUBLIC void gavl_image_transform_transform | ( | gavl_image_transform_t * | t,
|  | gavl_video_frame_t * | in_frame,
|  | gavl_video_frame_t * | out_frame
| ) |  |

Transform an image.

Parameters

  t | A transformation engine
  in_frame | Input frame
  out_frame | Output frame Since 1.1.0.

## gavl_image_transform_get_options()

GAVL_PUBLIC gavl_video_options_t * gavl_image_transform_get_options | ( | gavl_image_transform_t * | t | ) |

Get transformation options.

Parameters

  t | A transformation engine

Returns
  Options

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_image_transform_init.

Since 1.1.0.