3 ms·
I've never understood how a format can be "lossy" or "lossless" in the first place. It seems to me that the format specifies how the image data should be render
by gweinberg 13y ago
I've never understood how a format can be "lossy" or "lossless" in the first place. It seems to me that the format specifies how the image data should be rendered on a display device and any "loss" that occurs us always a result of the encoding process. For that matter, the concept of loss only makes sense if you start with a pixmap, and that is not always the case.
- homosaur 13y agoI see what you mean, but you are losing source information no matter what you start with.
- dbarlett 13y agoConsider an extremely simple codec that uses only (lossless) run-length encoding [1]. You have an image of a blue sky with a few white clouds. One of the rows might have pixels Blue-Blue-Blue-Blue-White-White. This would be encoded as 4Blue-2White. The amount of information is the same, but you've removed redundancy (this is more or less how fax machines work). A lossy codec would take advantage of limits in human perception and encode LightBlue-MediumBlue-DarkBlue as 2LightBlue-DarkBlue. On a large enough image, you wouldn't notice the difference. [1] https://en.wikipedia.org/wiki/Run-length_encoding https://en.wikipedia.org/wiki/Run-length_encoding
- cdumler 13y agoBy definition, a CODEC starts with some series of bits (source) that encodes information into a new series of bits (encoding). A CODEC is said to be "lossy" when the results of the decoded encoding does not match the source, ie. information encoded in the source stream gets dropped. Various techniques are used to accomplish this. One side of the scale is to simply degrade the quality of the original. The other is to use visual/acoustic changes humans have difficulty in recognizing. For instance, the human hear has a minimum distance between frequency and loudness of two tones. The softer tone is dropped in MP3 depending on "compression" level; thus, from a source fidelity standpoint, the quality is "lossy" since the encoded form no longer has the original's content. From a human ear quality standpoint, the quality is barely noticeable to most people.
- iso-8859-1 13y agoHere's the issue I think gweinberg has: Imagine you encode an image to JPEG, with the "quality slider" cranked all the way to 11 (or whatever the maximum is). Now, the DCT blocks are tiny and the compression is super inefficient. But it exactly reproduces the input image, and you may say it's lossless. The same image encoded with PNG (deflate) might be way smaller, but that still does not change the fact that JPEG losslessly encodes this image.
- ajb 13y agoTechnically you can have a format which is literally defined in such a way that not all inputs can be perfectly represented. On example is mobile phone audio, it is defined to operate at a particular bit rate, which is less than that required to represent all possible speech signals. However, you are right that 'lossy' is usually used to describe its intended use rather than its actual formal limit. For example, you can (probably!) non-lossily encode an image as a jpeg, but it won't be as good a compression ratio as you would get from a format which was specifically designed for use with lossless compression. It might even cause the file to get bigger.
- Amadou 13y agoI find that it helps to mentally substitute "idempotent" for "lossy" when talking about these algorithms.
- franzay 13y agoNo, a lossy algorithm can be idempotent, and in fact any optimal encoder is necessarily idempotent (because there is no need to further degrade an already compressed image). While it's true that most encoders are not actually optimal and often add noise when re-encoding, it's not a theoretical necessity. The correct mathematical term for "lossy" is "non-surjective": at a given encoding setting, not all inputs can be represented.