Commit 1c02af30 authored by Paul B Mahol's avatar Paul B Mahol

avfilter: add convolution filter

Signed-off-by: 's avatarPaul B Mahol <onemda@gmail.com>
parent b18467a9
...@@ -57,6 +57,7 @@ version <next>: ...@@ -57,6 +57,7 @@ version <next>:
- only seek with the right mouse button in ffplay - only seek with the right mouse button in ffplay
- toggle full screen when double-clicking with the left mouse button in ffplay - toggle full screen when double-clicking with the left mouse button in ffplay
- afftfilt filter - afftfilt filter
- convolution filter
version 2.8: version 2.8:
......
...@@ -4662,6 +4662,68 @@ For example to convert from BT.601 to SMPTE-240M, use the command: ...@@ -4662,6 +4662,68 @@ For example to convert from BT.601 to SMPTE-240M, use the command:
colormatrix=bt601:smpte240m colormatrix=bt601:smpte240m
@end example @end example
@section convolution
Apply convolution 3x3 or 5x5 filter.
The filter accepts the following options:
@table @option
@item 0m
@item 1m
@item 2m
@item 3m
Set matrix for each plane.
Matrix is sequence of 9 or 25 signed integers.
@item 0rdiv
@item 1rdiv
@item 2rdiv
@item 3rdiv
Set multiplier for calculated value for each plane.
@item 0bias
@item 1bias
@item 2bias
@item 3bias
Set bias for each plane. This value is added to the result of the multiplication.
Useful for making the overall image brighter or darker. Default is 0.0.
@end table
@subsection Examples
@itemize
@item
Apply sharpen:
@example
convolution="0 -1 0 -1 5 -1 0 -1 0:0 -1 0 -1 5 -1 0 -1 0:0 -1 0 -1 5 -1 0 -1 0:0 -1 0 -1 5 -1 0 -1 0"
@end example
@item
Apply blur:
@example
convolution="1 1 1 1 1 1 1 1 1:1 1 1 1 1 1 1 1 1:1 1 1 1 1 1 1 1 1:1 1 1 1 1 1 1 1 1:1/9:1/9:1/9:1/9"
@end example
@item
Apply edge enhance:
@example
convolution="0 0 0 -1 1 0 0 0 0:0 0 0 -1 1 0 0 0 0:0 0 0 -1 1 0 0 0 0:0 0 0 -1 1 0 0 0 0:5:1:1:1:0:128:128:128"
@end example
@item
Apply edge detect:
@example
convolution="0 1 0 1 -4 1 0 1 0:0 1 0 1 -4 1 0 1 0:0 1 0 1 -4 1 0 1 0:0 1 0 1 -4 1 0 1 0:5:5:5:1:0:128:128:128"
@end example
@item
Apply emboss:
@example
convolution="-2 -1 0 -1 1 1 0 1 2:-2 -1 0 -1 1 1 0 1 2:-2 -1 0 -1 1 1 0 1 2:-2 -1 0 -1 1 1 0 1 2"
@end example
@end itemize
@section copy @section copy
Copy the input source unchanged to the output. This is mainly useful for Copy the input source unchanged to the output. This is mainly useful for
......
...@@ -123,6 +123,7 @@ OBJS-$(CONFIG_COLORCHANNELMIXER_FILTER) += vf_colorchannelmixer.o ...@@ -123,6 +123,7 @@ OBJS-$(CONFIG_COLORCHANNELMIXER_FILTER) += vf_colorchannelmixer.o
OBJS-$(CONFIG_COLORKEY_FILTER) += vf_colorkey.o OBJS-$(CONFIG_COLORKEY_FILTER) += vf_colorkey.o
OBJS-$(CONFIG_COLORLEVELS_FILTER) += vf_colorlevels.o OBJS-$(CONFIG_COLORLEVELS_FILTER) += vf_colorlevels.o
OBJS-$(CONFIG_COLORMATRIX_FILTER) += vf_colormatrix.o OBJS-$(CONFIG_COLORMATRIX_FILTER) += vf_colormatrix.o
OBJS-$(CONFIG_CONVOLUTION_FILTER) += vf_convolution.o
OBJS-$(CONFIG_COPY_FILTER) += vf_copy.o OBJS-$(CONFIG_COPY_FILTER) += vf_copy.o
OBJS-$(CONFIG_COVER_RECT_FILTER) += vf_cover_rect.o lavfutils.o OBJS-$(CONFIG_COVER_RECT_FILTER) += vf_cover_rect.o lavfutils.o
OBJS-$(CONFIG_CROP_FILTER) += vf_crop.o OBJS-$(CONFIG_CROP_FILTER) += vf_crop.o
......
...@@ -144,6 +144,7 @@ void avfilter_register_all(void) ...@@ -144,6 +144,7 @@ void avfilter_register_all(void)
REGISTER_FILTER(COLORKEY, colorkey, vf); REGISTER_FILTER(COLORKEY, colorkey, vf);
REGISTER_FILTER(COLORLEVELS, colorlevels, vf); REGISTER_FILTER(COLORLEVELS, colorlevels, vf);
REGISTER_FILTER(COLORMATRIX, colormatrix, vf); REGISTER_FILTER(COLORMATRIX, colormatrix, vf);
REGISTER_FILTER(CONVOLUTION, convolution, vf);
REGISTER_FILTER(COPY, copy, vf); REGISTER_FILTER(COPY, copy, vf);
REGISTER_FILTER(COVER_RECT, cover_rect, vf); REGISTER_FILTER(COVER_RECT, cover_rect, vf);
REGISTER_FILTER(CROP, crop, vf); REGISTER_FILTER(CROP, crop, vf);
......
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
#include "libavutil/version.h" #include "libavutil/version.h"
#define LIBAVFILTER_VERSION_MAJOR 6 #define LIBAVFILTER_VERSION_MAJOR 6
#define LIBAVFILTER_VERSION_MINOR 26 #define LIBAVFILTER_VERSION_MINOR 27
#define LIBAVFILTER_VERSION_MICRO 100 #define LIBAVFILTER_VERSION_MICRO 100
#define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \ #define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment