DC 3 SourceCoding

139
Chapter 3 Source Coding

Transcript of DC 3 SourceCoding

Page 1: DC 3 SourceCoding

Chapter 3Source Coding

Page 2: DC 3 SourceCoding

WITS Lab, NSYSU.2

Table of Contents

3.1 Mathematical Models for Information Sources3.2 A Logarithmic Measure of Information

3.2.1 Average Mutual Information and Entropy3.2.2 Information Measures for Continuous Random

Variables

3.3 Coding for Discrete Sources3.3.1 Coding for Discrete Memoryless Sources3.3.2 Discrete Stationary Sources3.3.3 The Lempel-Ziv Algorithm

Page 3: DC 3 SourceCoding

WITS Lab, NSYSU.3

Table of Contents (cont.)

3.4 Coding for Analog Sources – Optimum Quantization3.4.1 Rate-Distortion Function3.4.2 Scalar Quantization3.4.3 Vector Quantization

3.5 Coding Techniques for Analog Sources3.5.1 Temporal Waveform Coding3.5.2 Spectral Waveform Coding3.5.3 Model-Based Source Coding

Page 4: DC 3 SourceCoding

WITS Lab, NSYSU.4

Introduction

Two types of sources: analog source and digital source.Whether a source is analog or discrete, a digital communication system is designed to transmit information in digital form.The output of the source must be converted to a format that can be transmitted digitally.This conversion of the source output to a digital form is generally performed by the source encoder, whose output may be assumed to be a sequence of binary digits.In this chapter, we treat source encoding based on mathematical models of information sources and provide a quantitative measure of the information emitted by a source.

Page 5: DC 3 SourceCoding

WITS Lab, NSYSU.5

3.1 Mathematical Models for Information Sources

The output of any information source is random.The source output is characterized in statistical terms.To construct a mathematical model for a discrete source, we assume that each letter in the alphabet {x1, x2, …, xL} has a given probability pk of occurrence.

1

( ), 1

1

k kL

kk

p P X x k L

p=

= = ≤ ≤

=∑

Page 6: DC 3 SourceCoding

WITS Lab, NSYSU.6

Two mathematical models of discrete sources:If the output sequence from the source is statistically independent, i.e. the current output letter is statistically independent from all past and future outputs, then the source is said to be memoryless. Such a source is called a discrete memoryless source (DMS).If the discrete source output is statistically dependent, we mayconstruct a mathematical model based on statistical stationarity. By definition, a discrete source is said to be stationary if the joint probabilities of two sequences of length n, say a1, a2, …, an and a1+m, a2+m, …, an+m, are identical for all n≥1 and for all shifts m. In other words, the joint probabilities for any arbitrary lengthsequence of source outputs are invariant under a shift in the time origin.

3.1 Mathematical Models for Information Sources

Page 7: DC 3 SourceCoding

WITS Lab, NSYSU.7

Analog sourceAn analog source has an output waveform x(t) that is a sample function of a stochastic process X(t).Assume that X(t) is a stationary stochastic process with autocorrelation function φxx(τ) and power spectral density Φxx(f). When X(t) is a band-limited stochastic process, i.e., Φxx(f)=0 for | f |≥W, the sampling theorem may be used to represent X(t) as:

By applying the sampling theorem, we may convert the output of an analog source into an equivalent discrete-time source.

( )sin 2

22 2

2n

nW tWnX t X

nW W tW

π

π

=−∞

⎡ ⎤⎛ ⎞−⎜ ⎟⎢ ⎥⎛ ⎞ ⎝ ⎠⎣ ⎦= ⎜ ⎟ ⎛ ⎞⎝ ⎠ −⎜ ⎟⎝ ⎠

3.1 Mathematical Models for Information Sources

Page 8: DC 3 SourceCoding

WITS Lab, NSYSU.8

Analog source (cont.)The output samples {X(n/2W)} from the stationary sources are generally continuous, and they can’t be represented in digital form without some loss in precision.We may quantize each sample to a set of discrete values, but the quantization process results in loss of precision.Consequently, the original signal can’t be reconstructed exactly from the quantized sample values.

3.1 Mathematical Models for Information Sources

Page 9: DC 3 SourceCoding

WITS Lab, NSYSU.9

Consider two discrete random variables with possible outcomes xi, i=1,2,…, n, and yi, i=1,2,…,m.When X and Y are statistically independent, the occurrence of Y=yj provides no information about the occurrence of X=xi.When X and Y are fully dependent such that the occurrence of Y=yj determines the occurrence of X=xi, , the information content is simply that provided by the event X=xi.Mutual Information between xi and yj: the information content provided by the occurrence of the event Y=yj about the event X=xi, is defined as:

( ) ( )( )

|; log i j

i ji

P x yI x y

P x=

3.2 A Logarithmic Measure of Information

Page 10: DC 3 SourceCoding

WITS Lab, NSYSU.10

3.2 A Logarithmic Measure of Information

The units of I(xi,yj) are determined by the base of the logarithm, which is usually selected as either 2 or e.When the base of the logarithm is 2, the units of I(xi,yj) are bits.When the base is e, the units of I(xi,yj) are called nats (natural units).The information measured in nats is equal to ln2 times the information measured in bits since:

When X and Y are statistically independent, p(xi|yj)=p(xi), I(xi,yj)=0.When X and Y are fully dependent, P(xi|yj)=1, and hence I(xi,yj)=-logP(xi).

2 2ln ln 2log 0.69315loga a a= =logloglog

ca

c

bba

=

Page 11: DC 3 SourceCoding

WITS Lab, NSYSU.11

Self-information of the event X=xi is defined as I(xi)=-logP(xi).Note that a high-probability event conveys less information than a low-probability event.If there is only a single event x with probability P(x)=1, then I(x)=0.Example 3.2-1: A discrete information source that emits a binary digit with equal probability.

The information content of each output is:

For a block of k binary digits, if the source is memoryless, there are M=2k possible k-bit blocks. The self-information is:

( ) ( )2 21log log 1 bit, =0,1 2i i iI x P x x= − = − =

( )' 2log 2 bitskiI x k−= − =

3.2 A Logarithmic Measure of Information

Page 12: DC 3 SourceCoding

WITS Lab, NSYSU.12

The information provided by the occurrence of the event Y=yjabout the event X=xi is identical to the information provided by the occurrence of the event X=xi about the event Y=yj since:

Example 3.2-2: X and Y are binary-valued {0,1} random variables that represent the input and output of a binary channel.

The input symbols are equally likely.

( ) ( )( )

( ) ( )( ) ( )

( )( ) ( )

( ) ( )( ) ( )

( )( ) ( )

| | ,;

| | ;

i j i j j i ji j

i i j i j

j i i j ij i

i j j

P x y P x y P y P x yI x y

P x P x P y P x P y

P y x P x P y xI y x

P x P y P y

= = =

= = =

3.2 A Logarithmic Measure of Information

Page 13: DC 3 SourceCoding

WITS Lab, NSYSU.13

Example 3.2-2 (cont.):The output symbols depend on the input according to the conditional probability:

Mutual information about X=0 and X=1, given that Y=0:

( ) ( )( ) ( )

0 0

1 1

0 | 0 1 1| 0

1| 1 1 0 | 1

P Y X p P Y X p

P Y X p P Y X p

= = = − = = =

= = = − = = =

( ) ( ) ( )

( ) ( ) ( )

( ) ( ) ( )

( ) ( ) ( )

0 1

1 0

0 0 | 0 01 0 | 1 1 12

1 1| 0 01 1| 1 1 12

P Y P Y X P X

P Y X P X p p

P Y P Y X P X

P Y X P X p p

= = = = =

+ = = = = − +

= = = = =

+ = = = = − +

3.2 A Logarithmic Measure of Information

Page 14: DC 3 SourceCoding

WITS Lab, NSYSU.14

Example 3.2-2 (cont.)The mutual information about X=0 given that Y=0 is:

The mutual information about X=1 given that Y=0 is:

If the channel is noiseless, p0=p1=0:

If the channel is useless, p0=p1=0.5:

( ) ( ) ( )( )

( )01 1 2 2

0 1

0 | 0 2 1; 0;0 log log

0 1P Y X p

I x y IP Y p p= = −

= = == − +

( ) ( ) 12 1 2

0 1

2x ; 1;0 log1

pI y Ip p

≡ =− +

( ) 20;0 log 2 1 bitI = =

( ) 20;0 log 1 0 bitI = =

3.2 A Logarithmic Measure of Information

Page 15: DC 3 SourceCoding

WITS Lab, NSYSU.15

Conditional self-information is defined as:

We interpret I(xi|yj) as the self-information about the event X=xiafter having observed the event Y=yj.The mutual information between a pair of events can be either positive or negative, or zero since both I(xi|yj) and I(xi) are greater than or equal to zero.

( ) ( ) ( )1| log log ||i j i j

i j

I x y P x yP x y

= = −

( ) ( ) ( ) ( ) ( ); log | log |i j i j i i i jI x y P x y P x I x I x y= − = −

3.2 A Logarithmic Measure of Information

Page 16: DC 3 SourceCoding

WITS Lab, NSYSU.16

3.2.1 Average Mutual Information and Entropy

Average mutual information between X and Y:

I(X;Y)=0 when X and Y are statistically independent.I(X;Y)≥0. (Problem 3-4)

Average self-information H(X):

When X represents the alphabet of possible output letters from a source, H(X) represents the average self-information per source letter, and it is called the entropy.

( ) ( ) ( )

( ) ( )( ) ( )

1 1

1 1

; , ;

, = , log

n m

i j i ji j

n mi j

i ji j i j

I X Y P x y I x y

P x yP x y

P x P y

= =

= =

= ∑∑

∑∑

( ) ( ) ( )1

n

i ii

H X P x I x=

= ∑

