Commit 183f3450 authored by Clément Bœsch's avatar Clément Bœsch

lavfi/curves: support preset shorthand.

parent dc65d784
...@@ -2328,8 +2328,10 @@ If there is no key point defined in @code{x=0}, the filter will automatically ...@@ -2328,8 +2328,10 @@ 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 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. 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, The filter accepts parameters as a list of @var{key}=@var{value}
separated by ":". pairs, separated by ":". If the key of the first options is omitted,
the arguments are interpreted according to the syntax
curves[=@var{preset}].
A description of the accepted parameters follows. A description of the accepted parameters follows.
...@@ -2390,6 +2392,12 @@ The previous example can also be achieved with the associated built-in preset: ...@@ -2390,6 +2392,12 @@ The previous example can also be achieved with the associated built-in preset:
@example @example
curves=preset=vintage curves=preset=vintage
@end example @end example
@item
Or simply:
@example
curves=vintage
@end example
@end itemize @end itemize
@section decimate @section decimate
......
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
#define LIBAVFILTER_VERSION_MAJOR 3 #define LIBAVFILTER_VERSION_MAJOR 3
#define LIBAVFILTER_VERSION_MINOR 48 #define LIBAVFILTER_VERSION_MINOR 48
#define LIBAVFILTER_VERSION_MICRO 103 #define LIBAVFILTER_VERSION_MICRO 104
#define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \ #define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
LIBAVFILTER_VERSION_MINOR, \ LIBAVFILTER_VERSION_MINOR, \
......
...@@ -287,12 +287,6 @@ static av_cold int init(AVFilterContext *ctx, const char *args) ...@@ -287,12 +287,6 @@ static av_cold int init(AVFilterContext *ctx, const char *args)
CurvesContext *curves = ctx->priv; CurvesContext *curves = ctx->priv;
struct keypoint *comp_points[NB_COMP] = {0}; struct keypoint *comp_points[NB_COMP] = {0};
curves->class = &curves_class;
av_opt_set_defaults(curves);
if ((ret = av_set_options_string(curves, args, "=", ":")) < 0)
return ret;
if (curves->preset) { if (curves->preset) {
char **pts = curves->comp_points_str; char **pts = curves->comp_points_str;
if (pts[0] || pts[1] || pts[2]) { if (pts[0] || pts[1] || pts[2]) {
...@@ -354,7 +348,6 @@ static av_cold int init(AVFilterContext *ctx, const char *args) ...@@ -354,7 +348,6 @@ static av_cold int init(AVFilterContext *ctx, const char *args)
} }
} }
av_opt_free(curves);
return 0; return 0;
} }
...@@ -424,6 +417,8 @@ static const AVFilterPad curves_outputs[] = { ...@@ -424,6 +417,8 @@ static const AVFilterPad curves_outputs[] = {
{ NULL } { NULL }
}; };
static const char *const shorthand[] = { "preset", NULL };
AVFilter avfilter_vf_curves = { AVFilter avfilter_vf_curves = {
.name = "curves", .name = "curves",
.description = NULL_IF_CONFIG_SMALL("Adjust components curves."), .description = NULL_IF_CONFIG_SMALL("Adjust components curves."),
...@@ -433,4 +428,5 @@ AVFilter avfilter_vf_curves = { ...@@ -433,4 +428,5 @@ AVFilter avfilter_vf_curves = {
.inputs = curves_inputs, .inputs = curves_inputs,
.outputs = curves_outputs, .outputs = curves_outputs,
.priv_class = &curves_class, .priv_class = &curves_class,
.shorthand = shorthand,
}; };
...@@ -48,7 +48,7 @@ FATE_HQDN3D += fate-filter-hqdn3d ...@@ -48,7 +48,7 @@ FATE_HQDN3D += fate-filter-hqdn3d
fate-filter-hqdn3d: CMD = framecrc -idct simple -i $(SAMPLES)/smjpeg/scenwin.mjpg -vf perms=random,hqdn3d -an fate-filter-hqdn3d: CMD = framecrc -idct simple -i $(SAMPLES)/smjpeg/scenwin.mjpg -vf perms=random,hqdn3d -an
FATE_FILTER-$(call ALLYES, SMJPEG_DEMUXER MJPEG_DECODER PERMS_FILTER HQDN3D_FILTER) += $(FATE_HQDN3D) FATE_FILTER-$(call ALLYES, SMJPEG_DEMUXER MJPEG_DECODER PERMS_FILTER HQDN3D_FILTER) += $(FATE_HQDN3D)
fate-filter-curves: CMD = framecrc -i $(SAMPLES)/utvideo/utvideo_rgb_median.avi -vf perms=random,curves=preset=vintage fate-filter-curves: CMD = framecrc -i $(SAMPLES)/utvideo/utvideo_rgb_median.avi -vf perms=random,curves=vintage
FATE_FILTER-$(call ALLYES, UTVIDEO_DECODER AVI_DEMUXER PERMS_FILTER CURVES_FILTER) += fate-filter-curves FATE_FILTER-$(call ALLYES, UTVIDEO_DECODER AVI_DEMUXER PERMS_FILTER CURVES_FILTER) += fate-filter-curves
FATE_GRADFUN += fate-filter-gradfun FATE_GRADFUN += fate-filter-gradfun
......
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