[MPlayer-dev-eng] rgb<->yuv convertion question
mayaray
mayaray at 263.sina.com
Thu Jan 15 01:59:03 CET 2004
----- Original Message -----
From:D Richard Felker III <dalias at aerifal.cx>
To:mplayer-dev-eng at mplayerhq.hu
Subject:Re: [MPlayer-dev-eng] rgb<->yuv convertion question
Date:Wed, 14 Jan 2004 11:11:21 +0800
> On Wed, Jan 14, 2004 at 10:23:02AM +0800, mayaray wrote:
> > i saw the following matrix in docs/tech/colorspaces.txt:
> >
> > Y = (0.257 * R) + (0.504 * G) + (0.098 * B) + 16
> > Cr = V = (0.439 * R) - (0.368 * G) - (0.071 * B) + 128
> > Cb = U = -(0.148 * R) - (0.291 * G) + (0.439 * B) + 128
> >
> > B = 1.164(Y - 16) + 2.018(U - 128)
> > G = 1.164(Y - 16) - 0.813(V - 128) - 0.391(U - 128)
> > R = 1.164(Y - 16) + 1.596(V - 128)
> >
> > then i used it in my program, but the result of a RGB2YUV followed by a YUV2RGB has some red dots or dashes in places
> > where the lumination is high.
> > the pRGB is a BYTE * and Y, U, V are all BYTE.
> > does my accuracy not high enough?
>
> No, but you have to clamp the results so they fit in a byte. Otherwise
> they'll overflow/wrap.
>
> BTW you should probably use fixed point rather than float. Float will
> be _very_ slow.
>
> Rich
>
so how can i clamp and use fixed point in vc using c++?
should i write the clamp function?
i can only find fixed point type in opengl and asm, does it
exist in c++?
thanks.
felix
===================================================================
More information about the MPlayer-dev-eng
mailing list