Page 17: DC 3 SourceCoding

WITS Lab, NSYSU.17

In the special case, in which the letter from the source are equally probable, P(xi)=1/n, we have:

In general, H(X) ≤ log n for any given set of source letter probabilities.In other words, the entropy of a discrete source is a maximum when the output letters are equally probable.

( )1

1 1log logn

i

H X nn n=

= − =∑

3.2.1 Average Mutual Information and Entropy

Page 18: DC 3 SourceCoding

WITS Lab, NSYSU.18

Example 3.2-3 : Consider a source that emits a sequence of statistically independent letters, where each output letter is either 0 with probability q or 1 with probability 1-q.

The entropy of this source is:

Maximum value of theentropy function occurs atq=0.5 where H(0.5)=1.

( ) ( ) ( ) ( )log 1 log 1H X H q q q q q≡ = − − − −Binary Entropy Function

3.2.1 Average Mutual Information and Entropy

Page 19: DC 3 SourceCoding

WITS Lab, NSYSU.19

The average conditional self-information is called the conditional entropy and is defined as:

H(X|Y) is the information or uncertainty in X after Y is observed.

( ) ( ) ( )1 1

1| , log|

n m

i ji j i j

H X Y P x yP x y= =

= ∑∑

( ) ( ) ( )( ) ( )

( ) ( ) ( ){ } ( ) ( )

( ) ( ) ( )

( ) ( ) ( ) ( )( ) ( )

1 1

1 1

1 1

1 1 1

,; , log

, log | log log

, log | log

log , log |

|

n mi j

i ji j i j

n m

i j i j j i ji j

n m

i j i j ii j

n n m

i i i j i ji i j

P x yI X Y P x y

P x P y

P x y P x y P y P x P y

P x y P x y P x

P x P x P x y P x y

H X H X Y

= =

= =

= =

= = =

=

⎡ ⎤= − −⎣ ⎦

⎡ ⎤= −⎣ ⎦

⎡ ⎤= − + ⎣ ⎦

= −

∑ ∑

∑ ∑

∑ ∑

∑ ∑∑

3.2.1 Average Mutual Information and Entropy

Page 20: DC 3 SourceCoding

WITS Lab, NSYSU.20

Since I(X;Y)≥0, it follows that H(X) ≥H(X|Y), with equality if and only if X and Y are statistically independent.H(X|Y) can be interpreted as the average amount of (conditional self-information) uncertainty in X after we observe Y.H(X) can be interpreted as the average amount of uncertainty (self-information) prior to the observation.I(X;Y) is the average amount of (mutual information) uncertainty provided about the set X by the observation of the set Y.Since H(X) ≥H(X|Y), it is clear that conditioning on the observation Y does not increase the entropy.

3.2.1 Average Mutual Information and Entropy

Page 21: DC 3 SourceCoding

WITS Lab, NSYSU.21

Example 3.2-4: Consider Example 3.2-2 for the case of p0=p1=p. Let P(X=0)=q and P(X=1)=1-q.

The entropy is:( ) ( ) ( ) ( )log 1 log 1H X H q q q q q≡ = − − − −

3.2.1 Average Mutual Information and Entropy

Page 22: DC 3 SourceCoding

WITS Lab, NSYSU.22

As in the proceeding example, when the conditional entropy H(X|Y) is viewed in terms of a channel whose input is X and whose out is Y, H(X|Y) is called the equivocation and is interpreted as the amount of average uncertainty remaining in Xafter observation of Y.

3.2.1 Average Mutual Information and Entropy

Page 23: DC 3 SourceCoding

WITS Lab, NSYSU.23

Entropy for two or more random variables:

( ) ( ) ( )( ) ( ) ( ) ( ) ( )

( ) ( ) ( ) ( )

1 2

1 2 1 2

1 2

1 21 1 1

1 2 1 2 1 3 1 2 1 2 1

1 2 3 1 2 1 3 1 2

1 2

... ... ... log ...

since ... | | ... | ...

... | |

... | ...

k

k k

k

nn n

K j j j j j jj j j

k k k

K

k

H X X X P x x x P x x x

P x x x P x P x x P x x x P x x x x

H X X X X H X H X X H X X X

H X X X X

= = =

= −

=

= + +

+ +

∑∑ ∑

( )

( )

( ) ( ) ( ) ( )

1

1 2 11

1 21

1 2 1

| ...

Since | ...

where and ...

k

k

i ii

k

k mm

m m

H X X X X

H X H X Y H X X X H X

X X Y X X X

−=

=

=

≥ ⇒ ≤

= =

3.2.1 Average Mutual Information and Entropy

Page 24: DC 3 SourceCoding

WITS Lab, NSYSU.24

3.2.2 Information Measures for Continuous Random Variables

If X and Y are random variables with joint PDF p(x,y) and marginal PDFs p(x) and p(y), the average mutual information between X and Y is defined as:

Although the definition of the average mutual information carriers over to continuous random variables, the concept of self-information does not. The problem is that a continuous random variable requires an infinite number of binary digits to represent it exactly. Hence, its self-information is infinite and, therefore, its entropy is also infinite.

( ) ( ) ( ) ( ) ( )( ) ( )

|; | log

p y x p xI X Y p x p y x dx dy

p x p y∞ ∞

−∞ −∞= ∫ ∫

Page 25: DC 3 SourceCoding

WITS Lab, NSYSU.25

Differential entropy of the continuous random variables X is defined as:

Note that this quantity does not have the physical meaning of self-information, although it may appear to be a natural extension of the definition of entropy for a discrete random variable.

Average conditional entropy of X given Y is defined as:

Average mutual information may be expressed as:

( ) ( ) ( ) logH X p x p x dx∞

−∞= −∫

( ) ( ) ( )| , log |H X Y p x y p x y dxdy∞ ∞

−∞ −∞= −∫ ∫

( ) ( ) ( )( ) ( )

; |

|

I X Y H X H X Y

H Y H Y X

= −

= −

3.2.2 Information Measures for Continuous Random Variables

Page 26: DC 3 SourceCoding

WITS Lab, NSYSU.26

Suppose X is discrete and has possible outcomes xi, i=1,2,…,n, and Y is continuous and is described by its marginal PDF p(y).

When X and Y are statistically dependent, we may express p(y) as:

The mutual information provided about the event X= xi by the occurrence of the event Y=y is:

The average mutual information between X and Y is:

( ) ( ) ( )1

|n

i ii

p y p y x P x=

= ∑

( ) ( ) ( )( ) ( )

( )( )

| |; logi i i

ii

p y x P x p y xI x y

p y P x p y= =

( ) ( ) ( ) ( )( )1

|; | log

ni

i ii

p y xI X Y p y x P x dy

p y∞

−∞=

=∑∫

3.2.2 Information Measures for Continuous Random Variables

Page 27: DC 3 SourceCoding

WITS Lab, NSYSU.27

Example 3.2-5. Let X be a discrete random variable with two equally probable outcomes x1=A and x2=-A.

Let the conditional PDFs p(y|xi), i=1,2, be Gaussian with mean xi and variance σ2.

The average mutual information is:

( )( )

( )( )2 2

2 22 21 1| |2 2

y A y A

p y A e p y A eσ σ

πσ πσ

− − − +

= − =

( ) ( )( ) ( ) ( )

( )

( ) ( ) ( )

| |1( ; ) | log | log2

1where | |2

p y A p y AI X Y p y A p y A dy

p y p y

p y p y A p y A

−∞

⎡ ⎤−= + −⎢ ⎥

⎣ ⎦

= + −⎡ ⎤⎣ ⎦

3.2.2 Information Measures for Continuous Random Variables

Page 28: DC 3 SourceCoding

WITS Lab, NSYSU.28

3.3 Coding for Discrete SourcesConsider the process of encoding the output of a source, i.e., the process of representing the source output by a sequence of binary digits.A measure of the efficiency of a source-encoding method can be obtained by comparing the average number of binary digits per output letter from the source to the entropy H(X).The discrete memoryless source (DMS) is by far the simplest model that can be devised for a physical model. Few physical sources closely fit this idealized mathematical model.It is always more efficient to encode blocks of symbols instead of encoding each symbol separately.By making the block size sufficiently large, the average number of binary digits per output letter from the source can be made arbitrarily close to the entropy of the source.

Page 29: DC 3 SourceCoding

WITS Lab, NSYSU.29

Suppose that a DMS produces an output letter or symbol every τs seconds.Each symbol is selected from a finite alphabet of symbols xi, i=1,2,…,L, occurring with probabilities P(xi), i=1,2,…,L.The entropy of the DMS in bits per source symbol is:

The equality holds when the symbols are equally probable.The average number of bits per source symbol is H(X).The source rate in bits/s is defined as H(X)/ τs.

( ) ( ) ( )2 21

log logL

i ii

H X P x P x L=

= − ≤∑Problem 3-5.

3.3.1 Coding for Discrete MemorylessSources

Page 30: DC 3 SourceCoding

WITS Lab, NSYSU.30

Fixed-length code wordsConsider a block encoding scheme that assigns a unique set of R binary digits to each symbol.Since there are L possible symbols, the number of binary digits per symbol required for unique encoding is:

The code rate R in bits per symbol is R.Since H(X)≤log2 L, it follows that R≥H(X).

2

2

log when is a power of 2.log 1 when is not a power of 2.

denotes the largest integer less than .

R L LR L L

x x

=

= +⎢ ⎥⎣ ⎦⎢ ⎥⎣ ⎦

3.3.1 Coding for Discrete MemorylessSources

Page 31: DC 3 SourceCoding

WITS Lab, NSYSU.31

Fixed-length code wordsThe efficiency of the encoding for the DMS is defined as the ratio H(X)/R.When L is a power of 2 and the source letters are equally probable, R=H(X).If L is not a power of 2 , but the source symbols are equally probable, R differs from H(X) by at most 1 bit per symbol.When log2 L>>1, the efficiency of this encoding scheme is high.When L is small, the efficiency of the fixed-length code can be increased by encoding a sequence of J symbols at a time.To achieve this, we need LJ unique code words.

3.3.1 Coding for Discrete MemorylessSources

Page 32: DC 3 SourceCoding

WITS Lab, NSYSU.32

Fixed-length code wordsBy using sequences of N binary digits, we have 2N possible code words. N ≥ J log2 L. The minimum integer value of Nrequired is . The average number of bits per source symbol is N/J=R and the inefficiency has been reduced by approximately a factor of 1/J relative to the symbol-by-symbol encoding.By making J sufficiently large, the efficiency of the encoding procedure, measured by the ratio H(X)/R=JH(X)/N, can be made as close to unity as desired.The above mentioned methods introduce no distortion since the encoding of source symbols or block of symbols into code words is unique. This is called noiseless.

2log 1N J L= +⎢ ⎥⎣ ⎦

3.3.1 Coding for Discrete MemorylessSources

Page 33: DC 3 SourceCoding

WITS Lab, NSYSU.33

Block coding failure (or distortion), with probability of Pe, occurs when the encoding process is not unique.Source coding theorem I: (by Shannon)

Let X be the ensemble of letters from a DMS with finite entropy H(X).Blocks of J symbols from the source are encoded into code words of length N from a binary alphabet.For anyε>0, the probability Pe of a block decoding failure can be made arbitrarily small if J is sufficiently large and

Conversely, if R≤H(X)-ε, Pe becomes arbitrarily close to 1 as J is sufficiently large.

( )NR H XJ

ε≡ ≥ +

3.3.1 Coding for Discrete MemorylessSources

Page 34: DC 3 SourceCoding

WITS Lab, NSYSU.34

Variable-length code wordsWhen the source symbols are not equally probable, a more efficient encoding method is to use variable-length code words.In the Morse code, the letters that occur more frequently are assigned short code words and those that occur infrequently are assigned long code words.Entropy coding devises a method for selecting and assigning the code words to source letters.

3.3.1 Coding for Discrete MemorylessSources

Page 35: DC 3 SourceCoding

WITS Lab, NSYSU.35

Variable-length code words

Code I is not uniquely decodable. (Example: 1001)Code II is uniquely decodable and instantaneously decodable.

Digit 0 indicates the end of a code word and no code word is longer than three binary digits.Prefix condition: no code word of length l<k that is identical to the first l binary digits of another code word of length k>l.

111111101/8a4

011110011/8a3

0110001/4a2

0011/2a1

Code IIICode IICode IP(ak)Letter

3.3.1 Coding for Discrete MemorylessSources

Page 36: DC 3 SourceCoding

WITS Lab, NSYSU.36

Variable-length code wordsCode III has a tree structure:

The code is uniquely decodable.The code is not instantaneously decodable.This code does not satisfy the prefix condition.

Objective: devise a systematic procedure for constructing uniquely decodable variable-length codes that minimizes:

( )1

L

k kk

R n P a=

= ∑

3.3.1 Coding for Discrete MemorylessSources

Page 37: DC 3 SourceCoding

WITS Lab, NSYSU.37

Kraft inequalityA necessary and sufficient condition for the existence of a binary code with code words having lengths n1≤n2≤…≤nL that satisfy the prefix condition is

Proof of sufficient condition:Consider a code tree that isembedded in the full tree of2n (n=nL) nodes.

12 1k

Ln

k

=

≤∑

nL=4

3.3.1 Coding for Discrete MemorylessSources

Page 38: DC 3 SourceCoding

WITS Lab, NSYSU.38

Kraft inequalityProof of sufficient condition (cont.)

Let’s select any node of order n1 as the first code word C1. This choice eliminates 2 n-n1 terminal nodes (or the fraction 2-n1 of the 2n terminal nodes).From the remaining available nodes of order n2, we select one node for the second code word C2. This choice eliminates 2 n-n2 terminal nodes.This process continues until the last code word is assigned at terminal node L.At the node j<L, the fraction of the number of terminal nodes eliminated is:

At node j<L, there is always a node k>j available to be assigned to the next code word. Thus, we have constructed a code tree that is embedded in the full tree. Q.E.D.

1 12 2 1k k

j Ln n

k k

− −

= =

< ≤∑ ∑

3.3.1 Coding for Discrete MemorylessSources

Page 39: DC 3 SourceCoding

WITS Lab, NSYSU.39

Kraft inequalityProof of necessary condition

In code tree of order n=nL, the number of terminal nodes eliminated from the total number of 2n terminal nodes is:

Source coding theorem IILet X be the ensemble of letters from a DMS with finite entropy H(X) and output letters xk, 1≤k≤L, with corresponding probabilities of occurrence pk, 1≤k≤L. It is possible to construct a code that satisfies the prefix condition and has an average length that satisfies the inequalities:

1 12 2 2 1k k

L Ln n nn

k k

− −

= =

≤ ⇒ ≤∑ ∑

R( ) ( ) 1H X R H X≤ < +

3.3.1 Coding for Discrete MemorylessSources

Page 40: DC 3 SourceCoding

WITS Lab, NSYSU.40

Source coding theorem II (cont.)Proof of lower bound:

( )

( ) ( ) ( )

2 21 1 1

21 1

2 21 1

1 2log log

22 ln ln 2 ln log

since ln 1, we have:

2log 1 log 2 1 0

Equal

k

kk

kk

nL L L

k k k kk k kk k

nnL L

k kk kk k

nL Ln

kk kk

H X R p p n pp p

p p ep p

x x

H X R e p ep

= = =

−−

= =

−−

= =

− = − =

⎛ ⎞⎛ ⎞= = ⋅⎜ ⎟⎜ ⎟

⎝ ⎠ ⎝ ⎠≤ −

⎛ ⎞ ⎛ ⎞− ≤ − ≤ − ≤⎜ ⎟ ⎜ ⎟⎝ ⎠⎝ ⎠

∑ ∑ ∑

∑ ∑

∑ ∑-ity holds if and only if 2 for 1 .kn

kp k L= ≤ ≤

Note that logab=logb/loga.

3.3.1 Coding for Discrete MemorylessSources

Kraft inequality.

Page 41: DC 3 SourceCoding

WITS Lab, NSYSU.41

Source coding theorem II (cont.)Proof of upper bound:

The upper bound may be established under the constraint that nk, 1≤ k ≤L, are integers, by selecting the {nk} such that .If the terms are summed over 1≤ k ≤L, we obtain the Kraft inequality, for which we have demonstrated that there exists a code that satisfies the prefix condition.On the other hand, if we take the logarithm of , we obtainIf we multiply both sides by pk and sum over 1≤ k ≤L, we obtain the desired upper bound.

12 2k kn nkp− − +≤ <

2 knkp −≥

12 knkp − +<

2 2log 1 or 1 logk k k kp n n p< − + < −

3.3.1 Coding for Discrete MemorylessSources

Page 42: DC 3 SourceCoding

WITS Lab, NSYSU.42

Huffman coding algorithm1. The source symbols are listed in order of decreasing

probability. The two source symbols of lowest probability are assigned a 0 and a 1.

2. These two source symbols are regarded as being combined into a new source symbol with probability equal to the sum of the two original probabilities. The probability of the new symbol is placed in the list in accordance with its value.

3. The procedure is repeated until we are left with a final list ofsource statistics of only two for which a 0 and a 1 are assigned.

4. The code for each (original) source symbol is found by working backward and tracing the sequence of 0s and 1s assigned to that symbol as well as its successors.

3.3.1 Coding for Discrete MemorylessSources

Page 43: DC 3 SourceCoding

WITS Lab, NSYSU.43

SymbolS0S1S2S3S4

Probability0.40.20.20.10.1

Code Word001011010011

Symbol

S0S1S2S3S4

Stage 1

0.40.20.20.10.1

Stage 2

0.40.20.20.2

Stage 3

0.40.40.2

Stage 4

0.60.4

0

1

0

1

0

1

0

1

3.3.1 Coding for Discrete MemorylessSources

Page 44: DC 3 SourceCoding

WITS Lab, NSYSU.44

Huffman coding algorithmExample 3.3-1

3.3.1 Coding for Discrete MemorylessSources

Page 45: DC 3 SourceCoding

WITS Lab, NSYSU.45

Huffman coding algorithmExample 3.3-1 (cont.)

3.3.1 Coding for Discrete MemorylessSources

Page 46: DC 3 SourceCoding

WITS Lab, NSYSU.46

Huffman coding algorithmExample 3.3-2

3.3.1 Coding for Discrete MemorylessSources

Page 47: DC 3 SourceCoding

WITS Lab, NSYSU.47

Huffman coding algorithmThis algorithm is optimum in the sense that the average number of binary digits required to represent the source symbols is a minimum, subject to the constraint that the code words satisfy the prefix condition, which allows the received sequence to be uniquely and instantaneously decodable.Huffman encoding process is not unique.Code words for different Huffman encoding process can have different lengths. However, the average code-word length is the same.When a combined symbol is moved as high as possible, the resulting Huffman code has a significantly smaller variance than when it is moved as low as possible.

3.3.1 Coding for Discrete MemorylessSources

Page 48: DC 3 SourceCoding

WITS Lab, NSYSU.48

Huffman coding algorithmThe variable-length encoding (Huffman) algorithm described in the above mentioned examples generates a prefix code having an that satisfies:

A more efficient procedure is to encode blocks of J symbols at a time. In such a case, the bounds of source coding theorem II become:

can be made as close to H(X) as desired by selecting Jsufficiently large.To design a Huffman code for a DMS, we need to know the probabilities of occurrence of all the source letters.

