Skip to content

Files

Latest commit

ad5a40d · Jul 8, 2018

History

History
958 lines (921 loc) · 51.5 KB

com303.md

File metadata and controls

958 lines (921 loc) · 51.5 KB

You can't use 'macro parameter character #' in math mode

$$
\def\sumi{\sum_{n = -\infty}^\infty}
\def\sinc{,\text{sinc}}
\def\sgn{,\text{sign}}
\def\arg{,\text{arg}}
\def\min{,\text{min}}
\def\Z{\mathbb{Z}}
\def\C{\mathbb{C}}
\def\N{\mathbb{N}}
\def\R{\mathbb{R}}
\def\H#1{\mathcal H{#1}}
\def\abs#1{,\lvert #1\rvert}
\def\norm#1{,\lVert #1\rVert}
$$

COM303

GNU General Public License v3.0 licensed. Source available on github.com/zifeo/EPFL.

Spring 2016: Signal Processing

[TOC]

Introduction

  • signal : description of the evolution of a physical phenomenon
    • processing
      • analysis : understanding the information carried by the signal
      • synthesis : creating a signal to contain the given information
    • communication
      • reception : analysis of an incoming signal
      • transmission : synthesis of an outgoing signal
  • digital model
    • discrete time : x ¯ = 1 N n = 0 N 1 x [ n ]
    • discrete amplitude : important for storage, processing, transmission
    • storage : 0 , 1
    • data transmission : x 1 ( t ) = G \sgn [ x ( t ) + G σ ( t ) ] as quantized signals
  • analog model
    • continuous time : x ¯ = 1 b a a b f ( t ) d t
    • storage : paper, vinyl, VHS, silver plates
    • data transmission : x N ( t ) = x ( t ) + N G σ ( t ) with N repeaters ( s i g n after each repetion to avoid noise multiplication)
  • sampling theorem : x ( t ) = \sumi x [ n ] \sinc ( t n T s T s )
  • discrete-time signal : a sequence of complex numbers x : \Z \C noted as x [ n ]
    • analysis : periodic measurement
    • synthesis : stream of generated samples
    • delta signal : x [ n ] = δ [ n ]
    • unit step : x [ n ] = u [ n ] = 1 n 0
    • exponential decay : x [ n ] = \abs a n u [ n ] with \abs a < 1
  • signal classes
    • finite-length : x = [ x 0 x N 1 ] T
    • infinite-length : x [ n ]
    • periodic : x ~ [ n ] = x ~ [ n + k N ] , replicated finite-lenght
    • finite-support : finite-length completed with 0 's
  • elementary operators
    • scaling : y [ n ] = α x [ n ]
    • sum : y [ n ] = x [ n ] + z [ n ]
    • product : y [ n ] = x [ n ] z [ n ]
    • shift by k (delay) : y [ n ] = x [ n k ] , best with periodic extension (circular)
  • energy : E x = \sumi \abs x [ n ] 2
    • periodic : E x =
  • power : P x = lim N 1 2 N + 1 n = N N \abs x [ n ] 2
    • periodic : P x = 1 N n = 0 N 1 \abs x ~ [ n ] 2
  • DSP as building block
    • adder : x [ n ] + y [ n ]
    • multiplier : α x [ n ]
    • delay : z N giving x [ n N ]
    • moving average : y [ n ] = x [ n ] + x [ n 1 ] 2
      • zero initial conditions : set a start time n 0 = 0 , assume input and output are zero for all time before n 0
      • recursion : y [ n ] = x [ x ] + α y [ n 1 ]
  • Karplus-Strong algorithm : y [ n ] = α y [ n 3 ] + x ¯ [ n ] with x ¯ [ n ] = δ [ n ] + 2 δ [ n 1 ] + 3 δ [ n 2 ]
    • build a recursion loop with a delay of M ( M -tap) : controls pitch
    • choose a signal x ¯ [ n ] that is nonzero only for 0 n < M : controls color (timbre)
    • choose a decay factor : α controls envelope (decay)
    • input x ¯ [ n ] to the system
    • play the output
    • frequency : f = 1 M T H z with time T associated to M sample interval

Vector spaces

  • vector spaces : usefull in approximation and compression, easy sampling, interpolation, Fourier Transform, fundamental in communication system design
    • euclidian : \R 2 , \R 3
    • linear algebra : \R N , \C N
    • space of square-summable infinite sequences : l 2 ( \Z )
    • space of quare-integrable functions over an interval : L 2 ( [ a , b ] )
      • inner product : < x , y >= b a x ( t ) y ( t ) d t
    • once you know the properties are satisfied, you can use all the tools for the space
    • ingredients
      • set of vectors : V
      • set of scalars : \C
    • properties : x , y , z are vectors
      • x + y = y + x
      • ( x + y ) + z = x + ( y + z )
      • α ( x + y ) = α y + α x
      • ( α + β ) x = α x + β x
      • α ( β x ) = ( α β ) x
      • 0 V x + 0 = 0 + x = x
      • x V ( x ) x + ( x ) = 0
    • inner (dot) product : < , >: V × V \C
      • < x + y , z >=< x , z > + < y , z >
      • < x , y >=< y , x >
      • < α x , y >= α < x , y >
      • < x , α y >= α < x , y >
      • < x , x >= \norm x 2 0
      • < x , x >= 0 x = 0
      • < x , y >= \norm x \norm y cos α
      • < x , y >= 0 with x , y 0 : orthogonal (maximally different)
      • defines a norm : \norm x = < x , x >
      • norm defines a distance : d ( x , y ) = \norm x y
      • mean square error : \norm x y 2
      • for signals : < x , y >= n = 0 N 1 x [ n ] y [ n ] , requires square-summable \abs x [ n ] 2 <
      • pythagorean theorem : \norm x + y 2 = \norm x 2 + \norm y 2 for x y
  • canonical basis : set of K vectors in a vector space with basis W = w ( k ) k = 0 , , K 1
    • linear combination : x ; x = k = 0 K 1 α k w ( k ) with α k \C unique
    • unique representation implies linear independence : k = 0 K 1 α k w ( k ) = 0 α k = 0 ; k = 0 , , K 1
    • basis for functions over an interval : v ( v ) = sin ( π ( 2 k + 1 ) t ) with k = 0 N ( 1 / N ) v ( k )
    • orthogonal basis : < w ( k ) , w ( n ) >= 0 for k n
    • orthonormal bassis : < w ( k ) , w ( n ) >= δ [ n k ] for k n (using Gram-Schmidt)
    • basis expansion : α k =< w ( k ) , x >
    • change of basis : x = k = 0 K 1 α k w ( k ) = k = 0 K 1 β k v ( k )
      • if v ( k ) orthnormal
      • β h =< v ( h ) , x >=< v ( h ) , k = 0 K 1 α k w ( k ) >= k = 0 K 1 α k < v ( h ) , w ( k ) >= k = 0 K 1 α k c h k
      • parseval's theorm : energy is conserved across change of basis \norm x 2 = k = 0 K 1 \abs α k 2
      • rotation matrix : $R=\begin{bmatrix}\cos\theta & \sin\theta \\ -\sin\theta & \cos\theta \end{bmatrix}$ with new coefficient β = R α
  • subspace : subset of vectors closed under addition and scalar multiplication
    • approximation : less dimensionnal projection
    • least-square approximation for subset S : x ^ = k = 0 K 1 < s ( k ) , x > s ( k ) (orthogonal projection)
      • has minimum-norm error : arg min y S \norm x y = x ^
      • error orthogonal to approximation : < x x ^ , x ^ >= 0
  • Gram-schmidt : original set s ( k ) u ( k ) orthonormal set
    1. p ( k ) = s ( k ) n = 0 k 1 < u ( n ) , s ( k ) > u ( n )
    2. u ( k ) = p ( k ) / \norm p ( k ) for each step k
  • Legendre polynormials : orthonormal basis for P N ( [ 1 , 1 ] ) , α k =< u ( k ) , x > with naive basis s ( k ) = t k
    • u ( 0 ) = 1 / 2
    • u ( 1 ) = 3 / 2 t
    • u ( 2 ) = 5 / 8 ( 3 t 2 1 )
  • Hilbert space : vector space H ( V , \C ) , inner product < , >: V × V \C , completeness (limiting operations must yield vector space elements)
    • finite-length and periodic signals live in \C N
    • inifinte-length signals live in l 2 ( \Z )
    • different bases are different observation tools for signals
    • subspace projections useful in filtering and compression

