Presentation is loading. Please wait.

Presentation is loading. Please wait.

Representing Concepts Part 2--

Similar presentations


Presentation on theme: "Representing Concepts Part 2--"— Presentation transcript:

1 Representing Concepts Part 2--
What we’ll cover for Part 2 : Representing concepts in a computer 1st type: Numeric values --brief review Today: How are some of the other concepts represented in the box? 1234

2 Information theory: Study of the most efficient way to encode concepts: information that interests us. All information must be captured & stored, processed, and transmitted. Using numbers to represent information allows us to use a discrete symbol system: distinct, unambiguous, precise. Discrete numbers are much easier to engineer than continuous numbers. Quick review of Part 1: How do we represent numeric values such as 1378 or in a computer? Logical structure? Physical structure? Mathematical operations (add, subtract, multiply, divide) operate on numeric information.

3 1 0 1 1 base 2 1 1 1 1 base 2 Digression: Binary Addition 1 1 1 Rules
0 + 0 = 0 1 + 0 = = 1 1 + 1 = 1 0 Carry: 1 1 1 base 2 base 2 1 1 Sum: 1

4 Representing characters
A - Z a - z # $ % ^ & * ( ) + = Must work with binary coding schemes (why?) Digression: the program determines if a stored bit pattern represents a numeric value, or an alphanumeric text, or part of a sound, or part of a picture, or part of an instruction..... With unique bit patterns, we can represent any character (including foreign characters), just the way we already used unique bit patterns to represent decimal values……

5 Another digression: However: Bit patterns that represent characters (alphanumeric) are typically not used used for mathematical computations like add or subtract. Instead: alphanumeric characters are mostly used to store textual content, which may be sorted or concatenated. So: although both numeric values (used for counting & math) and alphanumeric characters (used for text) are both represented using a bit pattern, they are treated differently.

6 Consider: Number characters (alphanumeric) are treated by the computer as text characters: 9 not= “9” 9 + 9 = while “9” + “9” = “99” The Binary pattern that represents 9 is different from the binary pattern that represents “9”. yet sorting is possible because text characters also have a binary (numeric) value: The numeric value of the binary representation of a is smaller than b and also b is smaller than c and so on …

7 NOTICE how A < B < C ……
“Place” “0” “1” “2” “A” “B” Letter B in binary code “C” Letter B “in the box” How to represent C ??? NOTICE how A < B < C ……

8 Number of symbols possible
Remember? x bits could represent 2x numbers 2 bits  22 = 4 different bit patterns Bit pattern 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111 Decimal value 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 4 bits?  different [24 = 16] SAME THING when representing alphanumeric characters: A two-bit code (two bulbs) can represent (e.g. encode) four unique characters.

9 22 = 4 A Base # bits = number of unique B C D = combinations
= 4 Base # bits = number of unique combinations (that represent values) = A B 1 C D

10 Base# of bits used = number of unique symbols the
coding scheme can represent Bit pattern length LOGICAL Representation (bit coding scheme): CORRESPONDS DIRECTLY to the PHYSICAL Representation (hardware “bits”): How many bulbs (switches, transistors, vacuum tubes, magnetized locations on disk, ...) #-of-States # of bulbs = number of unique symbols the bulbs can represent

11 What if we use more expensive light bulbs? OFF LOW HIGH
QUICK! Would that allow us to represent/encode MORE or LESS unique things? WHY? (assume will use only 2 bulbs) Then what has changed? Not how many bulbs, but what? #-of-States # of bulbs = number of unique combinations; which indicates number of unique values the bulbs can represent = A B C D 1 2 E F G H I 32 = 9 combinations

