<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
<HTML>
<HEAD>
  <META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=UTF-8">
  <META NAME="GENERATOR" CONTENT="GtkHTML/3.5.6">
</HEAD>
<BODY>
On Sun, 2005-02-20 at 17:34 +0100, Gergely Nagy wrote:
<BLOCKQUOTE TYPE=CITE>
<PRE>
<FONT COLOR="#000000">On Mon, 21 Feb 2005 01:40:48 +1100, Jan Schmidt &lt;<A HREF="mailto:thaytan@noraisin.net">thaytan@noraisin.net</A>&gt; wrote:</FONT>
<FONT COLOR="#000000">&gt; On Sun, 2005-02-20 at 15:09 +0100, Maciej Katafiasz wrote:</FONT>
<FONT COLOR="#000000">&gt; </FONT>
<FONT COLOR="#000000">&gt; &gt;Is it really going to be expensive if most of that image will be 100%</FONT>
<FONT COLOR="#000000">&gt; &gt;alpha anyway?</FONT>
<FONT COLOR="#000000">&gt; </FONT>
<FONT COLOR="#000000">&gt; Yes, it's more expensive to write out and then drag in 2 entire frames</FONT>
<FONT COLOR="#000000">&gt; worth of overlay image from main memory and iterate over it ~25 times</FONT>
<FONT COLOR="#000000">&gt; per second if you don't have to.</FONT>
<FONT COLOR="#000000">&gt; </FONT>
<FONT COLOR="#000000">&gt; There's a need for an imageoverlay to do this, but I think there's also</FONT>
<FONT COLOR="#000000">&gt; a place for a text renderer that draws straight onto the image buffer.</FONT>

<FONT COLOR="#000000">I'd like to believe there is no need to have two elements that do</FONT>
<FONT COLOR="#000000">almost the same thing, but rather have one, that can efficiently do</FONT>
<FONT COLOR="#000000">both tasks.</FONT>
</PRE>
</BLOCKQUOTE>
<BR>
I'm thinking that it's undesirable to have a single element that does both text/font rendering and <BR>
general image blending - an application doesn't want to load a pango/cairo dependency to render <BR>
text if it wants to blend png or DVD subtitle images over the video, for example. <BR>
<BR>
For that reason, it would be nicer to have a separate textoverlay as we currently have, that draws<BR>
text directly onto an image buffer, or a textrender that generates output buffers in a format that<BR>
makes blending efficient for a separate imageoverlay to handle.<BR>
<BR>
<BLOCKQUOTE TYPE=CITE>
<PRE>
<FONT COLOR="#000000">&gt; A possibly-decent alternative would be to provide the rendered</FONT>
<FONT COLOR="#000000">&gt; text-as-image overlay frames to the imageoverlay in a new frame format</FONT>
<FONT COLOR="#000000">&gt; that isn't just a raw image frame, but has a header describing</FONT>
<FONT COLOR="#000000">&gt; cropping information at the start of each frame.</FONT>

<FONT COLOR="#000000">How about rendering the text only (then, the buffer will be eg,</FONT>
<FONT COLOR="#000000">174x48), setting the caps on the srcpad appropriately (so the mixer</FONT>
<FONT COLOR="#000000">notices the dimension change), and optionally telling the mixer in one</FONT>
<FONT COLOR="#000000">way or the other the new position at which blending should occur? (Eg,</FONT>
<FONT COLOR="#000000">by setting the mixers xpos/ypos properties, or somesuch)</FONT>
</PRE>
</BLOCKQUOTE>
<BR>
Setting the caps would work, but you don't want to specify the xpos/ypos as a property on the image blending element - if you do that, it becomes the application's responsibility to synchronise updating it with the processing of the stream. You really want to put the xpos/ypos in the stream itself. You could put it in the caps on the pad along with the width and height: width, height, xpos, ypos. That involves (potentially) changing the caps on every frame, which may or may not be bad for performance, I'm not sure.<BR>
<BR>
We're still left with bad performance in the case where you have a subtitle to render containing 2 pieces of text in opposite corners of the frame. <BR>
<BR>
In that case, you still end up with a large mostly-empty image to blend onto the output, but it would be handled more efficiently by a textoverlay that could render directly onto the frame.<BR>
<BR>
Run-length compression, or at least some line-skipping semantics in the overlay image frame format handed to the videooverlay would alleviate this. In other words, I still think it's a good idea to hand buffers to the imageoverlay in a format other than raw uncompressed AYUV.<BR>
<BR>
J.<BR>
 <BR>
<TABLE CELLSPACING="0" CELLPADDING="0" WIDTH="100%">
<TR>
<TD>
-- <BR>
Jan Schmidt &lt;<A HREF="mailto:thaytan@noraisin.net">thaytan@noraisin.net</A>&gt;
</TD>
</TR>
</TABLE>
</BODY>
</HTML>