shithub: opus

Download patch

ref: c6db01d2a6c2fa7d8f062af3311b1fa47aeac7f4
parent: 93bc94ba793810e075b403f88c17536cca309414
author: Jean-Marc Valin <jmvalin@amazon.com>
date: Tue May 23 21:24:12 EDT 2023

Misc fixes

--- a/dnn/common.h
+++ b/dnn/common.h
@@ -8,7 +8,9 @@
 #include <math.h>
 
 #define RNN_INLINE inline
+#ifndef OPUS_INLINE
 #define OPUS_INLINE inline
+#endif
 
 float lpc_from_cepstrum(float *lpc, const float *cepstrum);
 
--- a/dnn/include/dred_rdovae.h
+++ b/dnn/include/dred_rdovae.h
@@ -25,6 +25,8 @@
    SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
+#ifndef DRED_RDOVAE_H
+#define DRED_RDOVAE_H
 
 #include <stdlib.h>
 
@@ -58,3 +60,5 @@
 const opus_uint16 * DRED_rdovae_get_dead_zone_pointer(void);
 const opus_uint16 * DRED_rdovae_get_r_pointer(void);
 const opus_uint16 * DRED_rdovae_get_quant_scales_pointer(void);
+
+#endif
--- a/dnn/lpcnet_enc.c
+++ b/dnn/lpcnet_enc.c
@@ -667,7 +667,7 @@
   best_b = (sy - best_a*sx)/sw;
   /* Quantizing the pitch as "main" pitch + slope. */
   center_pitch = best_b+5.5f*best_a;
-  main_pitch = (int)floor(.5 + 21.*log2(center_pitch/PITCH_MIN_PERIOD));
+  main_pitch = (int)floor(.5 + 21.*1.442695041*log(center_pitch/PITCH_MIN_PERIOD));
   main_pitch = IMAX(0, IMIN(63, main_pitch));
   modulation = (int)floor(.5 + 16*7*best_a/center_pitch);
   modulation = IMAX(-3, IMIN(3, modulation));
--