Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Casey Primozic
rnnoise
Commits
01774f8e
Unverified
Commit
01774f8e
authored
Jul 20, 2017
by
Jean-Marc Valin
Browse files
split analysis and synthesis
parent
0ef67d52
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/common.h
View file @
01774f8e
...
...
@@ -4,6 +4,7 @@
#define COMMON_H
#define RNN_INLINE inline
#define OPUS_INLINE inline
/** RNNoise wrapper for malloc(). To do your own dynamic allocation, all you need t
...
...
src/denoise.c
View file @
01774f8e
...
...
@@ -122,22 +122,33 @@ DenoiseState *rnnoise_create() {
return
st
;
}
void
process_frame
(
DenoiseState
*
st
,
float
*
out
,
const
float
*
in
)
{
static
void
frame_analysis
(
DenoiseState
*
st
,
kiss_fft_cpx
*
y
,
const
float
*
in
)
{
float
x
[
WINDOW_SIZE
];
int
i
;
kiss_fft_cpx
y
[
FREQ_SIZE
];
RNN_COPY
(
x
,
st
->
analysis_mem
,
FRAME_SIZE
);
for
(
i
=
0
;
i
<
FRAME_SIZE
;
i
++
)
x
[
FRAME_SIZE
+
i
]
=
in
[
i
];
RNN_COPY
(
st
->
analysis_mem
,
in
,
FRAME_SIZE
);
apply_window
(
x
);
forward_transform
(
y
,
x
);
/* Do the actual processing here. */
}
static
void
frame_synthesis
(
DenoiseState
*
st
,
float
*
out
,
const
kiss_fft_cpx
*
y
)
{
float
x
[
WINDOW_SIZE
];
int
i
;
inverse_transform
(
x
,
y
);
apply_window
(
x
);
for
(
i
=
0
;
i
<
FRAME_SIZE
;
i
++
)
out
[
i
]
=
x
[
i
]
+
st
->
synthesis_mem
[
i
];
RNN_COPY
(
st
->
synthesis_mem
,
&
x
[
FRAME_SIZE
],
FRAME_SIZE
);
}
static
void
rnnoise_process_frame
(
DenoiseState
*
st
,
float
*
out
,
const
float
*
in
)
{
kiss_fft_cpx
y
[
FREQ_SIZE
];
frame_analysis
(
st
,
y
,
in
);
/* Do processing here. */
frame_synthesis
(
st
,
out
,
y
);
}
int
main
()
{
int
i
;
float
x
[
FRAME_SIZE
];
...
...
@@ -154,10 +165,10 @@ int main() {
printf("%f %f\n", y[i].r, y[i].i);*/
/*for (i=0;i<NB_BANDS;i++)
printf("%f\n", bandE[i]);*/
process_frame
(
st
,
x
,
x
);
rnnoise_
process_frame
(
st
,
x
,
x
);
for
(
i
=
0
;
i
<
FRAME_SIZE
;
i
++
)
printf
(
"%f
\n
"
,
x
[
i
]);
process_frame
(
st
,
x
,
x
);
rnnoise_
process_frame
(
st
,
x
,
x
);
for
(
i
=
0
;
i
<
FRAME_SIZE
;
i
++
)
printf
(
"%f
\n
"
,
x
[
i
]);
return
0
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment