diff options
author | Jean-Marc Valin <jean-marc.valin@octasic.com> | 2011-01-31 19:53:28 +0300 |
---|---|---|
committer | Jean-Marc Valin <jean-marc.valin@octasic.com> | 2011-01-31 19:53:28 +0300 |
commit | eeca56821167303c2a050a548ca43029c4a402df (patch) | |
tree | 006a5e0a346fff65377e94bd0edbf5efe982d4e6 /src/opus_decoder.c | |
parent | 3ce277ca1fc2ad9b4105f0697a153a90eb457ebc (diff) |
More stereo work
Diffstat (limited to 'src/opus_decoder.c')
-rw-r--r-- | src/opus_decoder.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/opus_decoder.c b/src/opus_decoder.c index 52d044af..242fed0e 100644 --- a/src/opus_decoder.c +++ b/src/opus_decoder.c @@ -53,11 +53,12 @@ OpusDecoder *opus_decoder_create(int Fs, int channels) if( ret ) { /* Handle error */ } - celtDecSizeBytes = celt_decoder_get_size(1); + celtDecSizeBytes = celt_decoder_get_size(channels); raw_state = calloc(sizeof(OpusDecoder)+silkDecSizeBytes+celtDecSizeBytes, 1); 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->Fs = Fs; @@ -81,7 +82,7 @@ int opus_decode(OpusDecoder *st, const unsigned char *data, ec_byte_buffer buf; SKP_SILK_SDK_DecControlStruct DecControl; SKP_int32 silk_frame_size; - short pcm_celt[960]; + short pcm_celt[960*2]; int audiosize; if (data != NULL) @@ -147,7 +148,7 @@ int opus_decode(OpusDecoder *st, const unsigned char *data, /* Handle error */ } } else { - for (i=0;i<frame_size;i++) + for (i=0;i<frame_size*st->channels;i++) pcm[i] = 0; } @@ -182,7 +183,7 @@ int opus_decode(OpusDecoder *st, const unsigned char *data, /* Encode high band with CELT */ celt_ret = celt_decode_with_ec(st->celt_dec, data, len, pcm_celt, frame_size, &dec); - for (i=0;i<frame_size;i++) + for (i=0;i<frame_size*st->channels;i++) pcm[i] += pcm_celt[i]; } return celt_ret; |