// Create an empty geometries object
mlt_geometry geometry = mlt_geometry_init( );
- // Get the in and out position
- mlt_position in = mlt_transition_get_in( this );
- mlt_position out = mlt_transition_get_out( this );
- int length = out - in + 1;
+ // Get the duration
+ mlt_position length = mlt_transition_get_length( this );
double cycle = mlt_properties_get_double( properties, "cycle" );
// Get the new style geometry string
item.frame = -1;
if ( mlt_geometry_parse_item( geometry, &item, mlt_properties_get( properties, "end" ) ) == 0 )
mlt_geometry_insert( geometry, &item );
+ mlt_geometry_interpolate( geometry );
}
return geometry;
/** Calculate the field delta for this frame - position between two frames.
*/
-static inline double delta_calculate( mlt_transition this, mlt_frame frame, mlt_position position )
-{
- // Get the in and out position
- mlt_position in = mlt_transition_get_in( this );
- mlt_position out = mlt_transition_get_out( this );
- double length = out - in + 1;
-
- // Now do the calcs
- double x = ( double )( position - in ) / length;
- double y = ( double )( position + 1 - in ) / length;
-
- return length * ( y - x ) / 2.0;
-}
-
static int get_value( mlt_properties properties, const char *preferred, const char *fallback )
{
int value = mlt_properties_get_int( properties, preferred );
/** Composite a source line over a destination line
*/
+#if defined(USE_SSE) && defined(ARCH_X86_64)
+#include "composite_line_yuv_sse2_simple.c"
+#endif
static void composite_line_yuv( uint8_t *dest, uint8_t *src, int width, uint8_t *alpha_b, uint8_t *alpha_a, int weight, uint16_t *luma, int soft, uint32_t step )
{
- register int j;
+ register int j = 0;
register int mix;
- for ( j = 0; j < width; j ++ )
+#if defined(USE_SSE) && defined(ARCH_X86_64)
+ if ( !luma && width > 7 )
+ {
+ composite_line_yuv_sse2_simple(dest, src, width, alpha_b, alpha_a, weight);
+ j = width - width % 8;
+ dest += j * 2;
+ src += j * 2;
+ alpha_a += j;
+ alpha_b += j;
+ }
+#endif
+
+ for ( ; j < width; j ++ )
{
mix = calculate_mix( luma, j, soft, weight, *alpha_b ++, step );
*dest = sample_mix( *dest, *src++, mix );
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
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 );
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 );
if ( !crop )
{
crop = mlt_geometry_init();
- mlt_position in = mlt_transition_get_in( this );
- mlt_position out = mlt_transition_get_out( this );
- int length = out - in + 1;
+ mlt_position length = mlt_transition_get_length( this );
double cycle = mlt_properties_get_double( properties, "cycle" );
// Allow a geometry repeat cycle
sprintf( key, "%s.in", name );
if ( mlt_properties_get( a_props, key ) )
{
- sscanf( mlt_properties_get( a_props, key ), "%f,%f,%f,%f,%f,%d,%d", &result->item.x, &result->item.y, &result->item.w, &result->item.h, &result->item.mix, &result->nw, &result->nh );
+ sscanf( mlt_properties_get( a_props, key ), "%f %f %f %f %f %d %d", &result->item.x, &result->item.y, &result->item.w, &result->item.h, &result->item.mix, &result->nw, &result->nh );
}
else
{
}
else
{
- int length = mlt_transition_get_out( this ) - mlt_transition_get_in( this ) + 1;
+ mlt_position length = mlt_transition_get_length( this );
double cycle = mlt_properties_get_double( properties, "cycle" );
if ( cycle > 1 )
length = cycle;
uint8_t *dest = NULL;
// Get the image and dimensions
- uint8_t *image = mlt_properties_get_data( a_props, "image", NULL );
+ uint8_t *image = NULL;
int width = mlt_properties_get_int( a_props, "width" );
int height = mlt_properties_get_int( a_props, "height" );
- int format = mlt_properties_get_int( a_props, "format" );
+ mlt_image_format format = mlt_image_yuv422;
+
+ mlt_frame_get_image( a_frame, &image, &format, &width, &height, 0 );
+ if ( !image )
+ return b_frame;
// Pointers for copy operation
uint8_t *p;
}
// Store the key
- sprintf( key, "%s.in=%d,%d,%d,%d,%f,%d,%d", name, x, y, w, h, result.item.mix, width, height );
+ sprintf( key, "%s.in=%d %d %d %d %f %d %d", name, x, y, w, h, result.item.mix, width, height );
mlt_properties_parse( a_props, key );
- sprintf( key, "%s.out=%d,%d,%d,%d,%f,%d,%d", name, x, y, w, h, result.item.mix, width, height );
+ sprintf( key, "%s.out=%d %d %d %d %f %d %d", name, x, y, w, h, result.item.mix, width, height );
mlt_properties_parse( a_props, key );
ds = w * 2;
dest = mlt_pool_alloc( w * h * 2 );
// Assign to the new frame
- mlt_properties_set_data( b_props, "image", dest, w * h * 2, mlt_pool_release, NULL );
+ mlt_frame_set_image( b_frame, dest, w * h * 2, mlt_pool_release );
mlt_properties_set_int( b_props, "width", w );
mlt_properties_set_int( b_props, "height", h );
mlt_properties_set_int( b_props, "format", format );
struct geometry_s result;
// Calculate the position
- double delta = delta_calculate( this, a_frame, position );
+ double delta = mlt_transition_get_progress_delta( this, a_frame );
+ mlt_position length = mlt_transition_get_length( this );
// Get the image from the b frame
uint8_t *image_b = NULL;
- int width_b = *width;
- int height_b = *height;
+ int width_b = *width > 0 ? *width : mlt_properties_get_int( a_props, "normalised_width" );
+ int height_b = *height > 0 ? *height : mlt_properties_get_int( a_props, "normalised_height" );
// Vars for alphas
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" );
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( b_props, "consumer_deinterlace", 1 );
+ }
// TODO: Dangerous/temporary optimisation - if nothing to do, then do nothing
if ( mlt_properties_get_int( properties, "no_alpha" ) &&
for ( field = 0; field < ( progressive ? 1 : 2 ); field++ )
{
// Assume lower field (0) first
- double field_position = position + field * delta;
+ double field_position = position + field * delta * length;
// Do the calculation if we need to
// NB: Locks needed here since the properties are being modified
this->process = composite_process;
// Default starting motion and zoom
- mlt_properties_set( properties, "start", arg != NULL ? arg : "0,0:100%x100%" );
+ mlt_properties_set( properties, "start", arg != NULL ? arg : "0/0:100%x100%" );
// Default factory
mlt_properties_set( properties, "factory", mlt_environment( "MLT_PRODUCER" ) );