[FFmpeg-devel] [PATCH] Enable swscale by default

Michael Niedermayer michaelni
Sun Sep 14 17:46:50 CEST 2008


On Sun, Sep 14, 2008 at 05:26:14PM +0200, Michael Niedermayer wrote:
> On Sun, Sep 14, 2008 at 04:01:57PM +0100, M?ns Rullg?rd wrote:
> > Michael Niedermayer <michaelni at gmx.at> writes:
[...]
> > > The only plain C GPL code that iam aware of that we need in there are
> > > 220 lines of yuv2rgb table generation code.
> > > Rewriting this is easy, luca did it already IIRC but walken
> > > claimed copyright on the rewritten table generator. Noone else dared to
> > > try again and i simply have no personal interrest in rewriting FOSS code
> > > due to its license being disliked by some other people.
> > >
> > > Also the scaler might almost function entirely without this table generator
> > > We by now have a almost complete plain C rgb->yuv path that doesnt need it.
> > > Though it from a technical POV would be better to keep this or a equivalent
> > > table generator because it means more flexibility in terms of speed vs.
> > > quality.
> > 
> > Can someone explain what the table should contain?  How hard can it be
> > to generate a table?
> 
> not hard, but first to awnser justins similar question. Posting the
> output is useless because it depends on contrast, saturation, ... parameters.
> 
> What the tables contain is so that
> 8bit u, v, y0, y1 of 2 pixels YUV 4:2:2 can be converted to RGB by
> 
>     pr = tab_rV[v];
>     pg = tab_gU[u] + tab_gV[v];
>     pb = tab_bU[u];
> 
>     pixel0= pr[y0] + pg[y0] + pb[y0];
>     pixel1= pr[y1] + pg[y1] + pb[y1];
> 
> pixel0 and pixel1 here are 32 bit rgb/bgr32 or 16 bit rgb/bgr 15/16
> 
> 
> rgb/bgr24 is a special case for which the code looks like
>     pr = tab_rV[v];
>     pg = tab_gU[u] + tab_gV[v];
>     pb = tab_bU[u];
> 
>     pixel0r= pr[y0];
>     pixel0g= pg[y0];
>     pixel0b= pb[y0];
>     pixel1r= pr[y1];
>     pixel1g= pg[y1];
>     pixel1b= pb[y1];
> 
> tab_* thus contain pointers and the type of the pointers pr/pg/pb depends
> on the output.
> 
> The tables depend on the yuv type and 255 vs 219/224 range as well as a few
> parameters like user specified contrast and brightness.

also there are 2 ways to make such tables.
First is to have 3 * 256 * 256 * sizeof(type) tables
Second is what yuv2rgb does, that is have pointers of each of the 3 RGB tables
point into 3 corresponding 1-dimensional tables, this significantly
reduces the table size but leads to slight rounding errors.

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

I am the wisest man alive, for I know one thing, and that is that I know
nothing. -- Socrates
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20080914/4c9eb5a7/attachment.pgp>



More information about the ffmpeg-devel mailing list