Click to See Complete Forum and Search --> : Render bitmap


cobolt123
February 26th, 2008, 02:32 AM
Hi,

I need to render bitmaps really fast with great performance.
Since I at the same time need to do other CPU demanding operations it is prefered if the rendering can be handled as much as possible by the graphics card. But the rendering must perform ok even if there is no 3D support in the graphics card.

I have tried several rendering methods without coming to a conclusion.

I have tried these methods:

MFC:
----------------------------
CDC::StretchDIBits
CDC::StretchBlt
CDC::BitBlt

GDI:
----------------------------
SetDIBitsToDevice

DirectDraw:
----------------------------
IDirectDrawSurface7::BltFast

DirectX 9
----------------------------
IDirect3DDevice9::SetTexture
IDirect3DDevice9::StretchRect
ID3DXSprite::Draw


One method is by far fastest on all three systems I have tested with.
The system setup is similar for all three, except for the graphics cards:
Windows XP. service pack 2
Intel Pentium D CPU 3.40 GHz, 2GB Ram
The graphic cards differ accordingly:
1. Matrox Millenium G550. 32MB
2. Intel 82915. 128MB
3. Geforce8600GT 256Mb

The by far fastest rendering method is "IDirectDrawSurface7::BltFast".
It is also the only method which is slowest on system 1 with the worst graphics card, and by far fastest on system 3 with the best card.
Many of the other methods are worst on system 3, with the best graphics card!

However, I'am not very happy with using an old method from DDraw7, when there should be methods which are faster and more optimized for new graphic cards in DirectX 9. Furthermore BltFast does not support resizing.

But which method is this, that is best optimized for new graphics cards but also has good performance on computers with old graphics cards? And how do I use it to get the best performance and to minimize CPU usage, while letting the GPU do the work when supported by the graphics card?


What my application does is:
Retrieving several video streams on the network in MJPEG and MPEG4 format. Decoding the video to device independent bitmaps and finally rendering the bitmaps to screen in either original size, upscaled or downscaled. (An optional solution is to handle the resizing manually).
So the method has to be good at resizing the image, and I don't think I need any time consuming dubbel buffering, since I always draw the pictures in the same size at the same place once started.


Thanks for all help!

Syslock
March 3rd, 2008, 03:10 AM
I don't think you're going to get any faster than a hardware-accelerated device created by DirectX or OpenGL.
GDI and GDI+ will most likely be slower. MFC is not important.

You haven't really said where the slowdown occurs. Is it the blitting or the resizing?

If it's the resizing, then you could probably optimize it by noticing whether you're resizing an image up,
or resizing an image down, and using an optimized routine for it.

And why not use double-buffering, especially hardware-accelerated DB?
I'm almost positive it will be faster than a single buffer.