Mercurial > hg > audiostuff
comparison spandsp-0.0.3/spandsp-0.0.3/src/spandsp/awgn.h @ 5:f762bf195c4b
import spandsp-0.0.3
| author | Peter Meerwald <pmeerw@cosy.sbg.ac.at> |
|---|---|
| date | Fri, 25 Jun 2010 16:00:21 +0200 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| 4:26cd8f1ef0b1 | 5:f762bf195c4b |
|---|---|
| 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 General Public License version 2, as | |
| 14 * 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 General Public License for more details. | |
| 20 * | |
| 21 * You should have received a copy of the GNU General Public License | |
| 22 * along with this program; if not, write to the Free Software | |
| 23 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | |
| 24 * | |
| 25 * $Id: awgn.h,v 1.8 2006/10/24 13:45:27 steveu Exp $ | |
| 26 */ | |
| 27 | |
| 28 /*! \file */ | |
| 29 | |
| 30 /* This code is based on some demonstration code in a research | |
| 31 paper somewhere. I can't track down where I got the original from, | |
| 32 so that due recognition can be given. The original had no explicit | |
| 33 copyright notice, and I hope nobody objects to its use here. | |
| 34 | |
| 35 Having a reasonable Gaussian noise generator is pretty important for | |
| 36 telephony testing (in fact, pretty much any DSP testing), and this | |
| 37 one seems to have served me OK. Since the generation of Gaussian | |
| 38 noise is only for test purposes, and not a core system component, | |
| 39 I don't intend to worry excessively about copyright issues, unless | |
| 40 someone worries me. | |
| 41 | |
| 42 The non-core nature of this code also explains why it is unlikely | |
| 43 to ever be optimised. */ | |
| 44 | |
| 45 #if !defined(_AWGN_H_) | |
| 46 #define _AWGN_H_ | |
| 47 | |
| 48 /*! \page awgn_page Additive white gaussian noise (AWGN) generation | |
| 49 | |
| 50 \section awgn_page_sec_1 What does it do? | |
| 51 Adding noise is not the most useful thing in most DSP applications, but it is | |
| 52 awfully useful for test suites. | |
| 53 | |
| 54 \section awgn_page_sec_2 How does it work? | |
| 55 | |
| 56 This code is based on some demonstration code in a research paper somewhere. I | |
| 57 can't track down where I got the original from, so that due recognition can be | |
| 58 given. The original had no explicit copyright notice, and I hope nobody objects | |
| 59 to its use here. | |
| 60 | |
| 61 Having a reasonable Gaussian noise generator is pretty important for telephony | |
| 62 testing (in fact, pretty much any DSP testing), and this one seems to have | |
| 63 served me OK. Since the generation of Gaussian noise is only for test purposes, | |
| 64 and not a core system component, I don't intend to worry excessively about | |
| 65 copyright issues, unless someone worries me. | |
| 66 | |
| 67 The non-core nature of this code also explains why it is unlikely to ever be | |
| 68 optimised. | |
| 69 */ | |
| 70 | |
| 71 /*! | |
| 72 AWGN generator descriptor. This contains all the state information for an AWGN generator. | |
| 73 */ | |
| 74 typedef struct | |
| 75 { | |
| 76 double rms; | |
| 77 long int ix1; | |
| 78 long int ix2; | |
| 79 long int ix3; | |
| 80 double r[98]; | |
| 81 double gset; | |
| 82 int iset; | |
| 83 } awgn_state_t; | |
| 84 | |
| 85 #ifdef __cplusplus | |
| 86 extern "C" { | |
| 87 #endif | |
| 88 | |
| 89 void awgn_init_dbm0(awgn_state_t *s, int idum, float level); | |
| 90 | |
| 91 void awgn_init_dbov(awgn_state_t *s, int idum, float level); | |
| 92 | |
| 93 int16_t awgn(awgn_state_t *s); | |
| 94 | |
| 95 #ifdef __cplusplus | |
| 96 } | |
| 97 #endif | |
| 98 | |
| 99 #endif | |
| 100 /*- End of file ------------------------------------------------------------*/ |
