[FFmpeg-devel] lavfi state of affairs

Michael Niedermayer michaelni
Sun Feb 8 02:54:57 CET 2009


On Sat, Feb 07, 2009 at 07:30:51PM +0200, Kostya wrote:
> 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)

there are several formulas in there, mpeg4 lists:

      Table 6-9 -- Matrix Coefficients
Value Matrix
0     (forbidden)
1     ITU-R Recommendation BT.709
      EY = 0,7152 EG + 0,0722 EB + 0,2126 ER
      EPB = -0,386 EG + 0,500 EB -0,115 ER
      EPR = -0,454 EG - 0,046 EB + 0,500 ER
2     Unspecified Video
           Image characteristics are unknown.
3     reserved
4     FCC
      EY = 0,59 EG + 0,11 EB + 0,30 ER
      EPB = -0,331 EG + 0,500 EB -0,169 ER
      EPR = -0,421 EG - 0,079 EB + 0,500 ER
5     ITU-R Recommendation BT.470-2 System B, G
      EY = 0,587 EG + 0,114 EB + 0,299 ER
      EPB = -0,331 EG + 0,500 EB -0,169 ER
      EPR = -0,419 EG - 0,081 EB + 0,500 ER
6     SMPTE 170M
      EY = 0,587 EG + 0,114 EB + 0,299 ER
      EPB = -0,331 EG + 0,500 EB -0,169 ER
      EPR = -0,419 EG - 0,081 EB + 0,500 ER
7     SMPTE 240M (1987)
      EY = 0,701 EG + 0,087 EB + 0,212 ER
      EPB = -0,384 EG + 0,500 EB -0,116 ER
      EPR = -0,445 EG - 0,055 EB + 0,500 ER
8-255 reserved




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

+-1 difference is ok, especially if you are more accurate than the current code


> but licensed under WTFPL2 (http://sam.zoy.org/wtfpl/)

very good!


also dont forget brightness/contrast/saturation/full_range

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

Observe your enemies, for they first find out your faults. -- Antisthenes
-------------- 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/20090208/06fec452/attachment.pgp>



More information about the ffmpeg-devel mailing list