Fourier analysis

  • time domain : linear combination of atomic time units x [ n ] = k = 0 N 1 x [ k ] δ ( k )
  • oscillations are everywhere
    • sustainable dynamic systems exhibit oscillatory behavior
    • things that don't move in circles can't last
    • human receptors
      • cochlea : ear, air pressure, frequencies between 20Hz and 20KHz
      • rods and cones : retina, electromagnetic sinusoids, frequencies between 430THz to 790THz
    • oscillatory heartbeat : x [ n ] = A cos ( ω n + ϕ ) with frequency ω , initial phase ϕ , amplitude A
    • complex exponential : x [ n ] = A e j ( ω n + ϕ ) = A [ cos ( ω n + ϕ ) + j sin ( ω n + ϕ ) ]
    • periodic in n : e j ω n with ω = M N 2 π with M , N \N
    • wagonwheel effect : max speed at ω = π
    • digital frequency : how many samples before pattern repeats, no unit
    • physical frequency : how many secondes before pattern repeats, hertz, 1 M T s with M samples of T s system clock
  • frequency domain : as important as the time domain, hidden signal properties
  • fourier : simple change of basis, change of perspective
    • analysis : express signal as combination of periodic oscillations, from time to frequency domain
    • synthesis : create signal with frequency content, from frequency to time domain
    • orthogonal basis : w k [ n ] = w n ( k ) = e j 2 π N n k (normalization 1 / N )
    • proof = < w ( k ) , w ( h ) >= N for h = k otherwise 0
    • wrapping the phase : [ π , π ] by adding 2 π
  • discrete fourier transform : DFT, numerical algorithm
    • analysis : X k =< w ( k ) , x > or X [ k ] = n = 0 N 1 x [ n ] e j 2 π N n k
    • synthesis : $x=\frac{1}{N}\sum^{N-1}{k=0}X_kw^{(k)}$ or $x[n]=\frac{1}{N}\sum{k=0}^{N-1}X[k]e^{j\frac{2\pi}{N}nk}$
    • parseval : n = 0 N 1 | x [ n ] | 2 = 1 N k = 0 N 1 | X [ k ] | 2
    • finite-length time shifts : I D F T e j 2 π N M k X [ k ] = x [ ( n M ) mod N ] circular
    • real signal : symmertic in magnitude | X [ k ] | = | X [ N k ] | for k = 1 , , N / 2
    • DFT of length M step : X [ k ] = sin ( π N M k ) sin ( π N k ) e j π N ( M 1 ) k
    • X [ 0 ] = M
    • X [ k ] = 0 if M k / N integer
    • DFT of L periods : X L [ k ] = L X ¯ [ k / L ] if k multiple of L otherwise 0 with X ¯ [ k / L ] = n = 0 M 1 x ¯ [ n ] e j 2 π M n k L
  • matrix form basis change : $\begin{bmatrix}1 & 1 & 1 & \cdots & 1\\ 1 & W^1 & W^2 & \cdots & W^{N-1}\\ 1 & W^2 & W^4 & \cdots & W^{2(N-1)}\\ \vdots & \vdots & \vdots & \ddots & \vdots\\ 1 & W^{N-1} & W^{2(N-1)} & \cdots & W^{(N-1)^2}\end{bmatrix}$ with W [ n , m ] = W N n m = e j 2 π N n m
    • analysis : X = W x
    • synthesis : 1 N W H X
    • hermitian : W H conjugate transpose
    • dft : W N m = W N ( m mod N )
  • short-time fourier transform : STFT
    • time obfuscates frequency : Δ t Δ f = 2 π
    • small singal pieces of length L : X [ m ; k ] = n = 0 L 1 x [ m + n ] e j 2 π L n k
    • spectrogram : magnitude (dark small, white large), 10 log 10 ( | X [ m , k ] | )
      • system clock : F s = 1 / T s
      • highest positive frequency : F s / 2 Hz
      • frequency resolution : F s / L Hz
      • width of time slices : L T s s
      • wideband (short window) : precise location of transistions, poor frequency resolution
      • narrowband (long window) : more frequency resolution, less precision in time
  • discrete fourier series : DFS, N -periodic, equivalent to DFT of one period
    • analysis : X [ k ] = k = 0 N 1 x [ n ] e j 2 π N n k with n \Z
    • synthesis : x [ n ] = 1 N k = 0 N 1 X [ k ] e j 2 π N n k with n \Z
  • discrete-time fourier transform : DTFT, infinite signals, mathematical tool
    • analysis : F ( ω ) = X ( e j ω ) = n = x [ n ] e j ω n =< e j ω n , x [ n ] > , represented over [ π , π ] with x [ n ] l 2 ( \Z )
    • synthesis : x [ n ] = 1 2 π π π F ( ω ) e j ω n d ω
    • periodicity : F ( ω ) is 2 π -periodic, can be rescales M times X ( e j ω M )
    • splitting into chunks : n = y [ n ] = p = m = 0 M 1 y [ p M + m ]
    • signal symmetric : DTFT symmetric x [ n ] = x [ n ] X ( e j ω ) = X ( e j ω )
    • signal real : DTFT hermitian symmetric $x[n]=x^[n]\iff X(e^{j\omega})=X^(e^{-j\omega})$ (symmetric magnitude)
    • signal symmetric real : DTFT symmetric and real
  • review DFT : numerical algorithm (computable)
  • review DFS
  • review DTFT : mathematical tool (proofs)
  • pulse train : δ ~ ( ω ) = 2 π k = δ ( ω 2 π k ) (Dirac delta in space of 2 π -periodic functions)
  • embedding finite-length signals : N -tap signal, spectral DFT to infinite sequence
    • periodic extension : x ~ [ n ] = x [ n mod N ]
      • X ~ ( e j ω ) = 1 N k = 0 N 1 X [ k ] δ ~ ( ω 2 π N k )
    • finite-support extension : x ¯ [ n ] = x [ n ] for 0 n N otherwise 0
      • interval indicator signal : r ¯ [ n ] = 1 when 0 n < N else 0
      • X ¯ ( e j ω ) = k = 0 N 1 X [ k ] Λ ( ω 2 π N k )
      • Λ ( ω ) = ( 1 / N ) R ¯ ( e j ω ) : smooth interpolation of DFT values
      • R ¯ ( e j ω ) = sin ( ω 2 N ) sin ( ω 2 ) e j ω 2 ( N 1 ) : DTFT of interval signal
  • zero-padding : pad data vector with 0's to obtain nicer plots, no information added
  • modulation : x [ n ] baseband, D T F T x [ n ] cos ( ω c n ) = 1 2 [ X ( e j ( ω ω c ) ) + X ( e j ( ω + ω c ) ) ] , caution if too large
  • demodulation : D T F T x [ n ] cos ( ω c n ) 2 cos ( ω c n ) = X ( e j ω ) + 1 2 [ X ( e j ( ω 2 ω c ) ) + X ( e j ( ω + 2 ω c ) ) ]
  • fast fourrier transform : FFT
    • original complexity : O ( N 2 ) for X = W n x
    • divide and conquer : O ( N log ( N ) )

