]> git.sesse.net Git - mlt/commitdiff
service stack, various fixes
authorlilo_booter <lilo_booter@d19143bc-622f-0410-bfdd-b5b2a6649095>
Wed, 25 Feb 2004 11:54:10 +0000 (11:54 +0000)
committerlilo_booter <lilo_booter@d19143bc-622f-0410-bfdd-b5b2a6649095>
Wed, 25 Feb 2004 11:54:10 +0000 (11:54 +0000)
git-svn-id: https://mlt.svn.sourceforge.net/svnroot/mlt/trunk/mlt@168 d19143bc-622f-0410-bfdd-b5b2a6649095

docs/TODO
src/framework/mlt_consumer.c
src/framework/mlt_frame.c
src/framework/mlt_frame.h
src/modules/avformat/producer_avformat.c
src/modules/core/filter_deinterlace.c
src/modules/core/filter_obscure.c
src/modules/core/filter_watermark.c
src/modules/core/transition_composite.c
src/modules/core/transition_luma.c
src/modules/sdl/consumer_sdl.c

index 36913089f701b6d9dbc381be089e0a6bcc2f08c0..f0f3ae5cb26d811fd3b80126622b641227364380 100644 (file)
--- a/docs/TODO
+++ b/docs/TODO
@@ -1,16 +1,17 @@
-* optimisations
-* memory pooling
-* all memory leak detection
-* global property handling (more later)
-* documentation (framework, implementations)
-* finalisation of westley (entry, in/out points, frame holding)
-* installation procedure
-* dependency checks
-* field order considerations and normalisation
-* sdl rework (minor)
-* speex?
-* text/overlay/obsucure placement (units)
-* i18n (use of iconv api in producer_pango)
-* shaped fx for obscurer (and alpha in general?)
-* aspect constraints for scaling
-* field-based compositing for animation
+* PARTIAL - optimisations
+* DONE    - memory pooling
+* PARTIAL - all memory leak detection
+* PARTIAL - global property handling (more later)
+*         - documentation (framework, implementations)
+* DONE    - finalisation of westley (entry, in/out points)
+*         - installation procedure
+*         - dependency checks
+* DONE    - field order considerations and normalisation
+* PARTIAL - sdl rework (minor)
+*         - speex?
+* DONE    - text/overlay/obsucure placement (units)
+*         - i18n (use of iconv api in producer_pango)
+*         - shaped fx for obscurer (and alpha in general?)
+* DONE    - aspect constraints for scaling
+* DONE    - field-based compositing for animation
+*         - frame hold
index 99a3856cf3582cf1115d91070b62743b72fd4a68..8d79fc7d6eb6c7231d739c308d2ada68201b8690 100644 (file)
@@ -167,6 +167,7 @@ mlt_frame mlt_consumer_get_frame( mlt_consumer this )
                // Aspect ratio and other jiggery pokery
                mlt_properties_set_double( frame_properties, "consumer_aspect_ratio", mlt_properties_get_double( properties, "aspect_ratio" ) );
                mlt_properties_set_int( frame_properties, "consumer_progressive", mlt_properties_get_int( properties, "progressive" ) );
+               mlt_properties_set_int( frame_properties, "consumer_deinterlace", mlt_properties_get_int( properties, "deinterlace" ) );
                
        }
 
index 04bc9baab41882bf8303490f1be9797f8dc0939c..c0d75d666de754491645dd47a829bf68fc6ca1c8 100644 (file)
@@ -68,6 +68,7 @@ mlt_frame mlt_frame_init( )
                // Construct stacks for frames and methods
                this->stack_get_image = mlt_deque_init( );
                this->stack_frame = mlt_deque_init( );
+               this->stack_service = mlt_deque_init( );
        }
 
        return this;
@@ -161,6 +162,22 @@ mlt_frame mlt_frame_pop_frame( mlt_frame this )
        return mlt_deque_pop_back( this->stack_frame );
 }
 
+/** Push a service.
+*/
+
+int mlt_frame_push_service( mlt_frame this, void *that )
+{
+       return mlt_deque_push_back( this->stack_service, that );
+}
+
+/** Pop a service.
+*/
+
+void *mlt_frame_pop_service( mlt_frame this )
+{
+       return mlt_deque_pop_back( this->stack_service );
+}
+
 int mlt_frame_get_image( mlt_frame this, uint8_t **buffer, mlt_image_format *format, int *width, int *height, int writable )
 {
        mlt_properties properties = mlt_frame_properties( this );
@@ -297,6 +314,7 @@ void mlt_frame_close( mlt_frame this )
        {
                mlt_deque_close( this->stack_get_image );
                mlt_deque_close( this->stack_frame );
+               mlt_deque_close( this->stack_service );
                mlt_properties_close( &this->parent );
                free( this );
        }
index 1af606881cd932d1e06a50beef09931c2ae06580..915a707c1059fec35ef5815ce26b461975f153a5 100644 (file)
@@ -62,6 +62,7 @@ struct mlt_frame_s
        // Private properties
        mlt_deque stack_get_image;
        mlt_deque stack_frame;
+       mlt_deque stack_service;
 };
 
 extern mlt_frame mlt_frame_init( );
@@ -81,6 +82,8 @@ extern int mlt_frame_push_get_image( mlt_frame this, mlt_get_image get_image );
 extern mlt_get_image mlt_frame_pop_get_image( mlt_frame this );
 extern int mlt_frame_push_frame( mlt_frame this, mlt_frame that );
 extern mlt_frame mlt_frame_pop_frame( mlt_frame this );
+extern int mlt_frame_push_service( mlt_frame this, void *that );
+extern void *mlt_frame_pop_service( mlt_frame this );
 extern void mlt_frame_close( mlt_frame this );
 
 /* convenience functions */
index bace227bfdf1d44a433afd56d8b4b100870044a2..67a66dfdc640576dcaf1ddfcc5c83da4f6cb8d66 100644 (file)
@@ -309,7 +309,7 @@ static int producer_get_image( mlt_frame frame, uint8_t **buffer, mlt_image_form
        int ignore = 0;
 
        // Current time calcs
-       double current_time = 0;
+       double current_time = mlt_properties_get_double( properties, "current_time" );
 
        // We may want to use the source fps if available
        double source_fps = mlt_properties_get_double( properties, "source_fps" );
@@ -358,7 +358,7 @@ static int producer_get_image( mlt_frame frame, uint8_t **buffer, mlt_image_form
                        av_seek_frame( context, -1, real_timecode * 1000000.0 );
        
                        // Remove the cached info relating to the previous position
-                       mlt_properties_set_double( properties, "current_time", 0 );
+                       mlt_properties_set_double( properties, "current_time", real_timecode );
                        mlt_properties_set_data( properties, "current_image", NULL, 0, NULL, NULL );
                }
        }
