代写代考 CS4551

Multimedia Software Systems CS4551
Digital Data Acquisition
CSULA CS451 Multimedia Software Systems by Eun-Young Kang
Analog Signal/Digital Data

Copyright By PowCoder代写 加微信 powcoder

• Analog signal: continuous signal
• Digital data: discrete numbers (codes)
• Digitization: a process that converts analog signal to digital
• Interpolation: a process that recovers the original signal from digital codes
• Analog-to-Digital Converter (ADC): the device that converts analog signal to digital numbers
• Digital-to-Analog Converter (DAC): the device that converts digital codes to analog signal
CSULA CS451 Multimedia Software Systems by Eun-Young Kang

Digitization
• The digitization of a signal comprises two steps: – Sampling: extracting a subset of the signal
– Quantization: approximating continuous range values by a set of discrete values (in b-bits)
CSULA CS451 Multimedia Software Systems by Eun-Young Kang
Fraction of a Second
second [ s ]
0.001 [ thousandth ]
millisecond [ ms ]
0.000 001 [ millionth ]
microsecond [ μs ]
CSULA CS451 Multimedia Software Systems

Sampling and Sampling Period T
• Sampling of a signal 𝑥 𝑡 produces samples 𝑥𝑠 𝑛 that
is 𝑛th sampled signal value at time 𝑛 × 𝑇. 𝑥𝑡→𝑥𝑛𝑇 =𝑥𝑠 𝑛
where 𝑛 = 1, 2, 3, ⋯ and 𝑇 is the sampling period
• If 𝑇 = 1ms/5ms/10ms, how many samples do we
get per second?
• If𝑇=2ms,𝑥𝑠 1 =𝑥 1×2ms ,𝑥𝑠 2 =
CSULA CS451 Multimedia Software Systems by Eun-Young Kang
Sampling Example
CSULA CS451 Multimedia Software Systems by Eun-Young Kang

Sampling Frequency 𝐹
• For a signal 𝑥 𝑡 , this step produces 𝑥 𝑛𝑇 = 𝑥𝑠 𝑛 ,
where 𝑇 is the sampling period.
• 𝐹 = 1/𝑇 is the sampling frequency.
– If𝑇=1ms,𝐹=1/0.001=1000.
– If𝑇=5ms,𝐹=1/0.005=200.
– If𝑇=10ms,𝐹=1/0.01=100.𝐹=100meansthat sampling produces 100 samples per second.
• SamplingfrequencyismeasureinHz. – e.g. 𝐹 = 100Hz, 𝐹 = 2KHz, etc.
CSULA CS451 Multimedia Software Systems by Eun-Young Kang
Sampling Issue
• TheinversetransformationiscalledInterpolation – 𝑥 𝑡 from 𝑥𝑠 𝑛
– If the sampled signal is interpolated, how do you ensure that you get back the original signal? (How fast should we sample?)
CSULA CS451 Multimedia Software Systems by Eun-Young Kang

