[speex-dev] testenc and snr calculation

Jean-Marc Valin Jean-Marc.Valin at USherbrooke.ca
Mon Sep 1 14:31:49 PDT 2003

Actually, the SNR calculation in testenc has been broken for a while.
The reason for taking the last frame was that the codec would introduce
a one-frame latency. I changed that to half a frame (10 ms) a while ago
and never updated testenc.


Le lun 01/09/2003 à 13:12, Mike Dunn a écrit :
> Hi all,
> I'm new to the group.  I'm looking at the speex code with an eye towards 
> maybe helping out with either codec optimization or fixed-point 
> implementation,  The SNR calculation in testenc.c and testenc_uwb.c 
> doesn't make sense to me.  The code is
>       {
>          float enoise=0, esig=0, snr;
>          for (i=0;i<FRAME_SIZE;i++)
>          {
>             enoise+=(bak2[i]-input[i])*(bak2[i]-input[i]);
>             esig += bak2[i]*bak2[i];
>          }
>          snr = 10*log10((esig+1)/(enoise+1));
>          printf ("real SNR = %f\n", snr);
>       }
> But what I see from the rest of the code is that bak2[] contains the 
> previous input frame, and input[] contains the current input frame.  So 
> each enoise calculation is the square of the difference between input 
> sample from the last frame and the current frame???
> I have the latest version from CVS.  I think this code has changed in 
> the past few months, because I see different code in Christian Buchner's 
> modified code, downloaded from his site at openacm.org.
> Hope this question isn't too dumb  :-)
> Thanks,
> Mike Dunn
> --- >8 ----
> List archives:  http://www.xiph.org/archives/
> Ogg project homepage: http://www.xiph.org/ogg/
> To unsubscribe from this list, send a message to 'speex-dev-request at xiph.org'
> containing only the word 'unsubscribe' in the body.  No subject is needed.
> Unsubscribe messages sent to the list will be ignored/filtered.

Jean-Marc Valin, M.Sc.A., ing. jr.
LABORIUS (http://www.gel.usherb.ca/laborius)
Université de Sherbrooke, Québec, Canada

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 190 bytes
Desc: Ceci est une partie de message numériquement signée
Url : http://lists.xiph.org/pipermail/speex-dev/attachments/20030901/37c226ae/signature.pgp

More information about the Speex-dev mailing list