Nothing Special   »   [go: up one dir, main page]

Analogue Data, Compression and Encryption

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 30

GCSE COMPUTER SCIENCE

Data
Analogue Data, Compression and Encryption
Storage Units
In order to be able to calculate the file sizes of different types of file
you need to be able to convert between the different storage units.

bit (b)
byte (B) x8
kilobyte (KB) x 1024
megabyte (MB) x 1024
gigabyte (GB) x 1024
terabyte (TB) x 1024
Activity 1
Use a calculator to calculate the number of bytes.

Number of bytes

1024
1 kilobyte (KB) = 1024 bytes

1 megabyte (MB) = 1024 kilobytes 1048576

1 gigabyte (GB) = 1024 megabytes 1073741824

1 terabyte(TB) = 1024 gigabytes 1.099511628x10 (squared)


Analogue Data
Analogue data is continuous, allowing for an infinite number of possible
values. Digital data is discrete, it has a limited set of values.

To be handled by a computer, analogue data has to be converted to digital (or


digitised).
Sound
The process of digitising sound is known as sampling. Sampling an analogue
sound wave involves taking samples at evenly spaced time intervals and
representing the samples as numerical values.

The quality of the sound depends on the sampling rate, which is the number
of samples taken per second (measured in Hz) and the bit depth (the number
of bits used to store each sample).
Calculating File Size

You can calculate the file size of a sound using the following formula:

Sampling Rate (in Hz)


x
bit depth (in bits)
x
channels
x
duration in seconds
Calculating Bit Depth

You can calculate the bit depth of a sound using the following formula:

File Size (in bits)


/
Sampling Rate (in Hz) x channels x time (in seconds)
Activity 2
Question Answer

Describe the process of


converting analogue
sound waves into digital
data.
What is the difference
between analogue and
digital data?

What is meant by the


term ‘sampling rate’?

What is meant by the


term ‘bit depth’?
Activity 3
Use internet research to help you complete this table:

Question Answer

What is the sampling rate


for CD audio? Give your 44.1 kHz
answer in kHz.

In the context of digital


sound, what is meant by Audio quality
the term ‘bit depth’?

How many bits per


sample are used for CD 16
audio?

What about DVD audio?


Activity 4
Use internet research to help you complete this table:

Question Answer

Is a high frequency sound


High pitched
high or low pitched?

What is the highest


frequency the human ear 20 kHz
can detect?

Why do most sound


recordings have two
channels?
Activity 5
Question Answer

Calculate the file size of a CD quality,


stereo sound track that is 2.5 minutes
long. 13.2mb
Give your answer in megabytes to 1
decimal place.

Calculate the bit depth of a 10.3 MB, 3


minute, stereo sound track, with a
sampling rate of
1350041.6
30 kHz.

An analogue-to-digital converter
samples the temperature of a furnace
every two hours. Each sample is stored
as a 32-bit number. How many bytes of
data are stored in a week?
Compression

Compression is the process of reducing the size of a file. It allows us to


reduce the amount of storage space we use and to speed up the transfer of
files over networks. There are three types of compression:

Lossless Reduces the size of a file while retaining all the original
data.
Lossy Reduces the size of a file by permanently removing some
of the data.
Superchannel A form of compression where special data is selected for a
special reason. These data are separated from the rest, and
the rest are thrown out.
Activity 6
Describe the three strategies for compressing data in your own words:

Lossless compression is where the file is shrinked, but without losing data.

Lossless

This form of compression permanently removes some data.

Lossy

This method singles out a specific set of data, which is kept and any remaining data is
deleted.
Superchannel
Pros and Cons
Play this game to help you understand the pros and cons of each type of
compression.
Activity 7
Discuss the pros and cons of each method of compressing data.

Pro: No data is lost.


Con: Not the smallest form of compression.
Lossless

Pro: Good form of compression, smaller than lossless.


Con: Data is lost.
Lossy

Pro: Smallest form of compression


Con: Most of the data is lost.
Superchannel
Practical Activity
You are going to compress three different text files to see what happens. Save
these files to your area.

Right click on each of the files in the folder, click on Send to / Compressed
(zipped) folder.
Activity 8
Fill in this table to help you see what a difference compression makes to file size.

