]> git.sesse.net Git - mlt/commitdiff
frei0r/{frei0r_helper,transition_frei0r}.c: fixed wrong scaling and memory leak
authorblendamedt <blendamedt@d19143bc-622f-0410-bfdd-b5b2a6649095>
Sat, 22 Mar 2008 15:11:46 +0000 (15:11 +0000)
committerblendamedt <blendamedt@d19143bc-622f-0410-bfdd-b5b2a6649095>
Sat, 22 Mar 2008 15:11:46 +0000 (15:11 +0000)
git-svn-id: https://mlt.svn.sourceforge.net/svnroot/mlt/trunk/mlt@1107 d19143bc-622f-0410-bfdd-b5b2a6649095

src/modules/frei0r/frei0r_helper.c
src/modules/frei0r/transition_frei0r.c

index 4bcaf305ec6d29a2d9eb356421f51bfea0387e2d..cd309baef085582d5f4e93da30bc4164f59d4016 100644 (file)
@@ -21,7 +21,7 @@
 #include <string.h>
 
  int process_frei0r_item( mlt_service_type type,  double position , mlt_properties prop , mlt_frame this, uint8_t **image, mlt_image_format *format, int *width, int *height, int writable ){
-       
+
        int i=0;
        f0r_instance_t ( *f0r_construct ) ( unsigned int , unsigned int ) =  mlt_properties_get_data(  prop , "f0r_construct" ,NULL);
        void (*f0r_update)(f0r_instance_t instance, double time, const uint32_t* inframe, uint32_t* outframe)=mlt_properties_get_data(  prop , "f0r_update" ,NULL);
                
                mlt_convert_yuv422_to_rgb24a ( image[0] , (uint8_t *)img_a , video_area );
                mlt_convert_yuv422_to_rgb24a ( image[1] , (uint8_t *)img_b , video_area );
-               uint8_t* yuv = mlt_pool_alloc( video_area * 3 );
                f0r_update2 ( inst , position , img_a , img_b , NULL , result );
-               mlt_convert_rgb24a_to_yuv422((uint8_t *)result, *width, *height, *width * sizeof(uint32_t), 
-                                                                                               yuv, NULL );
-               image[2]=yuv;
+               
+               uint8_t * image_ptr=mlt_properties_get_data(MLT_FRAME_PROPERTIES(this), "image", NULL );
+               if (image_ptr)
+                   mlt_convert_rgb24a_to_yuv422((uint8_t *)result, *width, *height, *width * sizeof(uint32_t), image_ptr , NULL );
+               
+               mlt_pool_release(result);
        }
        mlt_pool_release(img_a);
        mlt_pool_release(img_b);
index 46b82fc272b309453bc404dcff24bd6baa6b06a2..4fb6846e5e232924746557f78d0670606ef47e57 100644 (file)
@@ -44,11 +44,10 @@ static int transition_get_image( mlt_frame a_frame, uint8_t **image, mlt_image_f
        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" ) );
        mlt_properties_set_double( b_props, "consumer_aspect_ratio", mlt_properties_get_double( a_props, "consumer_aspect_ratio" ) );
-       
-       
-       *width = mlt_properties_get_int( !invert ? a_props : b_props, "width" );
-       *height = mlt_properties_get_int( !invert ? a_props : b_props, "height" );
 
+       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" );
+       
        uint8_t *images[]={NULL,NULL,NULL};
 
        mlt_frame_get_image( a_frame, &images[0], format, width, height, 1 );
@@ -63,10 +62,11 @@ static int transition_get_image( mlt_frame a_frame, uint8_t **image, mlt_image_f
 
        float pos=( float )( position - in ) / ( float )( out - in + 1 );
        
-       process_frei0r_item( transition_type , pos , properties, a_frame, images, format, width,height, writable );
-       if (images[2]){
-               *image=images[2];
-       }
+       process_frei0r_item( transition_type , pos , properties, !invert ? a_frame : b_frame , images , format, width,height, writable );
+       
+       *width = mlt_properties_get_int( !invert ? a_props : b_props, "width" );
+        *height = mlt_properties_get_int( !invert ? a_props : b_props, "height" );
+       *image = mlt_properties_get_data( !invert ? a_props : b_props , "image", NULL );
        return 0;
 }