Skip to content
GitLab
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
a536f772
Commit
a536f772
authored
Mar 22, 2008
by
Jean-Marc Valin
Browse files
Added a few "restrict" keywords and changed some divisions to shifts
parent
3c2fe0fb
Changes
6
Hide whitespace changes
Inline
Side-by-side
libcelt/celt.c
View file @
a536f772
...
...
@@ -156,14 +156,14 @@ static inline celt_int16_t SIG2INT16(celt_sig_t x)
}
/** Apply window and compute the MDCT for all sub-frames and all channels in a frame */
static
celt_word32_t
compute_mdcts
(
const
mdct_lookup
*
lookup
,
const
celt_word16_t
*
window
,
celt_sig_t
*
in
,
celt_sig_t
*
out
,
int
N
,
int
overlap
,
int
B
,
int
C
)
static
celt_word32_t
compute_mdcts
(
const
mdct_lookup
*
lookup
,
const
celt_word16_t
*
restrict
window
,
celt_sig_t
*
in
,
celt_sig_t
*
out
,
int
N
,
int
overlap
,
int
B
,
int
C
)
{
int
i
,
c
,
N4
;
celt_word32_t
E
=
0
;
VARDECL
(
celt_word32_t
,
x
);
VARDECL
(
celt_word32_t
,
tmp
);
SAVE_STACK
;
N4
=
(
N
-
overlap
)
/
2
;
N4
=
(
N
-
overlap
)
>>
1
;
ALLOC
(
x
,
2
*
N
,
celt_word32_t
);
ALLOC
(
tmp
,
N
,
celt_word32_t
);
for
(
c
=
0
;
c
<
C
;
c
++
)
...
...
@@ -196,7 +196,7 @@ static celt_word32_t compute_mdcts(const mdct_lookup *lookup, const celt_word16_
}
/** Compute the IMDCT and apply window for all sub-frames and all channels in a frame */
static
void
compute_inv_mdcts
(
const
mdct_lookup
*
lookup
,
const
celt_word16_t
*
window
,
celt_sig_t
*
X
,
celt_sig_t
*
out_mem
,
celt_sig_t
*
mdct_overlap
,
int
N
,
int
overlap
,
int
B
,
int
C
)
static
void
compute_inv_mdcts
(
const
mdct_lookup
*
lookup
,
const
celt_word16_t
*
restrict
window
,
celt_sig_t
*
X
,
celt_sig_t
*
out_mem
,
celt_sig_t
*
mdct_overlap
,
int
N
,
int
overlap
,
int
B
,
int
C
)
{
int
i
,
c
,
N4
;
VARDECL
(
celt_word32_t
,
x
);
...
...
@@ -204,7 +204,7 @@ static void compute_inv_mdcts(const mdct_lookup *lookup, const celt_word16_t *wi
SAVE_STACK
;
ALLOC
(
x
,
2
*
N
,
celt_word32_t
);
ALLOC
(
tmp
,
N
,
celt_word32_t
);
N4
=
(
N
-
overlap
)
/
2
;
N4
=
(
N
-
overlap
)
>>
1
;
for
(
c
=
0
;
c
<
C
;
c
++
)
{
for
(
i
=
0
;
i
<
B
;
i
++
)
...
...
@@ -252,7 +252,7 @@ int EXPORT celt_encode(CELTEncoder *st, celt_int16_t *pcm, unsigned char *compre
N
=
st
->
block_size
;
B
=
st
->
nb_blocks
;
C
=
st
->
mode
->
nbChannels
;
N4
=
(
N
-
st
->
overlap
)
/
2
;
N4
=
(
N
-
st
->
overlap
)
>>
1
;
ALLOC
(
in
,
(
B
+
1
)
*
C
*
N
-
2
*
N4
,
celt_sig_t
);
...
...
@@ -565,7 +565,7 @@ int EXPORT celt_decode(CELTDecoder *st, unsigned char *data, int len, celt_int16
N
=
st
->
block_size
;
B
=
st
->
nb_blocks
;
C
=
st
->
mode
->
nbChannels
;
N4
=
(
N
-
st
->
overlap
)
/
2
;
N4
=
(
N
-
st
->
overlap
)
>>
1
;
ALLOC
(
freq
,
C
*
B
*
N
,
celt_sig_t
);
/**< Interleaved signal MDCTs */
ALLOC
(
X
,
C
*
B
*
N
,
celt_norm_t
);
/**< Interleaved normalised MDCTs */
...
...
libcelt/mdct.c
View file @
a536f772
...
...
@@ -62,8 +62,8 @@ void mdct_init(mdct_lookup *l,int N)
int
i
;
int
N2
;
l
->
n
=
N
;
N2
=
N
/
2
;
l
->
kfft
=
cpx32_fft_alloc
(
N
/
4
);
N2
=
N
>>
1
;
l
->
kfft
=
cpx32_fft_alloc
(
N
>>
2
);
l
->
trig
=
(
kiss_twiddle_scalar
*
)
celt_alloc
(
N2
*
sizeof
(
kiss_twiddle_scalar
));
/* We have enough points that sine isn't necessary */
#if defined(FIXED_POINT)
...
...
@@ -93,8 +93,8 @@ void mdct_forward(const mdct_lookup *l, kiss_fft_scalar *in, kiss_fft_scalar *ou
VARDECL
(
kiss_fft_scalar
,
f
);
SAVE_STACK
;
N
=
l
->
n
;
N2
=
N
/
2
;
N4
=
N
/
4
;
N2
=
N
>>
1
;
N4
=
N
>>
2
;
ALLOC
(
f
,
N2
,
kiss_fft_scalar
);
/* Consider the input to be compused of four blocks: [a, b, c, d] */
...
...
@@ -138,8 +138,8 @@ void mdct_backward(const mdct_lookup *l, kiss_fft_scalar *in, kiss_fft_scalar *o
VARDECL
(
kiss_fft_scalar
,
f
);
SAVE_STACK
;
N
=
l
->
n
;
N2
=
N
/
2
;
N4
=
N
/
4
;
N2
=
N
>>
1
;
N4
=
N
>>
2
;
ALLOC
(
f
,
N2
,
kiss_fft_scalar
);
/* Pre-rotate */
...
...
libcelt/mdct.h
View file @
a536f772
...
...
@@ -50,7 +50,7 @@
typedef
struct
{
int
n
;
kiss_fft_cfg
kfft
;
kiss_twiddle_scalar
*
trig
;
kiss_twiddle_scalar
*
restrict
trig
;
}
mdct_lookup
;
void
mdct_init
(
mdct_lookup
*
l
,
int
N
);
...
...
libcelt/pitch.c
View file @
a536f772
...
...
@@ -99,7 +99,7 @@ static void normalise16(celt_word16_t *x, int len, celt_word16_t val)
#define INPUT_SHIFT 15
void
find_spectral_pitch
(
kiss_fftr_cfg
fft
,
const
struct
PsyDecay
*
decay
,
const
celt_sig_t
*
x
,
const
celt_sig_t
*
y
,
const
celt_word16_t
*
window
,
int
overlap
,
int
lag
,
int
len
,
int
C
,
int
*
pitch
)
void
find_spectral_pitch
(
kiss_fftr_cfg
fft
,
const
struct
PsyDecay
*
decay
,
const
celt_sig_t
*
x
,
const
celt_sig_t
*
y
,
const
celt_word16_t
*
restrict
window
,
int
overlap
,
int
lag
,
int
len
,
int
C
,
int
*
pitch
)
{
int
c
,
i
;
celt_word32_t
max_corr
;
...
...
@@ -109,8 +109,8 @@ void find_spectral_pitch(kiss_fftr_cfg fft, const struct PsyDecay *decay, const
int
n2
;
int
L2
;
SAVE_STACK
;
n2
=
lag
/
2
;
L2
=
len
/
2
;
n2
=
lag
>>
1
;
L2
=
len
>>
1
;
ALLOC
(
X
,
lag
,
celt_word16_t
);
ALLOC
(
curve
,
n2
,
celt_mask_t
);
...
...
@@ -127,7 +127,7 @@ void find_spectral_pitch(kiss_fftr_cfg fft, const struct PsyDecay *decay, const
}
/* Applying the window in the bit-reverse domain. It's a bit weird, but it
can help save memory */
for
(
i
=
0
;
i
<
overlap
/
2
;
i
++
)
for
(
i
=
0
;
i
<
overlap
>>
1
;
i
++
)
{
X
[
2
*
BITREV
(
fft
,
i
)]
=
MULT16_16_Q15
(
window
[
2
*
i
],
X
[
2
*
BITREV
(
fft
,
i
)]);
X
[
2
*
BITREV
(
fft
,
i
)
+
1
]
=
MULT16_16_Q15
(
window
[
2
*
i
+
1
],
X
[
2
*
BITREV
(
fft
,
i
)
+
1
]);
...
...
libcelt/psy.c
View file @
a536f772
...
...
@@ -135,7 +135,7 @@ void compute_masking(const struct PsyDecay *decay, celt_word16_t *X, celt_mask_t
{
int
i
;
int
N
;
N
=
len
/
2
;
N
=
len
>>
1
;
mask
[
0
]
=
MULT16_16
(
X
[
0
],
X
[
0
]);
for
(
i
=
1
;
i
<
N
;
i
++
)
mask
[
i
]
=
ADD32
(
MULT16_16
(
X
[
i
*
2
],
X
[
i
*
2
]),
MULT16_16
(
X
[
i
*
2
+
1
],
X
[
i
*
2
+
1
]));
...
...
libcelt/vq.c
View file @
a536f772
...
...
@@ -474,7 +474,7 @@ void intra_fold(celt_norm_t *x, int N, celt_norm_t *Y, celt_norm_t *P, int B, in
celt_word16_t
g
;
E
=
EPSILON
;
if
(
N0
>=
Nmax
/
2
)
if
(
N0
>=
(
Nmax
>>
1
)
)
{
for
(
i
=
0
;
i
<
B
;
i
++
)
{
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment