diff options
author | rfelker <rfelker@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2003-04-27 10:04:39 +0000 |
---|---|---|
committer | rfelker <rfelker@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2003-04-27 10:04:39 +0000 |
commit | 70d324884097f31176940571a17f90f44ae773d8 (patch) | |
tree | 36e9018b1fd5f30f95f70b7ebfb0cd5c112d9813 /libmpcodecs | |
parent | 38fba566e5db39a0d7dc27e21faabfb9f41f6b6c (diff) | |
download | mpv-70d324884097f31176940571a17f90f44ae773d8.tar.bz2 mpv-70d324884097f31176940571a17f90f44ae773d8.tar.xz |
generate meaningful d_width & d_height when scaling, rather than useless nonsense.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@10003 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libmpcodecs')
-rw-r--r-- | libmpcodecs/vf_scale.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/libmpcodecs/vf_scale.c b/libmpcodecs/vf_scale.c index 960594f7d7..dd6f77503a 100644 --- a/libmpcodecs/vf_scale.c +++ b/libmpcodecs/vf_scale.c @@ -209,8 +209,17 @@ static int config(struct vf_instance_s* vf, } 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); } |