From: ddennedy Date: Sat, 7 Feb 2004 02:17:18 +0000 (+0000) Subject: fixup and disable rescale changes X-Git-Url: http://research.m1stereo.tv/gitweb?a=commitdiff_plain;h=3b7c7ca36c323c8daae9d3ef3ddce8d73befdd9e;p=melted fixup and disable rescale changes git-svn-id: https://mlt.svn.sourceforge.net/svnroot/mlt/trunk/mlt@119 d19143bc-622f-0410-bfdd-b5b2a6649095 --- diff --git a/src/modules/avformat/producer_avformat.c b/src/modules/avformat/producer_avformat.c index d5e6c7e..1f70b17 100644 --- a/src/modules/avformat/producer_avformat.c +++ b/src/modules/avformat/producer_avformat.c @@ -507,6 +507,7 @@ static void producer_set_up_video( mlt_producer this, mlt_frame frame ) aspect_ratio = ( double )codec_context->width / ( double )codec_context->height; mlt_properties_set_double( properties, "aspect_ratio", aspect_ratio ); + fprintf( stderr, "avformat: %dx%d (%f)\n", codec_context->width, codec_context->height, av_q2d( codec_context->sample_aspect_ratio ) ); // Now store the codec with its destructor mlt_properties_set_data( properties, "video_codec", codec_context, 0, producer_codec_close, NULL ); diff --git a/src/modules/gtk2/filter_rescale.c b/src/modules/gtk2/filter_rescale.c index 46de666..3032e67 100644 --- a/src/modules/gtk2/filter_rescale.c +++ b/src/modules/gtk2/filter_rescale.c @@ -56,17 +56,20 @@ static int filter_get_image( mlt_frame this, uint8_t **image, mlt_image_format * mlt_frame_get_image( this, &input, format, &iwidth, &iheight, 0 ); +#if 0 // Determine maximum size within the aspect ratio: double aspect_ratio = mlt_frame_get_aspect_ratio( this ); - float display_aspect_ratio = 4.0 / 3.0; // (float)iwidth / (float)iheight; - if ( *width < *height * aspect_ratio ) - oheight = *width / aspect_ratio; + // 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); + + if ( ( (double) owidth * dsar / iwidth * ssar ) < ( (double) oheight / iheight ) ) + oheight = (double) owidth * dsar / aspect_ratio; else - owidth = *height * aspect_ratio; - if ( ( float )owidth * display_aspect_ratio < *width ) - owidth = ( int )( ( float )owidth * display_aspect_ratio ); - else if ( ( float )oheight * display_aspect_ratio < *height ) - oheight = ( int )( ( float )oheight * display_aspect_ratio ); + owidth = (int)( ( aspect_ratio * oheight / dsar ) + 0.5 ) >> 1 << 1; + + fprintf( stderr, "rescale: from %dx%d (%f) to %dx%d\n", iwidth, iheight, aspect_ratio, owidth, oheight ); +#endif // If width and height are correct, don't do anything if ( input != NULL && ( iwidth != owidth || iheight != oheight ) ) diff --git a/src/modules/gtk2/producer_pango.c b/src/modules/gtk2/producer_pango.c index 7fa3764..7f842e4 100644 --- a/src/modules/gtk2/producer_pango.c +++ b/src/modules/gtk2/producer_pango.c @@ -257,7 +257,7 @@ static int producer_get_frame( mlt_producer producer, mlt_frame_ptr frame, int i { GdkPixbuf *temp = pixbuf; GdkPixbuf *scaled = gdk_pixbuf_scale_simple( pixbuf, - (gint) ( (float) gdk_pixbuf_get_width( pixbuf ) * 54.0/59.0), + (gint) ( (float) gdk_pixbuf_get_width( pixbuf ) * 45.0/48.0), gdk_pixbuf_get_height( pixbuf ), GDK_INTERP_HYPER ); pixbuf = scaled; g_object_unref( temp ); @@ -266,7 +266,7 @@ static int producer_get_frame( mlt_producer producer, mlt_frame_ptr frame, int i { GdkPixbuf *temp = pixbuf; GdkPixbuf *scaled = gdk_pixbuf_scale_simple( pixbuf, - (gint) ( (float) gdk_pixbuf_get_width( pixbuf ) * 11.0/10.0 ), + (gint) ( (float) gdk_pixbuf_get_width( pixbuf ) * 9.0/8.0 ), gdk_pixbuf_get_height( pixbuf ), GDK_INTERP_HYPER ); pixbuf = scaled; g_object_unref( temp ); diff --git a/src/modules/gtk2/producer_pixbuf.c b/src/modules/gtk2/producer_pixbuf.c index 8a1d3a3..81255d7 100644 --- a/src/modules/gtk2/producer_pixbuf.c +++ b/src/modules/gtk2/producer_pixbuf.c @@ -250,7 +250,7 @@ static int producer_get_frame( mlt_producer producer, mlt_frame_ptr frame, int i { GdkPixbuf *temp = pixbuf; GdkPixbuf *scaled = gdk_pixbuf_scale_simple( pixbuf, - (gint) ( (float) gdk_pixbuf_get_width( pixbuf ) * 54.0/59.0), + (gint) ( (float) gdk_pixbuf_get_width( pixbuf ) * 45.0/48.0), gdk_pixbuf_get_height( pixbuf ), GDK_INTERP_HYPER ); pixbuf = scaled; g_object_unref( temp ); @@ -259,7 +259,7 @@ static int producer_get_frame( mlt_producer producer, mlt_frame_ptr frame, int i { GdkPixbuf *temp = pixbuf; GdkPixbuf *scaled = gdk_pixbuf_scale_simple( pixbuf, - (gint) ( (float) gdk_pixbuf_get_width( pixbuf ) * 11.0/10.0 ), + (gint) ( (float) gdk_pixbuf_get_width( pixbuf ) * 9.0/8.0 ), gdk_pixbuf_get_height( pixbuf ), GDK_INTERP_HYPER ); pixbuf = scaled; g_object_unref( temp );