# What is the Code2 and other concepts of variable encoding in Coding Redundancy?

Am learning the concept of Coding Redundancy in image compression and am finding it hard to understand the table on page 3 of this document. All other explanations seem to follow the same symbols and methodology but don't explain the concept clearly.

Question1:
In the first column, r1=1/7, r2=2/7 etc and r7 is 1. Why is that? According to the column "Code1", the Code1 is created based on the r value which should range from 0 to 7. Why then are there fractions like 1/7, 2/7 etc?

Question2:
What is "Code2"? At least for Code1, when the value is 000, I know it is the binary representation of 0. But the same thing in Code2, is 11. I don't understand what and how they are trying to represent with Code2.

Question3:
Even if 0 is represented by 11 and 6 is represented by 000001 in variable length encoding, how is the algorithm supposed to know which 0 starts where and which 1 ends where? For example, to represent 60, I'd have to encode it as 00000111. When decoding, how is the algorithm supposed to know that it's 60?

• There should be one question per post. – Evil Nov 28 '17 at 12:08

In the first column, $r_k$ is the gray level. It ranges from 0 to 1, where 0 is 0% white (i.e., black) and 1 is 100% white. There are 8 gray levels arranged in regular intervals of 1/7.