science of information - university of virginiaffh8x/d/soi18f/module01-part01.pdfmodule 1, part 1:...

41
Science of Information MODULE 1, PART 1: DIGITAL V ANALOG, DIGITIZATION OF SIGNALS ECE 2066 1 Fall 2018

Upload: others

Post on 09-Jul-2020

2 views

Category:

Documents


0 download

TRANSCRIPT

Science of InformationMODULE 1, PART 1: DIGITAL V ANALOG, DIGITIZATION OF SIGNALS

ECE 2066 1Fall 2018

How are songs, voices, images and videos handled in the iPhone?MODULE 1: The iPhone, a digital device that stores and processes information

Digital v. analogDigitization of signals Sampling and quantization for imagesColor Number representationsBinary addition and multiplicationCodingASCII Run-length Coding

Fall 2018 ECE 2066 2

Digital v. analogInformation inside the iPhone is stored and processed digitally.

Outside the iPhone, the world is analog – your voice, the appearance of your face, your touch, etc.

First, we need to discuss “analog” vs. “digital”, and “continuous” vs. “discrete”

Signal: a function of time (usually) that carries information

◦ Examples: electrical current produced by a microphone, light emitted by a pixel on screen

Fall 2018 ECE 2066 3

Types of "Continuous" SignalsFor now assume real-valued signals unless otherwise stated.

Continuous-time signals - The signal is defined at every instant of time over a continuous domain, such as an interval; or a union of intervals; or the real line.

Continuous-amplitude signals - The signal can take any value coming from a continuous range; implies an uncountable number of possible values.

Analog Signal - Both continuous-time & continuous-amplitude.

Fall 2018 ECE 2066 4

Analog SignalExample:

sound waves

temperature

position

Fall 2018 ECE 2066 5

t

x (t )

continuous domain

continuous range

Analog Signal w/ discontinuitiesAnalog signals may have discontinuities in theory.

But not in reality.

Discontinuities are useful in theoretical analysis.

Fall 2018 ECE 2066 6

t

x (t )

t

x (t )

Types of "Discrete" SignalsFor now assume real-valued signals unless otherwise stated.

Discrete-time signals - The signal has a discrete domain - it takes values only at a countable or (usually) finite set of points on the real line. Usually, these time instants are equally-spaced.

Discrete-amplitude signals - The signal can take values only from a discrete range - a countable or (usually) finite set of real values. Always true for a signal stored as values in a computer (finite wordlength)

Digital Signal - Both discrete-time & discrete-amplitude. Signals stored on computers (including the iPhone processor and memory) are digital.

Fall 2018 ECE 2066 7

Discrete-time, continuous-amplitude signalExample:

Temperature at noon everyday

Fall 2018 ECE 2066 8

ndiscrete domain

continuous range

x (n )

Digital SignalSampled and quantized:

Every signal stored in a computer memory

But can occur naturally too:

US annual population

Number of stock transactions every hour

Fall 2018 ECE 2066 9

ndiscrete domain

discrete range

x (n )

Time vs Space

Fall 2018 ECE 2066 10

The horizontal axis (domain) is not always time:

Altitude along a bike path

Brightness for pixels in an image

Theoretical vs. Practical Discrete SignalsWe will often do paper analysis under the assumption that signals/systems are discrete-time and continuous-amplitude.

It is easy to analyze signals that have been sampled (discrete-time).

Analyzing signals that have been quantized is very messy.

However, any signal processed by a computer or digital processor will be a true digital signal.

Fortunately, increased wordlengths in most processors have made quantization effects less of a concern. (But definitely not to be ignored!!).

We’ll use Matlab and Mathcad in the problem sessions and homework.

Fall 2018 ECE 2066 11

Why Digital?What are the advantages of digital systems?

Fall 2018 ECE 2066 12

Music/SoundMusic/sound provides an excellent example of analog v. digital in the iPhone.

In my lifetime (not necessarily yours!), we’ve gone from music players that are inherently analog to those that are inherently digital.

You can visualize sound waves on a smart phone with Oscilloscope apps.

Fall 2018 ECE 2066 13

