2

I have raw bitmap data (pixel colors, 32 bit) in an array. Is there a simple way to display such a "sprite" on a D3DImage? Preferably without use of thirdparty libs (such as SharpDX).

Background: I have raw bitmap frames coming from unmanaged DLL and I need to display them with high framerate/low CPU usage in WPF. So far I've tried WriteableBitmap and InteropBitmap, but they are too slow (I get ~110 fps on maximized window (1680x1050 display), Core i5; and this is just a simple test with filling the memory. I believe that modern computers should do this much faster without using 100% CPU core time). I'm also looking at VideoRendererElement (Displaying live video from a raw uncompressed byte source in C#: WPF vs. Win forms), but this is a bit overcomplicated (involves unmanaged dlls, regsvr32 registration, etc).

As I see from D3DImage samples, it achieves good framerates without stressing the CPU. I wonder if it is possible to use it for bitmap display.

UPD: I've found this: http://www.codeproject.com/Articles/113991/Using-Direct2D-with-WPF

Which is basically what I was looking for. I've plugged it into my project, and it is on par with InteropBitmap, even a little bit slower. Looks like memory performance is a bottleneck in my case. In both cases most time is spent on copying bitmap (I use unmanaged memcpy).

Community
  • 1
  • 1
Pavel Tupitsyn
  • 8,393
  • 3
  • 22
  • 44
  • Interesting, on other computer, which has similar core i5 CPU, but dedicated GPU (insted of CPU integrated), I get 270 fps on a full-hd screen (1920х1080 window size) – Pavel Tupitsyn Aug 21 '13 at 10:03
  • could you share an example of how you solved this problem? I am trying to display a byte array (image from a camera) in a D3DImage. My only difference is that before I display the byte array, I am manipulating the array on the GPU. My desire is to display from the GPU (using InterOp??) without unloading it from the GPU. Thanks. – Bryan Greenway May 19 '14 at 17:56
  • Sorry, no, I ended up using InteropBitmap. – Pavel Tupitsyn May 21 '14 at 15:50
  • Gotcha...Thanks anyway. – Bryan Greenway May 21 '14 at 19:07

0 Answers0