[FFmpeg-cvslog] mpegaudio_tablegen: Don't use llrint

Derek Buitenhuis git at videolan.org
Tue Oct 15 17:52:33 CEST 2013


ffmpeg | branch: master | Derek Buitenhuis <derek.buitenhuis at gmail.com> | Tue Jan 15 16:28:05 2013 -0500| [e51692114354b8e460bf5c9f6def7089a6b969c0] | committer: Derek Buitenhuis

mpegaudio_tablegen: Don't use llrint

You cannot count on it being present on all systems, and you
cannot include libm.h in a host tool, so just hard code a baseline
implementation.

Signed-off-by: Derek Buitenhuis <derek.buitenhuis at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e51692114354b8e460bf5c9f6def7089a6b969c0
---

 libavcodec/mpegaudio_tablegen.h |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavcodec/mpegaudio_tablegen.h b/libavcodec/mpegaudio_tablegen.h
index 1090ea5..1e1a382 100644
--- a/libavcodec/mpegaudio_tablegen.h
+++ b/libavcodec/mpegaudio_tablegen.h
@@ -62,7 +62,8 @@ static void mpegaudio_tableinit(void)
         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;
-            expval_table_fixed[exponent][value] = llrint(f);
+            /* 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;
         }
         exp_table_fixed[exponent] = expval_table_fixed[exponent][1];



More information about the ffmpeg-cvslog mailing list