From 5ebcb1f52a169a2c2b190025144ca9608b786491 Mon Sep 17 00:00:00 2001 From: drowe67 Date: Tue, 7 Feb 2012 01:21:37 +0000 Subject: [PATCH] compiling OK, making a few mods git-svn-id: https://svn.code.sf.net/p/freetel/code@312 01035d8c-6547-0410-b346-abe4f91aad63 --- codec2-dev/unittest/vq_train_jvm.c | 448 +++++++++++++++++++++++++++++ 1 file changed, 448 insertions(+) create mode 100755 codec2-dev/unittest/vq_train_jvm.c diff --git a/codec2-dev/unittest/vq_train_jvm.c b/codec2-dev/unittest/vq_train_jvm.c new file mode 100755 index 00000000..a3f5b51b --- /dev/null +++ b/codec2-dev/unittest/vq_train_jvm.c @@ -0,0 +1,448 @@ +/*---------------------------------------------------------------------------*\ + + FILE........: vq_train_jvm.c + AUTHOR......: Jean-Marc Valin + DATE CREATED: 21 Jan 2012 + + Multi-stage Vector Quantoser training program developed by Jean-Marc at + linux.conf.au 2012. Minor mods by David Rowe + +\*---------------------------------------------------------------------------*/ + +/* + Copyright (C) 2012 Jean-Marc Valin + + All rights reserved. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License version 2, as + published by the Free Software Foundation. This program is + distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public + License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program; if not, see . +*/ + + +#include + +#include +#include +#include +#include + +#define MIN(a,b) ((a)<(b)?(a):(b)) +#define COEF 0.70f +#define MAX_ENTRIES 16384 + +void compute_weights(const float *x, float *w, int ndim) +{ + int i; + w[0] = MIN(x[0], x[1]-x[0]); + for (i=1;i