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 Lesser General Public License version 2.1,
00014  * as published by the Free Software Foundation.
00015  *
00016  * This program is distributed in the hope that it will be useful,
00017  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00018  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00019  * GNU Lesser General Public License for more details.
00020  *
00021  * You should have received a copy of the GNU Lesser General Public
00022  * License along with this program; if not, write to the Free Software
00023  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00024  */
00025 
00026 /*! \file */
00027 
00028 /* This code is based on some demonstration code in a research
00029    paper somewhere. I can't track down where I got the original from,
00030    so that due recognition can be given. The original had no explicit
00031    copyright notice, and I hope nobody objects to its use here.
00032    
00033    Having a reasonable Gaussian noise generator is pretty important for
00034    telephony testing (in fact, pretty much any DSP testing), and this
00035    one seems to have served me OK. Since the generation of Gaussian
00036    noise is only for test purposes, and not a core system component,
00037    I don't intend to worry excessively about copyright issues, unless
00038    someone worries me.
00039         
00040    The non-core nature of this code also explains why it is unlikely
00041    to ever be optimised. */
00042 
00043 #if !defined(_SPANDSP_AWGN_H_)
00044 #define _SPANDSP_AWGN_H_
00045 
00046 /*! \page awgn_page Additive white gaussian noise (AWGN) generation
00047 
00048 \section awgn_page_sec_1 What does it do?
00049 Adding noise is not the most useful thing in most DSP applications, but it is
00050 awfully useful for test suites. 
00051 
00052 \section awgn_page_sec_2 How does it work?
00053 
00054 This code is based on some demonstration code in a research paper somewhere. I
00055 can't track down where I got the original from, so that due recognition can be
00056 given. The original had no explicit copyright notice, and I hope nobody objects
00057 to its use here. 
00058 
00059 Having a reasonable Gaussian noise generator is pretty important for telephony
00060 testing (in fact, pretty much any DSP testing), and this one seems to have
00061 served me OK. Since the generation of Gaussian noise is only for test purposes,
00062 and not a core system component, I don't intend to worry excessively about
00063 copyright issues, unless someone worries me. 
00064 
00065 The non-core nature of this code also explains why it is unlikely to ever be
00066 optimised.
00067 */
00068 
00069 /*!
00070     AWGN generator descriptor. This contains all the state information for an AWGN generator.
00071  */
00072 typedef struct awgn_state_s awgn_state_t;
00073 
00074 #if defined(__cplusplus)
00075 extern "C"
00076 {
00077 #endif
00078 
00079 SPAN_DECLARE(awgn_state_t *) awgn_init_dbm0(awgn_state_t *s, int idum, float level);
00080 
00081 SPAN_DECLARE(awgn_state_t *) awgn_init_dbov(awgn_state_t *s, int idum, float level);
00082 
00083 SPAN_DECLARE(int) awgn_release(awgn_state_t *s);
00084 
00085 SPAN_DECLARE(int) awgn_free(awgn_state_t *s);
00086 
00087 SPAN_DECLARE(int16_t) awgn(awgn_state_t *s);
00088 
00089 #if defined(__cplusplus)
00090 }
00091 #endif
00092 
00093 #endif
00094 /*- End of file ------------------------------------------------------------*/