Linear systems

  • LTI
    • linearity : \H a 1 x 1 [ n ] + a 2 x 2 [ n ] = a 1 \H x 1 [ n ] + a 2 \H x 2 [ n ]
    • time invariance : \H x [ n ] = y [ n ] \H x [ n n 0 ] = y [ n n 0 ]
  • impulse response : h [ n ] = \H δ [ n ]
  • convolution : $x[n]h[n]=\sum_{k=-\infty}^\infty x[k]h[n-k]=<x^[k],h[n-k]>$
    • algorithm : time-reverse h [ m ] , center it in n , compute inner product
  • moving average : MA, y [ n ] = 1 M k = 0 M 1 x [ n k ]
    • impulse reponse : h [ n ] = 1 / M for 0 n < M
    • smoothing effect : proportional to M , # operations and storage
  • leaky integrator : LI, y [ n ] = λ y [ n 1 ] + ( 1 λ ) x [ n ] with leak λ < 1
    • impulse response : h [ n ] = ( 1 λ ) λ n u [ n ]
    • smoothing effect : depends on λ , constant operations and storage
  • stability
    • finite impulse response (FIR) : finite support, finite # of samples involved in the computation of each output, always stable
    • infinite impulse response (IIR) : infinite support, infinite # of samples involed in the computation of each output (finite computation though)
    • causal : impulse response zero for n < 0 , only past samples
    • noncausal : impulse response nonzero for n < 0 , need future samples
    • bounded-input bounded-output (BIBO) : require impulse response absolutely summable
    • nice signal : bounded signal
  • frequency reponse : DTFT of impulse response determines the frequency characteristic of a filter
    • eigensequences : complex exponentials, cannot change frequency of sinusoids
    • convolution theorem : multiplication in frequency space
    • amplitude : amplification when \abs H ( e j ω ) > 1 or attentuation when \abs H ( e j ω ) < 1
    • phase : overall delay, shape change
      • zero phase : H ( e j ω = 0
      • linear phase : H ( e j ω ) = d ω (almost linear phase on region of interest can do also the trick)
      • nonlinear phase : for example 1 / 2 sin ( ω 0 n ) + cos ( 2 ω 0 n + 2 θ 0 )

Ideal filters and approximation

  • filter types (magnitude response)
    • lowpass : basebands, MA, LI
    • highpass
    • bandpass
    • allpass
  • filter types (phase response)
    • linear phase
    • nonlinear phase
  • ideal lowpass filter : H ( e j ω ) = 1 for | ω | ω c otherwise 0 ( 2 π -periodic implicit)
    • zero-phase : no delay
    • impulse response : h [ n ] = sin ( ω c n ) π n
    • cannot compute in finite time : infinite support, two-sided
    • approximation : decay slowly in time
    • sinc-rect pair : r e c t ( x ) = 1 for | x | 1 / 2 and s i n c ( x ) = sin ( π x ) π x for x 0 , 1 if x = 0 ( 0 if x nonzero integer, not summable)
  • ideal highpass filter : H ( e j ω ) = 1 for π | w | ω c ( 2 π -periodic implicit)
    • impulse response : H h p ( e j ω ) = 1 H l p ( e j ω ) give h h p [ n ] = δ [ n ] ω c π s i n c ( ω c π n )
  • ideal bandpass filter : H ( e j ω ) = 1 for | ω ± ω 0 | ω c ( 2 π -periodic implicit)
    • impulse response : h b p [ n ] = 2 cos ( ω 0 n ) ω c π s i n c ( ω c π n )
  • impulse truncation
    • FIR appromixation of length M = 2 N + 1 : h ^ [ n ] = h [ n ] for | n | N
    • MSE minimized by symmetric impulse truncation around zero : M S E = \sumi | h [ n ] h ^ [ n ] | 2
    • gibbs phenomenon : maximum error around 9% regardless of N
      • A, B integrals : ( A + B ) / 2 π 1.09 with A π and B 2 π 0.589 (independant of M )
  • window method : narrow mainlobe (transition sharp), small sidelobe (small error), short window (FIR efficient)
    • MSE minimized, simple
    • cannot control max error
  • frequency sampling : take M of desired frequency response S [ k ] = H ( e j ω k ) where ω k = ( 2 π / M ) k , compute inverse DFT of S [ k ] , use s [ n ] to build h ^ [ n ] (finite support)
    • simple, works with arbitrary frequency response
    • cannot control max error
    • sampling in the frequency : periodization in time domain s [ n ] = m = h [ n + m M ]
  • z-transform : power series, convergence always absolute
    • analysis : X ( z ) = n = x [ n ] z n
    • synthesis :
    • region of convergence : ROC, circular symmetry
      • finit support signals : converge everywhere
      • causal signals : extends outwards from circle touching largest magnitude pole, converge if ROC include unit circle
      • independent of values of H ( z ) : assume Y ( z ) exists for x [ n ] = δ [ n ]
      • z n : zeros of transfert function, glue sheet to ground
      • p n : poles of transfert function, push sheet up
    • constant coefficient difference equation : k = 0 N 1 a k y [ n k ] = k = 0 M 1 b k x [ n k ] give Y ( z ) k = 0 N 1 a k = X ( z ) k = 0 M 1 b k x [ n k ] with Y ( z ) = H ( z ) X ( z )

Filter structures

  • abstract filter implementation
  • resonator : narrow bandpass filter, detect presence of sinusoid of given frequency, shift passband of LI
    • H ( z ) = G 0 1 2 λ cos ( ω 0 z 1 ) + | λ | 2 z 2
    • a 1 = 2 λ cos ω 0 and a 2 = | λ | 2
  • DC removal : DC balanced signal has zero sum, kill zero frequency
  • hum removal : remove a specific nonzero frequency H ( z ) = ( 1 e j ω 0 z 1 ) ( 1 e j ω 0 z 1 ) ( 1 λ e j ω 0 z 1 ) ( 1 λ e j ω 0 z 1 )
  • fractional delay : compute in-between values for sample, ideal, approximated with local interpolation
  • Hilbert filter : allpass, H ( e j ω 0 ) = j for 0 ω < π or j for π ω < 0 , h [ n ] = 2 π n for n odd otherwise 0
    • Hilbert demodulation : ( j y [ n ] h [ n ] + y [ n ] ) e j ω 0 n = x [ n ] for y [ n ] = x [ n ] cos ( ω 0 n )

Filter design

  • requirements
    • frequency response : passband, stopband
    • phase : overall delay, linearity
    • limit on computational resources or precision
    • determine N , M , a k , b k : H ( z ) = b 0 + b 1 z 1 + + b M 1 z ( M 1 ) a 0 + a 1 z 1 + + a N 1 z ( N 1 ) , hard nonlinear problem
  • limitations
    • transitions cannot be infinitely sharp : H ( z ) = B ( z ) / A ( z ) is \C
    • magnitude response cannot be constant over an interval : B ( z ) c A ( z ) infinite number of roots, need to be 0 for all z
    • higher filter order : small transition band, small error, expensive, large delay
    • equiriplle error
  • IIR
    • pros : computationally efficient, strong attenuation easy, good for audio
    • cons : stability issues, difficult to design for arbitrary response, nonlinear phase
    • method : conversion fo analog design, deeply studied field
    • butterworth : lowpass
      • magnitude response : maximally flat, monotonic over [ 0 , π ]
      • design parameters : order N ( N poles and zeros), cutoff frequency
      • design test criterion : width of transition band, passband error
    • chebyshev : lowpass
      • magnitude response : equiriplle in passband, monotonic in stopband
      • design parameters : order N ( N poles and zeros), passband max error, cutoff frequency
      • design test criterion : width of transition band, stopband error
    • elliptic : lowpass
      • magnitude response : equiriplle in passband and in stopband
      • design parameters : order N ( N poles and zeros), passband max error, cutoff frequency, stopband min attenuation
      • design test criterion : width of transition band
    • magnitude response in decibels : filter attenuation expressed A d B = 20 log 10 ( | H ( e j ω ) | / G ) with filter max passband G
  • FIR
    • pros : always stable, optimal design techniques exist, can be designed with linear phase
    • cons : computationally much more expensive, may sound harsh
    • method : optimal minimax filter design, algorithm for linear phase, equiriplle error in passband and stopband (proceeds by minimizing the maximum error)
    • half length : L
    • even FIR : M = 2 L taps
    • odd FIR : M = 2 L + 1 taps
    • delay : ( M 1 ) / 2
    • FIR only have zeros : if z 0 zero, so is z 0 and 1 / z 0
    • type I : h [ L + n ] = h [ L n ] , h d [ n ] = h [ n + L ] , h d [ n ] = h d [ n ]
      • $H(z)=z^{-L}(h_d[0]+\sum_{n=1}^Lh_dn)$
      • zero locations : H ( z 1 ) = z 2 L H ( z )
    • type II : h [ n ] = h [ 2 L 1 n ]
      • $H(z)=z^{-C}\sum_{n=0}^{L-1}hn$ with C = L 1 / 2
      • zero locations : H ( z 1 ) = z 2 C H ( z ) = z 2 L 1 H ( z )
      • always have zero : at ω = π
    • type III
      • $H(z)=z^{-L}\sum_n h_dn$
      • always have zero : at ω = 0 , π
    • type IV
  • Parks-McClellan algorithm : optimal, polynomial fitting H d ( e j ω ) = h d [ 0 ] + 2 n = 1 L h d [ n ] cos ω n
    • magnitude response : equiriplle in passband and stopband
    • design parameters : order N (number of taps), passband edge ω p , stopband edge ω s , ratio of passband to stopband error δ p / δ s
    • design test criterion : width of transition band, stopband error
    • Chebyshev polynomials : T n ( cos ω ) = cos n ω
      • T 0 ( x ) = 1
      • T 1 ( x ) = x
      • T 2 ( x ) = 2 x 2 1
      • T n ( x ) = 2 x T n 1 ( x ) T n 2 ( x )
    • convert the space to x = cos ω
      • l p = [ 0 , ω p ] l p = [ cos ω p , 1 ]
      • l s = [ ω s , π ] l s 0 [ 1 , cos ω s ]
    • minimize maximum error : E = min P ( x ) max x l p l s | P ( x ) D ( x ) |
      • P ( x ) = h d [ 0 ] + n = 1 L 2 h d [ n ] T n ( x )
      • D ( x ) = 1 when x l p else 0
    • alternation theorem : min max works only if P ( x ) D ( x ) alternates M + 2 times in l p l s between ± E
      • works also with weighting function : W ( x ) = 1 when x l p or δ p / δ s else ( x l s )
      • weighted min max : min max x l p l s \abs W ( x ) [ P ( x ) D ( x ) ]
      • max number of alternations : L + 3
        • polynomial of degree L : L 1 local extrema
        • ω p and ω s
        • sometimes : ω = 0 or ω = π
      • in-band alternations : L 1
    • Remez algorithm : guess positions of alternations, if not satisfied find extrema or error and repeat
    • algorithm : M filter coefficients, stopband and passband tolerances δ s and δ p , if error too big, increase M and retry
    • eliptic vs 51-tap minimax
  • design bandpass and highpass by modulating lowpass

Real-time processing

  • system clock : at most T s
    • record value : x i [ n ]
    • process value in causal filter
    • output value : x o [ n ]
  • buffering : interrupt for each samples would be too much overhead
  • input
  • output
  • double buffering
    • delay : d = T s L 2 seconds
    • underflow : CPU does not fill fast enough
  • multiple buffering (> 2) for protection
    • delay : d = T s L seconds
    • underflow : more protection
  • echo
  • reverb : superposition of many echos with different delays and magnitudes, costly, cheap alternative is allpass H ( z ) = α + z N 1 α z N
  • non-LTI effects
    • distortion : clip signal y [ n ] = t r u n c ( a x [ n ] ) / a
    • tremolo : sinusoidal amplitude modulation y [ n ] = ( 1 + cos ( ω 0 n ) / G ) x [ n ]
    • flanger : sinusoidal delay y [ n ] = x [ n ] + x [ n d ( 1 + cos ( ω 0 n ) ) ]
    • wah : time-varying bandpass filter

Stochastic signal processing

  • gaussian random variable : f ( x ) = N ( m , σ 2 ) = 1 2 π σ 2 exp ( x m ) 2 2 σ 2
    • mean : m
    • variance : σ 2
  • uniform random variable : f ( x ) = U ( A , B ) = 1 B A
    • mean : m = A + B 2
    • variance : σ 2 = ( B A ) 2 12
  • discrete uniform random variable : f ( x ) = U A , B = 1 B A + 1 k = A B δ ( x k )
    • mean : m = A + B 2
    • variance : σ 2 = ( B A + 1 ) 2 1 12
  • autocorrelation : R X Y = E [ X Y ]
  • covariance : C X Y = E [ ( X m X ) ( Y m Y ) ]
    • uncorrelated elements : E [ X Y ] = E [ X ] E [ Y ] C X Y = 0
    • independent elements : f X Y ( x , y ) = f X ( x ) f Y ( y ) C X Y = 0
  • random vector
    • cdf : F X ( α ) = P [ X n α n , n = 0 , , N 1 ] with α \R N
    • pdf : f X ( α ) = N α 0 α N 1 F X ( α 0 , , α N 1 )
    • mean : E [ X ] = m x = [ E [ X 0 ] E [ X N 1 ] ] T \R N
    • cross-correlation : R X Y = E [ X Y T ] \R N × N
    • covariance matrix : C X Y = E [ ( X m X ) ( Y m Y ) T ] \R N × N , symmetric, postive-definite, diagonal if uncorrelated or independent
  • gaussian random vector : f ( x ) = 1 ( 2 π ) n \abs Λ exp 1 2 ( x m ) T Λ 1 ( x m )
    • mean : m \R N
    • covariance matrix : Λ \R N × N
    • uncorrelated elements : independent elements
  • random process
    • full characterization : all possible sets of k indices for all k \N , too much
    • first-order : f X [ n ] ( x [ n ] ) ] time-varying mean x ¯ [ n ] = E [ x [ n ] ]
    • second-order : first order + f X [ n ] X [ m ] ( x [ n ] , x [ m ] ) time-varying cross-correlation σ x [ n , m ] = E [ x [ n ] x [ m ] ]
    • ... : time-varying further moment
  • stationarity : time-invariant partial-order descriptions f X [ n 0 ] X [ n k 1 ] ( ) = f X [ n 0 + M ] X [ n k 1 + M ] ( )
    • mean : time-invariant
    • correlation : depends only on time lag
    • higher-order moments : depend only on relative time differences
  • wide-sense stationarity (WSS) : stationarity up to second-order descriptions
    • mean : E [ X [ n ] ] = m
    • correlation : E [ X [ n ] X [ m ] ] = r [ n m ]
  • independent, identically distributed process (IID) : f X [ n 0 ] X [ n k 1 ] ( x ) = Π n = 0 k f ( x n )
    • mean : E [ X [ n ] ] = m
    • correlation : E [ X [ n ] X [ m ] ] = σ 2 δ [ n m ]
  • power spectral density (PSD) : independent of pdf
    • intuition : P [ k ] = E [ \abs X N [ k ] 2 / N ]
      • energy distributions in frequency : \abs X N [ k ] 2
      • power distributions in frequency : \abs X N [ k ] 2 / N , aka density
      • frequency-domain representations for stochastic processes is power
      • P [ k ] = 1 : power is equally distributed over all frequencies, cannot predict how fast signal moves
    • truncated DTFT : X N ( e j ω ) = n = N N x [ n ] e j ω n
    • for signal : P ( e j ω ) = lim N 1 2 N + 1 \abs X N ( e j ω ) 2
    • for WSS random process : P X ( e j ω ) = lim N 1 2 N + 1 E [ \abs X N ( e j ω ) 2 ] = lim N k = 2 N 2 N 2 N + 1 \abs k 2 N + 1 r X [ k ] e j ω k
      • P X ( e j ω ) = lim N k = w N [ k ] r X [ k ] e j ω k = D T F T r X [ k ]
      • lim N w N [ k ] = 1
  • white noise : IDD
    • zero mean : autocorrelation = covariance
    • P X ( e j ω ) = σ 2
  • additive white gaussian noise (AWGN) : IID, zero mean gaussian process, WSS full stationary
  • filter random process : output is WSS if input WSS
    • mean : m Y = m X H ( e j 0 )
    • correlation : r Y [ n ] = h [ n ] h [ n ] r X [ n ]
    • power distribution : P Y ( e j ω ) = \abs H ( e j ω ) 2 P X ( e j ω )
    • deterministict signal filter : works in magnitude in stochastic case but concept of phase lost

