]> git.sesse.net Git - mlt/commitdiff
Minor corrections with alpha and affines
authorlilo_booter <lilo_booter@d19143bc-622f-0410-bfdd-b5b2a6649095>
Fri, 18 Feb 2005 08:44:18 +0000 (08:44 +0000)
committerlilo_booter <lilo_booter@d19143bc-622f-0410-bfdd-b5b2a6649095>
Fri, 18 Feb 2005 08:44:18 +0000 (08:44 +0000)
git-svn-id: https://mlt.svn.sourceforge.net/svnroot/mlt/trunk/mlt@671 d19143bc-622f-0410-bfdd-b5b2a6649095

src/framework/mlt_frame.c
src/modules/core/producer_colour.c
src/modules/core/transition_composite.c
src/modules/plus/transition_affine.c

index 53472dbfb6537ecdc839033ac9aa3f6e49d5a25b..12a66d6bbb25c839081ec9b25e5a9a25367e0a43 100644 (file)
@@ -221,7 +221,7 @@ mlt_deque mlt_frame_service_stack( mlt_frame this )
        return this->stack_service;
 }
 
-/** [EXPERIMENTAL] Replace image stack with the information provided.
+/** Replace image stack with the information provided.
 
        This might prove to be unreliable and restrictive - the idea is that a transition
        which normally uses two images may decide to only use the b frame (ie: in the case
@@ -242,8 +242,7 @@ mlt_deque mlt_frame_service_stack( mlt_frame this )
 
 void mlt_frame_replace_image( mlt_frame this, uint8_t *image, mlt_image_format format, int width, int height )
 {
-       // Herein lies the potential problem for this function - it makes a potentially 
-       // dangerous assumption that all content on the image stack can be removed without a destructor
+       // Remove all items from the stack
        while( mlt_deque_pop_back( this->stack_image ) ) ;
 
        // Update the information 
@@ -359,14 +358,30 @@ int mlt_frame_get_image( mlt_frame this, uint8_t **buffer, mlt_image_format *for
                mlt_properties_set_int( properties, "test_image", 1 );
        }
 
+       mlt_properties_set_int( properties, "scaled_width", *width );
+       mlt_properties_set_int( properties, "scaled_height", *height );
+
        return error;
 }
 
 uint8_t *mlt_frame_get_alpha_mask( mlt_frame this )
 {
-       if ( this != NULL && this->get_alpha_mask != NULL )
-               return this->get_alpha_mask( this );
-       return this == NULL ? NULL : mlt_properties_get_data( &this->parent, "alpha", NULL );
+       uint8_t *alpha = NULL;
+       if ( this != NULL )
+       {
+               if ( this->get_alpha_mask != NULL )
+                       alpha = this->get_alpha_mask( this );
+               if ( alpha == NULL )
+                       alpha = mlt_properties_get_data( &this->parent, "alpha", NULL );
+               if ( alpha == NULL )
+               {
+                       int size = mlt_properties_get_int( &this->parent, "scaled_width" ) * mlt_properties_get_int( &this->parent, "scaled_height" );
+                       alpha = mlt_pool_alloc( size );
+                       memset( alpha, 255, size );
+                       mlt_properties_set_data( &this->parent, "alpha", alpha, size, mlt_pool_release, NULL );
+               }
+       }
+       return alpha;
 }
 
 int mlt_frame_get_audio( mlt_frame this, int16_t **buffer, mlt_audio_format *format, int *frequency, int *channels, int *samples )
index f7966ed8322c5a32d8decfcd331a384d746272ea..c1fa1681e3d558814e2f944b5540194a93711ccf 100644 (file)
@@ -128,6 +128,10 @@ static int producer_get_image( mlt_frame frame, uint8_t **buffer, mlt_image_form
        // See if we need to regenerate
        if ( *width != current_width || *height != current_height )
        {
+               // Color the image
+               uint8_t y, u, v;
+               int i = 0;
+
                // Allocate the image
                size = *width * *height * 2;
                image = mlt_pool_alloc( size );
@@ -137,9 +141,6 @@ static int producer_get_image( mlt_frame frame, uint8_t **buffer, mlt_image_form
                mlt_properties_set_int( producer_props, "width", *width );
                mlt_properties_set_int( producer_props, "height", *height );
 
-               // Color the image
-               uint8_t y, u, v;
-               int i = 0;
                RGB2YUV( color.r, color.g, color.b, y, u, v );
 
                while ( i < size )
index aafdd17ba9ba49a63b72292adcea8912327fcf01..da4800c2b7fd24033f16574f9710f87c32eb62f0 100644 (file)
@@ -763,7 +763,7 @@ static int get_b_frame_image( mlt_transition this, mlt_frame b_frame, uint8_t **
 
        ret = mlt_frame_get_image( b_frame, image, &format, width, height, 1 );
 
-       return ret;
+       return ret && image != NULL;
 }
 
 
index 4a8fe0916ab007141dc91606cd67bf106c479dab..636773a711541f45c5198f86f1e365e81ab5806d 100644 (file)
@@ -518,9 +518,6 @@ static int transition_get_image( mlt_frame a_frame, uint8_t **image, mlt_image_f
                start = transition_parse_keys( this, normalised_width, normalised_height );
        }
 
-       if ( *height & 1 )
-               *height ++;
-
        // Fetch the a frame image
        mlt_frame_get_image( a_frame, image, format, width, height, 1 );
 
@@ -632,7 +629,7 @@ static int transition_get_image( mlt_frame a_frame, uint8_t **image, mlt_image_f
                if ( scale )
                {
                        affine_max_output( affine.matrix, &sw, &sh, dz );
-                       affine_scale( affine.matrix, 1.0 / sw, 1.0 / sh );
+                       affine_scale( affine.matrix, sw, sh );
                }
                else if ( scale_x != 0 && scale_y != 0 )
                {