<?xml version="1.0"?>
<rss version="2.0">
	<channel>
		<title>is A5 supposed to work on PPC?</title>
		<link>http://www.allegro.cc/forums/view/605790</link>
		<description>Allegro.cc Forum Thread</description>
		<webMaster>matthew@allegro.cc (Matthew Leverton)</webMaster>
		<lastBuildDate>Mon, 27 Dec 2010 12:31:35 +0000</lastBuildDate>
	</channel>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Testing on OS X 10.4 PPC.</p><p>Attached is what it looks like when loading the mysha PNG image. The PCX version worked. (TGA did not.) I&#39;ve mentioned that before; there was some discussion, but no resolutions.</p><p>I tried running the speed demo, but it just failed complaining that &quot;dyld: Symbol not found: __al_kcm_aqueue_driver&quot;.</p><p>This is just an FYI to anybody who cares. I&#39;m not going to actively debug anything, and as far as I&#39;m concerned a proper fix is simply dropping support for PPC altogether.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Matthew Leverton)</author>
		<pubDate>Sun, 12 Dec 2010 07:25:02 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>It is supposed to work, yes.<br />This
</p><div class="quote_container"><div class="title"><a href="http://www.allegro.cc/forums/thread/605790/894256#target">Matthew Leverton</a> said:</div><div class="quote"><p>&quot;dyld: Symbol not found: __al_kcm_aqueue_driver&quot;.</p></div></div><p>
is more a problem with 10.4 than PPC though. I&#39;m sure I fixed a similar problem ages ago, should be easy to fix (the driver can&#39;t be built on 10.4 and should be disabled and unreferenced).
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Evert)</author>
		<pubDate>Sun, 12 Dec 2010 16:08:22 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Do you know if it&#39;s the native image loader, or the libpng loader? Mainly curious.</p><p>FYI I intend to release RC3 soon, and it would be nice (not important) to have either of these issues fixed.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Peter Wang)</author>
		<pubDate>Mon, 13 Dec 2010 10:56:05 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>PNG works with libpng, but not on native loader. TGA doesn&#39;t work on either, but I don&#39;t even know if the native loader handles TGAs.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Matthew Leverton)</author>
		<pubDate>Mon, 13 Dec 2010 11:24:16 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title"><a href="http://www.allegro.cc/forums/thread/605790/894403#target">Matthew Leverton</a> said:</div><div class="quote"><p>TGA doesn&#39;t work on either, but I don&#39;t even know if the native loader handles TGAs.</p></div></div><p>
I think so; the list of formats handled by the native loader is written to the log file.</p><div class="quote_container"><div class="title"><a href="http://www.allegro.cc/forums/thread/605790/894401#target">Peter Wang</a> said:</div><div class="quote"><p>FYI I intend to release RC3 soon, and it would be nice (not important) to have either of these issues fixed.</p></div></div><p>
I&#39;ll try looking into it this week.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Evert)</author>
		<pubDate>Mon, 13 Dec 2010 12:18:08 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I added this to the image.m file:</p><div class="source-code snippet"><div class="inner"><pre>   fp <span class="k3">=</span> <a href="http://www.allegro.cc/manual/al_fopen"><span class="a">al_fopen</span></a><span class="k2">(</span><span class="s">"image.dump"</span>, <span class="s">"wb"</span><span class="k2">)</span><span class="k2">;</span>
   <a href="http://www.allegro.cc/manual/al_fwrite"><span class="a">al_fwrite</span></a><span class="k2">(</span>fp, pixels, w <span class="k3">*</span> h <span class="k3">*</span> <span class="n">4</span><span class="k2">)</span><span class="k2">;</span>
   <a href="http://www.allegro.cc/manual/al_fclose"><span class="a">al_fclose</span></a><span class="k2">(</span>fp<span class="k2">)</span><span class="k2">;</span>
</pre></div></div><p>

immediately before looping over it. The output definitely does not correspond perfectly to the raw image data. There appears to be areas of garbage (particularly at the beginning of the image).</p><p>So A) is there a different way to load that pixel data or b) can we disable the native image loader on PPC?</p><p>I think there still is the issue of the built-in TGA loader.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Matthew Leverton)</author>
		<pubDate>Sat, 25 Dec 2010 10:38:12 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title"><a href="http://www.allegro.cc/forums/thread/605790/896251#target">Matthew Leverton</a> said:</div><div class="quote"><p>A) is there a different way to load that pixel data</p></div></div><p>
The code itself looks fine to me, so I&#39;m not sure what&#39;s going on. It doesn&#39;t look like an endianess problem?</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>b) can we disable the native image loader on PPC?</p></div></div><p>
That should be relatively easy (certainly by hand), but does that solve the problem?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Evert)</author>
		<pubDate>Sat, 25 Dec 2010 13:52:33 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title"><a href="http://www.allegro.cc/forums/thread/605790/896260#target">Evert</a> said:</div><div class="quote"><p> The code itself looks fine to me, so I&#39;m not sure what&#39;s going on. It doesn&#39;t look like an endianess problem?
</p></div></div><p>That&#39;s part of the problem.
</p><div class="source-code"><div class="toolbar"><span class="name">image.m</span><span class="button numbers"><b>#</b></span><span class="button select">Select</span><span class="button expand">Expand</span></div><div class="inner"><span class="number">  96</span>      <a href="http://www.allegro.cc/manual/ALLEGRO_LOCKED_REGION"><span class="a">ALLEGRO_LOCKED_REGION</span></a> <span class="k3">*</span><a href="http://www.delorie.com/djgpp/doc/libc/libc_539.html" target="_blank">lock</a> <span class="k3">=</span> <a href="http://www.allegro.cc/manual/al_lock_bitmap"><span class="a">al_lock_bitmap</span></a><span class="k2">(</span>bmp,
<div class="highlight"><span class="number">  97</span>            ALLEGRO_PIXEL_FORMAT_RGBA_8888, ALLEGRO_LOCK_WRITEONLY<span class="k2">)</span><span class="k2">;</span> </div><span class="number">  98</span>      <span class="k1">int</span> i<span class="k2">;</span>
<span class="number">  99</span>      <span class="k1">if</span> <span class="k2">(</span><span class="k3">!</span>premul<span class="k2">)</span> <span class="k2">{</span>
<span class="number"> 100</span>         <span class="k1">int</span> x<span class="k2">;</span>
<span class="number"> 101</span>         <span class="k1">for</span> <span class="k2">(</span>i <span class="k3">=</span> <span class="n">0</span><span class="k2">;</span> i <span class="k3">&lt;</span> h<span class="k2">;</span> i<span class="k3">+</span><span class="k3">+</span><span class="k2">)</span> <span class="k2">{</span>
<span class="number"> 102</span>            <span class="k1">unsigned</span> <span class="k1">char</span> <span class="k3">*</span>src_ptr <span class="k3">=</span> <span class="k2">(</span><span class="k1">unsigned</span> <span class="k1">char</span> <span class="k3">*</span><span class="k2">)</span>pixels <span class="k3">+</span> w <span class="k3">*</span> <span class="n">4</span> <span class="k3">*</span> i<span class="k2">;</span>
<span class="number"> 103</span>            <span class="k1">unsigned</span> <span class="k1">char</span> <span class="k3">*</span>dest_ptr <span class="k3">=</span> <span class="k2">(</span><span class="k1">unsigned</span> <span class="k1">char</span> <span class="k3">*</span><span class="k2">)</span>lock-&gt;data <span class="k3">+</span>
<span class="number"> 104</span>         lock-&gt;pitch <span class="k3">*</span> i<span class="k2">;</span>
<span class="number"> 105</span>            <span class="k1">for</span> <span class="k2">(</span>x <span class="k3">=</span> <span class="n">0</span><span class="k2">;</span> x <span class="k3">&lt;</span> w<span class="k2">;</span> x<span class="k3">+</span><span class="k3">+</span><span class="k2">)</span> <span class="k2">{</span>
<span class="number"> 106</span>               <span class="k1">unsigned</span> <span class="k1">char</span> r, g, b, a<span class="k2">;</span>
<span class="number"> 107</span>               r <span class="k3">=</span> <span class="k3">*</span>src_ptr<span class="k3">+</span><span class="k3">+</span><span class="k2">;</span>
<span class="number"> 108</span>               g <span class="k3">=</span> <span class="k3">*</span>src_ptr<span class="k3">+</span><span class="k3">+</span><span class="k2">;</span>
<span class="number"> 109</span>               b <span class="k3">=</span> <span class="k3">*</span>src_ptr<span class="k3">+</span><span class="k3">+</span><span class="k2">;</span>
<span class="number"> 110</span>               a <span class="k3">=</span> <span class="k3">*</span>src_ptr<span class="k3">+</span><span class="k3">+</span><span class="k2">;</span>
<span class="number"> 111</span>            <span class="c">// NOTE: avoid divide by zero by adding a fraction</span>
<span class="number"> 112</span>               <span class="k1">float</span> alpha_mul <span class="k3">=</span> <span class="n">255</span>.<span class="n">0f</span> <span class="k3">/</span> <span class="k2">(</span>a<span class="k3">+</span><span class="n">0</span>.<span class="n">001f</span><span class="k2">)</span><span class="k2">;</span>
<span class="number"> 113</span>               r <span class="k3">*</span><span class="k3">=</span> alpha_mul<span class="k2">;</span>
<span class="number"> 114</span>               g <span class="k3">*</span><span class="k3">=</span> alpha_mul<span class="k2">;</span>
<span class="number"> 115</span>               b <span class="k3">*</span><span class="k3">=</span> alpha_mul<span class="k2">;</span>
<span class="number"> 116</span>               <span class="k3">*</span>dest_ptr<span class="k3">+</span><span class="k3">+</span> <span class="k3">=</span> r<span class="k2">;</span>  
<span class="number"> 117</span>               <span class="k3">*</span>dest_ptr<span class="k3">+</span><span class="k3">+</span> <span class="k3">=</span> g<span class="k2">;</span>  
<span class="number"> 118</span>               <span class="k3">*</span>dest_ptr<span class="k3">+</span><span class="k3">+</span> <span class="k3">=</span> b<span class="k2">;</span>  
<span class="number"> 119</span>               <span class="k3">*</span>dest_ptr<span class="k3">+</span><span class="k3">+</span> <span class="k3">=</span> a<span class="k2">;</span>  
<span class="number"> 120</span>            <span class="k2">}</span>
<span class="number"> 121</span>         <span class="k2">}</span>
<span class="number"> 122</span>      <span class="k2">}</span>
<span class="number"> 123</span>      <span class="k1">else</span> <span class="k2">{</span>
<span class="number"> 124</span>         <span class="k1">for</span> <span class="k2">(</span>i <span class="k3">=</span> <span class="n">0</span><span class="k2">;</span> i <span class="k3">&lt;</span> h<span class="k2">;</span> i<span class="k3">+</span><span class="k3">+</span><span class="k2">)</span> <span class="k2">{</span>
<span class="number"> 125</span>            <a href="http://www.delorie.com/djgpp/doc/libc/libc_566.html" target="_blank">memcpy</a><span class="k2">(</span>lock-&gt;data <span class="k3">+</span> lock-&gt;pitch <span class="k3">*</span> i, pixels <span class="k3">+</span> w <span class="k3">*</span> <span class="n">4</span> <span class="k3">*</span> i, w <span class="k3">*</span> <span class="n">4</span><span class="k2">)</span><span class="k2">;</span>
<span class="number"> 126</span>         <span class="k2">}</span>
<span class="number"> 127</span>      <span class="k2">}</span>
<span class="number"> 128</span>      <a href="http://www.allegro.cc/manual/al_unlock_bitmap"><span class="a">al_unlock_bitmap</span></a><span class="k2">(</span>bmp<span class="k2">)</span><span class="k2">;</span>
</div></div><p>

