Home | Reviews | GUIpedia | Forum | Fun500
aguma | Compression AlgorithmsDoes anybody know any sort of simple ones besides LZW and RLE? If you do, please reply. Thanks! :) | 2008-08-24 | 1:57 PM |
ksr | Re:Compression AlgorithmsHuffman is a good one; it's used in MP3s and JPEGs. Reading about it, it seems simple enough, but I've never tried to implement it.
http://en.wikipedia.org/wiki/Huffman_coding
edit: Although in the article, it says LZW often has better compression, and it's probably simpler. | 2008-08-24 | 1:59 PM |
Todd | Re:Compression AlgorithmsHuffman is pretty simple to learn. It's mainly for demonstrations these days but it's the base for many different compression algorithms. | 2008-08-24 | 3:26 PM |
aguma | Re:Compression AlgorithmsWell, my goal is for it to be able to compress Fun500 4's GUI.EXE. Right now my compressor isn't optimized at all, so I probably won't be able to -- yet.
I'll keep editing this and telling my progress. :) Stay tuned lol
8:51 AM: W00T I can compress THE/RAIN/IN/SPAIN/FALLS/MAINLY/ON/THE/PLAIN!!! | 2008-08-25 | 11:46 AM |
aguma | Re:Compression AlgorithmsSorry for double posting, but otherwise nobody would notice I posted this. :P
Anyway, I'm having some trouble optimizing one thing.
There's a problem when you have a string with a bunch of the same characters, for example
SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS
it compresses it, but the dictionary looks like this:
S
SS
SSS
SSSS
SSSSS
SSSSSS
SSSSSSS
how do I get rid of that? | 2008-08-25 | 12:23 PM |
Todd | Re:Compression AlgorithmsI'd have to see the code. My guess is that it's trying to compress it by looking for a replacement for the one preceding it. So "S" would be "SS" and then it replaces "SS" with "SSS", and so on and so on. | 2008-08-25 | 2:07 PM |
aguma | Re:Compression AlgorithmsWell I'm using a slightly modified LZW algorithm, and it's supposed to happen, but I don't know how to make it work right. looooool :laugh: | 2008-08-25 | 2:08 PM |
SonicBrit | Re:Compression AlgorithmsDue to the way it has to build up the dictionary it can only include stuff from the actual stream itself (hence why it will duplicate), you could however scan the file first and create a dictionary file and then using that as the symbols instead.
Eg instead of @ (64), you could encode the word 'the' etc.. That is where huffman is also useful because you are dealing with weights (frequencies), so if a word is duplicated more then the higher up the tree it will exist, and the smaller bits used to reference (encode) that word. (I hope that makes sense), basically a similar technic is used to compress the qbasic help files. | 2008-08-25 | 10:36 PM |
Other
2021 Brandon Cornell