1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-02-04 06:08:26 +02:00
FFmpeg/libavcodec
Ganesh Ajjanagadde 96786a12f6 avcodec/aac_tablegen: speed up table initialization
This speeds up aac_tablegen to a ludicruous degree (~97%), i.e to the point
where it can be argued that runtime initialization can always be done instead of
hard-coded tables. The only cost is essentially a trivial increase in
the stack size.

Even if one does not care about this, the patch also improves accuracy
as detailed below.

Performance:
Benchmark obtained by looping 10^4 times over ff_aac_tableinit.

Sample benchmark (x86-64, Haswell, GNU/Linux):
old:
1295292 decicycles in ff_aac_tableinit,     512 runs,      0 skips
1275981 decicycles in ff_aac_tableinit,    1024 runs,      0 skips
1272932 decicycles in ff_aac_tableinit,    2048 runs,      0 skips
1262164 decicycles in ff_aac_tableinit,    4096 runs,      0 skips
1256720 decicycles in ff_aac_tableinit,    8192 runs,      0 skips

new:
21112 decicycles in ff_aac_tableinit,     511 runs,      1 skips
21269 decicycles in ff_aac_tableinit,    1023 runs,      1 skips
21352 decicycles in ff_aac_tableinit,    2043 runs,      5 skips
21386 decicycles in ff_aac_tableinit,    4080 runs,     16 skips
21299 decicycles in ff_aac_tableinit,    8173 runs,     19 skips

Accuracy:
The previous code was resulting in needless loss of
accuracy due to the pow being called in succession. As an illustration
of this:
ff_aac_pow34sf_tab[3]
old : 0.000000000007598092294225
new : 0.000000000007598091426864
real: 0.000000000007598091778545

truncated to float
old : 0.000000000007598092294225
new : 0.000000000007598091426864
real: 0.000000000007598091426864

showing that the old value was not correctly rounded. This affects a
large number of elements of the array.

Patch tested with FATE.

Reviewed-by: Rostislav Pehlivanov <atomnuker@gmail.com>
Signed-off-by: Ganesh Ajjanagadde <gajjanagadde@gmail.com>
2015-11-27 06:38:06 -05:00
..
2015-11-22 16:16:16 -05:00
2015-10-29 21:26:43 +01:00
2015-11-07 19:24:49 +01:00
2015-11-21 08:51:49 -05:00
2015-10-08 23:29:18 +02:00
2015-10-10 09:52:18 +02:00
2015-10-10 09:52:18 +02:00
2015-11-06 13:45:50 +01:00
2015-10-13 16:03:04 +02:00
2015-10-26 10:08:01 +01:00
2015-10-09 22:09:08 +02:00
2015-10-25 22:48:04 +01:00
2015-11-12 13:16:25 +01:00
2015-11-12 13:16:25 +01:00
2015-11-07 12:10:55 +01:00
2015-11-17 01:23:10 +01:00
2015-11-14 02:37:12 +01:00
2015-11-20 08:20:13 -05:00
2015-11-07 19:24:49 +01:00
2015-10-11 17:29:50 -03:00
2015-10-11 17:29:50 -03:00
2015-10-26 23:23:59 -07:00
2015-10-09 22:09:08 +02:00