Databases Reference
In-Depth Information
As Scale3 is 1, we transmit a 0 and decrement Scale3 to 0. The MSBs of the upper and lower
limits are both 0, so we shift out and transmit 0:
l ( 3 ) = (
01001000
) 2 =
72
(44)
u ( 3 ) = (
01010011
) 2 =
83
(45)
Both MSBs are again 0, so we shift out and transmit 0:
l ( 3 ) = (
10010000
) 2 =
144
(46)
u ( 3 ) = (
10100111
) 2 =
167
(47)
Now both MSBs are 1, so we shift out and transmit a 1. The limits become
l ( 3 ) = (
) 2 =
(48)
00100000
32
u ( 3 ) = (
) 2 =
(49)
01001111
79
Once again the MSBs are the same. This time we shift out and transmit a 0.
l ( 3 ) = (
01000000
) 2 =
64
(50)
u ( 3 ) = (
10011111
) 2 =
159
(51)
Now the MSBs are different. However, the second MSB for the lower limit is 1 while the
second MSB for the upper limit is 0. This is the condition for the E 3 mapping. Applying the
E 3 mapping by complementing the second MSB and shifting 1 bit to the left, we get
l ( 3 ) = (
00000000
) 2 =
0
(52)
u ( 3 ) = (
10111111
) 2 =
191
(53)
We also increment Scale3 to 1.
The next element in the sequence to be encoded is 1 . Therefore,
192
×
Cum _ Count
(
0
)
l ( 4 ) =
0
+
=
0
= (
00000000
) 2
(54)
50
192
×
Cum _ Count
(
1
)
u ( 4 ) =
0
+
1
=
152
= (
10011000
) 2
(55)
50
The encoding continues in this fashion. To this point we have generated the binary sequence
1100010. If we wish to terminate the encoding at this point, we have to send the current status
of the tag. This can be done by sending the value of the lower limit l ( 4 ) .As l ( 4 ) is 0, we will
end up sending eight 0s. However, Scale3, at this point, is 1. Therefore, after we send the first
0fromthevalueof l ( 4 ) , we need to send a 1 before sending the remaining seven 0s. The final
transmitted sequence is 1100010010000000.
Decoder Implementation
Once we have the encoder implementation, the decoder implementation is easy to describe.
As mentioned earlier, once we have started decoding all we have to do is mimic the encoder
algorithm. Let us first describe the decoder algorithm using pseudocode and then study its
implementation using Example 4.4.5 .
 
Search WWH ::




Custom Search