0% found this document useful (0 votes)
26 views26 pages

Data Representation & Storage

The document discusses how computers represent different types of data like text, images, sound, and numbers in binary format. It covers the basics of binary, bytes, ASCII, encoding, and how analog data is converted to digital for processing. Key topics are how each character, image pixel, and sound wave is broken down and encoded using strings of 1s and 0s.
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)
26 views26 pages

Data Representation & Storage

The document discusses how computers represent different types of data like text, images, sound, and numbers in binary format. It covers the basics of binary, bytes, ASCII, encoding, and how analog data is converted to digital for processing. Key topics are how each character, image pixel, and sound wave is broken down and encoded using strings of 1s and 0s.
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/ 26

Data Representation & Storage

How computers see the world Representing text


• There are a number of very common needs for a computer, including the need to • When any key on a keyboard is pressed, it needs to be converted into
store and view data. a binary number so that it can be processed by the computer and the
• Computers use electrical signals that are on or off, so they have to see everything typed character can appear on the screen.
as a series of binary numbers.
• This data is represented as a sequence of 1s and 0s (on and off). All data that we
want a computer to process needs to be converted into this binary format.

1 2

Representing images Representing sound


• Images also need to be converted into binary in order for a computer • Sound needs to be converted into binary for computers to be able to
to process them so that they can be seen on our screen. Digital process it. To do this, sound is captured - usually by a microphone -
images are made up of pixels. Each pixel in an image is made up of and then converted into a digital signal.
binary numbers.
• If we say that 1 is black (or on) and 0 is white (or off), then a simple
black and white picture can be created using binary.

3 4
Data Representation & Storage

Units
• A binary digit is known as a bit. A bit is the smallest unit of data a
Analogue data and digital data
computer can use.
Analogue data is a real-life signal that can vary greatly in value.
• Eight bits are known as a byte. A byte is significant in that a single
character can be represented in binary in eight bits - one byte. Examples include:
• sound waves
• Four bits or half a byte is known as a nibble. • pressure
• temperature
• To be able to reference large numbers of 0s and 1s, the binary unit
system is used: • Digital data is binary data which represents analogue data. Computers
work with digital data. Analogue data must be converted to digital before a
computer can use it.
• A device known as an analogue-to-digital convertor (ADC) is used to
generate digital data from analogue signals. In the same way, a digital
signal can be converted back to an analogue signal using a digital-to-
analogue convertor (DAC).

5 6

Data representation Data representation - continued


• All data is represented as binary digits, whether it is numbers, Extended ASCII ASCII code
text, images or sound. Calculations are also done in binary. Extended ASCII uses eight bits, ASCII uses seven bits, giving a
giving a character set of 256
Characters characters (28). This allows for character set of 128 characters (27).
special characters such as those The characters are represented in a
• Computers work in binary. As a result, all characters, whether with accents in languages such as
table, called the ASCII table. The
they are letters, punctuation or digits are stored as binary French and Spanish.
Unicode 128 characters include:
numbers. All of the characters that a computer can use are • 32 control codes (mainly to do with
called a character set. While suitable for representing
English characters, 256 characters is printing)
• Two standard character sets in common use are: far too small to hold every • 32 punctuation codes, symbols,
character in other languages, such and space
• American Standard Code for Information Interchange (ASCII) as Chinese or Arabic. Unicode uses • 26 upper case letters
• Unicode 16 bits, giving a range of over
65,000 characters. This makes it • 26 lower case letters
more suitable for those situations. • numeric digits 0-9
In ASCII, each character has its own assigned number

7 8
Data Representation & Storage

Hexadecimal
• In computer science, different • Hexadecimal is useful because large
number bases are used: numbers can be represented using fewer
digits.
• denary is base 10, which has ten • Additionally, hexadecimal is easier to
units (0-9) understand than binary. Programmers
• binary is base 2 , which has two often use hexadecimal to represent binary
units (0-1) values as they are simpler to write and
check than when using binary.
• hexadecimal, also known as hex, is
the third commonly used number
system. The digits 0, 1, 2, 3, 4, 5, 6, When data is stored or transmitted, its ASCII or Unicode number is used, not the character itself.
For example, the word "Computer" would be represented as:
7, 8 and 9 and the capital letters A, 1000011 1101111 1101101 1110000 1110101 1110100 1100101 1110010
B, C, D, E and F. Question
What would this message say?
1001000 1100101 1101100 1101100 1101111 0100001
Hello!

9 10

Binary and denary What is binary?

• Many ancient cultures developed the counting system that we use • Computers obviously don't have fingers,
but instead use tiny switches called
today, known as the decimal system. transistors that allow electricity to
• It allows us to use ten values and it is likely that this common be on or off in a circuit.
approach was developed because of the fact humans have ten • These circuits are combined to
represent data and the two states
fingers/digits to count with. of on or off are represented as 1 or 0.
• You may have also heard this system referred to as denary or base- • The binary system is known as a
10. ‘base 2’ system. This is because:
• there are only two digits to select
from (1 and 0)
• when using the binary system, data
is converted using the power of two.

