Re: Saving three 16 bit RGB values in 32 bits::
- From: Wenny Macura <wmacu@xxxxxxxxx>
- Date: Sat, 10 Sep 2005 01:49:25 GMT
Matthias Melcher wrote:
Wenny Macura wrote:
I have been fiddling with large 16 bit images for a while. and have been trying to save the image allocation space on the disk.
The following algorithm is the result of the struggle :-) Any comments ??
You are throwing away valuable bits. Just because it is floating point does not mean that it has any higher precision. Actually, it has lower precision since you lose bits on the not needed mantissa and the two sign bits.
Just take the most important bits of you values and throw away the fractions:
unsigned long r, g, b; unsigned long rgb = ((r<<16)&0xffe00000) // 11 bits for red |((g<< 5)&0x001ffc00) // 11 bits for green |((b>> 5)&0x000003ff); // and 10 bits for blue
or use any of the many existing lossy an lossless compressions
Thanks, " Mea culpa, Mea culpa mea maxima culpa" Test befor you post !!! Converted to R(11) G(11) B(10) and all is fine. Thanks. .
- References:
- Saving three 16 bit RGB values in 32 bits::
- From: Wenny Macura
- Re: Saving three 16 bit RGB values in 32 bits::
- From: Matthias Melcher
- Saving three 16 bit RGB values in 32 bits::
- Prev by Date: Re: Saving three 16 bit RGB values in 32 bits::
- Next by Date: Re: Saving three 16 bit RGB values in 32 bits::
- Previous by thread: Re: Saving three 16 bit RGB values in 32 bits::
- Next by thread: Re: Saving three 16 bit RGB values in 32 bits::
- Index(es):