spandsp  0.0.6
awgn.h
Go to the documentation of this file.
1 /*
2  * SpanDSP - a series of DSP components for telephony
3  *
4  * awgn.h - An additive Gaussian white noise generator
5  *
6  * Written by Steve Underwood <steveu@coppice.org>
7  *
8  * Copyright (C) 2001 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 Lesser General Public License version 2.1,
14  * as published by the Free Software Foundation.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU Lesser General Public License for more details.
20  *
21  * You should have received a copy of the GNU Lesser General Public
22  * License along with this program; if not, write to the Free Software
23  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24  */
25 
26 /*! \file */
27 
28 /* This code is based on some demonstration code in a research
29  paper somewhere. I can't track down where I got the original from,
30  so that due recognition can be given. The original had no explicit
31  copyright notice, and I hope nobody objects to its use here.
32 
33  Having a reasonable Gaussian noise generator is pretty important for
34  telephony testing (in fact, pretty much any DSP testing), and this
35  one seems to have served me OK. Since the generation of Gaussian
36  noise is only for test purposes, and not a core system component,
37  I don't intend to worry excessively about copyright issues, unless
38  someone worries me.
39 
40  The non-core nature of this code also explains why it is unlikely
41  to ever be optimised. */
42 
43 #if !defined(_SPANDSP_AWGN_H_)
44 #define _SPANDSP_AWGN_H_
45 
46 /*! \page awgn_page Additive white gaussian noise (AWGN) generation
47 
48 \section awgn_page_sec_1 What does it do?
49 Adding noise is not the most useful thing in most DSP applications, but it is
50 awfully useful for test suites.
51 
52 \section awgn_page_sec_2 How does it work?
53 
54 This code is based on some demonstration code in a research paper somewhere. I
55 can't track down where I got the original from, so that due recognition can be
56 given. The original had no explicit copyright notice, and I hope nobody objects
57 to its use here.
58 
59 Having a reasonable Gaussian noise generator is pretty important for telephony
60 testing (in fact, pretty much any DSP testing), and this one seems to have
61 served me OK. Since the generation of Gaussian noise is only for test purposes,
62 and not a core system component, I don't intend to worry excessively about
63 copyright issues, unless someone worries me.
64 
65 The non-core nature of this code also explains why it is unlikely to ever be
66 optimised.
67 */
68 
69 /*!
70  AWGN generator descriptor. This contains all the state information for an AWGN generator.
71  */
72 typedef struct awgn_state_s awgn_state_t;
73 
74 #if defined(__cplusplus)
75 extern "C"
76 {
77 #endif
78 
79 SPAN_DECLARE(awgn_state_t *) awgn_init_dbm0(awgn_state_t *s, int idum, float level);
80 
81 SPAN_DECLARE(awgn_state_t *) awgn_init_dbov(awgn_state_t *s, int idum, float level);
82 
83 SPAN_DECLARE(int) awgn_release(awgn_state_t *s);
84 
85 SPAN_DECLARE(int) awgn_free(awgn_state_t *s);
86 
87 SPAN_DECLARE(int16_t) awgn(awgn_state_t *s);
88 
89 #if defined(__cplusplus)
90 }
91 #endif
92 
93 #endif
94 /*- End of file ------------------------------------------------------------*/
Definition: private/awgn.h:32