Jpeg Performance With SDL_Image lib

I thought that when using the SDL image lib, once you had the image loaded
onto a surface it behaved exactly as if it was a .bmp file. However, when I
have a .bmp file and convert it to .jpg and load it with the IMG_Load(…)
routine, I brings my performance to a crawl compared to loading a .bmp. The
same is true with .png files. Do I have to do any other special stuff to
get it to scroll at the same speed as my bitmap files?

My workstation contains the following:
Linux Mandrake 7.0
SDL (latest developmental)
SDL_Image (latest)
Dual Celerons @ 540mhz
192mb pc133 sdram
Diamond Stealth II S220 (verite 2100)
kernel 2.2.14-15mdksmp______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com

I thought that when using the SDL image lib, once you had the image loaded
onto a surface it behaved exactly as if it was a .bmp file. However, when I
have a .bmp file and convert it to .jpg and load it with the IMG_Load(…)
routine, I brings my performance to a crawl compared to loading a .bmp. The
same is true with .png files. Do I have to do any other special stuff to
get it to scroll at the same speed as my bitmap files?

The loading may take much longer. The blitting should be the same speed.

-Sam Lantinga				(slouken at devolution.com)

Lead Programmer, Loki Entertainment Software–
“Any sufficiently advanced bug is indistinguishable from a feature”
– Rich Kulawiec

I thought that when using the SDL image lib, once you had the image loaded
onto a surface it behaved exactly as if it was a .bmp file. However, when I
have a .bmp file and convert it to .jpg and load it with the IMG_Load(…)
routine, I brings my performance to a crawl compared to loading a .bmp. The
same is true with .png files. Do I have to do any other special stuff to
get it to scroll at the same speed as my bitmap files?

Maybe, you use alpha channel. Try

img = IMG_Load(“img.png”);
SDL_SetAlpha(img, 0, 0);–
Kirill

Uriah Liggett wrote:

I thought that when using the SDL image lib, once you had the image loaded
onto a surface it behaved exactly as if it was a .bmp file. However, when I
have a .bmp file and convert it to .jpg and load it with the IMG_Load(…)
routine, I brings my performance to a crawl compared to loading a .bmp. The
same is true with .png files. Do I have to do any other special stuff to
get it to scroll at the same speed as my bitmap files?

If your computer is slower than your harddisc performance, don’t use
compressed files at runtime.

jpg and png are compressed (loads fast and needs more cpu time to uncompress)
bmp is uncompressed (loads slow and needs no cpu time to uncompress)

Better rethink your concept. Preload the graphic files or convert them
for the runtime into faster formats.

Hope this helps,
Johns–
Become famous, earn no money, create graphics for FreeCraft.

http://FreeCraft.Org - A free fantasy real-time strategy game engine
http://fgp.cjb.net - The FreeCraft Graphics Project