Register | Login | |||||
Main
| Memberlist
| Active users
| Calendar
| Chat
| Online users Ranks | FAQ | ACS | Stats | Color Chart | Search | Photo album |
| |
0 users currently in Programming. |
Acmlm's Board - I3 Archive - Programming - Compression? | New poll | | |
Add to favorites | Next newer thread | Next older thread |
User | Post | ||
Sukasa Birdo Not quite as active as before. Xkeeper supporter Xk > ||bass I IP Banned myself! Twice! Since: 11-17-05 From: Somewhere over there Last post: 6470 days Last view: 6469 days |
| ||
OK.. So I'm writing a compression/decompression DLL in VB6 (And YES, you CAN write properly exported windows DLLs in VB6), but I'm a little stumped on how to go about writing a recompressor (the decompressor is done... mostly). See, I'm not quite sure hwo I would go about compressing data without writing an extremely slow compressor, I would think. Does anyone have any tips or helpful guides they know of? I'm looking through google for any ways to write a good compressor, btu I can't find any.
In case you're wondering, these are the compression types I need to support: RLE - 5-bit run length Incrementing RLE - 5-bit run length 2-byte RLE - 5-bit run length LZ-Copy - 5-bit run length LZ-Reverse-Coopy - 5-bit run length LZ-Bit-Reversing-Copy - 5-bit run length Uncompressed data blocks - 5-bit run length RLE - 10-bit run length Incrementing RLE - 10-bit run length 2-byte RLE - 10-bit run length LZ-Copy - 10-bit run length LZ-Reverse-Coopy - 10-bit run length LZ-Bit-Reversing-Copy - 10-bit run length Uncompressed data blocks - 10-bit run length |
|||
Guy Perfect Since: 11-18-05 Last post: 6471 days Last view: 6469 days |
| ||
RLE is fairly simple. Just go until you find an inconsistency in a run.
LZ, on the other hand, can be tricky. You'll need to make the compressor look into the previous input data to find the shortest combination of matches. Beware, however, because one long match followed by a shorter match may yield more bytes than a shorter first match followed by a longer second match. It's a tricky thing to comprehend, but it reaks havoc on compressing data. |
|||
Sukasa Birdo Not quite as active as before. Xkeeper supporter Xk > ||bass I IP Banned myself! Twice! Since: 11-17-05 From: Somewhere over there Last post: 6470 days Last view: 6469 days |
| ||
I know... I sorta came up with a plan that involves looking through all the compressions, and looking for anything that gives a return on your byte usage (i.e. actually shrinks the data, as opposed to enlarging it [i.e. LZ-copy-10bit for a 1-byte string]), and then picks the best of those that do, only bothering to check the 10-bit runs is a 5-bit run of the same type can go to it's max. I wrote in how to handle uncompressed data, not the regular way, but one I think would be more effective (not to mention more possible without compromising cartain other compressions). | |||
HyperHacker Star Mario Finally being paid to code in VB! If only I still enjoyed that. <_< Wii #7182 6487 4198 1828 Since: 11-18-05 From: Canada, w00t! My computer's specs, if anyone gives a damn. STOP TRUNCATING THIS >8^( Last post: 6469 days Last view: 6469 days |
| ||
MIO0 is an LZ compression, so you could look at the source of my compressor to get an idea of how to do it (and how big a pain it is). Looking back through the data to find matches is easy... the hard part is ensuring you're taking the best possible match; EG you might save more space by skipping some matches if there are others nearby.
Also, watch out for overlap. You can get cases where, for example, you've only output 2 bytes and then are told to copy 5 bytes from the output starting at position 0. This is valid - after copying the first 2 bytes your output is now 4 bytes long, and the third byte copied is the one written by the first copy - but it's easy to screw up. |
|||
Sukasa Birdo Not quite as active as before. Xkeeper supporter Xk > ||bass I IP Banned myself! Twice! Since: 11-17-05 From: Somewhere over there Last post: 6470 days Last view: 6469 days |
| ||
Ueah, my LZ-copy compressor find the longest amtch it can, then goes back when the match ends and continues looking for another, and eventually finds the longest and best match available, and compresses that. |
Add to favorites | Next newer thread | Next older thread |
Acmlm's Board - I3 Archive - Programming - Compression? | | |