diff -ur /tmp/MPlayer-1.0pre5/DOCS/man/en/mplayer.1 ./DOCS/man/en/mplayer.1 --- /tmp/MPlayer-1.0pre5/DOCS/man/en/mplayer.1 2004-07-14 15:07:36.000000000 -0700 +++ ./DOCS/man/en/mplayer.1 2004-07-28 18:57:13.000000000 -0700 @@ -3013,12 +3013,24 @@ .RE .PD 1 .TP -.B cropdetect[=0\-255] +.B cropdetect[=limit:round] Calculates necessary cropping parameters and prints the recommended parameters to stdout. -The threshold can be optionally specified from nothing (0) to everything +.PD 0 +.RSs +.IPs limit +threshold, which can be optionally specified from nothing (0) to everything (255). (default: 24) +.br +.IPs round +value which the width/height should be divisible by. +The offset is automatically adjusted to center the video. +Use \'2\' to get only even dimentions (needed for 4:2:2 video). +\'16\' is best when encoding to most video codecs. +(default: 1) +.RE +.PD 1 .TP .B rectangle[=w:h:x:y] The plugin responds to the input.conf directive 'change_rectangle' diff -ur /tmp/MPlayer-1.0pre5/libmpcodecs/vf_cropdetect.c ./libmpcodecs/vf_cropdetect.c --- /tmp/MPlayer-1.0pre5/libmpcodecs/vf_cropdetect.c 2003-10-25 11:37:34.000000000 -0700 +++ ./libmpcodecs/vf_cropdetect.c 2004-07-28 15:13:56.000000000 -0700 @@ -16,6 +16,7 @@ struct vf_priv_s { int x1,y1,x2,y2; int limit; + int round; int fno; }; @@ -57,7 +58,7 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi){ mp_image_t *dmpi; int bpp=mpi->bpp/8; - int x,y; + int w,h,x,y; // hope we'll get DR buffer: dmpi=vf_get_image(vf->next,mpi->imgfmt, @@ -105,12 +106,27 @@ x=(vf->priv->x1+1)&(~1); y=(vf->priv->y1+1)&(~1); - + w=(vf->priv->x2+1-x)&(~1); + h=(vf->priv->y2+1-y)&(~1); + + if ( vf->priv->round > 1 ){ + while ( w % vf->priv->round != 0 ) { + --w; + if( w % 2 == 0 ) + ++x; + } + + while ( h % vf->priv->round != 0 ) { + --h; + if( h % 2 == 0 ) + ++y; + } + } printf("crop area: X: %d..%d Y: %d..%d (-vf crop=%d:%d:%d:%d)\n", vf->priv->x1,vf->priv->x2, vf->priv->y1,vf->priv->y2, - (vf->priv->x2+1-x)&(~1),(vf->priv->y2+1-y)&(~1),x,y - ); + w,h,x,y); + } @@ -124,7 +140,9 @@ vf->put_image=put_image; vf->priv=malloc(sizeof(struct vf_priv_s)); vf->priv->limit=24; // should be option - if(args) vf->priv->limit=atoi(args); + if(args) sscanf(args, "%d:%d", + &vf->priv->limit, + &vf->priv->round); return 1; }