@@ -395,13 +395,16 @@ static int producer_get_image( mlt_frame frame, uint8_t **buffer, mlt_image_form
                        // We only deal with video from the selected video_index
                        if ( ret >= 0 && pkt.stream_index == index && pkt.size > 0 )
                        {
-                               current_time = ( double )pkt.pts / 1000000.0;
-
                                // Decode the image
                                ret = avcodec_decode_video( codec_context, &frame, &got_picture, pkt.data, pkt.size );
 
                                if ( got_picture )
                                {
+                                       if ( pkt.pts != AV_NOPTS_VALUE && pkt.pts != 0  )
+                                               current_time = ( double )pkt.pts / 1000000.0;
+                                       else
+                                               current_time = real_timecode;
+
                                        // Handle ignore
                                        if ( current_time < real_timecode )
                                        {
@@ -410,9 +413,10 @@ static int producer_get_image( mlt_frame frame, uint8_t **buffer, mlt_image_form
                                        }
                                        else if ( current_time >= real_timecode )
                                        {
+                                               //current_time = real_timecode;
                                                ignore = 0;
                                        }
-                                       else if ( got_picture && ignore -- )
+                                       else if ( ignore -- )
                                        {
                                                got_picture = 0;
                                        }
index 59257f166cf8667da3f3c49c6123a08c8b5e7029..95cb25f96a5fe229bb3bc22ba941b7dd60bb8d1d 100644 (file)
@@ -83,7 +83,7 @@ static int filter_get_image( mlt_frame this, uint8_t **image, mlt_image_format *
        {
                // Check that we want progressive and we aren't already progressive
                if ( !mlt_properties_get_int( mlt_frame_properties( this ), "progressive" ) &&
-                        mlt_properties_get_int( mlt_frame_properties( this ), "consumer_progressive" ) )
+                        mlt_properties_get_int( mlt_frame_properties( this ), "consumer_deinterlace" ) )
                {
                        // Deinterlace the image
                        deinterlace_yuv( *image, *image, *width * 2, *height );
index ed06492999cb3bf746fe4c6bffc8d15a6db0400f..bf88a09c733322273bae4647ae0aa08e13c0bf14 100644 (file)
@@ -21,7 +21,6 @@
 #include "filter_obscure.h"
 
 #include <framework/mlt_frame.h>
-#include <framework/mlt_deque.h>
 
 #include <stdio.h>
 #include <stdlib.h>
@@ -223,11 +222,8 @@ static int filter_get_image( mlt_frame frame, uint8_t **image, mlt_image_format
        // Get the frame properties
        mlt_properties frame_properties = mlt_frame_properties( frame );
 
-       // Fetch the obscure stack for this frame
-       mlt_deque deque = mlt_properties_get_data( frame_properties, "filter_obscure", NULL );
-
        // Pop the top of stack now
-       mlt_filter this = mlt_deque_pop_back( deque );
+       mlt_filter this = mlt_frame_pop_service( frame );
 
        // Get the image from the frame
        int error = mlt_frame_get_image( frame, image, format, width, height, 1 );
@@ -272,24 +268,8 @@ static int filter_get_image( mlt_frame frame, uint8_t **image, mlt_image_format
 
 static mlt_frame filter_process( mlt_filter this, mlt_frame frame )
 {
-       // Get the frame properties
-       mlt_properties frame_properties = mlt_frame_properties( frame );
-
-       // Fetch the obscure stack for this frame
-       mlt_deque deque = mlt_properties_get_data( frame_properties, "filter_obscure", NULL );
-
-       // Create stack if necessary
-       if ( deque == NULL )
-       {
-               // Create the deque
-               deque = mlt_deque_init( );
-
-               // Assign to the frame
-               mlt_properties_set_data( frame_properties, "filter_obscure", deque, 0, ( mlt_destructor )mlt_deque_close, NULL );
-       }
-
-       // Push this on to the obscure stack
-       mlt_deque_push_back( deque, this );
+       // Push this on to the service stack
+       mlt_frame_push_service( frame, this );
        
        // Push the get image call
        mlt_frame_push_get_image( frame, filter_get_image );
index a7d0b0b0ec77b34b3a92ff935b3ac258b1f2af25..a22bac356e9048e9b1a8fb41142c1aa33e71b34c 100644 (file)
@@ -34,8 +34,7 @@
 static int filter_get_image( mlt_frame this, uint8_t **image, mlt_image_format *format, int *width, int *height, int writable )
 {
        int error = 0;
-       mlt_properties frame_properties = mlt_frame_properties( this );
-       mlt_filter filter = mlt_properties_get_data( frame_properties, "watermark", NULL );
+       mlt_filter filter = mlt_frame_pop_service( this );
        mlt_properties properties = mlt_filter_properties( filter );
        mlt_producer producer = mlt_properties_get_data( properties, "producer", NULL );
        mlt_transition composite = mlt_properties_get_data( properties, "composite", NULL );
@@ -92,9 +91,12 @@ static int filter_get_image( mlt_frame this, uint8_t **image, mlt_image_format *
 
 static mlt_frame filter_process( mlt_filter this, mlt_frame frame )
 {
-       mlt_properties properties = mlt_frame_properties( frame );
-       mlt_properties_set_data( properties, "watermark", this, 0, NULL, NULL );
+       // Push the filter on to the stack
+       mlt_frame_push_service( frame, this );
+
+       // Push the get_image on to the stack
        mlt_frame_push_get_image( frame, filter_get_image );
+
        return frame;
 }
 
index 1116b05b573725edcf635695c1f96868caa7685f..e8f1235bbddf5a8feefead8c1a502fa27e7dd0cc 100644 (file)
 #include <stdio.h>
 #include <stdlib.h>
 #include <ctype.h>
+#include <string.h>
 
 /** Geometry struct.
 */
 
 struct geometry_s
 {
+       float mix;
        int nw; // normalised width
        int nh; // normalised height
        int sw; // scaled width, not including consumer scale based upon w/nw
@@ -38,7 +40,6 @@ struct geometry_s
        float y;
        float w;
        float h;
-       float mix;
        int halign; // horizontal alignment: 0=left, 1=center, 2=right
        int valign; // vertical alignment: 0=top, 1=middle, 2=bottom
 };
@@ -74,6 +75,8 @@ static float parse_value( char **ptr, int normalisation, char delim, float defau
 
 static void geometry_parse( struct geometry_s *geometry, struct geometry_s *defaults, char *property, int nw, int nh )
 {
+       memset( geometry, 0, sizeof( struct geometry_s ) );
+
        // Assign normalised width and height
        geometry->nw = nw;
        geometry->nh = nh;
@@ -117,6 +120,8 @@ static void geometry_calculate( struct geometry_s *output, struct geometry_s *in
        output->w = in->w + ( out->w - in->w ) * position;
        output->h = in->h + ( out->h - in->h ) * position;
        output->mix = in->mix + ( out->mix - in->mix ) * position;
+       if ( output->mix > 100 )
+       fprintf( stderr, "%f = %f + ( %f - %f ) * %f\n", output->mix, in->mix, out->mix, in->mix, position );
 }
 
 /** Parse the alignment properties into the geometry.
@@ -149,13 +154,13 @@ static void alignment_calculate( struct geometry_s *geometry )
 /** Calculate the position for this frame.
 */
 
-static float position_calculate( mlt_transition this, mlt_frame frame )
+static inline float position_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
+       // Get the position
        mlt_position position = mlt_frame_get_position( frame );
 
        // Now do the calcs
@@ -165,7 +170,7 @@ static float position_calculate( mlt_transition this, mlt_frame frame )
 /** Calculate the field delta for this frame - position between two frames.
 */
 
-static float delta_calculate( mlt_transition this, mlt_frame frame )
+static inline float delta_calculate( mlt_transition this, mlt_frame frame )
 {
        // Get the in and out position
        mlt_position in = mlt_transition_get_in( this );
@@ -176,8 +181,7 @@ static float delta_calculate( mlt_transition this, mlt_frame frame )
 
        // Now do the calcs
        float x = ( float )( position - in ) / ( float )( out - in + 1 );
-       position++;
-       float y = ( float )( position - in ) / ( float )( out - in + 1 );
+       float y = ( float )( position + 1 - in ) / ( float )( out - in + 1 );
 
        return ( y - x ) / 2.0;
 }
@@ -196,9 +200,11 @@ static int get_value( mlt_properties properties, char *preferred, char *fallback
 static int composite_yuv( uint8_t *p_dest, int width_dest, int height_dest, int bpp, uint8_t *p_src, int width_src, int height_src, uint8_t *p_alpha, struct geometry_s geometry, int field )
 {
        int ret = 0;
-       int i, j, k;
+       int i, j;
        int x_src = 0, y_src = 0;
-       float weight = geometry.mix / 100;
+       int32_t weight = ( 1 << 16 ) * ( geometry.mix / 100 );
+       if ( geometry.mix > 100 )
+               fprintf( stderr, "%f %d\n", geometry.mix, weight );
        int stride_src = width_src * bpp;
        int stride_dest = width_dest * bpp;
 
@@ -276,25 +282,33 @@ static int composite_yuv( uint8_t *p_dest, int width_dest, int height_dest, int
        uint8_t *z = p_alpha;
 
        uint8_t a;
-       float value;
+       int32_t value;
        int step = ( field > -1 ) ? 2 : 1;
 
+       stride_src = stride_src * step;
+       int alpha_stride = stride_src / bpp;
+       stride_dest = stride_dest * step;
+
        // now do the compositing only to cropped extents
        for ( i = 0; i < height_src; i += step )
        {
-               p = &p_src[ i * stride_src ];
-               q = &p_dest[ i * stride_dest ];
-               o = &p_dest[ i * stride_dest ];
-               if ( p_alpha )
-                       z = &p_alpha[ i * stride_src / bpp ];
+               p = p_src;
+               q = p_dest;
+               o = q;
+               z = p_alpha;
 
                for ( j = 0; j < width_src; j ++ )
                {
                        a = ( z == NULL ) ? 255 : *z ++;
-                       value = ( weight * ( float ) a / 255.0 );
-                       for ( k = 0; k < bpp; k ++ )
-                               *o ++ = (uint8_t)( *p++ * value + *q++ * ( 1 - value ) );
+                       value = ( weight * ( a + 1 ) ) >> 8;
+                       *o ++ = ( *p++ * value + *q++ * ( ( 1 << 16 ) - value ) ) >> 16;
+                       *o ++ = ( *p++ * value + *q++ * ( ( 1 << 16 ) - value ) ) >> 16;
                }
+
+               p_src += stride_src;
+               p_dest += stride_dest;
+               if ( p_alpha )
+                       p_alpha += alpha_stride;
        }
 
        return ret;
@@ -304,7 +318,7 @@ static int composite_yuv( uint8_t *p_dest, int width_dest, int height_dest, int
 /** Get the properly sized image from b_frame.
 */
 
-static int get_b_frame_image( mlt_frame b_frame, uint8_t **image, int *width, int *height, struct geometry_s *geometry )
+static int get_b_frame_image( mlt_transition this, mlt_frame b_frame, uint8_t **image, int *width, int *height, struct geometry_s *geometry )
 {
        int ret = 0;
        mlt_image_format format = mlt_image_yuv422;
@@ -315,7 +329,6 @@ static int get_b_frame_image( mlt_frame b_frame, uint8_t **image, int *width, in
 
        // Compute the dimensioning rectangle
        mlt_properties b_props = mlt_frame_properties( b_frame );
-       mlt_transition this = mlt_properties_get_data( b_props, "transition_composite", NULL );
        mlt_properties properties = mlt_transition_properties( this );
 
        if ( mlt_properties_get( properties, "distort" ) == NULL )
@@ -325,32 +338,8 @@ static int get_b_frame_image( mlt_frame b_frame, uint8_t **image, int *width, in
                int normalised_height = geometry->h;
                int real_width = get_value( b_props, "real_width", "width" );
                int real_height = get_value( b_props, "real_height", "height" );
-               double input_ar = mlt_frame_get_aspect_ratio( b_frame );
-               double output_ar = mlt_properties_get_double( b_props, "consumer_aspect_ratio" );
-               //int scaled_width = ( input_ar > output_ar ? input_ar / output_ar : output_ar / input_ar ) * real_width;
-               //int scaled_height = ( input_ar > output_ar ? input_ar / output_ar : output_ar / input_ar ) * real_height;
                int scaled_width = real_width;
                int scaled_height = real_height;
-               double output_sar = ( double ) geometry->nw / geometry->nh / output_ar;
-
-               // We always normalise pixel aspect by requesting a larger than normal
-               // image in order to maximise usage of the bounding rectangle
-
-               // These calcs are optimised by reducing factors in equations
-// This is disabled due to bad results on 480 wide MPEGs
-#if 0
-               if ( output_sar < 1.0 )
-                       // If the output is skinny pixels (PAL) then stretch our input vertically
-                       // derived from: input_sar / output_sar * real_height
-                       scaled_height = ( double )real_width / input_ar / output_sar;
-
-               else
-#endif
-                       // If the output is fat pixels (NTSC) then stretch our input horizontally
-                       // derived from: output_sar / input_sar * real_width
-                       scaled_width = output_sar * real_height * input_ar;
-                       
-//             fprintf( stderr, "composite: real %dx%d scaled %dx%d normalised %dx%d\n", real_width, real_height, scaled_width, scaled_height, normalised_width, normalised_height );
 
                // Now ensure that our images fit in the normalised frame
                if ( scaled_width > normalised_width )
@@ -387,8 +376,6 @@ static int get_b_frame_image( mlt_frame b_frame, uint8_t **image, int *width, in
 
        x -= x % 2;
 
-       //fprintf( stderr, "composite calculated %d,%d:%dx%d\n", x, y, *width, *height );
-
        // optimization points - no work to do
        if ( *width <= 0 || *height <= 0 )
                return 1;
@@ -396,7 +383,7 @@ static int get_b_frame_image( mlt_frame b_frame, uint8_t **image, int *width, in
        if ( ( x < 0 && -x >= *width ) || ( y < 0 && -y >= *height ) )
                return 1;
 
-       ret = mlt_frame_get_image( b_frame, image, &format, width, height, 1 /* writable */ );
+       ret = mlt_frame_get_image( b_frame, image, &format, width, height, 1 );
 
        return ret;
 }
@@ -422,6 +409,9 @@ static int transition_get_image( mlt_frame a_frame, uint8_t **image, mlt_image_f
        // This compositer is yuv422 only
        *format = mlt_image_yuv422;
 
+       // Get the transition from the a frame
+       mlt_transition this = mlt_frame_pop_service( a_frame );
+
        // Get the image from the a frame
        mlt_frame_get_image( a_frame, image, format, width, height, 1 );
 
@@ -433,9 +423,6 @@ static int transition_get_image( mlt_frame a_frame, uint8_t **image, mlt_image_f
                // Get the properties of the b frame
                mlt_properties b_props = mlt_frame_properties( b_frame );
 
-               // Get the transition from the b frame
-               mlt_transition this = mlt_properties_get_data( b_props, "transition_composite", NULL );
-
                // Get the properties from the transition
                mlt_properties properties = mlt_transition_properties( this );
 
@@ -445,7 +432,7 @@ static int transition_get_image( mlt_frame a_frame, uint8_t **image, mlt_image_f
                struct geometry_s end;
 
                // Calculate the position
-               float position = position_calculate( this, a_frame );
+               float position = mlt_properties_get_double( b_props, "relative_position" );
                float delta = delta_calculate( this, a_frame );
 
                // Obtain the normalised width and height from the a_frame
@@ -473,7 +460,7 @@ static int transition_get_image( mlt_frame a_frame, uint8_t **image, mlt_image_f
                int width_b = *width;
                int height_b = *height;
                
-               if ( get_b_frame_image( b_frame, &image_b, &width_b, &height_b, &result ) == 0 )
+               if ( get_b_frame_image( this, b_frame, &image_b, &width_b, &height_b, &result ) == 0 )
                {
                        uint8_t *dest = *image;
                        uint8_t *src = image_b;
@@ -484,94 +471,6 @@ static int transition_get_image( mlt_frame a_frame, uint8_t **image, mlt_image_f
                                        mlt_properties_get_int( properties, "progressive" );
                        int field;
 
-                       // See if the alpha channel is our destination
-                       if ( mlt_properties_get( properties, "a_frame" ) != NULL )
-                       {
-                               bpp = 1;
-                               
-                               // Get or make the a_frame alpha channel
-                               dest = mlt_frame_get_alpha_mask( a_frame );
-                               if ( dest == NULL )
-                               {
-                                       // Allocate the alpha
-                                       dest = mlt_pool_alloc( *width * *height );
-                                       mlt_properties_set_data( a_props, "alpha", dest, *width * *height, ( mlt_destructor )mlt_pool_release, NULL );
-                                       
-                                       // Set alpha call back
-                                       a_frame->get_alpha_mask = transition_get_alpha_mask;
-                               }
-
-                               // If the source is an image, convert its YUV to an alpha channel
-                               if ( mlt_properties_get( properties, "b_frame" ) == NULL )
-                               {
-                                       if ( alpha == NULL )
-                                       {
-                                               // Allocate the alpha
-                                               alpha = mlt_pool_alloc( width_b * height_b );
-                                               mlt_properties_set_data( b_props, "alpha", alpha, width_b * height_b, ( mlt_destructor )mlt_pool_release, NULL );
-
-                                               // Set alpha call back
-                                               b_frame->get_alpha_mask = transition_get_alpha_mask;
-                                       }
-
-                                       // Copy the Y values into alpha
-                                       uint8_t *p = image_b;
-                                       uint8_t *q = alpha;
-                                       int i;
-                                       for ( i = 0; i < width_b * height_b; i ++, p += 2 )
-                                               *q ++ = *p;
-
-                                       // Setup to composite from the alpha channel
-                                       src = alpha;
-                                       alpha = NULL;
-                               }
-                       }
-                       
-                       // See if the alpha channel is our source
-                       if ( mlt_properties_get( properties, "b_frame" ) != NULL )
-                       {
-                               // If we do not have an alpha channel fabricate it
-                               if ( alpha == NULL )
-                               {
-                                       // Allocate the alpha
-                                       alpha = mlt_pool_alloc( width_b * height_b );
-                                       mlt_properties_set_data( b_props, "alpha", alpha, width_b * height_b, ( mlt_destructor )mlt_pool_release, NULL );
-
-                                       // Set alpha call back
-                                       b_frame->get_alpha_mask = transition_get_alpha_mask;
-                                       
-                                       // Copy the Y values into alpha
-                                       uint8_t *p = image_b;
-                                       uint8_t *q = alpha;
-                                       int i;
-                                       for ( i = 0; i < width_b * height_b; i ++, p += 2 )
-                                               *q ++ = *p;
-                               }
-
-                               // If the destination is image, convert the alpha channel to YUV
-                               if ( mlt_properties_get( properties, "a_frame" ) == NULL )
-                               {
-                                       uint8_t *p = alpha;
-                                       uint8_t *q = image_b;
-                                       int i;
-                                       
-                                       for ( i = 0; i < width_b * height_b; i ++, p ++ )
-                                       {
-                                               *q ++ = 16 + ( ( float )*p / 255 * 219 ); // 220 is the luma range from 16-235
-                                               *q ++ = 128;
-                                       }
-                               }
-                               else
-                               {
-                                       // Setup to composite from the alpha channel
-                                       src = alpha;
-                                       bpp = 1;
-                               }
-
-                               // Never the apply the alpha channel to this type of operation
-                               alpha = NULL;
-                       }
-
                        for ( field = 0; field < ( progressive ? 1 : 2 ); field++ )
                        {
                                // Assume lower field (0) first
@@ -598,8 +497,8 @@ static int transition_get_image( mlt_frame a_frame, uint8_t **image, mlt_image_f
 static mlt_frame composite_process( mlt_transition this, mlt_frame a_frame, mlt_frame b_frame )
 {
        // Propogate the transition properties to the b frame
-       mlt_properties b_props = mlt_frame_properties( b_frame );
-       mlt_properties_set_data( b_props, "transition_composite", this, 0, NULL, NULL );
+       mlt_properties_set_double( mlt_frame_properties( b_frame ), "relative_position", position_calculate( this, a_frame ) );
+       mlt_frame_push_service( a_frame, this );
        mlt_frame_push_get_image( a_frame, transition_get_image );
        mlt_frame_push_frame( a_frame, b_frame );
        return a_frame;
index a518e0666d7474e42ee6fd9b41cc2b6e35002567..6e58f26cc857ea339cbc246c31decea811117c56 100644 (file)
@@ -106,7 +106,7 @@ static inline int dissolve_yuv( mlt_frame this, mlt_frame that, float weight, in
 
 // image processing functions
 
-static uint32_t smoothstep( int32_t edge1, int32_t edge2, uint32_t a )
+static inline uint32_t smoothstep( int32_t edge1, int32_t edge2, uint32_t a )
 {
        if ( a < edge1 )
                return 0;
@@ -211,13 +211,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 );
@@ -250,11 +250,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 +365,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 )
index 64cf9d9afb67e17b7e1e14fe48f29f426a345e1f..d35e4a7869f24346a6ed46883d13cbd5bb85aaa8 100644 (file)
@@ -103,7 +103,7 @@ mlt_consumer consumer_sdl_init( char *arg )
                mlt_properties_set( this->properties, "rescale", "nearest" );
 
                // Default progressive true
-               mlt_properties_set_int( this->properties, "progressive", 0 );
+               mlt_properties_set_int( this->properties, "progressive", 1 );
 
                // Get aspect ratio
                this->aspect_ratio = mlt_properties_get_double( this->properties, "aspect_ratio" );