[CSCI 6990-DC] 10: Differential Encodingcmliu/Courses/Compression/...Differential Encoding C.M. Liu...
Transcript of [CSCI 6990-DC] 10: Differential Encodingcmliu/Courses/Compression/...Differential Encoding C.M. Liu...
![Page 1: [CSCI 6990-DC] 10: Differential Encodingcmliu/Courses/Compression/...Differential Encoding C.M. Liu Perceptual Signal Processing Lab College of Computer Science National Chiao-Tung](https://reader034.fdocuments.us/reader034/viewer/2022042315/5f03225b7e708231d407b50f/html5/thumbnails/1.jpg)
Differential Encoding
C.M. LiuPerceptual Signal Processing Lab College of Computer ScienceNational Chiao-Tung University
Office: EC538(03)5731877
http://www.csie.nctu.edu.tw/~cmliu/Courses/Compression/
![Page 2: [CSCI 6990-DC] 10: Differential Encodingcmliu/Courses/Compression/...Differential Encoding C.M. Liu Perceptual Signal Processing Lab College of Computer Science National Chiao-Tung](https://reader034.fdocuments.us/reader034/viewer/2022042315/5f03225b7e708231d407b50f/html5/thumbnails/2.jpg)
Idea2
Reducing the dynamic range/variance of coded sequence by encoding sample differences
![Page 3: [CSCI 6990-DC] 10: Differential Encodingcmliu/Courses/Compression/...Differential Encoding C.M. Liu Perceptual Signal Processing Lab College of Computer Science National Chiao-Tung](https://reader034.fdocuments.us/reader034/viewer/2022042315/5f03225b7e708231d407b50f/html5/thumbnails/3.jpg)
Example Image Histogram3
99% ∈ [-31, 31] 5 bits/pixel (or less)
![Page 4: [CSCI 6990-DC] 10: Differential Encodingcmliu/Courses/Compression/...Differential Encoding C.M. Liu Perceptual Signal Processing Lab College of Computer Science National Chiao-Tung](https://reader034.fdocuments.us/reader034/viewer/2022042315/5f03225b7e708231d407b50f/html5/thumbnails/4.jpg)
Basic Algorithm4
Consider sequence:6.2 9.7 13.2 5.9 8 7.4 4.2 1.8
Differences:6.2 3.5 3.5 −7.3 2.1 −0.6 −3.2 −2.4
Lossless encodingSimply coding the difference is sufficient to recover original
Lossy encodingQuantizer: −6 -4 -2 0 2 4 6
Quantized sequence: 6 4 4 −6 2 0 −4 −2
‘Lossless’ reconstruction: 6 10 14 8 10 10 6 4
QE: 0.2 −0.3 −0.8 −2.1 −2 −2.6 −1.8 −2.2Observation:
QE seems to grow over time—is it a coincidence?
![Page 5: [CSCI 6990-DC] 10: Differential Encodingcmliu/Courses/Compression/...Differential Encoding C.M. Liu Perceptual Signal Processing Lab College of Computer Science National Chiao-Tung](https://reader034.fdocuments.us/reader034/viewer/2022042315/5f03225b7e708231d407b50f/html5/thumbnails/5.jpg)
Basic Algorithm (2)5
Consider: {xn} and dn = xn – xn-1
nnnn qddQd +== ][ˆ
001 ˆ,ˆˆˆ xxdxx nnn =+= −
011 xxd −=
1111 ][ˆ qddQd +==
11110001ˆˆ qxqdxdxx +=++=+=
122 xxd −=
2222 ][ˆ qddQd +==
212
2111212ˆˆ
qqxqdqxdxx
++=+++=+=
∑ =+=⇒
n
k knn qxx1
ˆ
![Page 6: [CSCI 6990-DC] 10: Differential Encodingcmliu/Courses/Compression/...Differential Encoding C.M. Liu Perceptual Signal Processing Lab College of Computer Science National Chiao-Tung](https://reader034.fdocuments.us/reader034/viewer/2022042315/5f03225b7e708231d407b50f/html5/thumbnails/6.jpg)
Basic Algorithm (3)6
Alternative coding: 1ˆ −−= nnn xxd
011 xxd −=
1111 ][ˆ qddQd +==
11110001ˆˆ qxqdxdxx +=++=+=
122 x̂xd −=
2222 ][ˆ qddQd +==
22221212 ˆˆˆˆ qxqdxdxx +=++=+=
nnn qxx +=⇒ ˆ
![Page 7: [CSCI 6990-DC] 10: Differential Encodingcmliu/Courses/Compression/...Differential Encoding C.M. Liu Perceptual Signal Processing Lab College of Computer Science National Chiao-Tung](https://reader034.fdocuments.us/reader034/viewer/2022042315/5f03225b7e708231d407b50f/html5/thumbnails/7.jpg)
Basic Algorithm: Example7
![Page 8: [CSCI 6990-DC] 10: Differential Encodingcmliu/Courses/Compression/...Differential Encoding C.M. Liu Perceptual Signal Processing Lab College of Computer Science National Chiao-Tung](https://reader034.fdocuments.us/reader034/viewer/2022042315/5f03225b7e708231d407b50f/html5/thumbnails/8.jpg)
Differential Encoding Scheme8
![Page 9: [CSCI 6990-DC] 10: Differential Encodingcmliu/Courses/Compression/...Differential Encoding C.M. Liu Perceptual Signal Processing Lab College of Computer Science National Chiao-Tung](https://reader034.fdocuments.us/reader034/viewer/2022042315/5f03225b7e708231d407b50f/html5/thumbnails/9.jpg)
Differential Pulse Code Modulation (DPCM)9
( )021 ˆ,,ˆ,ˆ xxxfp nnn K−−=
![Page 10: [CSCI 6990-DC] 10: Differential Encodingcmliu/Courses/Compression/...Differential Encoding C.M. Liu Perceptual Signal Processing Lab College of Computer Science National Chiao-Tung](https://reader034.fdocuments.us/reader034/viewer/2022042315/5f03225b7e708231d407b50f/html5/thumbnails/10.jpg)
Prediction in DPCM10
Choice of f (·) affects σd, however
( )[ ]22nnd pxE −=σ
nnn qxx +=ˆ where qn depends on the variance of dn
Dependencies:
( ) ( )⋅→→→⋅ fxf nd ˆ2σ
Fine Quantization Assumption:Granularity is fine enough so thatThus,
nn xx ≈ˆ
( )021 ,,, xxxfp nnn K−−=
![Page 11: [CSCI 6990-DC] 10: Differential Encodingcmliu/Courses/Compression/...Differential Encoding C.M. Liu Perceptual Signal Processing Lab College of Computer Science National Chiao-Tung](https://reader034.fdocuments.us/reader034/viewer/2022042315/5f03225b7e708231d407b50f/html5/thumbnails/11.jpg)
Linear Predictor11
N is caller order of the predictor∑= −=N
i inin xap1
ˆ
( ) ⎥⎦⎤⎢⎣⎡ −= ∑ = −
2
12 N
i inind xaxEσFind {ai}: minimize
( )[ ]
( )[ ] 02
02
1
2
111
2
=−−=∂∂
=−−=∂∂
−= −
−= −
∑
∑
NnN
i ininN
d
nN
i inind
xxaxEa
xxaxEa
σ
σ
M
![Page 12: [CSCI 6990-DC] 10: Differential Encodingcmliu/Courses/Compression/...Differential Encoding C.M. Liu Perceptual Signal Processing Lab College of Computer Science National Chiao-Tung](https://reader034.fdocuments.us/reader034/viewer/2022042315/5f03225b7e708231d407b50f/html5/thumbnails/12.jpg)
Linear Predictor (2)12
where Rxx is the autocorrelation function:
∑
∑∑
=
=
=
=−
=−
=−
N
i xxxxi
N
i xxxxi
N
i xxxxi
NRNiRa
RiRa
RiRa
1
1
1
)()(
)2()2(
)1()1(
M
( ) [ ]knnxx xxEkR +=
![Page 13: [CSCI 6990-DC] 10: Differential Encodingcmliu/Courses/Compression/...Differential Encoding C.M. Liu Perceptual Signal Processing Lab College of Computer Science National Chiao-Tung](https://reader034.fdocuments.us/reader034/viewer/2022042315/5f03225b7e708231d407b50f/html5/thumbnails/13.jpg)
Linear Predictor (3)13
⎥⎥⎥⎥
⎦
⎤
⎢⎢⎢⎢
⎣
⎡
−−
−−
=
)0()2()1(
)2()0()1()1()1()0(
xxxxxx
xxxxxx
xxxxxx
RNRNR
NRRRNRRR
R
L
MOMM
L
L
)()()(
)1(1
kRkRNR
RP
a
aA xxxx
xx
xx
n
=−⎥⎥⎥
⎦
⎤
⎢⎢⎢
⎣
⎡=
⎥⎥⎥
⎦
⎤
⎢⎢⎢
⎣
⎡= MM
.1PRAPRA −=⇒=
![Page 14: [CSCI 6990-DC] 10: Differential Encodingcmliu/Courses/Compression/...Differential Encoding C.M. Liu Perceptual Signal Processing Lab College of Computer Science National Chiao-Tung](https://reader034.fdocuments.us/reader034/viewer/2022042315/5f03225b7e708231d407b50f/html5/thumbnails/14.jpg)
Linear Predictor Example: Speech14
![Page 15: [CSCI 6990-DC] 10: Differential Encodingcmliu/Courses/Compression/...Differential Encoding C.M. Liu Perceptual Signal Processing Lab College of Computer Science National Chiao-Tung](https://reader034.fdocuments.us/reader034/viewer/2022042315/5f03225b7e708231d407b50f/html5/thumbnails/15.jpg)
Linear Predictor Example (2)15
N = 1 a1 = 0.66N = 2 a1 = 0.596, a2 = 0.096N = 3 a1 = 0.577, a2 = -0.025, a3 = 0.204
( ) ∑ −
= +−=
kM
i kiixx xxkM
kR1
1
![Page 16: [CSCI 6990-DC] 10: Differential Encodingcmliu/Courses/Compression/...Differential Encoding C.M. Liu Perceptual Signal Processing Lab College of Computer Science National Chiao-Tung](https://reader034.fdocuments.us/reader034/viewer/2022042315/5f03225b7e708231d407b50f/html5/thumbnails/16.jpg)
Linear Predictor Example: Laplacian Quantization
16
Uniform Step sizes4-level: 1st order: 0.75, 2nd order: 0.59, 3rd order: 0.438-level: 1st order: 0.3, 2nd order: 0.4, 3rd order: 0.5
( )
( )∑∑
∑∑
=
=
=
=
−=
−=
M
i ii
M
i i
M
i ii
M
i i
px
x
xx
x
12
12
12
12
)dB(SPER
ˆ)dB(SNR
Prediction Error
![Page 17: [CSCI 6990-DC] 10: Differential Encodingcmliu/Courses/Compression/...Differential Encoding C.M. Liu Perceptual Signal Processing Lab College of Computer Science National Chiao-Tung](https://reader034.fdocuments.us/reader034/viewer/2022042315/5f03225b7e708231d407b50f/html5/thumbnails/17.jpg)
Linear Predictor Example: Performance17
SNR increases a lot for order 1 to order 2.
![Page 18: [CSCI 6990-DC] 10: Differential Encodingcmliu/Courses/Compression/...Differential Encoding C.M. Liu Perceptual Signal Processing Lab College of Computer Science National Chiao-Tung](https://reader034.fdocuments.us/reader034/viewer/2022042315/5f03225b7e708231d407b50f/html5/thumbnails/18.jpg)
Linear Predictor Example: Reconstruction18
Original Reconstruction:8-level quantizer
Laplacian pdf3rd-order predictor
Although the reconstructed sequence looks like the original, notice that there is significant distortion in areas where the source output values are small.
![Page 19: [CSCI 6990-DC] 10: Differential Encodingcmliu/Courses/Compression/...Differential Encoding C.M. Liu Perceptual Signal Processing Lab College of Computer Science National Chiao-Tung](https://reader034.fdocuments.us/reader034/viewer/2022042315/5f03225b7e708231d407b50f/html5/thumbnails/19.jpg)
Adaptive DPCM19
MotivationEven after DPCM, a lot of structure remains in the signalStructure more compression is possible
Residuals for 3rd-order predictor
![Page 20: [CSCI 6990-DC] 10: Differential Encodingcmliu/Courses/Compression/...Differential Encoding C.M. Liu Perceptual Signal Processing Lab College of Computer Science National Chiao-Tung](https://reader034.fdocuments.us/reader034/viewer/2022042315/5f03225b7e708231d407b50f/html5/thumbnails/20.jpg)
Approaches Adaptive DPCM20
Adaptation can be applied toQuantizationPrediction
ObservationQuantization adaptation is independent of predictionPrediction adaptation quantization adaptation
Good prediction depends on good quantization
![Page 21: [CSCI 6990-DC] 10: Differential Encodingcmliu/Courses/Compression/...Differential Encoding C.M. Liu Perceptual Signal Processing Lab College of Computer Science National Chiao-Tung](https://reader034.fdocuments.us/reader034/viewer/2022042315/5f03225b7e708231d407b50f/html5/thumbnails/21.jpg)
Adaptive Quantization in DPCM21
Forward adaptationParameters are estimated for each blockTransmitted to receiverOverall, this is inconvenient in DPCM as parameters are not explicitly available (due to feedback loop)
Backward adaptationEssentially, a version of the Jayant quantizerExample:
8-level quantizer, 3rd-order predictorM0 = 0.9, M1 = 0.9, M2 = 1.25, M3 = 1.75
![Page 22: [CSCI 6990-DC] 10: Differential Encodingcmliu/Courses/Compression/...Differential Encoding C.M. Liu Perceptual Signal Processing Lab College of Computer Science National Chiao-Tung](https://reader034.fdocuments.us/reader034/viewer/2022042315/5f03225b7e708231d407b50f/html5/thumbnails/22.jpg)
Example: Adaptive Jayant DPCM22
Original
Non-adaptive
Jayant
![Page 23: [CSCI 6990-DC] 10: Differential Encodingcmliu/Courses/Compression/...Differential Encoding C.M. Liu Perceptual Signal Processing Lab College of Computer Science National Chiao-Tung](https://reader034.fdocuments.us/reader034/viewer/2022042315/5f03225b7e708231d407b50f/html5/thumbnails/23.jpg)
Forward Adaptive Prediction: DPCM-APF23
Speech coding8000 sample/sec, 128 samples/block (16ms)
Image coding8x8 blocks
Autocorrelation coefficientsAssuming samples are zero outside block. l means the lth block.
)()(
0for1)(
0for,1)(
)()(
1)1(
)(
1)1(
)(
kRkR
kxxkM
kR
kxxkM
kR
lxx
lxx
lM
Mlikii
lxx
klM
Mlikii
lxx
−=
<−
=
>−
=
∑
∑
+−=+
−
−−=+ Rxx(k) can be efficiently
encoded usingpartial correlation (parcor)
coefficients
![Page 24: [CSCI 6990-DC] 10: Differential Encodingcmliu/Courses/Compression/...Differential Encoding C.M. Liu Perceptual Signal Processing Lab College of Computer Science National Chiao-Tung](https://reader034.fdocuments.us/reader034/viewer/2022042315/5f03225b7e708231d407b50f/html5/thumbnails/24.jpg)
Backward Adaptive Prediction: DPCM-APB24
1st-order predictor
Adapts with sample
Replacing by to have the consistent result with decoder
1)(
11
2)(
1)1(
1 ˆ2 −+ +=
∂∂
−= nnnnnn xda
adaa αα
Nth-order predictor
jnnnn
jnnn
jn
j
d
xdaa
−+
−+
+=
−=
XAA ˆˆˆˆ
)()1(
)()1(
α
α
A.k.a. Least Mean Squared (LMS)
1)(
1)1(
1 ˆˆ−
+ += nnnn xdaa α
nd nd̂
![Page 25: [CSCI 6990-DC] 10: Differential Encodingcmliu/Courses/Compression/...Differential Encoding C.M. Liu Perceptual Signal Processing Lab College of Computer Science National Chiao-Tung](https://reader034.fdocuments.us/reader034/viewer/2022042315/5f03225b7e708231d407b50f/html5/thumbnails/25.jpg)
Delta Modulation (DM)25
DM = DPCM w/ 1-bit quantizerSampling frequency
At least twice the highest frequency signal componentUsually, much higher
![Page 26: [CSCI 6990-DC] 10: Differential Encodingcmliu/Courses/Compression/...Differential Encoding C.M. Liu Perceptual Signal Processing Lab College of Computer Science National Chiao-Tung](https://reader034.fdocuments.us/reader034/viewer/2022042315/5f03225b7e708231d407b50f/html5/thumbnails/26.jpg)
Linear DM Reconstruction26
![Page 27: [CSCI 6990-DC] 10: Differential Encodingcmliu/Courses/Compression/...Differential Encoding C.M. Liu Perceptual Signal Processing Lab College of Computer Science National Chiao-Tung](https://reader034.fdocuments.us/reader034/viewer/2022042315/5f03225b7e708231d407b50f/html5/thumbnails/27.jpg)
Constant Factor Adaptive DM (CFDM)27
⎩⎨⎧
<−>
=0ˆif10ˆif1
n
nn d
ds⎩⎨⎧
≠Δ=Δ
=Δ−−
−−
112
111
ifif
nnn
nnnn ssM
ssM
211 21 <==< MMM
![Page 28: [CSCI 6990-DC] 10: Differential Encodingcmliu/Courses/Compression/...Differential Encoding C.M. Liu Perceptual Signal Processing Lab College of Computer Science National Chiao-Tung](https://reader034.fdocuments.us/reader034/viewer/2022042315/5f03225b7e708231d407b50f/html5/thumbnails/28.jpg)
Second-Order CFDM 28
Examples for 2 samples prediction
![Page 29: [CSCI 6990-DC] 10: Differential Encodingcmliu/Courses/Compression/...Differential Encoding C.M. Liu Perceptual Signal Processing Lab College of Computer Science National Chiao-Tung](https://reader034.fdocuments.us/reader034/viewer/2022042315/5f03225b7e708231d407b50f/html5/thumbnails/29.jpg)
Speech Coding29
Autocorrelation function for speech sampleIndicates a period of 47 samples
Pitch period
Need a separate component to take advantage of it
![Page 30: [CSCI 6990-DC] 10: Differential Encodingcmliu/Courses/Compression/...Differential Encoding C.M. Liu Perceptual Signal Processing Lab College of Computer Science National Chiao-Tung](https://reader034.fdocuments.us/reader034/viewer/2022042315/5f03225b7e708231d407b50f/html5/thumbnails/30.jpg)
DPCM with Pitch Predictor30
Also: Noise Feedback Coding (NFC)Shaping of QE such that most falls in high-amplitude periods
periodpitch,ˆ: =− ττnp xbP
![Page 31: [CSCI 6990-DC] 10: Differential Encodingcmliu/Courses/Compression/...Differential Encoding C.M. Liu Perceptual Signal Processing Lab College of Computer Science National Chiao-Tung](https://reader034.fdocuments.us/reader034/viewer/2022042315/5f03225b7e708231d407b50f/html5/thumbnails/31.jpg)
DPCM with Pitch Predictor Performance31
DPCM Residuals DPCM w/ Pitch PredictorResiduals
![Page 32: [CSCI 6990-DC] 10: Differential Encodingcmliu/Courses/Compression/...Differential Encoding C.M. Liu Perceptual Signal Processing Lab College of Computer Science National Chiao-Tung](https://reader034.fdocuments.us/reader034/viewer/2022042315/5f03225b7e708231d407b50f/html5/thumbnails/32.jpg)
G.72632
ITU recommendation for standard ADPCMSupersedes G.721 & G.723Rates: 40/32/24/16 kbits/secCompression w.r.t. 8-bit PCM:1.6:1, 2:1, 2.67:1, 4:1Quantizer levels: 2nb-1
midtread quantizer
Backward adaptive quantizationA version of the Jayant quantizerDescribed in terms of a scale factor αk
Q[dk/αk] * αk
![Page 33: [CSCI 6990-DC] 10: Differential Encodingcmliu/Courses/Compression/...Differential Encoding C.M. Liu Perceptual Signal Processing Lab College of Computer Science National Chiao-Tung](https://reader034.fdocuments.us/reader034/viewer/2022042315/5f03225b7e708231d407b50f/html5/thumbnails/33.jpg)
G.726 24kb Quantizer I/O Map33
![Page 34: [CSCI 6990-DC] 10: Differential Encodingcmliu/Courses/Compression/...Differential Encoding C.M. Liu Perceptual Signal Processing Lab College of Computer Science National Chiao-Tung](https://reader034.fdocuments.us/reader034/viewer/2022042315/5f03225b7e708231d407b50f/html5/thumbnails/34.jpg)
G.726: Quantizer Adaptation34
Based on y(k) = log2αk
Two factors:yu unlocked—to handle large fluctuations (e.g. speech)yl locked—for small ones like data transmission.
( ) )1()(1)1()()( 11 −−+−= kykakykaky lu
a1 depend on input variance: for speech it is close to 1
[ ] [ ] [ ] 51 2,logwhere,)1()1()( −− =⋅=⋅+−−= εεε MWIWkyky ku
62),()1()1()( −=+−−= γγγ kykyky ull
![Page 35: [CSCI 6990-DC] 10: Differential Encodingcmliu/Courses/Compression/...Differential Encoding C.M. Liu Perceptual Signal Processing Lab College of Computer Science National Chiao-Tung](https://reader034.fdocuments.us/reader034/viewer/2022042315/5f03225b7e708231d407b50f/html5/thumbnails/35.jpg)
G.726: Predictor35
Backward adaptable based onlast 2 reconstructed values
last 6 quantized differences
∑∑ = −−
= −− +=
6
1)1(2
1)1( ˆˆ
i ikk
ii ikk
ik dbxap
Simplified LMS:
![Page 36: [CSCI 6990-DC] 10: Differential Encodingcmliu/Courses/Compression/...Differential Encoding C.M. Liu Perceptual Signal Processing Lab College of Computer Science National Chiao-Tung](https://reader034.fdocuments.us/reader034/viewer/2022042315/5f03225b7e708231d407b50f/html5/thumbnails/36.jpg)
Differential Image Coding36
Consider the predictor
… in combination with 2-bit uniform quantizer & AC1 bit/pixel encoding—compare to JPEG at the same rate
Diff coded: SNR=22dB, PSNR=31dB JPEG: SNR=33dB, PSNR=42dB
![Page 37: [CSCI 6990-DC] 10: Differential Encodingcmliu/Courses/Compression/...Differential Encoding C.M. Liu Perceptual Signal Processing Lab College of Computer Science National Chiao-Tung](https://reader034.fdocuments.us/reader034/viewer/2022042315/5f03225b7e708231d407b50f/html5/thumbnails/37.jpg)
Differential Image Coding (2)37
Improved schemeRecursively indexed quantizer
Improved predictor
Diff coded: SNR=29dB, PSNR=38dB JPEG: SNR=33dB, PSNR=42dB
![Page 38: [CSCI 6990-DC] 10: Differential Encodingcmliu/Courses/Compression/...Differential Encoding C.M. Liu Perceptual Signal Processing Lab College of Computer Science National Chiao-Tung](https://reader034.fdocuments.us/reader034/viewer/2022042315/5f03225b7e708231d407b50f/html5/thumbnails/38.jpg)
Remarks38
Prediction in DPCMAdaptive DPCMDelta ModulationSpeech CodingImage Coding
![Page 39: [CSCI 6990-DC] 10: Differential Encodingcmliu/Courses/Compression/...Differential Encoding C.M. Liu Perceptual Signal Processing Lab College of Computer Science National Chiao-Tung](https://reader034.fdocuments.us/reader034/viewer/2022042315/5f03225b7e708231d407b50f/html5/thumbnails/39.jpg)
Homeworks39
P. 352 3, 4, 6