vinx13 / huffman

An encoder and decoder based on canonical Huffman encoding.
BSD 3-Clause "New" or "Revised" License
1 stars 1 forks source link

Support of int_type characters rather than Char to accommodate signed values #1

Open rajputasif opened 6 years ago

rajputasif commented 6 years ago

Hey vinx13,

I have forked your project and added some very crude changes (possibly brutal) to make the compressor and decompressor work with int_type values (to be encoded/decoded).

Although my hacks are pretty brutal, but this type of compressor/decompressor can handle signed values which is required in for eg. predictive coding and delta coding etc.

If you feel like it... add them to master. Asif

vinx13 commented 6 years ago

Thanks for your contribution! Would you like to make some cleanup to your code and make a PR ? Alternatively I can add a link to your repo for reference.

rajputasif commented 6 years ago

At first, I thought to edit everything and make it a template based but it turned out that it will be useless. Firstly, a 32 bit signed/unsigned data type will be able to handle all 8 and 16 bit data types (provided that only overhead is typecasting). Secondly, it doesnt matter how much no. of bits are used since frequency counter ensures that only available symbols are used.

So In summary, I guess int_type implementation will be capable of handling many data-types.

vinx13 commented 6 years ago

Yep, you are definitely right, using int type instead of byte would be better.