[Ffmpeg-devel] cropping + rescaling broken?

Luca Abeni lucabe72
Tue Mar 7 11:40:48 CET 2006


Hi again,

On Tue, 2006-03-07 at 11:15 +0100, Luca Abeni wrote:

> 4) ./ffmpeg -i /tmp/test.y4m -s 356x576 -croptop 144 -cropbottom 144 out.y4m
>    and look at the result... It's completely wrong! Why? Because this 
>    time ffmpeg does both rescaling (output width = 356) and cropping. 
>    -croptop and -cropbottom decrease the output size by 144 + 144 = 
>    288, so img_resample_full_init() is passed oheight = 288. But then it
>    computes s->pad_oheight = oheight - (padtop + padbottom) = 288 - 144 - 144 =
>    = 0... So it tries to rescale to 0!!!
Sorry, this is wrong; I got confused again...
What happens is that
s->v_incr = ((iheight - topBand - bottomBand) * POS_FRAC) / s->pad_oheight = 0

Anyway, the result looks bogus again... But now I am beginning to
understand... I was expecting ffmpeg to rescale first and crop after
rescaling, but it looks like it does the opposite...
But again, there seems to be an error: if I do
./ffmpeg -i /tmp/test.y4m -s 352x576 -croptop 10 -cropbottom 10 out.y4m
I get
Fmpeg version CVS, Copyright (c) 2000-2004 Fabrice Bellard
  configuration:  
  libavutil version: 49.0.0
  libavcodec version: 51.7.0
  libavformat version: 50.3.0
  built on Mar  7 2006 10:54:23, gcc: 4.0.3 20060304 (prerelease) (Debian 4.0.2-10)
Input #0, yuv4mpegpipe, from '/tmp/test.y4m':
  Duration: N/A, bitrate: N/A
  Stream #0.0, 25.00 fps(r): Video: rawvideo, yuv420p, 352x288
File 'out.y4m' already exists. Overwrite ? [y/N] y
VIncr: 31589
Output #0, yuv4mpegpipe, to 'out.y4m':
  Stream #0.0, 25.00 fps(c): Video: rawvideo, yuv420p, 352x556, q=2-31, 200 kb/s

The output height is 556 = 576 - 10 - 10... This would be correct if
ffmpeg resized before cropping...
It seems that libavcodec/imgresample.c thinks that cropping happens
before resizing, but ffmpeg.c thinks the oppisite :(
Now, I am _very_ confused...


			Luca
-- 
_____________________________________________________________________________
Copy this in your signature, if you think it is important:
                               N O    W A R ! ! !

 
 
 --
 Email.it, the professional e-mail, gratis per te: http://www.email.it/f
 
 Sponsor:
 DVD vergini: acquista online a prezzi vantaggiosi!
 Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid=4589&d=7-3





More information about the ffmpeg-devel mailing list