/*---------------------------------------------------------------------------*\ 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 . */ #ifdef VALGRIND #include #endif #include #include #include #include #define MIN(a,b) ((a)<(b)?(a):(b)) #define COEF 0.0f #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