11 12
Data Representation & Storage

Understanding denary
To sum up • People use the denary (or decimal) number system in their day-to-
day lives. This system has 10 digits that we can use: 0, 1, 2, 3, 4, 5, 6,
• Combinations of 1s and 0s can be 7, 8 and 9.
used by a computer to represent • The value of each place value is calculated by multiplying by 10 (ie by
any type of information (e.g. the power of 10). The first few place values look like this:
numbers, text, images, sound,
program instructions).

13 14

Base-10 Try it yourself!


The denary system is a method of assigning a place value to numbers.
A place value is the numerical value of a digit that appears within a number. For example, take the • So, the value of the number 124 in denary place values is actually:
number: 189210.
The place value of the digit 1 in the number 189210 is one thousand.

• What is the place value of the digit 4, in the number 1148210?


• In this number, there are:
• 4 hundred
• 1 thousand
Working out: Working from right to left, 4,4 is in the third position.
• 8 hundreds
• 9 tens
• Remember:
• 2 ones • First column is the 1s
• To work out what the place values are, you start from the first column on the right where • Second column is the 10s
the 1 place value is and multiply by 10 as you move from right to left.
• Third column is the 100s

15 16
Data Representation & Storage

Denary and Binary


Base-2
• The denary system is based • The binary system is based
• Binary is a base-2 number system. To understand how a binary value around the number 10 and uses around the number 2 using the
translates to a denary, you need to understand the place values for a the digits from 0 to 9. digits 0 and 1.
base-2 system. • So, instead of using units, tens,
• To work out what the place values are, you use the same process as hundreds, and thousands, in
you did with the denary system and start from the first column on the the binary system we use units,
right where the 1 place value is. But when using base-2, you multiply twos, fours, eights etc.
by 2 each time as you move from right to left.

17 18

Binary to denary
• To convert a binary number to denary, start by writing out the binary
place values. In denary, the place values are 1, 10, 100, 1000, etc –
each place value is 10 times bigger than the last. For example:

• In binary, each place value is 2 times bigger than the last (ie increased
by the power of 2). The first few binary place values look like this: The top row shows the place values - starting at 1 (on the right) each place value is 2 times the
previous (2, 4, 8, 16 etc). The bottom row holds the binary digits (0 or 1).
The table shows the binary number 10100110.
To convert the binary number to denary, we just need to write down the place value of each binary
1 digit, and add them all up. 128 + 32 +4 + 2 equals 166. That is the denary equivalent of binary
10100110.

19 20
Data Representation & Storage

Converting from binary to denary Representation of a Binary Number


• To convert binary to denary, simply take each place value that has a 1, As the decimal number is a weighted number, converting from decimal to binary
and add them together. (base 10 to base 2) will also produce a weighted binary number with the right-hand
most bit being the Least Significant Bit or LSB, and the left-hand most bit being
• For example, the binary number 1111100 in binary place values is: the Most Significant Bit or MSB, and we can represent this as:

21 22

Converting from binary to denary - continued Question 1


• Working out the value of 1010 1000: What would the binary number 111001 be in binary place value?
Answer
1.Extend the table to give the same number of columns as you have digits.
For this question we need 6 places.
2.Place the binary number on the table.
• So, 1010 1000 in binary is equal to 168 in denary.

3.Add the numbers in the binary place value row that have a 1 in the
binary row.

23 24
Data Representation & Storage

Question 2 Question 3
What would the binary number 1001 0011 represent in Denary? What would the binary number 101100101 represent in Denary?
Hint: In a base-2 system, each place value increases by a power of 2. The first place
value is 20 (1), the second is 21 (2), the third is 22 (4), the fourth is 23 (8) and so on.
We could represent 8 bits (one byte) of data using the table below. Answer
Answer

• This binary number represents 128 + 16 + 2 + 1. Or • By adding together ALL the decimal number values from right to left at the
positions that are represented by a “1” gives
27 + 24 + 21 + 20. us: (256) + (64) + (32) + (4) + (1) = 35710 or three hundred and fifty seven as a
• The sum of these values is 147. decimal number.
• Therefore, the 8-bit binary number 1001 0011 represents 147 in denary.

25 26

Question 4 Test Yourself


What would the binary number 00110010 represent in Denary? 1. Convert the binary number 10101010 to its decimal equivalent.
Fill in the third and fourth row in the table and then show your
Answer work below.

Adding up the numbers in the last row (0+0+32+16+0+0+2+0) = 50.


We can show our work as follows. 00110010 = 10101010=(__*2^7)+( __*2^6)+( __*2^5)+( __*2^4)+( __*2^3)+(
__*2^2)+( __*2^1)+( __*2^0) = (__*128)+( __*64)+( __*32)+( __*16)+(
(0*2^7)+(0*2^6)+(1*2^5)+(1*2^4)+(0*2^3)+(0*2^2)+(1*2^1)+(0*2^0) = __*8)+( __*4)+( __*2)+( __*1) = ____ + ____ + ____ + ____ + ____ +
(0*128)+(0*64)+(1*32)+(1*16)+(0*8)+(0*4)+(1*2)+(0*1) = ____ + ____ + ____ = ____
0 + 0 + 32 + 16 + 0 + 0 + 2 + 0 = 50

27 28
Data Representation & Storage

Test Yourself Test Yourself


2. Convert the binary number 01010101 to its decimal equivalent. 3. Convert the binary number 00111011 to its decimal equivalent.
Fill in the second, third and fourth row in the table and then show Fill in each row in the table and then show your work below.
your work below. Notice that you have two additional place values in this number.

01010101 = 00111011=

29 30

Test Yourself-Answers Questions - continued

Answers: • What would these binary


numbers be in denary? Answer
• The base 2 binary number 10101010 is equal to the base 10
decimal number 170. • 1001 •9
• 10101 • 21
• The base 2 binary number 01010101 is equal to the base 10
decimal number 85. • 11001100 • 204

• The base 2 binary number 1100111011 is equal to the base


10 decimal number 827.

31 32
Data Representation & Storage

Example – converting denary number 84 to a binary number


Converting from a denary number to a binary number • First set up the columns of binary place values.
To change from denary into binary follow
the steps: • 64 is the biggest place value that can be subtracted from 84. Place a 1 in the 64 place value column and
subtract 64 from 84, which gives 20.
• Draw a table. (Once the column heading
is bigger than your number you can stop).
• Place a one in the column with
the largest number that can be • 16 is the biggest place value that can be subtracted from 20. Place a 1 in the 16 place value column and
subtracted from your number. subtract 16 from 20, which gives 4.
• Subtract the column number from your
number to see what remains.
• 4 is the biggest place value that can be subtracted from 4. Place a 1 in the 4 place value column and subtract
• Continue subtracting until you reach 0. 4 from 4, which gives 0.
• Example - Express the number 27 in
Result: 84 in denary is 1010100 in
binary. binary.
• 27 can be written as 11011 in binary • Place a 0 in each remaining empty place value column.
To check that this is right, convert the
binary back to denary:
• Check your answer : 16 + 8 + 2 + 1 =27 (0 × 128) + (1 × 64) + (0 × 32) + (1 × 16)
+ (0 × 8) + (1 × 4) + (0 × 2) + (0 × 1) = 84

33 34

Steps - denary number 84 to a binary number


This method of converting denary numbers to binary is to use binary place Express 46 in binary
values.
• The first thing to do is write the place values in their columns.
• Then take your denary number, in this case, 84.
• Find the largest place value number that fits into 84 – in this case 64 – then
subtract.
• Put a one below and take the remaining 20 to the next column.
• 32 doesn’t fit into 20 so put a ‘0’ in that column.
• 16 fits into 20 leaving 4, so there’s another ‘1’ and move again.
• 8 doesn’t fit into 4, but 4 does, so put a ‘0’ and a ‘1’.
• You have nothing left so zeroes go beneath ‘2’ and ‘1’.
• And there’s your binary number

35 36
Data Representation & Storage

Method two - convert denary to binary The binary equivalent of 100 is 1100100.
To convert decimal to binary numbers,
Another method to convert denary to Starting with the least significant bit proceed with the steps given below:
binary is to divide the number by 2 (LSB), mark down the remainders
and mark down the remainder (1 or • 1010011 Step 1: Divide the given decimal number by
0). “2”, where it provides the result along with the
• As there are only seven digits in
Worked example: Denary number 83 this binary number, you can make it remainder.
• 83÷2=41 (remainder 1) into an 8-bit binary number by Step 2: If the given decimal number is even,
'padding' the result with the then the result will be a whole number, and it
• 41÷2=20 (remainder 1) provides the remainder with “0.”
required number of 0s on the left.
• 20÷2=10 (remainder 0) Step 3: If the given decimal number is odd,
• This produces the 8-bit binary then the result is not appropriately divided,
• 10÷2=5 (remainder 0) number 0101 0011, equivalent to and it provides the remainder with “1”.
• 5÷2=2 (remainder 1) 83 in denary (64 + 16 + 2 + 1). Step 4: By placing all the remainders in order
• 2÷2=1 (remainder 0) in such a way, the Least Significant Bit (LSB) at
the top and Most Significant Bit (MSB) at the
• 1÷2=0 (remainder 1) bottom, the required binary number will be
obtained.

37 38

Convert 2 in Binary How to convert 3 in Binary?


Now, let us convert • Step 1: Divide 2 by 2. The integer • Step 1: Divide 3 by 2, then quotient will
the given decimal quotient obtained in this step is used as be 1 and the remainder left will be 1
a dividend for the next step. Continue • Step 2: Divide 1 by 2, then the quotient
number 294 into a this process until we get the quotient
binary number. will be o and the remainder will be 1.
becomes 0.
Therefore, the • Step 3: Take the remainders from
• Step 2: Now, write the remainder in bottom to top in reverse order to get an
binary equivalent reverse chronological order (i.e.) from equivalent binary number,
for the given bottom to top.
decimal number • Hence, 310 = 112
• Hence, the decimal number 2 in binary
29410 is 102

is
1001001102 Dividend Remainder Dividend Remainder
2/2 = 1 0 3/2 = 1 1
29410 =1001001102
1/2 = 0 1 1/2 = 0 1

39 40
Data Representation & Storage

Binary Arithmetic Examples


Binary Addition
When adding binary numbers together, it is very
similar to using the column method in decimal:

Binary addition is (in some ways) even easier, as there are only a few cases
we need to consider:

41 42

Binary addition
• When two numbers are added together Example - adding 01 + 10
in denary, we take the first number, add • 1+0=1
the second number to it, and get an • 0+1=1
answer. For example, 1 + 2 = 3.
• When we add two binary numbers
together the process is different. Result in binary: 11 (which is denary 3)
• There are four rules that need to be Example - adding 01 + 101
followed when adding two binary • 1 + 1 = 0, carry 1
numbers. These are: • 1+0+0=1
• 0+0=0 • 0+1=1
• 1+0=1
• 1 + 1 = 10 (The 1 is carried into the next
column on the left)
• 1 + 1 + 1 = 11 (The 1 is carried into the Result in binary: 110 (which is denary 6)
next column on the left)

43 44
Data Representation & Storage

Example - adding 01010011 + 01110110


Overflow errors

Result in binary: 11001001 (which is • Sometimes, when adding


denary 201). two binary numbers we can end
You can check your answers by up with an extra digit that doesn’t
converting each binary number into fit. This is called an overflow error.
denary and checking your addition. • The effects of an overflow error
• 1+0=1
In this example, 01010011 is 83 in can vary. It might make the
• 1 + 1 = 0, carry 1 denary and 01110110 is 118 in denary.
• 1 + 0 + 1 = 0, carry 1 program crash or it might just
So, 83 + 118 is 201.
• 1+0+0=1 ignore the extra digit on the left
• 1 + 1 = 0, carry 1 and produce an unexpected result.
• 1 + 0 + 1 = 0, carry 1
• 1 + 1 + 1 = 1, carry 1
• 1+0+0=1

45 46

Overflow errors – continued…


Representation of graphics
• Overflow occurs when the result of
a calculation requires more bits
(place values) than are in the • There are two methods for storing images digitally:
available range. • raster
• For example, when using eight bits, • vector
the largest number that can be
recorded is 11111111 (denary 255). Raster images - A bitmap image is a type of raster file.
When adding together two eight-bit • The result is actually 10000000
numbers, a situation may occur (denary 256), which requires nine bits.
when the result requires more than However, as only eight bits are
available to hold the number, the
eight bits to hold it. result would be 00000000 (denary 0).
• For example, adding the binary • As you can see, overflow can have
numbers 11111110 (denary 254) serious consequences for the validity
and 00000010 (denary 2) would of calculations.
give:

47 48
Data Representation & Storage

Representation of images Pixels

• All data on a computer system is • A bitmapped graphic (also called a • A pixel represents the smallest
represented using binary patterns, bitmap image) is made up of a grid element of a bitmapped graphic: a
which are sequences of 1s and 0s. of pixels. single colour. As all data in a
• In order to represent an image, • A pixel (short for ‘picture element’) computer is stored in 1s and 0s,
one method is to store it as if it is the smallest element in an each colour needs to have a binary
were a grid of coloured squares, image. code assigned to it.
with each colour represented by a • If you magnify an image, you will • For example, the black-and-grey
unique binary pattern. see that it is made up of these tiny image shown in Figure 1 can be
• The image dimensions and the elements. represented by using just one bit
number of colours used are factors per pixel, by assigning a 0 to each
that affect the size of the image black pixel and a 1 to each grey
file. pixel.
Figure 1: A one-bit black and grey picture

49 50

Colour Depth Image with more than 2 colours

• Bitmap images that require only • Figure 2: One-bit images can be • If an image needs more than two
two colours can be represented used for more than just black colours, you will need more bits
by using just one bit per pixel. and white per pixel.
• The image (Figure 2) uses two • For example, with 2 bits, you can
colours and has been created by have 2 × 2 = 4 different bit
assigning a 0 to each orange patterns, and so you can
pixel and a 1 to each pink pixel. represent four different colours.
• As you can see in the table each
bit-pattern is assigned a colour.

51 52
Data Representation & Storage

Calculating the number of colours available from the


A 3-bit image with 8 colours number of bits used
• Using 3 bits will allow for more • Figure 3: A 3-bit image with 8 Rather than writing:
colours because there are more colours • 2 × 2 × 2 = 8 colours
binary patterns available for the • You can use a power:
colour: 2 × 2 × 2 = 8 colours as
shown in the image Figure 3: • 23 = 8 colours

The most common normal color


depths you'll see are 8-bit (256
colors), 16-bit (65,536 colors), and
24-bit (16.7 million colors) modes.
True color (or 24-bit color) is the
most frequently used mode

53 54

Image resolution Calculating bitmap file size

• Image resolution refers to the • Note that the term 'image • The number of bits used per pixel is called • When an image has a width of 8 pixels
clarity of an image as it appears on resolution' is sometimes used to the colour depth. The greater the colour depth, and a height of 8 pixels, with a colour
a screen or on paper. describe the size of a bitmapped the more colours are available for an image. depth of 4 bits, the calculation is:

• When you zoom in to a bitmap graphic in pixels. • The image resolution is the size of a bitmapped • Calculate total bits: 8 × 8 × 4 = 256 bits
graphic in pixels. It is calculated by multiplying
image, the pixels are stretched into • The size in pixels is calculated by Example
the width (in pixels) by the height (in pixels) of
larger blocks. That’s why bitmap multiplying the width (in pixels) by an image. • What is the file size of a bitmapped
images appear in poor quality the height (in pixels) of the image. • To find the size of an image file, you multiply
graphic that is 6 × 4 pixels and has a
when you enlarge them too much. the resolution of the image by the colour
colour depth of 2 bits?

• Image resolution can be expressed depth: image file size (in bits) = width (in Give your answer in bits.
pixels) × height (in pixels) × colour depth
as the number of pixels that an • Calculate total bits: 6 × 4 × 2 = 48 bits
image contains per inch (e.g. 300 • This means that the size of an image file will
ppi (pixels per inch)). increase if either the colour depth or the image
resolution increases.

55 56
Data Representation & Storage

Units of data storage Difference between the two units of data storage system

• Historically, storage capacity was expressed using the metric The differences between the two systems are shown below, pay close
attention to the Notation:
prefixes of kilo (1,000), mega (1,000,000), etc.
• Since 1998 there has been a move towards using the special
prefixes developed to more accurately represent binary values
(as per the International System of Units (SI) definition).
• For example, a kibibyte is equal to 1,024 bytes, whereas a
kilobyte is equal to 1,000 bytes.

57 58

Worked Examples Worked Example

When an image has a width of 240 When an image has a width of 1920 • What is the file size of a Working out:
pixels and a height of 300 pixels, with pixels and a height of 1080 pixels,
a colour depth of 4 bits, the with a colour depth of 24 bits, the bitmapped graphic that is 800 × • Calculate total bits: 800 × 800
calculation is: calculation is: 800 pixels and has a colour × 4 = 2,560,000 bits
1.Calculate total bits: 240 × 300 × 4 1.Calculate total bits: 1080 × 1920 × depth of 4 bits?
= 288,000 bits 24 = 49,766,400 bits Give your answer in kB. Assume • Convert bits to bytes:
2.Convert bits to bytes: 288,000 / 8 = 2.Convert bits to bytes: 49,766,400 / that 1kB = 1000 bytes. 2,560,000 / 8 = 320,000 bytes
36,000 bytes 8 = 6,220,800 bytes
• Convert bytes to kilobytes:
3.Convert bytes to kilobytes: 36,000 3.Convert bytes to kilobytes:
/ 1000 = 36kB 6,220,800 / 1000 = 6,220.8kB 320,000 / 1000 = 320kB
4.Convert kilobytes to megabytes:
6,220.8 / 1000 = 6.2208MB

59 60
Data Representation & Storage

File Size Example


• FILE SIZE is calculated by multiplying the surface area of a document (height x • A 500dpi image that measures 7 inches by 6 inches with the availability of 65,536
width) to be scanned by the bit depth and the dpi2. Because image file size is colours would result in the following calculation:
represented in bytes, which are made up of 8 bits, divide this figure by 8. 1.7 x 6 x 500 x 500 x 16 = 168,000,000 bits
2.168000000/8 = 21,000,000 bytes
Formula 1 for File Size 3.21000000/1024 = 20507.8125 Kilobytes
• File Size = (height x width x bit depth x dpi2) / 8 4.20507.8125/1024 = 20.03 Megabytes
• If the pixel dimensions are given, multiply them by each other and the bit depth • The DPI figure is used twice because it refers to the width and height of a single
to determine the number of bits in an image file. For instance, if a 24-bit image is square inch.
captured with a digital camera with pixel dimensions of 2,048 x 3,072, then the
file size equals (2048 x 3072 x 24)/8, or 18,874,368 bytes. • The bit depth relates to the number of colours available.
• The 65,536 colours required need a bit depth of 16 bits.
Formula 2 for File Size • If the scenario stated 256 colours the bit depth would be 8, had it stated
• File Size = (pixel dimensions x bit depth) / 8 16,777,216 then the bit depth would have been 24.