If I change the highlighted line from ABGR to RGBA it works. I don&#39;t know why the code would even work on Intel, it doesn&#39;t seem right to me.</p><p>(Edit: Or maybe <span class="source-code">ALLEGRO_PIXEL_FORMAT_ABGR_8888_LE</span> would be appropriate. The documentation is confusing, as it talks about not being dependent on endian and then later says it is.)</p><p>Note that I changed ex_bitmap to not pre-multiply that way I could edit the block of code that let me easily change the parameters around. (Although I ended up just changing the pixel format, which would affect both parts.)</p><p>Now with the above change, there are still some artifacts. See the attached picture vs the attached picture in the first post. I verified that the image is correct on disk.</p><p>I created a 256x256 PNG image with RGBA of 0x112233FF. The raw image dump of the pixel data had 256 pixels (0x400 bytes) of 0x000000FF to begin with, which makes no sense. Also, the data ended up as 0x132133FF, which is close but not the exact pixels. </p><p>The parrot JPEG ends up looking like a black and white photograph that is skewed by 45 degrees (as if the source lines are longer than expected).</p><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p> That should be relatively easy (certainly by hand), but does that solve the problem?
</p></div></div><p>libpng and libjpeg work. I think there may still be endian issues with Allegro&#39;s TGA loader.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Matthew Leverton)</author>
		<pubDate>Sat, 25 Dec 2010 15:45:35 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>PPC is big endain system and require byte swap in some places.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Michał Cichoń)</author>
		<pubDate>Sun, 26 Dec 2010 00:49:49 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I&#39;m aware of that; it&#39;s just the documentation is a bit confusing.</p><p>I think what it&#39;s trying to say is that if you use <span class="source-code">ALLEGRO_PIXEL_FORMAT_ABGR_8888</span>, then the following is <i>not</i> guaranteed to work:
