awgn.h

Go to the documentation of this file.
00001 /*
00002  * SpanDSP - a series of DSP components for telephony
00003  *
00004  * awgn.h - An additive Gaussian white noise generator
00005  *
00006  * Written by Steve Underwood <steveu@coppice.org>
00007  *
00008  * Copyright (C) 2001 Steve Underwood
00009  *
00010  * All rights reserved.
00011  *
00012  * This program is free software; you can redistribute it and/or modify
00013  * it under the terms of the GNU General Public License as published by
00014  * the Free Software Foundation; either version 2 of the License, or
00015  * (at your option) any later version.
00016  *
00017  * This program is distributed in the hope that it will be useful,
00018  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00019  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00020  * GNU General Public License for more details.
00021  *
00022  * You should have received a copy of the GNU General Public License
00023  * along with this program; if not, write to the Free Software
00024  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00025  *
00026  * $Id: awgn.h,v 1.5 2005/11/29 14:30:43 steveu Exp $
00027  */
00028 
00029 /*! \file */
00030 
00031 /* This code is based on some demonstration code in a research
00032    paper somewhere. I can't track down where I got the original from,
00033    so that due recognition can be given. The original had no explicit
00034    copyright notice, and I hope nobody objects to its use here.
00035    
00036    Having a reasonable Gaussian noise generator is pretty important for
00037    telephony testing (in fact, pretty much any DSP testing), and this
00038    one seems to have served me OK. Since the generation of Gaussian
00039    noise is only for test purposes, and not a core system component,
00040    I don't intend to worry excessively about copyright issues, unless
00041    someone worries me.
00042         
00043    The non-core nature of this code also explains why it is unlikely
00044    to ever be optimised. */
00045 
00046 #if !defined(_AWGN_H_)
00047 #define _AWGN_H_
00048 
00049 /*! \page awgn_page Additive white gaussian noise (AWGN) generation
00050 
00051 \section awgn_page_sec_1 What does it do?
00052 Adding noise is not the most useful thing in most DSP applications, but it is
00053 awfully useful for test suites. 
00054 
00055 \section awgn_page_sec_2 How does it work?
00056 
00057 This code is based on some demonstration code in a research paper somewhere. I
00058 can't track down where I got the original from, so that due recognition can be
00059 given. The original had no explicit copyright notice, and I hope nobody objects
00060 to its use here. 
00061 
00062 Having a reasonable Gaussian noise generator is pretty important for telephony
00063 testing (in fact, pretty much any DSP testing), and this one seems to have
00064 served me OK. Since the generation of Gaussian noise is only for test purposes,
00065 and not a core system component, I don't intend to worry excessively about
00066 copyright issues, unless someone worries me. 
00067 
00068 The non-core nature of this code also explains why it is unlikely to ever be
00069 optimised.
00070 */
00071 
00072 /*!
00073     AWGN generator descriptor. This contains all the state information for an AWGN generator.
00074  */
00075 typedef struct
00076 {
00077     double rms;
00078     long int ix1;
00079     long int ix2;
00080     long int ix3;
00081     double r[98];
00082     double gset;
00083     int iset;
00084 } awgn_state_t;
00085 
00086 #ifdef __cplusplus
00087 extern "C" {
00088 #endif
00089 
00090 void awgn_init(awgn_state_t *s, int idum, int level);
00091 int16_t awgn(awgn_state_t *s);
00092 
00093 #ifdef __cplusplus
00094 }
00095 #endif
00096 
00097 #endif
00098 /*- End of file ------------------------------------------------------------*/

Generated on Fri Nov 10 09:40:23 2006 for libspandsp by  doxygen 1.5.1