89
Eeng 360 1 Illustration of the Quantization Error

quantization

Embed Size (px)

Citation preview

Page 1: quantization

Eeng 360 1

Illustration of the Quantization Error

Page 2: quantization

Eeng 360 2

Uniform Quantization• Most ADC’s use uniform

quantizers.• The quantization levels of a

uniform quantizer are equally spaced apart.

• Uniform quantizers are optimal when the input distribution is uniform. When all values within the Dynamic Range of the quantizer are equally likely.

Input sample X

Example: Uniform =3 bit quantizer

q=8 and XQ = {1,3,5,7}

2 4 6 8

1

5

3

Output sampleXQ

-2-4-6-8

Dynamic Range:

(-8, 8)

7

-7

-3

-5

-1

Quantization Characteristic

Page 3: quantization

Eeng 360 3

Quantization Example

Analogue signal

Sampling TIMING

Quantization levels. Quantized to 5-levels

Quantization levelsQuantized 10-levels

Page 4: quantization

Eeng 360 4

PCM encoding example

Chart 1. Quantization and digitalization of a signal.

Signal is quantized in 11 time points & 8 quantization segments.

Chart 2. Process of restoring a signal.PCM encoded signal in binary form:101 111 110 001 010 100 111 100 011 010 101Total of 33 bits were used to encode a signal

Table: Quantization levels with belonging code words

Levels are encoded using this table

M=8

Page 5: quantization

Eeng 360 5

Encoding• The output of the quantizer is one of M possible signal levels.– If we want to use a binary transmission system, then we need to map

each quantized sample into an n bit binary word.

• Encoding is the process of representing each quantized sample by an bit code word.– The mapping is one-to-one so there is no distortion introduced by

encoding.– Some mappings are better than others.

• A Gray code gives the best end-to-end performance.• The weakness of Gray codes is poor performance when the sign bit

(MSB) is received in error.

22 , log ( )nM n M

Page 6: quantization

Eeng 360 6

Gray Codes

• With gray codes adjacent samples differ only in one bit position.• Example (3 bit quantization):

XQ Natural coding Gray Coding +7 111 110 +5 110 111 +3 101 101 +1 100 100 -1 011 000 -3 010 001 -5 001 011 -7 000 010

• With this gray code, a single bit error will result in an amplitude error of only 2.– Unless the MSB is in error.

Page 7: quantization

Eeng 360 7

Waveforms in a PCM system for M=8

M=8

(d) PCM Signal

(c) Error Signal

(b) Analog Signal, PAM Signal, Quantized PAM Signal

(a) Quantizer Input output characteristics

22 log ( )

is the number of Quantization levels

is the number of bits per sample

nM n M

M

n

Page 8: quantization

Quantization

• Analog source has infinite levels• In order to process the source output digitally, the

source have to be quantized to a finite number of levels– Reduce number of bits to a finite number– Introduce some distortion– Quantization error can be modeled as White process– The information lost in the quantization process can never

be recovered

Page 9: quantization

Classification of quantization

• Scalar Quantization– Each source output is quantized individually– Further Divided into

• Uniform quantization– Equal quantization region

• Nonuniform quantization– Various length quantization region

• Vector quantization– Blocks of source output are quantized

Page 10: quantization

Scalar Quantization

• ( )i i ix Q x x

1

2

3

N

1x

2x

3x

Nx

x Q(x)

Quantization Error

ix x

Page 11: quantization

Signal-to-Quantization-Noise Ratio

• Mean-Square Quantization Error– – Where fx(x) denotes pdf(probability density

function) of the source random variables• SQNR(Signal-to-Quantization-Noise Ratio)

2

1

( ) ( )i

N

i Xi

D x x f x dx

2

10

[ ]10log

dB

E XSQNR

D

Page 12: quantization

Uniform Quantization

• Equal quantization range

1 ( ~ ]a

2 ( , ]a a

3 ( , 2 ]a a

( ( 2) , )N a N

1x

2x

3x

Nx

a

Page 13: quantization

Uniform Quantization

• Optimal Quantization Level– The Centroid of the interval (Center of mass)

• Design of the uniform quantizer is equivalent to determining a and – Then we can easily calculate SQNR

• If X has uniform distribution– Then Quantization level = midpoints of quantization range

