On 03/11/02 at 12:31 Φοίβος Ρ. Ντόκος wrote: >For the 24 bit to 15/16 bit conversion the method proposed by >Malcolm Lear (on whose program mine is loosely based) -To >chop off the 2 high bits from the colour components works >rather well
For bit reduction the customary method is triangular distribution random probability function dithering. I am sure you can find the method described just by searching for it on the web. A triangual probability function just means that the probability 0.5 for the result of the random generator will be 0, and drops in a linear function towards 0 for results +1 and -1. It is easily generated. The result of the function is multiplied by the value of the first bit that is chopped off (in your case bit 1, and you retain bits 7 to 2), added to the original value that needs to be bit reduced, saturated to 255 (i.e. values >255 become 255) and the lower two bits are chopped off. The process is called (surprise, surprise!) DITHERING. It woks very well for DSP in general, and makes very nice pictures, which are, however, rather difficult to compress as 'noise' (the triangular probability function) is introduced in the lowest order bit. The basic algorithm is usable for many applications, but for some speciffic ones the random function needs to be changed - the function is what dictates the 'quality' of the dithering. There are whole families of them, different are used when a picture needs to be reduced not only regarding the number of colors, but also the size. Nasta