[FFmpeg-devel] lavfi state of affairs

Michael Niedermayer michaelni
Sun Feb 8 12:57:43 CET 2009


On Sun, Feb 08, 2009 at 01:31:48PM +0200, Kostya wrote:
> On Sun, Feb 08, 2009 at 02:54:57AM +0100, Michael Niedermayer wrote:
> > On Sat, Feb 07, 2009 at 07:30:51PM +0200, Kostya wrote:
> > > 
> > > 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!
>  
> Here's the patch (for RGB24/BGR24 only for now), seems to work but testing and
> comments are welcome.
>  
> > also dont forget brightness/contrast/saturation/full_range
> 
> It was easy (both to forget and to implement)
> 
> > [...]
> > -- 
> > Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

> Index: yuv2rgb.c
> ===================================================================
> --- yuv2rgb.c	(revision 28473)
> +++ yuv2rgb.c	(working copy)

yuv2rgb.c is under gpl, please put the code somewhere else unlessyou
replace the whole file

[...]
> +int my_yuv2rgb_c_init_tables (SwsContext *c, const int inv_table[4], int fullRange, int brightness, int contrast, int saturation)
> +{
> +    /*const int isRgb =      c->dstFormat==PIX_FMT_RGB32
> +                        || c->dstFormat==PIX_FMT_RGB32_1
> +                        || c->dstFormat==PIX_FMT_BGR24
> +                        || c->dstFormat==PIX_FMT_RGB565
> +                        || c->dstFormat==PIX_FMT_RGB555
> +                        || c->dstFormat==PIX_FMT_RGB8
> +                        || c->dstFormat==PIX_FMT_RGB4
> +                        || c->dstFormat==PIX_FMT_RGB4_BYTE
> +                        || c->dstFormat==PIX_FMT_MONOBLACK;*/

well ...

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

Opposition brings concord. Out of discord comes the fairest harmony.
-- Heraclitus
-------------- 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/329babc6/attachment.pgp>



More information about the ffmpeg-devel mailing list