[MPlayer-dev-eng] bogus d_width/d_height behavior in vf_scale
D Richard Felker III
dalias at aerifal.cx
Sat Apr 26 18:26:15 CEST 2003
I'm adding automatic aspect encoding support to ve_lavc, and I've run
into a little problem. Ideally the user should be able to turn this on
in the mencoder config file to always use it. However, automatic
aspect calculation is based on d_width and d_height passed to ve_lavc,
and unfortunately, these numbers are totally bogus when vf_scale is
used...
If you read vf_scale's config function, you'll see:
if(!opt_screen_size_x && !opt_screen_size_y){
d_width=d_width*vf->priv->w/width;
d_height=d_height*vf->priv->h/height;
}
i.e. it tries to readjust d_width and d_height to keep the original
aspect, adjusted by your scale factors... But this is total nonsense,
since the primary purpose of vf_scale is to fix aspect (to square
pixels). It also of course makes vf_scale behave very strangely with
vo's that also support hardware scaling.
Since the same information is there, just scaled to a different size,
scaling should *not* affect the aspect. I.e. if the input is 720x480
with 4:3 aspect, and you scale to 640x480 or 320x240 or 480x480, the
aspect should still be 4:3.
I see two possible fixes...
One way would be to leave d_width and d_height alone. However, this
way scaling with vf_scale would not affect display size on vo's with
hardware scaling, so if you scaled a 320x240 movie up to 640x480,
you'd still see it in a 320x240 window... This seems bad.
The other fix is to scale both d_width and d_height by the *same*
number, either vf->priv->w/width or vf->priv->h/height, or even their
average or something. This will ensure that aspect does not get
trashed, while also adjusting the display width and height
appropriately. IMO it makes the most sense to choose the bigger of
vf->priv->w/width and vf->priv->h/height and use this as the display
size scaling factor...
Comments? If no one strongly objects I'll implement fix 2 sometime
soon.
Rich
More information about the MPlayer-dev-eng
mailing list