summaryrefslogtreecommitdiffstats
path: root/libmpcodecs
diff options
context:
space:
mode:
authorrfelker <rfelker@b3059339-0415-0410-9bf9-f77b7e298cf2>2003-04-27 10:04:39 +0000
committerrfelker <rfelker@b3059339-0415-0410-9bf9-f77b7e298cf2>2003-04-27 10:04:39 +0000
commit70d324884097f31176940571a17f90f44ae773d8 (patch)
tree36e9018b1fd5f30f95f70b7ebfb0cd5c112d9813 /libmpcodecs
parent38fba566e5db39a0d7dc27e21faabfb9f41f6b6c (diff)
downloadmpv-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.c13
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);
}