<?xml version="1.0"?>
<rss version="2.0">
	<channel>
		<title>Why 32 bit?</title>
		<link>http://www.allegro.cc/forums/view/587163</link>
		<description>Allegro.cc Forum Thread</description>
		<webMaster>matthew@allegro.cc (Matthew Leverton)</webMaster>
		<lastBuildDate>Wed, 23 Aug 2006 16:03:12 +0000</lastBuildDate>
	</channel>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Why do most graphical things (e.g. games, windowing systems) operate at 32-bit colour? I&#39;ve had a theory that colour can never <u>actually</u> go over 24 bit:</p><p>There are three colours in RGB - Red, Green, and Blue.<br />Each colour can be in the region 0 to 255. This makes 8 bits per colour.</p><p>Three colours * 8 bits each = 24.</p><p>Can anybody enlighten me on why 32 bit is used?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (James Stanley)</author>
		<pubDate>Tue, 22 Aug 2006 13:56:33 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Because some windowing systems do translucency (alpha), games use translucency (alpha) all the time.</p><p>You can not do translucency without some form of alpha value, the A in RGBA/BGRA/ARGB/ABRG.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Thomas Fjellstrom)</author>
		<pubDate>Tue, 22 Aug 2006 14:01:02 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Oh yeah, you&#39;re probably right
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (James Stanley)</author>
		<pubDate>Tue, 22 Aug 2006 14:05:21 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Another thing is that 32bit is 2^5 and optimizing HW for such numbers is probably easier.</p><p>Also I think 32bit for (frame) buffer will be obsolete in a few years. Already most new games use FP16 per channel, in 3-4y FP32 might not be out of question. Thouhh I&#39;m not sure if &gt;=FP16  will be used in regular textures loaded from disk or not, probably not very soon.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (HoHo)</author>
		<pubDate>Tue, 22 Aug 2006 14:08:30 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p><a href="http://en.wikipedia.org/wiki/Data_structure_alignment">Word alignment</a>.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (gnolam)</author>
		<pubDate>Tue, 22 Aug 2006 14:34:15 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>
If gfx cards had used a HSV colour space we could have gotten away with 16-bit colour modes and textures (i.e. H=4, S=4, V=8). That would have given us a good speed boost for free. <img src="http://www.allegro.cc/forums/smileys/sad.gif" alt=":(" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Richard Phipps)</author>
		<pubDate>Tue, 22 Aug 2006 14:56:48 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
If gfx cards had used a HSV colour space we could have gotten away with 16-bit colour modes and textures (i.e. H=4, S=4, V=8). That would have given us a good speed boost for free. <img src="http://www.allegro.cc/forums/smileys/sad.gif" alt=":(" />
</p></div></div><p>

