tags:

views:

318

answers:

2

I have a question, which may be a pipe-dream, but I wanted to know if any of my fellow Stack Overflow'ers could help me with.

In the company I work for, we do billions of image manipulations each month. Basically, we take a massive image, slice it into 256 pixels square images, color quantize them and save them as pngs - and move onto the next mammoth image. We employ a number techniques to do this as quickly as possible, and currently it IS very fast, but I think there is a chance we could make it stellar in speed.

The application itself is .Net 2.0, loops through the various bytes in the large image, reading the bytes for each smaller image, and use GDI to save the image after it has run through a quantization algorithm. We have dozens of machines which run this application, and all of them have Nvidia Geforce 8 Video cards (or better).

Is there a way in which I can use the GPU instead of the CPU to perform any or all of the tasks above? If so, how do I do this? Unfortunately I have never coded anything like this before so if anyone can help me, I might need it explained quite thoroughly (and slowly).

+2  A: 

Define massive? (In other words, massive is relative.)

It is possible use CUDA - NVIDIA GPU's -

http://developer.download.nvidia.com/compute/cuda/sdk/website/projects/dxtc/doc/cuda_dxtc.pdf

+1 for knowing about CUDA.
Steven Sudit
It seems like CUDA is more about compression of images rather than slicing the images up. While the compression is cool (and *sort of* part of the issue) at the end of the process I still need PNGs outputted.As for massiveness, the image I am cutting is 8192px X 1024px.
Ash
+1  A: 

a few technologies to look into:

  1. Windows Imaging Components. this isn't exactly what you're after since i don't think it uses the GPU (although i could be wong) but it should be significantly faster than GDI+.

  2. Direct2D. this does use the GPU for many drawing operations and integrates well with the Windows Imaging Components. but from your description it's not clear whether the drawing operations optimized by the GPU fit exactly what you need.

on top of those you can try using pixel shaders for the image manipulation. this is an area i haven't delved into so i'll leave it for others to comment.

to put it another way, Windows Imaging Components should reduce the PNG load/save bottleneck significantly. the operations it provides will probably also help slice the image up in a much more optimal way than GDI+. Direct2D and/or a pixel shader should help with the pixel-level manipulation. the pixel shader should only be needed if there's no more direct way to do the color quantize operation you need on the images.

~jewels

Jewel S