Most efficient display method

Posted on 2003-03-06
Medium Priority
Last Modified: 2010-04-01
I have an client server app in which the server receives raw RGB video frames (384 x 288). It then passes a pointer to this frame to the client via WM_COPYDATA that now displays the frame.

At this stage I use DrawDibDraw to display the frames received. However when the video rate reaches about 100 frames per sec the display of the video consumes about 50% of the available cpu resources (Intel PIV 2.4 GHz on Win2000 prof).

Are there more efficient ways of displaying these RGB frames that would be less cpu processor intensive ? If possible please give some examples, or links to examples.

Question by:OD
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
LVL 49

Expert Comment

ID: 8078490
199 frames per second is faster than the human eye can percieve and faster than the vertical refresh rate.  In other words, some of the frames are being displayed and not ever seen!  So one solution would be to simply drop frames once you reach about 30 FPS.

However, that is not the question you asked.  Are you certain that it is the rendering of data to the screen that is soaking up the CPU cycles?  The WM_COPYDATA is not particularly efficient and could be part of the problem.  You might consider opening a NamedPipe or other high-speed IPC mechanism.

-- Dan

Author Comment

ID: 8080270

I investigated the NamedPipe/Socket/Mailslot options. The problem there is that I then have to transfer the whole frame (384 x 288 x 3 = 331kbyte per frame) from the server to the client. At 100fps that translates to some hefty data transfers, which after all my tests consumed even more cpu power than the WM_COPYDATA method.
The advantage of WM_COPYDATA is that I only need to "transfer" a pointer to the data/frames in the server and not pass the actual data itself.

Anyway, I am reasonably sure that it is the actual display that is eating away at the processor.

LVL 49

Accepted Solution

DanRollins earned 400 total points
ID: 8084120
WM_COPYDATA has to copy the data from one process's address space to that of another.  That can be time-consuming, though perhaps not much more so than other IPC mechanisms.

>> I am reasonably sure that it is the actual display...

In your position,. I'd do whatever I could to be more than "reasonably sure"  I know that in the past, I have spent many hours "fixing" the wrong thing.  That is not only wasted time, it can introduce bugs into perfectly functional code!  

So now I ALWAYS allocate debugging time right at the start to being 100% certain where the problem lies.  In this case, it would probably take all of 20 minutes to run some tests where you timed the output-without-transport and timed the transport-without-output and compared the results to the output-and-transport.

-- Dan
LVL 11

Expert Comment

ID: 9888341
No comment has been added lately, so it's time to clean up this TA. I will
leave a recommendation in the Cleanup topic area that this question is:

Answered: Points to DanRollins: Grade A

Please leave any comments here within the next seven days.

Experts: Silence means you don't care. Grading recommendations are made in light
of the posted grading guidlines (http://www.experts-exchange.com/help.jsp#hi73).


-bcl (bcladd)
EE Cleanup Volunteer

Featured Post


Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Errors will happen. It is a fact of life for the programmer. How and when errors are detected have a great impact on quality and cost of a product. It is better to detect errors at compile time, when possible and practical. Errors that make their wa…
This article will show you some of the more useful Standard Template Library (STL) algorithms through the use of working examples.  You will learn about how these algorithms fit into the STL architecture, how they work with STL containers, and why t…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question