[vlc-commits] audio_format: stick to single precision arithmethic (except for FL64)

Rémi Denis-Courmont git at videolan.org
Wed Aug 13 20:29:15 CEST 2014


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Wed Aug 13 21:16:55 2014 +0300| [b344246d35f6fdbcd4b14424118ebfac6005c3a8] | committer: Rémi Denis-Courmont

audio_format: stick to single precision arithmethic (except for FL64)

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

 modules/audio_filter/converter/format.c |   14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/modules/audio_filter/converter/format.c b/modules/audio_filter/converter/format.c
index c7777a5..bb55252 100644
--- a/modules/audio_filter/converter/format.c
+++ b/modules/audio_filter/converter/format.c
@@ -185,7 +185,7 @@ static block_t *S16toFl32(filter_t *filter, block_t *bsrc)
          * of 19 seconds for the above division. */
         union { float f; int32_t i; } u;
         u.i = *src++ + 0x43c00000;
-        *dst++ = u.f - 384.0;
+        *dst++ = u.f - 384.f;
     }
 #endif
 out:
@@ -265,7 +265,7 @@ static block_t *Fl32toS16(filter_t *filter, block_t *b)
 #else
         /* This is Walken's trick based on IEEE float format. */
         union { float f; int32_t i; } u;
-        u.f = *src++ + 384.0;
+        u.f = *src++ + 384.f;
         if (u.i > 0x43c07fff)
             *dst++ = 32767;
         else if (u.i < 0x43bf8000)
@@ -375,11 +375,11 @@ static block_t *Fl64toU8(filter_t *filter, block_t *b)
     uint8_t *dst = (uint8_t *)src;
     for (size_t i = b->i_buffer / 8; i--;)
     {
-        float s = *(src++) * 128.f;
-        if (s >= 127.)
+        float s = *(src++) * 128.;
+        if (s >= 127.f)
             *(dst++) = 255;
         else
-        if (s <= -128.)
+        if (s <= -128.f)
             *(dst++) = 0;
         else
             *(dst++) = lround(s) + 128;
@@ -426,10 +426,10 @@ static block_t *Fl64toS32(filter_t *filter, block_t *b)
     for (size_t i = b->i_buffer / 8; i--;)
     {
         float s = *(src++) * 2147483648.;
-        if (s >= 2147483647.)
+        if (s >= 2147483647.f)
             *(dst++) = 2147483647;
         else
-        if (s <= -2147483648.)
+        if (s <= -2147483648.f)
             *(dst++) = -2147483648;
         else
             *(dst++) = lround(s);



More information about the vlc-commits mailing list