Data Representation B
Data Representation B
1
ballboard would be
1010001001001010110001111011
Encode roadbed
1111100010111010011011
2
In Huffman encoding no character's bit string
is the prefix of any other character's bit
string – this is called the prefix property
To decode
◦ look for match left to right, bit by bit
◦ record letter when a match is found
◦ begin where you left off, going left to right
3
Try it!
Decode
1011111001010
DRAB
4
Technique for determining codes guarantees
the prefix property of the codes
5
• Consider a data stream where there are only
4 characters: A, B, C, D
0.40
B
10
1.00
0.35
1
110
C 11
0.60
0.20
111 0.25
D
0.05
• Note that the coding is now:
A 0
B 10
C 110
D 111
• Sometimes we use 1 character, sometimes 3.
10
A stereo sends an electrical signal to a speaker to
produce sound
This signal is an analog representation of the sound
wave
The voltage in the signal varies in direct proportion
to the sound wave
11
Digitize the signal by sampling
◦ periodically measure the voltage
◦ record the numeric value
12
Some data
is lost, but a
reasonable
sound is
reproduced
13
CDs store audio information digitally
On the surface of the CD are microscopic pits
that represent binary digits
A low intensity laser is pointed as the disc
The laser light reflects
◦ strongly if the surface is smooth and
◦ poorly if the surface is pitted
14
Figure 3.9
A CD player reading
binary information
15
Audio Formats
◦ WAV, AU, AIFF, VQF, and MP3
16
Colour
Perception of the frequencies of light that
reach the retinas of our eyes
18
Colour is expressed as an RGB (red-green-
blue) value--three numbers that indicate the
relative contribution of each of these three
basic colours
19
Figure 3.10 Three-dimensional colour space
20
A few TrueColor
RGB values and
the colors they
represent
21
A browser may support only a certain number
of specific colours, creating a palette from
which to choose
Figure 3.11
The Netscape color palette
22
23
Digitizing a picture
Representing it as a collection of individual
dots called pixels
Resolution
The number of pixels used to represent a
picture
Raster Graphics
Storage of data on a pixel-by-pixel basis
Bitmap (BMP), GIF, JPEG, and PNG are raster-
graphics formats
24
Bitmap format
Contains the pixel colour values of the image from
left to right and from top to bottom
GIF format (indexed colour)
Each image is made up of only 256 colours
JPEG format
Find out about it.
PNG format
Like GIF but achieves greater compression with wider
range of colour depths
25
M columns 0...15 Quantized
Value 110
N rows
0...15
27
The good side and the bad side…
28
Video codec: COmpressor/DECompressor
Methods used to shrink the size of a movie to
allow it to be played on a computer or over a
network
29
Temporal compression
A technique based on differences between
consecutive frames: If most of an image in
two frames hasn’t changed, why should we
waste space to duplicate all of the similar
information?
30
Spatial compression
A technique based on removing redundant
information within a frame: This problem is
essentially the same as that faced when
compressing still images