|
Elias delta code is a universal code encoding the positive integers. To code a number: An equivalent way to express the same process: The code begins: 1 = 20 => N' = 0, N = 1 => 1 2 = 21 + 0 => N' = 1, N = 2 => 0100 3 = 21 + 1 => N' = 1, N = 2 => 0101 4 = 22 + 0 => N' = 2, N = 3 => 01100 5 = 22 + 1 => N' = 2, N = 3 => 01101 6 = 22 + 2 => N' = 2, N = 3 => 01110 7 = 22 + 3 => N' = 2, N = 3 => 01111 8 = 23 + 0 => N' = 3, N = 4 => 00100000 9 = 23 + 1 => N' = 3, N = 4 => 00100001 10 = 23 + 2 => N' = 3, N = 4 => 00100010 11 = 23 + 3 => N' = 3, N = 4 => 00100011 12 = 23 + 4 => N' = 3, N = 4 => 00100100 13 = 23 + 5 => N' = 3, N = 4 => 00100101 14 = 23 + 6 => N' = 3, N = 4 => 00100110 15 = 23 + 7 => N' = 3, N = 4 => 00100111 16 = 24 + 0 => N' = 4, N = 5 => 001010000 17 = 24 + 1 => N' = 4, N = 5 => 001010001 To decode an Elias delta-coded integer: Example: 001010001 1. 2 leading zeros in 001 2. read 2 more bits i.e. 00101 3. decode N = 00101 = 5 4. get N' = 5 - 1 = 4 remaining bits for the complete code i.e. '0001' 5. encoded number = 24 + 1 = 17 This code can be generalized to zero or negative integers in the same ways described in Elias gamma coding. See also: Elias gamma coding, Elias omega coding
| ||||||||
|
| |||||||||
![]() |
|
| |