1 coms 161 introduction to computing title: the digital domain date: september 1, 2004 lecture...

45
1 COMS 161 Introduction to Computing Title: The Digital Domain Date: September 1, 2004 Lecture Number: 4

Upload: deirdre-allen

Post on 26-Dec-2015

217 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: 1 COMS 161 Introduction to Computing Title: The Digital Domain Date: September 1, 2004 Lecture Number: 4

1

COMS 161Introduction to Computing

Title: The Digital Domain

Date: September 1, 2004

Lecture Number: 4

Page 2: 1 COMS 161 Introduction to Computing Title: The Digital Domain Date: September 1, 2004 Lecture Number: 4

2

Announcements

• Homework Assignment 2 Due on Friday

• Questions

• Comments

• Concerns

• Criticism

• Jokes

Page 3: 1 COMS 161 Introduction to Computing Title: The Digital Domain Date: September 1, 2004 Lecture Number: 4

3

Review

• Digital Domain

• Discrete

• Digital

• Analog (continuous) information

Page 4: 1 COMS 161 Introduction to Computing Title: The Digital Domain Date: September 1, 2004 Lecture Number: 4

4

Outline

• Analog (continuous) Information

• Digital information– Advantages

– Disadvantages

Page 5: 1 COMS 161 Introduction to Computing Title: The Digital Domain Date: September 1, 2004 Lecture Number: 4

5

Analog Information

• Natural form of representing information– Sound is analog information

• Continuous over some dimension(s)– Time is a natural dimension for sound

– Sound is composed of variations in air pressure• A pressure measurement can be made at any

and all times during the sound• Temperature is also continuous

Page 6: 1 COMS 161 Introduction to Computing Title: The Digital Domain Date: September 1, 2004 Lecture Number: 4

6

Analog information

Amplitude,intensity, orvolume

Time

• Signal or waveform– Amplitude: how far up and down

– Frequency: how many times per sec

Page 7: 1 COMS 161 Introduction to Computing Title: The Digital Domain Date: September 1, 2004 Lecture Number: 4

7

Frequency

1 second time

Page 8: 1 COMS 161 Introduction to Computing Title: The Digital Domain Date: September 1, 2004 Lecture Number: 4

8

Analog information

• Continuous– At every instant in time there is an amplitude

– There is an infinite amount of information in an analog signal or waveform

Page 9: 1 COMS 161 Introduction to Computing Title: The Digital Domain Date: September 1, 2004 Lecture Number: 4

9

• Discrete and finite–Amplitude is measured at distinct time

intervals

Digital information

Time

Amplitude,intensity, orvolume

Page 10: 1 COMS 161 Introduction to Computing Title: The Digital Domain Date: September 1, 2004 Lecture Number: 4

10

– Finite sequence of instantaneous pulses, which we call samples• Finite sequence

– We can count and label the samples

• Instantaneous pulses– The amplitude, intensity, or volume at one specific

instant in time

Digital information

t t*2 t*3Time

Amplitude

Page 11: 1 COMS 161 Introduction to Computing Title: The Digital Domain Date: September 1, 2004 Lecture Number: 4

11

Digital information

• No measurements are made between the instantaneous pulses (samples)

• Digital representations contain a finite amount of information

• Digital information– Not exact as analog

– More precise (repeatable)

– More compact

Page 12: 1 COMS 161 Introduction to Computing Title: The Digital Domain Date: September 1, 2004 Lecture Number: 4

12

Digital information

• The number of samples is fundamentally important when accurately representing an analog signal– Appropriate sampling allows digital

information to replace analog information• For example

– CD’s, MP3’s, DVD’s– Digital telephones– …

Page 13: 1 COMS 161 Introduction to Computing Title: The Digital Domain Date: September 1, 2004 Lecture Number: 4

13

Digital advantages

• Electronic1. Fast

• Operating speeds measured in billionths of a second

2. Precise• Numbers are distinct and unambiguous

– Precise manipulation (cloning)

3. Ordinal• Ordered numbers

– Simple alphabetical sorting

Page 14: 1 COMS 161 Introduction to Computing Title: The Digital Domain Date: September 1, 2004 Lecture Number: 4

14

Digital advantages

4. Efficient storage• Practical to store large amounts of data

in a small amount of area– iPod: 10,000 songs! How many CD’s

would you need?

5. Fast Transfer• Compare downloading a paper from

the internet to:– Going to the library– Determining what you need is not there

Page 15: 1 COMS 161 Introduction to Computing Title: The Digital Domain Date: September 1, 2004 Lecture Number: 4

15

Digital advantages

6. Absolute replication• Cloning

– No loss or degradation of information when making a copy

– Copies of downloaded papers are just as clear as the original» Photocopying adds noise and loses

information in the process» Copies of copies become unintelligible

– Music for prosperity» Compare to my old LP’s

Page 16: 1 COMS 161 Introduction to Computing Title: The Digital Domain Date: September 1, 2004 Lecture Number: 4

16

Digital advantages

7. Resolution independence• Resolution: amount of detail

– Higher resolution means more detail and therefore higher fidelity

• Downloaded information can be scaled to match you system– Either higher or lower resolution

» Music is resampled to match the resolution of your system

• Resolution is machine independent

Page 17: 1 COMS 161 Introduction to Computing Title: The Digital Domain Date: September 1, 2004 Lecture Number: 4

17

Digital advantages

8. Random Access• Direct access to digital data, provided

we know where to look for it

• Random access– All accesses take the same amount of

time (latency) regardless of where the data resides

Page 18: 1 COMS 161 Introduction to Computing Title: The Digital Domain Date: September 1, 2004 Lecture Number: 4

18

Digital advantages

8. Random Access (Cont.)• Sequential access

– Analog information– Must pass information that comes before

what you wish to find

9. Selective Access• Searched by content (selective)

• Find occurrences of a given word in a document

Page 19: 1 COMS 161 Introduction to Computing Title: The Digital Domain Date: September 1, 2004 Lecture Number: 4

19

Digital advantages

10.Compression• Useful information is not totally

redundant or totally random

• Redundant– Repeating

• Random– Nothing in common– TV snow– This lecture?

Page 20: 1 COMS 161 Introduction to Computing Title: The Digital Domain Date: September 1, 2004 Lecture Number: 4

20

Redundant

–How many times does this message have to be transmitted, heard, or seen before it is not necessary to continue

» COMS 161 is the best of the best classes at the H-S-C» COMS 161 is the best of the best classes at the H-S-C» COMS 161 is the best of the best classes at the H-S-C» COMS 161 is the best of the best classes at the H-S-C» COMS 161 is the best of the best classes at the H-S-C» COMS 161 is the best of the best classes at the H-S-C» COMS 161 is the best of the best classes at the H-S-C» COMS 161 is the best of the best classes at the H-S-C» COMS 161 is the best of the best classes at the H-S-C

Page 21: 1 COMS 161 Introduction to Computing Title: The Digital Domain Date: September 1, 2004 Lecture Number: 4

21

Redundant

–Redundancy permits data compression• Remove some of the redundancy

• Keep enough–Reconstruct the original exactly–Reconstruct a reasonable approximation of

the original

• Example of compression–Repeat the following phrase nine times

» COMS 161 is the best of the best classes at the H-S-C

Page 22: 1 COMS 161 Introduction to Computing Title: The Digital Domain Date: September 1, 2004 Lecture Number: 4

22

Random

–Can you guess what this picture is?

Page 23: 1 COMS 161 Introduction to Computing Title: The Digital Domain Date: September 1, 2004 Lecture Number: 4

23

Digital advantages

11.Content Analysis and Synthesis• Digital data can be processed,

combined, and analyzed

• Ordered based on content

• Cookies– Allow web sites to taylor to you

12.Broad usefulness• Many different forms of information can

be represented this way

Page 24: 1 COMS 161 Introduction to Computing Title: The Digital Domain Date: September 1, 2004 Lecture Number: 4

24

Digital Domain

• Analog information– The natural form for many different types of

information

