Re: [linux-audio-dev] 64 bit float or integer

New Message Reply About this list Date view Thread view Subject view Author view Other groups

Subject: Re: [linux-audio-dev] 64 bit float or integer
From: Stefan Nitschke (stefan_nitschke_AT_hotmail.com)
Date: Mon May 21 2001 - 15:05:56 EEST


>From: Steve Harris <S.W.Harris_AT_ecs.soton.ac.uk>
>To: linux-audio-dev_AT_ginette.musique.umontreal.ca
>Subject: Re: [linux-audio-dev] 64 bit float or integer
>Date: Mon, 21 May 2001 13:13:57 +0100
>
>On Mon, May 21, 2001 at 11:15:21AM +0200, Jörn Nettingsmeier wrote:
> > Steve Harris wrote:
> > >
> > > You do have to be careful when converting back to int from float, as
> > > soundcard_buffer[i] = (int)(plugin_buffer[i] * 32768.0f) won't do what
>you
> > > want, its incedibly slow too, but thats another story.
> >
> > just out of curiosity, could you give details ?
>
>Well the truncation looses you 1 bit of dynamic range and distorts:
>
>float using cast using round
>-0.000300 -9 -10
>-0.000270 -8 -9
>-0.000240 -7 -8
>-0.000210 -6 -7
>-0.000180 -5 -6
>-0.000150 -4 -5
>-0.000120 -3 -4
>-0.000090 -2 -3
>-0.000060 -1 -2
>-0.000030 0 -1
>-0.000000 0 0
>0.000030 0 1
>0.000060 1 2
>0.000090 2 3
>0.000120 3 4
>0.000150 4 5
>0.000180 5 6
>0.000210 6 7
>0.000240 7 8
>0.000270 8 9
>0.000300 9 10
>
>You can get the round results using:
>
>inline int fi_round(float f) {
> f += (3<<22);
> return *((int*)&f) - 0x4b400000;
>}
>
>But that will return ints, I'm not sure if you could modify it to return
>shorts, but the int to short cast must be cheap.
>
>- Steve

that's right. Anyway who cares for the LSB?
Show me a 16bit A/D converter that has useful information in the LSB. Ok,
for D/A it could but do you hear the difference?

Stefan

_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.


New Message Reply About this list Date view Thread view Subject view Author view Other groups

This archive was generated by hypermail 2b28 : Mon May 21 2001 - 15:29:30 EEST