shithub: opus

Download patch

ref: 37f56593a20242a08b5315d3b78820f6dc060996
parent: 9621e7113d6bfbaee51a91891c307b1e1993168e
author: Gregory Maxwell <[email protected]>
date: Tue Jul 17 13:40:55 EDT 2012

Convert some double constants to float.

--- a/celt/kiss_fft.c
+++ b/celt/kiss_fft.c
@@ -559,7 +559,7 @@
 
         st->nfft=nfft;
 #ifndef FIXED_POINT
-        st->scale = 1./nfft;
+        st->scale = 1.f/nfft;
 #endif
         if (base != NULL)
         {
--- a/src/opus_decoder.c
+++ b/src/opus_decoder.c
@@ -453,7 +453,7 @@
          pcm[i] = SAT16(pcm[i] + pcm_silk[i]);
 #else
       for (i=0;i<frame_size*st->channels;i++)
-         pcm[i] = pcm[i] + (opus_val16)((1./32768.)*pcm_silk[i]);
+         pcm[i] = pcm[i] + (opus_val16)((1.f/32768.f)*pcm_silk[i]);
 #endif
    }
 
--- a/src/opus_encoder.c
+++ b/src/opus_encoder.c
@@ -307,11 +307,11 @@
     opus_val32 inval;
     opus_val32 A[2], B[3];
 
-    A[0] = (opus_val32)(A_Q28[0] * (1./((opus_int32)1<<28)));
-    A[1] = (opus_val32)(A_Q28[1] * (1./((opus_int32)1<<28)));
-    B[0] = (opus_val32)(B_Q28[0] * (1./((opus_int32)1<<28)));
-    B[1] = (opus_val32)(B_Q28[1] * (1./((opus_int32)1<<28)));
-    B[2] = (opus_val32)(B_Q28[2] * (1./((opus_int32)1<<28)));
+    A[0] = (opus_val32)(A_Q28[0] * (1.f/((opus_int32)1<<28)));
+    A[1] = (opus_val32)(A_Q28[1] * (1.f/((opus_int32)1<<28)));
+    B[0] = (opus_val32)(B_Q28[0] * (1.f/((opus_int32)1<<28)));
+    B[1] = (opus_val32)(B_Q28[1] * (1.f/((opus_int32)1<<28)));
+    B[2] = (opus_val32)(B_Q28[2] * (1.f/((opus_int32)1<<28)));
 
     /* Negate A_Q28 values and split in two parts */
 
@@ -1079,8 +1079,8 @@
             g1 = g1==16384 ? Q15ONE : SHL16(g1,1);
             g2 = g2==16384 ? Q15ONE : SHL16(g2,1);
 #else
-            g1 *= (1./16384);
-            g2 *= (1./16384);
+            g1 *= (1.f/16384);
+            g2 *= (1.f/16384);
 #endif
             stereo_fade(pcm_buf, pcm_buf, g1, g2, celt_mode->overlap,
                   frame_size, st->channels, celt_mode->window, st->Fs);
--- a/src/opus_multistream.c
+++ b/src/opus_multistream.c
@@ -348,7 +348,7 @@
    ALLOC(in, frame_size*st->layout.nb_channels, float);
 
    for (i=0;i<frame_size*st->layout.nb_channels;i++)
-      in[i] = (1./32768)*pcm[i];
+      in[i] = (1.f/32768.f)*pcm[i];
    ret = opus_multistream_encode_float(st, in, frame_size, data, max_data_bytes);
    RESTORE_STACK;
    return ret;
@@ -733,7 +733,7 @@
    if (ret > 0)
    {
       for (i=0;i<ret*st->layout.nb_channels;i++)
-         pcm[i] = (1./32768.)*(out[i]);
+         pcm[i] = (1.f/32768.f)*(out[i]);
    }
    RESTORE_STACK;
    return ret;