Usenet.com

www.Usenet.com

Group Index

Sci Thread Archive from Usenet.com

<-- __Chronological__ --> <-- __Thread__ -->

Re: any matlab function/source code for huffman encoding



"walala" <[EMAIL PROTECTED]> schreef in bericht
news:[EMAIL PROTECTED]
> Dear all,
>
> I am looking for matlab source code for huffman encoding such as those
used
> in JPEG...
>
> I hate C code since I guess I need 10x more time to modify it to suit my
> need; but with matlab code it is more understandable and modifiable...
>
> My need is to see a 16x16 picture block, if using Huffman encoding...
needs
> how many bits....(need accurate bit counting, and do not want get the
> overhead of jpeg header file...)
>
> Please help me!
>
> Thanks a lot,
>
> -Walala
>

no matlab functions here,

however if you only need to know how many bits it would take with huffman
codes, then you should not really compress the file.
All you need to know is how many bits are needed to encode each (different)
symbol.
then the entire length of the encoded file (without headers, as you wanted)
is given by:

Entire_Length = 0;
for (int i=0;i<256 (1); i++){
    Entire_Length += occurences[i] * bit_length[i];
}

in which:
1. bit_length[i] is the amount of bits needed to encode i;
2. occurences[i] is frequency of i;

if you want to know how to get the amount of bits needed for a certain i,
then i suggest using google ;-).

jan





<-- __Chronological__ --> <-- __Thread__ -->


Usenet.com



Please check out one of the premium Usenet Newsgroup Service Providers below for access to Usenet.