[FFmpeg-devel] [PATCH] libavfilter image transformations

Daniel G. Taylor dan
Tue Apr 20 23:03:06 CEST 2010


Attached is a patch to add matrix transformation utility methods to 
libavfilter. These are useful for translation, rotation, scaling, etc of 
input pictures and can be easily used from any filter.

This code was originally part of my work on the deshake/stabilize filter 
and the work of Georg Martius from his transcode transform filter.

Example usage:

#include "transform.h"

double matrix[9];

avfilter_get_matrix(shift_x, shift_y, radians, scale, (double *) &matrix);
avfilter_transform(src, dst, src_stride, dst_stride, width, height, 

The code supports creating simple matrices from translation, rotation, 
and scaling parameters, adding/subtracting matrices, multiplying a 
matrix by a scalar, and doing the actual picture transform. It supports 
several types of interpolation and edge fill methods.

This is useful for any filter that might want to transform video frames 
in any way in the future. I have at least one filter that will use this 
but is waiting on motion estimation stuff (deshake/stabilize video).

Take care,
Daniel G. Taylor
-------------- next part --------------
A non-text attachment was scrubbed...
Name: transform.diff
Type: text/x-diff
Size: 11592 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100420/634c1a00/attachment.diff>

More information about the ffmpeg-devel mailing list