shithub: opus

Download patch

ref: e51a3f33cf5a387eea3dff09d0ca04cf54d59e49
parent: 61e9eb15cc8e84a20eb1a7e5747b9a10e8caf0be
author: Jean-Marc Valin <[email protected]>
date: Wed Feb 6 18:48:09 EST 2013

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%.

--- a/silk/dec_API.c
+++ b/silk/dec_API.c
@@ -69,6 +69,9 @@
     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;
 }