[Ffmpeg-devel] [PATCH] flacenc - lpc and options
Justin Ruggles
jruggle
Fri Jun 30 07:40:48 CEST 2006
Hello,
Another FLAC encoder patch is done. This adds LPC encoding. Right now
there is only 1 order search method, which does a quick estimate based
on the reflection coefficients.
I also added compression options which can be changed by setting them in
the AVCodecContext or by using AVOption. Here is the solution I decided on:
1) added 'compression_level' to AVCodecContext. it is set to
FF_COMPRESSION_DEFAULT (-1) by default. this could be easily reused in
other codecs (e.g. PNG, ZLIB).
2) added 8 compression options to AVCodecContext which are used by the
encoder. most of them are set to -1 by default, which indicates for the
encoder to use its default setting. this is so that other codecs can
reuse these fields if they wish, and can have different default values.
3) modified flacenc.c to first check for the compression_level and set
all the options based on that value, then read the other AVCodecContext
values and override the defaults if they are explicitly set by the user.
If any of this should be changed, let me know. Michael's idea of a
'preset' field in AVCodecContext would work, but it was unnecessary in
this case. I guess it could still be added for shortcuts like "best" or
"fast".
Since I have not yet added any more extensive order search options, the
compression level only goes from 0 to 5 for now. Below are the results
of a few tests comparing ffmpeg to the reference encoder. The faster
decode times for the ffmpeg-generated files are mostly due to the fact
that MD5 sums are not implemented yet, so the decoder doesn't do any
verification.
On that note, when I do add MD5 support, could I put the MD5-specific
code in its own files (libavutil/md5.c, md5.h)? It could possibly be
reused in the regression tests by adding an md5 test format to libavformat.
-Justin
=======================================================
Hongroise.wav
playing time: 30.00s
original audio size: 5292100
flac:
level enc time bytes ratio kbps dec time
----- --------- -------- ----- ------ ---------
0 2.80s 2373649 0.448 632.9 1.08s
1 3.05s 2371546 0.448 632.4 1.07s
2 3.77s 2363295 0.446 630.2 1.10s
3 4.24s 2040056 0.385 544.0 1.35s
4 5.12s 2052680 0.387 547.3 1.40s
5 6.50s 2035756 0.384 542.8 1.45s
ffmpeg:
level enc time bytes ratio kbps dec time
----- --------- -------- ----- ------ ---------
0 2.20s 2374305 0.448 633.1 0.87s
1 3.03s 2372543 0.448 632.6 0.89s
2 3.31s 2368870 0.447 631.6 0.91s
3 4.12s 1990216 0.376 530.7 1.08s
4 4.55s 1952459 0.368 520.6 1.13s
5 4.82s 1951425 0.368 520.3 1.13s
=======================================================
=======================================================
compilation.wav
playing time: 65.23s
original audio size: 11505908
flac:
level enc time bytes ratio kbps dec time
----- --------- -------- ----- ------ ---------
0 6.53s 6398288 0.556 784.7 2.56s
1 6.94s 6279772 0.545 770.1 2.62s
2 8.56s 6241038 0.542 765.4 2.56s
3 9.17s 6132773 0.533 752.1 3.04s
4 11.25s 6013517 0.522 737.5 3.36s
5 14.35s 5996495 0.521 735.4 3.26s
ffmpeg:
level enc time bytes ratio kbps dec time
----- --------- -------- ----- ------ ---------
0 5.08s 6294599 0.547 771.9 2.04s
1 6.36s 6256409 0.543 767.3 2.11s
2 6.74s 6243269 0.542 765.6 1.97s
3 8.90s 5968820 0.518 732.0 2.69s
4 9.84s 5956367 0.517 730.5 2.74s
5 10.43s 5940655 0.516 728.5 2.79s
=======================================================
=======================================================
songs_of_love.wav
playing time: 270.55s
original audio size: 47724432
flac:
level enc time bytes ratio kbps dec time
----- --------- -------- ----- ------ ---------
0 27.17s 27316733 0.572 807.7 10.64s
1 28.64s 26237781 0.549 775.8 10.88s
2 35.87s 26170357 0.548 773.8 10.73s
3 38.80s 26259292 0.550 776.4 13.23s
4 47.62s 25299173 0.530 748.0 13.97s
5 60.32s 25258739 0.529 746.8 13.92s
ffmpeg:
level enc time bytes ratio kbps dec time
----- --------- -------- ----- ------ ---------
0 19.60s 26353714 0.552 779.2 8.72s
1 26.10s 26223349 0.549 775.4 8.53s
2 27.05s 26194053 0.548 774.5 8.61s
3 37.25s 25018815 0.524 739.7 11.25s
4 40.54s 24977928 0.523 738.5 11.33s
5 42.40s 24971002 0.523 738.3 11.13s
=======================================================
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: flac-lpc.diff
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20060630/ee4130a5/attachment.txt>
More information about the ffmpeg-devel
mailing list