Top Banner
Data storage
30

Data storage - lsrsssgroup.files.wordpress.com · Data Storage •Data stored on a computer can be of different types: •Text and numbers •Sound (music/ speech) •Pictures •Video

Jul 18, 2020

Download

Documents

dariahiddleston
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Data storage - lsrsssgroup.files.wordpress.com · Data Storage •Data stored on a computer can be of different types: •Text and numbers •Sound (music/ speech) •Pictures •Video

Data storage

Page 2: Data storage - lsrsssgroup.files.wordpress.com · Data Storage •Data stored on a computer can be of different types: •Text and numbers •Sound (music/ speech) •Pictures •Video

Data StorageDiscussion

• Data used and processed by a computer system is stored as electronic files

•Data can take many forms

• Saving student name, age marks … (characters , numbers ......)

• Saving a photo taken by a digital camera (picture)

• Record and save speech/music (sound)

• Recording a video (video)

• All the above will be saved as electronic files BUT each will be in a

different format.

2

Page 3: Data storage - lsrsssgroup.files.wordpress.com · Data Storage •Data stored on a computer can be of different types: •Text and numbers •Sound (music/ speech) •Pictures •Video

Data Storage

•Data stored on a computer can be of different types:

•Text and numbers

•Sound (music/ speech)

•Pictures

•Video

•Each type of data will be stored in a different way.

3

Page 4: Data storage - lsrsssgroup.files.wordpress.com · Data Storage •Data stored on a computer can be of different types: •Text and numbers •Sound (music/ speech) •Pictures •Video

Data Compression

•Compression means storing data in a format

that requires less space than usual

•Compression reduces the size of a file

•In order to be used again, a compressed file

must be uncompressed .

4

Page 5: Data storage - lsrsssgroup.files.wordpress.com · Data Storage •Data stored on a computer can be of different types: •Text and numbers •Sound (music/ speech) •Pictures •Video

Compression Benefits

Compression reduces file size therefore:

1. Storage benefit▪ Files can be stored using less disk space i.e.

▪ Less money spent on buying disks

2. Transmission benefit

▪ File is sent faster via a network (internet) i.e.

▪Takes less time to download/upload a file▪ Less money spent on internet fees.

5

Page 6: Data storage - lsrsssgroup.files.wordpress.com · Data Storage •Data stored on a computer can be of different types: •Text and numbers •Sound (music/ speech) •Pictures •Video

Compression Techniques

•Two compression techniques:

1. Lossless compression

2. Lossy compression

6

Page 7: Data storage - lsrsssgroup.files.wordpress.com · Data Storage •Data stored on a computer can be of different types: •Text and numbers •Sound (music/ speech) •Pictures •Video

Lossless compression

•The file is reduced in size for transmission and

storage BUT without losing any information

•it can be put back together again (uncompressed)

to produce a file identical to the original

•E.g. compressing text files. (Files that contain only

characters)

7

Page 8: Data storage - lsrsssgroup.files.wordpress.com · Data Storage •Data stored on a computer can be of different types: •Text and numbers •Sound (music/ speech) •Pictures •Video

Lossy compression

• Reduces a file by permanently eliminating certain information

• Difference is usually not noticeable to human eye or ear

• When decompressed, some detail is lost and the file is not exactly

like the original

• Used for pictures(JPEG), video (MP4) and sound (MP3), where a

certain amount of information loss will not be detected by most

users.

8

Page 9: Data storage - lsrsssgroup.files.wordpress.com · Data Storage •Data stored on a computer can be of different types: •Text and numbers •Sound (music/ speech) •Pictures •Video

Text and numbers

By text we mean any alphanumeric characters i.e. a combination of:

• A-Z , a-z, 0-9 , punctuation marks , symbols

• Any character present on a keyboard

• Every character is represented by a unique numeric value called the ASCII code

• ASCII code is usually in binary

• 1 character is represented by 1 byte (00000000 - 11111111 )

• Can also be written in equivalent decimal (0 to 128) or HEX (0 to 7F)

• "A" is 0100 0001," B" is 0100 0010, and so forth.

9

Page 10: Data storage - lsrsssgroup.files.wordpress.com · Data Storage •Data stored on a computer can be of different types: •Text and numbers •Sound (music/ speech) •Pictures •Video

ASCII code10

ASCII code defines a unique binary number between 0000000 and 1111111 for all the characters found on a standard keyboard

Page 11: Data storage - lsrsssgroup.files.wordpress.com · Data Storage •Data stored on a computer can be of different types: •Text and numbers •Sound (music/ speech) •Pictures •Video

Text files

•A Text file is stored in ASCII format

•ASCII format uses 1 byte per character

