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
Tim-Philipp Müller
Opus
Commits
b386458f
Commit
b386458f
authored
Jan 31, 2011
by
Jean-Marc Valin
Browse files
Got stereo support to work in CELT-only mode
parent
eeca5682
Changes
4
Hide whitespace changes
Inline
Side-by-side
src/opus_decoder.c
View file @
b386458f
...
...
@@ -58,7 +58,7 @@ OpusDecoder *opus_decoder_create(int Fs, int channels)
st
=
(
OpusDecoder
*
)
raw_state
;
st
->
silk_dec
=
(
void
*
)(
raw_state
+
sizeof
(
OpusDecoder
));
st
->
celt_dec
=
(
CELTDecoder
*
)(
raw_state
+
sizeof
(
OpusDecoder
)
+
silkDecSizeBytes
);
st
->
channels
=
channels
;
st
->
stream_channels
=
st
->
channels
=
channels
;
st
->
Fs
=
Fs
;
...
...
@@ -111,6 +111,7 @@ int opus_decode(OpusDecoder *st, const unsigned char *data,
else
audiosize
=
(
st
->
Fs
<<
audiosize
)
/
100
;
}
st
->
stream_channels
=
(
data
[
0
]
&
0x4
)
?
2
:
1
;
/*printf ("%d %d %d\n", st->mode, st->bandwidth, audiosize);*/
len
-=
1
;
...
...
@@ -180,6 +181,7 @@ int opus_decode(OpusDecoder *st, const unsigned char *data,
break
;
}
celt_decoder_ctl
(
st
->
celt_dec
,
CELT_SET_END_BAND
(
endband
));
celt_decoder_ctl
(
st
->
celt_dec
,
CELT_SET_CHANNELS
(
st
->
stream_channels
));
/* Encode high band with CELT */
celt_ret
=
celt_decode_with_ec
(
st
->
celt_dec
,
data
,
len
,
pcm_celt
,
frame_size
,
&
dec
);
...
...
src/opus_decoder.h
View file @
b386458f
...
...
@@ -39,6 +39,7 @@ struct OpusDecoder {
CELTDecoder
*
celt_dec
;
void
*
silk_dec
;
int
channels
;
int
stream_channels
;
int
mode
;
int
bandwidth
;
...
...
src/opus_encoder.c
View file @
b386458f
...
...
@@ -58,7 +58,7 @@ OpusEncoder *opus_encoder_create(int Fs, int channels)
st
=
(
OpusEncoder
*
)
raw_state
;
st
->
silk_enc
=
(
void
*
)(
raw_state
+
sizeof
(
OpusEncoder
));
st
->
celt_enc
=
(
CELTEncoder
*
)(
raw_state
+
sizeof
(
OpusEncoder
)
+
silkEncSizeBytes
);
st
->
channels
=
channels
;
st
->
stream_channels
=
st
->
channels
=
channels
;
st
->
Fs
=
Fs
;
...
...
@@ -168,6 +168,7 @@ int opus_encode(OpusEncoder *st, const short *pcm, int frame_size,
break
;
}
celt_encoder_ctl
(
st
->
celt_enc
,
CELT_SET_END_BAND
(
endband
));
celt_encoder_ctl
(
st
->
celt_enc
,
CELT_SET_CHANNELS
(
st
->
stream_channels
));
for
(
i
=
0
;
i
<
ENCODER_DELAY_COMPENSATION
*
st
->
channels
;
i
++
)
pcm_buf
[
i
]
=
st
->
delay_buffer
[
i
];
...
...
@@ -178,7 +179,9 @@ int opus_encode(OpusEncoder *st, const short *pcm, int frame_size,
if
(
st
->
vbr_rate
!=
0
)
{
int
tmp
=
(
st
->
vbr_rate
-
6000
)
/
2
;
int
tmp
;
tmp
=
(
st
->
mode
==
MODE_HYBRID
)
?
(
st
->
vbr_rate
-
6000
)
/
2
:
st
->
vbr_rate
;
tmp
=
((
ec_enc_tell
(
&
enc
,
0
)
+
4
)
>>
3
)
+
tmp
*
frame_size
/
(
8
*
st
->
Fs
);
if
(
tmp
<=
bytes_per_packet
)
bytes_per_packet
=
tmp
;
...
...
@@ -219,6 +222,7 @@ int opus_encode(OpusEncoder *st, const short *pcm, int frame_size,
data
[
0
]
|=
(
st
->
bandwidth
-
BANDWIDTH_SUPERWIDEBAND
)
<<
4
;
data
[
0
]
|=
(
period
-
2
)
<<
3
;
}
data
[
0
]
|=
(
st
->
stream_channels
==
2
)
<<
2
;
/*printf ("%x\n", (int)data[0]);*/
return
ret
+
1
;
...
...
src/opus_encoder.h
View file @
b386458f
...
...
@@ -43,6 +43,7 @@ struct OpusEncoder {
CELTEncoder
*
celt_enc
;
void
*
silk_enc
;
int
channels
;
int
stream_channels
;
int
mode
;
int
bandwidth
;
...
...
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