Homework 6 Solutions - Lyle School of Engineering

advertisement
EE 1382 Foundations of Electrical Engineering
Homework 6
Due Thursday 27 February 2003
1) Represent the natural number (e = 2.718281828…) as an unsigned 8 bit binary representation as
accurately as possible.
10.101101=2.703125
10.101110=2.71875
2) Sample and quantize the signal s(t)=3*sin(2  t/4) at a sample rate of 2 Hz for samples n=0 to 10.
The quantization should be a 5 bit signed representation between +3 and -3 (i.e., ±XX.XX where X
is a bit). Round to the nearest quantization level.
N
0
1
2
3
4
Ts
0.5
0.5
0.5
0.5
0.5
t
5
0.5
2.5
6
0.5
3
7
8
9
10
0.5
0.5
0.5
0.5
3.5
4
4.5
5
0
0.5
1
1.5
2
s(t)
0.00000000
2.12132034
3.00000000
2.12132034
0.00000000
2.12132034
3.00000000
2.12132034
0.00000000
2.12132034
3.00000000
Binary
000.00
010.01
011.00
010.01
000.00
110.01
111.00
110.01
000.00
010.01
011.00
3) Apply run length encoding to the following bit string:
00000000000000111111111000001111111111111000111110000111111110011111
Max Run Length is 14 so run length will take 4 bits
(0), (14,0),(9,1),(5,0),(13,1),(3,0),(5,1),(4,0),(8,1),(2,0),(5,1)
so: 01110100101011101001101010100100000100101
What is the compression ratio achieved?
Compressed bits 41 / uncompressed bits (14+9+5+13+3+5+4+8+2+5=67 = 41/67= 61.2%
4) Design a Huffman code tree for the following text message and provide the final bit sequence for
the message. What is the compression ratio achieved assuming an ASCII representation of the
original message?
EANY MEANY MINEY MOE, OUT GOES Y O U
E
5
_
8
_
8
_
8
A
2
E
5
E
5
E
5
N
3
Y
4
Y
4
Y
4
Y
4
O
4
O
4
O
4
_
8
N
3
N
3
N
3
M
3
M
3
M
3
M
3
I
1
A
2
A
2
A
2
O
4
U
2
U
2
U
2
,
1
I
1
GS
2
GS
2
U
2
,
1
I
1
,T
2
T
1
T
1
,
1
I
1
G
1
G
1
T
1
S
1
S
1
_
8
_
8
_
8
_
8
E
5
E
5
E
5
NM
6
Y
4
Y
4
,TIA
5
E
5
O
4
O
4
Y
4
,TIA
5
N
3
UGS
4
O
4
Y
4
M
3
N
3
UGS
4
O
4
,TI
3
M
3
N
3
UGS
4
A
2
,TI
3
M
3
U
2
A
2
GS
2
_
8
,TIAY
9
NME
11
OUGS
16
OUGS
8
_
8
,TIAY
9
NME
11
NM
6
OUGS
8
_
8
,TIAY
9
E
5
NM
6
OUGS
8
,TIA
5
E
5
Y
4
NME,
20
TIAY
OUGS
16
NME,TIAY-OUGS
-OUGS
NME,TIAY
NME
NM
N
,TIAY
E
,TIA
,TI
M
,T
-
Y
A
OUGS
O
UGS
U
GS
I
G
,
T
Symbol
Freq.
Code
_
8
01
E
5
110
Y
4
100
O
4
001
N
3
1111
M
3
1110
A
2
1010
U
2
0001
I
1
10110
,
1
101111
T
1
101110
G
1
00001
S
1
00000
S
5) You are designing an Enhanced CD containing images and audio of a particular band and its music.
You wish to store 50 full-color 24-bit images of 1200x1600 pixels each plus 60 minutes of stereo CDquality music (16-bit, 44.1kHz sample rate).
a)
Assuming that a CD holds 700MB, can the CD store everything you need in its original format?
b) If not, what compression ratio do you need to compress the images by to fit everything onto one
CD? Is this compression ratio reasonable?
50 images 3 bytes/pixel * 1200x1600 pixels /image = 288 MB
+
60 minutes * 60 sec /minute * 2 channels * 16 bits/sample * 44100 samples/sec * 1 byte/8bits
=635.04 MB
Total = 923.04 MB too much for a 700 MB CD.
288*x+635.04=700
x=22.43%. Probably a little extreme unless the images don’t contain much variation.
Download