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
5ea2e7f2
Commit
5ea2e7f2
authored
16 years ago
by
Jean-Marc Valin
Browse files
Options
Downloads
Patches
Plain Diff
Dividing by a constant is never good
parent
d125c264
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
libcelt/quant_bands.c
+4
-1
4 additions, 1 deletion
libcelt/quant_bands.c
with
4 additions
and
1 deletion
libcelt/quant_bands.c
+
4
−
1
View file @
5ea2e7f2
...
...
@@ -85,6 +85,7 @@ static inline celt_word16_t amp2dB(celt_ener_t amp)
#endif
static
const
celt_word16_t
base_resolution
=
QCONST16
(
6
.
f
,
8
);
static
const
celt_word16_t
base_resolution_1
=
QCONST16
(
0
.
1666667
f
,
15
);
int
*
quant_prob_alloc
(
const
CELTMode
*
m
)
{
...
...
@@ -124,11 +125,13 @@ static void quant_coarse_energy_mono(const CELTMode *m, celt_ener_t *eBands, cel
celt_word16_t
f
;
/* Q8 */
celt_word16_t
mean
=
MULT16_16_Q15
(
Q15ONE
-
coef
,
eMeans
[
i
]);
x
=
amp2dB
(
eBands
[
i
]);
f
=
EXTRACT16
(
celt_div
(
SHL32
(
EXTEND32
(
x
-
mean
-
MULT16_16_Q15
(
coef
,
oldEBands
[
i
])
-
prev
),
8
),
base_resolution
));
#ifdef FIXED_POINT
f
=
MULT16_16_Q15
(
x
-
mean
-
MULT16_16_Q15
(
coef
,
oldEBands
[
i
])
-
prev
,
base_resolution_1
);
/* Rounding to nearest integer here is really important! */
qi
=
(
f
+
128
)
>>
8
;
#else
f
=
(
x
-
mean
-
coef
*
oldEBands
[
i
]
-
prev
)
*
base_resolution_1
;
/* Rounding to nearest integer here is really important! */
qi
=
(
int
)
floor
(.
5
+
f
);
#endif
/* If we don't have enough bits to encode all the energy, just assume something safe.
...
...
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