Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

11991 Posts in 1587 Topics- by 3509 Members - Latest Member: lioneltenel

27. May 2012, 03:43:29 am
Xith3D CommunityXith3D InternalsDeveloper discussion (Moderators: Marvin Fröhlich, 'n ddrylliog)Slow to Open Texture Files (TGA Specifically)
Pages: [1]
Print
Author Topic: Slow to Open Texture Files (TGA Specifically)  (Read 1716 times)
qbproger
developers
Becoming dependent
***
Offline Offline

Posts: 217


View Profile
« on: 30. April 2008, 09:42:48 pm »

Loading TGA textures seems to be very slow.  If you want a comparison try loading a bunch of tga images (10 or 20) and then convert them to PNG, any you'll see a speedup.  Java's ImageIO.read is much faster.

I looked into this a bit, and it seems that setRGB() is a fairly slow function.  At least that's what YourKit is telling me.  TGA is about 10x slower to load than PNG.  After discovering that I was wondering what ImageIO was doing so that TGA's could be loaded faster also.

That lead me here (this is the parser for GIF Images, I believe.  It's a bit outdated, but should give clues as to what to do.  We could try looking at OpenJDK, I suppose.):
http://www.google.com/codesearch?hl=en&q=show:F_2IwIkThWQ:DW3SgkMvek0:jRWAtEoc_UM&sa=N&ct=rd&cs_p=http://dsc.ufcg.edu.br&cs_f=~dalton/javasrc/com/sun/imageio/plugins/gif/GIFImageReader.java&start=1

That's where the trail started going cold.  As I'm not a 'graphics' person per se, I'm not sure of exactly what to do.  It seems as though they're using a WritableRaster and passing in a lot of data at once, but I haven't been able to get that function to work for me the same way.

My reason for looking into this is one of the main bottlenecks of the importing process right now is loading images.  Has anybody looked into this?  Anyone more knowledgable about image formats than me want to take a look at it?

Thanks
Logged

Marvin Fröhlich
Xith Lord
Administrator
Guru
*****
Offline Offline

Posts: 4381


May the 4th, be with you...


View Profile
« Reply #1 on: 01. May 2008, 01:23:35 am »

I will put it on my list of TODOs.

Marvin
Logged
Marvin Fröhlich
Xith Lord
Administrator
Guru
*****
Offline Offline

Posts: 4381


May the 4th, be with you...


View Profile
« Reply #2 on: 05. May 2008, 02:31:08 pm »

Could you please have a look at the new benchmark-testcase org.xith3d.benchmarks.TextureLoadingBenchmark? I get the exact same times for JPEGs, PNGs and compressed/uncompressed TGAs.

Marvin
Logged
qbproger
developers
Becoming dependent
***
Offline Offline

Posts: 217


View Profile
« Reply #3 on: 05. May 2008, 05:17:15 pm »

That's really odd.  I was using YourKit to profile it, and it doesn't seem to be taking nearly as long now.  Maybe a system restart did the trick, or something like that?  I'm not sure.

On a side note when loading the tga it shows up with a blue tint.
Logged

Marvin Fröhlich
Xith Lord
Administrator
Guru
*****
Offline Offline

Posts: 4381


May the 4th, be with you...


View Profile
« Reply #4 on: 05. May 2008, 06:05:22 pm »

On a side note when loading the tga it shows up with a blue tint.

I suspect, your converter does that. As you can see in the testcase, the stone-Texture looks the same, no matter from which format it was loaded.

Which tool are you using to convert them? I used The Gimp.

Marvin
Logged
qbproger
developers
Becoming dependent
***
Offline Offline

Posts: 217


View Profile
« Reply #5 on: 05. May 2008, 08:24:07 pm »

I was viewing the stone texture checked in.

If I view it through Irfanview, it will show up with colors, but when I view it through Xith3D it shows up with a blue tint.
Logged

Marvin Fröhlich
Xith Lord
Administrator
Guru
*****
Offline Offline

Posts: 4381


May the 4th, be with you...


View Profile
« Reply #6 on: 05. May 2008, 11:41:03 pm »

I was viewing the stone texture checked in.

If I view it through Irfanview, it will show up with colors, but when I view it through Xith3D it shows up with a blue tint.

Hmm.. You're right. Strange, that I didn't see it when I last tried it. The blue tint was only showing up when loading an uncompressed TGA. I have fixed that now. The problem was, that the red and blue bytes are swapped in compressed/uncompressed formats.

Marvin
Logged
Pages: [1]
Print
Jump to:  

Theme orange-lt created by panic