From d38c9f1bbe69c87ab5f5bdc38e934d5c28fba13d Mon Sep 17 00:00:00 2001 From: Dan Dennedy Date: Mon, 7 Mar 2011 22:58:50 -0800 Subject: [PATCH] Refactor to mlt_transition_get_progress_delta(). --- src/modules/core/transition_composite.c | 16 +--------------- src/modules/core/transition_luma.c | 21 +-------------------- 2 files changed, 2 insertions(+), 35 deletions(-) diff --git a/src/modules/core/transition_composite.c b/src/modules/core/transition_composite.c index 5a041854..45683683 100644 --- a/src/modules/core/transition_composite.c +++ b/src/modules/core/transition_composite.c @@ -185,20 +185,6 @@ static int position_calculate( mlt_transition this, mlt_position position ) /** Calculate the field delta for this frame - position between two frames. */ -static inline double delta_calculate( mlt_transition this, mlt_frame frame, mlt_position position ) -{ - // Get the in and out position - mlt_position in = mlt_transition_get_in( this ); - mlt_position out = mlt_transition_get_out( this ); - double length = out - in + 1; - - // Now do the calcs - double x = ( double )( position - in ) / length; - double y = ( double )( position + 1 - in ) / length; - - return length * ( y - x ) / 2.0; -} - static int get_value( mlt_properties properties, const char *preferred, const char *fallback ) { int value = mlt_properties_get_int( properties, preferred ); @@ -1130,7 +1116,7 @@ static int transition_get_image( mlt_frame a_frame, uint8_t **image, mlt_image_f struct geometry_s result; // Calculate the position - double delta = delta_calculate( this, a_frame, position ); + double delta = mlt_transition_get_progress_delta( this, a_frame ); // Get the image from the b frame uint8_t *image_b = NULL; diff --git a/src/modules/core/transition_luma.c b/src/modules/core/transition_luma.c index e2dbfcd3..b4fac50e 100644 --- a/src/modules/core/transition_luma.c +++ b/src/modules/core/transition_luma.c @@ -29,25 +29,6 @@ #include #include -/** Calculate the field delta for this frame - position between two frames. -*/ - -static float delta_calculate( mlt_transition this, mlt_frame frame ) -{ - // Get the in and out position - mlt_position in = mlt_transition_get_in( this ); - mlt_position out = mlt_transition_get_out( this ); - - // Get the position of the frame - mlt_position position = mlt_frame_get_position( frame ); - - // Now do the calcs - float x = ( float )( position - in ) / ( float )( out - in + 1 ); - float y = ( float )( position + 1 - in ) / ( float )( out - in + 1 ); - - return ( y - x ) / 2.0; -} - static inline int dissolve_yuv( mlt_frame this, mlt_frame that, float weight, int width, int height ) { int ret = 0; @@ -468,7 +449,7 @@ static int transition_get_image( mlt_frame a_frame, uint8_t **image, mlt_image_f // Arbitrary composite defaults float mix = mlt_transition_get_progress( transition, a_frame ); - float frame_delta = delta_calculate( transition, a_frame ); + float frame_delta = mlt_transition_get_progress_delta( transition, a_frame ); float luma_softness = mlt_properties_get_double( properties, "softness" ); int progressive = mlt_properties_get_int( a_props, "consumer_deinterlace" ) || -- 2.39.2