Recommended Posts

Hello there. I have written some code to copy from a video sample onto and Direct3DTexture9 surface. It is, however, fairly slow and I thought that maybe you guys could give me a hand in speeding it up a little as I dont know all that much about optimization. The code looks like this:

This function is called every frame. I already know that it would be a good idea to move some of the variables out of the function but what I think could really help is to the make the loop faster. All is basically does is loop through the sample copying each pixel onto the texture. Each pixel is 32bit and is represented by the RGBQUAD (GDI) for ease of use.
If anybody could help that would be greatly appreciated.
Mark Coleman
P.S. Please dont flame my code too much I know it is pretty bad!

Share this post

Link to post

Share on other sites

Id say yes, get this, i have a great program called imageforge and it allows you to create gifs, avis, ect, and well i tried to make an avi, worked great... i saved it uncompressed thinking that was non standard, it was about 5 seconds long, it ended up being 30 mb, after STANDARD compression, it was down to 600 kb, and with DivX it was down to 300 so if you consider it, the bandwidth is probably so affected that it gets like that (just my two cents)

Share this post

Link to post

Share on other sites

It was a problem with my FPS code rather than the Direct Show code, I think the FPS was too high so Direct Show was missing lots of frames.

Ademan555 - I think you have a point, but for just one file bandwidth isnt really a problem. However, I will be using up to 10 animations on screen at once so I may well run into trouble. That program you used to compress your AVI, does it maintain the file as an AVI? Also does it maintain the format of the AVI? If so then I would be very aprreciative if you could tell me where I could get it from. I may do some tests to see if it works with my application.

Thanks.

Mark Coleman

[edited by - mrmrcoleman on February 19, 2004 9:13:51 PM]

0

Share this post

Link to post

Share on other sites

Yes, it retains the AVI extension, and because its microsoft''s standard compression, i assume it would be compatible, and heres a link (its free to try, i think 20 to buy (i hate it all my favorite old shareware programs are becomming free to try $X to buy ) crimsonland, imageforge, bleh) oh and heres a link

Share this post

Link to post

Share on other sites

I''m no expert on video files and all but I know that DirectShow''s VMR9 can give you a video image directly as a D3D texture. This is what the ATI Video Shader app uses. Maybe you could look into using that?

Share on other sites

When asking these questions, always ask yourself: "where is the bottleneck"?

Then find out. Don''t guess -- measure! Get a profiler. Something like VTune, or Quantify, or CodeAnalyst. It will tell you.

Also, when asking yourself whether your computer can do 10 AVIs, look at the data rate of your AVI. If each AVI is 1 MB/s in data rate, then you''d need to be able to sustain 10 MB/s from your hard disk to play back 10 streams; this is while seeking between the 10 streams.