Browse code

Support setting flags for sws.

Originally committed as revision 23041 to svn://svn.ffmpeg.org/ffmpeg/trunk

Michael Niedermayer authored on 2010/05/07 18:20:45
Showing 1 changed files
... ...
@@ -36,6 +36,7 @@ typedef struct {
36 36
      *  -1 = keep original aspect
37 37
      */
38 38
     int w, h;
39
+    unsigned int flags;         ///sws flags
39 40
 
40 41
     int hsub, vsub;             ///< chroma subsampling
41 42
     int slice_y;                ///< top of current output slice
... ...
@@ -46,8 +47,11 @@ static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque)
46 46
 {
47 47
     ScaleContext *scale = ctx->priv;
48 48
 
49
-    if (args)
49
+    scale->flags = SWS_BILINEAR;
50
+    if (args){
50 51
         sscanf(args, "%d:%d", &scale->w, &scale->h);
52
+        sscanf(strstr(args,"flags="), "flags=%i", &scale->flags);
53
+    }
51 54
 
52 55
     /* sanity check params */
53 56
     if (scale->w <  -1 || scale->h <  -1) {
... ...
@@ -124,7 +128,7 @@ static int config_props(AVFilterLink *outlink)
124 124
     /* TODO: make algorithm configurable */
125 125
     scale->sws = sws_getContext(inlink ->w, inlink ->h, inlink ->format,
126 126
                                 outlink->w, outlink->h, outlink->format,
127
-                                SWS_BILINEAR, NULL, NULL, NULL);
127
+                                scale->flags, NULL, NULL, NULL);
128 128
 
129 129
     av_log(ctx, AV_LOG_INFO, "w:%d h:%d fmt:%s\n",
130 130
            outlink->w, outlink->h, av_pix_fmt_descriptors[outlink->format].name);