Fall 2018 ECE 2066 14

Aiwa TPR-810 – the first boombox? (about 1977)

Fall 2018 ECE 2066 15

Sony Walkman circa 1979

Fall 2018 ECE 2066 16

First gen iPod (2001)

Fall 2018 ECE 2066 17

The iPhone, 2007-2017

Fall 2018 ECE 2066 18

Source: IFPI via Washington Post

Why Digital?What do we do with information?

◦ Computation and communication

Why is digital better for these?

◦ Analog computation would be difficult

◦ Removing noise from analog signals is difficult

◦ Digital signals are less dependent on a particular format

We use numbers for many of the same reasons

◦ I tell my doctor how tall I am in ft and in, not by marking a stick

So why the first electronic devices were analog?

Fall 2018 ECE 2066 19

From Analog to DigitaliPhone, like other modern computers, is digital

The real world is still analog (touch, voice, iPhone headphone output)

The process of converting an analog signal (like speech) into a digital one (bits) is called A to D conversion.

Fall 2018 ECE 2066 20

From analog to digitalRecall the difference between sampling and quantization…

Sampling refers to taking “snapshots” at discrete-time intervals.

Quantizing refers to the approximation of the signal value by a number, usually an integer, and almost always a number in the range of 0 to 2N -1 where N is called the bit depth.

Fall 2018 ECE 2066 21

From analog to digital

Fall 2018 ECE 2066 22

Quantization

Fall 2018 ECE 2066 23

Quantization

Fall 2018 ECE 2066 24

Quantization

Fall 2018 ECE 2066 25

00

10

01

11

Quantization

Fall 2018 ECE 2066 26

Quantization

Fall 2018 ECE 2066 27

QuantizationThe step size is Range / 2N

Larger N, more processing power needed, more storage… but also more fidelity – better representation of signal

Let’s listen to some audio evidence

◦ pure sinusoid at 440Hz sampled at 20,000** samples per second

◦ Quantized at 2,4, 8 bits

**How fast does the iPhone need to sample? Answer: in MODULE 2.

Fall 2018 ECE 2066 28

Fall 2018 ECE 2066 29

440 Hz

440 Hz @ 2bits

Fall 2018 ECE 2066 30

440 Hz @ 4bits

Fall 2018 ECE 2066 31

440 Hz @ 8bits

Fall 2018 ECE 2066 32

N=2

Fall 2018 ECE 2066 33

N=4

Fall 2018 ECE 2066 34

N=8

Audio CD uses 16-bit quantization for left and right channels = 65,536 levels per channel. ◦ (mp3 files on your iPhone use less than 10% of the CD bits per

channel – more in MODULE 3.)

Fall 2018 ECE 2066 35

Quantization ErrorQuantization Error occurs because we are approximating the signal.

Maximum error = stepsize = Range / 2N

Fall 2018 ECE 2066 36

QuantizationError

Quantization ErrorSo quantization is a noise source.

It can be reduced, but not eliminated.

Possible objective: reduce quantization noise so it is smaller than other noise sources.

Fall 2018 ECE 2066 37

Clipping ErrorClipping Error occurs when the analog signal exceeds the range of the quantizer.

Also called saturation.

Signal is clipped at the “rails.”

Fall 2018 ECE 2066 38

signal is clipped here

Actual signal

signal is clipped here

Clipping Error

Fall 2018 ECE 2066 39

Clipping-Quantization Trade-offClipping can be totally prevented by setting the range of the quantizer to the maximum input range.

But quantization error = Max – Min / 2N. So, increased range gives increased quantization error.

Another idea: use non-uniform quantization steps to make:

◦ Quantization error / signal strength = constant

Why? When can you “hear” quantization error in an audio signal?

Fall 2018 ECE 2066 40

Signal Length in BitsIn audio, number of bits = bit depth x #sample/s x # length of recording x 2 (for stereo)

Fall 2018 ECE 2066 41

For CD, N=16 and sample rate = 44100 / s (we’ll answer the “why” later)

What is the bandwidth requirement for streaming “lossless” CD-quality music (Tidal does this)?

How much storage space is needed for 80 mins of music?