FFmpeg
Macros | Enumerations | Functions
transform.h File Reference
#include <stdint.h>

Go to the source code of this file.

Macros

#define INTERPOLATE_DEFAULT   INTERPOLATE_BILINEAR
 
#define INTERPOLATE_FAST   INTERPOLATE_NEAREST
 
#define INTERPOLATE_BEST   INTERPOLATE_BIQUADRATIC
 
#define FILL_DEFAULT   FILL_ORIGINAL
 

Enumerations

enum  InterpolateMethod { INTERPOLATE_NEAREST, INTERPOLATE_BILINEAR, INTERPOLATE_BIQUADRATIC, INTERPOLATE_COUNT }
 
enum  FillMethod {
  FILL_BLANK, FILL_ORIGINAL, FILL_CLAMP, FILL_MIRROR,
  FILL_COUNT
}
 

Functions

void ff_get_matrix (float x_shift, float y_shift, float angle, float scale_x, float scale_y, float *matrix)
 Get an affine transformation matrix from given translation, rotation, and zoom factors. More...
 
int ff_affine_transform (const uint8_t *src, uint8_t *dst, int src_stride, int dst_stride, int width, int height, const float *matrix, enum InterpolateMethod interpolate, enum FillMethod fill)
 Do an affine transformation with the given interpolation method. More...
 

Detailed Description

transform input video

All matrices are defined as a single 9-item block of contiguous memory. For example, the identity matrix would be:

float *matrix = {1, 0, 0,
                 0, 1, 0,
                 0, 0, 1};

Definition in file transform.h.

Macro Definition Documentation

◆ INTERPOLATE_DEFAULT

#define INTERPOLATE_DEFAULT   INTERPOLATE_BILINEAR

Definition at line 47 of file transform.h.

◆ INTERPOLATE_FAST

#define INTERPOLATE_FAST   INTERPOLATE_NEAREST

Definition at line 48 of file transform.h.

◆ INTERPOLATE_BEST

#define INTERPOLATE_BEST   INTERPOLATE_BIQUADRATIC

Definition at line 49 of file transform.h.

◆ FILL_DEFAULT

#define FILL_DEFAULT   FILL_ORIGINAL

Definition at line 60 of file transform.h.

Enumeration Type Documentation

◆ InterpolateMethod

Enumerator
INTERPOLATE_NEAREST 
INTERPOLATE_BILINEAR 
INTERPOLATE_BIQUADRATIC 
INTERPOLATE_COUNT 

Definition at line 39 of file transform.h.

◆ FillMethod

enum FillMethod
Enumerator
FILL_BLANK 
FILL_ORIGINAL 
FILL_CLAMP 
FILL_MIRROR 
FILL_COUNT 

Definition at line 51 of file transform.h.

Function Documentation

◆ ff_get_matrix()

void ff_get_matrix ( float  x_shift,
float  y_shift,
float  angle,
float  scale_x,
float  scale_y,
float matrix 
)

Get an affine transformation matrix from given translation, rotation, and zoom factors.

The matrix will look like:

[ scale_x * cos(angle), -sin(angle), x_shift, sin(angle), scale_y * cos(angle), y_shift, 0, 0, 1 ]

Parameters
x_shifthorizontal translation
y_shiftvertical translation
anglerotation in radians
scale_xx scale percent (1.0 = 100%)
scale_yy scale percent (1.0 = 100%)
matrix9-item affine transformation matrix

Definition at line 106 of file transform.c.

Referenced by filter_frame(), and transform_center_scale().

◆ ff_affine_transform()

int ff_affine_transform ( const uint8_t *  src,
uint8_t *  dst,
int  src_stride,
int  dst_stride,
int  width,
int  height,
const float matrix,
enum InterpolateMethod  interpolate,
enum FillMethod  fill 
)

Do an affine transformation with the given interpolation method.

This multiplies each vector [x,y,1] by the matrix and then interpolates to get the final value.

Parameters
srcsource image
dstdestination image
src_stridesource image line size in bytes
dst_stridedestination image line size in bytes
widthimage width in pixels
heightimage height in pixels
matrix9-item affine transformation matrix
interpolatepixel interpolation method
filledge fill method
Returns
negative on error

Definition at line 125 of file transform.c.

Referenced by deshake_transform_c().