(a + (i-2) + /2)

( )[ | ]

( )i

i

X

i i

X

xf x dxx E X X

f x dx

Page 14: quantization

Uniform Quantization

• Symmetric pdf with even N (N=6)– Uniform Vs. Gaussian

a+4

a+3

a+2

a+

a

-x

=0

6x

5x

4x

3x

2x

1x

a+4

a+3

a+2

a+

a

-x

=0

6x

5x

4x

3x

2x

1x

Center is givenOnly one

parameter is chosen to

minimize distortion

Page 15: quantization

Nonuniform Quantization

• Uniform Vs. Nonuniform

a+3

a+2

a+

a

-

x

4x

3x

2x

1x

5x

=0

a4

a3

a2

a1

-x

4x

3x

2x

1x

5x

=0

DifferentQuantization

Region

UniformQuantization

Region

Page 16: quantization

Nonuniform Quantization

• Superior than Uniform quantization– Less Distortion– Higher SQNR

• Lloyd-Max Conditions for optimal condition–

– Choose initial quantization level:– Repeat until Minimum distortion

• Calculate quantization region boundary:• Calculate quantization level:

1

1

1( )

,2( )

i

i

i

i

a

Xa i ii ia

Xa

xf x dx x xx a

f x dx

, 1ix i N

, 1ix i N , 1ia i N

Page 17: quantization

Homework

• Illustrative Problem 4.8• Problems

– 4.12

Page 18: quantization

Uniform Quantization

• Symmetric pdf with even N (N=5)– Uniform Vs. Gaussian

a+3

a+2

a+

a

-

x

4x

3x

2x

1x

5x

=0

a+3

a+2

a+

a

-

x

4x

3x

2x

1x

5x

=0

Page 19: quantization

Homework

• Illustrative Problem– 4.4, 4.5, 4.7

• Problems– 4.6, 4.7

Page 20: quantization

20

2. Audio2.1 Human Perception2.2 Audio Bandwidth2.3 Digitization2.4 Audio Compression

2.4.1 Differential PCM2.4.2 Adaptive Differential PCM2.4.3 MP3

Contents

Page 21: quantization

21

• Audio: speech, music or synthesized audio.• Audio signals are analog.• Audio Perception

Sound waves generate air pressure oscillations. Stimulate human auditory system. Transform to neural signals recognizable by the

brain.

2.1 Human Perception

Page 22: quantization

22

• Features of human auditory system:1. Frequency range: Human can listen to

audio signals within the typical frequency range 20 -- 20,000 Hz.

2. Dynamic range: It is the range of the softest to the loudest audio amplitude that human can hear.

Different persons may have different frequency and dynamic ranges.

2.1 Human Perception

Page 23: quantization

23

2.2 Audio Bandwidth

• Period and FrequencyA periodic signal consists of a continuously

repeated waveform pattern. If its period is T, its frequency is:

Example: The following signals are periodic with period T and frequency

Tf

1

Tf

1

Page 24: quantization

24

2.2 Audio Bandwidth

Page 25: quantization

25

• Signal CharacteristicA signal can be decomposed into many sinusoidal signal components such that different components1. have different frequencies and2. may have different amplitudes.

(This decomposition can be done by mathematical techniques called Fourier series and Fourier transform.)

2.2 Audio Bandwidth

Page 26: quantization

26

2.2 Audio Bandwidth

Frequency of 1st component (1st harmonic) = f1 = 1/TFrequency of 2nd component (2nd harmonic)Frequency of 3rd component (3rd harmonic)= 3 f1

= 5 f1

Page 27: quantization

27

2.2 Audio Bandwidth

• Frequency Domain After decomposing a signal into its components, we can analyze the

properties of this signal in the frequency domain.

Example:

It is difficult to visualize the energy content of a signal in the time domain, but it is easy to do so in the frequency domain.

Page 28: quantization

28

2.2 Audio Bandwidth

• BandwidthBandwidth is the range of component frequencies.

Example:

A signal may have infinite number of components. In this case, bandwidth is defined to be the frequency range

over which x% (say, 99%) of the energy of the signal lies.

Page 29: quantization

29

2.2 Audio Bandwidth

• Effect of Limited Bandwidth

If a network does not have sufficient bandwidth to send all the frequency components of a signal

some frequency components are omitted the signal is distorted.

If a network has a larger bandwidth to send more frequency components of an audio signal

the audio signal is relatively less distorted.

Page 30: quantization

30

Page 31: quantization

31

2.3 Digitization

• Digitization: convert an analog audio signal to digital form via sampling and quantization.SamplingSample the magnitude of the audio signal at a certain

rate.

Page 32: quantization

32

2.3 Digitization

Nyquist Theorem: For a signal that has no frequency components higher than x Hz, its analog signal can be completely reproduced from its samples taken at the rate 2× of samples per second.

Illustration of Nyquist sampling rate:

Page 33: quantization

33

2.3 Digitization

Example

Telephone systems transmit voice signal components with at most 4000 Hz. Sampling rate should be 8000 samples/sec.

Page 34: quantization

34

• Quantization

If N bits are used to represent a sample value, there are 2N distinct quantization values.

Each sample value is rounded to the nearest quantization value, so there may be quantization error.

2.3 Digitization

Page 35: quantization

35

2.3 Digitization

If the first sample value is 24.1, it is quantized to 24 (0001 1000), so the quantization error is 0.1.

Page 36: quantization

36

2.3 Digitization

Pulse Code Modulation (PCM) PCM: perform sampling and quantization on audio signals. PCM is used in:

Digital telephone networks: Use a sampling rate of 8000 samples per second and 8 bits per sample, so the data rate is 64 kbps (adopted in ITU-T G.711).

Audio CD: Use a sampling rate of 44100 samples per second and 16 bits per sample, so the data rate for stereo audio is 1.411 Mbps.

Page 37: quantization

37

2.4 Audio Compression

2.4.1 Differential PCM

Differential PCM is a compressed version of PCM. It haslower bit rate but its voice quality may be poorer.

Differential PCMVoice signal changes slowly compared with the sampling rate.

Successive sample values have a small difference.

Use fewer bits to encode the difference between the current sample value and the previous one.

Lower bit rate, but voice quality may be degraded when voice amplitude changes abruptly.

Page 38: quantization

38

2.4 Audio Compression

Example

For PCM in digital telephony, sampling rate is 8000 samples/sec and 8 bits are used for each sample. Data rate is 64 kbps.

If differential PCM is adopted and 6 bits are used to encode the difference between successive sample values, data rate is reduced to 48 kbps.

Page 39: quantization

39

2.4 Audio Compression

2.4.2 Adaptive Differential PCM

Adaptive differential PCM is an improved version of differential PCM.

Main idea: When the voice amplitude changes steeply for a significant duration, change to use a larger quantization step (i.e., a larger difference between successive quantization values)

Page 40: quantization

40

2.4 Audio Compression

Page 41: quantization

41

2.4 Audio Compression

ITU-T G.721 adopts adaptive differential PCM, a sampling rate of 8000 samples per second, and 4 bits for encoding thedifference between successive sample values.

Bit rate is 32 kbps, but voice quality is only slightly worse than that in PCM at 64 kbps.

Page 42: quantization

42

2.4 Audio Compression

2.4.3 MP3

CD audio has a data rate of 1.411 Mbps. Well-known compression method for CD audio: MP3.

MP3: MPEG audio layer 3. (MPEG specifies three audio compression layers.)

MP3 adopts perceptual coding to attain a high compression ratio and provide very good audio quality.

Page 43: quantization

43

2.4 Audio Compression

Perceptual Coding

It is based on the science of psychoacoustics, which studies how people perceive sound.

It exploits certain flaws in the human auditory system for compression, such that the compressed audio sounds about the same to human even though its signal waveform may become quite different.

Page 44: quantization

44

2.4 Audio Compression1st Flaw: Threshold of Audibility

When a frequency component is very weak (i.e., its power is below a threshold), human cannot hear it.

Threshold of audibility (averaged over many people)

Compression: Omit the frequency components whose power falls below the threshold of audibility.

Page 45: quantization

45

2.4 Audio Compression2nd Flaw: Frequency Masking

Some sounds can mask other sounds: a loud sound in one frequency band hides a softer sound in another frequency band.

Masking effect:

Compression: Omit the masked frequency components.

Page 46: quantization

46

2.4 Audio Compression3rd Flaw: Temporal Masking

