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
3ccf3a56
Commit
3ccf3a56
authored
16 years ago
by
Jean-Marc Valin
Browse files
Options
Downloads
Patches
Plain Diff
Reverted to the old MDCT behaviour of only doing down-scaling in the FFT.
parent
8ddd7f40
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
libcelt/mdct.c
+12
-19
12 additions, 19 deletions
libcelt/mdct.c
libcelt/mdct.h
+3
-2
3 additions, 2 deletions
libcelt/mdct.h
with
15 additions
and
21 deletions
libcelt/mdct.c
+
12
−
19
View file @
3ccf3a56
...
...
@@ -86,13 +86,6 @@ void mdct_clear(mdct_lookup *l)
celt_free
(
l
->
trig
);
}
/* Only divide by half if float. In fixed-point, it's included in the shift */
#ifdef FIXED_POINT
#define FL_HALF(x) (x)
#else
#define FL_HALF(x) (.5f*(x))
#endif
void
mdct_forward
(
const
mdct_lookup
*
l
,
kiss_fft_scalar
*
in
,
kiss_fft_scalar
*
restrict
out
,
const
celt_word16_t
*
window
,
int
overlap
)
{
int
i
;
...
...
@@ -116,8 +109,8 @@ void mdct_forward(const mdct_lookup *l, kiss_fft_scalar *in, kiss_fft_scalar * r
for
(
i
=
0
;
i
<
(
overlap
>>
2
);
i
++
)
{
/* Real part arranged as -d-cR, Imag part arranged as -b+aR*/
*
yp
++
=
-
FL_HALF
(
MULT16_32_Q1
6
(
*
wp2
,
xp1
[
N2
])
+
MULT16_32_Q1
6
(
*
wp1
,
*
xp2
)
)
;
*
yp
++
=
-
FL_HALF
(
MULT16_32_Q1
6
(
*
wp1
,
*
xp1
)
-
MULT16_32_Q1
6
(
*
wp2
,
xp2
[
-
N2
])
)
;
*
yp
++
=
MULT16_32_Q1
5
(
*
wp2
,
xp1
[
N2
])
+
MULT16_32_Q1
5
(
*
wp1
,
*
xp2
);
*
yp
++
=
MULT16_32_Q1
5
(
*
wp1
,
*
xp1
)
-
MULT16_32_Q1
5
(
*
wp2
,
xp2
[
-
N2
]);
xp1
+=
2
;
xp2
-=
2
;
wp1
+=
2
;
...
...
@@ -128,16 +121,16 @@ void mdct_forward(const mdct_lookup *l, kiss_fft_scalar *in, kiss_fft_scalar * r
for
(;
i
<
N4
-
(
overlap
>>
2
);
i
++
)
{
/* Real part arranged as a-bR, Imag part arranged as -c-dR */
*
yp
++
=
-
HALF32
(
*
xp2
)
;
*
yp
++
=
-
HALF32
(
*
xp1
)
;
*
yp
++
=
*
xp2
;
*
yp
++
=
*
xp1
;
xp1
+=
2
;
xp2
-=
2
;
}
for
(;
i
<
N4
;
i
++
)
{
/* Real part arranged as a-bR, Imag part arranged as -c-dR */
*
yp
++
=
FL_HALF
(
MULT16_32_Q1
6
(
*
wp1
,
xp1
[
-
N2
])
-
MULT16_32_Q1
6
(
*
wp2
,
*
xp2
)
)
;
*
yp
++
=
-
FL_HALF
(
MULT16_32_Q1
6
(
*
wp2
,
*
xp1
)
+
MULT16_32_Q1
6
(
*
wp1
,
xp2
[
N2
])
)
;
*
yp
++
=
-
MULT16_32_Q1
5
(
*
wp1
,
xp1
[
-
N2
])
+
MULT16_32_Q1
5
(
*
wp2
,
*
xp2
);
*
yp
++
=
MULT16_32_Q1
5
(
*
wp2
,
*
xp1
)
+
MULT16_32_Q1
5
(
*
wp1
,
xp2
[
N2
]);
xp1
+=
2
;
xp2
-=
2
;
wp1
+=
2
;
...
...
@@ -153,16 +146,16 @@ void mdct_forward(const mdct_lookup *l, kiss_fft_scalar *in, kiss_fft_scalar * r
kiss_fft_scalar
re
,
im
;
re
=
yp
[
0
];
im
=
yp
[
1
];
*
yp
++
=
S_MUL
(
re
,
t
[
0
])
-
S_MUL
(
im
,
t
[
N4
]);
*
yp
++
=
S_MUL
(
im
,
t
[
0
])
+
S_MUL
(
re
,
t
[
N4
]);
*
yp
++
=
-
S_MUL
(
re
,
t
[
0
])
+
S_MUL
(
im
,
t
[
N4
]);
*
yp
++
=
-
S_MUL
(
im
,
t
[
0
])
-
S_MUL
(
re
,
t
[
N4
]);
t
++
;
}
}
/* N/4 complex FFT,
which should normally
down-scale by 4/N
(but doesn't now)
*/
/* N/4 complex FFT, down-scale
s
by 4/N */
cpx32_fft
(
l
->
kfft
,
out
,
f
,
N4
);
/* Post-rotate
and apply the scaling if the FFT doesn't to it itself
*/
/* Post-rotate */
{
/* Temp pointers to make it really clear to the compiler what we're doing */
const
kiss_fft_scalar
*
restrict
fp
=
f
;
...
...
@@ -240,8 +233,8 @@ void mdct_backward(const mdct_lookup *l, kiss_fft_scalar *in, kiss_fft_scalar *
kiss_fft_scalar
*
restrict
yp
=
f2
;
for
(
i
=
0
;
i
<
N4
;
i
++
)
{
*
yp
++
=-*
fp1
*
2
;
*
yp
++
=
*
fp2
*
2
;
*
yp
++
=-*
fp1
;
*
yp
++
=
*
fp2
;
fp1
+=
2
;
fp2
-=
2
;
}
...
...
This diff is collapsed.
Click to expand it.
libcelt/mdct.h
+
3
−
2
View file @
3ccf3a56
...
...
@@ -57,10 +57,11 @@ typedef struct {
void
mdct_init
(
mdct_lookup
*
l
,
int
N
);
void
mdct_clear
(
mdct_lookup
*
l
);
/** Compute a forward MDCT and scale by
2
/N */
/** Compute a forward MDCT and scale by
4
/N */
void
mdct_forward
(
const
mdct_lookup
*
l
,
kiss_fft_scalar
*
in
,
kiss_fft_scalar
*
out
,
const
celt_word16_t
*
window
,
int
overlap
);
/** Compute a backward MDCT (no scaling) and performs weighted overlap-add */
/** Compute a backward MDCT (no scaling) and performs weighted overlap-add
(scales implicitly by 1/2) */
void
mdct_backward
(
const
mdct_lookup
*
l
,
kiss_fft_scalar
*
in
,
kiss_fft_scalar
*
out
,
const
celt_word16_t
*
restrict
window
,
int
overlap
);
#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