5 ms·
What does it mean when a codec is "lossless"?
by DarkMeld 15y ago
What does it mean when a codec is "lossless"?
- ewoodrich 15y agoThink of more like RAR or ZIP compression: filesize it reduced, but no data is lost. Unlike MP3 which uses a number of lossy compression techniques, including psychoacoustics, that are specifically designed to reduce the bitrate of an audio stream with minimal artifacts.
- daeken 15y agoIt means that there's no loss of fidelity. If you convert raw audio (a WAV for instance) to MP3, vorbis, or other lossy formats and then convert it back, you'll end up with different (lower fidelity) data. Doing the same with FLAC or another lossless format gives you the exact same data back. In the image space, PNGs are likewise lossless, whereas JPEG causes a loss of fidelity.
- Caerus 15y agoThis is in no way rigorous, but hopefully the analogy helps. Imagine you want to encode something like y = 2 * sin(2 * x) + .1 * sin(10 * x) to save space. http://www.wolframalpha.com/input/?i=sin%28x%29+%2B+.1*sin%2810x%29 http://www.wolframalpha.com/input/?i=sin%28x%29+%2B+.1*sin%2... That is composed of two different sine waves added together - one low frequency, large amplitude and one high frequency low amplitude. That can be encoded two different ways - lossy or lossless. A lossy encoder gets rid of unimportant data and keeps a "close enough" representation of the original. In this example, .1 * sin(10 * t) is a minor component of the overall signal (plot them separately if you need to compare the difference) so the encoder chooses to delete it and only save 2 * sin(2 * t). In a real world sound, this would be like throwing away noise that is so high pitched we can't hear it, or is so quiet we can't detect it. A real encoder has to decide what the "small enough it can be deleted" threshold is, and it's rarely black and white. A lossless encoder looks at that signal and thinks "there has got to be a more efficient way to store that data". They are both sine functions, so that doesn't need to be repeated twice. "x" is completely unnecessary, because it knows the sine functions are dependent on some variable. So, it could write out something like "sin (2,2) (.1,10)". All of the original data is still there, if whoever receives the data (the decoder) knows how to interpret it.
- bwarp 15y agoNote: A fourier transform is never lossless - it's an approximation (usually a fairly good one though).
- Bou 15y agoThe Fourier transform itself is an exact mathematical transformation with an exact inverse transform. There's nothing lossy about it.
- bwarp 15y agoMathematically, you are correct. Practically you are not if you consider the transform source.
- psykotic 15y agoWhat do you mean? If the original source is analog and sampled below its Nyquist rate in the analog-to-digital conversion, the process is indeed irreversible. But that all happens before any transforms from the time domain to the frequency domain are in play, so it's a separate issue. Beyond that, discrete Fourier and cosine transforms as usually implemented are not fully reversible because of loss in precision. A colleague of mine blogged about the issue in the context of Haar transforms a few years ago: http://cbloomrants.blogspot.com/2008/09/09-08-08-1.html http://cbloomrants.blogspot.com/2008/09/09-08-08-1.html. By decomposing an orthogonal transform into shears as explained by Charles, you can design reversible fixed-precision variants of the DCT like binDCT: http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.41.8531 http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.41.8...
- bwarp 15y agoSorry it is a separate issue - I should have been more clear. The original point the OP made was a bad example. Unfortunately I made a poor attempt at explaining that.
- 15y ago
- nodata 15y agoLossless: zip/unzip. Lossy: jpeg.
- getsat 15y agoOr: Lossless: PNG Lossy: JPEG
- ZeroGravitas 15y agoAnother word for lossless is "reversible", i.e. you can get back out what you put in, which isn't the case with mp3, but is with zip or flac. If you don't worry about it being bit exact you can make it a fair bit smaller though, particularly if any of the original data is difficult/impossible to hear.