lavfi/curves: support preset shorthand.

This commit is contained in:
Clément Bœsch 2013-03-26 00:00:15 +01:00
parent dc65d784df
commit 183f3450fd
4 changed files with 15 additions and 11 deletions

View File

@ -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
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 ":".
The filter accepts parameters as a list of @var{key}=@var{value}
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.
@ -2390,6 +2392,12 @@ The previous example can also be achieved with the associated built-in preset:
@example
curves=preset=vintage
@end example
@item
Or simply:
@example
curves=vintage
@end example
@end itemize
@section decimate

View File

@ -30,7 +30,7 @@
#define LIBAVFILTER_VERSION_MAJOR 3
#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, \
LIBAVFILTER_VERSION_MINOR, \

View File

@ -287,12 +287,6 @@ static av_cold int init(AVFilterContext *ctx, const char *args)
CurvesContext *curves = ctx->priv;
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) {
char **pts = curves->comp_points_str;
if (pts[0] || pts[1] || pts[2]) {
@ -354,7 +348,6 @@ static av_cold int init(AVFilterContext *ctx, const char *args)
}
}
av_opt_free(curves);
return 0;
}
@ -424,6 +417,8 @@ static const AVFilterPad curves_outputs[] = {
{ NULL }
};
static const char *const shorthand[] = { "preset", NULL };
AVFilter avfilter_vf_curves = {
.name = "curves",
.description = NULL_IF_CONFIG_SMALL("Adjust components curves."),
@ -433,4 +428,5 @@ AVFilter avfilter_vf_curves = {
.inputs = curves_inputs,
.outputs = curves_outputs,
.priv_class = &curves_class,
.shorthand = shorthand,
};

View File

@ -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-$(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_GRADFUN += fate-filter-gradfun