04 November 2020, 17:58 | #1 |
Registered User
Join Date: Feb 2020
Location: Germany
Posts: 178
|
decruncing on the fly...
Hello everybody,
there is a tutorial or a piece of source code that briefly shows how to unpack onethefly data. With the packer "Shrinkler" or "Cranker" I can pack the raw data. Now I want to read this file piece by piece and unpack it immediately. The unpacking as a whole is no problem. Thanks and greetings JoeJoe |
04 November 2020, 22:48 | #2 | ||
Natteravn
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,496
|
Quote:
Quote:
You need a compression format which is represented as a single continuous stream. This works fine for simple compressors like Bytekiller, but it doesn't for LZ compressors, for example, which need a second stream for the literal buffer. Some of my games use Bytekiller compression and I'm just reading one 512 bytes block after another into a buffer to decompress it on the fly. I have no experience with Shrinkler or Cranker, though. |
||
05 November 2020, 06:53 | #3 |
Registered User
Join Date: Feb 2020
Location: Germany
Posts: 178
|
Sorry, I am looking for a tutorial. Here I have found a good code fragment. https://github.com/keirf/Amiga-Stuff/tree/master/inflate
|
06 November 2020, 11:26 | #4 | |
Registered User
Join Date: May 2011
Location: Cambridge
Posts: 682
|
Quote:
Or is it to hide the unpack time behind disk latency? This is tricky: You would need a pair of coroutines, one for disk, which yields after issuing a disk-read DMA, and one for the compressor, which would yield on a newly-implemented "yield symbol". I'm interested in doing this but had no time (or real purpose for it) so far. It's obviously non-trivial. |
|
06 November 2020, 21:38 | #5 |
Registered User
Join Date: Feb 2019
Location: Munich, Germany
Posts: 63
|
„Titanics Cruncher decrunches while loading...“
|
07 November 2020, 12:34 | #6 |
Registered User
Join Date: May 2004
Location: Somewhere secret
Age: 50
Posts: 364
|
It's quite tricky/unusual on Amiga, I know Mr.Spiv implemented a combined disk-loader/decrunch (almost certainly based on STC?) for the game "Elfmania" but 99.9% of games/demos simply load entire file then decrunch...
|
08 November 2020, 07:51 | #7 |
Registered User
Join Date: May 2015
Location: Kirkland, Washington, USA
Posts: 56
|
We used a trackloader+decruncher in 3d demo II intro (which was dumb because it was practically a single-file intro). The design is straightforward: double-buffer the memory that track is loaded into, and while waiting for track N to load into buffer A, decode track N-1 from buffer B into the destination buffer, and the decompressor (which uses an algorithm that allows in-place decompression, and can store its' state and resume) runs through the newly loaded bytes.
In pseudo-code: Code:
start DMA read of track 0 into track buffer 0 while(there are more tracks to read) { Wait for DMA track read finish start DMA read of track N into track buffer (N&1) Decode buffer track N-1 from track buffer ((N-1)&1) Decompress the decoded track N-1 N++ } Wait for DMA track read finish Decode buffer track N-1 from track buffer ((N-1)&1) Decompress the decoded track N-1 if you have a file that's 100000 bytes long when uncompressed, but 30000 bytes when compressed, I'd allocate, say 100008 bytes, and load the compressed file starting 70008 bytes into the buffer. |
08 November 2020, 09:50 | #8 |
Registered User
Join Date: Feb 2020
Location: Germany
Posts: 178
|
Thanks guys, very interesting contributions just the example with the trackloader and unpack. If you now adapt the trackloader to read a "DOS" file, it should be possible to load and unpack it.
|
13 November 2020, 18:10 | #9 |
Registered User
Join Date: Aug 2006
Location: Finland
Age: 51
Posts: 241
|
The original "Smarty and Nasty Gluttons" used track loader that decrunched a track while DMA was loading the next one.. Similar what Hannibal was describing. And if my memory is serving me right Elf-Mania had a similar loader (at least I got paid for providing the (de)compression program for that purpose )
The "new" Smarty and Nasty Gluttons has a hw banding FFS file loader that decrunches files per sector basic. Alas it has no DMA interleaving, which makes the loader slightly slow.. |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
What settings can be changed on-the-fly? | Foebane | support.WinUAE | 8 | 31 January 2017 22:33 |
Bitplane removal on the fly | gifgit | request.UAE Wishlist | 6 | 11 October 2015 20:31 |
Venus - The Fly Trap | benas | request.Old Rare Games | 3 | 01 March 2015 18:36 |
Fly Harder CD32 | killergorilla | request.Old Rare Games | 8 | 19 November 2010 20:56 |
Remove BlazeWCP on the fly? | pintcat | support.Apps | 19 | 25 June 2010 21:10 |
|
|