[FFmpeg-cvslog] r25184 - in trunk: Changelog doc/ffmpeg-doc.texi doc/filters.texi ffmpeg.c libavfilter/avfilter.h libavfilter/vf_crop.c tests/lavfi-regression.sh

stefano subversion
Sat Sep 25 01:14:01 CEST 2010


Author: stefano
Date: Sat Sep 25 01:14:01 2010
New Revision: 25184

Log:
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.

Modified:
   trunk/Changelog
   trunk/doc/ffmpeg-doc.texi
   trunk/doc/filters.texi
   trunk/ffmpeg.c
   trunk/libavfilter/avfilter.h
   trunk/libavfilter/vf_crop.c
   trunk/tests/lavfi-regression.sh

Modified: trunk/Changelog
==============================================================================
--- trunk/Changelog	Fri Sep 24 22:42:08 2010	(r25183)
+++ trunk/Changelog	Sat Sep 25 01:14:01 2010	(r25184)
@@ -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:

Modified: trunk/doc/ffmpeg-doc.texi
==============================================================================
--- trunk/doc/ffmpeg-doc.texi	Fri Sep 24 22:42:08 2010	(r25183)
+++ trunk/doc/ffmpeg-doc.texi	Sat Sep 25 01:14:01 2010	(r25184)
@@ -226,13 +226,13 @@ The following abbreviations are recogniz
 
 @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}

Modified: trunk/doc/filters.texi
==============================================================================
--- trunk/doc/filters.texi	Fri Sep 24 22:42:08 2010	(r25183)
+++ trunk/doc/filters.texi	Sat Sep 25 01:14:01 2010	(r25184)
@@ -26,27 +26,27 @@ Below is a description of the currently 
 
 @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

Modified: trunk/ffmpeg.c
==============================================================================
--- trunk/ffmpeg.c	Fri Sep 24 22:42:08 2010	(r25183)
+++ trunk/ffmpeg.c	Sat Sep 25 01:14:01 2010	(r25184)
@@ -432,9 +432,9 @@ static int configure_filters(AVInputStre
     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)

Modified: trunk/libavfilter/avfilter.h
==============================================================================
--- trunk/libavfilter/avfilter.h	Fri Sep 24 22:42:08 2010	(r25183)
+++ trunk/libavfilter/avfilter.h	Sat Sep 25 01:14:01 2010	(r25184)
@@ -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, \

Modified: trunk/libavfilter/vf_crop.c
==============================================================================
--- trunk/libavfilter/vf_crop.c	Fri Sep 24 22:42:08 2010	(r25183)
+++ trunk/libavfilter/vf_crop.c	Sat Sep 25 01:14:01 2010	(r25184)
@@ -73,7 +73,7 @@ static av_cold int init(AVFilterContext 
     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 *li
     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 *lin
 
 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),
 

Modified: trunk/tests/lavfi-regression.sh
==============================================================================
--- trunk/tests/lavfi-regression.sh	Fri Sep 24 22:42:08 2010	(r25183)
+++ trunk/tests/lavfi-regression.sh	Sat Sep 25 01:14:01 2010	(r25184)
@@ -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(){



More information about the ffmpeg-cvslog mailing list