Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

DirectDraw for fast DIB drawing?

Posted on 1998-01-06
3
Medium Priority
?
978 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 600 total points
ID: 1313481
I am sorry this sample is AVIDD95 and can be downloaded from Microsoft ftp or WWW.
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

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

Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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.
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

636 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