Performance issues with 2d blit of bitmap

Hi all,

I’m currently working on an application that blits a lot of 2d bitmaps to
the screen and I am having problems with incositent performance. The
application plays a single bitmap animation on the screen. The bitmap files
that are playing are less than 300*300 pixels at 15fps (data rate is around
4mbyte per sec). Everything plays fine when I preload the bitmaps into
memory, with my test animation, but this is not an option for the complete
program as the longest animation is around 30secs.

The animation is blitted to the screen using a color key. When I start
reading the files from disk, the animation freezes for 0.25 to 0.5 seconds
and then continues every 10 or so frames. I have setup a separate thread to
read the images from disk as additional work is being done in the main
thread. I tried setting up a buffer of SDL_Surface objects which the thread
fills up, but the problem persists. There is a loop in the main thread to
ensure that the buffer is not empty. I have setup a printf statement in the
loop and it does not print out at all during the operation of the program.
This indicates that the computer is not having problems getting the data
from the disk. However, the disk is read from when the pause happens.

I have tried using different video modes such as direct X vs WinDib as well
as hardware (including double buffering) and software modes. The program
plays two wav files at the same time as the annimation and these are both
played and mixed flawlessly.

Has anyone got any ideas on how to solve this problem?

Any help would be appreciated.

Regards,
Aaron Meola

Aaron Meola wrote:

Hi all,

I’m currently working on an application that blits a lot of 2d bitmaps to
the screen and I am having problems with incositent performance. The
application plays a single bitmap animation on the screen. The bitmap files
that are playing are less than 300*300 pixels at 15fps (data rate is around
4mbyte per sec). Everything plays fine when I preload the bitmaps into
memory, with my test animation, but this is not an option for the complete
program as the longest animation is around 30secs.

The animation is blitted to the screen using a color key. When I start
reading the files from disk, the animation freezes for 0.25 to 0.5 seconds
and then continues every 10 or so frames. I have setup a separate thread to
read the images from disk as additional work is being done in the main
thread. I tried setting up a buffer of SDL_Surface objects which the thread
fills up, but the problem persists. There is a loop in the main thread to
ensure that the buffer is not empty. I have setup a printf statement in the
loop and it does not print out at all during the operation of the program.
This indicates that the computer is not having problems getting the data
from the disk. However, the disk is read from when the pause happens.

I have tried using different video modes such as direct X vs WinDib as well
as hardware (including double buffering) and software modes. The program
plays two wav files at the same time as the annimation and these are both
played and mixed flawlessly.

Has anyone got any ideas on how to solve this problem?

Any help would be appreciated.

Regards,
Aaron Meola

Do you limit your frame rate? So you are only displaying at eg 15fps/60fps?

How long does it take to load your images and put them in the buffer on
your target machines? If you are running your code at a maximum frame
rate you could load up the images in your main loop with any remaining
time inbetween frames.

If your images are in one file, you can read multiple images at a time
into memory. Instead of one at a time. Which is a quicker method, and
doesn’t rely on the OS as much to schedule reads nicely.

Are your images compressed? On some computers(those without DMA)
reading less data from the drive may be quicker. Computers without DMA
will have a problem reading 4 megabytes per second from storage. eg
some of my old hard drives are 650KB/s - 2 megabytes per sec. Newer
ones with DMA enabled can get 12-20-40 MB/sec.

You’d be supprised how many new computers don’t have DMA enabled, which
is annoying.

Or could you use one of the existing movie formats with smpeg?

Have fun!

Thanks for your suggestions… but I fixed the problem with a simple reboot
of windows. Should have considered the obvious first!

Cheers
-Aaron

“Rene Dudfield” wrote in message
news:3F681F84.6020805 at yahoo.com

Aaron Meola wrote:

Hi all,

I’m currently working on an application that blits a lot of 2d bitmaps to
the screen and I am having problems with incositent performance. The
application plays a single bitmap animation on the screen. The bitmap
files

that are playing are less than 300*300 pixels at 15fps (data rate is
around

4mbyte per sec). Everything plays fine when I preload the bitmaps into
memory, with my test animation, but this is not an option for the
complete

program as the longest animation is around 30secs.

The animation is blitted to the screen using a color key. When I start
reading the files from disk, the animation freezes for 0.25 to 0.5
seconds

and then continues every 10 or so frames. I have setup a separate thread
to

read the images from disk as additional work is being done in the main
thread. I tried setting up a buffer of SDL_Surface objects which the
thread

fills up, but the problem persists. There is a loop in the main thread to
ensure that the buffer is not empty. I have setup a printf statement in
the

loop and it does not print out at all during the operation of the
program.

This indicates that the computer is not having problems getting the data
from the disk. However, the disk is read from when the pause happens.

I have tried using different video modes such as direct X vs WinDib as
well

as hardware (including double buffering) and software modes. The program
plays two wav files at the same time as the annimation and these are both
played and mixed flawlessly.

Has anyone got any ideas on how to solve this problem?

Any help would be appreciated.

Regards,
Aaron Meola

Do you limit your frame rate? So you are only displaying at eg
15fps/60fps?>
How long does it take to load your images and put them in the buffer on
your target machines? If you are running your code at a maximum frame
rate you could load up the images in your main loop with any remaining
time inbetween frames.

If your images are in one file, you can read multiple images at a time
into memory. Instead of one at a time. Which is a quicker method, and
doesn’t rely on the OS as much to schedule reads nicely.

Are your images compressed? On some computers(those without DMA)
reading less data from the drive may be quicker. Computers without DMA
will have a problem reading 4 megabytes per second from storage. eg
some of my old hard drives are 650KB/s - 2 megabytes per sec. Newer
ones with DMA enabled can get 12-20-40 MB/sec.

You’d be supprised how many new computers don’t have DMA enabled, which
is annoying.

Or could you use one of the existing movie formats with smpeg?

Have fun!