Chapter 2: Basics on computers and
digital information coding
Syllabus (1/3)
1. Introduction on Information Technologies (IT) and Cultural Heritage (CH)
1. The role of Cultural Heritage
2. Safeguarding and management
3. Context aware multimedia guides
4. The role of technology
2. Basics on Computers and digital information coding
1. Reference model: the Von Neumann Machine 2. Information and its measure
3. Binary information encoding
4. Binary codes: fundamental inequity for coding, examples (ASCII, 7 segment, numbers)
Why do computers and computer
industry develop so fast?
Because they share the same reference model
Returns on investments on computers are continuously
reinvested on the same reference model, leading to reduced
recurring costs and increased performance.
This leads to new applications, increased turnover and new
opportunities for further investments that are always redirected to the same reference model, with further virtuous
improvements in performance and costs
So, what is a computer?
A computer is just an information
processing machine, where
information is represented through
sequences of “0”s and “1”s
COMPUTER REFERENCE MODEL
A computer is a machine with the following properties:
• It is digital
• It is programmable
• Its programs are set of instructions executed
sequentially
• Its programs and its data are stored on a memory
support
Therefore we say that a computer is a stored program
sequential digital machine
John Von Neumann (1903-57) proposed in 1940 the model of a general
purpose programmable digital machine
The Von Neumann machine was adopted by the industry as the computer
reference model
Again, the essential features of the Von Neumann machine are:
It is digital
It is a general purpose machine and the desired functionality is assigned by
an instruction sequence named program
The program is stored on a memory support
Therefore:
the function performed by a computer may be changed by changing its program
The Von Neumann Machine (1940)
The electronic implementation of a Von Neumann machine is called “hardware” The set of programs executed by a computer is called “software”
A Mobile Phone as a computer
USB SD/CF/MicroSD GPS Keyboard Display Vibro-Tactile SpeakersInput Input/Output Ouput
What happens to information inside a
computer?
• Text is information
• Images are information
• Spoken language is information
Inside a computer information is always represented through sequences of “zeros” and “ones”
Sequences of “0” and “1” are stored (Memory), processed (CPU) and
moved (BUS) inside a computer
Furthermore:
How many zeros and ones are required
to represent a specific information?
GIOCA
Gestione e Innovazione delle
organizzazioni culturali e
artistiche
This text can be represented with a sequence of approximately
500 “zeros” and “ones”
This logo is an image. Windows tells us that its size is “60005 Bytes”
Since a Byte is a sequence of 8 “zeros” and “ones”, GIOCA’s logo can be
represented with a sequence of 480.040 “zeros” and “ones”
The 5 seconds audio clip associated to the reading of the above text in the Italian language can be represented with a sequence of approximately 25000 “zeros” and “ones”
Examples of information
• Information is an entity representing a choice among
alternative options
“Open”
or
“Closed”
“Turned on”
or
“Turned off”
4 options: N, E, S, W 8 options: N, NE, E, SE, S, SW, W, NW 16 options: N, NNE, NE, ENE, E, ESE, SE, SSE, S, SSW, SW, WSW, W, WNW,NW, NNW
3 options: red, yellow, green
4 options: red, yellow, green,
flashing yellow
SW, W, NW
4 options: red, green, red
Information and messages
• Information is a choice among a set of options
• A message is a collection of information sent from an entity A
to an entity B
• When a message is received, uncertainty decreases. The
amount of information
carried by a message goes with the
Measuring information
• The information measurement unit is called bit
• Definition: “A message specifying a choice between two
options with the same probability carries one bit of
information”
• With reference to the previous “door state” example, if both
situations “door open” and “door closed” may occur with the
same probability, then the message “the door is open”
carries one bit of information
• bit stands for binary digit, (“cifra binaria”); this name was
selected because one bit of information may be represented
with a single binary digit, i.e. a digit that can only take two
values: 0 or 1; so a binary digit, i.e. a “0” or a “1”, represents
one bit of information
Data vs. Information
Information
:
The meaning that a human assigns to
data
by means
of the known conventions used in their
“Codes on the sea”
Binary codes
A binary code is a map, i.e. a correspondence,
between the “symbols” of an alphabet and their
representation with strings of bits
Alphabet
≈
∂
∞
↨
€
Ω
☺
♠
♥
Strings of bits
0101 101 1101 11 1100 00 11111 010 1Binary code
INFORMATION CODING
• Suppose that we want to code a situation, that is the status of a door • The door can be open or closed
• We can map the status of the door onto the values of a single binary variable, for example, according to the following table:
door state x
door open 0
door closed 1
Let’s try, now, to encode the four cardinal points
N E S and W
The table above shows the encoding of the door states (open/closed) with one bit
Definition
a binary variable X is a variable that can only take two values: 0 and 1 ( i.e. it can only be x=0 or x=1)
Example: CODING the four cardinal
points
• We may bind each cardinal point to a configuration of 2 binary
variables x1 e x0, according to the following arbitrary table:
Cardinal
Point Value for (x
1 , x0)
N 00
E 01
S 10
W 11
The table above maps the 4 cardinal points onto the 4 cofigurations of 2 binary variables:
Definition of n bit binary configuration
• An n bit binary configuration is a sequence of n “0” and “1”
• E.g. : 001011 is a 6 bit binary configuration
How many n bit binary configurations exist?
2
n• There are two (i.e. 2
1) configurations of one bit: “0” and
“
1”
• Anytime one bit is added, the amount of configurations
doubles: C
n= 2 * C
n-1• In fact: adding one bit to a generic configuration
X of n-1
bit
,leades to the following two new configurations:
0
X
and
1
X
FUNDAMENTAL INEQUALITY FOR
CODING
As with n bit we can build 2
ndifferent n-bit binary configurations,
then with n bit we can code up to 2
ndifferent items
Therefore it must be:
M ≤ 2
nThe above is called the coding fundamental inequality
Let’s call n
minthe smallest integer that verifies the inequality M ≤ 2
nEx: M = 3 è n
min= 2
M = 6 è n
min= 3
How many bit are required to encode M different items?
The Power of Two
n 2n n 2n n 2n 1 2 11 2048 = (2K) 21 2 4 12 22 3 8 13 8K 23 4 16 14 24 5 15 25 32M 6 16 26 64M 7 128 17 27 8 256 18 256K 28 9 19 512K 29 10 1024 (= 1K) 20 1024K = (1M) 30A redundant code for alphanumeric
characters visualisation
Black & white pixel matrix: for example 8x8
This code is
“redundant” as its size (64 bit) is
larger than the minimum amount of bit required to code alphanumeric characters. Such a minimum may be evaluated applying the “fundamental coding inequality”
Bit map: a 64 bit code
M = 26 (lower case) è nmin = ??
M = 52 (up-lower case) è nmin = ??
Common Information Measurement
Units
• 1 Kilobit = 210 bit= 1024 bit (Kb): just over one thousand (103) bit
• 1 Megabit = 220 bit = 1.048.576 bit (Mb): just over one million
(106) bit
• 1 Gigabit = 230 bit: = 1.073.741.824 bit (Gb): just over one billion
(109) bit
• 1 Terabit = 240 bit: = 1.024 Gb (Tb): just over one thousand of
billion (103 * 109) bit
• 1 Byte = 23 bit = 8 bit
• 1 KiloByte = 210 Byte = 1024 Byte (KB): 1 KB is equivalent to 8
Kb • …
• The speed of data communication links is expressed in bps (bit
per second)
• The size of a memory area is expressed in Byte
Example: codes for the decimal figures
zero
one
two
three
four
five
six
seven
eight
nine
Decimal
figures
0000
0001
0010
0011
0100
0101
0110
0111
1000
1001
BCD
1000000000
0100000000
0010000000
0001000000
0000100000
0000010000
0000001000
0000000100
0000000010
0000000001
1 out of 10
7 segments based coding
g a f b e c dzero
one
two
three
four
five
six
seven
eight
nine
Decimal
figures
1111110
0110000
1101101
1111001
0110011
1011011
0011111
1110000
1111111
1110011
7 segments
abcdefg
Coding example: bar code
Digit L Pattern R Pattern
0 0001101 1110010 1 0011001 1100110 2 0010011 1101100 3 0111101 1000010 4 0100011 1011100 5 0110001 1001110 6 0101111 1010000 7 0111011 1000100 8 0110111 1001000 9 0001011 1110100 3 bit (101) 6 bit (01010)
7 bit
3 bit (101) L Pattern R PatternCoding example: Identification è RFID
Radio Frequency IDentification uses a 96 bit code called Electronic Product Code (EPC)
EPC allow to encode up to 232 x 232 x 232 different
information (products) 232 ~ 4.3 Billion 232 ~ 4.3 Billion 232 ~ 4.3 Billion
Internet Of Things?
http://www.epcglobalinc.org/home http://en.wikipedia.org/wiki/Electronic_Product_Code CHIP + AntennaText encoding: 8 bit ASCII code
Hexadecimal code: it uses 16 figures to represent numbersHexadecimal code to binary code
Decimal Hexadecimal Binary
0 0 0000 1 1 0001 2 2 0010 3 3 0011 4 4 0100 5 5 0101 6 6 0110 7 7 0111 8 8 1000 9 9 1001 10 A 1010 11 B 1011 12 C 1100 13 D 1101 14 E 1110 15 F 1111