struct geometry_s
{
+ int frame;
float position;
float mix;
int nw; // normalised width
position = ( position - in->position ) / ( out->position - in->position );
// Calculate this frames geometry
- output->nw = in->nw;
- output->nh = in->nh;
- output->x = in->x + ( out->x - in->x ) * position;
- output->y = in->y + ( out->y - in->y ) * position;
- output->w = in->w + ( out->w - in->w ) * position;
- output->h = in->h + ( out->h - in->h ) * position;
- output->mix = in->mix + ( out->mix - in->mix ) * position;
- output->distort = in->distort;
+ if ( in->frame != out->frame - 1 )
+ {
+ output->nw = in->nw;
+ output->nh = in->nh;
+ output->x = in->x + ( out->x - in->x ) * position;
+ output->y = in->y + ( out->y - in->y ) * position;
+ output->w = in->w + ( out->w - in->w ) * position;
+ output->h = in->h + ( out->h - in->h ) * position;
+ output->mix = in->mix + ( out->mix - in->mix ) * position;
+ output->distort = in->distort;
+ }
+ else
+ {
+ output->nw = out->nw;
+ output->nh = out->nh;
+ output->x = out->x;
+ output->y = out->y;
+ output->w = out->w;
+ output->h = out->h;
+ output->mix = out->mix;
+ output->distort = out->distort;
+ }
// DRD> These break on negative values. I do not think they are needed
// since yuv_composite takes care of YUYV group alignment
// Parse and add to the list
geometry_parse( temp, ptr, value, normalised_width, normalised_height );
- // Assign the position
+ // Assign the position and frame
+ temp->frame = frame;
temp->position = position;
// Allow the next to be appended after this one
mlt_position out = mlt_transition_get_out( this );
// Get the position of the frame
- mlt_position position = mlt_frame_get_position( frame );
+ char *name = mlt_properties_get( mlt_transition_properties( this ), "_unique_id" );
+ mlt_position position = mlt_properties_get_position( mlt_frame_properties( frame ), name );
// Now do the calcs
float x = ( float )( position - in ) / ( float )( out - in + 1 );
int32_t weight = ( 1 << 16 ) * ( geometry.mix / 100 );
int step = ( field > -1 ) ? 2 : 1;
int bpp = 2;
- int stride_src = width_src * bpp * step;
- int stride_dest = width_dest * bpp * step;
- int alpha_stride = stride_src / bpp;
-
+ int stride_src = width_src * bpp;
+ int stride_dest = width_dest * bpp;
+
// Adjust to consumer scale
int x = geometry.x * width_dest / geometry.nw;
int y = geometry.y * height_dest / geometry.nh;
}
// crop overlay beyond right edge of frame
- else if ( x + width_src > width_dest )
+ if ( x + width_src > width_dest )
width_src = width_dest - x;
// crop overlay off the top edge of the frame
y_src = -y;
height_src -= y_src;
}
+
// crop overlay below bottom edge of frame
- else if ( y + height_src > height_dest )
+ if ( y + height_src > height_dest )
height_src = height_dest - y;
// offset pointer into overlay buffer based on cropping
height_src--;
}
+ stride_src *= step;
+ stride_dest *= step;
+ int alpha_stride = stride_src / bpp;
+
if ( line_fn == NULL )
line_fn = composite_line_yuv;
*width = geometry->sw * *width / geometry->nw;
*height = geometry->sh * *height / geometry->nh;
- x -= x % 2;
+ x &= 0xfffffffe;
// optimization points - no work to do
if ( *width < 1 || *height < 1 )
uint8_t *dest = *image;
uint8_t *src = image_b;
uint8_t *alpha = mlt_frame_get_alpha_mask( b_frame );
- int progressive = mlt_properties_get_int( a_props, "progressive" ) ||
+ int progressive =
mlt_properties_get_int( a_props, "consumer_progressive" ) ||
mlt_properties_get_int( properties, "progressive" );
int field;
static mlt_frame composite_process( mlt_transition this, mlt_frame a_frame, mlt_frame b_frame )
{
+ // Get a unique name to store the frame position
+ char *name = mlt_properties_get( mlt_transition_properties( this ), "_unique_id" );
+
+ // Assign the current position to the name
+ mlt_properties_set_position( mlt_frame_properties( a_frame ), name, mlt_frame_get_position( a_frame ) );
+
// Propogate the transition properties to the b frame
mlt_properties_set_double( mlt_frame_properties( b_frame ), "relative_position", position_calculate( this, mlt_frame_get_position( a_frame ) ) );
+
mlt_frame_push_service( a_frame, this );
mlt_frame_push_frame( a_frame, b_frame );
mlt_frame_push_get_image( a_frame, transition_get_image );