Difference: 1. Lossless compression can be completely restored; lossy compression cannot be the same as the original file after restoration, and there will be a certain loss. 2. The compression ratio of lossless compression is generally "2:1" to "5:1"; while the compression ratio of lossy compression can reach "200:1" or more.
Lossy compression and lossless compression are both compression technologies, but no matter what technical model is used, the essential content of the two is the same, that is, They all use a special encoding method to effectively reduce the repetition and redundancy in data information, thereby achieving the purpose of data compression. The basic principle is to retain only some "key points" in the original data without affecting the basic use of the file, and remove duplicate and redundant information in the data, thereby achieving the purpose of compression.
The difference between lossy compression and lossless compression
1. The difference in restoreability
Lossless compression can be completely restored; After lossy compression is restored, it cannot be the same as the original file, and there will be some loss.
2. The difference in compression ratio
The compression ratio of lossless compression is subject to the theoretical limit of data statistical redundancy, generally 2:1 to 5:1;
Lossy compression takes advantage of the human insensitivity to certain frequency components in images or sound waves, allowing a certain amount of information to be lost during the compression process. Although the original data cannot be completely restored, the impact of the lost part on understanding the original image is reduced. But in exchange for a much larger compression ratio of up to 200:1 or more.
3. Differences in compressed file formats
mp3, divX, Xvid, jpeg, rm, rmvb, wma, wmv and other formats are lossy compression;
lossless Commonly used compression formats include APE, FLAC, TAK, WavPack, TTA, etc.
4. Differences in compression principles
There are two basic mechanisms of lossy compression:
One is lossy transformation encoding and decoding, which first samples the image or sound , cut into small pieces, transformed to a new space, quantized, and then entropy encoded on the quantized value.
The other is predictive encoding and decoding. The previous data and subsequent decoded data are used to predict the current sound sample or image frame. The error between the predicted data and the actual data and other information to reproduce the prediction are carried out. Quantization and encoding.
Lossless compression principles include run-length coding, Huffman coding and arithmetic coding.
5. Differences in application fields
Lossy compression is widely used in the compression of voice, image and video data;
Lossless compression is limited by the compression ratio and is only used temporarily. It is suitable for the compression of text data, programs and image data in special applications (such as fingerprint images, medical images, etc.), but the future of the lossless compression format is undoubtedly bright. As time goes by, the various factors that limit the lossless format will gradually be eliminated. eliminate.
For example, the capacity of hard drives continues to increase. 1TB mechanical hard drives have become mainstream, and 200GB solid-state drives will also become popular.
The problem of lossless formats taking up large space will no longer be a problem, and faster Decoding chips will also be developed. I believe that more and more hard drive walkman will support lossless format. In the near future, even the capacity of flash memory walkman will be calculated in TB. In order to pursue higher sound quality, lossless format Compression formats will receive more and more attention.
For more related knowledge, please visit: PHP Chinese website!
The above is the detailed content of What is the difference between lossy and lossless compression?. For more information, please follow other related articles on the PHP Chinese website!