Implementation of error trapping technique in (31, 16) cyclic codes for

0 downloads 0 Views 997KB Size Report
16-bit sound data are used as test subjects for cyclic code encoding, decoding, and error correction. The result shows that the design works well. The design can ...
2010 International Conference on Distributed Frameworks for Multimedia Applications (DFmA)

Implementation of Error Trapping Technique in (31,16) Cyclic Codes for Two-bit Error Correction in 16-bit Sound Data Using Labview Software Udayanto Dwi Atmojo#*1, Sri Suning Kusumawardani*2 #

Gama Cendekia, Student Activitby Unit for Interdisciplinary Research and Studies, Gadjah Mada University Jalan Pancasila 1 Yogyakarta Indonesia 55821 1

[email protected]

*

Department of Electrical Engineering and Information Technology, Gadjah Mada University Jalan Grafika 2 Yogyakarta Indonesia 55821 2

[email protected]

Abstract— This paper considers the implementation of cyclic codes encoder and decoder for multimedia content in the form of sound data using National Instruments LabView software. Cyclic codes can be defined by two parameters, which are code size n and information bit size k. LabView is an easy to use, multipurpose software which has many features for designing and prototyping. This research is a preliminary research on channel coding implementation on LabView. In this research, cyclic codes are used to implement the design. 16-bit sound data are used as test subjects for cyclic code encoding, decoding, and error correction. The result shows that the design works well. The design can correct short two-bit error in last n-k position of the codeword. Authors’ next project is to implement more advanced code for error correcting implementation in LabView. Keywords— Cyclic code, LabView, encoder, decoder, error correction, error trapping.

I. INTRODUCTION Nowadays, multimedia contents in the forms of sound, image, and video are used to deliver and pass information. To make the contents accessible everywhere whenever needed, modern communication systems are used to send and receive contents in the form of digital data anywhere and anytime. During transmission process through the communication channel, there is always probability of noise which may disrupt and change the corresponding data, making the information contained in the data cannot be extracted. So, to recover noise contained data, error correction is implemented in modern communication systems by adding redundant bits as parity bits into information bits in the data. By adding these redundant bits, received data which contains error can be recovered to the original data using specific algorithm. Modern communication systems require error correction mechanism to exclude noise in the received data. Cyclic code is the predecessor of modern error correction method such as BCH (Bose, Chaudhuri, and Hocquenghem) codes, RS (Reed Solomon) codes, and Convolutional codes, which are being widely used in today’s communication systems. This paper considers the prototyping of cyclic codes using National Instruments LabView software. Cyclic codes can be

defined by two parameters, which are code size n and information bits k. A design in LabView can be easily reprogrammed. The software also comes up with reprogrammable Graphical User Interface (GUI), which is an additional feature to provide information about the operation and result. In this research, cyclic code is used to correct two-bit error contained in the bit sequence of the data. This research is a preliminary research of error correcting in LabView software. II. BASIC THEORY A. Galois Field (GF) and modulo-2 Operation A field F is a non-empty set of elements with two operators usually called addition and multiplication, denoted “+” and “*” respectively. For F to be a field a number of conditions must hold [5] [6]: 1. Closure; For every a,b in F c = a + b; d = a * b Where c,d  F 2.

Associative; For every a,b, in F c = (a + b) + c = a + (b + c) a * (b * c) = (a * b) * c

3.

(4) (5)

Inverse; If a is in F, there exist elements b and c in F such that: a + b = 0; a * c = 1

5.

(2) (3)

Identity; There exists an identity element ‘0’ for addition and ‘1’ for multiplication that satisfy: 0+a=a+0=a a*1=1*a for every a in F

4.

(1)

Commutative; For every a,b in F

(6)

a + b = b + a; a * b = b * a 6.

(7)

Distributive; For every a,b,c in F (a + b) * c = a * c + b * c

(8)

The existence of a multiplicative inverse a-1 enables division operation, because for a,b,c  F, c = b/a is defined as c = b * a-1. Similarly the existence of an additive inverse (-a) enables the use of subtraction. In this case for a,b,c  F, c = b – a is defined as c = b + (-a) [6]. It can be shown that the set of integers {0, 1, 2,…, p-1} where p is prime, together with modulo p addition and multiplication forms a field. Such a field is called the finite field of order p, or GF(p). In this paper only binary arithmetic is considered, where p is constrained to equal 2. Arithmetic in GF(2) is therefore defined modulo 2 [6]. B. Cyclic Codes An (n,k) linear code C over GF(p) is called a cyclic code if whenever a codeword c = (c0,c1,…,cn-1) is in C, c(1) = (cn1,c0,c1...,cn-3,cn-2) is also in C [1][3][4]. In cyclic codes, a codeword c may be associated with a code polynomial c(x) of degree n-1 or less described in (9) below [2][3][4]. c(x) = c0 + c1x + c2x2 + ... +cn-1xn-1

(9)

If c(x) represents a codeword in an (n,k) cyclic code, then xic(x) mod (xn+1) is also a codeword of the cyclic code C, and it can be written as described in (10) below [3][4]. xic(x) = q(x)(xn+1) + c(i)(x)

(10)

Where the remainder polynomial c(i)(x) represents an ntuple codeword obtained by cyclically shifting c by i places and q(x)) is the quotient polynomial [3]. Cyclic codes have generator polynomials which are the product of distinct minimal polynomials corresponding to α, α2,…, α2t, where α  GF(2m) is a root of the primitive polynomial p(x)[5][6]. An irreducible polynomial p(x) of degree m is said to be primitive if and only if it divides xn + 1 for no n less that 2m–1 [6]. Primitive polynomials of every degree exist over every Galois field, and every Galois field has a primitive element α [6]. Table 1 gives list polynomials of GF(2) from GF(22) until GF(211)[6]. TABLE I. PRIMITIVE POLYNOMIALS OVER GF(2).

m 2 3 4 5 6

p(x) x2 +x+1 x3+x+1 x4+x+1 x5+x2+1 x6+x2+1

m 7 8 9 10 11

p(x) x7+x3+1 x8+x4+x3+x2+1 x9+x4+1 x10+x3+1 x11+x2+1

If c(x) has α, α2,…, α2t as its roots, c(x) is divisible by the minimal polynomials m1(x), m2(x), …, m2t(x) of α, α2,…, α2t [6]. Thus, the generator polynomial of the code must be the least common multiple of these minimal polynomials, which is described in (11) below [3][6]. g (x) = LCM{m1(x),m2(x),…,m2t(x)}

(11)

For an (n,k) cyclic code with generator polynomial g(x), generator matrix G in systematic form can be found by dividing xn-k+i by the generator polynomial g(x), yielding (12) below[3]: xn-k+i = qi(x)g(x) + yi(x) i=0,1,...,k-1

(12)

Where yi(x) = yi,0 +yi,1x+yi,2x2+...+yi,n-k-1xn-k-1 is the remainder polynomial of degree n-k-1 or less [1]. Equation (11) can be rearranged, producing (13) below [3]: ci(x) = qi(x)g(x) = yi(x) + xn-k+i i=0,1,...,k-1 (13) Thus, generator matrix G in systematic form for an (n,k) cyclic code is described in (14) below [3]. Matrix G consists of n-k parity bits and identity matrix with k x k elements. G = [Pkx(n-k) | Ik]

(14)

Where Pk x (n-k) denotes the k x (n-k) matrix in vector G that determines the n - k redundant bits and Ik is the k x k identity matrix in vector G that reproduces the k information bits [3]. Associated with any linear (n,k) code is the dual code CD of dimension (n-k). The dual code is a linear (n,n-k) code with 2nk codeword, which is the null space of the linear (n,k) code [3]. The generator for the dual code, denoted by H, consists of (n-k) linearly independent code vectors such that any vector in the row space of G is orthogonal to the rows H, which this matrix H is called parity check matrix of code C [3]. An n-tuple c is a codeword if and only if it is orthogonal to every row vector of H, which may be described by (15) below [3]. c . HT = 0

(15)

which 0 denotes an all zero row vector with n - k elements. Thus, the parity check matrix can be used to detect error contained in codeword c. The corresponding parity check matrix H for an (n,k) cyclic code is described in (16) below [3]. H = [In-k | PT(n-k) x k]

(16)

Where In-k denotes n – k identity matrix and PT denotes the transpose of matrix P. When additive error e is contained inside received codeword r, the result of r . HT will produce non zero vector. Because c . HT = 0, the resulting vector, which is called syndrome, is dependent only on the additive error e contained in received codeword r, or on the other hand, syndrome s can be described using (17) below [3].

s = r . HT = (c + e) . HT = e . HT

(17)

Thus, by multiplying received codeword r that contains error e with HT, produced syndrome s can be used to determine error e contained in the corresponding received codeword r. C. Error Trapping Technique Error trapping technique is a decoding method used to decode cyclic codes. This technique is an extended version of Meggitt decoder which is the basic cyclic code decoding method [3]. Error trapping technique is effective for decoding double errors or single burst errors [3]. If error pattern e(x) caused by channel noise affects transmitted codeword c(x), the received codeword r(x) can be expressed in (18) below [3]. r(x) = c(x) + e(x)

A: sound file input to be encoded. B: sound data in digital form D: generated and transmitted codeword

Equation (18) can be rearranged to express c(x) = e(x) + r(x). If all errors are confined in the n-k redundancy section of r(x), the errors are trapped in the syndrome register, e(x) = s(x), as described by (19) and (20) in vector form below [3]. c(x) = s(x) + r(x) = (s0+r0) +(s1+r1)x+ ... + (sn-k-1+rn-k-1)xn-k-1 (19) + rn-kxn-k + rn-k+1xn-k+1+...+rn-1xn-1 (20)

If the errors in r(x) are confined to the n-k parity check section, correction is accomplished by adding the syndrome to the received bits in the n-k parity check section of r(x) [3]. III. SYSTEM DESIGN Cyclic code Encoder and Decoder are designed using LabView software. The design is implemented using LabView graphical programming combined with some Mathscript functions for some simplifications required. Sound data used for testing purposes are 16 bit, so the resulting codeword should produce 31 bit. The designed system is divided into several parts, where are illustrated in Fig.1 and Fig.2 below.

Figure 1. System block diagram (first part)

Which:

C: sound data in binary (bit) sequences

(18)

c = (s0+r0,s1+r1,...,sn-k-1+rn-k-1,rn-k,rn-k+1,...,rn-1)

Figure 2. System block diagram (second part)

E: simulated noisy transmission channel containing additive error F: received codeword G: syndrome generated H: shifted syndrome. I : k columns zero matrix. J :estimated error produced by combining n-k shifted syndrome vector and zero matrix K : recovered codeword L : decoded sound data in digital form M: recovered original sound file System work: a.

.Wav Sound data file to be encoded is read and converted to analog waveform.

b.

Analog waveform produced is then converted to digital waveform using Analog to Digital waveform function in LabView.

c.

Digital waveform produced is then converted to 16 unsigned bit binary data, which are represented in decimal numbers (0-65535).

d.

The data are then converted to 16-bit binary sequences.

e.

To produce 31-bit codeword, each 16-bit sequence is multiplied by generator matrix, which consists of 15x16 parity matrix and 16x16 identity matrix.

f.

Generated 31-bit codeword is added with additive error e, which is modeled using 31-bit sequences containing two non-zero element in each row.

g.

To detect and correct error contained in the corresponding codeword, the corresponding

codeword is multiplied by transposed parity check matrix, which produces syndrome. h.

Error trapping technique is applied using n-k shifter to estimate error contained within corresponding codeword. The resulting vector represented in matrix is combined with k elements zero matrix, producing estimated error.

i.

Then, the received codeword is added with the estimated error to revert the codeword back to the original codeword.

j.

The resulting codeword is reverted back to data information by taking the last 16 columns of the resulting codeword in matrix form.

k.

The 16-bit binary data are converted back to decimal numbers, which are then converted back to digital waveform.

l.

Digital waveform produced is converted back to analog waveform, which is then displayed and played back.

To make the implementation informative to user, a simple Graphical User Interface (GUI) is also designed to display waveform of the original sound data, waveform of error contained sound data, and waveform of recovered sound data. GUI will provide information about processed data. IV. EXPERIMENTAL RESULTS The full system is implemented using LabView software. The schematic of Analog to Digital Converter is shown in Fig.4 below. The schematic extracts waveform from the sound file and converts it to digital. There is also function for sound data playback (Play Waveform), which is also shown in Fig.4.

Schematic used to produce generator matrix is shown in Fig.5 below. Generator matrix is formed by multiplying each row of Ik by xn-k and dividing the results by g(x), and the results are parity bits Pkx(n-k) which is combined with Ik such as that complies with (14). Mathscript is used to simplify some operations rather than using graphical programming.

Figure 5. Generator matrix production schematic

Schematic used to generate and add two-bit error to generated codeword is shown in Fig.6 below, which is implemented using Mathscript, along with the codeword generating operation. Schematic shown in Fig.6 produces twobit error which may contain in first n-k position within 31-bit codeword.

Figure 3. Analog to digital converter

The schematic of Decimal to Binary Converter is shown in Fig.5 below. The schematic consists of 16 dividing operation to convert decimal number produced to 16-bit binary data.

Figure 6. Error generator schematic

Figure 4. Decimal to binary converter

Schematic used to create H and HT is shown in Fig.7 below. The schematic shown in Fig.7 creates parity check matrix H by taking Pn-k submatrix from the generator matrix and combining it with identity matrix I with n-k rows and columns, such that H complies with (12), and then transposes it producing HT.

Figure 7. Parity check matrix generation schematic

Schematic used for error estimation is shown in Fig.8 below. Schematic shown in Fig.8 below implements error trapping technique, which is designed to estimate error contained in the received codeword by shifting the generated syndrome and combining the shifted syndrome with k x k zero matrix.

Figure 10. Data extraction and binary to decimal converter schematic

The schematic of Digital to Analog Converter is shown in Fig.11 below. The resulting decimal numbers which represent recovered sound data are converted back to analog waveform, which is reconstructed back to original .Wav sound data.

'

Figure 8. Error estimation schematic

By combining each n-k shifted syndrome with k x k zero matrix, estimated error in the corresponding codeword is produced, which then can be used to correct the received codeword. Schematic used for correcting received codeword is shown in Fig.9 below. Schematic shown in Fig.9 will add the corresponding received codeword with the produced estimated error to revert the received codeword back to the original codeword.

Figure 11. Digital to analog converter and sound WAV reconstruction

The designed system is tested to encode, decode, and correct error on .Wav sound data, which has the following specifications: -

Sampling frequency = 22050 Hz

-

Sound duration = approximately 0.6 s

-

1 channel mono

The computer used for implementation testing has the following specifications: -

Intel Centrino 1.20 GHz

Figure 9. Error correcting schematic

-

1 GB RAM

The schematic of Binary to Decimal Converter is shown in Fig.10 below. The schematic consists of data extraction function, 16 multipliers, and single modulo-2 adder. Information data d contained in each codeword are extracted by extracting the last k columns of the corresponding codeword. The resulting 16-bit binary data extracted are then converted to decimal representation of the 16-bit sound data.

-

Windows XP operating system

The experiment gives good result. The result, which can be observed using designed GUI, is shown in Fig.12 below. GUI shown in Fig.12 displays some variables and information, which are original data d, codeword c, received codeword r, recovered codeword, and recovered data.

Figure 15. Recovered sound data waveform

Figure 12. GUI and experiment result

The original signal is shown in Fig.13 below. The signal is taken directly from the Wav.file and then displayed using Labview waveform graph function.

Figure 13. Original sound waveform

The error contained signal is shown in Fig.14 below. The signal is taken from last k elements from received codeword r and then displayed using Labview waveform graph function.

V. CONCLUSIONS In this research, LabView software has been used for error correction implementation. Cyclic code is chosen for the implementation to correct two-bit error contained 16-bit sound data. The system generates 31-bit codeword which consists of 15-bit parity and 16-bit information data. For error correction, the system uses error trapping to estimate error contained in the data. The result shows that the designed system can correct the error contained in the data, as expected. Future works will include more advanced implementation such as Fire codes, BCH codes, convolution codes, and Turbo codes. ACKNOWLEDGMENT The author would like to say thanks to our family, friends, and colleagues in Department of Electrical Engineering and Information Technology and in Gama Cendekia for all the supports, motivations, and the inspirations. May Allah Blesses us everywhere where go and everything we do. REFERENCES [1] [2] [3] [4] [5] [6]

Figure 14. Noisy sound waveform (noise added)

The recovered signal is shown in Fig.15 below. The signal is taken from last k elements from recovered codeword c and then reconstructed back to sound wave, which is displayed using Labview waveform graph function. By comparing the original sound waveform with the recovered sound waveform, it can be observed that the system can detect and recover noisy sound data.

C. B. Rorabaugh, Error Coding Cookbook Practical C/C++ Routines and Recipes for Error Detection and Correction. New York: McGrawHill, 1995. J. I. Hall, Notes on Coding Theory. Michigan: Michigan State University, 2003. M. Y. Rhee, Error Correcting Coding Theory. Singapore, Singapore: McGraw Hill, 1989. S. B. Wicker, Error Control Systems for Digital Communications and Storage. New Jersey:Prentice Hall, 1995. S. Lin and D. J. Costello, Jr., Error Control Coding. New Jersey: Prentice Hall, 1983. S. S. Kusumawardani and B. Sutopo, “Designing 1 bit error correcting circuit on FPGA using BCH codes”, in Proc. CECI’01, 2001.