Ch. 8: Multimedia Encoding
  1. Representing numbers.
    1. Humans use decimal numbers: base 10.
    2. This requires ten symbols.
    3. Computers like to use two sybols, so they use binary numbers: base 2.
    4. Place value.
      1. Rightmost place value is one.
      2. Multiply by the base each time.
      3. Decimal: 105 = 100000, 104 = 10000, 103 = 1000, 102 = 100, 101 = 10, 100 = 1
      4. Binary: 27 = 128, 26 = 64, 25 = 32, 24 = 16, 23 = 8, 22 = 4, 21 = 2, 20 = 1
      Additive Combination
    5. Conversion from.
      1. Decimal (42581):
        Powers104103102101100
        Digits 42581
        Product 400002000 500 80 1 Sum: 42581
      2. Binary (101011011):
        Powers282726252423222120
        Digits 101011011
        Product 2560 64 0 16 8 0 2 1 Sum: 347
      3. More
    6. Conversion to binary.
      1. 211:
        Number211 211 83 19 19 3 3 3 1
        Place2561286432168421
        Subtract8319310
        Bits011010011
      2. 78:
        Number78 14 14 14 6 2 0
        Place6432168421
        Subtract14620
        Bits1001110
      3. More
    7. Binary addition.
      110010
      +1001
      111011
      1111
      1011
      +11011
      100110
      11
      1110
      +101
      10011
      1111
      110101
      +10010101
      11001010

      Carry-out when the sum is ≥ the base.
      More
  2. Mixing Light
    1. Paint
      1. Red, blue and yellow.
      2. Combine to black.
      3. Subtractive mixing.
    2. Light
      1. Red, blue and green.
      2. Combine to white.
      3. Additive mixing.
  3. Representing and Displaying Colors.
    1. Displays have a grid of dots, “pixels”.
    2. Each pixel has three colored dots of light.
    3. The dots' intensity is varied mix any desired color.
    4. Each pixel is represented numerically.
      1. A number for each color describes its intensity.
      2. Conventionally, each number is a byte (8 bits).
    5. This should be familiar.
  4. Representing Images.
    1. Images are arrays of pixels.
      1. Image is a 2-dimensional array of pixels.
      2. Each pixel has a color.
    2. Modify images using tests and arithmetic.
      1. Add to each pixel to brighten.
      2. Re-color selectively.
  5. Representing Video: Sequence of images, called frames.


  6. Representing Sound.
    1. Sampling.
      1. A to D, D to A.
      2. Sampling rate.
      3. Sample precision.
    2. Examples
      1. Music CDs are recorded at 44.1 kHz, using 16 bits per channel.
      2. Telephone calls are sampled at 8 kHz, using 8-bit samples.
    3. Nyquist Rule: Sampling must be twice the largest frequency.
    4. Sampling Rate Example.
  7. Compression.
    1. Multimedia files are large: Need to make 'em smaller.
      1. This picture of the capitol is 1288 by 840 pixels. That takes 3×840×1288=3245760 bytes, or about 3M.
      2. I have a recording of the main title from Star Wars Episode IV. As an uncompressed .wav file, it takes 55M.
    2. Lossless (classical) compression: Decompressed data is identical to the original.
      1. Run-length encoding: replace 20,20,20,20,20 with 5x20.
      2. Variable-length coding: shorter codes for more common characters.
      3. Color tables.
        1. Make a list of all colors in an image.
        2. Refer to them by index instead of full three-byte description.
        3. Works well for diagrams, but not photographs. Why would that be?
        4. Used by GIF.
      4. Record the difference.
        1. The difference between two things is often smaller than either.
        2. Stereo sound: record the second channel as the difference from the first.
        3. Video: record successive frames as the difference from the previous.
    3. Lossy compression.
      1. Data may differ from the original.
      2. Designed to “look” or “sound” the same.
      3. Sacrifices imperceptible detail for better compression. Examples
      4. The jpeg, mp3 and mp4 formats are examples.
    4. Sizes.
      1. The picture of the capitol is 373K as a jpeg.
      2. The mp3 version of the Star Wars theme is 9.8M.
  8. Multimedia Performance.
    1. Latency.
    2. Bandwidth.
  9. Optical Character Recognition (OCR).
  10. Meaning is imposed
    0000 0000 1111 0001 0000 1000 0010 0000
    1. Binary 15,796,256
    2. A reddish color
    3. ADD 1, 7, 17 MIPS assembler.
    4. Left 241, right 281 sound sample.
    5. IP address 0.241.8.32.