diff libmpcodecs/vf_scale.c @ 10002:b2b070bf934e

generate meaningful d_width & d_height when scaling, rather than useless nonsense.
author rfelker
date Sun, 27 Apr 2003 10:04:39 +0000
parents 3d8b145a5470
children 3193d477c2f0
line wrap: on
line diff
--- 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);
 }