Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Opus
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Xiph.Org
Opus
Commits
6d88dfe3
Commit
6d88dfe3
authored
6 years ago
by
Jean-Marc Valin
Browse files
Options
Downloads
Patches
Plain Diff
misc improvements
parent
a1ab7c5f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
dnn/dump_data.c
+18
-10
18 additions, 10 deletions
dnn/dump_data.c
with
18 additions
and
10 deletions
dnn/dump_data.c
+
18
−
10
View file @
6d88dfe3
...
...
@@ -177,15 +177,16 @@ static void compute_frame_features(DenoiseState *st, kiss_fft_cpx *X, kiss_fft_c
#if 1
int
sub
;
static
int
pcount
=
0
;
static
float
xc
[
8
][
PITCH_MAX_PERIOD
];
static
float
ener
[
8
][
PITCH_MAX_PERIOD
];
static
float
xc
[
10
][
PITCH_MAX_PERIOD
];
static
float
ener
[
10
][
PITCH_MAX_PERIOD
];
static
float
frame_max_corr
[
PITCH_MAX_PERIOD
];
for
(
sub
=
0
;
sub
<
2
;
sub
++
)
{
int
off
=
sub
*
FRAME_SIZE
/
2
;
celt_pitch_xcorr
(
&
st
->
exc_buf
[
PITCH_MAX_PERIOD
+
off
],
st
->
exc_buf
+
off
,
xcorr
,
FRAME_SIZE
/
2
,
PITCH_MAX_PERIOD
);
ener0
=
celt_inner_prod
(
&
st
->
exc_buf
[
PITCH_MAX_PERIOD
+
off
],
&
st
->
exc_buf
[
PITCH_MAX_PERIOD
+
off
],
FRAME_SIZE
/
2
);
for
(
i
=
0
;
i
<
PITCH_MAX_PERIOD
;
i
++
)
{
ener
[
2
*
pcount
+
sub
][
i
]
=
(
1
+
ener0
+
celt_inner_prod
(
&
st
->
exc_buf
[
i
+
off
],
&
st
->
exc_buf
[
i
+
off
],
FRAME_SIZE
/
2
));
xc
[
2
*
pcount
+
sub
][
i
]
=
2
*
xcorr
[
i
]
/
ener
[
2
*
pcount
+
sub
][
i
];
ener
[
2
+
2
*
pcount
+
sub
][
i
]
=
(
1
+
ener0
+
celt_inner_prod
(
&
st
->
exc_buf
[
i
+
off
],
&
st
->
exc_buf
[
i
+
off
],
FRAME_SIZE
/
2
));
xc
[
2
+
2
*
pcount
+
sub
][
i
]
=
2
*
xcorr
[
i
]
/
ener
[
2
+
2
*
pcount
+
sub
][
i
];
}
#if 0
for (i=0;i<PITCH_MAX_PERIOD;i++)
...
...
@@ -208,7 +209,7 @@ static void compute_frame_features(DenoiseState *st, kiss_fft_cpx *X, kiss_fft_c
period
=
PITCH_MAX_PERIOD
-
i
;
float
num
=
0
;
float
den
=
0
;
for
(
sub
=
0
;
sub
<
8
;
sub
++
)
{
for
(
sub
=
0
;
sub
<
10
;
sub
++
)
{
float
max_xc
=-
1000
,
max_ener
=
0
;
for
(
j
=
0
;
j
<
period
/
5
;
j
++
)
{
if
(
xc
[
sub
][
i
+
j
]
>
max_xc
)
{
...
...
@@ -220,18 +221,20 @@ static void compute_frame_features(DenoiseState *st, kiss_fft_cpx *X, kiss_fft_c
den
+=
max_ener
;
}
corr
=
num
/
den
;
corr
=
MAX16
(
corr
,
frame_max_corr
[
i
]
-
.
1
);
frame_max_corr
[
i
]
=
corr
;
if
(
corr
>
best_corr
)
{
if
(
period
<
best_period
*
5
/
4
||
(
corr
>
1
.
2
*
best_corr
&&
best_corr
<
.
6
))
{
if
(
period
<
best_period
*
5
/
4
||
(
corr
>
1
.
2
*
best_corr
&&
best_corr
<
.
5
))
{
best_corr
=
corr
;
best_period
=
period
;
}
}
//printf("%f ", corr);
}
int
best
[
8
];
int
best
[
10
];
i
=
PITCH_MAX_PERIOD
-
best_period
;
period
=
best_period
;
for
(
sub
=
0
;
sub
<
8
;
sub
++
)
{
for
(
sub
=
0
;
sub
<
10
;
sub
++
)
{
int
j
;
int
sub_period
=
PITCH_MIN_PERIOD
;
float
max_xc
=-
1000
,
max_ener
=
0
;
...
...
@@ -242,7 +245,8 @@ static void compute_frame_features(DenoiseState *st, kiss_fft_cpx *X, kiss_fft_c
sub_period
=
period
-
j
;
}
}
w
=
MAX16
(
1e-2
,
max_xc
-
.
2
)
*
max_ener
;
w
=
MAX16
(
1e-1
,
MIN16
(
1
,
5
*
(
max_xc
-
.
2
)))
*
max_ener
;
w
=
MAX16
(.
1
,
MIN16
(
1
,
5
*
(
max_xc
-
.
2
)));
sw
+=
w
;
sx
+=
w
*
sub
;
sxx
+=
w
*
sub
*
sub
;
...
...
@@ -252,8 +256,12 @@ static void compute_frame_features(DenoiseState *st, kiss_fft_cpx *X, kiss_fft_c
}
best_a
=
(
sw
*
sxy
-
sx
*
sy
)
/
(
sw
*
sxx
-
sx
*
sx
);
best_b
=
(
sxx
*
sy
-
sx
*
sxy
)
/
(
sw
*
sxx
-
sx
*
sx
);
for
(
sub
=
0
;
sub
<
8
;
sub
++
)
printf
(
"%f %d %f
\n
"
,
best_b
+
sub
*
best_a
,
best
[
sub
],
best_corr
);
for
(
sub
=
2
;
sub
<
10
;
sub
++
)
printf
(
"%f %d %f
\n
"
,
best_b
+
sub
*
best_a
,
best
[
sub
],
best_corr
);
//printf("%d %f %f %f\n", best_period, best_a, best_b, best_corr);
RNN_COPY
(
&
xc
[
0
][
0
],
&
xc
[
8
][
0
],
PITCH_MAX_PERIOD
);
RNN_COPY
(
&
xc
[
1
][
0
],
&
xc
[
9
][
0
],
PITCH_MAX_PERIOD
);
RNN_COPY
(
&
ener
[
0
][
0
],
&
ener
[
8
][
0
],
PITCH_MAX_PERIOD
);
RNN_COPY
(
&
ener
[
1
][
0
],
&
ener
[
9
][
0
],
PITCH_MAX_PERIOD
);
pcount
=
0
;
}
#endif
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment