Commit 65fc80f0 authored by Clément Bœsch's avatar Clément Bœsch

lavfi: add curves filter.

parent 3d813e7e
...@@ -2,6 +2,10 @@ Entries are sorted chronologically from oldest to youngest within each release, ...@@ -2,6 +2,10 @@ Entries are sorted chronologically from oldest to youngest within each release,
releases are sorted from youngest to oldest. releases are sorted from youngest to oldest.
version <next>: version <next>:
- curves filter
version 1.2:
- VDPAU hardware acceleration through normal hwaccel - VDPAU hardware acceleration through normal hwaccel
- SRTP support - SRTP support
......
...@@ -2217,6 +2217,73 @@ indicates never reset and return the largest area encountered during ...@@ -2217,6 +2217,73 @@ indicates never reset and return the largest area encountered during
playback. playback.
@end table @end table
@section curves
Apply color adjustments using curves.
This filter is similar to the Adobe Photoshop and GIMP curves tools. Each
component (red, green and blue) has its values defined by @var{N} key points
tied from each other using a smooth curve. The x-axis represents the pixel
values from the input frame, and the y-axis the new pixel values to be set for
the output frame.
By default, a component curve is defined by the two points @var{(0;0)} and
@var{(1;1)}. This creates a straight line where each original pixel value is
"adjusted" to its own value, which means no change to the image.
The filter allows you to redefine these two points and add some more. A new
curve (using a natural cubic spline interpolation) will be define to pass
smoothly through all these new coordinates. The new defined points needs to be
strictly increasing over the x-axis, and their @var{x} and @var{y} values must
be in the @var{[0;1]} interval. If the computed curves happened to go outside
the vector spaces, the values will be clipped accordingly.
If there is no key point defined in @code{x=0}, the filter will automatically
insert a @var{(0;0)} point. In the same way, if there is no key point defined
in @code{x=1}, the filter will automatically insert a @var{(1;1)} point.
The filter accepts parameters as a list of @var{key}=@var{value} pairs,
separated by ":".
A description of the accepted parameters follows.
@table @option
@item red, r
Set the key points for the red component.
@item green, g
Set the key points for the green component.
@item blue, b
Set the key points for the blue component.
@end table
To avoid some filtergraph syntax conflicts, each key points list need to be
defined using the following syntax: @code{x0/y0 x1/y1 x2/y2 ...}.
@subsection Examples
@itemize
@item
Increase slightly the middle level of blue:
@example
curves=blue='0.5/0.58'
@end example
@item
Vintage effect:
@example
curves=r='0/0.11 .42/.51 1/0.95':g='0.50/0.48':b='0/0.22 .49/.44 1/0.8'
@end example
Here we obtain the following coordinates for each components:
@table @var
@item red
@code{(0;0.11) (0.42;0.51) (1;0.95)}
@item green
@code{(0;0) (0.50;0.48) (1;1)}
@item blue
@code{(0;0.22) (0.49;0.44) (1;0.80)}
@end table
@end itemize
@section decimate @section decimate
Drop frames that do not differ greatly from the previous frame in Drop frames that do not differ greatly from the previous frame in
......
...@@ -104,6 +104,7 @@ OBJS-$(CONFIG_COLORMATRIX_FILTER) += vf_colormatrix.o ...@@ -104,6 +104,7 @@ OBJS-$(CONFIG_COLORMATRIX_FILTER) += vf_colormatrix.o
OBJS-$(CONFIG_COPY_FILTER) += vf_copy.o OBJS-$(CONFIG_COPY_FILTER) += vf_copy.o
OBJS-$(CONFIG_CROP_FILTER) += vf_crop.o OBJS-$(CONFIG_CROP_FILTER) += vf_crop.o
OBJS-$(CONFIG_CROPDETECT_FILTER) += vf_cropdetect.o OBJS-$(CONFIG_CROPDETECT_FILTER) += vf_cropdetect.o
OBJS-$(CONFIG_CURVES_FILTER) += vf_curves.o
OBJS-$(CONFIG_DECIMATE_FILTER) += vf_decimate.o OBJS-$(CONFIG_DECIMATE_FILTER) += vf_decimate.o
OBJS-$(CONFIG_DELOGO_FILTER) += vf_delogo.o OBJS-$(CONFIG_DELOGO_FILTER) += vf_delogo.o
OBJS-$(CONFIG_DESHAKE_FILTER) += vf_deshake.o OBJS-$(CONFIG_DESHAKE_FILTER) += vf_deshake.o
......
...@@ -100,6 +100,7 @@ void avfilter_register_all(void) ...@@ -100,6 +100,7 @@ void avfilter_register_all(void)
REGISTER_FILTER(COPY, copy, vf); REGISTER_FILTER(COPY, copy, vf);
REGISTER_FILTER(CROP, crop, vf); REGISTER_FILTER(CROP, crop, vf);
REGISTER_FILTER(CROPDETECT, cropdetect, vf); REGISTER_FILTER(CROPDETECT, cropdetect, vf);
REGISTER_FILTER(CURVES, curves, vf);
REGISTER_FILTER(DECIMATE, decimate, vf); REGISTER_FILTER(DECIMATE, decimate, vf);
REGISTER_FILTER(DELOGO, delogo, vf); REGISTER_FILTER(DELOGO, delogo, vf);
REGISTER_FILTER(DESHAKE, deshake, vf); REGISTER_FILTER(DESHAKE, deshake, vf);
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
#include "libavutil/avutil.h" #include "libavutil/avutil.h"
#define LIBAVFILTER_VERSION_MAJOR 3 #define LIBAVFILTER_VERSION_MAJOR 3
#define LIBAVFILTER_VERSION_MINOR 43 #define LIBAVFILTER_VERSION_MINOR 44
#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