– Continuous in at least one dimension

• Digital information– Language of the computer

– Analog information must be converted into a discrete (digital) form

– Multimedia is all digital information

Page 25: 1 COMS 161 Introduction to Computing Title: The Digital Domain Date: September 1, 2004 Lecture Number: 4

25

Digital Domain

• Converting analog to digital information– We need a digital representation of the

information

– Recall, digital is a discrete system• Where symbols are numbers• The digital advantages

– Therefore, we need a numerical encoding of the data• Numerical means numbers

Page 26: 1 COMS 161 Introduction to Computing Title: The Digital Domain Date: September 1, 2004 Lecture Number: 4

26

Numbers

• Two types of notion used to represent numbers– Non-positional notation

• No special significance is given to order– Counting numbers on your fingers– Tick mark counting method

» The number of items is important, not the order

– My honey do list» Not important which task I do first, just so I get them all

done

Page 27: 1 COMS 161 Introduction to Computing Title: The Digital Domain Date: September 1, 2004 Lecture Number: 4

27

Numbers

–Positional notation• Significance is given to order the digits

appear in the number

• The decimal numbering system uses positional notation

–This is the system we use–365 is not the same a 653

» These are completely different numbers» They use the same digits

Page 28: 1 COMS 161 Introduction to Computing Title: The Digital Domain Date: September 1, 2004 Lecture Number: 4

28

Positional notation

• 365 means– Three hundreds

– Six tens

– Five ones

• Each digit is multiplied by a power of 10

1*510*6100*3365 012 10*510*610*3

Page 29: 1 COMS 161 Introduction to Computing Title: The Digital Domain Date: September 1, 2004 Lecture Number: 4

29

Decimal number system

• Synonyms– Decimal number system

– Decimal notation

– Base-10 system

• Both digits and their location in the number are important

• Ten unique symbols (digits)– 0, 1, 2, …, 9

Page 30: 1 COMS 161 Introduction to Computing Title: The Digital Domain Date: September 1, 2004 Lecture Number: 4

30

Octal number system

• Decimal is not the only positional number system available– Octal

• Positional,base-8 system• Each digit is multiplied by a power of 8• Eight unique symbols (digits)

– 0, 1, 2, …, 7

0128 8*58*68*3365

10245548192

Page 31: 1 COMS 161 Introduction to Computing Title: The Digital Domain Date: September 1, 2004 Lecture Number: 4

31

Binary number system

–Binary• Positional, base-2 system

• Each digit is multiplied by a power of 2

• Two unique symbols (digits), 0 and 1

102 4514832101101

012345 2*12*02*12*12*02*1101101

1*12*04*18*116*032*11011012

Page 32: 1 COMS 161 Introduction to Computing Title: The Digital Domain Date: September 1, 2004 Lecture Number: 4

32

Binary number system

• Digital and binary relationship– The language of computers use binary digits

– Only 2 possible values• 0 and 1

– Much simpler to make electronics that distinguish between one of two values• Distinguishing between more than two values is

very difficult

Page 33: 1 COMS 161 Introduction to Computing Title: The Digital Domain Date: September 1, 2004 Lecture Number: 4

33

Binary number system

• Since binary digits have two possible values

• Binary digits are called bits– They only contain a little “bit” of information

– Numbers represented in binary form will (most likely) require more digits (bits) than the decimal form

210 10110146

Page 34: 1 COMS 161 Introduction to Computing Title: The Digital Domain Date: September 1, 2004 Lecture Number: 4

34

Binary number system

• To represent more information– Lump together multiple bits called strings

• One bit: 2 values• Two bits: 4 values (00, 01, 10, 11)• Three bits: 8 values (000, 001, …, 111)• Four bits: 16 values (0000, …, 1111)• Five bits: 32 values• Six bits: 64 values• Seven bits: 128 values• Eight bits: 256 values

Page 35: 1 COMS 161 Introduction to Computing Title: The Digital Domain Date: September 1, 2004 Lecture Number: 4

35

Binary number system

• In general

number of values = 2number of bits

– 1 = 20

– 2 = 21

