digital representation of analog information how images and sound are stored and communicated april...
Post on 21-Dec-2015
214 views
TRANSCRIPT
![Page 1: Digital Representation of Analog Information How Images and Sound are Stored and Communicated April 5, 2011Harvard Bits1](https://reader036.vdocument.in/reader036/viewer/2022062714/56649d535503460f94a2ff2d/html5/thumbnails/1.jpg)
Digital Representation of Analog Information
How Images and Sound are Stored and Communicated
April 5, 2011 Harvard Bits 1
![Page 2: Digital Representation of Analog Information How Images and Sound are Stored and Communicated April 5, 2011Harvard Bits1](https://reader036.vdocument.in/reader036/viewer/2022062714/56649d535503460f94a2ff2d/html5/thumbnails/2.jpg)
The Sine Wave
April 5, 2011 Harvard Bits 2
![Page 3: Digital Representation of Analog Information How Images and Sound are Stored and Communicated April 5, 2011Harvard Bits1](https://reader036.vdocument.in/reader036/viewer/2022062714/56649d535503460f94a2ff2d/html5/thumbnails/3.jpg)
Amplitude
April 5, 2011 Harvard Bits 3
![Page 4: Digital Representation of Analog Information How Images and Sound are Stored and Communicated April 5, 2011Harvard Bits1](https://reader036.vdocument.in/reader036/viewer/2022062714/56649d535503460f94a2ff2d/html5/thumbnails/4.jpg)
Frequency and Period
April 5, 2011 Harvard Bits 4
Frequency = 1/Period Period = 1/Frequency
Frequency in cycles/sec Period in sec/cycle
![Page 5: Digital Representation of Analog Information How Images and Sound are Stored and Communicated April 5, 2011Harvard Bits1](https://reader036.vdocument.in/reader036/viewer/2022062714/56649d535503460f94a2ff2d/html5/thumbnails/5.jpg)
Period and Wavelength
• Period = time duration of one cycle• Wavelength = spatial length of one cycle• For waves traveling at a fixed speed, period
and wavelength are proportional• E.g. light travels at speed c m/sec, and
Wavelength = c * Period
April 5, 2011 Harvard Bits 5
![Page 6: Digital Representation of Analog Information How Images and Sound are Stored and Communicated April 5, 2011Harvard Bits1](https://reader036.vdocument.in/reader036/viewer/2022062714/56649d535503460f94a2ff2d/html5/thumbnails/6.jpg)
Wavelength · Frequency = Speed(m) · (#/sec) = m/sec
• If speed is fixed then wavelength and frequency vary inversely
• E.g. speed of light in vacuum, speed of sound in air are constant
• Frequency measured in Hertz: 1 Hz = 1 cycle/sec• AC current = 60 Hz• A note above middle C = 440 Hz• Audible telephone frequencies = 400 - 3400 Hz = 0.4 -
3.4 KHz• Visible light = (4-7.5) · 1014 Hz
April 5, 2011 Harvard Bits 6
![Page 7: Digital Representation of Analog Information How Images and Sound are Stored and Communicated April 5, 2011Harvard Bits1](https://reader036.vdocument.in/reader036/viewer/2022062714/56649d535503460f94a2ff2d/html5/thumbnails/7.jpg)
Phase
April 5, 2011 Harvard Bits 7
![Page 8: Digital Representation of Analog Information How Images and Sound are Stored and Communicated April 5, 2011Harvard Bits1](https://reader036.vdocument.in/reader036/viewer/2022062714/56649d535503460f94a2ff2d/html5/thumbnails/8.jpg)
Sum of Sine Waves
April 5, 2011 Harvard Bits 8
sin(x) and 0.2*sin(10*x) sin(x) + 0.2*sin(10*x)
![Page 9: Digital Representation of Analog Information How Images and Sound are Stored and Communicated April 5, 2011Harvard Bits1](https://reader036.vdocument.in/reader036/viewer/2022062714/56649d535503460f94a2ff2d/html5/thumbnails/9.jpg)
Touch-Tone Telephone
April 5, 2011 Harvard Bits 9
1209 Hz
1336 Hz
1477 Hz
697 Hz
770 Hz
852 Hz
941 Hz
![Page 10: Digital Representation of Analog Information How Images and Sound are Stored and Communicated April 5, 2011Harvard Bits1](https://reader036.vdocument.in/reader036/viewer/2022062714/56649d535503460f94a2ff2d/html5/thumbnails/10.jpg)
Visible Light
April 5, 2011 Harvard Bits 10
A filter is something that transmits only a limited “band” of wavelengths
Short wavelength, high frequency
Long wavelength, low frequency
Blue Filter Red Filter
![Page 11: Digital Representation of Analog Information How Images and Sound are Stored and Communicated April 5, 2011Harvard Bits1](https://reader036.vdocument.in/reader036/viewer/2022062714/56649d535503460f94a2ff2d/html5/thumbnails/11.jpg)
Signals can be Filtered
April 5, 2011 Harvard Bits 11
Components
![Page 12: Digital Representation of Analog Information How Images and Sound are Stored and Communicated April 5, 2011Harvard Bits1](https://reader036.vdocument.in/reader036/viewer/2022062714/56649d535503460f94a2ff2d/html5/thumbnails/12.jpg)
Any Periodic Signal is Approximately a Sum of Sine Waves
April 5, 2011 Harvard Bits 12
![Page 13: Digital Representation of Analog Information How Images and Sound are Stored and Communicated April 5, 2011Harvard Bits1](https://reader036.vdocument.in/reader036/viewer/2022062714/56649d535503460f94a2ff2d/html5/thumbnails/13.jpg)
Fourier Analysis = Decomposition of Signal into Sines
• Signal usually is a sum of waves of higher and higher frequency and lower and lower amplitude
• Higher frequency components give greater accuracy• Next component of square wave:
April 5, 2011 Harvard Bits 13
![Page 14: Digital Representation of Analog Information How Images and Sound are Stored and Communicated April 5, 2011Harvard Bits1](https://reader036.vdocument.in/reader036/viewer/2022062714/56649d535503460f94a2ff2d/html5/thumbnails/14.jpg)
Sampling
April 5, 2011 Harvard Bits 14
A signal can be reconstructed from samples taken at regular intervals as long as the intervals are short enough
![Page 15: Digital Representation of Analog Information How Images and Sound are Stored and Communicated April 5, 2011Harvard Bits1](https://reader036.vdocument.in/reader036/viewer/2022062714/56649d535503460f94a2ff2d/html5/thumbnails/15.jpg)
Undersampling causes Aliasing
April 5, 2011 Harvard Bits 15
If the samples are too infrequent a lower-frequency signal may fit the sampled points and the original signal can’t be recovered
![Page 16: Digital Representation of Analog Information How Images and Sound are Stored and Communicated April 5, 2011Harvard Bits1](https://reader036.vdocument.in/reader036/viewer/2022062714/56649d535503460f94a2ff2d/html5/thumbnails/16.jpg)
Nyquist Sampling Theorem
• For the signal to be recovered accurately from the samples, the sampling rate must be more than twice the frequency of the highest-frequency component
• Wave frequency 1 KHz so sampling must be more than 2KHz to recover signal
April 5, 2011 Harvard Bits 16
![Page 17: Digital Representation of Analog Information How Images and Sound are Stored and Communicated April 5, 2011Harvard Bits1](https://reader036.vdocument.in/reader036/viewer/2022062714/56649d535503460f94a2ff2d/html5/thumbnails/17.jpg)
Alias = Another Signal with Same Samples as Original
April 5, 2011 Harvard Bits 17
![Page 18: Digital Representation of Analog Information How Images and Sound are Stored and Communicated April 5, 2011Harvard Bits1](https://reader036.vdocument.in/reader036/viewer/2022062714/56649d535503460f94a2ff2d/html5/thumbnails/18.jpg)
Audio Frequencies and Sampling
• Telephone system designed around 3.4KHz max• Human hearing up to 20KHz• Loss of high frequency components ==> poorer
quality sound• Digital telephones sample at 8KHz = 2*4kHz• CD ROM samples at 44.1KHz > 2*20KHz• Some PC sound cards sample at this rate• So VOIP (Voice Over IP) can have higher fidelity
than telephone land lines!
April 5, 2011 Harvard Bits 18
![Page 19: Digital Representation of Analog Information How Images and Sound are Stored and Communicated April 5, 2011Harvard Bits1](https://reader036.vdocument.in/reader036/viewer/2022062714/56649d535503460f94a2ff2d/html5/thumbnails/19.jpg)
Quantization:How Many Bits per Sample?
• n bits/sample => 2n possible sample values
April 5, 2011 Harvard Bits 19
Audio CDs => 16 bits/sample * 2 channels for stereoDigital Telephones => 8 bits/sample
![Page 20: Digital Representation of Analog Information How Images and Sound are Stored and Communicated April 5, 2011Harvard Bits1](https://reader036.vdocument.in/reader036/viewer/2022062714/56649d535503460f94a2ff2d/html5/thumbnails/20.jpg)
How Many Bits of Music?
• Audio CD: 1 hour of music = 3600 s * 44,100 sample/s * 16 bits/sample* 2 stereo
channels= 5Gb = 636MB
• Bits are used to reconstruct the sine waves, not simply to adjust the volume in jagged jumps
April 5, 2011 Harvard Bits 20
![Page 21: Digital Representation of Analog Information How Images and Sound are Stored and Communicated April 5, 2011Harvard Bits1](https://reader036.vdocument.in/reader036/viewer/2022062714/56649d535503460f94a2ff2d/html5/thumbnails/21.jpg)
Compression of Music
• CDs are uncompressed • When CD standard was set it would have been
too expensive to put decompression chips into consumer electronics
• Requires intelligence in the processor• CDs are a dying technology. Already often used
only once, to move music onto computer disk or Ipod
• What you can do with information depends on the representation!
April 5, 2011 Harvard Bits 21
![Page 22: Digital Representation of Analog Information How Images and Sound are Stored and Communicated April 5, 2011Harvard Bits1](https://reader036.vdocument.in/reader036/viewer/2022062714/56649d535503460f94a2ff2d/html5/thumbnails/22.jpg)
Compressing Music Losslessly• For storage on computer disk, compression is possible
because music samples have low entropy • Less space <==> more computing • Simple example: Take advantage of the fact that
successive samples usually differ by only a little• E.g. Difference coding: Record one value (16 bits) and
then just the changes, sample to sample• E.g. 4527; +1, 0, 0, -3, +2, 0, 0, 0, +7, 0, 0, -1, …• Huffman coding this sequence ==> huge compression• Real example: FLAC = Free Lossless Audio Code
April 5, 2011 Harvard Bits 22
![Page 23: Digital Representation of Analog Information How Images and Sound are Stored and Communicated April 5, 2011Harvard Bits1](https://reader036.vdocument.in/reader036/viewer/2022062714/56649d535503460f94a2ff2d/html5/thumbnails/23.jpg)
Lossy Compression of Music
• Once you have the bits, there is lots of computing you can do on them
• Principle: If the average teenager can’t hear the difference, why waste money preserving it?
• Rely on psychoacoustic phenomena to compress music in a way that sounds almost perfect but isn’t
• Not to be used at the studio for archival storage• A family of methods -- depending on the degree of
compression, enough information may be thrown away to be subtly audible
April 5, 2011 Harvard Bits 23
![Page 24: Digital Representation of Analog Information How Images and Sound are Stored and Communicated April 5, 2011Harvard Bits1](https://reader036.vdocument.in/reader036/viewer/2022062714/56649d535503460f94a2ff2d/html5/thumbnails/24.jpg)
Lossy Audio Compession Ideas
• Throw away very high frequency components• Throw away any component that is soft if it is
simultaneous with a loud component• Change stereo to mono (50% savings) if mostly low
frequencies -- where stereo is hard to hear• MP3, RealAudio, …• These standards stipulate decoding but not encoding --
there may be several encodings of the same music that discard different information to produce different storage sizes and bit rates
April 5, 2011 Harvard Bits 24
![Page 25: Digital Representation of Analog Information How Images and Sound are Stored and Communicated April 5, 2011Harvard Bits1](https://reader036.vdocument.in/reader036/viewer/2022062714/56649d535503460f94a2ff2d/html5/thumbnails/25.jpg)
Still Image and Video Encoding
• GIF and JPEG for still images• JPEG better for continuous-tone color, GIF for
monochrome and line drawings• JPEG exploits the fact that 24 bits of color are more
than the eye can see• Eye is more sensitive to small fluctuations in
intensity than small fluctuations in color• Spatial coherence: colors similar pixel to pixel• MPEG exploits temporal coherence for movies:
successive frames of video are usually similar
April 5, 2011 Harvard Bits 25
![Page 26: Digital Representation of Analog Information How Images and Sound are Stored and Communicated April 5, 2011Harvard Bits1](https://reader036.vdocument.in/reader036/viewer/2022062714/56649d535503460f94a2ff2d/html5/thumbnails/26.jpg)
Modulation
• There is only one sine wave at a given frequency, so how does the information get carried at a particular frequency?
• Modulation = Encoding information on a signal• Analog radio modulation technologies: – FM = Frequency Modulation– AM = Amplitude Modulation
April 5, 2011 Harvard Bits 26
![Page 27: Digital Representation of Analog Information How Images and Sound are Stored and Communicated April 5, 2011Harvard Bits1](https://reader036.vdocument.in/reader036/viewer/2022062714/56649d535503460f94a2ff2d/html5/thumbnails/27.jpg)
Amplitude Modulation
April 5, 2011 Harvard Bits 27
![Page 28: Digital Representation of Analog Information How Images and Sound are Stored and Communicated April 5, 2011Harvard Bits1](https://reader036.vdocument.in/reader036/viewer/2022062714/56649d535503460f94a2ff2d/html5/thumbnails/28.jpg)
FM = Frequency Modulation
April 5, 2011 Harvard Bits 28
![Page 29: Digital Representation of Analog Information How Images and Sound are Stored and Communicated April 5, 2011Harvard Bits1](https://reader036.vdocument.in/reader036/viewer/2022062714/56649d535503460f94a2ff2d/html5/thumbnails/29.jpg)
Problems with AM and FM
• Power varies with amplitude– [to be precise, power is the square root of the average of
the square of the signal power, the root mean square or rms power]
• As signal fades with distance, some parts of AM signals drop out before others
• But AM can transmit over longer distances because AM frequencies bounce off ionosphere and diffract around hills and buildings but FM frequencies are absorbed, causing “shadows”
• This difference between AM and FM is due to the frequency bands allocated to them, not the modulation technique!
April 5, 2011 Harvard Bits 29
![Page 30: Digital Representation of Analog Information How Images and Sound are Stored and Communicated April 5, 2011Harvard Bits1](https://reader036.vdocument.in/reader036/viewer/2022062714/56649d535503460f94a2ff2d/html5/thumbnails/30.jpg)
April 5, 2011 Harvard Bits 30
![Page 31: Digital Representation of Analog Information How Images and Sound are Stored and Communicated April 5, 2011Harvard Bits1](https://reader036.vdocument.in/reader036/viewer/2022062714/56649d535503460f94a2ff2d/html5/thumbnails/31.jpg)
Signal and Noise
• Signal is the information you want to transmit• Noise is just another signal, added to and interfering with
the signal you want to transmit• Some noise is random and unavoidable and comes from
natural sources• Some noise is intentional and is actually someone else’s
signal• A party can be “noisy” even though most of the “noise” is
just conversations other than yours!
April 5, 2011 Harvard Bits 31
![Page 32: Digital Representation of Analog Information How Images and Sound are Stored and Communicated April 5, 2011Harvard Bits1](https://reader036.vdocument.in/reader036/viewer/2022062714/56649d535503460f94a2ff2d/html5/thumbnails/32.jpg)
Noise and Channel Capacity
• If the noise is “soft” it is easy to pick out the signal• If the noise is “loud” it introduces many errors into the received signal• In a digital communications channel the noise level affects the channel
capacity• “Loud” noise can be compensated for by channel coding, at the expense
of lower data rate• Recall Shannon’s Channel Coding Theorem: Error rate can be made as
close to zero as desired, as long as the rate at which bits are transmitted does not exceed the channel capacity
April 5, 2011 Harvard Bits 32
![Page 33: Digital Representation of Analog Information How Images and Sound are Stored and Communicated April 5, 2011Harvard Bits1](https://reader036.vdocument.in/reader036/viewer/2022062714/56649d535503460f94a2ff2d/html5/thumbnails/33.jpg)
Signal to Noise Ratio
• “Loudness” of signal and noise are their power• The key parameter is the
Signal to Noise Ratio = SNR = S/Nwhere S = signal power, N = noise power
• High SNR = clearer signal = higher channel capacity
April 5, 2011 Harvard Bits 33
![Page 34: Digital Representation of Analog Information How Images and Sound are Stored and Communicated April 5, 2011Harvard Bits1](https://reader036.vdocument.in/reader036/viewer/2022062714/56649d535503460f94a2ff2d/html5/thumbnails/34.jpg)
Decibels
• SNR is a pure number: (signal power)/(noise power)
• Typically measured by its base ten logarithm: One bel = log10 (#)– (named after Alexander Graham Bell)
• So a tenfold increase in SNR raises it by one bel• One decibel = (1/10) of one bel• So 90 db is a ratio of 109 = 1 billion
April 5, 2011 Harvard Bits 34
http://docs.info.apple.com/article.html?artnum=58299
![Page 35: Digital Representation of Analog Information How Images and Sound are Stored and Communicated April 5, 2011Harvard Bits1](https://reader036.vdocument.in/reader036/viewer/2022062714/56649d535503460f94a2ff2d/html5/thumbnails/35.jpg)
Decibels for Sounds
• The loudness of sound X is the ratio of X to the softest sound S audible to humans, measured in decibels, i.e.
10 log10(X/S)
• So S is a 0 decibel sound• Normal conversation: X = 106S so X = 60db• Rock concert: X = 1011S so X = 110db, or even 120db:
1,000,000,000,000 times the power of S! Hearing loss in a few minutes
• Ipods around 115db -- mechanics of earbuds matter• A sound 1/10 as loud as the softest sound humans can hear
would be -10db and absolute silence would be −∞
April 5, 2011 Harvard Bits 35
![Page 36: Digital Representation of Analog Information How Images and Sound are Stored and Communicated April 5, 2011Harvard Bits1](https://reader036.vdocument.in/reader036/viewer/2022062714/56649d535503460f94a2ff2d/html5/thumbnails/36.jpg)
Other Logarithmic Scales• Richter scale for earthquakes
– Richter magnitude = log10(largest horizontal displacement caused by quake)– So magnitude 5 quake is 10x stronger than magnitude 4 quake, etc.
• Star magnitudes– Magnitude of star X = log (S/X) where S is a fixed reference brightness– So dimmer stars have higher magnitude– The base of the logarithm, 2.512, is somewhat accidental: it makes a
difference of 5 magnitudes = a factor of 100 – Visual system “feels” that magnitudes 6, 5, 4, 3, 2, 1 are getting brighter in
equal jumps– Brightest star = Sirius = magnitude -1.54– Sun = -26.8
April 5, 2011 Harvard Bits 36
![Page 37: Digital Representation of Analog Information How Images and Sound are Stored and Communicated April 5, 2011Harvard Bits1](https://reader036.vdocument.in/reader036/viewer/2022062714/56649d535503460f94a2ff2d/html5/thumbnails/37.jpg)
Restoration of Digital Signals
• We know that a fundamental advantage of digital representation over analog is that data can be restored
• E.g. if there are only two possibilities for a signal, the problem becomes recognizing which possibility the actual signal more closely resembles
April 5, 2011 Harvard Bits 37
0 1 ?
![Page 38: Digital Representation of Analog Information How Images and Sound are Stored and Communicated April 5, 2011Harvard Bits1](https://reader036.vdocument.in/reader036/viewer/2022062714/56649d535503460f94a2ff2d/html5/thumbnails/38.jpg)
A Communications Tradeoff:Bits per time unit vs. Power
• If signals had four possible levels rather than two, in each time slice two bits of information could be transmitted
• If the levels were closer together, the thresholding would be harder -- same noise => more errors
• If levels were same distance apart, need more power
April 5, 2011 Harvard Bits 38
0001
1011
vs.
0
1
00
01
10
11
111
110
101
100
![Page 39: Digital Representation of Analog Information How Images and Sound are Stored and Communicated April 5, 2011Harvard Bits1](https://reader036.vdocument.in/reader036/viewer/2022062714/56649d535503460f94a2ff2d/html5/thumbnails/39.jpg)
Bandwidth, Literally
• Bandwidth = the width of a frequency range• E.g. the AM band is 530-1700 KHz, for a bandwidth of about
1200 KHz• Within a band, signals (e.g. radio stations) have to be kept a
certain distance apart to avoid interference (could not have stations at both 1030 and 1031 KHz)
• More bandwidth => more “stations,” “channels,” i.e., more channel capacity
• With more bandwidth it is possible to transmit more information
April 5, 2011 Harvard Bits 39
![Page 40: Digital Representation of Analog Information How Images and Sound are Stored and Communicated April 5, 2011Harvard Bits1](https://reader036.vdocument.in/reader036/viewer/2022062714/56649d535503460f94a2ff2d/html5/thumbnails/40.jpg)
Bandwidth, Figuratively, = Speed
• “Broadband” = uses a large frequency range• Because broadband communication channels can carry
information at a high rate (i.e. have high channel capacity), any fast channel is now called “broadband” regardless of the underlying technology
• Caveat emptor! when buying “broadband Internet service” - the term has no standardized meaning in terms of data rates
• Check actual “bandwidth” or data rates -- often more in one direction than the other
April 5, 2011 Harvard Bits 40
![Page 41: Digital Representation of Analog Information How Images and Sound are Stored and Communicated April 5, 2011Harvard Bits1](https://reader036.vdocument.in/reader036/viewer/2022062714/56649d535503460f94a2ff2d/html5/thumbnails/41.jpg)
Signal, Noise, Bandwidth, Channel Capacity
• These four are interrelated• Stronger signal (S) => higher channel capacity C• More noise (N) => lower C• More bandwidth (B) => higher C
C = B lg (1+S/N)Shannon-Hartley Theorem
• So channel capacity increases linearly with bandwidth but logarithmically with signal-to-noise ratio
April 5, 2011 Harvard Bits 41
![Page 42: Digital Representation of Analog Information How Images and Sound are Stored and Communicated April 5, 2011Harvard Bits1](https://reader036.vdocument.in/reader036/viewer/2022062714/56649d535503460f94a2ff2d/html5/thumbnails/42.jpg)
Why Binary is Best
• Usually noise is uncontrollable • So to increase channel capacity, the engineer must
increase either bandwidth or signal power• Power is a precious resource! • Use more power in a PC or cell phone => bigger battery,
shorter battery life, etc.• With only two signal levels, power usage is minimized• To achieve a fixed data rate, can use 1000x less power if
we can get 10x more bandwidth!
April 5, 2011 Harvard Bits 42
C = B lg (1+S/N)
![Page 43: Digital Representation of Analog Information How Images and Sound are Stored and Communicated April 5, 2011Harvard Bits1](https://reader036.vdocument.in/reader036/viewer/2022062714/56649d535503460f94a2ff2d/html5/thumbnails/43.jpg)
Summary of Digital Communication (of Audio)
April 5, 2011 Harvard Bits 43
Instead of Amplitude Modulation of analog signal
or
Frequency Modulation
![Page 44: Digital Representation of Analog Information How Images and Sound are Stored and Communicated April 5, 2011Harvard Bits1](https://reader036.vdocument.in/reader036/viewer/2022062714/56649d535503460f94a2ff2d/html5/thumbnails/44.jpg)
Use Pulse Code Modulation
April 5, 2011 Harvard Bits 44
Sample and Quantize the Analog Signal (Analog to Digital conversion)
Turn the quantized data as binary numerals into a bit stream
And send digital pulses rather than the original analog signal
… 0 1 1 1 0 0 0 1 …
5 7 2 1 2 4 7 4 3 2 5
![Page 45: Digital Representation of Analog Information How Images and Sound are Stored and Communicated April 5, 2011Harvard Bits1](https://reader036.vdocument.in/reader036/viewer/2022062714/56649d535503460f94a2ff2d/html5/thumbnails/45.jpg)
Summary of Digital Radio/TV Communication
1. Sampling2. Quantization3. Source coding4. Modulation5. Transmission6. Thresholding7. Source decoding8. Regeneration
April 5, 2011 Harvard Bits 45
Repeated many times, once per hop
Channel coding/decoding on each hop
Analog to Digital conversion (A-D)
D-A conversion
With enough computing, could involve fancy digital signal processing