[theora-dev] yuv - rgb conversion without contrast decrease.

Ralph Giles giles at xiph.org
Tue Nov 20 13:17:17 PST 2007

On Tue, Nov 20, 2007 at 02:32:58PM -0200, Ribamar Santarosa de Sousa wrote:

> When I convert an yuv pixel into rgb using the recipies in
> http://www.fourcc.org/fccyvrgb.php I get an accurate color conversion
> but the contrast seems to be decreased. If i write, e.g., the pixel
> directly into an sdl yuv_overlay, I get a well-contrasted frame,
> however, if I convert the pixel to rgb and call SDL_MapRGB, I get a
> contrast-decreased frame.

This is complicated. Could be gamma, could be the reduced dynamic range 
of broadcast oriented colorspaces. There's a chapter in the spec which 
explains how to convert the two calibrated colorspaces; you might check 
if either of them reduce to any of the recipies you found. Of course, 
most video is encoded without a specific colorspace marked, so you're 
"free" to do whatever looks good.

There's also yuv2rgb code in liboggplay you can look at.


More information about the theora-dev mailing list