</p><div class="source-code snippet"><div class="inner"><pre><span class="c">// dest_ptr = 8 bit</span>
<span class="k3">*</span>dest_ptr<span class="k3">+</span><span class="k3">+</span> <span class="k3">=</span> r<span class="k2">;</span>  
<span class="k3">*</span>dest_ptr<span class="k3">+</span><span class="k3">+</span> <span class="k3">=</span> g<span class="k2">;</span>  
<span class="k3">*</span>dest_ptr<span class="k3">+</span><span class="k3">+</span> <span class="k3">=</span> b<span class="k2">;</span>  
<span class="k3">*</span>dest_ptr<span class="k3">+</span><span class="k3">+</span> <span class="k3">=</span> a<span class="k2">;</span>
</pre></div></div><p>
But that this should work:
</p><div class="source-code snippet"><div class="inner"><pre><span class="c">// dest_ptr = 32 bit</span>
<span class="k3">*</span>dest_ptr<span class="k3">+</span><span class="k3">+</span> <span class="k3">=</span> <span class="k2">(</span>a <span class="k3">&lt;</span><span class="k3">&lt;</span> <span class="n">24</span><span class="k2">)</span> <span class="k3">|</span> <span class="k2">(</span>b <span class="k3">&lt;</span><span class="k3">&lt;</span> <span class="n">16</span><span class="k2">)</span> <span class="k3">|</span> <span class="k2">(</span>g  <span class="k3">&lt;</span><span class="k3">&lt;</span> <span class="n">8</span><span class="k2">)</span> <span class="k3">|</span> r<span class="k2">;</span>
</pre></div></div><p>

For this code, though, I think using <span class="source-code">ALLEGRO_PIXEL_FORMAT_ABGR_8888_LE</span> would cause it to work on both PPC and Intel OS X.</p><p>However, none of this directly explains the other oddities with the image loading on PPC.</p><p><b>Update</b></p><p>I just committed the updates to fix the endian issues to Allegro&#39;s TGA loader (seemed to only affect 32-bit images) and the native image loader. However, the native loader still produces garbage (although the colors are right now).</p><p>A screenshot of a JPEG file is attached.</p><p><span class="remote-thumbnail"><span class="json">{"name":"602953","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/1\/f\/1fc009815097739a7eea46c4742363c9.png","w":640,"h":502,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/1\/f\/1fc009815097739a7eea46c4742363c9"}</span><img src="http://www.allegro.cc//djungxnpq2nug.cloudfront.net/image/cache/1/f/1fc009815097739a7eea46c4742363c9-240.jpg" alt="602953" width="240" height="188" /></span></p><p>TGA files are as posted earlier. (Almost correct, but with some horizontal artifacts.)</p><p>This could be an OS X 10.4 issue... whatever the problem is, the source data after loading the image is not the expected raw RGB values.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Matthew Leverton)</author>
		<pubDate>Mon, 27 Dec 2010 12:31:35 +0000</pubDate>
	</item>
</rss>
