Difference between revisions of "Compression"
Mfrederick (talk | contribs) |
(→Lossless Compression) |
||
Line 22: | Line 22: | ||
===Dictionary Based Methods=== | ===Dictionary Based Methods=== | ||
This is used when there are lots of repeating patterns of data. For example, if you where writing a document about Computer Science, you would probably say Computer Science a lot in the document. So what happens is that it sores the phrase in a dictionary and replaces the phrase with a number so whenever that data is needed, it calls up the dictionary and replaces that number with the phrase | This is used when there are lots of repeating patterns of data. For example, if you where writing a document about Computer Science, you would probably say Computer Science a lot in the document. So what happens is that it sores the phrase in a dictionary and replaces the phrase with a number so whenever that data is needed, it calls up the dictionary and replaces that number with the phrase | ||
+ | |||
+ | ==Difference between lossy and lossless compression== | ||
+ | The main difference between lossy and lossless compression is the fact that when compressed, lossy loses some of the original quality*, whilst lossless retains all of the initial quality, hence the names "lossy" and "lossless". | ||
+ | |||
+ | *Although sometimes lossy compression only removes the information that is not needed, for example it may remove some of the frequencies that cannot be heard by humans, so in this sense the quality may remain the same. |
Revision as of 23:24, 1 January 2017
Contents
Definition
Data compression is decreasing the size of a file. There are many different compression techniques.
Lossy Compression
Lossy compression is a compression technique that decreases file size by discarding bits of unnecessary data. This means that the original file cannot be recreated. An example of lossy compression is JPEG. JPEG images can discard some of the original data to create a new image which is similar to the original, but has a reduced resolution. Another example of lossy compression is MP3. MP3's shrink the bit rate used in the recording to save data.
All of the above use lossy methods of compression to save data and space. This isn't the best method to use as it gets rid of some of the data, so this would be a unsuitable method to use if the original file needs to be used. People who would need the original file would be: Photographers, Audio Producers and Printing Firms.
Lossy Methods
- JPEG
- MPEG-1
- MP3
Lossless Compression
Lossless compression is a compression technique that decreases file size whilst keeps all of the data. This is possible because of repeating patterns. Also, this means that the original file can be recreated to the same quality. Examples of lossless compression are Run Length Encoding and Dictionary Based Methods. Run Length Encoding replaces repeating pixels or codes. Dictionary Based Methods rely on patterns within a file and are more effective with larger files. Each pattern can has an ID number.
Run Length Encoding
This is a system that counts up the bits of data that are repeated. For Example, if there was a picture with 3 red pixels that are next to each other. The file would store the pixel colour and the amount of them are in the same row.
Dictionary Based Methods
This is used when there are lots of repeating patterns of data. For example, if you where writing a document about Computer Science, you would probably say Computer Science a lot in the document. So what happens is that it sores the phrase in a dictionary and replaces the phrase with a number so whenever that data is needed, it calls up the dictionary and replaces that number with the phrase
Difference between lossy and lossless compression
The main difference between lossy and lossless compression is the fact that when compressed, lossy loses some of the original quality*, whilst lossless retains all of the initial quality, hence the names "lossy" and "lossless".
- Although sometimes lossy compression only removes the information that is not needed, for example it may remove some of the frequencies that cannot be heard by humans, so in this sense the quality may remain the same.