]> git.sesse.net Git - mlt/commitdiff
fixup and disable rescale changes
authorddennedy <ddennedy@d19143bc-622f-0410-bfdd-b5b2a6649095>
Sat, 7 Feb 2004 02:17:18 +0000 (02:17 +0000)
committerddennedy <ddennedy@d19143bc-622f-0410-bfdd-b5b2a6649095>
Sat, 7 Feb 2004 02:17:18 +0000 (02:17 +0000)
git-svn-id: https://mlt.svn.sourceforge.net/svnroot/mlt/trunk/mlt@119 d19143bc-622f-0410-bfdd-b5b2a6649095

src/modules/avformat/producer_avformat.c
src/modules/gtk2/filter_rescale.c
src/modules/gtk2/producer_pango.c
src/modules/gtk2/producer_pixbuf.c

index d5e6c7e7af86762cc5fc5277059ce2627c8c518e..1f70b171356574bc8278bc973d1ba8c2c02fc281 100644 (file)
@@ -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 );
index 46de666aed06f854a8b225c39dc637964f970fc1..3032e67242eecdc6d896b18feafcb2345e4fdf15 100644 (file)
@@ -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 ) )
index 7fa376484b3cbf346a8a5c9e112b58ae65f0810c..7f842e43ed7326f97b9e7fa25edada193dfb9c00 100644 (file)
@@ -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 );
index 8a1d3a3060756ddce4f6b30754e993d35ca97e96..81255d737760ec16005caff735365ce2e600c414 100644 (file)
@@ -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 );