[Speex-dev] decode problem

Jean-Marc Valin jean-marc.valin at usherbrooke.ca
Wed Apr 30 04:47:53 PDT 2008


> I am using first time speex library, and this is my first problem. I
> need to decode AMR-NB packet to PCM. I read all manual instruction and I
> wrote these simple lines of code.

I'll answer if you can explain to me how to browse the web using
Photoshop. Seriously, if you want to decode Speex packets, you use
Speex, if you want to decode AMR-NB, you use an AMR-NB decoder.

Cheers,

	Jean-Marc

>  
> 
> bool CMMediaObj::AmrInit()
> 
> {
> 
>             speex_bits_init(&bits);
> 
>             destate = speex_decoder_init(&speex_nb_mode);
> 
>             int tmp=1;
> 
>             speex_decoder_ctl(destate, SPEEX_SET_ENH, &tmp);
> 
>             return true;
> 
> }
> 
> void CMMediaObj::AmrFreeMemory()
> 
> {
> 
>             if (destate){
> 
>                         speex_bits_destroy(&bits);
> 
>                         speex_decoder_destroy(destate);
> 
>             }
> 
> }
> 
> #define FRAME_SIZE 320
> 
> int CMMediaObj::AmrDecodeOneFrame(char *src,char *dst)
> 
> {
> 
>             speex_bits_read_from(&bits, src, 14);
> 
>             speex_decode_int(destate, &bits, (short*)dst);
> 
>             return FRAME_SIZE;
> 
> }
> 
>  
> 
> My problem is that I hear only strange sound. I receive packet of 14
> bytes for each frame and I call AmrDecodeOneFrame for each frame. Then
> 14 bytes amr packet should be 320 bytes uncompress data.
> speex_decode_int return 0 then good result.
> 
> Where is the problem ????
> 
>  
> 
> Thanks
> 
> Stefano
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Speex-dev mailing list
> Speex-dev at xiph.org
> http://lists.xiph.org/mailman/listinfo/speex-dev


More information about the Speex-dev mailing list