Solved

DirectDraw for fast DIB drawing?

Posted on 1998-01-06
3
952 Views
Last Modified: 2013-11-20
Environment: Visual C++ 5.0 SP3, WinNT 4.0

I realise that there is a great deal of information about DirectX available
via the WEB and Microsoft SDKs, and I have spent the last two days perusing
this information. However it seems a little bit sketchy in the actual area I
require. If anybody knows of anywhere where I can get info on, or samples /
examples of the following I would be very interested:

--

My application is for Windows NT4.0 (I believe I can use up to DirectX3.0
with NT), the software requires a video capture board to be located in the
machine. The capture board supplies a pointer to each captured image in
RGB24 format to the software via a driver. I then use this pointer to draw
the captured image to a "monitor" using StretchDIBits(). The problem I have
is this is very slow. In particular because the monitor is only a small part
of the whole program (it is in a separate thread to prevent the rest of the
program being stalled.)

Firstly would it be faster to use BitBlt using front and back buffers as in
the samples provided? Would this be a significant improvement for the
overhead of using the DirectX SDK?

I believe it is possible to use DirectX to speed this up but what exactly do
I need to do. Is it possible to simply allocate space for the image on a
pre-allocated DirectDraw surface, and just copy the image to it? I know that
some video capture card drivers use overlay to display images directly to
the video card surface but I can find no examples of how this is possible. I
have also found a reference to DirectShow for multimedia applications but
this does not seem to cope with the raw data. And finally I have seen
references to VideoPorts in the DirectDraw online help, but no samples of
how to use them, or examples of how to correctly set up a videoport.
(Videoports are stated to be developers who want to include video playback
in their applications: is it also possible for images taken directly from a
capture card?)

Many Thanks In Advance,

Spencer Jones
Chief Software Developer
Azure Limited
0
Comment
Question by:sdj
  • 2
3 Comments
 
LVL 7

Expert Comment

by:galkin
ID: 1313479
First if you have enough video memory you can screate directDraw surface in this memory and then blit your image on this surface using either IDirectDrawSurface2::Blt or IDirectDrawSurface2::BltFast. Then use IDirectDrawSurface2::Flip to make this front-buffer surface front buffer surface. This operation is very fast and doesn't cause any flickering. If you don't have enough video memory you can build back buffer surface in regular memory. In this case istead of Flip you must blit from back buffer onto front buffer using Blt or BltFast. It is slower then Flip but faster then off screen GDI blitting. You can also use DrawDIBDraw do send raw data to back buffer.

If you download DirectX SDK see DirectDraw samples. There is sample which parses AVI file into separate frames and uses DrawDIBDraw to draw a frame on back buffer.
0
 

Author Comment

by:sdj
ID: 1313480
I have downloaded the SDK (I have version 5.0 on my 95 machine, although I know I can not use this for NT) and through the multiple samples I still can not find one that uses video. I have searched them all on the keywords "avi", "DrawDIBDraw" and "video".

Hence I understand you are confirming that it should be quicker to use DirectDraw, however I still can not find any good sample code....

Thanks Anyway,
Spencer
0
 
LVL 7

Accepted Solution

by:
galkin earned 200 total points
ID: 1313481
I am sorry this sample is AVIDD95 and can be downloaded from Microsoft ftp or WWW.
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
repeateFront java challenge 31 87
Expand data scrubbing tool 13 31
if loop in java 3 114
fix34  challenge 9 97
This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

757 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now