Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion LJPEG-1992/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ For example let's assume that

### Second phase: generate BITS and HUFFVAL vectors -Huffman Coding-
- BITS is a vector of length 16, BITS represent count of each code-size and total number of nodes in the tree. For example BITS={0,3,1,1,1,1,0,0,0,0,0,0,0,0,0,0} means that it represent a tree with a total of 7 nodes. With three nodes of code-size=2, one node of code-size=3, one node of code-size=4, one node of code-size=5, one node of code-size=6. This mean only 7 of SSSS-class have data and encoded but which SSSS-class have data and which not can't be known from BITS vector.
- HUFFVAL is a vector of length equal to number of nodes in the tree, its job is to specify exactly which SSSS classes are used and what is the order, so the the class with the most pixels will get the shortest code-size and the class with the least number of pixels will get the longest code-size. for example, for given BITS vector BITS={0,3,1,1,1,1,0,0,0,0,0,0,0,0,0,0}, HUFFVAL={1,2,0,4,5,9,7}, that mean SSSS-class=1 have the most number of pixels and will get assigned the shortest available code-size and class=7 have the least pixels and will get the longest available code-size,and any class not mentioned have zero pixels. Combining both BITS and HUFFVAL vectors, that means the following {Class=1 have code-size of 2, Class=1 have code-size of 2, Class=0 have code-size of 2, Class=4 have code-size of 3, Class=5 have code-size of 4, Class=9 have code-size of 5, Class=7 have code-size of 5}
- HUFFVAL is a vector of length equal to number of nodes in the tree, its job is to specify exactly which SSSS classes are used and what is the order, so the the class with the most pixels will get the shortest code-size and the class with the least number of pixels will get the longest code-size. for example, for given BITS vector BITS={0,3,1,1,1,1,0,0,0,0,0,0,0,0,0,0}, HUFFVAL={1,2,0,4,5,9,7}, that mean SSSS-class=1 have the most number of pixels and will get assigned the shortest available code-size and class=7 have the least pixels and will get the longest available code-size,and any class not mentioned have zero pixels. Combining both BITS and HUFFVAL vectors, that means the following {Class=1 have code-size of 2, Class=2 have code-size of 2, Class=0 have code-size of 2, Class=4 have code-size of 3, Class=5 have code-size of 4, Class=9 have code-size of 5, Class=7 have code-size of 6}
- LJPEG only use BITS and HUFFVAL vectors to generate the huffman tree in the encoding/decoding process. LJPEG specification do not specify strictly how to generate BITS and HUFFVAL vectors out of SSSS_histogram vector, but It propose a way of generating BITS and HUFFVAL vectors. As long as BITS and HUFFVAL vectors represents correct Huffman tree, then it's accepted.

#### Proposed way to build BITS and HUFFVAL.
Expand Down