~ubuntu-branches/ubuntu/saucy/iaxmodem/saucy

« back to all changes in this revision

Viewing changes to lib/spandsp/src/spandsp/lpc10.h

  • Committer: Bazaar Package Importer
  • Author(s): Julien BLACHE
  • Date: 2006-10-28 10:54:55 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20061028105455-qdnaih9tmq0uc29w
Tags: 0.1.15~dfsg-1
* New upstream release.
* debian/rules:
  + Use new ~dfsg versionning scheme.
  + Do not remove config.* in get-orig-source.
* debian/patches/11_build_configure-stamp.dpatch:
  + Updated.
* debian/iaxmodem.init:
  + Added LSB header.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * SpanDSP - a series of DSP components for telephony
 
3
 *
 
4
 * lpc10.h - LPC10 low bit rate speech codec.
 
5
 *
 
6
 * Written by Steve Underwood <steveu@coppice.org>
 
7
 *
 
8
 * Copyright (C) 2006 Steve Underwood
 
9
 *
 
10
 * All rights reserved.
 
11
 *
 
12
 * This program is free software; you can redistribute it and/or modify
 
13
 * it under the terms of the GNU General Public License as published by
 
14
 * the Free Software Foundation; either version 2 of the License, or
 
15
 * (at your option) any later version.
 
16
 *
 
17
 * This program is distributed in the hope that it will be useful,
 
18
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
19
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
20
 * GNU General Public License for more details.
 
21
 *
 
22
 * You should have received a copy of the GNU General Public License
 
23
 * along with this program; if not, write to the Free Software
 
24
 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
25
 *
 
26
 * $Id: lpc10.h,v 1.2 2006/09/14 12:16:41 steveu Exp $
 
27
 */
 
28
 
 
29
#if !defined(_LPC10_H_)
 
30
#define _LPC10_H_
 
31
 
 
32
/*! \page lpc10_page LPC10 encoding and decoding
 
33
\section lpc10_page_sec_1 What does it do?
 
34
 
 
35
\section lpc10_page_sec_2 How does it work?
 
36
???.
 
37
*/
 
38
 
 
39
#define LPC10_SAMPLES_PER_FRAME 180
 
40
#define LPC10_BITS_IN_COMPRESSED_FRAME 54
 
41
 
 
42
/*!
 
43
    LPC10 codec encoder state descriptor. This defines the state of
 
44
    a single working instance of the LPC10 encoder.
 
45
*/
 
46
typedef struct
 
47
{
 
48
    int error_correction;
 
49
 
 
50
    /* State used only by function hp100 */
 
51
    float z11;
 
52
    float z21;
 
53
    float z12;
 
54
    float z22;
 
55
    
 
56
    /* State used by function analys */
 
57
    float inbuf[LPC10_SAMPLES_PER_FRAME*3];
 
58
    float pebuf[LPC10_SAMPLES_PER_FRAME*3];
 
59
    float lpbuf[696];
 
60
    float ivbuf[312];
 
61
    float bias;
 
62
    int32_t osbuf[10];  /* no initial value necessary */
 
63
    int32_t osptr;      /* initial value 1 */
 
64
    int32_t obound[3];
 
65
    int32_t vwin[6];    /* was [2][3] */   /* initial value vwin[4] = 307; vwin[5] = 462; */
 
66
    int32_t awin[6];    /* was [2][3] */   /* initial value awin[4] = 307; awin[5] = 462; */
 
67
    int32_t voibuf[8];  /* was [2][4] */
 
68
    float rmsbuf[3];
 
69
    float rcbuf[30];    /* was [10][3] */
 
70
    float zpre;
 
71
 
 
72
 
 
73
    /* State used by function onset */
 
74
    float n;
 
75
    float d__;          /* initial value 1.0f */
 
76
    float fpc;          /* no initial value necessary */
 
77
    float l2buf[16];
 
78
    float l2sum1;
 
79
    int32_t l2ptr1;     /* initial value 1 */
 
80
    int32_t l2ptr2;     /* initial value 9 */
 
81
    int32_t lasti;      /* no initial value necessary */
 
82
    int hyst;           /* initial value FALSE */
 
83
 
 
84
    /* State used by function voicin */
 
85
    float dither;       /* initial value 20.0f */
 
86
    float snr;
 
87
    float maxmin;
 
88
    float voice[6]           /* was [2][3] */;   /* initial value is probably unnecessary */
 
89
    int32_t lbve;
 
90
    int32_t lbue;
 
91
    int32_t fbve;
 
92
    int32_t fbue;
 
93
    int32_t ofbue;
 
94
    int32_t sfbue;
 
95
    int32_t olbue;
 
96
    int32_t slbue;
 
97
 
 
98
    /* State used by function dyptrk */
 
99
    float s[60];
 
100
    int32_t p[120]           /* was [60][2] */;
 
101
    int32_t ipoint;
 
102
    float alphax;
 
103
 
 
104
    /* State used by function chanwr */
 
105
    int32_t isync;
 
106
} lpc10_encode_state_t;
 
107
 
 
108
/*!
 
109
    LPC10 codec deocder state descriptor. This defines the state of
 
110
    a single working instance of the LPC10 decoder.
 
111
*/
 
112
typedef struct
 
113
{
 
114
    int error_correction;
 
115
 
 
116
    /* State used by function decode */
 
117
    int32_t iptold;     /* initial value 60 */
 
118
    int first;          /* initial value TRUE */
 
119
    int32_t ivp2h;
 
120
    int32_t iovoic;
 
121
    int32_t iavgp;      /* initial value 60 */
 
122
    int32_t erate;
 
123
    int32_t drc[10][3];
 
124
    int32_t dpit[3];
 
125
    int32_t drms[3];
 
126
 
 
127
    /* State used by function synths */
 
128
    float buf[LPC10_SAMPLES_PER_FRAME*2];
 
129
    int32_t buflen;     /* initial value LPC10_SAMPLES_PER_FRAME */
 
130
 
 
131
    /* State used by function pitsyn */
 
132
    int32_t ivoico;     /* no initial value necessary as long as first_pitsyn is initially TRUE_ */
 
133
    int32_t ipito;      /* no initial value necessary as long as first_pitsyn is initially TRUE_ */
 
134
    float rmso;         /* initial value 1.0f */
 
135
    float rco[10];      /* no initial value necessary as long as first_pitsyn is initially TRUE_ */
 
136
    int32_t jsamp;      /* no initial value necessary as long as first_pitsyn is initially TRUE_ */
 
137
    int first_pitsyn;   /* initial value TRUE_ */
 
138
 
 
139
    /* State used by function bsynz */
 
140
    int32_t ipo;
 
141
    float exc[166];
 
142
    float exc2[166];
 
143
    float lpi[3];
 
144
    float hpi[3];
 
145
    float rmso_bsynz;
 
146
 
 
147
    /* State used by function random */
 
148
    int32_t j;
 
149
    int32_t k;
 
150
    int16_t y[5];
 
151
 
 
152
    /* State used by function deemp */
 
153
    float dei[2];
 
154
    float deo[3];
 
155
} lpc10_decode_state_t;
 
156
 
 
157
#ifdef __cplusplus
 
158
extern "C" {
 
159
#endif
 
160
 
 
161
lpc10_encode_state_t *lpc10_encode_init(lpc10_encode_state_t *s, int error_correction);
 
162
int lpc10_encode_release(lpc10_encode_state_t *s);
 
163
int lpc10_encode(lpc10_encode_state_t *s, uint8_t code[], const int16_t amp[], int quant);
 
164
 
 
165
lpc10_decode_state_t *lpc10_decode_init(lpc10_decode_state_t *st, int error_correction);
 
166
int lpc10_decode_release(lpc10_decode_state_t *s);
 
167
int lpc10_decode(lpc10_decode_state_t *s, int16_t amp[], const uint8_t code[], int quant);
 
168
 
 
169
 
 
170
#ifdef __cplusplus
 
171
}
 
172
#endif
 
173
 
 
174
#endif
 
175
/*- End of include ---------------------------------------------------------*/