Permalink
Browse files

Compute a shot_change_list property for motion_est.

  • Loading branch information...
1 parent 24647b4 commit 42e4534d2a8c92079528e096bbdf71f759cc4b8d @ddennedy ddennedy committed Oct 20, 2012
Showing with 22 additions and 2 deletions.
  1. +22 −2 src/modules/motion_est/filter_motion_est.c
@@ -952,10 +952,30 @@ static int filter_get_image( mlt_frame frame, uint8_t **image, mlt_image_format
if( c->comparison_average > 10 * c->mb_w * c->mb_h &&
c->comparison_average > c->previous_msad * 2 )
{
- fprintf(stderr, " - SAD: %d <<Shot change>>\n", c->comparison_average);
+ mlt_properties properties = MLT_FILTER_PROPERTIES( filter );
+ mlt_log_verbose( MLT_FILTER_SERVICE(filter), "shot change: %d\n", c->comparison_average);
mlt_properties_set_int( MLT_FRAME_PROPERTIES( frame ), "shot_change", 1);
- // c->former_vectors_valid = 0; // Invalidate the previous frame's predictors
c->shot_change = 1;
+
+ // Add the shot change to the list
+ mlt_geometry key_frames = mlt_properties_get_data( properties, "shot_change_list", NULL );
+ if ( !key_frames )
+ {
+ key_frames = mlt_geometry_init();
+ mlt_properties_set_data( properties, "shot_change_list", key_frames, 0,
+ (mlt_destructor) mlt_geometry_close, (mlt_serialiser) mlt_geometry_serialise );
+ if ( key_frames )
+ mlt_geometry_set_length( key_frames, mlt_filter_get_length2( filter, frame ) );
+ }
+ if ( key_frames )
+ {
+ struct mlt_geometry_item_s item;
+ item.frame = (int) c->current_frame_position;
+ item.x = c->comparison_average;
+ item.f[0] = 1;
+ item.f[1] = item.f[2] = item.f[3] = item.f[4] = 0;
+ mlt_geometry_insert( key_frames, &item );
+ }
}
else {
c->former_vectors_valid = 1;

0 comments on commit 42e4534

Please sign in to comment.