Huffman Coding with norm2huff and huff2norm function
Show older comments
I have an 8000 information signal and then it is compressed using huffman coding (norm2huff) and then the signal is transmitted over the rayleigh channel. And during the decompression process using the huff2norm function, the number of information signals increases to 8932. Can you explain why that happened? Thanks before
[zipped,info] = norm2huff(quantized_sound); %compress
unzipped = huff2norm(uint8(decoded),info); %de-compress
10 Comments
Walter Roberson
on 14 Aug 2019
What kind of error detection and correction is done on the Rayleigh channel?
Ibnu Darajat
on 14 Aug 2019
Walter Roberson
on 14 Aug 2019
Huffman coding can only be used when the channel is perfect after error detection and correction, unless you introduce synchronization points in the stream that act to restrict error propagation (in which case a portion of the output might be wrong, but then you recover and start outputing correct data again.)
Ibnu Darajat
on 14 Aug 2019
Walter Roberson
on 14 Aug 2019
Imagine that you have a huffman dictionary:
01 -> Darajat
00 -> wins!
1 -> Ibnu
Now let us imagine that you have the "message" Darjat to send. That gets encoded as 01 . Now let that 01 get transmitted, but let there be a bit error on the 01 such that what is received after detection and correction is 11 . Decode that bit stream according to the dictionary. You start from the beginning of the stream and see that you have a 1 in hand. Match that to the dictionary. Temporarily eliminate all of the items in the dictionary that start with 0, and retain the rest and discard the leading 1 bit. That gives you the dictionary that contains only (empty) -> Ibnu . Are you at a dictionary with a single empty entry? Yes you are -- emit the corresponding string and restore the full dictionary, so you emit Ibnu and continue on to the second 1 out of the 11 that the receiver got. Some decoding logic again, so the 1 matches and again you emit Ibnu . So now you have emitted Ibnu Ibnu -- two items where you only expected one item, Darajat
If you have even a single bit error in a huffman sequence, then everything after that can get messed up in decoding and the number of items emitted can be quite different than if you did not have the error.
Ibnu Darajat
on 15 Aug 2019
Ibnu Darajat
on 15 Aug 2019
Walter Roberson
on 15 Aug 2019
I am not sure what you mean by the average length of the function?
Ibnu Darajat
on 15 Aug 2019
Walter Roberson
on 15 Aug 2019
Sum of (probability times length of encoding) , where probability is fraction of occurrences in the original source.
Answers (0)
Categories
Find more on Large Files and Big Data in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!