890 likes | 1.05k Views
Data Storage – Part 2. CS 1 Introduction to Computers and Computer Technology Rick Graziani Spring 2012. Digitizing Text. Earliest uses of PandA (Presence and Absence) was to digitize text (keyboard characters). We will look at digitizing images and video later.
E N D
Data Storage – Part 2 CS 1 Introduction to Computers and Computer Technology Rick Graziani Spring 2012
Digitizing Text • Earliest uses of PandA (Presence and Absence) was to digitize text (keyboard characters). • We will look at digitizing images and video later. • Assigning Symbols in United States: • 26 upper case letters • 26 lower case letters • 10 numerals • 20 punctuation characters • 10 typical arithmetic characters • 3 non-printable characters (enter, tab, backspace) • 95 symbols needed Rick Graziani graziani@cabrillo.edu
ASCII-7 • In the early days, a 7 bit code was used, with 128 combinations of 0’s and 1’s, enough for a typical keyboard. • The standard was developed by ASCII (American Standard Code for Information Interchange) • Each group of 7 bits was mapped to a single keyboard character. 0 = 0000000 1 = 0000001 2 = 0000010 3 = 0000011 … 127 = 1111111 Rick Graziani graziani@cabrillo.edu
Byte Byte = A collection of bits (usually 7 or 8 bits) which represents a character, a number, or other information. • More common: 8 bits = 1 byte • Abbreviation: B Rick Graziani graziani@cabrillo.edu
Bytes 1 byte (B) Kilobyte (KB) = 1,024 bytes (210) • “one thousand bytes” 1,024 = 2 * 2 * 2 * 2 * 2 * 2 * 2 * 2 * 2 * 2 Megabyte (MB) = 1,048,576 bytes (220) • “one million bytes” Gigabyte (GB) = 1,073,741,824 bytes (230) • “one billion bytes” Rick Graziani graziani@cabrillo.edu
ASCII-8 • IBM later extended the standard, using 8 bits per byte. • This was known as Extended ASCII or ASCII-8 • This gave 256 unique combinations of 0’s and 1’s. 0 = 00000000 1 = 00000001 2 = 00000010 3 = 00000011 … 255 = 11111111 1 Rick Graziani graziani@cabrillo.edu
ASCII-8 Rick Graziani graziani@cabrillo.edu
Try it! 1 • Write out Cabrillo College (Upper and Lower case) in bits (binary) using the chart above. 0100 0010 0110 0001 … C a Rick Graziani graziani@cabrillo.edu
The answer! 1 0100 0011 0110 0001 0110 0010 0111 0010 0110 1001 0110 1100 C a b r i l 0110 1100 0110 1111 0010 0000 0100 0011 0110 1111 0110 1100 l o space C o l 0110 1100 0110 0101 0110 0111 0110 0101 l e g e Rick Graziani graziani@cabrillo.edu
Unicode • Although ASCII works fine for English, many other languages need more than 256 characters, including numbers and punctuation. • Unicode uses a 16 bit representation, with 65,536 possible symbols. • Unicode can handle all languages. • www.unicode.org Rick Graziani graziani@cabrillo.edu
Pixels • A monitors screen is divided into a grid of small unit called picture elements or pixels. • The more pixels per inch the better the resolution, the sharper the image. • All colors on the screen are a combination of red, green and blue (RGB), just at various intensities. Rick Graziani graziani@cabrillo.edu
Each Color intensity of red, green and bluerepresented as a quantity from 0 through 255. • Higher the number the more intense the color. • Black has no intensity or no color and has the value (0, 0, 0) • White is full intensity and has the value (255, 255, 255) • Between these extremes is a whole range of colors and intensities. • Grey is somewhere in between (127, 127, 127) Rick Graziani graziani@cabrillo.edu
RGB Colors and Binary Representation • You can use your favorite program that allows you to choose colors to view these various red, green and blue values. Rick Graziani graziani@cabrillo.edu
RGB Colors and Binary Representation • Let’s convert these colors from Decimal to Binary! RedGreenBlue Purple: 172 73 185 Gold:253 249 88 Rick Graziani graziani@cabrillo.edu
RGB Colors and Binary Representation RedGreenBlue Purple: 172 73 185 Gold:253 249 88 Number of: 27 26 25 24 23 22 21 20 128’s64’s32’s16’s8’s4’s2’s1’s Dec. 172 73 185 253 249 88 Rick Graziani graziani@cabrillo.edu
RGB Colors and Binary Representation RedGreenBlue Purple: 172 73 185 Gold:253 249 88 Number of: 27 26 25 24 23 22 21 20 128’s64’s32’s16’s8’s4’s2’s1’s Dec. 172 1 0 1 0 1 1 0 0 73 0 1 0 0 1 0 0 1 185 1 0 1 1 1 0 0 1 253 1 1 1 1 1 1 0 1 249 1 1 1 1 1 0 0 1 88 0 1 0 1 1 0 0 0 Rick Graziani graziani@cabrillo.edu
RGB Colors and Binary Representation • We have now converted these colors from Decimal to Binary! RedGreenBlue Purple: 172 73 185 10101100 01001001 10111001 Gold:253 249 88 11111101 11111001 01011000 • Why does this matter? Rick Graziani graziani@cabrillo.edu
First a word about Pixels Per Inch 1600 pixels graphicssoft.about.com • PPI stands for pixels per inch. • PPI is a measurement of image resolution that defines the size an image will print. • The higher the PPI value, the better quality print you will get--but only up to a point. • 300ppi is generally considered the point of diminishing returns when it comes to ink jet printing of digital photos. 1200 pixels/300 ppi = 4 inches 1600 pixels /300 ppi = 5.3 inches 1200 pixels Rick Graziani graziani@cabrillo.edu
First a word about Pixels Per Inch • The higher the PPI value, the better quality print you will get--but only up to a point. Rick Graziani graziani@cabrillo.edu
RGB Colors and Binary Representation RedGreenBlue Purple: 172 73 185 10101100 01001001 10111001 24 bits for one pixel! • “True color” systems require 3 bytes or 24 bits per pixel. • There is 8 bit and 16 bit color, which gives you less of a color palette. Rick Graziani graziani@cabrillo.edu
RGB Colors and Binary Representation RedGreenBlue Purple: 172 73 185 10101100 01001001 10101111 = 24 bits per pixel • An 8 inch by 10 inch image scanned in at 300 pixels per inch: • 8 x 300 = 2,400 pixels 10 x 300 = 3,000 pixels • 2,400 pixels by 3,000 pixels = 7,200,000 pixels or 7.2 megapixels • At 24 bits per pixel (7,200,000 x 24) • = 172,800,000 bits or 21,600,000 bytes (21.6 megabytes) • RAM memory, video memory, disk space, bandwidth,… 10 inches or 3,000 pixels 8 inches or 2,400 pixels Rick Graziani graziani@cabrillo.edu
File Compression • Typical computer screen only has about 100 pixels per inch, not 300. • Images still require a lot of memory and disk space, not to mention transferring images over the network or Internet. • Compression – A means to change the representation to use fewer bits to store or transmit information. • Information sent via a fax is either black or white, long strings of 0’s or long strings of 1’s. Rick Graziani graziani@cabrillo.edu
Run-length encoding • Many fax machines use run-length encoding. • Run-length encoding uses binary numbers to specify how long the first sequence (run) of 0’s is, then how long the following sequence of 1’s is, then how long the following sequence of 0’s is, and so on. • Fewer bits needed than sending 100 0’s, then 373 1’s etc. • Run-length encoding is a lossless compression scheme, meaning that the original representation of 0’s and 1’s can be reconstructed exactly. Rick Graziani graziani@cabrillo.edu
JPEG Compression • JPEG – Joint Photographic Experts Group • JPEG is a common standard for compressing and storing still images. • Our eyes are not very sensitive to small changes in hue (chrominance), but we are sensitive to brightness (luminance). • This means we can store less accurate description of the hue of the picture (fewer bits) and our eyes will not notice it. • This is a lossy compression scheme, because we have lost some the original representation of the image and it cannot be reconstructed exactly. Rick Graziani graziani@cabrillo.edu
JPEG Compression Scheme • With JPEG we can get 20:1 compression ratio or more, without being able to see a difference. • There are large areas of similar hues in pictures that can be lumped together without our noticing. • Because of this, when Run-length compression is used there is more compression because there is less variations in the hue. Rick Graziani graziani@cabrillo.edu
MPEG Compression Scheme • MPEG (Motion Pictures Experts Group) • MPEG compression is similar to JPEG, but applied to movies. • JPEG compression is applied to each frame. • Then interframe coherency is used, which only records and transmits the “differences” between frames. Rick Graziani graziani@cabrillo.edu
Hexadecimal Number System <tr> <td rowspan="2" bgcolor="#cccc99"> </td> <td height="30" bgcolor="#999966"><div id="mainnav">
Pixels • A monitors screen is divided into a grid of small unit called picture elements or pixels. • The more pixels per inch the better the resolution, the sharper the image. • All colors on the screen are a combination of red, green and blue (RGB), just at various intensities. Rick Graziani graziani@cabrillo.edu
Dreamweaver Rick Graziani graziani@cabrillo.edu
With web applications like HTML (Hypertext Markup Language), colors are sometime described using their RGB color specification in hexadecimal. <tr> <td rowspan="2" bgcolor="#cccc99"> </td> <td height="30" bgcolor="#999966"><div id="mainnav"> Hexadecimal Number Rick Graziani graziani@cabrillo.edu
Hexadecimal REDGREENBLUE <td rowspan="2" bgcolor="#cccc99"> </td> RedGreenBlue cccc99 <td height="30" bgcolor="#999966"><div id="mainnav"> RedGreenBlue 999966 # means hexadecimal in web applications Rick Graziani graziani@cabrillo.edu
Hexadecimal Numbers • What are they? • Why do these people use them? • web designers • digital medial creators • computer scientists • networking professionals Rick Graziani graziani@cabrillo.edu
Rick’s Number System Rules • All digits start with 0 • A Base-n number system has n number of digits: • Decimal: Base-10 has 10 digits • Binary: Base-2 has 2 digits • Hexadecimal: Base-16 has 16 digits • The first column is always the number of 1’s • Each of the following columns is n times the previous column (n = Base-n) • Base 10: 10,000 1,000 100 10 1 • Base 2: 16 8 4 2 1 • Base 16: 65,5364,096256161 Rick Graziani graziani@cabrillo.edu
Hexadecimal Digits Hexadecimal: 16 digits DecHex 0 0 1 1 2 2 3 3 4 4 5 5 6 6 7 7 DecHex 8 8 9 9 10 A 11 B 12 C 13 D 14 E 15 F Rick Graziani graziani@cabrillo.edu
0, 1, 2, 3, 4, 5, 6, 7 ,8, 9, A, B, C, D, E, F Hexadecimal Decimal16’s1’s 8 8 9 9 10 A 14 E 15 F 16 10 Rick Graziani graziani@cabrillo.edu
0, 1, 2, 3, 4, 5, 6, 7 ,8, 9, A, B, C, D, E, F Hexadecimal Decimal16’s1’s 17 1 1 20 1 4 21 1 5 26 1 A 12 C 29 1 D Rick Graziani graziani@cabrillo.edu
0, 1, 2, 3, 4, 5, 6, 7 ,8, 9, A, B, C, D, E, F Hexadecimal Decimal16’s1’s 30 1 E 31 1 F 32 2 0 33 2 1 50 3 2 60 3 C Rick Graziani graziani@cabrillo.edu
Question… • Luigi went into a bar and ordered a beer. The bartender ask Luigi for his ID to make sure he was old enough to order a beer (21). After looking at Luigi’s ID the bartender told Luigi he was not at least 21. Luigi answered, “I’m sorry but you are wrong. I am exactly 21. My ID shows my age in Hexadecimal.” What age is on McLuigi’s ID in Hexadecimal? Decimal16’s1’s 21 1 5 16 + 5 Rick Graziani graziani@cabrillo.edu
Don’t forget why we are doing this! <tr> <td rowspan="2" bgcolor="#cccc99"> </td> <td height="30" bgcolor="#999966"><div id="mainnav"> Hexadecimal Number Rick Graziani graziani@cabrillo.edu
Why Hexadecimal? • Hexadecimal is perfect for matching 4 bits. • Every combination of 4 bits can be matched with one hex number. • 4 bits can be represented by 1 Hex value • 8 bits can be represented by 2 Hex values Rick Graziani graziani@cabrillo.edu
Hexadecimal Digits 4 bits can be represented by 1 Hex value DecHex Binary 8421 8 8 1000 9 9 1001 10 A 1010 11 B 1011 12 C 1100 13 D 1101 14 E 1110 15 F 1111 Hexadecimal: 16 digits DecHex Binary 8421 0 0 0000 1 1 0001 2 2 0010 3 3 0011 4 4 0100 5 5 0101 6 6 0110 7 7 0111 Rick Graziani graziani@cabrillo.edu
Hexadecimal Digits 4 bits can be represented by 1 Hex value • Hexadecimal is perfect for matching 4 bits. • Every combination of 4 bits can be matched with one hex number. • 4 bits can be represented by 1 Hex value • 8 bits can be represented by 2 Hex values Dec. Hex. Binary Dec. Hex. Binary 0 0 0000 8 8 1000 1 1 0001 9 9 1001 2 2 0010 10 A 1010 3 3 0011 11 B 1011 4 4 0100 12 C 1100 5 5 0101 13 D 1101 6 6 0110 14 E 1110 7 7 0111 15 F 1111 Rick Graziani graziani@cabrillo.edu
Converting Decimal, Hex, and Binary Dec. Hex. Binary Dec. Hex. Binary 0 0 0000 8 8 1000 1 1 0001 9 9 1001 2 2 0010 10 A 1010 3 3 0011 11 B 1011 4 4 0100 12 C 1100 5 5 0101 13 D 1101 6 6 0110 14 E 1110 7 7 0111 15 F 1111 ----------------------------------------------------- Dec. Hex BinaryDec. Hex BinaryDec. Hex Binary 0 0010 10 F 1110 12 A 0000 5 C 0010 1000 Rick Graziani graziani@cabrillo.edu