A set of MATLAB m-files (version 5.2) which do complete Huffman Coding.
The files are:
hufflen: Based on probability (or number of occurences) of each symbol the length for the Huffman codewords are calculated.
ex: HL = hufflen(S);
huffcode: Based on the codeword lengths this function find the Huffman codewords
ex: HK = huffcode(HL);
hufftree: Make the Huffman-tree from the length of Huffman codes
ex: Htree = hufftree(HL);
huff03: Huffman encoder/decoder, one or two vectors of non-negative integers are huffman coded.
ex: y = huff03(x1, x2); % encoding
ex: [x1, x2] = huff03(y); % decoding
A newer zip-file is now available from http://www.ux.uis.no/~karlsk/proj99/index.html
It`s not bad. However, I think you can make it more simple and efficient. It`s too long and it needs three other function beside the orginal one, you can combine them in one function and much less lines. it's going to be then more faster in execution and less error. I have made one but still in progress. anyway, mine is much less lines than this one. You are like trying to execute 1+1 in this manner y = 1, x = 1, and z = y, s = x, then g = z + s.
Good luck man.
its really nice
the coding process is not running correctly it fails in encoding itself help for it
I tried using a square wave with a long period and the compression was no different than for a random sequence. There appears to be a bug that needs fixing first.
Doesn't seem to work, e.g., for a constant sequence it gives irrelevant codewords.
I try it
Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.