<p>There is another option. And that is, you write your own GPU-based PNG decoder. You could use OpenCL to perform this operation fairly efficiently (and perform your composition using OpenGL which can share resources with OpenCL). It is also possible to interleave transfer and decoding for maximum throughput. If this is a route you can/want to pursue I can provide more information.</p>

<p>Here are some resources related to GPU-based DEFLATE (and INFLATE).</p>

<ol>
<li><a href="http://www.google.com/url?sa=t&amp;rct=j&amp;q=&amp;esrc=s&amp;source=web&amp;cd=1&amp;ved=0CE4QFjAA&amp;url=http://arxiv.org/pdf/1107.1525&amp;ei=qhnzT7PEFIr10gGcq9XoCQ&amp;usg=AFQjCNH_BlNNNTk8KTMw7TMfANof64ApBg" rel="nofollow">Accelerating Lossless compression with GPUs</a></li>
<li><a href="http://code.google.com/p/gpu-block-compression/" rel="nofollow">gpu-block-compression</a> using CUDA on Google code.</li>
<li><a href="http://www.google.com/url?sa=t&amp;rct=j&amp;q=&amp;esrc=s&amp;source=web&amp;cd=5&amp;ved=0CGQQFjAE&amp;url=http://www.ece.neu.edu/groups/nucar/GPGPU4/files/oneil.pdf&amp;ei=1BrzT6ukLsrh0QH2_OSLCg&amp;usg=AFQjCNHTVkX4QukaurUugSDpkFVPRopCWw" rel="nofollow">Floating point data-compression at 75 Gb/s on a GPU</a> - note that this doesn't use INFLATE/DEFLATE but a novel parallel compression/decompression scheme that is more GPU-friendly.</li>
</ol>

<p>Hope this helps!</p>
Fastest PNG decoder for .NET
<p>Our web server needs to process many compositions of large images together before sending the results to web clients. This process is performance critical because the server can receive several thousands of requests per hour.</p>

<p>Right now our solution loads PNG files (around 1MB each) from the HD and sends them to the video card so the composition is done on the GPU. We first tried loading our images using the PNG decoder exposed by the XNA API. We saw the performance was not too good.</p>

<p>To understand if the problem was loading from the HD or the decoding of the PNG, we modified that by loading the file in a memory stream, and then sending that memory stream to the .NET PNG decoder. The difference of performance using XNA or using System.Windows.Media.Imaging.PngBitmapDecoder class is not significant. We roughly get the same levels of performance.</p>

<p>Our benchmarks show the following performance results:</p>

<ul>
<li>Load images from disk: 37.76ms 1% </li>
<li>Decode PNGs: 2816.97ms 77% </li>
<li>Load images on Video Hardware: 196.67ms 5% </li>
<li>Composition: 87.80ms 2% </li>
<li>Get composition result from Video Hardware: 166.21ms 5% </li>
<li>Encode to PNG: 318.13ms 9% </li>
<li>Store to disk: 3.96ms 0% </li>
<li>Clean up: 53.00ms 1% </li>
</ul>

<p>Total: 3680.50ms 100% </p>

<p>From these results we see that the slowest parts are when decoding the PNG.</p>

<p>So we are wondering if there wouldn't be a PNG decoder we could use that would allow us to reduce the PNG decoding time. We also considered keeping the images uncompressed on the hard disk, but then each image would be 10MB in size instead of 1MB and since there are several tens of thousands of these images stored on the hard disk, it is not possible to store them all without compression.</p>

<p>EDIT: More useful information:</p>

<ul>
<li>The benchmark simulates loading 20 PNG images and compositing them together. This will roughly correspond to the kind of requests we will get in the production environment. </li>
<li>Each image used in the composition is 1600x1600 in size.</li>
<li>The solution will involve as many as 10 load balanced servers like the one we are discussing here. So extra software development effort could be worth the savings on the hardware costs.</li>
<li>Caching the decoded source images is something we are considering, but each composition will most likely be done with completely different source images, so cache misses will be high and performance gain, low.</li>
<li>The benchmarks were done with a crappy video card, so we can expect the PNG decoding to be even more of a performance bottleneck using a decent video card.</li>
</ul>