R( ) ( ) 1H X R H X≤ < +

( ) ( ) ( ) ( ) 11 JJ

RJH X R JH X H X R H XJ J

≤ < + ⇒ ≤ ≡ < +

R

3.3.1 Coding for Discrete MemorylessSources

Page 49: DC 3 SourceCoding

WITS Lab, NSYSU.49

Huffman coding algorithmExample 3.3-3

3.3.1 Coding for Discrete MemorylessSources

Page 50: DC 3 SourceCoding

WITS Lab, NSYSU.50

Huffman coding algorithmExample 3.3-3 (cont.)

3.3.1 Coding for Discrete MemorylessSources

Page 51: DC 3 SourceCoding

WITS Lab, NSYSU.51

3.3.2 Discrete Stationary SourcesWe consider discrete sources for which the sequence of output letters is statistically stationary (letters are statistically dependent).The entropy of a block of random variables X1X2…Xk is:

H(Xi|X1X2…Xi-1) is the conditional entropy of the ith symbol from the source given the previous i-1 symbols.The entropy per letter for the k-symbol block is defined as

Information content of a stationary source is defined as the entropy per letter in the limit as k→∞.

( ) ( )1 2 1 2 11

... | ...k

K i ii

H X X X H X X X X −=

= ∑

( ) ( )1 21 ...k kH X H X X Xk

=

( ) ( ) ( )1 21lim lim ...k kk k

H X H X H X X Xk∞ →∞ →∞

≡ =

From 3.2-13and 3.2-15.

Page 52: DC 3 SourceCoding

WITS Lab, NSYSU.52

The entropy per letter from the source can be defined in terms of the conditional entropy H(Xk|X1X2…Xk-1) in the limit as kapproaches infinity.

Existence of the above equation can be found in page 100-101.For a discrete stationary source that emits J letters with HJ(X) as the entropy per letter.

In the limit as J→∞, we have:

( ) ( )1 2 1lim | ...k kkH X H X X X X∞ −→∞

=

( ) ( )1 1... ... 1JJ JH X X R H X X≤ < +

( ) ( )H X R H X ε∞ ∞≤ < +

3.3.2 Discrete Stationary Sources

( ) ( ) 1JJ J

RH X R H XJ J

≤ ≡ < +

Page 53: DC 3 SourceCoding

WITS Lab, NSYSU.53

3.3.3 The Lempel-Ziv Algorithm

For Huffman Coding, except for the estimation of the marginal probabilities {pk}, corresponding to the frequency of occurrence of the individual source output letters, the computational complexity involved in estimating joint probabilities is extremely high.The application of the Huffman coding method to source coding for many real sources with memory is generally impractical.The Lempel-Ziv source coding algorithm is designed to be independent of the source statistics.It belongs to the class of universal source coding algorithms.It is a variable-to-fixed-length algorithm.

Page 54: DC 3 SourceCoding

WITS Lab, NSYSU.54

3.3.3 The Lempel-Ziv AlgorithmOperation of Lempel-Ziv algorithm

1. The sequence at the output of the discrete source is parsed into variable-length blocks, which are called phrases.

2. A new phrase is introduced every time a block of letters from the source differs from some previous phrase in the last letter.

3. The phrases are listed in a dictionary, which stores the location of the existing phrases.

4. In encoding a new phrase, we simply specify the location of the existing phrase in the dictionary and append the new letter.101011010010011101010000110011101011000110111,0,10,11,01,00,100,111,010,1000,011,001,110,101,10001,1011

Page 55: DC 3 SourceCoding

WITS Lab, NSYSU.55

3.3.3 The Lempel-Ziv AlgorithmOperation of Lempel-Ziv algorithm (cont.)

To encode the phrases, we construct a dictionary:

Page 56: DC 3 SourceCoding

WITS Lab, NSYSU.56

3.3.3 The Lempel-Ziv AlgorithmOperation of Lempel-Ziv algorithm (cont.)

5. The code words are determined by listing the dictionary location (in binary form) of the previous phrase that matches the new phrase in all but the last location.

6. The new output letter is appended to the dictionary location of the previous phrase.

7. The location 0000 is used to encode a phrase that has not appeared previously.

8. The source decoder for the code constructs an identical copy of the dictionary at the receiving end of the communication system and decodes the received sequence in step with the transmitted data sequence.

Page 57: DC 3 SourceCoding

WITS Lab, NSYSU.57

3.3.3 The Lempel-Ziv AlgorithmOperation of Lempel-Ziv algorithm (cont.)

As the sequence is increased in length, the encoding procedure becomes more efficient and results in a compressed sequence at the output of the source.No matter how large the table is, it will eventually overflow.To solve the overflow problem, the source encoder and decoder must use an identical procedure to remove phrases from the dictionaries that are not useful and substitute new phrases in their place.Lempel-Ziv algorithm is widely used in the compression of computer files.

E.g. “compress” and “uncompress” utilities under the UNIX© OS.

Page 58: DC 3 SourceCoding

WITS Lab, NSYSU.58

3.4 Coding for Analog Sources – Optimum Quantization

An analog source emits a message waveform x(t) that is a sample function of a stochastic process X(t).When X(t) is a band-limited, stationary stochastic process, the sampling theorem allows us to represent X(t) by a sequence of uniform samples take at the Nyqist rate.The samples are then quantized in amplitude and encoded.Quantization of the amplitudes of the sampled signal results in data compression, but it also introduces some distortion of the waveform or a loss of signal fidelity.

Page 59: DC 3 SourceCoding

WITS Lab, NSYSU.59

3.4.1 Rate-Distortion FunctionDistortion is introduced when the samples from the information source are quantized to a fixed number of bits.Squared-error distortion:

Distortion of the general form:( ) ( )2

, k kk kd x x x x= −

( ),p

k kkd x x x x= −

( ) ( )1

The distortion between a sequence of samples and the

corresponding quantized values is the average over the source output samples, i.e.,

1 X ,X ,

n

n

n

n kn kk

n X

n X n

d d x xn =

= ∑

Page 60: DC 3 SourceCoding

WITS Lab, NSYSU.60

3.4.1 Rate-Distortion Function

The minimum rate in bits per source output that is required to represent the output X of the memoryless source with a distortion less than or equal to D is called the rate-distortion function R(D) and is defined as:

( )

( ) ( ) ( )1

, is a random variable and its expected value is defined

as the distortion , i.e.,1 , , ,

nn

n

n kn kk

d X X

D

D E d X X E d x x E d x xn =

⎡ ⎤ ⎡ ⎤ ⎡ ⎤= = =⎣ ⎦ ⎣ ⎦ ⎣ ⎦∑

( )( ) ( )

( )( )

( )

| : , min ;

where ; is the average mutual information between

and . Note that decreases as increases.

p x x E d X X DR D I X X

I X X

X X R D D

⎡ ⎤≤⎣ ⎦

=

Stationary Process

Page 61: DC 3 SourceCoding

WITS Lab, NSYSU.61

3.4.1 Rate-Distortion Function

Theorem: Rate-distortion function for a memorylessGaussian source (Shannon 1959)

The minimum information rate necessary to represent the output of a discrete-time, continuous-amplitude memorylessGaussian source based on a mean-square-error distortion measure per symbol (single letter distortion measure) is:

( )( )

( )

22

2

2

2

1 log 02

0

where is the variance of the Gaussian source output.

xx

g

x

x

DDR DD

σ σ

σ

σ

⎧ ⎛ ⎞ ≤ ≤⎜ ⎟⎪ ⎝ ⎠= ⎨⎪ >⎩

Page 62: DC 3 SourceCoding

WITS Lab, NSYSU.62

3.4.1 Rate-Distortion Function

Rate-distortion function for a memoryless Gaussian source

2

No information need be transm-itted when the distortion .xD σ≥

2 can be obtained by usingzeros in the reconstruction of thesignal.

xD σ=

2

2

For we can use statistic-ally independent, zero-meanGaussian noise samples with a variance of - for thereconstruction.

x

x

D

D

σ

σ

>

Page 63: DC 3 SourceCoding

WITS Lab, NSYSU.63

3.4.1 Rate-Distortion Function

Theorem: Source coding with a distortion measure (Shannon 1959)There exists an encoding scheme that maps the source output into code words such that for any given distortion D, the minimum rate R(D) bits per symbol (sample) is sufficient to reconstruct the source output with an average distortion that isarbitrarily close to D.

It is clear that the rate-distortion function R(D) for any source represents a lower bound on the source rate that is possible for a given level of distortion.Distortion-rate function for the discrete-time, memorylessGaussian is (from Equation 3.4-6):

( ) ( )2 2 210 102 or 10 log 6 10log [dB]R

g x g xD R D R Rσ σ−= = − +

Page 64: DC 3 SourceCoding

WITS Lab, NSYSU.64

3.4.1 Rate-Distortion Function

Theorem: Upper Bound on R(D)The rate-distortion function of a memoryless, continuous-amplitude source with zero mean and finite variance σ2

x with respect to the mean-square-error distortion measure is upper-bounded as:

The theorem implies that the Gaussian source requires the maximum rate among all other sources for a specified level of mean-square-error distortion.The rate distortion R(D) of any continuous-amplitude, memoryless source with zero mean and finite variance σ2

xsatisfies the condition R(D) ≤Rg(D).

( )2

22

1 log , 02

xxR D D

Dσ σ≤ ≤ ≤

Page 65: DC 3 SourceCoding

WITS Lab, NSYSU.65

The distortion-rate function of the same source satisfies the condition:The lower bound on the rate-distortion function exists and is called the Shannon lower bound for a mean-square-error distortion measure:

where H(X) is the differential entropy of the continuous-amplitude, memoryless source. The distortion-rate function is:

For any continuous-amplitude, memoryless source:

( ) ( ) 2 2 2 Rg xD R D R σ−≤ =

