Log inRegister an accountBrowse CSDbHelp & documentationFacts & StatisticsThe forumsAvailable RSS-feeds on CSDbSupport CSDb Commodore 64 Scene Database
You are not logged in - nap
CSDb User Forums


Forums > C64 Coding > Koala compression
2010-10-03 10:45
Karoshier
Account closed

Registered: May 2010
Posts: 15
Koala compression

Hi there,
out of simple curiosity I'm digging into the .gg file format and its compression algo.
Unfortunately, codebase64 does not report information on how gg files are packed. Therefore, with a brief search, I've managed to find the following file, which is a test image ($175A bytes) written in such format.

http://www.editorix.org/congo/html/examples/test.gg

By looking into the file with an hex editor, it seems to me that it's a simple RLE packed stuff (which still loads at $6000 by the way), with escape code $FE followed a byte indicating the value to repeat and a further byte indicating the amount of repetitions.

Does anybody know whether I am correct in my assumption and whether there is anything I'm missing?

Cheers
2010-10-04 01:14
Skate

Registered: Jul 2003
Posts: 490
yeah, it looks like RLE but magic byte can be $AA as well as $FE.
2010-10-04 06:50
MagerValp

Registered: Dec 2001
Posts: 1056
#!/usr/bin/env python

with open("test.gg", "rb") as infile:
    with open("test.koa", "wb") as outfile:
        loadaddr = infile.read(2)
        outfile.write(loadaddr)
        while True:
            c = infile.read(1)
            if not c:
                break
            if c == "\xfe":
                c = infile.read(1)
                count = ord(infile.read(1))
                if count == 0:
                    count = 256
            else:
                count = 1
            outfile.write(c * count)


2010-10-04 14:41
Karoshier
Account closed

Registered: May 2010
Posts: 15
Thanks MagerValp for the quick script.
I've found out that the very same packing algo is also used for doodle; even the escape/magic byte is the same.
I'll try to update the corresponding article by groepaz/hitmen on codebase64, or have one of the admins do that if I don't have permission for it.
2010-10-04 16:37
Frantic

Registered: Mar 2003
Posts: 1627
@Karoshier: All you need to do to update an article on codebase is to register. No special permissions needed.

//FTC (Codebase admin)
2010-10-04 17:04
Karoshier
Account closed

Registered: May 2010
Posts: 15
I've noticed that, thanks Frantic.
The page has been updated. I hope that'll be useful to other sceners as well.

Here's the link, just for the sake of completeness.

http://www.codebase64.org/doku.php?id=base:c64_grafix_files_spe..
RefreshSubscribe to this thread:

You need to be logged in to post in the forum.

Search the forum:
Search   for   in  
All times are CET.
Search CSDb
Advanced
Users Online
pcollins/Quantum
Fred/Channel 4
Dymo/G★P
Hypnosis/TSD
Menace/Spaceballs
krissz
Guests online: 124
Top Demos
1 Next Level  (9.8)
2 Mojo  (9.7)
3 Coma Light 13  (9.7)
4 Edge of Disgrace  (9.6)
5 Comaland 100%  (9.6)
6 No Bounds  (9.6)
7 Uncensored  (9.6)
8 Wonderland XIV  (9.6)
9 Memento Mori  (9.6)
10 Bromance  (9.5)
Top onefile Demos
1 It's More Fun to Com..  (9.7)
2 Party Elk 2  (9.7)
3 Cubic Dream  (9.6)
4 Copper Booze  (9.5)
5 TRSAC, Gabber & Pebe..  (9.5)
6 Rainbow Connection  (9.5)
7 Wafer Demo  (9.5)
8 Dawnfall V1.1  (9.5)
9 Quadrants  (9.5)
10 Daah, Those Acid Pil..  (9.5)
Top Groups
1 Nostalgia  (9.3)
2 Oxyron  (9.3)
3 Booze Design  (9.3)
4 Censor Design  (9.3)
5 Crest  (9.3)
Top Logo Graphicians
1 Sander  (10)
2 Facet  (9.7)
3 Mermaid  (9.4)
4 Pal  (9.4)
5 Shine  (9.3)

Home - Disclaimer
Copyright © No Name 2001-2024
Page generated in: 0.037 sec.