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;
/** 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 );
int stride_src = geometry.sw * bpp;
int stride_dest = width_dest * bpp;
int i_softness = ( 1 << 16 ) * softness;
- int weight = ( ( 1 << 16 ) - 1 ) * geometry.item.mix / 100;
- uint32_t luma_step = ( ( 1 << 16 ) - 1 ) * geometry.item.mix / 100 * ( 1.0 + softness );
+ int weight = ( ( ( 1 << 16 ) - 1 ) * geometry.item.mix + 50 ) / 100;
+ uint32_t luma_step = ( ( ( 1 << 16 ) - 1 ) * geometry.item.mix + 50 ) / 100 * ( 1.0 + softness );
// Adjust to consumer scale
int x = rint( geometry.item.x * width_dest / geometry.nw );
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 );
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
{
}
// 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;
// Calculate the 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;
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" ) );