X-Git-Url: http://research.m1stereo.tv/gitweb?a=blobdiff_plain;f=src%2Fmodules%2Fcore%2Ftransition_luma.c;h=bb44d29157f0e8d510f7bb17fa075b3e918953f6;hb=bdbe7d802961afa00c233b3cf30e32f0e1c3740a;hp=40d5ca5787a927b27ced5ccb04d4be5f68f3a857;hpb=7ac623df605d7daa8125b189cf77a937cfe03888;p=melted diff --git a/src/modules/core/transition_luma.c b/src/modules/core/transition_luma.c index 40d5ca5..bb44d29 100644 --- a/src/modules/core/transition_luma.c +++ b/src/modules/core/transition_luma.c @@ -25,6 +25,7 @@ #include #include #include +#include /** Luma class. */ @@ -166,7 +167,7 @@ static void luma_composite( mlt_frame a_frame, mlt_frame b_frame, int luma_width int32_t i_softness = softness * ( 1 << 16 ); - int field_count = field_order < 0 ? 1 : 2; + int field_count = field_order <= 0 ? 1 : 2; int field_stride_src = field_count * stride_src; int field_stride_dest = field_count * stride_dest; @@ -211,13 +212,13 @@ static void luma_composite( mlt_frame a_frame, mlt_frame b_frame, int luma_width /** Get the image. */ -static int transition_get_image( mlt_frame this, uint8_t **image, mlt_image_format *format, int *width, int *height, int writable ) +static int transition_get_image( mlt_frame a_frame, uint8_t **image, mlt_image_format *format, int *width, int *height, int writable ) { // Get the properties of the a frame - mlt_properties a_props = mlt_frame_properties( this ); + mlt_properties a_props = mlt_frame_properties( a_frame ); // Get the b frame from the stack - mlt_frame b_frame = mlt_frame_pop_frame( this ); + mlt_frame b_frame = mlt_frame_pop_frame( a_frame ); // Get the properties of the b frame mlt_properties b_props = mlt_frame_properties( b_frame ); @@ -240,8 +241,11 @@ static int transition_get_image( mlt_frame this, uint8_t **image, mlt_image_form // consumer property from the a_frame mlt_properties_set_double( b_props, "consumer_aspect_ratio", mlt_properties_get_double( a_props, "consumer_aspect_ratio" ) ); mlt_properties_set_double( b_props, "consumer_scale", mlt_properties_get_double( a_props, "consumer_scale" ) ); - + // Honour the reverse here + if ( mix >= 1.0 ) + mix -= floor( mix ); + mix = reverse ? 1 - mix : mix; frame_delta *= reverse ? -1.0 : 1.0; @@ -250,11 +254,11 @@ static int transition_get_image( mlt_frame this, uint8_t **image, mlt_image_form if ( luma_width > 0 && luma_height > 0 && luma_bitmap != NULL ) // Composite the frames using a luma map - luma_composite( this, b_frame, luma_width, luma_height, luma_bitmap, mix, frame_delta, + luma_composite( a_frame, b_frame, luma_width, luma_height, luma_bitmap, mix, frame_delta, luma_softness, progressive ? -1 : top_field_first, width, height ); else // Dissolve the frames using the time offset for mix value - dissolve_yuv( this, b_frame, mix, *width, *height ); + dissolve_yuv( a_frame, b_frame, mix, *width, *height ); // Extract the a_frame image info *width = mlt_properties_get_int( a_props, "width" ); @@ -365,7 +369,7 @@ static mlt_frame transition_process( mlt_transition transition, mlt_frame a_fram // Get the properties of the b frame mlt_properties b_props = mlt_frame_properties( b_frame ); - + // If the filename property changed, reload the map char *lumafile = mlt_properties_get( properties, "resource" ); if ( this->bitmap == NULL && lumafile != NULL ) @@ -379,8 +383,8 @@ static mlt_frame transition_process( mlt_transition transition, mlt_frame a_fram } // Set the b frame properties - mlt_properties_set_double( b_props, "image.mix", position_calculate( transition, b_frame ) ); - mlt_properties_set_double( b_props, "luma.delta", delta_calculate( transition, b_frame ) ); + mlt_properties_set_double( b_props, "image.mix", position_calculate( transition, a_frame ) ); + mlt_properties_set_double( b_props, "luma.delta", delta_calculate( transition, a_frame ) ); mlt_properties_set_int( b_props, "luma.width", this->width ); mlt_properties_set_int( b_props, "luma.height", this->height ); mlt_properties_set_data( b_props, "luma.bitmap", this->bitmap, 0, NULL, NULL );