# HG changeset patch # User rfelker # Date 1051437879 0 # Node ID b2b070bf934e74572d9e9d0dd7fe643478d79220 # Parent 3a6ae4199f6700136c003b7d892e1fe8c3cdac01 generate meaningful d_width & d_height when scaling, rather than useless nonsense. diff -r 3a6ae4199f67 -r b2b070bf934e libmpcodecs/vf_scale.c --- a/libmpcodecs/vf_scale.c Sun Apr 27 09:45:38 2003 +0000 +++ b/libmpcodecs/vf_scale.c Sun Apr 27 10:04:39 2003 +0000 @@ -209,8 +209,17 @@ } 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; + // Compute new d_width and d_height, preserving aspect + // while ensuring that both are >= output size in pixels. + if (vf->priv->h * d_width > vf->priv->w * d_height) { + d_width = vf->priv->h * d_width / d_height; + d_height = vf->priv->h; + } else { + d_height = vf->priv->w * d_height / d_width; + d_width = vf->priv->w; + } + //d_width=d_width*vf->priv->w/width; + //d_height=d_height*vf->priv->h/height; } return vf_next_config(vf,vf->priv->w,vf->priv->h,d_width,d_height,flags,best); }