Squashed commit of the following:

commit 5b64cf7c4d67af9050bc959996ef976ce6326888
Author: Jean-Marc Valin <jean-marc.valin@octasic.com>
Date:   Thu May 19 16:40:35 2011 -0400

    Fixes a few bugs introduced in the latest update

commit b91eb86025d2de3c4cf04f4fb1aa48a28ad676a3
Author: Timothy B. Terriberry <tterribe@xiph.org>
Date:   Thu May 19 16:12:02 2011 -0400

    build_draft.sh fixes

commit 0b10c30db7ad60ff7d4bfc1139bdb86e0543c035
Author: Jean-Marc Valin <jean-marc.valin@octasic.com>
Date:   Thu May 19 15:30:21 2011 -0400

    Fixes the draft build

commit 164424cded5978e657105104e171ac202dde5e5b
Author: Jean-Marc Valin <jean-marc.valin@octasic.com>
Date:   Thu May 19 15:00:23 2011 -0400

    Updated build system

commit 188d9fcba8c3a1b1ad67c67c430e1b37e3658a40
Author: Koen Vos <koen.vos@skype.net>
Date:   Thu May 19 17:14:57 2011 -0400

    SILK/Opus update
This commit is contained in:
Jean-Marc Valin 2011-05-19 17:17:44 -04:00
parent c77b96333b
commit 103302b375
192 changed files with 3849 additions and 3866 deletions

View file

@ -37,7 +37,7 @@
#include "opus_decoder.h"
#include "entdec.h"
#include "modes.h"
#include "SKP_Silk_SDK_API.h"
#include "silk_API.h"
#define MAX_PACKET (1275)
@ -52,7 +52,7 @@ int opus_decoder_get_size(int channels)
{
int silkDecSizeBytes, celtDecSizeBytes;
int ret;
ret = SKP_Silk_SDK_Get_Decoder_Size( &silkDecSizeBytes );
ret = silk_Get_Decoder_Size( &silkDecSizeBytes );
if(ret)
return 0;
silkDecSizeBytes = align(silkDecSizeBytes);
@ -69,7 +69,7 @@ OpusDecoder *opus_decoder_init(OpusDecoder *st, int Fs, int channels)
memset(st, 0, sizeof(OpusDecoder));
/* Initialize SILK encoder */
ret = SKP_Silk_SDK_Get_Decoder_Size( &silkDecSizeBytes );
ret = silk_Get_Decoder_Size( &silkDecSizeBytes );
if( ret ) {
return NULL;
}
@ -84,7 +84,7 @@ OpusDecoder *opus_decoder_init(OpusDecoder *st, int Fs, int channels)
st->Fs = Fs;
/* Reset decoder */
ret = SKP_Silk_SDK_InitDecoder( silk_dec );
ret = silk_InitDecoder( silk_dec );
if( ret ) {
goto failure;
}
@ -149,7 +149,7 @@ static int opus_decode_frame(OpusDecoder *st, const unsigned char *data,
CELTDecoder *celt_dec;
int i, silk_ret=0, celt_ret=0;
ec_dec dec;
SKP_SILK_SDK_DecControlStruct DecControl;
silk_DecControlStruct DecControl;
SKP_int32 silk_frame_size;
short pcm_celt[960*2];
short pcm_transition[960*2];
@ -183,9 +183,6 @@ static int opus_decode_frame(OpusDecoder *st, const unsigned char *data,
mode = st->prev_mode;
}
if (st->stream_channels > st->channels)
return OPUS_CORRUPTED_DATA;
if (data!=NULL && !st->prev_redundancy && mode != st->prev_mode && st->prev_mode > 0
&& !(mode == MODE_SILK_ONLY && st->prev_mode == MODE_HYBRID)
&& !(mode == MODE_HYBRID && st->prev_mode == MODE_SILK_ONLY))
@ -209,9 +206,11 @@ static int opus_decode_frame(OpusDecoder *st, const unsigned char *data,
SKP_int16 *pcm_ptr = pcm;
if (st->prev_mode==MODE_CELT_ONLY)
SKP_Silk_SDK_InitDecoder( silk_dec );
silk_InitDecoder( silk_dec );
DecControl.API_sampleRate = st->Fs;
DecControl.nChannelsAPI = st->channels;
DecControl.nChannelsInternal = st->stream_channels;
DecControl.payloadSize_ms = 1000 * audiosize / st->Fs;
if( mode == MODE_SILK_ONLY ) {
if( st->bandwidth == BANDWIDTH_NARROWBAND ) {
@ -228,14 +227,13 @@ static int opus_decode_frame(OpusDecoder *st, const unsigned char *data,
/* Hybrid mode */
DecControl.internalSampleRate = 16000;
}
DecControl.nChannels = st->channels;
lost_flag = data == NULL ? 1 : 2 * decode_fec;
decoded_samples = 0;
do {
/* Call SILK decoder */
int first_frame = decoded_samples == 0;
silk_ret = SKP_Silk_SDK_Decode( silk_dec, &DecControl,
silk_ret = silk_Decode( silk_dec, &DecControl,
lost_flag, first_frame, &dec, pcm_ptr, &silk_frame_size );
if( silk_ret ) {
fprintf (stderr, "SILK decode error\n");
@ -318,10 +316,9 @@ static int opus_decode_frame(OpusDecoder *st, const unsigned char *data,
/* Decode CELT */
celt_ret = celt_decode_with_ec(celt_dec, decode_fec?NULL:data, len, pcm_celt, frame_size, &dec);
for (i=0;i<frame_size*st->channels;i++)
pcm[i] = ADD_SAT16(pcm[i], pcm_celt[i]);
pcm[i] = SAT16(pcm[i] + (int)pcm_celt[i]);
}
{
const CELTMode *celt_mode;
celt_decoder_ctl(celt_dec, CELT_GET_MODE(&celt_mode));