Solved

DirectDraw for fast DIB drawing?

Posted on 1998-01-06
3
965 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
[X]
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
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
mapAB Challlenge 35 180
Authenticate using sesu from script 7 152
Problem to Office 1 63
Notepad++ Question 11 21
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
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.
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…
Suggested Courses

738 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