diff options
author | Derek Buitenhuis <derek.buitenhuis@gmail.com> | 2013-01-16 01:08:59 +0400 |
---|---|---|
committer | Derek Buitenhuis <derek.buitenhuis@gmail.com> | 2013-10-15 20:00:28 +0400 |
commit | bc31a7a3b6bcd7409e4440d7d8124006813fe15a (patch) | |
tree | c013de7d9dcb5f207defc4aefb6b1821e5d0961b /libavcodec/mpegaudio_tablegen.h | |
parent | 884fd4d2590c30c7787fc05b86b050125fd53f33 (diff) |
tablegen: Don't use cbrtf in host tools
You cannot count on them being present on all systems, and you
cannot include libm.h in a host tool, so just hard code baseline
implementations.
Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
Diffstat (limited to 'libavcodec/mpegaudio_tablegen.h')
-rw-r--r-- | libavcodec/mpegaudio_tablegen.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/libavcodec/mpegaudio_tablegen.h b/libavcodec/mpegaudio_tablegen.h index a222f2c423..a6c203ff3b 100644 --- a/libavcodec/mpegaudio_tablegen.h +++ b/libavcodec/mpegaudio_tablegen.h @@ -47,7 +47,8 @@ static void mpegaudio_tableinit(void) double value = i / 4; double f, fm; int e, m; - f = value * cbrtf(value) * pow(2, (i & 3) * 0.25); + /* cbrtf() isn't available on all systems, so we use powf(). */ + f = value * powf(value, 1.0 / 3.0) * pow(2, (i & 3) * 0.25); fm = frexp(f, &e); m = (uint32_t)(fm * (1LL << 31) + 0.5); e += FRAC_BITS - 31 + 5 - 100; @@ -58,7 +59,8 @@ static void mpegaudio_tableinit(void) } for (exponent = 0; exponent < 512; exponent++) { for (value = 0; value < 16; value++) { - double f = (double)value * cbrtf(value) * pow(2, (exponent - 400) * 0.25 + FRAC_BITS + 5); + /* cbrtf() isn't available on all systems, so we use powf(). */ + double f = (double)value * powf(value, 1.0 / 3.0) * pow(2, (exponent - 400) * 0.25 + FRAC_BITS + 5); expval_table_fixed[exponent][value] = llrint(f); expval_table_float[exponent][value] = f; } |