]> git.sesse.net Git - mlt/commitdiff
Factor out some frame properties in transitions.
authorDan Dennedy <dan@dennedy.org>
Sat, 7 May 2011 05:46:59 +0000 (22:46 -0700)
committerDan Dennedy <dan@dennedy.org>
Sat, 7 May 2011 05:46:59 +0000 (22:46 -0700)
Transitions had to apply a pattern of copying some properties from the A
frame to the B frame that was unrelated to its core routine. This is now
largely taken care of by a recent commit to mlt_transition.c.

src/modules/core/transition_composite.c
src/modules/core/transition_luma.c
src/modules/frei0r/transition_frei0r.c
src/modules/plus/transition_affine.c

index 22eb091e209674b18204f232ffb5b3fdb93ebac8..7b2622b3e50aa63e894dc7595b4715c3a8339358 100644 (file)
@@ -750,6 +750,7 @@ static int get_b_frame_image( mlt_transition this, mlt_frame b_frame, uint8_t **
        mlt_properties b_props = MLT_FRAME_PROPERTIES( b_frame );
        mlt_properties properties = MLT_TRANSITION_PROPERTIES( this );
        uint8_t resize_alpha = mlt_properties_get_int( b_props, "resize_alpha" );
+       double consumer_ar = mlt_profile_sar( mlt_service_profile( MLT_TRANSITION_SERVICE(this) ) );
 
        // Do not scale if we are cropping - the compositing rectangle can crop the b image
        // TODO: Use the animatable w and h of the crop geometry to scale independently of crop rectangle
@@ -758,7 +759,6 @@ static int get_b_frame_image( mlt_transition this, mlt_frame b_frame, uint8_t **
                int real_width = get_value( b_props, "real_width", "width" );
                int real_height = get_value( b_props, "real_height", "height" );
                double input_ar = mlt_properties_get_double( b_props, "aspect_ratio" );
-               double consumer_ar = mlt_properties_get_double( b_props, "consumer_aspect_ratio" );
                double background_ar = mlt_properties_get_double( b_props, "output_ratio" );
                double output_ar = background_ar != 0.0 ? background_ar : consumer_ar;
                int scaled_width = rint( ( input_ar == 0.0 ? output_ar : input_ar ) / output_ar * real_width );
@@ -775,7 +775,6 @@ static int get_b_frame_image( mlt_transition this, mlt_frame b_frame, uint8_t **
                int real_width = get_value( b_props, "real_width", "width" );
                int real_height = get_value( b_props, "real_height", "height" );
                double input_ar = mlt_properties_get_double( b_props, "aspect_ratio" );
-               double consumer_ar = mlt_properties_get_double( b_props, "consumer_aspect_ratio" );
                double background_ar = mlt_properties_get_double( b_props, "output_ratio" );
                double output_ar = background_ar != 0.0 ? background_ar : consumer_ar;
                int scaled_width = rint( ( input_ar == 0.0 ? output_ar : input_ar ) / output_ar * real_width );
@@ -1131,13 +1130,6 @@ static int transition_get_image( mlt_frame a_frame, uint8_t **image, mlt_image_f
                uint8_t *alpha_a = NULL;
                uint8_t *alpha_b = NULL;
 
-               // Composites always need scaling... defaulting to lowest
-               const char *rescale = mlt_properties_get( a_props, "rescale.interp" );
-               if ( rescale == NULL || !strcmp( rescale, "none" ) )
-                       rescale = "nearest";
-               mlt_properties_set( a_props, "rescale.interp", rescale );
-               mlt_properties_set( b_props, "rescale.interp", rescale );
-
                // Do the calculation
                // NB: Locks needed here since the properties are being modified
                int invert = mlt_properties_get_int( properties, "invert" );
@@ -1145,11 +1137,12 @@ static int transition_get_image( mlt_frame a_frame, uint8_t **image, mlt_image_f
                composite_calculate( this, &result, invert ? b_frame : a_frame, position );
                mlt_service_unlock( MLT_TRANSITION_SERVICE( this ) );
 
-               // Since we are the consumer of the b_frame, we must pass along these
-               // consumer properties from the a_frame
-               mlt_properties_set_int( b_props, "consumer_deinterlace", mlt_properties_get_int( a_props, "consumer_deinterlace" ) || mlt_properties_get_int( properties, "deinterlace" ) );
-               mlt_properties_set( b_props, "consumer_deinterlace_method", mlt_properties_get( a_props, "consumer_deinterlace_method" ) );
-               mlt_properties_set_double( b_props, "consumer_aspect_ratio", mlt_properties_get_double( a_props, "consumer_aspect_ratio" ) );
+               // Manual option to deinterlace
+               if ( mlt_properties_get_int( properties, "deinterlace" ) )
+               {
+                       mlt_properties_set_int( a_props, "consumer_deinterlace", 1 );
+                       mlt_properties_set_int( a_props, "consumer_deinterlace", 1 );
+               }
 
                // TODO: Dangerous/temporary optimisation - if nothing to do, then do nothing
                if ( mlt_properties_get_int( properties, "no_alpha" ) && 
index cb18dd5e0fa54da3aa94c87a01b4962c7e8f756c..437eb9f1b511d585e24e920cfade4c586b958a10 100644 (file)
@@ -45,7 +45,6 @@ static inline int dissolve_yuv( mlt_frame this, mlt_frame that, float weight, in
 
        if ( mlt_properties_get( &this->parent, "distort" ) )
                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 );
@@ -103,7 +102,6 @@ static void luma_composite( mlt_frame a_frame, mlt_frame b_frame, int luma_width
 
        if ( mlt_properties_get( &a_frame->parent, "distort" ) )
                mlt_properties_set( &b_frame->parent, "distort", mlt_properties_get( &a_frame->parent, "distort" ) );
-       mlt_properties_set_int( &b_frame->parent, "consumer_deinterlace", mlt_properties_get_int( &a_frame->parent, "consumer_deinterlace" ) );
        mlt_frame_get_image( a_frame, &p_dest, &format_dest, &width_dest, &height_dest, 1 );
        mlt_frame_get_image( b_frame, &p_src, &format_src, &width_src, &height_src, 0 );
 
@@ -459,28 +457,10 @@ 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 || !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
-       // consumer property from the a_frame
-       if ( mlt_properties_get_double( a_props, "aspect_ratio" ) == 0.0 )
-               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" ) );
-       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 )
                mix -= floor( mix );
 
-       // Ensure we get scaling on the b_frame
-       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", mlt_properties_get( a_props, "rescale.interp" ) );
-       
-       if ( invert )
-               mlt_properties_set_int( b_props, "consumer_deinterlace", mlt_properties_get_int( a_props, "consumer_deinterlace") );
-
        if ( mlt_properties_get( properties, "fixed" ) )
                mix = mlt_properties_get_double( properties, "fixed" );
 
index 4e335b18e665f5517c81368e641ef6c45610304d..f36d1c4e4b244489508a2bb92b6c7b03332412dc 100644 (file)
@@ -31,19 +31,6 @@ static int transition_get_image( mlt_frame a_frame, uint8_t **image, mlt_image_f
 
        int invert = mlt_properties_get_int( properties, "invert" );
 
-       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" );
-
-       // set consumer_aspect_ratio for a and b frame
-       if ( mlt_properties_get_double( a_props, "aspect_ratio" ) == 0.0 )
-               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" ) );
-       mlt_properties_set_double( b_props, "consumer_aspect_ratio", mlt_properties_get_double( a_props, "consumer_aspect_ratio" ) );
-
-       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", mlt_properties_get( a_props, "rescale.interp" ) );
-
        uint8_t *images[]={NULL,NULL,NULL};
 
        *format = mlt_image_rgb24a;
index 95e4a92ab985da34257431e6caed37fda6652491..b07cea31cee285b31e7f4e5ee1715d8f6101d21a 100644 (file)
@@ -426,12 +426,10 @@ static int transition_get_image( mlt_frame a_frame, uint8_t **image, mlt_image_f
        mlt_properties_set_int( b_props, "rescale_height", b_height );
 
        // Suppress padding and aspect normalization.
-       char *interps = mlt_properties_get( b_props, "rescale.interp" );
+       char *interps = mlt_properties_get( a_props, "rescale.interp" );
        if ( interps )
                interps = strdup( interps );
        mlt_properties_set( b_props, "rescale.interp", "none" );
-       if ( mlt_properties_get_double( b_props, "aspect_ratio" ) == 0.0 )
-               mlt_properties_set_double( b_props, "aspect_ratio", consumer_ar );
 
        // This is not a field-aware transform.
        mlt_properties_set_int( b_props, "consumer_deinterlace", 1 );