File A File B File C


How many characters does the file
contain?

What type of content does the file contain?

What is its file size before compression?

What is its file size after compression?

What is its compression ratio


(decompressed size/compressed file size)?

Which file compresses the most? Explain why.

file no longer exists on Dropbox.


Run Length Encoding
Activity 9
Question Answer

RLE compression works by replacing sequences of the same


Describe how the RLE data values within a file by a count number and a single value.
compression algorithm For example,
works. ABBBBBBBBBCDEEEEF (17 Bytes)
Using RLE: A *8B C D *4E F (10 bytes)
Activity 10
In the table below, the image is encoded in binary. The first binary pair represents a colour (00 = blue, 01 = white, 10
= yellow, 11 = green) and the second binary number represents the run length of the colour. So, for example, 00,
1101 represents blue, 13 pixels. Shade the squares (pixels) in the table to recreate the image.

00 0110 10 0010 00 0100 10 0001 00 0001

00 0101 10 0010 00 0100 10 0010 00 0001

00 0101 11 0011 00 0011 10 0010 00 0001

00 0011 11 0110 00 0001 10 0011 00 0001

00 0010 11 0010 01 0001 11 0101 10 0011 00 0001

00 0001 11 1001 10 0011 00 0001

00 0010 11 1000 10 0011 00 0001

00 0011 11 0110 00 0001 10 0011 00 0001

00 0101 11 0011 00 0011 10 0010 00 0001

00 0101 10 0010 00 0100 10 0010 00 0001

00 0110 10 0010 00 0100 10 0001 00 0001


Activity 11
Use the Run Length Encoding Calculator to encode these text strings.

Text string Answer

AAAABBBBBBBBBCADDDDEEFFFFFFFF 4A9BCA4D2E8F
ABCABCABCABCABCABCABCABCABCS ABCABCABCABCABCABCABCABCABCS

BBGGYYAACCFFEEBBGGYYAACCFFEE 2B2G2Y2A2C2F2E2B2G2Y2A2C2F2E

Which one compresses the most? AAAABBBBBBBBBCADDDDEEFFFFFFFF

Why is this?
It has more repetitive strings.
Describe in English the process the RLE
calculator follows to encode a piece of text.
Activity 12
Answer the questions below based on this text:

The wheels on the bus go round and round, round and round, round and round.
The wheels on the bus go round and round all day long.

How many characters, including 131


spaces and punctuation marks,
are there in this song?

Assuming one byte is used to 131 B


represent each character, what is
its file size?
Activity 13
Complete this table:

Word Number of times used Number of bytes in word

The 2 3

wheels 2 6

on 2 2

the 2 3

bus 3

go 2

round 9

and 4

all 1

day 1

long 1
Activity 14
Complete this lookup table of all the words used more than once in the song.

Lookup table

0 The

1 wheels

2 on

3 the

4 and

5 round

6 bus

7 go
Activity 15
Use the lookup table you have completed to encode the song, replacing repeated words with the number representing
their position in the table.
Encryption
Encryption allows data to be kept secret and secure so no one else can make
use of it.

A key is used to encrypt plain text into meaningless cipher text, the same key
is used to decrypt the data back into its original form. Only someone who
knows the key can decrypt the cipher. If you don’t have the key you need to
crack the code.
Activity 16
Decrypt this message:

Message Decrypted Message

KH WUHDVXUH LV KLGGHQ
XQGHU WKH SDOP WUHH EH TUEDVXUE LV KLGGEQ XQGEU TKE SDOP TUEE
Hint: H = E and W = T
Caesar Cipher
Activity 17
Question Answer

Explain how the Caesar


cipher works.
Activity 18
Use this Caesar cipher wheel to decode and encode these messages.

Plain text Shift Encrypted text

THE ENIGMA MACHINE WAS INVENTED BY THE +3


GERMANS

COLOSSUS WAS THE WORLD’S FIRST DIGITAL +4


COMPUTER

+5 YMJ HFJXFW HNUMJW NX FS


JCFRUQJ TK WTRFS NSLJSZNYD

-3 QEB HBV FP EFAABK RKABO QEB


CILTBO MLQ

You might also like