So here's my setup:
- Camera images coming in at 1920x1080 @ 25 FPS
- Writing image data to
WriteableBitmap
on UI thread (simple copy, no processing) - Two
Image
controls in two different windows on two different monitors has theirSource
property set to theWriteableBitmap
- Some generic UI stuff goes over the camera images
This works great, uses about 4% CPU on an old laptop (8 logical processors). The video is as smooth as can be. However, my UI has some animations (stuff moving around). When the camera display is running, those animations gets choppy.
Right now, the camera image is in Gray8 format, so it will be converted (I guess when calling WritePixels
?). I also tried forcing one of the animations to 25 FPS too, no change.
Where should I start to resolve this? Is the issue that I'm locking the bitmap for too long, or is there something else going on? From what I can see locking the bitmap will cause the render thread to block, so moving that to another thread seems pointless. And it does feel like that somewhat defeats the purpose of WriteableBitmap
.