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
98193470
Commit
98193470
authored
17 years ago
by
Jean-Marc Valin
Browse files
Options
Downloads
Patches
Plain Diff
fixed-point: unquant_energy_mono() has received the fixed-point code from
quant_energy_mono()
parent
d0316201
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
libcelt/quant_bands.c
+15
-12
15 additions, 12 deletions
libcelt/quant_bands.c
with
15 additions
and
12 deletions
libcelt/quant_bands.c
+
15
−
12
View file @
98193470
...
...
@@ -40,7 +40,7 @@
#include
"arch.h"
#ifdef FIXED_POINT
const
floa
t
eMeans
[
24
]
=
{
11520
,
-
2048
,
-
3072
,
-
640
,
256
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
};
const
celt_word16_
t
eMeans
[
24
]
=
{
11520
,
-
2048
,
-
3072
,
-
640
,
256
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
};
#else
const
float
eMeans
[
24
]
=
{
45
.
f
,
-
8
.
f
,
-
12
.
f
,
-
2
.
5
f
,
1
.
f
,
0
.
f
,
0
.
f
,
0
.
f
,
0
.
f
,
0
.
f
,
0
.
f
,
0
.
f
,
0
.
f
,
0
.
f
,
0
.
f
,
0
.
f
,
0
.
f
,
0
.
f
,
0
.
f
,
0
.
f
,
0
.
f
,
0
.
f
,
0
.
f
,
0
.
f
};
#endif
...
...
@@ -107,7 +107,6 @@ static void quant_energy_mono(const CELTMode *m, celt_ener_t *eBands, celt_word1
for
(
i
=
0
;
i
<
m
->
nbEBands
;
i
++
)
{
int
q2
;
float
offset2
;
celt_word16_t
offset
=
(
error
[
i
]
+
QCONST16
(.
5
f
,
8
))
*
frac
[
i
];
/* FIXME: Instead of giving up without warning, we should degrade everything gracefully */
if
(
ec_enc_tell
(
enc
,
0
)
-
bits
+
EC_ILOG
(
frac
[
i
])
>
budget
)
...
...
@@ -140,7 +139,7 @@ static void unquant_energy_mono(const CELTMode *m, celt_ener_t *eBands, celt_wor
{
int
i
;
int
bits
;
floa
t
prev
=
0
;
celt_word16_
t
prev
=
0
;
float
coef
=
m
->
ePredCoef
;
/* The .7 is a heuristic */
float
beta
=
.
7
*
coef
;
...
...
@@ -148,10 +147,10 @@ static void unquant_energy_mono(const CELTMode *m, celt_ener_t *eBands, celt_wor
for
(
i
=
0
;
i
<
m
->
nbEBands
;
i
++
)
{
int
qi
;
floa
t
q
;
floa
t
res
;
floa
t
mean
=
(
1
-
coef
)
*
eMeans
[
i
];
res
=
6
.;
celt_word16_
t
q
;
celt_word16_
t
res
;
celt_word16_
t
mean
=
(
1
-
coef
)
*
eMeans
[
i
];
res
=
DB_SCALING
*
6
.;
/* If we didn't have enough bits to encode all the energy, just assume something safe. */
if
(
ec_dec_tell
(
dec
,
0
)
-
bits
>
budget
)
qi
=
-
1
;
...
...
@@ -159,19 +158,23 @@ static void unquant_energy_mono(const CELTMode *m, celt_ener_t *eBands, celt_wor
qi
=
ec_laplace_decode
(
dec
,
6000
-
i
*
200
);
q
=
qi
*
res
;
oldEBands
[
i
]
=
DB_SCALING
*
(
DB_SCALING_1
*
mean
+
coef
*
DB_SCALING_1
*
oldEBands
[
i
]
+
prev
+
q
);
/*printf("%d ", qi);*/
/*printf("%f %f ", pred+prev+q, x);*/
/*printf("%f ", x-pred);*/
oldEBands
[
i
]
=
mean
+
coef
*
oldEBands
[
i
]
+
prev
+
q
;
prev
=
DB_SCALING_1
*
mean
+
prev
+
(
1
-
beta
)
*
q
;
prev
=
mean
+
prev
+
(
1
-
beta
)
*
q
;
}
for
(
i
=
0
;
i
<
m
->
nbEBands
;
i
++
)
{
int
q2
;
floa
t
offset
;
celt_word16_
t
offset
;
if
(
ec_dec_tell
(
dec
,
0
)
-
bits
+
EC_ILOG
(
frac
[
i
])
>
budget
)
break
;
q2
=
ec_dec_uint
(
dec
,
frac
[
i
]);
offset
=
((
q2
+
.
5
)
/
frac
[
i
])
-
.
5
;
oldEBands
[
i
]
+=
DB_SCALING
*
6
.
*
offset
;
offset
=
(
Q8
*
(
q2
+
.
5
)
/
frac
[
i
])
-
QCONST16
(.
5
f
,
8
)
;
oldEBands
[
i
]
+=
PSHR32
(
MULT16_16
(
DB_SCALING
*
6
,
offset
),
8
)
;
}
for
(
i
=
0
;
i
<
m
->
nbEBands
;
i
++
)
{
...
...
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