tags:

views:

463

answers:

2
+1  Q: 

BitBlt Performance

I have a function that splits a multipage tiff into single pages and it uses the windows BitBlt function. In terms of performance, would the video card have any influence in doing the split? Would it be worth using a straight C/C++ library instead?

+1  A: 

If BitBlt can map the pages into video memory, there is a very good chance that your video card will be much, much faster than the CPU. This is for a few reasons:

  • The card will run in parallel with your CPU, so you can do other work while it is running.
  • The video card is optimized to perform the memory copies on it's own, instead of having to have the CPU copy each word from one place to another. This frees your CPU bus up for other things.
  • The video card probably has a larger word size for data moves, and if you blit has any operation flags attached, those would be likely optimized by the hardware. Also, the memory on most video cards is faster than system memory.

Note that these things aren't always true. For example, if you card shares system memory then it won't have a faster access to the memory than the CPU. However, you still get the parallel support.

Finally, there is the possibility that the overhead of transfering the image to the card and back will overwhelm the speed improvement you get by doing it on the card. So you just need to experiment.

I should add - I believe that you need to specify that the memory is on-card in the device context. I don't think that just creating a memory context does anything particular with the video card.

Christopher
+2  A: 

The video card won't participate in any activity unless it is the destination HDC of the BitBlt. A library dedicated to imaging functions should perform better for this task, since ultimately you will be writing these to disk.

If you were making alterations to the image data, then there is the possibility that using your video card could help; but only if you are rendering a lot of new image data for the destination tiffs, particularly 3D scenes and the like.

meklarian
One thing to remember: a card specific driver is always optimized to accelerate to the fullest extent possible, whereas CPU-based code may not be optimized as well. Or the CPU may not support the optimizations that code has access to.Accelerated blitting support has been around for a long time, and depending on how the memory architecture is arranged you can get support for automatic DMA. For bulk throughput, it could make a big difference.
Christopher
The task at hand is to split up TIFF images. A library that has been written with prior knowledge of a TIFF layout doesn't need to do all the other intermediate steps of creating HDCs and support objects. Also, since TIFFs are a raster format, there isn't any need to do transformations like one would have to do with JPEGs and other related formats.
meklarian