[Ffmpeg-devel] FLAC encoder

Corey Hickey bugfood-ml
Sat May 27 09:58:52 CEST 2006

Justin Ruggles wrote:
> Michael Niedermayer wrote:
>> the number of bits for a single symbol is (data>>k) + k + 1 for all symbols
>> n to m its obviously (m-n)*(k+1) + sum of (data[i]>>k)
>> and "sum of (data[i]>>k)" is just the sum of the corresponding partial sums
>> for that area
> So is all that partial sums calculation just to speed up calculation of
> "sum of (data[i]>>k)" ?  If so, I can easily optimize the rest and go
> back to the partial sums stuff once I understand better how it works.
> I have already done some simple optimizations.  My results seem too
> staggering to be true.  I seem to have knocked off another 30% in
> encoding time for the highest compression level.  That makes it now 60%
> faster than libFLAC...  Now I'm worried it's just my machine.  Can
> anyone else confirm similar results of 30% faster than "flac -8" with
> the version I posted earlier?

On an amd64:

$ time flac -f -8 audiodump.wav

flac 1.1.2, Copyright (C) 2000,2001,2002,2003,2004,2005  Josh Coalson
flac comes with ABSOLUTELY NO WARRANTY.  This is free software, and you are
welcome to redistribute it under certain conditions.  Type `flac' for

options: -P 4096 -b 4608 -m -l 12 -e -q 0 -r 0,6
audiodump.wav: wrote 19010895 bytes, ratio=0.598

real    0m18.765s
user    0m18.518s
sys     0m0.204s

$ time flake/flake -8 audiodump.wav a.flac
Flake: FLAC audio encoder
Signed 16-bit 44100 Hz stereo
samples: 7953408
blocksize: 4608
frames:      1726 | samples:   7953408 | bytes:  19104706 | bitrate:
847 kbps

real    0m6.140s
user    0m6.027s
sys     0m0.109s

$ ls -l audiodump.wav audiodump.flac a.flac
-rw-r--r-- 1 bugfood bugfood 19104706 2006-05-27 00:52:25 a.flac
-rw-r--r-- 1 bugfood bugfood 19010895 2006-05-27 00:49:48 audiodump.flac
-rw-r--r-- 1 bugfood bugfood 31813676 2006-05-27 00:49:48 audiodump.wav

Sounds fine, I think. Nice!


More information about the ffmpeg-devel mailing list