Chapter15 (Compatibility Mode)
Chapter15 (Compatibility Mode)
with OpenGL 3e
• Run-length encoding
– Simply searches the image file for contiguous, repeated values
– Reduced file is formed by storing each sequence of repeated
values as the single file value along with the number of
repetitions
– For example : A list indicate that the value 20 occurs 4 times,
followed by 3 non-repeating values 99,68,31, and followed by
8 occurrence of value 40
{20,20,20,20,99,68,31,40,40,40,40,40,40,40,40,…..}
Encoded as :
{4,20,-3,99,68,31,8,40,…..}
• LZW encoding
– A modification of the earlier LZ, LZ77 and LZ78 pattern-
recognition algorithms
– Replace the repeated pattern with a code
– For example: assign the pattern {128,96} as c1,
{200,30,10} as c2 and {50,240} as c3
{128,96,200,30,10,128,96,50,240,200,30,20,…..}
Encoded as :
{c1,c2,c1,c3,c2,……}
• Huffman encoding
– Using variable length code for the value in an image file
– Assigns the shortest code for the most frequently occurring
value in the file
– Assigns the longest code for the least frequently occurring
value
– Similar idea as Morse code
• Procedure of Huffman encoding
– Count the number of occurrence of each values in the
input image file
– Assign bit codes with the values according to the
frequency count
• For example, construct a tree
• Arithmetic encoding
– The frequency count in a file is used to obtain numerical
codes for sequences of the file values
– Procedure of arithmetic encoding
• Computes the fraction of the file that is occupied by each
value
• Create a sub-intervals within the unit interval from 0.0 to
1.0
• Map the file fraction to the sub-intervals
• Establish numerical intervals for various combinations of
the file values
• The combinations is encoded with the numerical bounds
• Arithmetic encoding
– Example
File value Frequency count File fraction Unit-interval range
V1 16 0.20 0.00 – 0.20
V2 24 0.30 0.20 – 0.50
V3 40 0.50 0.50 – 1.00
Total 80 1.00
Encoded as
{471.29, 143.81, -67.76, 16.33, 7.42, -4.73, 5.49, 0.05}
c lm 1 c lm
n n
2
– The n by n set of input values
n1 n1
(2 j 1)l (2k 1)m j,k 0,1,...,n
cos
V jk lm0
0
c jV j cos 2n 2n 1