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
fb3112ad
Commit
fb3112ad
authored
6 years ago
by
Jean-Marc Valin
Browse files
Options
Downloads
Patches
Plain Diff
Removing most of the full-overlap assumptions from freq.[ch]
parent
e8c96212
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
dnn/freq.c
+8
-7
8 additions, 7 deletions
dnn/freq.c
dnn/freq.h
+3
-2
3 additions, 2 deletions
dnn/freq.h
with
11 additions
and
9 deletions
dnn/freq.c
+
8
−
7
View file @
fb3112ad
...
...
@@ -51,7 +51,7 @@ static const opus_int16 eband5ms[] = {
typedef
struct
{
int
init
;
kiss_fft_state
*
kfft
;
float
half_window
[
FRAME
_SIZE
];
float
half_window
[
OVERLAP
_SIZE
];
float
dct_table
[
NB_BANDS
*
NB_BANDS
];
}
CommonState
;
...
...
@@ -127,9 +127,9 @@ CommonState common;
static
void
check_init
()
{
int
i
;
if
(
common
.
init
)
return
;
common
.
kfft
=
opus_fft_alloc_twiddles
(
2
*
FRAME
_SIZE
,
NULL
,
NULL
,
NULL
,
0
);
for
(
i
=
0
;
i
<
FRAME
_SIZE
;
i
++
)
common
.
half_window
[
i
]
=
sin
(.
5
*
M_PI
*
sin
(.
5
*
M_PI
*
(
i
+
.
5
)
/
FRAME
_SIZE
)
*
sin
(.
5
*
M_PI
*
(
i
+
.
5
)
/
FRAME
_SIZE
));
common
.
kfft
=
opus_fft_alloc_twiddles
(
WINDOW
_SIZE
,
NULL
,
NULL
,
NULL
,
0
);
for
(
i
=
0
;
i
<
OVERLAP
_SIZE
;
i
++
)
common
.
half_window
[
i
]
=
sin
(.
5
*
M_PI
*
sin
(.
5
*
M_PI
*
(
i
+
.
5
)
/
OVERLAP
_SIZE
)
*
sin
(.
5
*
M_PI
*
(
i
+
.
5
)
/
OVERLAP
_SIZE
));
for
(
i
=
0
;
i
<
NB_BANDS
;
i
++
)
{
int
j
;
for
(
j
=
0
;
j
<
NB_BANDS
;
j
++
)
{
...
...
@@ -209,10 +209,11 @@ float lpc_from_bands(float *lpc, const float *Ex)
float
rc
[
LPC_ORDER
];
float
Xr
[
FREQ_SIZE
];
kiss_fft_cpx
X_auto
[
FREQ_SIZE
];
float
x_auto
[
FRAME
_SIZE
];
float
x_auto
[
WINDOW
_SIZE
];
interp_band_gain
(
Xr
,
Ex
);
Xr
[
FREQ_SIZE
-
1
]
=
0
;
RNN_CLEAR
(
X_auto
,
FREQ_SIZE
);
for
(
i
=
0
;
i
<
160
;
i
++
)
X_auto
[
i
].
r
=
Xr
[
i
];
for
(
i
=
0
;
i
<
FREQ_SIZE
;
i
++
)
X_auto
[
i
].
r
=
Xr
[
i
];
inverse_transform
(
x_auto
,
X_auto
);
for
(
i
=
0
;
i
<
LPC_ORDER
+
1
;
i
++
)
ac
[
i
]
=
x_auto
[
i
];
...
...
@@ -239,7 +240,7 @@ float lpc_from_cepstrum(float *lpc, const float *cepstrum)
void
apply_window
(
float
*
x
)
{
int
i
;
check_init
();
for
(
i
=
0
;
i
<
FRAME
_SIZE
;
i
++
)
{
for
(
i
=
0
;
i
<
OVERLAP
_SIZE
;
i
++
)
{
x
[
i
]
*=
common
.
half_window
[
i
];
x
[
WINDOW_SIZE
-
1
-
i
]
*=
common
.
half_window
[
i
];
}
...
...
This diff is collapsed.
Click to expand it.
dnn/freq.h
+
3
−
2
View file @
fb3112ad
...
...
@@ -30,8 +30,9 @@
#define FRAME_SIZE_SHIFT 2
#define FRAME_SIZE (40<<FRAME_SIZE_SHIFT)
#define WINDOW_SIZE (2*FRAME_SIZE)
#define FREQ_SIZE (FRAME_SIZE + 1)
#define OVERLAP_SIZE (FRAME_SIZE)
#define WINDOW_SIZE (FRAME_SIZE + OVERLAP_SIZE)
#define FREQ_SIZE (WINDOW_SIZE/2 + 1)
#define NB_BANDS 18
...
...
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