[Mplayer-cvslog] CVS: main/libmpcodecs vf_scale.c,1.39,1.40

Richard Felker CVS rfelker at mplayerhq.hu
Sun Apr 27 12:05:03 CEST 2003


Update of /cvsroot/mplayer/main/libmpcodecs
In directory mail:/var/tmp.root/cvs-serv12888/libmpcodecs

Modified Files:
	vf_scale.c 
Log Message:
generate meaningful d_width & d_height when scaling, rather than useless nonsense.


Index: vf_scale.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpcodecs/vf_scale.c,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -r1.39 -r1.40
--- vf_scale.c	25 Apr 2003 11:26:08 -0000	1.39
+++ vf_scale.c	27 Apr 2003 10:04:39 -0000	1.40
@@ -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);
 }



More information about the MPlayer-cvslog mailing list