[FFmpeg-devel] Fw: Re: [issue986] Truemotion2 decoder - chroma issues

Michael Niedermayer michaelni
Thu Apr 23 22:09:27 CEST 2009

On Thu, Apr 23, 2009 at 01:00:04PM -0700, Jason Garrett-Glaser wrote:
> On Thu, Apr 23, 2009 at 12:52 PM, Michael Niedermayer <michaelni at gmx.at> wrote:
> > On Thu, Apr 23, 2009 at 12:36:20PM -0700, Jason Garrett-Glaser wrote:
> >> > The problem is that tm2 yuv seems to use 9bit for U & V this makes
> >> > it impossible to fit in any of the common pixel packings
> >> > thus it seems this has to be to converted in the decoder unless you
> >> > would use 16bit YUV420 but this seems really silly.
> >>
> >> 9-bit U/V? ?What is it using, YCgCo?
> >
> > no, is anyone using YCgCo ? I tried it in ffv1 once and it was
> > crap compared to normal YCbCr in terms of compression IIRC.
> Is it better than RGB?

YCbCr compressed better than RGB, YCgCo was a little worse than YCbCr in my
test a long time ago but iam pretty sure it was better than RGB
that is IIRC

>  I recall that YCgCo with 9-bit U/V can
> represent all RGB color values.

So can YCbCr

also if you are interrested in that stuff, it is VERY easy to test with
ffv1 how well they compress, just change:

            int v= src[x + stride*y];
            int b= v&0xFF;
            int g= (v>>8)&0xFF;
            int r= (v>>16)&0xFF;

            b -= g;
            r -= g;
            g += (b + r)>>2;
            b += 0x100;
            r += 0x100;

//            assert(g>=0 && b>=0 && r>=0);
//            assert(g<256 && b<512 && r<512);
            sample[0][0][x]= g;
            sample[1][0][x]= b;
            sample[2][0][x]= r;

to whichever transform you like to try

Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Rewriting code that is poorly written but fully understood is good.
Rewriting code that one doesnt understand is a sign that one is less smart
then the original author, trying to rewrite it will not make it better.
-------------- 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/20090423/74d0eb65/attachment.pgp>

More information about the ffmpeg-devel mailing list