[SCM] libav/experimental: Change the syntax of the crop filter from x:y:w:h to w:h:x:y.

siretart at users.alioth.debian.org siretart at users.alioth.debian.org
Sun Jun 30 17:16:09 UTC 2013


The following commit has been merged in the experimental branch:
commit 2bc05d35470d5a18f9c6d2d10be9c1c8ddc2f634
Author: Stefano Sabatini <stefano.sabatini-lala at poste.it>
Date:   Fri Sep 24 23:14:01 2010 +0000

    Change the syntax of the crop filter from x:y:w:h to w:h:x:y.
    
    Slightly more intuitive and required by a pending changes for making
    the filter parametric.
    
    Originally committed as revision 25184 to svn://svn.ffmpeg.org/ffmpeg/trunk

diff --git a/Changelog b/Changelog
index 2a8dcaa..c29d15a 100644
--- a/Changelog
+++ b/Changelog
@@ -37,6 +37,7 @@ version <next>:
 - R10k video decoder
 - ocv_smooth filter
 - frei0r wrapper filter
+- change crop filter syntax to width:height:x:y
 
 
 version 0.6:
diff --git a/doc/ffmpeg-doc.texi b/doc/ffmpeg-doc.texi
index d9c5c14..e43e87e 100644
--- a/doc/ffmpeg-doc.texi
+++ b/doc/ffmpeg-doc.texi
@@ -226,13 +226,13 @@ The following abbreviations are recognized:
 
 @item -aspect @var{aspect}
 Set aspect ratio (4:3, 16:9 or 1.3333, 1.7777).
- at item -croptop @var{size} (deprecated - use -vf crop=x:y:width:height instead)
+ at item -croptop @var{size} (deprecated - use the crop filter instead)
 Set top crop band size (in pixels).
- at item -cropbottom @var{size} (deprecated - use -vf crop=x:y:width:height instead)
+ at item -cropbottom @var{size} (deprecated - use the crop filter instead)
 Set bottom crop band size (in pixels).
- at item -cropleft @var{size} (deprecated - use -vf crop=x:y:width:height instead)
+ at item -cropleft @var{size} (deprecated - use the crop filter instead)
 Set left crop band size (in pixels).
- at item -cropright @var{size} (deprecated - use -vf crop=x:y:width:height instead)
+ at item -cropright @var{size} (deprecated - use the crop filter instead)
 Set right crop band size (in pixels).
 @item -padtop @var{size}
 @item -padbottom @var{size}
diff --git a/doc/filters.texi b/doc/filters.texi
index 2309c56..f934082 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -26,27 +26,27 @@ Below is a description of the currently available video filters.
 
 @section crop
 
-Crop the input video to @var{x}:@var{y}:@var{width}:@var{height}.
+Crop the input video to @var{width}:@var{height}:@var{x}:@var{y}.
 
 @example
-./ffmpeg -i in.avi -vf "crop=0:0:0:240" out.avi
+./ffmpeg -i in.avi -vf "crop=0:240:0:0" out.avi
 @end example
 
- at var{x} and @var{y} specify the position of the top-left corner of the
-output (non-cropped) area.
-
-The default value of @var{x} and @var{y} is 0.
-
 The @var{width} and @var{height} parameters specify the width and height
 of the output (non-cropped) area.
 
 A value of 0 is interpreted as the maximum possible size contained in
 the area delimited by the top-left corner at position x:y.
 
+ at var{x} and @var{y} specify the position of the top-left corner of the
+output (non-cropped) area.
+
+The default value of @var{x} and @var{y} is 0.
+
 For example the parameters:
 
 @example
-"crop=100:100:0:0"
+"crop=0:0:100:100"
 @end example
 
 will delimit the rectangle with the top-left corner placed at position