Interpolation

  • bridging two world : sampling and interpolation
  • continuous-time signal processing : x ( t ) L 2 ( \R ) complex function of real variable with finite energy
  • analog LTI filters : $y(t)=(xh)(t)=<h^(t-\tau),x(\tau)>$
  • fourier
    • frequence : F = Ω 2 π Hz with Ω rad/s and period T = 1 F
    • analysis : X ( j Ω ) =< e j Ω t , x ( t ) >= x ( t ) e j Ω t d t not periodic
    • synthesis : x ( t ) = 1 2 π X ( j Ω ) e j Ω t d Ω
  • convolution theorem : Y ( j Ω ) = X ( j Ω ) H ( j Ω )
  • bandlimitedness : X ( j Ω ) = 0 for \abs Ω > Ω N
    • total bandwidth : Ω B = 2 Ω N
    • prototypical function : T s = 2 π Ω B = π Ω N
      • φ ( t ) = \sinc ( t T s )
      • Φ ( j Ω ) = π Ω N r e c t ( Ω 2 Ω N )
  • interpolation : fill the gaps between samples
    • requirement : decide interval T s , make sure x ( n T s ) = x [ n ] , make sure x ( t ) is smooth (infinitely differentiable)
  • polynomial interpolation : N points, polynomial of degree N 1 , p ( t ) = a 0 + a 1 t + + a N 1 t N 1
    • N -degree polynomial bases in interval
      • naive : 1 , t , , t N
      • Legendre basis : orthonormal, increasing degree
      • Chebyshev basis : orthonormal, increasing degree
      • Lagrange : interpolation property, same degree
    • consider symmetric interval : l N = [ N , , N ]
    • naive : p ( 0 ) = x [ 0 ] , p ( T s ) = x [ 1 ] , p ( ( N 1 ) T s ) = x [ N 1 ]
    • space of degree-$2N$ polynomial over l N : P N
    • P N basis : 2 N + 1 Lagrange polynomials L n ( N ) ( t ) = Π k = N , k n N t k n k for n = N , , N
    • Lagrange interpolation : p ( t ) = n = N N x [ n ] L n ( N ) ( t )
      • polynomial of degree 2 N through 2 N + 1 points unique
      • satifies : p ( n ) = x [ n ] for N n N since L n ( N ) ( m ) = 1 only if n = m else 0
    • pros : maximally smooth
    • cons : interpolation bricks depend on N
  • zero-order interpolation : N t N , x ( t ) = n = N N x [ n ] r e c t ( t n )
    • x ( t ) = x [ t + 0.5 ]
    • kernel : i 0 ( t ) = r e c t ( t ) (support 1 )
    • not continuous
  • first-order interpolation : x ( t ) = n = N N x [ n ] i 1 ( t n )
    • kernel : i 1 ( t ) = 1 \abs t for \abs t 1 else 0 (support 2 )
    • continuous but derivative is not
  • third-order interpolation : x ( t ) = n = N N x [ n ] i 3 ( t n )
    • kernel : splicing two cubic polynomials (support 4 )
    • continous up to second derivative
  • local interpolation : x ( t ) = n = N N x [ n ] i c ( t n )
    • requirements : i c ( 0 ) = 1 and i c ( t ) = 0 for t nonzero integer
    • pros : same interpolating function independently of N
    • cons : lack of smoothness
    • limit : local = global interpolation, lim N L n ( N ) ( t ) = f ( t n )
  • sinc interpolation : x ( t ) = n = x [ n ] \sinc ( t n T s T s )
    • convergence : \sinc ( t n ) and L n ( ) ( t ) share an infinite number of zeros
    • spectral representation : X ( j Ω ) = ( π / Ω N ) X ( e j π ( Ω / Ω N ) ) for \abs Ω Ω N else 0
    • fast interpolation : T s small, wider spectrum
    • slow interpolation : T s large, narrower spectrum
  • space of bandlimited functions : Ω N -BL$\subset L_1(\R)$, hilbert space
  • sampling theorem
    • special case : T s = 1 and Ω N = π
      • basis : φ ( n ) ( t ) = \sinc ( t n ) with n \Z
      • sampling as basis expansion : < φ ( n ) ( t ) , x ( t ) >=< \sinc ( t n ) , x ( t ) >=< s i n c ( n t ) , x ( t ) >= ( \sinc x ) ( n ) \= 1 2 π r e c t ( Ω 2 π ) X ( j Ω ) e j Ω n d Ω = 1 2 π π π X ( j Ω ) e j Ω n d Ω = x ( n )
      • analysis : x [ n ] =< \sinc ( t n ) , x ( t ) >
      • synthesis : x ( t ) = n = x [ n ] \sinc ( t n )
      • sufficient representation : x [ n ] = x ( n ) with n \N
    • general case : T s = π / Ω N
      • basis : φ ( n ) ( t ) = \sinc ( ( t n T s ) / T s )
      • analysis : x [ n ] =< \sinc ( t n T s T s ) , x ( t ) >= T s x ( n T s )
      • synthesis : x ( t ) = 1 T s n = x [ n ] \sinc ( t n T s T s )
      • coefficient : T s x ( n T s ) for any $x(t)\in\Omega_N-$BL
      • sufficient representation : x [ n ] = x ( n T s ) for any x ( t ) Ω N -BL
    • corollary : Ω N -BL$\subset\Omega$-BL for any Ω Ω N
      • sufficient representation : x [ n ] = x ( n T s ) for any x ( t ) Ω N -BL and any T s π / Ω N
    • hertz : any signal x ( t ) bandlimited to $F_N$Hz can be sampled with no loss of information using sampling frequency F s 2 F N (i.e. sampling period T s 1 / 2 F N )