•Any text file can be converted to a string of 0's and 1‘

•and hence easily understood by the computer

•Binary ASCII code can be converted to DEN or HEX to

make it easier to read for humans.

11

Page 12: Data storage - lsrsssgroup.files.wordpress.com · Data Storage •Data stored on a computer can be of different types: •Text and numbers •Sound (music/ speech) •Pictures •Video

Text file Compression

•A Text file may be compressed

•BUT we need to get the exact original after uncompressing

•Which type of compression is appropriate?

•WHY?

• loss of any data would be disastrous e.g. a spreadsheet file

storing student marks

•Read textbook page 80

12

Page 13: Data storage - lsrsssgroup.files.wordpress.com · Data Storage •Data stored on a computer can be of different types: •Text and numbers •Sound (music/ speech) •Pictures •Video

Picture files•Pictures/images/photos are made up of pixels

•A pixel is a single dot in a graphic image

•Number of pixels = resolution

•Higher resolution = More pixels = higher quality picture

•Resolution measured as =

• (number of pixels per row) X (number of rows)

•An image having 1024 pixels per row with 768 rows has a resolution of 1024x768 = 786 432 Pixels

• The file size of a picture depends on the number of pixels

13

Page 14: Data storage - lsrsssgroup.files.wordpress.com · Data Storage •Data stored on a computer can be of different types: •Text and numbers •Sound (music/ speech) •Pictures •Video

Picture file compression•The format in which a picture is saved tells us

▪If the picture was compressed or not

▪ And if compressed then which compression technique was used?

▪ Lossy or lossless?

•Several picture file formats exist

•Uncompressed formats: BMP, TIFF

• Lossless Compressed formats: PNG , GIF

• Lossy compressed format :JPEG

14

Page 15: Data storage - lsrsssgroup.files.wordpress.com · Data Storage •Data stored on a computer can be of different types: •Text and numbers •Sound (music/ speech) •Pictures •Video

JPEG format• JPEG is the most common format for pictures

• JPEG = Joint Photographic Experts Group

• JPEG is a file compression format designed to make photo files

smaller in size for storage and for transmission

• JPEG is an example of lossy file compression

• i.e. once the image is compressed, a new file is formed

and the original file can no longer be rebuilt

15

Page 16: Data storage - lsrsssgroup.files.wordpress.com · Data Storage •Data stored on a computer can be of different types: •Text and numbers •Sound (music/ speech) •Pictures •Video

How does JPEG reduce file size

JPEG is an example of lossy file compression

•JPEG uses the limitations of human vision to

remove some colours from the picture

•JPEG discards information that the human eye

would not notice.

16

Page 17: Data storage - lsrsssgroup.files.wordpress.com · Data Storage •Data stored on a computer can be of different types: •Text and numbers •Sound (music/ speech) •Pictures •Video

Calculating size of a Picture file • An uncompressed colour picture file requires 24 bits to store each pixel

• Remember 8 bits = 1 byte

• i.e 24 ÷ 8 = 3 bytes per pixel

• There fore a picture of resolution 600 X 800 requires

• 600 x 800 = 480 000 pixels

• Each pixel needs 3 bytes for storage of color information

• 480 000 pixels need : (480 000 x 3) bytes

• = 1440 000 bytes

• = 1440 ÷ 1024 = 1406 kilobytes (KB)

• = 1406 ÷ 1024 = 1.3 megabytes (MB)

17

Page 18: Data storage - lsrsssgroup.files.wordpress.com · Data Storage •Data stored on a computer can be of different types: •Text and numbers •Sound (music/ speech) •Pictures •Video

Activity 6.2(a) from textbook

•(a) An image is 1200 pixels by 1600 pixels. Calculate:

• (i) the total number of pixels in the original image

• (ii) the number of bytes occupied by this file

• (iii) the file size of the jpeg image (in kilobytes) if the

original image was reduced by a factor of 8.

18

Page 19: Data storage - lsrsssgroup.files.wordpress.com · Data Storage •Data stored on a computer can be of different types: •Text and numbers •Sound (music/ speech) •Pictures •Video

Activity 6.2(b) from textbook(b) A second image is 3072 pixels by 2304 pixels. Calculate:

• (i) the total number of pixels in the original image

• (ii) the number of bytes occupied by this file

• (iii) the file size of the jpeg image (in megabytes) if the original image

was reduced by a factor of 5.

• (iv) How many uncompressed files of the size calculated in part (ii)

could be stored on a 4-gigabyte memory card?

• (v) How many compressed files of the size calculated in part (iii) could

be stored on the same 4-gigabyte memory card?

19

