Robert informed me last week about the new release of the
Free Lossless Audio Codec (FLAC). It claims to be better and faster than the version before. So, since I am use FLAC (and of course
Vorbis) for my media archive I thought I give the new version a spin and while doing that also check for the improvements.
FLAC offers a bunch of different quality settings, which of course do not influence the sound quality at all — it is always possible to reproduce a bit-identical version of the original wav-file — but give the trade-off between time needed for compression and compressed file size. The higher the quality setting, the smaller the file will (should) be but the process will take longer. To be even more precise, the quality settings are synonymous for a bunch of more technical parameters, but I do not want to go into that.
So I took five different songs and compressed each for quality settings 1 to 8 (8 is equivalent to
--best) once with
flac-1.1.2 and once with
flac-1.1.4. Both versions were compiled with rather aggressive compiler settings, but they were the same for both and also the GCC was the same; the usage of SSE was enable for both via the dedicated
configure-flag
--enable-sse. Of course I also measured the time the compression of each file took. All measurements have been performed on
jane, my 1.6Ghz P4m Laptop.

With these data I produced a couple of plots, assessing the improvements from
1.1.2 to
1.1.4. What is shown in the figures is the rate versus the ratio. The rate is the quotient of song time over compression time, so a rate of 5 means the compression is done in one fifth of the running time of the song. The ratio is compressed file size over the original file size, so a ratio of e.g. 0.65 would mean that the resulting flac is 65% of the original file, hence saving 35%. Note that the scaling for the ratio is the same in all plots, but the scaling for the rate differs slightly.
The ratio that can be achieved depends strongly on the input file, but normally values around 60% are achieved. This of course does not compare at all to the compression rate achieved by lossy codecs like Vorbis or MP3, but that is the cost of lossless encoding.

In each figure two curves are shown, the red one gives the values for
1.1.2 and the green ones correspond to
1.1.4. Each curve consists of eight points, the leftmost being the one obtained with the highest and the rightmost the one obtained with the lowest quality setting.
Common for all plots is the very flat slope at the beginning, the file size changes only slowly whereas the rate increases significantly. This behaviour is visible from quality 8 down to 4. Then we can see a big jump in compression efficiency between quality 4 to 2 while the rate does not change very much. Quality 1 and 2 then do not differ much in file size and also the change in rate is not too significant.

This general shape of the curve does not differ between the two different versions of FLAC. The improvements made from
1.1.2 to
1.1.4 are twofold: First the achieved compression at the same quality setting is better, the points move to the bottom. But also the code works faster, so the points move to the right.
The two inset graphs quantify this behaviour a bit closer. Both have the quality setting on their abscissa. The lower one (blue dots) then shows the speed-up achieved by the newer version, which is given by the ratio of the compression times, 1.1.2 over 1.1.4; so a speed-up of 2 means that the compression was twice as fast. The upper inset plot (magenta points) percentage difference between the achieved file sizes, so a difference of 1% means that the newer version of FLAC produce a file that is smaller by one percent at the same quality setting.

What is remarkable here is the huge speed-up that can be seen at quality settings 8 and 7. The code is indeed more than twice as fast for all files I tested. The speed-up is not significant for the other settings but still measurable. Interesting is the effect on the file size, only for quality 1 and 2 there is no or only very minor change, but for all other settings the file size is reduced by 1% to 4%, strongly depending on the file: Only very little effect on the file size can be seen for 'J.S. Bach - BWV 1068, Air', the largest change is observed for 'Urna Chahartugchi - Yanzagan zootoi saaral mori'.

So, what do we learn from all this? First of all, the new release really has improvements. Depending on how you used FLAC before you will feel them. Then it does not make much of a difference (space-wise) if you use quality 8 or 5, but quality 5 is way faster in compression. So just looking at the graphs I would say going for quality 6 is the green solution, but then I do not really care how long the compression takes. Especially with the speed-up for quality 8 and 9 it is really not any pain anymore (rate at around 8 to 9) given that the compression with Vorbis also runs at a rate of about 9 on my laptop.