avfilter: add bm3d filter

Signed-off-by: Paul B Mahol <onemda@gmail.com>
This commit is contained in:
Paul B Mahol 2018-05-09 12:58:23 +02:00
parent ecf38be7c7
commit 544fde1bf8
6 changed files with 1167 additions and 1 deletions

View File

@ -28,6 +28,7 @@ version <next>:
- transpose_npp filter
- AVS2 video encoder via libxavs2
- amultiply filter
- Block-Matching 3d (bm3d) denoising filter
version 4.0:

View File

@ -5729,6 +5729,91 @@ tblend=all_mode=grainextract
@end example
@end itemize
@section bm3d
Denoise frames using Block-Matching 3D algorithm.
The filter accepts the following options.
@table @option
@item sigma
Set denoising strength. Default value is 1.
Allowed range is from 0 to 999.9.
The denoising algorith is very sensitive to sigma, so adjust it
according to the source.
@item block
Set local patch size. This sets dimensions in 2D.
@item bstep
Set sliding step for processing blocks. Default value is 4.
Allowed range is from 1 to 64.
Smaller values allows processing more reference blocks and is slower.
@item group
Set maximal number of similar blocks for 3rd dimension. Default value is 1.
When set to 1, no block matching is done. Larger values allows more blocks
in single group.
Allowed range is from 1 to 256.
@item range
Set radius for search block matching. Default is 9.
Allowed range is from 1 to INT32_MAX.
@item mstep
Set step between two search locations for block matching. Default is 1.
Allowed range is from 1 to 64. Smaller is slower.
@item thmse
Set threshold of mean square error for block matching. Valid range is 0 to
INT32_MAX.
@item hdthr
Set thresholding parameter for hard thresholding in 3D transformed domain.
Larger values results in stronger hard-thresholding filtering in frequency
domain.
@item estim
Set filtering estimation mode. Can be @code{basic} or @code{final}.
Default is @code{basic}.
@item ref
If enabled, filter will use 2nd stream for block matching.
Default is disabled for @code{basic} value of @var{estim} option,
and always enabled if value of @var{estim} is @code{final}.
@item planes
Set planes to filter. Default is all available except alpha.
@end table
@subsection Examples
@itemize
@item
Basic filtering with bm3d:
@example
bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic
@end example
@item
Same as above, but filtering only luma:
@example
bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic:planes=1
@end example
@item
Same as above, but with both estimation modes:
@example
split[a][b],[a]bm3d=sigma=3:block=4:bstep=2:group=1:estim=basic[a],[b][a]bm3d=sigma=3:block=4:bstep=2:group=16:estim=final:ref=1
@end example
@item
Same as above, but prefilter with @ref{nlmeans} filter instead:
@example
split[a][b],[a]nlmeans=s=3:r=7:p=3[a],[b][a]bm3d=sigma=3:block=4:bstep=2:group=16:estim=final:ref=1
@end example
@end itemize
@section boxblur
Apply a boxblur algorithm to the input video.
@ -11691,6 +11776,7 @@ It accepts the following option:
With value 1, it negates the alpha component, if present. Default value is 0.
@end table
@anchor{nlmeans}
@section nlmeans
Denoise frames using Non-Local Means algorithm.

View File

@ -158,6 +158,7 @@ OBJS-$(CONFIG_BITPLANENOISE_FILTER) += vf_bitplanenoise.o
OBJS-$(CONFIG_BLACKDETECT_FILTER) += vf_blackdetect.o
OBJS-$(CONFIG_BLACKFRAME_FILTER) += vf_blackframe.o
OBJS-$(CONFIG_BLEND_FILTER) += vf_blend.o framesync.o
OBJS-$(CONFIG_BM3D_FILTER) += vf_bm3d.o
OBJS-$(CONFIG_BOXBLUR_FILTER) += vf_boxblur.o boxblur.o
OBJS-$(CONFIG_BOXBLUR_OPENCL_FILTER) += vf_avgblur_opencl.o opencl.o \
opencl/avgblur.o boxblur.o

View File

@ -149,6 +149,7 @@ extern AVFilter ff_vf_bitplanenoise;
extern AVFilter ff_vf_blackdetect;
extern AVFilter ff_vf_blackframe;
extern AVFilter ff_vf_blend;
extern AVFilter ff_vf_bm3d;
extern AVFilter ff_vf_boxblur;
extern AVFilter ff_vf_boxblur_opencl;
extern AVFilter ff_vf_bwdif;

View File

@ -30,7 +30,7 @@
#include "libavutil/version.h"
#define LIBAVFILTER_VERSION_MAJOR 7
#define LIBAVFILTER_VERSION_MINOR 30
#define LIBAVFILTER_VERSION_MINOR 31
#define LIBAVFILTER_VERSION_MICRO 100
#define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \

1077
libavfilter/vf_bm3d.c Normal file

File diff suppressed because it is too large Load Diff