Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(83)

Unified Diff: src/mlp_train.h

Issue 28553003: Updating Opus to a pre-release of 1.1 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/opus
Patch Set: Removing failing file Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/mlp_data.c ('k') | src/mlp_train.c » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/mlp_train.h
diff --git a/celt/celt_lpc.h b/src/mlp_train.h
similarity index 50%
copy from celt/celt_lpc.h
copy to src/mlp_train.h
index 2baa77edf8b8226634d726365988a32315f1b55c..1857f64449bf2bb5770bc56885febf7a5d942075 100644
--- a/celt/celt_lpc.h
+++ b/src/mlp_train.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2009-2010 Xiph.Org Foundation
+/* Copyright (c) 2008-2011 Octasic Inc.
Written by Jean-Marc Valin */
/*
Redistribution and use in source and binary forms, with or without
@@ -15,8 +15,8 @@
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
- OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
@@ -25,29 +25,62 @@
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef PLC_H
-#define PLC_H
+#ifndef _MLP_TRAIN_H_
+#define _MLP_TRAIN_H_
-#include "arch.h"
+#include <math.h>
+#include <stdlib.h>
-#define LPC_ORDER 24
+double tansig_table[501];
+static inline double tansig_double(double x)
+{
+ return 2./(1.+exp(-2.*x)) - 1.;
+}
+static inline void build_tansig_table()
+{
+ int i;
+ for (i=0;i<501;i++)
+ tansig_table[i] = tansig_double(.04*(i-250));
+}
-void _celt_lpc(opus_val16 *_lpc, const opus_val32 *ac, int p);
+static inline double tansig_approx(double x)
+{
+ int i;
+ double y, dy;
+ if (x>=10)
+ return 1;
+ if (x<=-10)
+ return -1;
+ i = lrint(25*x);
+ x -= .04*i;
+ y = tansig_table[250+i];
+ dy = 1-y*y;
+ y = y + x*dy*(1 - y*x);
+ return y;
+}
-void celt_fir(const opus_val16 *x,
- const opus_val16 *num,
- opus_val16 *y,
- int N,
- int ord,
- opus_val16 *mem);
+inline float randn(float sd)
+{
+ float U1, U2, S, x;
+ do {
+ U1 = ((float)rand())/RAND_MAX;
+ U2 = ((float)rand())/RAND_MAX;
+ U1 = 2*U1-1;
+ U2 = 2*U2-1;
+ S = U1*U1 + U2*U2;
+ } while (S >= 1 || S == 0.0f);
+ x = sd*sqrt(-2 * log(S) / S) * U1;
+ return x;
+}
-void celt_iir(const opus_val32 *x,
- const opus_val16 *den,
- opus_val32 *y,
- int N,
- int ord,
- opus_val16 *mem);
-void _celt_autocorr(const opus_val16 *x, opus_val32 *ac, const opus_val16 *window, int overlap, int lag, int n);
+typedef struct {
+ int layers;
+ int *topo;
+ double **weights;
+ double **best_weights;
+ double *in_rate;
+} MLPTrain;
-#endif /* PLC_H */
+
+#endif /* _MLP_TRAIN_H_ */
« no previous file with comments | « src/mlp_data.c ('k') | src/mlp_train.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698