<!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 Tue, 2005-02-22 at 12:07 +0100, Gergely Nagy wrote:
<BLOCKQUOTE TYPE=CITE>
<PRE>
<FONT COLOR="#000000">On Mon, 2005-02-21 at 15:34 +1100, Jan Schmidt wrote:</FONT>
<FONT COLOR="#000000">&gt; On Sun, 2005-02-20 at 21:58 +0100, Maciej Katafiasz wrote:</FONT>
<FONT COLOR="#000000">&gt; &gt;Dnia 20-02-2005, nie o godzinie 18:51 +0100, Gergely Nagy napisa&#322;:</FONT>
<FONT COLOR="#000000">&gt; &gt;&gt; Note, that the text renderer element would only create a buffer that</FONT>
<FONT COLOR="#000000">&gt; &gt;&gt; is large enough to hold the text, not as large as the whole frame</FONT>
<FONT COLOR="#000000">&gt; &gt;&gt; it will be rendered onto. This way the extra overhead coming from</FONT>
<FONT COLOR="#000000">&gt; &gt;&gt; the fact that renderer and blender are separated is insignificant.</FONT>
<FONT COLOR="#000000">&gt; &gt;</FONT>
<FONT COLOR="#000000">&gt; &gt;Not really, you kinda need to render to full frame (at least logically</FONT>
<FONT COLOR="#000000">&gt; &gt;so), because subtitles are to be positioned precisely. If we were to</FONT>
<FONT COLOR="#000000">&gt; &gt;render only &quot;necessary&quot; parts, it will make correct positioning</FONT>
<FONT COLOR="#000000">&gt; &gt;impossible. As I refuse to pass positioning info via caps, it pretty</FONT>
<FONT COLOR="#000000">&gt; &gt;much reduces to either RLE or what Jan proposed -- equivalent of X</FONT>
<FONT COLOR="#000000">&gt; &gt;damage regions. I favor the latter, having RLE decoder inside imagemixer</FONT>
<FONT COLOR="#000000">&gt; &gt;feels wrong :)</FONT>
<FONT COLOR="#000000">&gt; </FONT>
<FONT COLOR="#000000">&gt; Actually, I think an RLE input format will be useful - in fact I'm</FONT>
<FONT COLOR="#000000">&gt; planning to implement one for DVD subtitling, because RLE is the format</FONT>
<FONT COLOR="#000000">&gt; the subtitles are given as on DVD. I'm planning to do this with a helper</FONT>
<FONT COLOR="#000000">&gt; library in gst-libs to avoid duplicating the code everywhere, of course.</FONT>

<FONT COLOR="#000000">I'd think an RLE decoder would be more useful.. The only case where an</FONT>
<FONT COLOR="#000000">RLE input format might be better, is when you can memcpy a bunch of</FONT>
<FONT COLOR="#000000">pixels over the background. Which is the most common case for subtitles,</FONT>
<FONT COLOR="#000000">true, but in that case, blitting an uncompressed image over the picture</FONT>
<FONT COLOR="#000000">is pretty fast too (and has an added benefit of making it possible to do</FONT>
<FONT COLOR="#000000">some tricks, like transparency, anti-aliasing and stuff like that).</FONT>
</PRE>
</BLOCKQUOTE>
<BR>
I guess you mean having an RLE decoder separate to the videomixer. My motivation is entirely geared toward DVD, currently - I want to avoid taking RLE compressed subtitles off the DVD and writing out an uncompressed region (which may be as large as the entire framebuffer) and then reading that back in from main memory to blend it, when a simple RLE encoding makes the number of bytes that need to move in and out of main memory quite a lot smaller.<BR>
<BR>
There's no reason videomixer can't accept several available buffer formats on the input pads and have some internal functions that know how to blend those, within reason - I think RLE is simple enough, but a JPEG format would be silly.<BR>
<BR>
<BLOCKQUOTE TYPE=CITE>
<PRE>
<FONT COLOR="#000000">&gt; Also, I don't think we need anything as complex as a full XDamage</FONT>
<FONT COLOR="#000000">&gt; structure, we just need some values in the first bytes of the buffer</FONT>
<FONT COLOR="#000000">&gt; that specify the x/y offset and have each buffer represent a single</FONT>
<FONT COLOR="#000000">&gt; output rectangle to draw. To draw multiple regions in an output frame,</FONT>
<FONT COLOR="#000000">&gt; the text renderers could supply a stream of buffers with 0 duration and</FONT>
<FONT COLOR="#000000">&gt; identical timestamps. Only the last buffer of the set would have a</FONT>
<FONT COLOR="#000000">&gt; non-zero duration.</FONT>

<FONT COLOR="#000000">I don't really like this... this places additional burden on the mixer,</FONT>
<FONT COLOR="#000000">which will have to care about buffer timestamps and durations. Couldn't</FONT>
<FONT COLOR="#000000">we have the text renderer output a container format that has a header</FONT>
<FONT COLOR="#000000">prepended to each region-buffer, and have a regionmixer that parses the</FONT>
<FONT COLOR="#000000">format, and calls into imagemixer appropriately? This way, the mixer</FONT>
<FONT COLOR="#000000">would not need extensive modifications to deal with 0 duration buffers.</FONT>
<FONT COLOR="#000000">It wouldn't even know about it, as the regionmixer takes care of that</FONT>
<FONT COLOR="#000000">stuff.</FONT>
</PRE>
</BLOCKQUOTE>
<BR>
I don't know whether you're suggesting a subclass of videomixer here, or whether you're confused about how GStreamer elements interact.<BR>
If anything, I think we'd add your 'multiple regions overlay' format as an frame encoding that the videomixer knows how to read and blend onto an AYUV framebuffer, and then add that mime-type to the pad capabilities for the sink pads of videomixer.<BR>
<BR>
<BLOCKQUOTE TYPE=CITE>
<PRE>
<FONT COLOR="#000000">I mean something like, text_renderer outputs this container format,</FONT>
<FONT COLOR="#000000">regionmixer parses it into individual buffers, then passes each one in</FONT>
<FONT COLOR="#000000">turn to gst_imagemixer_mix(). This sounds like pretty easy to do.</FONT>
</PRE>
</BLOCKQUOTE>
What is 'gst_imagemixer_mix()'? I don't know whether you're describing having 2 separate GStreamer elements named 'regionmixer' and 'imagemixer'. If you are, well - Gstreamer elements are only allowed to interact by pushing Gstreamer buffers and events to each other, they can't call functions in another element.<BR>
<BR>
<BLOCKQUOTE TYPE=CITE>
<PRE>
<FONT COLOR="#000000">However, what would be best, is to push a whole buffer set over on a</FONT>
<FONT COLOR="#000000">pad. That way, one wouldn't have to do the splitting into individual</FONT>
<FONT COLOR="#000000">buffers part (far more resource friendly, and faster, since it means far</FONT>
<FONT COLOR="#000000">less buffer copying), nor would we need the 0-duration checking.</FONT>

</PRE>
</BLOCKQUOTE>
There's no way in GStreamer to pass a group of buffers as one. Are you using 'buffer' in a different way than we use it in GStreamer circles?<BR>
<BR>
J.<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>