[FFmpeg-cvslog] lavfi/curves: support preset shorthand.

Clément Bœsch git at videolan.org
Tue Mar 26 00:05:13 CET 2013


ffmpeg | branch: master | Clément Bœsch <ubitux at gmail.com> | Tue Mar 26 00:00:15 2013 +0100| [183f3450fda08ecccd824c1e44936c6c0a7262e4] | committer: Clément Bœsch

lavfi/curves: support preset shorthand.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=183f3450fda08ecccd824c1e44936c6c0a7262e4
---

 doc/filters.texi        |   12 ++++++++++--
 libavfilter/version.h   |    2 +-
 libavfilter/vf_curves.c |   10 +++-------
 tests/fate/filter.mak   |    2 +-
 4 files changed, 15 insertions(+), 11 deletions(-)

diff --git a/doc/filters.texi b/doc/filters.texi
index 94fc6f3..450f6ab 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -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
+
+ at item
+Or simply:
+ at example
+curves=vintage
+ at end example
 @end itemize
 
 @section decimate
diff --git a/libavfilter/version.h b/libavfilter/version.h
index d0ed722..ce6d874 100644
--- a/libavfilter/version.h
+++ b/libavfilter/version.h
@@ -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, \
diff --git a/libavfilter/vf_curves.c b/libavfilter/vf_curves.c
index d83b702..6137262 100644
--- a/libavfilter/vf_curves.c
+++ b/libavfilter/vf_curves.c
@@ -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,
 };
diff --git a/tests/fate/filter.mak b/tests/fate/filter.mak
index 23724b1..4b1b056 100644
--- a/tests/fate/filter.mak
+++ b/tests/fate/filter.mak
@@ -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



More information about the ffmpeg-cvslog mailing list