FFmpeg  4.3
Macros | Functions
transform.c File Reference
#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. More...
 
 INTERPOLATE_METHOD (interpolate_bilinear)
 Bilinear interpolation. More...
 
 INTERPOLATE_METHOD (interpolate_biquadratic)
 Biquadratic interpolation. More...
 
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...
 
void avfilter_add_matrix (const float *m1, const float *m2, float *result)
 Add two matrices together. More...
 
void avfilter_sub_matrix (const float *m1, const float *m2, float *result)
 Subtract one matrix from another. More...
 
void avfilter_mul_matrix (const float *m1, float scalar, float *result)
 Multiply a matrix by a scalar value. More...
 
int 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. More...
 

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)

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)])

Definition at line 36 of file transform.c.

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

◆ avfilter_add_matrix()

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 125 of file transform.c.

◆ avfilter_sub_matrix()

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 132 of file transform.c.

◆ avfilter_mul_matrix()

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 139 of file transform.c.

◆ avfilter_transform()

int 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
Returns
negative on error

Definition at line 146 of file transform.c.

Referenced by deshake_transform_c().

stride
int stride
Definition: mace.c:144
name
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf default minimum maximum flags name is the option name
Definition: writing_filters.txt:88
x
FFmpeg Automated Testing Environment ************************************Introduction Using FATE from your FFmpeg source directory Submitting the results to the FFmpeg result aggregation server Uploading new samples to the fate suite FATE makefile targets and variables Makefile targets Makefile variables Examples Introduction **************FATE is an extended regression suite on the client side and a means for results aggregation and presentation on the server side The first part of this document explains how you can use FATE from your FFmpeg source directory to test your ffmpeg binary The second part describes how you can run FATE to submit the results to FFmpeg’s FATE server In any way you can have a look at the publicly viewable FATE results by visiting this as it can be seen if some test on some platform broke with their recent contribution This usually happens on the platforms the developers could not test on The second part of this document describes how you can run FATE to submit your results to FFmpeg’s FATE server If you want to submit your results be sure to check that your combination of OS and compiler is not already listed on the above mentioned website In the third part you can find a comprehensive listing of FATE makefile targets and variables Using FATE from your FFmpeg source directory **********************************************If you want to run FATE on your machine you need to have the samples in place You can get the samples via the build target fate rsync Use this command from the top level source this will cause FATE to fail NOTE To use a custom wrapper to run the pass ‘ target exec’ to ‘configure’ or set the TARGET_EXEC Make variable Submitting the results to the FFmpeg result aggregation server ****************************************************************To submit your results to the server you should run fate through the shell script ‘tests fate sh’ from the FFmpeg sources This script needs to be invoked with a configuration file as its first argument tests fate sh path to fate_config A configuration file template with comments describing the individual configuration variables can be found at ‘doc fate_config sh template’ Create a configuration that suits your based on the configuration template The ‘slot’ configuration variable can be any string that is not yet but it is suggested that you name it adhering to the following pattern ‘ARCH OS COMPILER COMPILER VERSION’ The configuration file itself will be sourced in a shell therefore all shell features may be used This enables you to setup the environment as you need it for your build For your first test runs the ‘fate_recv’ variable should be empty or commented out This will run everything as normal except that it will omit the submission of the results to the server The following files should be present in $workdir as specified in the configuration it may help to try out the ‘ssh’ command with one or more ‘ v’ options You should get detailed output concerning your SSH configuration and the authentication process The only thing left is to automate the execution of the fate sh script and the synchronisation of the samples directory Uploading new samples to the fate suite *****************************************If you need a sample uploaded send a mail to samples request This is for developers who have an account on the fate suite server If you upload new please make sure they are as small as space on each network bandwidth and so on benefit from smaller test cases Also keep in mind older checkouts use existing sample that means in practice generally do not remove or overwrite files as it likely would break older checkouts or releases Also all needed samples for a commit should be ideally before the push If you need an account for frequently uploading samples or you wish to help others by doing that send a mail to ffmpeg devel rsync vauL Duo x
Definition: fate.txt:150
width
#define width
src
#define src
Definition: vp8dsp.c:254
height
#define height
uint8_t
uint8_t
Definition: audio_convert.c:194
w
FFmpeg Automated Testing Environment ************************************Introduction Using FATE from your FFmpeg source directory Submitting the results to the FFmpeg result aggregation server Uploading new samples to the fate suite FATE makefile targets and variables Makefile targets Makefile variables Examples Introduction **************FATE is an extended regression suite on the client side and a means for results aggregation and presentation on the server side The first part of this document explains how you can use FATE from your FFmpeg source directory to test your ffmpeg binary The second part describes how you can run FATE to submit the results to FFmpeg’s FATE server In any way you can have a look at the publicly viewable FATE results by visiting this as it can be seen if some test on some platform broke with their recent contribution This usually happens on the platforms the developers could not test on The second part of this document describes how you can run FATE to submit your results to FFmpeg’s FATE server If you want to submit your results be sure to check that your combination of OS and compiler is not already listed on the above mentioned website In the third part you can find a comprehensive listing of FATE makefile targets and variables Using FATE from your FFmpeg source directory **********************************************If you want to run FATE on your machine you need to have the samples in place You can get the samples via the build target fate rsync Use this command from the top level source this will cause FATE to fail NOTE To use a custom wrapper to run the pass ‘ target exec’ to ‘configure’ or set the TARGET_EXEC Make variable Submitting the results to the FFmpeg result aggregation server ****************************************************************To submit your results to the server you should run fate through the shell script ‘tests fate sh’ from the FFmpeg sources This script needs to be invoked with a configuration file as its first argument tests fate sh path to fate_config A configuration file template with comments describing the individual configuration variables can be found at ‘doc fate_config sh template’ Create a configuration that suits your based on the configuration template The ‘slot’ configuration variable can be any string that is not yet but it is suggested that you name it adhering to the following pattern ‘ARCH OS COMPILER COMPILER VERSION’ The configuration file itself will be sourced in a shell therefore all shell features may be used This enables you to setup the environment as you need it for your build For your first test runs the ‘fate_recv’ variable should be empty or commented out This will run everything as normal except that it will omit the submission of the results to the server The following files should be present in $workdir as specified in the configuration it may help to try out the ‘ssh’ command with one or more ‘ v’ options You should get detailed output concerning your SSH configuration and the authentication process The only thing left is to automate the execution of the fate sh script and the synchronisation of the samples directory Uploading new samples to the fate suite *****************************************If you need a sample uploaded send a mail to samples request This is for developers who have an account on the fate suite server If you upload new please make sure they are as small as space on each network bandwidth and so on benefit from smaller test cases Also keep in mind older checkouts use existing sample that means in practice generally do not remove or overwrite files as it likely would break older checkouts or releases Also all needed samples for a commit should be ideally before the push If you need an account for frequently uploading samples or you wish to help others by doing that send a mail to ffmpeg devel rsync vauL Duo ug o o w
Definition: fate.txt:150
h
h
Definition: vp9dsp_template.c:2038