00001 /* 00002 * iLBC - a library for the iLBC codec 00003 * 00004 * helpfun.h - The iLBC low bit rate speech codec. 00005 * 00006 * Adapted by Steve Underwood <steveu@coppice.org> from the reference 00007 * iLBC code supplied in RFC3951. 00008 * 00009 * Original code Copyright (C) The Internet Society (2004). 00010 * All changes to produce this version Copyright (C) 2008 by Steve Underwood 00011 * All Rights Reserved. 00012 * 00013 * This program is distributed in the hope that it will be useful, 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 00016 * 00017 * $Id: helpfun.h,v 1.2 2008/03/06 12:27:38 steveu Exp $ 00018 */ 00019 00020 #ifndef __iLBC_HELPFUN_H 00021 #define __iLBC_HELPFUN_H 00022 00023 void autocorr(float *r, /* (o) autocorrelation vector */ 00024 const float *x, /* (i) data vector */ 00025 int N, /* (i) length of data vector */ 00026 int order); /* largest lag for calculated 00027 autocorrelations */ 00028 00029 void window(float *z, /* (o) the windowed data */ 00030 const float *x, /* (i) the original data vector */ 00031 const float *y, /* (i) the window */ 00032 int N); /* (i) length of all vectors */ 00033 00034 void levdurb(float *a, /* (o) lpc coefficient vector starting with 1.0 */ 00035 float *k, /* (o) reflection coefficients */ 00036 float *r, /* (i) autocorrelation vector */ 00037 int order); /* (i) order of lpc filter */ 00038 00039 void interpolate(float *out, /* (o) the interpolated vector */ 00040 float *in1, /* (i) the first vector for the 00041 interpolation */ 00042 float *in2, /* (i) the second vector for the 00043 interpolation */ 00044 float coef, /* (i) interpolation weights */ 00045 int length); /* (i) length of all vectors */ 00046 00047 void bwexpand(float *out, /* (o) the bandwidth expanded lpc coefficients */ 00048 float *in, /* (i) the lpc coefficients before bandwidth 00049 expansion */ 00050 float coef, /* (i) the bandwidth expansion factor */ 00051 int length); /* (i) the length of lpc coefficient vectors */ 00052 00053 void vq(float *Xq, /* (o) the quantized vector */ 00054 int *index, /* (o) the quantization index */ 00055 const float *CB, /* (i) the vector quantization codebook */ 00056 float *X, /* (i) the vector to quantize */ 00057 int n_cb, /* (i) the number of vectors in the codebook */ 00058 int dim); /* (i) the dimension of all vectors */ 00059 00060 void SplitVQ(float *qX, /* (o) the quantized vector */ 00061 int *index, /* (o) a vector of indexes for all vector 00062 codebooks in the split */ 00063 float *X, /* (i) the vector to quantize */ 00064 const float *CB, /* (i) the quantizer codebook */ 00065 int nsplit, /* the number of vector splits */ 00066 const int *dim, /* the dimension of X and qX */ 00067 const int *cbsize); /* the number of vectors in the codebook */ 00068 00069 void sort_sq(float *xq, /* (o) the quantized value */ 00070 int *index, /* (o) the quantization index */ 00071 float x, /* (i) the value to quantize */ 00072 const float *cb, /* (i) the quantization codebook */ 00073 int cb_size); /* (i) the size of the quantization codebook */ 00074 00075 int LSF_check( /* (o) 1 for stable lsf vectors and 0 for nonstable ones */ 00076 float *lsf, /* (i) a table of lsf vectors */ 00077 int dim, /* (i) the dimension of each lsf vector */ 00078 int NoAn); /* (i) the number of lsf vectors in the table */ 00079 00080 #endif