Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (522)
Games in Android Showcase (127)
games submitted by our members
Games in WIP (591)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  GZIPInputStream  (Read 4540 times)
0 Members and 1 Guest are viewing this topic.
Offline Chman

Junior Devvie




Nothing more that... Java games are cool !


« Posted 2003-06-05 15:22:38 »

Hi everybody !

I'm trying to make my own texture format for lwjgl. Basically, it's very simple : the image is in raw format, and I gzip the image to reduce its size.

My goal was to reduce the loading time (because using awt image loader is not very fast...). But i've made some benchmarks and here are the results :

- When using the awt loader : 1530 ms
- When using raw format without gzip compression : 450 ms (3 times faster !!!)
- When using raw format with gzip compression : 3560 ms

So I deduce that using a GZIPInputStream is very very slow...
Does someone know where to find a faster "ungziper" or how could I do to make the decompression faster ?

Thanks for your help
++
Chman

EDIT: Oh, and forget about my english Smiley
Offline wjtprgm

Junior Newbie




Java games rock!


« Reply #1 - Posted 2003-06-05 18:36:51 »

no idea really. The only thing I can think of is to look at using java.util.zip.Deflator directly if it is just that the input stream is slow.  But that is ZLIB (GZip uses ZLIB but is somewhat different), and I don't know how much faster you could make things run that way.  You could also look for other gzip decoders (I can't remember any, but a search should find something).
Offline Chman

Junior Devvie




Nothing more that... Java games are cool !


« Reply #2 - Posted 2003-06-05 18:46:05 »

Hum... There are not so many gzip nor zip decoders for java on the web... The ones I've found were very slow, like in the JDK...

Any advices for my image loader ?
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Mojomonkey

Senior Devvie




ooh ooh eee eeee


« Reply #3 - Posted 2003-06-05 18:51:46 »

I don't know about any fast unzippers... but what I would suggest is unzipping in the background as you need textures. That is predictively determine what textures are going to be needed before too long and start loading it.  

Don't send a man to do a monkey's work.
Offline leknor

Junior Devvie




ROCK!!!


« Reply #4 - Posted 2003-06-05 19:56:06 »

http://www.jcraft.com/jzlib/index.html this is the one other java compression lib I know of.

Ant knows how to do bzip2 but that is more CPU intensive than gzip http://ant.apache.org/manual/CoreTasks/pack.html
Offline princec

« JGO Spiffy Duke »


Medals: 422
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #5 - Posted 2003-06-05 22:09:02 »

You're coming at it from the wrong angle Ch*man!
Zipping is only important when you're downloading stuff over the net. When it's local - store it in unzipped form! Then it's fast. And when you download it - well, it's zipped, of course. So it's fast then, too.

Cas Smiley

Offline Backmask

Junior Devvie




586: The average IQ needed to understand a PC


« Reply #6 - Posted 2003-06-06 05:18:43 »

Hmm princec beat me to it.

Well keep your images gzip in your distribution. Then you can unzip all the files the first time the game is launched or when it is installed. HDD storage is cheap and most people have to much of it. I prefer a fast loading game over some 10-50mbs of HDD space anytime.

Offline Chman

Junior Devvie




Nothing more that... Java games are cool !


« Reply #7 - Posted 2003-06-06 09:37:27 »

Yes, I understand, but zipped image uses 80ko, whereas unzipped it uses more than 700ko...
Offline princec

« JGO Spiffy Duke »


Medals: 422
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #8 - Posted 2003-06-06 09:39:44 »

Disk space is hugely plentiful and abundant, and bandwidth ain't. So who cares if it's half a meg when it's unzipped? I only care that it takes 10 seconds to download!

You ought to be more worried about squeezing it into graphics card memory than the speed it unzips at! Look into S3TC texture compression to shrink your textures a bit.


Cas Smiley

Offline Chman

Junior Devvie




Nothing more that... Java games are cool !


« Reply #9 - Posted 2003-06-06 09:42:26 »

Ok, thanks for your help men !
I will use S3TC... it seems to be good ! Do every graphics cards can handle this ?
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline princec

« JGO Spiffy Duke »


Medals: 422
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #10 - Posted 2003-06-06 11:07:01 »

No, only modern ones. You'll have to check for the extension.

If I recall, it doesn't save on disk space, but when you upload the texture to the card, the drivers convert it to the compressed format of your choice (in glTexImage2d)

Cas Smiley

Offline Chman

Junior Devvie




Nothing more that... Java games are cool !


« Reply #11 - Posted 2003-06-06 11:26:11 »

Quote

If I recall, it doesn't save on disk space, but when you upload the texture to the card, the drivers convert it to the compressed format of your choice (in glTexImage2d)


yeah I know Smiley

Ok, now my texture loader works well with S3TC...
Thanks for your help !
Offline elias

Senior Devvie





« Reply #12 - Posted 2003-06-06 14:33:04 »

Actually the best thing about the extension is the ability to _ignore_ specific formats. I can upload a texture with the GL_COMPRESSED_RGB(A) format and it will simply choose an appropriate format. That's the real spirit of OpenGL and comes as core in version 1.3 or 1.4 (don't remember exaclty). You will only need the more specific S3TC extension if you need to update your textures on the fly.

- elias

Offline Abuse

JGO Knight


Medals: 14


falling into the abyss of reality


« Reply #13 - Posted 2003-06-06 15:08:47 »

Isn't IO the slowest operation though :S

Loading 20megs of compressed data should take rougly half as long as 40megs of uncompressed.
If you can then decompress the 20megs in less time than it would take to finish reading in the 40megs - you should end up with a faster loading, and smaller program.

Compression is going to get more and more important as the discrepancy between Storage and processing speed increases.

Make Elite IV:Dangerous happen! Pledge your backing at KICKSTARTER here! https://dl.dropbox.com/u/54785909/EliteIVsmaller.png
Offline elias

Senior Devvie





« Reply #14 - Posted 2003-06-06 15:31:10 »

But we're talking compression as an internal texture format, so the texture will take up less of the precious video memory. The extension has nothing to do with disk format (even though you can retrieve the texture in the driver specific compressed format).

- elias

Offline Abuse

JGO Knight


Medals: 14


falling into the abyss of reality


« Reply #15 - Posted 2003-06-06 21:55:25 »

oh my response was relevant 5posts earlier Cheesy

Make Elite IV:Dangerous happen! Pledge your backing at KICKSTARTER here! https://dl.dropbox.com/u/54785909/EliteIVsmaller.png
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

trollwarrior1 (34 views)
2014-11-22 12:13:56

xFryIx (73 views)
2014-11-13 12:34:49

digdugdiggy (52 views)
2014-11-12 21:11:50

digdugdiggy (46 views)
2014-11-12 21:10:15

digdugdiggy (40 views)
2014-11-12 21:09:33

kovacsa (66 views)
2014-11-07 19:57:14

TehJavaDev (70 views)
2014-11-03 22:04:50

BurntPizza (68 views)
2014-11-03 18:54:52

moogie (83 views)
2014-11-03 06:22:04

CopyableCougar4 (82 views)
2014-11-01 23:36:41
Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!