Re: [Mlt-devel] [PATCH] save converted image for next use

2012-02-20 Thread Dan Dennedy
2012/2/17 Maksym Veremeyenko ve...@m1stereo.tv:
 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...

It will only work when you call mlt_frame_set_image beforehand, which
I believe you had done in the previous patch. Now you are not, so
yeah, it is ok to call convert_image.

 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...

This is not fault of yours, but I can simply not include yet another
form of caching into this pixbuf producer. I need to review the old
cache (as opposed to usage of mlt_cache) first.

-- 
+-DRD-+

--
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] save converted image for next use

2012-02-20 Thread Dan Dennedy
On Mon, Feb 20, 2012 at 10:17 AM, Dan Dennedy d...@dennedy.org wrote:
 2012/2/17 Maksym Veremeyenko ve...@m1stereo.tv:
 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...

 It will only work when you call mlt_frame_set_image beforehand, which
 I believe you had done in the previous patch. Now you are not, so
 yeah, it is ok to call convert_image.

 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...

 This is not fault of yours, but I can simply not include yet another
 form of caching into this pixbuf producer. I need to review the old
 cache (as opposed to usage of mlt_cache) first.

The old cache driven by the cache property caches an entire image
sequence into memory, which has very limited usage. The only time it
makes sense is when you have a short sequence and you reuse that
producer. The only thing I can see really using this is some unknown
playout server that smartly reuses a producer for an animated lower
third or watermark. Note this does not cache the colorspace-converted
images.

The purpose of mlt_cache for pixbuf.pixbuf is to recycle the
unscaled image because the resolution can change from one frame to the
next by the requester (e.g. affine transition). The usage of
mlt_service_cache prevents too many GdkPixbuf objects in memory at the
same time in a complex composition. We had kdenlive users using
hundreds of image clips - not an image sequence, but a laboriously
constructed slideshow. These pixbuf objects hold open a file
descriptor exhausting max file handles per process as well consuming
memory.

The purpose of mlt_cache for pixbuf.image is to recycle the scaled
image. Again, the usage of mlt_service_cache helps reduce memory
consumption. A mlt_service_cache applies across all instances of a
particular service in a graph. IOW, only up to 10 are actually in
memory while the least recently used get flushed. Your patch does not
take advantage of this. Imagine a few hundred digital photos
referenced by a Kdenlive project. Once you play through the project,
all of those images (albeit scaled and converted) are being cached in
producer_pixbuf.clone.image.

I think pixbuf.image should hold the converted image, but the
refresh_image() function needs refactoring to simplify it before we
can do anything more to it. Also, I maintain producer_qimage in
parallel with this, so it will need the same treatment. Finally, both
of these are also pending an enhancement to image sequence loading
that j-b-m requested. I will start the refactoring now.

-- 
+-DRD-+

--
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] save converted image for next use

2012-02-17 Thread Maksym Veremeyenko

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] save converted image for next use

2012-02-16 Thread Maksym Veremeyenko
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] [PATCH] save converted image for next use

2012-02-16 Thread Maksym Veremeyenko
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] save converted image for next use

2012-02-16 Thread Dan Dennedy
2012/2/16 Maksym Veremeyenko ve...@m1stereo.tv:
 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...

but it is a low priority for me, and I do not see the considerable
gain it would provide, but feel free to clarify

 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...

A filter or transition can already indicate if it needs to do
something by choosing whether to push its get_image function pointer
onto a stack on the frame. Producers also push get_image onto the
frame's stack, but they need pretty much to do this for every frame to
define the frame's image. Perhaps a change to mlt_producer can repeat
the previous frame's image if the actual producer did not put
get_image on the stack. Some property of the producer could choose the
behavior since things like the mlt_playlist producer support blank
items and theoretically so could a regular producer.

Also, avformat producer has caching based on position. Maybe that can
be generalized and used for this purpose, but I think it does not make
sense for some live sources. OTOH, decklink producer is a live source
and now does position-based caching to support yadif deinterlace and
framerate adaption. Needs more thinking through, but I think we are
getting close to something general.

-- 
+-DRD-+

--
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

2012-02-16 Thread Dan Dennedy
On Thu, Feb 16, 2012 at 9:44 AM, Dan Dennedy d...@dennedy.org wrote:
 2012/2/16 Maksym Veremeyenko ve...@m1stereo.tv:
 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...

 but it is a low priority for me, and I do not see the considerable
 gain it would provide, but feel free to clarify

I came to a realization: the current behavior is consistent with
mlt_frame_get_audio and mlt_frame_get_image, both of which synthesize
data when there is none and no operations on the stack. So, I am very
reluctant to change this.

-- 
+-DRD-+

--
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

2012-02-15 Thread Dan Dennedy
2012/2/14 Maksym Veremeyenko ve...@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.

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.

-- 
+-DRD-+

--
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


[Mlt-devel] [PATCH] save converted image for next use

2012-02-14 Thread Maksym Veremeyenko

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 @@