CSC 110 – Intro to Computing Lecture 4: Arithmetic in other bases & Encoding Data.

Slides:



Advertisements
Similar presentations
Data Compression CS 147 Minh Nguyen.
Advertisements

The Binary Numbering Systems
Comp 1001: IT & Architecture - Joe Carthy 1 Review Floating point numbers are represented in scientific notation In binary: ± m x 2 exp There are different.
Dale & Lewis Chapter 3 Data Representation. Representing color Similarly to how color is perceived in the human eye, color information is encoded in combinations.
Chapter 4: The Building Blocks: Binary Numbers, Boolean Logic, and Gates Invitation to Computer Science, Java Version, Third Edition.
Chapter 4: The Building Blocks: Binary Numbers, Boolean Logic, and Gates Invitation to Computer Science, C++ Version, Third Edition.
Chapter 4: The Building Blocks: Binary Numbers, Boolean Logic, and Gates Invitation to Computer Science, C++ Version, Third & Fourth Edition Spring 2008:
Connecting with Computer Science, 2e
Compression JPG compression, Source: Original 10:1 Compression 45:1 Compression.
1 Data Compression Engineering Math Physics (EMP) Steve Lyon Electrical Engineering.
Computer Science 335 Data Compression.
CSC 110 – Intro to Computing Lecture 3: Converting between bases & Arithmetic in other bases.
Chapter 4: The Building Blocks: Binary Numbers, Boolean Logic, and Gates Invitation to Computer Science, C++ Version, Third Edition.
CSC 110 – Intro to Computing Lecture 4: Arithmetic in other bases & Encoding Data.
Introduction to Management Information Systems Chapter 3 Computer Basics HTM 304 Spring 06.
Chapter 1 The Big Picture. QUIZ 2 5 Explain the abstractions we normally apply when using the following systems: DVD player Registering for classes on.
Data storage Charles McAnany. What are the ones and zeroes? Hard drive Computer "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod.
Connecting with Computer Science 2 Objectives Learn why numbering systems are important to understand Refresh your knowledge of powers of numbers Learn.
Dale & Lewis Chapter 3 Data Representation
CS105 INTRODUCTION TO COMPUTER CONCEPTS DATA REPRESENTATION Instructor: Cuong (Charlie) Pham.
CPS120 Introduction to Computer Science Lecture 4
(2.1) Fundamentals  Terms for magnitudes – logarithms and logarithmic graphs  Digital representations – Binary numbers – Text – Analog information 
Chapter 2, Exploring the Digital Domain
CSCI-235 Micro-Computers in Science Hardware Part II.
TOPIC 4 INTRODUCTION TO MEDIA COMPUTATION: DIGITAL PICTURES Notes adapted from Introduction to Computing and Programming with Java: A Multimedia Approach.
Computing in the Modern World BCS-CMW-7: Data Representation Wayne Summers Marion County October 25, 2011.
Chapter 11 Fluency with Information Technology 4 th edition by Lawrence Snyder (slides by Deborah Woodall : 1.
Foundations of Computer Science Computing …it is all about Data Representation, Storage, Processing, and Communication of Data 10/4/20151CS 112 – Foundations.
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.
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.
Compsci Today’s topics l Binary Numbers  Brookshear l Slides from Prof. Marti Hearst of UC Berkeley SIMS l Upcoming  Networks Interactive.
1 i206: Lecture 2: Computer Architecture, Binary Encodings, and Data Representation Marti Hearst Spring 2012.
Computer Concepts 2014 Chapter 8 Digital Media. 8 Digital Audio Basics  Sampling a sound wave Chapter 8: Digital Media 2.
Chapter 1: Data Storage.
CS 111 – Sept. 10 Quiz Data compression –text –images –sounds Commitment: –Please read rest of chapter 1. –Department picnic next Wednesday.
Addressing Image Compression Techniques on current Internet Technologies By: Eduardo J. Moreira & Onyeka Ezenwoye CIS-6931 Term Paper.
Compsci Today’s topics l Binary Numbers  Brookshear l Slides from Prof. Marti Hearst of UC Berkeley SIMS l Upcoming  Networks Interactive.
Chapter 1 Data Storage © 2007 Pearson Addison-Wesley. All rights reserved.
COMPRESSION. Compression in General: Why Compress? So Many Bits, So Little Time (Space) CD audio rate: 2 * 2 * 8 * = 1,411,200 bps CD audio storage:
CISC1100: Binary Numbers Fall 2014, Dr. Zhang 1. Numeral System 2  A way for expressing numbers, using symbols in a consistent manner.  " 11 " can be.
Introduction to Digital Media. What is it? Digital media is what computers use to; Store, transmit, receive and manipulate data Raw data are numbers,
1 COMS 161 Introduction to Computing Title: The Digital Domain Date: September 6, 2004 Lecture Number: 6.
Chapter 1 Data Storage © 2007 Pearson Addison-Wesley. All rights reserved.
CSCI-100 Introduction to Computing Hardware Part II.
Chapter 1 Background 1. In this lecture, you will find answers to these questions Computers store and transmit information using digital data. What exactly.
Chapter 3 Data Representation. 2 Compressing Files.
CPSC 171 Introduction to Computer Science Binary.
Chapter 1 Data Storage © 2007 Pearson Addison-Wesley. All rights reserved.
TOPIC 4 INTRODUCTION TO MEDIA COMPUTATION: DIGITAL PICTURES Notes adapted from Introduction to Computing and Programming with Java: A Multimedia Approach.
CSC 110 – Intro to Computing Lecture 3: Converting between bases & Arithmetic in other bases.
Audio Formats. Digital sound files must be organized and structured so that your media player can read them. It's just like being able to read and understand.
1 Part A Multimedia Production Chapter 2 Multimedia Basics Digitization, Coding-decoding and Compression Information and Communication Technology.
Submitted To-: Submitted By-: Mrs.Sushma Rani (HOD) Aashish Kr. Goyal (IT-7th) Deepak Soni (IT-8 th )
Chapter 1: Data Storage.
Computer Science: An Overview Eleventh Edition
Invitation to Computer Science, C++ Version, Fourth Edition
Everything is a number Everything in a computer memory and on storages is a number. Number  Number Characters  Number by ASCII code Sounds  Number.
3.1 Denary, Binary and Hexadecimal Number Systems
Data Compression.
University of Gujrat Department of Computer Science
Data Compression CS 147 Minh Nguyen.
Invitation to Computer Science, Java Version, Third Edition
Invitation to Computer Science, C++ Version, Third Edition
The Building Blocks: Binary Numbers, Boolean Logic, and Gates
Computer Systems – Unit 1
WJEC GCSE Computer Science
Presentation transcript:

CSC 110 – Intro to Computing Lecture 4: Arithmetic in other bases & Encoding Data

Announcements Copies of the slides are available on Blackboard and the course web page before and after each class I have a cool office. Please stop by and look (you could also me questions you have at the same time).

Addition Refresher How do we add two numbers together?

Adding in other bases Rules are very synonmous  Carry the one when above value of base For the digit being computed, record the sum minus the base  For instance in base 2:  Or in base 8:

Adding hexadecimal numbers FEED +FACE BEEF + EA7

Data Encoding Data (“information”) is traditionally encoded in analog formats  Falls along a continuum with lots of minimal changes Color changes when mixing paint Rising mercury levels when temperature increases  Easy for nature, but hard to capture numerically How to capture precision: Is it o F or o F?

Data Encoding Easier to encode discrete data  E.g., Using integer or rational numbers 71 o F or 4.5 miles.  Also bounds space needed to record data For this reason, computers only use discrete data

Digitizing Data Computers work in binary (0-1)  Makes computing cheaper and simpler  Limited loss of precision: Can convert all integers into binary How come this conversion is possible?

CD Encoding 1 stored as bump 0 stored as pit

CD Encoding Laser light shines onto spinning disc  Bumps reflect laser well  Pits scatter laser light  Receptor records amount of light received  Based upon level, determines if is a “0” or “1”  CD player converts string of bits into sounds

Digitizing Data Figure 3.3 Signals in this region considered 0 Signals in this region considered 1 How digital data is captured and processed

Binary Representation 1 bit captures 2 states: 0 or 1 2 bits captures 4 states: 00, 01, 10, 11 3 bits capture 8 states: 000, 001, 010, 011, 100, 101, 110, 111

Binary Representation How many states can 4 bits capture? How many different states can n bits represent?

Data Storage Storing data can require lots of space  Each pixel (dot) in a color photo takes 4 bytes  5 megapixel (~million pixel) camera: 20MB per picture  32 pictures: 640MB (a CD holds 650MB)

Compression Much of this data is repetitive or unneeded  Areas in pictures contain similar data Pixels of clothing, leaves, or the sky will be similar  Music contains lots of sounds we cannot hear Compression limits the space data uses

Compression Ratios Compare algorithms by compression rate  Measures how well data are compressed  Expressed as a value between 0% and ???% 0%  perfect compression (not really possible) 100%  no compression 110%  compressed data is 10 % larger Most algorithms lie somewhere in between Algorithms rate depends on input data

First type of compression Lossless compression  Lmt spce tkn w/o losing data  Important when all data is important E.g., bank records, grade reports, census data

Keyword Encoding Useful method of compressing text Idea: Words occur commonly in English  Encode: Replace words with single symbols  Decode: Replace symbols with words  What words would be good to replace?  How should these be chosen?

Keyword Encoding We will compress common words with single characters  as  ^  the  ~  and  +  that  $  must  &

Keyword Encoding Example Raw Text: To be, or not to be: that is the question: Whether 'tis nobler in the mind to suffer The slings & arrows of outrageous fortune, Or to take arms against a sea of troubles, And by opposing end them? To die: to sleep; No more; & by a sleep to say we end

Keyword Encoding Example Encoded Text: To be, or not to be: $ is ~ question: Whe~r 'tis nobler in ~ mind to suffer The slings & arrows of outrageous fortune, Or to take arms against a sea of troubles, And by opposing end ~m? To die: to sleep; No more; & by a sleep to say we end

Keyword Encoding Example Decoded Text: To be, or not to be: that is the question: Whether 'tis nobler in the mind to suffer The slings must arrows of outrageous fortune, Or to take arms against a sea of troubles, And by opposing end them? To die: to sleep; No more; must by a sleep to say we end

Keyword Encoding Example Oops! We accidentally expanded symbols that were in the original text  Also, were unable to compress word “The” because it was capitalized How could we get around these problems?

Run-Length Encoding Takes advantage of repeated characters  Not useful for English  Very useful for DNA Replaces text with first character, flag, and one digit number of repeated characters  Consider if we make ‘*’ the flag character

Run-Length Encoding BAAAAAAAB  BA*7B BAAAAAAAAAAB  BA*9AB  Can only handle single digit replacement  How can we fix this?

Run-Length Encoding Variable number of digit replacement:  BAAAAAAAAAAB  BA*10B  BAAAAAAAAAA1B  BA*101B Oops… Why not increase digits for replacement?

Run-Length Encoding How would we encode this text Raw Text: A*7AAAA Encoded Text: A*7A*3 Decoded Text: AAAAAAAAAA How can we solve this problem?

Huffman Coding Invented by Dr. David Huffman Based upon idea that not all characters are equal  Why use as much space on ‘s’ as ‘q’?  Encode characters with space inversely proportional to frequency used

Problems With Huffman Coding Very difficult to figure out algorithm  Need to make sure that initial bits match only one character  Luckily, Dr. Huffman solved this problem How do we decide frequency of usage? What problems would bad encoding cause?

Second compression type Lossy compression  No(table) because data is lost in compression  Useful when not all data is important

Sound Encoding Many modern ways of encoding sound  mp3 (created by Fraunhofer, defined in MPEG-3 Audio layer 3 standard)  aac (created by Apple, included in MPEG-4 standard)  wma (created by Microsoft, not made available to any standards body)

Sound Encoding All of these format use “psycho-acoustic model”  Analyze how the human brain hears sound  Filter out sounds brain cannot process  Compress remaining notes mp3 uses Huffman encoding

Psycho-acoustic models Hard to encode music  Need to process sounds through models Easy to decode music  All filtering already done  Only need to reverse Huffman encoding Is this a good trade-off?

For Next Lecture Have Chapter 4 started Be ready to discuss:  Boolean logic  AND, OR, XOR, NOT, NAND, NOR gates