Sampling and application

  • sinc sampling
  • sinc sampling for Ω N -BL signals
  • raw sampling
  • raw sampling continuous-time complex expoential : x ( t ) = e j Ω 0 t
    • all angular speed allowed
    • periodic : T = 2 π / Ω 0
    • F T e e j Ω 0 t = 2 π δ ( Ω Ω 0 )
    • bandlimited : to Ω 0 +
    • raw sample : snapshots at regular intervals of rotating point x [ n ] = e j Ω 0 T s n
      • digital frequency : ω 0 = Ω 0 T s
      • easy : T s < π / Ω 0 ω 0 < π
      • tricky : π / Ω 0 < T s < 2 π / Ω 0 π < ω 0 < 2 π
      • trouble : T s > 2 π / Ω 0 ω 0 > 2 π
    • aliasing
  • raw sampling arbitrary signal
    • spectrum : x [ n ] = x c ( n T s ) , start with inverse Fourier Transform
      • split intergration interval (aliased) : x [ n ] = 1 2 π k = ( 2 k 1 ) Ω N ( 2 k + 1 ) Ω N X c ( j Ω ) e j Ω n T s d Ω
      • periodzation : X ~ c ( j Ω ) = k = X c ( j ( Ω 2 k Ω N ) ) give x [ n ] = 1 2 π Ω N Ω N X ~ C ( j Ω ) e j Ω T s n d Ω
      • set ω = Ω T s : x [ n ] = I D T F T 1 T s X ~ C ( j ω T s )
      • final : X ( e j ω ) = π Ω N k = X C ( j ω Ω N π 2 j k Ω N )
      • bandlimited to Ω 0 : Ω N > Ω 0
      • bandlimited to Ω 0 : Ω N = Ω 0
      • bandlimited to Ω 0 : Ω N < Ω 0
      • non-bandlimited
  • sampling stategies : given a sampling period T s
    • bandlimited to π / T s or less : raw sampling is fine (equivalent to sinc sampling up to scaling factor T s )
    • non-bandlimited
      • bandlimit via a lowpass filter in continuous-time domain before sampling
        • raw sample and incur aliasing - bandlimiting : optimal with respect to least squares approximation
    • aliasing : error cannot be controlled, better bandlimit
  • sinc sampling and interpolation
  • least squares approximation with sinc sampling and interpolation
  • processing of analog signals
    • impulse invariance : H C ( j Ω ) = H ( e j π Ω / Ω N )
    • duality : H ( e j ω ) = H C ( j ω )
    • fractional delay : H ( e j ω ) = e j ω d with d \Z
      • discrete time : ideal filter (approximation with cubic local interpolation)
    • digital differentiator : H ( e j ω ) = j ω , F T x c ( t ) = j Ω X C ( j Ω )
      • discrete time : h [ n ] = ( 1 ) n n for n 0 else 0 , ideal filter (approximations exist)

