From: lilo_booter Date: Sat, 23 Jul 2005 06:40:31 +0000 (+0000) Subject: + Correction for rounding errors X-Git-Url: http://research.m1stereo.tv/gitweb?a=commitdiff_plain;h=18deadc4f5b3c17c46055d16b78259c561772f29;p=melted + Correction for rounding errors git-svn-id: https://mlt.svn.sourceforge.net/svnroot/mlt/trunk/mlt@779 d19143bc-622f-0410-bfdd-b5b2a6649095 --- diff --git a/src/modules/core/filter_resize.c b/src/modules/core/filter_resize.c index bd8841b..8ad0210 100644 --- a/src/modules/core/filter_resize.c +++ b/src/modules/core/filter_resize.c @@ -75,14 +75,14 @@ static int filter_get_image( mlt_frame this, uint8_t **image, mlt_image_format * //fprintf( stderr, "normalised %dx%d output %dx%d %f %f\n", normalised_width, normalised_height, owidth, oheight, ( float )output_ar, ( float )mlt_properties_get_double( properties, "consumer_aspect_ratio" ) * owidth / oheight ); // Optimised for the input_ar > output_ar case (e.g. widescreen on standard) - int scaled_width = input_ar / output_ar * normalised_width + 0.5; + int scaled_width = ( input_ar * normalised_width ) / output_ar + 0.5; int scaled_height = normalised_height; // Now ensure that our images fit in the output frame if ( scaled_width > normalised_width ) { scaled_width = normalised_width; - scaled_height = output_ar / input_ar * normalised_height + 0.5; + scaled_height = ( output_ar * normalised_height ) / input_ar + 0.5; } // Now calculate the actual image size that we want