Hi,
1) Convert the number to I32,
2) Add a (I32 constand with value) 32768 to it.
The result is a 16 bit positive number, ranging from 0 to 65535.
3) Use 'Rotate Right With Carry' (Carry = FALSE) on the result.
We have a 15 bit integer.
4) repeat 3) , 14 bits result
5) repeat 3) , 13 bits result
6) repeat 3) , 12 bits result, ranging from 0 to 4095 !
Offcause you can make a for loop repeating step 3) fout times, but don't
forget to put the result in a shift register!
This is, Btw. a very crude way of color reduction...
Regards,
Wiebe.
"mino"
wrote in message
news:5065000000080000001E4C0000-1021771306000@exchange.ni.com...
> I need a algorithm to convert 16-bit tiff files with pixel values
> ranging from -32768 to 32768 to 12-bit valu
es ranging from 0 to 4095.
> The algorithm provided by NI
>
(http://zone.ni.com/devzone/explprog.nsf/6c163603265406328625682a006ed37d/10
560a596bddd342862566c70062a743?OpenDocument)
> doing a 16->8 bit conversion seems not to work if the brightness
> values are negative [-32768..0[. Is any help out there ???