AWARE SYSTEMS
TIFF and LibTiff Mail List Archive

Thread

2001.03.28 14:50 "Bit depth", by Andrew Jarvis
2001.03.28 16:32 "Re: Bit depth", by Joe Dumoulin
2001.03.29 08:02 "Re: Bit depth", by Andrew Jarvis
2001.03.29 11:03 "Re: Bit depth", by Martí Maria
2001.03.29 11:14 "Re: Bit depth", by Andrew Jarvis
2001.03.29 11:44 "Re: Bit depth", by Martí Maria
2001.03.29 16:57 "Re: Bit depth", by Chris 'Xenon' Hanson
2001.03.29 18:23 "Re: Bit depth", by Andreas R. Kleinert
2001.03.29 18:10 "Re: Bit depth", by Martí Maria
2001.03.29 17:02 "Re[2]: Bit depth", by Rainer Wiesenfarth
2001.03.28 18:07 "Re: Bit depth", by Frank Warmerdam
2001.03.28 18:52 "RE: Bit depth", by Max Martinez

2001.03.29 17:02 "Re[2]: Bit depth", by Rainer Wiesenfarth

Hello Andrew,

What is required is a left shift of 5 places which is equivalent to multiplication by 65536/2048=32.

Assuming you have 11 bit data and want to have 16 bit, you should do

    out = (in << 5) | (in >> 6);

in       -----XXX XXXXXXXX
in << 5  XXXXXXXX XXX00000
in >> 6  -------- ---XXXXX
out      XXXXXXXX XXXXXXXX

That gives you both $0000 and $ffff and a good and fast scaling

-- -----------------------------------------------------------------
-- Dipl.-Inform. Rainer Wiesenfarth
-- Inpho GmbH                    E-mail: Rainer.Wiesenfarth@Inpho.de
-- Smaragdweg 1                  Phone : +49 711 22881-10
-- 70174 Stuttgart               Fax   : +49 711 22881-11
-- Germany                       URL   : http://www.inpho.de