12 A D G B E H? C F = = 23 = 8 combinations
What if we don’t want to use complicated bulbs---how else can we INCREASE how many things can be represented?? So, base (# of states) is two: (0 , 1) (off , on) NOW what MUST change? #-of-States # of bulbs = number of unique combinations; which indicates number of unique things the bulbs can represent Base# of bits used = number of unique things the coding scheme can represent 1 = A B C D E F G 1 = H? 23 = 8 combinations

13 22 = 4 combinations 23 = 8 “ 24 = 16 “ 25 = 32 “ 26 = 64 “ 27 = 128 “
23 = 8 “ 24 = “ 25 = “ 26 = “ 27 = “ 28 = “ 216= “ So, to get more things represented, we just keep adding bits (or light bulbs)

14 For alphanumeric character values:
Bit pattern (etc) Character (text) value 1 2 3 A B C D E 7, 8, 16, 32, and 64-bit patterns are used for alphanumeric character values: 27= character values 28= character values 216= 65,536 character values 232= > 4 billion char values 264= 18,446,744,073,709,551,616 character values 14

15 Challenge 1: 26 upper-case characters in our alphabet
Challenge 1: 26 upper-case characters in our alphabet. Want our electronic word processor to manipulate all 26. Must create binary coding scheme that will allow us enough unique patterns to encode all 26. What is the minimum bit pattern length that is required for our coding scheme? (minimum number of bulbs) What two parts of the equation do we already know? Base# bits used = no. of unique things coding scheme can represent States# bulbs used = no. of unique things coding scheme “ “ x 2 >= 26 x=5 (25=32)

16 26 >= X X=64 Maximum number of characters in the Zuni alphabet?
Challenge 2: there are X number of characters in Zuni alphabet. Want our word processor to manipulate all of them. A binary coding scheme, which is six bits long, would allow enough unique patterns to be able to manipulate all the characters of the Zuni alphabet. Maximum number of characters in the Zuni alphabet? Base# of bits used = no. of unique things coding scheme can represent What parts do we already know? 26 >= X X=64

17 Character formats ASCII and Extended ASCII (ANSI):
Standard ASCII: Basic set for character data: 7-bit code can represent how many characters? 128 ANSI: Extended ASCII to 8-bits (Windows apps use 8 bits) can represent how many characters? 8 bits: each pattern also fits nicely into 1 memory cell. 256

18 8-bit ASCII A B C Hello In 8-bit ASCII code: In the box (memory or storage): 8 bits: one byte (one character): logical 8 bulbs: stores one byte: physical 17

19 Representing other information types… pictures, sounds
Other codes Unicode: 16-bit code (65,536 bit patterns) Internat’l Standards Org: 32-bit code (>4 billion bit patterns) Quotable... Representing other information types… pictures, sounds

20 Important digression:
Data can travel and be stored in the form of a signal. Signal: anything that changes with time or space. Different types of signals: Analog: continuous values (measurable) Most of what we see/hear is in ANALOG form: sound, light, water, electricity, temperature, wind: can be plotted as a continuous, undulating line or wave. time Digital: discrete values (countable, like numbers) time

21 Converting analog info to digital form:
Most natural forms of information (pictures, sounds) are in analog form--continuous values E.g.: Sound: how loud? How high? (pitch) E.g.: Color: GRAY . But how GRAY is it? No precise way in analog world to determine this perfectly and the same each time. G G G G Computers: designed to store and process (and transmit) discrete, on/off signals. So with digital computers, we’ll have to change analog signals with infinite precision into digital signals with finite precision. That process is called “digitizing” (or “sampling”).

22 Advantages of digital (over analog)
Digital signals offer the following, and more… Known Precision Ordinality (built-in order of numbers) Shades from darkest to lightest are expressed as numbers, from smallest to largest. Example: Eight shades to work with, from black to white: 1 2 3 4 5 6 7 000 001 010 011 100 101 110 111 Absolute perfect replication Analog: Copy of a copy of a copy…..last as good as original? Content analysis much easier Compression techniques work well (later!!)

23 Representing visual info
Images; graphics Computer images: formed by collections of dots; each dot is a picture element: pixel. How image is represented & stored inside the computer (logical structure) can be radically different. Bitmapped: Also called Raster Object-oriented: Also called Vector Each has its own advantages, disadvantages, and particular uses.

24 Bitmap graphics Image is represented by bits.
Each bit pattern defines one pixel. Good illustration: SCANNER Regular photograph. What kind of information is it? What kind of information can be stored and manipulated inside a digital computer? Essentially, then, what does your SCANNER have to do? In laymen’s terms, how? Phys’l: Log’l: 000 001 010 011 100 101 110 111 Dec’l Binary 23

25 Stored representation of such a picture: “bitmap” or “pixmap”
Stored bits are like a map of image being represented. B&W Image Bitmap Physical representation of bits are actually stored in memory. Program? Knows nothing about shapes of objects; only which pixels are what color value (more shortly…) 24

26 Monochrome (Black&White).
If a single pixel can be either black or white, then how many bits are needed to represent one pixel? Why? 1 25

27 2? = 8 unique “shades” (or values of gray)
Grayscale What if we want to represent more? Say, shades of gray. What has to happen to the bits stored in memory in order to represent more different values (shades) on the screen? Intuitively: LESS or MORE bits/pixel than with B&W? ILLUSTRATION: If a single pixel can be any one of eight shades, what minimum # of stored bits is needed to represent that one pixel? (Length of coding scheme?) ? ? OK, what about binary bits? Are two bits enough? 2? = 8 unique “shades” (or values of gray) 2? = unique “shades” (or values of gray) 26

28 Editing bitmaps

29 Number of shades possible
REMEMBER BACK? Bit pattern length Base# of bits used = number of unique concepts/values the coding scheme can represent Bit pattern length Base# of bits used = number of unique shades/colors the coding scheme can represent NOTICE a PATTERN HERE ? 28

30 Representing color Color Primary colors for computer graphics: RGB
Digression: Why RGB? The additive reproduction process mixes various amounts of R, G and B light to produce other colors. For more information: Primary colors How colors work: 29

31 224 = ? ~16.7 million unique color values.
“True” color uses a 24 bit code to represent each color value: (photographic quality) 8 bits for red (28 = 256 shades of red) 8 bits for green (28 = 256 shades of green) 8 bits for blue (28 = 256 shades of blue) 8 bits Combine various shades to make various color combinations (provides lots of bit patterns). SO: If one pixel is represented by a 24-bit code, how many different COLOR VALUES can a single pixel display? 224 = ? ~16.7 million unique color values. 30

32 LOOKING IN THE BOX: 24 bits stored for EACH PIXEL!
= BLACK = All OFF Again, imagine an advancing odometer that would show all of the color values between black and white …! AND LOTS MORE! = WHITE = All ON

33 File formats for bitmap graphics
File format : How information is encoded & stored Different software apps understand different graphics file formats (encoding systems). TIFF, GIF, JPEG, BMP,... Some better for certain purposes... Beyond the scope of COMP 4. When saving an image file one can usually choose a file format from a selection. PowerPoint, for example, recognizes a number of graphics file formats, but not all. However, utilities (filters) can interpret and convert one file format to another. Software often comes w/filters (or can download from software vendor’s Web site).

34 Advantages, disadvantages, applications:
Photo realism. Software: Photo editing, and Paint. Can work at pixel level. HUGE files without compression! Storage and download time! Images do not scale up well: Image resolution is important Original bitmapped graphic Same image scaled up

35 Vector graphics Uses instructions to draw lines, fill shapes (rather than tracking and storing bits for each pixel)…. In English: “Draw a circle at the point that is 100 pixels to the right and 140 pixels down from the top-left corner of the screen with the radius of 25 pixels.” Software: Drawing. Shapes are known to the program. Does not work at pixel level, but rather at object-level. Scalable, no jaggies. Files relatively small Layering: “2 ½ dimensions” Seeing more vector graphics for the Web: .sfv, .cmg

36 Representing sound Produced by vibration; transmitted over a medium.
another important means of conveying information. Produced by vibration; transmitted over a medium. Sound travels in analog wave patterns. Wave characteristics: amplitude (loudness) and frequency (pitch) can be measured & sampled over time, and stored as a sequence of binary numbers. Called? “Digitizing” or “sampling” Much like scanning an analog photograph spatially creates a digital bitmap. The higher the sampling rate, the better the quality of the digital signal!

37 Analog to digital audio
dB Samples time Sampling rate Analog sounds can be: Captured in analog form by an analog microphone Converted to digital form by an ADC (audio to digital converter) Stored as file on a digital storage device (CD or hard drive). Then, for playback to human ears: Converted to analog form by a DAC (digital to analog converter) Played back by analog speakers.

38 These days, we can get Digital capture and player devices for both audio and video. Digital cameras Digital camcorders Digital microphones So, for that data, the computer does not need ADC or DAC converters: captured and played all in the same digital mode. MP3 files: file format that squeezes digital sound into small files through sophisticated compression adapted to the human ear (more later). Fast to download; less to store.

39 SUMMARY! We can use bit patterns of zeroes and ones to represent: Numeric values Alphanumeric text Pictures (bitmaps) Sounds and Instructions Vector graphics; MIDI (music); General programming (coming) RECAP: SOFTWARE determines if a stored bit pattern represents a numeric value, or alphanumeric text, or part of a sound, or part of a picture, or part of an instruction all bits look the same to the CPU!


Download ppt "Representing Concepts Part 2--"

Similar presentations


Ads by Google