Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mumble-voip/speexdsp.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTristan Matthews <tmatth@videolan.org>2015-04-01 19:34:18 +0300
committerTristan Matthews <tmatth@videolan.org>2015-04-01 19:37:48 +0300
commit784a9236a57f5eb4cf7ebcae68bf120eed43846d (patch)
tree63099fa13b175a32192bb3050ac387ed892441ec
parent887ac103dbbd0533ed501fc3dd599c876cc0eec7 (diff)
remove trailing whitespace
-rw-r--r--doc/sampledec.c6
-rw-r--r--doc/sampleenc.c4
-rw-r--r--include/speex/speex_buffer.h2
-rw-r--r--include/speex/speex_echo.h10
-rw-r--r--include/speex/speex_jitter.h40
-rw-r--r--include/speex/speex_preprocess.h12
-rw-r--r--include/speex/speex_resampler.h116
-rw-r--r--include/speex/speexdsp_types.h2
-rw-r--r--libspeexdsp/_kiss_fft_guts.h4
-rw-r--r--libspeexdsp/arch.h12
-rw-r--r--libspeexdsp/buffer.c4
-rw-r--r--libspeexdsp/fftwrap.c18
-rw-r--r--libspeexdsp/fftwrap.h12
-rw-r--r--libspeexdsp/filterbank.c12
-rw-r--r--libspeexdsp/fixed_arm4.h10
-rw-r--r--libspeexdsp/fixed_arm5e.h10
-rw-r--r--libspeexdsp/fixed_bfin.h12
-rw-r--r--libspeexdsp/fixed_debug.h50
-rw-r--r--libspeexdsp/fixed_generic.h8
-rw-r--r--libspeexdsp/jitter.c150
-rw-r--r--libspeexdsp/kiss_fft.c40
-rw-r--r--libspeexdsp/kiss_fft.h26
-rw-r--r--libspeexdsp/kiss_fftr.c38
-rw-r--r--libspeexdsp/kiss_fftr.h12
-rw-r--r--libspeexdsp/math_approx.h14
-rw-r--r--libspeexdsp/mdf.c132
-rw-r--r--libspeexdsp/misc_bfin.h10
-rw-r--r--libspeexdsp/os_support.h6
-rw-r--r--libspeexdsp/preprocess.c142
-rw-r--r--libspeexdsp/pseudofloat.h26
-rw-r--r--libspeexdsp/resample.c82
-rw-r--r--libspeexdsp/resample_sse.h8
-rw-r--r--libspeexdsp/scal.c36
-rw-r--r--libspeexdsp/smallft.c16
-rw-r--r--libspeexdsp/stack_alloc.h10
-rw-r--r--libspeexdsp/testjitter.c12
-rw-r--r--libspeexdsp/testresample.c4
-rw-r--r--libspeexdsp/vorbis_psy.h10
-rw-r--r--ti/config.h12
-rw-r--r--ti/os_support_custom.h36
-rw-r--r--tmv/_kiss_fft_guts_tm.h8
-rw-r--r--tmv/config.h28
-rw-r--r--tmv/fftwrap_tm.h24
-rw-r--r--tmv/filterbank_tm.h30
-rw-r--r--tmv/fixed_tm.h10
-rw-r--r--tmv/kiss_fft_tm.h118
-rw-r--r--tmv/kiss_fftr_tm.h34
-rw-r--r--tmv/mdf_tm.h362
-rw-r--r--tmv/misc_tm.h8
-rw-r--r--tmv/preprocess_tm.h160
-rw-r--r--tmv/profile_tm.h10
51 files changed, 979 insertions, 979 deletions
diff --git a/doc/sampledec.c b/doc/sampledec.c
index 2878c47..8e89e12 100644
--- a/doc/sampledec.c
+++ b/doc/sampledec.c
@@ -33,13 +33,13 @@ int main(int argc, char **argv)
speex_bits_init(&bits);
while (1)
{
- /*Read the size encoded by sampleenc, this part will likely be
+ /*Read the size encoded by sampleenc, this part will likely be
different in your application*/
fread(&nbBytes, sizeof(int), 1, stdin);
fprintf (stderr, "nbBytes: %d\n", nbBytes);
if (feof(stdin))
break;
-
+
/*Read the "packet" encoded by sampleenc*/
fread(cbits, 1, nbBytes, stdin);
/*Copy the data into the bit-stream struct*/
@@ -55,7 +55,7 @@ int main(int argc, char **argv)
/*Write the decoded audio to file*/
fwrite(out, sizeof(short), FRAME_SIZE, fout);
}
-
+
/*Destroy the decoder state*/
speex_decoder_destroy(state);
/*Destroy the bit-stream truct*/
diff --git a/doc/sampleenc.c b/doc/sampleenc.c
index d508181..a0ec8b6 100644
--- a/doc/sampleenc.c
+++ b/doc/sampleenc.c
@@ -52,9 +52,9 @@ int main(int argc, char **argv)
fwrite(&nbBytes, sizeof(int), 1, stdout);
/*Write the compressed data*/
fwrite(cbits, 1, nbBytes, stdout);
-
+
}
-
+
/*Destroy the encoder state*/
speex_encoder_destroy(state);
/*Destroy the bit-packing struct*/
diff --git a/include/speex/speex_buffer.h b/include/speex/speex_buffer.h
index 5bd128a..9e85cfc 100644
--- a/include/speex/speex_buffer.h
+++ b/include/speex/speex_buffer.h
@@ -1,5 +1,5 @@
/* Copyright (C) 2007 Jean-Marc Valin
-
+
File: speex_buffer.h
This is a very simple ring buffer implementation. It is not thread-safe
so you need to do your own locking.
diff --git a/include/speex/speex_echo.h b/include/speex/speex_echo.h
index 6f14d09..4c1aa5a 100644
--- a/include/speex/speex_echo.h
+++ b/include/speex/speex_echo.h
@@ -63,7 +63,7 @@ extern "C" {
struct SpeexEchoState_;
/** @class SpeexEchoState
- * This holds the state of the echo canceller. You need one per channel.
+ * This holds the state of the echo canceller. You need one per channel.
*/
/** Internal echo canceller state. Should never be accessed directly. */
@@ -85,7 +85,7 @@ SpeexEchoState *speex_echo_state_init(int frame_size, int filter_length);
*/
SpeexEchoState *speex_echo_state_init_mc(int frame_size, int filter_length, int nb_mic, int nb_speakers);
-/** Destroys an echo canceller state
+/** Destroys an echo canceller state
* @param st Echo canceller state
*/
void speex_echo_state_destroy(SpeexEchoState *st);
@@ -117,7 +117,7 @@ void speex_echo_capture(SpeexEchoState *st, const spx_int16_t *rec, spx_int16_t
*/
void speex_echo_playback(SpeexEchoState *st, const spx_int16_t *play);
-/** Reset the echo canceller to its original state
+/** Reset the echo canceller to its original state
* @param st Echo canceller state
*/
void speex_echo_state_reset(SpeexEchoState *st);
@@ -139,7 +139,7 @@ typedef struct SpeexDecorrState_ SpeexDecorrState;
/** Create a state for the channel decorrelation algorithm
- This is useful for multi-channel echo cancellation only
+ This is useful for multi-channel echo cancellation only
* @param rate Sampling rate
* @param channels Number of channels (it's a bit pointless if you don't have at least 2)
* @param frame_size Size of the frame to process at ones (counting samples *per* channel)
@@ -155,7 +155,7 @@ SpeexDecorrState *speex_decorrelate_new(int rate, int channels, int frame_size);
*/
void speex_decorrelate(SpeexDecorrState *st, const spx_int16_t *in, spx_int16_t *out, int strength);
-/** Destroy a Decorrelation state
+/** Destroy a Decorrelation state
* @param st State to destroy
*/
void speex_decorrelate_destroy(SpeexDecorrState *st);
diff --git a/include/speex/speex_jitter.h b/include/speex/speex_jitter.h
index 66708da..8fc8d7e 100644
--- a/include/speex/speex_jitter.h
+++ b/include/speex/speex_jitter.h
@@ -7,18 +7,18 @@
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
-
+
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
-
+
- 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.
-
+
- Neither the name of the Xiph.org Foundation nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
-
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -89,7 +89,7 @@ struct _JitterBufferPacket {
/** Included because of an early misspelling (will remove in next release) */
#define JITTER_BUFFER_GET_AVALIABLE_COUNT 3
-/** Assign a function to destroy unused packet. When setting that, the jitter
+/** Assign a function to destroy unused packet. When setting that, the jitter
buffer no longer copies packet data. */
#define JITTER_BUFFER_SET_DESTROY_CALLBACK 4
/** */
@@ -104,7 +104,7 @@ struct _JitterBufferPacket {
#define JITTER_BUFFER_SET_CONCEALMENT_SIZE 8
#define JITTER_BUFFER_GET_CONCEALMENT_SIZE 9
-/** Absolute max amount of loss that can be tolerated regardless of the delay. Typical loss
+/** Absolute max amount of loss that can be tolerated regardless of the delay. Typical loss
should be half of that or less. */
#define JITTER_BUFFER_SET_MAX_LATE_RATE 10
#define JITTER_BUFFER_GET_MAX_LATE_RATE 11
@@ -114,59 +114,59 @@ struct _JitterBufferPacket {
#define JITTER_BUFFER_GET_LATE_COST 13
-/** Initialises jitter buffer
- *
- * @param step_size Starting value for the size of concleanment packets and delay
+/** Initialises jitter buffer
+ *
+ * @param step_size Starting value for the size of concleanment packets and delay
adjustment steps. Can be changed at any time using JITTER_BUFFER_SET_DELAY_STEP
and JITTER_BUFFER_GET_CONCEALMENT_SIZE.
* @return Newly created jitter buffer state
*/
JitterBuffer *jitter_buffer_init(int step_size);
-/** Restores jitter buffer to its original state
- *
+/** Restores jitter buffer to its original state
+ *
* @param jitter Jitter buffer state
*/
void jitter_buffer_reset(JitterBuffer *jitter);
-/** Destroys jitter buffer
- *
+/** Destroys jitter buffer
+ *
* @param jitter Jitter buffer state
*/
void jitter_buffer_destroy(JitterBuffer *jitter);
/** Put one packet into the jitter buffer
- *
+ *
* @param jitter Jitter buffer state
* @param packet Incoming packet
*/
void jitter_buffer_put(JitterBuffer *jitter, const JitterBufferPacket *packet);
/** Get one packet from the jitter buffer
- *
+ *
* @param jitter Jitter buffer state
* @param packet Returned packet
* @param desired_span Number of samples (or units) we wish to get from the buffer (no guarantee)
- * @param current_timestamp Timestamp for the returned packet
+ * @param current_timestamp Timestamp for the returned packet
*/
int jitter_buffer_get(JitterBuffer *jitter, JitterBufferPacket *packet, spx_int32_t desired_span, spx_int32_t *start_offset);
/** Used right after jitter_buffer_get() to obtain another packet that would have the same timestamp.
* This is mainly useful for media where a single "frame" can be split into several packets.
- *
+ *
* @param jitter Jitter buffer state
* @param packet Returned packet
*/
int jitter_buffer_get_another(JitterBuffer *jitter, JitterBufferPacket *packet);
/** Get pointer timestamp of jitter buffer
- *
+ *
* @param jitter Jitter buffer state
*/
int jitter_buffer_get_pointer_timestamp(JitterBuffer *jitter);
/** Advance by one tick
- *
+ *
* @param jitter Jitter buffer state
*/
void jitter_buffer_tick(JitterBuffer *jitter);
@@ -178,7 +178,7 @@ void jitter_buffer_tick(JitterBuffer *jitter);
void jitter_buffer_remaining_span(JitterBuffer *jitter, spx_uint32_t rem);
/** Used like the ioctl function to control the jitter buffer parameters
- *
+ *
* @param jitter Jitter buffer state
* @param request ioctl-type request (one of the JITTER_BUFFER_* macros)
* @param ptr Data exchanged to-from function
diff --git a/include/speex/speex_preprocess.h b/include/speex/speex_preprocess.h
index b9555eb..a2e1210 100644
--- a/include/speex/speex_preprocess.h
+++ b/include/speex/speex_preprocess.h
@@ -2,7 +2,7 @@
Written by Jean-Marc Valin */
/**
* @file speex_preprocess.h
- * @brief Speex preprocessor. The preprocess can do noise suppression,
+ * @brief Speex preprocessor. The preprocess can do noise suppression,
* residual echo suppression (after using the echo canceller), automatic
* gain control (AGC) and voice activity detection (VAD).
*/
@@ -37,7 +37,7 @@
#ifndef SPEEX_PREPROCESS_H
#define SPEEX_PREPROCESS_H
/** @defgroup SpeexPreprocessState SpeexPreprocessState: The Speex preprocessor
- * This is the Speex preprocessor. The preprocess can do noise suppression,
+ * This is the Speex preprocessor. The preprocess can do noise suppression,
* residual echo suppression (after using the echo canceller), automatic
* gain control (AGC) and voice activity detection (VAD).
* @{
@@ -48,7 +48,7 @@
#ifdef __cplusplus
extern "C" {
#endif
-
+
/** State of the preprocessor (one per channel). Should never be accessed directly. */
struct SpeexPreprocessState_;
@@ -64,12 +64,12 @@ typedef struct SpeexPreprocessState_ SpeexPreprocessState;
*/
SpeexPreprocessState *speex_preprocess_state_init(int frame_size, int sampling_rate);
-/** Destroys a preprocessor state
+/** Destroys a preprocessor state
* @param st Preprocessor state to destroy
*/
void speex_preprocess_state_destroy(SpeexPreprocessState *st);
-/** Preprocess a frame
+/** Preprocess a frame
* @param st Preprocessor state
* @param x Audio sample vector (in and out). Must be same size as specified in speex_preprocess_state_init().
* @return Bool value for voice activity (1 for speech, 0 for noise/silence), ONLY if VAD turned on.
@@ -85,7 +85,7 @@ int speex_preprocess(SpeexPreprocessState *st, spx_int16_t *x, spx_int32_t *echo
*/
void speex_preprocess_estimate_update(SpeexPreprocessState *st, spx_int16_t *x);
-/** Used like the ioctl function to control the preprocessor parameters
+/** Used like the ioctl function to control the preprocessor parameters
* @param st Preprocessor state
* @param request ioctl-type request (one of the SPEEX_PREPROCESS_* macros)
* @param ptr Data exchanged to-from function
diff --git a/include/speex/speex_resampler.h b/include/speex/speex_resampler.h
index 50d777f..90c989b 100644
--- a/include/speex/speex_resampler.h
+++ b/include/speex/speex_resampler.h
@@ -1,8 +1,8 @@
/* Copyright (C) 2007 Jean-Marc Valin
-
+
File: speex_resampler.h
Resampling code
-
+
The design goals of this code are:
- Very fast algorithm
- Low memory requirement
@@ -43,7 +43,7 @@
/********* WARNING: MENTAL SANITY ENDS HERE *************/
-/* If the resampler is defined outside of Speex, we change the symbol names so that
+/* If the resampler is defined outside of Speex, we change the symbol names so that
there won't be any clash if linking with Speex later on. */
/* #define RANDOM_PREFIX your software name here */
@@ -53,7 +53,7 @@
#define CAT_PREFIX2(a,b) a ## b
#define CAT_PREFIX(a,b) CAT_PREFIX2(a, b)
-
+
#define speex_resampler_init CAT_PREFIX(RANDOM_PREFIX,_resampler_init)
#define speex_resampler_init_frac CAT_PREFIX(RANDOM_PREFIX,_resampler_init_frac)
#define speex_resampler_destroy CAT_PREFIX(RANDOM_PREFIX,_resampler_destroy)
@@ -81,7 +81,7 @@
#define spx_int32_t int
#define spx_uint16_t unsigned short
#define spx_uint32_t unsigned int
-
+
#else /* OUTSIDE_SPEEX */
#include "speexdsp_types.h"
@@ -104,7 +104,7 @@ enum {
RESAMPLER_ERR_BAD_STATE = 2,
RESAMPLER_ERR_INVALID_ARG = 3,
RESAMPLER_ERR_PTR_OVERLAP = 4,
-
+
RESAMPLER_ERR_MAX_ERROR
};
@@ -120,14 +120,14 @@ typedef struct SpeexResamplerState_ SpeexResamplerState;
* @return Newly created resampler state
* @retval NULL Error: not enough memory
*/
-SpeexResamplerState *speex_resampler_init(spx_uint32_t nb_channels,
- spx_uint32_t in_rate,
- spx_uint32_t out_rate,
+SpeexResamplerState *speex_resampler_init(spx_uint32_t nb_channels,
+ spx_uint32_t in_rate,
+ spx_uint32_t out_rate,
int quality,
int *err);
-/** Create a new resampler with fractional input/output rates. The sampling
- * rate ratio is an arbitrary rational number with both the numerator and
+/** Create a new resampler with fractional input/output rates. The sampling
+ * rate ratio is an arbitrary rational number with both the numerator and
* denominator being 32-bit integers.
* @param nb_channels Number of channels to be processed
* @param ratio_num Numerator of the sampling rate ratio
@@ -139,11 +139,11 @@ SpeexResamplerState *speex_resampler_init(spx_uint32_t nb_channels,
* @return Newly created resampler state
* @retval NULL Error: not enough memory
*/
-SpeexResamplerState *speex_resampler_init_frac(spx_uint32_t nb_channels,
- spx_uint32_t ratio_num,
- spx_uint32_t ratio_den,
- spx_uint32_t in_rate,
- spx_uint32_t out_rate,
+SpeexResamplerState *speex_resampler_init_frac(spx_uint32_t nb_channels,
+ spx_uint32_t ratio_num,
+ spx_uint32_t ratio_den,
+ spx_uint32_t in_rate,
+ spx_uint32_t out_rate,
int quality,
int *err);
@@ -154,24 +154,24 @@ void speex_resampler_destroy(SpeexResamplerState *st);
/** Resample a float array. The input and output buffers must *not* overlap.
* @param st Resampler state
- * @param channel_index Index of the channel to process for the multi-channel
+ * @param channel_index Index of the channel to process for the multi-channel
* base (0 otherwise)
* @param in Input buffer
- * @param in_len Number of input samples in the input buffer. Returns the
+ * @param in_len Number of input samples in the input buffer. Returns the
* number of samples processed
* @param out Output buffer
* @param out_len Size of the output buffer. Returns the number of samples written
*/
-int speex_resampler_process_float(SpeexResamplerState *st,
- spx_uint32_t channel_index,
- const float *in,
- spx_uint32_t *in_len,
- float *out,
+int speex_resampler_process_float(SpeexResamplerState *st,
+ spx_uint32_t channel_index,
+ const float *in,
+ spx_uint32_t *in_len,
+ float *out,
spx_uint32_t *out_len);
/** Resample an int array. The input and output buffers must *not* overlap.
* @param st Resampler state
- * @param channel_index Index of the channel to process for the multi-channel
+ * @param channel_index Index of the channel to process for the multi-channel
* base (0 otherwise)
* @param in Input buffer
* @param in_len Number of input samples in the input buffer. Returns the number
@@ -179,11 +179,11 @@ int speex_resampler_process_float(SpeexResamplerState *st,
* @param out Output buffer
* @param out_len Size of the output buffer. Returns the number of samples written
*/
-int speex_resampler_process_int(SpeexResamplerState *st,
- spx_uint32_t channel_index,
- const spx_int16_t *in,
- spx_uint32_t *in_len,
- spx_int16_t *out,
+int speex_resampler_process_int(SpeexResamplerState *st,
+ spx_uint32_t channel_index,
+ const spx_int16_t *in,
+ spx_uint32_t *in_len,
+ spx_int16_t *out,
spx_uint32_t *out_len);
/** Resample an interleaved float array. The input and output buffers must *not* overlap.
@@ -195,10 +195,10 @@ int speex_resampler_process_int(SpeexResamplerState *st,
* @param out_len Size of the output buffer. Returns the number of samples written.
* This is all per-channel.
*/
-int speex_resampler_process_interleaved_float(SpeexResamplerState *st,
- const float *in,
- spx_uint32_t *in_len,
- float *out,
+int speex_resampler_process_interleaved_float(SpeexResamplerState *st,
+ const float *in,
+ spx_uint32_t *in_len,
+ float *out,
spx_uint32_t *out_len);
/** Resample an interleaved int array. The input and output buffers must *not* overlap.
@@ -210,10 +210,10 @@ int speex_resampler_process_interleaved_float(SpeexResamplerState *st,
* @param out_len Size of the output buffer. Returns the number of samples written.
* This is all per-channel.
*/
-int speex_resampler_process_interleaved_int(SpeexResamplerState *st,
- const spx_int16_t *in,
- spx_uint32_t *in_len,
- spx_int16_t *out,
+int speex_resampler_process_interleaved_int(SpeexResamplerState *st,
+ const spx_int16_t *in,
+ spx_uint32_t *in_len,
+ spx_int16_t *out,
spx_uint32_t *out_len);
/** Set (change) the input/output sampling rates (integer value).
@@ -221,8 +221,8 @@ int speex_resampler_process_interleaved_int(SpeexResamplerState *st,
* @param in_rate Input sampling rate (integer number of Hz).
* @param out_rate Output sampling rate (integer number of Hz).
*/
-int speex_resampler_set_rate(SpeexResamplerState *st,
- spx_uint32_t in_rate,
+int speex_resampler_set_rate(SpeexResamplerState *st,
+ spx_uint32_t in_rate,
spx_uint32_t out_rate);
/** Get the current input/output sampling rates (integer value).
@@ -230,11 +230,11 @@ int speex_resampler_set_rate(SpeexResamplerState *st,
* @param in_rate Input sampling rate (integer number of Hz) copied.
* @param out_rate Output sampling rate (integer number of Hz) copied.
*/
-void speex_resampler_get_rate(SpeexResamplerState *st,
- spx_uint32_t *in_rate,
+void speex_resampler_get_rate(SpeexResamplerState *st,
+ spx_uint32_t *in_rate,
spx_uint32_t *out_rate);
-/** Set (change) the input/output sampling rates and resampling ratio
+/** Set (change) the input/output sampling rates and resampling ratio
* (fractional values in Hz supported).
* @param st Resampler state
* @param ratio_num Numerator of the sampling rate ratio
@@ -242,10 +242,10 @@ void speex_resampler_get_rate(SpeexResamplerState *st,
* @param in_rate Input sampling rate rounded to the nearest integer (in Hz).
* @param out_rate Output sampling rate rounded to the nearest integer (in Hz).
*/
-int speex_resampler_set_rate_frac(SpeexResamplerState *st,
- spx_uint32_t ratio_num,
- spx_uint32_t ratio_den,
- spx_uint32_t in_rate,
+int speex_resampler_set_rate_frac(SpeexResamplerState *st,
+ spx_uint32_t ratio_num,
+ spx_uint32_t ratio_den,
+ spx_uint32_t in_rate,
spx_uint32_t out_rate);
/** Get the current resampling ratio. This will be reduced to the least
@@ -254,52 +254,52 @@ int speex_resampler_set_rate_frac(SpeexResamplerState *st,
* @param ratio_num Numerator of the sampling rate ratio copied
* @param ratio_den Denominator of the sampling rate ratio copied
*/
-void speex_resampler_get_ratio(SpeexResamplerState *st,
- spx_uint32_t *ratio_num,
+void speex_resampler_get_ratio(SpeexResamplerState *st,
+ spx_uint32_t *ratio_num,
spx_uint32_t *ratio_den);
/** Set (change) the conversion quality.
* @param st Resampler state
- * @param quality Resampling quality between 0 and 10, where 0 has poor
+ * @param quality Resampling quality between 0 and 10, where 0 has poor
* quality and 10 has very high quality.
*/
-int speex_resampler_set_quality(SpeexResamplerState *st,
+int speex_resampler_set_quality(SpeexResamplerState *st,
int quality);
/** Get the conversion quality.
* @param st Resampler state
- * @param quality Resampling quality between 0 and 10, where 0 has poor
+ * @param quality Resampling quality between 0 and 10, where 0 has poor
* quality and 10 has very high quality.
*/
-void speex_resampler_get_quality(SpeexResamplerState *st,
+void speex_resampler_get_quality(SpeexResamplerState *st,
int *quality);
/** Set (change) the input stride.
* @param st Resampler state
* @param stride Input stride
*/
-void speex_resampler_set_input_stride(SpeexResamplerState *st,
+void speex_resampler_set_input_stride(SpeexResamplerState *st,
spx_uint32_t stride);
/** Get the input stride.
* @param st Resampler state
* @param stride Input stride copied
*/
-void speex_resampler_get_input_stride(SpeexResamplerState *st,
+void speex_resampler_get_input_stride(SpeexResamplerState *st,
spx_uint32_t *stride);
/** Set (change) the output stride.
* @param st Resampler state
* @param stride Output stride
*/
-void speex_resampler_set_output_stride(SpeexResamplerState *st,
+void speex_resampler_set_output_stride(SpeexResamplerState *st,
spx_uint32_t stride);
/** Get the output stride.
* @param st Resampler state copied
* @param stride Output stride
*/
-void speex_resampler_get_output_stride(SpeexResamplerState *st,
+void speex_resampler_get_output_stride(SpeexResamplerState *st,
spx_uint32_t *stride);
/** Get the latency introduced by the resampler measured in input samples.
@@ -312,8 +312,8 @@ int speex_resampler_get_input_latency(SpeexResamplerState *st);
*/
int speex_resampler_get_output_latency(SpeexResamplerState *st);
-/** Make sure that the first samples to go out of the resamplers don't have
- * leading zeros. This is only useful before starting to use a newly created
+/** Make sure that the first samples to go out of the resamplers don't have
+ * leading zeros. This is only useful before starting to use a newly created
* resampler. It is recommended to use that when resampling an audio file, as
* it will generate a file with the same length. For real-time processing,
* it is probably easier not to use this call (so that the output duration
diff --git a/include/speex/speexdsp_types.h b/include/speex/speexdsp_types.h
index 334d674..4b4a76a 100644
--- a/include/speex/speexdsp_types.h
+++ b/include/speex/speexdsp_types.h
@@ -22,7 +22,7 @@
#ifndef _SPEEX_TYPES_H
#define _SPEEX_TYPES_H
-#if defined(_WIN32)
+#if defined(_WIN32)
# if defined(__CYGWIN__)
# include <_G_config.h>
diff --git a/libspeexdsp/_kiss_fft_guts.h b/libspeexdsp/_kiss_fft_guts.h
index 6571e79..f5f2a5f 100644
--- a/libspeexdsp/_kiss_fft_guts.h
+++ b/libspeexdsp/_kiss_fft_guts.h
@@ -23,7 +23,7 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
#include "math_approx.h"
#define MAXFACTORS 32
-/* e.g. an fft of length 128 has 4 factors
+/* e.g. an fft of length 128 has 4 factors
as far as kissfft is concerned
4*4*4*2
*/
@@ -47,7 +47,7 @@ struct kiss_fft_state{
#ifdef FIXED_POINT
#include "arch.h"
# define FRACBITS 15
-# define SAMPPROD spx_int32_t
+# define SAMPPROD spx_int32_t
#define SAMP_MAX 32767
#define SAMP_MIN -SAMP_MAX
diff --git a/libspeexdsp/arch.h b/libspeexdsp/arch.h
index 535d308..6b3bc5d 100644
--- a/libspeexdsp/arch.h
+++ b/libspeexdsp/arch.h
@@ -7,18 +7,18 @@
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
-
+
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
-
+
- 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.
-
+
- Neither the name of the Xiph.org Foundation nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
-
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -210,11 +210,11 @@ typedef float spx_word32_t;
#if defined (CONFIG_TI_C54X) || defined (CONFIG_TI_C55X)
/* 2 on TI C5x DSP */
-#define BYTES_PER_CHAR 2
+#define BYTES_PER_CHAR 2
#define BITS_PER_CHAR 16
#define LOG2_BITS_PER_CHAR 4
-#else
+#else
#define BYTES_PER_CHAR 1
#define BITS_PER_CHAR 8
diff --git a/libspeexdsp/buffer.c b/libspeexdsp/buffer.c
index c82cab5..048be83 100644
--- a/libspeexdsp/buffer.c
+++ b/libspeexdsp/buffer.c
@@ -1,5 +1,5 @@
/* Copyright (C) 2007 Jean-Marc Valin
-
+
File: buffer.c
This is a very simple ring buffer implementation. It is not thread-safe
so you need to do your own locking.
@@ -99,7 +99,7 @@ EXPORT int speex_buffer_write(SpeexBuffer *st, void *_data, int len)
EXPORT int speex_buffer_writezeros(SpeexBuffer *st, int len)
{
- /* This is almost the same as for speex_buffer_write() but using
+ /* This is almost the same as for speex_buffer_write() but using
SPEEX_MEMSET() instead of SPEEX_COPY(). Update accordingly. */
int end;
int end1;
diff --git a/libspeexdsp/fftwrap.c b/libspeexdsp/fftwrap.c
index a14b1e4..4573479 100644
--- a/libspeexdsp/fftwrap.c
+++ b/libspeexdsp/fftwrap.c
@@ -1,23 +1,23 @@
-/* Copyright (C) 2005-2006 Jean-Marc Valin
+/* Copyright (C) 2005-2006 Jean-Marc Valin
File: fftwrap.c
- Wrapper for various FFTs
+ Wrapper for various FFTs
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
-
+
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
-
+
- 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.
-
+
- Neither the name of the Xiph.org Foundation nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
-
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -62,7 +62,7 @@ static int maximize_range(spx_word16_t *in, spx_word16_t *out, spx_word16_t boun
for (i=0;i<len;i++)
{
out[i] = SHL16(in[i], shift);
- }
+ }
return shift;
}
@@ -270,7 +270,7 @@ void spx_fft(void *table, spx_word16_t *in, spx_word16_t *out)
out[i] = optr[i+1];
}
-void spx_ifft(void *table, spx_word16_t *in, spx_word16_t *out)
+void spx_ifft(void *table, spx_word16_t *in, spx_word16_t *out)
{
int i;
struct fftw_config *t = (struct fftw_config *) table;
@@ -285,7 +285,7 @@ void spx_ifft(void *table, spx_word16_t *in, spx_word16_t *out)
iptr[N+1] = 0.0f;
fftwf_execute(t->ifft);
-
+
for(i=0;i<N;++i)
out[i] = optr[i];
}
diff --git a/libspeexdsp/fftwrap.h b/libspeexdsp/fftwrap.h
index dfaf489..2c07425 100644
--- a/libspeexdsp/fftwrap.h
+++ b/libspeexdsp/fftwrap.h
@@ -1,23 +1,23 @@
-/* Copyright (C) 2005 Jean-Marc Valin
+/* Copyright (C) 2005 Jean-Marc Valin
File: fftwrap.h
- Wrapper for various FFTs
+ Wrapper for various FFTs
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
-
+
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
-
+
- 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.
-
+
- Neither the name of the Xiph.org Foundation nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
-
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
diff --git a/libspeexdsp/filterbank.c b/libspeexdsp/filterbank.c
index e2fb71d..c8fdd7a 100644
--- a/libspeexdsp/filterbank.c
+++ b/libspeexdsp/filterbank.c
@@ -40,15 +40,15 @@
#include <math.h>
#include "math_approx.h"
#include "os_support.h"
-
+
#ifdef FIXED_POINT
#define toBARK(n) (MULT16_16(26829,spx_atan(SHR32(MULT16_16(97,n),2))) + MULT16_16(4588,spx_atan(MULT16_32_Q15(20,MULT16_16(n,n)))) + MULT16_16(3355,n))
-
+
#else
#define toBARK(n) (13.1f*atan(.00074f*(n))+2.24f*atan((n)*(n)*1.85e-8f)+1e-4f*(n))
#endif
-
+
#define toMEL(n) (2595.f*log10(1.f+(n)/700.f))
FilterBank *filterbank_new(int banks, spx_word32_t sampling, int len, int type)
@@ -62,7 +62,7 @@ FilterBank *filterbank_new(int banks, spx_word32_t sampling, int len, int type)
df = DIV32(SHL32(sampling,15),MULT16_16(2,len));
max_mel = toBARK(EXTRACT16(sampling/2));
mel_interval = PDIV32(max_mel,banks-1);
-
+
bank = (FilterBank*)speex_alloc(sizeof(FilterBank));
bank->nb_banks = banks;
bank->len = len;
@@ -85,7 +85,7 @@ FilterBank *filterbank_new(int banks, spx_word32_t sampling, int len, int type)
break;
#ifdef FIXED_POINT
id1 = DIV32(mel,mel_interval);
-#else
+#else
id1 = (int)(floor(mel/mel_interval));
#endif
if (id1>banks-2)
@@ -101,7 +101,7 @@ FilterBank *filterbank_new(int banks, spx_word32_t sampling, int len, int type)
bank->bank_right[i] = id2;
bank->filter_right[i] = val;
}
-
+
/* Think I can safely disable normalisation for fixed-point (and probably float as well) */
#ifndef FIXED_POINT
for (i=0;i<bank->nb_banks;i++)
diff --git a/libspeexdsp/fixed_arm4.h b/libspeexdsp/fixed_arm4.h
index b6981ca..223478c 100644
--- a/libspeexdsp/fixed_arm4.h
+++ b/libspeexdsp/fixed_arm4.h
@@ -7,18 +7,18 @@
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
-
+
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
-
+
- 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.
-
+
- Neither the name of the Xiph.org Foundation nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
-
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -109,7 +109,7 @@ static inline short DIV32_16(int a, int b)
"\tsubs %3, %0, %1, asl #6 \n"
"\tmovpl %0, %3 \n"
"\torrpl %2, %2, %4, asl #6 \n"
-
+
"\tsubs %3, %0, %1, asl #5 \n"
"\tmovpl %0, %3 \n"
"\torrpl %2, %2, %4, asl #5 \n"
diff --git a/libspeexdsp/fixed_arm5e.h b/libspeexdsp/fixed_arm5e.h
index 9b4861c..aa565ef 100644
--- a/libspeexdsp/fixed_arm5e.h
+++ b/libspeexdsp/fixed_arm5e.h
@@ -7,18 +7,18 @@
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
-
+
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
-
+
- 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.
-
+
- Neither the name of the Xiph.org Foundation nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
-
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -161,7 +161,7 @@ static inline short DIV32_16(int a, int b)
"\tsubs %3, %0, %1 \n"
"\torrpl %2, %2, %4 \n"
"\tmovpl %0, %3 \n"
-
+
"\tmovs %5, %5, lsr #31 \n"
"\trsbne %2, %2, #0 \n"
: "=r" (dead1), "=r" (dead2), "=r" (res),
diff --git a/libspeexdsp/fixed_bfin.h b/libspeexdsp/fixed_bfin.h
index 9eb21e3..646a483 100644
--- a/libspeexdsp/fixed_bfin.h
+++ b/libspeexdsp/fixed_bfin.h
@@ -8,18 +8,18 @@
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
-
+
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
-
+
- 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.
-
+
- Neither the name of the Xiph.org Foundation nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
-
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -68,9 +68,9 @@ static inline spx_word16_t DIV32_16(spx_word32_t a, spx_word16_t b)
{
spx_word32_t res, bb;
bb = b;
- /* Make the roundinf consistent with the C version
+ /* Make the roundinf consistent with the C version
(do we need to do that?)*/
- if (a<0)
+ if (a<0)
a += (b-1);
__asm__ (
"P0 = 15;\n\t"
diff --git a/libspeexdsp/fixed_debug.h b/libspeexdsp/fixed_debug.h
index 54f3866..4d5fe11 100644
--- a/libspeexdsp/fixed_debug.h
+++ b/libspeexdsp/fixed_debug.h
@@ -7,18 +7,18 @@
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
-
+
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
-
+
- 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.
-
+
- Neither the name of the Xiph.org Foundation nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
-
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -101,7 +101,7 @@ static inline int _EXTEND32(int x, char *file, int line)
}
#define SHR16(a, shift) _SHR16(a, shift, __FILE__, __LINE__)
-static inline short _SHR16(int a, int shift, char *file, int line)
+static inline short _SHR16(int a, int shift, char *file, int line)
{
int res;
if (!VERIFY_SHORT(a) || !VERIFY_SHORT(shift))
@@ -115,7 +115,7 @@ static inline short _SHR16(int a, int shift, char *file, int line)
return res;
}
#define SHL16(a, shift) _SHL16(a, shift, __FILE__, __LINE__)
-static inline short _SHL16(int a, int shift, char *file, int line)
+static inline short _SHL16(int a, int shift, char *file, int line)
{
int res;
if (!VERIFY_SHORT(a) || !VERIFY_SHORT(shift))
@@ -129,7 +129,7 @@ static inline short _SHL16(int a, int shift, char *file, int line)
return res;
}
-static inline int SHR32(long long a, int shift)
+static inline int SHR32(long long a, int shift)
{
long long res;
if (!VERIFY_INT(a) || !VERIFY_SHORT(shift))
@@ -144,7 +144,7 @@ static inline int SHR32(long long a, int shift)
spx_mips++;
return res;
}
-static inline int SHL32(long long a, int shift)
+static inline int SHL32(long long a, int shift)
{
long long res;
if (!VERIFY_INT(a) || !VERIFY_SHORT(shift))
@@ -171,7 +171,7 @@ static inline int SHL32(long long a, int shift)
//#define SHL(a,shift) ((a) << (shift))
#define ADD16(a, b) _ADD16(a, b, __FILE__, __LINE__)
-static inline short _ADD16(int a, int b, char *file, int line)
+static inline short _ADD16(int a, int b, char *file, int line)
{
int res;
if (!VERIFY_SHORT(a) || !VERIFY_SHORT(b))
@@ -188,7 +188,7 @@ static inline short _ADD16(int a, int b, char *file, int line)
}
#define SUB16(a, b) _SUB16(a, b, __FILE__, __LINE__)
-static inline short _SUB16(int a, int b, char *file, int line)
+static inline short _SUB16(int a, int b, char *file, int line)
{
int res;
if (!VERIFY_SHORT(a) || !VERIFY_SHORT(b))
@@ -203,7 +203,7 @@ static inline short _SUB16(int a, int b, char *file, int line)
}
#define ADD32(a, b) _ADD32(a, b, __FILE__, __LINE__)
-static inline int _ADD32(long long a, long long b, char *file, int line)
+static inline int _ADD32(long long a, long long b, char *file, int line)
{
long long res;
if (!VERIFY_INT(a) || !VERIFY_INT(b))
@@ -219,7 +219,7 @@ static inline int _ADD32(long long a, long long b, char *file, int line)
return res;
}
-static inline int SUB32(long long a, long long b)
+static inline int SUB32(long long a, long long b)
{
long long res;
if (!VERIFY_INT(a) || !VERIFY_INT(b))
@@ -236,7 +236,7 @@ static inline int SUB32(long long a, long long b)
#define ADD64(a,b) (MIPS_INC(a)+(b))
/* result fits in 16 bits */
-static inline short MULT16_16_16(int a, int b)
+static inline short MULT16_16_16(int a, int b)
{
int res;
if (!VERIFY_SHORT(a) || !VERIFY_SHORT(b))
@@ -251,7 +251,7 @@ static inline short MULT16_16_16(int a, int b)
}
#define MULT16_16(a, b) _MULT16_16(a, b, __FILE__, __LINE__)
-static inline int _MULT16_16(int a, int b, char *file, int line)
+static inline int _MULT16_16(int a, int b, char *file, int line)
{
long long res;
if (!VERIFY_SHORT(a) || !VERIFY_SHORT(b))
@@ -280,7 +280,7 @@ static inline int _MULT16_32_QX(int a, long long b, int Q, char *file, int line)
fprintf (stderr, "MULT16_32_Q%d: inputs are not short+int: %d %d in %s: line %d\n", Q, (int)a, (int)b, file, line);
}
if (ABS32(b)>=(EXTEND32(1)<<(15+Q)))
- fprintf (stderr, "MULT16_32_Q%d: second operand too large: %d %d in %s: line %d\n", Q, (int)a, (int)b, file, line);
+ fprintf (stderr, "MULT16_32_Q%d: second operand too large: %d %d in %s: line %d\n", Q, (int)a, (int)b, file, line);
res = (((long long)a)*(long long)b) >> Q;
if (!VERIFY_INT(res))
fprintf (stderr, "MULT16_32_Q%d: output is not int: %d*%d=%d in %s: line %d\n", Q, (int)a, (int)b,(int)res, file, line);
@@ -296,7 +296,7 @@ static inline int MULT16_32_PX(int a, long long b, int Q)
fprintf (stderr, "MULT16_32_P%d: inputs are not short+int: %d %d\n", Q, (int)a, (int)b);
}
if (ABS32(b)>=(EXTEND32(1)<<(15+Q)))
- fprintf (stderr, "MULT16_32_Q%d: second operand too large: %d %d\n", Q, (int)a, (int)b);
+ fprintf (stderr, "MULT16_32_Q%d: second operand too large: %d %d\n", Q, (int)a, (int)b);
res = ((((long long)a)*(long long)b) + ((EXTEND32(1)<<Q)>>1))>> Q;
if (!VERIFY_INT(res))
fprintf (stderr, "MULT16_32_P%d: output is not int: %d*%d=%d\n", Q, (int)a, (int)b,(int)res);
@@ -323,7 +323,7 @@ static inline int SATURATE(int a, int b)
return a;
}
-static inline int MULT16_16_Q11_32(int a, int b)
+static inline int MULT16_16_Q11_32(int a, int b)
{
long long res;
if (!VERIFY_SHORT(a) || !VERIFY_SHORT(b))
@@ -337,7 +337,7 @@ static inline int MULT16_16_Q11_32(int a, int b)
spx_mips+=3;
return res;
}
-static inline short MULT16_16_Q13(int a, int b)
+static inline short MULT16_16_Q13(int a, int b)
{
long long res;
if (!VERIFY_SHORT(a) || !VERIFY_SHORT(b))
@@ -351,7 +351,7 @@ static inline short MULT16_16_Q13(int a, int b)
spx_mips+=3;
return res;
}
-static inline short MULT16_16_Q14(int a, int b)
+static inline short MULT16_16_Q14(int a, int b)
{
long long res;
if (!VERIFY_SHORT(a) || !VERIFY_SHORT(b))
@@ -365,7 +365,7 @@ static inline short MULT16_16_Q14(int a, int b)
spx_mips+=3;
return res;
}
-static inline short MULT16_16_Q15(int a, int b)
+static inline short MULT16_16_Q15(int a, int b)
{
long long res;
if (!VERIFY_SHORT(a) || !VERIFY_SHORT(b))
@@ -382,7 +382,7 @@ static inline short MULT16_16_Q15(int a, int b)
return res;
}
-static inline short MULT16_16_P13(int a, int b)
+static inline short MULT16_16_P13(int a, int b)
{
long long res;
if (!VERIFY_SHORT(a) || !VERIFY_SHORT(b))
@@ -399,7 +399,7 @@ static inline short MULT16_16_P13(int a, int b)
spx_mips+=4;
return res;
}
-static inline short MULT16_16_P14(int a, int b)
+static inline short MULT16_16_P14(int a, int b)
{
long long res;
if (!VERIFY_SHORT(a) || !VERIFY_SHORT(b))
@@ -416,7 +416,7 @@ static inline short MULT16_16_P14(int a, int b)
spx_mips+=4;
return res;
}
-static inline short MULT16_16_P15(int a, int b)
+static inline short MULT16_16_P15(int a, int b)
{
long long res;
if (!VERIFY_SHORT(a) || !VERIFY_SHORT(b))
@@ -436,7 +436,7 @@ static inline short MULT16_16_P15(int a, int b)
#define DIV32_16(a, b) _DIV32_16(a, b, __FILE__, __LINE__)
-static inline int _DIV32_16(long long a, long long b, char *file, int line)
+static inline int _DIV32_16(long long a, long long b, char *file, int line)
{
long long res;
if (b==0)
@@ -462,7 +462,7 @@ static inline int _DIV32_16(long long a, long long b, char *file, int line)
}
#define DIV32(a, b) _DIV32(a, b, __FILE__, __LINE__)
-static inline int _DIV32(long long a, long long b, char *file, int line)
+static inline int _DIV32(long long a, long long b, char *file, int line)
{
long long res;
if (b==0)
diff --git a/libspeexdsp/fixed_generic.h b/libspeexdsp/fixed_generic.h
index 0e012e9..12d27aa 100644
--- a/libspeexdsp/fixed_generic.h
+++ b/libspeexdsp/fixed_generic.h
@@ -7,18 +7,18 @@
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
-
+
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
-
+
- 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.
-
+
- Neither the name of the Xiph.org Foundation nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
-
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
diff --git a/libspeexdsp/jitter.c b/libspeexdsp/jitter.c
index a077d8d..a9c0dd3 100644
--- a/libspeexdsp/jitter.c
+++ b/libspeexdsp/jitter.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002 Jean-Marc Valin
+/* Copyright (C) 2002 Jean-Marc Valin
File: speex_jitter.h
Adaptive jitter buffer for Speex
@@ -6,18 +6,18 @@
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
-
+
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
-
+
- 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.
-
+
- Neither the name of the Xiph.org Foundation nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
-
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -71,7 +71,7 @@ TODO:
#define LT32(a,b) (((spx_int32_t)((a)-(b)))<0)
#define LE32(a,b) (((spx_int32_t)((a)-(b)))<=0)
-#define ROUND_DOWN(x, step) ((x)<0 ? ((x)-(step)+1)/(step)*(step) : (x)/(step)*(step))
+#define ROUND_DOWN(x, step) ((x)<0 ? ((x)-(step)+1)/(step)*(step) : (x)/(step)*(step))
#define MAX_TIMINGS 40
#define MAX_BUFFERS 3
@@ -101,7 +101,7 @@ static void tb_add(struct TimingBuffer *tb, spx_int16_t timing)
tb->curr_count++;
return;
}
-
+
/* Find where the timing info goes in the sorted list */
pos = 0;
/* FIXME: Do bisection instead of linear search */
@@ -109,9 +109,9 @@ static void tb_add(struct TimingBuffer *tb, spx_int16_t timing)
{
pos++;
}
-
+
speex_assert(pos <= tb->filled && pos < MAX_TIMINGS);
-
+
/* Shift everything so we can perform the insertion */
if (pos < tb->filled)
{
@@ -124,7 +124,7 @@ static void tb_add(struct TimingBuffer *tb, spx_int16_t timing)
/* Insert */
tb->timing[pos] = timing;
tb->counts[pos] = tb->curr_count;
-
+
tb->curr_count++;
if (tb->filled<MAX_TIMINGS)
tb->filled++;
@@ -137,12 +137,12 @@ struct JitterBuffer_ {
spx_uint32_t pointer_timestamp; /**< Timestamp of what we will *get* next */
spx_uint32_t last_returned_timestamp; /**< Useful for getting the next packet with the same timestamp (for fragmented media) */
spx_uint32_t next_stop; /**< Estimated time the next get() will be called */
-
+
spx_int32_t buffered; /**< Amount of data we think is still buffered by the application (timestamp units)*/
-
+
JitterBufferPacket packets[SPEEX_JITTER_MAX_BUFFER_SIZE]; /**< Packets stored in the buffer */
spx_uint32_t arrival[SPEEX_JITTER_MAX_BUFFER_SIZE]; /**< Packet arrival time (0 means it was late, even though it's a valid timestamp) */
-
+
void (*destroy) (void *); /**< Callback for destroying a packet */
spx_int32_t delay_step; /**< Size of the steps when adjusting buffering (timestamp units) */
@@ -152,7 +152,7 @@ struct JitterBuffer_ {
int late_cutoff; /**< How late must a packet be for it not to be considered at all */
int interp_requested; /**< An interpolation is requested by speex_jitter_update_delay() */
int auto_adjust; /**< Whether to automatically adjust the delay at any time */
-
+
struct TimingBuffer _tb[MAX_BUFFERS]; /**< Don't use those directly */
struct TimingBuffer *timeBuffers[MAX_BUFFERS]; /**< Storing arrival time of latest frames so we can compute some stats */
int window_size; /**< Total window over which the late frames are counted */
@@ -160,15 +160,15 @@ struct JitterBuffer_ {
int max_late_rate; /**< Absolute maximum amount of late packets tolerable (in percent) */
int latency_tradeoff; /**< Latency equivalent of losing one percent of packets */
int auto_tradeoff; /**< Latency equivalent of losing one percent of packets (automatic default) */
-
+
int lost_count; /**< Number of consecutive lost packets */
};
-/** Based on available data, this computes the optimal delay for the jitter buffer.
+/** Based on available data, this computes the optimal delay for the jitter buffer.
The optimised function is in timestamp units and is:
cost = delay + late_factor*[number of frames that would be late if we used that delay]
@param tb Array of buffers
- @param late_factor Equivalent cost of a late frame (in timestamp units)
+ @param late_factor Equivalent cost of a late frame (in timestamp units)
*/
static spx_int16_t compute_opt_delay(JitterBuffer *jitter)
{
@@ -184,27 +184,27 @@ static spx_int16_t compute_opt_delay(JitterBuffer *jitter)
int worst = 0;
spx_int32_t deltaT;
struct TimingBuffer *tb;
-
+
tb = jitter->_tb;
-
+
/* Number of packet timings we have received (including those we didn't keep) */
tot_count = 0;
for (i=0;i<MAX_BUFFERS;i++)
tot_count += tb[i].curr_count;
if (tot_count==0)
return 0;
-
+
/* Compute cost for one lost packet */
if (jitter->latency_tradeoff != 0)
late_factor = jitter->latency_tradeoff * 100.0f / tot_count;
else
late_factor = jitter->auto_tradeoff * jitter->window_size/tot_count;
-
+
/*fprintf(stderr, "late_factor = %f\n", late_factor);*/
for (i=0;i<MAX_BUFFERS;i++)
pos[i] = 0;
-
- /* Pick the TOP_DELAY "latest" packets (doesn't need to actually be late
+
+ /* Pick the TOP_DELAY "latest" packets (doesn't need to actually be late
for the current settings) */
for (i=0;i<TOP_DELAY;i++)
{
@@ -223,13 +223,13 @@ static spx_int16_t compute_opt_delay(JitterBuffer *jitter)
if (next != -1)
{
spx_int32_t cost;
-
+
if (i==0)
worst = latest;
best = latest;
latest = ROUND_DOWN(latest, jitter->delay_step);
pos[next]++;
-
+
/* Actual cost function that tells us how bad using this delay would be */
cost = -latest + late_factor*late;
/*fprintf(stderr, "cost %d = %d + %f * %d\n", cost, -latest, late_factor, late);*/
@@ -241,7 +241,7 @@ static spx_int16_t compute_opt_delay(JitterBuffer *jitter)
} else {
break;
}
-
+
/* For the next timing we will consider, there will be one more late packet to count */
late++;
/* Two-frame penalty if we're going to increase the amount of late frames (hysteresis) */
@@ -251,14 +251,14 @@ static spx_int16_t compute_opt_delay(JitterBuffer *jitter)
late+=4;
}
}
-
+
deltaT = best-worst;
/* This is a default "automatic latency tradeoff" when none is provided */
jitter->auto_tradeoff = 1 + deltaT/TOP_DELAY;
/*fprintf(stderr, "auto_tradeoff = %d (%d %d %d)\n", jitter->auto_tradeoff, best, worst, i);*/
-
+
/* FIXME: Compute a short-term estimate too and combine with the long-term one */
-
+
/* Prevents reducing the buffer size when we haven't really had much data */
if (tot_count < TOP_DELAY && opt > 0)
return 0;
@@ -313,7 +313,7 @@ EXPORT void jitter_buffer_reset(JitterBuffer *jitter)
jitter->lost_count = 0;
jitter->buffered = 0;
jitter->auto_tradeoff = 32000;
-
+
for (i=0;i<MAX_BUFFERS;i++)
{
tb_init(&jitter->_tb[i]);
@@ -368,7 +368,7 @@ EXPORT void jitter_buffer_put(JitterBuffer *jitter, const JitterBufferPacket *pa
int i,j;
int late;
/*fprintf (stderr, "put packet %d %d\n", timestamp, span);*/
-
+
/* Cleanup buffer (remove old packets that weren't played) */
if (!jitter->reset_state)
{
@@ -386,7 +386,7 @@ EXPORT void jitter_buffer_put(JitterBuffer *jitter, const JitterBufferPacket *pa
}
}
}
-
+
/*fprintf(stderr, "arrival: %d %d %d\n", packet->timestamp, jitter->next_stop, jitter->pointer_timestamp);*/
/* Check if packet is late (could still be useful though) */
if (!jitter->reset_state && LT32(packet->timestamp, jitter->next_stop))
@@ -403,7 +403,7 @@ EXPORT void jitter_buffer_put(JitterBuffer *jitter, const JitterBufferPacket *pa
{
jitter_buffer_reset(jitter);
}
-
+
/* Only insert the packet if it's not hopelessly late (i.e. totally useless) */
if (jitter->reset_state || GE32(packet->timestamp+packet->span+jitter->delay_step, jitter->pointer_timestamp))
{
@@ -414,7 +414,7 @@ EXPORT void jitter_buffer_put(JitterBuffer *jitter, const JitterBufferPacket *pa
if (jitter->packets[i].data==NULL)
break;
}
-
+
/*No place left in the buffer, need to make room for it by discarding the oldest packet */
if (i==SPEEX_JITTER_MAX_BUFFER_SIZE)
{
@@ -433,9 +433,9 @@ EXPORT void jitter_buffer_put(JitterBuffer *jitter, const JitterBufferPacket *pa
else
speex_free(jitter->packets[i].data);
jitter->packets[i].data=NULL;
- /*fprintf (stderr, "Buffer is full, discarding earliest frame %d (currently at %d)\n", timestamp, jitter->pointer_timestamp);*/
+ /*fprintf (stderr, "Buffer is full, discarding earliest frame %d (currently at %d)\n", timestamp, jitter->pointer_timestamp);*/
}
-
+
/* Copy packet in buffer */
if (jitter->destroy)
{
@@ -455,8 +455,8 @@ EXPORT void jitter_buffer_put(JitterBuffer *jitter, const JitterBufferPacket *pa
else
jitter->arrival[i] = jitter->next_stop;
}
-
-
+
+
}
/** Get one packet from the jitter buffer */
@@ -465,7 +465,7 @@ EXPORT int jitter_buffer_get(JitterBuffer *jitter, JitterBufferPacket *packet, s
int i;
unsigned int j;
spx_int16_t opt;
-
+
if (start_offset != NULL)
*start_offset = 0;
@@ -485,7 +485,7 @@ EXPORT int jitter_buffer_get(JitterBuffer *jitter, JitterBufferPacket *packet, s
}
if (found)
{
- jitter->reset_state=0;
+ jitter->reset_state=0;
jitter->pointer_timestamp = oldest;
jitter->next_stop = oldest;
} else {
@@ -494,36 +494,36 @@ EXPORT int jitter_buffer_get(JitterBuffer *jitter, JitterBufferPacket *packet, s
return JITTER_BUFFER_MISSING;
}
}
-
+
jitter->last_returned_timestamp = jitter->pointer_timestamp;
-
+
if (jitter->interp_requested != 0)
{
packet->timestamp = jitter->pointer_timestamp;
packet->span = jitter->interp_requested;
-
+
/* Increment the pointer because it got decremented in the delay update */
jitter->pointer_timestamp += jitter->interp_requested;
packet->len = 0;
/*fprintf (stderr, "Deferred interpolate\n");*/
-
+
jitter->interp_requested = 0;
-
+
jitter->buffered = packet->span - desired_span;
return JITTER_BUFFER_INSERTION;
}
-
+
/* Searching for the packet that fits best */
-
+
/* Search the buffer for a packet with the right timestamp and spanning the whole current chunk */
for (i=0;i<SPEEX_JITTER_MAX_BUFFER_SIZE;i++)
{
if (jitter->packets[i].data && jitter->packets[i].timestamp==jitter->pointer_timestamp && GE32(jitter->packets[i].timestamp+jitter->packets[i].span,jitter->pointer_timestamp+desired_span))
break;
}
-
+
/* If no match, try for an "older" packet that still spans (fully) the current chunk */
if (i==SPEEX_JITTER_MAX_BUFFER_SIZE)
{
@@ -533,7 +533,7 @@ EXPORT int jitter_buffer_get(JitterBuffer *jitter, JitterBufferPacket *packet, s
break;
}
}
-
+
/* If still no match, try for an "older" packet that spans part of the current chunk */
if (i==SPEEX_JITTER_MAX_BUFFER_SIZE)
{
@@ -543,7 +543,7 @@ EXPORT int jitter_buffer_get(JitterBuffer *jitter, JitterBufferPacket *packet, s
break;
}
}
-
+
/* If still no match, try for earliest packet possible */
if (i==SPEEX_JITTER_MAX_BUFFER_SIZE)
{
@@ -576,17 +576,17 @@ EXPORT int jitter_buffer_get(JitterBuffer *jitter, JitterBufferPacket *packet, s
if (i!=SPEEX_JITTER_MAX_BUFFER_SIZE)
{
spx_int32_t offset;
-
+
/* We (obviously) haven't lost this packet */
jitter->lost_count = 0;
-
+
/* In this case, 0 isn't as a valid timestamp */
if (jitter->arrival[i] != 0)
{
update_timings(jitter, ((spx_int32_t)jitter->packets[i].timestamp) - ((spx_int32_t)jitter->arrival[i]) - jitter->buffer_margin);
}
-
-
+
+
/* Copy packet */
if (jitter->destroy)
{
@@ -611,10 +611,10 @@ EXPORT int jitter_buffer_get(JitterBuffer *jitter, JitterBufferPacket *packet, s
*start_offset = offset;
else if (offset != 0)
speex_warning_int("jitter_buffer_get() discarding non-zero start_offset", offset);
-
+
packet->timestamp = jitter->packets[i].timestamp;
jitter->last_returned_timestamp = packet->timestamp;
-
+
packet->span = jitter->packets[i].span;
packet->sequence = jitter->packets[i].sequence;
packet->user_data = jitter->packets[i].user_data;
@@ -622,36 +622,36 @@ EXPORT int jitter_buffer_get(JitterBuffer *jitter, JitterBufferPacket *packet, s
jitter->pointer_timestamp = jitter->packets[i].timestamp+jitter->packets[i].span;
jitter->buffered = packet->span - desired_span;
-
+
if (start_offset != NULL)
jitter->buffered += *start_offset;
-
+
return JITTER_BUFFER_OK;
}
-
-
+
+
/* If we haven't found anything worth returning */
-
+
/*fprintf (stderr, "not found\n");*/
jitter->lost_count++;
/*fprintf (stderr, "m");*/
/*fprintf (stderr, "lost_count = %d\n", jitter->lost_count);*/
-
+
opt = compute_opt_delay(jitter);
-
- /* Should we force an increase in the buffer or just do normal interpolation? */
+
+ /* Should we force an increase in the buffer or just do normal interpolation? */
if (opt < 0)
{
/* Need to increase buffering */
-
+
/* Shift histogram to compensate */
shift_timings(jitter, -opt);
-
+
packet->timestamp = jitter->pointer_timestamp;
packet->span = -opt;
/* Don't move the pointer_timestamp forward */
packet->len = 0;
-
+
jitter->buffered = packet->span - desired_span;
return JITTER_BUFFER_INSERTION;
/*jitter->pointer_timestamp -= jitter->delay_step;*/
@@ -659,12 +659,12 @@ EXPORT int jitter_buffer_get(JitterBuffer *jitter, JitterBufferPacket *packet, s
} else {
/* Normal packet loss */
packet->timestamp = jitter->pointer_timestamp;
-
+
desired_span = ROUND_DOWN(desired_span, jitter->concealment_size);
packet->span = desired_span;
jitter->pointer_timestamp += desired_span;
packet->len = 0;
-
+
jitter->buffered = packet->span - desired_span;
return JITTER_BUFFER_MISSING;
/*fprintf (stderr, "Normal loss\n");*/
@@ -713,11 +713,11 @@ static int _jitter_buffer_update_delay(JitterBuffer *jitter, JitterBufferPacket
{
spx_int16_t opt = compute_opt_delay(jitter);
/*fprintf(stderr, "opt adjustment is %d ", opt);*/
-
+
if (opt < 0)
{
shift_timings(jitter, -opt);
-
+
jitter->pointer_timestamp += opt;
jitter->interp_requested = -opt;
/*fprintf (stderr, "Decision to interpolate %d samples\n", -opt);*/
@@ -727,14 +727,14 @@ static int _jitter_buffer_update_delay(JitterBuffer *jitter, JitterBufferPacket
jitter->pointer_timestamp += opt;
/*fprintf (stderr, "Decision to drop %d samples\n", opt);*/
}
-
+
return opt;
}
/* Let the jitter buffer know it's the right time to adjust the buffering delay to the network conditions */
EXPORT int jitter_buffer_update_delay(JitterBuffer *jitter, JitterBufferPacket *packet, spx_int32_t *start_offset)
{
- /* If the programmer calls jitter_buffer_update_delay() directly,
+ /* If the programmer calls jitter_buffer_update_delay() directly,
automatically disable auto-adjustment */
jitter->auto_adjust = 0;
@@ -752,7 +752,7 @@ EXPORT void jitter_buffer_tick(JitterBuffer *jitter)
/* Automatically-adjust the buffering delay if requested */
if (jitter->auto_adjust)
_jitter_buffer_update_delay(jitter, NULL, NULL);
-
+
if (jitter->buffered >= 0)
{
jitter->next_stop = jitter->pointer_timestamp - jitter->buffered;
@@ -768,7 +768,7 @@ EXPORT void jitter_buffer_remaining_span(JitterBuffer *jitter, spx_uint32_t rem)
/* Automatically-adjust the buffering delay if requested */
if (jitter->auto_adjust)
_jitter_buffer_update_delay(jitter, NULL, NULL);
-
+
if (jitter->buffered < 0)
speex_warning_int("jitter buffer sees negative buffering, your code might be broken. Value is ", jitter->buffered);
jitter->next_stop = jitter->pointer_timestamp - rem;
diff --git a/libspeexdsp/kiss_fft.c b/libspeexdsp/kiss_fft.c
index 6778281..285e557 100644
--- a/libspeexdsp/kiss_fft.c
+++ b/libspeexdsp/kiss_fft.c
@@ -110,7 +110,7 @@ static void kf_bfly4(
C_MUL(scratch[0],Fout[m] , *tw1 );
C_MUL(scratch[1],Fout[m2] , *tw2 );
C_MUL(scratch[2],Fout[m3] , *tw3 );
-
+
C_SUB( scratch[5] , *Fout, scratch[1] );
C_ADDTO(*Fout, scratch[1]);
C_ADD( scratch[3] , scratch[0] , scratch[2] );
@@ -120,7 +120,7 @@ static void kf_bfly4(
tw2 += fstride*2;
tw3 += fstride*3;
C_ADDTO( *Fout , scratch[3] );
-
+
Fout[m].r = scratch[5].r - scratch[4].i;
Fout[m].i = scratch[5].i + scratch[4].r;
Fout[m3].r = scratch[5].r + scratch[4].i;
@@ -140,7 +140,7 @@ static void kf_bfly4(
C_MUL4(scratch[0],Fout[m] , *tw1 );
C_MUL4(scratch[1],Fout[m2] , *tw2 );
C_MUL4(scratch[2],Fout[m3] , *tw3 );
-
+
Fout->r = PSHR16(Fout->r, 2);
Fout->i = PSHR16(Fout->i, 2);
C_SUB( scratch[5] , *Fout, scratch[1] );
@@ -154,7 +154,7 @@ static void kf_bfly4(
tw2 += fstride*2;
tw3 += fstride*3;
C_ADDTO( *Fout , scratch[3] );
-
+
Fout[m].r = scratch[5].r + scratch[4].i;
Fout[m].i = scratch[5].i - scratch[4].r;
Fout[m3].r = scratch[5].r - scratch[4].i;
@@ -292,7 +292,7 @@ static void kf_bfly_generic(
/*CHECKBUF(scratchbuf,nscratchbuf,p);*/
if (p>17)
speex_fatal("KissFFT: max radix supported is 17");
-
+
for ( u=0; u<m; ++u ) {
k=u;
for ( q1=0 ; q1<p ; ++q1 ) {
@@ -317,7 +317,7 @@ static void kf_bfly_generic(
}
}
}
-
+
static
void kf_shuffle(
kiss_fft_cpx * Fout,
@@ -330,7 +330,7 @@ void kf_shuffle(
{
const int p=*factors++; /* the radix */
const int m=*factors++; /* stage's fft length/p */
-
+
/*printf ("fft %d %d %d %d %d %d\n", p*m, m, p, s2, fstride*in_stride, N);*/
if (m==1)
{
@@ -392,14 +392,14 @@ void kf_work(
switch (p) {
case 2: kf_bfly2(Fout,fstride,st,m); break;
- case 3: kf_bfly3(Fout,fstride,st,m); break;
+ case 3: kf_bfly3(Fout,fstride,st,m); break;
case 4: kf_bfly4(Fout,fstride,st,m); break;
- case 5: kf_bfly5(Fout,fstride,st,m); break;
+ case 5: kf_bfly5(Fout,fstride,st,m); break;
default: kf_bfly_generic(Fout,fstride,st,m,p); break;
}
#else
/*printf ("fft %d %d %d %d %d %d %d\n", p*m, m, p, s2, fstride*in_stride, N, m2);*/
- if (m==1)
+ if (m==1)
{
/*for (i=0;i<N;i++)
{
@@ -416,24 +416,24 @@ void kf_work(
kf_work( Fout , f, fstride*p, in_stride, factors,st, N*p, fstride*in_stride, m);
}
-
-
-
+
+
+
switch (p) {
case 2: kf_bfly2(Fout,fstride,st,m, N, m2); break;
- case 3: for (i=0;i<N;i++){Fout=Fout_beg+i*m2; kf_bfly3(Fout,fstride,st,m);} break;
+ case 3: for (i=0;i<N;i++){Fout=Fout_beg+i*m2; kf_bfly3(Fout,fstride,st,m);} break;
case 4: kf_bfly4(Fout,fstride,st,m, N, m2); break;
- case 5: for (i=0;i<N;i++){Fout=Fout_beg+i*m2; kf_bfly5(Fout,fstride,st,m);} break;
+ case 5: for (i=0;i<N;i++){Fout=Fout_beg+i*m2; kf_bfly5(Fout,fstride,st,m);} break;
default: for (i=0;i<N;i++){Fout=Fout_beg+i*m2; kf_bfly_generic(Fout,fstride,st,m,p);} break;
- }
+ }
#endif
}
/* facbuf is populated by p1,m1,p2,m2, ...
- where
+ where
p[i] * m[i] = m[i-1]
m0 = n */
-static
+static
void kf_factor(int n,int * facbuf)
{
int p=4;
@@ -501,10 +501,10 @@ kiss_fft_cfg kiss_fft_alloc(int nfft,int inverse_fft,void * mem,size_t * lenmem
-
+
void kiss_fft_stride(kiss_fft_cfg st,const kiss_fft_cpx *fin,kiss_fft_cpx *fout,int in_stride)
{
- if (fin == fout)
+ if (fin == fout)
{
speex_fatal("In-place FFT not supported");
/*CHECKBUF(tmpbuf,ntmpbuf,st->nfft);
diff --git a/libspeexdsp/kiss_fft.h b/libspeexdsp/kiss_fft.h
index fa3f2c6..bb19ead 100644
--- a/libspeexdsp/kiss_fft.h
+++ b/libspeexdsp/kiss_fft.h
@@ -26,13 +26,13 @@ extern "C" {
# include <xmmintrin.h>
# define kiss_fft_scalar __m128
#define KISS_FFT_MALLOC(nbytes) memalign(16,nbytes)
-#else
+#else
#define KISS_FFT_MALLOC speex_alloc
-#endif
+#endif
#ifdef FIXED_POINT
-#include "arch.h"
+#include "arch.h"
# define kiss_fft_scalar spx_int16_t
#else
# ifndef kiss_fft_scalar
@@ -48,9 +48,9 @@ typedef struct {
typedef struct kiss_fft_state* kiss_fft_cfg;
-/*
+/*
* kiss_fft_alloc
- *
+ *
* Initialize a FFT (or IFFT) algorithm's cfg/state buffer.
*
* typical usage: kiss_fft_cfg mycfg=kiss_fft_alloc(1024,0,NULL,NULL);
@@ -60,18 +60,18 @@ typedef struct kiss_fft_state* kiss_fft_cfg;
*
* If lenmem is NULL, then kiss_fft_alloc will allocate a cfg buffer using malloc.
* The returned value should be free()d when done to avoid memory leaks.
- *
+ *
* The state can be placed in a user supplied buffer 'mem':
* If lenmem is not NULL and mem is not NULL and *lenmem is large enough,
* then the function places the cfg in mem and the size used in *lenmem
* and returns mem.
- *
+ *
* If lenmem is not NULL and ( mem is NULL or *lenmem is not large enough),
- * then the function returns NULL and places the minimum cfg
+ * then the function returns NULL and places the minimum cfg
* buffer size in *lenmem.
* */
-kiss_fft_cfg kiss_fft_alloc(int nfft,int inverse_fft,void * mem,size_t * lenmem);
+kiss_fft_cfg kiss_fft_alloc(int nfft,int inverse_fft,void * mem,size_t * lenmem);
/*
* kiss_fft(cfg,in_out_buf)
@@ -90,19 +90,19 @@ void kiss_fft(kiss_fft_cfg cfg,const kiss_fft_cpx *fin,kiss_fft_cpx *fout);
* */
void kiss_fft_stride(kiss_fft_cfg cfg,const kiss_fft_cpx *fin,kiss_fft_cpx *fout,int fin_stride);
-/* If kiss_fft_alloc allocated a buffer, it is one contiguous
+/* If kiss_fft_alloc allocated a buffer, it is one contiguous
buffer and can be simply free()d when no longer needed*/
#define kiss_fft_free speex_free
/*
- Cleans up some memory that gets managed internally. Not necessary to call, but it might clean up
+ Cleans up some memory that gets managed internally. Not necessary to call, but it might clean up
your compiler output to call this before you exit.
*/
void kiss_fft_cleanup(void);
-
+
#ifdef __cplusplus
-}
+}
#endif
#endif
diff --git a/libspeexdsp/kiss_fftr.c b/libspeexdsp/kiss_fftr.c
index f6275b8..827e0b1 100644
--- a/libspeexdsp/kiss_fftr.c
+++ b/libspeexdsp/kiss_fftr.c
@@ -24,9 +24,9 @@ struct kiss_fftr_state{
kiss_fft_cfg substate;
kiss_fft_cpx * tmpbuf;
kiss_fft_cpx * super_twiddles;
-#ifdef USE_SIMD
+#ifdef USE_SIMD
long pad;
-#endif
+#endif
};
kiss_fftr_cfg kiss_fftr_alloc(int nfft,int inverse_fft,void * mem,size_t * lenmem)
@@ -96,12 +96,12 @@ void kiss_fftr(kiss_fftr_cfg st,const kiss_fft_scalar *timedata,kiss_fft_cpx *fr
* contains the sum of the even-numbered elements of the input time sequence
* The imag part is the sum of the odd-numbered elements
*
- * The sum of tdc.r and tdc.i is the sum of the input time sequence.
+ * The sum of tdc.r and tdc.i is the sum of the input time sequence.
* yielding DC of input time sequence
- * The difference of tdc.r - tdc.i is the sum of the input (dot product) [1,-1,1,-1...
+ * The difference of tdc.r - tdc.i is the sum of the input (dot product) [1,-1,1,-1...
* yielding Nyquist bin of input time sequence
*/
-
+
tdc.r = st->tmpbuf[0].r;
tdc.i = st->tmpbuf[0].i;
C_FIXDIV(tdc,2);
@@ -109,14 +109,14 @@ void kiss_fftr(kiss_fftr_cfg st,const kiss_fft_scalar *timedata,kiss_fft_cpx *fr
CHECK_OVERFLOW_OP(tdc.r ,-, tdc.i);
freqdata[0].r = tdc.r + tdc.i;
freqdata[ncfft].r = tdc.r - tdc.i;
-#ifdef USE_SIMD
+#ifdef USE_SIMD
freqdata[ncfft].i = freqdata[0].i = _mm_set1_ps(0);
#else
freqdata[ncfft].i = freqdata[0].i = 0;
#endif
for ( k=1;k <= ncfft/2 ; ++k ) {
- fpk = st->tmpbuf[k];
+ fpk = st->tmpbuf[k];
fpnk.r = st->tmpbuf[ncfft-k].r;
fpnk.i = - st->tmpbuf[ncfft-k].i;
C_FIXDIV(fpk,2);
@@ -161,7 +161,7 @@ void kiss_fftri(kiss_fftr_cfg st,const kiss_fft_cpx *freqdata, kiss_fft_scalar *
C_MUL (fok, tmp, st->super_twiddles[k]);
C_ADD (st->tmpbuf[k], fek, fok);
C_SUB (st->tmpbuf[ncfft - k], fek, fok);
-#ifdef USE_SIMD
+#ifdef USE_SIMD
st->tmpbuf[ncfft - k].i *= _mm_set1_ps(-1.0);
#else
st->tmpbuf[ncfft - k].i *= -1;
@@ -189,12 +189,12 @@ void kiss_fftr2(kiss_fftr_cfg st,const kiss_fft_scalar *timedata,kiss_fft_scalar
* contains the sum of the even-numbered elements of the input time sequence
* The imag part is the sum of the odd-numbered elements
*
- * The sum of tdc.r and tdc.i is the sum of the input time sequence.
+ * The sum of tdc.r and tdc.i is the sum of the input time sequence.
* yielding DC of input time sequence
- * The difference of tdc.r - tdc.i is the sum of the input (dot product) [1,-1,1,-1...
+ * The difference of tdc.r - tdc.i is the sum of the input (dot product) [1,-1,1,-1...
* yielding Nyquist bin of input time sequence
*/
-
+
tdc.r = st->tmpbuf[0].r;
tdc.i = st->tmpbuf[0].i;
C_FIXDIV(tdc,2);
@@ -205,7 +205,7 @@ void kiss_fftr2(kiss_fftr_cfg st,const kiss_fft_scalar *timedata,kiss_fft_scalar
for ( k=1;k <= ncfft/2 ; ++k )
{
- /*fpk = st->tmpbuf[k];
+ /*fpk = st->tmpbuf[k];
fpnk.r = st->tmpbuf[ncfft-k].r;
fpnk.i = - st->tmpbuf[ncfft-k].i;
C_FIXDIV(fpk,2);
@@ -213,7 +213,7 @@ void kiss_fftr2(kiss_fftr_cfg st,const kiss_fft_scalar *timedata,kiss_fft_scalar
C_ADD( f1k, fpk , fpnk );
C_SUB( f2k, fpk , fpnk );
-
+
C_MUL( tw , f2k , st->super_twiddles[k]);
freqdata[2*k-1] = HALF_OF(f1k.r + tw.r);
@@ -226,7 +226,7 @@ void kiss_fftr2(kiss_fftr_cfg st,const kiss_fft_scalar *timedata,kiss_fft_scalar
f1k.i = PSHR32(SUB32(EXTEND32(st->tmpbuf[k].i), EXTEND32(st->tmpbuf[ncfft-k].i)),1);
f2k.r = PSHR32(SUB32(EXTEND32(st->tmpbuf[k].r), EXTEND32(st->tmpbuf[ncfft-k].r)),1);
f2k.i = SHR32(ADD32(EXTEND32(st->tmpbuf[k].i), EXTEND32(st->tmpbuf[ncfft-k].i)),1);
-
+
C_MUL( tw , f2k , st->super_twiddles[k]);
freqdata[2*k-1] = HALF_OF(f1k.r + tw.r);
@@ -236,13 +236,13 @@ void kiss_fftr2(kiss_fftr_cfg st,const kiss_fft_scalar *timedata,kiss_fft_scalar
*/
f2k.r = SHR32(SUB32(EXTEND32(st->tmpbuf[k].r), EXTEND32(st->tmpbuf[ncfft-k].r)),1);
f2k.i = PSHR32(ADD32(EXTEND32(st->tmpbuf[k].i), EXTEND32(st->tmpbuf[ncfft-k].i)),1);
-
+
f1kr = SHL32(ADD32(EXTEND32(st->tmpbuf[k].r), EXTEND32(st->tmpbuf[ncfft-k].r)),13);
f1ki = SHL32(SUB32(EXTEND32(st->tmpbuf[k].i), EXTEND32(st->tmpbuf[ncfft-k].i)),13);
-
+
twr = SHR32(SUB32(MULT16_16(f2k.r,st->super_twiddles[k].r),MULT16_16(f2k.i,st->super_twiddles[k].i)), 1);
twi = SHR32(ADD32(MULT16_16(f2k.i,st->super_twiddles[k].r),MULT16_16(f2k.r,st->super_twiddles[k].i)), 1);
-
+
#ifdef FIXED_POINT
freqdata[2*k-1] = PSHR32(f1kr + twr, 15);
freqdata[2*k] = PSHR32(f1ki + twi, 15);
@@ -253,7 +253,7 @@ void kiss_fftr2(kiss_fftr_cfg st,const kiss_fft_scalar *timedata,kiss_fft_scalar
freqdata[2*k] = .5f*(f1ki + twi);
freqdata[2*(ncfft-k)-1] = .5f*(f1kr - twr);
freqdata[2*(ncfft-k)] = .5f*(twi - f1ki);
-
+
#endif
}
}
@@ -287,7 +287,7 @@ void kiss_fftri2(kiss_fftr_cfg st,const kiss_fft_scalar *freqdata,kiss_fft_scala
C_MUL (fok, tmp, st->super_twiddles[k]);
C_ADD (st->tmpbuf[k], fek, fok);
C_SUB (st->tmpbuf[ncfft - k], fek, fok);
-#ifdef USE_SIMD
+#ifdef USE_SIMD
st->tmpbuf[ncfft - k].i *= _mm_set1_ps(-1.0);
#else
st->tmpbuf[ncfft - k].i *= -1;
diff --git a/libspeexdsp/kiss_fftr.h b/libspeexdsp/kiss_fftr.h
index 7bfb423..8cfeda1 100644
--- a/libspeexdsp/kiss_fftr.h
+++ b/libspeexdsp/kiss_fftr.h
@@ -6,13 +6,13 @@
extern "C" {
#endif
-
-/*
-
+
+/*
+
Real optimized version can save about 45% cpu time vs. complex fft of a real seq.
-
-
+
+
*/
typedef struct kiss_fftr_state *kiss_fftr_cfg;
@@ -22,7 +22,7 @@ kiss_fftr_cfg kiss_fftr_alloc(int nfft,int inverse_fft,void * mem, size_t * lenm
/*
nfft must be even
- If you don't care to allocate space, use mem = lenmem = NULL
+ If you don't care to allocate space, use mem = lenmem = NULL
*/
diff --git a/libspeexdsp/math_approx.h b/libspeexdsp/math_approx.h
index 9ca8307..596dfdc 100644
--- a/libspeexdsp/math_approx.h
+++ b/libspeexdsp/math_approx.h
@@ -7,18 +7,18 @@
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
-
+
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
-
+
- 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.
-
+
- Neither the name of the Xiph.org Foundation nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
-
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -168,11 +168,11 @@ static inline spx_word16_t spx_acos(spx_word16_t x)
x = NEG16(x);
}
x = SUB16(16384,x);
-
+
x = x >> 1;
sq = MULT16_16_Q13(x, ADD16(A1, MULT16_16_Q13(x, ADD16(A2, MULT16_16_Q13(x, (A3))))));
ret = spx_sqrt(SHL32(EXTEND32(sq),13));
-
+
/*ret = spx_sqrt(67108864*(-1.6129e-04 + 2.0104e+00*f + 2.7373e-01*f*f + 1.8136e-01*f*f*f));*/
if (s)
ret = SUB16(25736,ret);
@@ -208,7 +208,7 @@ static inline spx_word16_t spx_cos(spx_word16_t x)
static inline spx_word16_t _spx_cos_pi_2(spx_word16_t x)
{
spx_word16_t x2;
-
+
x2 = MULT16_16_P15(x,x);
return ADD16(1,MIN16(32766,ADD32(SUB16(L1,x2), MULT16_16_P15(x2, ADD32(L2, MULT16_16_P15(x2, ADD32(L3, MULT16_16_P15(L4, x2))))))));
}
diff --git a/libspeexdsp/mdf.c b/libspeexdsp/mdf.c
index 456ab84..1193387 100644
--- a/libspeexdsp/mdf.c
+++ b/libspeexdsp/mdf.c
@@ -33,36 +33,36 @@
/*
The echo canceller is based on the MDF algorithm described in:
- J. S. Soo, K. K. Pang Multidelay block frequency adaptive filter,
- IEEE Trans. Acoust. Speech Signal Process., Vol. ASSP-38, No. 2,
+ J. S. Soo, K. K. Pang Multidelay block frequency adaptive filter,
+ IEEE Trans. Acoust. Speech Signal Process., Vol. ASSP-38, No. 2,
February 1990.
-
- We use the Alternatively Updated MDF (AUMDF) variant. Robustness to
+
+ We use the Alternatively Updated MDF (AUMDF) variant. Robustness to
double-talk is achieved using a variable learning rate as described in:
-
- Valin, J.-M., On Adjusting the Learning Rate in Frequency Domain Echo
+
+ Valin, J.-M., On Adjusting the Learning Rate in Frequency Domain Echo
Cancellation With Double-Talk. IEEE Transactions on Audio,
Speech and Language Processing, Vol. 15, No. 3, pp. 1030-1034, 2007.
http://people.xiph.org/~jm/papers/valin_taslp2006.pdf
-
+
There is no explicit double-talk detection, but a continuous variation
in the learning rate based on residual echo, double-talk and background
noise.
-
+
About the fixed-point version:
- All the signals are represented with 16-bit words. The filter weights
+ All the signals are represented with 16-bit words. The filter weights
are represented with 32-bit words, but only the top 16 bits are used
in most cases. The lower 16 bits are completely unreliable (due to the
fact that the update is done only on the top bits), but help in the
adaptation -- probably by removing a "threshold effect" due to
quantization (rounding going to zero) when the gradient is small.
-
+
Another kludge that seems to work good: when performing the weight
update, we only move half the way toward the "goal" this seems to
reduce the effect of quantization noise in the update phase. This
can be seen as applying a gradient descent on a "soft constraint"
instead of having a hard constraint.
-
+
*/
#ifdef HAVE_CONFIG_H
@@ -89,9 +89,9 @@
#endif
#ifdef FIXED_POINT
-#define WORD2INT(x) ((x) < -32767 ? -32768 : ((x) > 32766 ? 32767 : (x)))
+#define WORD2INT(x) ((x) < -32767 ? -32768 : ((x) > 32766 ? 32767 : (x)))
#else
-#define WORD2INT(x) ((x) < -32767.5f ? -32768 : ((x) > 32766.5f ? 32767 : floor(.5+(x))))
+#define WORD2INT(x) ((x) < -32767.5f ? -32768 : ((x) > 32766.5f ? 32767 : floor(.5+(x))))
#endif
/* If enabled, the AEC will use a foreground filter and a background filter to be more robust to double-talk
@@ -145,7 +145,7 @@ struct SpeexEchoState_ {
spx_word16_t beta_max;
spx_word32_t sum_adapt;
spx_word16_t leak_estimate;
-
+
spx_word16_t *e; /* scratch */
spx_word16_t *x; /* Far-end input buffer (2N) */
spx_word16_t *X; /* Far-end buffer (M+1 frames) in frequency domain */
@@ -198,7 +198,7 @@ static inline void filter_dc_notch16(const spx_int16_t *in, spx_word16_t radius,
den2 = MULT16_16_Q15(radius,radius) + MULT16_16_Q15(QCONST16(.7,15),MULT16_16_Q15(32767-radius,32767-radius));
#else
den2 = radius*radius + .7*(1-radius)*(1-radius);
-#endif
+#endif
/*printf ("%d %d %d %d %d %d\n", num[0], num[1], num[2], den[0], den[1], den[2]);*/
for (i=0;i<len;i++)
{
@@ -420,7 +420,7 @@ EXPORT SpeexEchoState *speex_echo_state_init_mc(int frame_size, int filter_lengt
pFile = fopen("aec_play.sw", "wb");
oFile = fopen("aec_out.sw", "wb");
#endif
-
+
st->frame_size = frame_size;
st->window_size = 2*frame_size;
N = st->window_size;
@@ -442,7 +442,7 @@ EXPORT SpeexEchoState *speex_echo_state_init_mc(int frame_size, int filter_lengt
st->leak_estimate = 0;
st->fft_table = spx_fft_init(N);
-
+
st->e = (spx_word16_t*)speex_alloc(C*N*sizeof(spx_word16_t));
st->x = (spx_word16_t*)speex_alloc(K*N*sizeof(spx_word16_t));
st->input = (spx_word16_t*)speex_alloc(C*st->frame_size*sizeof(spx_word16_t));
@@ -498,7 +498,7 @@ EXPORT SpeexEchoState *speex_echo_state_init_mc(int frame_size, int filter_lengt
st->prop[i] = DIV32(MULT16_16(QCONST16(.8f,15), st->prop[i]),sum);
}
}
-
+
st->memX = (spx_word16_t*)speex_alloc(K*sizeof(spx_word16_t));
st->memD = (spx_word16_t*)speex_alloc(C*sizeof(spx_word16_t));
st->memE = (spx_word16_t*)speex_alloc(C*sizeof(spx_word16_t));
@@ -513,16 +513,16 @@ EXPORT SpeexEchoState *speex_echo_state_init_mc(int frame_size, int filter_lengt
st->notch_mem = (spx_mem_t*)speex_alloc(2*C*sizeof(spx_mem_t));
st->adapted = 0;
st->Pey = st->Pyy = FLOAT_ONE;
-
+
#ifdef TWO_PATH
st->Davg1 = st->Davg2 = 0;
st->Dvar1 = st->Dvar2 = FLOAT_ZERO;
#endif
-
+
st->play_buf = (spx_int16_t*)speex_alloc(K*(PLAYBACK_DELAY+1)*st->frame_size*sizeof(spx_int16_t));
st->play_buf_pos = PLAYBACK_DELAY*st->frame_size;
st->play_buf_started = 0;
-
+
return st;
}
@@ -624,7 +624,7 @@ EXPORT void speex_echo_state_destroy(SpeexEchoState *st)
speex_free(st->play_buf);
speex_free(st);
-
+
#ifdef DUMP_ECHO_CANCEL_DATA
fclose(rFile);
fclose(pFile);
@@ -704,7 +704,7 @@ EXPORT void speex_echo_cancellation(SpeexEchoState *st, const spx_int16_t *in, c
spx_float_t alpha, alpha_1;
spx_word16_t RER;
spx_word32_t tmp32;
-
+
N = st->window_size;
M = st->M;
C = st->C;
@@ -736,7 +736,7 @@ EXPORT void speex_echo_cancellation(SpeexEchoState *st, const spx_int16_t *in, c
tmp32 = 32767;
if (st->saturated == 0)
st->saturated = 1;
- }
+ }
if (tmp32 < -32767)
{
tmp32 = -32767;
@@ -762,18 +762,18 @@ EXPORT void speex_echo_cancellation(SpeexEchoState *st, const spx_int16_t *in, c
{
tmp32 = 32767;
st->saturated = M+1;
- }
+ }
if (tmp32 < -32767)
{
tmp32 = -32767;
st->saturated = M+1;
- }
+ }
#endif
st->x[speak*N+i+st->frame_size] = EXTRACT16(tmp32);
st->memX[speak] = far_end[i*K+speak];
}
- }
-
+ }
+
for (speak = 0; speak < K; speak++)
{
/* Shift memory: this could be optimized eventually*/
@@ -785,15 +785,15 @@ EXPORT void speex_echo_cancellation(SpeexEchoState *st, const spx_int16_t *in, c
/* Convert x (echo input) to frequency domain */
spx_fft(st->fft_table, st->x+speak*N, &st->X[speak*N]);
}
-
+
Sxx = 0;
for (speak = 0; speak < K; speak++)
{
Sxx += mdf_inner_prod(st->x+speak*N+st->frame_size, st->x+speak*N+st->frame_size, st->frame_size);
power_spectrum_accum(st->X+speak*N, st->Xf, N);
}
-
- Sff = 0;
+
+ Sff = 0;
for (chan = 0; chan < C; chan++)
{
#ifdef TWO_PATH
@@ -805,7 +805,7 @@ EXPORT void speex_echo_cancellation(SpeexEchoState *st, const spx_int16_t *in, c
Sff += mdf_inner_prod(st->e+chan*N, st->e+chan*N, st->frame_size);
#endif
}
-
+
/* Adjust proportional adaption rate */
/* FIXME: Adjust that for C, K*/
if (st->adapted)
@@ -828,8 +828,8 @@ EXPORT void speex_echo_cancellation(SpeexEchoState *st, const spx_int16_t *in, c
} else {
st->saturated--;
}
-
- /* FIXME: MC conversion required */
+
+ /* FIXME: MC conversion required */
/* Update weight to prevent circular convolution (MDF / AUMDF) */
for (chan = 0; chan < C; chan++)
{
@@ -869,13 +869,13 @@ EXPORT void speex_echo_cancellation(SpeexEchoState *st, const spx_int16_t *in, c
}
}
}
-
- /* So we can use power_spectrum_accum */
+
+ /* So we can use power_spectrum_accum */
for (i=0;i<=st->frame_size;i++)
st->Rf[i] = st->Yf[i] = st->Xf[i] = 0;
-
+
Dbf = 0;
- See = 0;
+ See = 0;
#ifdef TWO_PATH
/* Difference in response, this is used to estimate the variance of our residual power estimate */
for (chan = 0; chan < C; chan++)
@@ -897,20 +897,20 @@ EXPORT void speex_echo_cancellation(SpeexEchoState *st, const spx_int16_t *in, c
#ifdef TWO_PATH
/* Logic for updating the foreground filter */
-
+
/* For two time windows, compute the mean of the energy difference, as well as the variance */
st->Davg1 = ADD32(MULT16_32_Q15(QCONST16(.6f,15),st->Davg1), MULT16_32_Q15(QCONST16(.4f,15),SUB32(Sff,See)));
st->Davg2 = ADD32(MULT16_32_Q15(QCONST16(.85f,15),st->Davg2), MULT16_32_Q15(QCONST16(.15f,15),SUB32(Sff,See)));
st->Dvar1 = FLOAT_ADD(FLOAT_MULT(VAR1_SMOOTH, st->Dvar1), FLOAT_MUL32U(MULT16_32_Q15(QCONST16(.4f,15),Sff), MULT16_32_Q15(QCONST16(.4f,15),Dbf)));
st->Dvar2 = FLOAT_ADD(FLOAT_MULT(VAR2_SMOOTH, st->Dvar2), FLOAT_MUL32U(MULT16_32_Q15(QCONST16(.15f,15),Sff), MULT16_32_Q15(QCONST16(.15f,15),Dbf)));
-
+
/* Equivalent float code:
st->Davg1 = .6*st->Davg1 + .4*(Sff-See);
st->Davg2 = .85*st->Davg2 + .15*(Sff-See);
st->Dvar1 = .36*st->Dvar1 + .16*Sff*Dbf;
st->Dvar2 = .7225*st->Dvar2 + .0225*Sff*Dbf;
*/
-
+
update_foreground = 0;
/* Check if we have a statistically significant reduction in the residual echo */
/* Note that this is *not* Gaussian, so we need to be careful about the longer tail */
@@ -920,7 +920,7 @@ EXPORT void speex_echo_cancellation(SpeexEchoState *st, const spx_int16_t *in, c
update_foreground = 1;
else if (FLOAT_GT(FLOAT_MUL32U(st->Davg2, ABS32(st->Davg2)), FLOAT_MULT(VAR2_UPDATE,(st->Dvar2))))
update_foreground = 1;
-
+
/* Do we update? */
if (update_foreground)
{
@@ -949,12 +949,12 @@ EXPORT void speex_echo_cancellation(SpeexEchoState *st, const spx_int16_t *in, c
st->W[i] = SHL32(EXTEND32(st->foreground[i]),16);
/* We also need to copy the output so as to get correct adaptation */
for (chan = 0; chan < C; chan++)
- {
+ {
for (i=0;i<st->frame_size;i++)
st->y[chan*N+i+st->frame_size] = st->e[chan*N+i+st->frame_size];
for (i=0;i<st->frame_size;i++)
st->e[chan*N+i] = SUB16(st->input[chan*st->frame_size+i], st->y[chan*N+i+st->frame_size]);
- }
+ }
See = Sff;
st->Davg1 = st->Davg2 = 0;
st->Dvar1 = st->Dvar2 = FLOAT_ZERO;
@@ -962,10 +962,10 @@ EXPORT void speex_echo_cancellation(SpeexEchoState *st, const spx_int16_t *in, c
}
#endif
- Sey = Syy = Sdd = 0;
+ Sey = Syy = Sdd = 0;
for (chan = 0; chan < C; chan++)
- {
- /* Compute error signal (for the output with de-emphasis) */
+ {
+ /* Compute error signal (for the output with de-emphasis) */
for (i=0;i<st->frame_size;i++)
{
spx_word32_t tmp_out;
@@ -988,34 +988,34 @@ EXPORT void speex_echo_cancellation(SpeexEchoState *st, const spx_int16_t *in, c
#ifdef DUMP_ECHO_CANCEL_DATA
dump_audio(in, far_end, out, st->frame_size);
#endif
-
- /* Compute error signal (filter update version) */
+
+ /* Compute error signal (filter update version) */
for (i=0;i<st->frame_size;i++)
{
st->e[chan*N+i+st->frame_size] = st->e[chan*N+i];
st->e[chan*N+i] = 0;
}
-
+
/* Compute a bunch of correlations */
/* FIXME: bad merge */
Sey += mdf_inner_prod(st->e+chan*N+st->frame_size, st->y+chan*N+st->frame_size, st->frame_size);
Syy += mdf_inner_prod(st->y+chan*N+st->frame_size, st->y+chan*N+st->frame_size, st->frame_size);
Sdd += mdf_inner_prod(st->input+chan*st->frame_size, st->input+chan*st->frame_size, st->frame_size);
-
+
/* Convert error to frequency domain */
spx_fft(st->fft_table, st->e+chan*N, st->E+chan*N);
for (i=0;i<st->frame_size;i++)
st->y[i+chan*N] = 0;
spx_fft(st->fft_table, st->y+chan*N, st->Y+chan*N);
-
+
/* Compute power spectrum of echo (X), error (E) and filter response (Y) */
power_spectrum_accum(st->E+chan*N, st->Rf, N);
power_spectrum_accum(st->Y+chan*N, st->Yf, N);
-
+
}
-
+
/*printf ("%f %f %f %f\n", Sff, See, Syy, Sdd, st->update_cond);*/
-
+
/* Do some sanity check */
if (!(Syy>=0 && Sxx>=0 && See >= 0)
#ifndef FIXED_POINT
@@ -1044,14 +1044,14 @@ EXPORT void speex_echo_cancellation(SpeexEchoState *st, const spx_int16_t *in, c
/* Add a small noise floor to make sure not to have problems when dividing */
See = MAX32(See, SHR32(MULT16_16(N, 100),6));
-
+
for (speak = 0; speak < K; speak++)
{
Sxx += mdf_inner_prod(st->x+speak*N+st->frame_size, st->x+speak*N+st->frame_size, st->frame_size);
power_spectrum_accum(st->X+speak*N, st->Xf, N);
}
-
+
/* Smooth far end energy estimate over time */
for (j=0;j<=st->frame_size;j++)
st->power[j] = MULT16_32_Q15(ss_1,st->power[j]) + 1 + MULT16_32_Q15(ss,st->Xf[j]);
@@ -1072,7 +1072,7 @@ EXPORT void speex_echo_cancellation(SpeexEchoState *st, const spx_int16_t *in, c
st->Yh[j] = (1-st->spec_average)*st->Yh[j] + st->spec_average*st->Yf[j];
#endif
}
-
+
Pyy = FLOAT_SQRT(Pyy);
Pey = FLOAT_DIVU(Pey,Pyy);
@@ -1100,7 +1100,7 @@ EXPORT void speex_echo_cancellation(SpeexEchoState *st, const spx_int16_t *in, c
else
st->leak_estimate = SHL16(st->leak_estimate,1);
/*printf ("%f\n", st->leak_estimate);*/
-
+
/* Compute Residual to Error Ratio */
#ifdef FIXED_POINT
tmp32 = MULT16_32_Q15(st->leak_estimate,Syy);
@@ -1156,7 +1156,7 @@ EXPORT void speex_echo_cancellation(SpeexEchoState *st, const spx_int16_t *in, c
/* Temporary adaption rate if filter is not yet adapted enough */
spx_word16_t adapt_rate=0;
- if (Sxx > SHR32(MULT16_16(N, 1000),6))
+ if (Sxx > SHR32(MULT16_16(N, 1000),6))
{
tmp32 = MULT16_32_Q15(QCONST16(.25f, 15), Sxx);
#ifdef FIXED_POINT
@@ -1176,7 +1176,7 @@ EXPORT void speex_echo_cancellation(SpeexEchoState *st, const spx_int16_t *in, c
st->sum_adapt = ADD32(st->sum_adapt,adapt_rate);
}
- /* FIXME: MC conversion required */
+ /* FIXME: MC conversion required */
for (i=0;i<st->frame_size;i++)
st->last_y[i] = st->last_y[st->frame_size+i];
if (st->adapted)
@@ -1198,17 +1198,17 @@ void speex_echo_get_residual(SpeexEchoState *st, spx_word32_t *residual_echo, in
int i;
spx_word16_t leak2;
int N;
-
+
N = st->window_size;
/* Apply hanning window (should pre-compute it)*/
for (i=0;i<N;i++)
st->y[i] = MULT16_16_Q15(st->window[i],st->last_y[i]);
-
+
/* Compute power spectrum of the echo */
spx_fft(st->fft_table, st->y, st->Y);
power_spectrum(st->Y, residual_echo, N);
-
+
#ifdef FIXED_POINT
if (st->leak_estimate > 16383)
leak2 = 32767;
@@ -1223,14 +1223,14 @@ void speex_echo_get_residual(SpeexEchoState *st, spx_word32_t *residual_echo, in
/* Estimate residual echo */
for (i=0;i<=st->frame_size;i++)
residual_echo[i] = (spx_int32_t)MULT16_32_Q15(leak2,residual_echo[i]);
-
+
}
EXPORT int speex_echo_ctl(SpeexEchoState *st, int request, void *ptr)
{
switch(request)
{
-
+
case SPEEX_ECHO_GET_FRAME_SIZE:
(*(int*)ptr) = st->frame_size;
break;
diff --git a/libspeexdsp/misc_bfin.h b/libspeexdsp/misc_bfin.h
index 3c8c09d..4e27681 100644
--- a/libspeexdsp/misc_bfin.h
+++ b/libspeexdsp/misc_bfin.h
@@ -1,25 +1,25 @@
/* Copyright (C) 2005 Analog Devices */
/**
@file misc_bfin.h
- @author Jean-Marc Valin
+ @author Jean-Marc Valin
@brief Various compatibility routines for Speex (Blackfin version)
*/
/*
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
-
+
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
-
+
- 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.
-
+
- Neither the name of the Xiph.org Foundation nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
-
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
diff --git a/libspeexdsp/os_support.h b/libspeexdsp/os_support.h
index 2e23a5e..0db31a6 100644
--- a/libspeexdsp/os_support.h
+++ b/libspeexdsp/os_support.h
@@ -1,5 +1,5 @@
/* Copyright (C) 2007 Jean-Marc Valin
-
+
File: os_support.h
This is the (tiny) OS abstraction layer. Aside from math.h, this is the
only place where system headers are allowed.
@@ -45,12 +45,12 @@
#include "os_support_custom.h"
#endif
-/** Speex wrapper for calloc. To do your own dynamic allocation, all you need to do is replace this function, speex_realloc and speex_free
+/** Speex wrapper for calloc. To do your own dynamic allocation, all you need to do is replace this function, speex_realloc and speex_free
NOTE: speex_alloc needs to CLEAR THE MEMORY */
#ifndef OVERRIDE_SPEEX_ALLOC
static inline void *speex_alloc (int size)
{
- /* WARNING: this is not equivalent to malloc(). If you want to use malloc()
+ /* WARNING: this is not equivalent to malloc(). If you want to use malloc()
or your own allocator, YOU NEED TO CLEAR THE MEMORY ALLOCATED. Otherwise
you will experience strange bugs */
return calloc(size,1);
diff --git a/libspeexdsp/preprocess.c b/libspeexdsp/preprocess.c
index b8e287a..c080581 100644
--- a/libspeexdsp/preprocess.c
+++ b/libspeexdsp/preprocess.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2003 Epic Games (written by Jean-Marc Valin)
- Copyright (C) 2004-2006 Epic Games
-
+ Copyright (C) 2004-2006 Epic Games
+
File: preprocess.c
Preprocessor with denoising based on the algorithm by Ephraim and Malah
@@ -34,24 +34,24 @@
/*
Recommended papers:
-
+
Y. Ephraim and D. Malah, "Speech enhancement using minimum mean-square error
- short-time spectral amplitude estimator". IEEE Transactions on Acoustics,
+ short-time spectral amplitude estimator". IEEE Transactions on Acoustics,
Speech and Signal Processing, vol. ASSP-32, no. 6, pp. 1109-1121, 1984.
-
+
Y. Ephraim and D. Malah, "Speech enhancement using minimum mean-square error
- log-spectral amplitude estimator". IEEE Transactions on Acoustics, Speech and
+ log-spectral amplitude estimator". IEEE Transactions on Acoustics, Speech and
Signal Processing, vol. ASSP-33, no. 2, pp. 443-445, 1985.
-
+
I. Cohen and B. Berdugo, "Speech enhancement for non-stationary noise environments".
Signal Processing, vol. 81, no. 2, pp. 2403-2418, 2001.
- Stefan Gustafsson, Rainer Martin, Peter Jax, and Peter Vary. "A psychoacoustic
- approach to combined acoustic echo cancellation and noise reduction". IEEE
+ Stefan Gustafsson, Rainer Martin, Peter Jax, and Peter Vary. "A psychoacoustic
+ approach to combined acoustic echo cancellation and noise reduction". IEEE
Transactions on Speech and Audio Processing, 2002.
-
+
J.-M. Valin, J. Rouat, and F. Michaud, "Microphone array post-filter for separation
- of simultaneous non-stationary sources". In Proceedings IEEE International
+ of simultaneous non-stationary sources". In Proceedings IEEE International
Conference on Acoustics, Speech, and Signal Processing, 2004.
*/
@@ -71,7 +71,7 @@
#define LOUDNESS_EXP 5.f
#define AMP_SCALE .001f
#define AMP_SCALE_1 1000.f
-
+
#define NB_BANDS 24
#define SPEECH_PROB_START_DEFAULT QCONST16(0.35f,15)
@@ -113,7 +113,7 @@ static inline spx_word16_t DIV32_16_Q8(spx_word32_t a, spx_word32_t b)
a = SHL32(a,8);
return PDIV32_16(a,b);
}
-
+
}
static inline spx_word16_t DIV32_16_Q15(spx_word32_t a, spx_word32_t b)
{
@@ -181,7 +181,7 @@ struct SpeexPreprocessState_ {
int sampling_rate; /**< Sampling rate of the input/output */
int nbands;
FilterBank *bank;
-
+
/* Parameters */
int denoise_enabled;
int vad_enabled;
@@ -194,7 +194,7 @@ struct SpeexPreprocessState_ {
int echo_suppress;
int echo_suppress_active;
SpeexEchoState *echo_state;
-
+
spx_word16_t speech_prob; /**< Probability last frame was speech */
/* DSP-related arrays */
@@ -256,7 +256,7 @@ static void conj_window(spx_word16_t *w, int len)
spx_word16_t tmp;
#ifdef FIXED_POINT
spx_word16_t x = DIV32_16(MULT16_16(32767,i),len);
-#else
+#else
spx_word16_t x = DIV32_16(MULT16_16(QCONST16(4.f,13),i),len);
#endif
int inv=0;
@@ -281,10 +281,10 @@ static void conj_window(spx_word16_t *w, int len)
}
}
-
+
#ifdef FIXED_POINT
-/* This function approximates the gain function
- y = gamma(1.25)^2 * M(-.25;1;-x) / sqrt(x)
+/* This function approximates the gain function
+ y = gamma(1.25)^2 * M(-.25;1;-x) / sqrt(x)
which multiplied by xi/(1+xi) is the optimal gain
in the loudness domain ( sqrt[amplitude] )
Input in Q11 format, output in Q15
@@ -317,7 +317,7 @@ static inline spx_word16_t qcurve(spx_word16_t x)
static void compute_gain_floor(int noise_suppress, int effective_echo_suppress, spx_word32_t *noise, spx_word32_t *echo, spx_word16_t *gain_floor, int len)
{
int i;
-
+
if (noise_suppress > effective_echo_suppress)
{
spx_word16_t noise_gain, gain_ratio;
@@ -343,8 +343,8 @@ static void compute_gain_floor(int noise_suppress, int effective_echo_suppress,
}
#else
-/* This function approximates the gain function
- y = gamma(1.25)^2 * M(-.25;1;-x) / sqrt(x)
+/* This function approximates the gain function
+ y = gamma(1.25)^2 * M(-.25;1;-x) / sqrt(x)
which multiplied by xi/(1+xi) is the optimal gain
in the loudness domain ( sqrt[amplitude] )
*/
@@ -410,8 +410,8 @@ EXPORT SpeexPreprocessState *speex_preprocess_state_init(int frame_size, int sam
break;
}
}
-
-
+
+
if (st->ps_size < 3*st->frame_size/4)
st->ps_size = st->ps_size * 3 / 2;
#else
@@ -421,7 +421,7 @@ EXPORT SpeexPreprocessState *speex_preprocess_state_init(int frame_size, int sam
N = st->ps_size;
N3 = 2*N - st->frame_size;
N4 = st->frame_size - N3;
-
+
st->sampling_rate = sampling_rate;
st->denoise_enabled = 1;
st->vad_enabled = 0;
@@ -436,15 +436,15 @@ EXPORT SpeexPreprocessState *speex_preprocess_state_init(int frame_size, int sam
st->speech_prob_continue = SPEECH_PROB_CONTINUE_DEFAULT;
st->echo_state = NULL;
-
+
st->nbands = NB_BANDS;
M = st->nbands;
st->bank = filterbank_new(M, sampling_rate, N, 1);
-
+
st->frame = (spx_word16_t*)speex_alloc(2*N*sizeof(spx_word16_t));
st->window = (spx_word16_t*)speex_alloc(2*N*sizeof(spx_word16_t));
st->ft = (spx_word16_t*)speex_alloc(2*N*sizeof(spx_word16_t));
-
+
st->ps = (spx_word32_t*)speex_alloc((N+M)*sizeof(spx_word32_t));
st->noise = (spx_word32_t*)speex_alloc((N+M)*sizeof(spx_word32_t));
st->echo_noise = (spx_word32_t*)speex_alloc((N+M)*sizeof(spx_word32_t));
@@ -457,19 +457,19 @@ EXPORT SpeexPreprocessState *speex_preprocess_state_init(int frame_size, int sam
st->gain2 = (spx_word16_t*)speex_alloc((N+M)*sizeof(spx_word16_t));
st->gain_floor = (spx_word16_t*)speex_alloc((N+M)*sizeof(spx_word16_t));
st->zeta = (spx_word16_t*)speex_alloc((N+M)*sizeof(spx_word16_t));
-
+
st->S = (spx_word32_t*)speex_alloc(N*sizeof(spx_word32_t));
st->Smin = (spx_word32_t*)speex_alloc(N*sizeof(spx_word32_t));
st->Stmp = (spx_word32_t*)speex_alloc(N*sizeof(spx_word32_t));
st->update_prob = (int*)speex_alloc(N*sizeof(int));
-
+
st->inbuf = (spx_word16_t*)speex_alloc(N3*sizeof(spx_word16_t));
st->outbuf = (spx_word16_t*)speex_alloc(N3*sizeof(spx_word16_t));
conj_window(st->window, 2*N3);
for (i=2*N3;i<2*st->ps_size;i++)
st->window[i]=Q15_ONE;
-
+
if (N4>0)
{
for (i=N3-1;i>=0;i--)
@@ -569,7 +569,7 @@ static void speex_compute_agc(SpeexPreprocessState *st, spx_word16_t Pframe, spx
float target_gain;
float loudness=1.f;
float rate;
-
+
for (i=2;i<N;i++)
{
loudness += 2.f*N*st->ps[i]* st->loudness_weight[i];
@@ -587,7 +587,7 @@ static void speex_compute_agc(SpeexPreprocessState *st, spx_word16_t Pframe, spx
st->init_max *= 1.f + .1f*Pframe*Pframe;
}
/*printf ("%f %f %f %f\n", Pframe, loudness, pow(st->loudness, 1.0f/LOUDNESS_EXP), st->loudness2);*/
-
+
target_gain = AMP_SCALE*st->agc_level*pow(st->loudness/(1e-4+st->loudness_accum), -1.0f/LOUDNESS_EXP);
if ((Pframe>.5 && st->nb_adapt > 20) || target_gain < st->agc_gain)
@@ -600,11 +600,11 @@ static void speex_compute_agc(SpeexPreprocessState *st, spx_word16_t Pframe, spx
target_gain = st->max_gain;
if (target_gain > st->init_max)
target_gain = st->init_max;
-
+
st->agc_gain = target_gain;
}
/*fprintf (stderr, "%f %f %f\n", loudness, (float)AMP_SCALE_1*pow(st->loudness, 1.0f/LOUDNESS_EXP), st->agc_gain);*/
-
+
for (i=0;i<2*N;i++)
ft[i] *= st->agc_gain;
st->prev_loudness = loudness;
@@ -624,7 +624,7 @@ static void preprocess_analysis(SpeexPreprocessState *st, spx_int16_t *x)
st->frame[i]=st->inbuf[i];
for (i=0;i<st->frame_size;i++)
st->frame[N3+i]=x[i];
-
+
/* Update inbuf */
for (i=0;i<N3;i++)
st->inbuf[i]=x[N4+i];
@@ -643,10 +643,10 @@ static void preprocess_analysis(SpeexPreprocessState *st, spx_int16_t *x)
st->frame[i] = SHL16(st->frame[i], st->frame_shift);
}
#endif
-
+
/* Perform FFT */
spx_fft(st->fft_lookup, st->frame, st->ft);
-
+
/* Power spectrum */
ps[0]=MULT16_16(st->ft[0],st->ft[0]);
for (i=1;i<N;i++)
@@ -664,11 +664,11 @@ static void update_noise_prob(SpeexPreprocessState *st)
int N = st->ps_size;
for (i=1;i<N-1;i++)
- st->S[i] = MULT16_32_Q15(QCONST16(.8f,15),st->S[i]) + MULT16_32_Q15(QCONST16(.05f,15),st->ps[i-1])
+ st->S[i] = MULT16_32_Q15(QCONST16(.8f,15),st->S[i]) + MULT16_32_Q15(QCONST16(.05f,15),st->ps[i-1])
+ MULT16_32_Q15(QCONST16(.1f,15),st->ps[i]) + MULT16_32_Q15(QCONST16(.05f,15),st->ps[i+1]);
st->S[0] = MULT16_32_Q15(QCONST16(.8f,15),st->S[0]) + MULT16_32_Q15(QCONST16(.2f,15),st->ps[0]);
st->S[N-1] = MULT16_32_Q15(QCONST16(.8f,15),st->S[N-1]) + MULT16_32_Q15(QCONST16(.2f,15),st->ps[N-1]);
-
+
if (st->nb_adapt==1)
{
for (i=0;i<N;i++)
@@ -695,7 +695,7 @@ static void update_noise_prob(SpeexPreprocessState *st)
for (i=0;i<N;i++)
{
st->Smin[i] = MIN32(st->Smin[i], st->S[i]);
- st->Stmp[i] = MIN32(st->Stmp[i], st->S[i]);
+ st->Stmp[i] = MIN32(st->Stmp[i], st->S[i]);
}
}
for (i=0;i<N;i++)
@@ -731,12 +731,12 @@ EXPORT int speex_preprocess_run(SpeexPreprocessState *st, spx_int16_t *x)
spx_word16_t Pframe;
spx_word16_t beta, beta_1;
spx_word16_t effective_echo_suppress;
-
+
st->nb_adapt++;
if (st->nb_adapt>20000)
st->nb_adapt = 20000;
st->min_count++;
-
+
beta = MAX16(QCONST16(.03,15),DIV32_16(Q15_ONE,st->nb_adapt));
beta_1 = Q15_ONE-beta;
M = st->nbands;
@@ -770,7 +770,7 @@ EXPORT int speex_preprocess_run(SpeexPreprocessState *st, spx_int16_t *x)
st->update_prob[i] = 0;
}
*/
-
+
/* Update the noise estimate for the frequencies where it can be */
for (i=0;i<N;i++)
{
@@ -788,17 +788,17 @@ EXPORT int speex_preprocess_run(SpeexPreprocessState *st, spx_int16_t *x)
for (i=0;i<N+M;i++)
{
spx_word16_t gamma;
-
+
/* Total noise estimate including residual echo and reverberation */
spx_word32_t tot_noise = ADD32(ADD32(ADD32(EXTEND32(1), PSHR32(st->noise[i],NOISE_SHIFT)) , st->echo_noise[i]) , st->reverb_estimate[i]);
-
+
/* A posteriori SNR = ps/noise - 1*/
st->post[i] = SUB16(DIV32_16_Q8(ps[i],tot_noise), QCONST16(1.f,SNR_SHIFT));
st->post[i]=MIN16(st->post[i], QCONST16(100.f,SNR_SHIFT));
-
+
/* Computing update gamma = .1 + .9*(old/(old+noise))^2 */
gamma = QCONST16(.1f,15)+MULT16_16_Q15(QCONST16(.89f,15),SQR16_Q15(DIV32_16_Q15(st->old_ps[i],ADD32(st->old_ps[i],tot_noise))));
-
+
/* A priori SNR update = gamma*max(0,post) + (1-gamma)*old/noise */
st->prior[i] = EXTRACT16(PSHR32(ADD32(MULT16_16(gamma,MAX16(0,st->post[i])), MULT16_16(Q15_ONE-gamma,DIV32_16_Q8(st->old_ps[i],tot_noise))), 15));
st->prior[i]=MIN16(st->prior[i], QCONST16(100.f,SNR_SHIFT));
@@ -819,13 +819,13 @@ EXPORT int speex_preprocess_run(SpeexPreprocessState *st, spx_int16_t *x)
for (i=N;i<N+M;i++)
Zframe = ADD32(Zframe, EXTEND32(st->zeta[i]));
Pframe = QCONST16(.1f,15)+MULT16_16_Q15(QCONST16(.899f,15),qcurve(DIV32_16(Zframe,st->nbands)));
-
+
effective_echo_suppress = EXTRACT16(PSHR32(ADD32(MULT16_16(SUB16(Q15_ONE,Pframe), st->echo_suppress), MULT16_16(Pframe, st->echo_suppress_active)),15));
-
+
compute_gain_floor(st->noise_suppress, effective_echo_suppress, st->noise+N, st->echo_noise+N, st->gain_floor+N, M);
-
- /* Compute Ephraim & Malah gain speech probability of presence for each critical band (Bark scale)
- Technically this is actually wrong because the EM gaim assumes a slightly different probability
+
+ /* Compute Ephraim & Malah gain speech probability of presence for each critical band (Bark scale)
+ Technically this is actually wrong because the EM gaim assumes a slightly different probability
distribution */
for (i=N;i<N+M;i++)
{
@@ -842,7 +842,7 @@ EXPORT int speex_preprocess_run(SpeexPreprocessState *st, spx_int16_t *x)
#ifdef FIXED_POINT
spx_word16_t tmp;
#endif
-
+
prior_ratio = PDIV32_16(SHL32(EXTEND32(st->prior[i]), 15), ADD16(st->prior[i], SHL32(1,SNR_SHIFT)));
theta = MULT16_32_P15(prior_ratio, QCONST32(1.f,EXPIN_SHIFT)+SHL32(EXTEND32(st->post[i]),EXPIN_SHIFT-SNR_SHIFT));
@@ -867,12 +867,12 @@ EXPORT int speex_preprocess_run(SpeexPreprocessState *st, spx_int16_t *x)
/* Convert the EM gains and speech prob to linear frequency */
filterbank_compute_psd16(st->bank,st->gain2+N, st->gain2);
filterbank_compute_psd16(st->bank,st->gain+N, st->gain);
-
+
/* Use 1 for linear gain resolution (best) or 0 for Bark gain resolution (faster) */
if (1)
{
filterbank_compute_psd16(st->bank,st->gain_floor+N, st->gain_floor);
-
+
/* Compute gain according to the Ephraim-Malah algorithm -- linear frequency */
for (i=0;i<N;i++)
{
@@ -882,7 +882,7 @@ EXPORT int speex_preprocess_run(SpeexPreprocessState *st, spx_int16_t *x)
spx_word16_t tmp;
spx_word16_t p;
spx_word16_t g;
-
+
/* Wiener filter gain */
prior_ratio = PDIV32_16(SHL32(EXTEND32(st->prior[i]), 15), ADD16(st->prior[i], SHL32(1,SNR_SHIFT)));
theta = MULT16_32_P15(prior_ratio, QCONST32(1.f,EXPIN_SHIFT)+SHL32(EXTEND32(st->post[i]),EXPIN_SHIFT-SNR_SHIFT));
@@ -893,22 +893,22 @@ EXPORT int speex_preprocess_run(SpeexPreprocessState *st, spx_int16_t *x)
g = EXTRACT16(MIN32(Q15_ONE, MULT16_32_Q15(prior_ratio, MM)));
/* Interpolated speech probability of presence */
p = st->gain2[i];
-
+
/* Constrain the gain to be close to the Bark scale gain */
if (MULT16_16_Q15(QCONST16(.333f,15),g) > st->gain[i])
g = MULT16_16(3,st->gain[i]);
st->gain[i] = g;
-
+
/* Save old power spectrum */
st->old_ps[i] = MULT16_32_P15(QCONST16(.2f,15),st->old_ps[i]) + MULT16_32_P15(MULT16_16_P15(QCONST16(.8f,15),SQR16_Q15(st->gain[i])),ps[i]);
-
+
/* Apply gain floor */
if (st->gain[i] < st->gain_floor[i])
st->gain[i] = st->gain_floor[i];
/* Exponential decay model for reverberation (unused) */
/*st->reverb_estimate[i] = st->reverb_decay*st->reverb_estimate[i] + st->reverb_decay*st->reverb_level*st->gain[i]*st->gain[i]*st->ps[i];*/
-
+
/* Take into account speech probability of presence (loudness domain MMSE estimator) */
/* gain2 = [p*sqrt(gain)+(1-p)*sqrt(gain _floor) ]^2 */
tmp = MULT16_16_P15(p,spx_sqrt(SHL32(EXTEND32(st->gain[i]),15))) + MULT16_16_P15(SUB16(Q15_ONE,p),spx_sqrt(SHL32(EXTEND32(st->gain_floor[i]),15)));
@@ -922,20 +922,20 @@ EXPORT int speex_preprocess_run(SpeexPreprocessState *st, spx_int16_t *x)
{
spx_word16_t tmp;
spx_word16_t p = st->gain2[i];
- st->gain[i] = MAX16(st->gain[i], st->gain_floor[i]);
+ st->gain[i] = MAX16(st->gain[i], st->gain_floor[i]);
tmp = MULT16_16_P15(p,spx_sqrt(SHL32(EXTEND32(st->gain[i]),15))) + MULT16_16_P15(SUB16(Q15_ONE,p),spx_sqrt(SHL32(EXTEND32(st->gain_floor[i]),15)));
st->gain2[i]=SQR16_Q15(tmp);
}
filterbank_compute_psd16(st->bank,st->gain2+N, st->gain2);
}
-
+
/* If noise suppression is off, don't apply the gain (but then why call this in the first place!) */
if (!st->denoise_enabled)
{
for (i=0;i<N+M;i++)
st->gain2[i]=Q15_ONE;
}
-
+
/* Apply computed gain */
for (i=1;i<N;i++)
{
@@ -944,7 +944,7 @@ EXPORT int speex_preprocess_run(SpeexPreprocessState *st, spx_int16_t *x)
}
st->ft[0] = MULT16_16_P15(st->gain2[0],st->ft[0]);
st->ft[2*N-1] = MULT16_16_P15(st->gain2[N-1],st->ft[2*N-1]);
-
+
/*FIXME: This *will* not work for fixed-point */
#ifndef FIXED_POINT
if (st->agc_enabled)
@@ -973,7 +973,7 @@ EXPORT int speex_preprocess_run(SpeexPreprocessState *st, spx_int16_t *x)
}
}
#endif
-
+
/* Synthesis window (for WOLA) */
for (i=0;i<2*N;i++)
st->frame[i] = MULT16_16_Q15(st->frame[i], st->window[i]);
@@ -983,7 +983,7 @@ EXPORT int speex_preprocess_run(SpeexPreprocessState *st, spx_int16_t *x)
x[i] = st->outbuf[i] + st->frame[i];
for (i=0;i<N4;i++)
x[N3+i] = st->frame[N3+i];
-
+
/* Update outbuf */
for (i=0;i<N3;i++)
st->outbuf[i] = st->frame[st->frame_size+i];
@@ -1016,11 +1016,11 @@ EXPORT void speex_preprocess_estimate_update(SpeexPreprocessState *st, spx_int16
M = st->nbands;
st->min_count++;
-
+
preprocess_analysis(st, x);
update_noise_prob(st);
-
+
for (i=1;i<N-1;i++)
{
if (!st->update_prob[i] || st->ps[i] < PSHR32(st->noise[i],NOISE_SHIFT))
@@ -1099,7 +1099,7 @@ EXPORT int speex_preprocess_ctl(SpeexPreprocessState *state, int request, void *
case SPEEX_PREPROCESS_GET_VAD:
(*(spx_int32_t*)ptr) = st->vad_enabled;
break;
-
+
case SPEEX_PREPROCESS_SET_DEREVERB:
st->dereverb_enabled = (*(spx_int32_t*)ptr);
for (i=0;i<st->ps_size;i++)
@@ -1117,7 +1117,7 @@ EXPORT int speex_preprocess_ctl(SpeexPreprocessState *state, int request, void *
/* FIXME: Re-enable when de-reverberation is actually enabled again */
/*(*(float*)ptr) = st->reverb_level;*/
break;
-
+
case SPEEX_PREPROCESS_SET_DEREVERB_DECAY:
/* FIXME: Re-enable when de-reverberation is actually enabled again */
/*st->reverb_decay = (*(float*)ptr);*/
diff --git a/libspeexdsp/pseudofloat.h b/libspeexdsp/pseudofloat.h
index fa841a0..ed5ab14 100644
--- a/libspeexdsp/pseudofloat.h
+++ b/libspeexdsp/pseudofloat.h
@@ -3,7 +3,7 @@
@file pseudofloat.h
@brief Pseudo-floating point
* This header file provides a lightweight floating point type for
- * use on fixed-point platforms when a large dynamic range is
+ * use on fixed-point platforms when a large dynamic range is
* required. The new type is not compatible with the 32-bit IEEE format,
* it is not even remotely as accurate as 32-bit floats, and is not
* even guaranteed to produce even remotely correct results for code
@@ -16,18 +16,18 @@
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
-
+
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
-
+
- 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.
-
+
- Neither the name of the Xiph.org Foundation nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
-
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -84,7 +84,7 @@ static inline spx_float_t PSEUDOFLOAT(spx_int32_t x)
r.e = e;
return r;
}
- else
+ else
{
spx_float_t r;
r.m = x;
@@ -101,12 +101,12 @@ static inline spx_float_t FLOAT_ADD(spx_float_t a, spx_float_t b)
return b;
else if (b.m==0)
return a;
- if ((a).e > (b).e)
+ if ((a).e > (b).e)
{
r.m = ((a).m>>1) + ((b).m>>MIN(15,(a).e-(b).e+1));
r.e = (a).e+1;
}
- else
+ else
{
r.m = ((b).m>>1) + ((a).m>>MIN(15,(b).e-(a).e+1));
r.e = (b).e+1;
@@ -141,7 +141,7 @@ static inline spx_float_t FLOAT_SUB(spx_float_t a, spx_float_t b)
r.m = ((a).m>>1) - ((b).m>>MIN(15,(a).e-(b).e+1));
r.e = (a).e+1;
}
- else
+ else
{
r.m = ((a).m>>MIN(15,(b).e-(a).e+1)) - ((b).m>>1);
r.e = (b).e+1;
@@ -169,10 +169,10 @@ static inline int FLOAT_LT(spx_float_t a, spx_float_t b)
if (a.m==0)
return b.m>0;
else if (b.m==0)
- return a.m<0;
+ return a.m<0;
if ((a).e > (b).e)
return ((a).m>>1) < ((b).m>>MIN(15,(a).e-(b).e+1));
- else
+ else
return ((b).m>>1) > ((a).m>>MIN(15,(b).e-(a).e+1));
}
@@ -202,7 +202,7 @@ static inline spx_float_t FLOAT_MULT(spx_float_t a, spx_float_t b)
}
}
/*printf ("%f * %f = %f\n", REALFLOAT(a), REALFLOAT(b), REALFLOAT(r));*/
- return r;
+ return r;
}
static inline spx_float_t FLOAT_AMULT(spx_float_t a, spx_float_t b)
@@ -210,7 +210,7 @@ static inline spx_float_t FLOAT_AMULT(spx_float_t a, spx_float_t b)
spx_float_t r;
r.m = (spx_int16_t)((spx_int32_t)(a).m*(b).m>>15);
r.e = (a).e+(b).e+15;
- return r;
+ return r;
}
diff --git a/libspeexdsp/resample.c b/libspeexdsp/resample.c
index edbd65b..4940a64 100644
--- a/libspeexdsp/resample.c
+++ b/libspeexdsp/resample.c
@@ -1,6 +1,6 @@
/* Copyright (C) 2007-2008 Jean-Marc Valin
Copyright (C) 2008 Thorvald Natvig
-
+
File: resample.c
Arbitrary resampling code
@@ -38,22 +38,22 @@
- Low memory requirement
- Good *perceptual* quality (and not best SNR)
- Warning: This resampler is relatively new. Although I think I got rid of
+ Warning: This resampler is relatively new. Although I think I got rid of
all the major bugs and I don't expect the API to change anymore, there
may be something I've missed. So use with caution.
This algorithm is based on this original resampling algorithm:
Smith, Julius O. Digital Audio Resampling Home Page
- Center for Computer Research in Music and Acoustics (CCRMA),
+ Center for Computer Research in Music and Acoustics (CCRMA),
Stanford University, 2007.
Web published at http://www-ccrma.stanford.edu/~jos/resample/.
- There is one main difference, though. This resampler uses cubic
+ There is one main difference, though. This resampler uses cubic
interpolation instead of linear interpolation in the above paper. This
makes the table much smaller and makes it possible to compute that table
- on a per-stream basis. In turn, being able to tweak the table for each
- stream makes it possible to both reduce complexity on simple ratios
- (e.g. 2/3), and get rid of the rounding operations in the inner loop.
+ on a per-stream basis. In turn, being able to tweak the table for each
+ stream makes it possible to both reduce complexity on simple ratios
+ (e.g. 2/3), and get rid of the rounding operations in the inner loop.
The latter both reduces CPU time and makes the algorithm more SIMD-friendly.
*/
@@ -84,11 +84,11 @@ static void speex_free (void *ptr) {free(ptr);}
#endif
#ifdef FIXED_POINT
-#define WORD2INT(x) ((x) < -32767 ? -32768 : ((x) > 32766 ? 32767 : (x)))
+#define WORD2INT(x) ((x) < -32767 ? -32768 : ((x) > 32766 ? 32767 : (x)))
#else
-#define WORD2INT(x) ((x) < -32767.5f ? -32768 : ((x) > 32766.5f ? 32767 : floor(.5+(x))))
+#define WORD2INT(x) ((x) < -32767.5f ? -32768 : ((x) > 32766.5f ? 32767 : floor(.5+(x))))
#endif
-
+
#define IMAX(a,b) ((a) > (b) ? (a) : (b))
#define IMIN(a,b) ((a) < (b) ? (a) : (b))
@@ -118,7 +118,7 @@ struct SpeexResamplerState_ {
spx_uint32_t out_rate;
spx_uint32_t num_rate;
spx_uint32_t den_rate;
-
+
int quality;
spx_uint32_t nb_channels;
spx_uint32_t filt_len;
@@ -130,17 +130,17 @@ struct SpeexResamplerState_ {
spx_uint32_t oversample;
int initialised;
int started;
-
+
/* These are per-channel */
spx_int32_t *last_sample;
spx_uint32_t *samp_frac_num;
spx_uint32_t *magic_samples;
-
+
spx_word16_t *mem;
spx_word16_t *sinc_table;
spx_uint32_t sinc_table_length;
resampler_basic_func resampler_ptr;
-
+
int in_stride;
int out_stride;
} ;
@@ -182,7 +182,7 @@ static const double kaiser8_table[36] = {
0.32108304, 0.27619388, 0.23465776, 0.19672670, 0.16255380, 0.13219758,
0.10562887, 0.08273982, 0.06335451, 0.04724088, 0.03412321, 0.02369490,
0.01563093, 0.00959968, 0.00527363, 0.00233883, 0.00050000, 0.00000000};
-
+
static const double kaiser6_table[36] = {
0.99733006, 1.00000000, 0.99733006, 0.98935595, 0.97618418, 0.95799003,
0.93501423, 0.90755855, 0.87598009, 0.84068475, 0.80211977, 0.76076565,
@@ -195,7 +195,7 @@ struct FuncDef {
const double *table;
int oversample;
};
-
+
static const struct FuncDef _KAISER12 = {kaiser12_table, 64};
#define KAISER12 (&_KAISER12)
/*static struct FuncDef _KAISER12 = {kaiser12_table, 32};
@@ -217,7 +217,7 @@ struct QualityMapping {
/* This table maps conversion quality to internal parameters. There are two
- reasons that explain why the up-sampling bandwidth is larger than the
+ reasons that explain why the up-sampling bandwidth is larger than the
down-sampling bandwidth:
1) When up-sampling, we can assume that the spectrum is already attenuated
close to the Nyquist rate (from an A/D or a previous resampling filter)
@@ -243,7 +243,7 @@ static double compute_func(float x, const struct FuncDef *func)
{
float y, frac;
double interp[4];
- int ind;
+ int ind;
y = x*func->oversample;
ind = (int)floor(y);
frac = (y-ind);
@@ -254,7 +254,7 @@ static double compute_func(float x, const struct FuncDef *func)
interp[0] = -0.3333333333*frac + 0.5*(frac*frac) - 0.1666666667*(frac*frac*frac);
/* Just to make sure we don't have rounding problems */
interp[1] = 1.f-interp[3]-interp[2]-interp[0];
-
+
/*sum = frac*accum[1] + (1-frac)*accum[2];*/
return interp[0]*func->table[ind] + interp[1]*func->table[ind+1] + interp[2]*func->table[ind+2] + interp[3]*func->table[ind+3];
}
@@ -481,7 +481,7 @@ static int resampler_basic_interpolate_single(SpeexResamplerState *st, spx_uint3
cubic_coef(frac, interp);
sum = interpolate_product_single(iptr, st->sinc_table + st->oversample + 4 - offset - 2, N, st->oversample, interp);
#endif
-
+
out[out_stride * out_sample++] = sum;
last_sample += int_advance;
samp_frac_num += frac_advance;
@@ -543,7 +543,7 @@ static int resampler_basic_interpolate_double(SpeexResamplerState *st, spx_uint3
cubic_coef(frac, interp);
sum = interpolate_product_double(iptr, st->sinc_table + st->oversample + 4 - offset - 2, N, st->oversample, interp);
#endif
-
+
out[out_stride * out_sample++] = PSHR32(sum,15);
last_sample += int_advance;
samp_frac_num += frac_advance;
@@ -603,7 +603,7 @@ static int update_filter(SpeexResamplerState *st)
st->frac_advance = st->num_rate%st->den_rate;
st->oversample = quality_map[st->quality].oversample;
st->filt_len = quality_map[st->quality].base_length;
-
+
if (st->num_rate > st->den_rate)
{
/* down-sampling */
@@ -626,7 +626,7 @@ static int update_filter(SpeexResamplerState *st)
/* up-sampling */
st->cutoff = quality_map[st->quality].upsample_bandwidth;
}
-
+
/* Choose the resampling type that requires the least amount of memory */
#ifdef RESAMPLE_FULL_SINC_TABLE
use_direct = 1;
@@ -725,7 +725,7 @@ static int update_filter(SpeexResamplerState *st)
/*if (st->magic_samples[i])*/
{
/* Try and remove the magic samples as if nothing had happened */
-
+
/* FIXME: This is wrong but for now we need it to avoid going over the array bounds */
olen = old_length + 2*st->magic_samples[i];
for (j=old_length-1+st->magic_samples[i];j--;)
@@ -810,14 +810,14 @@ EXPORT SpeexResamplerState *speex_resampler_init_frac(spx_uint32_t nb_channels,
st->filt_len = 0;
st->mem = 0;
st->resampler_ptr = 0;
-
+
st->cutoff = 1.f;
st->nb_channels = nb_channels;
st->in_stride = 1;
st->out_stride = 1;
-
+
st->buffer_size = 160;
-
+
/* Per channel data */
st->last_sample = (spx_int32_t*)speex_alloc(nb_channels*sizeof(spx_int32_t));
st->magic_samples = (spx_uint32_t*)speex_alloc(nb_channels*sizeof(spx_uint32_t));
@@ -863,17 +863,17 @@ static int speex_resampler_process_native(SpeexResamplerState *st, spx_uint32_t
int out_sample = 0;
spx_word16_t *mem = st->mem + channel_index * st->mem_alloc_size;
spx_uint32_t ilen;
-
+
st->started = 1;
-
+
/* Call the right resampler through the function ptr */
out_sample = st->resampler_ptr(st, channel_index, mem, in_len, out, out_len);
-
+
if (st->last_sample[channel_index] < (spx_int32_t)*in_len)
*in_len = st->last_sample[channel_index];
*out_len = out_sample;
st->last_sample[channel_index] -= *in_len;
-
+
ilen = *in_len;
for(j=0;j<N-1;++j)
@@ -886,11 +886,11 @@ static int speex_resampler_magic(SpeexResamplerState *st, spx_uint32_t channel_i
spx_uint32_t tmp_in_len = st->magic_samples[channel_index];
spx_word16_t *mem = st->mem + channel_index * st->mem_alloc_size;
const int N = st->filt_len;
-
+
speex_resampler_process_native(st, channel_index, &tmp_in_len, *out, &out_len);
st->magic_samples[channel_index] -= tmp_in_len;
-
+
/* If we couldn't process all "magic" input samples, save the rest for next time */
if (st->magic_samples[channel_index])
{
@@ -916,13 +916,13 @@ EXPORT int speex_resampler_process_float(SpeexResamplerState *st, spx_uint32_t c
const spx_uint32_t xlen = st->mem_alloc_size - filt_offs;
const int istride = st->in_stride;
- if (st->magic_samples[channel_index])
+ if (st->magic_samples[channel_index])
olen -= speex_resampler_magic(st, channel_index, &out, olen);
if (! st->magic_samples[channel_index]) {
while (ilen && olen) {
spx_uint32_t ichunk = (ilen > xlen) ? xlen : ilen;
spx_uint32_t ochunk = olen;
-
+
if (in) {
for(j=0;j<ichunk;++j)
x[j+filt_offs]=in[j*istride];
@@ -966,7 +966,7 @@ EXPORT int speex_resampler_process_int(SpeexResamplerState *st, spx_uint32_t cha
#endif
st->out_stride = 1;
-
+
while (ilen && olen) {
spx_word16_t *y = ystack;
spx_uint32_t ichunk = (ilen > xlen) ? xlen : ilen;
@@ -1003,7 +1003,7 @@ EXPORT int speex_resampler_process_int(SpeexResamplerState *st, spx_uint32_t cha
#else
out[j*ostride_save] = WORD2INT(ystack[j]);
#endif
-
+
ilen -= ichunk;
olen -= ochunk;
out += (ochunk+omagic) * ostride_save;
@@ -1039,7 +1039,7 @@ EXPORT int speex_resampler_process_interleaved_float(SpeexResamplerState *st, co
st->out_stride = ostride_save;
return st->resampler_ptr == resampler_basic_zero ? RESAMPLER_ERR_ALLOC_FAILED : RESAMPLER_ERR_SUCCESS;
}
-
+
EXPORT int speex_resampler_process_interleaved_int(SpeexResamplerState *st, const spx_int16_t *in, spx_uint32_t *in_len, spx_int16_t *out, spx_uint32_t *out_len)
{
spx_uint32_t i;
@@ -1081,7 +1081,7 @@ EXPORT int speex_resampler_set_rate_frac(SpeexResamplerState *st, spx_uint32_t r
spx_uint32_t i;
if (st->in_rate == in_rate && st->out_rate == out_rate && st->num_rate == ratio_num && st->den_rate == ratio_den)
return RESAMPLER_ERR_SUCCESS;
-
+
old_den = st->den_rate;
st->in_rate = in_rate;
st->out_rate = out_rate;
@@ -1096,7 +1096,7 @@ EXPORT int speex_resampler_set_rate_frac(SpeexResamplerState *st, spx_uint32_t r
st->den_rate /= fact;
}
}
-
+
if (old_den > 0)
{
for (i=0;i<st->nb_channels;i++)
@@ -1107,7 +1107,7 @@ EXPORT int speex_resampler_set_rate_frac(SpeexResamplerState *st, spx_uint32_t r
st->samp_frac_num[i] = st->den_rate-1;
}
}
-
+
if (st->initialised)
return update_filter(st);
return RESAMPLER_ERR_SUCCESS;
diff --git a/libspeexdsp/resample_sse.h b/libspeexdsp/resample_sse.h
index 64be8a1..fed5b82 100644
--- a/libspeexdsp/resample_sse.h
+++ b/libspeexdsp/resample_sse.h
@@ -9,18 +9,18 @@
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
-
+
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
-
+
- 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.
-
+
- Neither the name of the Xiph.org Foundation nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
-
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
diff --git a/libspeexdsp/scal.c b/libspeexdsp/scal.c
index d2ea59c..807cb51 100644
--- a/libspeexdsp/scal.c
+++ b/libspeexdsp/scal.c
@@ -33,8 +33,8 @@
/*
The algorithm implemented here is described in:
-* J.-M. Valin, Perceptually-Motivated Nonlinear Channel Decorrelation For
- Stereo Acoustic Echo Cancellation, Accepted for Joint Workshop on
+* J.-M. Valin, Perceptually-Motivated Nonlinear Channel Decorrelation For
+ Stereo Acoustic Echo Cancellation, Accepted for Joint Workshop on
Hands­free Speech Communication and Microphone Arrays (HSCMA), 2008.
http://people.xiph.org/~jm/papers/valin_hscma2008.pdf
@@ -71,7 +71,7 @@ struct SpeexDecorrState_ {
float *vorbis_win;
int seed;
float *y;
-
+
/* Per-channel stuff */
float *buff;
float (*ring)[ALLPASS_ORDER];
@@ -102,13 +102,13 @@ EXPORT SpeexDecorrState *speex_decorrelate_new(int rate, int channels, int frame
st->order = speex_alloc(channels*sizeof(int));
st->alpha = speex_alloc(channels*sizeof(float));
st->ring = speex_alloc(channels*ALLPASS_ORDER*sizeof(float));
-
+
/*FIXME: The +20 is there only as a kludge for ALL_PASS_OLA*/
st->vorbis_win = speex_alloc((2*frame_size+20)*sizeof(float));
for (i=0;i<2*frame_size;i++)
st->vorbis_win[i] = sin(.5*M_PI* sin(M_PI*i/(2*frame_size))*sin(M_PI*i/(2*frame_size)) );
st->seed = rand();
-
+
for (ch=0;ch<channels;ch++)
{
for (i=0;i<ALLPASS_ORDER;i++)
@@ -142,12 +142,12 @@ EXPORT void speex_decorrelate(SpeexDecorrState *st, const spx_int16_t *in, spx_i
{
int ch;
float amount;
-
+
if (strength<0)
strength = 0;
if (strength>100)
strength = 100;
-
+
amount = .01*strength;
for (ch=0;ch<st->channels;ch++)
{
@@ -156,7 +156,7 @@ EXPORT void speex_decorrelate(SpeexDecorrState *st, const spx_int16_t *in, spx_i
float beta, beta2;
float *x;
float max_alpha = 0;
-
+
float *buff;
float *ring;
int ringID;
@@ -168,7 +168,7 @@ EXPORT void speex_decorrelate(SpeexDecorrState *st, const spx_int16_t *in, spx_i
ringID = st->ringID[ch];
order = st->order[ch];
alpha = st->alpha[ch];
-
+
for (i=0;i<st->frame_size;i++)
buff[i] = buff[i+st->frame_size];
for (i=0;i<st->frame_size;i++)
@@ -182,12 +182,12 @@ EXPORT void speex_decorrelate(SpeexDecorrState *st, const spx_int16_t *in, spx_i
beta = 1-0.63246*amount;
if (beta<0)
beta = 0;
-
+
beta2 = beta;
for (i=0;i<st->frame_size;i++)
{
- st->y[i] = alpha*(x[i-ALLPASS_ORDER+order]-beta*x[i-ALLPASS_ORDER+order-1])*st->vorbis_win[st->frame_size+i+order]
- + x[i-ALLPASS_ORDER]*st->vorbis_win[st->frame_size+i]
+ st->y[i] = alpha*(x[i-ALLPASS_ORDER+order]-beta*x[i-ALLPASS_ORDER+order-1])*st->vorbis_win[st->frame_size+i+order]
+ + x[i-ALLPASS_ORDER]*st->vorbis_win[st->frame_size+i]
- alpha*(ring[ringID]
- beta*ring[ringID+1>=order?0:ringID+1]);
ring[ringID++]=st->y[i];
@@ -204,7 +204,7 @@ EXPORT void speex_decorrelate(SpeexDecorrState *st, const spx_int16_t *in, spx_i
max_alpha = pow(.96+.04*(amount-1),order);
if (max_alpha > .98/(1.+beta2))
max_alpha = .98/(1.+beta2);
-
+
alpha = alpha + .4*uni_rand(&st->seed);
if (alpha > max_alpha)
alpha = max_alpha;
@@ -215,8 +215,8 @@ EXPORT void speex_decorrelate(SpeexDecorrState *st, const spx_int16_t *in, spx_i
ringID = 0;
for (i=0;i<st->frame_size;i++)
{
- float tmp = alpha*(x[i-ALLPASS_ORDER+order]-beta*x[i-ALLPASS_ORDER+order-1])*st->vorbis_win[i+order]
- + x[i-ALLPASS_ORDER]*st->vorbis_win[i]
+ float tmp = alpha*(x[i-ALLPASS_ORDER+order]-beta*x[i-ALLPASS_ORDER+order-1])*st->vorbis_win[i+order]
+ + x[i-ALLPASS_ORDER]*st->vorbis_win[i]
- alpha*(ring[ringID]
- beta*ring[ringID+1>=order?0:ringID+1]);
ring[ringID++]=tmp;
@@ -225,7 +225,7 @@ EXPORT void speex_decorrelate(SpeexDecorrState *st, const spx_int16_t *in, spx_i
ringID=0;
st->y[i] += tmp;
}
-
+
#ifdef VORBIS_PSYCHO
float frame[N];
float scale = 1./N;
@@ -252,7 +252,7 @@ EXPORT void speex_decorrelate(SpeexDecorrState *st, const spx_int16_t *in, spx_i
for (i=0;i<2*st->frame_size;i++)
frame[i] *= st->vorbis_win[i];
#endif
-
+
for (i=0;i<st->frame_size;i++)
{
#ifdef VORBIS_PSYCHO
@@ -267,7 +267,7 @@ EXPORT void speex_decorrelate(SpeexDecorrState *st, const spx_int16_t *in, spx_i
tmp = -32767;
out[i*st->channels+ch] = tmp;
}
-
+
st->ringID[ch] = ringID;
st->order[ch] = order;
st->alpha[ch] = alpha;
diff --git a/libspeexdsp/smallft.c b/libspeexdsp/smallft.c
index 5c26d01..82c3b0a 100644
--- a/libspeexdsp/smallft.c
+++ b/libspeexdsp/smallft.c
@@ -127,7 +127,7 @@ static void dradf2(int ido,int l1,float *cc,float *ch,float *wa1){
t1+=ido;
t2+=ido;
}
-
+
if(ido<2)return;
if(ido==2)goto L105;
@@ -174,7 +174,7 @@ static void dradf4(int ido,int l1,float *cc,float *ch,float *wa1,
int i,k,t0,t1,t2,t3,t4,t5,t6;
float ci2,ci3,ci4,cr2,cr3,cr4,ti1,ti2,ti3,ti4,tr1,tr2,tr3,tr4;
t0=l1*ido;
-
+
t1=t0;
t4=t1<<1;
t2=t1+(t1<<1);
@@ -246,7 +246,7 @@ static void dradf4(int ido,int l1,float *cc,float *ch,float *wa1,
if(ido&1)return;
L105:
-
+
t2=(t1=t0+ido-1)+(t0<<1);
t3=ido<<2;
t4=ido;
@@ -280,7 +280,7 @@ static void dradfg(int ido,int ip,int l1,int idl1,float *cc,float *c1,
int nbd;
float dcp,arg,dsp,ar1h,ar2h;
int idp2,ipp2;
-
+
arg=tpi/(float)ip;
dcp=cos(arg);
dsp=sin(arg);
@@ -638,7 +638,7 @@ static void dradb2(int ido,int l1,float *cc,float *ch,float *wa1){
float ti2,tr2;
t0=l1*ido;
-
+
t1=0;
t2=0;
t3=(ido<<1)-1;
@@ -754,7 +754,7 @@ static void dradb4(int ido,int l1,float *cc,float *ch,float *wa1,
int i,k,t0,t1,t2,t3,t4,t5,t6,t7,t8;
float ci2,ci3,ci4,cr2,cr3,cr4,ti1,ti2,ti3,ti4,tr1,tr2,tr3,tr4;
t0=l1*ido;
-
+
t1=0;
t2=ido<<2;
t3=0;
@@ -763,7 +763,7 @@ static void dradb4(int ido,int l1,float *cc,float *ch,float *wa1,
t4=t3+t6;
t5=t1;
tr3=cc[t4-1]+cc[t4-1];
- tr4=cc[t4]+cc[t4];
+ tr4=cc[t4]+cc[t4];
tr1=cc[t3]-cc[(t4+=t6)-1];
tr2=cc[t3]+cc[t4-1];
ch[t5]=tr2+tr3;
@@ -858,7 +858,7 @@ static void dradbg(int ido,int ip,int l1,int idl1,float *cc,float *c1,
ipp2=ip;
ipph=(ip+1)>>1;
if(ido<l1)goto L103;
-
+
t1=0;
t2=0;
for(k=0;k<l1;k++){
diff --git a/libspeexdsp/stack_alloc.h b/libspeexdsp/stack_alloc.h
index 5264e66..6c56334 100644
--- a/libspeexdsp/stack_alloc.h
+++ b/libspeexdsp/stack_alloc.h
@@ -7,18 +7,18 @@
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
-
+
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
-
+
- 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.
-
+
- Neither the name of the Xiph.org Foundation nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
-
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -101,7 +101,7 @@
#endif
#if defined(VAR_ARRAYS)
-#define VARDECL(var)
+#define VARDECL(var)
#define ALLOC(var, size, type) type var[size]
#elif defined(USE_ALLOCA)
#define VARDECL(var) var
diff --git a/libspeexdsp/testjitter.c b/libspeexdsp/testjitter.c
index 557c5c3..399dfe9 100644
--- a/libspeexdsp/testjitter.c
+++ b/libspeexdsp/testjitter.c
@@ -13,7 +13,7 @@ union jbpdata {
void synthIn(JitterBufferPacket *in, int idx, int span) {
union jbpdata d;
d.idx = idx;
-
+
in->data = d.data;
in->len = sizeof(d);
in->timestamp = idx * 10;
@@ -28,13 +28,13 @@ void jitterFill(JitterBuffer *jb) {
int i;
out.data = buffer;
-
+
jitter_buffer_reset(jb);
for(i=0;i<100;++i) {
synthIn(&in, i, 1);
jitter_buffer_put(jb, &in);
-
+
out.len = 65536;
if (jitter_buffer_get(jb, &out, 10, NULL) != JITTER_BUFFER_OK) {
printf("Fill test failed iteration %d\n", i);
@@ -51,11 +51,11 @@ int main()
char buffer[65536];
JitterBufferPacket in, out;
int i;
-
+
JitterBuffer *jb = jitter_buffer_init(10);
-
+
out.data = buffer;
-
+
/* Frozen sender case */
jitterFill(jb);
for(i=0;i<100;++i) {
diff --git a/libspeexdsp/testresample.c b/libspeexdsp/testresample.c
index 1681e52..7ed8667 100644
--- a/libspeexdsp/testresample.c
+++ b/libspeexdsp/testresample.c
@@ -1,5 +1,5 @@
/* Copyright (C) 2007 Jean-Marc Valin
-
+
File: testresample.c
Testing the resampling code
@@ -51,7 +51,7 @@ int main()
SpeexResamplerState *st = speex_resampler_init(1, 8000, 12000, 10, NULL);
speex_resampler_set_rate(st, 96000, 44100);
speex_resampler_skip_zeros(st);
-
+
in = malloc(NN*sizeof(short));
out = malloc(2*NN*sizeof(short));
fin = malloc(NN*sizeof(float));
diff --git a/libspeexdsp/vorbis_psy.h b/libspeexdsp/vorbis_psy.h
index 6871057..19ea9c3 100644
--- a/libspeexdsp/vorbis_psy.h
+++ b/libspeexdsp/vorbis_psy.h
@@ -4,18 +4,18 @@
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
-
+
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
-
+
- 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.
-
+
- Neither the name of the Xiph.org Foundation nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
-
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -40,7 +40,7 @@
#define todB(x) ((x)>1e-13?log((x)*(x))*4.34294480f:-30)
-#define fromdB(x) (exp((x)*.11512925f))
+#define fromdB(x) (exp((x)*.11512925f))
/* The bark scale equations are approximations, since the original
table was somewhat hand rolled. The below are chosen to have the
diff --git a/ti/config.h b/ti/config.h
index da4834c..0957472 100644
--- a/ti/config.h
+++ b/ti/config.h
@@ -6,18 +6,18 @@
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
-
+
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
-
+
- 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.
-
+
- Neither the name of the Xiph.org Foundation nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
-
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -37,7 +37,7 @@
#define EXPORT
/* Disable DC block if doing SNR testing */
-#define DISABLE_HIGHPASS
+#define DISABLE_HIGHPASS
/* Allow for 2 20ms narrowband blocks per frame, plus a couple of bytes */
#define MAX_CHARS_PER_FRAME (42/BYTES_PER_CHAR)
@@ -55,7 +55,7 @@
//#undef MANUAL_ALLOC
//#undef OS_SUPPORT_CUSTOM
-#if defined (CONFIG_TI_C54X) || defined (CONFIG_TI_C55X)
+#if defined (CONFIG_TI_C54X) || defined (CONFIG_TI_C55X)
//#define PRECISION16
// These values determined by analysis for 8kbps narrowband
diff --git a/ti/os_support_custom.h b/ti/os_support_custom.h
index 95dd679..d88249e 100644
--- a/ti/os_support_custom.h
+++ b/ti/os_support_custom.h
@@ -1,23 +1,23 @@
/* Copyright (C) 2007 Psi Systems, Inc.
- Author: Jean-Marc Valin
+ Author: Jean-Marc Valin
File: os_support_custom.h
Memory Allocation overrides to allow user control rather than C alloc/free.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
-
+
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
-
+
- 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.
-
+
- Neither the name of the Xiph.org Foundation nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
-
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -33,20 +33,20 @@
#ifdef MANUAL_ALLOC
-/* To avoid changing the Speex call model, this file relies on four static variables
- The user main creates two linear buffers, and initializes spxGlobalHeap/ScratchPtr
- to point to the start of the two buffers, and initializes spxGlobalHeap/ScratchEnd
+/* To avoid changing the Speex call model, this file relies on four static variables
+ The user main creates two linear buffers, and initializes spxGlobalHeap/ScratchPtr
+ to point to the start of the two buffers, and initializes spxGlobalHeap/ScratchEnd
to point to the first address following the last byte of the two buffers.
-
- This mechanism allows, for example, data caching for multichannel applications,
- where the Speex state is swapped from a large slow memory to a small fast memory
+
+ This mechanism allows, for example, data caching for multichannel applications,
+ where the Speex state is swapped from a large slow memory to a small fast memory
each time the codec runs.
-
+
Persistent data is allocated in spxGlobalHeap (instead of calloc), while scratch
data is allocated in spxGlobalScratch.
*/
-extern char *spxGlobalHeapPtr, *spxGlobalHeapEnd;
+extern char *spxGlobalHeapPtr, *spxGlobalHeapEnd;
extern char *spxGlobalScratchPtr, *spxGlobalScratchEnd;
/* Make sure that all structures are aligned to largest type */
@@ -57,19 +57,19 @@ extern inline void speex_warning(const char *str);
static inline void *speex_alloc (int size)
{
void *ptr;
-
+
ptr = (void *) (((int)spxGlobalHeapPtr + BLOCK_MASK) & ~BLOCK_MASK); //Start on 8 boundary
spxGlobalHeapPtr = (char *)((int)ptr + size); // Update pointer to next free location
- if (spxGlobalHeapPtr > spxGlobalHeapEnd )
+ if (spxGlobalHeapPtr > spxGlobalHeapEnd )
{
#ifdef VERBOSE_ALLOC
fprintf (stderr, "insufficient space for persistent alloc request %d bytes\n", size);
#endif
return 0;
}
-
+
#ifdef VERBOSE_ALLOC
fprintf (stderr, "Persist Allocated %d chars at %x, %d remaining\n", size, ptr, ((int)spxGlobalHeapEnd - (int)spxGlobalHeapPtr));
#endif
@@ -86,14 +86,14 @@ static inline void *speex_alloc_scratch (int size)
spxGlobalScratchPtr = (char *)((int)ptr + size); // Update pointer to next free location
- if (spxGlobalScratchPtr > spxGlobalScratchEnd )
+ if (spxGlobalScratchPtr > spxGlobalScratchEnd )
{
#ifdef VERBOSE_ALLOC
fprintf (stderr, "insufficient space for scratch alloc request %d bytes\n", size);
#endif
return 0;
}
-
+
#ifdef VERBOSE_ALLOC
fprintf (stderr, "Scratch Allocated %d chars at %x, %d remaining\n", size, ptr, ((int)spxGlobalScratchEnd - (int)spxGlobalScratchPtr));
#endif
diff --git a/tmv/_kiss_fft_guts_tm.h b/tmv/_kiss_fft_guts_tm.h
index 9cf2864..55c3049 100644
--- a/tmv/_kiss_fft_guts_tm.h
+++ b/tmv/_kiss_fft_guts_tm.h
@@ -8,18 +8,18 @@
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
-
+
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
-
+
- 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.
-
+
- Neither the name of the Xiph.org Foundation nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
-
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
diff --git a/tmv/config.h b/tmv/config.h
index 0b68fb8..ea7abe1 100644
--- a/tmv/config.h
+++ b/tmv/config.h
@@ -19,23 +19,23 @@
#define TM_DEBUGMEM_ALIGNNMENT 1
-#define TM_PROFILE 1
-#define TM_PROFILE_FIRMEM16 0
-#define TM_PROFILE_IIRMEM16 0
-#define TM_PROFILE_FILTERMEM16 0
-#define TM_PROFILE_VQNBEST 0
-#define TM_PROFILE_VQNBESTSIGN 0
-#define TM_PROFILE_COMPUTEQUANTWEIGHTS 0
-#define TM_PROFILE_LSPQUANT 0
+#define TM_PROFILE 1
+#define TM_PROFILE_FIRMEM16 0
+#define TM_PROFILE_IIRMEM16 0
+#define TM_PROFILE_FILTERMEM16 0
+#define TM_PROFILE_VQNBEST 0
+#define TM_PROFILE_VQNBESTSIGN 0
+#define TM_PROFILE_COMPUTEQUANTWEIGHTS 0
+#define TM_PROFILE_LSPQUANT 0
#define TM_PROFILE_LSPWEIGHTQUANT 0
#define TM_PROFILE_LSPENFORCEMARGIN 0
#define TM_PROFILE_LSPTOLPC 0
-#define TM_PROFILE_INNERPROD 0
-#define TM_PROFILE_PITCHXCORR 0
-#define TM_PROFILE_LSP_INTERPOLATE 0
-#define TM_PROFILE_CHEBPOLYEVA 0
-#define TM_PROFILE_COMPUTEWEIGHTEDCODEBOOK 0
-#define TM_PROFILE_TARGETUPDATE 0
+#define TM_PROFILE_INNERPROD 0
+#define TM_PROFILE_PITCHXCORR 0
+#define TM_PROFILE_LSP_INTERPOLATE 0
+#define TM_PROFILE_CHEBPOLYEVA 0
+#define TM_PROFILE_COMPUTEWEIGHTEDCODEBOOK 0
+#define TM_PROFILE_TARGETUPDATE 0
#define TM_PROFILE_SPXAUTOCORR 0
#define TM_PROFILE_COMPUTEPITCHERROR 0
#define TM_PROFILE_COMPUTERMS16 0
diff --git a/tmv/fftwrap_tm.h b/tmv/fftwrap_tm.h
index 39d924e..488a8d2 100644
--- a/tmv/fftwrap_tm.h
+++ b/tmv/fftwrap_tm.h
@@ -8,18 +8,18 @@
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
-
+
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
-
+
- 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.
-
+
- Neither the name of the Xiph.org Foundation nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
-
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -59,12 +59,12 @@ static int maximize_range(Int16 *in, Int16 *out, int bound, int len)
x32 = ld32x(in,i+1);
x54 = ld32x(in,i+2);
x76 = ld32x(in,i+3);
-
+
x10 = dspidualabs(x10);
x32 = dspidualabs(x32);
x54 = dspidualabs(x54);
x76 = dspidualabs(x76);
-
+
x10 = imax(sex16(x10), asri(16,x10));
x32 = imax(sex16(x32), asri(16,x32));
x54 = imax(sex16(x54), asri(16,x54));
@@ -101,7 +101,7 @@ static int maximize_range(Int16 *in, Int16 *out, int bound, int len)
st32d(j+4,out,x32);
st32d(j+8,out,x54);
st32d(j+12,out,x76);
- }
+ }
}
MAXIMIZERANGE_STOP();
@@ -157,7 +157,7 @@ static void renorm_range(Int16 *in, Int16 *out, int shift, int len)
#endif
-#ifdef USE_COMPACT_KISS_FFT
+#ifdef USE_COMPACT_KISS_FFT
#ifdef FIXED_POINT
#define OVERRIDE_POWER_SPECTRUM
@@ -175,9 +175,9 @@ void power_spectrum(const spx_word16_t *X, spx_word32_t *ps, int N)
x76 = 0;
ps[0] = MULT16_16(X[0],X[0]);
N >>= 1;
-
+
for( i=1 ; i<N ; i+=4 )
- {
+ {
x10 = ld32x(x, i);
x32 = ld32x(x, i+1);
x54 = ld32x(x, i+2);
@@ -202,7 +202,7 @@ void power_spectrum(const float * restrict X, float * restrict ps, int N)
{
register int i, j;
register float xx;
-
+
POWERSPECTRUM_START();
xx = X[0];
@@ -216,7 +216,7 @@ void power_spectrum(const float * restrict X, float * restrict ps, int N)
xi = X[i];
xii = X[i+1];
-
+
ps[j] = MULT16_16(xi,xi) + MULT16_16(xii,xii);
}
#pragma TCS_unrollexact=0
diff --git a/tmv/filterbank_tm.h b/tmv/filterbank_tm.h
index 39d2332..e739c66 100644
--- a/tmv/filterbank_tm.h
+++ b/tmv/filterbank_tm.h
@@ -8,18 +8,18 @@
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
-
+
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
-
+
- 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.
-
+
- Neither the name of the Xiph.org Foundation nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
-
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -42,7 +42,7 @@ void filterbank_compute_bank32(FilterBank * restrict bank, spx_word32_t * restri
{
register int i, j, k, banks, len, zero, s;
register int * restrict left;
- register int * restrict right;
+ register int * restrict right;
register int * restrict bleft;
register int * restrict bright;
@@ -82,14 +82,14 @@ void filterbank_compute_bank32(FilterBank * restrict bank, spx_word32_t * restri
#pragma TCS_unrollexact=1
#endif
for ( i=0,j=1,k=0 ; i<len ; i+=2,j+=2,++k )
- { register int ps1, ps0, _mel, ps0_msb, ps0_lsb, ps1_msb, ps1_lsb;
+ { register int ps1, ps0, _mel, ps0_msb, ps0_lsb, ps1_msb, ps1_lsb;
register int left10, right10, left1, left0, right1, right0;
register int il1, ir1, il0, ir0;
ps0 = ld32x(ps,i);
il0 = ld32x(bleft,i);
_mel = ld32x(mel,il0);
- left10 = ld32x(left,k);
+ left10 = ld32x(left,k);
ir0 = ld32x(bright,i);
right10 = ld32x(right,k);
@@ -133,7 +133,7 @@ void filterbank_compute_psd16(FilterBank * restrict bank, spx_word16_t * restric
{
register int i, j, k, len, s;
register int * restrict left;
- register int * restrict right;
+ register int * restrict right;
register int * restrict bleft;
register int * restrict bright;
@@ -169,28 +169,28 @@ void filterbank_compute_psd16(FilterBank * restrict bank, spx_word16_t * restric
il0 = ld32x(bleft, i);
ir0 = ld32x(bright,i);
- mell0 = mel[il0];
+ mell0 = mel[il0];
melr0 = mel[ir0];
left10 = ld32x(left, k);
right10 = ld32x(right, k);
mel0 = pack16lsb(mell0, melr0);
lr0 = pack16lsb(left10, right10);
-
+
acc0 += ifir16(mel0, lr0);
acc0 >>= 15;
-
+
il1 = ld32x(bleft, i+1);
ir1 = ld32x(bright,i+1);
mell1 = mel[il1];
melr1 = mel[ir1];
mel1 = pack16lsb(mell1, melr1);
lr1 = pack16msb(left10, right10);
-
+
acc1 += ifir16(mel1, lr1);
acc1 >>= 15;
ps10 = pack16lsb(acc1, acc0);
-
+
st32d(j, ps, ps10);
}
#if (TM_UNROLL && TM_UNROLL_FILTERBANKCOMPUTEPSD16)
@@ -233,7 +233,7 @@ void filterbank_compute_bank32(FilterBank * restrict bank, float * restrict ps,
id1 = bleft[i];
id2 = bright[i];
psi = ps[i];
-
+
mel[id1] += left[i] * psi;
mel[id2] += right[i] * psi;
}
@@ -274,7 +274,7 @@ void filterbank_compute_psd16(FilterBank * restrict bank, float * restrict mel,
acc = mel[id1] * left[i];
acc += mel[id2] * right[i];
-
+
ps[i] = acc;
}
#if (TM_UNROLL && TM_UNROLL_FILTERBANKCOMPUTEPSD16)
diff --git a/tmv/fixed_tm.h b/tmv/fixed_tm.h
index c8fa968..d5e12b1 100644
--- a/tmv/fixed_tm.h
+++ b/tmv/fixed_tm.h
@@ -8,18 +8,18 @@
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
-
+
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
-
+
- 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.
-
+
- Neither the name of the Xiph.org Foundation nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
-
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -75,7 +75,7 @@
#undef ADD32
#undef SUB32
#undef MULT16_16
-#undef MULT16_16_16
+#undef MULT16_16_16
#define ADD16(a,b) ((int)(a) + (int)(b))
#define SUB16(a,b) ((int)(a) - (int)(b))
diff --git a/tmv/kiss_fft_tm.h b/tmv/kiss_fft_tm.h
index dce2072..0a69f3d 100644
--- a/tmv/kiss_fft_tm.h
+++ b/tmv/kiss_fft_tm.h
@@ -8,18 +8,18 @@
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
-
+
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
-
+
- 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.
-
+
- Neither the name of the Xiph.org Foundation nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
-
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -53,17 +53,17 @@ static void kf_bfly2(
register int * restrict tw1 = (int*)st->twiddles;
register int i, j;
register int _inv = !st->inverse;
-
+
Fout2 = (int*)Fout + m;
-
+
for ( i=0,j=0 ; i<m ; ++i,j+=4,tw1+=fstride )
{ register int tw_10, ff_10, f2_10;
ff_10 = ld32x(Fout, i);
f2_10 = ld32x(Fout2, i);
tw_10 = ld32(tw1);
-
- if ( _inv )
+
+ if ( _inv )
{ TM_SHR(f2_10, f2_10, 1);
TM_SHR(ff_10, ff_10, 1);
}
@@ -111,11 +111,11 @@ static void kf_bfly4(
sc0 = ld32x(Fout1,i);
sc3 = ld32(tw1);
sc1 = ld32x(Fout2, i);
- sc4 = ld32(tw2);
+ sc4 = ld32(tw2);
sc2 = ld32x(Fout3, i);
sc5 = ld32(tw3);
ff0 = ld32x(Fout,i);
-
+
if ( _inv )
{
TM_ADD(sc0, sc0, 0x00020002);
@@ -137,12 +137,12 @@ static void kf_bfly4(
TM_SUB(sc4, sc0, sc2);
TM_SUB(sc1, ff0, sc3);
TM_ADD(ff0, ff0, sc3);
-
+
st32d(j, Fout2, sc1);
st32d(j, Fout, ff0);
sc5 = funshift2(sc5, sc5);
-
+
if ( _inv )
{ TM_ADD(ff0, sc5, sc4);
TM_SUB(sc1, sc5, sc4);
@@ -193,7 +193,7 @@ static void kf_bfly3(
sc3 = ld32(tw1);
sc4 = ld32(tw2);
ff0 = ld32x(Fout,i);
-
+
if ( _inv )
{
TM_DIV(sc1, sc1, 3);
@@ -233,7 +233,7 @@ static void kf_bfly5(
const kiss_fft_cfg st,
int m
)
-{
+{
register int * restrict tw1;
register int * restrict tw2;
register int * restrict tw3;
@@ -309,7 +309,7 @@ static void kf_bfly5(
sc78_lsb = pack16lsb(sc7,sc8);
sc90_msb = pack16msb(sc10,sc9);
sc90_lsb = pack16lsb(sc10,sc9);
-
+
sc5 = pack16lsb( sround(ifir16(sc78_msb,yab_lsb)), sround(ifir16(sc78_lsb,yab_lsb)));
sc6 = pack16lsb(-sround(ifir16(sc90_lsb,yab_msb)), sround(ifir16(sc90_msb,yab_msb)));
@@ -348,41 +348,41 @@ static void kf_bfly_generic(
CHECKBUF(scratchbuf,nscratchbuf,p);
- for ( i=0; i<m; ++i )
+ for ( i=0; i<m; ++i )
{ register int sc10;
- for ( j=0,k=i ; j<p ; ++j,k+=m )
+ for ( j=0,k=i ; j<p ; ++j,k+=m )
{ register int f10;
f10 = ld32x(Fout,k);
- if ( _inv )
+ if ( _inv )
{ TM_DIV(f10, f10, p);
}
st32d(j<<2, scratchbuf, f10);
}
- for ( j=0,k=i,sc10=ld32(scratchbuf) ; j<p ; ++j,k+=m )
+ for ( j=0,k=i,sc10=ld32(scratchbuf) ; j<p ; ++j,k+=m )
{
register int twidx = 0;
register int f10;
- for ( l=1,f10 = sc10 ; l<p ; ++l )
+ for ( l=1,f10 = sc10 ; l<p ; ++l )
{ register int tw, sc;
twidx += fstride * k;
- if ( twidx>=Norig )
+ if ( twidx>=Norig )
{ twidx -= Norig;
}
-
+
sc = ld32x(scratchbuf,l);
tw = ld32x(twiddles,twidx);
-
+
TM_MUL(sc, sc, tw);
TM_ADD(f10, f10, sc);
}
- st32d(k<<2, Fout, f10);
+ st32d(k<<2, Fout, f10);
}
}
}
@@ -405,17 +405,17 @@ static void kf_bfly2(
do
{
register kiss_fft_cpx _fout2, _fout, t;
-
+
_fout2 = *Fout2;
_fout = *Fout;
-
+
C_MUL ( t, _fout2, *tw1);
C_SUB (_fout2, _fout, t);
C_ADD (_fout, _fout, t);
-
+
*Fout2 = _fout2;
*Fout = _fout;
-
+
tw1 += fstride;
++Fout2;
++Fout;
@@ -432,22 +432,22 @@ static void kf_bfly4(
)
{
register kiss_fft_cpx * restrict tw1,* restrict tw2,* restrict tw3;
- register kiss_fft_cpx * restrict Fout1, * restrict Fout2, * restrict Fout3;
+ register kiss_fft_cpx * restrict Fout1, * restrict Fout2, * restrict Fout3;
register int _inv = !st->inverse;
-
+
tw3 = tw2 = tw1 = st->twiddles;
-
+
Fout1 = Fout + m;
Fout2 = Fout + (m << 1);
Fout3 = Fout + (m * 3);
do {
-
+
register kiss_fft_cpx _fout;
register kiss_fft_cpx sc0, sc1, sc2, sc3, sc4, sc5;
-
+
_fout = *Fout;
-
+
C_MUL( sc0,*Fout1, *tw1);
C_MUL( sc1,*Fout2, *tw2);
C_MUL( sc2,*Fout3, *tw3);
@@ -458,10 +458,10 @@ static void kf_bfly4(
C_SUB(*Fout2, _fout, sc3);
C_ADD( *Fout, _fout, sc3);
- tw1 += fstride;
+ tw1 += fstride;
tw2 += (fstride << 1);
tw3 += (fstride * 3);
-
+
if ( _inv )
{
Fout1->r = sc5.r + sc4.i;
@@ -475,10 +475,10 @@ static void kf_bfly4(
Fout3->r = sc5.r + sc4.i;
Fout3->i = sc5.i - sc4.r;
}
-
-
+
+
++Fout; ++Fout1; ++Fout2; ++Fout3;
-
+
} while(--m);
}
@@ -493,40 +493,40 @@ static void kf_bfly3(
register kiss_fft_cpx * restrict Fout1, * restrict Fout2;
register kiss_fft_cpx * restrict tw1,* restrict tw2;
register float epi;
-
+
tw1 = tw2 = st->twiddles;
epi = st->twiddles[fstride*m].i;
Fout1 = Fout + m;
Fout2 = Fout + (m << 1);
do {
-
+
register kiss_fft_cpx _fout;
register kiss_fft_cpx sc0, sc1, sc2, sc3;
-
+
_fout = *Fout;
-
+
C_MUL( sc1, *Fout1, *tw1);
C_MUL( sc2, *Fout2, *tw2);
C_ADD( sc3, sc1, sc2);
C_SUB( sc0, sc1, sc2);
tw1 += fstride;
tw2 += (fstride << 1);
-
+
sc1.r = _fout.r - HALF_OF(sc3.r);
sc1.i = _fout.i - HALF_OF(sc3.i);
-
+
C_MULBYSCALAR(sc0, epi);
C_ADD(*Fout, _fout, sc3);
-
+
Fout2->r = sc1.r + sc0.i;
Fout2->i = sc1.i - sc0.r;
-
+
Fout1->r = sc1.i - sc0.i;
Fout1->i = sc1.r + sc0.r;
-
+
++Fout; ++Fout1; ++Fout2;
-
+
} while(--m);
}
@@ -553,42 +553,42 @@ static void kf_bfly5(
yai = tw[fstride*m].i;
ybr = tw[fstride*2*m].r;
ybi = tw[fstride*2*m].i;
-
+
for ( u=0; u<m; ++u )
{
register kiss_fft_cpx sc0, sc1, sc2, sc3, sc4, sc5, sc6, sc7, sc8, sc9, sc10, sc11, sc12;
-
+
sc0 = *Fout;
-
+
C_MUL( sc1,*Fout1, tw[u*fstride]);
C_MUL( sc2,*Fout2, tw[2*u*fstride]);
C_MUL( sc3,*Fout3, tw[3*u*fstride]);
C_MUL( sc4,*Fout4, tw[4*u*fstride]);
-
+
C_ADD( sc7, sc1, sc4);
C_SUB( sc10, sc1, sc4);
C_ADD( sc8, sc2, sc3);
C_SUB( sc9, sc2, sc3);
-
+
Fout->r = sc0.r + sc7.r + sc8.r;
Fout->i = sc0.i + sc7.i + sc8.i;
-
+
sc5.r = sc0.r + S_MUL(sc7.r,yar) + S_MUL(sc8.r,ybr);
sc5.i = sc0.i + S_MUL(sc7.i,yar) + S_MUL(sc8.i,ybr);
-
+
sc6.r = S_MUL(sc10.i,yai) + S_MUL(sc9.i,ybi);
sc6.i = -S_MUL(sc10.r,yai) - S_MUL(sc9.r,ybi);
-
+
C_SUB(*Fout1,sc5,sc6);
C_ADD(*Fout4,sc5,sc6);
-
+
sc11.r = sc0.r + S_MUL(sc7.r,ybr) + S_MUL(sc8.r,yar);
sc11.i = sc0.i + S_MUL(sc7.i,ybr) + S_MUL(sc8.i,yar);
sc12.r = - S_MUL(sc10.i,ybi) + S_MUL(sc9.i,yai);
sc12.i = S_MUL(sc10.r,ybi) - S_MUL(sc9.r,yai);
C_ADD(*Fout2,sc11,sc12);
C_SUB(*Fout3,sc11,sc12);
-
+
++Fout1; ++Fout2; ++Fout3; ++Fout4;
}
}
diff --git a/tmv/kiss_fftr_tm.h b/tmv/kiss_fftr_tm.h
index 5b2b2cf..8b9f75a 100644
--- a/tmv/kiss_fftr_tm.h
+++ b/tmv/kiss_fftr_tm.h
@@ -8,18 +8,18 @@
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
-
+
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
-
+
- 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.
-
+
- Neither the name of the Xiph.org Foundation nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
-
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -46,7 +46,7 @@
c1 = -asri(16,(c)); \
c0 = sex16((c)); \
(res) = pack16lsb(sround(c1 * (32767/(frac))), sround(c0 * (32767/(frac))));\
- }
+ }
#define OVERRIDE_KISS_FFTR
@@ -78,8 +78,8 @@ void kiss_fftr(kiss_fftr_cfg st,const kiss_fft_scalar * restrict timedata, kiss_
freqdata[ncfft].i = freqdata[0].i = 0;
}
- for ( k=1 ; k <= ncfft2 ; ++k )
- {
+ for ( k=1 ; k <= ncfft2 ; ++k )
+ {
register int fpk, fpnk, i, tw, f1k, f2k;
register int fq1, fq2;
@@ -91,7 +91,7 @@ void kiss_fftr(kiss_fftr_cfg st,const kiss_fft_scalar * restrict timedata, kiss_
TM_DIV(fpk, fpk, 2);
TM_NDIV(fpnk,fpnk,2);
-
+
TM_ADD( f1k, fpk , fpnk );
TM_SUB( f2k, fpk , fpnk );
TM_MUL( tw , f2k, tw );
@@ -134,7 +134,7 @@ void kiss_fftri(kiss_fftr_cfg st,const kiss_fft_cpx * restrict freqdata,kiss_fft
st->tmpbuf[0].i = fqr - fqnr;
}
- for ( k=1 ; k <= ncfft2 ; ++k )
+ for ( k=1 ; k <= ncfft2 ; ++k )
{
register int fk, fnkc, i, tw, fek, fok, tmp;
register int tbk, tbn;
@@ -144,7 +144,7 @@ void kiss_fftri(kiss_fftr_cfg st,const kiss_fft_cpx * restrict freqdata,kiss_fft
fk = ld32x(freqdata,k);
tw = ld32x(twiddles,k);
fnkc = pack16lsb(-freqdata[i].i, freqdata[i].r);
-
+
TM_ADD (fek, fk, fnkc);
TM_SUB (tmp, fk, fnkc);
TM_MUL (fok, tmp, tw );
@@ -176,14 +176,14 @@ void kiss_fftr(kiss_fftr_cfg st,const kiss_fft_scalar * restrict timedata,kiss_f
tdcr = tmpbuf[0].r;
tdci = tmpbuf[0].i;
-
+
freqdata[0].r = tdcr + tdci;
freqdata[ncfft].r = tdcr - tdci;
freqdata[ncfft].i = freqdata[0].i = 0;
- for ( k=1;k <= ncfft/2 ; ++k )
+ for ( k=1;k <= ncfft/2 ; ++k )
{
- fpk = tmpbuf[k];
+ fpk = tmpbuf[k];
fpnk.r = tmpbuf[ncfft-k].r;
fpnk.i = -tmpbuf[ncfft-k].i;
@@ -203,16 +203,16 @@ void kiss_fftri(kiss_fftr_cfg st,const kiss_fft_cpx * restrict freqdata,kiss_fft
{
register int k, ncfft;
register kiss_fft_cpx * restrict tmpbuf, * restrict tw;
-
-
+
+
ncfft = st->substate->nfft;
tmpbuf= st->tmpbuf;
tw = st->super_twiddles;
-
+
tmpbuf[0].r = freqdata[0].r + freqdata[ncfft].r;
tmpbuf[0].i = freqdata[0].r - freqdata[ncfft].r;
- for (k = 1; k <= ncfft / 2; ++k)
+ for (k = 1; k <= ncfft / 2; ++k)
{
register kiss_fft_cpx fk, fnkc, fek, fok, tmp;
fk = freqdata[k];
diff --git a/tmv/mdf_tm.h b/tmv/mdf_tm.h
index cc82bf8..c505570 100644
--- a/tmv/mdf_tm.h
+++ b/tmv/mdf_tm.h
@@ -8,18 +8,18 @@
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
-
+
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
-
+
- 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.
-
+
- Neither the name of the Xiph.org Foundation nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
-
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -36,7 +36,7 @@
#include "profile_tm.h"
// shifted power spectrum to fftwrap.c so that optimisation can be shared between mdf.c and preprocess.c
-#define OVERRIDE_POWER_SPECTRUM
+#define OVERRIDE_POWER_SPECTRUM
#ifdef FIXED_POINT
@@ -44,10 +44,10 @@
#define OVERRIDE_FILTER_DC_NOTCH16
void filter_dc_notch16(
- const spx_int16_t * restrict in,
- float radius,
- float * restrict out,
- int len,
+ const spx_int16_t * restrict in,
+ float radius,
+ float * restrict out,
+ int len,
float * restrict mem
)
{
@@ -74,7 +74,7 @@ void filter_dc_notch16(
mem0 = mem1 + 2 * (-vin + rvout);
mem1 = vin - (den2 * vout);
-
+
out[i] = rvout;
}
#if (TM_UNROLL && TM_UNROLL_FILTERDCNOTCH16)
@@ -90,17 +90,17 @@ void filter_dc_notch16(
#define OVERRIDE_MDF_INNER_PROD
float mdf_inner_prod(
- const float * restrict x,
- const float * restrict y,
+ const float * restrict x,
+ const float * restrict y,
int len
)
{
register float sum = 0;
-
+
MDFINNERPROD_START();
len >>= 1;
-
+
#if (TM_UNROLL && TM_UNROLL_MDFINNERPRODUCT)
#pragma TCS_unroll=4
#pragma TCS_unrollexact=1
@@ -126,9 +126,9 @@ float mdf_inner_prod(
#define OVERRIDE_SPECTRAL_MUL_ACCUM
void spectral_mul_accum(
- const float * restrict X,
- const float * restrict Y,
- float * restrict acc,
+ const float * restrict X,
+ const float * restrict Y,
+ float * restrict acc,
int N, int M
)
{
@@ -151,11 +151,11 @@ void spectral_mul_accum(
acc[i] = (Xi * Yi - Xii * Yii);
acc[i+1]= (Xii * Yi + Xi * Yii);
}
-
+
acc[_N] = X[_N] * Y[_N];
for ( j=1,X+=N,Y+=N ; j<M ; j++ )
- {
+ {
acc[0] += X[0] * Y[0];
for ( i=1 ; i<N-1 ; i+=2 )
@@ -168,7 +168,7 @@ void spectral_mul_accum(
acc[i] += (Xi * Yi - Xii * Yii);
acc[i+1]+= (Xii * Yi + Xi * Yii);
}
-
+
acc[_N] += X[_N] * Y[_N];
X += N;
Y += N;
@@ -179,11 +179,11 @@ void spectral_mul_accum(
#define OVERRIDE_WEIGHTED_SPECTRAL_MUL_CONJ
void weighted_spectral_mul_conj(
- const float * restrict w,
- const float p,
- const float * restrict X,
- const float * restrict Y,
- float * restrict prod,
+ const float * restrict w,
+ const float p,
+ const float * restrict X,
+ const float * restrict Y,
+ float * restrict prod,
int N
)
{
@@ -192,7 +192,7 @@ void weighted_spectral_mul_conj(
WEIGHTEDSPECTRALMULCONJ_START();
- prod[0] = p * w[0] * X[0] * Y[0];
+ prod[0] = p * w[0] * X[0] * Y[0];
_N = N-1;
for (i=1,j=1;i<_N;i+=2,j++)
@@ -210,7 +210,7 @@ void weighted_spectral_mul_conj(
prod[i] = W * (Xi * Yi + Xii * Yii);
prod[i+1]= W * (Xi * Yii - Xii * Yi);
}
-
+
prod[_N] = p * w[j] * X[_N] * Y[_N];
WEIGHTEDSPECTRALMULCONJ_STOP();
@@ -218,9 +218,9 @@ void weighted_spectral_mul_conj(
#define OVERRIDE_MDF_ADJUST_PROP
void mdf_adjust_prop(
- const float * restrict W,
- int N,
- int M,
+ const float * restrict W,
+ int N,
+ int M,
float * restrict prop
)
{
@@ -242,9 +242,9 @@ void mdf_adjust_prop(
#pragma TCS_unrollexact=1
#endif
for ( j=k ; j<l ; ++j )
- {
+ {
register float wi = W[j];
-
+
tmp += wi * wi;
}
#if (TM_UNROLL && TM_UNROLL_MDFADJUSTPROP)
@@ -277,8 +277,8 @@ void mdf_adjust_prop(
#define OVERRIDE_SPEEX_ECHO_GET_RESIDUAL
void speex_echo_get_residual(
- SpeexEchoState * restrict st,
- float * restrict residual_echo,
+ SpeexEchoState * restrict st,
+ float * restrict residual_echo,
int len
)
{
@@ -302,16 +302,16 @@ void speex_echo_get_residual(
#pragma TCS_unrollexact=1
#endif
for (i=0;i<N;i++)
- { y[i] = window[i] * last_y[i];
+ { y[i] = window[i] * last_y[i];
}
#if (TM_UNROLL && TM_UNROLL_SPEEXECHOGETRESIDUAL)
#pragma TCS_unrollexact=0
#pragma TCS_unroll=0
#endif
-
+
spx_fft(st->fft_table, st->y, st->Y);
power_spectrum(st->Y, residual_echo, N);
-
+
leake = st->leak_estimate;
leak2 = fmux(leake > .5, 1, 2 * leake);
N = st->frame_size;
@@ -340,7 +340,7 @@ void speex_echo_get_residual(
void mdf_preemph(
- SpeexEchoState * restrict st,
+ SpeexEchoState * restrict st,
spx_word16_t * restrict x,
const spx_int16_t * restrict far_end,
int framesize
@@ -429,7 +429,7 @@ void mdf_sub(
#if (TM_UNROLL && TM_UNROLL_SPEEXECHOCANCELLATION)
#pragma TCS_unrollexact=0
#pragma TCS_unroll=0
-#endif
+#endif
}
void mdf_sub_int(
@@ -458,8 +458,8 @@ void mdf_sub_int(
#else
for ( i=0,j=0 ; i<framesize ; i+=2,++j )
{ register int src1i, src2i, desti;
-
-
+
+
src1i = ld32d(src1,j);
src2i = ld32d(src2,j);
desti = dspidualsub(src1i,src2i);
@@ -472,7 +472,7 @@ void mdf_sub_int(
#if (TM_UNROLL && TM_UNROLL_SPEEXECHOCANCELLATION)
#pragma TCS_unrollexact=0
#pragma TCS_unroll=0
-#endif
+#endif
}
void mdf_compute_weight_gradient(
@@ -490,11 +490,11 @@ void mdf_compute_weight_gradient(
register spx_word32_t * restrict W = &(st->W[j*N]);
weighted_spectral_mul_conj(
- st->power_1,
- FLOAT_SHL(PSEUDOFLOAT(st->prop[j]),-15),
- &X[(j+1)*N],
- st->E,
- st->PHI,
+ st->power_1,
+ FLOAT_SHL(PSEUDOFLOAT(st->prop[j]),-15),
+ &X[(j+1)*N],
+ st->E,
+ st->PHI,
N);
#if (TM_UNROLL && TM_UNROLL_SPEEXECHOCANCELLATION)
#pragma TCS_unroll=4
@@ -506,7 +506,7 @@ void mdf_compute_weight_gradient(
#if (TM_UNROLL && TM_UNROLL_SPEEXECHOCANCELLATION)
#pragma TCS_unrollexact=0
#pragma TCS_unroll=0
-#endif
+#endif
}
}
@@ -528,7 +528,7 @@ void mdf_update_weight(
for ( j=0 ; j<M ; j++ )
{
register spx_word32_t * restrict W = &(st->W[j*N]);
-
+
if (j==0 || cancel_count%(M-1) == j-1)
{
#ifdef FIXED_POINT
@@ -542,7 +542,7 @@ void mdf_update_weight(
#if (TM_UNROLL && TM_UNROLL_SPEEXECHOCANCELLATION)
#pragma TCS_unrollexact=0
#pragma TCS_unroll=0
-#endif
+#endif
spx_ifft(st->fft_table, wtmp2, wtmp);
memset(wtmp, 0, framesize * sizeof(spx_word16_t));
@@ -556,7 +556,7 @@ void mdf_update_weight(
#if (TM_UNROLL && TM_UNROLL_SPEEXECHOCANCELLATION)
#pragma TCS_unrollexact=0
#pragma TCS_unroll=0
-#endif
+#endif
spx_fft(st->fft_table, wtmp, wtmp2);
@@ -570,13 +570,13 @@ void mdf_update_weight(
#if (TM_UNROLL && TM_UNROLL_SPEEXECHOCANCELLATION)
#pragma TCS_unrollexact=0
#pragma TCS_unroll=0
-#endif
+#endif
#else
spx_ifft(st->fft_table, W, wtmp);
memset(&wtmp[framesize], 0, (N-framesize) * sizeof(spx_word16_t));
spx_fft(st->fft_table, wtmp, W);
-#endif
+#endif
}
}
}
@@ -589,11 +589,11 @@ spx_word32_t mdf_update_foreground(
spx_word32_t Dbf,
spx_word32_t Sff,
spx_word32_t See
-)
-{
- register spx_word32_t Davg1 = st->Davg1;
- register spx_word32_t Davg2 = st->Davg2;
- register spx_word32_t Dvar1 = st->Dvar1;
+)
+{
+ register spx_word32_t Davg1 = st->Davg1;
+ register spx_word32_t Davg2 = st->Davg2;
+ register spx_word32_t Dvar1 = st->Dvar1;
register spx_word32_t Dvar2 = st->Dvar2;
register spx_word16_t * restrict input = st->input;
register int framesize = st->frame_size;
@@ -604,80 +604,80 @@ spx_word32_t mdf_update_foreground(
register int i;
register int N = st->window_size;
register int M = st->M;
-
-#ifdef FIXED_POINT
- register spx_word32_t sc0 = SUB32(Sff,See);
- register spx_float_t sc1 = FLOAT_MUL32U(Sff,Dbf);
-
- Davg1 = ADD32(MULT16_32_Q15(QCONST16(.6f,15),Davg1), MULT16_32_Q15(QCONST16(.4f,15),sc0));
- Davg2 = ADD32(MULT16_32_Q15(QCONST16(.85f,15),Davg2), MULT16_32_Q15(QCONST16(.15f,15),sc0));
- Dvar1 = FLOAT_ADD(
- FLOAT_MULT(VAR1_SMOOTH,Dvar1),
- FLOAT_MUL32U(MULT16_32_Q15(QCONST16(.4f,15),Sff),
- MULT16_32_Q15(QCONST16(.4f,15),Dbf)));
- Dvar2 = FLOAT_ADD(
- FLOAT_MULT(VAR2_SMOOTH,Dvar2),
- FLOAT_MUL32U(MULT16_32_Q15(QCONST16(.15f,15),Sff),
- MULT16_32_Q15(QCONST16(.15f,15),Dbf)));
+
+#ifdef FIXED_POINT
+ register spx_word32_t sc0 = SUB32(Sff,See);
+ register spx_float_t sc1 = FLOAT_MUL32U(Sff,Dbf);
+
+ Davg1 = ADD32(MULT16_32_Q15(QCONST16(.6f,15),Davg1), MULT16_32_Q15(QCONST16(.4f,15),sc0));
+ Davg2 = ADD32(MULT16_32_Q15(QCONST16(.85f,15),Davg2), MULT16_32_Q15(QCONST16(.15f,15),sc0));
+ Dvar1 = FLOAT_ADD(
+ FLOAT_MULT(VAR1_SMOOTH,Dvar1),
+ FLOAT_MUL32U(MULT16_32_Q15(QCONST16(.4f,15),Sff),
+ MULT16_32_Q15(QCONST16(.4f,15),Dbf)));
+ Dvar2 = FLOAT_ADD(
+ FLOAT_MULT(VAR2_SMOOTH,Dvar2),
+ FLOAT_MUL32U(MULT16_32_Q15(QCONST16(.15f,15),Sff),
+ MULT16_32_Q15(QCONST16(.15f,15),Dbf)));
#else
- register spx_word32_t sc0 = Sff - See;
- register spx_word32_t sc1 = Sff * Dbf;
-
- Davg1 = .6*Davg1 + .4*sc0;
- Davg2 = .85*Davg2 + .15*sc0;
- Dvar1 = VAR1_SMOOTH*Dvar1 + .16*sc1;
- Dvar2 = VAR2_SMOOTH*Dvar2 + .0225*sc1;
+ register spx_word32_t sc0 = Sff - See;
+ register spx_word32_t sc1 = Sff * Dbf;
+
+ Davg1 = .6*Davg1 + .4*sc0;
+ Davg2 = .85*Davg2 + .15*sc0;
+ Dvar1 = VAR1_SMOOTH*Dvar1 + .16*sc1;
+ Dvar2 = VAR2_SMOOTH*Dvar2 + .0225*sc1;
+#endif
+
+ update_foreground =
+ mux( FLOAT_GT(FLOAT_MUL32U(sc0, VABS(sc0)), sc1), 1,
+ mux( FLOAT_GT(FLOAT_MUL32U(Davg1, VABS(Davg1)), FLOAT_MULT(VAR1_UPDATE,(Dvar1))), 1,
+ mux( FLOAT_GT(FLOAT_MUL32U(Davg2, VABS(Davg2)), FLOAT_MULT(VAR2_UPDATE,(Dvar2))), 1, 0)));
+
+ if ( update_foreground )
+ {
+ register spx_word16_t * restrict windowf = st->window + framesize;
+ register spx_word16_t * restrict window = st->window;
+
+ st->Davg1 = st->Davg2 = 0;
+ st->Dvar1 = st->Dvar2 = FLOAT_ZERO;
+
+ memcpy(st->foreground, st->W, N*M*sizeof(spx_word32_t));
+
+#if (TM_UNROLL && TM_UNROLL_SPEEXECHOCANCELLATION)
+#pragma TCS_unroll=4
+#pragma TCS_unrollexact=1
#endif
-
- update_foreground =
- mux( FLOAT_GT(FLOAT_MUL32U(sc0, VABS(sc0)), sc1), 1,
- mux( FLOAT_GT(FLOAT_MUL32U(Davg1, VABS(Davg1)), FLOAT_MULT(VAR1_UPDATE,(Dvar1))), 1,
- mux( FLOAT_GT(FLOAT_MUL32U(Davg2, VABS(Davg2)), FLOAT_MULT(VAR2_UPDATE,(Dvar2))), 1, 0)));
-
- if ( update_foreground )
- {
- register spx_word16_t * restrict windowf = st->window + framesize;
- register spx_word16_t * restrict window = st->window;
-
- st->Davg1 = st->Davg2 = 0;
- st->Dvar1 = st->Dvar2 = FLOAT_ZERO;
-
- memcpy(st->foreground, st->W, N*M*sizeof(spx_word32_t));
-
-#if (TM_UNROLL && TM_UNROLL_SPEEXECHOCANCELLATION)
-#pragma TCS_unroll=4
-#pragma TCS_unrollexact=1
-#endif
- for ( i=0 ; i<framesize ; ++i)
- { register spx_word16_t wi = window[i];
- register spx_word16_t wfi = windowf[i];
- register spx_word16_t ei = ee[i];
- register spx_word16_t yi = y[i];
-
- ee[i] = MULT16_16_Q15(wfi,ei) + MULT16_16_Q15(wi,yi);
- }
-#if (TM_UNROLL && TM_UNROLL_SPEEXECHOCANCELLATION)
-#pragma TCS_unrollexact=0
-#pragma TCS_unroll=0
-#endif
-
- } else
- {
- register int reset_background;
-
- reset_background =
- mux( FLOAT_GT(FLOAT_MUL32U(-(sc0),VABS(sc0)), FLOAT_MULT(VAR_BACKTRACK,sc1)), 1,
- mux( FLOAT_GT(FLOAT_MUL32U(-(Davg1), VABS(Davg1)), FLOAT_MULT(VAR_BACKTRACK,Dvar1)), 1,
- mux( FLOAT_GT(FLOAT_MUL32U(-(Davg2), VABS(Davg2)), FLOAT_MULT(VAR_BACKTRACK,Dvar2)), 1, 0)));
-
- if ( reset_background )
- {
- memcpy(st->W, st->foreground, N*M*sizeof(spx_word32_t));
- memcpy(y, ee, framesize * sizeof(spx_word16_t));
- mdf_sub(xx,input,y,framesize);
- See = Sff;
- st->Davg1 = st->Davg2 = 0;
- st->Dvar1 = st->Dvar2 = FLOAT_ZERO;
+ for ( i=0 ; i<framesize ; ++i)
+ { register spx_word16_t wi = window[i];
+ register spx_word16_t wfi = windowf[i];
+ register spx_word16_t ei = ee[i];
+ register spx_word16_t yi = y[i];
+
+ ee[i] = MULT16_16_Q15(wfi,ei) + MULT16_16_Q15(wi,yi);
+ }
+#if (TM_UNROLL && TM_UNROLL_SPEEXECHOCANCELLATION)
+#pragma TCS_unrollexact=0
+#pragma TCS_unroll=0
+#endif
+
+ } else
+ {
+ register int reset_background;
+
+ reset_background =
+ mux( FLOAT_GT(FLOAT_MUL32U(-(sc0),VABS(sc0)), FLOAT_MULT(VAR_BACKTRACK,sc1)), 1,
+ mux( FLOAT_GT(FLOAT_MUL32U(-(Davg1), VABS(Davg1)), FLOAT_MULT(VAR_BACKTRACK,Dvar1)), 1,
+ mux( FLOAT_GT(FLOAT_MUL32U(-(Davg2), VABS(Davg2)), FLOAT_MULT(VAR_BACKTRACK,Dvar2)), 1, 0)));
+
+ if ( reset_background )
+ {
+ memcpy(st->W, st->foreground, N*M*sizeof(spx_word32_t));
+ memcpy(y, ee, framesize * sizeof(spx_word16_t));
+ mdf_sub(xx,input,y,framesize);
+ See = Sff;
+ st->Davg1 = st->Davg2 = 0;
+ st->Dvar1 = st->Dvar2 = FLOAT_ZERO;
} else
{
st->Davg1 = Davg1;
@@ -688,9 +688,9 @@ spx_word32_t mdf_update_foreground(
}
return See;
-}
+}
#endif
-
+
void mdf_compute_error_signal(
SpeexEchoState * restrict st,
const spx_int16_t * restrict in,
@@ -733,7 +733,7 @@ void mdf_compute_error_signal(
#else
tmp_out = SUB32(EXTEND32(input[i]), EXTEND32(y[i]));
#endif
- tmp_out =
+ tmp_out =
fmux( tmp_out > 32767, 32767,
fmux( tmp_out < -32768, -32768, tmp_out));
#endif
@@ -749,7 +749,7 @@ void mdf_compute_error_signal(
#if (TM_UNROLL && TM_UNROLL_SPEEXECHOCANCELLATION)
#pragma TCS_unrollexact=0
#pragma TCS_unroll=0
-#endif
+#endif
st->memE = memE;
st->saturated = saturated;
@@ -760,8 +760,8 @@ void mdf_compute_error_signal(
inline int mdf_check(
SpeexEchoState * restrict st,
spx_int16_t * out,
- spx_word32_t Syy,
- spx_word32_t Sxx,
+ spx_word32_t Syy,
+ spx_word32_t Sxx,
spx_word32_t See,
spx_word32_t Sff,
spx_word32_t Sdd
@@ -777,7 +777,7 @@ inline int mdf_check(
|| !(Sff < N1e9 && Syy < N1e9 && Sxx < N1e9 )
#endif
)
- {
+ {
screwed_up += 50;
memset(out, 0, framesize * sizeof(spx_int16_t));
@@ -811,7 +811,7 @@ void mdf_smooth(
#if (TM_UNROLL && TM_UNROLL_SPEEXECHOCANCELLATION)
#pragma TCS_unroll=4
#pragma TCS_unrollexact=1
-#endif
+#endif
for ( j=0 ; j<framesize ; ++j )
{ register spx_word32_t pi = power[j];
register spx_word32_t xfi = Xf[j];
@@ -821,7 +821,7 @@ void mdf_smooth(
#if (TM_UNROLL && TM_UNROLL_SPEEXECHOCANCELLATION)
#pragma TCS_unrollexact=0
#pragma TCS_unroll=0
-#endif
+#endif
pf = power[framesize];
xff = Xf[framesize];
@@ -830,11 +830,11 @@ void mdf_smooth(
void mdf_compute_filtered_spectra_crosscorrelations(
SpeexEchoState * restrict st,
- spx_word32_t Syy,
+ spx_word32_t Syy,
spx_word32_t See,
int framesize
)
-{
+{
register spx_float_t Pey = FLOAT_ONE;
register spx_float_t Pyy = FLOAT_ONE;
register spx_word16_t spec_average = st->spec_average;
@@ -863,7 +863,7 @@ void mdf_compute_filtered_spectra_crosscorrelations(
#if (TM_UNROLL && TM_UNROLL_SPEEXECHOCANCELLATION)
#pragma TCS_unroll=4
#pragma TCS_unrollexact=1
-#endif
+#endif
for (j=framesize; j>0 ; --j)
{
_Ehj = pEh[j];
@@ -883,7 +883,7 @@ void mdf_compute_filtered_spectra_crosscorrelations(
#if (TM_UNROLL && TM_UNROLL_SPEEXECHOCANCELLATION)
#pragma TCS_unrollexact=0
#pragma TCS_unroll=0
-#endif
+#endif
_Ehj = pEh[0];
_Rfj = pRf[0];
_Yfj = pYf[0];
@@ -906,21 +906,21 @@ void mdf_compute_filtered_spectra_crosscorrelations(
tmp32 = VMUX(tmp32 > tmpx, tmpx, tmp32);
alpha = FLOAT_DIV32(tmp32, See);
alpha_1 = FLOAT_SUB(FLOAT_ONE, alpha);
-
+
sPey = FLOAT_ADD(FLOAT_MULT(alpha_1,sPey) , FLOAT_MULT(alpha,Pey));
- sPyy = FLOAT_ADD(FLOAT_MULT(alpha_1,sPyy) , FLOAT_MULT(alpha,Pyy));
+ sPyy = FLOAT_ADD(FLOAT_MULT(alpha_1,sPyy) , FLOAT_MULT(alpha,Pyy));
tmp = FLOAT_MULT(MIN_LEAK,sPyy);
#ifndef FIXED_POINT
sPyy = VMUX(FLOAT_LT(sPyy, FLOAT_ONE), FLOAT_ONE, sPyy);
sPey = VMUX(FLOAT_LT(sPey, tmp), tmp, sPey);
- sPey = VMUX(FLOAT_LT(sPey, sPyy), sPey, sPyy);
+ sPey = VMUX(FLOAT_LT(sPey, sPyy), sPey, sPyy);
#else
sPyy = FLOAT_LT(sPyy, FLOAT_ONE) ? FLOAT_ONE : sPyy;
sPey = FLOAT_LT(sPey, tmp) ? tmp : sPey;
- sPey = FLOAT_LT(sPey, sPyy) ? sPey : sPyy;
+ sPey = FLOAT_LT(sPey, sPyy) ? sPey : sPyy;
#endif
-
+
leak_estimate = FLOAT_EXTRACT16(FLOAT_SHL(FLOAT_DIVU(sPey, sPyy),14));
leak_estimate = VMUX( leak_estimate > 16383, 32767, SHL16(leak_estimate,1));
@@ -943,10 +943,10 @@ inline spx_word16_t mdf_compute_RER(
register spx_word32_t tmp32;
register spx_word32_t tmp;
spx_float_t bound = PSEUDOFLOAT(Sey);
-
+
tmp32 = MULT16_32_Q15(leake,Syy);
tmp32 = ADD32(SHR32(Sxx,13), ADD32(tmp32, SHL32(tmp32,1)));
-
+
bound = FLOAT_DIVU(FLOAT_MULT(bound, bound), PSEUDOFLOAT(ADD32(1,Syy)));
tmp = FLOAT_EXTRACT32(bound);
tmp32 = imux( FLOAT_GT(bound, PSEUDOFLOAT(See)), See,
@@ -972,7 +972,7 @@ void mdf_adapt(
SpeexEchoState * restrict st,
spx_word16_t RER,
spx_word32_t Syy,
- spx_word32_t See,
+ spx_word32_t See,
spx_word32_t Sxx
)
{
@@ -985,20 +985,20 @@ void mdf_adapt(
register int i;
register int M = st->M;
- adapted = mux( !adapted && sum_adapt > QCONST32(M,15) &&
+ adapted = mux( !adapted && sum_adapt > QCONST32(M,15) &&
MULT16_32_Q15(leake,Syy) > MULT16_32_Q15(QCONST16(.03f,15),Syy), 1, adapted);
if ( adapted )
- { register spx_word32_t * restrict Yf = st->Yf;
+ { register spx_word32_t * restrict Yf = st->Yf;
register spx_word32_t * restrict Rf = st->Rf;
register spx_word32_t r, e, e2;
#if (TM_UNROLL && TM_UNROLL_SPEEXECHOCANCELLATION)
#pragma TCS_unroll=4
#pragma TCS_unrollexact=1
-#endif
+#endif
for ( i=0 ; i<framesize ; ++i )
- {
+ {
r = SHL32(Yf[i],3);
r = MULT16_32_Q15(leake,r);
e = SHL32(Rf[i],3)+1;
@@ -1011,7 +1011,7 @@ void mdf_adapt(
r = fmux( r > e2, e2, r);
#endif
- r = MULT16_32_Q15(QCONST16(.7,15),r) +
+ r = MULT16_32_Q15(QCONST16(.7,15),r) +
MULT16_32_Q15(QCONST16(.3,15),(spx_word32_t)(MULT16_32_Q15(RER,e)));
power_1[i] = FLOAT_SHL(FLOAT_DIV32_FLOAT(r,FLOAT_MUL32U(e,power[i]+10)),WEIGHT_SHIFT+16);
@@ -1019,8 +1019,8 @@ void mdf_adapt(
#if (TM_UNROLL && TM_UNROLL_SPEEXECHOCANCELLATION)
#pragma TCS_unrollexact=0
#pragma TCS_unroll=0
-#endif
-
+#endif
+
r = SHL32(Yf[framesize],3);
r = MULT16_32_Q15(leake,r);
e = SHL32(Rf[framesize],3)+1;
@@ -1033,19 +1033,19 @@ void mdf_adapt(
r = fmux( r > e2, e2, r);
#endif
- r = MULT16_32_Q15(QCONST16(.7,15),r) +
+ r = MULT16_32_Q15(QCONST16(.7,15),r) +
MULT16_32_Q15(QCONST16(.3,15),(spx_word32_t)(MULT16_32_Q15(RER,e)));
power_1[framesize] = FLOAT_SHL(FLOAT_DIV32_FLOAT(r,FLOAT_MUL32U(e,power[framesize]+10)),WEIGHT_SHIFT+16);
- } else
+ } else
{
register spx_word16_t adapt_rate=0;
register int N = st->window_size;
- if ( Sxx > SHR32(MULT16_16(N, 1000),6) )
+ if ( Sxx > SHR32(MULT16_16(N, 1000),6) )
{ register spx_word32_t tmp32, tmp32q;
-
+
tmp32 = MULT16_32_Q15(QCONST16(.25f, 15), Sxx);
#ifdef FIXED_POINT
tmp32q = SHR32(See,2);
@@ -1056,33 +1056,33 @@ void mdf_adapt(
#endif
adapt_rate = FLOAT_EXTRACT16(FLOAT_SHL(FLOAT_DIV32(tmp32, See),15));
}
-
+
#if (TM_UNROLL && TM_UNROLL_SPEEXECHOCANCELLATION)
#pragma TCS_unroll=4
#pragma TCS_unrollexact=1
-#endif
+#endif
for (i=0;i<framesize;i++)
power_1[i] = FLOAT_SHL(FLOAT_DIV32(EXTEND32(adapt_rate),ADD32(power[i],10)),WEIGHT_SHIFT+1);
#if (TM_UNROLL && TM_UNROLL_SPEEXECHOCANCELLATION)
#pragma TCS_unrollexact=0
#pragma TCS_unroll=0
-#endif
+#endif
power_1[framesize] = FLOAT_SHL(FLOAT_DIV32(EXTEND32(adapt_rate),ADD32(power[framesize],10)),WEIGHT_SHIFT+1);
sum_adapt = ADD32(sum_adapt,adapt_rate);
}
-
+
st->sum_adapt = sum_adapt;
st->adapted = adapted;
}
#define OVERRIDE_ECHO_CANCELLATION
void speex_echo_cancellation(
- SpeexEchoState * restrict st,
- const spx_int16_t * restrict in,
- const spx_int16_t * restrict far_end,
+ SpeexEchoState * restrict st,
+ const spx_int16_t * restrict in,
+ const spx_int16_t * restrict far_end,
spx_int16_t * restrict out
)
-{
+{
register int framesize = st->frame_size;
register spx_word16_t * restrict x = st->x;
register spx_word16_t * restrict xx = st->x + framesize;
@@ -1103,7 +1103,7 @@ void speex_echo_cancellation(
filter_dc_notch16(in, st->notch_radius, st->input, framesize, st->notch_mem);
mdf_preemph(st, xx, far_end, framesize);
-
+
{
register spx_word16_t * restrict X = st->X;
@@ -1119,19 +1119,19 @@ void speex_echo_cancellation(
memcpy(st->last_y, st->x, N * sizeof(spx_word16_t));
Sxx = mdf_inner_prod(xx, xx, framesize);
memcpy(x, xx, framesize * sizeof(spx_word16_t));
-
+
#ifdef TWO_PATH
- spectral_mul_accum(st->X, st->foreground, st->Y, N, M);
+ spectral_mul_accum(st->X, st->foreground, st->Y, N, M);
spx_ifft(st->fft_table, st->Y, st->e);
mdf_sub(xx, st->input, ee, framesize);
Sff = mdf_inner_prod(xx, xx, framesize);
#endif
-
+
mdf_adjust_prop (st->W, N, M, st->prop);
-
+
if (st->saturated == 0)
{ mdf_compute_weight_gradient(st, X, N, M);
- } else
+ } else
{ st->saturated--;
}
}
@@ -1141,7 +1141,7 @@ void speex_echo_cancellation(
spx_ifft(st->fft_table, st->Y, st->y);
#ifdef TWO_PATH
- mdf_sub(xx, ee, yy, framesize);
+ mdf_sub(xx, ee, yy, framesize);
Dbf = 10+mdf_inner_prod(xx, xx, framesize);
#endif
@@ -1154,12 +1154,12 @@ void speex_echo_cancellation(
See = mdf_update_foreground(st,Dbf,Sff,See);
#endif
-
+
mdf_compute_error_signal(st, in, out, framesize);
Sey = mdf_inner_prod(ee, yy, framesize);
Syy = mdf_inner_prod(yy, yy, framesize);
Sdd = mdf_inner_prod(st->input, st->input, framesize);
-
+
if ( mdf_check(st,out,Syy,Sxx,See,Sff,Sdd) >= 50 )
{ speex_warning("The echo canceller started acting funny and got slapped (reset). It swears it will behave now.");
speex_echo_state_reset(st);
@@ -1178,10 +1178,10 @@ void speex_echo_cancellation(
mdf_compute_filtered_spectra_crosscorrelations(st,Syy,See,framesize);
RER = mdf_compute_RER(See,Syy,Sey,Sxx,st->leak_estimate);
mdf_adapt(st, RER, Syy, See, Sxx);
-
+
if ( st->adapted )
{ register spx_word16_t * restrict last_yy = st->last_y + framesize;
-
+
memcpy(st->last_y, last_yy, framesize * sizeof(spx_word16_t));
mdf_sub_int(last_yy, in, out, framesize);
diff --git a/tmv/misc_tm.h b/tmv/misc_tm.h
index 4d6cea7..2954234 100644
--- a/tmv/misc_tm.h
+++ b/tmv/misc_tm.h
@@ -8,18 +8,18 @@
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
-
+
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
-
+
- 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.
-
+
- Neither the name of the Xiph.org Foundation nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
-
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
diff --git a/tmv/preprocess_tm.h b/tmv/preprocess_tm.h
index f903b73..9e4a067 100644
--- a/tmv/preprocess_tm.h
+++ b/tmv/preprocess_tm.h
@@ -8,18 +8,18 @@
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
-
+
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
-
+
- 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.
-
+
- Neither the name of the Xiph.org Foundation nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
-
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -62,7 +62,7 @@ static void preprocess_analysis(SpeexPreprocessState * restrict st, spx_int16_t
N3 >>= 1;
framesize >>= 1;
max_val = 0;
-
+
for ( i=0,j=0 ; i<N3 ; i+=2,j+=8 )
{ register int r1, r2;
@@ -82,7 +82,7 @@ static void preprocess_analysis(SpeexPreprocessState * restrict st, spx_int16_t
st32d(j, ptr, r1);
st32d(j+4,ptr, r2);
}
-
+
for ( i=0,j=0,ptr=(int*)(x+N4) ; i<N3 ; i+=2,j+=8 )
{ register int r1, r2;
@@ -115,7 +115,7 @@ static void preprocess_analysis(SpeexPreprocessState * restrict st, spx_int16_t
#pragma TCS_unrollexact=0
#pragma TCS_unroll=0
#endif
-
+
max_val = 14 - spx_ilog2(max_val);
st->frame_shift = max_val;
@@ -139,15 +139,15 @@ static void preprocess_analysis(SpeexPreprocessState * restrict st, spx_int16_t
#endif
}
- spx_fft(st->fft_lookup, st->frame, st->ft);
+ spx_fft(st->fft_lookup, st->frame, st->ft);
power_spectrum(st->ft, ps, N << 1);
-
+
#if (TM_UNROLL && TM_UNROLL_PREPROCESSANALYSIS)
#pragma TCS_unroll=4
#pragma TCS_unrollexact=1
#endif
for ( i=0,ptr=(int*)st->ps,max_val<<=1,j=((1<<((max_val))>>1)) ;i<N ; ++i )
- {
+ {
ps[i] = (ps[i] + j) >> max_val;
}
#if (TM_UNROLL && TM_UNROLL_PREPROCESSANALYSIS)
@@ -171,7 +171,7 @@ static void update_noise_prob(SpeexPreprocessState * restrict st)
register int * restrict Smin = (int*)st->Smin;
register int * restrict Stmp = (int*)st->Stmp;
register int * restrict S = (int*)st->S;
-
+
UPDATENOISEPROB_START();
{
@@ -180,7 +180,7 @@ static void update_noise_prob(SpeexPreprocessState * restrict st)
register int q8, q05, q2, q1;
register int *ps = (int*)st->ps;
register int si_lsb, si_msb, sii_lsb, sii_msb;
-
+
q8 = QCONST16(.8f,15);
q05 = QCONST16(.05f,15);
q2 = QCONST16(.2f,15);
@@ -196,7 +196,7 @@ static void update_noise_prob(SpeexPreprocessState * restrict st)
ips_lsb &= 0x00007fff;
psi_lsb &= 0x00007fff;
si_lsb &= 0x00007fff;
-
+
S[0] = _MULT16_32_Q15(q8,si_msb,si_lsb) + _MULT16_32_Q15(q2,ips_msb,ips_lsb);
for ( i=1 ; i<N-1 ; i+=2 )
@@ -209,11 +209,11 @@ static void update_noise_prob(SpeexPreprocessState * restrict st)
si_lsb &= 0x00007fff;
psii_lsb &= 0x00007fff;
- S[i]= _MULT16_32_Q15(q8,si_msb,si_lsb) +
- _MULT16_32_Q15(q05,ips_msb,ips_lsb) +
- _MULT16_32_Q15(q1,psi_msb,psi_lsb) +
+ S[i]= _MULT16_32_Q15(q8,si_msb,si_lsb) +
+ _MULT16_32_Q15(q05,ips_msb,ips_lsb) +
+ _MULT16_32_Q15(q1,psi_msb,psi_lsb) +
_MULT16_32_Q15(q05,psii_msb,psii_lsb);
-
+
psiii_lsb = ps[i+2];
sii_lsb = S[i+1];
@@ -222,9 +222,9 @@ static void update_noise_prob(SpeexPreprocessState * restrict st)
sii_lsb &= 0x00007fff;
psiii_lsb&= 0x00007fff;
- S[i+1]= _MULT16_32_Q15(q8,sii_msb,sii_lsb) +
- _MULT16_32_Q15(q05,psi_msb,psi_lsb) +
- _MULT16_32_Q15(q1,psii_msb,psii_lsb) +
+ S[i+1]= _MULT16_32_Q15(q8,sii_msb,sii_lsb) +
+ _MULT16_32_Q15(q05,psi_msb,psi_lsb) +
+ _MULT16_32_Q15(q1,psii_msb,psii_lsb) +
_MULT16_32_Q15(q05,psiii_msb,psiii_lsb);
ips_lsb = psii_lsb;
@@ -232,12 +232,12 @@ static void update_noise_prob(SpeexPreprocessState * restrict st)
psi_lsb = psiii_lsb;
psi_msb = psiii_msb;
}
-
+
S[N-1] = MULT16_32_Q15(q8,S[N-1]) + MULT16_32_Q15(q2,ps[N-1]);
}
nb_adapt = st->nb_adapt;
-
+
if ( nb_adapt==1 )
{ for ( i=0 ; i<N ; ++i )
Smin[i] = Stmp[i] = 0;
@@ -261,7 +261,7 @@ static void update_noise_prob(SpeexPreprocessState * restrict st)
si = S[i];
stmpi = Stmp[i];
-
+
Smin[i] = imin(stmpi,si);
Stmp[i] = si;
}
@@ -269,7 +269,7 @@ static void update_noise_prob(SpeexPreprocessState * restrict st)
#pragma TCS_unrollexact=0
#pragma TCS_unroll=0
#endif
- } else
+ } else
{
#if (TM_UNROLL && TM_UNROLL_UPDATENOISEPROB)
@@ -284,7 +284,7 @@ static void update_noise_prob(SpeexPreprocessState * restrict st)
smini = Smin[i];
Smin[i] = imin(smini,si);
- Stmp[i] = imin(stmpi,si);
+ Stmp[i] = imin(stmpi,si);
}
#if (TM_UNROLL && TM_UNROLL_UPDATENOISEPROB)
#pragma TCS_unrollexact=0
@@ -388,7 +388,7 @@ static void preprocess_analysis(SpeexPreprocessState * restrict st, spx_int16_t
#pragma TCS_unroll=0
#endif
- spx_fft(st->fft_lookup, frame, st->ft);
+ spx_fft(st->fft_lookup, frame, st->ft);
power_spectrum(st->ft, ps, N << 1);
filterbank_compute_bank32(st->bank, ps, ps+N);
@@ -399,7 +399,7 @@ static void preprocess_analysis(SpeexPreprocessState * restrict st, spx_int16_t
#define OVERRIDE_UPDATE_NOISE_PROB
static void update_noise_prob(SpeexPreprocessState * restrict st)
{
-
+
register float * restrict S = st->S;
register float * restrict ps = st->ps;
register int N = st->ps_size;
@@ -426,7 +426,7 @@ static void update_noise_prob(SpeexPreprocessState * restrict st)
psii = ps[i+1];
psiii = ps[i+2];
S[i] = .8f * S[i] + .05f * ips + .1f * psi + .05f * psii;
- S[i+1] = .8f * S[i+1] + .05f * psi + .1f * psii + .05f * psiii;
+ S[i+1] = .8f * S[i+1] + .05f * psi + .1f * psii + .05f * psiii;
ips = psii;
psi = psiii;
}
@@ -435,9 +435,9 @@ static void update_noise_prob(SpeexPreprocessState * restrict st)
}
nb_adapt = st->nb_adapt;
-
+
if ( nb_adapt==1 )
- {
+ {
for (i=0;i<N;i++)
Smin[i] = st->Stmp[i] = 0;
}
@@ -446,7 +446,7 @@ static void update_noise_prob(SpeexPreprocessState * restrict st)
mux(nb_adapt < 1000, 50,
mux(nb_adapt < 10000, 150, 300)));
-
+
if ( st->min_count > min_range )
{
st->min_count = 0;
@@ -469,7 +469,7 @@ static void update_noise_prob(SpeexPreprocessState * restrict st)
#pragma TCS_unroll=0
#endif
- } else
+ } else
{
register float * restrict Smin = st->Smin;
@@ -484,9 +484,9 @@ static void update_noise_prob(SpeexPreprocessState * restrict st)
stmpi = Stmp[i];
si = S[i];
smini = Smin[i];
-
+
Smin[i] = fmin(smini,si);
- Stmp[i] = fmin(stmpi,si);
+ Stmp[i] = fmin(stmpi,si);
}
#if (TM_UNROLL && TM_UNROLL_UPDATENOISEPROB)
#pragma TCS_unrollexact=0
@@ -508,7 +508,7 @@ static void update_noise_prob(SpeexPreprocessState * restrict st)
si = S[i];
smini = Smin[i];
update_prob[i] = mux( (.4 * si) > (smini + 20.f), 1, 0);
-
+
}
#if (TM_UNROLL && TM_UNROLL_UPDATENOISEPROB)
#pragma TCS_unrollexact=0
@@ -522,11 +522,11 @@ static void update_noise_prob(SpeexPreprocessState * restrict st)
#define OVERRIDE_COMPUTE_GAIN_FLOOR
static void compute_gain_floor(
- int noise_suppress,
- int effective_echo_suppress,
- float * restrict noise,
- float * restrict echo,
- float * gain_floor,
+ int noise_suppress,
+ int effective_echo_suppress,
+ float * restrict noise,
+ float * restrict echo,
+ float * gain_floor,
int len
)
{
@@ -592,7 +592,7 @@ void preprocess_residue_echo(
#ifndef FIXED_POINT
r = r_echo[0];
if (!(r >=0 && r < N*1e9f) )
- {
+ {
memset(r_echo, 0, N * sizeof(spx_word32_t));
}
#endif
@@ -610,8 +610,8 @@ void preprocess_residue_echo(
#pragma TCS_unroll=0
#endif
filterbank_compute_bank32(st->bank, e_noise, e_noise+N);
-
- } else
+
+ } else
{ memset(st->echo_noise, 0, (NM) * sizeof(spx_word32_t));
}
}
@@ -639,7 +639,7 @@ void preprocess_update_noise(
register spx_word32_t psi = ps[i];
if ( !up[i] || psi < PSHR32(ni, NOISE_SHIFT) )
- { noise[i] = MAX32(EXTEND32(0),MULT16_32_Q15(beta_1,ni) +
+ { noise[i] = MAX32(EXTEND32(0),MULT16_32_Q15(beta_1,ni) +
MULT16_32_Q15(beta,SHL32(psi,NOISE_SHIFT)));
}
}
@@ -677,7 +677,7 @@ void preprocess_compute_SNR(
register spx_word16_t priori;
tot_noise = ADD32(ADD32(ADD32(EXTEND32(1), PSHR32(noise[i],NOISE_SHIFT)), echo[i]) , reverb[i]);
-
+
posti = SUB16(DIV32_16_Q8(ps[i],tot_noise), QCONST16(1.f,SNR_SHIFT));
posti = MIN16(posti, QCONST16(100.f,SNR_SHIFT));
post[i] = posti;
@@ -685,7 +685,7 @@ void preprocess_compute_SNR(
opsi = old_ps[i];
gamma = QCONST16(.1f,15)+MULT16_16_Q15(QCONST16(.89f,15),SQR16_Q15(DIV32_16_Q15(opsi,ADD32(opsi,tot_noise))));
-
+
priori = EXTRACT16(PSHR32(ADD32(MULT16_16(gamma,MAX16(0,posti)), MULT16_16(Q15_ONE-gamma,DIV32_16_Q8(opsi,tot_noise))), 15));
prior[i]=MIN16(priori, QCONST16(100.f,SNR_SHIFT));
}
@@ -711,7 +711,7 @@ spx_word32_t preprocess_smooth_SNR(
iprior = prior[0];
priori = prior[1];
zeta[0] = PSHR32(ADD32(MULT16_16(QCONST16(.7f,15),zeta[0]), MULT16_16(QCONST16(.3f,15),iprior)),15);
-
+
#if (TM_UNROLL && TM_UNROLL_SPEEXPREPROCESSRUN)
#pragma TCS_unroll=2
#pragma TCS_unrollexact=1
@@ -733,13 +733,13 @@ spx_word32_t preprocess_smooth_SNR(
for (i=_N; i<NM ; i++)
{ register spx_word16_t zetai = zeta[i];
-
+
priori = prior[i];
zeta[i] = PSHR32(ADD32(MULT16_16(QCONST16(.7f,15),zetai), MULT16_16(QCONST16(.3f,15),priori)),15);
}
Zframe = 0;
-
+
#if (TM_UNROLL && TM_UNROLL_SPEEXPREPROCESSRUN)
#pragma TCS_unroll=4
#pragma TCS_unrollexact=1
@@ -770,7 +770,7 @@ void preprocess_compute_emgain(
register spx_word16_t * restrict gain2 = st->gain2;
register int i;
register int N=st->ps_size;
-
+
for ( i=N ; i<NM ; ++i )
{
register spx_word32_t theta;
@@ -783,7 +783,7 @@ void preprocess_compute_emgain(
register spx_word16_t tmp;
#endif
register spx_word16_t priori = prior[i];
-
+
prior_ratio = PDIV32_16(SHL32(EXTEND32(priori), 15), ADD16(priori, SHL32(1,SNR_SHIFT)));
theta = MULT16_32_P15(prior_ratio, QCONST32(1.f,EXPIN_SHIFT)+SHL32(EXTEND32(post[i]),EXPIN_SHIFT-SNR_SHIFT));
@@ -811,7 +811,7 @@ void preprocess_compute_emgain(
void preprocess_compute_linear_gain(
SpeexPreprocessState * restrict st,
- spx_word32_t * restrict ps,
+ spx_word32_t * restrict ps,
int N
)
{
@@ -828,7 +828,7 @@ void preprocess_compute_linear_gain(
#if (TM_UNROLL && TM_UNROLL_SPEEXPREPROCESSRUN)
#pragma TCS_unroll=4
#pragma TCS_unrollexact=1
-#endif
+#endif
for (i=0;i<N;i++)
{
register spx_word32_t MM;
@@ -845,16 +845,16 @@ void preprocess_compute_linear_gain(
g = EXTRACT16(MIN32(Q15_ONE, MULT16_32_Q15(prior_ratio, MM)));
p = gain2[i];
-
+
g = VMUX( MULT16_16_Q15(QCONST16(.333f,15),g) > gain[i], MULT16_16(3,gain[i]), g);
- old_ps[i]= MULT16_32_P15(QCONST16(.2f,15),old_ps[i]) +
+ old_ps[i]= MULT16_32_P15(QCONST16(.2f,15),old_ps[i]) +
MULT16_32_P15(MULT16_16_P15(QCONST16(.8f,15),SQR16_Q15(g)),ps[i]);
-
+
g = VMUX( g < gfi, gfi, g );
gain[i] = g;
- tmp = MULT16_16_P15(p,spx_sqrt(SHL32(EXTEND32(g),15))) +
+ tmp = MULT16_16_P15(p,spx_sqrt(SHL32(EXTEND32(g),15))) +
MULT16_16_P15(SUB16(Q15_ONE,p),spx_sqrt(SHL32(EXTEND32(gfi),15)));
gain2[i]=SQR16_Q15(tmp);
@@ -888,11 +888,11 @@ void preprocess_compute_bark_gain(
register spx_word16_t gaini;
register spx_word16_t gfi = gain_floor[i];
- gaini = MAX16(gain[i], gfi);
+ gaini = MAX16(gain[i], gfi);
gain[i] = gaini;
- tmp = MULT16_16_P15(p,spx_sqrt(SHL32(EXTEND32(gaini),15))) +
+ tmp = MULT16_16_P15(p,spx_sqrt(SHL32(EXTEND32(gaini),15))) +
MULT16_16_P15(SUB16(Q15_ONE,p),spx_sqrt(SHL32(EXTEND32(gfi),15)));
gain2[i]=SQR16_Q15(tmp);
@@ -940,10 +940,10 @@ void preprocess_scale(
#if (TM_UNROLL && TM_UNROLL_SPEEXPREPROCESSRUN)
#pragma TCS_unroll=4
#pragma TCS_unrollexact=1
-#endif
+#endif
for ( i=0 ; i<N2 ;i++)
{ register spx_word16_t framei = frame[i];
-
+
frame[i] = PSHR16(framei,shift);
}
#if (TM_UNROLL && TM_UNROLL_SPEEXPREPROCESSRUN)
@@ -956,9 +956,9 @@ void preprocess_scale(
void preprocess_apply_agc(
SpeexPreprocessState * restrict st,
- int N
+ int N
)
-{
+{
register spx_word16_t max_sample=0;
register spx_word16_t * restrict frame = st->frame;
register int i;
@@ -967,7 +967,7 @@ void preprocess_apply_agc(
#if (TM_UNROLL && TM_UNROLL_SPEEXPREPROCESSRUN)
#pragma TCS_unroll=4
#pragma TCS_unrollexact=1
-#endif
+#endif
for (i=0;i<N2;i++)
{ register spx_word16_t framei = VABS(frame[i]);
@@ -976,7 +976,7 @@ void preprocess_apply_agc(
#if (TM_UNROLL && TM_UNROLL_SPEEXPREPROCESSRUN)
#pragma TCS_unrollexact=0
#pragma TCS_unroll=0
-#endif
+#endif
if ( max_sample > 28000.f )
{
@@ -985,14 +985,14 @@ void preprocess_apply_agc(
#if (TM_UNROLL && TM_UNROLL_SPEEXPREPROCESSRUN)
#pragma TCS_unroll=4
#pragma TCS_unrollexact=1
-#endif
+#endif
for ( i=0 ; i< N2 ; i++ )
{ frame[i] *= damp;
}
#if (TM_UNROLL && TM_UNROLL_SPEEXPREPROCESSRUN)
#pragma TCS_unrollexact=0
#pragma TCS_unroll=0
-#endif
+#endif
}
}
#endif
@@ -1001,7 +1001,7 @@ void preprocess_apply_agc(
void preprocess_update(
SpeexPreprocessState * restrict st,
spx_int16_t * restrict x,
- int N
+ int N
)
{
register spx_word16_t * restrict frame = st->frame;
@@ -1016,7 +1016,7 @@ void preprocess_update(
#if (TM_UNROLL && TM_UNROLL_SPEEXPREPROCESSRUN)
#pragma TCS_unroll=4
#pragma TCS_unrollexact=1
-#endif
+#endif
for ( i=0 ; i<N2 ; i++)
{ register spx_word16_t fi = frame[i];
register spx_word16_t wi = window[i];
@@ -1029,12 +1029,12 @@ void preprocess_update(
#if (TM_UNROLL && TM_UNROLL_SPEEXPREPROCESSRUN)
#pragma TCS_unrollexact=0
#pragma TCS_unroll=0
-#endif
+#endif
for ( i=0;i<N4;i++)
{ x[N3+i] = frame[N3+i];
}
-
+
memcpy(outbuf, frame+framesize, (N3) * sizeof(spx_word16_t));
}
@@ -1063,22 +1063,22 @@ int speex_preprocess_run(SpeexPreprocessState * restrict st, spx_int16_t * restr
preprocess_compute_SNR(st, ps, NM);
Zframe = preprocess_smooth_SNR(st, N, NM);
-
+
{
register spx_word16_t effective_echo_suppress;
-
+
Pframe = QCONST16(.1f,15)+MULT16_16_Q15(QCONST16(.899f,15),qcurve(DIV32_16(Zframe,M)));
- effective_echo_suppress = EXTRACT16(PSHR32(ADD32(MULT16_16(SUB16(Q15_ONE,Pframe), st->echo_suppress),
+ effective_echo_suppress = EXTRACT16(PSHR32(ADD32(MULT16_16(SUB16(Q15_ONE,Pframe), st->echo_suppress),
MULT16_16(Pframe, st->echo_suppress_active)),15));
compute_gain_floor(st->noise_suppress, effective_echo_suppress, st->noise+N, st->echo_noise+N, st->gain_floor+N, M);
-
+
}
preprocess_compute_emgain(st, ps, Pframe, NM);
preprocess_compute_linear_gain(st, ps, N);
-
+
if (!st->denoise_enabled)
{
register spx_word16_t * restrict gain2 = st->gain2;
@@ -1086,7 +1086,7 @@ int speex_preprocess_run(SpeexPreprocessState * restrict st, spx_int16_t * restr
#if (TM_UNROLL && TM_UNROLL_SPEEXPREPROCESSRUN)
#pragma TCS_unroll=4
#pragma TCS_unrollexact=1
-#endif
+#endif
for ( i=0 ; i<NM ; i++ )
{ gain2[i] = Q15_ONE;
}
@@ -1095,7 +1095,7 @@ int speex_preprocess_run(SpeexPreprocessState * restrict st, spx_int16_t * restr
#pragma TCS_unroll=0
#endif
}
-
+
preprocess_apply_gain(st, N);
#ifndef FIXED_POINT
@@ -1124,12 +1124,12 @@ int speex_preprocess_run(SpeexPreprocessState * restrict st, spx_int16_t * restr
if (Pframe > st->speech_prob_start || (st->was_speech && Pframe > st->speech_prob_continue))
{ st->was_speech=1;
return 1;
-
+
} else
{ st->was_speech=0;
return 0;
}
- } else
+ } else
{ return 1;
}
}
diff --git a/tmv/profile_tm.h b/tmv/profile_tm.h
index 8588e26..e6fe111 100644
--- a/tmv/profile_tm.h
+++ b/tmv/profile_tm.h
@@ -8,18 +8,18 @@
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
-
+
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
-
+
- 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.
-
+
- Neither the name of the Xiph.org Foundation nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
-
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -178,7 +178,7 @@ extern int __profile_end;
#define COMPUTERMS16_START()
#define COMPUTERMS16_STOP()
#endif
-
+
#if TM_PROFILE_NORMALIZE16
#define NORMALIZE16_START() PROFILE_START()
#define NORMALIZE16_STOP() PROFILE_STOP()