[comp.graphics] 8bit -> 5bit / pixel reduction

ks26+@andrew.cmu.edu (Kenneth Sykes) (04/17/89)

This may be a stupid question but...

When converting 8bit/pixel color to 5bit/pixel color, are any side effects
introduced if the top 5 bits are used (c >> 3)?  How about converting the
other way, say 3bit/pixel -> 5bit/pixel?  Are there more efficient ways
of doing this?

A related problem:  Is there a better way to correctly increase the intensity
of a pixel than
        hsv  = RGB2HSV(rgb)
        v += intensity difference
        rgb' = HSV2RGB(hsv)

Any help would be appreciated.  Mail should be directed to ks26+@andrew.cmu.edu

Thanks,
    Ken Sykes

turk@Apple.COM (Ken "Turk" Turkowski) (04/19/89)

In article <YYGUd-y00XomA4BkVj@andrew.cmu.edu> ks26+@andrew.cmu.edu (Kenneth Sykes) writes:
>This may be a stupid question but...
>
>When converting 8bit/pixel color to 5bit/pixel color, are any side effects
>introduced if the top 5 bits are used (c >> 3)?  How about converting the
>other way, say 3bit/pixel -> 5bit/pixel?  Are there more efficient ways
>of doing this?

You mean, artifacts besides quantization?

The maximum for 5 bit pixels is 31, for 3, 7, therefore:

	five = three * (31/7);

You can be more efficient if you use shifts and adds.
-- 
Ken Turkowski @ Apple Computer, Inc., Cupertino, CA
Internet: turk@apple.com
Applelink: TURKOWSKI1
UUCP: sun!apple!turk