Actually, that mode you mentioned is awful, compared for example to 16-bit RGB. Here is a utility (attached) that can convert any bitmap readable by allegro to look like it was in one of those formats (it&#39;ll still be 24-bit, but it&#39;ll use only the colours from the RGB16 or HSV16 colour spaces). We&#39;d need less granularity for the hue part, that&#39;s for sure. Just test it on any photo or anything.</p><p>In other words, I don&#39;t think HSV 16-bit would really be better that RGB 16-bit.</p><p>EDIT: I tweaked with it a little. The program now supports HSV448 HSV547 and HSV646, but even the last one is much worse than RGB565 (you can see some blocks). Download the second attachment.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Jakub Wasilewski)</author>
		<pubDate>Tue, 22 Aug 2006 19:45:10 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
Why do most graphical things (e.g. games, windowing systems) operate at 32-bit colour?
</p></div></div><p>
As gnolam said, gfx cards like aligned data. Also extra 8 bits can be used for one additional channel, which can be used to store alpha channel, gloss map, height map or any other single-channel data. This additional channel on the screen can be useful, too, especially during multipass rendering to achieve complex effects on old hardware (eg. per-pixel normalmapped lightning on GeForce 2).</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
I&#39;ve had a theory that colour can never <u>actually</u> go over 24 bit
</p></div></div><p>
It can. High dynamic range images often use 16 bits per color component giving 48 bits total, sometimes even using 16-bit floating-point numbers. This extra brightness allows to change scene exposure without losing quality. &quot;Overflows&quot; are usually converted to glowing areas during image post-processing, giving everything nicer look, especially on shiny and reflective objects.</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
You can not do translucency without some form of alpha value, the A in RGBA/BGRA/ARGB/ABRG.
</p></div></div><p>
You can assume constant alpha or get alpha from different texture. <img src="http://www.allegro.cc/forums/smileys/wink.gif" alt=";)" /></p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
Also I think 32bit for (frame) buffer will be obsolete in a few years. Already most new games use FP16 per channel, in 3-4y FP32 might not be out of question. Thouhh I&#39;m not sure if &gt;=FP16 will be used in regular textures loaded from disk or not, probably not very soon.
</p></div></div><p>
32-bit framebuffer and texture formats won&#39;t be obsolete too soon, as 64-bit or wider pixel formats take considerably more bandwidth, which reduces fill rate. I agree that FP16 for textures won&#39;t be used too widely (except for skies) as 8-bit channels are doing well enough and reflectiveness (diffuse or specular) doesn&#39;t vary that much over the material to really need FP16 color formats.</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
If gfx cards had used a HSV colour space we could have gotten away with 16-bit colour modes and textures (i.e. H=4, S=4, V=8). That would have given us a good speed boost for free. <img src="http://www.allegro.cc/forums/smileys/sad.gif" alt=":(" />
</p></div></div><p>
Slow blending, texture filtering and pixel shaders would compensate this speed boost, probably making everything even slower.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Krzysztof Kluczek)</author>
		<pubDate>Tue, 22 Aug 2006 21:00:51 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
If gfx cards had used a HSV colour space
</p></div></div><p>

Matrox G400 does, but it optionally combines the H&amp;S from each 2 pixels to produce 8 bits each, which it uses for high quality TV output</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
Slow blending, texture filtering and pixel shaders would compensate this speed boost, probably making everything even slower.
</p></div></div><p>

Everything except fade_to_grey() <img src="http://www.allegro.cc/forums/smileys/smiley.gif" alt=":)" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Matt Smith)</author>
		<pubDate>Tue, 22 Aug 2006 21:35:20 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>
Hmm. ok. I&#39;ll take your word for it. I just remember reading that Jpeg and other image compression routines tend to compress the colourspace normally, so I didn&#39;t think the effect would be <i>as</i> noticable as RGB555.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Richard Phipps)</author>
		<pubDate>Tue, 22 Aug 2006 22:10:34 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Seems to me that 16 bits is 16 bits, that allows 65536 shades of anything, period.  And none of you tried to program the SVGA modes with 24 bit color?  You had to write a short int, then a char for some pixels, or a char followed by a short int for the other pixels. That all goes away with 32 bit or 16 bit, not to mention making sure you didn&#39;t run off the end of the 64k segment with 24 bit color.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Arthur Kalliokoski)</author>
		<pubDate>Wed, 23 Aug 2006 03:42:42 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Krzysztof Kluczek said:</div><div class="quote"><p>
You can assume constant alpha or get alpha from different texture.
</p></div></div><p>Is that not &quot;some form of alpha value&quot;? <img src="http://www.allegro.cc/forums/smileys/wink.gif" alt=";)" /></p><div class="quote_container"><div class="title">Arthur Kalliokoski said:</div><div class="quote"><p>
Seems to me that 16 bits is 16 bits, that allows 65536 shades of anything, period.
</p></div></div><p>I don&#39;t follow, what exactly do you mean? 16 bit color is 565 (RGB) thats 5 bits red, 6 bits green, and 5 bits blue. Or sometimes 5551, 5 red, 5 blue, 5 green, 1 alpha. It&#39;s not &quot;shades&quot; its specific colors.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Thomas Fjellstrom)</author>
		<pubDate>Wed, 23 Aug 2006 10:38:55 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
