Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Mark Harris
Opus
Commits
11f01729
Commit
11f01729
authored
Dec 09, 2007
by
Jean-Marc Valin
Browse files
Some cleaning up, a few less warnings and the decoder no longer does an
infinitete loop in Laplace decoding when the data is corrupted.
parent
06ee7f90
Changes
6
Hide whitespace changes
Inline
Side-by-side
configure.ac
View file @
11f01729
...
...
@@ -6,7 +6,7 @@ AM_CONFIG_HEADER([config.h])
CELT_MAJOR_VERSION=0
CELT_MINOR_VERSION=0
CELT_MICRO_VERSION=
0
CELT_MICRO_VERSION=
1
CELT_EXTRA_VERSION=
CELT_VERSION=$CELT_MAJOR_VERSION.$CELT_MINOR_VERSION.$CELT_MICRO_VERSION$CELT_EXTRA_VERSION
...
...
libcelt/bands.c
View file @
11f01729
...
...
@@ -155,7 +155,7 @@ void quant_bands(const CELTMode *m, float *X, float *P, ec_enc *enc)
for
(
i
=
0
;
i
<
m
->
nbEBands
;
i
++
)
{
int
q
,
id
;
int
q
;
q
=
m
->
nbPulses
[
i
];
if
(
q
>
0
)
{
float
n
=
sqrt
(
B
*
(
eBands
[
i
+
1
]
-
eBands
[
i
]));
...
...
@@ -185,7 +185,7 @@ void unquant_bands(const CELTMode *m, float *X, float *P, ec_dec *dec)
for
(
i
=
0
;
i
<
m
->
nbEBands
;
i
++
)
{
int
q
,
id
;
int
q
;
q
=
m
->
nbPulses
[
i
];
if
(
q
>
0
)
{
float
n
=
sqrt
(
B
*
(
eBands
[
i
+
1
]
-
eBands
[
i
]));
...
...
libcelt/celt.c
View file @
11f01729
...
...
@@ -390,16 +390,13 @@ void celt_decoder_destroy(CELTDecoder *st)
celt_free
(
st
);
}
int
celt_decode_lost
(
CELTDecoder
*
st
,
short
*
pcm
)
static
void
celt_decode_lost
(
CELTDecoder
*
st
,
short
*
pcm
)
{
int
i
,
N
,
B
;
N
=
st
->
block_size
;
B
=
st
->
nb_blocks
;
float
X
[
B
*
N
];
/**< Interleaved signal MDCTs */
float
P
[
B
*
N
];
/**< Interleaved pitch MDCTs*/
float
bandE
[
st
->
mode
->
nbEBands
];
float
gains
[
st
->
mode
->
nbPBands
];
int
pitch_index
;
pitch_index
=
st
->
last_pitch_index
;
...
...
@@ -448,7 +445,7 @@ int celt_decode(CELTDecoder *st, char *data, int len, short *pcm)
ec_dec_init
(
&
dec
,
&
buf
);
/* Get the pitch index */
pitch_index
=
ec_dec_uint
(
&
dec
,
MAX_PERIOD
-
(
B
+
1
)
*
N
);
;
pitch_index
=
ec_dec_uint
(
&
dec
,
MAX_PERIOD
-
(
B
+
1
)
*
N
);
st
->
last_pitch_index
=
pitch_index
;
/* Get band energies */
...
...
libcelt/testcelt.c
View file @
11f01729
...
...
@@ -32,6 +32,7 @@
#include "celt.h"
#include <stdio.h>
#include <stdlib.h>
#define FRAME_SIZE 256
#define NBLOCKS 2
...
...
libcelt/vq.c
View file @
11f01729
...
...
@@ -303,7 +303,7 @@ void alg_unquant(float *x, int N, int K, float *p, ec_dec *dec)
void
copy_unquant
(
float
*
x
,
int
N
,
int
K
,
float
*
Y
,
int
B
,
int
N0
,
ec_dec
*
dec
)
{
int
i
,
j
;
int
j
;
int
sign
;
float
s
;
int
best
;
...
...
libentcode/laplace.c
View file @
11f01729
...
...
@@ -31,7 +31,6 @@
#include "entenc.h"
#include "entdec.h"
#include <stdio.h>
static
int
ec_laplace_get_total
(
int
decay
)
{
...
...
@@ -83,7 +82,7 @@ int ec_laplace_decode(ec_dec *dec, int decay)
fl
=
0
;
fs
=
1
<<
15
;
fh
=
fs
;
while
(
fm
>=
fh
)
while
(
fm
>=
fh
&&
fs
!=
0
)
{
fl
=
fh
;
fs
=
(
fs
*
decay
)
>>
14
;
...
...
@@ -100,12 +99,15 @@ int ec_laplace_decode(ec_dec *dec, int decay)
fh
-=
fs
;
}
}
//printf ("fl/fh: %d/%d\n", fl, fh);
/* Preventing an infinite loop in case something screws up in the decoding */
if
(
fl
==
fh
)
fl
--
;
ec_dec_update
(
dec
,
fl
,
fh
,
ft
);
return
val
;
}
#if 0
#include <stdio.h>
int main()
{
int val;
...
...
Write
Preview
Supports
Markdown
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