me
Superdanby

Data Representation

Units

  • bit, byte, kilobytes, megabytes, gigabytes, terabytes, petabytes
  • 1000 base, MB
  • 1024 base, MiB
  • b vs B

Numerical

Encoding

  • Excess 3
  • BCD
  • Exercise: base 10, 9’s complement vs 10’s complement

Integers(fixed point)

  • 2’s complement: mainly used
  • 1’s complement: postive & negative 0
  • Sign and magnitude
  • Gray code

Floating point

  • Sign and magnitude
  • Float(32bits, 1 + 8 + 23), excess-127
  • Double(64bits, 1 + 11 + 48)

Overflow & Underflow

Conversion

  • 10110.0011~(2)~
  • 1101~(2)~
    • unsigned
    • signed
  • float: 1 01111111 00000 00000 00000 00000 001 = -(1+2^-23^)

Text

Audio

  1. Sampling
    • Sample rate(e.g. 44100Hz)
    • Duration(e.g. 3s)
  2. Quantization
    • Bit per sample(bit depth, e.g. 24 bit)
  3. Encoding
    • Lossy: mp3, ape…
    • Lossless: wav, flac…
  • Bit rate = sample rate * bit depth (e.g. 1033kbps)

Images

  • Raster(bitmap) graphics: bmp, jpeg, gif…
  • Vector graphics: svg…
  • Resolution
  • Color depth
    • True color: 24 bits, 3 channels
    • Indexed color: a subset color of true color

Videos

  • Mpeg4, avi, mkv…

Questions

  1. Convert the 1010.01011~(2)~ to decimal and octal.
  2. Convert the 734.2371~(8)~ to decimal and binary.
  3. Convert the 31.96~(10)~ to octal and binary.
  4. Represent 31.96~(10)~ with single precision floating point.
  5. When will overflow and underflow happen?
  6. Give 1 example of overflowing and 1 example of underflowing.
  7. If a piece of audio has 500 bytes, duration of 5s, bit depth is 10bit. What’s its bit rate and sampling rate?
  8. How do resolution and color depth affect an image?