Seems to me that 16 bits is 16 bits, that allows 65536 shades of anything, period.
</p></div></div><p>
I don&#39;t follow, what exactly do you mean?
</p></div></div><p>
I think he means, regardless of what colorspace you use, 16-bits will never get you more than 65,536 colors. The different colorspaces will only determine which colors you get.</p><p>Though I&#39;d think HSV would be a bad choice if you want a wide range of colors. You&#39;ll actually get fewer colors with HSV than RGB. 0,0,255 and 32,0,255 produce different colors in RGB, but in HSV they&#39;d give you the same color. Since there&#39;s no saturation, the hue is completely ignored. same goes for 143,136,0 and 53,222,0.. in RGB those are two different colors, but in HSV, since there&#39;s no light (assuming V is the luminance), the hue and saturation are completely ignored. Any two different values for an RGB triplette will produce different results, but any two different values for an HSV triplette may not.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Kitty Cat)</author>
		<pubDate>Wed, 23 Aug 2006 10:50:17 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>
Ah yes, I was thinking of something like this which I found several years ago:<br /><a href="http://r0k.us/graphics/png16.html">http://r0k.us/graphics/png16.html</a></p><p>This kind of thing really appeals to the amiga loving part of my mind! <img src="http://www.allegro.cc/forums/smileys/smiley.gif" alt=":)" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Richard Phipps)</author>
		<pubDate>Wed, 23 Aug 2006 14:04:14 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
Matrox G400 does, but it optionally combines the H&amp;S from each 2 pixels to produce 8 bits each, which it uses for high quality TV output
</p></div></div><p>
As I understand it, sampling chrominance less frequently than luminance is also the way that all DVDs and even most commercial video editing formats work? And doesn&#39;t the Gamecube use a 16bit luminance/chrominance split framebuffer?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Thomas Harte)</author>
		<pubDate>Wed, 23 Aug 2006 14:18:10 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
Is that not &quot;some form of alpha value&quot;? <img src="http://www.allegro.cc/forums/smileys/wink.gif" alt=";)" />
</p></div></div><p>
Yes, but it&#39;s not in RGBA, ARGB, BGRA or ABGR. <img src="http://www.allegro.cc/forums/smileys/smiley.gif" alt=":)" /></p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
I think he means, regardless of what colorspace you use, 16-bits will never get you more than 65,536 colors.
</p></div></div><p>
Modes like D3DFMT_G8R8_G8B8 will. In this case, each pair of pixels shares two channels and only one channel varies between them (green in this case). It still uses 16 bits per pixel, but gives you entire 24-bit color space (somewhat restricted, but still).</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
(assuming V is the luminance)
</p></div></div><p>
AFAIK V isn&#39;t luminance, but value. HSL has luminance and uses slightly different conversion methods. <img src="http://www.allegro.cc/forums/smileys/smiley.gif" alt=":)" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Krzysztof Kluczek)</author>
		<pubDate>Wed, 23 Aug 2006 15:27:40 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
Yes, but it&#39;s not in RGBA, ARGB, BGRA or ABGR. <img src="http://www.allegro.cc/forums/smileys/smiley.gif" alt=":)" />
</p></div></div><p>The A in those are <i>also</i> &quot;some form of alpha value&quot;. <img src="http://www.allegro.cc/forums/smileys/wink.gif" alt=";)" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Thomas Fjellstrom)</author>
		<pubDate>Wed, 23 Aug 2006 15:33:14 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
As I understand it, sampling chrominance less frequently than luminance is also the way that all DVDs and even most commercial video editing formats work?
</p></div></div><p>

That&#39;s right, it&#39;s because the human eye has less spatial resolution in chrominance than in luminance.  Even analogue television takes advantage of this by squeezing the colour signal on to the higher bandwidth traditional monochrome (luminence only) signal.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Matt Smith)</author>
		<pubDate>Wed, 23 Aug 2006 16:03:12 +0000</pubDate>
	</item>
</rss>
