FFmpeg
Loading...
Searching...
No Matches
transform.c File Reference

transform input video More...

#include "libavutil/common.h"
#include "libavutil/avassert.h"
#include "transform.h"

Go to the source code of this file.

Macros

#define INTERPOLATE_METHOD(name)
 
#define PIXEL(img, x, y, w, h, stride, def)
 

Functions

 INTERPOLATE_METHOD (interpolate_nearest)
 Nearest neighbor interpolation.
 
 INTERPOLATE_METHOD (interpolate_bilinear)
 Bilinear interpolation.
 
 INTERPOLATE_METHOD (interpolate_biquadratic)
 Biquadratic interpolation.
 
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.
 
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.
 

Detailed Description

transform input video

Definition in file transform.c.

Macro Definition Documentation

◆ INTERPOLATE_METHOD

#define INTERPOLATE_METHOD ( name)
Value:
static uint8_t name(float x, float y, const uint8_t *src, \
int width, int height, int stride, uint8_t def)
const char * name
Definition qsvenc.c:142
#define stride
#define src
Definition vp8dsp.c:248
#define height
Definition dsp.h:89
#define width
Definition dsp.h:89

Definition at line 32 of file transform.c.

◆ PIXEL

#define PIXEL ( img,
x,
y,
w,
h,
stride,
def )
Value:
((x) < 0 || (y) < 0) ? (def) : \
(((x) >= (w) || (y) >= (h)) ? (def) : \
img[(x) + (y) * (stride)])
uint8_t w
Definition llvidencdsp.c:39
#define img

Definition at line 36 of file transform.c.

Referenced by INTERPOLATE_METHOD(), INTERPOLATE_METHOD(), and INTERPOLATE_METHOD().

Function Documentation

◆ INTERPOLATE_METHOD() [1/3]

INTERPOLATE_METHOD ( interpolate_nearest )

Nearest neighbor interpolation.

Definition at line 44 of file transform.c.

◆ INTERPOLATE_METHOD() [2/3]

INTERPOLATE_METHOD ( interpolate_bilinear )

Bilinear interpolation.

Definition at line 52 of file transform.c.

◆ INTERPOLATE_METHOD() [3/3]

INTERPOLATE_METHOD ( interpolate_biquadratic )

Biquadratic interpolation.

Definition at line 79 of file transform.c.

◆ 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().