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

gitlab.xiph.org/xiph/opus.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'dnn/nndsp.c')
-rw-r--r--dnn/nndsp.c30
1 files changed, 10 insertions, 20 deletions
diff --git a/dnn/nndsp.c b/dnn/nndsp.c
index 4fbe5346..6d987872 100644
--- a/dnn/nndsp.c
+++ b/dnn/nndsp.c
@@ -39,7 +39,7 @@
#include <math.h>
#ifndef M_PI
-#define M_PI 3.141592653
+#define M_PI 3.141592653589793f
#endif
#define SET_ZERO(x) memset(x, 0, sizeof(x))
@@ -60,6 +60,15 @@ void init_adashape_state(AdaShapeState *hAdaShape)
OPUS_CLEAR(hAdaShape, 1);
}
+void compute_overlap_window(float *window, int overlap_size)
+{
+ int i_sample;
+ for (i_sample=0; i_sample < overlap_size; i_sample++)
+ {
+ window[i_sample] = 0.5f + 0.5f * cos(M_PI * (i_sample + 0.5f) / overlap_size);
+ }
+}
+
#ifdef DEBUG_NNDSP
void print_float_vector(const char* name, const float *vec, int length)
{
@@ -169,15 +178,6 @@ void adaconv_process_frame(
print_float_vector("x_in", x_in, in_channels * frame_size);
#endif
- if (window == NULL)
- {
- for (i_sample=0; i_sample < overlap_size; i_sample++)
- {
- window_buffer[i_sample] = 0.5f + 0.5f * cos(M_PI * (i_sample + 0.5f) / overlap_size);
- }
- window = &window_buffer[0];
- }
-
/* prepare input */
for (i_in_channels=0; i_in_channels < in_channels; i_in_channels ++)
{
@@ -280,16 +280,6 @@ void adacomb_process_frame(
SET_ZERO(kernel_buffer);
SET_ZERO(input_buffer);
-
- if (window == NULL)
- {
- for (i_sample=0; i_sample < overlap_size; i_sample++)
- {
- window_buffer[i_sample] = 0.5f + 0.5f * cos(M_PI * (i_sample + 0.5f) / overlap_size);
- }
- window = &window_buffer[0];
- }
-
OPUS_COPY(input_buffer, hAdaComb->history, kernel_size + ADACOMB_MAX_LAG);
OPUS_COPY(input_buffer + kernel_size + ADACOMB_MAX_LAG, x_in, frame_size);
p_input = input_buffer + kernel_size + ADACOMB_MAX_LAG;