Page 20: Data storage - lsrsssgroup.files.wordpress.com · Data Storage •Data stored on a computer can be of different types: •Text and numbers •Sound (music/ speech) •Pictures •Video

Sound (Music) Files

•Two ways of representing music files

1. MP3

2. MIDI

20

Page 21: Data storage - lsrsssgroup.files.wordpress.com · Data Storage •Data stored on a computer can be of different types: •Text and numbers •Sound (music/ speech) •Pictures •Video

MP3 files

•Uses lossy compression technology to reduce the size of

a music file by up to 90%

• A 700 MB music CD can be compressed to just 50-70 MB MP3 file

•The original music is compressed in such a way that it

does not noticeably affect the quality of the sound

• i.e Listeners will not be able to make the difference between

original and MP3.

21

Page 22: Data storage - lsrsssgroup.files.wordpress.com · Data Storage •Data stored on a computer can be of different types: •Text and numbers •Sound (music/ speech) •Pictures •Video

How does MP3 reduce the music file size?

•Discards unimportant parts of the music

•If two sounds are played at same time it keeps

the louder sound and the softer sound is

removed

•Removes sounds human ear cannot hear very

well.

22

Page 23: Data storage - lsrsssgroup.files.wordpress.com · Data Storage •Data stored on a computer can be of different types: •Text and numbers •Sound (music/ speech) •Pictures •Video

MIDI Files• MIDI is a communication protocol (A protocol is a set of rules)

• This protocol allows electronic musical instruments to communicate with each other.

• A MIDI file consists of a list of commands that instruct a device (e.g. an electronic organ,

a sound card in a computer or in a mobile phone) how to produce a particular sound

• MIDI files do not contain any audio hence, their size is considerably smaller

• For example, a 10 MB MP3 file only requires about 10 KB file size when saved as

MIDI.

• Suitable for devices where memory or storage space is limited

• For example, storing ring tones on a mobile phone.

23

Page 24: Data storage - lsrsssgroup.files.wordpress.com · Data Storage •Data stored on a computer can be of different types: •Text and numbers •Sound (music/ speech) •Pictures •Video

Video files

Video files are stored in MP4 format

• MP4 allows the storage of multimedia files in a lossy compressed form

• Can store in same file:

• sound

• Music

• Videos

• Photos

• Animation

• MP4 is used to stream Videos over the internet (YouTube, Online movies…)

• Smaller file size

• No noticeable loss in quality.

24

Page 25: Data storage - lsrsssgroup.files.wordpress.com · Data Storage •Data stored on a computer can be of different types: •Text and numbers •Sound (music/ speech) •Pictures •Video

How does MP4 reduce file size of videos

•MP4 allows the storage of multimedia files in

a lossy compressed form

•MP4 files use a variety of methods such as

removing some of the colour information in

each video frame

25

Page 26: Data storage - lsrsssgroup.files.wordpress.com · Data Storage •Data stored on a computer can be of different types: •Text and numbers •Sound (music/ speech) •Pictures •Video

Other file compression formatsWe have seen JPEG, MP3 and MP4, But there exist other

compression formats:

1. ZIP

• format that supports lossless data compression

• Suitable for compressing text files

2. GIF

• Lossless compression used with pictures

3. PNG• Lossless compression for pictures (Better than GIF)

26

Page 27: Data storage - lsrsssgroup.files.wordpress.com · Data Storage •Data stored on a computer can be of different types: •Text and numbers •Sound (music/ speech) •Pictures •Video

Definitions27

Page 28: Data storage - lsrsssgroup.files.wordpress.com · Data Storage •Data stored on a computer can be of different types: •Text and numbers •Sound (music/ speech) •Pictures •Video

Computer Science Workbook P36 Q 6Textbook Chapter 6 Activities 6.1-6.2

28 Homework 1

Page 29: Data storage - lsrsssgroup.files.wordpress.com · Data Storage •Data stored on a computer can be of different types: •Text and numbers •Sound (music/ speech) •Pictures •Video

1 (a) Robin wants to send a large file to Jennifer over the Internet.

State two benefits of compressing the file to send it.

Benefit 1 ...................................................................................................................................

Benefit 2 ...................................................................................................................................

(b) Two types of compression are lossy and lossless.

Choose the most suitable type of compression for the following and explain your choice.

(i) Downloading the code for a computer program:

Type of compression .........................................................................................................

Explanation .......................................................................................................................

(ii) Streaming a video file:

Type of compression .........................................................................................................

Explanation .......................................................................................................................

29 Homework 2

Page 30: Data storage - lsrsssgroup.files.wordpress.com · Data Storage •Data stored on a computer can be of different types: •Text and numbers •Sound (music/ speech) •Pictures •Video

End Data Storage

30