Data Representation CS280 – 09/13/05. Binary (from a Hacker’s dictionary) A base-2 numbering system with only two digits, 0 and 1, which is perfectly.

Slides:



Advertisements
Similar presentations
Information Representation
Advertisements

Technology ICT Option: Data Representation. Data Representation In our everyday lives, we communicate with each other using analogue data. This data takes.
1 Chapter 2 The Digital World. 2 Digital Data Representation.
Data Representation COE 202 Digital Logic Design Dr. Aiman El-Maleh
The Binary Numbering Systems
A-Level Computing#BristolMet Session Objectives#8 express numbers in binary, octal and hexadecimal explain the use of code to represent a character set.
Chapter 5 Light, Sound, Magic: Representing Multimedia Digitally Digitizing is more than letters, numbers, and metadata It is also photos, audio, and video.
Bits are Not just for Numbers Computers store characters as bits or binary digits. Characters from the English-language keyboard are represented in ASCII.
Connecting with Computer Science, 2e
Introduction to Multimedia Student Multimedia Design Center 06/06/06.
1 The Information School of the University of Washington Nov 6fit more-digital © 2006 University of Washington Digital Information INFO/CSE 100,
March 2006Taner Erig - EMU2-1 Metamorphosis of Information How is information represented and how do computers store information?
1 A Balanced Introduction to Computer Science, 2/E David Reed, Creighton University ©2008 Pearson Prentice Hall ISBN Chapter 12 Data.
 Wisegeek.com defines Data Compression as:  “Data compression is a general term for a group of technologies that encode large files in order to shrink.