( ) ( )*2

1 log 22

R D H X eDπ= −

( ) ( )2* 1 22

R H XD Reπ

− −⎡ ⎤⎣ ⎦=

( ) ( ) ( ) ( ) ( ) ( )* * and g gR D R D R D D R D R D R≤ ≤ ≤ ≤

3.4.1 Rate-Distortion Function

Page 66: DC 3 SourceCoding

WITS Lab, NSYSU.66

The differential entropy of the memoryless Gaussian source is:

By setting σ2x =1, we obtain from Equation 3.4-12:

The differential entropy H(X) is upper-bounded by Hg(X) (shown by Shannon 1948).

( ) ( ) ( )2 *2

1 log 2 2g x gH X e R D R Dπ σ= ⇒ =

( ) ( ) ( )*1010 log 6 6 gD R R H X H X⎡ ⎤= − − −⎣ ⎦

( )( ) ( ) ( )

( ) ( )

10 *

*

10log 6

6

gg

g

D RH X H X dB

D R

R D R D dB

⎡ ⎤= −⎣ ⎦

⎡ ⎤= −⎣ ⎦

3.4.1 Rate-Distortion Function

Page 67: DC 3 SourceCoding

WITS Lab, NSYSU.67

3.4.1 Rate-Distortion Function

Differential entropies and rate-distortion comparisons of four common PDFs for signal models

( ) ( )( ) ( )

( )( ) ( )( )

( )

( )

( )

( )

2 2

* *

/ 2 22

22

2 / 2 22

43 / 2 0.423 2

2

PDFbits/sample dB

1 1Gaussian log 2 0 022

1 1Uniform , 3 log 12 0.255 1.5322 3

1 1Laplacian log 2 0.104 0.6222

3 1Gamma log 4 / 3 0.709 4.2528

x

x

x

g g

xx

x

x xx

xx

x

xx

x

R D R D D R D Rp x H x

e e

x

e e

e ex

σ

σ

σ

π σπσ

σ σσ

σσ

π σπσ

− −

Page 68: DC 3 SourceCoding

WITS Lab, NSYSU.68

Consider a band-limited Gaussian source with spectral density:

When the output of this source is sampled at the Nyquist rate, the samples are uncorrelated and, since the source is Gaussian, they are also statistically independent.The equivalent discrete-time Gaussian source is memoryless.The rate-distortion function in bits/s is:

The distortion-rate function is:

( ) ( )( )

2

20

X f WWff W

σ⎧ ≤⎪Φ = ⎨⎪ >⎩

( )2

22log 0X

g xR D W DDσ σ= ≤ ≤

( ) 22R

Wg XD R σ

−=

3.4.1 Rate-Distortion Function

Page 69: DC 3 SourceCoding

WITS Lab, NSYSU.69

3.4.2 Scalar QuantizationIn source encoding, the quantizer can be optimized if we know the PDF of the signal amplitude at the input to the quantizer.Suppose that the sequence {xn} at the input to the quantizer has a PDF p(x) and let L=2R be the desired number of levels. Design the optimum scalar quantizer that minimizes some function of the quantization error q= -x, where is the quantized value of x.f( -x) denotes the desired function of the error. Then, the distortion resulting from quantization of the signal amplitude is:

Lloyd-Max quantizer: an optimum quantizer that minimizes Dby optimally selecting the output levels and the corresponding input range of each output level.

xx

( ) ( )D f x x p x dx∞

−∞= −∫

x

Page 70: DC 3 SourceCoding

WITS Lab, NSYSU.70

For a uniform quantizer, the output levels are specified as k= (2k-1)Δ/2, corresponding to an input signal amplitude in the range (k-1)Δ≤x<kΔ, where Δ is the step size.When the uniform quantizer is symmetric with an even number of levels, the average distortion may be expressed as:

The minimization of D is carried out with respect to the step-size.

x

( ) ( )

( )( )

( )

( ) ( )

12

11

12

1 2 2 12

1 2 12

L

k

kk

L

D f x x p x dx

f k x p x dx

f L x p x dx

−∞

−∆

− ∆=

⎛ ⎞− ∆⎜ ⎟⎝ ⎠

= −

⎛ ⎞= − ∆ −⎜ ⎟⎝ ⎠⎛ ⎞+ − ∆ −⎜ ⎟⎝ ⎠

∑∫

3.4.2 Scalar Quantization

Page 71: DC 3 SourceCoding

WITS Lab, NSYSU.71

By differentiating D with respect to Δ, we obtain:

For mean-square-error criterion, for which f(x)=x2:

( ) ( )( )

( )

( ) ( ) ( )

12

11

'

12

12 1 2 12

1 1 1 02

L

k

kk

L

k f k x p x dx

L f L x p x dx

−∆

− ∆=

⎛ ⎞− − ∆⎜ ⎟⎝ ⎠

⎛ ⎞− − ∆ −⎜ ⎟⎝ ⎠

⎛ ⎞+ − − ∆ − =⎜ ⎟⎝ ⎠

∑ ∫

3.4.2 Scalar Quantization

Page 72: DC 3 SourceCoding

WITS Lab, NSYSU.72

The distortion can be reduced further by using non-uniform quantizer.Let the output level be = k when the input signal amplitude is in the range xk-1≤x<xk with end points are x0=-∞ and xL=∞. By optimally selecting the { } and {xk}, we can minimize the distortion:

Differentiating D with respect to the {xk} and { }, we obtain:

x x

kx

( ) ( )11

k

k

L xk

xk

D f x x p x dx−=

= −∑∫

kx( ) ( )! 1, 2,..., 1k kk kf x x f x x k L+− = − = −

( ) ( )1

' 1, 2,...,k

k

xk

xf x x p x dx k L

− =∫

3.4.2 Scalar Quantization

Page 73: DC 3 SourceCoding

WITS Lab, NSYSU.73

For f(x)=x2:

The difference in the performance of the uniform and non-uniform quantizers is relatively small for small values of R, but it increases as R increases.

( )11 1, 2,..., 12

k kkx x x k L+= + = −

( ) ( )1

1, 2,...,k

k

xk

xx x p x dx k L

− =∫

3.4.2 Scalar Quantization

Page 74: DC 3 SourceCoding

WITS Lab, NSYSU.74

3.4.2 Scalar Quantization

Optimum eight-level quantizer for a Gaussian random variable.

Page 75: DC 3 SourceCoding

WITS Lab, NSYSU.75

3.4.2 Scalar Quantization

Optimum eight-level quantizer for a Gaussian random variable.

Page 76: DC 3 SourceCoding

WITS Lab, NSYSU.76

3.4.2 Scalar Quantization

Comparison of optimum uniform and nonuniform quantizersfor a Gaussian random variable.

Page 77: DC 3 SourceCoding

WITS Lab, NSYSU.77

Distortion versus rate curves for discrete-time memorylessGaussian source

3.4.2 Scalar Quantization

Page 78: DC 3 SourceCoding

WITS Lab, NSYSU.78

Since any quantizer reduces a continuous amplitude source into a discrete amplitude source, we may treat the discrete amplitudeas letters, say , with associated probabilities {pk}. If the signal amplitudes are statistically independent, the discrete source is memoryless and its entropy is:

{ },1kX x k L= ≤ ≤

x

( ) 21

logL

k kk

H X p p=

= −∑

3.4.2 Scalar Quantization

Page 79: DC 3 SourceCoding

WITS Lab, NSYSU.79

Conclusions:The quantizer can be optimized when the PDF of the continuous source output is known.The optimum quantizer of L=2R levels results in a minimum distortion of D(R), where R=log2L bits per sample.This distortion can be achieved by simply representing each quantized sample by R bits, though more efficient encoding is possible since the discrete source output that results from quantization is characterized by a set of probabilities that can be used to design efficient variable-length codes for the source output (entropy coding).

3.4.2 Scalar Quantization

Page 80: DC 3 SourceCoding

WITS Lab, NSYSU.80

3.4.3 Vector Quantization

The joint quantization of a block of signal samples or a block of signal parameters is called block or vector quantization.Vector quantization is widely used in speech coding for digital cellular systems.Even if the continuous-amplitude source is memoryless, quantizing vectors performs better than quantizing scalar.If the signal samples or signal parameters are statistically dependent, we can achieve an even greater efficiency.

[ ]{ }

( )

1 2

1 2

We have an -dimensional vector ... with real-valued,

continuous-amplitude components ,1 and joint PDF

, ,..., . The vector is quantized into another -

dimensional vector with co

n

k

n

n X x x x

x k n

p x x x X n

X

=

≤ ≤

{ } ( )mponents ,1 : .kx k n X Q X≤ ≤ =

Page 81: DC 3 SourceCoding

WITS Lab, NSYSU.81

Vector quantization of blocks of data may be viewed as a pattern recognition problem involving the classification of blocks of data into a discrete number of categories or cells in a way that optimizes some fidelity criterion, such as mean-square-error distortion.Example of quantization in two-dimensional space.

3.4.3 Vector Quantization

Page 82: DC 3 SourceCoding

WITS Lab, NSYSU.82

The average distortion over the set of input vectors X is:

We can minimize D by selecting the cells {Ck, 1≤k≤L} for a given PDF p(X).A commonly used distortion measure for vector quantization is the mean square error (l2 norm) defined as:

Weighted mean square error:

( ) ( )

( ) ( ) ( )

1

1

, |

= ,k

L

kk kk

L

kk X Ck

D P X C E d X X X C

P X C d X X p X dX

=

∈=

⎡ ⎤= ∈ ∈⎣ ⎦

∑ ∫

( ) ( ) ( ) ( )' 2

21

1 1,n

kkk

d X X X X X X x xn n =

= − − = −∑

( ) ( ) ( )'

2 ,Wd X X X X W X X= − −

3.4.3 Vector Quantization