61 62

Effects of changing resolution and colour depth


• The image Figure 4 shows a 24-bit • Figure 4: Which half has the poorest
image on the left compared to an 8-bit quality?
image on the right.
• Which image has the poorest quality?
• The image with the 8-bit colour
depth only has 256 different colours
represented compared to the 24-bit
image, which has 16.7 million colours
represented.
• This results in the 8-bit image being
poorer quality because humans see
more than 256 different colours.

63 64
Data Representation & Storage

Effects of changing resolution and colour depth - continued Metadata


The file size of an image depends on the the colour depth of the image. In Figure 5,
you can see how much the file size increases when the colour depth is increased. • The actual file size of a bitmapped graphic is always greater than the
result of its simple file size calculation. This is because, in addition to
the pixel data, the file must store additional information so that the
image can be reproduced accurately. This additional data is
called metadata, which means data about data. Examples of
metadata include:
• Image dimensions (e.g. width in pixels, height in pixels)
• File format
• Date and time of creation
• Geographical location of creation
• Details about the device used to create the image
• Camera settings
Figure 5: You can convert any image to use different colour depths, saving you storage space

65 66

Screen or display resolution


• A 1080p resolution means the image has 1920 pixels horizontally by
Screen or display resolution
1080 vertically (1920x1080). You can find the total pixels in the image
by multiplying those two numbers (the height and width) together, • Image resolution should not be confused with screen or display resolution,
meaning a 1080p image has more than 2 million pixels. Full HD is just which refers to the number of pixels that a screen is set to display.
another term for 1080p or 1920x1080, and those are all ways of • Screen resolution is also expressed by specifying the width of the screen in
referring to the same resolution. pixels by the height of the screen in pixels (eg 1,920×1,080).
• Screens that have a large number of pixels (1,280×720 and above) are
• By contrast, 4K has a resolution of 3840x2160. That’s a lot more pixels considered 'high definition' as they can show images and video with
in the overall image — totaling over 8 million pixels. As always, the enhanced clarity.
higher the resolution, the sharper the picture will be. • If you try to view an image with a low resolution (eg 300, ×, 240 /
• However, you should know that if you watch a video recorded in Full 300×240 pixels) in full-screen mode on a screen with a higher resolution
HD on a 4K monitor, the image will not improve in quality. It will (eg 1,280×720 pixels), the computer will need to rescale the image to fit
the screen, and that will cause the image to look pixelated.
always be limited by the original recording resolution.

67 68
Data Representation & Storage

File Formats Vectors graphics


• A vector image, rather than using blocks of colour to produce an image, uses
mathematical calculations. Shapes such as straight lines and curves become
Common file formats of bitmapped graphics are: scalable, without reducing quality.
• Bitmap – file extension is .bmp • As you zoom in or enlarge the shape, lines remain crisp. Vectors are not used for
photographs, but line drawings or fonts.
• PNG (Portable Network Graphic) – file extension is .png • A common file format for vector graphics is SVG (Scalable Vector Graphics),
which is used to define vector graphics for the web. All popular web browsers
• JPEG (Joint Photographic Experts Group) – file extension is support the rendering of SVG images.
.jpg or .jpeg • A vector is more efficient than a bitmap at storing large areas of the same colour
because it does not need to store every pixel as a bitmap does. Because vector-
• GIF (Graphics Interchange Format) – file extension is .gif based images are not made up of a specific number of pixels, they can be scaled
to a larger or smaller size and not lose any image quality.
• TIFF (The Tag Image File Format ) – file extension is .tiff
• Vector graphics are used in Computer Aided Design (CAD), desktop publishing
and the fonts on your computer.

69 70

Bitmap vs Vector Comparison Table


1. Bitmap images comprise individual pixels, while vector images are created using
mathematical formulas to define shapes and paths.
2. Bitmap images lose quality when scaled up or down, while vector images can be
resized without any loss of quality or resolution.
3. Bitmap images are ideal for complex, detailed images like photographs, while
vector images are suitable for simple graphics, logos, and illustrations.
4. Vector graphics are produced by combining a limited number of shapes,
therefore the variety of images that they can represent is restricted. This is why
they are mostly used to produce illustrations, cartoons, logos, web designs, etc.
On the other hand, bitmapped graphics can depict almost any level of
complexity and detail. Photographs are always stored as bitmaps.
5. Bitmap images are larger than vector images. This can slow down the reading
and rendering process considerably.

71 72
Data Representation & Storage

Representing sound

