]> git.sesse.net Git - mlt/commitdiff
rescale aspect handling redux
authorddennedy <ddennedy@d19143bc-622f-0410-bfdd-b5b2a6649095>
Sat, 7 Feb 2004 03:31:00 +0000 (03:31 +0000)
committerddennedy <ddennedy@d19143bc-622f-0410-bfdd-b5b2a6649095>
Sat, 7 Feb 2004 03:31:00 +0000 (03:31 +0000)
git-svn-id: https://mlt.svn.sourceforge.net/svnroot/mlt/trunk/mlt@120 d19143bc-622f-0410-bfdd-b5b2a6649095

src/modules/gtk2/filter_rescale.c

index 3032e67242eecdc6d896b18feafcb2345e4fdf15..d9c7f83a2a2d38ecc74d52d830dd0a5792e77968 100644 (file)
@@ -58,19 +58,18 @@ static int filter_get_image( mlt_frame this, uint8_t **image, mlt_image_format *
 
 #if 0
        // Determine maximum size within the aspect ratio:
-       double aspect_ratio = mlt_frame_get_aspect_ratio( this );
-       // TODO: these need to be provided
-       double dsar = oheight < 576 ? (8.0 / 9.0) : (48.0 / 45.0);
-       double ssar = iheight < 576 ? (8.0 / 9.0) : (48.0 / 45.0);
+       double i_aspect_ratio = mlt_frame_get_aspect_ratio( this );
+       // TODO: this needs to be provided      q
+       #define o_aspect_ratio ( double )( 4.0 / 3.0 )
 
-       if ( ( (double) owidth * dsar / iwidth * ssar ) < ( (double) oheight / iheight ) )
-               oheight = (double) owidth * dsar / aspect_ratio;
+       if ( ( owidth * i_aspect_ratio * o_aspect_ratio ) > owidth )
+               oheight *= o_aspect_ratio / i_aspect_ratio;
        else
-               owidth = (int)( ( aspect_ratio * oheight / dsar ) + 0.5 ) >> 1 << 1;
+               owidth *= i_aspect_ratio * o_aspect_ratio;
 
-       fprintf( stderr, "rescale: from %dx%d (%f) to %dx%d\n", iwidth, iheight, aspect_ratio, owidth, oheight );
+       fprintf( stderr, "rescale: from %dx%d (%f) to %dx%d\n", iwidth, iheight, i_aspect_ratio, owidth, oheight );
 #endif
-
+       
        // If width and height are correct, don't do anything
        if ( input != NULL && ( iwidth != owidth || iheight != oheight ) )
        {