From e51a3f33cf5a387eea3dff09d0ca04cf54d59e49 Mon Sep 17 00:00:00 2001 From: Jean-Marc Valin Date: Wed, 6 Feb 2013 23:48:09 -0500 Subject: [PATCH] Fixes a minor CELT->SILK switching glitch in the decoder By not reinitializing the stereo state during a switch, the old stereo memory would create a false impulse (i.e. single sample) in the decoded audio. This change affects the normative part of the decoder. Fortunately, the modified decoder is still compliant with the specification because it still easily passes the testvectors. For example, for the float decoder at 48 kHz, the opus_compare (arbitrary) "quality score" changes from from 99.9333% to 99.925%. --- silk/dec_API.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/silk/dec_API.c b/silk/dec_API.c index 58b6b2b1..33146c04 100644 --- a/silk/dec_API.c +++ b/silk/dec_API.c @@ -69,6 +69,9 @@ opus_int silk_InitDecoder( /* O Returns error co for( n = 0; n < DECODER_NUM_CHANNELS; n++ ) { ret = silk_init_decoder( &channel_state[ n ] ); } + silk_memset(&((silk_decoder *)decState)->sStereo, 0, sizeof(((silk_decoder *)decState)->sStereo)); + /* Not strictly needed, but it's cleaner that way */ + ((silk_decoder *)decState)->prev_decode_only_middle = 0; return ret; }