libvoipcodecs 0.0.1
helpfun.h
1/*
2 * iLBC - a library for the iLBC codec
3 *
4 * helpfun.h - The iLBC low bit rate speech codec.
5 *
6 * Adapted by Steve Underwood <steveu@coppice.org> from the reference
7 * iLBC code supplied in RFC3951.
8 *
9 * Original code Copyright (C) The Internet Society (2004).
10 * All changes to produce this version Copyright (C) 2008 by Steve Underwood
11 * All Rights Reserved.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16 *
17 * $Id: helpfun.h,v 1.2 2008/03/06 12:27:38 steveu Exp $
18 */
19
20#ifndef __iLBC_HELPFUN_H
21#define __iLBC_HELPFUN_H
22
23void autocorr(float *r, /* (o) autocorrelation vector */
24 const float *x, /* (i) data vector */
25 int N, /* (i) length of data vector */
26 int order); /* largest lag for calculated
27 autocorrelations */
28
29void window(float *z, /* (o) the windowed data */
30 const float *x, /* (i) the original data vector */
31 const float *y, /* (i) the window */
32 int N); /* (i) length of all vectors */
33
34void levdurb(float *a, /* (o) lpc coefficient vector starting with 1.0 */
35 float *k, /* (o) reflection coefficients */
36 float *r, /* (i) autocorrelation vector */
37 int order); /* (i) order of lpc filter */
38
39void interpolate(float *out, /* (o) the interpolated vector */
40 float *in1, /* (i) the first vector for the
41 interpolation */
42 float *in2, /* (i) the second vector for the
43 interpolation */
44 float coef, /* (i) interpolation weights */
45 int length); /* (i) length of all vectors */
46
47void bwexpand(float *out, /* (o) the bandwidth expanded lpc coefficients */
48 float *in, /* (i) the lpc coefficients before bandwidth
49 expansion */
50 float coef, /* (i) the bandwidth expansion factor */
51 int length); /* (i) the length of lpc coefficient vectors */
52
53void vq(float *Xq, /* (o) the quantized vector */
54 int *index, /* (o) the quantization index */
55 const float *CB, /* (i) the vector quantization codebook */
56 float *X, /* (i) the vector to quantize */
57 int n_cb, /* (i) the number of vectors in the codebook */
58 int dim); /* (i) the dimension of all vectors */
59
60void SplitVQ(float *qX, /* (o) the quantized vector */
61 int *index, /* (o) a vector of indexes for all vector
62 codebooks in the split */
63 float *X, /* (i) the vector to quantize */
64 const float *CB, /* (i) the quantizer codebook */
65 int nsplit, /* the number of vector splits */
66 const int *dim, /* the dimension of X and qX */
67 const int *cbsize); /* the number of vectors in the codebook */
68
69void sort_sq(float *xq, /* (o) the quantized value */
70 int *index, /* (o) the quantization index */
71 float x, /* (i) the value to quantize */
72 const float *cb, /* (i) the quantization codebook */
73 int cb_size); /* (i) the size of the quantization codebook */
74
75int LSF_check( /* (o) 1 for stable lsf vectors and 0 for nonstable ones */
76 float *lsf, /* (i) a table of lsf vectors */
77 int dim, /* (i) the dimension of each lsf vector */
78 int NoAn); /* (i) the number of lsf vectors in the table */
79
80#endif