36
Pulse Code Modulation ES442 Spring 2017 Lecture 9 1 Analog signal Pulse Amplitude Modulation Pulse Width Modulation Pulse Position Modulation Pulse Code Modulation (3-bit coding)

Pulse Code Modulation - Sonoma State University · 3 Next Topic – Pulse Code Modulation Pulse-code modulation (PCM) is used to digitally represent sampled analog signals. It is

Embed Size (px)

Citation preview

Page 1: Pulse Code Modulation - Sonoma State University · 3 Next Topic – Pulse Code Modulation Pulse-code modulation (PCM) is used to digitally represent sampled analog signals. It is

Pulse Code Modulation ES442 – Spring 2017

Lecture 9

1

Analog signal

Pulse Amplitude Modulation

Pulse Width Modulation

Pulse Position Modulation

Pulse Code Modulation (3-bit coding)

Page 2: Pulse Code Modulation - Sonoma State University · 3 Next Topic – Pulse Code Modulation Pulse-code modulation (PCM) is used to digitally represent sampled analog signals. It is

2

1. Digital is more robust than analog to noise and interference†

2. Digital is more viable to using regenerative repeaters

3. Digital hardware more flexible by using microprocessors and VLSI

4. Can be coded to yield extremely low error rates with error correction

5. Easier to multiplex several digital signals than analog signals

6. Digital is more efficient in trading off SNR for bandwidth

7. Digital signals are easily encrypted for security purposes

8. Digital signal storage is easier, cheaper and more efficient

9. Reproduction of digital data is more reliable without deterioration

10. Cost is coming down in digital systems faster than in analog systems and DSP algorithms are growing in power and flexibility

Reading: Lathi & Ding; Section 6.2.1 on pages 321 and 322.

† Analog signals vary continuously and their value is affected by all levels of noise.

Advantages of Digital Over Analog For Communications

Page 3: Pulse Code Modulation - Sonoma State University · 3 Next Topic – Pulse Code Modulation Pulse-code modulation (PCM) is used to digitally represent sampled analog signals. It is

3

Next Topic – Pulse Code Modulation

Pulse-code modulation (PCM) is used to digitally represent sampled analog signals. It is the standard form of digital audio in computers, CDs, digital telephony and other digital audio applications. The amplitude of the analog signal is sampled at uniform intervals and each sample is quantized to its nearest value within a predetermined range of digital levels.

Four-bit coding (16 discrete levels)

Page 4: Pulse Code Modulation - Sonoma State University · 3 Next Topic – Pulse Code Modulation Pulse-code modulation (PCM) is used to digitally represent sampled analog signals. It is

Analog to Digital Conversion Process (ADC)

4

Note: “Discrete time” corresponds to the timing of the sampling.

Sample Quantize Encode Analog Signal Captured

Sampled Data Values

Quantized Sampled

Data

Digital Signal

Analog signal is continuous

in time & amplitude

Discrete time values:

few amplitudes from analog

signal

Now have discrete Values in

both time & amplitude

Now have the digital

data which is the final

result

Sampling selects the data points we use to create the

digital data

Quantizing chooses the amplitude

values used to encode

Encoding assigns binary

numbers to those

amplitude values

time

am

plit

ud

e

0100101101011001 1110101010101000 0100011000100011 0101001111010101 1110110111010001

time

amp

litu

de

time amp

litu

de

Three Step Process

Page 5: Pulse Code Modulation - Sonoma State University · 3 Next Topic – Pulse Code Modulation Pulse-code modulation (PCM) is used to digitally represent sampled analog signals. It is

5

Second Step – Quantization I

16 levels – 4 bits

=

The process of assigning quantization levels

Lathi & Ding Figure 1.4

p. 4

Page 6: Pulse Code Modulation - Sonoma State University · 3 Next Topic – Pulse Code Modulation Pulse-code modulation (PCM) is used to digitally represent sampled analog signals. It is

Natural Binary Pulse Code (Example)

6

To communicate sampled values, we send a sequence of bits that represents the quantized value.

For 16 quantization levels, 4 bits are required.

PCM can use a binary representation of value.

The PSTN uses PCM

Figure 1.5 (page 8) of Lathi & Ding

Page 7: Pulse Code Modulation - Sonoma State University · 3 Next Topic – Pulse Code Modulation Pulse-code modulation (PCM) is used to digitally represent sampled analog signals. It is

7

Second Step – Quantization II

We start with a sampled signal {call it m(t)} and now we want to quantize it. The quantized amplitude is limited to a range, say from –mp to +mp. (Note: the range of m(t) may extend beyond (-mp, mp) in some cases.) Divide the range (-mp, mp) into L uniformly spaced intervals. The number intervals is L and the separation between quantized levels is The kth sample point of m(t) is designated as m(kTS) and is assigned a value equal to the midpoint between two adjacent levels. Define: m(kTS) = kth sample’s value, and m(kTS) = kth quantized sample’s value. Then the quantization error q(kTS) is equal to m(kTS) - m(kTS)

Read Section 6.2.2 of Lathi & Ding: Quantizing evaluation of parameter q(t).

2 pm

L

pp. 322-324

Page 8: Pulse Code Modulation - Sonoma State University · 3 Next Topic – Pulse Code Modulation Pulse-code modulation (PCM) is used to digitally represent sampled analog signals. It is

8

Error Generated by Quantization

Quantization fluctuation or “noise”

Page 9: Pulse Code Modulation - Sonoma State University · 3 Next Topic – Pulse Code Modulation Pulse-code modulation (PCM) is used to digitally represent sampled analog signals. It is

9

Second Step – Quantization III

The quantized levels are separated by The maximum error for any sample point’s quantized value is at most ½. It is shown in Lathi and Ding that the “time average” mean square error from quantization is Let Nq equal q2. Nq is proportional to the fluctuation of the error signal. This is sometimes quantization noise. This means that m(t) = m(t) + q(t) The signal (message) power S0 is proportional to the square of m(t), thus

2 pm

L

22

2

23 12

pmq

L

20 ( )S m t

Page 10: Pulse Code Modulation - Sonoma State University · 3 Next Topic – Pulse Code Modulation Pulse-code modulation (PCM) is used to digitally represent sampled analog signals. It is

10

Second Step – Quantization IV

We want a measure of the quality of received signal (that is, the ratio of the strength of the received signal S0 relative to the strength of the error Nq due to quantization). This is given by the ratio

2 220

22

2

( ) ( )3

3q pp

S m t m tL

N mm

L

Conclusion: To keep the quantization error small relative to the message signal level, use smaller quantization steps .

Page 11: Pulse Code Modulation - Sonoma State University · 3 Next Topic – Pulse Code Modulation Pulse-code modulation (PCM) is used to digitally represent sampled analog signals. It is

11

The Dilemma of Strong Signals versus Weak Signals

Strong Signal Weak Signal

Note different encoding levels on each side.

(a) Linear encoding (b) With non-linear encoding Companding

Page 12: Pulse Code Modulation - Sonoma State University · 3 Next Topic – Pulse Code Modulation Pulse-code modulation (PCM) is used to digitally represent sampled analog signals. It is

12 http://www.slideshare.net/91pratham/unit-ipcmvsh

Use Compression and Expansion → Companding

Restoration Compression

m(t) m(t) m(t) (m)

Page 13: Pulse Code Modulation - Sonoma State University · 3 Next Topic – Pulse Code Modulation Pulse-code modulation (PCM) is used to digitally represent sampled analog signals. It is

13

Companding Laws

A-Law Companding (Europe) -Law Companding (North America)

Lathi & Ding Section 6.2.3 pp. 325-328

1log 1 0 1

log (1 )e

e p p

m my for

m m

10

1 log

11 log 1

1 log

e p p

e

e p p

A m my for

A m m A

AmA my for

A m A m

Input (m/mp) Input (m/mp)

Ou

tpu

t (

y/y m

ax)

Ou

tpu

t (

y/y m

ax)

Page 14: Pulse Code Modulation - Sonoma State University · 3 Next Topic – Pulse Code Modulation Pulse-code modulation (PCM) is used to digitally represent sampled analog signals. It is

14

Flattening of the S/N Ratio Using the -Law

Lathi & Ding Figure 6.18

p. 328

For optimal S/N ratio in North America = 255 is used. An approximately constant S/N ratio is the most desirable.

(8 bits)

0

q

S

N

Relative signal power m2(t) , (dB)

Page 15: Pulse Code Modulation - Sonoma State University · 3 Next Topic – Pulse Code Modulation Pulse-code modulation (PCM) is used to digitally represent sampled analog signals. It is

15

Transmission Bandwidth

In binary PCM, we have a group of n bits corresponding to L levels with n bits. Thus, L = 2n or n = log2(L)

Signal m(t) is band-limited to B Hz which requires 2B samples per second. For 2nB elements of information, we must transfer 2nB bits/second. Thus, the minimum bandwidth BT needed to transmit 2nB bits/second is BT = nB Hz Practically speaking, usually we choose the transmission bandwidth to be a little higher than the minimum bandwidth required.

Page 16: Pulse Code Modulation - Sonoma State University · 3 Next Topic – Pulse Code Modulation Pulse-code modulation (PCM) is used to digitally represent sampled analog signals. It is

16

Example 6.2 (Lathi & Ding, page 329)

Problem: A band-limited signal m(t) of 3 kHz bandwidth is sampled at rate of 33⅓ % higher than the Nyquist rate. The maximum allowable error in the sample amplitude (i.e., the maximum quantization error) is 0.5% of the peak amplitude mp. Assume binary encoding. Find the minimum bandwidth of the channel to transmit the encoded binary signal. Solution: The Nyquist rate is RN = 2 x 3000 Hz = 6000 Hz (samples/second), but the actual rate is 33⅓ % higher, so that is 6000 Hz + (⅓ x 6000) = 8000 Hz. The quantization step is and the maximum quantization error is plus/minus /2. Hence, we can write For binary coding, L, must be a power of two; therefore, knowing that L = 27 = 128 and 28 = 256, we must choose n = 8 to guarantee better than a 0.5% error.

0.5200

2 100

p

p

mm L

L

Page 17: Pulse Code Modulation - Sonoma State University · 3 Next Topic – Pulse Code Modulation Pulse-code modulation (PCM) is used to digitally represent sampled analog signals. It is

17

Example 6.2 Continued (Lathi & Ding, page 329)

Solution (continued): Having chosen n = 8 to guarantee 0.5% error, to find the bandwidth required we note that

Total number of bits per second = 8 bits 8000 Hz

= 64,000 bits/second

C

However, we know we can transmit 2 bits/Hz of bandwidth¶, so it requires a bandwidth BT of BT = C/2 = 32,000 Hz = 32 kHz If 24 such signals are multiplexed on a single line (known as a T1 Line in the Telephone system, then CT1 = 24 x 64 kb/s = 1.536 Mb/s, and the bandwidth is 768 KHz

¶A maximum of 2B independent elements of information per second can be transmitted, error-free, over a noiseless channel of bandwidth B Hz.

Page 18: Pulse Code Modulation - Sonoma State University · 3 Next Topic – Pulse Code Modulation Pulse-code modulation (PCM) is used to digitally represent sampled analog signals. It is

18

Exponential Increase of the Output SNR (S/N ratio)

2

02

2( )3 2

q p

nS m t

N m

220

2

( )3

q p

S m tL

N m

We start with the SNR (signal-to-noise ratio) equation from slide 10 above:

The number of levels L can be expressed as L2 = 22n where n = log2(L) and is The number of bits to generate L levels. The SNR can now be expressed as

Using the expression for bandwidth, BT = nB, then we arrive at Taking the logarithm gives

2

02

2 /( )3 2 T

q p

B BS m t

N m

2

0 010 10 2

( )10 log 10log 3 2 log 10 2 6 dB

q q pdB

S S m tn n

N N m

Page 19: Pulse Code Modulation - Sonoma State University · 3 Next Topic – Pulse Code Modulation Pulse-code modulation (PCM) is used to digitally represent sampled analog signals. It is

19

SNR Example

Given a full sinusoidal modulating signal m(t) of amplitude Am into a load resistance R = 1 ohm, find the signal-to-quantization noise ratio (sometimes called SNR):

Setting mmax = Am

2

maxand set2m

ave m

AP m A

20

2 2max

2 2 2( ) 3 33 (2) (2) (2)

2ave

q p

n n nS m t P

N m m

01010log 1.76 6 dB

q

Sn

N

L n SNR

32 5 31.8 dB

64 6 37.8 dB

128 7 43.8 dB

256 8 49.8 dB

Page 20: Pulse Code Modulation - Sonoma State University · 3 Next Topic – Pulse Code Modulation Pulse-code modulation (PCM) is used to digitally represent sampled analog signals. It is

20

Bell System’s T1 Carrier System (1962)

The T-carrier is a member of the group of carrier systems developed by AT&T Bell Laboratories for digital transmission of multiplexed telephone calls using Pulse Code Modulation and Time Division Multiplexing. The first version, the Transmission System 1 (T1), was introduced in 1962 in the Bell System, and could transmit up to 24 telephone calls simultaneously over a single transmission line consisting of copper wire.

1.544 Mbit/s data rates

193 bit frame – 122 sec/frame

Page 21: Pulse Code Modulation - Sonoma State University · 3 Next Topic – Pulse Code Modulation Pulse-code modulation (PCM) is used to digitally represent sampled analog signals. It is

21

T1 Carrier – Time Division Multiplexing

Lathi & Ding Figure 6.20

p. 333

Page 22: Pulse Code Modulation - Sonoma State University · 3 Next Topic – Pulse Code Modulation Pulse-code modulation (PCM) is used to digitally represent sampled analog signals. It is

22

Comparison of T-Carrier (North America) and E-Carrier (Europe)

Carrier Level T-Carrier Data Rates E-Carrier Data Rates

Zero-level 64 kbits/s (DS-0)

64 kbits/s

First-level 1.544 Mbits/s (DS-1)

T1 – 24 channels

2.048 Mbits/s (E1) 32 user channels

Second-level 6.312 Mbits/s (DS-2)

T2 – 96 channels

8.448 Mbits/s (E2) 128 channels

Third-level 44.736 Mbits/s (DS3)

T3 – 672 channels

34.368 Mbits/s (E3) 512 channels

Fourth-level 274.176 Mbits/s (DS4)

T4 – 4032 channels

139.264 Mbits/s (E4) 2048 channels

Fifth-level 400.352 Mbits/s (DS5)

T5 – 5760 channels

565.148 Mbits/s (E5) 8192 channels

Page 23: Pulse Code Modulation - Sonoma State University · 3 Next Topic – Pulse Code Modulation Pulse-code modulation (PCM) is used to digitally represent sampled analog signals. It is

23

Worked PCM Example

We are given a signal m(t) = 2cos(2250 t) as the signal input.

(a) Find the SNR with 8-bit PCM.

For 8-bit encoding, L = 2n where n = 8, therefore, the number of levels = 256. The amplitude Am of the sinusoidal waveform means that mp = 2 volts. The total signal swing possible (- mp to + mp) will be 2mp = 4 volts, therefore, the average signal power is Pave = [(Am)2/2] = [22/2] = 2 watts. (See slide 19)

The interval = [2mp/L] = 4 volts/256 levels = 1.625 10-2 volt. (See slide 19)

Now we can find the SNR (signal-to-quantized noise ratio) (See side 18) Using for the quantization noise Nq = [()2/12], and taking Pave = 2 W, the SNR is given by

22 2

10

2 2412 98,304

(1.5625 10 )

10 log 98,304 49.93 dB

ave

q q

dB

PS

N N

SNR

Page 24: Pulse Code Modulation - Sonoma State University · 3 Next Topic – Pulse Code Modulation Pulse-code modulation (PCM) is used to digitally represent sampled analog signals. It is

24

Worked Example for PCM (continued)

We are given a signal m(t) = 2cos(2250 t) as the signal input.

(b) If the minimum SNR is to be at least 36 dB, how many bits n are needed to encode the signal (i.e., find n)? Other parameters such as signal power remain the same as in part (a) on previous slide.

Note that 36 dB is numerically equivalent to 3,981 [about 4,000]. Remembering that the interval is = [2mp /L] and 2mp = 4 volts. Therefore, we can determine the number of levels L, and then n. The lowest integer number of bits n that will give at least 31.5 levels is n = 5 because 25 = 32 levels. So the answer is 5 bits.

2

2 2

2 4 43,981 ; 0.001005 and 0.0317 volt

3981

pm

2 431.5

0.0317

pmL

Page 25: Pulse Code Modulation - Sonoma State University · 3 Next Topic – Pulse Code Modulation Pulse-code modulation (PCM) is used to digitally represent sampled analog signals. It is

25

Differential Pulse Code Modulation (DPCM)

PCM is not really efficient because it generates so many bits taking up a lot of bandwidth. Can we improve on this? YES. Suppose we have a slowly varying signal m(t), then we exploit this by using the difference in two adjacent samples. This will form the basis of differential pulse code modulation (DPCM). Let m[k] be the kth sample of signal m(t). Then we can express the difference between adjacent samples as d[k] = m[k] – m[k-1] Instead of transmitting m[k], we instead transmit d[k].

Lathi & Ding, Section 6.5, pp. 341-344

Page 26: Pulse Code Modulation - Sonoma State University · 3 Next Topic – Pulse Code Modulation Pulse-code modulation (PCM) is used to digitally represent sampled analog signals. It is

26

Differential Pulse Code Modulation (continued)

At the receiver knowing d[k] and the previous value of m[k-1] allows us to construct the value of m[k].

How do we benefit from doing this?

The difference of successive samples almost always is much smaller than the full range of the sample values of m(t) (full range covers -mp to +mp). We use this fact to improve upon the efficiency of PCM by requiring fewer bits.

In addition, we make use of the estimate of m[k], denoted by m[k]. We use previous sample values of m(t) to make this estimate. Suppose m[k] is the estimate of the kth sample, then the difference d[k] is given by d[k] = m[k] – m[k] and it is the difference d[k] that is transmitted.

Lathi & Ding, Section 6.5, pp. 341-344

Page 27: Pulse Code Modulation - Sonoma State University · 3 Next Topic – Pulse Code Modulation Pulse-code modulation (PCM) is used to digitally represent sampled analog signals. It is

27

Differential Pulse Code Modulation (continued)

Receiver Concept:

At the receiver we determine the estimate m[k] from previous sample values, and then generate m[k] by adding the received d[k] values to the estimate m[k]. Thus the reconstruction of the samples is done iteratively.

Lathi & Ding, Section 6.5, pp. 341-344

Page 28: Pulse Code Modulation - Sonoma State University · 3 Next Topic – Pulse Code Modulation Pulse-code modulation (PCM) is used to digitally represent sampled analog signals. It is

28

Digression on Signal Prediction

Starting with a Taylor series (time step is Ts),

2 2 3 3

2 3

( ) ( ( ) ( ( )[ ] ( ) ...

2! 3!( )

[ ] ( ) for small

S SS S

S S S

dm t T d m t T d m tm t T m t T

dt dt dtdm t

m t T m t T Tdt

We denote the kth sample of m(t) by m[k], that is, m[kTS] = m[k], and m[kTS TS] = m[k 1], and so on. This is a first-order predictor.

In handling the derivatives, we write Thus, So we get an approximation of the (k+1)th sample, m[k+1], from the two prior samples.

( ) ( )

( ) S S SS

S

m kT m kT Tdm kT

dt T

[ ] [ 1][ 1] [ ]

[ 1] 2 [ ] [ 1]

S

S

m k m km k m k T

T

m k m k m k

Page 29: Pulse Code Modulation - Sonoma State University · 3 Next Topic – Pulse Code Modulation Pulse-code modulation (PCM) is used to digitally represent sampled analog signals. It is

29

Signal Prediction (continued)

But we can do better than this. In general, The set of {ai} are the prediction coefficients. This is the predicted value of m[k]. It is an Nth order predictor. Note that the input consists of the weighted previous samples m[k-1], m[k-2],etc. We say that input m[k] gives output m[k]. For first-order prediction, m[k] = m[k-1]. The next slide shows how to implement this prediction of m[k].

1 2[ ] [ 1] [ 2] . . . [ ] [ ]Nm k a m k a m k a m k N m k

Page 30: Pulse Code Modulation - Sonoma State University · 3 Next Topic – Pulse Code Modulation Pulse-code modulation (PCM) is used to digitally represent sampled analog signals. It is

30

Linear Predictor Implemented With Transversal Filter

Lathi & Ding Figure 6.27

p. 343

Delay TS

Delay TS

Delay TS

a1

Input m[k]

a2 a3

Delay TS

. . . Delay TS

aN

Output m[k]

Transversal filter is a tapped delay line (with required weights {ai} )

1 2[ ] [ 1] [ 2] . . . [ ]Nm k a m k a m k a m k N

Page 31: Pulse Code Modulation - Sonoma State University · 3 Next Topic – Pulse Code Modulation Pulse-code modulation (PCM) is used to digitally represent sampled analog signals. It is

31

DPCM Transmitter

[ ] [ ] [ ] and is quantized to yield,

[ ] [ ] [ ] where [ ] is the quantization error

q

q

d k m k m k

d k d k q k q k

The predictor output m[k] is fed back to the input so the predictor input mq[k] is given by

[ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ]q q q qm k m k d k m k d k d k m k q k

This shows that mq[k] is the quantized version of m[k].

Lathi & Ding Figure 6.28(a)

p. 344

Quantizer

Predictor

Input m[k]

mq[k]

+

+

+

mq[k]

d[k] Output

dq[k]

Page 32: Pulse Code Modulation - Sonoma State University · 3 Next Topic – Pulse Code Modulation Pulse-code modulation (PCM) is used to digitally represent sampled analog signals. It is

32

DPCM Receiver

Predictor

Input dq[k]

+

mq[k]

Output mq[k]

+ Lathi & Ding Figure 6.28(a)

p. 344

The receiver’s output (which is the predictor’s input) is also the same, mq[k] = m[k] + q[k]. Hence, we are able to receive the desired signal m[k] plus the quantization noise, q[k]. It is important to note that from the difference signal d[k] is much smaller that the noise associated with m[k].

Page 33: Pulse Code Modulation - Sonoma State University · 3 Next Topic – Pulse Code Modulation Pulse-code modulation (PCM) is used to digitally represent sampled analog signals. It is

33

DPCM SNR Improvement

How much better is DPCM with regard to SNR? To determine this, define mp and dp as the peak amplitudes of m(t) and d(t), respectively. Assuming the same number of steps L for both, then the quantization step in DPCM is reduced in magnitude by dp/mp. The quantization noise is proportional to ()2 – the quantization noise power is reduced by a factor (dp/mp)2 and the SNR is therefore increased by (mp/dp)2. Maintaining the same SNR, the number of bits can be reduced.

Example: The AT&T telephone system sometimes operates at 32 kbits/s (or even 24 kbits/s) when using DPCM. [The telephone system was initially designed to use a 64 kbits/s data rate.]

Page 34: Pulse Code Modulation - Sonoma State University · 3 Next Topic – Pulse Code Modulation Pulse-code modulation (PCM) is used to digitally represent sampled analog signals. It is

34

Adaptive Differential PCM

Adaptive differential PCM (ADPCM) can further improve upon DPCM by Incorporating an adaptive quantizer (variable ) at encoding.

The quantized prediction error dq[k] is a good measure of the predicted error size – it can be used to change which minimizes dq[k]. When dq[k] fluctuates around large positive or negative values, the prediction error is large and needs to increase, but when dq[k] fluctuates around zero (small values), then needs to decrease.

Example: An 8-bit PCM sequence can be encoded into a 4-bit ADPCM sequence at the same sampling rate. This reduces the channel bandwidth by one-half with no loss in quality.

Adaptive Quantizer

nth order Predictor

+

m[k]

To Channel

dq[k]

Page 35: Pulse Code Modulation - Sonoma State University · 3 Next Topic – Pulse Code Modulation Pulse-code modulation (PCM) is used to digitally represent sampled analog signals. It is

35

Adaptive Differential PCM Output Example

time

Page 36: Pulse Code Modulation - Sonoma State University · 3 Next Topic – Pulse Code Modulation Pulse-code modulation (PCM) is used to digitally represent sampled analog signals. It is

36

Next Topic is Delta Modulation