Download Memory & Storage: Lesson 9 Compression and more Slides Computer science in PDF only on Docsity!
Memory & Storage: Lesson 9
Starter
- HD TV has a resolution of 1920px x 1080px
- This results in 2.1 megapixels per frame
- Each pixel uses 24-bit colour
- This means each frame needs about 50 megabits
- There are 25 frames per second resulting in a total amount of data being 1. gigabits per second
How can we possibly
stream this through
internet connections
that are typically under
70 Mb/s in the UK?
Memory & Storage: Lesson 9
Compression techniques
- Compression is the name given to algorithms which reduce file sizes
- Decompression is the process where compressed data is restored to its original format
- Compression is heavily used with sound, image and video files
- There are two types of compression:
- Lossy compression (JPG, GIF, MP 3 )
- Lossless compression (PNG, TIFF)
Memory & Storage: Lesson 9
Compression
Reducing the amount of file space (bits) that a given file takes up.
- In the past, compression was important because computer memory was expensive.
- Today, memory is much, much cheaper but compression remains important because of the volume of information we transmit over networks.
- A smaller file size means fewer bits to transmit, so a faster transmission is achieved.
Memory & Storage: Lesson 9
Compression Ratio
- The level of compression is measured by its compression ratio.
- The compression ratio is: The size of the compressed file divided by the size of the original.
- The ratio will be a number between 0 and 1 ; the closer the ratio is to 0 , the tighter the compression.
Memory & Storage: Lesson 9
Lossy Compression
- The file is compressed to a smaller size but some information is lost during the process.
- The original file cannot be perfectly reconstructed. When would this sort of compression be useful?
Memory & Storage: Lesson 9
Lossy compression:
Recreating Files
- Recreates the file using the remaining data and uses algorithms to guess the removed content
- Uncompressed data is not the same as the original Would this technique work for compressing a computer program?
Memory & Storage: Lesson 9
How lossy compression works
Similarly coloured pixels are all made the same
Memory & Storage: Lesson 9
Lossy compression:
Artefacts
- Lossy compression results in
small mistakes known as
‘digital artefacts’ appearing
in images and video
- Noise can often be seen where there are contrasting colours
- Blocks can often result from lossy compression
Memory & Storage: Lesson 9
Lossless image compression
- Finds groups of repeating data and records the data only once along with the number of times it was repeated = 12 x + 6 x
- When data is uncompressed it is restored exactly as it was in the original
Memory & Storage: Lesson 9
Lossless text compression
- Finds patterns in the original text
- Encodes each pattern in a dictionary An eye for an eye, a tooth for a tooth. . 0 0000 An_ 1 0001 eye 2 0010 for 3 0011 an_ 4 0100 ,_ 5 0101 a_ 6 0110 tooth 7 0111 1 2 3 4 2 5 6 7 3 6 7 0 0001 0010 0011 0100 0010 0101 0110 0111 0011 0110 0111 0000 An eye for an eye , a tooth for a tooth.
Memory & Storage: Lesson 9
Calculating Compression Reduction
Original File size- compressed file size = answer
Answer/original file size = % in reduction
Original file= 120 bytes, compressed to 73 bytes
120 bytes - 73 = 47
47/120= 0.39 = 39% reduction in size
Memory & Storage: Lesson 9
Lossy or Lossless…?
- A website image
- A zipped file of text files and images
- A PDF instruction manual
- The latest Radiohead album
Memory & Storage: Lesson 9
Benefits of compression
- Smaller files = fewer packets = faster transmission
- Quicker to complete
- Reduces traffic over the Internet
- Less chance of collisions or transmission errors
- Improves download speed of video, sound (including speech used for VOIP systems) and image files
- Speeds up download of webpages that use images
- Reduces space on disk / servers
- Enables better streaming of music and video
Memory & Storage: Lesson 9
Task 1:
Compression
Navigation: 🠀 Student G-Suite 🠀 Computer Studies 🠀 GCSE Computer Science 🠀 Unit 1: Computer Systems 🠀 1.2: Memory & Storage 🠀 Lesson 9: Compression 🠀 Worksheet 1
- Complete Task 1 on the worksheet
- Complete page 84 in the CGP: Practice Exam Questions book
- Use Page 75 in the CGP: Revision Guide book to help you