Quantization
• The value at every sampled location is digitized. The digital domain has a finite bit representation. The sampled value is approximated to the nearest digital value.
– 𝑥𝑞 𝑛 = 𝑄 𝑥𝑠 𝑛 , where 𝑄 is a quantization function which
• Formally
maps the values of 𝑥𝑠 𝑛 into 𝑁 levels with a quantization step Δ.
– Typically, 2𝑏−1 < 𝑁 ≤ 2𝑏 so that we need 𝒃 bits to represent one quantized sample. – What is the correct quantization step? – Quantization errors may result! CSULA CS451 Multimedia Software Systems by Eun-Young Kang Quantization 𝑛 𝑡, Δ = 0.05 CSULA CS451 Multimedia Software Systems by Eun-Young Kang CSULA CS451 Multimedia Software Systems by Eun-Young Kang CSULA CS451 Multimedia Software Systems by Eun-Young Kang Digitization • The digitization of a signal 𝑥 𝑡 comprises two steps: Sampling 𝑥𝑡→𝑥𝑛𝑇 =𝑥𝑠 𝑛 Quantization 𝑥𝑠 𝑛→𝑥𝑞 𝑛 Digitization 𝑥𝑡→𝑥𝑠 𝑛→𝑥𝑞 𝑛 CSULA CS451 Multimedia Software Systems by Eun-Young Kang • Howmanybitsdoyougetpersecond(bits/second)? Bit rate = (number of samples per second) × (bits per sample) • Assamplingrateincreases,bitrateincreases • Asquantizationbitsusedincrease,bitrateincreases CSULA CS451 Multimedia Software Systems by Eun-Young Kang Bit Rate Examples • Digitized audio? – Sampling frequency: 𝐹 = 44.1 KHz (sampling period: 𝑇 = 1/𝐹 = 0.023 ms) – Quantization with 𝑏 = 16 bits (𝑁 = 216 = 65,536) – Bit-rate=𝑏𝐹 =𝑏/𝑇 =44.1K×16=705.6Kb/s(1𝐾=103bits) – Example: 1 minute of uncompressed stereo music takes more than 10 MB! • Digitized speech? – Sampling frequency: 𝐹 = 8 KHz (why?) – Quantization with b = 16 bits – Bit-rate=𝑏𝐹=8K×16=128Kb/s(1𝐾=103bits) CSULA CS451 Multimedia Software Systems by Eun-Young Kang What is the correct sampling rate? • If 𝐹 is too large (𝑇 is too small), we obtain too high a bitrate • If𝐹istoosmall(𝑇istoolarge),toomuchinformation is lost in the sampling process • Wewanttocaptureasmuchinformationasnecessary to represent the signal correctly CSULA CS451 Multimedia Software Systems by Eun-Young Kang Sampling Example CSULA CS451 Multimedia Software Systems by Eun-Young Kang Sampling Rate • Wecanseethatthesamplingrateaffectsthe reconstructed signal. • How can we have a correct sampling rate depending on a signal? • SamplingTheorem:theminimumsamplingratefor “correct” sampling depends on the frequency characteristics of the signal CSULA CS451 Multimedia Software Systems by Eun-Young Kang Nyquist-Shannon’s Sampling Theorem • Nyquist-Shannon’sSamplingTheorem – A continuous signal can be completely reconstructed from a set of equally spaced samples iff the sampling frequency is greater than twice the highest frequency of the signal • Nyquistrate𝐹=2𝐵,where𝐵isthehighestfrequency of the signal • Issue - How can we know the highest frequency of a signal? – Fourier Transform : An equivalent frequency spectrum representation of a signal in the temporal/spatial domain CSULA CS451 Multimedia Software Systems by Eun-Young Kang Frequency of a Signal from spatial/temporal domain to frequency domain from frequency domain back to spatial/temporal domain CSULA CS451 Multimedia Software Systems by Eun-Young Kang CSULA CS451 Multimedia Software Systems by Eun-Young Kang Band-limited Signals • Fourier Transform 𝑋 𝑓 of a signal 𝑥 𝑡 – An equivalent frequency spectrum representation of a signal in the spatial domain – Reminder: frequency is measured in Hz • Band (𝑩) of a signal: highest frequency “contained” in the signal • Ifthehighestfrequencyin𝑋 𝑓 is𝐵,wesay𝒙 𝒕 isBandLimitedto𝑩 CSULA CS451 Multimedia Software Systems by Eun-Young Kang Band-limited Signals • SamplingTheoremRevisited – Let 𝑥 𝑡 have a maximum frequency 𝐵. Then we can “perfectly” reconstruct (interpolate) 𝑥 𝑡 from its sampled version 𝑥𝑠 𝑛 only if sampling rate 𝐹 > 2𝐵 (i.e. the sampling period𝑇<1/ 2𝐵 ) • Otherwise – aliasing – “Aliasing” is a form of non– linear, signal–dependent distortion CSULA CS451 Multimedia Software Systems by Eun-Young Kang Aliasing Examples • Audio aliasing – without aliasing – with aliasing • Image aliasing • Examples of Spatial aliasing and Temporal aliasing CSULA CS451 Multimedia Software Systems by Eun-Young Kang Spatial Domain Aliasing CSULA CS451 Multimedia Software Systems by Eun-Young Kang Moiré Patterns • Moiré effect (an example of aliasing) – A different pattern will result in in the reconstructed image if the pattern in the original image is not sampled at a rate that is at least twice the rate of repetition of the pattern. CSULA CS451 Multimedia Software Systems by Eun-Young Kang Moiré Patterns CSULA CS451 Multimedia Software Systems by Eun-Young Kang Signal Filtering • A “filter” 𝐻 𝑓 is an operator characterized by its frequency response : – The Fourier transform of 𝑦 𝑡 is 𝑌 𝑓 = 𝐻 𝑓 𝑋 𝑓 – The band 𝐵 of 𝑦 𝑡 is smaller the band 𝐵 of the filter – Filters can be low-pass, band-pass or high-pass CSULA CS451 Multimedia Software Systems by Eun-Young Kang Example: Low-Pass Filter CSULA CS451 Multimedia Software Systems by Eun-Young Kang Example: Band-pass Filter CSULA CS451 Multimedia Software Systems by Eun-Young Kang Example: High-pass Filter CSULA CS451 Multimedia Software Systems by Eun-Young Kang CSULA CS451 Multimedia Software Systems by Eun-Young Kang CSULA CS451 Multimedia Software Systems by Eun-Young Kang CSULA CS451 Multimedia Software Systems by Eun-Young Kang Prefiltering (Filtering Before Sampling) • If we need to sample a signal that has band B using a sampling rate 𝐹 < 2𝐵, we have two choices: – Sample the signal as it is, obtaining aliasing – Prefilter the signal with a filter that has band 𝐵h and use 𝐹 = 2𝐵h accordingly, • In this case, we lose all the frequencies between 𝐵 and 𝐵h (equal to 𝐹/2), but do not get aliasing. => In other words, if we use 𝐹 lower than the highest frequency of the original signal, we cannot recover all frequencies above 𝐹/2. But no aliasing for the data lower than 𝐹/2.
CSULA CS451 Multimedia Software Systems by Eun-Young Kang
Examples Using Filters in Compression
• AudioFilteringExample
– An microphone captures up to 100 KHz (i.e. cutoff frequency is 100 KHz).
• We should sample at 200 KHz.
• If Quantized at 16 bits per sample→3 Mbs!
– But our hearing system can only detect frequencies up to ~20KHz.
– Thus, prefilter the signal
• Use a low-pass filter with filter frequency 20 KHz. Then, we sample the signal at 40 KHz producing only 640 Kb/s
• In fact, for CD Audio we use a sampling frequency of 44.1 KHz CSULA CS451 Multimedia Software Systems by Eun-Young Kang

