Display a bitmap as fast as technically possible!
#1 Members - Reputation: 100
Posted 14 February 2012 - 04:42 AM
This is my syntax:
accept connection on a listening socket
recieve a bit of stuff including image dimentions
create a dx device if dx is faster than gdi
start a loop
get the bitmap from the socket
show the bitmap
loop again
with gdi it takes an imense 100ms to splash out a bitmap on a picturebox in a form i have had limited success with slimdx dx9 and the image got streched and distorted and the bitmap keeps getting corrupt and dx throws an exception and yes i have a loop for the socket.receive.
So then can someone give me some plain simple and dirty samples i can try?
#3 Members - Reputation: 3794
Posted 14 February 2012 - 05:58 PM
All of these will take more time that the actual act of showing the final bitmap on screen, irrespective of whether you use D3D or GDI. Showing an image on screen is fast - the laptop I'm using at the moment can do that several thousand times per second. Getting it from source to a format that can be shown on screen is the slow part and that's the part you need to focus on optimizing.
So like I said you need to give info on what's involved in your "get the bitmap" step before anyone can really start providing answers.
It appears that the gentleman thought C++ was extremely difficult and he was overjoyed that the machine was absorbing it; he understood that good C++ is difficult but the best C++ is well-nigh unintelligible.
#6 Members - Reputation: 3794
Posted 15 February 2012 - 04:54 AM
The network will also be a bottleneck here - a 1280x1024 screenshot will be about 5mb in size so even on a 100mbit local LAN you're looking at about half a second to transmit it - and that's assuming no other traffic or overhead (which there will be).
I think you may be already at peak performance here.
It appears that the gentleman thought C++ was extremely difficult and he was overjoyed that the machine was absorbing it; he understood that good C++ is difficult but the best C++ is well-nigh unintelligible.
#7 Members - Reputation: 1988
Posted 15 February 2012 - 05:42 AM
For example, first optimize getting the render results to the main memory as fast as possible. If you can modify the source program, use render-target textures instead of GetFrontBufferData (and preferably D3D11 hardware/api).
You can also optimize the data transfer independently of the image source - just send random frames over the network. If you haven't already, consider compressing the data before the transfer. If you can afford to lose some fidelity, a MPEG-style video codec could be useful. And if you need full fidelity, compress the individual frames using PNG before sending (though if the compression is more inefficient than the raw send, don't bother).
Live video streaming is a very difficult subject, and there is always some latency and/or bandwidth issues; especially if you play fast action games over such video terminal. With movies and other static video, you can hide latency because the delay of the image or sound is not dependent on immediate user input and therefore you can compensate for it.
Software developer
#8 Members - Reputation: 100
Posted 15 February 2012 - 07:22 AM
#9 Members - Reputation: 1988
Posted 15 February 2012 - 07:27 AM
Software developer
#12 Members - Reputation: 180
Posted 15 February 2012 - 10:14 AM
#13 Members - Reputation: 100
Posted 15 February 2012 - 10:28 AM
I've exhausted google this is like a wild goose chase im going round in circles!
#14 Members - Reputation: 100
Posted 15 February 2012 - 11:30 AM
I just noticed the dwm does the screen capture so is there a simple way of using that?
#15 Members - Reputation: 743
Posted 15 February 2012 - 06:39 PM
#16 Members - Reputation: 100
Posted 16 February 2012 - 06:44 AM
#18 Members - Reputation: 1054
Posted 18 February 2012 - 09:36 PM
There's a lot of remote control software out on the market specifically for remote assistance. I think you'd probably end up saving a lot of time and money if you downloaded/purchased an existing software solution and you'd have a higher level of quality assurance.
Hobby: Game Developer
Currently employed as: Sr. Sharepoint Developer in Afghanistan
#20 Members - Reputation: 1988
Posted 20 February 2012 - 12:21 AM
I do appreciate that you want to learn this stuff anyway, but then you have to be willing to invest unknown amount of time into the project - you don't know when you're ready until you actually are ready.
Again, approach the problem systematically, piece by piece, and then finish the puzzle when you have all the individual pieces at hand. You don't need all the pieces to begin solving it, though.
Software developer






