Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Mark Harris
Opus
Commits
6fd02706
Commit
6fd02706
authored
Dec 02, 2009
by
George de Vries
Committed by
Jean-Marc Valin
Dec 02, 2009
Browse files
Fixing (read) array overrun for 1024-sample frames.
parent
aebb6fd6
Changes
1
Hide whitespace changes
Inline
Side-by-side
libcelt/quant_bands.c
View file @
6fd02706
...
...
@@ -42,10 +42,12 @@
#include "mathops.h"
#include "stack_alloc.h"
#define E_MEANS_SIZE (5)
#ifdef FIXED_POINT
const
celt_word16
eMeans
[
24
]
=
{
1920
,
-
341
,
-
512
,
-
107
,
43
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
};
const
celt_word16
eMeans
[
E_MEANS_SIZE
]
=
{
1920
,
-
341
,
-
512
,
-
107
,
43
};
#else
const
celt_word16
eMeans
[
24
]
=
{
7
.
5
f
,
-
1
.
33
f
,
-
2
.
f
,
-
0
.
42
f
,
0
.
17
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
};
const
celt_word16
eMeans
[
E_MEANS_SIZE
]
=
{
7
.
5
f
,
-
1
.
33
f
,
-
2
.
f
,
-
0
.
42
f
,
0
.
17
f
};
#endif
/* FIXME: Implement for stereo */
...
...
@@ -112,7 +114,7 @@ unsigned quant_coarse_energy(const CELTMode *m, celt_word16 *eBands, celt_word16
celt_word16
q
;
/* dB */
celt_word16
x
;
/* dB */
celt_word16
f
;
/* Q8 */
celt_word16
mean
=
MULT16_16_Q15
(
Q15ONE
-
coef
,
eMeans
[
i
]);
celt_word16
mean
=
(
i
<
E_MEANS_SIZE
)
?
MULT16_16_Q15
(
Q15ONE
-
coef
,
eMeans
[
i
])
:
0
;
x
=
eBands
[
i
+
c
*
m
->
nbEBands
];
#ifdef FIXED_POINT
f
=
x
-
mean
-
MULT16_16_Q15
(
coef
,
oldEBands
[
i
+
c
*
m
->
nbEBands
])
-
prev
[
c
];
...
...
@@ -241,7 +243,7 @@ void unquant_coarse_energy(const CELTMode *m, celt_ener *eBands, celt_word16 *ol
do
{
int
qi
;
celt_word16
q
;
celt_word16
mean
=
MULT16_16_Q15
(
Q15ONE
-
coef
,
eMeans
[
i
]);
celt_word16
mean
=
(
i
<
E_MEANS_SIZE
)
?
MULT16_16_Q15
(
Q15ONE
-
coef
,
eMeans
[
i
])
:
0
;
/* If we didn't have enough bits to encode all the energy, just assume something safe.
We allow slightly busting the budget here */
if
(
ec_dec_tell
(
dec
,
0
)
>
budget
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment