1
Error Control Codes and Their Applications in Digital World
Eric Chen
http://moodle.tec.hkr.se/~chen
Computer Science GroupHKr
2
2
OCR-Number (OCR-nummer ) ?
• A reference number links your payment to the invoice
• Typed OCR in-correctly ? Error detection?
• E24.se reported (how it is possible?)– Företagaren Thomas Hultberg fyllde i fel
OCR-nummer när han skulle betala in skatten. Nu tvingas han betala in de 229 000 kronorna en gång till.
3
3
Outline of the talk
• Analog versus Digital• Why digital ? • Errors and Error Effect• Error Control Coding• Applications and Examples• My Research Results
4
4
Analog Environment
• Voice signal example– Microphone converts the speech to
electrical signal, it is analog
5
5
Analog Communication
• Analog signal– The value (amplitude) varies continuously
• Very difficult to re-produce the analog signal at the receiver Bad quality
6
6
Digital World• Information society, information explosion
– Most information is represented in the form of numbers
• Computer and infrastructure are digital systems• Video and audio
– VCD, DVD player– Digital TV– CD music– Mp3 player
• Information is encoded into sequences of binary digits (bits) 0 and 1
7
7
Digital Communication
• Digital signal– Limited number of discrete values
• Example– binary waveform– Binary 1 and 0 are represented by
different levels of the voltage– 010110010111
8
8
Analog and Digital Conversions
• Conversions are needed• A/D converter
– Sender– Convert analog signal to digital signal
• D/A converter– Receiver– Convert digital signal to analog signal
9
9
Advantages with digital system
• Immune to noises ?– Amplifier vs regeneratorBetter quality for digital communication
10
10
Advantages with digital system (cont.)
• Integrated services– For audio, video, others
• More reliable information exchange• Easy to provide secure
communication • Digital processing and storage• Less costly implementation
11
11
Errors in digital communications
12
12
Errors and Error Effect
• Errors
0 1 or 1 0
Bits can be lost
• Error effect
downloaded programs from Internet ?
CD music ?
Internet banking services ?
• Errors must be detected/corrected !!!
13
13
Bit Error Rate
• BER = bit_errors / total-bits = p p = 1/100000 = 10-5 for optical disks p = 10-11 for a fiber link
• Some calculations p = 10-6
• download a file of length 107 bits 10 bit errors • Data rate at 10 Mbps 1 bit error in every 1
second !!
p = 10-11, and data rate 10 Gigabits/sec 1 bit error each 10 second !
14
14
Error Effect Example 1 – image
• Waterfall – original image
15
15
Error Effect Example 1 – image
• Waterfall – with bit error rate 1/10
16
16
Error Effect Example 2– English text
• two-frogs.txt
• Bit error rate 1/100, 1/1000– two-frogs-100.txt p = 1/100– two-frogs-1000.txt p = 1/1000
– You can still read the text ?!– Why ?
• Redundancy in natural language
17
17
two-frogs.txtA group of frogs were traveling through the woods, and two of themfell into a deep pit. When the other frogs saw how deep the pitwas, they told the two frogs that they were as good as dead. Thetwo frogs ignored the comments and tried to jump up out of the pitwith all their might. The other frogs kept telling them to stop,that they were as good as dead. Finally, one of the frogs tookheed to what the other frogs were saying and gave up. He fell downand died.
The other frog continued to jump as hard as he could. Once again,the crowd of frogs yelled at him to stop the pain and just die. Hejumped even harder and finally made it out. When he got out, theother frogs said, "Did you not hear us?" The frog explained tothem that he was deaf. He thought they were encouraging him theentire time.
18
18
two-frogs-1000.txt (p = 1/1000)
A group of frogs were traveling through the woods,!and two of themfell into a deep pit. When the other frogs saw how deep the pitwas, they told the two frogs that they were as good as dead. Thetwo frogs ignored the comments and tried to jump up out of the pivwith all their might. The other frogs kept pelling them to stop,that they were as good as dead.(Finally, one of the frogs tookheed to what the other frogs were saying and gave up. He fell downand died.
The other frog continued to jump as hqrd as he could. Once again,the crowd of frogs yelled at him to stop the pain and just die. Hejumped even harder aNd finally made it out. When he got out, theother fr/gs said, "Did you not hear us?" The frog explained tothem that he was deaf. He thought they were encouraging him theentire time.
19
19
two-frogs-100.txt (p = 1/100)A group of frogs werd travening through phe woods, and two of themfell into a deep pit. _hen the odher frogs sAw how d%ep the pitwas, they told the two frog¾ that they were as good!as dead. Vhatwg frogs ignored the comments ant triEd 4o jumpáuq ouv of the pitsatx all*tha4 they were as good as dead. ãinamly, one"of tha frogs tookheed(to0what the otheR frogs were saying and 'ave up. He fell downand dieõ.♂Tje ophez frog continued t⌂ jump as hard as he could. Once again,the crowd oF frogs yell%õ!at"him to stop the pain and nust die. Hejumped even harder i~d finally made it out. When he got out♀ the☻them thqt He was de!f. He thought they wÕre encouraging him uheentire tkme.
20
20
• add additional information, or redundancy
to data
• added by sender, checked by receiver
• k data digits encoded to a codeword of n digits
• Code rate r = k / n
k nEncoded as
codeword
Error Control Coding – Principle
21
21
Application Example– Swedish personal ID
• 640823-3234 ?• yy mm dd – nnnP
yy mm dd– year month daynnn – serial number
odd– for male, even for femaleP ? That is parity check digit
Used for error detection !• OCR number uses the same technique
22
22
Personal ID Encoding Method
position 1 2 3 4 5 6 7 8 9 10 6 4 0 8 2 3 3 2 3 ?2×odd 12 4 0 8 4 3 6 2 6add2-digits 3 4 0 8 4 3 6 2 6sum = 3 + 4 + 0 + 8 + 4 + 3 + 6 + 2 + 6 = 36take the last digit of the sum: 6parity check digit = 10 – 6 = 4 640823-3234
23
23
Personal ID Error Detection
640823-3234 460823-3234 ?position 1 2 3 4 5 6 7 8 9 10 4 6 0 8 2 3 3 2 3 ?2×odd 8 6 0 8 4 3 6 2 6add2-digits 8 6 0 8 4 3 6 2 6sum = 8 + 6 + 0 + 8 + 4 + 3 + 6 + 2 + 6 = 43take the last digit of the sum: 3parity check digit = 10 – 3 = 7 It is not equal to 4 Error in the number !
24
24
• Given k data bits, add 1 parity check bit
b….b encoded as b…b P
In the encoded word, how to get P ??
• # of 1’s is even even parity check encoding
• # of 1’s is odd odd parity check encoding
• Example: k = 7, n = 8 1001001 1001001 1 Even parity, P = 1 1001001 1001001 0 Odd parity, P = 0
• Can detect any odd number of errors
Even or Odd Parity Checks
25
25
• Hamming [7, 4] code k = 4, n = 7 Encode 4 data bits by adding 3 parity bits
Can correct any single error
• Encoding
a b c d a b c d x y z
Where a, b, c, d are information bits
x, y, z are parity check bits
they are 0 or 1
Hamming Code Example
26
26
• Given a, b, c, d. How to get x, y, z ?
Place a, b, c, d in the intersections
Label circles by x, y, z
Parity checking rule:
the sum of each circle is 0
x = a+b+c, y = a + c + d, z = b + c +
d
Hamming Code Example
a
b cd
x y
z
27
27
• Given a, b, c, d. How to get x, y, z ?
0101 0101 xyz
so the codeword is 0101 110
Hamming Code Example
0
1 01
1 1
0
0
1 01
x y
z
a
b cd
x y
z
28
28
• 0101 110 sent 0100 110 received. Encode 0100 0100 101
Compare received xyz 110 there is an error
bit d must be in error, it affects y, z correction 0101
Hamming Code for Error Correction
0
1 00
1 0
1
0
1 00
1 1
0 received reconstructed
29
29
• Only detect errors
– Using protocol to correct errors:
ACK: positive acknowledgement ( I got it) NAK: negative acknowledgement ( sorry )
• Simple, reliable, high code rate• Used in data communications
Error Detecting Codes
sender receivercodeword
ACK/NAK
30
30
• Detect and correct errors
• No feedback channel required• Complicated, lower code rate• Used in storage systems (computer
storage, CD, DVD), and • space communications
Error Correcting Codes
sender receivercodeword
31
31
A picture of Saturn sent by Voyager 2
• It would not be possible without using the error correcting code
32
32
Olympus Mons by Viking 1
• the largest known volcano in the Solar System
• 27 km high, over 600km at the base, and is surrounded by a well-defined scarp that is up to 6 km high
• http://xpda.com/mars/
33
33
Application in Compact Disc (CD)
• Without error correcting codes, it is not possible to have high quality music or video on the CD
• cross-interleave Read-Solomon code (CIRC) is used– Correct about 4000 bits burst
errors•2.5 mm on disc•8 mm hole
34
34
More Applications ??
• In any applications related to digital storage, and digital communications, you can find error control codes.
• Error control coding is a standard technique to detect/correct errors
35
35
Some of my Research Results
• A web database of binary quasi-cyclic codes
moodle.tec.hkr.se/~chen/research/codes/searchqc2.htm
• A Web database of two-weight codesmoodle.tec.hkr.se/~chen/research/2-weight-codes/
search.php
36
36
References• Prasad, K. V.,
Principles of Digital Communication Systems and Computer Networks, Charles River Media, 2004
• Kularatna N., Essentials of Modern Telecommunications
Systems, Artech House Incorporated, 2004
• http://skatteverket.se/download/18.1e6d5f87115319ffba380001857/70408.pdf
• http://www.e24.se/pengar24/dinekonomi/familjeekonomi/artikel_360879.e24
• http://www.lur.nu/OCR/generera.php• http://www.bankgirot.se/upload/Gemensamt/
Trycksaker/Manualer/BG2688.pdf
37
37
• Questions ?
The material is available athttp://moodle.tec.hkr.se/~chen
Thank you