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
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
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
Alexander Traud
Opus
Commits
7fd98c57
Commit
7fd98c57
authored
11 years ago
by
Jean-Marc Valin
Browse files
Options
Downloads
Patches
Plain Diff
Converts denormalise_bands() to use 16-bit multiplications
parent
ee2506b2
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
celt/bands.c
+20
-7
20 additions, 7 deletions
celt/bands.c
celt/mathops.h
+8
-2
8 additions, 2 deletions
celt/mathops.h
with
28 additions
and
9 deletions
celt/bands.c
+
20
−
7
View file @
7fd98c57
...
...
@@ -205,17 +205,30 @@ void denormalise_bands(const CELTMode *m, const celt_norm * OPUS_RESTRICT X,
for
(
i
=
start
;
i
<
end
;
i
++
)
{
int
j
,
band_end
;
celt_ener
bandE
;
opus_val32
g
;
opus_val16
g
;
opus_val16
lg
;
lg
=
ADD16
(
bandLogE
[
i
+
c
*
m
->
nbEBands
],
SHL16
((
opus_val16
)
eMeans
[
i
],
6
));
bandE
=
PSHR32
(
celt_exp2
(
lg
),
4
)
;
g
=
SHR32
(
bandE
,
1
);
#ifdef FIXED_POINT
int
shift
;
#endif
j
=
M
*
eBands
[
i
];
band_end
=
M
*
eBands
[
i
+
1
];
lg
=
ADD16
(
bandLogE
[
i
+
c
*
m
->
nbEBands
],
SHL16
((
opus_val16
)
eMeans
[
i
],
6
));
#ifdef FIXED_POINT
/* Handle the integer part of the log energy */
shift
=
16
-
(
lg
>>
DB_SHIFT
);
if
(
shift
>
31
)
{
shift
=
0
;
g
=
0
;
}
else
{
/* Handle the fractional part. */
g
=
celt_exp2_frac
(
lg
&
((
1
<<
DB_SHIFT
)
-
1
));
}
#else
g
=
celt_exp2
(
lg
);
#endif
do
{
*
f
++
=
SHL32
(
MULT16_32_Q15
(
*
x
,
g
),
2
);
x
++
;
*
f
++
=
SHR32
(
MULT16_16
(
*
x
++
,
g
),
shift
);
}
while
(
++
j
<
band_end
);
}
celt_assert
(
start
<=
end
);
...
...
This diff is collapsed.
Click to expand it.
celt/mathops.h
+
8
−
2
View file @
7fd98c57
...
...
@@ -190,6 +190,13 @@ static inline opus_val16 celt_log2(opus_val32 x)
#define D1 22804
#define D2 14819
#define D3 10204
static
inline
opus_val32
celt_exp2_frac
(
opus_val16
x
)
{
opus_val16
frac
;
frac
=
SHL16
(
x
,
4
);
return
ADD16
(
D0
,
MULT16_16_Q15
(
frac
,
ADD16
(
D1
,
MULT16_16_Q15
(
frac
,
ADD16
(
D2
,
MULT16_16_Q15
(
D3
,
frac
))))));
}
/** Base-2 exponential approximation (2^x). (Q10 input, Q16 output) */
static
inline
opus_val32
celt_exp2
(
opus_val16
x
)
{
...
...
@@ -200,8 +207,7 @@ static inline opus_val32 celt_exp2(opus_val16 x)
return
0x7f000000
;
else
if
(
integer
<
-
15
)
return
0
;
frac
=
SHL16
(
x
-
SHL16
(
integer
,
10
),
4
);
frac
=
ADD16
(
D0
,
MULT16_16_Q15
(
frac
,
ADD16
(
D1
,
MULT16_16_Q15
(
frac
,
ADD16
(
D2
,
MULT16_16_Q15
(
D3
,
frac
))))));
frac
=
celt_exp2_frac
(
x
-
SHL16
(
integer
,
10
));
return
VSHR32
(
EXTEND32
(
frac
),
-
integer
-
2
);
}
...
...
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