On Fri, Oct 19, 2012 at 6:15 PM, j-b-m <[email protected]> wrote:
> On Friday 19 October 2012 16:49:59 Dan Dennedy wrote:
>> On Fri, Oct 19, 2012 at 2:46 PM, j-b-m <[email protected]> wrote:
>> > Hi,
>> >
>> > Following a feature request in Kdenlive (1), I tried to make a few changes
>> > to
>> > the motion_est filter to allow the detection of scene changes in a clip.
>> >
>> > I made 2 changes to the filter:
>> >
>> > 1 - add a geometry property "bounding" allowing to process filter on a
>> > part of the image only to speed up processing
>>
>> ok
>>
>> > 2 - Store the scene changes frame positions in a "_scene_cut" property
>> > that can later be retrieved by the application
>>
>> Why hide the property with the leading underscore? If it is not
>> hidden, the someone using melt can use this to serialize the result to
>> XML for processing the results. Also, the name should perhaps be a bit
>> more consistent with the existing "shot_change"
>>
>> Also, for the value, it looks like you are you are making a list of
>> frame numbers using a colon delimiter. Hmm.. there might be a case to
>> get these as time values (i.e. clock or timecode) in the future. Also,
>> there might be a case for making the list format more consistent with
>> geometry keyframing where semi-colon is the delimiter. You could then
>> use mlt_geometry to construct this value instead of this ad hoc code.
>> An app could use mlt_geometry to parse it as well. Then, when
>> mlt_geometry is refactored into mlt_properties and a new mlt_rect
>> type, it will gain support for time values.
>
> Ok, here is an updated version, trying to use mlt_geometry.
>
Not quite, so I started working on the patch myself. First, let's look
at the first part - the bounding property. You were assigning the
bounds pointer to something on the stack local to a block. Also, it
had to parse the property on each iteration. Here is mine, but it is
not mutable, which I think is OK because you can not really adjust it
interactively and expect to see results in something like this. If you
want to "reset" it then do a mlt_properties_set_data() to NULL to
force bounding to be re-parsed. OK?
diff --git a/src/modules/motion_est/filter_motion_est.c
b/src/modules/motion_est/filter_motion_est.c
index d2dff28..7d5dd33 100644
--- a/src/modules/motion_est/filter_motion_est.c
+++ b/src/modules/motion_est/filter_motion_est.c
@@ -891,6 +891,22 @@ static int filter_get_image( mlt_frame frame,
uint8_t **image, mlt_image_format
/* Check to see if somebody else has given us bounds */
struct mlt_geometry_item_s *bounds = mlt_properties_get_data(
MLT_FRAME_PROPERTIES( frame ), "bounds", NULL );
+ if (bounds == NULL )
+ {
+ char *property = mlt_properties_get( MLT_FILTER_PROPERTIES(
filter
), "bounding" );
+ if ( property != NULL )
+ {
+ mlt_geometry geometry = mlt_geometry_init( );
+ mlt_profile profile = mlt_service_profile(
MLT_FILTER_SERVICE( filter ) );
+ mlt_geometry_parse( geometry, property, 0,
profile->width,
profile->height );
+ if ( geometry != NULL ) {
+ bounds = calloc( 1, sizeof(*bounds) );
+ mlt_properties_set_data( MLT_FILTER_PROPERTIES(
filter ),
"bounds", bounds, sizeof(*bounds), free, NULL );
+ mlt_geometry_fetch( geometry, bounds, 0 );
+ }
+ }
+ }
+
if( bounds != NULL ) {
// translate pixel units (from bounds) to macroblock units
// make sure whole macroblock stays within bounds
--
+-DRD-+
------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_sfd2d_oct
_______________________________________________
Mlt-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mlt-devel