<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Blackfin Fast JPEG Encoding</title>
	<atom:link href="http://blog.frankvh.com/2009/06/09/blackfin-fast-jpeg-encoding/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.frankvh.com/2009/06/09/blackfin-fast-jpeg-encoding/</link>
	<description>A bunch of random musings, with a leaning towards electronics &#38; computers.</description>
	<lastBuildDate>Fri, 25 Jun 2010 05:09:58 -0700</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: frank</title>
		<link>http://blog.frankvh.com/2009/06/09/blackfin-fast-jpeg-encoding/comment-page-1/#comment-154</link>
		<dc:creator>frank</dc:creator>
		<pubDate>Fri, 25 Jun 2010 05:09:58 +0000</pubDate>
		<guid isPermaLink="false">http://blog.frankvh.com/?p=31#comment-154</guid>
		<description>First off, run the code through a profiler to see which functions are taking the most time. It might not even be your code - you might be calling some really slow libraries. Then try to optimise the code algorithmically in C as much as you can. Only when you&#039;ve done all you can that way, do you take the painful step of writing assembler.</description>
		<content:encoded><![CDATA[<p>First off, run the code through a profiler to see which functions are taking the most time. It might not even be your code &#8211; you might be calling some really slow libraries. Then try to optimise the code algorithmically in C as much as you can. Only when you&#8217;ve done all you can that way, do you take the painful step of writing assembler.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bill Strahan</title>
		<link>http://blog.frankvh.com/2009/06/09/blackfin-fast-jpeg-encoding/comment-page-1/#comment-153</link>
		<dc:creator>Bill Strahan</dc:creator>
		<pubDate>Fri, 25 Jun 2010 03:23:26 +0000</pubDate>
		<guid isPermaLink="false">http://blog.frankvh.com/?p=31#comment-153</guid>
		<description>What about a REALLY fast jpeg decoder?  I&#039;ve got a CE app that we distribute on an XScale based device, written in .net.  I&#039;ve put together a large C++ library to handle some image stuff (rotation, zooming, etc.) but the bottleneck is how quicky he images are being decoded by .net.

They&#039;re just 256X256 tiles but they take more than 100ms to decode on a 624 mhz processor.  I&#039;m sure it could be MUCH faster, but dont&#039; know where to begin.

Bill</description>
		<content:encoded><![CDATA[<p>What about a REALLY fast jpeg decoder?  I&#8217;ve got a CE app that we distribute on an XScale based device, written in .net.  I&#8217;ve put together a large C++ library to handle some image stuff (rotation, zooming, etc.) but the bottleneck is how quicky he images are being decoded by .net.</p>
<p>They&#8217;re just 256X256 tiles but they take more than 100ms to decode on a 624 mhz processor.  I&#8217;m sure it could be MUCH faster, but dont&#8217; know where to begin.</p>
<p>Bill</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Steve Howell</title>
		<link>http://blog.frankvh.com/2009/06/09/blackfin-fast-jpeg-encoding/comment-page-1/#comment-117</link>
		<dc:creator>Steve Howell</dc:creator>
		<pubDate>Mon, 04 Jan 2010 16:14:41 +0000</pubDate>
		<guid isPermaLink="false">http://blog.frankvh.com/?p=31#comment-117</guid>
		<description>Hi Frank,

Thanks for the very quick reply! I don&#039;t think it&#039;s a 64/32 bit problem. I have 32 bit int&#039;s, 16 bit short&#039;s and 8 bit char&#039;s, as expected by the code. Thanks anyway. I&#039;ll keep investigating.

Steve</description>
		<content:encoded><![CDATA[<p>Hi Frank,</p>
<p>Thanks for the very quick reply! I don&#8217;t think it&#8217;s a 64/32 bit problem. I have 32 bit int&#8217;s, 16 bit short&#8217;s and 8 bit char&#8217;s, as expected by the code. Thanks anyway. I&#8217;ll keep investigating.</p>
<p>Steve</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: frank</title>
		<link>http://blog.frankvh.com/2009/06/09/blackfin-fast-jpeg-encoding/comment-page-1/#comment-116</link>
		<dc:creator>frank</dc:creator>
		<pubDate>Mon, 04 Jan 2010 16:04:32 +0000</pubDate>
		<guid isPermaLink="false">http://blog.frankvh.com/?p=31#comment-116</guid>
		<description>Hi Steve,

Hmm, I don&#039;t know. At one point I had a similar problem to what you&#039;re describing, where the JPG image started out correct but then got messed up. It was due to the assembly language DCT algorithm being used at the time. Switching to the C code DCT function fixed the problem, and I then wrote an assembly version of that C code to make it run faster. Is there any chance this might be a data type problem (eg you&#039;re running on a 64 bit machine when this code perhaps assumes 32 bits) or something like that?  

Good luck!

Frank.</description>
		<content:encoded><![CDATA[<p>Hi Steve,</p>
<p>Hmm, I don&#8217;t know. At one point I had a similar problem to what you&#8217;re describing, where the JPG image started out correct but then got messed up. It was due to the assembly language DCT algorithm being used at the time. Switching to the C code DCT function fixed the problem, and I then wrote an assembly version of that C code to make it run faster. Is there any chance this might be a data type problem (eg you&#8217;re running on a 64 bit machine when this code perhaps assumes 32 bits) or something like that?  </p>
<p>Good luck!</p>
<p>Frank.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Steve Howell</title>
		<link>http://blog.frankvh.com/2009/06/09/blackfin-fast-jpeg-encoding/comment-page-1/#comment-115</link>
		<dc:creator>Steve Howell</dc:creator>
		<pubDate>Mon, 04 Jan 2010 15:42:22 +0000</pubDate>
		<guid isPermaLink="false">http://blog.frankvh.com/?p=31#comment-115</guid>
		<description>Hi,

I&#039;ve been trying to build and use this jpeg code in a Microsoft Visual C++ project to convert 24 bit RGB images to JPG. I removed the __attribute__ stuff and switched it back to using all the C routines instead of the assembler ones, but I can&#039;t get it to work properly. It seems to produce a JPEG file in which the first few 8x8 blocks of pixels look correct but the rest of the image is corrupted. On quality level 8 the length of the strip of blocks which look right is longer than it is on quality level 1. I don&#039;t suppose you&#039;d have any idea what I might have got wrong?

The only changes I made to the code were:
Remove the __attribute__s.
In &quot;encodeMCU&quot;, called &quot;quantization&quot; instead of &quot;quantization_asm&quot;.
In &quot;DCT&quot;, commented out the part were it just calls &quot;jpegdct&quot; and returns.
In &quot;huffman&quot;, made it call the PUTBITS macro instead of &quot;putbits_asm&quot;.
In &quot;read_rgb24_format&quot;, I changed the &quot;#if 0&quot;s to &quot;#if 1&quot;s and vice versa, this stopping it using &quot;read_rgb_yuv&quot;.

Any help gratefully accepted!

Thanks

Steve Howell</description>
		<content:encoded><![CDATA[<p>Hi,</p>
<p>I&#8217;ve been trying to build and use this jpeg code in a Microsoft Visual C++ project to convert 24 bit RGB images to JPG. I removed the __attribute__ stuff and switched it back to using all the C routines instead of the assembler ones, but I can&#8217;t get it to work properly. It seems to produce a JPEG file in which the first few 8&#215;8 blocks of pixels look correct but the rest of the image is corrupted. On quality level 8 the length of the strip of blocks which look right is longer than it is on quality level 1. I don&#8217;t suppose you&#8217;d have any idea what I might have got wrong?</p>
<p>The only changes I made to the code were:<br />
Remove the __attribute__s.<br />
In &#8220;encodeMCU&#8221;, called &#8220;quantization&#8221; instead of &#8220;quantization_asm&#8221;.<br />
In &#8220;DCT&#8221;, commented out the part were it just calls &#8220;jpegdct&#8221; and returns.<br />
In &#8220;huffman&#8221;, made it call the PUTBITS macro instead of &#8220;putbits_asm&#8221;.<br />
In &#8220;read_rgb24_format&#8221;, I changed the &#8220;#if 0&#8243;s to &#8220;#if 1&#8243;s and vice versa, this stopping it using &#8220;read_rgb_yuv&#8221;.</p>
<p>Any help gratefully accepted!</p>
<p>Thanks</p>
<p>Steve Howell</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Franklin</title>
		<link>http://blog.frankvh.com/2009/06/09/blackfin-fast-jpeg-encoding/comment-page-1/#comment-109</link>
		<dc:creator>Franklin</dc:creator>
		<pubDate>Fri, 30 Oct 2009 19:08:44 +0000</pubDate>
		<guid isPermaLink="false">http://blog.frankvh.com/?p=31#comment-109</guid>
		<description>Frank,
You are a genius! The following change produces the expected picture:

INT16 *CB_Ptr = CR;//CB;
INT16 *CR_Ptr = CB;//CR;

Next step, the inverted image.

Thanks a lot
Franklin</description>
		<content:encoded><![CDATA[<p>Frank,<br />
You are a genius! The following change produces the expected picture:</p>
<p>INT16 *CB_Ptr = CR;//CB;<br />
INT16 *CR_Ptr = CB;//CR;</p>
<p>Next step, the inverted image.</p>
<p>Thanks a lot<br />
Franklin</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: frank</title>
		<link>http://blog.frankvh.com/2009/06/09/blackfin-fast-jpeg-encoding/comment-page-1/#comment-108</link>
		<dc:creator>frank</dc:creator>
		<pubDate>Fri, 30 Oct 2009 18:27:51 +0000</pubDate>
		<guid isPermaLink="false">http://blog.frankvh.com/?p=31#comment-108</guid>
		<description>Kudos to you for getting it largely running on wince. Obviously you commented out the assembler routines to use the C functions (DCT, huffman, etc).

Chances are the image is inverted because that&#039;s how it comes from the camera. A great many cameras return an inverted image. Not all, but lots.

A BMP image is actually upside down. So if you&#039;re going from a BMP to a JPG, that&#039;s likely what you&#039;re seeing. A BMP stores the image inverted. So if the image comes from the camera inverted &amp; is stored in a BMP &quot;as-is&quot;, the BMP viewer will invert it, resulting in a right-way-up image when viewing the BMP. But a JPG file stores the image as-is, so an inverted source image will result in an inverted JPG image.

RGB24 is a somewhat ambiguous thing. Some drivers think the byte order is red - green - blue. Other drivers think it&#039;s blue- green - red. I&#039;ve seen both. In either case green will be correct, but sometimes red &amp; blue will be swapped.

This can easily be seen by pointing the camera at a strongly-coloured red &amp; blue object. If the colours display backwards, you know where the problem is.

A blue cast (or any other colour cast) over the image may also be caused by a wrong (or completely missing) white balance algorithm. Artificial lighting can also cause a colour cast (our eyes/brains are remarkably good at ignoring such things) - try changing the lighting a bit.

Have fun!</description>
		<content:encoded><![CDATA[<p>Kudos to you for getting it largely running on wince. Obviously you commented out the assembler routines to use the C functions (DCT, huffman, etc).</p>
<p>Chances are the image is inverted because that&#8217;s how it comes from the camera. A great many cameras return an inverted image. Not all, but lots.</p>
<p>A BMP image is actually upside down. So if you&#8217;re going from a BMP to a JPG, that&#8217;s likely what you&#8217;re seeing. A BMP stores the image inverted. So if the image comes from the camera inverted &#038; is stored in a BMP &#8220;as-is&#8221;, the BMP viewer will invert it, resulting in a right-way-up image when viewing the BMP. But a JPG file stores the image as-is, so an inverted source image will result in an inverted JPG image.</p>
<p>RGB24 is a somewhat ambiguous thing. Some drivers think the byte order is red &#8211; green &#8211; blue. Other drivers think it&#8217;s blue- green &#8211; red. I&#8217;ve seen both. In either case green will be correct, but sometimes red &#038; blue will be swapped.</p>
<p>This can easily be seen by pointing the camera at a strongly-coloured red &#038; blue object. If the colours display backwards, you know where the problem is.</p>
<p>A blue cast (or any other colour cast) over the image may also be caused by a wrong (or completely missing) white balance algorithm. Artificial lighting can also cause a colour cast (our eyes/brains are remarkably good at ignoring such things) &#8211; try changing the lighting a bit.</p>
<p>Have fun!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Frank</title>
		<link>http://blog.frankvh.com/2009/06/09/blackfin-fast-jpeg-encoding/comment-page-1/#comment-107</link>
		<dc:creator>Frank</dc:creator>
		<pubDate>Fri, 30 Oct 2009 17:36:53 +0000</pubDate>
		<guid isPermaLink="false">http://blog.frankvh.com/?p=31#comment-107</guid>
		<description>Hi Frank,
I was looking for a fast Jpeg encoder for windows ce and found yours. I had it working after making a few minimal changes of the C code version. The output is very fast. The only problem is that the image comes inverted and the resulting picture is blue-ish. I am pretty sure my camera outputs RGB24.
Thanks  a lot
Frank</description>
		<content:encoded><![CDATA[<p>Hi Frank,<br />
I was looking for a fast Jpeg encoder for windows ce and found yours. I had it working after making a few minimal changes of the C code version. The output is very fast. The only problem is that the image comes inverted and the resulting picture is blue-ish. I am pretty sure my camera outputs RGB24.<br />
Thanks  a lot<br />
Frank</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Strubi</title>
		<link>http://blog.frankvh.com/2009/06/09/blackfin-fast-jpeg-encoding/comment-page-1/#comment-95</link>
		<dc:creator>Strubi</dc:creator>
		<pubDate>Mon, 28 Sep 2009 11:10:31 +0000</pubDate>
		<guid isPermaLink="false">http://blog.frankvh.com/?p=31#comment-95</guid>
		<description>Hi Frank :-)

Just some quick feedback: FOUR_ZERO_ZERO works, too. Tested it with a monochrome cam.

Greetings!</description>
		<content:encoded><![CDATA[<p>Hi Frank <img src='http://blog.frankvh.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>Just some quick feedback: FOUR_ZERO_ZERO works, too. Tested it with a monochrome cam.</p>
<p>Greetings!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: flash-player</title>
		<link>http://blog.frankvh.com/2009/06/09/blackfin-fast-jpeg-encoding/comment-page-1/#comment-21</link>
		<dc:creator>flash-player</dc:creator>
		<pubDate>Tue, 07 Jul 2009 01:57:18 +0000</pubDate>
		<guid isPermaLink="false">http://blog.frankvh.com/?p=31#comment-21</guid>
		<description>Great post!</description>
		<content:encoded><![CDATA[<p>Great post!</p>
]]></content:encoded>
	</item>
</channel>
</rss>
