From b7ec88d437f7eca013393fa3bf4798956a2fe7fd Mon Sep 17 00:00:00 2001 From: ddennedy Date: Sun, 28 Dec 2008 02:39:28 +0000 Subject: [PATCH] filter_rescale.c, producer_avformat.c, producer_libdv.c, producer_consumer.c: coerce a deinterlace when scaling an interlaced source. git-svn-id: https://mlt.svn.sourceforge.net/svnroot/mlt/trunk/mlt@1294 d19143bc-622f-0410-bfdd-b5b2a6649095 --- src/modules/avformat/producer_avformat.c | 2 ++ src/modules/core/filter_rescale.c | 7 ++++++- src/modules/core/producer_consumer.c | 7 +++++-- src/modules/dv/producer_libdv.c | 2 ++ 4 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/modules/avformat/producer_avformat.c b/src/modules/avformat/producer_avformat.c index 14a97bf..df5b0b1 100644 --- a/src/modules/avformat/producer_avformat.c +++ b/src/modules/avformat/producer_avformat.c @@ -985,6 +985,8 @@ static void producer_set_up_video( mlt_producer this, mlt_frame frame ) // Set the width and height mlt_properties_set_int( frame_properties, "width", codec_context->width ); mlt_properties_set_int( frame_properties, "height", codec_context->height ); + mlt_properties_set_int( frame_properties, "real_width", codec_context->width ); + mlt_properties_set_int( frame_properties, "real_height", codec_context->height ); mlt_properties_set_double( frame_properties, "aspect_ratio", aspect_ratio ); mlt_frame_push_get_image( frame, producer_get_image ); diff --git a/src/modules/core/filter_rescale.c b/src/modules/core/filter_rescale.c index 6251ca8..25ca5fc 100644 --- a/src/modules/core/filter_rescale.c +++ b/src/modules/core/filter_rescale.c @@ -206,7 +206,12 @@ static int filter_get_image( mlt_frame this, uint8_t **image, mlt_image_format * mlt_properties_set_int( properties, "rescale_width", iwidth ); mlt_properties_set_int( properties, "rescale_height", iheight ); } - + + // Deinterlace if height is changing to prevent fields mixing on interpolation + // One exception: non-interpolated, integral scaling + if ( iheight != oheight && ( strcmp( interps, "nearest" ) || ( iheight % oheight != 0 ) ) ) + mlt_properties_set_int( properties, "consumer_deinterlace", 1 ); + // Get the image as requested mlt_frame_get_image( this, image, format, &iwidth, &iheight, writable ); diff --git a/src/modules/core/producer_consumer.c b/src/modules/core/producer_consumer.c index 280705d..7b36f21 100644 --- a/src/modules/core/producer_consumer.c +++ b/src/modules/core/producer_consumer.c @@ -161,8 +161,11 @@ static int get_frame( mlt_producer this, mlt_frame_ptr frame, int index ) // Inform the normalizers about our video properties mlt_properties frame_props = MLT_FRAME_PROPERTIES( *frame ); mlt_properties_set_double( frame_props, "aspect_ratio", mlt_profile_sar( cx->profile ) ); - mlt_properties_set_double( frame_props, "width", cx->profile->width ); - mlt_properties_set_double( frame_props, "height", cx->profile->height ); + mlt_properties_set_int( frame_props, "width", cx->profile->width ); + mlt_properties_set_int( frame_props, "height", cx->profile->height ); + mlt_properties_set_int( frame_props, "real_width", cx->profile->width ); + mlt_properties_set_int( frame_props, "real_height", cx->profile->height ); + mlt_properties_set_int( frame_props, "progressive", cx->profile->progressive ); } // Calculate the next timecode diff --git a/src/modules/dv/producer_libdv.c b/src/modules/dv/producer_libdv.c index 10f3d46..6fd012c 100644 --- a/src/modules/dv/producer_libdv.c +++ b/src/modules/dv/producer_libdv.c @@ -485,6 +485,8 @@ static int producer_get_frame( mlt_producer producer, mlt_frame_ptr frame, int i // Update other info on the frame mlt_properties_set_int( properties, "width", 720 ); mlt_properties_set_int( properties, "height", this->is_pal ? 576 : 480 ); + mlt_properties_set_int( properties, "real_width", 720 ); + mlt_properties_set_int( properties, "real_height", this->is_pal ? 576 : 480 ); mlt_properties_set_int( properties, "top_field_first", !this->is_pal ? 0 : ( data[ 5 ] & 0x07 ) == 0 ? 0 : 1 ); // Parse the header for meta info -- 1.7.4.4