I was stuck a bit while implementing the Huffman Module initially. I was thinking about implementing huffman tables on fly but soon realised it’s a very difficult task.
Finally I changed my plan to build the tables using the JPEG Standards.
I added all the huffman encoded values in a csv file and then built rom tables using the csv file.
The huffman module have a small state machine sitting inside it which makes a unique serial code from the given parallel code which is huffman encoded.
We generally concat both variable length integer (run length encoded) and variable length code(huffman encoded) and store them in a FIFO.
In some cases when the input to the run length encoder do not have any zeroes, it will be bad to compress them using huffman encoder because it do not save any space.
Fianlly, the huffman encoder is merged into the main repo.