0% found this document useful (0 votes)
21 views32 pages

COMS1015 Data Representation A

The document discusses the representation and storage of various data types in computers, distinguishing between analog and digital information, and explaining concepts like data compression, binary formats, and character sets such as ASCII and Unicode. It covers how different data types, including numbers, text, audio, images, and video, are stored and manipulated in digital form. Additionally, it addresses the nature of signals, data compression techniques, and the representation of negative and floating-point values in binary format.

Uploaded by

antmadondo035
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views32 pages

COMS1015 Data Representation A

The document discusses the representation and storage of various data types in computers, distinguishing between analog and digital information, and explaining concepts like data compression, binary formats, and character sets such as ASCII and Unicode. It covers how different data types, including numbers, text, audio, images, and video, are stored and manipulated in digital form. Additionally, it addresses the nature of signals, data compression techniques, and the representation of negative and floating-point values in binary format.

Uploaded by

antmadondo035
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 32

The representation and storage of different

data types in the computer


Chapter 3
 Distinguish between analog and
digital information
 Explain data compression and
calculate compression ratios
 Explain the binary formats for
negative and floating-point (rational)
values
 Describe the characteristics of the
ASCII and Unicode character sets
 Explain the nature of sound and its
representation
 Explain how RGB values define a colour
 Discuss the nature of images and raster and
vector graphics
 Explain temporal and spatial video
compression
• Data versus Information
• Computers are multimedia devices, dealing
with a vast array of information categories
• Computers store, present, and help us modify
• Numbers
• Text
• Audio
• Images and graphics
• Video
Bit (Binary digit)

Byte 8 bits

The number of bytes in a word determines


the word length of the computer, but it is
usually a multiple of 8

32-bit machines
64-bit machines

5
 Analog data obtained from the real world is
continuous
 Digital data as represented in digital
computers is discrete
 Analog data is converted to digital data by
sampling it at a finite number of points. The
data at these points are stored in binary
format.
Important facts about electronic signals
 An analog signal continually fluctuates in
voltage up and down
 A digital signal has only a high or low state,
corresponding to the two binary digits
 All electronic signals (both analog and digital)
degrade as they move down a line
 The voltage of the signal fluctuates due to
environmental effects
Periodically, a digital signal is reclocked to
regain its original shape

Figure 3.2
An analog and a digital
signal

Figure 3.3
Degradation of analog and digital signals

8
 Not only numbers, but any data can be
represented by binary numbers

 Once we know the number of choices that


any type of data requires, we can use enough
binary digits to code it.
 True & false 1 bit
 Car gears 3 bits
 Numbers as many as we can afford!
 Grey scale images 8 bits
 English letters 6 bits

 How many different states can we represent with


n bits?
 What happens every time you increase the
number of bits by 1?
Signed-magnitude number representation
The sign represents the ordering, and the
digits represent the magnitude of the number

11
Using two decimal digits:
 let 1 through 49 represent 1 through 49
 let 50 through 99 represent -50 through -1

 Easy to convert to new scheme – just subtract the


number you want to make negative from 100
 Easy to convert back – just subtract a number in the
negative range from 100.

12
To perform addition, add the numbers and
discard any carry into the hundreds position
Now you try it

48 (signed-magnitude)
-1
47

How does it work in


the new scheme?

13
A-B=A+(-B)
Add the negative of the second to the first

Try
4 -4 -4
-3 +3 + -3

14
Formula to compute the negative
representation of a number

Thus A – B is: A + (10k – B) = 10k + (A-B)

This representation is called the ten’s


complement

15
Two’s Complement
(Vertical line is easier to read)

16
Addition and subtraction are the same as in
10’s complement arithmetic

-127 10000001
+ 1 00000001
-126 10000010

Do you notice something interesting about the


left-most bit?

17
• Working out 2s complements:
• For example, for 8 bits, if we want to
represent –x we would use 28 – x
• That is 100000000-x
• Rather write this as 11111111 - x + 1
because the first two terms are “flip the bits
of x”
Rule: Flip the bits of x and add 1!
-32 -00100000 11011111+1 11100000
-64 -01000000 10111111+1 11000000
-96 -01100000 10100000

19
What happens if the computed value won't
fit?
Overflow
If each value is stored using eight bits,
adding 127 to 3 overflows
01111111
+ 00000011
10000010

Problems occur when mapping an


unbounded world onto a bounded machine!

20
A real value in base 10 can be defined by the
following formula

The representation is called floating point


because the number of digits is fixed but the
radix point floats

21
5 digit mantissa examples

15556*104
A binary floating-point value is defined by the formula
sign * mantissa * 2exp

22
What must be provided to represent text?
There is a finite number of characters to
represent, so list them all and assign each a
binary string
Character set
A list of characters and the codes used to
represent each one
Computer manufacturers agreed to
standardize…

23
ASCII stands for American Standard Code for
Information Interchange
ASCII originally used seven bits to represent
each character, allowing for 128 unique
characters
Later extended ASCII evolved so that all eight
bits were used
How many characters could be represented?

24
25
The first 32 characters in the ASCII
character chart do not have a simple
character representation to print to
the screen

What do you think they are used for?

26
Extended ASCII is not enough for international
use
Unicode uses 16 bits per character
How many characters can UNICODE
represent?
Unicode is a superset of ASCII
The first 256 characters correspond exactly to
the extended ASCII character set

27
Figure 3.6 A few characters in the Unicode character set

28
• Data compression
Reduction in the amount of space needed to
store a piece of data
• Compression ratio
The size of the compressed data divided by
the size of the original data
• A data compression technique can be
– lossless, which means the data can be retrieved
without any loss of the original information
– lossy, which means some information may be lost
in the process of compaction
Assigning 16 bits to each character in a
document uses too much file space

We need ways to store and transmit text


efficiently

Text compression techniques


keyword encoding
run-length encoding
Huffman encoding

30
A single character may be repeated over and
over again in a long sequence
Replace a repeated sequence with
◦ a flag character
◦ repeated character
◦ number of repetitions
*x8
◦ * is the flag character
◦ x is the repeated character
◦ 8 is the number of times x is repeated

31
Original text
bbbbbbbbjjjkllqqqqqq+++++
Encoded text
*b8jjjkll*q6*+5 (Why isn't l encoded? J?)
The compression ratio is 15/25 or .6

Encoded text
*x4*p4l*k7
Original text
xxxxpppplkkkkkkk
This type of repetition doesn’t occur in English text; can you
think of a situation where it might occur?

32

You might also like