Multirate signal processing

  • advanced sampling
    • from continous to discrete
    • discrete to continuous
    • practial interpolation :
      • time : x ( t ) = n = x [ n ] i ( t n T s T s )
      • frequency : X ( j Ω ) = T s n = x [ n ] I ( j T s Ω ) e j n T s Ω = π Ω N I ( j π Ω Ω N ) X ( e j π Ω Ω N )
    • sinc interpolation : i ( t ) = \sinc ( t ) and I ( j Ω ) = r e c t ( Ω 2 π )
    • zero-order hold : i ( t ) = r e c t ( t ) and I ( j Ω ) = s i n c ( Ω 2 π ) ($X(j\Omega)=\frac{\pi}{\Omega_N}\sinc(\frac{\Omega}{2\Omega_N})X(e^{j\pi\Omega/\Omega_N})$)
    • first-order
  • bandpass sampling : sampling theorem is only sufficient condition, in theory Ω N > Ω m a x what if signal is bandpass
    • bandpass : X ( j Ω ) = 0 for \abs Ω Ω c > Ω 0
    • no aliasing : requires at least Ω N Ω 0
    • baseband condition : Ω N = Ω c / k for some k \N
    • samples : for T s = π / Ω N , x [ n ] = x ( n T s ) is alias-free, baseband DT version of x ( t )
    • AM channel
  • upsampling : zoom, X N U [ n ] = x [ k ] for n = k N else 0 with k \Z
    • zero-fill
    • spectral representation : X N U ( e j ω ) = X ( e j ω N )
      • time domain : zeros between nonzero samples not natural
      • frequency domain : extra replicas of spectrum not natural
    • zero-order interpolator : for N -upsampling, i 0 [ n ] = u [ n ] u [ n N ] and \abs I 0 ( e j ω ) = \abs sin ( ω 2 N ) sin ( ω 2 )
    • first-order interplator : i 1 [ n ] = ( i 0 [ n ] i 0 [ n ] ) / N
    • ideal digital interpolator
  • downsampling : dezoom, X N D [ n ] = x [ n N ]
    • spectral representation : X N D ( e j ω ) = 1 N m = 0 N 1 X ( e j w 2 π m N )
    • without aliasing
    • with aliasing
    • with aliasing filter
    • caution with highpass signal
    • rational sampling rate change : in pratice, time-varying local interpolation
    • subsample interpolation : compute x ( n + τ ) with \abs τ < 1 / 2
      • local Lagrange approximation : x ( n + τ ) x L ( n ; τ ) = k = N N x [ n k ] L k ( N ) ( τ ) = ( x d τ ) [ n ] with 2 N + 1 -tap FIR d τ [ k ] = L k ( N ) ( τ )

Quantization

  • quantitzation : map range of signal onto finite set
    • factors : storage budget (bits per sample), storage scheme (fixed, floating), input properties (range, distribution)
    • irreversiable : quantization noise
    • simplest quantizer : each sample encoded individually (scalar), quantized independently (memoryless), encoded using R bits
    • scalar : A x [ n ] B , 2 R intervals
    • error : e [ n ] = Q x [ n ] x [ n ] = x ~ [ n ] x [ n ] , model error as white noise
    • uniform : interval Δ = ( B A ) 2 R
      • hypothesis : f x ( τ ) = 1 B A
      • MSE : σ e 2 = k = 0 2 R 1 l k f x ( τ ) ( x ~ k τ ) 2 d τ
      • minimizing error : σ e 2 x ~ m = 0 for x ~ m = A + m Δ + Δ 2 , interval midpoint
      • error energy : σ e 2 = Δ 2 12
      • signal energy : σ x 2 = ( B A ) 2 / 12
      • signal to noise ratio : S N R = σ x 2 / σ e 2 = 2 2 R ( S N R d B = 10 log 10 2 2 R 6 R db)
    • unbounded : clip samples to [ A , B ] (linear distortion) vs smoothly saturate input (simulate saturation curves of analog electronics)
    • gaussian : σ e 2 = 3 π 2 σ 2 Δ 2
    • Lloyd-Max algo : design optimal quantizer for distribution
    • companders
  • A/D converter : sampling discretizes time, quantization discretises amplitude
    • oversampling : reduce quantization error
  • D/A converter
    • oversampling : cheaper hardware for interpolation, undo in-band distortion in analog domain, significant out-of-band distortion, minimal D/A rate
    • oversampling using ZOH

Image processing

  • digital image : two-dimensional M 1 × M 2 finite-support signal x [ n 1 , n 2 ] , pixel grid
    • grayscale : scalar pixel value
    • color : multidimensional pixel value
  • still works : linearity, convolution, fourier, interpolation, sampling
  • breaks : fourier analysis less relevant, filter design hard, IIRs rare, linear operators only mildly useful
  • news : affine transforms, finite-support signals, causality loses meaning
  • rect : r e c t ( n 1 2 N 1 , n 2 2 N 2 ) = 1 only if \abs n 1 < N 1 and \abs n 2 < N 2 else 0
  • separable signals
    • dirac : δ [ n 1 , n 2 ] = δ [ n 1 ] δ [ n 2 ]
    • rect : r e c t ( n 1 2 N 1 , n 2 2 N 2 ) = r e c t ( n 1 2 N 1 ) r e c t ( n 2 2 N 2 )
  • nonseparable signal : x [ n 1 , n 2 ] = 1 if \abs n 1 + \abs n 2 < N else 0
  • 2D convolution : x [ n 1 , n 2 ] h [ n 1 , n 2 ] = k 1 = k 2 = x [ k 1 , k 2 ] h [ n 1 k 1 , n 2 k 2 ]
    • operations : M 1 M 2 per output sample
  • 2D convolution for separable signals : $x[n_1,n_2]h[n_1,n_2]=\sum_{k_1=-\infty}^\infty h_1[n_1-k_1]\sum_{k_2=-\infty}^\infty x[k_1,k_2]h_2[n_2-k_2]=h_1[n_1](h_2[n_2]*x[n_1,n_2])$
    • operations : M 1 + M 2 per output sample
  • affine transforms : mapping \R 2 \R 2 that reshapes coordinate system t = A t d \R 2 \Z 2
    • translation : A = I , $d=\begin{bmatrix}d_1 \\ d_2\end{bmatrix}$
    • scaling : $A=\begin{bmatrix}a_1 & 0 \\ 0 & a_2\end{bmatrix}$, d = 0
    • rotation : $A=\begin{bmatrix}\cos\theta & -\sin\theta \\ \sin\theta & \cos\theta\end{bmatrix}$, d = 0
    • horizontal flips : $A=\begin{bmatrix}-1 & 0 \\ 0 & 1\end{bmatrix}$, d = 0
    • vertical flips : $A=\begin{bmatrix}1 & 0 \\ 0 & -1\end{bmatrix}$, d = 0
    • horizontal shear : $A=\begin{bmatrix}1 & s \\ 0 & 1\end{bmatrix}$, d = 0
    • vertical shear : $A=\begin{bmatrix}1 & 0 \\ s & 1\end{bmatrix}$, d = 0
    • discrete-space solution
      • inverse transform : t = A 1 ( m + d )
      • interpolate mid-points : ( t 1 , t 2 ) = ( η 1 + τ 1 , η 2 + τ 2 ) with η 1 , 2 \Z and 0 τ 1 , 2 < 1
  • bilinear interpolation
    • first-order interpolator : y [ m 1 , m 2 ] = ( 1 τ 1 ) ( 1 τ 2 ) x [ η 1 , η 2 ] + τ 1 ( 1 τ 2 ) x [ η 1 + 1 , η 2 ] + ( 1 τ 1 ) τ 2 x [ η 1 , η 2 + 1 ] + τ 1 τ 2 x [ η 1 + 1 , η 2 + 1 ]
  • 2D DFT
    • analysis : X [ k 1 , k 2 ] = n 1 = 0 N 1 1 n 2 = 0 N 2 1 x [ n 1 , n 2 ] e j 2 π N 1 n 1 k 1 e j 2 π N 2 n 2 k 2
    • synthesis : x [ n 1 , n 2 ] = 1 N 1 N 2 k 1 = 0 N 1 1 k 2 = 0 N 2 1 X [ k 1 , k 2 ] e j 2 π N 1 n 1 k 1 e j 2 π N 2 n 2 k 2
    • orthogonal basis : N 1 N 2 vectors, w k 1 , k 2 [ n 1 , n 2 ] = e j 2 π N 1 n 1 k 1 e j 2 π N 2 n 2 k 2
    • basis for k 1 = 3 and k 2 = 230
    • matrix form
    • HDR images : need to compress the levels
      • remove flagrant outliers
      • nonlinear mapping : y = x 1 / 3 after normalization x 1
    • magnitude : does not carry much information
    • phase : carry some info
  • image filtering
    • lowpass : smoothing
    • highpass : enhancement, edge detection
    • 2D IIRs : nonlinear phase, border effects, stability (fundamental theorem of algebra does not hold in multiple dimensions)
    • noncomputable CCDE
    • 2D FIR : generally zero centered, odd number of taps in both directions, stable
      • moving average
      • gaussian blur : h [ n 1 , n 2 ] = 1 2 π σ 2 e n 1 2 + n 2 2 2 σ 2
      • sobel
      • Laplacian : Δ f ( t 1 , t 2 ) = 2 f t 1 2 + 2 f t 2 2

