Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Mark Harris
Opus
Commits
a3fadcb9
Unverified
Commit
a3fadcb9
authored
Sep 09, 2016
by
Jean-Marc Valin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes surround_analysis() for frame size > 20 ms
parent
c305b824
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
11 deletions
+24
-11
src/opus_multistream_encoder.c
src/opus_multistream_encoder.c
+24
-11
No files found.
src/opus_multistream_encoder.c
View file @
a3fadcb9
...
...
@@ -240,6 +240,7 @@ void surround_analysis(const CELTMode *celt_mode, const void *pcm, opus_val16 *b
int
pos
[
8
]
=
{
0
};
int
upsample
;
int
frame_size
;
int
freq_size
;
opus_val16
channel_offset
;
opus_val32
bandE
[
21
];
opus_val16
maskLogE
[
3
][
21
];
...
...
@@ -250,6 +251,7 @@ void surround_analysis(const CELTMode *celt_mode, const void *pcm, opus_val16 *b
upsample
=
resampling_factor
(
rate
);
frame_size
=
len
*
upsample
;
freq_size
=
IMIN
(
960
,
frame_size
);
/* LM = log2(frame_size / 120) */
for
(
LM
=
0
;
LM
<
celt_mode
->
maxLM
;
LM
++
)
...
...
@@ -258,7 +260,7 @@ void surround_analysis(const CELTMode *celt_mode, const void *pcm, opus_val16 *b
ALLOC
(
in
,
frame_size
+
overlap
,
opus_val32
);
ALLOC
(
x
,
len
,
opus_val16
);
ALLOC
(
freq
,
fr
am
e_size
,
opus_val32
);
ALLOC
(
freq
,
fre
q
_size
,
opus_val32
);
channel_pos
(
channels
,
pos
);
...
...
@@ -268,6 +270,9 @@ void surround_analysis(const CELTMode *celt_mode, const void *pcm, opus_val16 *b
for
(
c
=
0
;
c
<
channels
;
c
++
)
{
int
frame
;
int
nb_frames
=
frame_size
/
freq_size
;
celt_assert
(
nb_frames
*
freq_size
==
frame_size
);
OPUS_COPY
(
in
,
mem
+
c
*
overlap
,
overlap
);
(
*
copy_channel_in
)(
x
,
1
,
pcm
,
channels
,
c
,
len
);
celt_preemphasis
(
x
,
in
+
overlap
,
frame_size
,
1
,
upsample
,
celt_mode
->
preemph
,
preemph_mem
+
c
,
0
);
...
...
@@ -284,18 +289,26 @@ void surround_analysis(const CELTMode *celt_mode, const void *pcm, opus_val16 *b
}
}
#endif
clt_mdct_forward
(
&
celt_mode
->
mdct
,
in
,
freq
,
celt_mode
->
window
,
overlap
,
celt_mode
->
maxLM
-
LM
,
1
,
arch
);
if
(
upsample
!=
1
)
OPUS_CLEAR
(
bandE
,
21
);
for
(
frame
=
0
;
frame
<
nb_frames
;
frame
++
)
{
int
bound
=
len
;
for
(
i
=
0
;
i
<
bound
;
i
++
)
freq
[
i
]
*=
upsample
;
for
(;
i
<
frame_size
;
i
++
)
freq
[
i
]
=
0
;
}
opus_val32
tmpE
[
21
];
clt_mdct_forward
(
&
celt_mode
->
mdct
,
in
+
960
*
frame
,
freq
,
celt_mode
->
window
,
overlap
,
celt_mode
->
maxLM
-
LM
,
1
,
arch
);
if
(
upsample
!=
1
)
{
int
bound
=
freq_size
/
upsample
;
for
(
i
=
0
;
i
<
bound
;
i
++
)
freq
[
i
]
*=
upsample
;
for
(;
i
<
freq_size
;
i
++
)
freq
[
i
]
=
0
;
}
compute_band_energies
(
celt_mode
,
freq
,
bandE
,
21
,
1
,
LM
);
compute_band_energies
(
celt_mode
,
freq
,
tmpE
,
21
,
1
,
LM
);
/* If we have multiple frames, take the max energy. */
for
(
i
=
0
;
i
<
21
;
i
++
)
bandE
[
i
]
=
MAX32
(
bandE
[
i
],
tmpE
[
i
]);
}
amp2Log2
(
celt_mode
,
21
,
21
,
bandE
,
bandLogE
+
21
*
c
,
1
);
/* Apply spreading function with -6 dB/band going up and -12 dB/band going down. */
for
(
i
=
1
;
i
<
21
;
i
++
)
...
...
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