X-Git-Url: http://research.m1stereo.tv/gitweb?a=blobdiff_plain;f=src%2Fmodules%2Fplus%2Ftransition_affine.c;h=a8c92d03570af30c3c7886403e47678391ef585c;hb=c12c6c380fa37b6a0d28ce98fdcda487a8aca76d;hp=f95b1483955438455715b42a58ba5a58623d5df2;hpb=909d149697331a560edb1924f58fc58c5a25aaea;p=melted diff --git a/src/modules/plus/transition_affine.c b/src/modules/plus/transition_affine.c index f95b148..a8c92d0 100644 --- a/src/modules/plus/transition_affine.c +++ b/src/modules/plus/transition_affine.c @@ -517,7 +517,7 @@ static int transition_get_image( mlt_frame a_frame, uint8_t **image, mlt_image_f mlt_frame_get_image( a_frame, image, format, width, height, 1 ); // Calculate the region now - composite_calculate( &result, this, a_frame, ( float )( position - in ) / ( out - in + 1 ) ); + composite_calculate( &result, this, a_frame, ( float )( position ) / ( out - in + 1 ) ); // Fetch the b frame image result.w = ( int )( result.w * *width / result.nw ); @@ -587,6 +587,8 @@ static int transition_get_image( mlt_frame a_frame, uint8_t **image, mlt_image_f int y_offset = ( int )result.h >> 1; uint8_t *alpha = mlt_frame_get_alpha_mask( b_frame ); + uint8_t *mask = mlt_pool_alloc( b_width * b_height ); + uint8_t *pmask = mask; float mix; affine_t affine; @@ -613,6 +615,9 @@ static int transition_get_image( mlt_frame a_frame, uint8_t **image, mlt_image_f dz = MapZ( affine.matrix, 0, 0 ); + if ( mask != NULL ) + memset( mask, 0, b_width * b_height ); + for ( y = lower_y; y < upper_y; y ++ ) { p = q; @@ -626,26 +631,34 @@ static int transition_get_image( mlt_frame a_frame, uint8_t **image, mlt_image_f { if ( alpha == NULL ) { + *pmask ++ = 255; dx += dx & 1; *p ++ = *( b_image + dy * b_stride + ( dx << 1 ) ); *p ++ = *( b_image + dy * b_stride + ( dx << 1 ) + ( ( x & 1 ) << 1 ) + 1 ); } else { + *pmask ++ = *( alpha + dy * b_width + dx ); mix = ( float )*( alpha + dy * b_width + dx ) / 255.0; dx += dx & 1; - *p ++ = *p * ( 1 - mix ) + mix * *( b_image + dy * b_stride + ( dx << 1 ) ); - *p ++ = *p * ( 1 - mix ) + mix * *( b_image + dy * b_stride + ( dx << 1 ) + ( ( x & 1 ) << 1 ) + 1 ); + *p = *p * ( 1 - mix ) + mix * *( b_image + dy * b_stride + ( dx << 1 ) ); + p ++; + *p = *p * ( 1 - mix ) + mix * *( b_image + dy * b_stride + ( dx << 1 ) + ( ( x & 1 ) << 1 ) + 1 ); + p ++; } } else { p += 2; + pmask ++; } } q += a_stride; } + + b_frame->get_alpha_mask = NULL; + mlt_properties_set_data( b_props, "alpha", mask, 0, mlt_pool_release, NULL ); } return 0; @@ -672,7 +685,6 @@ static mlt_frame transition_process( mlt_transition transition, mlt_frame a_fram // Push the transition method mlt_frame_push_get_image( a_frame, transition_get_image ); - return a_frame; }