[Speex-dev] Bug in decoding

Thorvald Natvig speex at natvig.com
Mon Aug 29 09:42:21 PDT 2005


> I think I just found a bug (which is easy to avoid if you use Speex the
> "standard" way). I'm writing a wrapper-dll in C# for Speex and it's up
> and running. However, I had some problem with the wrapper (Garbage
> Collector-related) so I found out that if I created a new decoder every
> run, everything worked smoothly. What I also discovered was that the
> sound quality was degraded due to this. I investigated and found out
> that the same bug/error appears if I write a simple C-program.
>
>
>
> My main program was testenc.c in the speex source code. What I changed
> was to remove the decoder initialization in the beginning of the file
> and put them in the while()-loop before speex_decoder_int() and put a
> speex_decoder_destroy() just after the decode call (and of course,
> removed the destroy call at the end of the program).

(snip snip)

If I understand correctly, you're doing something like this:

while (more packets) {
   initialize new decoder;
   decode single packet;
   destroy decoder;
}

.. which won't work well, because Speex has partially dependent frames; it 
needs the context of the previous frame to achieve full quality. If you 
search the archives for the discussions iLBC (which has fully 
independent frames), you'll find some of the arguments and explanations.




More information about the Speex-dev mailing list