Archived

This topic is now archived and is closed to further replies.

Xces

Displaying full screen pictures

Recommended Posts

Xces    122
Hey guys, i am currently using the JPG routine to load 116 JPG''s which are 800x600 @ startup of my application (it is for in a disco) Each JPG loads very slow (+1 sec), is there a way to improve the loading speed? I was thinking about 2 things: 1) change the textures to a power of 2 and .BMP format 2) load the textures while the application is running I think a combination of these 2 is the best but i am not sure..

Share this post


Link to post
Share on other sites
Guest Anonymous Poster   
Guest Anonymous Poster
#2 may or may not be a good idea. 800x600 is a good amount of data, about 1.5mb of raw data iirc.

Saving them as .bmp will definately speed up loading. Do use it, or any other non compressed format (unless space is an isssue).

If its just static images that are displayed on the screen, then you can display one, and load the next. If this is an animation though, loading pictures on the fly wll slow it down for sure. You could load them oin a separate thread, but that brings up all sorts of intresting issues.

Also remember that texture memory is not unlimited. If i did my calculations correctly, a 800x600 24bit image is roughly 1.5mb uncompressed. With 116 of them, youll be using over 160mb for textures.

Share this post


Link to post
Share on other sites
Xces    122
You got a point there. But the app still runs
(with my geforce 3 ti200)

It are still images, and i have been considering loading them in a different thread.

Share this post


Link to post
Share on other sites
a person    118
well it woudl work fine if its all loaded. d3d/ogl would swap the texture data from vram to sysram as needed. because you are loading them as 800x600x24 images they MUST be converted to be used as a texture. they will be converted to either 16bit or 32bit (with alpha ignored) depending on the color depth and how your driver handles things. the geforce3 handles both texture formats at either color depth, but there is no such thing as a 24bit texture format. 24bit images are no DWPRD aligned so access is slow, thus many cards dont even support it for a desktop resolution. images converted to power of two, are ussually scaled to the next highest texture size, which in this case is 1024x1024.

thus knowing all that worst and best case scenarios:
116 1024x1024x32 textures (the more likly scenario) 460mb of data needs to be allocated. this eats into swap space and thus while loading images you will be writing things to disk again anyway unless you have over 512mb of ram (yes even with 512mb of ram you will use the swap file because: windows, drivers, your app, other apps, will use some of the ram, leaving you with roughly 450mb or so free).

116 1024x1024x16 (unlikly) 240mb, you probbaly still will be using some swap space unless you have 512mb or more, in which case you wont need to use swap space.

instead do the following:
1. make your images 512x512x16 instead. this will hopfully keep the textures in 16bit format using much less ram. if quality is really important, use 32bit textures then.
2. store images as png files. bmp is too large, and time spent reading the images will probably be longer then decompressing a png. plus you wont lose any quaility since png is lossless. though i think no matter wha you do in this case, jpgs will load faster then nearly all the formats (including uncompressed).
3. is load time that important? consder that you will only laod it once then use it all night, it seems to be a acceptable load time. many games that you place for only a half hour take as long to load up.
4. its probably not the actual loading, but more the fact that you are loading more data then you have ram. consider the fact that on a 1.5ghz it takes approx 0.189 seconds to load a 1024x768x24 jpg image. this includes time to allocate space for storing the image in ram and converting the image to a 32bit image. so even on a 400mhz pc, it should only take 0.780 seconds at most. also if the image data is scattered across the harddrive (ie your drive is fragmneted) it will take significently longer to load the images, because the drive needs to do a lot of seeking. for reference the first time a bmp image is loaded (1024x764x24) it takes 0.460 seconds to load. loading it a second time requires only 0.023 seconds. this is becase much of the data is in the hardrive cache or in windows hardrive cache. the jpg image only dropped to 0.119 seconds. the decompress time will ussually be better then the disk read time of an uncompressed image.

do the following test. load 116 jpg images and time how long it takes. then do 116 bmps. then switch to resized images that are a power of two. just the switch to the power of two will make a HUGE difference d3d/ogl wont have to resample the image which is quite time consuming.

Share this post


Link to post
Share on other sites