When a masking sound ends, it takes a short time before hearing the masked sound.

Masking effect:

Compression: If the amplitudes of the masked frequency components are less than the decay envelope, omit these components.

Page 47: quantization

47

2.4 Audio Compression

To use MP3 for compression, we select two options:

Sampling rate: We can sample the waveform at 32 kHz, 44.1 kHz or 48 kHz on one or two channels.

Bit rate: Typically, we choose the bit rate to be 96 kbps, 128 kbps or 160 kbps.

Page 48: quantization

48

2.4 Audio Compression

Main Steps for Compression

Perform sampling on the audio signal. Divide the samples into groups with 1152 samples per group.

Each group is passed through: (i) 32 digital filters to get 32 frequency subbands, and (ii) a psychoacoustic model to determine the masked frequencies.

Based on the available "bit budget" (depending on the chosen bit rate), allocate more bits to the subbands with larger unmasked spectral power.

Finally, use Huffman coding to encode the bits (i.e., assign shorter codewords to numbers that appear frequently).

Page 49: quantization

Example

Page 50: quantization

Networks: Data Encoding 50

Page 51: quantization

Networks: Data Encoding 51

PCMNonlinear Quantization Levels

Page 52: quantization

Networks: Data Encoding 52

Delta Modulation DCC 6th Ed. W.Stallings

Page 53: quantization

Analog Representations of SoundMagnified phonograph grooves, viewed from above:

The shape of the grooves encodes the continuously varying audio signal.

Page 54: quantization

Analog to Digital Recording Chain

ADC

Continuously varying electrical energy is an analog of the sound pressure wave.

Microphone converts acoustic to electrical energy. It’s a transducer.

ADC (Analog to Digital Converter) converts analog to digital electrical signal.Digital signal transmits binary numbers.

DAC (Digital to Analog Converter) converts digital signal in computer to analog for your headphones.

Page 55: quantization

Analog versus Digital

AnalogContinuous signal that mimics shape of acoustic sound pressure wave

DigitalStream of discrete numbers that represent instantaneous amplitudes of analog signal, measured at equally spaced points in time.

Page 56: quantization

Analog to Digital Conversion

Instantaneous amplitudes of continuous analog signal, measured at equally spaced points in time.

A series of “snapshots”

Page 57: quantization

[a.k.a. “sample word length,” “bit depth”]Precision of numbers used for measurement: the more bits, the higher the resolution.

Example: 16 bit

Analog to Digital Overview

Sampling RateHow often analog signal is measured

Sampling Resolution

[samples per second, Hz]Example: 44,100 Hz

Page 58: quantization

Sampling Rate

Nyquist Theorem:

Sampling rate must be at least twice as high as the highest frequency you want to represent.

Determines the highest frequency that you can represent with a digital signal.

Capturing just the crest and trough of a sine wave will represent the wave exactly.

Page 59: quantization

Aliasing

What happens if sampling rate not high enough?

A high frequency signal

sampled at too low a rate

looks like …

… a lower frequency signal.

That’s called aliasing or foldover. An ADC has a low-pass anti-aliasing filter to prevent this.

Synthesis software can cause aliasing.

Page 60: quantization

Common Sampling Rates

Sampling Rate Uses

44.1 kHz (44100) CD, DAT

48 kHz (48000) DAT, DV, DVD-Video

96 kHz (96000) DVD-Audio

22.05 kHz (22050) Old samplers

Most software can handle all these rates.

Which rates can represent the range of frequencies audible by (fresh) ears?

Page 61: quantization

4-bit QuantizationA 4-bit binary number has 24 = 16 values.

0

2

4

6

8

10

12

14

Ampl

itude

A better approximation

Time — measure amp. at each tick of sample clock

Page 62: quantization

Quantization Noise

Round-off error: difference between actual signal and quantization to integer values…

Random errors: sounds like low-amplitude noise

Page 63: quantization

The Digital Audio Stream

It’s just a series of sample numbers, to be interpreted as instantaneous amplitudes: one for every tick of the sample clock.

Previous example:11 13 15 13 10 9 6 1 4 9 15 11 13 9

This is what appears in a sound file, along with a header that indicates the sampling rate, bit depth and other things.

Page 64: quantization

Common Sampling Resolutions

Word length Uses

