diff options
Diffstat (limited to 'src/delta.c')
-rw-r--r-- | src/delta.c | 70 |
1 files changed, 40 insertions, 30 deletions
diff --git a/src/delta.c b/src/delta.c index b1effd0..eea91d2 100644 --- a/src/delta.c +++ b/src/delta.c @@ -1,21 +1,24 @@ -/* libxtract feature extraction library - * - * Copyright (C) 2006 Jamie Bullock +/* + * Copyright (C) 2012 Jamie Bullock * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: * - * 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. + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - * USA. */ /* xtract_delta.c: defines functions that extract a feature as a single value from more than one input vector */ @@ -24,14 +27,16 @@ #include "xtract/libxtract.h" -int xtract_flux(const float *data, const int N, const void *argv , float *result){ +int xtract_flux(const float *data, const int N, const void *argv , float *result) +{ /* FIX: don't be lazy -- take the lnorm of the difference vector! */ return xtract_lnorm(data, N, argv, result); } -int xtract_lnorm(const float *data, const int N, const void *argv , float *result){ +int xtract_lnorm(const float *data, const int N, const void *argv , float *result) +{ int n, type; @@ -45,18 +50,20 @@ int xtract_lnorm(const float *data, const int N, const void *argv , float *resul *result = 0.f; - switch(type){ + switch(type) + { - case XTRACT_POSITIVE_SLOPE: - for(n = 0; n < N; n++){ - if(data[n] > 0) - *result += powf(data[n], order); - } - break; - default: - for(n = 0; n < N; n++) + case XTRACT_POSITIVE_SLOPE: + for(n = 0; n < N; n++) + { + if(data[n] > 0) *result += powf(data[n], order); - break; + } + break; + default: + for(n = 0; n < N; n++) + *result += powf(data[n], order); + break; } @@ -66,19 +73,22 @@ int xtract_lnorm(const float *data, const int N, const void *argv , float *resul } -int xtract_attack_time(const float *data, const int N, const void *argv , float *result){ +int xtract_attack_time(const float *data, const int N, const void *argv , float *result) +{ return XTRACT_FEATURE_NOT_IMPLEMENTED; } -int xtract_decay_time(const float *data, const int N, const void *argv, float *result){ +int xtract_decay_time(const float *data, const int N, const void *argv, float *result) +{ return XTRACT_FEATURE_NOT_IMPLEMENTED; } -int xtract_difference_vector(const float *data, const int N, const void *argv, float *result){ +int xtract_difference_vector(const float *data, const int N, const void *argv, float *result) +{ const float *frame1, *frame2; |