Sunday, December 30, 2018

1.1.3(c): show understanding of the principles of data compression applied to music, video, photos and text files



(basically, previous post)
Lossless compression
Every bit of data is preserved when compressed and is restored after being uncompressed. This is usually used for text files and spreadsheets(if you don’t to lose any values)

Lossy compression

Redundant information is permanently eliminated. This can apple to photo, music and video files. (stuff we cant hear)

Text File Compression

“LIVE AS IF YOU WERE TO DIE TOMORROW, LEARN AS IF YOU WERE TO LIVE FOREVER”

This sentence consists of 74 memory units
To compress this, a compression algorithm can use a data dictionary to store repeated groups of characters
The data dictionary can store these groups and replace the ones in the text with numbers:

LIVE -> 1
AS IF YOU WERE TO -> 2
OR -> 3

1 2 DIE TOM3ROW, LEARN 2 1 F3EVER.

Now this new sentence is now 34 memory unit

This has saved 54% of the original file size
When the file is uncompressed, the groups of characters in the data dictionary are fetched and replace the numbers in the sentence.

No comments:

Post a Comment