8-bit integer Low-res web audio

16-bit integer CD, DAT, DV, sound files

24-bit integer DVD-Video, DVD-Audio

32-bit floating point Software (usually only for internal representation)

Page 65: quantization

16-bit Sample Word Length

A 16-bit integer can represent 216, or 65,536, values (amplitude points).

We typically use signed 16-bit integers, and center the 65,536 values around 0.

32,767

-32,768

0

Page 66: quantization

Audio File Size

CD characteristics…- Sampling rate:

44,100 samples per second (44.1 kHz)

How big is a 5-minute CD-quality sound file?

- Sample word length:16 bits (i.e., 2 bytes) per sample

- Number of channels:2 (stereo)

Page 67: quantization

Audio File Size

5 minutes * 60 seconds per minute= 300 seconds

How big is a 5-minute CD-quality sound file?

44,100 samples * 2 bytes per sample * 2 channels= 176,400 bytes per second

300 seconds * 176,400 bytes per second= 52,920,000 bytes = c. 50.5 megabytes (MB)

Page 68: quantization

DAC: Sample and HoldTo reconstruct analog signal, hold each sample value for one clock tick; convert it to steady voltage.

0

1

2

3

4

5

6

7

Ampl

itude

Time

Page 69: quantization

DAC: Smoothing FilterApply an analog low-pass filter to the output of the sample-and-hold unit: averages “stair steps” into a smooth curve.

0

1

2

3

4

5

6

7

Ampl

itude

Time

Page 70: quantization

Prof. Brian L. Evans

Dept. of Electrical and Computer Engineering

The University of Texas at Austin

EE445S Real-Time Digital Signal Processing Lab Spring 2011

Lecture 8

Quantization

Page 71: quantization

8 - 71

Outline

• Introduction

• Uniform amplitude quantization

• Audio

• Quantization error (noise) analysis

• Noise immunity in communication systems

• Conclusion

• Digital vs. analog audio (optional)

Page 72: quantization

8 - 72

Resolution• Human eyes

Sample received light on 2-D grid Photoreceptor density in retina

falls off exponentially awayfrom fovea (point of focus)

Respond logarithmically tointensity (amplitude) of light

• Human earsRespond to frequencies in 20 Hz to 20 kHz rangeRespond logarithmically in both intensity (amplitude)

of sound (pressure waves) and frequency (octaves)Log-log plot for hearing response vs. frequency

Foveated grid:point of focus in middle

Page 73: quantization

8 - 73

Data Conversion

• Analog-to-DigitalConversionLowpass filter has

stopband frequencyless than ½ fs

• Digital-to-AnalogConversionLowpass filter has stopband

frequency less than ½ fs

Discrete-to-continuousconversion could be assimple as sample and hold

Analog Lowpass Filter

Discrete to Continuous Conversion

fs

Lecture 7

Analog Lowpass Filter

Quantizer

Sampler at sampling rate of fs

Lecture 8Lecture 4

Page 74: quantization

8 - 74

Types of Quantizers• Quantization is an interpretation of a

continuous quantity by a finite set of discrete values

• Amplitude quantization approximates its input by a discrete amplitude taken from finite set of values

System Property Amplitude Quantizer

Sampler Sampler + Quantizer

Linearity Yes

Time-invariance No

Causality Yes

Memoryless Yes

For the sampler, stay in the continuous time domain at the input and output to decide on time invariance

Page 75: quantization

8 - 75

Public Switched Telephone Network

• Sample voice signals at 8000 samples/s• Quantize voice to 8 bits/sample

Uniformly quantize to 8 bits/sample, orCompand by uniformly quantizing to 12 bits and

