diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-10-15 20:06:44 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-10-15 21:03:03 +0200 |
commit | 59352a07d856a67b81fe3480ac4644a92beac113 (patch) | |
tree | e3ba1af18e69daf1f9842bf6df3de3736d9704a1 /libavcodec/mpegaudio_tablegen.h | |
parent | e51692114354b8e460bf5c9f6def7089a6b969c0 (diff) | |
download | ffmpeg-59352a07d856a67b81fe3480ac4644a92beac113.tar.gz |
avcodec: improve precission for cbrtf() emulation
cbrtf() took floats but it represented 1/3 exactly
and even if not more precission should be better in theory
for the table generation
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/mpegaudio_tablegen.h')
-rw-r--r-- | libavcodec/mpegaudio_tablegen.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/libavcodec/mpegaudio_tablegen.h b/libavcodec/mpegaudio_tablegen.h index 1e1a38296b..60303b16ad 100644 --- a/libavcodec/mpegaudio_tablegen.h +++ b/libavcodec/mpegaudio_tablegen.h @@ -49,7 +49,7 @@ static void mpegaudio_tableinit(void) double f, fm; int e, m; /* cbrtf() isn't available on all systems, so we use powf(). */ - f = value / IMDCT_SCALAR * powf(value, 1.0 / 3.0) * pow(2, (i & 3) * 0.25); + f = value / IMDCT_SCALAR * pow(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; @@ -61,7 +61,7 @@ static void mpegaudio_tableinit(void) for (exponent = 0; exponent < 512; exponent++) { for (value = 0; value < 16; value++) { /* 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) / IMDCT_SCALAR; + double f = (double)value * pow(value, 1.0 / 3.0) * pow(2, (exponent - 400) * 0.25 + FRAC_BITS + 5) / IMDCT_SCALAR; /* llrint() isn't always available, so round and cast manually. */ expval_table_fixed[exponent][value] = (long long int) (f >= 0 ? floor(f + 0.5) : ceil(f - 0.5)); expval_table_float[exponent][value] = f; |