Commit ce6b6ef6 authored by Stefano Sabatini's avatar Stefano Sabatini Committed by Anton Khirnov

lavfi: port boxblur filter from libmpcodecs

With the following additions:
* support to gray format
* support to yuva420p format
* parametric luma/chroma/alpha radius
* consistency check on the radius values, avoid crashes with invalid values
Signed-off-by: 's avatarAnton Khirnov <anton@khirnov.net>
parent 171868e2
......@@ -51,6 +51,7 @@ easier to use. The changes are:
- CELT in Ogg demuxing
- VC-1 interlaced decoding
- lut, lutrgb, and lutyuv filters
- boxblur filter
version 0.7:
......
......@@ -1480,6 +1480,7 @@ udp_protocol_deps="network"
# filters
blackframe_filter_deps="gpl"
boxblur_filter_deps="gpl"
cropdetect_filter_deps="gpl"
drawtext_filter_deps="libfreetype"
frei0r_filter_deps="frei0r dlopen strtok_r"
......
......@@ -183,6 +183,66 @@ threshold, and defaults to 98.
@var{threshold} is the threshold below which a pixel value is
considered black, and defaults to 32.
@section boxblur
Apply boxblur algorithm to the input video.
This filter accepts the parameters:
@var{luma_power}:@var{luma_radius}:@var{chroma_radius}:@var{chroma_power}:@var{alpha_radius}:@var{alpha_power}
Chroma and alpha parameters are optional, if not specified they default
to the corresponding values set for @var{luma_radius} and
@var{luma_power}.
@var{luma_radius}, @var{chroma_radius}, and @var{alpha_radius} represent
the radius in pixels of the box used for blurring the corresponding
input plane. They are expressions, and can contain the following
constants:
@table @option
@item w, h
the input width and heigth in pixels
@item cw, ch
the input chroma image width and height in pixels
@item hsub, vsub
horizontal and vertical chroma subsample values. For example for the
pixel format "yuv422p" @var{hsub} is 2 and @var{vsub} is 1.
@end table
The radius must be a non-negative number, and must not be greater than
the value of the expression @code{min(w,h)/2} for the luma and alpha planes,
and of @code{min(cw,ch)/2} for the chroma planes.
@var{luma_power}, @var{chroma_power}, and @var{alpha_power} represent
how many times the boxblur filter is applied to the corresponding
plane.
Some examples follow:
@itemize
@item
Apply a boxblur filter with luma, chroma, and alpha radius
set to 2:
@example
boxblur=2:1
@end example
@item
Set luma radius to 2, alpha and chroma radius to 0
@example
boxblur=2:1:0:0:0:0
@end example
@item
Set luma and chroma radius to a fraction of the video dimension
@example
boxblur=min(h\,w)/10:1:min(cw\,ch)/10:1
@end example
@end itemize
@section copy
Copy the input source unchanged to the output. Mainly useful for
......
......@@ -20,6 +20,7 @@ OBJS-$(CONFIG_ANULLSRC_FILTER) += asrc_anullsrc.o
OBJS-$(CONFIG_ANULLSINK_FILTER) += asink_anullsink.o
OBJS-$(CONFIG_BLACKFRAME_FILTER) += vf_blackframe.o
OBJS-$(CONFIG_BOXBLUR_FILTER) += vf_boxblur.o
OBJS-$(CONFIG_COPY_FILTER) += vf_copy.o
OBJS-$(CONFIG_CROP_FILTER) += vf_crop.o
OBJS-$(CONFIG_CROPDETECT_FILTER) += vf_cropdetect.o
......
......@@ -41,6 +41,7 @@ void avfilter_register_all(void)
REGISTER_FILTER (ANULLSINK, anullsink, asink);
REGISTER_FILTER (BLACKFRAME, blackframe, vf);
REGISTER_FILTER (BOXBLUR, boxblur, vf);
REGISTER_FILTER (COPY, copy, vf);
REGISTER_FILTER (CROP, crop, vf);
REGISTER_FILTER (CROPDETECT, cropdetect, vf);
......
......@@ -29,7 +29,7 @@
#include "libavutil/rational.h"
#define LIBAVFILTER_VERSION_MAJOR 2
#define LIBAVFILTER_VERSION_MINOR 9
#define LIBAVFILTER_VERSION_MINOR 10
#define LIBAVFILTER_VERSION_MICRO 0
#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