X-Git-Url: http://research.m1stereo.tv/gitweb?a=blobdiff_plain;f=src%2Fmodules%2Fcore%2Ftransition_luma.c;h=e55046cf26826fb595ef36ba097f437a96a87e53;hb=7651a182bf7191ab5db9b3741caeac2f86540281;hp=ebdc82cf15a159607acd858e9dd8ebce69aad619;hpb=9029c77b04ddf9c9d9becacca56615607bb84234;p=melted diff --git a/src/modules/core/transition_luma.c b/src/modules/core/transition_luma.c index ebdc82c..e55046c 100644 --- a/src/modules/core/transition_luma.c +++ b/src/modules/core/transition_luma.c @@ -69,8 +69,10 @@ static inline int dissolve_yuv( mlt_frame this, mlt_frame that, float weight, in int width_src = width, height_src = height; mlt_image_format format = mlt_image_yuv422; uint8_t *p_src, *p_dest; - uint8_t *p; + uint8_t *p, *q; uint8_t *limit; + uint8_t *alpha_src; + uint8_t *alpha_dst; int32_t weigh = weight * ( 1 << 16 ); int32_t weigh_complement = ( 1 - weight ) * ( 1 << 16 ); @@ -79,19 +81,23 @@ static inline int dissolve_yuv( mlt_frame this, mlt_frame that, float weight, in mlt_properties_set( &that->parent, "distort", mlt_properties_get( &this->parent, "distort" ) ); mlt_properties_set_int( &that->parent, "consumer_deinterlace", mlt_properties_get_int( &this->parent, "consumer_deinterlace" ) ); mlt_frame_get_image( this, &p_dest, &format, &width, &height, 1 ); + alpha_dst = mlt_frame_get_alpha_mask( this ); mlt_frame_get_image( that, &p_src, &format, &width_src, &height_src, 0 ); + alpha_src = mlt_frame_get_alpha_mask( that ); // Pick the lesser of two evils ;-) width_src = width_src > width ? width : width_src; height_src = height_src > height ? height : height_src; p = p_dest; + q = alpha_dst; limit = p_dest + height_src * width_src * 2; while ( p < limit ) { *p_dest++ = ( *p_src++ * weigh + *p++ * weigh_complement ) >> 16; *p_dest++ = ( *p_src++ * weigh + *p++ * weigh_complement ) >> 16; + *alpha_dst++ = ( *alpha_src++ * weigh + *q++ * weigh_complement ) >> 16; } return ret; @@ -481,7 +487,7 @@ static int transition_get_image( mlt_frame a_frame, uint8_t **image, mlt_image_f int reverse = mlt_properties_get_int( properties, "reverse" ); int invert = mlt_properties_get_int( properties, "invert" ); - if ( mlt_properties_get( a_props, "rescale.interp" ) == NULL ) + if ( mlt_properties_get( a_props, "rescale.interp" ) == NULL || !strcmp( mlt_properties_get( a_props, "rescale.interp" ), "none" ) ) mlt_properties_set( a_props, "rescale.interp", "nearest" ); // Since we are the consumer of the b_frame, we must pass along this @@ -490,10 +496,7 @@ static int transition_get_image( mlt_frame a_frame, uint8_t **image, mlt_image_f mlt_properties_set_double( a_props, "aspect_ratio", mlt_properties_get_double( a_props, "consumer_aspect_ratio" ) ); if ( mlt_properties_get_double( b_props, "aspect_ratio" ) == 0.0 ) mlt_properties_set_double( b_props, "aspect_ratio", mlt_properties_get_double( a_props, "consumer_aspect_ratio" ) ); - if ( !strcmp( mlt_properties_get( a_props, "rescale.interp" ), "none" ) ) - mlt_properties_set_double( b_props, "consumer_aspect_ratio", mlt_properties_get_double( a_props, "aspect_ratio" ) ); - else - 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_aspect_ratio", mlt_properties_get_double( a_props, "consumer_aspect_ratio" ) ); // Honour the reverse here if ( mix >= 1.0 ) @@ -503,7 +506,8 @@ static int transition_get_image( mlt_frame a_frame, uint8_t **image, mlt_image_f frame_delta *= reverse || invert ? -1.0 : 1.0; // Ensure we get scaling on the b_frame - mlt_properties_set( b_props, "rescale.interp", "nearest" ); + if ( mlt_properties_get( b_props, "rescale.interp" ) == NULL || !strcmp( mlt_properties_get( b_props, "rescale.interp" ), "none" ) ) + mlt_properties_set( b_props, "rescale.interp", "nearest" ); if ( mlt_properties_get( properties, "fixed" ) ) mix = mlt_properties_get_double( properties, "fixed" );