Representing Nonnumeric Data Everything is really a number
Its all 1’s and 0’s How do we represent other things? Words/Pictures/Sound?
Text To store English we need Letters (upper case & lower) Punctuation Special marks (space, newline, etc…)
Text To store English we need Assign each a number Letters (upper case & lower) Punctuation Special marks (space, newline, etc…) Assign each a number ASCII encoding : most popular such scheme
ASCII table Partial table Full Table: http://www.ascii-code.com/ DEC OCT HEX BIN Symbol 47 057 2F 00101111 / 48 060 30 00110000 49 061 31 00110001 1 50 062 32 00110010 2 51 063 33 00110011 3 52 064 34 00110100 4 53 065 35 00110101 5 54 066 36 00110110 6 55 067 37 00110111 7 56 070 38 00111000 8 57 071 39 00111001 9 58 072 3A 00111010 : 59 073 3B 00111011 ; 60 074 3C 00111100 < 61 075 3D 00111101 = 62 076 3E 00111110 > 63 077 3F 00111111 ? 64 100 40 01000000 @ 65 101 41 01000001 A 66 102 42 01000010 B 67 103 43 01000011 C 68 104 44 01000100 D 69 105 45 01000101 E 70 106 46 01000110 F 71 107 01000111 G 72 110 01001000 H 73 111 01001001 I Partial table Full Table: http://www.ascii-code.com/ A = 65 = 01000001 My name: A n d r e w 01000001 01101110 01100100 01110010 01100101 01110111
Text Why 0-127? Need more characters? Well it seemed like enough 127 is 2^7 – the biggest number you can write with 7 binary digits. Need more characters? Extended ASCII – 8 bits (1 byte) – 256 characters Unicode – universal scheme – up to 4 bytes per character http://unicode-table.com/en/#devanagari
Bitmaps Image divided into pixels Each pixel either on (1) or off (0)
Adding gray 2 digits for each square give 4 “colors” (00, 01, 10, 11)
Adding gray 2 digits for each square give 4 “colors” (00, 01, 10, 11)
Image Size Image is 2000 pixels wide & 1000 pixels tall. 2000 x 1000 = 2,000,000 pixels Bits per Pixel 24 8 1 Number Colors 16,777,216 256 (color) 256 (grays) 2 Image Size 48,000,000 bits or ~5.7 MBytes 16,000,000 bits or ~1.9 MBytes 2,000,000 bits or ~244 KBytes
Vector Art Vector images are mathematically based Everything described as lines and curves Shapes are filled with solid color, gradients or patterns
Computer Sounds Two approaches to representing sound as numbers: MIDI sequences Samples