Home > Archive > Compression > December 2005 > YCbCr to RGB
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
|
|
| Arne Demmers 2005-12-02, 8:50 pm |
| Hi,
as a thesis project I'm busy writing a small jpeg decoder for an
embedded system. Now I came across a problem when converting from YCbCr
to the RGB colorspace.
I used the formulas for this that are in the JFIF specs. Now it seems
that even if I have no values for eighter of the Y, Cb or Cr component,
that it's still possible to overflow an 8-bit unsigned variable when
converting to R, G or B.
If there is an overflow, how should I handle it?
It seems also rather logical to me that if even there is an overflow
that it would never be very high, however, for the test image I'm using
I came across the following values:
Y = 154, Cb = 10, Cr = 254 which gives the following rounded values: R
= 331, G = 105, B = -55
The G value seems possible, since it's in the range, hoever when
looking at R and B they seem rather outragious to me. What could leed
to such abnormal values???
grtz
Arne Demmers
| |
|
| "Arne Demmers" <arne.demmers@scarlet.be> ha scritto nel messaggio
news:1133359046.738476.154660@g14g2000cwa.googlegroups.com...
> Hi,
>
> as a thesis project I'm busy writing a small jpeg decoder for an
> embedded system. Now I came across a problem when converting from YCbCr
> to the RGB colorspace.
>
> I used the formulas for this that are in the JFIF specs. Now it seems
> that even if I have no values for eighter of the Y, Cb or Cr component,
> that it's still possible to overflow an 8-bit unsigned variable when
> converting to R, G or B.
> If there is an overflow, how should I handle it?
> It seems also rather logical to me that if even there is an overflow
> that it would never be very high, however, for the test image I'm using
> I came across the following values:
> Y = 154, Cb = 10, Cr = 254 which gives the following rounded values: R
> = 331, G = 105, B = -55
>
> The G value seems possible, since it's in the range, hoever when
> looking at R and B they seem rather outragious to me. What could leed
> to such abnormal values???
>
> grtz
>
> Arne Demmers
Hi,
maybe this helps:
http://www.w3.org/Graphics/JPEG/jfif.txt
Best,
E.
| |
| Ben Rudiak-Gould 2005-12-02, 8:50 pm |
| Arne Demmers wrote:
> What could leed to such abnormal values???
This might be caused by chroma subsampling in an area where the chroma
varies rapidly.
-- Ben
| |
|
| Hi,
YCbCr color space is much bigger than RGB color space. It means there
are lot of YCbCr values what would be out of RGB value ranges. If you
make following conversions RGB->YCbCr->RGB, then it should be no
problem RGB value range. But if there are done some processing in YCbCr
domain, then there are possible that ranges do not pass anymore.
By video is therefore YCbCr ranges limited to 16...235.
Tarmo
|
|
|
|
|