diff --git a/ffmpeg.c b/ffmpeg.c
index 7fdf57b..df9a99b 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -432,9 +432,9 @@ static int configure_filters(AVInputStream *ist, AVOutputStream *ost)
     last_filter = ist->input_video_filter;
 
     if (ost->video_crop) {
-        snprintf(args, 255, "%d:%d:%d:%d", ost->leftBand, ost->topBand,
-                 codec->width,
-                 codec->height);
+        snprintf(args, 255, "%d:%d:%d:%d",
+                 codec->width, codec->height,
+                 ost->leftBand, ost->topBand);
         if ((ret = avfilter_open(&filter, avfilter_get_by_name("crop"), NULL)) < 0)
             return ret;
         if ((ret = avfilter_init_filter(filter, args, NULL)) < 0)
diff --git a/libavfilter/avfilter.h b/libavfilter/avfilter.h
index 32f75bd..6fe6fa1 100644
--- a/libavfilter/avfilter.h
+++ b/libavfilter/avfilter.h
@@ -25,7 +25,7 @@
 #include "libavutil/avutil.h"
 
 #define LIBAVFILTER_VERSION_MAJOR  1
-#define LIBAVFILTER_VERSION_MINOR 40
+#define LIBAVFILTER_VERSION_MINOR 41
 #define LIBAVFILTER_VERSION_MICRO  0
 
 #define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
diff --git a/libavfilter/vf_crop.c b/libavfilter/vf_crop.c
index 4f8a382..dfbc223 100644
--- a/libavfilter/vf_crop.c
+++ b/libavfilter/vf_crop.c
@@ -73,7 +73,7 @@ static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque)
     CropContext *crop = ctx->priv;
 
     if (args)
-        sscanf(args, "%d:%d:%d:%d", &crop->x, &crop->y, &crop->w, &crop->h);
+        sscanf(args, "%d:%d:%d:%d", &crop->w, &crop->h, &crop->x, &crop->y);
 
     return 0;
 }
@@ -96,8 +96,8 @@ static int config_input(AVFilterLink *link)
     crop->x &= ~((1 << crop->hsub) - 1);
     crop->y &= ~((1 << crop->vsub) - 1);
 
-    av_log(link->dst, AV_LOG_INFO, "x:%d y:%d w:%d h:%d\n",
-           crop->x, crop->y, crop->w, crop->h);
+    av_log(link->dst, AV_LOG_INFO, "w:%d h:%d x:%d y:%d\n",
+           crop->w, crop->h, crop->x, crop->y);
 
     if (crop->x <  0 || crop->y <  0                    ||
         crop->w <= 0 || crop->h <= 0                    ||
@@ -172,7 +172,7 @@ static void draw_slice(AVFilterLink *link, int y, int h, int slice_dir)
 
 AVFilter avfilter_vf_crop = {
     .name      = "crop",
-    .description = NULL_IF_CONFIG_SMALL("Crop the input video to x:y:width:height."),
+    .description = NULL_IF_CONFIG_SMALL("Crop the input video to width:height:x:y."),
 
     .priv_size = sizeof(CropContext),
 
diff --git a/tests/lavfi-regression.sh b/tests/lavfi-regression.sh
index 511e0ae..112dda8 100755
--- a/tests/lavfi-regression.sh
+++ b/tests/lavfi-regression.sh
@@ -22,15 +22,15 @@ do_lavfi() {
     fi
 }
 
-do_lavfi "crop"               "crop=100:100"
-do_lavfi "crop_scale"         "crop=100:100,scale=400:-1"
-do_lavfi "crop_scale_vflip"   "null,null,crop=200:200,crop=20:20,scale=200:200,scale=250:250,vflip,vflip,null,scale=200:200,crop=100:100,vflip,scale=200:200,null,vflip,crop=100:100,null"
-do_lavfi "crop_vflip"         "crop=100:100,vflip"
+do_lavfi "crop"               "crop=0:0:100:100"
+do_lavfi "crop_scale"         "crop=0:0:100:100,scale=400:-1"
+do_lavfi "crop_scale_vflip"   "null,null,crop=0:0:200:200,crop=0:0:20:20,scale=200:200,scale=250:250,vflip,vflip,null,scale=200:200,crop=0:0:100:100,vflip,scale=200:200,null,vflip,crop=0:0:100:100,null"
+do_lavfi "crop_vflip"         "crop=0:0:100:100,vflip"
 do_lavfi "null"               "null"
 do_lavfi "scale200"           "scale=200:200"
 do_lavfi "scale500"           "scale=500:500"
 do_lavfi "vflip"              "vflip"
-do_lavfi "vflip_crop"         "vflip,crop=100:100"
+do_lavfi "vflip_crop"         "vflip,crop=0:0:100:100"
 do_lavfi "vflip_vflip"        "vflip,vflip"
 
 do_lavfi_pixfmts(){

-- 
Libav/FFmpeg packaging



More information about the pkg-multimedia-commits mailing list