Subsampling (Decimation)
• Given 𝑥𝑠 𝑛 , subsampling by 𝑀 means generating a
signal𝑦 𝑛 =𝑥 𝑀𝑛 ,where𝑀>1 𝑠𝑠
• Example: A continuous signal 𝑥 𝑡 , band-limited to 𝐵 = 4 KHz is sampled without aliasing with 𝐹 = 10 KHz.
• Suppose now we subsample the resulting signal by 2. This means sampling the original signal with rate 𝐹 = 5 KHz (which gives aliasing)
• Solution:digitallow-passfilterbeforesubsampling. CSULA CS451 Multimedia Software Systems by Eun-Young Kang
Subsampling Example
CSULA CS451 Multimedia Software Systems by Eun-Young Kang

Original Image
CSULA CS451 Multimedia Software Systems by Eun-Young Kang
Subsampled by 2
CSULA CS451 Multimedia Software Systems by Eun-Young Kang

Subsampled by 4
CSULA CS451 Multimedia Software Systems by Eun-Young Kang
What is the correct quantization step?
• If too many quantization levels 𝑁 = 2𝑏 : too high a bit-rate
• If too few quantization levels 𝑁 = 2𝑏 : distortion due to quantization error (a.k.a. quantization noise)
CSULA CS451 Multimedia Software Systems by Eun-Young Kang

Statistical Definitions
• Mean of the signal 𝑥 𝑛 , for a large sample space M: 1𝑀
𝜇𝑥 =𝑀෍𝑥 𝑛 𝑛=1
• The variance of the signal 𝑥 𝑛 : 1𝑀
𝜎2= ෍𝑥𝑛−𝜇2 𝑥𝑀𝑥
• The power of the quantization error, 𝜎2, is the variance of the signal 𝑒
𝑒 𝑛 = 𝑥𝑞 𝑛 − 𝑥 𝑛
• The signal-to-quantization noise ratio (measured in decibels dB) 𝑆𝑄𝑁𝑅 = 10log 𝜎2/𝜎2 = 20log 𝜎 /𝜎
CSULA CS451 Multimedia Software Systems by Eun-Young Kang
10 𝑥 𝑒 10 𝑥 𝑒
Quantization – Facts
• Now,assumethat𝑁=2𝑏,where𝑏isthenumberof bits for representing the quantized value.
• Then𝑆𝑄𝑁𝑅=20×𝑏×log102=6.03𝑏(dB).
– Thus, the SQNR increases by 6 dB for every bit we add when quantizing an input sample. So 16 bits provide a maximum SQNR of 96 dB.
CSULA CS451 Multimedia Software Systems by Eun-Young Kang

Some Useful Numbers
CSULA CS451 Multimedia Software Systems by Eun-Young Kang
Quantization Example (1)
CSULA CS451 Multimedia Software Systems by Eun-Young Kang

Quantization Example (2)
CSULA CS451 Multimedia Software Systems by Eun-Young Kang
Quantization Example (3)
CSULA CS451 Multimedia Software Systems by Eun-Young Kang

程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com