Based on an spatial predictor and a 0-order static variable-length encoder (Huffman).
The block diagram is:
Categories:
Huffman codes:
Example ($e=5$):
Example ($e=-9$):
Example (decode $100101$):
Example (decode $1010110$):
In [ ]:
!wget https://sourceforge.net/projects/jpeg/files/jpeg/Cornell%20LJPEG%20v1.0/ljpg.tar.Z/download?use_mirror=ayera&download=&failedmirror=kent.dl.sourceforge.net
!uncompress ljpg.tar.Z
!tar xv ljpg.tar
%cd ljpg
!make
Codec | lena boats pepers zelda Average
--------+--------------------------------
: | : : : : :
ls-jpeg | .... .... .... .... ....
Cb and Cr signals can be subsampled without visual loss.
Reduces the size of Cb and Cr signas in 1/4.
In [ ]: