shithub: opus

Download patch

ref: 805fed733a5cc1eb13008ddb78403b891e909637
parent: 57f5681987bf1efd2718c712eceebf4b8e45054f
author: Jean-Marc Valin <jmvalin@amazon.com>
date: Mon Jan 24 11:29:04 EST 2022

Fix warnings

--- a/dnn/freq.c
+++ b/dnn/freq.c
@@ -127,7 +127,7 @@
 
 CommonState common;
 
-static void check_init() {
+static void check_init(void) {
   int i;
   if (common.init) return;
   common.kfft = opus_fft_alloc_twiddles(WINDOW_SIZE, NULL, NULL, NULL, 0);
--- a/dnn/lpcnet_enc.c
+++ b/dnn/lpcnet_enc.c
@@ -74,7 +74,7 @@
 }
 
 
-int vq_quantize(const float *codebook, int nb_entries, const float *x, int ndim, float *dist)
+int vq_quantize(const float *codebook, int nb_entries, const float *x, int ndim, float *dist_out)
 {
   int i, j;
   float min_dist = 1e15;
@@ -91,8 +91,8 @@
       nearest = i;
     }
   }
-  if (dist)
-    *dist = min_dist;
+  if (dist_out)
+    *dist_out = min_dist;
   return nearest;
 }
 
@@ -236,7 +236,7 @@
     return id;
 }
 
-static int find_nearest_multi(const float *codebook, int nb_entries, const float *x, int ndim, float *dist, int sign)
+static int find_nearest_multi(const float *codebook, int nb_entries, const float *x, int ndim, float *dist_out, int sign)
 {
   int i, j;
   float min_dist = 1e15;
@@ -270,8 +270,8 @@
       }
     }
   }
-  if (dist)
-    *dist = min_dist;
+  if (dist_out)
+    *dist_out = min_dist;
   return nearest;
 }
 
--- a/dnn/nnet.c
+++ b/dnn/nnet.c
@@ -170,11 +170,11 @@
    /* Computing all the random thresholds in advance. These thresholds are directly
       based on the logit to avoid computing the sigmoid.*/
    for (b=0;b<8;b+=4) {
-       uint32_t val = kiss99_rand(rng);
-       thresholds[b] = sampling_logit_table[val&0xFF];
-       thresholds[b+1] = sampling_logit_table[(val>>8)&0xFF];
-       thresholds[b+2] = sampling_logit_table[(val>>16)&0xFF];
-       thresholds[b+3] = sampling_logit_table[(val>>24)&0xFF];
+       uint32_t r = kiss99_rand(rng);
+       thresholds[b] = sampling_logit_table[r&0xFF];
+       thresholds[b+1] = sampling_logit_table[(r>>8)&0xFF];
+       thresholds[b+2] = sampling_logit_table[(r>>16)&0xFF];
+       thresholds[b+3] = sampling_logit_table[(r>>24)&0xFF];
    }
 
    for (b=0;b<8;b++)
--