Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
7d4fe0c5
Commit
7d4fe0c5
authored
Nov 21, 2017
by
Richard Ling
Committed by
Paul B Mahol
Nov 25, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avfilter: add normalize filter
parent
279d2599
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
470 additions
and
1 deletion
+470
-1
Changelog
Changelog
+1
-0
filters.texi
doc/filters.texi
+80
-0
Makefile
libavfilter/Makefile
+1
-0
allfilters.c
libavfilter/allfilters.c
+1
-0
version.h
libavfilter/version.h
+1
-1
vf_normalize.c
libavfilter/vf_normalize.c
+386
-0
No files found.
Changelog
View file @
7d4fe0c5
...
...
@@ -19,6 +19,7 @@ version <next>:
- acontrast audio filter
- OpenCL overlay filter
- video mix filter
- video normalize filter
version 3.4:
...
...
doc/filters.texi
View file @
7d4fe0c5
...
...
@@ -10867,6 +10867,86 @@ Add temporal and uniform noise to input video:
noise=alls=20:allf=t+u
@end example
@section normalize
Normalize RGB video (aka histogram stretching, contrast stretching).
See: https://en.wikipedia.org/wiki/Normalization_(image_processing)
For each channel of each frame, the filter computes the input range and maps
it linearly to the user-specified output range. The output range defaults
to the full dynamic range from pure black to pure white.
Temporal smoothing can be used on the input range to reduce flickering (rapid
changes in brightness) caused when small dark or bright objects enter or leave
the scene. This is similar to the auto-exposure (automatic gain control) on a
video camera, and, like a video camera, it may cause a period of over- or
under-exposure of the video.
The R,G,B channels can be normalized independently, which may cause some
color shifting, or linked together as a single channel, which prevents
color shifting. Linked normalization preserves hue. Independent normalization
does not, so it can be used to remove some color casts. Independent and linked
normalization can be combined in any ratio.
The normalize filter accepts the following options:
@table @option
@item blackpt
@item whitept
Colors which define the output range. The minimum input value is mapped to
the @var{blackpt}. The maximum input value is mapped to the @var{whitept}.
The defaults are black and white respectively. Specifying white for
@var{blackpt} and black for @var{whitept} will give color-inverted,
normalized video. Shades of grey can be used to reduce the dynamic range
(contrast). Specifying saturated colors here can create some interesting
effects.
@item smoothing
The number of previous frames to use for temporal smoothing. The input range
of each channel is smoothed using a rolling average over the current frame
and the @var{smoothing} previous frames. The default is 0 (no temporal
smoothing).
@item independence
Controls the ratio of independent (color shifting) channel normalization to
linked (color preserving) normalization. 0.0 is fully linked, 1.0 is fully
independent. Defaults to 1.0 (fully independent).
@item strength
Overall strength of the filter. 1.0 is full strength. 0.0 is a rather
expensive no-op. Defaults to 1.0 (full strength).
@end table
@subsection Examples
Stretch video contrast to use the full dynamic range, with no temporal
smoothing; may flicker depending on the source content:
@example
normalize=blackpt=black:whitept=white:smoothing=0
@end example
As above, but with 50 frames of temporal smoothing; flicker should be
reduced, depending on the source content:
@example
normalize=blackpt=black:whitept=white:smoothing=50
@end example
As above, but with hue-preserving linked channel normalization:
@example
normalize=blackpt=black:whitept=white:smoothing=50:independence=0
@end example
As above, but with half strength:
@example
normalize=blackpt=black:whitept=white:smoothing=50:independence=0:strength=0.5
@end example
Map the darkest input color to red, the brightest input color to cyan:
@example
normalize=blackpt=red:whitept=cyan
@end example
@section null
Pass the video source unchanged to the output.
...
...
libavfilter/Makefile
View file @
7d4fe0c5
...
...
@@ -247,6 +247,7 @@ OBJS-$(CONFIG_NLMEANS_FILTER) += vf_nlmeans.o
OBJS-$(CONFIG_NNEDI_FILTER)
+=
vf_nnedi.o
OBJS-$(CONFIG_NOFORMAT_FILTER)
+=
vf_format.o
OBJS-$(CONFIG_NOISE_FILTER)
+=
vf_noise.o
OBJS-$(CONFIG_NORMALIZE_FILTER)
+=
vf_normalize.o
OBJS-$(CONFIG_NULL_FILTER)
+=
vf_null.o
OBJS-$(CONFIG_OCR_FILTER)
+=
vf_ocr.o
OBJS-$(CONFIG_OCV_FILTER)
+=
vf_libopencv.o
...
...
libavfilter/allfilters.c
View file @
7d4fe0c5
...
...
@@ -257,6 +257,7 @@ static void register_all(void)
REGISTER_FILTER
(
NNEDI
,
nnedi
,
vf
);
REGISTER_FILTER
(
NOFORMAT
,
noformat
,
vf
);
REGISTER_FILTER
(
NOISE
,
noise
,
vf
);
REGISTER_FILTER
(
NORMALIZE
,
normalize
,
vf
);
REGISTER_FILTER
(
NULL
,
null
,
vf
);
REGISTER_FILTER
(
OCR
,
ocr
,
vf
);
REGISTER_FILTER
(
OCV
,
ocv
,
vf
);
...
...
libavfilter/version.h
View file @
7d4fe0c5
...
...
@@ -30,7 +30,7 @@
#include "libavutil/version.h"
#define LIBAVFILTER_VERSION_MAJOR 7
#define LIBAVFILTER_VERSION_MINOR
3
#define LIBAVFILTER_VERSION_MINOR
4
#define LIBAVFILTER_VERSION_MICRO 100
#define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
...
...
libavfilter/vf_normalize.c
0 → 100644
View file @
7d4fe0c5
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment