Presentation is loading. Please wait.

Presentation is loading. Please wait.

19 Nov'08Comp30291 Sectn 61 UNIVERSITY of MANCHESTER School of Computer Science Comp30291 : Digital Media Processing Section 6 Sampling & Reconstruction.

Similar presentations


Presentation on theme: "19 Nov'08Comp30291 Sectn 61 UNIVERSITY of MANCHESTER School of Computer Science Comp30291 : Digital Media Processing Section 6 Sampling & Reconstruction."— Presentation transcript:

1 19 Nov'08Comp30291 Sectn 61 UNIVERSITY of MANCHESTER School of Computer Science Comp30291 : Digital Media Processing Section 6 Sampling & Reconstruction

2 19 Nov'08Comp30291 Sectn 62 This section concerns the sampling & digitisation of analogue signals. The signals may then be processed digitally and/or transmitted in digital form. Resulting digital signals often need to be converted back to analogue form or “reconstructed”. Reconstruction is also considered in this section. Introduction

3 19 Nov'08Comp30291 Sectn 63 An analogue signal & its magnitude spectrum. t x a (t)  |X a (j  )|

4 19 Nov'08Comp30291 Sectn 64 Sampling an analogue signal Measure x a (t) at intervals T to obtain {x[n]}: {..., x[-1], x[0], x[1], x[2], x[3],... } t x a (t) T 2T 3T 4T 5T-T -3T -2T x[1] x[2] x[-1] x[-2] x[5] X[0] x[3] x[-3] x[1] = x a (T), x[2] = x a (2T), etc.

5 19 Nov'08Comp30291 Sectn 65 x S (t) t T 2T 3T 4T 5T -T -3T-2T x a (T ) x a (2T) x a (-T) x a (-2T) x a (4T) Measure x a (t) at 0,  T,  2T,... & represent by analogue impulses. Invent a new signal x S (t) = sample T {x a (t)}

6 19 Nov'08Comp30291 Sectn 66 Analogue ‘unit impulse’ 1 1 1/2 2 1/4 4 3 5 1/8 Voltage pulse of strength 1  1=1 Pulse of strength 2  0.5=1 More pulses of strength 1 As width  0, & height   with strength remaining at 1 we get ‘unit impulse’ 1 Volts t

7 19 Nov'08Comp30291 Sectn 67 Analogue ‘impulse’ of strength A 1 1 1/2 2 1/4 4 3 5 Voltage pulse of strength 1  A=A Narrower pulse of strength 2A  0.5=A Even narrower pulse of strength A As width  0, & height   with strength remaining at A we get impulse of strength A A Volts t A

8 19 Nov'08Comp30291 Sectn 68 DTFT of {x[n]} It may be shown that: DTFT of {x[n]} = Fourier transform of x S (t) i.e. X(e j  ) = X S (j  ) = with  =  T. But how is X(e j  ) related to the Fourier transform of x a (t)?

9 19 Nov'08Comp30291 Sectn 69 THE SAMPLING THEOREM : FT of sample T {x a (t)} is (1/T)repeat 2  /T {X a (j  )}  x S (t) X S (j  ) 'sample T {x a (t)}' already defined 'repeat 2  /T {X a (j  )}' means (loosely speaking) X a (j  ) repeated at frequency intervals of 2  /T.   /T -  /T 2  /T 4  /T -4  /T -2  /T |X S (j  )| (1/T)X a (j  )

10 19 Nov'08Comp30291 Sectn 610 By the Sampling Theorem :  /T -  /T |X a (j  )|  Spectrum of x a (t):   /T -  /T 2  /T 4  /T -4  /T -2  /T |X S (j  )| (1/T)X a (j  ) Effect of sampling at 1/T Hz:

11 19 Nov'08Comp30291 Sectn 611 Remember: Sample in time-domain  repeat in frequency-domain sample T {x a (t)} -> (1/T)repeat 2  /T {X a (j  )} ( 2  /T is the sampling frequency in radians/second)

12 19 Nov'08Comp30291 Sectn 612 Precise definition of ‘repeat’ function repeat 2  /T {X a (j  )} is sum of identical copies of X a (j  ) each shifted in frequency by a multiple of  2  /T

13 19 Nov'08Comp30291 Sectn 613 By this precise definition :   /T -  /T |X a (j  )|  Given a spectrum  /T -  /T 2  /T 4  /T -4  /T -2  /T |X S (j  )| X a (j  ) |REPEAT 2  /T {X a (j  )}|

14 19 Nov'08Comp30291 Sectn 614 Applying precise defn to another spectrum :   /T -  /T |X a (j  )|   /T -  /T 2  /T 4  /T -4  /T -2  /T |X S (j  )| |REPEAT 2  /T {X a (j  )}|

15 19 Nov'08Comp30291 Sectn 615 Observation from previous 2 slides In first case, X a (j  ) is bandlimited between  /T or  F S / 2. Red images do not overlap with |X a (j  )| when copies are summed.  DTFT of {x[n]} = X S (j  ) = FT of x a (t) for -  /T     /T i.e for -      In second case, X a (j  ) is not bandlimited between  /T. Red images do overlap & when summed change shape of |X a (j  )|.  DTFT of {x[n]}  FT of x a (t) for -      In 2nd case, ‘aliasing distortion’ has occurred.

16 19 Nov'08Comp30291 Sectn 616 x a (t) bandlimited between  /T rad/s (  f s /2 Hz): |X|X(j  )|  a   Spectrum of x S (t): |Xs(j  )|    Further illustration (no aliasing) |(1/T)X a (j  )|

17 19 Nov'08Comp30291 Sectn 617 If X a (j  ) not bandlimited to  /T, overlap occurs |Xa(j  )|    |Xs(j  )|      Further illustration of aliasing

18 19 Nov'08Comp30291 Sectn 618    X a (j  )  !  X S (j  )= X(e j  ) t t {…, 3, -2, -2, 1, 1, -1, … }x a (t)x S (t) {x[n]} =     /T-  /T  /T -  /T  -- DTFT of {x[n]} related to X a (j  ) when no aliasing  1/T

19 19 Nov'08Comp30291 Sectn 619 Nyquist sampling criterion If there is no aliasing, original spectrum is seen between  F S /2. Can filter off the red images & get back the orig spectrum. No information is lost despite the sampling process. To avoid aliasing, low-pass filter x a (t) to band-limit to  F S /2. Sampling process then satisfies “Nyquist sampling criterion”.

20 19 Nov'08Comp30291 Sectn 620 Example to illustrate aliasing x a (t) has sinusoidal component at 7 kHz: It is sampled at 10 kHz without an antialiasing filter. Does it satisfy Nyquist sampling criteria? What happens to the sinusoid?

21 19 Nov'08Comp30291 Sectn 621 Solution to example on previous slide It becomes 3 kHz (10-7) sine-wave & distorts signal. |X S (j2  f)| 5 k - --10 k f

22 19 Nov'08Comp30291 Sectn 622 Assume x a (t) has spectrum below & is sampled at f S = 2  /T to obtain {x[n]}: How can we obtain x a (t) exactly from {x[n]} ? |X a (j  )|    Reconstruction of x a (t) from {x[n]}

23 19 Nov'08Comp30291 Sectn 623 Ideal reconstruction (with impulses) Firstly reconstruct: x S (t) = sample T {x a (t)} by making each sample of {x[n]} the strength of an impulse:

24 19 Nov'08Comp30291 Sectn 624 |X S (j  )|     Spectrum of x S (t) is (1/T)repeat{Xa(j  )} |(1/T)X a (j  )|     if we use an ideal lowpass filter to remove everything outside  /T we get: Image (ghost) Image (ghost)

25 19 Nov'08Comp30291 Sectn 625 Ideal reconstruction In theory, to obtain x a (t) exactly from {x[n]}: 1) Construct x S (t) with ideal impulses. 2) Ideal low-pass filter with cut-off  /T to remove images. 3) Multiply by T. In practice cannot have ideal impulses, or an ideal low-pass filter. Each impulse approximated by pulse of finite voltage & non-zero duration:

26 19 Nov'08Comp30291 Sectn 626 ‘Sample & hold’ (S/H) reconstruction Produce a voltage  x[n] at t = nT Hold this fixed until next sample at t = (n+1)T. Produces a “staircase waveform” x P (t) say. t x P (t) T 2T 3T t x S (t) 4 6 9 5 4/T 6/T 9/T 5/T

27 19 Nov'08Comp30291 Sectn 627 Standard ADC produces x P (t) instead of x S (t) x P (t) T 2T 3T 4/T 6/T 9/T 5/T {..., 4, 6, 9, 5, 3,.... } t ADC 3/T x P (t) will be scaled.

28 19 Nov'08Comp30291 Sectn 628 Effect of S/H approximation Energy spectral density falls off slightly as frequency increases. Loss of ESD  4 dB as    /T. Like turning down the ‘treble’ in a tone control. Not too serious, & can be compensated for. e.g. include‘treble boost’ in digital signal before reconstruction.

29 19 Nov'08Comp30291 Sectn 629 Example: Why must analogue signals be low-pass filtered before they are sampled? If {x[n]} is obtained by sampling x a (t) at intervals of T, the DTFT X(e j  ) of {x[n]} is (1/T)repeat 2  /T {X a (j  )}. This is equal to the FT of x S (t) = sample T (x a (t)) If x a (t) is bandlimited between  /T then Xa(j  ) =0 for |  | >  /T. It follows that X(e j  ) = (1/T)X a (j  ) with  =  T. No overlap. We can reconstruct x a (t) perfectly by producing the series of weighted impulses x S (t) & low-pass filtering. No informatn is lost. In practice using pulses instead of impulses give good approximatn.. Where x a (t) is not bandlimited between  /T then overlap occurs & X S (j  ) will not be identical to X a (j  ) in the frequency range  fs/2 Hz. Lowpass filtering x S (t) produces a distorted (aliased) version of x a (t). So before sampling we must lowpass filter xa(t) to make sure that it is bandlimited to  /T i.e. f S /2 Hz

30 19 Nov'08Comp30291 Sectn 630 Quantisation Conversion of samples of x a (t) to binary numbers produces a digital signal. Must approximate to nearest quantisation level:- 0 0 0 0 0 1 0 1 0 0 1 1 1 0 0 1 0 1 1 1 0 11 1 V      

31 19 Nov'08Comp30291 Sectn 631 ‘m-bit’ uniform ADC has 2 m levels,  volts apart. Rounding true samples {x[n]} produces: Quantisation error (noise) (Quantised) = (True) + (Error) Normally e[n] lies between -  /2 & +  /2 Ideal reconstruction from quantised {x[n]} will produce: x a (t) + e a (t) Instead of x a (t), where e a (t) arises from {e[n]}.

32 19 Nov'08Comp30291 Sectn 632 Assumptions about {e[n]} & e a (t) i) Samples of {e[n]} random & uniformly distributed between  /2. ii) Power spectral density of e a (t) evenly spread over range  Fs/2 Hz.

33 19 Nov'08Comp30291 Sectn 633 Probability density of e[n] e[n]     Power spectral density of e a (t)  

34 19 Nov'08Comp30291 Sectn 634 It may be be shown that power of e a (t) is  2 / 12 (quantisation noise power in watts) Power of a signal is loudness if it is when converted to sound. Strict definition: power produced when signal is applied as a voltage to a 1 Ohm resistor. For constant voltage V, power = V 2 /R = V 2 watts. For sinusoid of amplitude A, power = A 2 /2 watts.

35 19 Nov'08Comp30291 Sectn 635 Signal to quantisation noise ratio (SQNR) To maximise SQNR, signal must be large enough to use all quantisation levels without overflow. Amplification required before A/D conversion.

36 19 Nov'08Comp30291 Sectn 636 SQNR for sinusoid Given m-bit ADC with step-size . Maximum sine-wave amplitude is 2 m-1 . Power of A sin(  t) : A 2 /2.  maximum possible SQNR is: = 1.8 + 6m dB. ( i.e. approx 6 dB per bit) Formula often assumed for signals which are approx. sinusoidal.

37 19 Nov'08Comp30291 Sectn 637 Example (a) How many bits are required to achieve a SQNR of 60 dB with sinusoids amplified to occupy full range of uniformly quantising A/D converter? (b) What SQNR is achievable with a 16-bit uniformly quantising A/D converter applied to sinusoidally shaped signals? Solution: (a) About ten bits. (b) 97.8 dB.

38 19 Nov'08Comp30291 Sectn 638 Block diag of DSP system for processing analogue sound

39 19 Nov'08Comp30291 Sectn 639 Antialiasing LPF: Analogue lowpass filter, cut-off < F S /2 to remove any spectral energy which would be aliased into signal band. Analogue S/H: Holds input steady for ADC. A/D conv: Converts voltages to binary numbers of specified word-length. Quantisation error incurred. Samples taken at F S Hz. Digital processor: Controls S/H & ADC to determine F S Reads samples from ADC, processes them & outputs to DAC. D/A conv: Converts binary numbers to analogue voltages. Stair-case waveforms normally produced. S/H compensation: Compensates S/H reconstruction loss of up to 4 dB by boosting spectrum as it approaches F S /2. Reconstruction LPF: Removes images of  Fs/2 band produced by S/H reconstruction.

40 19 Nov'08Comp30291 Sectn 640 Choice of sampling rate (F S ) To process x a (t) band-limited to  F with F = 20kHz. In theory, we could choose F S = 2F Hz. e.g. 40 kHz. There are two related problems with this choice. (1) Need very sharp analogue input anti-aliasing filter to remove everything above F Hz. (2) Need very sharp analogue reconstruction filter to eliminate images (ghosts)

41 19 Nov'08Comp30291 Sectn 641 |Xs(j2  f)| Hz - F 2F F REMOVE Fs/2 -Fs/2 f Signal bandwidth is F, sampled at F S = 2F. Clearly a very sharp analog filter is needed to remove the ‘images’ (ghosts) created by the sampling process. Reconstruction filter requirement when F S =2F

42 19 Nov'08Comp30291 Sectn 642 ‘Slightly’ increasing the sampling rate Assume signal bandwidth remains at  F =  20kHz, but instead of sampling at F S = 40 kHz we ‘slightly over-sample’ at 44.1kHz. To avoid input aliasing, must filter out all above F S /2 = 22.05 kHz. Without affecting the music within  20kHz. We have a ‘guard-band’ from 20 to 22.05 kHz to allow the filter’s gain response to ‘roll off’ gradually. So filter need not be ‘brick-wall’. It may be argued that guardband is 4.1kHz as spectrum between 22.05 & 24.1kHz get aliased to 20-22.05kHz, i.e. above 20kHz

43 19 Nov'08Comp30291 Sectn 643 Effect of slightly over-sampling on reconstruction filter requirement: F S = 44.1 kHz when F=20 kHz. Images start at  24.1 kHz so filtering requirement relaxed slightly. |Xs(j2  f)| Hz - F 2F F REMOVE F S /2 -F S /2 f

44 19 Nov'08Comp30291 Sectn 644 Higher degrees of over-sampling: With signal band-width still at  F Hz, now sample at 4F Hz. Anti-aliasing input filter now needs to filter out only components beyond  3F without distorting signal in  F band. Reconstruction simplified as images start at  3F. Images easier to remove without affecting signal in frequency range  F.

45 19 Nov'08Comp30291 Sectn 645 Reconstruction filter requirement when F S = 4F |X S (2  jf)| Hz -F 2F F REMOVE F S /2 -F S /2 -2F 4F - 3F f f S =4F

46 19 Nov'08Comp30291 Sectn 646 f f S /2 8F f S =8F 4F -8F Reconstruction filter requirement when F S = 8F Filtering task to remove red images is even easier

47 19 Nov'08Comp30291 Sectn 647 f F S /2 8F F S =12F 4F -8F 12F -12F -4F Easier still when sampling rate increased to 12F Hz

48 19 Nov'08Comp30291 Sectn 648 Consider effect of increasing F S = from 2F to 4F. As  & m remain unchanged, SQNR not affected. But quantisation noise power is evenly distributed in frequency range  F S /2. Same quantisation noise power now more thinly spread in frequency range  2F Hz rather than  F Hz. Effect of increasing sampling rate on SQNR

49 19 Nov'08Comp30291 Sectn 649 Same quantisatn noise power, more thinly spread Power spectral density of quantistn noise F - F f F S = 2F Power spectral density of quantisatn noise F - F f 2F - F S = 4 F

50 19 Nov'08Comp30291 Sectn 650 Quantisation noise power unchanged, but bandwidth increased. Signal bandwidth does not change, So keep analogue filter pass-band at  F, not  F S /2. Assuming quantisation noise evenly spread, this will remove half the noise power. Adds 3 dB to the SQNR. Effect of doubling F S from 2F to 4F

51 19 Nov'08Comp30291 Sectn 651 Advantages of over-sampling: Simpler analog antialiasing & reconstruction filters. Reduction in SQNR of 3dB per doubling of F S. Reduces S/H reconstructn roll-off effect. Disadvantages: Increases no. of bits per second (ADC word-length x f S ), Increases cost of processing, storage/transmission Faster ADC needed.

52 19 Nov'08Comp30291 Sectn 652 Conclusion about over-sampling Over-sampling simplifies analogue electronics, but is less economical with digital processing, storage & transmission resources.

53 19 Nov'08Comp30291 Sectn 653 Digital anti-aliasing & reconstruction filters Can get the best of both worlds. Sample at higher rate, 4F say, with analogue filter to remove components beyond  3F. Digital filter to remove components beyond  F. Down-sample (decimate) to reduce F S to 2F. Simply omit alternate samples. To reconstruct: Up-sample by placing zeros between each sample: e.g. { …, 1, 2, 3, 4, …} with F S = 10 kHz becomes {…, 1, 0, 2, 0, 3, 0, 4, 0, …} at 20 kHz. Creates images (ghosts) in the digital signal. Removed by digital filter. Then reconstruct as normal but at higher F S.

54 19 Nov'08Comp30291 Sectn 654 Down-sampling (decimation) & up-sampling Assume a signal has been sampled at Fs Hz. To reduce the sampling rate to Fs/N where N is an integer: Digitally low-pass filter to remove all components above Fs/(2N). Then it is safe to sample at Fs/N rather than Fs. Down-sample by omitting N-1 samples out of every N. Assume another signal has been sampled at Fs Hz. We wish to up-sample to a new sampling rate Fs' = N × Fs. Insert N zero valued samples between each sample. Creates ‘images’ at frequencies above Fs/2 Hz. Digitally low-pass filter to remove all components above Fs/2 = Fs' /(2N) Hz.

55 19 Nov'08Comp30291 Sectn 655 CD format: 20 kHz bandwidth music sampled at 44.1 kHz 16 bits/channel uniform quantisation (normally stereo). Music stored at 44100 x 32=1.4112Mbytes/s (with FEC) Recording studio will over-sample & use simple input filter. Apply digital antialiasing filter to band-limit to  20 kHz Down-sample to 44.1 kHz for storing on CD. Player reads samples from CD at 44.1 kHz & up-samples to 88.2, 176.4 kHz or higher by inserting zeros. Creates images which are removed by digital filtering. Now have 20 kHz bandwidth music sampled at 88.2, 176.4 kHz or higher. Apply to DAC. Simple analog reconstruction filter is now used.

56 19 Nov'08Comp30291 Sectn 656 Bit-stream (delta-sigma) DAC: Used in many CD & MP3 players Up-sample to such a degree (256) that a one bit DAC is all that is required. Produces high quantisation noise, but very thinly spread in frequency-domain. Most of it filtered off by very simple analogue filter. 256 times over-sampling gain only 3 x 8 dB.  some more tricks needed: noise-shaping.

57 19 Nov'08Comp30291 Sectn 657 Example A DSP system for processing sinusoidal signals in the range 0 Hz to 4 kHz samples at 20 kHz with an 8-bit ADC. If the input signal is always amplified to use the full dynamic range of the ADC, estimate the SQNR in the range 0 to 4 kHz. How would the SQNR be affected by decreasing F S to 10 kHz and replacing the 8-bit ADC by a 10-bit device? Are there any disadvantages in doing this?


Download ppt "19 Nov'08Comp30291 Sectn 61 UNIVERSITY of MANCHESTER School of Computer Science Comp30291 : Digital Media Processing Section 6 Sampling & Reconstruction."

Similar presentations


Ads by Google