map12 bits logarithmically to 8 bits (by lookup table) to allocate more bits in quiet segments (where ear is more sensitive)

)1log(

)1log(

xy

m = 256 in US/Japan and A = 87.6 in Europe

11

log1

log1

10

log1

xA

ifA

xAA

xifA

xA

y

Maximum data rate?

kbps

m lawx1

1

y

A lawx1

1

Page 76: quantization

8 - 76

Uniform Quantization• Round to nearest integer (midtread)

Quantize amplitude to levels {-2, -1, 0, 1}Step size D for linear region of operationRepresent levels by {00, 01, 10, 11} or

{10, 11, 00, 01} …Latter is two's complement representation

• Rounding with offset (midrise)Quantize to levels {-3/2, -1/2, 1/2, 3/2}Represent levels by {11, 10, 00, 01} …Step size 1

3

3

1223

23

2

13

3

12

)2(12

x

Q[x]

1-2

-2

1

x

Q[x]

1-2 -1

1

2Used in slide 8-10

Page 77: quantization

8 - 77

Handling Overflow• Example: Consider set of integers {-2, -1, 0, 1}

Represented in two's complement system {10, 11, 00, 01}.

Add (–1) + (–1) + (–1) + 1 + 1Intermediate computations are – 2, 1, –2, –1 for

wraparound arithmetic and –2, –2, –1, 0 for saturation arithmetic

• Saturation: When to use it?If input value greater than maximum,

set it to maximum; if less than minimum, set it to minimum

Used in quantizers, filtering, other signal processing operators

• Wraparound: When to use it?Addition performed modulo set of integersUsed in address calculations, array indexing

Native support in MMX and DSPs

Standard two’s complement behavior

Page 78: quantization

8 - 78

Audio Compact Discs (CDs)• Sampled at 44.1 kHz

Analog signal bandwidth from 0 Hz of 20 kHzAnalog signal bandwidth from 20 kHz to 22.05 kHz is

for anti-aliasing filter to roll off from passband to stopband(rolloff is about 10% of maximum passband frequency)

• Amplitude is uniformly quantized to B = 16 bits to yield signal-to-noise ratio of

1.76 dB + 6.02 dB/bit * B = 98.08 dBThis loose upper bound is derived later in slides 8-11

to 8-15In practice, audio CDs have dynamic range of about

95 dB

Page 79: quantization

8 - 79

Dynamic Range• Signal-to-noise ratio in dB

• For linear systems, dynamicrange is equal to SNR

• Linear time-invariant filter for bandlimited signalPass signal bandwidth: magnitude response of 1

means 0 dBAttenuate out-of-band noise: Astopband = dynamic

range

Power Noiselog 10

Power Signallog 10 Power Noise

Power Signallog 10SNR

10

10

10dB

Why 10 log10 ?

For amplitude A,AdB = 20 log10 A

With power P A2 ,PdB = 10 log10 A2

PdB = 20 log10 A

Page 80: quantization

8 - 80

Dynamic Range in Audio• Sound Pressure Level (SPL)

Reference in dB SPL is 20 Pa(threshold of hearing)

40 dB SPL noise in typical living room120 dB SPL threshold of pain 80 dB SPL resulting dynamic rangeAudio CDs give 95 dB of dynamic range

• Estimating dynamic range(a)Find maximum RMS output of the linear system

with some specified amount of distortion, typically 1%

(b)Find RMS output of system with small input signal (e.g.-60 dB of full scale) with input signal removed from output

(c)Divide (b) into (a) to find the dynamic range

Anechoic room 10 dBWhisper 30 dB Rainfall 50 dB

Dishwasher 60 dB City Traffic 85 dB

Leaf Blower 110 dB Siren 120 dB

Slide by Dr. Thomas D. Kite, Audio Precision

Page 81: quantization

8 - 81

Quantization Error (Noise) Analysis• Quantization output

Input signal plus noiseNoise is difference of

output and input signals

• Signal-to-noise ratio (SNR) derivationQuantize to B bits

Quantization error

• Assumptionsm (-mmax, mmax)

Uniform midrise quantizerInput does not overload quantizerQuantization error (noise) is uniformly distributedNumber of quantization levels L = 2B is large enough

so thatQB[ · ]m v

mvmmQq B ][LL

1

1

1

Page 82: quantization

8 - 82

Quantization Error (Noise) Analysis• Deterministic signal x(t)

w/ Fourier transform X(f)Power spectrum is square of

absolute value of magnitude response (phase is ignored)

Multiplication in Fourier domain is convolution in time domain

Conjugation in Fourier domain is reversal & conjugation in time

• Autocorrelation of x(t)

Maximum value (when it exists) is at Rx(0)

Rx(t) is even symmetric,i.e. Rx(t) = Rx(-t)

)( )()()( *2fXfXfXfPx

)(*)( )( )( ** xxFfXfX

)(*)()( * xxRx

t

1x(t)

0 Ts

t

Rx(t)

-Ts Ts

Ts

Page 83: quantization

8 - 83

Quantization Error (Noise) Analysis• Two-sided random signal n(t)

Fourier transform may not exist, but power spectrum exists

For zero-mean Gaussian random process n(t) with variance s2

• Estimate noise powerspectrum in Matlab

22* )( )( )( )( )( fPtntnER nn

)( )( nn RFfP

N = 16384; % finite no. of samplesgaussianNoise = randn(N,1);plot( abs(fft(gaussianNoise)) .^ 2 );

approximate noise floor

dttntntntnERn )( )( )( )( )( **

)(*)( )( )( )( )( )( ***

nndttntntntnERn

Page 84: quantization

8 - 84

Quantization Error (Noise) Analysis• Quantizer step size

• Quantization error

q is sample of zero-mean random process Q

q is uniformly distributed

• Input power: Paverage,m

SNR exponential in BAdding 1 bit increases

SNR by factor of 4• Derivation of SNR in

deciBels on next slide

L

m

L

m maxmax 2

1

2

22

q

BQ

zero

QQ

m

QE

22max

22

222

2 3

1

12

B

Q m

PP 22max

maverage,2

maverage, 2 3

SNR

PowerNoise

PowerSignalSNR

Page 85: quantization

8 - 85

Quantization Error (Noise) Analysis• SNR in dB = constant + 6.02 dB/bit * B

• What is maximum number of bits of resolution forLandline telephone speech signal of SNR of 35 dBAudio CD signal with SNR of 95 dB

BmP

mP

m

P B

02.6log 20log 10477.0

)2(logB 20log 20log 103log 10

2 3

log 10SNR log 10

max10maverage,10

10max10maverage,1010

22max

maverage,1010

1.76 and 1.17 are common constants used in audio

Loose upper bound

Page 86: quantization

8 - 86

Noise Immunity at Receiver Output• Depends on modulation, average transmit

power, transmission bandwidth and channel noise

• Analog communications (receiver output SNR)“When the carrier to noise ratio is high, an increase

in the transmission bandwidth BT provides a corresponding quadratic increase in the output signal-to-noise ratio or figure of merit of the [wideband] FM system.” – Simon Haykin, Communication Systems, 4th ed., p. 147.

• Digital communications (receiver symbol error)“For code division multiple access (CDMA) spread

spectrum communications, probability of symbol error decreases exponentially with transmission bandwidth BT” – Andrew Viterbi, CDMA: Principles of Spread Spectrum Communications, 1995, pp. 34-36.

Page 87: quantization

8 - 87

Conclusion• Amplitude quantization approximates its input

by a discrete amplitude taken from finite set of values

• Loose upper bound in signal-to-noise ratio of a uniform amplitude quantizer with output of B bitsBest case: 6 dB of SNR gained for each bit added to

quantizerKey limitation: assumes large number of levels L = 2B

• Best case improvement in noise immunity for communication systemsAnalog: improvement quadratic in transmission

bandwidthDigital: improvement exponential in transmission

bandwidth

Page 88: quantization

8 - 88

Digital vs. Analog Audio• An audio engineer claims to notice differences

between analog vinyl master recording and the remixed CD version. Is this possible?When digitizing an analog recording, the maximum

voltage level for the quantizer is the maximum volume in the track

Samples are uniformly quantized (to 216 levels in this case although early CDs circa 1982 were recorded at 14 bits)

Problem on a track with both loud and quiet portions, which occurs often in classical pieces

When track is quiet, relative error in quantizing samples grows

Contrast this with analog media such as vinyl which responds linearly to quiet portions

Optional

Page 89: quantization

8 - 89

Digital vs. Analog Audio• Analog and digital media response to voltage v

• For a large dynamic rangeAnalog media: records voltages above V0 with

distortionDigital media: clips voltages above V0 to V0

• Audio CDs use delta-sigma modulationEffective dynamic range of 19 bits for lower

frequencies but lower than 16 bits for higher frequencies

Human hearing is more sensitive at lower frequencies

03/1

00

00

03/1

00

for

for

for

)(

VvvVV

VvVv

VvVvV

vA

00

00

00

for

for

for

)(

VvV

VvVv

VvV

vD

Optional