~ubuntu-branches/ubuntu/vivid/linphone/vivid

« back to all changes in this revision

Viewing changes to speex/libspeex/speex_preprocess.h

  • Committer: Bazaar Package Importer
  • Author(s): Samuel Mimram
  • Date: 2006-11-15 10:34:50 UTC
  • mfrom: (1.2.1 upstream) (2.1.8 feisty)
  • Revision ID: james.westby@ubuntu.com-20061115103450-qgafwcks2lkhctlj
* New upstream release.
* Enable video support.
* Fix mismatched #endif in mscommon.h, closes: #398307.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* Copyright (C) 2003 Epic Games 
2
 
   Written by Jean-Marc Valin
3
 
 
4
 
   File: speex_preprocess.h
5
 
 
6
 
 
7
 
   Redistribution and use in source and binary forms, with or without
8
 
   modification, are permitted provided that the following conditions are
9
 
   met:
10
 
 
11
 
   1. Redistributions of source code must retain the above copyright notice,
12
 
   this list of conditions and the following disclaimer.
13
 
 
14
 
   2. Redistributions in binary form must reproduce the above copyright
15
 
   notice, this list of conditions and the following disclaimer in the
16
 
   documentation and/or other materials provided with the distribution.
17
 
 
18
 
   3. The name of the author may not be used to endorse or promote products
19
 
   derived from this software without specific prior written permission.
20
 
 
21
 
   THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
22
 
   IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
23
 
   OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
24
 
   DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
25
 
   INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
26
 
   (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
27
 
   SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28
 
   HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
29
 
   STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
30
 
   ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31
 
   POSSIBILITY OF SUCH DAMAGE.
32
 
*/
33
 
 
34
 
 
35
 
#ifdef __cplusplus
36
 
extern "C" {
37
 
#endif
38
 
 
39
 
struct drft_lookup;
40
 
 
41
 
typedef struct SpeexPreprocessState {
42
 
   int    frame_size;        /**< Number of samples processed each time */
43
 
   int    ps_size;           /**< Number of points in the power spectrum */
44
 
   int    sampling_rate;     /**< Sampling rate of the input/output */
45
 
   
46
 
   /* parameters */
47
 
   int    denoise_enabled;
48
 
   int    agc_enabled;
49
 
   float  agc_level;
50
 
   int    vad_enabled;
51
 
 
52
 
   float *frame;             /**< Processing frame (2*ps_size) */
53
 
   float *ps;                /**< Current power spectrum */
54
 
   float *gain2;             /**< Adjusted gains */
55
 
   float *window;            /**< Analysis/Synthesis window */
56
 
   float *noise;             /**< Noise estimate */
57
 
   float *old_ps;            /**< Power spectrum for last frame */
58
 
   float *gain;              /**< Ephraim Malah gain */
59
 
   float *prior;             /**< A-priori SNR */
60
 
   float *post;              /**< A-posteriori SNR */
61
 
 
62
 
   float *S;                 /**< Smoothed power spectrum */
63
 
   float *Smin;              /**< See Cohen paper */
64
 
   float *Stmp;              /**< See Cohen paper */
65
 
   float *update_prob;       /**< Propability of speech presence for noise update */
66
 
 
67
 
   float *zeta;              /**< Smoothed a priori SNR */
68
 
   float  Zpeak;
69
 
   float  Zlast;
70
 
 
71
 
   float *loudness_weight;   /**< Perceptual loudness curve */
72
 
 
73
 
   float *echo_noise;
74
 
 
75
 
   float *noise_bands;
76
 
   float *noise_bands2;
77
 
   int    noise_bandsN;
78
 
   float *speech_bands;
79
 
   float *speech_bands2;
80
 
   int    speech_bandsN;
81
 
 
82
 
   float *inbuf;             /**< Input buffer (overlapped analysis) */
83
 
   float *outbuf;            /**< Output buffer (for overlap and add) */
84
 
 
85
 
   float  speech_prob;
86
 
   int    last_speech;
87
 
   float  loudness;          /**< loudness estimate */
88
 
   float  loudness2;         /**< loudness estimate */
89
 
   int    nb_adapt;          /**< Number of frames used for adaptation so far */
90
 
   int    nb_loudness_adapt; /**< Number of frames used for loudness adaptation so far */
91
 
   int    consec_noise;      /**< Number of consecutive noise frames */
92
 
   int    nb_preprocess;     /**< Number of frames processed so far */
93
 
   struct drft_lookup *fft_lookup;   /**< Lookup table for the FFT */
94
 
 
95
 
} SpeexPreprocessState;
96
 
 
97
 
/** Creates a new preprocessing state */
98
 
SpeexPreprocessState *speex_preprocess_state_init(int frame_size, int sampling_rate);
99
 
 
100
 
/** Destroys a denoising state */
101
 
void speex_preprocess_state_destroy(SpeexPreprocessState *st);
102
 
 
103
 
/** Preprocess a frame */
104
 
int speex_preprocess(SpeexPreprocessState *st, short *x, float *noise);
105
 
 
106
 
/** Preprocess a frame */
107
 
void speex_preprocess_estimate_update(SpeexPreprocessState *st, short *x, float *noise);
108
 
 
109
 
/** Used like the ioctl function to control the preprocessor parameters */
110
 
int speex_preprocess_ctl(SpeexPreprocessState *st, int request, void *ptr);
111
 
 
112
 
 
113
 
 
114
 
#define SPEEX_PREPROCESS_SET_DENOISE 0
115
 
#define SPEEX_PREPROCESS_GET_DENOISE 1
116
 
 
117
 
#define SPEEX_PREPROCESS_SET_AGC 2
118
 
#define SPEEX_PREPROCESS_GET_AGC 3
119
 
 
120
 
#define SPEEX_PREPROCESS_SET_VAD 4
121
 
#define SPEEX_PREPROCESS_GET_VAD 5
122
 
 
123
 
#define SPEEX_PREPROCESS_SET_AGC_LEVEL 6
124
 
#define SPEEX_PREPROCESS_GET_AGC_LEVEL 7
125
 
 
126
 
#ifdef __cplusplus
127
 
}
128
 
#endif