Help - Search - Members - Calendar
Full Version: Different compressions for different gains
Hydrogenaudio Forums > Lossless Audio Compression > FLAC
Robin
I had a very low volume (max peak was about -23 dB) file in mono that when compressed with flac -8 gave a compression of about 0.192 if I remember correctly.
I then normalized the file to have a maximum of 0.0 dB and the flac file turned out to be 0.4xx something which made the resulting file more than double the size for the low-volume one.

Why is this? Isn't the change from sample to sample the same for the low volume one as for the high volume one? And the difference is really significant, so it can't really be that the sample to sample change is slightly different, can it?

This really isn't a problem for me, I'm more curious biggrin.gif
Realityfreak
There was a similar thread with WaveGain and MP3 , stating that normalizing a sample with WaveGain can decrease/increase the filesize of the MP3 file if normalized before encoding (depending on the song beeing louder/quieter than the normalization level). [Edit] The following statement is incorrect! There is no difference between MP3, FLAC or whatever codec you want to use. The outcome is always the same. The only difference is the algorythm the different codecs use to compress and that they're lossy or lossless. (Please correct me if I'm wrong)

For more information read this. [Edit] link removed

Or to make it short:
[Edit] Quote removed

I hope there is somebody out there that can answer your question a bit more specific than I did.

Regards

- Realityfreak
Gabriel
QUOTE
There is no difference between MP3, FLAC or whatever codec you want to use.

There is a huge difference between perceptual lossy codecs and lossless codecs.
Realityfreak
QUOTE(Gabriel @ Oct 20 2005, 05:21 PM)
QUOTE
There is no difference between MP3, FLAC or whatever codec you want to use.

There is a huge difference between perceptual lossy codecs and lossless codecs.
*



Well... Maybe I've used the wrong words to express myself. I only ment that the outcome of the final file is always the same. (Bigger/smaller size)
But if that means the thread I linked to above is useless, then I'll just remove it along with the quote and leave it at that.

- Realityfreak

*Teasing Gabriel* (It would also be helpful to know what the differences are... I don't speak C++ nor did I take the perceptual lossy codecs and lossless codecs class for advanced.) tongue.gif
jcoalson
the normalization process added a lot of noise which FLAC can't compress but must faithfully reproduce.

Josh
rompel
QUOTE(Robin @ Oct 20 2005, 07:41 AM)
I had a very low volume (max peak was about -23 dB) file in mono that when compressed with flac -8 gave a compression of about 0.192 if I remember correctly.
I then normalized the file to have a maximum of 0.0 dB and the flac file turned out to be 0.4xx something which made the resulting file more than double the size for the low-volume one.

Why is this? Isn't the change from sample to sample the same for the low volume one as for the high volume one? And the difference is really significant, so it can't really be that the sample to sample change is slightly different, can it?

This really isn't a problem for me, I'm more curious  biggrin.gif
*


When you apply a positive gain to a file you are raising the noise floor. To your ears or for a perceptual codec, this makes little difference since, essentially, the S/N ratio is unchanged. But a lossless codec has to encode all the noise exactly and that takes bits. In particular, a 23 dB gain corresponds to 3.8 bits/sample, increasing the compression ratio by about .24.

In theory, a lossless codec could detect that all the samples were multiples of some gain factor (plus or minus 1 if dithering was applied). Then you could apply an arbitrary gain for little cost. AFAIK, nobody's been crazy enough to actually try implementing such a scheme.

As a special case of this idea, FLAC will detect if some number of low-order bits are always zero and code that very efficiently. So if you can arrange to multiply all your samples by a power of 2, you can get the gain at the cost of a few bits per frame. In the case of your file, the best you could do without clipping would be to multiply all the samples by 8, corresponding to a 18dB gain.

If you really wanted the full 23dB gain, you could apply the maximal gain that would keep all the samples under 1/8 full-scale (i.e. approximately 5dB) before multiplying by 8. This would cost approximately .8 bits/sample or a .05 increase in compression ratio. The downside would be an 18dB increase in distortion/dithering noise compared to just applying the 23dB gain in one step. If dithering were used in the gain process, this would probably still be quite acceptable.

--John
Robin
Thanks for the answers, especially the very in-depth answer from John. I *think* I get it, although I will probably need to read up on dithering...
HotshotGG
QUOTE
Well... Maybe I've used the wrong words to express myself. I only ment that the outcome of the final file is always the same. (Bigger/smaller size)
But if that means the thread I linked to above is useless, then I'll just remove it along with the quote and leave it at that.


well to the "average Joe" the outcome is always the same, but to the electrical engineer or computer scientist their is a HUGE difference. Data compression is entire research field of it's own in the CS world. Information theory has paved the way for this kind of stuff and we can all thank Claude Shannon for that biggrin.gif. Psychoacoustics well that's one area you should know, especially if you plan on being a audio engineer or if you are a w orking scientist researching perceptual coding, etc. wink.gif
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2008 Invision Power Services, Inc.