• Computers work in binary. All data must be converted into binary in order
for a computer to process it. Sound is no exception. To do this, sound is
captured - usually by a microphone - and then converted into a digital
signal.
• Sound is the continual vibration of air particles and is an analogue signal.
Therefore, we need to convert sound into binary to be able to process and
store it using a computer.
• A sound card translates between the outside world's analogue information
and a computer's digital information.
• It uses an analogue to digital convertor (ADC) to change sound into a digital
format the computer can understand, and a digital to analogue convertor
(DAC) to change digital information into sound that you can hear.

73 74

75 76
Data Representation & Storage

Just as with images, the higher the bit depth, the more accurately a sound can be recorded, but the larger the file
size.
How many possible values would an 8-bit audio sample have responses?
The maximum value that could be represented by an 8 bit number is 255, so the range would be 0—255 (256
values).
Typical bit depths are 16 bit and 24 bit.

77 78

Converting the Sample to Binary Sample rate


• The samples can then be converted to binary. They will be recorded to the nearest whole • Sample rate is the number of samples recorded in any given period of time. The higher the
number. sample rate the closer the recorded signal is to the original. Sample rate is measured
in hertz (Hz).
• If the sample rate is doubled - twice as many samples in the same time period - the
resulting representation would be closer:
• If the time samples are then plotted back onto the same graph, it can be seen that the sound
wave now looks different. This is because sampling does not take into account what the sound However, the higher the
wave is doing in between each time sample. sample rate, the larger the
This means that the sound loses quality as resulting file. As a result,
data has been lost between the time samples. sound files are often a
The way to increase the quality and store the compromise between
sound at a quality closer to the original, is to quality and size of file. An
have more time samples that are closer audio file is usually
recorded at 44.1 kilohertz
together. This way, more detail about the
(kHz). This is high enough
sound can be collected, so when it’s for good sound quality
converted to digital and back to analogue while keeping file size
again it does not lose as much quality. down to sensible levels.

79 80
Data Representation & Storage

Bit depth and Bit rate A visual sound waveform


• Sound travels in the form of a wave:
• Bit depth refers to the number of bits used to record each sample. As is
the case with images, the higher the bit depth, the more accurately a
sound can be recorded, but the larger the file size. Typical bit depths are
16 bit and 24 bit.
• Bit rate in the context of sound is simply a measure of how much data is
processed for each second of sound. Bit rate is calculated by:
• Sample rate × bit depth
• As with sample rate, the higher the bit rate, the better the quality of the recorded
sound. • All sound waves have 2 components – volume and pitch.
Volume ( amplitude)
When we shout louder, what we are really doing in increasing the amplitude of the wave that is produced.
Pitch (Frequency)
When we talk in a high pitch voice, what we are really doing is vibrating our vocal chords more rapidly, causing the
frequency of the waves to increase.

81 82

Amplitude controls how loud the sound is and the Wave traces
frequency controls the pitch. Example: • To record or analyse a sound, scientists and musicians use a microphone to turn the sound into an
electrical signal.
• The electrical signal can then be displayed on a device called an oscilloscope and it produces a
graph called a wave trace.

83 84
Data Representation & Storage

Mono and Stereo


• Mono or Monophonic sound only uses one channel when converting a signal into
a sound. Even if there are multiple speakers, the same signal will go to both
speakers. This then gives the effect that the sounds, even if they are coming from
separate speakers, are coming from one single position or source.
• Stereophonic (stereo) audio comes from multiple sources, which present the
image of a 'left' and 'right' in the audio feed. stereo uses two different channels,
one for each speaker.

85 86

87 88
Data Representation & Storage

89 90

Lossy compression
Compression • With lossy compression, some data is removed and Note: An audio file can be compressed by reducing
discarded, thereby reducing the overall amount of the bit depth of the samples.
data and the size of the file. Another technique discards very quiet sounds that a
• Modern computer processing often generates files of very large sizes. • An image can be compressed by reducing its colour
listener is unlikely to notice, especially in a louder part of
a song. This approach reduces the size of the audio file
For example, audio files often run to megabytes (MB), while high- depth. This reduces the range of colours that the while retaining as much audio quality as possible.
definition video can be gigabytes (GB) in size. Such files require lots of image contains. In practice, this results in an
averaging of shades of colours. For example, a very
storage space, and, because of their size, are difficult to transmit. light shade of green could be averaged with a not
These problems can be overcome by using compression. so light shade - the very light shade might be
discarded, and the pixels affected by it re-coloured
• There are two types of compression that can be applied to files: with the darker shade.
• lossy compression Various lossy standards exist:
• lossless compression • the JPEG file format works on this principle, which
is why JPEG files tend to be smaller in size
• the MPEG file format compresses audio and video,
making it more suitable for streaming media
• MP3 is a lossy format for audio, including music

91 92
Data Representation & Storage

Lossless compression
• There are some files that • With lossless compression, files are
programmers do not want to lose reduced in size without the loss of
data from. For example: data. However, lossless compression
does not usually achieve the same file
• text files size reduction as lossy compression.
• spreadsheets Various lossless standards exist, eg:
• financial records • PDF allows lossless compression of
• emails text documents
• GIF is a lossless image file format

