[FFmpeg-devel] lavfi state of affairs

Kostya kostya.shishkov
Sat Feb 7 18:30:51 CET 2009


On Fri, Feb 06, 2009 at 11:16:42AM +0100, Michael Niedermayer wrote:
> On Fri, Feb 06, 2009 at 09:43:44AM +0200, Kostya wrote:
> > On Thu, Feb 05, 2009 at 11:02:24PM +0100, Michael Niedermayer wrote:
> > > On Thu, Feb 05, 2009 at 12:36:55PM -0800, Baptiste Coudurier wrote:
> > > > Hi Michael,
> > > > 
> > > > On 2/5/2009 12:21 PM, Michael Niedermayer wrote:
> > > > 
> > > > Sorry but if _you_ want imgconvert dropped, _you_ have to make some 
> > > > efforts too.
> > >
> > > Dont you think its a little offensive to ask the one who probably spend more
> > > efforts on sws than anyone else to make some effort "too" ?
> > > Also i dont mind fixing technical issues and cleanliness ones, but i will
> > > not rewrite the GPL code. There are people who want the yuv table generator
> > > to be under LGPL, they can rewrite it but IMHO they should not block the
> > > removial of cruft if they decide not to.
> > > And i know you are an excelent developer, you could likely rewrite the darn
> > > table generator in less than 2 hours.
> > 
> > Well, I think I can do that (if I find the requirements to it). 
> 
> there are
>  void * yuvTable;            // pointer to the yuv->rgb table start so it can be freed()
>     uint8_t * table_rV[256];
>     uint8_t * table_gU[256];
>     int    table_gV[256];
>     uint8_t * table_bU[256];
> in the sws context
> 
> their use in swscale should make it obvious what they contain.
> 
> simply dumping the contents and the pointers (overlap) for the tables
> should also make it clear what they contain for the various pix_fmts
 
Well, from what I've debugged, looks like it's standard formula, like can be seen here:
http://www.fourcc.org/fccyvrgb.php

R = 1.164(Y - 16) + 1.596(V - 128)
G = 1.164(Y - 16) - 0.813(V - 128) - 0.391(U - 128)
B = 1.164(Y - 16)                  + 2.018(U - 128)

Current table generator (judging from table output, haven't tried seeing the code)
generates one table for scaled Y component and uint8_t* tables are used to point to
the different parts of it.

R = 1.164(Y - 16 + 1.596/1.164(V - 128)) = 1.164(Y + 1.371*V + 192)
G = 1.164(Y - 16 - 0.813/1.164(V - 128) - 0.391/1.164(U - 128)) = 1.164(Y - 0.698*V - 0.336*U + 116)
B = 1.164(Y - 16 + 2.018/1.164(U - 128)) = 1.164(Y + 1.734*U - 238)

With this formulae I think I will write (maybe not so nice) table generator that
will differ by +-1 but licensed under WTFPL2 (http://sam.zoy.org/wtfpl/)

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




More information about the ffmpeg-devel mailing list