Page 83: DC 3 SourceCoding

WITS Lab, NSYSU.83

W is a positive-definite weighting matrix and is usually selected to be the inverse of the covariance matrix of the inputdata vector X.lp norm is defined as:

Two conditions for the partitioning of the n-dimensional space into L cells so that the average distortion is minimized.

Nearest-neighbor selection rule:

Each output vector be chosen to minimize the average distortion in cell Ck:

( )1

1,pn

kp kk

d X X x xn =

= −∑

( ) ( ), , , , 1k jd X X d X X k j j L≤ ≠ ≤ ≤

( ) ( ) ( ), | ,

The that minimizes is called the centroid of the cell.k

k k X C

k k

D E d X X X C d X X p X dX

X D∈

⎡ ⎤= ∈ =⎣ ⎦ ∫

3.4.3 Vector Quantization

Page 84: DC 3 SourceCoding

WITS Lab, NSYSU.84

In general, we expect the code vectors to be closer together in regions where the joint PDF is large and farther apart in regions where p(X) is small.The distortion per dimension is defined as:

The vectors can be transmitted at an average bit rate of:

( ) ( )2

1

1,n

kkk

d X X x xn =

= −∑

( ) bits per sample

H XR

n=

( )( ) ( ) ( )2

1

is the entropy of the quantized source output defined as

logL

i ii

H X

H X p X p X=

= −∑

3.4.3 Vector Quantization

Page 85: DC 3 SourceCoding

WITS Lab, NSYSU.85

For a given average rate R, the minimum achievable distortion Dn(R) is:

The distortion-rate function can be approached arbitrarily closely by increasing the size n of the vectors.The development above is predicated on the assumption that the joint PDF p(X) of the data vector is known. However, the joint PDF p(X) of the data may not be known.It is possible to select the quantized output vectors adaptivelyfrom a set of training vectors X(m).

( )( ) ( )

( ) ( )

min ,

lim

n Q X

nn

D R E d X X

D R D R→∞

⎡ ⎤= ⎣ ⎦

=

3.4.3 Vector Quantization

Page 86: DC 3 SourceCoding

WITS Lab, NSYSU.86

K-Means Algorithm

( )( ){ }

{ }( )

Initialize by setting the iteration number 0. Choose a set of

output vectors 0 ,1 .

Classify the training vectors ,1 into the

clusters by aplying the nearest-neighbor rule:

iff

k

k

k

i

X k L

X m m M

C

X C i d

=

≤ ≤

≤ ≤

∈ ( )( ) ( )( )

( ) ( )

, , for all

Recompute (set to 1) the output vectors of every cluster bycomputing the centroid:

1 , 1

of the training vectors that fall in each cluster.k

k j

kx Ck

X X i d X X i k j

i i

X i X m k LM ∈

≤ ≠

+

= ≤ ≤∑

( ) ( )

Also, computethe resulting average distortion ( ) at the th iteration.Terminate the test if the change -1 in the averagedistortion is relatively small. Otherwise, go to step 2.

D i iD i D i−

Step 1

Step 2

Step 3

Step 4

3.4.3 Vector Quantization

Page 87: DC 3 SourceCoding

WITS Lab, NSYSU.87

The K-means algorithm converges to a local minimum.By beginning the algorithm with different sets of initial outputvectors and each time performing the optimization described in the K-mean algorithm, it is possible to find a global optimum.Once we have selected the output vectors, we have established what is called a code book.If the computation involves evaluating the distance between X(m) and each of the L possible output vectors, the procedure constitutes a full search.If we assume that each computation requires n multiplications and additions, the computational requirement for a full search is C=nL multiplication and additions per input vector.

3.4.3 Vector Quantization

Page 88: DC 3 SourceCoding

WITS Lab, NSYSU.88

If we select L to be a power of 2, then log2L is the number of bits required to represent each vector. If Rdenotes the bit rate per sample, we have nR=log2Land the computational cost is C=n2nR.The computational cost associated with a full search can be reduced by constructing the code book based on a binary tree search. Uniform tree for binary search

vector quantization.

3.4.3 Vector Quantization

Page 89: DC 3 SourceCoding

WITS Lab, NSYSU.89

The computational cost of the binary tree search is C=2nlog2L=2n2R.Although the computational cost has been significantly reduced, the memory required to store the (centroid) vectors has increased from nL to approximately 2nL, due to the fact that we now have to store the vectors at the intermediate nodes in addition to the vectors at the terminal nodes.The binary tree search algorithm generates a uniform tree and the resulting code will be sub-optimum in the sense that the code words result in more distortion compared to the code words generated by the method corresponding to a full search.A code book resulting in lower distortion is obtained by subdividing the cluster of test vectors having the largest totaldistortion at each step.

3.4.3 Vector Quantization

Page 90: DC 3 SourceCoding

WITS Lab, NSYSU.90

Non-uniform tree for binary search vector quantization

3.4.3 Vector Quantization

Page 91: DC 3 SourceCoding

WITS Lab, NSYSU.91

Example 3.4-1: Let x1 and x2 be two random variables with a uniform joint PDF:

( ) ( ) ( )

( )1 2

1 X C ,

0 otherwisep x x p X ab

⎧ ∈⎪≡ = ⎨⎪⎩

3.4.3 Vector Quantization

Page 92: DC 3 SourceCoding

WITS Lab, NSYSU.92

Example 3.4-1 (cont.)If we quantize x1 and x2 separately by using uniform intervals of length Δ, the number of levels needed is:

The number of bits needed for coding the vector X=[x1x2] is:

Scalar quantization of each component is equivalent to vector quantization with the total number of levels:

1 2 2a bL L +

= =∆

( )1 2 2 1 2 2

2

2 2

log log

log2

x

x

R R R L L

a bR

= + = +

+=

( )2

1 2 22x

a bL L L

+= =

3.4.3 Vector Quantization

Page 93: DC 3 SourceCoding

WITS Lab, NSYSU.93

Example 3.4-1 (cont.)This approach is equivalent to covering the large square that encloses the rectangle by square cells, where each cell represents one of the Lx quantized regions.This encoding is wasteful and results in an increase of the bit rate.If we were to cover only the region for which p(X) >0 with squares having area Δ2, the total number of levels that will result is the area of the rectangle divided by Δ2, i.e.,

The difference in bit rate between the scalar and vector quantization method is:

'2 x

abL =∆

( )2'

2 log2x x

a bR R

ab+

− =

3.4.3 Vector Quantization

Page 94: DC 3 SourceCoding

WITS Lab, NSYSU.94

Example 3.4-1 (cont.)A linear transformation (rotation by 45 degrees) will de-correlate x1 and x2 and render the two random variables statistically independent. Then scalar quantization and vector quantization achieve the same efficiency.Vector quantization will always equal or exceed the performance of scalar quantization.Vector quantization has been applied to several types of speech encoding methods including both waveform and model-based methods.

3.4.3 Vector Quantization

Page 95: DC 3 SourceCoding

WITS Lab, NSYSU.95

3.5 Coding Techniques for Analog Sources

Three types of analog source encoding methodsTemporal waveform coding : the source encoder is designed to represent digitally the temporal characteristics of the source waveform.Spectral waveform coding : the signal waveform is usually subdivided into different frequency bands, and either the time waveform in each band or its spectral characteristics are encoded for transmission.Model-based coding : based on a mathematical model of the source.

Page 96: DC 3 SourceCoding

WITS Lab, NSYSU.96

3.5.1 Temporal Waveform Coding

Pulse-code modulation (PCM)Let x(t) denote a sample function emitted by a source and let xn denote the samples taken at a sampling rate fs≥2W, where W is the highest frequency in the spectrum of x(t).In PCM, each sample of the signal is quantized to one of 2R

amplitude levels, where R is the number of binary digits used to represent each sample.The quantization process may be modeled mathematically as:

where qn represents the quantization error, which we treat as an additive noise.

n n nx x q= +

Page 97: DC 3 SourceCoding

WITS Lab, NSYSU.97

Pulse-code modulation (PCM)For a uniform quantizer, the quantization noise is well characterized statistically by the uniform PDF:

Mean square value of thequantization error is:

( ) -1 1 1, , 22 2

Rp q q= − ∆ ≤ ≤ ∆ ∆ =∆

( )2 2 21 1 212 12

RE q −= ∆ = ×

3.5.1 Temporal Waveform Coding

Page 98: DC 3 SourceCoding

WITS Lab, NSYSU.98

Pulse-code modulation (PCM)Many source signals such as speech waveforms have the characteristic that small signal amplitudes occur more frequently than large ones.A better approach is to employ a non-uniform quantizer.A non-uniform quantizer characteristic is usually obtained by passing the signal through a non-linear device that compresses the signal amplitude, followed by a uniform quantizer.In the reconstruction of the signal from the quantized values, the inverse logarithmic relation is used to expand the signal amplitude.The combined compressor-expandor pair is termed as a compandor.

3.5.1 Temporal Waveform Coding

Page 99: DC 3 SourceCoding

WITS Lab, NSYSU.99

Pulse-code modulation (PCM)In North America: μ-law compression:

In Europe: A-Law compression:

maxmax

log [1 ( / )]sgn

log (1 )1 for 0

sgn 1 for 0

e

e

x xy y x

xx

x

µµ

+= ⋅

+

+ ≥⎧= ⎨− <⎩

⎪⎪⎩

⎪⎪⎨

≤<⋅+

+

≤<⋅+=

11 sgnlog1

)]/([log1

10 sgnlog1

)/(

max

maxmax

max

maxmax

xx

Ax

AxxA

y

Axx

xA

xxAy

y

e

e

e

3.5.1 Temporal Waveform Coding

Page 100: DC 3 SourceCoding

WITS Lab, NSYSU.100

Pulse-code modulation (PCM)Standard values of μ is 255 and A is 87.6.

3.5.1 Temporal Waveform Coding

μ-law characteristic A-law characteristic

Page 101: DC 3 SourceCoding

WITS Lab, NSYSU.101

Differential pulse-code modulation (DPCM)Most source signals sampled at the Nyquist rate or faster exhibit significant correlation between successive samples.An encoding scheme that exploits the redundancy in the samples will result in a lower bit rate for the source output.A relatively simple solution is to encode the differences between successive samples rather than the samples themselves.Since differences between samples are expected to be smaller than the actual sampled amplitudes, fewer bits are required to represent the differences.A refinement of this general approach is to predict the current sample based on the previous p samples.

3.5.1 Temporal Waveform Coding

Page 102: DC 3 SourceCoding

WITS Lab, NSYSU.102

Differential pulse-code modulation (DPCM)Let xn denote the current samples from the source and the predicted value of xn is defined as:

The {ai} are selected to minimize some function of the error.A mathematically and practically convenient error function is the mean square error (MSE):

1

p

n i n ii

x a x∧

−=

= ∑

( )

( ) ( ) ( )

22

1

2

1 1 12

p

p n n i n ii

p p p

n i n n i i j n i n ji i j

E e E x a x

E x a E x x a a E x x

ε −=

− − −= = =

⎡ ⎤⎛ ⎞= = −⎢ ⎥⎜ ⎟

⎢ ⎥⎝ ⎠⎣ ⎦

= − +

∑ ∑∑

3.5.1 Temporal Waveform Coding

Page 103: DC 3 SourceCoding

WITS Lab, NSYSU.103

Differential pulse-code modulation (DPCM)If the source output is wide-sense stationary, we have:

To minimize εp, we need to solve the linear equations, called the normal equations or the Yule-Walker equations:

When the autocorrelation function φ(n) is not known a priori, it may be estimated from the samples {xn} using the relation:

( ) ( ) ( )1 1 1

0 2p p p

p i i ji i j

a i a a i jε φ φ φ= = =

= − + −∑ ∑∑

( ) ( )1

, 1, 2,...p

ii

a i j j j pφ φ=

− = =∑

( )1

1 , 0,1, 2,...,N n

i i ni

n x x n pNφ

∧ −

+=

= =∑

3.5.1 Temporal Waveform Coding

Page 104: DC 3 SourceCoding

WITS Lab, NSYSU.104

Differential pulse-code modulation (DPCM)Block diagram of a DPCM encoder (a) and decoder (b).

3.5.1 Temporal Waveform Coding

Page 105: DC 3 SourceCoding

WITS Lab, NSYSU.105

Differential pulse-code modulation (DPCM)For the DPCM encoder, the output of the predictor is:

Input to the quantizer is the difference:

Each value of the quantized prediction error is encoded into a sequence of binary digits and transmitted over the channel to the destination.At the destination, the same predictor that was used at the transmitting end is synthesized.

1

p

n n iii

x a x −

=

= ∑

nn ne x x= −

3.5.1 Temporal Waveform Coding

Page 106: DC 3 SourceCoding

WITS Lab, NSYSU.106

Differential pulse-code modulation (DPCM)The use of feedback around the quantizer ensures that the error in is simply the quantization error and that there is no accumulation of previous quantization errors in the implementation of the decoder. That is:

This means that the quantized sample differs from the input xn by the quantization error qn independent of the predictor used.Therefore, the quantization errors do not accumulate.

nx n n nq e e= −

( )

n n n nn n n n

n n n

q e e e x x x x

x x q

= − = − − = −

⇒ = +nx

3.5.1 Temporal Waveform Coding

Page 107: DC 3 SourceCoding

WITS Lab, NSYSU.107

Differential pulse-code modulation (DPCM)An improvement in the quality of the estimate is obtained by including linearly filtered past values of the quantized error.The estimate may be expressed as:

where {bi} are the coefficients of the filter for the quantized error sequence.The two sets of coefficients {ai} and {bi} are selected to minimize some function of the error en, such as the mean square error.

1 1

p m

n n i n ii ii i

x a x b e− −

= =

= +∑ ∑

3.5.1 Temporal Waveform Coding

Page 108: DC 3 SourceCoding

WITS Lab, NSYSU.108

DPCM modified by the addition of linearly filtered error sequence.

3.5.1 Temporal Waveform Coding

Page 109: DC 3 SourceCoding

WITS Lab, NSYSU.109

Adaptive PCM and DPCMMany real sources are quasi-stationary in nature.One aspect of the quasi-stationary characteristic is that the variance and the autocorrelation function of the source output vary slowly with time.PCM and DPCM encoders are designed on the basis that the source output is stationary.The efficiency and performance of these encoders can be improved by having them adapt to the slowly time variant statistics of the source.One improvement of PCM and DPCM that reduces the dynamic range of the quantization noise is the use of an adaptive quantizer.

3.5.1 Temporal Waveform Coding

Page 110: DC 3 SourceCoding

WITS Lab, NSYSU.110

Adaptive PCM and DPCMA relatively simple method is to use a uniform quantizer that varies its step size in accordance with the variance of the pastsignal samples.For example, a short-term running estimate of the variance of xn can be computed from the input sequence {xn} and the step size can be adjusted on the basis of such an estimate. Such an algorithm has been successfully used by Jayant in the encoding of speech signals.The step size is adjusted recursively according to:

where M(n) is a factor, whose value depends on the quantizer level for the sample and Δn is the step size.

( )1n nM n+∆ = ∆

3.5.1 Temporal Waveform Coding

Page 111: DC 3 SourceCoding

WITS Lab, NSYSU.111

A 3-bit quantizer with an adaptive step size.

3.5.1 Temporal Waveform Coding

Page 112: DC 3 SourceCoding

WITS Lab, NSYSU.112

Multiplication factors for adaptive step size adjustment

0.800.800.800.801.201.602.002.40

0.900.900.900.901.201.602.002.40

0.900.901.251.70

0.801.60

0.851.001.001.50

0.602.20

M(1)M(2)M(3)M(4)M(5)M(6)M(7)M(8)

2 3 4 2 3 4

PCM DPCM

3.5.1 Temporal Waveform Coding

Page 113: DC 3 SourceCoding

WITS Lab, NSYSU.113

Delta modulation (DM)Delta modulation may be viewed as a simplified form of DPCM in which a two-level (1-bit) quantizer is used in conjunction with a fixed first-order predictor.

3.5.1 Temporal Waveform Coding

Page 114: DC 3 SourceCoding

WITS Lab, NSYSU.114

Delta modulation (DM)

The estimated (predicted) value of xn is really the previous sample xn-1 modified by the quantization noise qn-1.An equivalent realization of the one-step predictor is an accumulator with an input equal to the quantized error signal .

( )( )

1 1 1

1 1 1 11 1 1 1

n n n n

n n nn n n

n n n n nn n n n

x x x e

q e e e x x

x x e q e x e x q

− − −

− − − −− − − −

= = +

= − = − −

= + = − + + = +

ne

3.5.1 Temporal Waveform Coding

Page 115: DC 3 SourceCoding

WITS Lab, NSYSU.115

Delta modulation (DM)In general, the quantized error signal is scaled by some value, say Δ1, which is called the step size.The encoder shown in the previous figure approximates a waveform x(t) by a linear staircase function.In order for the approximation to be relatively good, the waveform must change slowly relative to the sampling rate.The sampling rate must be several (a factor of at least 5) timesthe Nyquist rate.Two types of distortion:

Slope-overload distortion: Δ1 too small.Granular noise: Δ1 too large.

3.5.1 Temporal Waveform Coding

Page 116: DC 3 SourceCoding

WITS Lab, NSYSU.116

Delta modulation (DM)Two types of distortion

3.5.1 Temporal Waveform Coding

Page 117: DC 3 SourceCoding

WITS Lab, NSYSU.117

Delta modulation (DM)Even when Δ1 is optimized to minimize the total mean square value of the slope-overload distortion and the granular noise, the performance of the DM encoder may still be less than satisfactory.An alternative solution is to employ a variable step size that adapts itself to the short-term characteristics of the source signal.

3.5.1 Temporal Waveform Coding

Page 118: DC 3 SourceCoding

WITS Lab, NSYSU.118

Delta modulation (DM)Jayant devised a simple rule in 1970 to adaptively vary the step size according to:

where k≥1 is a constant that is selected to minimize the total distortion.

1.1 , 1, 2,...n ne e

n n K n−

−∆ = ∆ =

3.5.1 Temporal Waveform Coding

Page 119: DC 3 SourceCoding

WITS Lab, NSYSU.119

Delta Modulation (DM)An example of a delta modulation with adaptive step size.

3.5.1 Temporal Waveform Coding

Page 120: DC 3 SourceCoding

WITS Lab, NSYSU.120

Delta Modulation (DM)Continuously variable slope delta modulation (CVSD)

1 21 1

1 2

1 2

if , , and have the same sign. otherwise

where 0< <1 and k k >0.

n n nn n

n n

k e e ek

αα

α

− −−

∆ = ∆ +

∆ = ∆ =

3.5.1 Temporal Waveform Coding

Page 121: DC 3 SourceCoding

WITS Lab, NSYSU.121

3.5.2 Spectral Waveform CodingSubband coding (SBC)

In SBC of speech and image signals, the signal is divided into a small number of subbands and the time waveform in each subband is encoded separately.Example: Speech Coding:

In speech coding, the lower-frequency bands contain most of the spectral energy in voiced speech.Quantization noise is more noticeable to the ear in the lower-frequency bands.More bits are used for the lower-band signals and fewer are used for the higher-frequency bands.

Filter design is particularly important in achieving good performance in SBC.

Page 122: DC 3 SourceCoding

WITS Lab, NSYSU.122

3.5.2 Spectral Waveform CodingAdaptive Transform Coding (ATC)

In ATC, the source signal is sampled and subdivided into frames of Nf samples, and the data in each frame is transformed into the spectral domain for coding and transmission.At the source decoder, each frame of spectral samples is transformed back into the time domain and the signal is synthesized from the time-domain samples and passed through a digital-to-analog (D/A) converter.To achieve coding efficiency, we assign more bits to the more important spectral coefficients and fewer bits to the less important spectral coefficients.

Page 123: DC 3 SourceCoding

WITS Lab, NSYSU.123

3.5.3 Model-Based Source Coding

Source is modeled as a linear system (filter) that, when excited by an appropriate input signal, results in the observed source output.Instead of transmitting the samples of the source waveform to the receiver, the parameters of the linear system are transmitted along with an appropriate excitation signal.If the number of parameters is sufficiently small, the model-based methods provide a large compression of the data.

Page 124: DC 3 SourceCoding

WITS Lab, NSYSU.124

3.5.3 Model-Based Source Coding

Linear Predictive Coding (LPC)The sampled sequence, denoted by xn, n=0,1,…,N-1, is assumed to have been generated by an all-pole (discrete-time) filter having the transfer function:

Suppose that the input sequence is denoted by vn, n=0,1,2,…. The output sequence of the all-pole model satisfies the difference equation:

This equation is not true in general.

( )

1

1p

kk

k

GH za z−

=

=−∑

1, 0,1, 2,...

p

n k n k nk

x a x Gv n−=

= + =∑

Page 125: DC 3 SourceCoding

WITS Lab, NSYSU.125

Linear predictive coding (LPC)If the input is a white-noise sequence or an impulse, we may form an estimate (or prediction) of xn by the weighted linear combination:

The error between the observed value xn and the estimated (predicted) value .

The filter coefficients {ak} can be selected to minimize the mean square value of this error.

1

, 0p

n k n kk

x a x n−=

= >∑

nx

1

p

nn n n k n kk

e x x x a x −=

= − = −∑

3.5.3 Model-Based Source Coding

Page 126: DC 3 SourceCoding

WITS Lab, NSYSU.126

Linear predictive coding (LPC)Suppose that the input {vn} is a white-noise sequence. Then, the filter output xn is a random sequence and so is the difference en. The ensemble average of the squared error is:

To specify the filter H(z), we must determine the filter gain G.

( )

( ) ( ) ( )

22

1

p p

1 k=1 m=1 0 2 k +

p

p n n k n kk

p

kk

E e E x a x

a k m

ε

φ φ φ

−=

=

⎡ ⎤⎛ ⎞= = −⎢ ⎥⎜ ⎟

⎢ ⎥⎝ ⎠⎣ ⎦

= − −

∑ ∑∑

( ) ( )2

2 2 2 2

1

p

n n n k n k pk

E Gv G E v G E x a x ε−=

⎡ ⎤⎛ ⎞⎡ ⎤ = = = − =⎢ ⎥⎜ ⎟⎣ ⎦ ⎢ ⎥⎝ ⎠⎣ ⎦∑

3.5.3 Model-Based Source Coding

Page 127: DC 3 SourceCoding

WITS Lab, NSYSU.127

Linear predictive coding (LPC)Hence, G2 simplifies to:

( ) ( )2

10 k

p

p kk

G aε φ φ=

= = −∑

( ) ( )

In practice, we do not usually know a priori the trueautocorrelation function of the source output. Hence, in

place of , we substitute an estimate .n nφ φ

3.5.3 Model-Based Source Coding

Page 128: DC 3 SourceCoding

WITS Lab, NSYSU.128

Linear predictive coding (LPC)The Levinson-Durbin algorithm derived in Appendix A may be used to solve for the predictor coefficients {ak} recursively.

aik, k=1,2,…,i, are the coefficients of the ith-order predictor.

( ) ( )

( ) ( )( )

( )

1

11

1

1 1 ,

i i 1 11 0

, 2,3,....,

= 1 1

1= 1 0

0

i

i kk

iii

ik i k ii i i k

ii

i a i ka i p

a a a a k i

a a

φ φ

ε

φε ε ε φ

φ

−=

− − −

− −= =

− ≤ ≤ −

− = =

3.5.3 Model-Based Source Coding

Page 129: DC 3 SourceCoding

WITS Lab, NSYSU.129

Linear predictive coding (LPC)The desired coefficients for the predictor of order p are:

The residual MSE is:, 1, 2,...k pka a k p≡ =

( ) ( ) ( ) ( )2 2

1 1

0 k 0 1pp

k iik i

G a aε φ φ φ= =

= = − = −∑ ∏

1 1 0

The residual MSE , 1, 2,..., , forms a monotone

decreasing sequence, i.e., ... , and theprediction coefficients satisfy the condition: 1, 1, 2

i

p p

ii

ii

i p

aa i

ε

ε ε ε ε−

=

≤ ≤ ≤

< = ,...,The condition is necessary and sufficient for all the polesof ( ) to be inside the unit circle.

p

H z

3.5.3 Model-Based Source Coding

Page 130: DC 3 SourceCoding

WITS Lab, NSYSU.130

Linear predictive coding (LPC)LPC has been successfully used in the modeling of a speech source. In this case, the coefficients aii, i=1,2,..,p, are called reflection coefficients as a consequence of their correspondence to the reflection coefficients in the acoustic tube model of the vocal tract.Once the predictor coefficients and the gain G have been estimated from the source output {xn}, each parameter is coded into a sequence of binary digits and transmitted to the receiver.

3.5.3 Model-Based Source Coding

Page 131: DC 3 SourceCoding

WITS Lab, NSYSU.131

Linear predictive coding (LPC)Block diagram of a waveform synthesizer (source decoder) for an LPC system

3.5.3 Model-Based Source Coding

Page 132: DC 3 SourceCoding

WITS Lab, NSYSU.132

Linear predictive coding (LPC)The signal generator is used to produce the excitation function {vn}, which is scaled by G to produce the desired input to the all-pole filter model H(z) synthesized from the received prediction coefficient.The analog signal may be reconstructed by passing the output sequence from H(z) through an analog filter that basically performs the function of interpolating the signal between sample points.In this realization of the waveform synthesizer, the excitation function and the gain parameter must be transmitted along with the prediction coefficients to the receiver.

3.5.3 Model-Based Source Coding

Page 133: DC 3 SourceCoding

WITS Lab, NSYSU.133

Linear predictive coding (LPC)When the source output is stationary, the filter parameters need to be determined only once.Since most sources encountered in practice are at best quasi-stationary, it is necessary to periodically obtain new estimates of the filter coefficients, the gain G, and the type of excitation function, and to transmit these estimates to the receiver.

3.5.3 Model-Based Source Coding

Page 134: DC 3 SourceCoding

WITS Lab, NSYSU.134

Linear predictive coding (LPC)Example 3.5-1: Block diagram model of the generation of a speech signal.

3.5.3 Model-Based Source Coding

Page 135: DC 3 SourceCoding

WITS Lab, NSYSU.135

Linear predictive coding (LPC)Example 3.5-1 (cont.)

There are two mutually exclusive excitation functions to model voiced and unvoiced speech sounds.On a short-time basis, voiced speech is periodic with a fundamental frequency f0 or a pitch period 1/ f0 that depends on the speaker.Voiced speech is generated by exciting an all-pole filter model of the vocal tract by a periodic impulse train with a period equal to the desired pitch period.Unvoiced speech sounds are generated by exciting the all-pole filter model by the output of a random-noise generator.

3.5.3 Model-Based Source Coding

Page 136: DC 3 SourceCoding

WITS Lab, NSYSU.136

Linear predictive coding (LPC)Example 3.5-1 (cont.)

The speech encoder at the transmitter must determine the proper excitation function, the pitch period of voiced speech, the gain parameter G, and the prediction coefficients.Typically, the voiced and unvoiced information requires 1 bit, the pitch period is adequately represented by 6 bits, and the gain parameter may be represented by 5 bits after its dynamic range is compressed logarithmically.The prediction coefficients require 8-10 bits per coefficient for adequate representation.The bit rate from the source encoder is 4800-2400 bits/s.

3.5.3 Model-Based Source Coding

Page 137: DC 3 SourceCoding

WITS Lab, NSYSU.137

Linear predictive coding (LPC)When the reflection coefficients are transmitted to the decoder, it is not necessary to re-compute the prediction coefficients in order to realize the speech synthesizer.The synthesis is performed by realizing a lattice filter, which utilizes the reflection coefficients directly and which is equivalent to the linear prediction filter.

3.5.3 Model-Based Source Coding

Page 138: DC 3 SourceCoding

WITS Lab, NSYSU.138

Linear predictive coding (LPC)A more general source model is a linear filter that contains both poles and zeros. The source output xn satisfies the difference equation:

where vn is the input excitation sequence.

For speech coding, the model-based methods are generally called vocoders.

1 0

p q

n k n k k n ki k

x a x b v− −= =

= +∑ ∑

{ } { }

The MSE criterion applied to the minimization of the error

, where is an estimate of , results in a set ofnon-linear equations for the parameters and .

n nn n n

k k

e x x x xa b

= −

3.5.3 Model-Based Source Coding

Page 139: DC 3 SourceCoding

WITS Lab, NSYSU.139

Encoding techniques applied to speech signals

Encodingmethod

PCMLog PCMDPCMADPCMDMADM

LPC/CELP

Quantizer

LinearLogarithmicLogarithmicAdaptiveBinaryAdaptive binary

Coder

12 bits7-8 bits4-6 bits3-4 bits1 bit1 bit

Transmissionrate (bits/s)

96,00056,000-64,00032,000-48,00024,000-32,00032,000-64,00016,000-32,000

2400-9600

3.5.3 Model-Based Source Coding