[xiph-cvs] cvs commit: speex/libspeex speex_denoise.h denoise.c testdenoise.c denoise.h
Jean-Marc Valin
jm at xiph.org
Sun May 11 18:02:19 PDT 2003
jm 03/05/11 21:02:19
Modified: libspeex denoise.c testdenoise.c
Added: libspeex speex_denoise.h
Removed: libspeex denoise.h
Log:
renamed denoise.h to speex_denoise.h, removed some C++-style stuff
Revision Changes Path
1.3 +5 -7 speex/libspeex/denoise.c
Index: denoise.c
===================================================================
RCS file: /usr/local/cvsroot/speex/libspeex/denoise.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- denoise.c 8 May 2003 03:58:12 -0000 1.2
+++ denoise.c 12 May 2003 01:02:19 -0000 1.3
@@ -32,7 +32,7 @@
*/
#include <math.h>
-#include "denoise.h"
+#include "speex_denoise.h"
#include <stdio.h>
#include "misc.h"
@@ -79,6 +79,7 @@
DenoiseState *denoise_state_init(int frame_size)
{
int i;
+ int N, N3, N4;
DenoiseState *st = (DenoiseState *)speex_alloc(sizeof(DenoiseState));
st->frame_size = frame_size;
@@ -97,9 +98,9 @@
}
}
- int N = st->ps_size;
- int N3 = 2*N - st->frame_size;
- int N4 = st->frame_size - N3;
+ N = st->ps_size;
+ N3 = 2*N - st->frame_size;
+ N4 = st->frame_size - N3;
st->frame = (float*)speex_alloc(2*N*sizeof(float));
st->ps = (float*)speex_alloc(N*sizeof(float));
@@ -189,12 +190,9 @@
int denoise(DenoiseState *st, float *x)
{
- //float frame[2*N];
int i;
- //float ps[N];
float mean_post=0;
float mean_prior=0;
- //float gain2[N];
float energy;
int N = st->ps_size;
int N3 = 2*N - st->frame_size;
<p><p>1.2 +1 -1 speex/libspeex/testdenoise.c
Index: testdenoise.c
===================================================================
RCS file: /usr/local/cvsroot/speex/libspeex/testdenoise.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- testdenoise.c 8 May 2003 04:04:49 -0000 1.1
+++ testdenoise.c 12 May 2003 01:02:19 -0000 1.2
@@ -1,4 +1,4 @@
-#include "denoise.h"
+#include "speex_denoise.h"
#include <stdio.h>
#define NN 160
<p><p>1.1 speex/libspeex/speex_denoise.h
Index: speex_denoise.h
===================================================================
/* Copyright (C) 2003 Epic Games
Written by Jean-Marc Valin
File: speex_denoise.h
<p> Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
<p>#include "smallft.h"
typedef struct DenoiseState {
int frame_size; /**< Number of samples processed each time */
int ps_size; /**< Number of points in the power spectrum */
float *frame; /**< Processing frame (2*ps_size) */
float *ps; /**< Current power spectrum */
float *gain2; /**< Adjusted gains */
float *window; /**< Analysis/Synthesis window */
float *noise; /**< Noise estimate */
float *old_ps; /**< Power spectrum for last frame */
float *gain; /**< Ephraim Malah gain */
float *prior; /**< A-priori SNR */
float *post; /**< A-posteriori SNR */
float *min_ps; /**< */
float *last_energy; /**< Energy of the previous frames */
float *last_ps; /**< Power spectrum of the past frames */
int last_id; /**< */
float *inbuf; /**< Input buffer (overlapped analysis) */
float *outbuf; /**< Output buffer (for overlap and add) */
int nb_adapt; /**< Number of frames used for adaptation so far */
int consec_noise; /**< */
int nb_denoise; /**< Number of frames processed so far */
int nb_min_estimate; /**< */
int last_update; /**< */
float min_ener; /**< */
drft_lookup fft_lookup; /**< */
} DenoiseState;
/** Creates a new denoising state */
DenoiseState *denoise_state_init(int frame_size);
/** Destroys a denoising state */
void denoise_state_destroy(DenoiseState *st);
/** Denoise a frame */
int denoise(DenoiseState *st, float *x);
<p><p>--- >8 ----
List archives: http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'cvs-request at xiph.org'
containing only the word 'unsubscribe' in the body. No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.
More information about the commits
mailing list