Lecture 3 notes

advertisement
ELEN 33 Introduction to Digital Signal Processing Systems
Lecture 3 Notes
Codes:




31 March 2000
Baudot code: Each code is 5 bits, so there are 32 different codes. This is too
small a number for alphabetic letters , numbers, and basic punctuation. Two
codes were reserved to represent a "shift" or a change from on character code
list (letters) to another list (numbers and punctuation). This leaves 30 possible
codes for each list or 60 total possible characters. However, this means that
interpreting a code requires memory of the most recent shift indicator. If an
error occurred that made the shift state unknown, the codes could not be
interpreted with certainty.
ASCII code: The letters stand for American Standard Code for Information
and Interchange. Each code is 7 bits so there are 128 different codes. No shift
states are used, and only the current value of a code is needed to interpret it.
Unicode: Each code is 16 bits. There are 216, or approximately 64,000,
possible codes. Version 20 defines 38,885 codes.
Universal Character Set: Each code has 32 bits. ISO 10646 defines it.
Hexadecimal is often used to represent the character codes since the binary
representation is often too long to easily remember. (Note: The space in the
middle of each binary code in the table below shows the correspondence between
a group of 4 bits and an equivalent hexadecimal digit. The space is put in only to
assist visual interpretation and has no other meaning.)
Binary code
(base 2)
0100 0001
0110 0001
0111 1010
Hexadecimal
code (base 16)
41
61
7A
Character
A
a
z
Signed Fixed Point representations:
Sign-magnitude
2's complement
Floating Point Representation
Values are written in scientific notation and saved as two number. One is the
exponent. The other is the magnitude and associated sign of the number.
Normalization to guarantee uniqueness
3.25*104=32.5*103=325000*10-1=0.00325*107
Increase dynamic range
Companding=Compressing and expanding
Use small amplitude steps for low amplitude and larger steps for high amplitude.
Copyright March 2000, Sally L. Wood
Page 1
ELEN 033 Lecture 3 Notes
Floating Point Formats:
IEEE 754: 32 bit
Single Precision
s Exp 8
23 bit fraction
sign 8 bit Hidden bit is to the
excess left of the binary
127
point
IEEE 754: 64 bit
Double Precision
s exp 11
sign 11 bit
excess
1023
52 bit fraction
Hidden bit is to the left of the binary point
TMS320C3x - Short
Internal
P4-5 User's Guide
exp s
15
11
fraction
10
0
The exponent is 4 bit 2's complement.
The mantissa is 12 bit 2's complement with an implied most
significant nonsign bit. The implied binary point is between
bits 11 and 10. The value is:
0
if e=-8
e
01.f x 2 if s=0
10.f x 2e if s=1
Copyright March 2000, Sally L. Wood
Page 2
ELEN 033 Lecture 3 Notes
TMS320C3x - Single
Precision
P4-6 User's Guide
exp
31
s
fraction
24 23 22
0
The exponent is 8 bit 2's complement.
The mantissa is 24 bit 2's complement with an implied most
significant nonsign bit. The implied binary point is between
bits 23 and 22. The value is:
0
if e=-128
01.f x 2e if s=0
10.f x 2e if s=1
TMS320C3x Extended Precision
P4-7 User's Guide
exp
39
s
fraction
32 31 30
0
The exponent is 8 bit 2's complement.
The mantissa is 32 bit 2's complement with an implied most
significant nonsign bit. The implied binary point is between
bits 31 and 30. The value is:
0
if e=-128
01.f x 2e if s=0
10.f x 2e if s=1
Copyright March 2000, Sally L. Wood
Page 3
ELEN 033 Lecture 3 Notes
mu-law and A-law:
Companding using 8 bits to represent values in a manner similar to floating point formats
described above. Input values over the range -1 to 1are mapped to 8-bit values with a step
size of approximately 0.00025 at the lowest amplitude and a step size of approximately
0.032 at the largest amplitude. There is an algorithm that converts from linear to mu law
encoding, and there is a Matlab function that will implement this. This representation is
not suitable for computation because it uses so few bits, but it is appropriate for
increasing the dynamic range of an audio signal using only 8 bits.
The most significant bit of the mu-law representation is the sign bit, and the exponent is 3
bits. The representation looks more like the other formats if it is bitwise complemented.
xmu=0:255;
xlin=mu2lin(xmu);
xmuc=255-xmu;
The table shows positive values (for the MSB of xmuc=0) represented by 128 of themulaw codes. Xmuc=16*xmucH+xmucL. Negative values have the same magnitudes.
xmucH
xmucL
0
1
2
3
4
5
6
7
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
.0002
.0005
.0007
.0040
.0045
.0050
.0121
.0131
.0140
.0282
.0302
.0604
.1249
.2538
.5116
.5428
.5741
.6053
.0032
.0034
.0037
.0114
Copyright March 2000, Sally L. Wood
.4882
Page 4
.9491
.9803
ELEN 033 Lecture 3 Notes
Download