File compression reduces file sizes by removing unnecessary data, allowing files to take up less storage space and transmit faster. There are two main types of file compression: lossless compression reconstructs the original file while lossy compression results in some loss of detail. Common file compression applications include MP3 and MP4 for audio and video, JPEG and PNG for images, and RLE for a variety of file formats.
File compression reduces file sizes by removing unnecessary data, allowing files to take up less storage space and transmit faster. There are two main types of file compression: lossless compression reconstructs the original file while lossy compression results in some loss of detail. Common file compression applications include MP3 and MP4 for audio and video, JPEG and PNG for images, and RLE for a variety of file formats.
✓ Save storage space ✓ Reduce the time taken to stream or transmit data
LO1: Define file compression.
Types of File Compression
• Lossless – all the data from the original file can be
reconstructed when the file is uncompressed again (applicable to spreadsheet file) • Lossy – file compression algorithm which eliminates unnecessary data, usually results in some loss of detail when compared to original; impossible to reconstruct (ex. MP3, JPEG)
LO2: Differentiate lossy and lossless compression.
File Compression Applications (MP3)
• MP3 uses technology known as audio compression to convert
music and other sounds into an MP3 file format, which reduce the size of a normal music file by 90% • MP3 uses perceptual music shaping – removes certain sounds which has frequencies that are outside the human hearing range, if two sounds are played at the same time, only the louder one can be heard by the ear, so softer sound is eliminated • Bit rate – refers to the number of bits per second used when creating sound file (between 80 to 320 kilobits per second), 200 kilobits or higher gives a sound quality close to a normal CD 3
LO2: Discuss the file compression applications.
File Compression Applications (MP4)
• MP4 file format allows the storage of multimedia
files rather than just sound. • MP4 includes music, videos, photos and animation
LO2: Discuss the file compression applications.
File Compression Applications (Bitmap Images)
• Both the file size and quality of image are reduced.
Example is JPEG • JPEG reduces the raw bit-map image by a factor of between 5 to 15 depending on the quality of the original • Vector graphics can also undergo some form of file compression like scalable vector graphics (.svg)
LO2: Discuss the file compression applications.
File Compression Applications (Run-Length Encoding - RLE) • Used to compress a number of different file formats • A form of lossless compression that reduces the size of a string of adjacent, identical data (such as repeated colours in an image) • A repeated string is encoded into two values. • First value represents the number of identical data items (such as characters) while the second value represents the code of the data item a a a a a b b b b c c d d d d d 05 97 04 98 02 99 05 100
LO2: Discuss the file compression applications.
File Compression Applications (Run-Length Encoding - RLE) • One issue occurs with a string such as ‘cdcdcdcdcd’ where compression is not very effective. To cope with this we use a flag. • A flag preceding data indicates that what follows are the number of repeating units (for example, 255 05 97 where 255 is the flag and the other two numbers indicate that there are five items with ASCII code 97). • When the flag is not used, the next bytes are taken with their face value and a run of 1 (fo example, 01 99 means one character with ASCII code 99 follows).