shithub: opus

Download patch

ref: 0ddfdfc7c06203a44914f76b27f4a92b66a665c1
parent: 5ac0ac7acc06bb06c987be5a1a5e40d57ea9f4d0
author: Jean-Marc Valin <jmvalin@jmvalin.ca>
date: Tue Nov 27 07:34:39 EST 2018

Add deemphasis

--- a/dnn/lpcnet.c
+++ b/dnn/lpcnet.c
@@ -36,8 +36,8 @@
 #define NB_TOTAL_FEATURES 55
 
 #define LPC_ORDER 16
+#define PREEMPH 0.85f
 
-
 #define PITCH_GAIN_FEATURE 37
 #define PDF_FLOOR 0.002
 
@@ -53,6 +53,7 @@
     float old_input[FEATURES_DELAY][FEATURE_CONV2_OUT_SIZE];
     float old_lpc[FEATURES_DELAY][LPC_ORDER];
     int frame_count;
+    float deemph_mem;
 };
 
 
@@ -178,6 +179,8 @@
         RNN_MOVE(&lpcnet->last_sig[1], &lpcnet->last_sig[0], LPC_ORDER-1);
         lpcnet->last_sig[0] = output[i];
         lpcnet->last_exc = exc;
+        output[i] += PREEMPH*lpcnet->deemph_mem;
+        lpcnet->deemph_mem = output[i];
     }
 }
 
--