]> git.sesse.net Git - ffmpeg/commitdiff
vf_scale: Add an option to pass the scaler params
authorLuca Barbato <lu_zero@gentoo.org>
Tue, 25 Aug 2015 21:04:12 +0000 (23:04 +0200)
committerLuca Barbato <lu_zero@gentoo.org>
Wed, 26 Aug 2015 10:13:23 +0000 (12:13 +0200)
Reported-By: zehan@magicpony.technology
libavfilter/vf_scale.c

index 73ea9d23e067323cddc17d70fe9a41de00822328..65cf6323c1d359631f48d5bd9a9ad1f63f0293d3 100644 (file)
@@ -79,6 +79,7 @@ typedef struct ScaleContext {
      */
     int w, h;
     unsigned int flags;         ///sws flags
+    double param[2];            // sws params
 
     int hsub, vsub;             ///< chroma subsampling
     int slice_y;                ///< top of current output slice
@@ -238,7 +239,7 @@ static int config_props(AVFilterLink *outlink)
     else {
         scale->sws = sws_getContext(inlink ->w, inlink ->h, inlink ->format,
                                     outlink->w, outlink->h, outlink->format,
-                                    scale->flags, NULL, NULL, NULL);
+                                    scale->flags, NULL, NULL, scale->param);
         if (!scale->sws)
             return AVERROR(EINVAL);
     }
@@ -300,6 +301,8 @@ static const AVOption options[] = {
     { "w",     "Output video width",          OFFSET(w_expr),    AV_OPT_TYPE_STRING, { .str = "iw" },       .flags = FLAGS },
     { "h",     "Output video height",         OFFSET(h_expr),    AV_OPT_TYPE_STRING, { .str = "ih" },       .flags = FLAGS },
     { "flags", "Flags to pass to libswscale", OFFSET(flags_str), AV_OPT_TYPE_STRING, { .str = "bilinear" }, .flags = FLAGS },
+    { "param0", "Scaler param 0",             OFFSET(param[0]),  AV_OPT_TYPE_DOUBLE, { .dbl = SWS_PARAM_DEFAULT  }, INT_MIN, INT_MAX, FLAGS },
+    { "param1", "Scaler param 1",             OFFSET(param[1]),  AV_OPT_TYPE_DOUBLE, { .dbl = SWS_PARAM_DEFAULT  }, INT_MIN, INT_MAX, FLAGS },
     { NULL },
 };