Re: [Mlt-devel] [PATCH] migrate to timestamped audio packet
09.06.11 09:57, Dan Dennedy написав(ла): 2011/6/8 Maksym Veremeyenkove...@m1stereo.tv: hi, attached patch provides decklink consumer rework in order to simplify and fix current bugs (#3311153, #3309546, #3308341). it also makes (IMHO) it more straightforward and easer to investigate... i did a tests against videos i have and found no noticeable regressions. Overall, I like the direction of it very much; it is much clearer. However, there is at least one big problem. It does not respect the realtime frame-dropping behavior of mlt_consumer. Basically, I re-added this part between renderAudio() and renderVideo() plus members and initializers to support it. if ( mlt_properties_get_int( MLT_FRAME_PROPERTIES(frame), rendered) ) { // Close the previous frame and use the new one mlt_frame_close( m_frame ); m_frame = frame; } else { if ( !m_frame ) m_frame = frame; // Reuse the last frame mlt_log_verbose( getConsumer(), dropped video frame %u\n, ++m_dropped ); } --- If a frame is not rendered, then the render-ahead thread in mlt_consumer has decided to skip preparing an image for it (if real_time 0). You did not notice because you can still request to render an image anyway on-demand by calling mlt_frame_get_image and also because you were probably not stressing it. thanks for noticing that - that is just clear what rendered properties of frame means. I would like to propose two ways for workaround of frame-dropping behavior of mlt_consumer: 1. i can honer them by two ways a) keep latest rendered frame and output (without audio) it for a case of non-rendered as it was present in origin code b) just avoid any render(Audio|Video) if it dropped frame but increment counter (m_count) - lets decklink freeze latest frame 2. use mlt_consumer_get_frame (i think its the same as mlt_consumer_rt_frame but without RT behavior) - what could be most preferred because there is also a check: [...] // enqueu more frames if underrun if(bmdOutputFrameDisplayedLate == completed) --ScheduleNextFrame(false); [...] i can even implement both by either by #ifdef or by properties like rt that could split (regulate) behavior for dropped frames workaround... I am still testing it. In your own testing, please lookout for screen tearing, which is why I was previously creating multiple IDeckLinkMutableVideoFrames. I did not see it yet maybe because ScheduleVideoFrame() is now synchronous with ScheduledFrameCompleted(). i will try to load system hard and test again... -- Maksym Veremeyenko -- EditLive Enterprise is the world's most technically advanced content authoring tool. Experience the power of Track Changes, Inline Image Editing and ensure content is compliant with Accessibility Checking. http://p.sf.net/sfu/ephox-dev2dev ___ Mlt-devel mailing list Mlt-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mlt-devel
Re: [Mlt-devel] [PATCH] migrate to timestamped audio packet
On Thu, June 9, 2011 7:27 pm, Dan Dennedy wrote: [...] frame that is being saved and repeated, hmm... repeat last DeckLinkVideoFrame instead of mlt_frame. great idea! what would you say about approach used in attached patch? I will test it tomorrow morning... -- Maksym Veremeyenko 0002-respect-the-realtime-frame-dropping-behavior-of-mlt_.patch Description: Binary data -- EditLive Enterprise is the world's most technically advanced content authoring tool. Experience the power of Track Changes, Inline Image Editing and ensure content is compliant with Accessibility Checking. http://p.sf.net/sfu/ephox-dev2dev___ Mlt-devel mailing list Mlt-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mlt-devel
Re: [Mlt-devel] [PATCH] rugen UI reworks: 0001-introduce-timecodes-display.patch
11.06.11 18:59, Maksym Veremeyenko написав(ла): [...] *0001-introduce-timecodes-display.patch* - switch display all timings in timecode (require previous patches for melted to provide proper fps) -- Maksym Veremeyenko From 8a12273a54cf8b028bca37773f3fb079ccd97a51 Mon Sep 17 00:00:00 2001 From: Maksym Veremeyenko ve...@m1stereo.tv Date: Fri, 10 Jun 2011 15:26:24 +0300 Subject: [PATCH 1/6] introduce timecodes display --- src/dv1394app.c | 22 + src/dv1394app.h |2 + src/page_clips.c | 18 +++- src/page_status.c | 55 +++- 4 files changed, 64 insertions(+), 33 deletions(-) diff --git a/src/dv1394app.c b/src/dv1394app.c index d367235..b1919ae 100644 --- a/src/dv1394app.c +++ b/src/dv1394app.c @@ -555,3 +555,25 @@ void dv1394app_close( dv1394app this ) page_close( this-pages[ -- this-page_count ] ); free( this ); } + +char* frames2tc( int f, float fps, char* buf ) +{ + int tc[4] = { 0, 0, 0, 0 }; + float d; + int t; + + if ( fps ) + { + d = f / fps; + t = d; + + tc[0] = (d - t) * fps; + tc[1] = t % 60; t /= 60; + tc[2] = t % 60; t /= 60; + tc[3] = t % 24; + } + + sprintf(buf, %.2d:%.2d:%.2d:%.2d, tc[3], tc[2], tc[1], tc[0]); + + return buf; +} diff --git a/src/dv1394app.h b/src/dv1394app.h index 70671be..ae411c5 100644 --- a/src/dv1394app.h +++ b/src/dv1394app.h @@ -63,5 +63,7 @@ extern void dv1394app_show_status( dv1394app, mvcp_status ); extern void dv1394app_disconnect( dv1394app ); extern void dv1394app_close( dv1394app ); +extern char* frames2tc( int f, float fps, char* buf ); + #endif diff --git a/src/page_clips.c b/src/page_clips.c index 50b8912..173f97e 100644 --- a/src/page_clips.c +++ b/src/page_clips.c @@ -155,7 +155,13 @@ static void list_queue( page_clips this, int clip ) GtkCellRenderer *renderer; GtkTreeViewColumn *column; - list_store = gtk_list_store_new( 6, G_TYPE_BOOLEAN, G_TYPE_INT, G_TYPE_INT, G_TYPE_INT, G_TYPE_STRING, G_TYPE_INT ); + list_store = gtk_list_store_new( 6, + G_TYPE_BOOLEAN, + G_TYPE_STRING, + G_TYPE_STRING, + G_TYPE_STRING, + G_TYPE_STRING, + G_TYPE_INT ); gtk_tree_view_set_model( GTK_TREE_VIEW( treeview ), GTK_TREE_MODEL( list_store ) ); renderer = gtk_cell_renderer_toggle_new( ); @@ -188,9 +194,17 @@ static void list_queue( page_clips this, int clip ) for ( index = 0; index mvcp_list_count( list ); index ++ ) { + char tc1[12], tc2[12], tc3[12]; mvcp_list_get( list, index, entry ); gtk_list_store_append( list_store, iter ); - gtk_list_store_set( list_store, iter, 0, index == clip, 1, ( int )entry.in, 2, ( int )entry.out, 3, ( int )entry.size, 4, entry.full, 5, entry.clip, -1 ); + gtk_list_store_set( list_store, iter, + 0, index == clip, + 1, frames2tc( entry.in, entry.fps, tc1), + 2, frames2tc( entry.out, entry.fps, tc2), + 3, frames2tc( entry.size, entry.fps, tc3), + 4, entry.full, + 5, entry.clip, + -1 ); } this-clip = clip; diff --git a/src/page_status.c b/src/page_status.c index bd8bd84..1ca9487 100644 --- a/src/page_status.c +++ b/src/page_status.c @@ -51,45 +51,38 @@ static GtkWidget *this_page_get_widget( page ); /** Show the status associated to a unit. */ +static char* status_to_text( mvcp_status status ) +{ + switch( status-status ) + { + case unit_offline: return offline; break; + case unit_undefined: return undefined; break; + case unit_not_loaded: return unloaded; break; + case unit_stopped: return stopped; break; + case unit_playing: return playing; break; + case unit_paused: return paused; break; + case unit_disconnected: return disconnect; break; + case unit_unknown: return unknown; break; + } + return unknown; +} + static int show_status( page_status this, mvcp_status status ) { GtkWidget *widget = this_page_get_widget( ( page )this ); char temp[ 1024 ] = ; char temp2[ 1024 ]; char label_name[ 256 ]; + char tc1[12], tc2[12], tc3[12]; - sprintf( temp, %05d %05d %05d %s [, status-in, status-position, status-out, status-clip ); - - switch( status-status ) - { - case unit_offline: - strcat( temp, offline ); - break; - case unit_undefined: - strcat( temp, undefined ); - break; - case unit_not_loaded: - strcat( temp, unloaded ); - break; - case unit_stopped: - strcat( temp, stopped ); - break; - case unit_playing: - strcat( temp, playing ); - break; - case unit_paused: - strcat( temp, paused ); - break; - case unit_disconnected: - strcat( temp, disconnect ); - break; - default: - strcat( temp, unknown ); - break; - } + sprintf( temp, [%s] IN:%s POS:%s OUT:%s %s, + status_to_text( status ), + frames2tc(status-in, status-fps, tc1), + frames2tc(status-position, status-fps, tc2), + frames2tc(status-out, status-fps, tc3), + status-clip + ); - strcat( temp, ] ); - sprintf( label_name, label_unit_%d, status-unit ); gdk_threads_enter(); -- 1.7.4.4
Re: [Mlt-devel] [PATCH] rugen UI reworks: 0003-introduce-clips-page-split.patch
11.06.11 18:59, Maksym Veremeyenko написав(ла): [...] *0003-introduce-clips-page-split.patch* - add UI splitter into the page_clips -- Maksym Veremeyenko From b29301d007ac3ad0c43ad2fd4fc09c6c5c996b02 Mon Sep 17 00:00:00 2001 From: Maksym Veremeyenko ve...@m1stereo.tv Date: Sat, 11 Jun 2011 16:03:11 +0300 Subject: [PATCH 3/6] introduce clips page split --- src/interface.c | 44 +++- 1 files changed, 35 insertions(+), 9 deletions(-) diff --git a/src/interface.c b/src/interface.c index 552c2f5..3720315 100644 --- a/src/interface.c +++ b/src/interface.c @@ -493,7 +493,7 @@ create_window_connection (void) return window_connection; } -static void create_pane_status (GtkWidget* parent) +static GtkWidget* create_pane_status (GtkWidget* parent, GtkWidget* top) { int i; char buf[32]; @@ -506,21 +506,22 @@ static void create_pane_status (GtkWidget* parent) // create a scrolled area scrolledwindow = gtk_scrolled_window_new (NULL, NULL); gtk_widget_show (scrolledwindow); - gtk_container_add (GTK_CONTAINER (parent), scrolledwindow); + if ( parent ) + gtk_container_add (GTK_CONTAINER (parent), scrolledwindow); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); - GLADE_HOOKUP_OBJECT (parent, scrolledwindow, scrolledwindow4); + GLADE_HOOKUP_OBJECT (top, scrolledwindow, scrolledwindow4); // create a viewport viewport = gtk_viewport_new (NULL, NULL); gtk_widget_show (viewport); gtk_container_add (GTK_CONTAINER (scrolledwindow), viewport); - GLADE_HOOKUP_OBJECT (parent, viewport, viewport1); + GLADE_HOOKUP_OBJECT (top, viewport, viewport1); // create a table for displaying radios table = gtk_table_new (32, 1, FALSE); gtk_widget_show (table); gtk_container_add (GTK_CONTAINER (viewport), table); - GLADE_HOOKUP_OBJECT (parent, table, table3); + GLADE_HOOKUP_OBJECT (top, table, table3); for (i = 0; i 16; i++) { @@ -536,7 +537,7 @@ static void create_pane_status (GtkWidget* parent) gtk_label_set_justify (GTK_LABEL (label_unit), GTK_JUSTIFY_LEFT); gtk_misc_set_alignment (GTK_MISC (label_unit), 0, 0.5); snprintf(buf, sizeof(buf), label_unit_%d, i); - GLADE_HOOKUP_OBJECT (parent, label_unit, buf); + GLADE_HOOKUP_OBJECT (top, label_unit, buf); // radio button radiobutton = gtk_radio_button_new_with_mnemonic (NULL, _(disconnected)); @@ -546,8 +547,10 @@ static void create_pane_status (GtkWidget* parent) gtk_radio_button_set_group (GTK_RADIO_BUTTON (radiobutton), radiobutton_group); radiobutton_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radiobutton)); snprintf(buf, sizeof(buf), radiobutton_%d, i); - GLADE_HOOKUP_OBJECT (parent, radiobutton, buf); + GLADE_HOOKUP_OBJECT (top, radiobutton, buf); } + + return scrolledwindow; } GtkWidget* @@ -559,7 +562,7 @@ create_page_status (void) gtk_window_set_title (GTK_WINDOW (page_status), _(page_status)); GLADE_HOOKUP_OBJECT_NO_REF (page_status, page_status, page_status); - create_pane_status (page_status); + create_pane_status (page_status, page_status); return page_status; } @@ -611,13 +614,36 @@ create_page_clips (void) GtkWidget *image24; GtkWidget *hbuttonbox5; GtkWidget *label45; + GtkWidget *hpaned0; + GtkWidget *frame1, *frame2; page_clips = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_window_set_title (GTK_WINDOW (page_clips), _(page_clips)); + hpaned0 = gtk_hpaned_new (); + gtk_widget_show (hpaned0); + gtk_container_add (GTK_CONTAINER (page_clips), hpaned0); + GLADE_HOOKUP_OBJECT (page_clips, hpaned0, hpaned0); + + frame1 = gtk_frame_new (Playlist); + frame2 = gtk_frame_new (Units); + gtk_frame_set_shadow_type (GTK_FRAME (frame1), GTK_SHADOW_IN); + gtk_frame_set_shadow_type (GTK_FRAME (frame2), GTK_SHADOW_IN); + gtk_widget_show(frame1); + gtk_widget_show(frame2); + + gtk_widget_set_size_request (hpaned0, 200 , -1); + gtk_paned_pack1 (GTK_PANED (hpaned0), frame1, TRUE, FALSE); + gtk_widget_set_size_request (frame1, 50, -1); + gtk_paned_pack2 (GTK_PANED (hpaned0), frame2, FALSE, FALSE); + gtk_widget_set_size_request (frame2, 250, -1); + +// create_pane_status (page_clips, frame2); +// GLADE_HOOKUP_OBJECT_NO_REF (page_status, page_status, page_status); + vbox8 = gtk_vbox_new (FALSE, 0); gtk_widget_show (vbox8); - gtk_container_add (GTK_CONTAINER (page_clips), vbox8); + gtk_container_add (GTK_CONTAINER (frame1), vbox8); hbox26 = gtk_hbox_new (FALSE, 0); gtk_widget_show (hbox26); -- 1.7.4.4 -- EditLive Enterprise is the world's most technically advanced content authoring tool. Experience the power of Track Changes, Inline Image Editing and ensure content is compliant with Accessibility Checking. http://p.sf.net/sfu/ephox-dev2dev___ Mlt-devel mailing list Mlt-devel
Re: [Mlt-devel] [PATCH] rugen UI reworks: 0004-join-clips-and-status-control-to-same-operate-page.patch
11.06.11 18:59, Maksym Veremeyenko написав(ла): Hi, next e-mails will be attached with a patches makes (IMHO) more comfortable work with rugen. [...] *0004-join-clips-and-status-control-to-same-operate-page.patch* - adds a common wrapper for page_clips and page_status to join them into the same page -- Maksym Veremeyenko From e2f5473fd145b558dc19c5d07c05061a2120e2b8 Mon Sep 17 00:00:00 2001 From: Maksym Veremeyenko ve...@m1stereo.tv Date: Sat, 11 Jun 2011 18:18:59 +0300 Subject: [PATCH 4/6] join clips and status control to same 'operate' page --- src/Makefile.am|1 + src/dv1394app.c|3 +- src/interface.c| 25 +++ src/interface.h|3 +- src/page.h |5 +- src/page_clips.c |7 ++- src/page_operate.c | 122 src/page_status.c |8 ++- 8 files changed, 144 insertions(+), 30 deletions(-) create mode 100644 src/page_operate.c diff --git a/src/Makefile.am b/src/Makefile.am index 4f30e03..6bc5baa 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -18,6 +18,7 @@ rugen_SOURCES = \ page_command.c \ page_status.c \ page_units.c \ + page_operate.c \ gtkenhancedscale.c gtkenhancedscale.h rugen_CFLAGS = `pkg-config --cflags gthread-2.0 mlt-melted mlt-mvcp` diff --git a/src/dv1394app.c b/src/dv1394app.c index b1919ae..c462b50 100644 --- a/src/dv1394app.c +++ b/src/dv1394app.c @@ -401,8 +401,7 @@ dv1394app dv1394app_init( GtkWidget *window, char *instance ) // gtk_signal_connect( GTK_OBJECT( widget ), clicked, GTK_SIGNAL_FUNC( on_item_quit_activate ), this ); /* Initialise the pages. */ - dv1394app_register_page( this, page_status_init( this ) ); - dv1394app_register_page( this, page_clips_init( this ) ); + dv1394app_register_page( this, page_operate_init( this ) ); dv1394app_register_page( this, page_command_init( this ) ); this-guard = 1; gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( this-page_buttons[ 0 ] ), TRUE ); diff --git a/src/interface.c b/src/interface.c index 3720315..adc7b86 100644 --- a/src/interface.c +++ b/src/interface.c @@ -554,21 +554,7 @@ static GtkWidget* create_pane_status (GtkWidget* parent, GtkWidget* top) } GtkWidget* -create_page_status (void) -{ - GtkWidget *page_status; - - page_status = gtk_window_new (GTK_WINDOW_TOPLEVEL); - gtk_window_set_title (GTK_WINDOW (page_status), _(page_status)); - GLADE_HOOKUP_OBJECT_NO_REF (page_status, page_status, page_status); - - create_pane_status (page_status, page_status); - - return page_status; -} - -GtkWidget* -create_page_clips (void) +create_page_operate (void) { GtkWidget *page_clips; GtkWidget *vbox8; @@ -618,7 +604,8 @@ create_page_clips (void) GtkWidget *frame1, *frame2; page_clips = gtk_window_new (GTK_WINDOW_TOPLEVEL); - gtk_window_set_title (GTK_WINDOW (page_clips), _(page_clips)); + gtk_window_set_title (GTK_WINDOW (page_clips), _(page_operate)); + GLADE_HOOKUP_OBJECT_NO_REF (page_clips, page_clips, page_operate); hpaned0 = gtk_hpaned_new (); gtk_widget_show (hpaned0); @@ -630,7 +617,9 @@ create_page_clips (void) gtk_frame_set_shadow_type (GTK_FRAME (frame1), GTK_SHADOW_IN); gtk_frame_set_shadow_type (GTK_FRAME (frame2), GTK_SHADOW_IN); gtk_widget_show(frame1); + GLADE_HOOKUP_OBJECT (page_clips, frame1, page_clips); gtk_widget_show(frame2); + GLADE_HOOKUP_OBJECT (page_clips, frame2, page_status); gtk_widget_set_size_request (hpaned0, 200 , -1); gtk_paned_pack1 (GTK_PANED (hpaned0), frame1, TRUE, FALSE); @@ -638,8 +627,7 @@ create_page_clips (void) gtk_paned_pack2 (GTK_PANED (hpaned0), frame2, FALSE, FALSE); gtk_widget_set_size_request (frame2, 250, -1); -// create_pane_status (page_clips, frame2); -// GLADE_HOOKUP_OBJECT_NO_REF (page_status, page_status, page_status); + create_pane_status (frame2, page_clips); vbox8 = gtk_vbox_new (FALSE, 0); gtk_widget_show (vbox8); @@ -859,7 +847,6 @@ create_page_clips (void) gtk_label_set_justify (GTK_LABEL (label45), GTK_JUSTIFY_LEFT); /* Store pointers to all widgets, for use by lookup_widget(). */ - GLADE_HOOKUP_OBJECT_NO_REF (page_clips, page_clips, page_clips); GLADE_HOOKUP_OBJECT (page_clips, vbox8, vbox8); GLADE_HOOKUP_OBJECT (page_clips, hbox26, hbox26); GLADE_HOOKUP_OBJECT (page_clips, label_directory, label_directory); diff --git a/src/interface.h b/src/interface.h index 07ec112..df95306 100644 --- a/src/interface.h +++ b/src/interface.h @@ -4,6 +4,5 @@ GtkWidget* create_gdv1394d (void); GtkWidget* create_window_connection (void); -GtkWidget* create_page_status (void); -GtkWidget* create_page_clips (void); +GtkWidget* create_page_operate (void); GtkWidget* create_page_shell (void); diff --git a/src/page.h b/src/page.h index c3403c0..7f54f4a 100644 --- a/src/page.h +++ b/src/page.h @@ -48,9 +48,10 @@ extern void page_show_status( page, mvcp_status ); extern void page_close( page ); /* page factories
Re: [Mlt-devel] [PATCH] rugen UI reworks: 0005-split-status-string-format-for-status-string-and-sta.patch
11.06.11 18:59, Maksym Veremeyenko написав(ла): Hi, next e-mails will be attached with a patches makes (IMHO) more comfortable work with rugen. [...] *0005-split-status-string-format-for-status-string-and-sta.patch* - use another formatting of status string for status line and units list -- Maksym Veremeyenko From 11eaa4b7c688211e0cd65880990ce6debada0d8c Mon Sep 17 00:00:00 2001 From: Maksym Veremeyenko ve...@m1stereo.tv Date: Sat, 11 Jun 2011 18:30:57 +0300 Subject: [PATCH 5/6] split status string format for 'status string' and 'status plane' --- src/page_status.c | 26 +- 1 files changed, 17 insertions(+), 9 deletions(-) diff --git a/src/page_status.c b/src/page_status.c index aec2168..1047ec6 100644 --- a/src/page_status.c +++ b/src/page_status.c @@ -68,22 +68,29 @@ static char* status_to_text( mvcp_status status ) return unknown; } +static void format_status_string(char* buf, int size, mvcp_status status , char* sep) +{ + char tc1[12], tc2[12], tc3[12]; + + snprintf( buf, size, + [%s]%sIN:%s%sPOS:%s%sOUT:%s%s%s%s, + status_to_text( status ), sep, + frames2tc(status-in, status-fps, tc1), sep, + frames2tc(status-position, status-fps, tc2), sep, + frames2tc(status-out, status-fps, tc3), sep, + status-clip, sep + ); + +} + static int show_status( page_status this, mvcp_status status ) { GtkWidget *widget = this_page_get_widget( ( page )this ); char temp[ 1024 ] = ; char temp2[ 1024 ]; char label_name[ 256 ]; - char tc1[12], tc2[12], tc3[12]; - - sprintf( temp, [%s] IN:%s POS:%s OUT:%s %s, - status_to_text( status ), - frames2tc(status-in, status-fps, tc1), - frames2tc(status-position, status-fps, tc2), - frames2tc(status-out, status-fps, tc3), - status-clip - ); + format_status_string(temp, sizeof(temp), status , \n); sprintf( label_name, label_unit_%d, status-unit ); gdk_threads_enter(); @@ -91,6 +98,7 @@ static int show_status( page_status this, mvcp_status status ) gtk_label_set_text( GTK_LABEL( widget ), temp ); if ( status-unit == dv1394app_get_selected_unit( this-app ) ) { + format_status_string(temp, sizeof(temp), status , ); sprintf( temp2, U%d - %s, status-unit, temp ); widget = lookup_widget( dv1394app_get_widget( this-app ), statusbar ); gtk_statusbar_pop( GTK_STATUSBAR( widget ), this-context ); -- 1.7.4.4 -- EditLive Enterprise is the world's most technically advanced content authoring tool. Experience the power of Track Changes, Inline Image Editing and ensure content is compliant with Accessibility Checking. http://p.sf.net/sfu/ephox-dev2dev___ Mlt-devel mailing list Mlt-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mlt-devel
Re: [Mlt-devel] [PATCH] rugen UI reworks: 0006-fix-eof-getting-per-unit.patch
11.06.11 18:59, Maksym Veremeyenko написав(ла): Hi, next e-mails will be attached with a patches makes (IMHO) more comfortable work with rugen. [...] *0006-fix-eof-getting-per-unit.patch* - fix eof status getting per unit -- Maksym Veremeyenko From 08ee495a47cc71719b65d95a18ed05015716685c Mon Sep 17 00:00:00 2001 From: Maksym Veremeyenko ve...@m1stereo.tv Date: Sat, 11 Jun 2011 18:55:51 +0300 Subject: [PATCH 6/6] fix eof getting per unit --- src/dv1394app.c | 10 ++ src/dv1394app.h |2 +- src/page_status.c |9 + 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/dv1394app.c b/src/dv1394app.c index c462b50..6d0487b 100644 --- a/src/dv1394app.c +++ b/src/dv1394app.c @@ -244,12 +244,12 @@ static gboolean on_transport_pressed( GtkWidget *button, gpointer data ) case 11: mvcp_unit_set( dv, unit, eof, loop); - this-eof = 0; + this-eof[this-selected_unit] = 0; break; case 12: mvcp_unit_set( dv, unit, eof, pause); - this-eof = 0; + this-eof[this-selected_unit] = 0; break; default: @@ -316,8 +316,10 @@ void dv1394app_show_status( dv1394app this, mvcp_status status ) gtk_signal_emit_by_name( GTK_OBJECT(trim_adj[TRIM_ADJ_POS]), value_changed ); } - gtk_widget_set_sensitive( lookup_widget( dv1394app_get_widget( this ), transport_11 ), this-eof == 'p' ); - gtk_widget_set_sensitive( lookup_widget( dv1394app_get_widget( this ), transport_12 ), this-eof == 'l' ); + gtk_widget_set_sensitive( lookup_widget( dv1394app_get_widget( this ), transport_11 ), + this-eof[this-selected_unit] == 'p' ); + gtk_widget_set_sensitive( lookup_widget( dv1394app_get_widget( this ), transport_12 ), + this-eof[this-selected_unit] == 'l' ); } static gboolean trim_pressed( GtkWidget *button, GdkEventButton *event, gpointer user_data ) diff --git a/src/dv1394app.h b/src/dv1394app.h index ae411c5..4243601 100644 --- a/src/dv1394app.h +++ b/src/dv1394app.h @@ -48,7 +48,7 @@ typedef struct int trim_in; int trim_out; int guard; - int eof; + int eof[16]; } *dv1394app, dv1394app_t; diff --git a/src/page_status.c b/src/page_status.c index 1047ec6..c0864fd 100644 --- a/src/page_status.c +++ b/src/page_status.c @@ -217,14 +217,15 @@ static void *status_thread( void *arg ) if ( status.status == unit_disconnected ) { -this-app-eof = 0; +this-app-eof[this-app-selected_unit] = 0; break; } + if ( !this-app-eof[this-app-selected_unit] +mvcp_unit_get( this-app-command, this-app-selected_unit, +eof, buf, sizeof(buf) ) != -1) + this-app-eof[this-app-selected_unit] = buf[0]; if ( show_status( this, status ) ) show_units( this, TRUE ); - if ( !this-app-eof mvcp_unit_get( this-app-command, this-app-selected_unit, -eof, buf, sizeof(buf) ) != -1) - this-app-eof = buf[0]; } } -- 1.7.4.4 -- EditLive Enterprise is the world's most technically advanced content authoring tool. Experience the power of Track Changes, Inline Image Editing and ensure content is compliant with Accessibility Checking. http://p.sf.net/sfu/ephox-dev2dev___ Mlt-devel mailing list Mlt-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mlt-devel
Re: [Mlt-devel] [PATCH] rugen UI reworks
11.06.11 21:06, Dan Dennedy написав(ла): On Sat, Jun 11, 2011 at 8:59 AM, Maksym Veremeyenkove...@m1stereo.tv wrote: Hi, next e-mails will be attached with a patches makes (IMHO) more comfortable work with rugen. I do not want to maintain rugen. Can you please make a public git repo of your branch? Then, I can pull from it, or link to it from mltframework.org. You would then send to the mailing list to announce after big chunks of work (or critical fixes). as you prefer. clone: git clone http://research.m1stereo.tv/git/rugen.git web interface: http://research.m1stereo.tv/gitweb/ BTW, what tool do you use for testing melted? However, I am more interested in mvcp and melted fixes (undecided about enhancements). So, you can provide patches for that or public git repos if you come to prefer it. Thanks! OK -- Maksym Veremeyenko -- EditLive Enterprise is the world's most technically advanced content authoring tool. Experience the power of Track Changes, Inline Image Editing and ensure content is compliant with Accessibility Checking. http://p.sf.net/sfu/ephox-dev2dev ___ Mlt-devel mailing list Mlt-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mlt-devel
Re: [Mlt-devel] Avformat producer not cleaning up [PATCH]
14.06.11 10:32, j-b-m написав(ла): [...[ This issue came back in a different way since the refactoring of producer_open, in this commit: http://mltframework.org/gitweb/mlt.git?p=mltframework.org/mlt.git;a=commit;h=a0c82f0eb433e5b756e8239ebb684abc81b796d9 When connecting the producer to an sdl_preview consumer, it works fine, deleting the producer and consumer closes the video4linux device. However, when connecting the producer to an avformat consumer, deleting producer and consumer leaves the device open, producer_avformat_close is never called. Something must remain in cache or is not deleted. The only way to close the video4linux device is to close MLT's factory. i am not sure if it related, but running melted for some hours with video in loop cause *SIGSEGV*: (5) AS-RUN U0 /B02905.dv len 375 pos 339 [dv @ 0x80d3700] Estimating duration from bitrate, this may be inaccurate [dv @ 0x8243100] Estimating duration from bitrate, this may be inaccurate [dv @ 0x8211660] Estimating duration from bitrate, this may be inaccurate (5) AS-RUN U0 /B02905.dv len 375 pos 339 [dv @ 0x8243100] Estimating duration from bitrate, this may be inaccurate [dv @ 0x820b5c0] Estimating duration from bitrate, this may be inaccurate [dv @ 0x8220200] Estimating duration from bitrate, this may be inaccurate [...] (5) AS-RUN U0 /B02905.dv len 375 pos 330 [dv @ 0x117911a0] Estimating duration from bitrate, this may be inaccurate [dv @ 0x1203cee0] Estimating duration from bitrate, this may be inaccurate [dv @ 0x114093c0] Estimating duration from bitrate, this may be inaccurate (5) AS-RUN U0 /B02905.dv len 375 pos 330 [dv @ 0x117911a0] Estimating duration from bitrate, this may be inaccurate [dv @ 0x1203cee0] Estimating duration from bitrate, this may be inaccurate [dv @ 0x142b4160] Estimating duration from bitrate, this may be inaccurate [...] (5) AS-RUN U0 /B02905.dv len 375 pos 327 [dv @ 0x15c1c320] Estimating duration from bitrate, this may be inaccurate [dv @ 0x156ef1c0] Estimating duration from bitrate, this may be inaccurate Program received signal SIGSEGV, Segmentation fault. [Switching to Thread 0xa2ab6b70 (LWP 9156)] 0x00f78e7e in av_find_opt () from /usr/local/enctools/lib/libavutil.so.51 Missing separate debuginfos, use: debuginfo-install SDL-1.2.14-10.fc14.i686 alsa-lib-1.0.24-1.fc14.i686 bzip2-libs-1.0.6-1.fc14.1.i686 cairo-1.10.2-1.fc14.i686 expat-2.0.1-10.fc13.i686 fontconfig-2.8.0-2.fc14.i686 freetype-2.4.2-4.fc14.i686 gdk-pixbuf2-2.22.0-1.fc14.i686 glib2-2.26.0-2.fc14.i686 glibc-2.13-1.i686 gsm-1.0.13-2.fc12.i686 gtk2-2.22.0-1.fc14.1.i686 libX11-1.3.4-4.fc14.i686 libXau-1.0.6-1.fc14.i686 libXcomposite-0.4.2-1.fc14.i686 libXcursor-1.1.10-5.fc14.i686 libXdamage-1.1.3-1.fc14.i686 libXext-1.1.2-2.fc14.i686 libXfixes-4.0.5-1.fc14.i686 libXi-1.3.2-1.fc14.i686 libXinerama-1.1-2.fc13.i686 libXrandr-1.3.0-5.fc13.i686 libXrender-0.9.6-1.fc14.i686 libgcc-4.5.1-4.fc14.i686 libgomp-4.5.1-4.fc14.i686 libpng-1.2.44-1.fc14.i686 libsamplerate-0.1.7-2.fc12.i686 libselinux-2.0.96-6.fc14.1.i686 libstdc++-4.5.1-4.fc14.i686 libtool-ltdl-2.2.10-3.fc14.i686 libxcb-1.7-1.fc14.i686 libxml2-2.7.7-3.fc14.i686 pango-1.28.1-5.fc14.i686 pixman-0.18.4-1.fc14.i686 sox-14.3.2-1.fc14.i686 zlib-1.2.5-2.fc14.i686 (gdb) bt #0 0x00f78e7e in av_find_opt () from /usr/local/enctools/lib/libavutil.so.51 #1 0x0001 in ?? () (gdb) One thing i noticed is AS-RUN reported *pos* in decremented way. if it not related i will makes a new record in bugracker. -- Maksym Veremeyenko -- EditLive Enterprise is the world's most technically advanced content authoring tool. Experience the power of Track Changes, Inline Image Editing and ensure content is compliant with Accessibility Checking. http://p.sf.net/sfu/ephox-dev2dev ___ Mlt-devel mailing list Mlt-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mlt-devel
[Mlt-devel] melted functionality extending
Hi, i would like to extend melted functionality and have a question about commands and format that could be used for that purpose: 1. Most desired feature is a request a media info of video, i.e. request duration and fps of a clip. INFO /BNC00077.dv 202 OK 0 /BNC00077.dv 0 748 25.00 could you suggest a name of command and possible (most preferred) approach to implement? 2. Another feature i would prefer to be implemented is auto-deleting played clip, i.e. after clip is played it been deleted in other clips present in a playlist sequence. That could be set by enabling some key value for unit like: USET U0 played_remove=1 and clip deleting could be implemented in a part of code after AS-RUN notification appear... -- Maksym Veremeyenko -- All of the data generated in your IT infrastructure is seriously valuable. Why? It contains a definitive record of application performance, security threats, fraudulent activity, and more. Splunk takes this data and makes sense of it. IT sense. And common sense. http://p.sf.net/sfu/splunk-d2d-c2 ___ Mlt-devel mailing list Mlt-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mlt-devel
Re: [Mlt-devel] melted functionality extending
01.07.11 18:47, Dan Dennedy написав(ла): On Fri, Jul 1, 2011 at 1:58 AM, Maksym Veremeyenkove...@m1stereo.tv wrote: [...] 2. Another feature i would prefer to be implemented is auto-deleting played clip, i.e. after clip is played it been deleted in other clips present in a playlist sequence. That could be set by enabling some key value for unit like: USET U0 played_remove=1 and clip deleting could be implemented in a part of code after AS-RUN notification appear... I assume you mean removing the clip from the playlist instead of deleting the file. Most people today periodically call WIPE such as when they APND clips every hour or so. yes. remove clip from playlist after playing that one. mlt_playlist has an autoclose property, and I wonder if it will already do this with uset u0 autoclose=1: http://mltframework.org/doxygen/structmlt__playlist__s.html *autoclose* /Set this true if you are doing sequential processing and want to automatically close producers as they are finished being used to free resources/. does it remove a item from playlist? -- Maksym Veremeyenko -- All of the data generated in your IT infrastructure is seriously valuable. Why? It contains a definitive record of application performance, security threats, fraudulent activity, and more. Splunk takes this data and makes sense of it. IT sense. And common sense. http://p.sf.net/sfu/splunk-d2d-c2 ___ Mlt-devel mailing list Mlt-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mlt-devel
Re: [Mlt-devel] PAL pixel aspect ratio: 16:15 vs 59:54
02.07.11 18:24, Maksym Veremeyenko написав(ла): Hi, i recently notices higher cpu activity for some files during playback and found they been rescaled from 720x576 to 720x562. problem comes from different PAR that files has, actually differently overridden. default consumer *dv_pal* has: [...] sample_aspect_num=16 sample_aspect_den=15 [...] producer *producer_avformat.c* has own PAR override code in *get_aspect_ratio* that setup: 64:45 for PAL 16:9 16:15 for PAL 4:3 32:27 for NTSC 16:9 8:9 for NTSC 4:3 in the same time *producer_libdv.c* defined PAR for video according to ITU Rec.601: 118.0/81.0 for PAL 16:9 40.0/33.0 for NTSC 16:9 59.0/54.0 for PAL 4:3 10.0/11.0 for NTSC 4:3 so, what is solution?: 1. honor ITU 601: change dv_pal profile to 59:54, drop avformat overriding code 2. use non-ITU PARs and fix *producer_libdv.c* to provide non-ITU pixel aspect ratios attached patch fix par setting in libdv producer -- Maksym Veremeyenko From ab108e9be70e8ea3eb65b6ac44df2a893e6f9935 Mon Sep 17 00:00:00 2001 From: Maksym Veremeyenko ve...@m1stereo.tv Date: Sat, 2 Jul 2011 18:24:06 +0300 Subject: [PATCH] fix pixel aspect ratio --- src/modules/dv/producer_libdv.c | 19 +-- 1 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/modules/dv/producer_libdv.c b/src/modules/dv/producer_libdv.c index 345602a..eee02f9 100644 --- a/src/modules/dv/producer_libdv.c +++ b/src/modules/dv/producer_libdv.c @@ -225,6 +225,8 @@ static int producer_collect_info( producer_libdv this, mlt_profile profile ) // If it looks like a valid frame, the get stats if ( valid ) { + double aspect_ratio; + // Get the properties mlt_properties properties = MLT_PRODUCER_PROPERTIES( this-parent ); @@ -262,8 +264,21 @@ static int producer_collect_info( producer_libdv this, mlt_profile profile ) // Parse the header for meta info dv_parse_header( dv_decoder, dv_data ); - mlt_properties_set_double( properties, aspect_ratio, -dv_format_wide( dv_decoder ) ? ( this-is_pal ? 118.0/81.0 : 40.0/33.0 ) : ( this-is_pal ? 59.0/54.0 : 10.0/11.0 ) ); + if ( this-is_pal ) + { +if ( dv_format_wide( dv_decoder ) ) + aspect_ratio = 64.0 / 45.0; +else + aspect_ratio = 16.0 / 15.0; + } + else + { +if ( dv_format_wide( dv_decoder ) ) + aspect_ratio = 32.0 / 27.0; +else + aspect_ratio = 8 / 9; + } + mlt_properties_set_double( properties, aspect_ratio, aspect_ratio); mlt_properties_set_double( properties, source_fps, this-is_pal ? 25 : ( 3.0 / 1001.0 ) ); mlt_properties_set_int( properties, meta.media.nb_streams, 2 ); mlt_properties_set_int( properties, video_index, 0 ); -- 1.7.4.4 -- All of the data generated in your IT infrastructure is seriously valuable. Why? It contains a definitive record of application performance, security threats, fraudulent activity, and more. Splunk takes this data and makes sense of it. IT sense. And common sense. http://p.sf.net/sfu/splunk-d2d-c2___ Mlt-devel mailing list Mlt-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mlt-devel
[Mlt-devel] PAL pixel aspect ratio: 16:15 vs 59:54
Hi, i recently notices higher cpu activity for some files during playback and found they been rescaled from 720x576 to 720x562. problem comes from different PAR that files has, actually differently overridden. default consumer *dv_pal* has: [...] sample_aspect_num=16 sample_aspect_den=15 [...] producer *producer_avformat.c* has own PAR override code in *get_aspect_ratio* that setup: 64:45 for PAL 16:9 16:15 for PAL 4:3 32:27 for NTSC 16:9 8:9 for NTSC 4:3 in the same time *producer_libdv.c* defined PAR for video according to ITU Rec.601: 118.0/81.0 for PAL 16:9 40.0/33.0 for NTSC 16:9 59.0/54.0 for PAL 4:3 10.0/11.0 for NTSC 4:3 so, what is solution?: 1. honor ITU 601: change dv_pal profile to 59:54, drop avformat overriding code 2. use non-ITU PARs and fix *producer_libdv.c* to provide non-ITU pixel aspect ratios -- Maksym Veremeyenko -- All of the data generated in your IT infrastructure is seriously valuable. Why? It contains a definitive record of application performance, security threats, fraudulent activity, and more. Splunk takes this data and makes sense of it. IT sense. And common sense. http://p.sf.net/sfu/splunk-d2d-c2 ___ Mlt-devel mailing list Mlt-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mlt-devel
[Mlt-devel] [PATCH 1/3] fix a audiostream leak in producer reopen
Hi, playing files in a loop mode in melted cause a leak of file descriptors that seen well from /proc/process id/fd/file no. the problem comes from avformat's producer re-open code that lost release of audiostream context. attached patch fix this behaviour... -- Maksym Veremeyenko From 55468ffa298871951ddde9a2ddeb39c7388607c9 Mon Sep 17 00:00:00 2001 From: Maksym Veremeyenko ve...@m1stereo.tv Date: Sun, 3 Jul 2011 16:32:16 +0300 Subject: [PATCH 1/3] fix a audiostream leak in producer reopen --- src/modules/avformat/producer_avformat.c | 60 + 1 files changed, 27 insertions(+), 33 deletions(-) diff --git a/src/modules/avformat/producer_avformat.c b/src/modules/avformat/producer_avformat.c index b96bf10..314bcd1 100644 --- a/src/modules/avformat/producer_avformat.c +++ b/src/modules/avformat/producer_avformat.c @@ -143,6 +143,8 @@ static void producer_set_up_audio( producer_avformat self, mlt_frame frame ); static void apply_properties( void *obj, mlt_properties properties, int flags ); static int video_codec_init( producer_avformat self, int index, mlt_properties properties ); static void get_audio_streams_info( producer_avformat self ); +static void producer_avformat_release( producer_avformat ); +static int audio_codec_init( producer_avformat self, int index, mlt_properties properties ); #ifdef VDPAU #include vdpau.c @@ -849,40 +851,18 @@ static void reopen_video( producer_avformat self, mlt_producer producer ) { mlt_properties properties = MLT_PRODUCER_PROPERTIES( producer ); mlt_service_lock( MLT_PRODUCER_SERVICE( producer ) ); - pthread_mutex_lock( self-audio_mutex ); - if ( self-video_codec ) - { - avformat_lock(); - avcodec_close( self-video_codec ); - avformat_unlock(); - } - self-video_codec = NULL; - if ( self-dummy_context ) - av_close_input_file( self-dummy_context ); - self-dummy_context = NULL; - if ( self-video_format ) - av_close_input_file( self-video_format ); - self-video_format = NULL; - - int audio_index = self-audio_index; - int video_index = self-video_index; + producer_avformat_release( self ); - pthread_mutex_unlock( self-audio_mutex ); - pthread_mutex_unlock( self-video_mutex ); producer_open( self, mlt_service_profile( MLT_PRODUCER_SERVICE(producer) ), mlt_properties_get( properties, resource ) ); - pthread_mutex_lock( self-video_mutex ); - pthread_mutex_lock( self-audio_mutex ); - self-audio_index = audio_index; - if ( self-video_format video_index -1 ) - { - self-video_index = video_index; - video_codec_init( self, video_index, properties ); - } + if ( self-video_format self-video_index -1 ) + video_codec_init( self, self-video_index, properties ); + + if ( self-audio_format self-audio_index -1 ) + audio_codec_init( self, self-audio_index, properties ); - pthread_mutex_unlock( self-audio_mutex ); mlt_service_unlock( MLT_PRODUCER_SERVICE( producer ) ); } @@ -2531,38 +2511,45 @@ static int producer_get_frame( mlt_producer producer, mlt_frame_ptr frame, int i return 0; } -static void producer_avformat_close( producer_avformat self ) +static void producer_avformat_release( producer_avformat self ) { - mlt_log_debug( NULL, producer_avformat_close\n ); - // Cleanup av contexts - av_free( self-av_frame ); + if( self-av_frame ) + av_freep( self-av_frame ); avformat_lock(); int i; for ( i = 0; i MAX_AUDIO_STREAMS; i++ ) { if ( self-audio_resample[i] ) audio_resample_close( self-audio_resample[i] ); + self-audio_resample[i] = NULL; mlt_pool_release( self-audio_buffer[i] ); - av_free( self-decode_buffer[i] ); + self-audio_buffer[i] = NULL; + av_freep( self-decode_buffer[i] ); if ( self-audio_codec[i] ) avcodec_close( self-audio_codec[i] ); + self-audio_codec[i] = NULL; } if ( self-video_codec ) avcodec_close( self-video_codec ); + self-video_codec = NULL; // Close the file if ( self-dummy_context ) av_close_input_file( self-dummy_context ); + self-dummy_context = NULL; if ( self-seekable self-audio_format ) av_close_input_file( self-audio_format ); + self-audio_format = NULL; if ( self-video_format ) av_close_input_file( self-video_format ); + self-video_format = NULL; avformat_unlock(); #ifdef VDPAU vdpau_producer_close( self ); #endif if ( self-image_cache ) mlt_cache_close( self-image_cache ); + self-image_cache = NULL; // Cleanup the mutexes pthread_mutex_destroy( self-audio_mutex ); @@ -2581,6 +2568,13 @@ static void producer_avformat_close( producer_avformat self ) av_free_packet( pkt ); free( pkt ); } +} + +static void producer_avformat_close( producer_avformat self ) +{ + mlt_log_debug( NULL, producer_avformat_close\n ); + + producer_avformat_release( self ); free( self ); } -- 1.7.4.4 -- All of the data generated in your IT infrastructure is seriously valuable. Why? It contains
[Mlt-devel] [PATCH 2/3] possible fix to use new_seek code
Hi, after fixing re-open in avformat producer i realize that new_seek code was never used. latest commit http://mltframework.org/gitweb/mlt.git?p=mltframework.org/mlt.git;a=commitdiff;h=cc781be46c32b555f7675193e34ca74417aa923c enable new_seek only for H264 in TS. May be that wrong? and new_seek code should be enabled by default for all formats except h264/ts? -- Maksym Veremeyenko From 9cdb1e8242c7a0ec521d1253ac654b7e04a92c55 Mon Sep 17 00:00:00 2001 From: Maksym Veremeyenko ve...@m1stereo.tv Date: Sun, 3 Jul 2011 16:39:09 +0300 Subject: [PATCH 2/3] possible fix to use new_seek code --- src/modules/avformat/producer_avformat.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/src/modules/avformat/producer_avformat.c b/src/modules/avformat/producer_avformat.c index 314bcd1..1144877 100644 --- a/src/modules/avformat/producer_avformat.c +++ b/src/modules/avformat/producer_avformat.c @@ -1296,7 +1296,7 @@ static int producer_get_image( mlt_frame frame, uint8_t **buffer, mlt_image_form // Turn on usage of new seek API and PTS for seeking int use_new_seek = self-seekable - codec_context-codec_id == CODEC_ID_H264 !strcmp( context-iformat-name, mpegts ); + !(codec_context-codec_id == CODEC_ID_H264 !strcmp( context-iformat-name, mpegts )); if ( mlt_properties_get( properties, new_seek ) ) use_new_seek = mlt_properties_get_int( properties, new_seek ); -- 1.7.4.4 -- All of the data generated in your IT infrastructure is seriously valuable. Why? It contains a definitive record of application performance, security threats, fraudulent activity, and more. Splunk takes this data and makes sense of it. IT sense. And common sense. http://p.sf.net/sfu/splunk-d2d-c2___ Mlt-devel mailing list Mlt-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mlt-devel
[Mlt-devel] [PATCH 3/3] fix newline on position logging
Hi, after enabling of new_seek code log message about positioning written without newline. Please find attached patch what fix that. -- Maksym Veremeyenko From 2853c96c7ba271cb34fc48968402547d2c0bb76f Mon Sep 17 00:00:00 2001 From: Maksym Veremeyenko ve...@m1stereo.tv Date: Sun, 3 Jul 2011 16:40:19 +0300 Subject: [PATCH 3/3] fix newline on position logging --- src/modules/avformat/producer_avformat.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/src/modules/avformat/producer_avformat.c b/src/modules/avformat/producer_avformat.c index 1144877..51e19ae 100644 --- a/src/modules/avformat/producer_avformat.c +++ b/src/modules/avformat/producer_avformat.c @@ -930,7 +930,7 @@ static int seek_video( producer_avformat self, mlt_position position, { timestamp = ( req_position - 0.1 / source_fps ) / ( av_q2d( stream-time_base ) * source_fps ); -mlt_log_verbose( MLT_PRODUCER_SERVICE(producer), pos %PRId64 pts %PRId64 , req_position, timestamp ); +mlt_log_verbose( MLT_PRODUCER_SERVICE(producer), pos %PRId64 pts %PRId64 \n, req_position, timestamp ); if ( self-first_pts 0 ) timestamp += self-first_pts; else if ( context-start_time != AV_NOPTS_VALUE ) -- 1.7.4.4 -- All of the data generated in your IT infrastructure is seriously valuable. Why? It contains a definitive record of application performance, security threats, fraudulent activity, and more. Splunk takes this data and makes sense of it. IT sense. And common sense. http://p.sf.net/sfu/splunk-d2d-c2___ Mlt-devel mailing list Mlt-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mlt-devel
Re: [Mlt-devel] [PATCH 2/3] possible fix to use new_seek code
On Sun, July 3, 2011 9:34 pm, Dan Dennedy wrote: 2011/7/3 Maksym Veremeyenko ve...@m1stereo.tv: Hi, after fixing re-open in avformat producer i realize that new_seek code was never used. latest commit http://mltframework.org/gitweb/mlt.git?p=mltframework.org/mlt.git;a=commitdiff;h=cc781be46c32b555f7675193e34ca74417aa923c enable new_seek only for H264 in TS. May be that wrong? and new_seek code should be enabled by default for all formats except h264/ts? This patch is wrong and rejected. My logic is correct: new_seek is only enabled by default for h264/ts as it was specifically added for AVCHD but caused regressions in other formats. ahh... i did not belived that it only AVCHD targeted... sorry for noise... -- Maksym Veremeyenko -- All of the data generated in your IT infrastructure is seriously valuable. Why? It contains a definitive record of application performance, security threats, fraudulent activity, and more. Splunk takes this data and makes sense of it. IT sense. And common sense. http://p.sf.net/sfu/splunk-d2d-c2 ___ Mlt-devel mailing list Mlt-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mlt-devel
Re: [Mlt-devel] [PATCH 1/3] fix a audiostream leak in producer reopen
03.07.11 23:06, Dan Dennedy написав(ла): On Sun, Jul 3, 2011 at 12:48 PM, Maksym Veremeyenkove...@m1stereo.tv wrote: On Sun, July 3, 2011 10:01 pm, Dan Dennedy wrote: 2011/7/3 Maksym Veremeyenkove...@m1stereo.tv: Hi, playing files in a loop mode in melted cause a leak of file descriptors that seen well from /proc/process id/fd/file no. the problem comes from avformat's producer re-open code that lost release of audiostream context. attached patch fix this behaviour... This patch is wrong in a couple of ways. It completely alters the locking mechanisms, and I will be surprised if it works under multi-threaded access such as with kdenlive or with parallel consumer. Your attempt to refactor to common code is noble but naive with respect to the locking requirements, which are different depending upon the state of the locks when these similar actions are invoked. Secondly, it breaks the user-selected audio and video tracks because in producer_open() they are reset to their defaults. That is why they were saved before producer_open() and re-applied afterwards. updated patch attached Please test my latest commits. In my analysis and testing while working on these fixes, I found it is not at all safe to close the audio format and codec contexts at this point - think parallel. there are no leaks noticed with latest git, thanks. No offense to you, but I am not too comfortable with other people's hands getting into avformat producer. That is a very intricate piece of work, and there are a lot of special requirements that only I know about. Thank you for trying, though! It will be nice for someone else to become knowledgeable about this code. If you look at the git log, you will see that I have put major effort to refactoring its code periodically in order to tame this wild beast. If you want to contribute something here, I would accept a patch that refactors my recent change that added a take_lock parameter to producer_open() into a new function producer_open_with_lock() that inside calls producer_open() - similar approach to your patch. ok -- Maksym Veremeyenko -- All of the data generated in your IT infrastructure is seriously valuable. Why? It contains a definitive record of application performance, security threats, fraudulent activity, and more. Splunk takes this data and makes sense of it. IT sense. And common sense. http://p.sf.net/sfu/splunk-d2d-c2 ___ Mlt-devel mailing list Mlt-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mlt-devel
Re: [Mlt-devel] [PATCH 1/3] fix a audiostream leak in producer reopen
03.07.11 23:06, Dan Dennedy написав(ла): On Sun, Jul 3, 2011 at 12:48 PM, Maksym Veremeyenkove...@m1stereo.tv wrote: On Sun, July 3, 2011 10:01 pm, Dan Dennedy wrote: 2011/7/3 Maksym Veremeyenkove...@m1stereo.tv: Hi, playing files in a loop mode in melted cause a leak of file descriptors that seen well from /proc/process id/fd/file no. the problem comes from avformat's producer re-open code that lost release of audiostream context. [...] Please test my latest commits. In my analysis and testing while working on these fixes, I found it is not at all safe to close the audio format and codec contexts at this point - think parallel. i am not sure it it regression or related, but something influent a decklink output, to be precise, out output. After hour or two i start receive messages about decklink audio buffer underflow - it wrote less samples then 1920 -- Maksym Veremeyenko -- All of the data generated in your IT infrastructure is seriously valuable. Why? It contains a definitive record of application performance, security threats, fraudulent activity, and more. Splunk takes this data and makes sense of it. IT sense. And common sense. http://p.sf.net/sfu/splunk-d2d-c2 ___ Mlt-devel mailing list Mlt-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mlt-devel
Re: [Mlt-devel] [PATCH 1/3] fix a audiostream leak in producer reopen
04.07.11 18:37, Maksym Veremeyenko написав(ла): 03.07.11 23:06, Dan Dennedy написав(ла): On Sun, Jul 3, 2011 at 12:48 PM, Maksym Veremeyenkove...@m1stereo.tv wrote: On Sun, July 3, 2011 10:01 pm, Dan Dennedy wrote: 2011/7/3 Maksym Veremeyenkove...@m1stereo.tv: Hi, playing files in a loop mode in melted cause a leak of file descriptors that seen well from /proc/process id/fd/file no. the problem comes from avformat's producer re-open code that lost release of audiostream context. [...] Please test my latest commits. In my analysis and testing while working on these fixes, I found it is not at all safe to close the audio format and codec contexts at this point - think parallel. i am not sure it it regression or related, but something influent a decklink output, to be precise, out output. After hour or two i start receive messages about decklink audio buffer underflow - it wrote less samples then 1920 seems to me that latest update to avformat producer uncover an audio preroll problem to decklink consumer. applying simple patch: diff --git a/src/modules/decklink/consumer_decklink.cpp b/src/modules/decklink/consumer_decklink.cpp index 0fb2361..0179de3 100644 --- a/src/modules/decklink/consumer_decklink.cpp +++ b/src/modules/decklink/consumer_decklink.cpp @@ -54,6 +54,7 @@ private: int m_isKeyer; IDeckLinkKeyer* m_deckLinkKeyer; boolm_terminate_on_pause; + uint32_tm_acnt; IDeckLinkDisplayMode* getDisplayMode() { @@ -428,6 +429,16 @@ public: virtual HRESULT STDMETHODCALLTYPE ScheduledFrameCompleted( IDeckLinkVideoFrame* completedFrame, BMDOutputFrameCompleti { + uint32_t cnt; + m_deckLinkOutput-GetBufferedAudioSampleFrameCount(cnt); + if(cnt != m_acnt) + { + mlt_log_verbose( getConsumer(), + ScheduledFrameCompleted: GetBufferedAudioSampleFrameCount %d - %d, m_count=%lld\n, + m_acnt, cnt, m_count ); + m_acnt = cnt; + }; + // When a video frame has been released by the API, schedule another video frame to be output // ignore handler if frame was flushed makes very interesting output: [...] [consumer decklink] ScheduledFrameCompleted: GetBufferedAudioSampleFrameCount 1919 - 2877, m_count=20164 (5) AS-RUN U0 /tst_E0001531_43.dv len 773 pos 725 [consumer decklink] ScheduledFrameCompleted: GetBufferedAudioSampleFrameCount 2877 - 3836, m_count=20937 (5) AS-RUN U0 /BNC00975.mov len 748 pos 702 [dv @ 0x80da0a0] Estimating duration from bitrate, this may be inaccurate [dv @ 0x82ff1c0] Estimating duration from bitrate, this may be inaccurate [consumer decklink] ScheduledFrameCompleted: GetBufferedAudioSampleFrameCount 3836 - 4794, m_count=21685 (5) AS-RUN U0 /tst_E0001531_43.dv len 773 pos 728 [consumer decklink] ScheduledFrameCompleted: GetBufferedAudioSampleFrameCount 4794 - 5754, m_count=22458 (5) AS-RUN U0 /BNC00975.mov len 748 pos 705 [dv @ 0x82ff1c0] Estimating duration from bitrate, this may be inaccurate [dv @ 0x8326820] Estimating duration from bitrate, this may be inaccurate (5) AS-RUN U0 /tst_E0001531_43.dv len 773 pos 732 [...] (5) AS-RUN U0 /BNC00975.mov len 748 pos 696 [dv @ 0x80da0a0] Estimating duration from bitrate, this may be inaccurate [dv @ 0x80d8580] Estimating duration from bitrate, this may be inaccurate [consumer decklink] ScheduledFrameCompleted: GetBufferedAudioSampleFrameCount 5754 - 6715, m_count=29290 [consumer decklink] ScheduledFrameCompleted: GetBufferedAudioSampleFrameCount 6715 - 5754, m_count=29291 (5) AS-RUN U0 /tst_E0001531_43.dv len 773 pos 722 for some reason decklink do not flush or drop some audio packet and as result it overrun after one second samples. i can't definitely find a reason, but i will look deeper... -- Maksym Veremeyenko -- All of the data generated in your IT infrastructure is seriously valuable. Why? It contains a definitive record of application performance, security threats, fraudulent activity, and more. Splunk takes this data and makes sense of it. IT sense. And common sense. http://p.sf.net/sfu/splunk-d2d-c2 ___ Mlt-devel mailing list Mlt-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mlt-devel
Re: [Mlt-devel] Impending release
15.07.11 08:37, Dan Dennedy написав(ла): I am going out of town Sunday through Wednesday. I was thinking about making a new release before I leave. Anybody thinks I should wait? decklink drop issue i noticed before... i will try to prepare workaround or find a real problem... -- Maksym Veremeyenko -- AppSumo Presents a FREE Video for the SourceForge Community by Eric Ries, the creator of the Lean Startup Methodology on Lean Startup Secrets Revealed. This video shows you how to validate your ideas, optimize your ideas and identify your business strategy. http://p.sf.net/sfu/appsumosfdev2dev ___ Mlt-devel mailing list Mlt-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mlt-devel
Re: [Mlt-devel] [PATCH] priority mangling of melted+decklink
21.07.11 23:34, Dan Dennedy написав(ла): 2011/7/19 Maksym Veremeyenkove...@m1stereo.tv: Hi, in my previous message about audio buffer overflow i did not noticed about possible reason. IMHO one of reasons is too high priority of melted. That cause decklink callback delayed if avformat producer has higher activity. The priority boosting is kind of a legacy thing when we were using BlueFish444 for SDI output and letting threads inherit scheduling priority and class - basically trying to make the process and all of its threads the same higher priority. that could be good for Bluefish driver. that depends on driver structure. Hence rising up priority to highest level makes impossible to prioritize required thread - all inherited threads has highest priority. To avoid it i prepared patch (*0001-change-priority-on-demand.patch*) that enable maximum priority if it required by argument from command line, also that makes possible to setup priority higher then default. After changing priority to default value no overrun happens. good, but I wonder if we should completely drop the priority-setting in melted. i would leave it configurable as i proposed in a patch - at least it makes possible to make a melted process i bit higher priority over xorg for example... moreover i would like to makes more experiments with ionice code to makes a io priority higher over other smbd for example... So next step was to increase a decklink callback thread priority over other threads in MLT - *0005-rise-DriverNotificationThreadFunction-priority.patch* - that could give additional benefits on decklink hardware control timings. Do you think this should this be controlled by a property? For example, if (mlt_property_get_int(properties, priority) -20) this patch trying to increase a priority of internal Decklink callback thread: #0 DeckLinkConsumer::ScheduledFrameCompleted (this=0x80a61d0, completedFrame=0xb642a398, completed=0) at consumer_decklink.cpp:436 #1 0x02473753 in CDeckLinkOutput::outputFrameCompletionCallback(unsigned int, char) () from /usr/lib/libDeckLinkAPI.so #2 0x024533b3 in CDeckLink::DriverNotificationThreadFunction(void*) () from /usr/lib/libDeckLinkAPI.so #3 0x00163e99 in start_thread () from /lib/libpthread.so.0 #4 0x00250d2e in clone () from /lib/libc.so.6 priority of this thread could be inherited from priority of initialization code, so another possible solution is: 1. save current thread priority 2. set new priority from mlt_property_get_int(properties, priority) 3. init decklink 4. restore origin prio what do you thing about this? -- Maksym Veremeyenko -- 10 Tips for Better Web Security Learn 10 ways to better secure your business today. Topics covered include: Web security, SSL, hacker attacks Denial of Service (DoS), private keys, security Microsoft Exchange, secure Instant Messaging, and much more. http://www.accelacomm.com/jaw/sfnl/114/51426210/ ___ Mlt-devel mailing list Mlt-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mlt-devel
Re: [Mlt-devel] [PATCH] priority mangling of melted+decklink
23.07.11 00:45, Dan Dennedy написав(ла): 2011/7/22 Maksym Veremeyenkove...@m1stereo.tv: [...] priority of this thread could be inherited from priority of initialization code, so another possible solution is: 1. save current thread priority 2. set new priority from mlt_property_get_int(properties, priority) 3. init decklink 4. restore origin prio what do you thing about this? I am a little worried if we know exactly when the thread inside decklink starts and therefore when to do step 4. that was really hard, so i leaved with minor changes - priority is set from *priority* properties. That make possible to adjust priority from melted shell: USET U0 consumer.priority=max also reworked patch against melted to makes it process priority configurable... -- Maksym Veremeyenko From 12acf8721e2c61c8adb050b304a807a9033e42f0 Mon Sep 17 00:00:00 2001 From: Maksym Veremeyenko ve...@m1stereo.tv Date: Mon, 25 Jul 2011 14:58:33 +0300 Subject: [PATCH] change DriverNotificationThreadFunction priority by setting consumer.priority properties --- src/modules/decklink/consumer_decklink.cpp | 39 1 files changed, 39 insertions(+), 0 deletions(-) diff --git a/src/modules/decklink/consumer_decklink.cpp b/src/modules/decklink/consumer_decklink.cpp index 88c1cb9..e6323a1 100644 --- a/src/modules/decklink/consumer_decklink.cpp +++ b/src/modules/decklink/consumer_decklink.cpp @@ -57,6 +57,7 @@ private: boolm_terminate_on_pause; uint32_tm_preroll; uint32_tm_acnt; + boolm_reprio; IDeckLinkDisplayMode* getDisplayMode() { @@ -237,6 +238,7 @@ public: } m_preroll = preroll; + m_reprio = false; // preroll frames for( i = 0; i preroll; i++ ) @@ -439,6 +441,43 @@ public: virtual HRESULT STDMETHODCALLTYPE ScheduledFrameCompleted( IDeckLinkVideoFrame* completedFrame, BMDOutputFrameCompletionResult completed ) { + if( !m_reprio ) + { + mlt_properties properties = MLT_CONSUMER_PROPERTIES( getConsumer() ); + + if ( mlt_properties_get( properties, priority ) ) + { +int r; +pthread_t thread; +pthread_attr_t tattr; +struct sched_param param; + +pthread_attr_init(tattr); +pthread_attr_setschedpolicy(tattr, SCHED_FIFO); + +if ( !strcmp( max, mlt_properties_get( properties, priority ) ) ) + param.sched_priority = sched_get_priority_max(SCHED_FIFO) - 1; +else if ( !strcmp( min, mlt_properties_get( properties, priority ) ) ) + param.sched_priority = sched_get_priority_min(SCHED_FIFO) + 1; +else + param.sched_priority = mlt_properties_get_int( properties, priority ); + +pthread_attr_setschedparam(tattr, param); + +thread = pthread_self(); + +r = pthread_setschedparam(thread, SCHED_FIFO, param); +if( r ) + mlt_log_verbose( getConsumer(), + ScheduledFrameCompleted: pthread_setschedparam retured %d\n, r); +else + mlt_log_verbose( getConsumer(), + ScheduledFrameCompleted: param.sched_priority=%d\n, param.sched_priority); + }; + + m_reprio = true; + }; + uint32_t cnt; m_deckLinkOutput-GetBufferedAudioSampleFrameCount( cnt ); if ( cnt != m_acnt ) -- 1.7.4.4 From 1d60ad636101422dace6fdc698e979ed002209f7 Mon Sep 17 00:00:00 2001 From: Maksym Veremeyenko ve...@m1stereo.tv Date: Mon, 25 Jul 2011 15:08:47 +0300 Subject: [PATCH] use -prio to set melted process priority --- src/melted/melted.c | 26 -- 1 files changed, 20 insertions(+), 6 deletions(-) diff --git a/src/melted/melted.c b/src/melted/melted.c index be019ec..f52e836 100644 --- a/src/melted/melted.c +++ b/src/melted/melted.c @@ -58,7 +58,7 @@ static void main_cleanup( ) void usage( char *app ) { - fprintf( stderr, Usage: %s [-test] [-port ] [-c config-file]\n, app ); + fprintf( stderr, Usage: %s [-prio |max] [-test] [-port ] [-c config-file]\n, app ); exit( 0 ); } @@ -71,7 +71,6 @@ int main( int argc, char **argv ) int index = 0; int background = 1; struct timespec tm = { 1, 0 }; - struct sched_param scp; mvcp_status_t status; struct { int clip_index; @@ -79,11 +78,24 @@ int main( int argc, char **argv ) } asrun[ MAX_UNITS ]; const char *config_file = /etc/melted.conf; - // Use realtime scheduling if possible - memset( scp, '\0', sizeof( scp ) ); - scp.sched_priority = sched_get_priority_max( SCHED_FIFO ) - 1; #ifndef __DARWIN__ - sched_setscheduler( 0, SCHED_FIFO, scp ); + for ( index = 1; index argc; index ++ ) + { + if ( !strcmp( argv[ index ], -prio ) ) + { + struct sched_param scp; + char* prio = argv[ ++ index ]; + + memset( scp, 0, sizeof( scp ) ); + + if( !strcmp( prio, max ) ) +scp.sched_priority = sched_get_priority_max( SCHED_FIFO ) - 1; + else +scp.sched_priority = atoi(prio); + + sched_setscheduler( 0, SCHED_FIFO, scp ); + } + } #endif mlt_factory_init( NULL ); @@ -100,6 +112,8
[Mlt-devel] performance question
Hi, i did a tests to define how many layers can be played and found that dropped frames start appear on 5th PNG layer over DV track mlt file attached. so the question is how many layers could be played on top or generic hardware? -- Maksym Veremeyenko ?xml version=1.0 ? mlt profile description=DV/DVD PAL display_aspect_den=3 display_aspect_num=4 frame_rate_den=1 frame_rate_num=25 height=576 progressive=0 sample_aspect_den=15 sample_aspect_num=16 width=720/ tractor id=tractor0 multitrack playlist id=Background Track producer id=1fd2a31a-3d3a-11e1-bac8-080027013906 in=0.0 novdpau=1 out=503.0 property name=mlt_servicecolor/property /producer /playlist playlist id=Track 1 producer id=a5142e62-3d36-11e1-bac8-080027013906 in=0.0 novdpau=1 out=499.0 property name=resourcetest_video.dv/property /producer /playlist playlist id=Track 2 producer id=c5bf5b1e-3d36-11e1-bac8-080027013906 in=0.0 novdpau=1 out=496.0 property name=resourcetest_image_01.png/property /producer /playlist playlist id=Track 3 producer id=eb3d6570-3d36-11e1-bac8-080027013906 in=0.0 novdpau=1 out=494.0 property name=resourcetest_image_02.png/property /producer /playlist playlist id=Track 4 producer id=ecfd6842-3d36-11e1-bac8-080027013906 in=0.0 novdpau=1 out=492.0 property name=resourcetest_image_03.png/property /producer /playlist playlist id=Track 5 producer id=f1d828a2-3d36-11e1-bac8-080027013906 in=0.0 novdpau=1 out=494.0 property name=resourcetest_image_04.png/property /producer /playlist playlist id=Track 6 /playlist playlist id=Track 7 /playlist playlist id=Track 8 /playlist playlist id=Track 9 /playlist playlist id=Track 10 /playlist playlist id=Track 11 /playlist /multitrack filter gain=1 in=0.0 mlt_service=volume out=499.0 track=1/ transition in=0.0 out=499.0 property name=mlt_servicecomposite/property property name=a_track0/property property name=b_track1/property property name=progressive1/property property name=geometry0=0%,0%:100%x100%:100; -1=0%,0%:100%x100%:100; /property property name=haligncentre/property property name=valigncentre/property property name=distort0/property property name=fill1/property /transition transition in=0.0 out=499.0 property name=mlt_servicemix/property property name=a_track0/property property name=b_track1/property property name=combine1/property property name=always_active1/property /transition transition in=0.0 out=496.0 property name=mlt_servicecomposite/property property name=a_track0/property property name=b_track2/property property name=progressive1/property property name=geometry0=0%,0%:100%x100%:100; -1=0%,0%:100%x100%:100; /property property name=haligncentre/property property name=valigncentre/property property name=distort0/property property name=fill1/property /transition transition in=0.0 out=494.0 property name=mlt_servicecomposite/property property name=a_track0/property property name=b_track3/property property name=progressive1/property property name=geometry0=0%,0%:100%x100%:100; -1=0%,0%:100%x100%:100; /property property name=haligncentre/property property name=valigncentre/property property name=distort0/property property name=fill1/property /transition transition in=0.0 out=492.0 property name=mlt_servicecomposite/property property name=a_track0/property property name=b_track4/property property name=progressive1/property property name=geometry0=0%,0%:100%x100%:100; -1=0%,0%:100%x100%:100; /property property name=haligncentre/property property name=valigncentre/property property name=distort0/property property name=fill1/property /transition transition in=0.0 out=494.0 property name=mlt_servicecomposite/property property name=a_track0/property property name=b_track5/property property name=progressive1/property property name=geometry0=0%,0%:100%x100%:100; -1=0%,0%:100%x100%:100; /property property name=haligncentre/property property name=valigncentre/property property name=distort0/property property name=fill1/property /transition transition in=0.0 out=492.0 property name=mlt_servicecomposite/property property name=a_track0/property property name=b_track6/property property name=progressive1/property property name=geometry0=0%,0%:100%x100%:100; -1=0%,0%:100%x100%:100; /property property name=haligncentre/property property name=valigncentre/property property name=distort0/property property name=fill1/property /transition transition in=0.0 out=500.0 property name=mlt_servicecomposite/property property name=a_track0/property property name=b_track7/property property name=progressive1/property property name=geometry0=0%,0%:100%x100%:100; -1=0%,0%:100%x100%:100
[Mlt-devel] content scaling
Hi, i am trying to play a mlt files with video on /logo/ overlay: ?xml version=1.0 ? mlt tractor id=tractor0 multitrack playlist id=AV producer id=AV0 in=0.0 out=1499.0 property name=resource/home/studio/Videos/file_titling_test/I0009618_test.avi/property /producer /playlist playlist id=G0 producer id=p1 in=0.0 out=1499.0 property name=resource/home/studio/Videos/file_titling_test/test_image_13.png/property /producer /playlist /multitrack transition in=0.0 out=150.0 property name=mlt_servicecomposite/property property name=a_track0/property property name=b_track1/property property name=progressive1/property property name=geometry0=0%,0%:100%x100%:100; -1=0%,0%:100%x100%:100; /property property name=haligncentre/property property name=valigncentre/property property name=distort0/property property name=fill1/property /transition /tractor /mlt but graphics from test_image_13.png been always scaled to dimensions defined in profile. are there any chance to avoid such scaling and provide pixel-to-pixel compositing. for images it would be ease to calculate geometry scaling, but for pango i have no idea how to do this. -- Maksym Veremeyenko ?xml version=1.0 ? mlt profile description=DV/DVD PAL display_aspect_den=3 display_aspect_num=4 frame_rate_den=1 frame_rate_num=25 height=576 progressive=0 sample_aspect_den=15 sample_aspect_num=16 width=720/ tractor id=tractor0 multitrack playlist id=Background Track producer id=1fd2a31a-3d3a-11e1-bac8-080027013906 in=0.0 novdpau=1 out=503.0 property name=mlt_servicecolor/property /producer /playlist playlist id=Track 1 producer id=a5142e62-3d36-11e1-bac8-080027013906 in=0.0 novdpau=1 out=499.0 property name=resourcetest_video.dv/property /producer /playlist playlist id=Track 2 producer id=c5bf5b1e-3d36-11e1-bac8-080027013906 in=0.0 novdpau=1 out=496.0 property name=resourcetest_image_01.png/property /producer /playlist playlist id=Track 3 producer id=eb3d6570-3d36-11e1-bac8-080027013906 in=0.0 novdpau=1 out=494.0 property name=resourcetest_image_02.png/property /producer /playlist playlist id=Track 4 producer id=ecfd6842-3d36-11e1-bac8-080027013906 in=0.0 novdpau=1 out=492.0 property name=resourcetest_image_03.png/property /producer /playlist playlist id=Track 5 producer id=f1d828a2-3d36-11e1-bac8-080027013906 in=0.0 novdpau=1 out=494.0 property name=resourcetest_image_04.png/property /producer /playlist playlist id=Track 6 /playlist playlist id=Track 7 /playlist playlist id=Track 8 /playlist playlist id=Track 9 /playlist playlist id=Track 10 /playlist playlist id=Track 11 /playlist /multitrack filter gain=1 in=0.0 mlt_service=volume out=499.0 track=1/ transition in=0.0 out=499.0 property name=mlt_servicecomposite/property property name=a_track0/property property name=b_track1/property property name=progressive1/property property name=geometry0=0%,0%:100%x100%:100; -1=0%,0%:100%x100%:100; /property property name=haligncentre/property property name=valigncentre/property property name=distort0/property property name=fill1/property /transition transition in=0.0 out=499.0 property name=mlt_servicemix/property property name=a_track0/property property name=b_track1/property property name=combine1/property property name=always_active1/property /transition transition in=0.0 out=496.0 property name=mlt_servicecomposite/property property name=a_track0/property property name=b_track2/property property name=progressive1/property property name=geometry0=0%,0%:100%x100%:100; -1=0%,0%:100%x100%:100; /property property name=haligncentre/property property name=valigncentre/property property name=distort0/property property name=fill1/property /transition transition in=0.0 out=494.0 property name=mlt_servicecomposite/property property name=a_track0/property property name=b_track3/property property name=progressive1/property property name=geometry0=0%,0%:100%x100%:100; -1=0%,0%:100%x100%:100; /property property name=haligncentre/property property name=valigncentre/property property name=distort0/property property name=fill1/property /transition transition in=0.0 out=492.0 property name=mlt_servicecomposite/property property name=a_track0/property property name=b_track4/property property name=progressive1/property property name=geometry0=0%,0%:100%x100%:100; -1=0%,0%:100%x100%:100; /property property name=haligncentre/property property name
Re: [Mlt-devel] content scaling
14.01.12 00:25, Dan Dennedy написав(ла): 2012/1/13 Maksym Veremeyenkove...@m1stereo.tv: Hi, i am trying to play a mlt files with video on /logo/ overlay: ?xml version=1.0 ? mlt tractor id=tractor0 multitrack playlist id=AV producer id=AV0 in=0.0 out=1499.0 property name=resource/home/studio/Videos/file_titling_test/I0009618_test.avi/property /producer /playlist playlist id=G0 producer id=p1 in=0.0 out=1499.0 property name=resource/home/studio/Videos/file_titling_test/test_image_13.png/property The image producers assume the image has square pixels because that is most typical. However, if your images are 720x576 or you simply want to prevent scaling for sample aspect ratio compensation, then you need to override the force_aspect_ratio property, e.g. force_aspect_ratio=@16/15 The '@' prefix to the property value tells it to do very simple expression evaluation when fetching the property as a numeric type. /producer /playlist /multitrack transition in=0.0 out=150.0 property name=mlt_servicecomposite/property property name=a_track0/property property name=b_track1/property property name=progressive1/property property name=geometry0=0%,0%:100%x100%:100; -1=0%,0%:100%x100%:100;/property property name=haligncentre/property property name=valigncentre/property property name=distort0/property property name=fill1/property fill=1 tells it to scale up; otherwise, the default is only to scale down to fit within the geometry rectangle. Sorry this is not documented in the service metadata. We ported some docs to metadata format, but still have not fully updated them. /transition /tractor /mlt but graphics from test_image_13.png been always scaled to dimensions defined in profile. remove fill=1 Thanks, that helps! [...] for images it would be ease to calculate geometry scaling, but for pango i have no idea how to do this. pango generates images with square pixels; however, like pixbuf, you can force_aspect_ratio (pixel aspect) to the same as the project if you do not care about a (subtle?) distortion in the display aspect ratio of the text. I have used this trick in the past on SD PAL, but it will not work on anamorphic widescreen. i could be wrong, but i have a suspicious that pango do not support force_aspect_ratio property, so i attached a patch. PS where is located a code that perform *composite* of all tracks? -- Maksym Veremeyenko From 36efc230c6d4adf28bb87941aabcf7117813d2a1 Mon Sep 17 00:00:00 2001 From: Maksym Veremeyenko ve...@m1stereo.tv Date: Sat, 14 Jan 2012 18:01:31 +0200 Subject: [PATCH 1/2] fix pango's producer force_aspect_ratio property handling --- src/modules/gtk2/producer_pango.c |9 - 1 files changed, 8 insertions(+), 1 deletions(-) diff --git a/src/modules/gtk2/producer_pango.c b/src/modules/gtk2/producer_pango.c index deb8bd2..ef4985c 100644 --- a/src/modules/gtk2/producer_pango.c +++ b/src/modules/gtk2/producer_pango.c @@ -536,6 +536,9 @@ static int producer_get_frame( mlt_producer producer, mlt_frame_ptr frame, int i { producer_pango this = producer-child; + // Fetch the producers properties + mlt_properties producer_properties = MLT_PRODUCER_PROPERTIES( producer ); + // Generate a frame *frame = mlt_frame_init( MLT_PRODUCER_SERVICE( producer ) ); @@ -556,7 +559,11 @@ static int producer_get_frame( mlt_producer producer, mlt_frame_ptr frame, int i // Set producer-specific frame properties mlt_properties_set_int( properties, progressive, 1 ); - mlt_properties_set_double( properties, aspect_ratio, 1 ); + double force_ratio = mlt_properties_get_double( producer_properties, force_aspect_ratio ); + if ( force_ratio 0.0 ) + mlt_properties_set_double( properties, aspect_ratio, force_ratio ); + else + mlt_properties_set_double( properties, aspect_ratio, 1.0); // Stack the get image callback mlt_frame_push_service( *frame, this ); -- 1.7.4.4 From 850c326e3e0c1acbb25ddb03b09663b99d084fcb Mon Sep 17 00:00:00 2001 From: Maksym Veremeyenko ve...@m1stereo.tv Date: Sat, 14 Jan 2012 18:04:50 +0200 Subject: [PATCH 2/2] fix tag closing --- docs/mlt-xml.txt |2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/docs/mlt-xml.txt b/docs/mlt-xml.txt index 0a6c1ee..41312a7 100644 --- a/docs/mlt-xml.txt +++ b/docs/mlt-xml.txt @@ -202,6 +202,7 @@ Tractors: entry producer=producer0 in=0 out=2999/ blank length=1000/ entry producer=producer0 in=3000 out=6999/ + /playlist playlist id=playlist1 blank length=3000/ entry producer=producer1 in=0 out=999/ @@ -256,6 +257,7 @@ Tractors: entry producer=producer0 in=0 out=2999/ blank length=1000
[Mlt-devel] [PATCH] fix thread exit on error and thread termination
Hi, i was testing a recording from decklink into the avformat consumer with simple code: #include stdio.h #include unistd.h #include framework/mlt.h int main( int argc, char *argv[] ) { mlt_consumer consumer; mlt_producer producer; mlt_profile profile; mlt_repository repo; repo = mlt_factory_init(NULL); mlt_log_set_level(MLT_LOG_DEBUG); // Initialise the factory if(repo) { profile = mlt_profile_init(dv_pal); producer = mlt_factory_producer(profile, decklink, 0); if(!producer) fprintf(stderr, ERROR: Failed to create producer\n); else { consumer = mlt_factory_consumer(profile, avformat, mlt_rec_01.mov); if(!consumer) fprintf(stderr, ERROR: Failed to create consumer\n); else { mlt_properties consumer_properties = mlt_consumer_properties(consumer); mlt_properties_set(consumer_properties, properties, DV); mlt_consumer_connect(consumer, mlt_producer_service(producer)); mlt_consumer_start(consumer); fprintf(stderr, press any key to stop); //getchar(); mlt_consumer_stop(consumer); fprintf(stderr, \nstopped\n); mlt_consumer_close(consumer); }; mlt_producer_close(producer); }; mlt_factory_close(); } else fprintf(stderr, ERROR: Unable to locate factory modules\n ); return 0; }; but that cause a SIGSEGV: Program received signal SIGSEGV, Segmentation fault. [Switching to Thread 0x7fffeb243700 (LWP 568)] flush_cluster_buffer (s=0x7fffe400b2e0) at libavformat/movenc.c:2210 2210for (i=0; imov-nb_streams; i++){ Missing separate debuginfos, use: debuginfo-install SDL-1.2.14-11.fc14.x86_64 alsa-lib-1.0.24-1.fc14.x86_64 cairo-1.10.2-1.fc14.x86_64 expat-2.0.1-10.fc13.x86_64 fontconfig-2.8.0-2.fc14.x86_64 freetype-2.4.2-5.fc14.x86_64 gdk-pixbuf2-2.22.0-2.fc14.x86_64 glib2-2.26.0-2.fc14.x86_64 glibc-2.13-2.x86_64 gsm-1.0.13-2.fc12.x86_64 gtk2-2.22.0-2.fc14.x86_64 libX11-1.3.4-4.fc14.x86_64 libXau-1.0.6-1.fc14.x86_64 libXcomposite-0.4.2-1.fc14.x86_64 libXcursor-1.1.10-5.fc14.x86_64 libXdamage-1.1.3-1.fc14.x86_64 libXext-1.1.2-2.fc14.x86_64 libXfixes-4.0.5-1.fc14.x86_64 libXi-1.3.2-1.fc14.x86_64 libXinerama-1.1-2.fc13.x86_64 libXrandr-1.3.0-5.fc13.x86_64 libXrender-0.9.6-1.fc14.x86_64 libdv-1.0.0-9.fc13.x86_64 libgcc-4.5.1-4.fc14.x86_64 libgomp-4.5.1-4.fc14.x86_64 libogg-1.2.0-1.fc14.x86_64 libpng-1.2.46-1.fc14.x86_64 libselinux-2.0.96-6.fc14.1.x86_64 libstdc++-4.5.1-4.fc14.x86_64 libtheora-1.1.1-1.fc13.x86_64 libtool-ltdl-2.2.10-3.fc14.x86_64 libvorbis-1.3.1-2.fc14.x86_64 libxcb-1.7-1.fc14.x86_64 libxml2-2.7.7-3.fc14.x86_64 pango-1.28.1-5.fc14.x86_64 pixman-0.18.4-1.fc14.x86_64 sox-14.3.2-1.fc14.x86_64 speex-1.2-0.12.rc1.fc12.x86_64 zlib-1.2.5-2.fc14.x86_64 (gdb) bt #0 flush_cluster_buffer (s=0x7fffe400b2e0) at libavformat/movenc.c:2210 #1 0x7fffef2edb37 in mov_write_trailer (s=value optimized out) at libavformat/movenc.c:2645 #2 0x7fffef34af06 in av_write_trailer (s=0x7fffe400b2e0) at libavformat/utils.c:3562 #3 0x7fffef5ab9a2 in consumer_thread (arg=0x693bf0) at consumer_avformat.c:1872 #4 0x003a71006ccb in start_thread () from /lib64/libpthread.so.0 #5 0x003a70ce0c2d in clone () from /lib64/libc.so.6 wrong test code where mlt_consumer_stop was called immediately after mlt_consumer_start caused that sideeffect. to resolve such condition i attached a patch that properly determinate consumer's thread finish and avoid writing /trailer/ if no /header was written.. -- Maksym Veremeyenko From 467bbee676c7347f6e4fbe8774c9d282d8ad607e Mon Sep 17 00:00:00 2001 From: Maksym Veremeyenko ve...@m1stereo.tv Date: Mon, 16 Jan 2012 14:03:25 +0200 Subject: [PATCH] fix thread exit on error and thread termination --- src/modules/avformat/consumer_avformat.c | 38 - 1 files changed, 26 insertions(+), 12 deletions(-) diff --git a/src/modules/avformat/consumer_avformat.c b/src/modules/avformat/consumer_avformat.c index 07e80ea..5665ba9 100644 --- a/src/modules/avformat/consumer_avformat.c +++ b/src/modules/avformat/consumer_avformat.c @@ -352,7 +352,7 @@ static int consumer_start( mlt_consumer consumer ) mlt_properties_set_int( properties, frequency, mlt_properties_get_int( properties, ar ) ); // Assign the thread to properties - mlt_properties_set_data( properties, thread, thread, sizeof( pthread_t ), free, NULL ); + mlt_properties_set_int64( properties, thread, (uint64_t)thread); // Set the running state mlt_properties_set_int( properties, running, 1 ); @@ -371,17 +371,23 @@ static int consumer_stop( mlt_consumer consumer ) // Get the properties mlt_properties properties = MLT_CONSUMER_PROPERTIES( consumer ); + // Get the thread
[Mlt-devel] [PATCH] fix timecode extraction on NULL frame
Hi, for some reason requested frame in the beginning of consumer thread is NULL, so it makes a SIGSEGV on requesting vitc from that frame: (gdb) bt #0 mlt_properties_find (self=0x0, name=0x7fffef5adae0 meta.attr.vitc.markup) at mlt_properties.c:484 #1 mlt_properties_get (self=0x0, name=0x7fffef5adae0 meta.attr.vitc.markup) at mlt_properties.c:750 #2 0x7fffef5aa4a9 in consumer_thread (arg=0x693960) at consumer_avformat.c:1286 #3 0x003a71006ccb in start_thread () from /lib64/libpthread.so.0 #4 0x003a70ce0c2d in clone () from /lib64/libc.so.6 the solution is to check if frame is defined. patch attached. -- Maksym Veremeyenko From e030af1d205b1cac9e4bca5b7742fd24e1569126 Mon Sep 17 00:00:00 2001 From: Maksym Veremeyenko ve...@m1stereo.tv Date: Mon, 16 Jan 2012 14:41:19 +0200 Subject: [PATCH 4/5] check if frame is not NULL before extrating timecode --- src/modules/avformat/consumer_avformat.c |3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/src/modules/avformat/consumer_avformat.c b/src/modules/avformat/consumer_avformat.c index 5665ba9..050cc70 100644 --- a/src/modules/avformat/consumer_avformat.c +++ b/src/modules/avformat/consumer_avformat.c @@ -1282,6 +1282,8 @@ static void *consumer_thread( void *arg ) // Get a frame now, so we can set some AVOptions from properties. frame = mlt_consumer_rt_frame( consumer ); + if ( frame ) + { // Set the timecode from the MLT metadata if available. const char *timecode = mlt_properties_get( MLT_FRAME_PROPERTIES(frame), meta.attr.vitc.markup ); if ( timecode strcmp( timecode, ) ) @@ -1290,6 +1292,7 @@ static void *consumer_thread( void *arg ) if ( strchr( timecode, ';' ) ) mlt_properties_set_int( properties, drop_frame_timecode, 1 ); } + } // Add audio and video streams if ( video_codec_id != CODEC_ID_NONE ) -- 1.7.4.4 From 9d1967a21199047d0b1728c3c19ec3409ab1abdb Mon Sep 17 00:00:00 2001 From: Maksym Veremeyenko ve...@m1stereo.tv Date: Mon, 16 Jan 2012 15:06:06 +0200 Subject: [PATCH 5/5] reindent after previous patch --- src/modules/avformat/consumer_avformat.c | 16 1 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/modules/avformat/consumer_avformat.c b/src/modules/avformat/consumer_avformat.c index 050cc70..44dbe53 100644 --- a/src/modules/avformat/consumer_avformat.c +++ b/src/modules/avformat/consumer_avformat.c @@ -1284,14 +1284,14 @@ static void *consumer_thread( void *arg ) if ( frame ) { - // Set the timecode from the MLT metadata if available. - const char *timecode = mlt_properties_get( MLT_FRAME_PROPERTIES(frame), meta.attr.vitc.markup ); - if ( timecode strcmp( timecode, ) ) - { - mlt_properties_set( properties, timecode, timecode ); - if ( strchr( timecode, ';' ) ) - mlt_properties_set_int( properties, drop_frame_timecode, 1 ); - } + // Set the timecode from the MLT metadata if available. + const char *timecode = mlt_properties_get( MLT_FRAME_PROPERTIES(frame), meta.attr.vitc.markup ); + if ( timecode strcmp( timecode, ) ) + { + mlt_properties_set( properties, timecode, timecode ); + if ( strchr( timecode, ';' ) ) +mlt_properties_set_int( properties, drop_frame_timecode, 1 ); + } } // Add audio and video streams -- 1.7.4.4 -- RSA(R) Conference 2012 Mar 27 - Feb 2 Save $400 by Jan. 27 Register now! http://p.sf.net/sfu/rsa-sfdev2dev2___ Mlt-devel mailing list Mlt-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mlt-devel
Re: [Mlt-devel] [PATCH] fix thread exit on error and thread termination
16.01.12 14:12, Maksym Veremeyenko написав(ла): Hi, i was testing a recording from decklink into the avformat consumer with simple code: [...] but that cause a SIGSEGV: [...] wrong test code where mlt_consumer_stop was called immediately after mlt_consumer_start caused that sideeffect. to resolve such condition i attached a patch that properly determinate consumer's thread finish and avoid writing /trailer/ if no /header was written.. ping? -- Maksym Veremeyenko -- Keep Your Developer Skills Current with LearnDevNow! The most comprehensive online learning library for Microsoft developers is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, Metro Style Apps, more. Free future releases when you subscribe now! http://p.sf.net/sfu/learndevnow-d2d ___ Mlt-devel mailing list Mlt-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mlt-devel
Re: [Mlt-devel] content scaling
14.01.12 18:08, Maksym Veremeyenko написав(ла): [...] i could be wrong, but i have a suspicious that pango do not support force_aspect_ratio property, so i attached a patch. ping? -- Maksym Veremeyenko -- Keep Your Developer Skills Current with LearnDevNow! The most comprehensive online learning library for Microsoft developers is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, Metro Style Apps, more. Free future releases when you subscribe now! http://p.sf.net/sfu/learndevnow-d2d ___ Mlt-devel mailing list Mlt-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mlt-devel
Re: [Mlt-devel] loop for producer
25.01.12 19:24, Dan Dennedy написав(ла): On Wed, Jan 25, 2012 at 8:16 AM, Maksym Veremeyenkove...@m1stereo.tv wrote: Hi, are there any way to set (or use) *loop* or *eof* properties for *avformat* producer? Yes, I think it should, but it depends on your context (object model) and application to enable the proper behavior. IOW, the playlist or multitrack length might be limiting the duration. Also, it appears that the playlist sets eof=pause when you add the producer to a playlist. So, eof needs to be set after the playlist operation. Also, the playlist producer supports an eof property itself that can be a factor. it seems i have to use playlist for playing loop... command melt test.dv eof=loop do not work properly for me, is it correct? -- Maksym Veremeyenko -- Keep Your Developer Skills Current with LearnDevNow! The most comprehensive online learning library for Microsoft developers is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, Metro Style Apps, more. Free future releases when you subscribe now! http://p.sf.net/sfu/learndevnow-d2d ___ Mlt-devel mailing list Mlt-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mlt-devel
Re: [Mlt-devel] loop for producer
25.01.12 19:55, Dan Dennedy написав(ла): On Wed, Jan 25, 2012 at 9:43 AM, Dan Dennedyd...@dennedy.org wrote: 2012/1/25 Maksym Veremeyenkove...@m1stereo.tv: 25.01.12 19:24, Dan Dennedy написав(ла): On Wed, Jan 25, 2012 at 8:16 AM, Maksym Veremeyenkove...@m1stereo.tv wrote: Hi, are there any way to set (or use) *loop* or *eof* properties for *avformat* producer? Yes, I think it should, but it depends on your context (object model) and application to enable the proper behavior. IOW, the playlist or multitrack length might be limiting the duration. Also, it appears that the playlist sets eof=pause when you add the producer to a playlist. So, eof needs to be set after the playlist operation. Also, the playlist producer supports an eof property itself that can be a factor. it seems i have to use playlist for playing loop... command melt test.dv eof=loop do not work properly for me, is it correct? Correct, that is what I implied by context. melt does is not concerned to easily support this use case (but there might be a tricky way to do it). Melt always creates a multitrack with a playlist for a track. The most obvious way to simulate a loop with melt is to use -repeat with a large value. You will need to dig a little if you need a real loop by using a mlt xml file or by tricking the command line options. I had a vague recollection that I had figured out a command line trick. So, I searched my e-mail and found it: melt eof=loop test.dv In the options processor, initially the current properties object is the tractor, which is a producer that understands eof property semantics. So, here we set a property on the tractor producer before creating a new producer, which changes the current properties object. i had a success with C code to provide a loop throw a mlt_playlist, but for xml i can't provide this. i did a simple demo with background video and some small animation on it: ?xml version=1.0 ? mlt !-- clip -- producer id=clip property name=resourceI0009618_test.avi/property /producer !-- cg -- producer id=cg property name=resourceglobe_SD.avi/property /producer !-- cg loop -- playlist id=cg_loop eof=loop entry producer=cg/ /playlist tractor multitrack track producer=cg_loop/ track producer=clip/ /multitrack !-- clip and cg blending -- transition in=0.0 out=1499.0 property name=mlt_servicecomposite/property property name=a_track1/property property name=b_track0/property property name=progressive1/property property name=start0/0:100%x100%:100/property property name=end0/0:100%x100%:100/property property name=halignleft/property property name=valigntop/property property name=distort0/property /transition /tractor /mlt -- Maksym Veremeyenko Senior System Administrator IT Department Ukrainian Music Television Channel M1 DDI. +380 44 205-44-92 Tel. +380 44 205-44-80 Fax. +380 44 205-44-82 Cell. +380-67-447-22-43 E-mail : maksym.veremeye...@m1stereo.tv Web site: www.m1stereo.tv -- Keep Your Developer Skills Current with LearnDevNow! The most comprehensive online learning library for Microsoft developers is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, Metro Style Apps, more. Free future releases when you subscribe now! http://p.sf.net/sfu/learndevnow-d2d ___ Mlt-devel mailing list Mlt-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mlt-devel
[Mlt-devel] [PATCH] use sse2 instruction for line compositing
Hi, attached patch perform line compositing for SSE2+ARCH_X86_64 build. It works for a case where luma is not defined... -- Maksym Veremeyenko From 73dca48f8e4a470140ab4d70d2002c6ff39017ef Mon Sep 17 00:00:00 2001 From: Maksym Veremeyenko ve...@m1stereo.tv Date: Thu, 2 Feb 2012 18:03:07 +0200 Subject: [PATCH] use sse2 instruction for line compositing --- src/modules/core/composite_line_yuv_sse2_simple.c | 164 + src/modules/core/transition_composite.c | 12 ++- 2 files changed, 174 insertions(+), 2 deletions(-) create mode 100644 src/modules/core/composite_line_yuv_sse2_simple.c diff --git a/src/modules/core/composite_line_yuv_sse2_simple.c b/src/modules/core/composite_line_yuv_sse2_simple.c new file mode 100644 index 000..bd977e1 --- /dev/null +++ b/src/modules/core/composite_line_yuv_sse2_simple.c @@ -0,0 +1,164 @@ +const static unsigned char const1[] = +{ +0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00 +}; + +__asm__ volatile +( +pxor %%xmm0, %%xmm0 \n\t /* clear zero register */ +movdqu (%4), %%xmm9\n\t /* load const1 */ +movd %0, %%xmm1 \n\t /* load weight and decompose */ +movlhps%%xmm1, %%xmm1 \n\t +pshuflw$0, %%xmm1, %%xmm1 \n\t +pshufhw$0, %%xmm1, %%xmm1 \n\t + +/* +xmm1 (weight) + +00 W 00 W 00 W 00 W 00 W 00 W 00 W 00 W +*/ +loop_start:\n\t +movq (%1), %%xmm2\n\t /* load source alpha */ +punpcklbw %%xmm0, %%xmm2 \n\t /* unpack alpha 8 8-bits alphas to 8 16-bits values */ + +/* +xmm2 (src alpha) +xmm3 (dst alpha) + +00 A8 00 A7 00 A6 00 A5 00 A4 00 A3 00 A2 00 A1 +*/ +pmullw %%xmm1, %%xmm2 \n\t /* premultiply source alpha */ +psrlw $8, %%xmm2 \n\t + +/* +xmm2 (premultiplied) + +00 A8 00 A7 00 A6 00 A5 00 A4 00 A3 00 A2 00 A1 +*/ + + +/* +DSTa = DSTa + (SRCa * (0xFF - DSTa)) 8 +*/ +movq (%5), %%xmm3\n\t /* load dst alpha */ +punpcklbw %%xmm0, %%xmm3 \n\t /* unpack dst 8 8-bits alphas to 8 16-bits values */ +movdqa %%xmm9, %%xmm4 \n\t +psubw %%xmm3, %%xmm4 \n\t +pmullw %%xmm2, %%xmm4 \n\t +psrlw $8, %%xmm4 \n\t +paddw %%xmm4, %%xmm3 \n\t +packuswb %%xmm0, %%xmm3 \n\t +movq %%xmm3, (%5)\n\t /* load dst alpha */ + +movdqu (%2), %%xmm3\n\t /* load src */ +movdqu (%3), %%xmm4\n\t /* load dst */ +movdqa %%xmm3, %%xmm5 \n\t /* dub src */ +movdqa %%xmm4, %%xmm6 \n\t /* dub dst */ + +/* +xmm3 (src) +xmm4 (dst) +xmm5 (src) +xmm6 (dst) + +U8 V8 U7 V7 U6 V6 U5 V5 U4 V4 U3 V3 U2 V2 U1 V1 +*/ + +punpcklbw %%xmm0, %%xmm5 \n\t /* unpack src low */ +punpcklbw %%xmm0, %%xmm6 \n\t /* unpack dst low */ +punpckhbw %%xmm0, %%xmm3 \n\t /* unpack src high */ +punpckhbw %%xmm0, %%xmm4 \n\t /* unpack dst high */ + +/* +xmm5 (src_l) +xmm6 (dst_l) + +00 U4 00 V4 00 U3 00 V3 00 U2 00 V2 00 U1 00 V1 + +xmm3 (src_u) +xmm4 (dst_u) + +00 U8 00 V8 00 U7 00 V7 00 U6 00 V6 00 U5 00 V5 +*/ + +movdqa %%xmm2, %%xmm7 \n\t /* dub alpha */ +movdqa %%xmm2, %%xmm8 \n\t /* dub alpha */ +movlhps%%xmm7, %%xmm7 \n\t /* dub low */ +movhlps%%xmm8, %%xmm8 \n\t /* dub high */ + +/* +xmm7 (src alpha) + +00 A4 00 A3 00 A2 00 A1 00 A4 00 A3 00 A2 00 A1 +xmm8 (src alpha) + +00 A8 00 A7 00 A6 00 A5 00 A8 00 A7 00 A6 00 A5 +*/ + +pshuflw$0x50, %%xmm7, %%xmm7 \n\t +pshuflw$0x50, %%xmm8, %%xmm8 \n\t +pshufhw$0xFA, %%xmm7, %%xmm7 \n\t +pshufhw$0xFA, %%xmm8, %%xmm8 \n\t + +/* +xmm7 (src alpha lower) + +00 A4 00 A4 00 A3 00 A3 00 A2 00 A2 00 A1 00 A1 + +xmm8 (src alpha upper) +00 A8 00 A8 00 A7 00 A7 00 A6 00 A6 00 A5 00 A5
[Mlt-devel] no alpha channel for video with PIX_FMT_YUVA420P pixel format
Hi, i am trying to decrease cpu usage, so i would like to use PIX_FMT_YUVA420P animation instead of PIX_FMT_BGRA (or other rgb with alpha channel) but has no luck.. video with such pixel format in *nut* container has detected by ffmpeg properly, but mlt did not use it alpha channel. i can provide a sample if required... -- Maksym Veremeyenko -- Keep Your Developer Skills Current with LearnDevNow! The most comprehensive online learning library for Microsoft developers is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, Metro Style Apps, more. Free future releases when you subscribe now! http://p.sf.net/sfu/learndevnow-d2d ___ Mlt-devel mailing list Mlt-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mlt-devel
Re: [Mlt-devel] [PATCH] use sse2 instruction for line compositing
02.02.12 19:01, Patrick Matthäi написав(ла): Am 02.02.2012 17:57, schrieb Maksym Veremeyenko: Hi, attached patch perform line compositing for SSE2+ARCH_X86_64 build. It works for a case where luma is not defined... Is there a reason why it is only on amd64 available? because it use xmm8 and xmm9 that available only for x64 mode... Surely the code should be disabled if mlt is configured without SSE support, it used only: [...] #if defined(USE_SSE) defined(ARCH_X86_64) but a user with an modern CPU but i386 userland/kernel maybe still wants to benefit from it? code could be optimized by dropping keeping in register two constants... -- Maksym Veremeyenko -- Keep Your Developer Skills Current with LearnDevNow! The most comprehensive online learning library for Microsoft developers is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, Metro Style Apps, more. Free future releases when you subscribe now! http://p.sf.net/sfu/learndevnow-d2d ___ Mlt-devel mailing list Mlt-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mlt-devel
Re: [Mlt-devel] [PATCH] use sse2 instruction for line compositing
02.02.12 18:57, Maksym Veremeyenko написав(ла): Hi, attached patch perform line compositing for SSE2+ARCH_X86_64 build. It works for a case where luma is not defined... updated patch attached -- Maksym Veremeyenko From d0a46a3308b390228e6d4337b24010ae3cecef7f Mon Sep 17 00:00:00 2001 From: Maksym Veremeyenko ve...@m1stereo.tv Date: Fri, 3 Feb 2012 13:19:12 +0200 Subject: [PATCH] use sse2 instruction for line compositing --- src/modules/core/composite_line_yuv_sse2_simple.c | 164 + src/modules/core/transition_composite.c | 16 ++- 2 files changed, 178 insertions(+), 2 deletions(-) create mode 100644 src/modules/core/composite_line_yuv_sse2_simple.c diff --git a/src/modules/core/composite_line_yuv_sse2_simple.c b/src/modules/core/composite_line_yuv_sse2_simple.c new file mode 100644 index 000..bd977e1 --- /dev/null +++ b/src/modules/core/composite_line_yuv_sse2_simple.c @@ -0,0 +1,164 @@ +const static unsigned char const1[] = +{ +0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00 +}; + +__asm__ volatile +( +pxor %%xmm0, %%xmm0 \n\t /* clear zero register */ +movdqu (%4), %%xmm9\n\t /* load const1 */ +movd %0, %%xmm1 \n\t /* load weight and decompose */ +movlhps%%xmm1, %%xmm1 \n\t +pshuflw$0, %%xmm1, %%xmm1 \n\t +pshufhw$0, %%xmm1, %%xmm1 \n\t + +/* +xmm1 (weight) + +00 W 00 W 00 W 00 W 00 W 00 W 00 W 00 W +*/ +loop_start:\n\t +movq (%1), %%xmm2\n\t /* load source alpha */ +punpcklbw %%xmm0, %%xmm2 \n\t /* unpack alpha 8 8-bits alphas to 8 16-bits values */ + +/* +xmm2 (src alpha) +xmm3 (dst alpha) + +00 A8 00 A7 00 A6 00 A5 00 A4 00 A3 00 A2 00 A1 +*/ +pmullw %%xmm1, %%xmm2 \n\t /* premultiply source alpha */ +psrlw $8, %%xmm2 \n\t + +/* +xmm2 (premultiplied) + +00 A8 00 A7 00 A6 00 A5 00 A4 00 A3 00 A2 00 A1 +*/ + + +/* +DSTa = DSTa + (SRCa * (0xFF - DSTa)) 8 +*/ +movq (%5), %%xmm3\n\t /* load dst alpha */ +punpcklbw %%xmm0, %%xmm3 \n\t /* unpack dst 8 8-bits alphas to 8 16-bits values */ +movdqa %%xmm9, %%xmm4 \n\t +psubw %%xmm3, %%xmm4 \n\t +pmullw %%xmm2, %%xmm4 \n\t +psrlw $8, %%xmm4 \n\t +paddw %%xmm4, %%xmm3 \n\t +packuswb %%xmm0, %%xmm3 \n\t +movq %%xmm3, (%5)\n\t /* load dst alpha */ + +movdqu (%2), %%xmm3\n\t /* load src */ +movdqu (%3), %%xmm4\n\t /* load dst */ +movdqa %%xmm3, %%xmm5 \n\t /* dub src */ +movdqa %%xmm4, %%xmm6 \n\t /* dub dst */ + +/* +xmm3 (src) +xmm4 (dst) +xmm5 (src) +xmm6 (dst) + +U8 V8 U7 V7 U6 V6 U5 V5 U4 V4 U3 V3 U2 V2 U1 V1 +*/ + +punpcklbw %%xmm0, %%xmm5 \n\t /* unpack src low */ +punpcklbw %%xmm0, %%xmm6 \n\t /* unpack dst low */ +punpckhbw %%xmm0, %%xmm3 \n\t /* unpack src high */ +punpckhbw %%xmm0, %%xmm4 \n\t /* unpack dst high */ + +/* +xmm5 (src_l) +xmm6 (dst_l) + +00 U4 00 V4 00 U3 00 V3 00 U2 00 V2 00 U1 00 V1 + +xmm3 (src_u) +xmm4 (dst_u) + +00 U8 00 V8 00 U7 00 V7 00 U6 00 V6 00 U5 00 V5 +*/ + +movdqa %%xmm2, %%xmm7 \n\t /* dub alpha */ +movdqa %%xmm2, %%xmm8 \n\t /* dub alpha */ +movlhps%%xmm7, %%xmm7 \n\t /* dub low */ +movhlps%%xmm8, %%xmm8 \n\t /* dub high */ + +/* +xmm7 (src alpha) + +00 A4 00 A3 00 A2 00 A1 00 A4 00 A3 00 A2 00 A1 +xmm8 (src alpha) + +00 A8 00 A7 00 A6 00 A5 00 A8 00 A7 00 A6 00 A5 +*/ + +pshuflw$0x50, %%xmm7, %%xmm7 \n\t +pshuflw$0x50, %%xmm8, %%xmm8 \n\t +pshufhw$0xFA, %%xmm7, %%xmm7 \n\t +pshufhw$0xFA, %%xmm8, %%xmm8 \n\t + +/* +xmm7 (src alpha lower) + +00 A4 00 A4 00 A3 00 A3 00 A2 00 A2 00 A1 00 A1 + +xmm8 (src alpha upper
[Mlt-devel] vdpau performance
Hi, i am trying to use vdpau for mpeg2 decoding. i did a test patch that enable vdpau init for mpeg2. it works, but it still high cpu load. enabling vdpau gives only 15% of cpu load decrease (81% with vdpau 96% without vdpau) am i doing something wrong? ps i am testing 1920x1080 4:2:0 mpeg-2 files... -- Maksym Veremeyenko From a5b2d1e0f3ddbb4167ac4ecb9e4a69edf8bab083 Mon Sep 17 00:00:00 2001 From: Maksym Veremeyenko ve...@m1stereo.tv Date: Sat, 4 Feb 2012 17:54:40 +0200 Subject: [PATCH] mpeg2 against vdpau probe --- src/modules/avformat/producer_avformat.c | 21 +++-- src/modules/avformat/vdpau.c | 28 2 files changed, 35 insertions(+), 14 deletions(-) diff --git a/src/modules/avformat/producer_avformat.c b/src/modules/avformat/producer_avformat.c index c94080d..b349b4c 100644 --- a/src/modules/avformat/producer_avformat.c +++ b/src/modules/avformat/producer_avformat.c @@ -1597,6 +1597,7 @@ static int producer_get_image( mlt_frame frame, uint8_t **buffer, mlt_image_form // Decode the image if ( must_decode || int_position = req_position ) { +#if 0 #ifdef VDPAU if ( self-vdpau ) { @@ -1607,6 +1608,7 @@ static int producer_get_image( mlt_frame frame, uint8_t **buffer, mlt_image_form self-vdpau-is_decoded = 0; } #endif +#endif codec_context-reordered_opaque = pkt.pts; if ( int_position = req_position ) codec_context-skip_loop_filter = AVDISCARD_NONE; @@ -1835,23 +1837,30 @@ static int video_codec_init( producer_avformat self, int index, mlt_properties p AVCodecContext *codec_context = stream-codec; // Find the codec - AVCodec *codec = avcodec_find_decoder( codec_context-codec_id ); + AVCodec *codec = NULL; #ifdef VDPAU - if ( codec_context-codec_id == CODEC_ID_H264 ) + char* vdpau_codec = NULL; + switch ( codec_context-codec_id ) + { + case CODEC_ID_H264: vdpau_codec = h264_vdpau; break; + case CODEC_ID_MPEG2VIDEO: vdpau_codec = mpegvideo_vdpau; break; + }; + + if ( vdpau_codec ) { - if ( ( codec = avcodec_find_decoder_by_name( h264_vdpau ) ) ) + if ( ( codec = avcodec_find_decoder_by_name( vdpau_codec ) ) ) { if ( vdpau_init( self ) ) { self-video_codec = codec_context; - if ( !vdpau_decoder_init( self ) ) + if ( !vdpau_decoder_init( self, codec_context-codec_id ) ) vdpau_fini( self ); } } - if ( !self-vdpau ) -codec = avcodec_find_decoder( codec_context-codec_id ); } + if ( !self-vdpau ) #endif + codec = avcodec_find_decoder( codec_context-codec_id ); // Initialise multi-threading int thread_count = mlt_properties_get_int( properties, threads ); diff --git a/src/modules/avformat/vdpau.c b/src/modules/avformat/vdpau.c index b5710b3..c7f7b13 100644 --- a/src/modules/avformat/vdpau.c +++ b/src/modules/avformat/vdpau.c @@ -126,7 +126,7 @@ static int vdpau_init( producer_avformat self ) static enum PixelFormat vdpau_get_format( struct AVCodecContext *s, const enum PixelFormat *fmt ) { - return PIX_FMT_VDPAU_H264; + return *fmt; } static int vdpau_get_buffer( AVCodecContext *codec_context, AVFrame *frame ) @@ -152,14 +152,14 @@ static int vdpau_get_buffer( AVCodecContext *codec_context, AVFrame *frame ) frame-reordered_opaque = codec_context-reordered_opaque; if ( frame-reference ) { -frame-age = self-vdpau-ip_age[0]; +//frame-age = self-vdpau-ip_age[0]; self-vdpau-ip_age[0] = self-vdpau-ip_age[1] + 1; self-vdpau-ip_age[1] = 1; self-vdpau-b_age++; } else { -frame-age = self-vdpau-b_age; +//frame-age = self-vdpau-b_age; self-vdpau-ip_age[0] ++; self-vdpau-ip_age[1] ++; self-vdpau-b_age = 1; @@ -219,21 +219,33 @@ static void vdpau_draw_horiz( AVCodecContext *codec_context, const AVFrame *fram } } -static int vdpau_decoder_init( producer_avformat self ) +static int vdpau_decoder_init( producer_avformat self, int codec_id ) { mlt_log_debug( MLT_PRODUCER_SERVICE(self-parent), vdpau_decoder_init\n ); int success = 1; - + VdpDecoderProfile profile; + self-video_codec-opaque = self; self-video_codec-get_format = vdpau_get_format; self-video_codec-get_buffer = vdpau_get_buffer; self-video_codec-release_buffer = vdpau_release_buffer; self-video_codec-draw_horiz_band = vdpau_draw_horiz; self-video_codec-slice_flags = SLICE_FLAG_CODED_ORDER | SLICE_FLAG_ALLOW_FIELD; - self-video_codec-pix_fmt = PIX_FMT_VDPAU_H264; - - VdpDecoderProfile profile = VDP_DECODER_PROFILE_H264_HIGH; + uint32_t max_references = self-video_codec-refs; + + switch(codec_id) + { + case CODEC_ID_H264: + self-video_codec-pix_fmt = PIX_FMT_VDPAU_H264; + profile = VDP_DECODER_PROFILE_H264_HIGH; + break; + case CODEC_ID_MPEG2VIDEO: + self-video_codec-pix_fmt = PIX_FMT_VDPAU_MPEG2; + profile = VDP_DECODER_PROFILE_MPEG2_MAIN; + break; + }; + pthread_mutex_lock( mlt_sdl_mutex
Re: [Mlt-devel] [PATCH] use sse2 instruction for line compositing
06.02.12 18:47, Dan Dennedy написав(ла): [...] I will give it another review and testing. Your other items are still on my todo list, but have been busy lately dealing with libav- and ffmpeg-integration bugs. offtopic: why does alpha plane created if not exists? why do not pass a NULL into the composite_yuv_??? function? i think for 1920x1080 creating non-transparent alpha plane could be bit slowdown system? -- Maksym Veremeyenko -- Try before you buy = See our experts in action! The most comprehensive online learning library for Microsoft developers is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, Metro Style Apps, more. Free future releases when you subscribe now! http://p.sf.net/sfu/learndevnow-dev2 ___ Mlt-devel mailing list Mlt-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mlt-devel
Re: [Mlt-devel] [PATCH] use sse2 instruction for line compositing
08.02.12 06:45, Dan Dennedy написав(ла): On Tue, Feb 7, 2012 at 8:40 PM, Dan Dennedyd...@dennedy.org wrote: 2012/2/6 Maksym Veremeyenkove...@m1stereo.tv: 04.02.12 22:25, Dan Dennedy написав(ла): 2012/2/3 Maksym Veremeyenkove...@m1stereo.tv: 02.02.12 18:57, Maksym Veremeyenko написав(ла): Hi, attached patch perform line compositing for SSE2+ARCH_X86_64 build. It works for a case where luma is not defined... updated patch attached i am still testing it... may be you can take a look if all processed fine. I started testing with the demos in the demo/ directory. It mostly works; however, mlt_my_name_is crashes on me (and one time mlt_squeeze_box): (gdb) bt #0 0x7fffdecced14 in composite_line_yuv ( dest=0x25bae60 ~\037~ ~\037~!~-\177\064~2\177\065}5\200\064}3\200\062}3\201\064}6\201\063|0\202-|+\202+|+\202,|-\202/{0\203\060{1\203\061{1\203\061{1\203\061|2\202\062|1\202/{/\202\060{1\202-{,\202-{1\202\062{2\202\065{:\202\062{3\203\063{3\203\063z6\203;z@\203=z@\203BzD\203JzR\204WzW\204^ya\202fyj\202myn\202nyn\202wyv\202yy~\202\177y|\202|y\177\202{y{\202|y~\202\177y}\201|y}\201{y{\201{yy\201xyw\201wyx\201w{w\201t{p\201..., src=0x2c621f0 width=0, alpha_b=0x2c16e00 , Expanding the test to include width fixed that for me. if ( !luma width ) Can you think of some other checks we should add? seems i miss that checks, i think it should be: if ( !luma width 7 ) -- Maksym Veremeyenko -- Keep Your Developer Skills Current with LearnDevNow! The most comprehensive online learning library for Microsoft developers is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, Metro Style Apps, more. Free future releases when you subscribe now! http://p.sf.net/sfu/learndevnow-d2d ___ Mlt-devel mailing list Mlt-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mlt-devel
Re: [Mlt-devel] planning to release MLT this weekend
09.02.12 07:18, Dan Dennedy написав(ла): I want to make a new release this weekend after I resolve of couple of Maksym's patches. may be it has a sense to include sse2 and yuva fixes into next release... -- Maksym Veremeyenko -- Virtualization Cloud Management Using Capacity Planning Cloud computing makes use of virtualization - but cloud computing also focuses on allowing computing to be delivered as a service. http://www.accelacomm.com/jaw/sfnl/114/51521223/ ___ Mlt-devel mailing list Mlt-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mlt-devel
Re: [Mlt-devel] [PATCH] fix thread exit on error and thread termination
08.02.12 20:11, Dan Dennedy написав(ла): [...] Well, the more critical goal was to fix a segfault, but I see your point now about using running to cleanup thread. I did not like your conversion of the thread property from data to a int64; do you know how data properties provide destruction? Also, my testing revealed some additional pointer checks required inside consumer_thread. Comment on this applied to head: diff --git a/src/modules/avformat/consumer_avformat.c b/src/modules/avformat/consumer_avformat.c index fb52df3..cd63431 100644 --- a/src/modules/avformat/consumer_avformat.c +++ b/src/modules/avformat/consumer_avformat.c @@ -350,18 +350,18 @@ static int consumer_stop( mlt_consumer consumer ) { // Get the properties mlt_properties properties = MLT_CONSUMER_PROPERTIES( consumer ); + pthread_t *thread = mlt_properties_get_data( properties, thread, NULL ); // Check that we're running - if ( mlt_properties_get_int( properties, running ) ) + if ( thread ) { - // Get the thread - pthread_t *thread = mlt_properties_get_data( properties, thread, NULL ); - // Stop the thread mlt_properties_set_int( properties, running, 0 ); // Wait for termination pthread_join( *thread, NULL ); what about swapping two lines above - set flag running after pthread_join return? -- Maksym Veremeyenko -- Virtualization Cloud Management Using Capacity Planning Cloud computing makes use of virtualization - but cloud computing also focuses on allowing computing to be delivered as a service. http://www.accelacomm.com/jaw/sfnl/114/51521223/ ___ Mlt-devel mailing list Mlt-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mlt-devel
Re: [Mlt-devel] [PATCH] fix thread exit on error and thread termination
09.02.12 20:28, Dan Dennedy написав(ла): 2012/2/9 Maksym Veremeyenkove...@m1stereo.tv: 08.02.12 20:11, Dan Dennedy написав(ла): [...] Well, the more critical goal was to fix a segfault, but I see your point now about using running to cleanup thread. I did not like your conversion of the thread property from data to a int64; do you know how data properties provide destruction? Also, my testing revealed some additional pointer checks required inside consumer_thread. Comment on this applied to head: diff --git a/src/modules/avformat/consumer_avformat.c b/src/modules/avformat/consumer_avformat.c index fb52df3..cd63431 100644 --- a/src/modules/avformat/consumer_avformat.c +++ b/src/modules/avformat/consumer_avformat.c @@ -350,18 +350,18 @@ static int consumer_stop( mlt_consumer consumer ) { // Get the properties mlt_properties properties = MLT_CONSUMER_PROPERTIES( consumer ); + pthread_t *thread = mlt_properties_get_data( properties, thread, NULL ); // Check that we're running - if ( mlt_properties_get_int( properties, running ) ) + if ( thread ) { - // Get the thread - pthread_t *thread = mlt_properties_get_data( properties, thread, NULL ); - // Stop the thread mlt_properties_set_int( properties, running, 0 ); // Wait for termination pthread_join( *thread, NULL ); what about swapping two lines above - set flag running after pthread_join return? The main loop in the consumer checks the running property, so we need to set it 0 to signal termination before the join. ok with me... -- Maksym Veremeyenko -- Virtualization Cloud Management Using Capacity Planning Cloud computing makes use of virtualization - but cloud computing also focuses on allowing computing to be delivered as a service. http://www.accelacomm.com/jaw/sfnl/114/51521223/ ___ Mlt-devel mailing list Mlt-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mlt-devel
Re: [Mlt-devel] [PATCH] use sse2 instruction for line compositing
10.02.12 07:41, Dan Dennedy написав(ла): 2012/2/2 Maksym Veremeyenkove...@m1stereo.tv: Hi, attached patch perform line compositing for SSE2+ARCH_X86_64 build. It works for a case where luma is not defined... Hi Maksym, did some more testing and ran into a couple of image quality problems. First, alpha blending seems poor, mostly noticeable with a text with curvy typeface over video: melt clip1.dv -filter dynamictext:Hello size=200 outline=2 olcolour=white family=elegante bgcolor=0x0020 The first time you run that you will see that the alpha of bgcolour (black with 12.5% opacity) is not honored and the background is black. Set bgcolour=0 to make it completely transparent and look along curved edges to see the poor blending. The second problem is that key-framing opacity causes a repeating cycle of 100% A frame, A+B blended, and 100% B frame. The below reproduces it: melt color:red -track color:blue -transition composite out=99 geometry=0=0/0:100%x100%:0; 99=0/0:100%x100%:100 i wrongly assumed weight range in 0..255 - updated patch attached... -- Maksym Veremeyenko From e8c8a1dde7883f203f609f364a27ea6c1a77104f Mon Sep 17 00:00:00 2001 From: Maksym Veremeyenko ve...@m1stereo.tv Date: Tue, 14 Feb 2012 13:34:12 +0200 Subject: [PATCH] use sse2 instruction for line compositing --- src/modules/core/composite_line_yuv_sse2_simple.c | 164 + src/modules/core/transition_composite.c | 12 ++- 2 files changed, 174 insertions(+), 2 deletions(-) create mode 100644 src/modules/core/composite_line_yuv_sse2_simple.c diff --git a/src/modules/core/composite_line_yuv_sse2_simple.c b/src/modules/core/composite_line_yuv_sse2_simple.c new file mode 100644 index 000..f202828 --- /dev/null +++ b/src/modules/core/composite_line_yuv_sse2_simple.c @@ -0,0 +1,164 @@ +const static unsigned char const1[] = +{ +0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00 +}; + +__asm__ volatile +( +pxor %%xmm0, %%xmm0 \n\t /* clear zero register */ +movdqu (%4), %%xmm9\n\t /* load const1 */ +movd %0, %%xmm1 \n\t /* load weight and decompose */ +movlhps%%xmm1, %%xmm1 \n\t +pshuflw$0, %%xmm1, %%xmm1 \n\t +pshufhw$0, %%xmm1, %%xmm1 \n\t + +/* +xmm1 (weight) + +00 W 00 W 00 W 00 W 00 W 00 W 00 W 00 W +*/ +loop_start:\n\t +movq (%1), %%xmm2\n\t /* load source alpha */ +punpcklbw %%xmm0, %%xmm2 \n\t /* unpack alpha 8 8-bits alphas to 8 16-bits values */ + +/* +xmm2 (src alpha) +xmm3 (dst alpha) + +00 A8 00 A7 00 A6 00 A5 00 A4 00 A3 00 A2 00 A1 +*/ +pmullw %%xmm1, %%xmm2 \n\t /* premultiply source alpha */ +psrlw $8, %%xmm2 \n\t + +/* +xmm2 (premultiplied) + +00 A8 00 A7 00 A6 00 A5 00 A4 00 A3 00 A2 00 A1 +*/ + + +/* +DSTa = DSTa + (SRCa * (0xFF - DSTa)) 8 +*/ +movq (%5), %%xmm3\n\t /* load dst alpha */ +punpcklbw %%xmm0, %%xmm3 \n\t /* unpack dst 8 8-bits alphas to 8 16-bits values */ +movdqa %%xmm9, %%xmm4 \n\t +psubw %%xmm3, %%xmm4 \n\t +pmullw %%xmm2, %%xmm4 \n\t +psrlw $8, %%xmm4 \n\t +paddw %%xmm4, %%xmm3 \n\t +packuswb %%xmm0, %%xmm3 \n\t +movq %%xmm3, (%5)\n\t /* save dst alpha */ + +movdqu (%2), %%xmm3\n\t /* load src */ +movdqu (%3), %%xmm4\n\t /* load dst */ +movdqa %%xmm3, %%xmm5 \n\t /* dub src */ +movdqa %%xmm4, %%xmm6 \n\t /* dub dst */ + +/* +xmm3 (src) +xmm4 (dst) +xmm5 (src) +xmm6 (dst) + +U8 V8 U7 V7 U6 V6 U5 V5 U4 V4 U3 V3 U2 V2 U1 V1 +*/ + +punpcklbw %%xmm0, %%xmm5 \n\t /* unpack src low */ +punpcklbw %%xmm0, %%xmm6 \n\t /* unpack dst low */ +punpckhbw %%xmm0, %%xmm3 \n\t /* unpack src high */ +punpckhbw %%xmm0, %%xmm4 \n\t /* unpack dst high */ + +/* +xmm5 (src_l) +xmm6 (dst_l) + +00 U4 00 V4 00 U3 00 V3 00 U2 00 V2 00 U1 00 V1 + +xmm3 (src_u) +xmm4 (dst_u) + +00 U8 00 V8 00 U7 00 V7 00 U6 00 V6 00 U5 00 V5 +*/ + +movdqa
[Mlt-devel] [PATCH] save converted image for next use
Hi, data for overlay image converted from RGBA to YUV422 for each frame. attached patch save converted image of *pixbuf* producer to avoid converting it to profile format each time it require to produce resulting frame. with that patch and previous SSE2 patches it possible to put full hd logo on video without dropped frame. it is draft version with leak on exit but it could answer the question if it is a right approach for solving problem with image converted to desired format once per frame instead of once per load/format_change. -- Maksym Veremeyenko From 94f0d6dbd3141ea1461e92b0055de3dddf686583 Mon Sep 17 00:00:00 2001 From: Maksym Veremeyenko ve...@m1stereo.tv Date: Tue, 14 Feb 2012 18:20:29 +0200 Subject: [PATCH 1/2] implement mlt_frame_get_image_data and mlt_frame_get_alpha_data --- src/framework/mlt_frame.c | 10 ++ src/framework/mlt_frame.h |2 ++ 2 files changed, 12 insertions(+), 0 deletions(-) diff --git a/src/framework/mlt_frame.c b/src/framework/mlt_frame.c index 6125929..d08c5cb 100644 --- a/src/framework/mlt_frame.c +++ b/src/framework/mlt_frame.c @@ -310,6 +310,11 @@ int mlt_frame_set_image( mlt_frame self, uint8_t *image, int size, mlt_destructo return mlt_properties_set_data( MLT_FRAME_PROPERTIES( self ), image, image, size, destroy, NULL ); } +void* mlt_frame_get_image_data( mlt_frame self, int *size ) +{ + return mlt_properties_get_data( MLT_FRAME_PROPERTIES( self ), image, size ); +} + /** Set a new alpha channel on the frame. * * \public \memberof mlt_frame_s @@ -325,6 +330,11 @@ int mlt_frame_set_alpha( mlt_frame self, uint8_t *alpha, int size, mlt_destructo return mlt_properties_set_data( MLT_FRAME_PROPERTIES( self ), alpha, alpha, size, destroy, NULL ); } +void* mlt_frame_get_alpha_data( mlt_frame self, int *size ) +{ + return mlt_properties_get_data( MLT_FRAME_PROPERTIES( self ), alpha, size ); +} + /** Replace image stack with the information provided. * * This might prove to be unreliable and restrictive - the idea is that a transition diff --git a/src/framework/mlt_frame.h b/src/framework/mlt_frame.h index 144d867..4eaf0ce 100644 --- a/src/framework/mlt_frame.h +++ b/src/framework/mlt_frame.h @@ -118,8 +118,10 @@ extern mlt_position mlt_frame_get_position( mlt_frame self ); extern int mlt_frame_set_position( mlt_frame self, mlt_position value ); extern int mlt_frame_set_image( mlt_frame self, uint8_t *image, int size, mlt_destructor destroy ); extern int mlt_frame_set_alpha( mlt_frame self, uint8_t *alpha, int size, mlt_destructor destroy ); +extern void* mlt_frame_get_alpha_data( mlt_frame self, int *size ); extern void mlt_frame_replace_image( mlt_frame self, uint8_t *image, mlt_image_format format, int width, int height ); extern int mlt_frame_get_image( mlt_frame self, uint8_t **buffer, mlt_image_format *format, int *width, int *height, int writable ); +extern void* mlt_frame_get_image_data( mlt_frame self, int *size ); extern uint8_t *mlt_frame_get_alpha_mask( mlt_frame self ); extern int mlt_frame_get_audio( mlt_frame self, void **buffer, mlt_audio_format *format, int *frequency, int *channels, int *samples ); extern int mlt_frame_set_audio( mlt_frame self, void *buffer, mlt_audio_format, int size, mlt_destructor ); -- 1.7.7.6 From 815d08b838e84afbbb4f74a08af394e2240c37b0 Mon Sep 17 00:00:00 2001 From: Maksym Veremeyenko ve...@m1stereo.tv Date: Tue, 14 Feb 2012 18:47:11 +0200 Subject: [PATCH 2/2] save converted image for next use --- src/modules/gtk2/producer_pixbuf.c | 80 +++ 1 files changed, 70 insertions(+), 10 deletions(-) diff --git a/src/modules/gtk2/producer_pixbuf.c b/src/modules/gtk2/producer_pixbuf.c index b7da50b..f2acc28 100644 --- a/src/modules/gtk2/producer_pixbuf.c +++ b/src/modules/gtk2/producer_pixbuf.c @@ -59,6 +59,13 @@ struct producer_pixbuf_s uint8_t *image; mlt_cache_item image_cache; pthread_mutex_t mutex; + struct + { + uint8_t *image; + uint8_t *alpha; + mlt_image_format format; + int size[2]; + } clone; }; static void load_filenames( producer_pixbuf self, mlt_properties producer_properties ); @@ -391,6 +398,11 @@ static void refresh_image( producer_pixbuf self, mlt_frame frame, int width, int int dst_stride = self-width * ( self-alpha ? 4 : 3 ); int image_size = dst_stride * ( height + 1 ); self-image = mlt_pool_alloc( image_size ); + if( self-clone.image ) + { + mlt_pool_release( self-clone.image ); + self-clone.image = NULL; + }; if ( src_stride != dst_stride ) { @@ -454,7 +466,8 @@ static void refresh_image( producer_pixbuf self, mlt_frame frame, int width, int static int producer_get_image( mlt_frame frame, uint8_t **buffer, mlt_image_format *format, int *width, int *height, int writable ) { int error = 0; - + mlt_image_format format_origin; + // Obtain properties of frame mlt_properties properties = MLT_FRAME_PROPERTIES( frame ); @@ -472,20 +485,67
Re: [Mlt-devel] [PATCH] use sse2 instruction for line compositing
15.02.12 05:33, Dan Dennedy написав(ла): [...] OK, very close! But there is still one problem I noticed. On some geometry widths, the right edge of the B frame image is chopped off. This is reproduced in demo/mlt_my_name_is. On the first title that reads My name is Inigo Montoya notice how the right side of 'a' is cropped. i can't reproduce it... did you apply patch completely? because newer version has dropped lines: + dest += j * 2; + src += j * 2; + alpha_a += j; + alpha_b += j; because that values been updated in asm code... -- Maksym Veremeyenko -- Virtualization Cloud Management Using Capacity Planning Cloud computing makes use of virtualization - but cloud computing also focuses on allowing computing to be delivered as a service. http://www.accelacomm.com/jaw/sfnl/114/51521223/ ___ Mlt-devel mailing list Mlt-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mlt-devel
Re: [Mlt-devel] no alpha channel for video with PIX_FMT_YUVA420P pixel format
02.02.12 19:03, Maksym Veremeyenko написав(ла): Hi, i am trying to decrease cpu usage, so i would like to use PIX_FMT_YUVA420P animation instead of PIX_FMT_BGRA (or other rgb with alpha channel) but has no luck.. i think i found where it should be fixed, now its clear why 32bit rgba formats not converted in avformat_producer but converted with alpha extracting later in convert_image in filter_avcolour_space.c -- Maksym Veremeyenko -- Virtualization Cloud Management Using Capacity Planning Cloud computing makes use of virtualization - but cloud computing also focuses on allowing computing to be delivered as a service. http://www.accelacomm.com/jaw/sfnl/114/51521223/ ___ Mlt-devel mailing list Mlt-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mlt-devel
Re: [Mlt-devel] [PATCH] save converted image for next use
15.02.12 20:49, Dan Dennedy написав(ла): 2012/2/14 Maksym Veremeyenkove...@m1stereo.tv: Hi, data for overlay image converted from RGBA to YUV422 for each frame. attached patch save converted image of *pixbuf* producer to avoid converting it to profile format each time it require to produce resulting frame. with that patch and previous SSE2 patches it possible to put full hd logo on video without dropped frame. it is draft version with leak on exit but it could answer the question if it is a right approach for solving problem with image converted to desired format once per frame instead of once per load/format_change. The idea is fine but not the patches. The first patch to mlt_frame is rejected because they are not really needed; use mlt_frame_get_alpha_mask and mlt_frame_get_image. API changes including additions are not taken lightly and need strong justification. These two just add confusion. problem is *mlt_frame_get_alpha_mask* function that generate fake alpha channel for frames without one. I had a plans to propose drop creating filled alpha plane with it function and just return NULL, but in the same time fix compositing function to care about 8 variants of alpha_a, alpha_b, weight values... i'll have a look on mlt_frame_get_image... In the pixbuf patch, you should not call the convert_image virtual function directly; use mlt_frame_get_image(). Unfortunately, mlt_frame_set_image lacks a format parameter. I forget why. For now, just set the format property. mlt_frame_get_alpha_mask() should probably have an out param. I will think about breaking API because there are other API changes coming in this release. For now, you will have to use a computed size for the alpha. Lastly, break clone.size apart into clone.image_size and clone.alpha_size for readability. such code could be added to pango and possibly other producers. May be it possible to provide another way for storing/cached converted/scaled images on upper level... -- Maksym Veremeyenko Senior System Administrator IT Department Ukrainian Music Television Channel M1 DDI. +380 44 205-44-92 Tel. +380 44 205-44-80 Fax. +380 44 205-44-82 Cell. +380-67-447-22-43 E-mail : maksym.veremeye...@m1stereo.tv Web site: www.m1stereo.tv -- Virtualization Cloud Management Using Capacity Planning Cloud computing makes use of virtualization - but cloud computing also focuses on allowing computing to be delivered as a service. http://www.accelacomm.com/jaw/sfnl/114/51521223/ ___ Mlt-devel mailing list Mlt-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mlt-devel
Re: [Mlt-devel] no alpha channel for video with PIX_FMT_YUVA420P pixel format
02.02.12 19:03, Maksym Veremeyenko написав(ла): Hi, i am trying to decrease cpu usage, so i would like to use PIX_FMT_YUVA420P animation instead of PIX_FMT_BGRA (or other rgb with alpha channel) but has no luck.. video with such pixel format in *nut* container has detected by ffmpeg properly, but mlt did not use it alpha channel. i can provide a sample if required... alpha been ignored for PIX_FMT_YUVA420P and PIX_FMT_YUVA444P pixel format. moreover current implementation of libswscale drop alpha channel if destination format has no alpha and not planar (even if buffer specified) attached patch extract alpha plane during image decoding. it works almost fine except moments when image fetched from cache (even if *noimagecache* specified). another problem is artifact that appear if last frame in movie is not transparent but producer specifies *out* out of animation. another attempt to fix this was to fix mlt_frame_clone (patch attached) but it has no luck too... -- Maksym Veremeyenko From 7efb254ffa82b34d289cf7a0bb574be061541259 Mon Sep 17 00:00:00 2001 From: Maksym Veremeyenko ve...@m1stereo.tv Date: Thu, 16 Feb 2012 17:44:40 +0200 Subject: [PATCH 1/2] alpha extracting from planar formats --- src/modules/avformat/producer_avformat.c | 36 +++-- 1 files changed, 28 insertions(+), 8 deletions(-) diff --git a/src/modules/avformat/producer_avformat.c b/src/modules/avformat/producer_avformat.c index 87b87af..8938fa4 100644 --- a/src/modules/avformat/producer_avformat.c +++ b/src/modules/avformat/producer_avformat.c @@ -1243,7 +1243,7 @@ static mlt_image_format pick_format( enum PixelFormat pix_fmt ) } static void convert_image( AVFrame *frame, uint8_t *buffer, int pix_fmt, - mlt_image_format *format, int width, int height, int colorspace ) + mlt_image_format *format, int width, int height, int colorspace, uint8_t **alpha ) { #ifdef SWSCALE int full_range = -1; @@ -1256,6 +1256,21 @@ static void convert_image( AVFrame *frame, uint8_t *buffer, int pix_fmt, flags |= SWS_CPU_CAPS_MMX2; #endif + /* extract alpha from planar formats */ + if ( ( pix_fmt == PIX_FMT_YUVA420P || pix_fmt == PIX_FMT_YUVA444P ) + *format != mlt_image_rgb24a *format != mlt_image_opengl + frame-data[3] frame-linesize[3] ) + { + int i; + uint8_t *src, *dst; + + dst = *alpha = mlt_pool_alloc( width * height ); + src = frame-data[3]; + + for(i = 0; i height; dst += width, src += frame-linesize[3], i++) + memcpy(dst, src, FFMIN(width, frame-linesize[3])); + } + if ( *format == mlt_image_yuv420p ) { struct SwsContext *context = sws_getContext( width, height, pix_fmt, @@ -1388,6 +1403,8 @@ static int producer_get_image( mlt_frame frame, uint8_t **buffer, mlt_image_form // Get codec context AVCodecContext *codec_context = stream-codec; + uint8_t *alpha = NULL; + // Get the image cache if ( ! self-image_cache ! mlt_properties_get_int( properties, noimagecache ) ) self-image_cache = mlt_cache_init(); @@ -1464,7 +1481,6 @@ static int producer_get_image( mlt_frame frame, uint8_t **buffer, mlt_image_form context = self-video_format; stream = context-streams[ self-video_index ]; codec_context = stream-codec; - if ( *format == mlt_image_none || codec_context-pix_fmt == PIX_FMT_ARGB || codec_context-pix_fmt == PIX_FMT_RGBA || @@ -1495,12 +1511,12 @@ static int producer_get_image( mlt_frame frame, uint8_t **buffer, mlt_image_form picture.linesize[1] = codec_context-width / 2; picture.linesize[2] = codec_context-width / 2; convert_image( (AVFrame*) picture, *buffer, - PIX_FMT_YUV420P, format, *width, *height, self-colorspace ); + PIX_FMT_YUV420P, format, *width, *height, self-colorspace, alpha ); } else #endif convert_image( self-av_frame, *buffer, codec_context-pix_fmt, -format, *width, *height, self-colorspace ); +format, *width, *height, self-colorspace, alpha ); } else mlt_frame_get_image( frame, buffer, format, width, height, writable ); @@ -1690,7 +1706,7 @@ static int producer_get_image( mlt_frame frame, uint8_t **buffer, mlt_image_form if ( status == VDP_STATUS_OK ) { convert_image( self-av_frame, *buffer, PIX_FMT_YUV420P, - format, *width, *height, self-colorspace ); + format, *width, *height, self-colorspace, alpha ); } else { @@ -1707,7 +1723,7 @@ static int producer_get_image( mlt_frame frame, uint8_t **buffer, mlt_image_form else #endif convert_image( self-av_frame, *buffer, codec_context-pix_fmt, - format, *width, *height, self-colorspace ); + format, *width, *height, self-colorspace, alpha ); self-top_field_first |= self-av_frame-top_field_first; self-current_position = int_position; self-got_picture = 1; @@ -1749,12 +1765,12 @@ static int producer_get_image( mlt_frame frame, uint8_t **buffer, mlt_image_form picture.linesize[1
Re: [Mlt-devel] [PATCH] use sse2 instruction for line compositing
15.02.12 20:33, Dan Dennedy написав(ла): 2012/2/15 Maksym Veremeyenkove...@m1stereo.tv: 15.02.12 05:33, Dan Dennedy написав(ла): [...] OK, very close! But there is still one problem I noticed. On some geometry widths, the right edge of the B frame image is chopped off. This is reproduced in demo/mlt_my_name_is. On the first title that reads My name is Inigo Montoya notice how the right side of 'a' is cropped. i can't reproduce it... Look real closely - it occurs more at the beginning when the geometry is smaller. I can switch between the branch with this patch and master and see it is different. did you apply patch completely? because newer version has dropped lines: + dest += j * 2; + src += j * 2; + alpha_a += j; + alpha_b += j; because that values been updated in asm code... yes, just double-checked. I will see if I can figure it out this weekend because it always nice to refresh myself on some simd asm. seems problem in last 1..7 pixel of rows processed. may be gcc specific issue and values dest src alpha_a alpha_b should be sent to asm function throw stack copy -- Maksym Veremeyenko -- Virtualization Cloud Management Using Capacity Planning Cloud computing makes use of virtualization - but cloud computing also focuses on allowing computing to be delivered as a service. http://www.accelacomm.com/jaw/sfnl/114/51521223/ ___ Mlt-devel mailing list Mlt-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mlt-devel
Re: [Mlt-devel] [PATCH] save converted image for next use
16.02.12 18:54, Dan Dennedy написав(ла): 2012/2/16 Maksym Veremeyenkove...@m1stereo.tv: 15.02.12 20:49, Dan Dennedy написав(ла): 2012/2/14 Maksym Veremeyenkove...@m1stereo.tv: Hi, data for overlay image converted from RGBA to YUV422 for each frame. attached patch save converted image of *pixbuf* producer to avoid converting it to profile format each time it require to produce resulting frame. with that patch and previous SSE2 patches it possible to put full hd logo on video without dropped frame. it is draft version with leak on exit but it could answer the question if it is a right approach for solving problem with image converted to desired format once per frame instead of once per load/format_change. The idea is fine but not the patches. The first patch to mlt_frame is rejected because they are not really needed; use mlt_frame_get_alpha_mask and mlt_frame_get_image. API changes including additions are not taken lightly and need strong justification. These two just add confusion. problem is *mlt_frame_get_alpha_mask* function that generate fake alpha channel for frames without one. I had a plans to propose drop creating filled alpha plane with it function and just return NULL, but in the same That is a high impact change that requires analyzing every call to the function, and fixing and testing its impact. if you decide to break API that will be a good chance to implement that feature and fix possible regression caused by that improvement... time fix compositing function to care about 8 variants of alpha_a, alpha_b, weight values... i'll have a look on mlt_frame_get_image... In the pixbuf patch, you should not call the convert_image virtual function directly; use mlt_frame_get_image(). Unfortunately, mlt_frame_set_image lacks a format parameter. I forget why. For now, just set the format property. mlt_frame_get_alpha_mask() should probably have an out param. I will think about breaking API because there are other API changes coming in this release. For now, you will have to use a computed size for the alpha. Lastly, break clone.size apart into clone.image_size and clone.alpha_size for readability. such code could be added to pango and possibly other producers. May be it possible to provide another way for storing/cached converted/scaled images on upper level... I thought about that, and it makes some sense. The upper level does not understand when the image changes - only the producer knows this. Of course, the producer could set a flag to indicate the image changed or fire an event that causes the caching mechanism to flush. I will think about it more. what if after receiving frame consumer makes a clone with all properties and during requesting new frame sent it back, so all filters and producer could check if frame need to be updated... -- Maksym Veremeyenko -- Virtualization Cloud Management Using Capacity Planning Cloud computing makes use of virtualization - but cloud computing also focuses on allowing computing to be delivered as a service. http://www.accelacomm.com/jaw/sfnl/114/51521223/ ___ Mlt-devel mailing list Mlt-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mlt-devel
Re: [Mlt-devel] [PATCH] use sse2 instruction for line compositing
15.02.12 20:33, Dan Dennedy написав(ла): [...] Look real closely - it occurs more at the beginning when the geometry is smaller. I can switch between the branch with this patch and master and see it is different. another one attempt. the only things i have a doubt is xmm register clobber list, currently comment out... -- Maksym Veremeyenko From 45c8b653808e8bee5c832095f37cac1f193404f0 Mon Sep 17 00:00:00 2001 From: Maksym Veremeyenko ve...@m1stereo.tv Date: Thu, 16 Feb 2012 19:10:00 +0200 Subject: [PATCH] use sse2 instruction for line compositing --- src/modules/core/composite_line_yuv_sse2_simple.c | 167 + src/modules/core/transition_composite.c | 19 ++- 2 files changed, 184 insertions(+), 2 deletions(-) create mode 100644 src/modules/core/composite_line_yuv_sse2_simple.c diff --git a/src/modules/core/composite_line_yuv_sse2_simple.c b/src/modules/core/composite_line_yuv_sse2_simple.c new file mode 100644 index 000..2ed4801 --- /dev/null +++ b/src/modules/core/composite_line_yuv_sse2_simple.c @@ -0,0 +1,167 @@ +void composite_line_yuv_sse2_simple(uint8_t *dest, uint8_t *src, int width, uint8_t *alpha_b, uint8_t *alpha_a, int weight) +{ +const static unsigned char const1[] = +{ +0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00 +}; + +__asm__ volatile +( +pxor %%xmm0, %%xmm0 \n\t /* clear zero register */ +movdqu (%4), %%xmm9\n\t /* load const1 */ +movd %0, %%xmm1 \n\t /* load weight and decompose */ +movlhps%%xmm1, %%xmm1 \n\t +pshuflw$0, %%xmm1, %%xmm1 \n\t +pshufhw$0, %%xmm1, %%xmm1 \n\t + +/* +xmm1 (weight) + +00 W 00 W 00 W 00 W 00 W 00 W 00 W 00 W +*/ +loop_start:\n\t +movq (%1), %%xmm2\n\t /* load source alpha */ +punpcklbw %%xmm0, %%xmm2 \n\t /* unpack alpha 8 8-bits alphas to 8 16-bits values */ + +/* +xmm2 (src alpha) +xmm3 (dst alpha) + +00 A8 00 A7 00 A6 00 A5 00 A4 00 A3 00 A2 00 A1 +*/ +pmullw %%xmm1, %%xmm2 \n\t /* premultiply source alpha */ +psrlw $8, %%xmm2 \n\t + +/* +xmm2 (premultiplied) + +00 A8 00 A7 00 A6 00 A5 00 A4 00 A3 00 A2 00 A1 +*/ + + +/* +DSTa = DSTa + (SRCa * (0xFF - DSTa)) 8 +*/ +movq (%5), %%xmm3\n\t /* load dst alpha */ +punpcklbw %%xmm0, %%xmm3 \n\t /* unpack dst 8 8-bits alphas to 8 16-bits values */ +movdqa %%xmm9, %%xmm4 \n\t +psubw %%xmm3, %%xmm4 \n\t +pmullw %%xmm2, %%xmm4 \n\t +psrlw $8, %%xmm4 \n\t +paddw %%xmm4, %%xmm3 \n\t +packuswb %%xmm0, %%xmm3 \n\t +movq %%xmm3, (%5)\n\t /* save dst alpha */ + +movdqu (%2), %%xmm3\n\t /* load src */ +movdqu (%3), %%xmm4\n\t /* load dst */ +movdqa %%xmm3, %%xmm5 \n\t /* dub src */ +movdqa %%xmm4, %%xmm6 \n\t /* dub dst */ + +/* +xmm3 (src) +xmm4 (dst) +xmm5 (src) +xmm6 (dst) + +U8 V8 U7 V7 U6 V6 U5 V5 U4 V4 U3 V3 U2 V2 U1 V1 +*/ + +punpcklbw %%xmm0, %%xmm5 \n\t /* unpack src low */ +punpcklbw %%xmm0, %%xmm6 \n\t /* unpack dst low */ +punpckhbw %%xmm0, %%xmm3 \n\t /* unpack src high */ +punpckhbw %%xmm0, %%xmm4 \n\t /* unpack dst high */ + +/* +xmm5 (src_l) +xmm6 (dst_l) + +00 U4 00 V4 00 U3 00 V3 00 U2 00 V2 00 U1 00 V1 + +xmm3 (src_u) +xmm4 (dst_u) + +00 U8 00 V8 00 U7 00 V7 00 U6 00 V6 00 U5 00 V5 +*/ + +movdqa %%xmm2, %%xmm7 \n\t /* dub alpha */ +movdqa %%xmm2, %%xmm8 \n\t /* dub alpha */ +movlhps%%xmm7, %%xmm7 \n\t /* dub low */ +movhlps%%xmm8, %%xmm8 \n\t /* dub high */ + +/* +xmm7 (src alpha) + +00 A4 00 A3 00 A2 00 A1 00 A4 00 A3 00 A2 00 A1 +xmm8 (src alpha) + +00 A8 00 A7 00 A6 00 A5 00 A8 00 A7 00 A6 00 A5 +*/ + +pshuflw$0x50, %%xmm7, %%xmm7 \n\t +pshuflw$0x50, %%xmm8, %%xmm8 \n\t +pshufhw$0xFA
[Mlt-devel] rounding problem
Hi, during working with line compositing function i faced a strange value for *weight* parameter - 65534 that value is a rounding problem that flag fast-math used. i prepared small code: #include stdio.h int main() { float mix = 100.0f; int r1 = ((1 16) - 1) * mix / 100; int r2 = (((1 16) - 1) * mix + 50 ) / 100; int r3 = 65535.0f * mix / 100.0f; printf(r1=%d, r2=%d, r3=%d\n, r1, r2, r3); }; compiling running examples: [root@dev-5 core]# gcc -o q -ffast-math q.c [root@dev-5 core]# ./q r1=65534, r2=65535, r3=65534 [root@dev-5 core]# ./q r1=65535, r2=65535, r3=65535 may be it has a sense to fix such rounding issues: - 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 ); -- Maksym Veremeyenko -- Virtualization Cloud Management Using Capacity Planning Cloud computing makes use of virtualization - but cloud computing also focuses on allowing computing to be delivered as a service. http://www.accelacomm.com/jaw/sfnl/114/51521223/ ___ Mlt-devel mailing list Mlt-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mlt-devel
Re: [Mlt-devel] rounding problem
16.02.12 19:50, Maksym Veremeyenko написав(ла): [...] [root@dev-5 core]# gcc -o q -ffast-math q.c [root@dev-5 core]# ./q r1=65534, r2=65535, r3=65534 [root@dev-5 core]# gcc -o q q.c [root@dev-5 core]# ./q r1=65535, r2=65535, r3=65535 -- Maksym Veremeyenko -- Virtualization Cloud Management Using Capacity Planning Cloud computing makes use of virtualization - but cloud computing also focuses on allowing computing to be delivered as a service. http://www.accelacomm.com/jaw/sfnl/114/51521223/ ___ Mlt-devel mailing list Mlt-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mlt-devel
Re: [Mlt-devel] no alpha channel for video with PIX_FMT_YUVA420P pixel format
16.02.12 18:56, Dan Dennedy написав(ла): 2012/2/16 Maksym Veremeyenkove...@m1stereo.tv: 02.02.12 19:03, Maksym Veremeyenko написав(ла): Hi, i am trying to decrease cpu usage, so i would like to use PIX_FMT_YUVA420P animation instead of PIX_FMT_BGRA (or other rgb with alpha channel) but has no luck.. video with such pixel format in *nut* container has detected by ffmpeg properly, but mlt did not use it alpha channel. i can provide a sample if required... alpha been ignored for PIX_FMT_YUVA420P and PIX_FMT_YUVA444P pixel format. moreover current implementation of libswscale drop alpha channel if destination format has no alpha and not planar (even if buffer specified) attached patch extract alpha plane during image decoding. it works almost fine except moments when image fetched from cache (even if *noimagecache* specified). another problem is artifact that appear if last frame in movie is not transparent but producer specifies *out* out of animation. another attempt to fix this was to fix mlt_frame_clone (patch attached) but it has no luck too... OK, thank you for the start of this effort. I will look at it this weekend. attached updated version that works with cache. second patch is optional but could be usefull if frame with alpha been cloned. -- Maksym Veremeyenko From d13a842181a9bc55c40b84af9c385ddbd0965987 Mon Sep 17 00:00:00 2001 From: Maksym Veremeyenko ve...@m1stereo.tv Date: Fri, 17 Feb 2012 12:01:40 +0200 Subject: [PATCH] alpha extracting from planar formats --- src/modules/avformat/producer_avformat.c | 59 ++ 1 files changed, 51 insertions(+), 8 deletions(-) diff --git a/src/modules/avformat/producer_avformat.c b/src/modules/avformat/producer_avformat.c index 87b87af..f58e287 100644 --- a/src/modules/avformat/producer_avformat.c +++ b/src/modules/avformat/producer_avformat.c @@ -115,6 +115,7 @@ struct producer_avformat_s unsigned int invalid_pts_counter; double resample_factor; mlt_cache image_cache; + mlt_cache alpha_cache; int colorspace; pthread_mutex_t video_mutex; pthread_mutex_t audio_mutex; @@ -1243,7 +1244,7 @@ static mlt_image_format pick_format( enum PixelFormat pix_fmt ) } static void convert_image( AVFrame *frame, uint8_t *buffer, int pix_fmt, - mlt_image_format *format, int width, int height, int colorspace ) + mlt_image_format *format, int width, int height, int colorspace, uint8_t **alpha ) { #ifdef SWSCALE int full_range = -1; @@ -1256,6 +1257,21 @@ static void convert_image( AVFrame *frame, uint8_t *buffer, int pix_fmt, flags |= SWS_CPU_CAPS_MMX2; #endif + /* extract alpha from planar formats */ + if ( ( pix_fmt == PIX_FMT_YUVA420P || pix_fmt == PIX_FMT_YUVA444P ) + *format != mlt_image_rgb24a *format != mlt_image_opengl + frame-data[3] frame-linesize[3] ) + { + int i; + uint8_t *src, *dst; + + dst = *alpha = mlt_pool_alloc( width * height ); + src = frame-data[3]; + + for(i = 0; i height; dst += width, src += frame-linesize[3], i++) + memcpy(dst, src, FFMIN(width, frame-linesize[3])); + } + if ( *format == mlt_image_yuv420p ) { struct SwsContext *context = sws_getContext( width, height, pix_fmt, @@ -1388,9 +1404,14 @@ static int producer_get_image( mlt_frame frame, uint8_t **buffer, mlt_image_form // Get codec context AVCodecContext *codec_context = stream-codec; + uint8_t *alpha = NULL; + // Get the image cache if ( ! self-image_cache ! mlt_properties_get_int( properties, noimagecache ) ) + { self-image_cache = mlt_cache_init(); + self-alpha_cache = mlt_cache_init(); + } if ( self-image_cache ) { mlt_cache_item item = mlt_cache_get( self-image_cache, (void*) position ); @@ -1422,6 +1443,16 @@ static int producer_get_image( mlt_frame frame, uint8_t **buffer, mlt_image_form } self-got_picture = 1; + /* check for alpha */ + item = mlt_cache_get( self-alpha_cache, (void*) position ); + original = mlt_cache_item_data( item, size ); + if( original ) + { +alpha = mlt_pool_alloc( size ); +memcpy( alpha, original, size ); +mlt_cache_item_close( item ); + } + goto exit_get_image; } } @@ -1464,7 +1495,6 @@ static int producer_get_image( mlt_frame frame, uint8_t **buffer, mlt_image_form context = self-video_format; stream = context-streams[ self-video_index ]; codec_context = stream-codec; - if ( *format == mlt_image_none || codec_context-pix_fmt == PIX_FMT_ARGB || codec_context-pix_fmt == PIX_FMT_RGBA || @@ -1495,12 +1525,12 @@ static int producer_get_image( mlt_frame frame, uint8_t **buffer, mlt_image_form picture.linesize[1] = codec_context-width / 2; picture.linesize[2] = codec_context-width / 2; convert_image( (AVFrame*) picture, *buffer, - PIX_FMT_YUV420P, format, *width, *height, self-colorspace ); + PIX_FMT_YUV420P, format, *width, *height, self-colorspace, alpha ); } else #endif convert_image( self-av_frame, *buffer
Re: [Mlt-devel] [PATCH] save converted image for next use
15.02.12 20:49, Dan Dennedy написав(ла): [...] In the pixbuf patch, you should not call the convert_image virtual function directly; use mlt_frame_get_image(). use mlt_frame_get_image for converting image did not work - call to that function return blank frame... i updated patch and added the same functionality to pango producer, but calling convert_image virtual function directly left till i find another way to convert it... -- Maksym Veremeyenko From 061535dd2d7675cbb7596f3be0ff4a7c1fc272ac Mon Sep 17 00:00:00 2001 From: Maksym Veremeyenko ve...@m1stereo.tv Date: Fri, 17 Feb 2012 16:17:32 +0200 Subject: [PATCH 1/2] save converted frame of pixbuf producer --- src/modules/gtk2/producer_pixbuf.c | 74 +++- 1 files changed, 64 insertions(+), 10 deletions(-) diff --git a/src/modules/gtk2/producer_pixbuf.c b/src/modules/gtk2/producer_pixbuf.c index b7da50b..3adce16 100644 --- a/src/modules/gtk2/producer_pixbuf.c +++ b/src/modules/gtk2/producer_pixbuf.c @@ -59,8 +59,24 @@ struct producer_pixbuf_s uint8_t *image; mlt_cache_item image_cache; pthread_mutex_t mutex; + struct + { + uint8_t *image, *alpha; + int image_size, alpha_size; + mlt_image_format format; + } clone; }; +static void clean_clone( producer_pixbuf self ) +{ + if ( self-clone.image ) + mlt_pool_release( self-clone.image ); + self-clone.image = NULL; + if ( self-clone.alpha ) + mlt_pool_release( self-clone.alpha ); + self-clone.alpha = NULL; +} + static void load_filenames( producer_pixbuf self, mlt_properties producer_properties ); static void refresh_image( producer_pixbuf self, mlt_frame frame, int width, int height ); static int producer_get_frame( mlt_producer parent, mlt_frame_ptr frame, int index ); @@ -391,6 +407,7 @@ static void refresh_image( producer_pixbuf self, mlt_frame frame, int width, int int dst_stride = self-width * ( self-alpha ? 4 : 3 ); int image_size = dst_stride * ( height + 1 ); self-image = mlt_pool_alloc( image_size ); + clean_clone( self ); if ( src_stride != dst_stride ) { @@ -454,7 +471,8 @@ static void refresh_image( producer_pixbuf self, mlt_frame frame, int width, int static int producer_get_image( mlt_frame frame, uint8_t **buffer, mlt_image_format *format, int *width, int *height, int writable ) { int error = 0; - + mlt_image_format format_origin; + // Obtain properties of frame mlt_properties properties = MLT_FRAME_PROPERTIES( frame ); @@ -472,20 +490,55 @@ static int producer_get_image( mlt_frame frame, uint8_t **buffer, mlt_image_form // Get width and height (may have changed during the refresh) *width = self-width; *height = self-height; - *format = self-alpha ? mlt_image_rgb24a : mlt_image_rgb24; + format_origin = self-alpha ? mlt_image_rgb24a : mlt_image_rgb24; + if ( mlt_image_none == *format) + *format = format_origin; // NB: Cloning is necessary with this producer (due to processing of images ahead of use) // The fault is not in the design of mlt, but in the implementation of the pixbuf producer... if ( self-image ) { - // Clone the image - int image_size = self-width * self-height * ( self-alpha ? 4 :3 ); - uint8_t *image_copy = mlt_pool_alloc( image_size ); - memcpy( image_copy, self-image, image_size ); - // Now update properties so we free the copy after - mlt_frame_set_image( frame, image_copy, image_size, mlt_pool_release ); - // We're going to pass the copy on - *buffer = image_copy; + int size; + uint8_t* image; + + if ( self-clone.image self-clone.format == *format) + { + image = mlt_pool_alloc( self-clone.image_size ); + memcpy( image, self-clone.image, self-clone.image_size ); + mlt_frame_set_image( frame, image, self-clone.image_size, mlt_pool_release ); + *buffer = image; + if ( self-clone.alpha ) + { +image = mlt_pool_alloc( self-clone.alpha_size ); +memcpy( image, self-clone.alpha, self-clone.alpha_size ); +mlt_frame_set_alpha( frame, image, self-clone.alpha_size, mlt_pool_release ); + }; + } + else + { + clean_clone( self ); + size = self-width * self-height * ( self-alpha ? 4 :3 ); + image = mlt_pool_alloc( size ); + memcpy( image, self-image, size ); + if(frame-convert_image format_origin != *format) + { +frame-convert_image( frame, image, format_origin, *format ); +*format = format_origin; + } + mlt_frame_set_image( frame, image, size, mlt_pool_release ); + *buffer = image; + self-clone.format = *format; + self-clone.image_size = mlt_image_format_size( *format, *width, *height, NULL ); + self-clone.image = mlt_pool_alloc( self-clone.image_size ); + memcpy(self-clone.image, image, self-clone.image_size); + image = mlt_frame_get_alpha_mask(frame); + if ( image ) + { +self-clone.alpha_size = (*width) * (*height); +self-clone.alpha = mlt_pool_alloc( self-clone.alpha_size ); +memcpy(self-clone.alpha, image, self-clone.alpha_size
Re: [Mlt-devel] [PATCH] allow start decklink producer from pause
21.02.12 01:04, Dan Dennedy написав(ла): 2012/2/20 Maksym Veremeyenkove...@m1stereo.tv: Hi, because of decklink board has no native EE mode for monitoring signal passthrow it only chance to start recording from proper position is pausing producer. attached patch could solve a problem then you need to start /recording/ by unpausing producer in a chain producer_decklink -- consumer_avformat.c This is harmless enough that I applied it, but can you elaborate more about the approach? decklink board has no EE mode, i.e. you can't seen SDI signal pass throw until you setup decklink into the recoding mode. So if you need to start recording from a proper moment you see on decklink output, you need to unpause it. but it not so simple because if you set speed 0.0 to producer, it still send a frames to avformat consumer (moreover it exit encoding thread if *terminate_on_pause* not disabled or just mute and encode incoming frames), so if you have a /black box/ with SDI inputs and outputs and IP control - that is an only method... If you are connected to the avformat consumer for file capture, how are you providing preview? passthrow SDI output I would think you would have it connected to another consumer, like SDL, during preview, and then connect it to the avformat consumer for capture with no pausing the producer in between. Unless perhaps you are using the multi consumer. thanks to idea... btw, are there any samples for this functionality? it is like *tie* ? -- Maksym Veremeyenko -- Keep Your Developer Skills Current with LearnDevNow! The most comprehensive online learning library for Microsoft developers is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, Metro Style Apps, more. Free future releases when you subscribe now! http://p.sf.net/sfu/learndevnow-d2d ___ Mlt-devel mailing list Mlt-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mlt-devel
[Mlt-devel] decklink device enumerating cause a problem
Hi, after recent patch for decklink producer and consumer i found a strange behavior when first decklink working in play mode (process X) and second decklink works in play-record-play mode (process Y). Either some race condition or kind of deadlock happens on a driver level. For some reason code line: 126 if ( m_deckLink-QueryInterface( IID_IDeckLinkOutput, (void**) m_deckLinkOutput ) == S_OK ) start thread: (gdb) bt #0 0x003ec22e8217 in ioctl () from /lib64/libc.so.6 #1 0x7f1946d0743c in WaitForNotificationEvents () from /usr/lib64/libDeckLinkAPI.so #2 0x7f1946ca2633 in CDeckLinkOutput::DriverNotificationThread() () from /usr/lib64/libDeckLinkAPI.so #3 0x7f1946ca2709 in CDeckLinkOutput::DriverNotificationThreadFunction(void*) () from /usr/lib64/libDeckLinkAPI.so #4 0x003ec2607d90 in start_thread () from /lib64/libpthread.so.0 #5 0x003ec22ef48d in clone () from /lib64/libc.so.6 that stall next line that release m_deckLinkOutput: #0 0x003ec2609080 in pthread_join () from /lib64/libpthread.so.0 #1 0x7f8346a37b04 in CDeckLinkOutput::~CDeckLinkOutput() () from /usr/lib64/libDeckLinkAPI.so #2 0x7f8346a20cca in CDeckLink::~CDeckLink() () from /usr/lib64/libDeckLinkAPI.so #3 0x7f8346a2072f in CDeckLink::Release() () from /usr/lib64/libDeckLinkAPI.so #4 0x7f8346a48c01 in CDeckLink_v8_0::~CDeckLink_v8_0() () from /usr/lib64/libDeckLinkAPI.so #5 0x7f8346a48ea7 in CDeckLink_v8_0::Release() () from /usr/lib64/libDeckLinkAPI.so #6 0x7f834e1ee5cb in listDevices (properties=0x7f82ec016768, this=0x7f82ec016760) at consumer_decklink.cpp:142 First i revised all decklink pointers for any leak: 0001-care-about-NULL-pointers.patch but that do not helps, so i checked mode iteration loop: 0002-make-sure-all-is-release-in-mode-iteration-loop.patch but the cure was to disable device listing: 0003-make-device-listing-only-if-list_devices-property-se.patch i dont know if it driver bug or some arch specific behaviour, but that patches is an only way for me to provide stable decklink operation... -- Maksym Veremeyenko From 5ec0801c361a58628038c0ed9b334ae5086c36fc Mon Sep 17 00:00:00 2001 From: Maksym Veremeyenko ve...@m1stereo.tv Date: Sat, 17 Mar 2012 15:53:40 +0100 Subject: [PATCH 1/3] care about NULL pointers --- src/modules/decklink/consumer_decklink.cpp | 74 ++- src/modules/decklink/producer_decklink.cpp | 49 +++ 2 files changed, 67 insertions(+), 56 deletions(-) diff --git a/src/modules/decklink/consumer_decklink.cpp b/src/modules/decklink/consumer_decklink.cpp index 8645506..dceccdc 100644 --- a/src/modules/decklink/consumer_decklink.cpp +++ b/src/modules/decklink/consumer_decklink.cpp @@ -33,6 +33,8 @@ #include DeckLinkAPI.h #endif +#define SAFE_RELEASE(V) if (V) { V-Release(); V = NULL; } + static const unsigned PREROLL_MINIMUM = 3; class DeckLinkConsumer @@ -92,15 +94,19 @@ private: public: mlt_consumer getConsumer() { return m_consumer; } - + + DeckLinkConsumer() + { + m_deckLinkKeyer = NULL; + m_deckLinkOutput = NULL; + m_deckLink = NULL; + } + ~DeckLinkConsumer() { - if ( m_deckLinkKeyer ) - m_deckLinkKeyer-Release(); - if ( m_deckLinkOutput ) - m_deckLinkOutput-Release(); - if ( m_deckLink ) - m_deckLink-Release(); + SAFE_RELEASE( m_deckLinkKeyer ); + SAFE_RELEASE( m_deckLinkOutput ); + SAFE_RELEASE( m_deckLink ); } bool listDevices( mlt_properties properties ) @@ -137,11 +143,11 @@ public: free( key ); free( name ); } - m_deckLinkOutput-Release(); + SAFE_RELEASE( m_deckLinkOutput ); } -m_deckLink-Release(); +SAFE_RELEASE( m_deckLink ); } - decklinkIterator-Release(); + SAFE_RELEASE( decklinkIterator ); mlt_properties_set_int( properties, devices, i ); mlt_log_verbose( NULL, [consumer decklink] devices = %d\n, i ); @@ -149,8 +155,7 @@ public: } catch ( const char *error ) { - if ( decklinkIterator ) -decklinkIterator-Release(); + SAFE_RELEASE( decklinkIterator ); mlt_log_error( getConsumer(), %s\n, error ); return false; } @@ -182,30 +187,32 @@ public: return false; } #endif - + // Connect to the Nth DeckLink instance - do { - if ( deckLinkIterator-Next( m_deckLink ) != S_OK ) - { -mlt_log_error( getConsumer(), DeckLink card not found\n ); -deckLinkIterator-Release(); -return false; - } - } while ( ++i = card ); - deckLinkIterator-Release(); - + for ( i = 0; deckLinkIterator-Next( m_deckLink ) == S_OK ; i++) + { + if(i == card) +break; + else +SAFE_RELEASE( m_deckLink ); + } + SAFE_RELEASE( deckLinkIterator ); + if( !m_deckLink ) + { + mlt_log_error( getConsumer(), DeckLink card not found\n ); + return false; + } + // Obtain the audio/video output interface (IDeckLinkOutput) if ( m_deckLink
[Mlt-devel] scaler problem
Hi, converted image with melt has some strange artifact. # result broken image: /usr/local/mltframework.org/mlt/bin/melt -verbose -profile dv_pal -producer avformat:/home/studio/Videos/TheCore/hd/meta/test0002.mov.png in=1 out=1 -consumer avformat:/var/www/html/test_dv_pal.png vcodec=png f=image2 s=320x240 # result normal image: /usr/local/mltframework.org/mlt/bin/melt -verbose -profile square_pal -producer avformat:/home/studio/Videos/TheCore/hd/meta/test0002.mov.png in=1 out=1 -consumer avformat:/var/www/html/test_square_pal.png vcodec=png f=image2 s=320x240 source and resulting file could be downloaded from: http://downloads.m1stereo.tv/324c3cef50a05a05d2583456a1c6b21f/test0002.mov.png http://downloads.m1stereo.tv/324c3cef50a05a05d2583456a1c6b21f/test_dv_pal.png http://downloads.m1stereo.tv/324c3cef50a05a05d2583456a1c6b21f/test_square_pal.png mlt from git, ffmpeg from git, 64-bit linux... -- Maksym Veremeyenko -- This SF email is sponsosred by: Try Windows Azure free for 90 days Click Here http://p.sf.net/sfu/sfd2d-msazure ___ Mlt-devel mailing list Mlt-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mlt-devel
Re: [Mlt-devel] decklink device enumerating cause a problem
19.03.12 18:58, Dan Dennedy написав(ла): 2012/3/19 Maksym Veremeyenkove...@m1stereo.tv: Hi, after recent patch for decklink producer and consumer i found a strange behavior when first decklink working in play mode (process X) and second decklink works in play-record-play mode (process Y). Either some race condition or kind of deadlock happens on a driver level. For some reason code line: hmm, might be even worse when trying to use decklink producer and consumer in the same process! i used, but not simultaneously. it switch from avformat - decklink to decklink - avformat and seems working stable if device listing will be avoided... but the cure was to disable device listing: 0003-make-device-listing-only-if-list_devices-property-se.patch The only small problem I have with this is that it requires the app to start the consumer or fetch a frame from the producer in order to get the information. I can make a small improvement to this patch that establishes a property-changed event listener so that the enumeration occurs once when list_devices property is set, which is a little more convenient. as you prefer.. -- Maksym Veremeyenko -- This SF email is sponsosred by: Try Windows Azure free for 90 days Click Here http://p.sf.net/sfu/sfd2d-msazure ___ Mlt-devel mailing list Mlt-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mlt-devel
Re: [Mlt-devel] [PATCH] inherite producer properties defined by uset
23.04.12 16:05, Maksym Veremeyenko написав(ла): Hi, attached patch allows setting properties for producer that is element of playlist. using syntax: uset u0 producer.audio_index=all allow set this properties to created producer instead of playlist... ping? -- Maksym Veremeyenko -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ ___ Mlt-devel mailing list Mlt-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mlt-devel
Re: [Mlt-devel] [PATCH] inherite producer properties defined by uset
16.05.12 19:20, Dan Dennedy написав(ла): On Wed, May 16, 2012 at 1:48 AM, Maksym Veremeyenkove...@m1stereo.tv wrote: 23.04.12 16:05, Maksym Veremeyenko написав(ла): Hi, attached patch allows setting properties for producer that is element of playlist. using syntax: uset u0 producer.audio_index=all allow set this properties to created producer instead of playlist... ping? I was out of town for a while, and focusing on other things. Before I look at the patch, how does this behave logically? A playlist is a producer. So, if this just affects the playlist as producer, it seems superfluous. Otherwise, which entry of the playlist does this affect? As it stands, it looks ambiguous. it set properties for each/per playlist item producer. -- Maksym Veremeyenko -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ ___ Mlt-devel mailing list Mlt-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mlt-devel
Re: [Mlt-devel] thumbnail creating hint
13.04.12 14:16, Maksym Veremeyenko написав(ла): Hi, i have a problem creating thumbnail from videofile. *melt* command line works fine: /usr/local/mltframework.org/mlt/bin/melt -profile dv_pal R0009178.mpg in=100 out=100 -consumer avformat:R0009178.png s=128x72 vcodec=png f=image2 but program code sample do not work properly: #includestdlib.h #includesys/types.h #includeunistd.h #includestring.h #includeerrno.h #includeframework/mlt.h int main(int argc, char** argv) { mlt_consumer consumer; mlt_producer producer; mlt_profile profile; mlt_properties c_props, p_props; if(3 != argc) return 1; mlt_factory_init(NULL); profile = mlt_profile_init(dv_pal); producer = mlt_factory_producer(profile, NULL, argv[1]); consumer = mlt_factory_consumer(profile, avformat, argv[2]); c_props = mlt_consumer_properties(consumer); p_props = mlt_producer_properties(producer); mlt_properties_set_int(p_props, in, 100); mlt_properties_set_int(p_props, out, 100); mlt_properties_set(c_props, s, 96x72); mlt_properties_set(c_props, vcodec, png); mlt_properties_set(c_props, f, image2); mlt_consumer_connect(consumer, mlt_producer_service(producer)); mlt_consumer_start(consumer); while(!mlt_consumer_is_stopped(consumer)) usleep(40); mlt_consumer_stop(consumer); mlt_consumer_close(consumer); mlt_producer_close(producer); mlt_profile_close(profile); return 0; }; it output always first frame, so setting in/out does not help... any hint? ping? -- Maksym Veremeyenko -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ ___ Mlt-devel mailing list Mlt-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mlt-devel
[Mlt-devel] [PATCH] extend melted with file probe command
hi, attached set of patches extend melted functionality with PROBE command that return information for specified file how it /supported/ by mlt framework. it gives a chance to check if file is OK before adding one to playlist. -- Maksym Veremeyenko From eeba3de17cda7f4ffc8a036cb9e3d69d9e1e2855 Mon Sep 17 00:00:00 2001 From: Maksym Veremeyenko ve...@m1stereo.tv Date: Tue, 3 Jul 2012 14:05:53 +0300 Subject: [PATCH 1/3] implement PROBE command --- src/melted/melted_commands.c | 36 src/melted/melted_commands.h |1 + src/melted/melted_local.c|1 + 3 files changed, 38 insertions(+), 0 deletions(-) diff --git a/src/melted/melted_commands.c b/src/melted/melted_commands.c index c865a3d..45dc0d0 100644 --- a/src/melted/melted_commands.c +++ b/src/melted/melted_commands.c @@ -184,6 +184,42 @@ response_codes melted_list_clips( command_argument cmd_arg ) return error; } +/** Probe open clip. +*/ +response_codes melted_probe_clip( command_argument cmd_arg ) +{ + int l; + const char *file_name = (const char*) cmd_arg-argument; + char fullname[1024]; + mlt_producer producer; + mlt_profile profile; + + snprintf( fullname, sizeof(fullname), %s%s, cmd_arg-root_dir, file_name ); + profile = mlt_profile_init(NULL); + producer = mlt_factory_producer( profile, NULL, fullname ); + if (!producer ) + { + mlt_profile_close(profile); + return RESPONSE_BAD_FILE; + }; + + l = mlt_producer_get_length( producer ); + mvcp_response_printf( cmd_arg-response, 10240, + %d \%s\ %d %d %d %d %.2f\n\n, + 0, /* index */ + cmd_arg-argument, /* title */ + 0, /* frame in */ + l - 1, /* frame out */ + l, /* frame count */ + l, /* length */ + mlt_producer_get_fps( producer ) ); + + mlt_producer_close( producer ); + mlt_profile_close(profile); + + return RESPONSE_SUCCESS_N; +} + /** Set a server configuration property. */ diff --git a/src/melted/melted_commands.h b/src/melted/melted_commands.h index c2424be..0b45007 100644 --- a/src/melted/melted_commands.h +++ b/src/melted/melted_commands.h @@ -41,6 +41,7 @@ extern response_codes melted_add_unit( command_argument ); extern response_codes melted_list_nodes( command_argument ); extern response_codes melted_list_units( command_argument ); extern response_codes melted_list_clips( command_argument ); +extern response_codes melted_probe_clip( command_argument ); extern response_codes melted_set_global_property( command_argument ); extern response_codes melted_get_global_property( command_argument ); diff --git a/src/melted/melted_local.c b/src/melted/melted_local.c index 580aedf..3f16543 100644 --- a/src/melted/melted_local.c +++ b/src/melted/melted_local.c @@ -174,6 +174,7 @@ static command_t vocabulary[] = {UADD, melted_add_unit, 0, ATYPE_STRING, Create a new playout unit (virtual VTR) to transmit to receiver specified in GUID argument.}, {ULS, melted_list_units, 0, ATYPE_NONE, Lists the units that have already been added to the server.}, {CLS, melted_list_clips, 0, ATYPE_STRING, Lists the clips at directory name argument.}, + {PROBE, melted_probe_clip, 0, ATYPE_STRING, Probe clip for playback. Output clip parameters.}, {SET, melted_set_global_property, 0, ATYPE_PAIR, Set a server configuration property.}, {GET, melted_get_global_property, 0, ATYPE_STRING, Get a server configuration property.}, {RUN, melted_run, 0, ATYPE_STRING, Run a batch file. }, -- 1.7.7.6 From 13c65fdb52025d1fefa4c34d3cd8dd523c2bf1f2 Mon Sep 17 00:00:00 2001 From: Maksym Veremeyenko ve...@m1stereo.tv Date: Tue, 3 Jul 2012 14:16:45 +0300 Subject: [PATCH 2/3] factorize mvcp_list line parsing --- src/mvcp/mvcp.c | 37 ++--- 1 files changed, 22 insertions(+), 15 deletions(-) diff --git a/src/mvcp/mvcp.c b/src/mvcp/mvcp.c index 87b2148..99e086d 100644 --- a/src/mvcp/mvcp.c +++ b/src/mvcp/mvcp.c @@ -706,6 +706,27 @@ mvcp_error_code mvcp_list_get_error_code( mvcp_list list ) return mvcp_malloc_failed; } +static mvcp_error_code mvcp_list_parse( mvcp_list_entry entry, char* line) +{ + mvcp_tokeniser tokeniser = mvcp_tokeniser_init( ); + mvcp_tokeniser_parse_new( tokeniser, line, ); + + if ( mvcp_tokeniser_count( tokeniser ) 0 ) + { + entry-clip = atoi( mvcp_tokeniser_get_string( tokeniser, 0 ) ); + mvcp_util_strip( mvcp_tokeniser_get_string( tokeniser, 1 ), '\' ); + strcpy( entry-full, mvcp_tokeniser_get_string( tokeniser, 1 ) ); + entry-in = atol( mvcp_tokeniser_get_string( tokeniser, 2 ) ); + entry-out = atol( mvcp_tokeniser_get_string( tokeniser, 3 ) ); + entry-max = atol( mvcp_tokeniser_get_string( tokeniser, 4 ) ); + entry-size = atol( mvcp_tokeniser_get_string( tokeniser, 5 ) ); + entry-fps = atof( mvcp_tokeniser_get_string( tokeniser, 6 ) ); + } + mvcp_tokeniser_close( tokeniser ); + + return mvcp_ok; +} + /** Get a particular file entry in the list. */ @@ -716,21 +737,7 @@ mvcp_error_code mvcp_list_get( mvcp_list list, int
[Mlt-devel] [PATCH] extend USTA output with current clip start time and playlist duration
Hi, attached patch USTA output with current clip start time and playlist duration. Two more parameters helps detect global playlist playback and remaining time. that breaks ABI with previous version so lib number should be incremented. another issue is older mvcp client will not support status reading from newer version - they will reject to parse USTA output due to increased number of entries. -- Maksym Veremeyenko From 058653f92adbdfe9084a3d6f3fad707fdd6563cf Mon Sep 17 00:00:00 2001 From: Maksym Veremeyenko ve...@m1stereo.tv Date: Wed, 27 Jun 2012 15:19:09 +0300 Subject: [PATCH] extend USTA output with current clip start time and playlist duration --- src/melted/melted_unit.c |2 ++ src/mvcp/mvcp_status.c | 14 +++--- src/mvcp/mvcp_status.h |2 ++ 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/melted/melted_unit.c b/src/melted/melted_unit.c index 66dfd9c..e4561dd 100644 --- a/src/melted/melted_unit.c +++ b/src/melted/melted_unit.c @@ -576,6 +576,8 @@ int melted_unit_get_status( melted_unit unit, mvcp_status status ) status-tail_length = mlt_producer_get_length( clip ); status-clip_index = mlt_playlist_current_clip( playlist ); status-seek_flag = 1; + status-dur = mlt_producer_get_length( producer ); + status-start = info.start; } status-generation = mlt_properties_get_int( properties, generation ); diff --git a/src/mvcp/mvcp_status.c b/src/mvcp/mvcp_status.c index 209290f..9c73151 100644 --- a/src/mvcp/mvcp_status.c +++ b/src/mvcp/mvcp_status.c @@ -34,7 +34,8 @@ void mvcp_status_parse( mvcp_status status, char *text ) { mvcp_tokeniser tokeniser = mvcp_tokeniser_init( ); - if ( mvcp_tokeniser_parse_new( tokeniser, text, ) == 17 ) + int r = mvcp_tokeniser_parse_new( tokeniser, text, ); + if ( 19 == r || 17 == r ) { status-unit = atoi( mvcp_tokeniser_get_string( tokeniser, 0 ) ); strncpy( status-clip, mvcp_util_strip( mvcp_tokeniser_get_string( tokeniser, 2 ), '\' ), sizeof( status-clip ) ); @@ -53,6 +54,11 @@ void mvcp_status_parse( mvcp_status status, char *text ) status-seek_flag = atoi( mvcp_tokeniser_get_string( tokeniser, 14 ) ); status-generation = atoi( mvcp_tokeniser_get_string( tokeniser, 15 ) ); status-clip_index = atoi( mvcp_tokeniser_get_string( tokeniser, 16 ) ); + if ( 19 == r ) + { + status-start = atoi( mvcp_tokeniser_get_string( tokeniser, 17 ) ); + status-dur = atoi( mvcp_tokeniser_get_string( tokeniser, 18 ) ); + }; if ( !strcmp( mvcp_tokeniser_get_string( tokeniser, 1 ), unknown ) ) status-status = unit_unknown; @@ -121,7 +127,7 @@ char *mvcp_status_serialise( mvcp_status status, char *text, int length ) break; } - snprintf( text, length, %d %s \%s\ %d %d %.2f %d %d %d \%s\ %d %d %d %d %d %d %d\r\n, + snprintf( text, length, %d %s \%s\ %d %d %.2f %d %d %d \%s\ %d %d %d %d %d %d %d %d %d\r\n, status-unit, status_string, status-clip, @@ -138,7 +144,9 @@ char *mvcp_status_serialise( mvcp_status status, char *text, int length ) status-tail_length, status-seek_flag, status-generation, - status-clip_index ); + status-clip_index, + status-start, + status-dur ); return text; } diff --git a/src/mvcp/mvcp_status.h b/src/mvcp/mvcp_status.h index c629473..c9128f7 100644 --- a/src/mvcp/mvcp_status.h +++ b/src/mvcp/mvcp_status.h @@ -67,6 +67,8 @@ typedef struct int generation; int clip_index; int dummy; + int dur; /** duration of playlist */ + int start; /** time head clip relative to the beginning of the playlist */ } *mvcp_status, mvcp_status_t; -- 1.7.4.4 -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/___ Mlt-devel mailing list Mlt-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mlt-devel
Re: [Mlt-devel] [PATCH] extend USTA output with current clip start time and playlist duration
03.07.12 18:50, Dan Dennedy написав(ла): On Tue, Jul 3, 2012 at 5:42 AM, Maksym Veremeyenkove...@m1stereo.tv wrote: Hi, attached patch USTA output with current clip start time and playlist duration. Two more parameters helps detect global playlist playback and remaining time. that breaks ABI with previous version so lib number should be incremented. ok another issue is older mvcp client will not support status reading from newer version - they will reject to parse USTA output due to increased number of entries. I think we should make a new command USTATUS that also includes a version or new text format that affords extensibility. if you plan to reject this patch, i can implement USTA2 and STATUS2 commands with appropriate mvcp_status2 but that will require duplicating mvcp_status2.[c|h] and mvcp_notifier2.[h|c]... -- Maksym Veremeyenko -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ ___ Mlt-devel mailing list Mlt-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mlt-devel
[Mlt-devel] [PATCH] Disable Video and Audio Input on producer stop
Hi, attached patch fix coredumps like: 0x7fffe5d824b3 in CDeckLinkInput::DisableVideoInput() () from /usr/lib/libDeckLinkAPI.so Missing separate debuginfos, use: debuginfo-install SDL-1.2.14-13.fc16.x86_64 alsa-lib-1.0.25-1.fc16.x86_64 bzip2-libs-1.0.6-3.fc15.x86_64 cairo-1.10.2-4.fc16.x86_64 expat-2.0.1-11.fc15.x86_64 fontconfig-2.8.0-4.fc16.x86_64 freetype-2.4.6-4.fc16.x86_64 gdk-pixbuf2-2.24.1-1.fc16.x86_64 glib2-2.30.2-1.fc16.x86_64 glibc-2.14.90-24.fc16.6.x86_64 gtk2-2.24.8-3.fc16.x86_64 libX11-1.4.3-1.fc16.x86_64 libXau-1.0.6-2.fc15.x86_64 libXcomposite-0.4.3-2.fc15.x86_64 libXcursor-1.1.11-3.fc15.x86_64 libXdamage-1.1.3-2.fc15.x86_64 libXext-1.3.0-1.fc16.x86_64 libXfixes-5.0-1.fc16.x86_64 libXi-1.4.5-1.fc16.x86_64 libXinerama-1.1.1-2.fc15.x86_64 libXrandr-1.3.1-2.fc15.x86_64 libXrender-0.9.6-2.fc15.x86_64 libffi-3.0.10-1.fc16.x86_64 libgcc-4.6.3-2.fc16.x86_64 libogg-1.2.2-3.fc15.x86_64 libpng-1.2.48-1.fc16.x86_64 libselinux-2.1.6-6.fc16.x86_64 libstdc++-4.6.3-2.fc16.x86_64 libtheora-1.1.1-1.fc15.x86_64 libvorbis-1.3.3-1.fc16.x86_64 libxcb-1.7-3.fc16.x86_64 libxml2-2.7.8-6.fc16.x86_64 pango-1.29.4-1.fc16.x86_64 pixman-0.22.2-1.fc16.x86_64 speex-1.2-0.13.rc1.fc15.x86_64 zlib-1.2.5-6.fc16.x86_64 (gdb) bt #0 0x7fffe5d824b3 in CDeckLinkInput::DisableVideoInput() () from /usr/lib/libDeckLinkAPI.so #1 0x7fffe5d843d7 in CDeckLinkInput::Release() () from /usr/lib/libDeckLinkAPI.so #2 0x7fffe5d96fc1 in CDeckLinkInput_v9_2::~CDeckLinkInput_v9_2() () from /usr/lib/libDeckLinkAPI.so #3 0x7fffe5d9704a in CDeckLinkInput_v9_2::Release() () from /usr/lib/libDeckLinkAPI.so #4 0x7fffe672837d in ~DeckLinkProducer (this=0x7fffdc000920, __in_chrg=optimized out) at producer_decklink.cpp:112 #5 DeckLinkProducer::~DeckLinkProducer (this=0x7fffdc000920, __in_chrg=optimized out) at producer_decklink.cpp:114 #6 0x7fffe67268b3 in producer_close (producer=0x7fffdc001170) at producer_decklink.cpp:625 #7 0x0040616b in mlt_stop (instance=0x614010) at src/mlt.c:553 #8 0x004045db in ctl_method_Stop (envP=0x700a07d0, paramArrayP=0x7fffd4003c70, serverInfo=0x614010, channelInfo= 0x700a0910) at src/ctl.c:452 #9 0x003955e022d3 in callNamedMethod (resultPP=0x700a0828, callInfoP=0x700a0910, paramArrayP=0x7fffd4003c70, methodP=optimized out, envP=0x700a07d0) at /usr/src/debug/xmlrpc-c-1.27.7/src/registry.c:307 #10 xmlrpc_dispatchCall (envP=0x700a07d0, registryP=0x635ac0, methodName=0x7fffd4004400 TheCore.Stop, paramArrayP= 0x7fffd4003c70, callInfoP=0x700a0910, resultPP=0x700a0828) at /usr/src/debug/xmlrpc-c-1.27.7/src/registry.c:337 #11 0x003955e0248b in xmlrpc_registry_process_call2 (envP=0x700a08a0, registryP=0x635ac0, callXml= 0x7fffd4004d80 ?xml version=\1.0\ encoding=\utf-8\?methodCallmethodNameTheCore.Stop/methodNameparams/params/methodCallge_, callXmlLen=117, callInfo=0x700a0910, responseXmlPP=0x700a08c0) at /usr/src/debug/xmlrpc-c-1.27.7/src/registry.c:426 #12 0x77bb4e99 in processCall (trace=0x0, accessControl=..., wantChunk=false, xmlProcessorArg=0x635ac0, xmlProcessor= 0x77bb47b0 processXmlrpcCall, contentSize=117, abyssSessionP=0x700a0910) at /usr/src/debug/xmlrpc-c-1.27.7/src/xmlrpc_server_abyss.c:462 #13 handleXmlRpcCallReq (accessControl=..., wantChunk=false, xmlProcessorArg=0x635ac0, xmlProcessor= 0x77bb47b0 processXmlrpcCall, requestInfoP=optimized out, abyssSessionP=0x700a0910) at /usr/src/debug/xmlrpc-c-1.27.7/src/xmlrpc_server_abyss.c:597 #14 handleIfXmlrpcReq (handlerArg=optimized out, abyssSessionP=0x700a0910, handledP=optimized out) at /usr/src/debug/xmlrpc-c-1.27.7/src/xmlrpc_server_abyss.c:661 #15 0x779a7c24 in runUserHandler (srvP=0x634a90, sessionP=0x700a0910) at /usr/src/debug/xmlrpc-c-1.27.7/lib/abyss/src/server.c:564 #16 processRequestFromClient (connectionP=optimized out, lastReqOnConn=optimized out, timeout=optimized out, keepAliveP=0x700a0a8c) at /usr/src/debug/xmlrpc-c-1.27.7/lib/abyss/src/server.c:657 #17 0x779a7d85 in serverFunc (userHandle=0x651160) at /usr/src/debug/xmlrpc-c-1.27.7/lib/abyss/src/server.c:723 #18 0x779a2437 in connJob (userHandle=0x651160) at /usr/src/debug/xmlrpc-c-1.27.7/lib/abyss/src/conn.c:39 #19 0x779aa804 in pthreadStart (arg=0x648920) at /usr/src/debug/xmlrpc-c-1.27.7/lib/abyss/src/thread_pthread.c:49 #20 0x003ca8207d90 in start_thread () from /lib64/libpthread.so.0 #21 0x003ca7ef0f5d in clone () from /lib64/libc.so.6 (gdb) quit that happens if decklink's input instance released without disabling video and output... -- Maksym Veremeyenko From c424d7a821d7e9b5a9644d4c801dd5b6db908989 Mon Sep 17 00:00:00 2001 From: Maksym Veremeyenko ve...@m1stereo.tv Date: Wed, 11 Jul 2012 13:17:54 +0300 Subject: [PATCH] Disable Video and Audio Input on producer stop
Re: [Mlt-devel] memory leaks
18.07.12 20:06, Dan Dennedy написав(ла): On Wed, Jul 18, 2012 at 9:31 AM, Maksym Veremeyenkove...@m1stereo.tv wrote: Hi, during debugging a program that uses mlt i found a lot of leaks in mlt framework. Some may be negligible one-time allocations that will free automatically by kernel, but we try to use mlt_factory_register_for_clean_up() to track those. Many will be in dependencies and sometimes difficult or time-consuming to track down. And maybe some are legitimate for which I welcome patches. i prepared very small program that opens producer only (see attached) running valgrind valgrind -v --leak-check=full --error-limit=no --leak-resolution=high --show-reachable=yes ./mlt_play reports tons of errors, and among them: And each one requires analysis. Have you done that? I suggesting removing modules that you do not need for your test in order to reduce the noise level. [...] ==8838== 40 bytes in 1 blocks are definitely lost in loss record 2 of 19 ==8838==at 0x4A074CD: malloc (vg_replace_malloc.c:236) ==8838==by 0xC0B8654: ??? ==8838==by 0xCA5E29F: ??? ==8838==by 0xC0B8209: ??? ==8838==by 0xC0B8576: ??? ==8838==by 0x4C48439: mlt_factory_producer (mlt_factory.c:291) ==8838==by 0xB67FB31: ??? ==8838==by 0xB67FE33: ??? ==8838==by 0x4C48439: mlt_factory_producer (mlt_factory.c:291) ==8838==by 0x4007C4: main (mlt_play.c:11) ==8838== ==8838== 40 bytes in 1 blocks are definitely lost in loss record 3 of 19 ==8838==at 0x4A074CD: malloc (vg_replace_malloc.c:236) ==8838==by 0xC0B8654: ??? ==8838==by 0xCA5E2B2: ??? ==8838==by 0xC0B8209: ??? ==8838==by 0xC0B8576: ??? ==8838==by 0x4C48439: mlt_factory_producer (mlt_factory.c:291) ==8838==by 0xB67FB31: ??? ==8838==by 0xB67FE33: ??? ==8838==by 0x4C48439: mlt_factory_producer (mlt_factory.c:291) ==8838==by 0x4007C4: main (mlt_play.c:11) ==8838== [...] is it a bug or i forget to free some resources? Those require further analysis, but it is not clear from that trace where the problem lies except that it is in some producer. One thing to check is that when you start a consumer, then frames in queues may be holding references to the producer, and you need to ensure all references to frames are released prior to normal process exit in order to make the valgrind test happy. That should happen in mlt_consumer_stop(). thanks for hints... i am trying to dig but currently without success :-(( -- Maksym Veremeyenko -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ ___ Mlt-devel mailing list Mlt-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mlt-devel
[Mlt-devel] memory leaks
Hi, during debugging a program that uses mlt i found a lot of leaks in mlt framework. i prepared very small program that opens producer only (see attached) running valgrind valgrind -v --leak-check=full --error-limit=no --leak-resolution=high --show-reachable=yes ./mlt_play reports tons of errors, and among them: [...] ==8838== 40 bytes in 1 blocks are definitely lost in loss record 2 of 19 ==8838==at 0x4A074CD: malloc (vg_replace_malloc.c:236) ==8838==by 0xC0B8654: ??? ==8838==by 0xCA5E29F: ??? ==8838==by 0xC0B8209: ??? ==8838==by 0xC0B8576: ??? ==8838==by 0x4C48439: mlt_factory_producer (mlt_factory.c:291) ==8838==by 0xB67FB31: ??? ==8838==by 0xB67FE33: ??? ==8838==by 0x4C48439: mlt_factory_producer (mlt_factory.c:291) ==8838==by 0x4007C4: main (mlt_play.c:11) ==8838== ==8838== 40 bytes in 1 blocks are definitely lost in loss record 3 of 19 ==8838==at 0x4A074CD: malloc (vg_replace_malloc.c:236) ==8838==by 0xC0B8654: ??? ==8838==by 0xCA5E2B2: ??? ==8838==by 0xC0B8209: ??? ==8838==by 0xC0B8576: ??? ==8838==by 0x4C48439: mlt_factory_producer (mlt_factory.c:291) ==8838==by 0xB67FB31: ??? ==8838==by 0xB67FE33: ??? ==8838==by 0x4C48439: mlt_factory_producer (mlt_factory.c:291) ==8838==by 0x4007C4: main (mlt_play.c:11) ==8838== [...] is it a bug or i forget to free some resources? -- Maksym Veremeyenko #include stdio.h #include unistd.h #include framework/mlt.h /* comment next line to test mem leak for real playback */ #define MINIMAL /* comment next line to test mem leak on error */ #define FILE_EXISTING /tmp/probe5.mov #ifdef FILE_EXISTING #define FILE_TO_USE FILE_EXISTING #else #define FILE_TO_USE /tmp/blabla.mov #endif int main( int argc, char *argv[] ) { mlt_repository repo = mlt_factory_init(NULL); mlt_profile profile = mlt_profile_init(dv_pal); mlt_producer producer = mlt_factory_producer(profile, NULL, FILE_TO_USE); #ifndef MINIMAL mlt_consumer consumer = mlt_factory_consumer(profile, decklink, 0); mlt_playlist playlist = mlt_playlist_init(); mlt_properties_set(mlt_playlist_properties(playlist), eof, loop); mlt_playlist_append(playlist, producer); mlt_producer_close(producer); mlt_consumer_connect(consumer, MLT_PLAYLIST_SERVICE(playlist)); mlt_consumer_start(consumer); sleep(10); mlt_consumer_stop(consumer); mlt_consumer_close(consumer); mlt_playlist_close(playlist); #else mlt_producer_close(producer); #endif mlt_profile_close(profile); mlt_factory_close(); return 0; }; -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/___ Mlt-devel mailing list Mlt-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mlt-devel
[Mlt-devel] [PATCH] fix array index out of range
Hi, during enumerating self-audio_codec or other arrays that has limit MAX_AUDIO_STREAMS it is possible to access out of index range. attached patch fix that behavior. NB i noticed that current value of MAX_AUDIO_STREAMS is 10. that mean that it will be unable to access audio track with index 11 or more. so i would suggest to increase MAX_AUDIO_STREAMS value up to 32 or bigger -- Maksym Veremeyenko From b6fd64bbf0b0def1a0cb7092c07b2d5351a51be5 Mon Sep 17 00:00:00 2001 From: Maksym Veremeyenko ve...@m1stereo.tv Date: Fri, 28 Sep 2012 16:24:05 +0200 Subject: [PATCH] fix array index out of range --- src/modules/avformat/producer_avformat.c |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/modules/avformat/producer_avformat.c b/src/modules/avformat/producer_avformat.c index 2419238..48150ed 100644 --- a/src/modules/avformat/producer_avformat.c +++ b/src/modules/avformat/producer_avformat.c @@ -2272,7 +2272,7 @@ static int producer_get_audio( mlt_frame frame, void **buffer, mlt_audio_format if ( self-audio_index == INT_MAX ) { index = 0; - index_max = context-nb_streams; + index_max = FFMIN( MAX_AUDIO_STREAMS, context-nb_streams ); *channels = self-total_channels; *samples = *samples * FFMAX( self-max_frequency, *frequency ) / *frequency; *frequency = FFMAX( self-max_frequency, *frequency ); @@ -2351,7 +2351,7 @@ static int producer_get_audio( mlt_frame frame, void **buffer, mlt_audio_format { // Check if there is enough audio for all streams got_audio = 1; -for ( index = 0; got_audio index context-nb_streams; index++ ) +for ( index = 0; got_audio index index_max; index++ ) if ( ( self-audio_codec[ index ] self-audio_used[ index ] *samples ) || ignore[ index ] ) got_audio = 0; if ( got_audio ) -- 1.7.7.6 -- Got visibility? Most devs has no idea what their production app looks like. Find out how fast your code is with AppDynamics Lite. http://ad.doubleclick.net/clk;262219671;13503038;y? http://info.appdynamics.com/FreeJavaPerformanceDownload.html___ Mlt-devel mailing list Mlt-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mlt-devel
[Mlt-devel] [PATCH] calc image size as largest of two image size calculation methods
Hi, attached patch fix context error noticed by valgrind. that error happens because of image size calculated by *avpicture_get_size* and *mlt_image_format_size* are different. In my case avpicture_get_size(AV_PIX_FMT_YUYV422, 60, 68) == 8160 = [ 68 * (2 * 60) ] mlt_image_format_size(mlt_image_yuv422, 60, 68, NULL) == 8280 = [ (68 + 1) * (2 * 60) ] as result during copying it access area outside of allocated space... -- Maksym Veremeyenko From 70a5bffe0d05b75d48c981e98527d972a3846176 Mon Sep 17 00:00:00 2001 From: Maksym Veremeyenko ve...@m1stereo.tv Date: Thu, 8 Nov 2012 13:48:04 +0200 Subject: [PATCH] calc image size as largest of two image size calculation methods --- src/modules/avformat/filter_avcolour_space.c |3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/src/modules/avformat/filter_avcolour_space.c b/src/modules/avformat/filter_avcolour_space.c index 3e804e9..5bf53ea 100644 --- a/src/modules/avformat/filter_avcolour_space.c +++ b/src/modules/avformat/filter_avcolour_space.c @@ -169,7 +169,8 @@ static int convert_image( mlt_frame frame, uint8_t **image, mlt_image_format *fo int in_fmt = convert_mlt_to_av_cs( *format ); int out_fmt = convert_mlt_to_av_cs( output_format ); - int size = avpicture_get_size( out_fmt, width, height ); + int size = FFMAX( avpicture_get_size( out_fmt, width, height ), + mlt_image_format_size( output_format, width, height, NULL ) ); uint8_t *output = mlt_pool_alloc( size ); if ( *format == mlt_image_rgb24a || *format == mlt_image_opengl ) -- 1.7.7.6 -- 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_d2d_nov___ Mlt-devel mailing list Mlt-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mlt-devel
[Mlt-devel] planar audio and libswresample vs. libavresample
Hi, after recent update of ffmpeg i found that some old files stops to play and crash melt. That happens after update of ffmpeg: http://git.videolan.org/?p=ffmpeg.git;a=commit;h=3d3cf6745e2a5dc9c377244454c3186d75b177fa that update change output sample format to planar and as result this make wrong behavior of producer_avformat supporting planar samples decode in producer_avformat.c seems not good idea, but best IMHO is replace older audio resampling call to newer interface: libswresample or libavresample among cons for that are requirements to support both and should old be deleted or #ifdef'ed? what would you suggest? -- Maksym Veremeyenko -- Monitor your physical, virtual and cloud infrastructure from a single web console. Get in-depth insight into apps, servers, databases, vmware, SAP, cloud infrastructure, etc. Download 30-day Free Trial. Pricing starts from $795 for 25 servers or applications! http://p.sf.net/sfu/zoho_dev2dev_nov ___ Mlt-devel mailing list Mlt-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mlt-devel
[Mlt-devel] slow playback and producer_slowmotion
Hi, could anybody give me advice on how to play with speed 0.1 ... 0.9 or another non-integer speed value. mlt_types.h has very interesting lines code: [...] /* I don't want to break anyone's applications without warning. -Zach */ #undef DOUBLE_MLT_POSITION #ifdef DOUBLE_MLT_POSITION typedef double mlt_position; #else typedef int32_t mlt_position; #endif [...] that define to use integer type for position, so any float speed values would be truncated to int value: void mlt_producer_prepare_next( mlt_producer self ) { if ( mlt_producer_get_speed( self ) != 0 ) mlt_producer_seek( self, mlt_producer_position( self ) + mlt_producer_get_speed( self ) ); } so first possible approach would be define DOUBLE_MLT_POSITION, but could it break MLT? i found producer_slowmotion that sounds like proper solution but i have no glue how to use it. Could anybody give me a code sample that show how to use playlist and slowmotion producer? -- Maksym Veremeyenko -- AlienVault Unified Security Management (USM) platform delivers complete security visibility with the essential security capabilities. Easily and efficiently configure, manage, and operate all of your security controls from a single console and one unified framework. Download a free trial. http://p.sf.net/sfu/alienvault_d2d ___ Mlt-devel mailing list Mlt-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mlt-devel
Re: [Mlt-devel] slow playback and producer_slowmotion
13.05.13 21:21, Dan Dennedy написав(ла): On Mon, May 13, 2013 at 9:58 AM, Maksym Veremeyenkove...@m1stereo.tv wrote: Hi, could anybody give me advice on how to play with speed 0.1 ... 0.9 or another non-integer speed value. mlt_types.h has very interesting lines code: [...] /* I don't want to break anyone's applications without warning. -Zach */ #undef DOUBLE_MLT_POSITION #ifdef DOUBLE_MLT_POSITION typedef double mlt_position; #else typedef int32_t mlt_position; #endif [...] that define to use integer type for position, so any float speed values would be truncated to int value: void mlt_producer_prepare_next( mlt_producer self ) { if ( mlt_producer_get_speed( self ) != 0 ) mlt_producer_seek( self, mlt_producer_position( self ) + mlt_producer_get_speed( self ) ); } so first possible approach would be define DOUBLE_MLT_POSITION, but could it break MLT? Yes, it is an interesting unused code that I should probably remove. It quite likely will break all sorts of things; it is certainly not as simple a switch as it appears. :-) You are completely on your own should you choose to use it as I know nothing about it. Of course, you can go all in and get something working here and feel free to share your fork for review and merge. i did a change to make mlt_position type double (patch attached) and it seems it working fine for me currently. at least it playback clips and speed could be changed from [0..1] range easy. i will try to do more tests next day. i think it would be usefull to add an option to configure for controlling macro DOUBLE_MLT_POSITION definition. i found producer_slowmotion that sounds like proper solution but i have no glue how to use it. Could anybody give me a code sample that show how to use playlist and slowmotion producer? And that producer is basically useless as well because the resulting image quality is so poor. It attempted to use macroblock motion estimation to do fast frame interpolation. If you just want to repeat or drop frames, then take a look at the framebuffer producer (as used by kdenlive's speed effect). Please be aware that this does not convey the encapsulated producer's audio. framebuffer:some.mp4?0.5 speed 0 : reverse 0 abs(speed) 1.0 : slow 1.0 abs(speed) : fast could you give a hint on how to use playlist producer and framebuffer producer with C-code? -- Maksym Veremeyenko From 4948bc16263d42366e7595f244f70ea98c7bfab3 Mon Sep 17 00:00:00 2001 From: Maksym Veremeyenko ve...@m1stereo.tv Date: Tue, 14 May 2013 11:28:10 +0300 Subject: [PATCH] make mlt_position type double --- src/framework/mlt_consumer.c|2 +- src/framework/mlt_frame.c |2 +- src/framework/mlt_types.h |6 +- src/modules/avformat/producer_avformat.c|2 +- src/modules/avsync/consumer_blipflash.c |4 ++-- src/modules/core/filter_luma.c |6 +++--- src/modules/dgraft/filter_telecide.c|8 src/modules/gtk2/producer_count.c |8 src/modules/kdenlive/producer_framebuffer.c |2 +- src/modules/xine/filter_deinterlace.c |2 +- 10 files changed, 23 insertions(+), 19 deletions(-) diff --git a/src/framework/mlt_consumer.c b/src/framework/mlt_consumer.c index f9eb806..2791a01 100644 --- a/src/framework/mlt_consumer.c +++ b/src/framework/mlt_consumer.c @@ -990,7 +990,7 @@ static void *consumer_worker_thread( void *arg ) frame = mlt_deque_peek( priv-queue, index ); if ( frame ) { - mlt_log_debug( MLT_CONSUMER_SERVICE(self), worker processing index = %d frame %d queue count = %d\n, + mlt_log_debug( MLT_CONSUMER_SERVICE(self), worker processing index = %d frame MLT_POSITION_FMT queue count = %d\n, index, mlt_frame_get_position(frame), mlt_deque_count( priv-queue ) ); frame-is_processing = 1; mlt_properties_inc_ref( MLT_FRAME_PROPERTIES( frame ) ); diff --git a/src/framework/mlt_frame.c b/src/framework/mlt_frame.c index 988b310..7c8b5f8 100644 --- a/src/framework/mlt_frame.c +++ b/src/framework/mlt_frame.c @@ -982,7 +982,7 @@ void mlt_frame_write_ppm( mlt_frame frame ) FILE *file; char filename[16]; - sprintf( filename, frame-%05d.ppm, mlt_frame_get_position( frame ) ); + sprintf( filename, frame-%05d.ppm, (int)mlt_frame_get_position( frame ) ); file = fopen( filename, wb ); if ( !file ) return; diff --git a/src/framework/mlt_types.h b/src/framework/mlt_types.h index c1574d4..764c0c4 100644 --- a/src/framework/mlt_types.h +++ b/src/framework/mlt_types.h @@ -103,10 +103,14 @@ typedef enum mlt_service_type; /* I don't want to break anyone's applications without warning. -Zach */ -#undef DOUBLE_MLT_POSITION +#define DOUBLE_MLT_POSITION #ifdef DOUBLE_MLT_POSITION +#define MLT_POSITION_FMT %f +#define MLT_POSITION_MOD(A, B) (A - B * ((int)(A / B))) typedef double mlt_position; #else +#define MLT_POSITION_MOD(A, B) A % B +#define MLT_POSITION_FMT %d
[Mlt-devel] [PATCH] keep origin audio samples freq if audio_index=all is used
Hi, if option audio_index=all is specified for producer avformat it do not update samplerate. as result playback 44100 audio track is going faster and audio resampler do not activated. attached patch should fix this behavior -- Maksym Veremeyenko From 8707464aa87982c40628f1d013ba55f2d50d7cc7 Mon Sep 17 00:00:00 2001 From: Maksym Veremeyenko ve...@m1stereo.tv Date: Mon, 17 Jun 2013 19:34:50 +0300 Subject: [PATCH 1/2] keep origin audio samples freq if audio_index=all is used --- src/modules/avformat/producer_avformat.c |1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/src/modules/avformat/producer_avformat.c b/src/modules/avformat/producer_avformat.c index 1b87b86..f972bb0 100644 --- a/src/modules/avformat/producer_avformat.c +++ b/src/modules/avformat/producer_avformat.c @@ -2340,6 +2340,7 @@ static int producer_get_audio( mlt_frame frame, void **buffer, mlt_audio_format { // XXX: This only works if all audio tracks have the same sample format. *format = pick_audio_format( self-audio_codec[ index ]-sample_fmt ); + *frequency = self-audio_codec[ index ]-sample_rate; sizeof_sample = sample_bytes( self-audio_codec[ index ] ); break; } -- 1.7.1 -- This SF.net email is sponsored by Windows: Build for Windows Store. http://p.sf.net/sfu/windows-dev2dev___ Mlt-devel mailing list Mlt-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mlt-devel
Re: [Mlt-devel] [PATCH] keep origin audio samples freq if audio_index=all is used
04.07.13 22:16, Dan Dennedy написав(ла): On Thu, Jul 4, 2013 at 4:35 AM, Maksym Veremeyenkove...@m1stereo.tv wrote: Hi, if option audio_index=all is specified for producer avformat it do not update samplerate. as result playback 44100 audio track is going faster and audio resampler do not activated. attached patch should fix this behavior This change contradicts the determination of frequency that appears earlier in the function: if ( self-audio_index == INT_MAX ) ... *frequency = FFMAX( self-max_frequency, *frequency ); Elsewhere, self-max_frequency is set to the highest sample rate while enumerating audio tracks. Perhaps the more correct change is to change that line to simply: *frequency = self-max_frequency; I think it should works... Can you test how that change works for you? OK PS how can i test what of audio resamplers invoked: avformat's or libresample? -- Maksym Veremeyenko -- This SF.net email is sponsored by Windows: Build for Windows Store. http://p.sf.net/sfu/windows-dev2dev ___ Mlt-devel mailing list Mlt-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mlt-devel
Re: [Mlt-devel] [PATCH] keep origin audio samples freq if audio_index=all is used
04.07.13 22:16, Dan Dennedy написав(ла): On Thu, Jul 4, 2013 at 4:35 AM, Maksym Veremeyenkove...@m1stereo.tv wrote: Hi, if option audio_index=all is specified for producer avformat it do not update samplerate. as result playback 44100 audio track is going faster and audio resampler do not activated. attached patch should fix this behavior This change contradicts the determination of frequency that appears earlier in the function: if ( self-audio_index == INT_MAX ) ... *frequency = FFMAX( self-max_frequency, *frequency ); Elsewhere, self-max_frequency is set to the highest sample rate while enumerating audio tracks. Perhaps the more correct change is to change that line to simply: *frequency = self-max_frequency; Can you test how that change works for you? it works -- Maksym Veremeyenko -- See everything from the browser to the database with AppDynamics Get end-to-end visibility with application monitoring from AppDynamics Isolate bottlenecks and diagnose root cause in seconds. Start your free trial of AppDynamics Pro today! http://pubads.g.doubleclick.net/gampad/clk?id=48808831iu=/4140/ostg.clktrk ___ Mlt-devel mailing list Mlt-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mlt-devel
Re: [Mlt-devel] [PATCH] use rational fps value to calc frames count
30.07.13 07:38, Dan Dennedy написав(ла): On Sun, Jul 21, 2013 at 6:33 AM, Maksym Veremeyenkove...@m1stereo.tv wrote: Hi, recently i noticed that all clips i was trying to play with mlt has duration 1 smaller then origin. this happens because of calculation (or even compiler) of frames count that comes on double and later not rounded to integer. [...] attached patch tries to avoid double type using during calculation and properly return 251 frames length... -- Maksym Veremeyenko looks good to me, thanks, applied. is it possible to ask to test if regression of /mlt_position type double/ disappeared after that patch? -- Maksym Veremeyenko -- Get your SQL database under version control now! Version control is standard for application code, but databases havent caught up. So what steps can you take to put your SQL databases under version control? Why should you start doing it? Read more to find out. http://pubads.g.doubleclick.net/gampad/clk?id=49501711iu=/4140/ostg.clktrk ___ Mlt-devel mailing list Mlt-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mlt-devel
Re: [Mlt-devel] [PATCH] fix race condition in mlt_consumer
19.10.13 04:39, Dan Dennedy написав(ла): On Thu, Oct 17, 2013 at 9:14 AM, Maksym Veremeyenkove...@m1stereo.tv wrote: Hi, attached patch prevent start new (or additional) consumer_read_ahead_start from avformat consumer during stopping/closing consumer. I do not like that you removed priv-ahead = 0; from mlt_consumer_stop(). Please explain; was that really necessary to fix your problem? The other parts look good. first it: 1598:// Cancel the read ahead threads 1598:priv-ahead = 0; and then trying to stop consumer module thread: 1609:// Invoke the child callback 1610:if ( self-stop != NULL ) 1611:self-stop( self ); and it waiting for thread finished. internal consumer thread is trying to call mlt_consumer_rt_frame. that function if priv-ahead is not running and trying to call consumer_read_ahead_start 1521:if ( priv-ahead == 0 ) 1522:{ 1523:int buffer = mlt_properties_get_int( properties, buffer ); 1524:int prefill = mlt_properties_get_int( properties, prefill ); 1525:consumer_read_ahead_start( self ); 1526:if ( buffer 1 ) 1527:size = prefill 0 prefill buffer ? prefill : buffer; 1528:} that successfully starting consumer_read_ahead_thread again: 1089:if ( pthread_create( priv-ahead_thread, thread_attributes, consumer_read_ahead_thread, self ) 0 ) 1090:pthread_create( priv-ahead_thread, NULL, consumer_read_ahead_thread, self ); or 1095:pthread_create( priv-ahead_thread, NULL, consumer_read_ahead_thread, self ); my patch trying to prevent that behaviour by /two hands/ and i think checking priv-started could be enough - at least i will hardly check it in a day or two... may be name priv-ahead is kind ambiguous and could be renamed into something like priv-flag_exit -- Maksym Veremeyenko -- October Webinars: Code for Performance Free Intel webinars can help you accelerate application performance. Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from the latest Intel processors and coprocessors. See abstracts and register http://pubads.g.doubleclick.net/gampad/clk?id=60135031iu=/4140/ostg.clktrk ___ Mlt-devel mailing list Mlt-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mlt-devel
Re: [Mlt-devel] [PATCH] fix race condition in mlt_consumer
21.10.13 20:39, Dan Dennedy написав(ла): On Mon, Oct 21, 2013 at 12:28 AM, Maksym Veremeyenkove...@m1stereo.tv wrote: 19.10.13 04:39, Dan Dennedy написав(ла): On Thu, Oct 17, 2013 at 9:14 AM, Maksym Veremeyenkove...@m1stereo.tv wrote: Hi, attached patch prevent start new (or additional) consumer_read_ahead_start from avformat consumer during stopping/closing consumer. I do not like that you removed priv-ahead = 0; from mlt_consumer_stop(). Please explain; was that really necessary to fix your problem? The other parts look good. first it: 1598:// Cancel the read ahead threads 1598:priv-ahead = 0; and then trying to stop consumer module thread: 1609:// Invoke the child callback 1610:if ( self-stop != NULL ) 1611:self-stop( self ); and it waiting for thread finished. internal consumer thread is trying to call mlt_consumer_rt_frame. that function if priv-ahead is not running and trying to call consumer_read_ahead_start 1521:if ( priv-ahead == 0 ) 1522:{ 1523:int buffer = mlt_properties_get_int( properties, buffer ); 1524:int prefill = mlt_properties_get_int( properties, prefill ); 1525:consumer_read_ahead_start( self ); 1526:if ( buffer 1 ) 1527:size = prefill 0 prefill buffer ? prefill : buffer; 1528:} that successfully starting consumer_read_ahead_thread again: 1089:if ( pthread_create(priv-ahead_thread, thread_attributes, consumer_read_ahead_thread, self ) 0 ) 1090:pthread_create(priv-ahead_thread, NULL, consumer_read_ahead_thread, self ); or 1095:pthread_create(priv-ahead_thread, NULL, consumer_read_ahead_thread, self ); my patch trying to prevent that behaviour by /two hands/ and i think checking priv-started could be enough - at least i will hardly check it in a day or two... Are you calling mlt_consumer_stop() and mlt_consumer_start() from 2 different threads? in my case they been called from different threads but with large time interval... what i wanted to notice is that consumer_read_ahead_thread started twice because after resetting priv-ahead is possible mlt_consumer_rt_frame from internal consumer thread that check condition: 1521:if ( priv-ahead == 0 ) for starting thread... -- Maksym Veremeyenko -- October Webinars: Code for Performance Free Intel webinars can help you accelerate application performance. Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from the latest Intel processors and coprocessors. See abstracts and register http://pubads.g.doubleclick.net/gampad/clk?id=60135031iu=/4140/ostg.clktrk ___ Mlt-devel mailing list Mlt-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mlt-devel
[Mlt-devel] [PATCH 4/4] check result of header write
Hi, avformat_consumer should stop further works if writing header fails. fails could happens if container does not support track encoding parameters. otherwise i get SIGFPE somewhere deep in the avcodec libraries. -- Maksym Veremeyenko From c958bb4e9c16e7b65e121494640c4f3e09b12519 Mon Sep 17 00:00:00 2001 From: Maksym Veremeyenko ve...@m1.tv Date: Sun, 16 Feb 2014 18:14:46 +0200 Subject: [PATCH 4/4] check result of header write --- src/modules/avformat/consumer_avformat.c |9 +++-- 1 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/modules/avformat/consumer_avformat.c b/src/modules/avformat/consumer_avformat.c index 6b8cb1f..1547c07 100644 --- a/src/modules/avformat/consumer_avformat.c +++ b/src/modules/avformat/consumer_avformat.c @@ -1486,10 +1486,15 @@ static void *consumer_thread( void *arg ) // Write the stream header. if ( mlt_properties_get_int( properties, running ) ) #if LIBAVFORMAT_VERSION_INT = ((5316)+(28)+0) - avformat_write_header( oc, NULL ); + if ( avformat_write_header( oc, NULL ) 0 ) #else - av_write_header( oc ); + if ( av_write_header( oc ) 0 ) #endif + { +mlt_log_error( MLT_CONSUMER_SERVICE( consumer ), Could not write header '%s'\n, filename ); +mlt_events_fire( properties, consumer-fatal-error, NULL ); +goto on_fatal_error; + } } #if LIBAVFORMAT_VERSION_INT ((5316)+(28)+0) else -- 1.7.7.6 -- Android apps run on BlackBerry 10 Introducing the new BlackBerry 10.2.1 Runtime for Android apps. Now with support for Jelly Bean, Bluetooth, Mapview and more. Get your Android app in front of a whole new audience. Start now. http://pubads.g.doubleclick.net/gampad/clk?id=124407151iu=/4140/ostg.clktrk___ Mlt-devel mailing list Mlt-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mlt-devel
[Mlt-devel] [PATCH 2/4] implement SSE optimized swab function
Hi, attached patch implement SSE2 optimized swab function that is activelly used with decklink producer/consumer. it gives not performance boots but in my case it decrease thread CPU usage from 12% to 9% for 1080i25. -- Maksym Veremeyenko From c1b1417026d5cc2ebf9b743e7d5f1778499514a6 Mon Sep 17 00:00:00 2001 From: Maksym Veremeyenko ve...@m1.tv Date: Thu, 13 Feb 2014 16:27:23 +0200 Subject: [PATCH 2/4] implement SSE optimized swab function --- src/modules/decklink/common.cpp| 44 src/modules/decklink/common.h |1 + src/modules/decklink/consumer_decklink.cpp |4 +- src/modules/decklink/producer_decklink.cpp |4 +- 4 files changed, 49 insertions(+), 4 deletions(-) diff --git a/src/modules/decklink/common.cpp b/src/modules/decklink/common.cpp index 83f5e53..cafdda9 100644 --- a/src/modules/decklink/common.cpp +++ b/src/modules/decklink/common.cpp @@ -19,6 +19,7 @@ #include common.h #include stdlib.h +#include unistd.h #ifdef __DARWIN__ @@ -89,3 +90,46 @@ void freeDLString( DLString aDLString ) #endif + +void swab2( const void *from, void *to, int n ) +{ +#if defined(USE_SSE) +#define SWAB_STEP 16 + __asm__ volatile + ( + loop_start:\n\t + + /* load */ + movdqa 0(%[from]), %%xmm0 \n\t + add$0x10, %[from] \n\t + + /* duplicate to temp registers */ + movdqa %%xmm0, %%xmm1 \n\t + + /* shift right temp register */ + psrlw $8, %%xmm1 \n\t + + /* shift left main register */ + psllw $8, %%xmm0 \n\t + + /* compose them back */ + por %%xmm0, %%xmm1 \n\t + + /* save */ + movdqa %%xmm1, 0(%[to])\n\t + add$0x10, %[to]\n\t + + dec%[cnt] \n\t + jnzloop_start \n\t + + : + : [from]r(from), [to]r(to), [cnt]r(n / SWAB_STEP) + : xmm0, xmm1 + ); + + from = (unsigned char*) from + n - (n % SWAB_STEP); + to = (unsigned char*) to + n - (n % SWAB_STEP); + n = (n % SWAB_STEP); +#endif + swab(from, to, n); +}; diff --git a/src/modules/decklink/common.h b/src/modules/decklink/common.h index 3b48b9c..98a8536 100644 --- a/src/modules/decklink/common.h +++ b/src/modules/decklink/common.h @@ -38,5 +38,6 @@ char* getCString( DLString aDLString ); void freeCString( char* aCString ); void freeDLString( DLString aDLString ); +void swab2( const void *from, void *to, int n ); #endif // DECKLINK_COMMON_H diff --git a/src/modules/decklink/consumer_decklink.cpp b/src/modules/decklink/consumer_decklink.cpp index 8f01dea..ac6f5a9 100644 --- a/src/modules/decklink/consumer_decklink.cpp +++ b/src/modules/decklink/consumer_decklink.cpp @@ -416,9 +416,9 @@ public: // Normal non-keyer playout - needs byte swapping if ( !progressive m_displayMode-GetFieldDominance() == bmdUpperFieldFirst ) // convert lower field first to top field first - swab( (char*) image, (char*) buffer + stride, stride * ( height - 1 ) ); + swab2( (char*) image, (char*) buffer + stride, stride * ( height - 1 ) ); else - swab( (char*) image, (char*) buffer, stride * height ); + swab2( (char*) image, (char*) buffer, stride * height ); } else if ( !mlt_properties_get_int( MLT_FRAME_PROPERTIES( frame ), test_image ) ) { diff --git a/src/modules/decklink/producer_decklink.cpp b/src/modules/decklink/producer_decklink.cpp index 9434893..6801fad 100644 --- a/src/modules/decklink/producer_decklink.cpp +++ b/src/modules/decklink/producer_decklink.cpp @@ -432,7 +432,7 @@ public: for ( int i = 1; i m_vancLines + 1; i++ ) { if ( vanc-GetBufferForVerticalBlankingLine( i, buffer ) == S_OK ) -swab( (char*) buffer, (char*) image + ( i - 1 ) * video-GetRowBytes(), video-GetRowBytes() ); +swab2( (char*) buffer, (char*) image + ( i - 1 ) * video-GetRowBytes(), video-GetRowBytes() ); else mlt_log_debug( getProducer(), failed capture vanc line %d\n, i ); } @@ -445,7 +445,7 @@ public: if ( image buffer ) { size = video-GetRowBytes() * video-GetHeight(); - swab( (char*) buffer, (char*) image + m_vancLines * video-GetRowBytes(), size ); + swab2( (char*) buffer, (char*) image + m_vancLines * video-GetRowBytes(), size ); mlt_frame_set_image( frame, (uint8_t*) image, size, mlt_pool_release ); } else if ( image ) -- 1.7.7.6 -- Android apps run on BlackBerry 10 Introducing the new BlackBerry 10.2.1 Runtime for Android apps. Now with support for Jelly Bean, Bluetooth, Mapview and more. Get your Android app in front of a whole new audience. Start now. http://pubads.g.doubleclick.net/gampad/clk?id=124407151iu=/4140/ostg.clktrk___ Mlt-devel
[Mlt-devel] [PATCH 1/4] add frame drop explanation
Hi, attached patch adds a small explanation about frames drop in decklink producer. -- Maksym Veremeyenko From ae23d4e01066234521e75e012e3b7225e84619b1 Mon Sep 17 00:00:00 2001 From: Maksym Veremeyenko ve...@m1.tv Date: Thu, 13 Feb 2014 16:23:32 +0200 Subject: [PATCH 1/4] add frame drop explanation --- src/modules/decklink/producer_decklink.cpp |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/src/modules/decklink/producer_decklink.cpp b/src/modules/decklink/producer_decklink.cpp index a68ab80..9434893 100644 --- a/src/modules/decklink/producer_decklink.cpp +++ b/src/modules/decklink/producer_decklink.cpp @@ -526,7 +526,7 @@ public: { mlt_frame_close( frame ); mlt_properties_set_int( MLT_PRODUCER_PROPERTIES( getProducer() ), dropped, ++m_dropped ); -mlt_log_warning( getProducer(), frame dropped %d\n, m_dropped ); +mlt_log_warning( getProducer(), buffer overrun, frame dropped %d\n, m_dropped ); } pthread_mutex_unlock( m_mutex ); } -- 1.7.7.6 -- Android apps run on BlackBerry 10 Introducing the new BlackBerry 10.2.1 Runtime for Android apps. Now with support for Jelly Bean, Bluetooth, Mapview and more. Get your Android app in front of a whole new audience. Start now. http://pubads.g.doubleclick.net/gampad/clk?id=124407151iu=/4140/ostg.clktrk___ Mlt-devel mailing list Mlt-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mlt-devel
Re: [Mlt-devel] [PATCH 2/4] implement SSE optimized swab function
16.02.14 22:01, Dan Dennedy написав(ла): On Sun, Feb 16, 2014 at 6:27 AM, Maksym Veremeyenkove...@m1stereo.tv wrote: Hi, attached patch implement SSE2 optimized swab function that is activelly used with decklink producer/consumer. it gives not performance boots but in my case it decrease thread CPU usage from 12% to 9% for 1080i25. Our build servers are failing on this: common.cpp: In function 'void swab2(const void*, void*, int)': common.cpp:128:3: error: unknown register name 'xmm1' in 'asm' common.cpp:128:3: error: unknown register name 'xmm0' in 'asm' I see from the history on your previous asm contribution to composite, that I needed to comment out the last line of asm. what is OS, gcc used on a build server? -- Maksym Veremeyenko -- Android apps run on BlackBerry 10 Introducing the new BlackBerry 10.2.1 Runtime for Android apps. Now with support for Jelly Bean, Bluetooth, Mapview and more. Get your Android app in front of a whole new audience. Start now. http://pubads.g.doubleclick.net/gampad/clk?id=124407151iu=/4140/ostg.clktrk ___ Mlt-devel mailing list Mlt-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mlt-devel
Re: [Mlt-devel] [PATCH 3/4] fix samples number calculation for 24 and 32 bit output
16.02.14 20:25, Dan Dennedy написав(ла): On Sun, Feb 16, 2014 at 6:30 AM, Maksym Veremeyenkove...@m1stereo.tv wrote: Hi, if i specify pcm_s24le on output audio codec, consumer_avformat wrongly calculate a number of output samples and as result audio encoding function failed because of resulted packed buffer size greater then submitted. This requires a libavcodec version check. From some basic checking, it needs FFmpeg v1.0: #define LIBAVCODEC_VERSION_MAJOR 54 #define LIBAVCODEC_VERSION_MINOR 59 #define LIBAVCODEC_VERSION_MICRO 100 or libav 9.4: #define LIBAVCODEC_VERSION_MAJOR 54 #define LIBAVCODEC_VERSION_MINOR 35 #define LIBAVCODEC_VERSION_MICRO 0 We require the higher minor number to prevent compilation failure on FFmpeg v? updated patch with #if LIBAVCODEC_VERSION_INT = ((5416)+(598)+0) [...] #endif attached -- Maksym Veremeyenko Senior System Administrator IT Department Ukrainian Music Television Channel M1 DDI. +380 44 205-44-92 Tel. +380 44 205-44-80 Fax. +380 44 205-44-82 Cell. +380-67-447-22-43 E-mail : maksym.veremeye...@m1stereo.tv Web site: www.m1stereo.tv From 5376178021e8e3e2144e6ef53e7593e675ddb63b Mon Sep 17 00:00:00 2001 From: Maksym Veremeyenko ve...@m1.tv Date: Mon, 17 Feb 2014 10:55:48 +0200 Subject: [PATCH] fix samples number calculation for 24 and 32 bit output --- src/modules/avformat/consumer_avformat.c | 14 ++ 1 files changed, 14 insertions(+), 0 deletions(-) diff --git a/src/modules/avformat/consumer_avformat.c b/src/modules/avformat/consumer_avformat.c index 8776de8..b4753fa 100644 --- a/src/modules/avformat/consumer_avformat.c +++ b/src/modules/avformat/consumer_avformat.c @@ -709,6 +709,20 @@ static int open_audio( mlt_properties properties, AVFormatContext *oc, AVStream case AV_CODEC_ID_PCM_U16BE: audio_input_frame_size = 1; break; +#if LIBAVCODEC_VERSION_INT = ((5416)+(598)+0) +case AV_CODEC_ID_PCM_S24LE: +case AV_CODEC_ID_PCM_S24BE: +case AV_CODEC_ID_PCM_U24LE: +case AV_CODEC_ID_PCM_U24BE: + audio_input_frame_size /= 3; + break; +case AV_CODEC_ID_PCM_S32LE: +case AV_CODEC_ID_PCM_S32BE: +case AV_CODEC_ID_PCM_U32LE: +case AV_CODEC_ID_PCM_U32BE: + audio_input_frame_size = 2; + break; +#endif default: break; } -- 1.7.7.6 -- Android apps run on BlackBerry 10 Introducing the new BlackBerry 10.2.1 Runtime for Android apps. Now with support for Jelly Bean, Bluetooth, Mapview and more. Get your Android app in front of a whole new audience. Start now. http://pubads.g.doubleclick.net/gampad/clk?id=124407151iu=/4140/ostg.clktrk___ Mlt-devel mailing list Mlt-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mlt-devel
[Mlt-devel] [PATCH] reorder frame initialization call, cleanup useless parts
Hi, attached patch reorder mlt frame initialization to avoid additional mlt_frame_close for some cases. -- Maksym Veremeyenko From 85c892311c19099189147b616ff50177988a0c97 Mon Sep 17 00:00:00 2001 From: Maksym Veremeyenko ve...@m1.tv Date: Sun, 22 Jun 2014 17:29:32 +0300 Subject: [PATCH 2/6] reorder frame initialization call, cleanup useless parts --- src/modules/decklink/producer_decklink.cpp | 17 - 1 files changed, 4 insertions(+), 13 deletions(-) diff --git a/src/modules/decklink/producer_decklink.cpp b/src/modules/decklink/producer_decklink.cpp index 877c0ea..c580080 100644 --- a/src/modules/decklink/producer_decklink.cpp +++ b/src/modules/decklink/producer_decklink.cpp @@ -358,6 +358,7 @@ public: IDeckLinkVideoInputFrame* video, IDeckLinkAudioInputPacket* audio ) { + mlt_frame frame = NULL; if( !m_reprio ) { mlt_properties properties = MLT_PRODUCER_PROPERTIES( getProducer() ); @@ -402,9 +403,6 @@ public: return S_OK; } - // Create mlt_frame - mlt_frame frame = mlt_frame_init( MLT_PRODUCER_SERVICE( getProducer() ) ); - // Copy video if ( video ) { @@ -446,20 +444,17 @@ public: { size = video-GetRowBytes() * video-GetHeight(); swab2( (char*) buffer, (char*) image + m_vancLines * video-GetRowBytes(), size ); + frame = mlt_frame_init( MLT_PRODUCER_SERVICE( getProducer() ) ); mlt_frame_set_image( frame, (uint8_t*) image, size, mlt_pool_release ); } else if ( image ) { - mlt_log_verbose( getProducer(), no video\n ); + mlt_log_verbose( getProducer(), no video image\n ); mlt_pool_release( image ); } } else - { -mlt_log_verbose( getProducer(), no signal\n ); -mlt_frame_close( frame ); -frame = 0; - } +mlt_log_verbose( getProducer(), frame is invalid\n ); // Get timecode IDeckLinkTimecode* timecode = 0; @@ -479,11 +474,7 @@ public: } } else - { mlt_log_verbose( getProducer(), no video\n ); - mlt_frame_close( frame ); - frame = 0; - } // Copy audio if ( frame audio ) -- 1.7.7.6 -- HPCC Systems Open Source Big Data Platform from LexisNexis Risk Solutions Find What Matters Most in Your Big Data with HPCC Systems Open Source. Fast. Scalable. Simple. Ideal for Dirty Data. Leverages Graph Analysis for Fast Processing Easy Data Exploration http://p.sf.net/sfu/hpccsystems___ Mlt-devel mailing list Mlt-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mlt-devel
[Mlt-devel] [PATCH] fix playlist items move
Hi, attached patch fix playlist item movement and setting new indexes. -- Maksym Veremeyenko From eff949aeec2ffbe5299ebd21b0163dbd1d1f1ab5 Mon Sep 17 00:00:00 2001 From: Maksym Veremeyenko ve...@m1.tv Date: Sun, 22 Jun 2014 17:13:10 +0300 Subject: [PATCH 1/6] fix playlist items move --- src/framework/mlt_playlist.c |4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/src/framework/mlt_playlist.c b/src/framework/mlt_playlist.c index 62a1f16..306ff93 100644 --- a/src/framework/mlt_playlist.c +++ b/src/framework/mlt_playlist.c @@ -919,7 +919,9 @@ int mlt_playlist_move( mlt_playlist self, int src, int dest ) if ( current == src ) current = dest; - else if ( current src current dest ) + else if ( src current current dest ) + current --; + else if ( dest current current src ) current ++; else if ( current == dest ) current = src; -- 1.7.7.6 -- HPCC Systems Open Source Big Data Platform from LexisNexis Risk Solutions Find What Matters Most in Your Big Data with HPCC Systems Open Source. Fast. Scalable. Simple. Ideal for Dirty Data. Leverages Graph Analysis for Fast Processing Easy Data Exploration http://p.sf.net/sfu/hpccsystems___ Mlt-devel mailing list Mlt-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mlt-devel
Re: [Mlt-devel] [PATCH] reorder frame initialization call, cleanup useless parts
22.06.14 21:26, Dan Dennedy написав(ла): On Sun, Jun 22, 2014 at 6:21 AM, Maksym Veremeyenkove...@m1stereo.tv wrote: Hi, attached patch reorder mlt frame initialization to avoid additional mlt_frame_close for some cases. What problem does it solve? its avoid calling mlt_frame_close if some error condition happens. I do not like changing the message from no signal to frame is invalid. Blackmagic's API says: /.../ bmdFrameHasNoInputSource No input source was detected – frame is invalid /.../ The existing message is more clear. And the message change from video to video image is useless. this change was made to avoid similar error message for different kind of errors happens in this function... Also, from a code style perspective, while I do not often complain, I think if the if block has braces, then the else clause should as well. i can prepare a patch where all *else* code block remains a brackets. -- Maksym Veremeyenko -- HPCC Systems Open Source Big Data Platform from LexisNexis Risk Solutions Find What Matters Most in Your Big Data with HPCC Systems Open Source. Fast. Scalable. Simple. Ideal for Dirty Data. Leverages Graph Analysis for Fast Processing Easy Data Exploration http://p.sf.net/sfu/hpccsystems ___ Mlt-devel mailing list Mlt-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mlt-devel
Re: [Mlt-devel] [PATCH] reorder frame initialization call, cleanup useless parts
23.06.14 19:44, Dan Dennedy написав(ла): On Mon, Jun 23, 2014 at 8:30 AM, Maksym Veremeyenkove...@m1stereo.tv wrote: 22.06.14 21:26, Dan Dennedy написав(ла): [...] I do not like changing the message from no signal to frame is invalid. Blackmagic's API says: /.../ bmdFrameHasNoInputSource No input source was detected – frame is invalid /.../ The message no signal is still better. I reject that change. The existing message is more clear. And the message change from video to video image is useless. this change was made to avoid similar error message for different kind of errors happens in this function... OK, that is accepted. may be you can give a hint how to modify that messages to make them different to help in error locating? -- Maksym Veremeyenko -- HPCC Systems Open Source Big Data Platform from LexisNexis Risk Solutions Find What Matters Most in Your Big Data with HPCC Systems Open Source. Fast. Scalable. Simple. Ideal for Dirty Data. Leverages Graph Analysis for Fast Processing Easy Data Exploration http://p.sf.net/sfu/hpccsystems ___ Mlt-devel mailing list Mlt-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mlt-devel
Re: [Mlt-devel] [PATCH] reorder frame initialization call, cleanup useless parts
23.06.14 21:52, Dan Dennedy написав(ла): On Mon, Jun 23, 2014 at 10:02 AM, Maksym Veremeyenkove...@m1stereo.tv wrote: 23.06.14 19:44, Dan Dennedy написав(ла): On Mon, Jun 23, 2014 at 8:30 AM, Maksym Veremeyenkove...@m1stereo.tv wrote: 22.06.14 21:26, Dan Dennedy написав(ла): [...] I do not like changing the message from no signal to frame is invalid. Blackmagic's API says: /.../ bmdFrameHasNoInputSource No input source was detected – frame is invalid /.../ The message no signal is still better. I reject that change. The existing message is more clear. And the message change from video to video image is useless. this change was made to avoid similar error message for different kind of errors happens in this function... OK, that is accepted. may be you can give a hint how to modify that messages to make them different to help in error locating? I do not understand the question. Simply resubmit your patch with your best understanding of what was accepted and is expected. We will figure it out from there. :-) updated patch attached. no changes to error message -- Maksym Veremeyenko From 8a00b78b4f97cf14f2ddbda09305fae37e4a0860 Mon Sep 17 00:00:00 2001 From: Maksym Veremeyenko ve...@m1.tv Date: Tue, 24 Jun 2014 10:34:41 +0300 Subject: [PATCH 1/2] rework mlt frame initialization to avoid mlt_frame_close for some error cases --- src/modules/decklink/producer_decklink.cpp |9 +++-- 1 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/modules/decklink/producer_decklink.cpp b/src/modules/decklink/producer_decklink.cpp index 2845fb2..fb1afde 100644 --- a/src/modules/decklink/producer_decklink.cpp +++ b/src/modules/decklink/producer_decklink.cpp @@ -358,6 +358,8 @@ public: IDeckLinkVideoInputFrame* video, IDeckLinkAudioInputPacket* audio ) { + mlt_frame frame = NULL; + if( !m_reprio ) { mlt_properties properties = MLT_PRODUCER_PROPERTIES( getProducer() ); @@ -402,8 +404,6 @@ public: return S_OK; } - // Create mlt_frame - mlt_frame frame = mlt_frame_init( MLT_PRODUCER_SERVICE( getProducer() ) ); // Copy video if ( video ) @@ -446,6 +446,7 @@ public: { size = video-GetRowBytes() * video-GetHeight(); swab2( (char*) buffer, (char*) image + m_vancLines * video-GetRowBytes(), size ); + frame = mlt_frame_init( MLT_PRODUCER_SERVICE( getProducer() ) ); mlt_frame_set_image( frame, (uint8_t*) image, size, mlt_pool_release ); } else if ( image ) @@ -457,8 +458,6 @@ public: else { mlt_log_verbose( getProducer(), no signal\n ); -mlt_frame_close( frame ); -frame = 0; } // Get timecode @@ -481,8 +480,6 @@ public: else { mlt_log_verbose( getProducer(), no video\n ); - mlt_frame_close( frame ); - frame = 0; } // Copy audio -- 1.7.7.6 -- Open source business process management suite built on Java and Eclipse Turn processes into business applications with Bonita BPM Community Edition Quickly connect people, data, and systems into organized workflows Winner of BOSSIE, CODIE, OW2 and Gartner awards http://p.sf.net/sfu/Bonitasoft___ Mlt-devel mailing list Mlt-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mlt-devel
[Mlt-devel] [PATCH] implement matte transition
Hi, attached patch implement *matte* transition. it perform replacing alpha channel of track A with luma of track B. Luma of track B will be scaled if it required. that patch helps to avoid using uncompressed BGRA video for CG. test data could be downloaded from http://downloads.m1stereo.tv/8a1b443c948a9de6b6a32e665235de06/ if you need to prepare FILL and KEY (MATTE) files, you can use ffmpeg to extract alpha channel from existing video. For example: extract alpha channel and video and create matte file: ffmpeg -i sg_gm_2013_clip_title.avi -vf alphaextract -pix_fmt yuv422p -preset placebo -crf 10 -y sg_gm_2013_clip_title.matte_scaled.mp4 because of example above provides a scaled luma output, transition performs scaling (not SSE optimized) it from [16,235] - [0, 255], it is possible to create unscaled (full) range: ffmpeg -i sg_gm_2013_clip_title.avi -vf alphaextract -pix_fmt yuvj422p -preset placebo -crf 10 -y sg_gm_2013_clip_title.matte_full.mp4 fill track will be created similar: ffmpeg -i sg_gm_2013_clip_title.avi -pix_fmt yuv422p -preset placebo -crf 10 -y sg_gm_2013_clip_title.fill.mp4 -- Maksym Veremeyenko From 26cf01645b9000b9229c476eec95ba4adb083cfc Mon Sep 17 00:00:00 2001 From: Maksym Veremeyenko ve...@m1.tv Date: Tue, 24 Jun 2014 19:29:12 +0300 Subject: [PATCH] implement matte transition --- src/modules/core/Makefile |1 + src/modules/core/factory.c|3 + src/modules/core/transition_matte.c | 177 + src/modules/core/transition_matte.yml | 12 +++ 4 files changed, 193 insertions(+), 0 deletions(-) create mode 100644 src/modules/core/transition_matte.c create mode 100644 src/modules/core/transition_matte.yml diff --git a/src/modules/core/Makefile b/src/modules/core/Makefile index f4b73f4..71bd848 100644 --- a/src/modules/core/Makefile +++ b/src/modules/core/Makefile @@ -39,6 +39,7 @@ OBJS = factory.o \ transition_luma.o \ transition_mix.o \ transition_region.o \ + transition_matte.o \ consumer_multi.o \ consumer_null.o diff --git a/src/modules/core/factory.c b/src/modules/core/factory.c index 64b2fe2..86aaab3 100644 --- a/src/modules/core/factory.c +++ b/src/modules/core/factory.c @@ -56,6 +56,7 @@ extern mlt_producer producer_noise_init( mlt_profile profile, mlt_service_type t #include transition_composite.h extern mlt_transition transition_luma_init( mlt_profile profile, mlt_service_type type, const char *id, char *arg ); extern mlt_transition transition_mix_init( mlt_profile profile, mlt_service_type type, const char *id, char *arg ); +extern mlt_transition transition_matte_init( mlt_profile profile, mlt_service_type type, const char *id, char *arg ); #include transition_region.h static mlt_properties metadata( mlt_service_type type, const char *id, void *data ) @@ -105,6 +106,7 @@ MLT_REPOSITORY MLT_REGISTER( transition_type, composite, transition_composite_init ); MLT_REGISTER( transition_type, luma, transition_luma_init ); MLT_REGISTER( transition_type, mix, transition_mix_init ); + MLT_REGISTER( transition_type, matte, transition_matte_init ); MLT_REGISTER( transition_type, region, transition_region_init ); MLT_REGISTER_METADATA( consumer_type, multi, metadata, consumer_multi.yml ); @@ -139,5 +141,6 @@ MLT_REPOSITORY MLT_REGISTER_METADATA( transition_type, composite, metadata, transition_composite.yml ); MLT_REGISTER_METADATA( transition_type, luma, metadata, transition_luma.yml ); MLT_REGISTER_METADATA( transition_type, mix, metadata, transition_mix.yml ); + MLT_REGISTER_METADATA( transition_type, matte, metadata, transition_matte.yml ); MLT_REGISTER_METADATA( transition_type, region, metadata, transition_region.yml ); } diff --git a/src/modules/core/transition_matte.c b/src/modules/core/transition_matte.c new file mode 100644 index 000..f1b9bdd --- /dev/null +++ b/src/modules/core/transition_matte.c @@ -0,0 +1,177 @@ +/* + * transition_luma.c -- a generic dissolve/wipe processor + * Copyright (C) 2003-2014 Ushodaya Enterprises Limited + * Author: Dan Dennedy d...@dennedy.org + * + * Adapted from Kino Plugin Timfx, which is + * Copyright (C) 2002 Timothy M. Shead tsh...@k-3d.com + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite
Re: [Mlt-devel] [PATCH] implement matte transition
26.06.14 09:31, Dan Dennedy написав(ла): On Tue, Jun 24, 2014 at 11:36 PM, Maksym Veremeyenkove...@m1stereo.tv wrote: Hi, attached patch implement *matte* transition. it perform replacing alpha channel of track A with luma of track B. Luma of track B will be scaled if it required. Hi Maksym, excellent contribution! Have you seen the shape filter in the vmfx directory? It basically does something similar when you set use_luminance=1, but it seems to have been designed for some more odd and silly use cases whereas your transition simply satisfies a more common need. Some comments. +/* + * transition_luma.c -- a generic dissolve/wipe processor Fix the file name and description done + * Copyright (C) 2003-2014 Ushodaya Enterprises Limited + * Author: Dan Dennedyd...@dennedy.org Make yourself the author! replaced only author string, copyright remain the same + * Adapted from Kino Plugin Timfx, which is + * Copyright (C) 2002 Timothy M. Sheadtsh...@k-3d.com Rremove those lines as they do not apply. +#include transition_composite.h Remove that include. +// mlt_service_lock( MLT_TRANSITION_SERVICE( transition ) ); ... +// mlt_service_unlock( MLT_TRANSITION_SERVICE( transition ) ); Services need to be locked if they modify the state of the service (transition, here) because in parallel processing there can be multiple threads in the same get_image function. In your case, you are not modifying state. So, remove those lines, which leads to: + // Get the properties of the transition + mlt_properties properties = MLT_TRANSITION_PROPERTIES( transition ); You never use this properties! You can remove those lines. And.. + // Get the transition object + mlt_transition transition = mlt_frame_pop_service( a_frame ); You can remove those lines and the corresponding mlt_frame_push_service() in your process function. +// if ( b_frame == NULL ) +// { +// +// } + if ( b_frame != NULL ) + { You push the b_frame from your process function. In the process function, you will always get a valid b_frame. Those lines can be removed and code shifted to left when removing the block braces. done +++ b/src/modules/core/transition_matte.yml @@ -0,0 +1,12 @@ +schema_version: 0.1 +type: transition +identifier: matte +title: Matte +version: 1 +copyright: Ushodaya Enterprises Limited +creator: Dan Dennedy Again, make yourself the author. replaced only author string, copyright remain the same +license: LGPLv2.1 +language: en +tags: + - Video +description: Replace alphachannel with data from luma channel of other track. Please document the full_luma property under a parameters: section. i added more explanation and ffmpeg calls examples. -- Maksym Veremeyenko From db129d6be3307584538574ed72039f29c0e0c485 Mon Sep 17 00:00:00 2001 From: Maksym Veremeyenko ve...@m1.tv Date: Thu, 26 Jun 2014 13:35:08 +0300 Subject: [PATCH] implement matte transition --- src/modules/core/Makefile |1 + src/modules/core/factory.c|3 + src/modules/core/transition_matte.c | 155 + src/modules/core/transition_matte.yml | 44 + 4 files changed, 203 insertions(+), 0 deletions(-) create mode 100644 src/modules/core/transition_matte.c create mode 100644 src/modules/core/transition_matte.yml diff --git a/src/modules/core/Makefile b/src/modules/core/Makefile index f4b73f4..71bd848 100644 --- a/src/modules/core/Makefile +++ b/src/modules/core/Makefile @@ -39,6 +39,7 @@ OBJS = factory.o \ transition_luma.o \ transition_mix.o \ transition_region.o \ + transition_matte.o \ consumer_multi.o \ consumer_null.o diff --git a/src/modules/core/factory.c b/src/modules/core/factory.c index 64b2fe2..86aaab3 100644 --- a/src/modules/core/factory.c +++ b/src/modules/core/factory.c @@ -56,6 +56,7 @@ extern mlt_producer producer_noise_init( mlt_profile profile, mlt_service_type t #include transition_composite.h extern mlt_transition transition_luma_init( mlt_profile profile, mlt_service_type type, const char *id, char *arg ); extern mlt_transition transition_mix_init( mlt_profile profile, mlt_service_type type, const char *id, char *arg ); +extern mlt_transition transition_matte_init( mlt_profile profile, mlt_service_type type, const char *id, char *arg ); #include transition_region.h static mlt_properties metadata( mlt_service_type type, const char *id, void *data ) @@ -105,6 +106,7 @@ MLT_REPOSITORY MLT_REGISTER( transition_type, composite, transition_composite_init ); MLT_REGISTER( transition_type, luma, transition_luma_init ); MLT_REGISTER( transition_type, mix, transition_mix_init ); + MLT_REGISTER( transition_type, matte, transition_matte_init ); MLT_REGISTER( transition_type, region, transition_region_init ); MLT_REGISTER_METADATA( consumer_type, multi, metadata, consumer_multi.yml ); @@ -139,5 +141,6 @@ MLT_REPOSITORY MLT_REGISTER_METADATA( transition_type, composite
[Mlt-devel] [PATCH] enable output VITC and RP188 by default
Hi, attached patch enable output VITC by default. -- Maksym Veremeyenko From c1a3d25bca943f6eae144bab4efd9d46d5ff653a Mon Sep 17 00:00:00 2001 From: Maksym Veremeyenko ve...@m1.tv Date: Thu, 26 Jun 2014 14:55:36 +0300 Subject: [PATCH 1/2] enable output VITC and RP188 by default --- src/modules/decklink/consumer_decklink.cpp |3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/src/modules/decklink/consumer_decklink.cpp b/src/modules/decklink/consumer_decklink.cpp index 1de5b43..99e875e 100644 --- a/src/modules/decklink/consumer_decklink.cpp +++ b/src/modules/decklink/consumer_decklink.cpp @@ -246,7 +246,8 @@ public: } // Set the video output mode - if ( S_OK != m_deckLinkOutput-EnableVideoOutput( m_displayMode-GetDisplayMode(), bmdVideoOutputFlagDefault ) ) + if ( S_OK != m_deckLinkOutput-EnableVideoOutput( m_displayMode-GetDisplayMode(), + bmdVideoOutputFlagDefault | bmdVideoOutputRP188 | bmdVideoOutputVITC) ) { mlt_log_error( getConsumer(), Failed to enable video output\n ); return false; -- 1.7.7.6 -- Open source business process management suite built on Java and Eclipse Turn processes into business applications with Bonita BPM Community Edition Quickly connect people, data, and systems into organized workflows Winner of BOSSIE, CODIE, OW2 and Gartner awards http://p.sf.net/sfu/Bonitasoft___ Mlt-devel mailing list Mlt-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mlt-devel
[Mlt-devel] [PATCH] use INT_MAX for for default producer length ?
Hi, i found that specifying in/out properties of producer (with still image) is not enough for playing it for specified time. In the attached test file logo will disappear in 10 minutes because of default length for producer was set to 15000 frames. may be we can change 15000 magic value with another large value like INT_MAX? -- Maksym Veremeyenko From 856abd2f14ba26a142a9324458775d7a358f4493 Mon Sep 17 00:00:00 2001 From: Maksym Veremeyenko ve...@m1.tv Date: Fri, 27 Jun 2014 11:12:31 +0300 Subject: [PATCH] use INT_MAX for for default producer length --- src/framework/mlt_producer.c |4 ++-- src/modules/core/producer_hold.c |2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/framework/mlt_producer.c b/src/framework/mlt_producer.c index d5c049b..6311198 100644 --- a/src/framework/mlt_producer.c +++ b/src/framework/mlt_producer.c @@ -93,8 +93,8 @@ int mlt_producer_init( mlt_producer self, void *child ) mlt_properties_set_double( properties, _frame, 0 ); mlt_properties_set_double( properties, _speed, 1.0 ); mlt_properties_set_position( properties, in, 0 ); - mlt_properties_set_position( properties, out, 14999 ); - mlt_properties_set_position( properties, length, 15000 ); + mlt_properties_set_position( properties, out, INT_MAX - 1 ); + mlt_properties_set_position( properties, length, INT_MAX ); mlt_properties_set( properties, eof, pause ); mlt_properties_set( properties, resource, producer ); diff --git a/src/modules/core/producer_hold.c b/src/modules/core/producer_hold.c index 6c888c4..c5e323c 100644 --- a/src/modules/core/producer_hold.c +++ b/src/modules/core/producer_hold.c @@ -55,7 +55,7 @@ mlt_producer producer_hold_init( mlt_profile profile, mlt_service_type type, con mlt_properties_set_position( properties, frame, 0 ); mlt_properties_set_position( properties, in, 0 ); mlt_properties_set_position( properties, out, 25 ); - mlt_properties_set_position( properties, length, 15000 ); + mlt_properties_set_position( properties, length, INT_MAX ); mlt_properties_set( properties, resource, arg ); mlt_properties_set( properties, method, onefield ); -- 1.7.7.6 ?xml version=1.0 ? mlt producer id=clip in=0 out=2 property name=resource/home/studio/Videos/TheCore/data/m-files/11.11.2000_1.avi/property property name=force_aspect_ratio@16/15/property /producer producer id=producer0 property name=force_aspect_ratio@16/15/property property name=resource/home/studio/Videos/TheCore/data/assets/m1_logo_fullHD.png/property /producer playlist id=playlist0 entry producer=producer0 in=0 out=2/ /playlist tractor multitrack track producer=clip/ track producer=playlist0/ /multitrack transition in=0 out=2 property name=valigntop/property property name=halignright/property property name=progressive1/property property name=distort0/property property name=key[0]-30/30:100%x100%:100/property property name=key[2]-30/30:100%x100%:100/property property name=mlt_servicecomposite/property property name=a_track0/property property name=b_track1/property /transition /tractor /mlt -- Open source business process management suite built on Java and Eclipse Turn processes into business applications with Bonita BPM Community Edition Quickly connect people, data, and systems into organized workflows Winner of BOSSIE, CODIE, OW2 and Gartner awards http://p.sf.net/sfu/Bonitasoft___ Mlt-devel mailing list Mlt-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mlt-devel
Re: [Mlt-devel] [PATCH] use INT_MAX for for default producer length ?
27.06.14 20:30, Dan Dennedy написав(ла): On Thu, Jun 26, 2014 at 11:25 PM, Maksym Veremeyenko ve...@m1stereo.tv mailto:ve...@m1stereo.tv wrote: Hi, i found that specifying in/out properties of producer (with still image) is not enough for playing it for specified time. In the attached test file logo will disappear in 10 minutes because of default length for producer was set to 15000 frames. may be we can change 15000 magic value with another large value like INT_MAX? OK, I have known about this since forever, and I have been on the fence about whether to change it. For the longest time my feeling was that apps should manage the length of image producers, and then this problem never really appears to the user. However, for the person using the command line, melted, or manually learning and authoring MLT XML, it is inconvenient to have to be reminded about this default length and not be able to simply set the out point. So, I can accept the patch after some testing in apps Shotcut, Flowblade, and Kdenlive. We have to test different kinds of producers to ensure the user does not end up accidentally adding some huge item to the timeline, potentially causing a crash due to exceeding some GUI canvas limitation. Therefore, I will apply the patch after the 0.9.2 release. that patch would definitely break Shotcut, Flowblade, and Kdenlive behaviour... may then introduce env variable to override default value? -- Maksym Veremeyenko -- Open source business process management suite built on Java and Eclipse Turn processes into business applications with Bonita BPM Community Edition Quickly connect people, data, and systems into organized workflows Winner of BOSSIE, CODIE, OW2 and Gartner awards http://p.sf.net/sfu/Bonitasoft ___ Mlt-devel mailing list Mlt-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mlt-devel
[Mlt-devel] [PATCH] implement SSE optimized luma copy/scale functions
Hi, attached set of patches implements optimization for luma scale in matte transition, first patch change scaling equation that avoid division and only use shift and multiplication second patch implement using SSE code for scaling and copying luma. -- Maksym Veremeyenko From fd58ca781aa2d8f68aaedabe7b0f428c5baf6853 Mon Sep 17 00:00:00 2001 From: Maksym Veremeyenko ve...@m1.tv Date: Fri, 27 Jun 2014 12:14:45 +0300 Subject: [PATCH 1/2] update scaling equantion to avoid division --- src/modules/core/transition_matte.c |4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/src/modules/core/transition_matte.c b/src/modules/core/transition_matte.c index c127761..25e93c4 100644 --- a/src/modules/core/transition_matte.c +++ b/src/modules/core/transition_matte.c @@ -57,7 +57,9 @@ static void copy_Y_to_A_scaled_luma(uint8_t* alpha_a, int stride_a, uint8_t* ima p = 16; if(p 235) p = 235; - p = (p - 16) * 255 / 219; + /* p = (p - 16) * 255 / 219; */ + p -= 16; + p = ((p 8) + (p * 43)) 8; alpha_a[i] = p; }; -- 1.7.7.6 From 466e71bd8f7f9fd7ec7fb800bc312c5d0305b16b Mon Sep 17 00:00:00 2001 From: Maksym Veremeyenko ve...@m1.tv Date: Fri, 27 Jun 2014 17:05:50 +0300 Subject: [PATCH 2/2] implement SSE optimized luma copy/scale functions --- src/modules/core/transition_matte.c | 151 ++- 1 files changed, 149 insertions(+), 2 deletions(-) diff --git a/src/modules/core/transition_matte.c b/src/modules/core/transition_matte.c index 25e93c4..2ea0acd 100644 --- a/src/modules/core/transition_matte.c +++ b/src/modules/core/transition_matte.c @@ -30,26 +30,173 @@ typedef void ( *copy_luma_fn )(uint8_t* alpha_a, int stride_a, uint8_t* image_b, int stride_b, int width, int height); +#if defined(USE_SSE) +static void __attribute__((noinline)) copy_Y_to_A_full_luma_sse(uint8_t* alpha_a, uint8_t* image_b, int cnt) +{ + const static unsigned char const4[] = + { + 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0 + }; + + __asm__ volatile + ( + movdqu (%[equ255]), %%xmm4 \n\t /* load bottom value 0xff */ + + loop_start1: \n\t + + /* load pixels block 1 */ + movdqu 0(%[image_b]), %%xmm0 \n\t + add$0x10, %[image_b] \n\t + + /* load pixels block 2 */ + movdqu 0(%[image_b]), %%xmm1 \n\t + add$0x10, %[image_b] \n\t + + /* leave only Y */ + pand %%xmm4, %%xmm0 \n\t + pand %%xmm4, %%xmm1 \n\t + + /* pack to 8 bit value */ + packuswb %%xmm1, %%xmm0 \n\t + + /* store */ + movdqu %%xmm0, (%[alpha_a])\n\t + add$0x10, %[alpha_a] \n\t + + /* loop if we done */ + dec%[cnt] \n\t + jnzloop_start1 \n\t + : + : [cnt]r (cnt), [alpha_a]r(alpha_a), [image_b]r(image_b), [equ255]r(const4) + ); +}; +#endif + static void copy_Y_to_A_full_luma(uint8_t* alpha_a, int stride_a, uint8_t* image_b, int stride_b, int width, int height) { int i, j; for(j = 0; j height; j++) { - for(i = 0; i width; i++) + i = 0; +#if defined(USE_SSE) + if(width = 16) + { + copy_Y_to_A_full_luma_sse(alpha_a, image_b, width 4); + i = (width 4) 4; + } +#endif + for(; i width; i++) alpha_a[i] = image_b[2*i]; alpha_a += stride_a; image_b += stride_b; }; }; +#if defined(USE_SSE) +static void __attribute__((noinline)) copy_Y_to_A_scaled_luma_sse(uint8_t* alpha_a, uint8_t* image_b, int cnt) +{ + const static unsigned char const1[] = + { + 43, 0, 43, 0, 43, 0, 43, 0, 43, 0, 43, 0, 43, 0, 43, 0 + }; + const static unsigned char const2[] = + { + 16, 0, 16, 0, 16, 0, 16, 0, 16, 0, 16, 0, 16, 0, 16, 0 + }; + const static unsigned char const3[] = + { + 235, 0, 235, 0, 235, 0, 235, 0, 235, 0, 235, 0, 235, 0, 235, 0 + }; + const static unsigned char const4[] = + { + 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0, 255, 0 + }; + + __asm__ volatile + ( + movdqu (%[equ43]), %%xmm7 \n\t /* load multiplier 43 */ + movdqu (%[equ16]), %%xmm6 \n\t /* load bottom value 16 */ + movdqu (%[equ235]), %%xmm5 \n\t /* load bottom value 235 */ + movdqu (%[equ255]), %%xmm4 \n\t /* load bottom value 0xff */ + + loop_start:\n\t + + /* load pixels block 1 */ + movdqu 0(%[image_b]), %%xmm0 \n\t + add$0x10, %[image_b] \n\t + + /* load pixels block 2 */ + movdqu 0(%[image_b]), %%xmm1 \n\t + add$0x10, %[image_b] \n\t + + /* leave only Y */ + pand %%xmm4, %%xmm0 \n\t + pand %%xmm4, %%xmm1 \n\t + + /* upper range clip */ + pminsw %%xmm5, %%xmm0 \n\t + pminsw %%xmm5, %%xmm1 \n\t + + /* upper range clip */ + pmaxsw %%xmm6, %%xmm0
[Mlt-devel] [PATCH] avoid creating alpha channel if not required (review request)
Hi, i was tried to reach realtime performance for some simple cg operation and found that during composite transition operation MLT create an alpha plane for frame that has not it and not even require for further display. i.e. if you put a small CG over HD frame, MLT create a full frame alpha channel and further blending operation use it memory for no reason IMHO. so i implement function mlt_frame_get_alpha_mask_nc that do the same as mlt_frame_get_alpha_mask but do not create alpha channel if not exist - it just return NULL. next i replaced some code parts for using mlt_frame_get_alpha_mask_nc and handling returned NULL value. finally composite_line_yuv_sse2_simple function was split into 8 variants: |0| dest_a == NULL | src_a == NULL | weight == 256 | blit |1| dest_a == NULL | src_a == NULL | weight != 256 | blend: with given alpha |2| dest_a == NULL | src_a != NULL | weight == 256 | blend: only src alpha |3| dest_a == NULL | src_a != NULL | weight != 256 | blend: premultiply src alpha |4| dest_a != NULL | src_a == NULL | weight == 256 | blit: blit and set dst alpha to FF |5| dest_a != NULL | src_a == NULL | weight != 256 | blend: with given alpha |6| dest_a != NULL | src_a != NULL | weight == 256 | blend: full blend without src alpha premutiply |7| dest_a != NULL | src_a != NULL | weight != 256 | blend: full (origin version) from my tests i did not found visible regression. may be somebody else could also review/test proposed code. -- Maksym Veremeyenko From 2e973085a151bd43762b17bf37e802cdcb130167 Mon Sep 17 00:00:00 2001 From: Maksym Veremeyenko ve...@m1.tv Date: Fri, 27 Jun 2014 18:02:16 +0300 Subject: [PATCH 1/6] rename arguments indexes to literal names --- src/modules/core/composite_line_yuv_sse2_simple.c | 30 ++-- 1 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/modules/core/composite_line_yuv_sse2_simple.c b/src/modules/core/composite_line_yuv_sse2_simple.c index 04eb1ca..049ed9e 100644 --- a/src/modules/core/composite_line_yuv_sse2_simple.c +++ b/src/modules/core/composite_line_yuv_sse2_simple.c @@ -33,9 +33,9 @@ void composite_line_yuv_sse2_simple(uint8_t *dest, uint8_t *src, int width, uint __asm__ volatile ( pxor %%xmm0, %%xmm0 \n\t /* clear zero register */ -movdqu (%4), %%xmm9\n\t /* load const1 */ -movdqu (%7), %%xmm10 \n\t /* load const2 */ -movd %0, %%xmm1 \n\t /* load weight and decompose */ +movdqu (%[const1]), %%xmm9 \n\t /* load const1 */ +movdqu (%[const2]), %%xmm10\n\t /* load const2 */ +movd %[weight], %%xmm1 \n\t /* load weight and decompose */ movlhps%%xmm1, %%xmm1 \n\t pshuflw$0, %%xmm1, %%xmm1 \n\t pshufhw$0, %%xmm1, %%xmm1 \n\t @@ -46,7 +46,7 @@ void composite_line_yuv_sse2_simple(uint8_t *dest, uint8_t *src, int width, uint 00 W 00 W 00 W 00 W 00 W 00 W 00 W 00 W */ loop_start:\n\t -movq (%1), %%xmm2\n\t /* load source alpha */ +movq (%[alpha_b]), %%xmm2\n\t /* load source alpha */ punpcklbw %%xmm0, %%xmm2 \n\t /* unpack alpha 8 8-bits alphas to 8 16-bits values */ /* @@ -68,7 +68,7 @@ void composite_line_yuv_sse2_simple(uint8_t *dest, uint8_t *src, int width, uint /* DSTa = DSTa + (SRCa * (0xFF - DSTa)) 8 */ -movq (%5), %%xmm3\n\t /* load dst alpha */ +movq (%[alpha_a]), %%xmm3\n\t /* load dst alpha */ punpcklbw %%xmm0, %%xmm3 \n\t /* unpack dst 8 8-bits alphas to 8 16-bits values */ movdqa %%xmm9, %%xmm4 \n\t psubw %%xmm3, %%xmm4 \n\t @@ -80,10 +80,10 @@ void composite_line_yuv_sse2_simple(uint8_t *dest, uint8_t *src, int width, uint psrlw $8, %%xmm4 \n\t paddw %%xmm4, %%xmm3 \n\t packuswb %%xmm0, %%xmm3 \n\t -movq %%xmm3, (%5)\n\t /* save dst alpha */ +movq %%xmm3, (%[alpha_a])\n\t /* save dst alpha */ -movdqu (%2), %%xmm3\n\t /* load src */ -movdqu (%3), %%xmm4\n\t /* load dst */ +movdqu (%[src]), %%xmm3\n\t /* load src */ +movdqu (%[dest]), %%xmm4 \n\t /* load dst */ movdqa %%xmm3, %%xmm5 \n\t /* dub src */ movdqa %%xmm4, %%xmm6 \n\t /* dub dst */ @@ -185,21 +185,21 @@ void composite_line_yuv_sse2_simple(uint8_t *dest, uint8_t *src, int width, uint
Re: [Mlt-devel] [mltframework/mlt] 0c9cce: update scaling equantion to avoid division
14.07.14 06:42, Dan Dennedy написав(ла): Maksym, after making this commit, our 32-bit Ubuntu 12.04 build node started reporting this failure to build: transition_matte.c: In function 'copy_Y_to_A_scaled_luma_sse': transition_matte.c:115:2: error: can't find a register in class 'GENERAL_REGS' while reloading 'asm' transition_matte.c:115:2: error: 'asm' operand has impossible constraints it seems 32-bit building has not enough registers for input operands. i attached patch that disable using SSE code on 32-bit systems. -- Maksym Veremeyenko From 1fef4deb4e1ea554b7c7cc99cc9ebacc91f67d5a Mon Sep 17 00:00:00 2001 From: Maksym Veremeyenko ve...@m1.tv Date: Mon, 14 Jul 2014 14:22:16 +0300 Subject: [PATCH] avoid SSE code on 32-bit system --- src/modules/core/transition_matte.c |8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/modules/core/transition_matte.c b/src/modules/core/transition_matte.c index 56035a1..bde7e38 100644 --- a/src/modules/core/transition_matte.c +++ b/src/modules/core/transition_matte.c @@ -29,7 +29,7 @@ typedef void ( *copy_luma_fn )(uint8_t* alpha_a, int stride_a, uint8_t* image_b, int stride_b, int width, int height); -#if defined(USE_SSE) +#if defined(USE_SSE) defined(ARCH_X86_64) static void __attribute__((noinline)) copy_Y_to_A_full_luma_sse(uint8_t* alpha_a, uint8_t* image_b, int cnt) { const static unsigned char const4[] = @@ -78,7 +78,7 @@ static void copy_Y_to_A_full_luma(uint8_t* alpha_a, int stride_a, uint8_t* image for(j = 0; j height; j++) { i = 0; -#if defined(USE_SSE) +#if defined(USE_SSE) defined(ARCH_X86_64) if(width = 16) { copy_Y_to_A_full_luma_sse(alpha_a, image_b, width 4); @@ -92,7 +92,7 @@ static void copy_Y_to_A_full_luma(uint8_t* alpha_a, int stride_a, uint8_t* image }; }; -#if defined(USE_SSE) +#if defined(USE_SSE) defined(ARCH_X86_64) static void __attribute__((noinline)) copy_Y_to_A_scaled_luma_sse(uint8_t* alpha_a, uint8_t* image_b, int cnt) { const static unsigned char const1[] = @@ -188,7 +188,7 @@ static void copy_Y_to_A_scaled_luma(uint8_t* alpha_a, int stride_a, uint8_t* ima for(j = 0; j height; j++) { i = 0; -#if defined(USE_SSE) +#if defined(USE_SSE) defined(ARCH_X86_64) if(width = 16) { copy_Y_to_A_scaled_luma_sse(alpha_a, image_b, width 4); -- 1.7.9.5 -- Want fast and easy access to all the code in your enterprise? Index and search up to 200,000 lines of code with a free copy of Black Duck#174; Code Sight#153; - the same software that powers the world's largest code search on Ohloh, the Black Duck Open Hub! Try it now. http://p.sf.net/sfu/bds___ Mlt-devel mailing list Mlt-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mlt-devel
[Mlt-devel] [PATCH] restart decklink if input signal changed mode
Hi, if input signal to decklink board is differ from specified at board initialization or changed later, decklink could inform it by VideoInputFormatChanged callback. but it still does not give a proper frame at VideoInputFrameArrived provided patch stop/start decklink board with updated profile. -- Maksym Veremeyenko From a2a7c254df003a7082d395626dac904a647cd326 Mon Sep 17 00:00:00 2001 From: Maksym Veremeyenko ve...@m1.tv Date: Wed, 3 Sep 2014 19:11:50 +0300 Subject: [PATCH] restart decklink if input signal changed mode --- src/modules/decklink/producer_decklink.cpp | 10 ++ 1 files changed, 10 insertions(+), 0 deletions(-) diff --git a/src/modules/decklink/producer_decklink.cpp b/src/modules/decklink/producer_decklink.cpp index 04510f4..e194b38 100644 --- a/src/modules/decklink/producer_decklink.cpp +++ b/src/modules/decklink/producer_decklink.cpp @@ -79,6 +79,7 @@ private: } public: + mlt_profile m_new_input; void setProducer( mlt_producer producer ) { m_producer = producer; } @@ -91,6 +92,7 @@ public: m_producer = NULL; m_decklink = NULL; m_decklinkInput = NULL; + m_new_input = NULL; } virtual ~DeckLinkProducer() @@ -606,6 +608,7 @@ public: ( mode-GetFlags() bmdDisplayModeColorspaceRec709 ) ? 709 : 601; mlt_log_verbose( getProducer(), colorspace changed %d\n, profile-colorspace ); } + m_new_input = profile; return S_OK; } }; @@ -627,6 +630,13 @@ static int get_frame( mlt_producer producer, mlt_frame_ptr frame, int index ) mlt_position end = mlt_producer_get_playtime( producer ); end = ( mlt_producer_get_length( producer ) end ? mlt_producer_get_length( producer ) : end ) - 1; + if ( decklink decklink-m_new_input ) + { + decklink-m_new_input = NULL; + decklink-stop(); + decklink-start( decklink-m_new_input ); + } + // Re-open if needed if ( !decklink pos end ) { -- 1.7.7.6 -- Slashdot TV. Video for Nerds. Stuff that matters. http://tv.slashdot.org/___ Mlt-devel mailing list Mlt-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mlt-devel
Re: [Mlt-devel] [PATCH] pass list of properties for encapsulated producer and consumer
05.09.14 19:28, Dan Dennedy написав(ла): On Fri, Sep 5, 2014 at 3:51 AM, Maksym Veremeyenkove...@m1stereo.tv wrote: Hi, this patch provides ability to pass properties to encapsulated producer and consumer. Thank you for the contribution, Maksym. We have a convention to use a prefix on the property name to make it pass to encapsulated services. See for example, watermark and affine filters. In this case, you would use simply mlt_properties_pass() with prefix. or consumer.. How do you feel to change your patch to work like that? Or, is there are reason you prefer it as you have submitted? i reworked a patch to use prefixes producer. and consumer.. please review -- Maksym Veremeyenko From 33cd2bbf7cb0ef5ecedca97e3619272b91575282 Mon Sep 17 00:00:00 2001 From: Maksym Veremeyenko ve...@m1.tv Date: Mon, 8 Sep 2014 12:28:02 +0300 Subject: [PATCH] pass prefixed properties to encapsulated producer and consumer --- src/modules/core/producer_consumer.c | 26 +- 1 files changed, 25 insertions(+), 1 deletions(-) diff --git a/src/modules/core/producer_consumer.c b/src/modules/core/producer_consumer.c index dc436cc..e09865f 100644 --- a/src/modules/core/producer_consumer.c +++ b/src/modules/core/producer_consumer.c @@ -20,6 +20,9 @@ #include framework/mlt.h +#define CONSUMER_PROPERTIES_PREFIX consumer. +#define PRODUCER_PROPERTIES_PREFIX producer. + #include stdio.h #include stdlib.h #include math.h @@ -101,6 +104,23 @@ static int get_audio( mlt_frame frame, void **buffer, mlt_audio_format *format, return result; } +static void property_changed( mlt_properties owner, mlt_consumer self, char *name ) +{ + mlt_properties properties = MLT_PRODUCER_PROPERTIES(self); + context cx = mlt_properties_get_data( properties, context, NULL ); + + if ( !cx ) + return; + + if ( name == strstr( name, CONSUMER_PROPERTIES_PREFIX ) ) + mlt_properties_set(MLT_CONSUMER_PROPERTIES( cx-consumer ), name + strlen( CONSUMER_PROPERTIES_PREFIX ), + mlt_properties_get( properties, name )); + + if ( name == strstr( name, PRODUCER_PROPERTIES_PREFIX ) ) + mlt_properties_set(MLT_PRODUCER_PROPERTIES( cx-producer ), name + strlen( PRODUCER_PROPERTIES_PREFIX ), + mlt_properties_get( properties, name )); +} + static int get_frame( mlt_producer self, mlt_frame_ptr frame, int index ) { mlt_properties properties = MLT_PRODUCER_PROPERTIES(self); @@ -152,7 +172,11 @@ static int get_frame( mlt_producer self, mlt_frame_ptr frame, int index ) mlt_properties_get_int( properties, real_time ) ); mlt_properties_pass_list( MLT_CONSUMER_PROPERTIES( cx-consumer ), properties, buffer, prefill, deinterlace_method, rescale ); - + + mlt_properties_pass( MLT_CONSUMER_PROPERTIES( cx-consumer ), properties, CONSUMER_PROPERTIES_PREFIX ); + mlt_properties_pass( MLT_PRODUCER_PROPERTIES( cx-producer ), properties, PRODUCER_PROPERTIES_PREFIX ); + mlt_events_listen( properties, self, property-changed, ( mlt_listener )property_changed ); + // Connect it all together mlt_consumer_connect( cx-consumer, MLT_PRODUCER_SERVICE( cx-producer ) ); mlt_consumer_start( cx-consumer ); -- 1.7.7.6 -- Want excitement? Manually upgrade your production database. When you want reliability, choose Perforce Perforce version control. Predictably reliable. http://pubads.g.doubleclick.net/gampad/clk?id=157508191iu=/4140/ostg.clktrk___ Mlt-devel mailing list Mlt-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mlt-devel
Re: [Mlt-devel] [PATCH] restart decklink if input signal changed mode
08.09.14 00:59, Dan Dennedy написав(ла): On Wed, Sep 3, 2014 at 7:27 AM, Maksym Veremeyenkove...@m1stereo.tv wrote: Hi, if input signal to decklink board is differ from specified at board initialization or changed later, decklink could inform it by VideoInputFormatChanged callback. but it still does not give a proper frame at VideoInputFrameArrived provided patch stop/start decklink board with updated profile. I tested this patch today, and it causes a regression for me. I am using Desktop Video 9.8 on Ubuntu 12.04 64-bit. I am giving a DeckLink SDI card SD NTSC input, and running simply melt -verbose decklink: which starts with a dv_pal MLT profile, then performs auto-profile in which DeckLink input format detection occurs and changes the profile. The regression I experience is that there are very many dropped frames [consumer sdl] dropped video frame and playback is very choppy, of course. Adding -consumer sdl real_time=0 or -1 does make the problem go away, but I consider the out of the box experience of melt decklink: broken by it. i think that is normal because of there is no framerate convertor in mlt and 29.97 incoming framerate cause a drop frame because consumer works with 25 fps before startup decklink been configured to dv_pal, but after *VideoInputFormatChanged* notification call it is been restarted with detected profile, like dv_ntsc in you case. in my case without patch i receive a white frame that generated by: [...] if ( !*frame ) *frame = mlt_frame_init( MLT_PRODUCER_SERVICE(producer) ); [...] with a path i receive at least some frames. my test case was sending 1080i50 into dv_pal configured input and visa-verse Does the problem you address occur with a different version of Desktop Video? Or, do I need a different test scenario to produce the problem you see? i use the same diver version -- Maksym Veremeyenko -- Want excitement? Manually upgrade your production database. When you want reliability, choose Perforce Perforce version control. Predictably reliable. http://pubads.g.doubleclick.net/gampad/clk?id=157508191iu=/4140/ostg.clktrk ___ Mlt-devel mailing list Mlt-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mlt-devel