Representing Information in Binary (Continued)
Digital Data Patrice Koehl Computer Science UC Davis.
Connecting with Computer Science 2 Objectives Learn why numbering systems are important to understand Refresh your knowledge of powers of numbers Learn.
Chapter 5 Data representation.
©Brooks/Cole, 2003 Chapter 2 Data Representation.
Chapter 2 Data Representation. Define data types. Visualize how data are stored inside a computer. Understand the differences between text, numbers, images,
Data vs. Information OUTPUTOUTPUT Information Data PROCESSPROCESS INPUTINPUT There are 10 types of people in this world those who read binary and those.
(2.1) Fundamentals  Terms for magnitudes – logarithms and logarithmic graphs  Digital representations – Binary numbers – Text – Analog information 
Computers and Scientific Thinking David Reed, Creighton University Data Representation 1.
Lawrence Snyder University of Washington, Seattle © Lawrence Snyder 2004 Adding some light to computing ….
Digital Media Dr. Jim Rowan ITEC Monday, August 27.
Too much information running through my brain.. We live in the information age. Knowledge comes from careful investigation of information. Information.
Chapter 11 Fluency with Information Technology 4 th edition by Lawrence Snyder (slides by Deborah Woodall : 1.
Text, Images, Video and Sound CS 1 Introduction to Computers and Computer Technology Rick Graziani Spring 2015.
1 Perception, Illusion and VR HNRS 299, Spring 2008 Lecture 14 Introduction to Computer Graphics.
Chapter 2 Computer Hardware
Lec 3: Data Representation Computer Organization & Assembly Language Programming.
Chapter 3 Representation. Key Concepts Digital vs Analog How many bits? Some standard representations Compression Methods 3-2.
3-1 Data and Computers Computers are multimedia devices, dealing with a vast array of information categories. Computers store, present, and help us modify.
Text and Graphics September 26, Unit 3.
Compsci Today’s topics l Binary Numbers  Brookshear l Slides from Prof. Marti Hearst of UC Berkeley SIMS l Upcoming  Networks Interactive.
Number Systems CIT Network Math
Logical Circuit Design Week 2,3: Fundamental Concepts in Computer Science, Binary Logic, Number Systems Mentor Hamiti, MSc Office: ,
1 Ethics of Computing MONT 113G, Spring 2012 Session 10 HTML Tables Graphics on the Web.
Marr CollegeHigher ComputingSlide 1 Higher Computing: COMPUTER SYSTEMS Part 1: Data Representation – 6 hours.
Quiz # 1 Chapters 1,2, & 3.
1 COMS 161 Introduction to Computing Title: The Digital Domain Date: September 6, 2004 Lecture Number: 6.
Int 2/ Higher - Data Representation - 1 Why use Binary? It is a two state system (on/off) which makes it simple to operate Even if degradation of current.
Data Representation The storage of Text Numbers Graphics.
CS 111 – Sept. 3 More data representation Review hex notation Text –ASCII and Unicode Sound and images Commitment: –For Wednesday: Please read pp
Data Representation. What is data? Data is information that has been translated into a form that is more convenient to process As information take different.
Chapter 1 Background 1. In this lecture, you will find answers to these questions Computers store and transmit information using digital data. What exactly.
Data Representation. How is data stored on a computer? Registers, main memory, etc. consists of grids of transistors Transistors are in one of two states,
TOPIC 4 INTRODUCTION TO MEDIA COMPUTATION: DIGITAL PICTURES Notes adapted from Introduction to Computing and Programming with Java: A Multimedia Approach.
Chapter 3: Data Representation Chapter 3 Data Representation Page 17 Computers use bits to represent all types of data, including text, numerical values,
More Digital Representation Discrete information is represented in binary (PandA), and “continuous” information is made discrete.
Information in Computers. Remember Computers Execute algorithms Need to be told what to do And to whom to do it.
Data Representation. In our everyday lives, we communicate with each other using analogue data. This data takes the form of: Sound Images Letters Numbers.
1 A Balanced Introduction to Computer Science David Reed, Creighton University ©2005 Pearson Prentice Hall ISBN X Chapter 12 Data Representation.
Chapter 8 & 11: Representing Information Digitally
Data Representation.
Lec 3: Data Representation
Everything is a number Everything in a computer memory and on storages is a number. Number  Number Characters  Number by ASCII code Sounds  Number.
Vocabulary byte - The technical term for 8 bits of data.
Binary Representation in Audio and Images
How does a computer represent everything using just zeros and ones?
Vocabulary byte - The technical term for 8 bits of data.
CHAPTER 2 - DIGITAL DATA REPRESENTATION AND NUMBERING SYSTEMS
Ch2: Data Representation
The Building Blocks: Binary Numbers, Boolean Logic, and Gates
INFO/CSE 100, Spring 2005 Fluency in Information Technology
Chapter 2 Data Representation.
Why use Binary? It is a two state system (on/off) which makes it simple to operate Even if degradation of current occurs (ie a slight drop in voltage)
How Computers Store Data
Option: Data Representation
Option: Data Representation
Presentation transcript:

Data Representation CS280 – 09/13/05

Binary (from a Hacker’s dictionary) A base-2 numbering system with only two digits, 0 and 1, which is perfectly suited for electronic operations since it can be expressed by power states (on/off), voltage levels (high/low) or charge (positive/negative), but is less than ideal for humans, who find it awkward to say things like “It’s a Catch – situation,” “He’s the pound gorilla,” and “That’s the dollar question.” “There are only 10 kinds of people in the world…those that understand binary and those that do not.” (from the ACM CS t-shirt).

Looking at more data Character representations

Data and Data Representation So how is this data that we operate on stored in the computer?

Let’s start with numbers Binary codes are Base 2 We “think” and operate in Base 10. What does this mean?

Counting Base 10 has 10 digits to represent different numbers of things Base 2 has only 2 digits available. Counting

Base then we run out of unique digits. So we move to a positional system. 10 – means we have ten things – a 1 in the 10’s position and no more things in the 1’s position.

Binary counting 0 1  then we run out of digits 10 This represents the number 2. A 1 in the 2’s position and a 0 in the 1’s position.

Positional notation 10’s positions represented 1 * 10 0 = 1 1 * 10 1 = 10 1 * 10 2 = * 10 3 = 1,000 1 * 10 4 = 10,000 1 * 10 5 = 100,000 1 * 10 6 = 1,000,000 2’s positions represented 1 * 2 0 = 1 1 * 2 1 = 2 1 * 2 2 = 4 1 * 2 3 = 8 1 * 2 4 = 16 1 * 2 5 = 32 1 * 2 6 = 64

How does the computer then store numbers? Let’s say we want to represent the number 53 in binary = Why? See chart next page.

Converting from binary to decimal Use chart 1 * 2 0 = 1 1 * 2 1 = 2 1 * 2 2 = 4 1 * 2 3 = 8 1 * 2 4 = 16 1 * 2 5 = 32 1 * 2 6 = 64 1 * 2 7 = * 28 = decimal Must use 7 bits xxxxxxx 75 – 64 = 9 1xxxxxx 32 and 16 are not used 100xxxx 9 – 8 = xxx 4 and 2 are not used last digit is What is the general subtraction algorithm to convert from binary to decimal number?

Converting binary to decimal 274 – decimal 4 * 10 0 = 4 7 * 10 1 = 70 2 * 10 2 = 200 total – binary 1 * 2 0 = 1 1 * 2 1 = 2 0 * 2 2 = 0 1 * 2 3 = 8 total11 What is the general algorithm for taking a number in base X and converting it to its base 2 equivalent?

Number representation Numbers are represented by their corresponding binary representation We are disregarding sign We are disregarding floating point What about other kinds of data?

Think about the binary values as a kind of code.

The binary values represent codes How many different values can be stored in 1 bit? How many in 2 bits? How many in 4 bits? How many in a byte?

General form encoding If you have x possible unique symbols, and y positions for any one of those symbols, then the general number of unique codes is x y Example, you have 2 dice each of which has 6 different face values, so there are 36 or 6 2 possible unique codes.

ASCII codes represent characters of data Use 1 byte or 8 bits Unicode extends the Ascii codes by another byte. ASCII can form most of the characters used by “Western” languages along with punctuation symbols. Unicode allows for special symbols and symbols in other languages like Japanese, Chinese, Arabic

Figure 8.7. ASCII, The American Standard Code for Information Interchange (page 220)

Reading the chart Left column is the left side of the byte (group of 8 bits) (another term is the high order) Right column is the right side of the byte. Value is the corresponding binary code.

Binary to hex Hexidecimal (base 16) codes can be used to represent groups of 4 binary digits. Hexidecimal counting: A B C D E F A = 10Binary 1010 B = C = D = E = F =

So the letter Z can be abbreviated in binary 5 A in hex Commonly binary numbers are represented in groups of 4 numbers with the leading 0’s used as placeholders. Hex numbers are shown as 2 digit with a space in between each group of two.

Encoding – character string Text or character strings are typically contiguously stored in memory. Assume that each character takes up one byte of space, how many bytes would be required for a phone number (we are using a slightly different example than the book. Note the hyphens and spaces:

568 – 8771 – requires 10 bytes E

In class assignment Using the chart on page 220, what is your first (or nick) name in ASCII binary codes? Work with your partner. Write the first name (spread out). Write the binary code for each letter of your name based on the ASCII chart. Convert at least one of those binary codes to the decimal (base 10) equivalent.

What about other kinds of data? Chapter 11 material

Pixels A pixel is like a dot. Your computer screen is composed of thousands of pixels. How many? Settings – Control Panel – Display – Settings Screen area is the dimensions expressed in terms of pixels. Higher the number the better the resolution.

Each pixel Has a color associated with it. Colors are a combination of red, green, and blue light – RGB The intensity of the particular color defines how much of that color contributes to the overall color displayed. Each color is associated with a 1 byte code. In one byte we can have values from 0 (no color) to 1 (full intensity).

Color See example in Word document Black is coded red green blue White is coded We will also use this feature when we code HTML colors.

Sound Analog – real world – infinitely continuous Digital – representation - discrete Sound is a continuous series of sound waves. To digitize we cannot capture every infinite value that hits our ears. But we can sample the values.

Figure Sound wave. The horizontal axis is time; the vertical axis is sound pressure.

Figure Two sampling rates; the rate on the right is twice as fast as that on the left.

Figure (a) Three-bit precision for samples requires that the indicated reading be approximated as +10. (b) Adding another bit makes the sample twice as accurate.

Figure Schematic for analog-to- digital and digital-to-analog conversion.

Sampling While we lose some information in this process, it is usually negligible in terms of our ability to perceive the sounds.

But to produce sounds Requires a large amount of data. For example, at a 16 bit representation of each sound, it would take 10 megabytes to reproduce 1 minute of a song. Compression – Remove the parts of the sound that we cannot hear. – MP3 format.

Images Images have the same problem. If each image is made up of thousands of pixels, and each pixel requires 3 bytes of data, then each image is huge. JPEG format compresses the digital representation to remove the differences in hues of a picture that we cannot perceive. Then we can compress by using run-length compression to code the remaining bits.

Run-length compression If my bit pattern is: We can code a value to indicate that we have: 24 0’s followed by 14 1’s followed by 16 0’s, etc. When we have many changing values in the pattern, it will not save us much space, but by making patterns of identical pixels, you can save a good deal of data space.

Lossy vs lossless conversion Lossless – no loss of data in the conversion Lossy – there is loss of data Run-length coding is lossless. You can convert the original to a compressed form and recover it exactly. Compression that removes some of the detail (things that we cannot perceive) is lossy. You cannot reproduce exactly the same sound/picture.