93 94

Run length encoding (RLE)

• One method of lossless • The data for this is


compression is run length encoding 00 00 00 11 11 11 11 00 00 00, which
(RLE). is ten data values of two characters
• RLE looks at the data in a file for each, giving 20 characters in total.
consecutive runs of the same data. RLE looks for the runs of each data,
These runs are stored as one item and records what the data is and
of data, instead of many. how many times in succession it
• Consider this row in a bitmap occurs. These values are stored
image: instead of the original data.
For example:
• 00000011111111000000 - 20
characters - becomes
• 608160 - 6 characters

95 96
Data Representation & Storage

Storage
• Computer users need to be able to store programs and data when the power is
Common types of secondary storage
switched off. Secondary storage is used to hold data and programs on physical
devices when the computer is not in use. • Secondary storage devices are generally separated into three types:
Secondary storage • magnetic storage devices, such as hard disk drives
• Computers use primary memory such as random access
memory (RAM) and cache(A piece of temporary memory) to hold data that is • optical storage devices, such as CD, DVD and Blu-ray discs
being processed. However, this type of memory is volatile, which means it loses
its contents when the computer is switched off. • solid state storage devices, such as solid state drives and USB
• Secondary storage is non-volatile, long-term storage. It is used to keep programs memory sticks
and data indefinitely. Without secondary storage all programs and data would be
lost the moment the computer is switched off.
• There are many forms of secondary storage, and each type of secondary storage
device has its own characteristics. Because all devices are different, some are
more suited to certain applications than others.
Note: Not all computers require secondary storage. Embedded computers, such as
those found in a digital watch or central heating system, do not need to store data
when the power is turned off. The instructions needed to run them are stored
in ROM and any user data is held in RAM.

97 98

• Optical media also come in different


Magnetic devices Optical devices types:
• ROM media have data pre-written
• Magnetic devices such as hard disk drives use magnetic • Optical devices use a laser to on them. The data cannot be
overwritten. Music, films, software
fields to magnetise tiny individual sections of a metal scan the surface of a spinning and games are often distributed this
spinning disk. disc made from metal and way.
• R media are blank. An optical device
• Each tiny section represents one bit. A magnetised section plastic. The disc surface is writes data to them by shining a
represents a binary '1' and a demagnetised section divided into tracks, with each laser onto the disc. The laser burns
pits to represent '0's. The media can
represents a binary '0’. track containing many flat only be written to once, but read
areas and hollows. many times. Copies of data are
• As the disk is spinning, a read/write head moves across its often made using these media.
surface. To write data, the head magnetises or demagnetises • The flat areas are known as • RW works in a similar way to R,
except that the disc can be written
a section of the disk that is spinning under it. To read data, lands and the hollows as pits. to more than once.
the head makes a note of whether the section is magnetised
or not.
99 100
Data Representation & Storage

Suitable devices and storage media for a


Solid state devices
given application
• Solid state devices use non-volatile random access memory (RAM) to • The choice of secondary storage medium depends on the use it is required
store data indefinitely. They tend to have much faster access times for. When deciding on the type of device needed, a user should consider:
than other types of device and, because they have no moving parts, • Cost - what is the cost per gigabyte (GB)?
are more durable.
• Since this type of memory is expensive, solid state devices tend to be • Capacity - how much data can the medium hold?
smaller in capacity than other types. For example, a solid-state drive • Speed of access - how quickly can data be transferred to and from the
that holds 256 GB might be of a similar cost to a hard disk with medium?
several terabytes capacity. • Portability - how portable is the medium? Does it need to be portable?
• Solid state devices require little power, making them ideal for • Durability - how robust is the medium, and how robust will it need to be?
portable devices where battery life is a big consideration. They are
also portable due to their small size and durability. • Reliability - how resilient and long-lasting is the medium?

101 102

Difference between a storage medium and a storage device


Cloud storage
• The device that actually holds the data is known as
the storage medium (‘media’ is the plural).
The device that saves data onto the storage medium,
• Storing data at a remote location online is known as cloud storage. or reads data from it, is known as the storage device.
When files and data are sent to the cloud, they are actually being sent • Sometimes the storage medium is
to a server (or servers) connected to the internet. a fixed (permanent) part of the storage device, e.g.
the magnetic coated discs built into a hard drive.
• Services such as Dropbox, Google Drive, Amazon Drive, OneDrive, Box • Sometimes the storage medium is removable from
and iCloud are examples of cloud storage. Files can be uploaded to a the device, e.g. a CD-ROM can be taken out of a CD
drive.
folder system and downloaded as required.
• What is a USB medium?
• In cloud storage users pay for what they use. They need to pay for the The term USB flash drive refers to the device in its
storage and the facilities that the cloud company have in place to entirety, including the USB connector, whereas the
storage medium is the internal flash chip.
maintain and manage the service.

103 104

You might also like