I have a stream of jpeg pictures(25fps, aboud 1000x700) and i want to render it the screen with as less CPU usage as possible.
By now I found out a fast way to decompress jpeg images - it is a gdi+ api. On my machine it take about 50ns per frame. I don't know how do they manage to do it but it's true, libjpeg8 for example is a much much slower as remembered it.
I tried to use gdi+ to output a stretched picture but it uses to much CPU for such a simple job. So I switched to directx9. It's good for me, but I can't find a good way to convert a gdi+ picture to directx9 texture.
There are a lot of ways to do it and all of them slow and have high CPU usage.
One of them:
- get surface from texture
- get hdc from surface
- create gdi+ graphics from hdc
- draw without stretching (DrawI of flat API).
Another way:
- lock bits of image
- lock bits of surface
- copy bits
By the way D3DXCreateTextureFromFileInMemory
is slow.
The question is how can I use an image as texture without copy overhead? Or what is the best way to convert image to texture?