– 4 = 22

– 8 = 23

– 16 = 24

– 32 = 25

– 64 = 26

– 128 = 27

– 256 = 28

Page 36: 1 COMS 161 Introduction to Computing Title: The Digital Domain Date: September 1, 2004 Lecture Number: 4

36

Binary number system

• Common grouping– 4 bits: nibble

– 8 bits: byte

• One byte represents 256 different values or items

Page 37: 1 COMS 161 Introduction to Computing Title: The Digital Domain Date: September 1, 2004 Lecture Number: 4

37

Binary number system

– Letters in the English language• A = 6510 = 0100 00012

• B = 6610 = 0100 00102

• …

• Z = 9010 = 0101 10102

• …

• a = 9710 = 0110 00012

• …

• Z = 12210 = 0111 10102

• Numbers are still left over for punctuation

Page 38: 1 COMS 161 Introduction to Computing Title: The Digital Domain Date: September 1, 2004 Lecture Number: 4

38

Binary number system

• Precision– The number of bits used to represent an

item• Letter: precision of 8 bits• Integer (whole number): precision of 32 or 64

bits

– Always finite• Computers have finite precision

– Presents some limitations

Page 39: 1 COMS 161 Introduction to Computing Title: The Digital Domain Date: September 1, 2004 Lecture Number: 4

39

Hexadecimal number system

• Sometimes called hex– Positional,base-16 system

– Each digit is multiplied by a power of 16

– Sixteen unique symbols (digits)• 0, 1, 2, …, 15

• Symbol a or A for 10• Symbol b or B for 11 Symbol e or E for 14• Symbol c or C for 12 Symbol f or F for 15• Symbol d or D for 13

Page 40: 1 COMS 161 Introduction to Computing Title: The Digital Domain Date: September 1, 2004 Lecture Number: 4

40

Hexadecimal number system

• A hex number can represent 16 different items– Equivalent to 4 bits

– Makes it easy to convert between binary and hex• Group bits by 4’s from the left end• Substitute the hex symbol

– 9010 = 0101 10102 = 5A16

» Is the base 16 really needed?

– 6610 = 0100 00102 = 4216

Page 41: 1 COMS 161 Introduction to Computing Title: The Digital Domain Date: September 1, 2004 Lecture Number: 4

41

Hexadecimal number system

• Use the backwards conversion to convert hex to binary– One hex digit is equivalent to 4 bits

– Substitute the binary nibble• Always start at the right end• Add zeros to the left end as necessary to fill in 4

bits

Page 42: 1 COMS 161 Introduction to Computing Title: The Digital Domain Date: September 1, 2004 Lecture Number: 4

42

Hexadecimal number system

HEX DEC BIN

0 0 0000

1 1 0001

2 2 0010

3 3 0011

4 4 0100

5 5 0101

6 6 0110

7 7 0111

8 8 1000

9 9 1001

A 10 1010

B 11 1011

C 12 1100

D 13 1101

E 14 1110

F 15 1111

Page 43: 1 COMS 161 Introduction to Computing Title: The Digital Domain Date: September 1, 2004 Lecture Number: 4

43

Digitization

• The process of converting analog information into binary– Discrete forms are unambiguous

• Text and numbers are discrete

– Conversion of discrete to digital• Come up with a mapping

– As we did with the letters

Page 44: 1 COMS 161 Introduction to Computing Title: The Digital Domain Date: September 1, 2004 Lecture Number: 4

44

Binary Coded Decimal

• Integers (whole numbers)– One mapping is to use its binary equivalent

• Binary Coded Decimal (BCD)– 010 = 00002

– 110 = 00012

– …

– 910 = 10012

• Need a minimum of 4 bits to represent 10 different values

– Some 4 bit quantities are wasted

Page 45: 1 COMS 161 Introduction to Computing Title: The Digital Domain Date: September 1, 2004 Lecture Number: 4

45

Binary Coded Decimal

• String of decimal digits– Each decimal digit is represented by 4 bits

– The number of bits needed to represent different numbers vary

– Performing arithmetic is complicated