Hi Aymeric,
I actually fixed that problem in svn only a couple hours before you sent
your email. You can either update to svn or simply make this:
qual += .3*log(.001+ener/60000.0);
Jean-Marc
Le mardi 14 f?vrier 2006 ? 17:20 +0100, Aymeric Moizard a ?crit
:> Hi Jean-Marc,
>
> I used the following code after init of the encoder to
> get the frame size of my RTP packets.
>
> char pcm_data[3200];
> char speex_data[3200];
> SpeexBits bits;
> memset(pcm_data, '\0', 3200);
> memset(speex_data, '\0', 3200);
> speex_bits_init(&bits);
> speex_bits_reset(&bits);
> speex_encode_int(codec_info->enc, (short*)pcm_data, &bits);
> codec->enc_frame_size = speex_bits_write(&bits, speex_data,
frame_size);
>
> I never run into problems using either speex on linux or windows until one
> used my dll and speex through delphi on windows: he gets division by zero.
>
> I found that "ener" is 0 around line 253: (version 1.1.11)
>
> if (ener<60000)
> {
> if (vbr->consec_noise>2)
> qual-=0.5*(log(3.0 + vbr->consec_noise)-log(3));
> if (ener<10000&&vbr->consec_noise>2)
> qual-=0.5*(log(3.0 + vbr->consec_noise)-log(3));
> if (qual<0)
> qual=0;
>
> qual += .3*log(ener/60000.0);
> }
>
> I think this is a side effect of the fact that my pcm_data is
> initialized to '\0'....
>
> I have no fix except something like: (which is working!)
>
> if (ener!=0) qual += .3*log(ener/60000.0);
>
> I still don't understand why this seems to happen only when
> running inside a delphi program...
>
> I hope to get a better fix!
> Thanks for all.
>
> Aymeric
> http://www.antisip.com
> http://sip.antisip.com -- Free Telephony account.
>
>
> _______________________________________________
> Speex-dev mailing list
> Speex-dev@xiph.org
> http://lists.xiph.org/mailman/listinfo/speex-dev
>