libavfilter/transform.h File Reference

transform input video More...

Go to the source code of this file.

Defines

#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 avfilter_get_matrix (float x_shift, float y_shift, float angle, float zoom, float *matrix)
 Get an affine transformation matrix from a given translation, rotation, and zoom factor.
void avfilter_add_matrix (const float *m1, const float *m2, float *result)
 Add two matrices together.
void avfilter_sub_matrix (const float *m1, const float *m2, float *result)
 Subtract one matrix from another.
void avfilter_mul_matrix (const float *m1, float scalar, float *result)
 Multiply a matrix by a scalar value.
void avfilter_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.

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.


Define Documentation

Definition at line 58 of file transform.h.

Definition at line 47 of file transform.h.

Definition at line 45 of file transform.h.

Definition at line 46 of file transform.h.


Enumeration Type Documentation

enum FillMethod
Enumerator:
FILL_BLANK 
FILL_ORIGINAL 
FILL_CLAMP 
FILL_MIRROR 
FILL_COUNT 

Definition at line 49 of file transform.h.

Enumerator:
INTERPOLATE_NEAREST 
INTERPOLATE_BILINEAR 
INTERPOLATE_BIQUADRATIC 
INTERPOLATE_COUNT 

Definition at line 37 of file transform.h.


Function Documentation

void avfilter_add_matrix ( const float *  m1,
const float *  m2,
float *  result 
)

Add two matrices together.

result = m1 + m2.

Parameters:
m19-item transformation matrix
m29-item transformation matrix
result9-item transformation matrix

Definition at line 117 of file transform.c.

void avfilter_get_matrix ( float  x_shift,
float  y_shift,
float  angle,
float  zoom,
float *  matrix 
)

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

The matrix will look like:

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

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

Definition at line 105 of file transform.c.

Referenced by end_frame().

void avfilter_mul_matrix ( const float *  m1,
float  scalar,
float *  result 
)

Multiply a matrix by a scalar value.

result = m1 * scalar.

Parameters:
m19-item transformation matrix
scalara number
result9-item transformation matrix

Definition at line 131 of file transform.c.

void avfilter_sub_matrix ( const float *  m1,
const float *  m2,
float *  result 
)

Subtract one matrix from another.

result = m1 - m2.

Parameters:
m19-item transformation matrix
m29-item transformation matrix
result9-item transformation matrix

Definition at line 124 of file transform.c.

void avfilter_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

Definition at line 138 of file transform.c.

Referenced by end_frame().