Dr. Dóra Maros Institute of Telecommunication Óbuda University Telecommunications Techniques II. Source Coding (speech) Error detection and Error correction Transmission from source to destination Source (analog) -Microphone -Camera -Pressure, temperature etc sensors Source coding Source decoding Channel coding Channel decoding Channel (digital) Destination (analog/digital) -Speaker (ears) -Displays (eyes) -Alarms (see and hear!) Bandwidth allocation Source information Filter Source information A/D Filter Compression A/D Channel coding Compression Modulation Channel coding Channel How we „generate” voice? Glottis Vocal cords Vocal tract (resonator filter system) Excitation Characterization of Human Speech • Frequency: 300-3400 Hz • The charcaterization of a 20 ms duration sample does not change (excitation, filter system) • We can find some correlations between two consecutive 20 ms samples • Using a long time analysis we can predict the next pattern (differencial coding, eg. DPCM) •Our brain can correct a lot of „errors”! Classification of Speech Encoders Waveform encoder: describes the analog signals in the time and frequency domain Vocoders: describes the rules of phonation (how we generate the voice) Hybrid encoders: combines good properties of two coders (low rate, good quality) Subjective MOS MOS: Mean Opinion Score Theory of Waveform Encoders Sampling (sampling frequency) Quantization (number of levels) Coding (length of codeword) Benefits: good voice quality Disadvantage: big rate (PCM: 64 kbit/s) Theory of Vocoders A, E, O, I etc. vowels Excitation B, F, P, M etc. consonants Benefit: low rate (pár kb/s) Disadvantage: bad quality Voiced - Vowels Typical amplitude/time signal Pitch frequency: 50-500 Hz Typical Power Spectrum Density/ Frequency signal Voiceless - Consonants Typical amplitude/time signal (white noise) Typical Power Spectrum Density/ Frequency signal Sub-band Coding •Baseband is divided into sub-bands regarding PSD •Each sub-bands are encoded separately •Benefits: low noise sensitivity (different sampling frequencies and codeword length are used) •Bitrate: 16-32 kbit/s •Receiver: sub-bands are superimposed (added) Speech Codecs MOS AMR: Adaptive Multirate Codec (3G és 4G mobile) G723: VoIP (mobile) G728: LD-CELP, LowDelay code excited linear prediction G729: CS-ACELP, Coding of Speech, Adaptive Code GSM FR and EFR: Full rate, Enhanced Full Rate Excited Linear Prediction (VoIP) Internet Low Bitrate Codec (iLBC) Theory of Hybrid Encoder/Decoder Analysis by Synthesis (AbS) Excitation: MPE and RPE RPE MPE: Multiple Pulse Excitation MPE RPE: Regular Pulse Excitation, GSM13kbit/s MPE: aplitudes and phases are encoded RPE: only amplitudes is encoded Excitation: CELP (Code Excited Linear Prediction) Excitation Table Index Excitation Table •Code table: 1024 excitation samples •Only the index of table is sent! •Bitrate: 4,8-16 kbit/s Codec Rate tin tout Encoder Decoder Codec rate: tin-tout Typical: 50-100 ms Fast: G728 CELP (DoCELP) codec, 2-5 ms GSM Speech Codec Voice activity detector Waveform encoder Bitrate: 260 bit/20ms, 13kbit/s Voice Activity Detector (VAD) Discontinous Transmission (DTX) and SID Frame SID: Silence Indicator Fletcher-Munson Curves (sensitivity of ears) Equal-loudness contours for the human ear Phon: Unit of relative loudness level for pure tones Frequency Color Sensitivity of Eyes Luminosity sensitivity is 3 x more faster then color sensitivity Compression of Source Information Lossless compression: small part of information is lost Lossy compression: huge part of information is lost Compression Rate: original information/compressed information image: lossless : .raw lossy: .jpeg (eg. 25/1) Error Correction (general) Noisy channel Demodulator Received bit sequence (BER) Error detection procedures Automatic Repeat Request (ARQ) Forward Error Coding (FEC) Error detection Error correction Error Detection I. (repetition) • We use small blocks • Each block is sent repeatedly • Efficient, when we have only one bit error Sender Receiver 1011 1011 1011 1010 1011 1011 1011 1011 1011 1010 1011 1010 Error Detection II. (parity) • Even or odd parity • Even: we add „1” parity if the number of „1”s is odd, otherwise parity is „0”. • Odd: we add „1” parity, if the number of „1”s is even • Applications: mikrocontollers, data bus, data storage Sender Receiver Even parity 10110010 10110110 Odd parity 00110010 00110110 Error Detection III. (polarity change) • We send the original and negated bit sequency • If the bit polarity is the same at the receiver error • Disadvantege: big redundancy • Application: multicarrier systems Sender Receiver Receiver 10110010 10110010 10100010 01001101 01011101 01011101 Error Detection IV. (Cyclic Redundancy Check -CRC) • A polimon is generated from bit sequence (data) • Generator polinom is the same (known) at sender and receiver • CRC= data polinom/generator polinom • Application: mobile, RFID, Bluetooth, Ethetnet..etc MSB Sender LSB 10110010101001 CRC polinom division generator polinom Receiver 10100010101001 CRC ? polinom division CRC generator polinom Error Detection V. (CheckSum) • • • • • The message is segmented into parts We binary add the parts (CS) The message and CS are sent We binary add the parts again at receiver side If two CSs are not equal -error Sender Error Detection VI. (Hamming coding) Receiver Code i Code i Hamming distance calculator The Hamming distance of the code words is greater or equal d+1 Eg: 4/7 Hamming code …….4 data bits – 3 parity bits d=2 error can be detected, but only one is corrected Number of parity bits = largest exponent (23) Hamming coding (even parity) DATA PARITY 7653 0001 HD:4 0010 HD:3 0011 HD:3 0100 p1 p2 p3 110 101 011 011 p1: (3,5,7) – 20=1 P2: (3,6,7) – 21=2 P3: (5,6,7) – 22=4 7654321 Error Correction (ARQ:Automatic Repeat Request) Four types: •Stop and Wait •Go-Back-N •Selective •Hybrid Stop and Wait ARQ Data block t1 Sender Receiver Data block Sender t1 Receiver Data block t2 After time out the sender repeats the transmission Problem: receiver does not know whether it received the repeated or next data block Solution: 0 and 1 flag bits in consecutive data blocks Go-Back-N ARQ 1. We define a sliding time window 2. The packets are sent one by one (without ACKs) in this window 3. If the first ACK is detected window slides. 4. If not, all packets are sent again Selective ARQ Message Long message – one ACK Advantage: if no errors – fast transmission Disadvantage: If errors – the message is sent again – slow transmission Small block – more ACKs Advantage: we repeate only those blocks where errors are detected Disadvantage: slow ( ACK) Hibrid ARQ (Chase combining) NACK is sent back, receiver does not drop faulty packets Using an errors correction procedure we can repair the data from faulty packets Hibrid ARQ (Incremental redundancy) A FEC (Forward Error Coding) is used at sender side The redundancy bits are sent after NACK Forward Error Coding: FEC Two main types: •Convolutional coding •Block coding We add redundancy bits which help correct data at the receiver Convolutional Coding (theory example) (3,1,3) coder (n,k,m) coder D laches and modulo2 adders • n: number of outputs • k: number of inputs • m: number of D laches • number of input state : (m-1)2 Generator polinoms G1(1,1,1) G2 (0,1,1) G3(1,0,1) Types of Convolutional Coders (Mother coder and „punctured” coder) Mother coder:1/n „Punctured” coder: k/n eg: 2/3 coder Systematic coder •We send original data (V3,V2,V1 and redundancy (v4) Non systematic coder •We do not send original data •We send only convolutional coded info We code „1” (find the error!) Output: 11111011 1011 vs. 1 1 1 1 0 1 1 1 0 1 0 1 1 1 ? But we use convolution ! Input bits Respones (coded data) 1 11111011 0 00000000 (two bits shift) 1 11111011 1 11111011 ----------------------------------------------------------------------------Kódolt info 11110111010111 We use modulo2 adder for outputs! Shift: L-1 (L: number of inner D laches) Operation table State graph Info: 1011 Coded info: 11110111010111 Tree structure Info: 1011 Coded info: 11110111010111 Trellis Graph Coding with Trellis Graph Info: 1011 Coded info: 11110111010111 Error Correction – Fano algorythm I. Info: 1011 Coded info: 11 11 01 11 01 01 11 - Detected info: 01 11 01 11 01 01 11 Error Correction – Fano algorythm II. Error Correction – Fano algorythm III. Error Correction – Viterbi algorythm I. We use Hamming metric Hamming metric Error Correction – Viterbi algorythm II. Error Correction – Viterbi algorythm III. Error Correction – Viterbi algorythm IV. Error Correction – Viterbi algorythm V. Error Correction – Viterbi algorythm VI. Error Correction – Block Coding (general) G= 1+ X11+X13+X14+X16 XOR Gates LFSR: Linear Feedback Shift Register Error Correction – Block Coding (GSM Speech) XOR gate Data 50 bits Block code bits SW-ON – coding (50 clocks) SW-OFF – Reading Data from D laches