1 / 34

Data Representation: Analog vs. Digital, Compression, and Binary Formats

This chapter explains the difference between analog and digital information, data compression techniques, binary formats for negative and floating-point values, and the characteristics of ASCII and Unicode character sets. It also covers the representation of sound, color, and graphics, as well as video compression methods.

miriami
Télécharger la présentation

Data Representation: Analog vs. Digital, Compression, and Binary Formats

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Chapter 03 Data Representation

  2. Chapter Goals • Distinguish between analog and digital information • Explain data compression and calculate compression ratios • Explain the binary formats for negative and floating-point values • Describe the characteristics of the ASCII and Unicode character sets • Perform various types of text compression

  3. Chapter Goals • Explain the nature of sound and its representation • Explain how RGB values define a color • Distinguish between raster and vector graphics • Explain temporal and spatial video compression

  4. Data and Computers Computers are multimedia devices,dealing with a vast array of information categories Computers store, present, and help us modify • Numbers • Text • Audio • Images and graphics • Video

  5. Data compression Reduction in the amount of space needed to store the data Compression ratio • The size of the compressed data divided by the size of the original data • Between 0 and 1 (0% and 100%) Compression techniques can be lossless, which means the data can be retrieved without any loss of the original information lossy, which means some information may be lost in the process of compaction

  6. Analog and Digital Data The world is infinite and continuous • Zeno’s paradox: “That which is in locomotion must arrive at the half-way stage before it arrives at the goal.” — Aristotle, Physics VI:9 Computers are finite and discrete! How do we represent an infinite world? We represent enough of the world to satisfy our computational needs and our senses of sight and sound Actually, there are analog computers!

  7. Analog and Digital Information Information can be represented in one of two ways: analog or digital Analog data A continuous representation, analogous to the actual information it represents Digital data A discrete representation, breaking the information up into separate elements

  8. Figure 3.1A mercury thermometer continually rises in direct proportion to the temperature Analog and Digital Information Thermometer is an analog device

  9. Analog and Digital Information Computers cannot work well with analog data, so we digitize the data Digitize Breaking data into pieces and representing those pieces separately Why do we use binary to represent digitized data? • Price • Reliability (Remember Leibniz and Babbage!)

  10. Electronic Signals Important facts about electronic signals • An analog signal continually fluctuates in voltage up and down • A digital signal has only a high or low state, corresponding to the two binary digits • All electronic signals (both analog and digital) degrade as they move down a line • The voltage of the signal fluctuates due to environmental effects

  11. Figure 3.2An analog and a digital signal Figure 3.3Degradation of analog and digital signals Electronic Signals (Cont’d) Periodically, a digital signal is reclocked to regain its original shape

  12. Binary Representations One bit can be either 0 or 1 One bit can represent two things (Why?) Two bits can represent four things (Why?) How many things can three bits represent? How many things can four bits represent? How many things can eight bits represent?

  13. Individual work: read entire Section 3.1

  14. Binary Representations Bit combinations Figure 3.4 Why does the number of combinations double with every extra bit?

  15. Binary Representations How many things can n bits represent? What happens every time you increase the number of bits by one? More advanced example: “one byte – two byte” representation

  16. Representing Negative Values Signed-magnitude number representation The sign represents the ordering, and the digits represent the magnitude of the number

  17. Representing Negative Values There is a problem with the sign-magnitude representation: plus zero and minus zero Solution: “Complement” representation

  18. Ten’s complement Using two decimal digits, represent 100 numbers • If unsigned, the range would be … let 1 through 49 represent 1 … 49 let 50 through 99 represent -50 … -1

  19. Ten’s complement To perform addition, add the numbers and discard any carry • Now you try it • 48 (signed-magnitude) • 1 • 47 • How does it work in • the new scheme?

  20. Ten’s complement A-B=A+(-B) Add the negative of the second to the first Try 4 - 4 -4 - 3 +3 + -3

  21. Two’s Complement(Vertical line is easier to read) Do you notice something interesting about the left-most bit (MSB)?

  22. Two’s complement on 4 bits (k = 4)

  23. Two’s complement Addition and subtraction are the same as in unsigned: -127 1000 0001 + 10000 0001 -126 1000 0010 But ignore any Carry out of the MSB: -1 1111 1111 + -11111 1111 -2 1111 1110

  24. Have a nice weekend! Individual work: • Read and take notes → up to p.62, before Number overflow • End of chapter exercises 1- 6, 33, 40, 41 The first exam will be next Friday (Sept. 18), during class time. Next Wednesday is review for exam.

  25. Two’s complement Formula to compute the negative of a number on k digits: • for ten’s comp: -I = Negative(I) → 10k - I • for two’s comp: -I = Negative(I) → 2k - I Practice: find the 8-bit two’s comp. representations of: -1 -2 -3 -51 -130 0

  26. Two’s complement Q: Given a number in two’s complement, how do we find its magnitude? A: Just like for unsigned numbers, only MSB is subtracted! Practice: find the magnitudes of the following two’s comp. numbers: 0000 0011 1000 0000 1000 0001 1000 0011 1001 0110 1111 1111

  27. What happens if the computed value won't fit in the given number of bits k? Overflow If k = 8 bits, adding 127 to 3 overflows 1111 1111 + 0000 0011 0 1000 0010 … but adding -1 to 3 doesn’t! Conclusion: overflow is specific to the representation(unsigned, sign-mag., two’s comp., floating point etc.)

  28. Overflow Problems occur when mapping an infinite world onto a finite machine!

  29. Representing Real Numbers Real numbers A number with a whole part and a fractional part 104.32, 0.999999, 357.0, and 3.14159 Positions to the right of the decimal point are the tenths, hundredths, thousandths etc: 10-1, 10-2 , 10-3 …

  30. Representing Real Numbers Same rules apply in binary as in decimal Decimal point is actually the radix point Positions to the right of the radix point in binary are 2-1 (one half), 2-2 (one quarter), 2-3 (one eighth) …

  31. Representing Real Numbers A real value in base 10 can be defined by the following formula The representation is called floating point because the number of digits is fixed but the radix point floats

  32. Representing Real Numbers • A binary floating-point value is defined by the • formula • sign * mantissa * 2exp

  33. Representing Real Numbers Scientific notation A form of floating-point representation in which the decimal point is kept to the right of the leftmost digit 12001.32708 is 1.200132708E+4 in scientific notation What is 123.332 in scientific notation? What is 0.0034 in scientific notation?

  34. This was all the material for Friday’s exam: up to and including Section 3.2 • This presentation is available on the webpage • Make sure you understand all the examples! • Review Wednesday!

More Related