Sharing more macros between the Opus code and the CELT low-level code

This commit is contained in:
Jean-Marc Valin 2011-08-31 17:47:48 -04:00
parent 875f8dbd56
commit f9e701ad24
8 changed files with 244 additions and 242 deletions

View file

@ -110,7 +110,7 @@ int opus_decoder_init(OpusDecoder *st, int Fs, int channels)
/* Initialize CELT decoder */
ret = celt_decoder_init(celt_dec, Fs, channels);
if (ret != CELT_OK)
if (ret != OPUS_OK)
goto failure;
celt_decoder_ctl(celt_dec, CELT_SET_SIGNALLING(0));
@ -373,15 +373,15 @@ static int opus_decode_frame(OpusDecoder *st, const unsigned char *data,
{
celt_decoder_ctl(celt_dec, CELT_SET_START_BAND(0));
celt_decode_with_ec(celt_dec, data+len, redundancy_bytes, redundant_audio, F5, NULL);
celt_decoder_ctl(celt_dec, CELT_GET_RANGE(&redundant_rng));
celt_decoder_ctl(celt_dec, CELT_RESET_STATE);
celt_decoder_ctl(celt_dec, OPUS_GET_FINAL_RANGE(&redundant_rng));
celt_decoder_ctl(celt_dec, OPUS_RESET_STATE);
}
/* MUST be after PLC */
celt_decoder_ctl(celt_dec, CELT_SET_START_BAND(start_band));
if (transition)
celt_decoder_ctl(celt_dec, CELT_RESET_STATE);
celt_decoder_ctl(celt_dec, OPUS_RESET_STATE);
if (mode != MODE_SILK_ONLY)
{
@ -413,11 +413,11 @@ static int opus_decode_frame(OpusDecoder *st, const unsigned char *data,
/* 5 ms redundant frame for SILK->CELT */
if (redundancy && !celt_to_silk)
{
celt_decoder_ctl(celt_dec, CELT_RESET_STATE);
celt_decoder_ctl(celt_dec, OPUS_RESET_STATE);
celt_decoder_ctl(celt_dec, CELT_SET_START_BAND(0));
celt_decode_with_ec(celt_dec, data+len, redundancy_bytes, redundant_audio, F5, NULL);
celt_decoder_ctl(celt_dec, CELT_GET_RANGE(&redundant_rng));
celt_decoder_ctl(celt_dec, OPUS_GET_FINAL_RANGE(&redundant_rng));
smooth_fade(pcm+st->channels*(frame_size-F2_5), redundant_audio+st->channels*F2_5,
pcm+st->channels*(frame_size-F2_5), F2_5, st->channels, window, st->Fs);
}
@ -766,7 +766,7 @@ int opus_decoder_ctl(OpusDecoder *st, int request, ...)
opus_decoder_get_size(st->channels)-
((char*)&st->OPUS_DECODER_RESET_START - (char*)st));
celt_decoder_ctl(celt_dec, CELT_RESET_STATE);
celt_decoder_ctl(celt_dec, OPUS_RESET_STATE);
silk_InitDecoder( silk_dec );
st->stream_channels = st->channels;
st->frame_size = st->Fs/400;