Image compression

  • compression : exploit physical redundancy, allocate bits for things that matter
    • lossy : some information discarded
    • key : compressing at block level, using suitable transform (change of basis), smart quantization, entropy coding
  • level compressing
    • pixel level : reduce number bits per pixel, coarser quantization, limit 1bpp
    • block level : divide in blocks, code average value with 8 bits, less than 1bpp, exploit local spatial correlation, compress remote regions independently
    • transform coding
    • discrete cosine transform : C [ k 1 , k 2 ] = n 1 = 0 N 1 n 2 = 0 N 1 x [ n 1 , n 2 ] cos [ π N ( n 1 + 1 / 2 ) k 1 ] cos [ π N ( n 2 + 1 / 2 ) k 2 ]
  • smart quantization
    • standard : x ^ = f l o o r ( x ) + 0.5
    • deadzone : x ^ = r o u n d ( x )
    • variable step : fine to coarse
  • JPEG standard
    • split image into 8x8 non-overlapping blocks
    • computed DCT of each block
    • quantize DCT coefficients according to psycovisually-tuned tables
    • zigzag scan to maximize ordering
    • run-length encoding : each nonzero value encoded as [ ( r , s ) , c ] , 8 bit per pair
      • runlength : r number of zeros before current value
      • size : s number of bits needed to encode value
      • actual value : c
      • ( 0 , 0 ) : indicates only zeros from now
    • huffman coding

Digital communication system

  • success factors
    • DSP paradigm : integer easy to regenerate, good phase control, adaptive algo
    • algo : entropy coding, error correction, trellis-coded modulation, viterbi
    • hardware : miniatuziation, general-purpose platforms, power efficiency
  • analog channel : affect capacity
    • bandwidth constraint : grow as 1 / T s
    • power constraint : limit max amplitude
    • AM radio channel : from $530$kHz to $1.7$MHz, each channel $8$kHz, power limited by law (daytime, nighttime, interference, health)
  • channel capacity : maximum amount of information that can be reliably delivered over a channel (bit per second)
  • all-digital paradigm : keep everything digital until we hit physical channel
  • transmitter design
    • white random sequence : a [ n ]
    • shaping bandwidth : shrink support of full-band signal with upsampling (does not change data rate)
    • Baud rate : available bandwidth W = F m a x F m i n , F s = K W > 2 F m a x thus ω m a x ω m i n = 2 π W F s = 2 π K
    • raised cosine : 1 / n 2 decay
  • transmission reliability : â [ n ] = a [ n ] + η [ n ]
    • error : depends on power of noise vs of signal, decoding strategy, alphabet
    • signaling alphabet
      • mapper : split incoming bitstream into chunks, assign symbol a [ n ] from finite alphabet A to each
      • slicer : receive value â [ n ] , decide which symbol is closest, piece back blocks
    • two-level signaling :
      • alphabet : ± G
      • transmitted power : σ s 2 = G 2
      • error probability : Q ( G / σ 0 ) = Q ( σ s / σ 0 ) = Q ( S N R )
  • signaling scheme
    • PAM : chunks of M bits (corresponding k [ n ] 0 , , 2 M 1 ), a [ n ] = G ( ( 2 M + 1 ) + 2 k [ n ] ) , a [ n ] = arg min a A [ \abs â [ n ] a ] , zero-mean, distance 2 G
    • QAM : chunks of M even bits, M / 2 for PAM a r [ n ] and a i [ n ] , a [ n ] = G ( a r [ n ] + j a i [ n ] , a [ n ] = arg min a A [ \abs â [ n ] a ]
      • error probability : circular approximation P e r r exp G 2 σ 0 2 exp 3 S N R / 2 M + 1
      • transmitted power : σ s 2 = G 2 2 3 ( 2 M 1 )
      • recipe : M = log 2 ( 1 3 2 S N R ln ( p e ) )
      • passband : c [ n ] = b [ n ] e j ω c n , s [ n ] = c [ n ] = b r [ n ] cos ω c n b i [ n ] sin ω c n
  • receiver
    • issues
      • propagation delay : handshake, delay estimation
      • linear distortion : D ( j Ω ) , adapative equalization
      • interference : line probing
      • clock drifts : timing recovery
    • Hilbert demodulation
    • throughput : W M bps
  • shannon capacity upperbound : C = W log 2 ( 1 + S N R )
  • delay compensation : D ( j Ω ) = e j Ω d , d = ( L + τ ) T s with \abs τ < 1 / 2 and L \N
    • bulk delay : L
    • fractional delay : τ
      • transmit : b [ n ] = e j ω 0 n , s [ n ] = cos ( ( ω c + ω 0 ) n )
      • receive : s ^ [ n ] = cos ( ( ω c + ω 0 ) ( n L τ ) )
      • after demodulation : b ^ [ n ] = e j ω 0 ( n τ ) (known frequency)
      • compensating : s ^ [ n ] = s ( ( n τ ) T s ) (after offsetting bulk delay), in theory compensate with sinc fractional delay ($h[n]=\sinc(n+\tau)$), in practive filter local Lagrange approx
  • adaptive equalization : in theory E ( z ) = 1 / D ( z ) but change over time
    • bootstrapping using training sequence
  • ADSL channel : N sub-channel, M -QAM
    • discrete multitone modulation : insteadd of lowpassing, use 2 N -tap interval indicator
    • complex output signal : c [ n ] = k = 0 N 1 a k [ n / 2 N ] e j 2 π 2 N n k
    • specs : $F_{max}=1104$KHz, N = 256 , M = 4 , voice channel 0-7, upstream data: 7-31, max throughput 14.9Mbps (downstream)