Re: [linux-audio-dev] Converting float to int

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

Subject: Re: [linux-audio-dev] Converting float to int
From: Erik de Castro Lopo (erikd_AT_mega-nerd.com)
Date: Mon Oct 29 2001 - 22:22:57 EET


It really blew my mind when "Daniel V." <dvenkita_AT_ecel.uwa.edu.au> said:

> Hi all. I know this has been answered before but I can't find the post :(
> Anyway, the problem is I have a buffer of audio represented as floats [-1,+1]
> that I want to convert to signed shorts for writing to my card. I recall
> there is an efficient way of doing this, and an inefficient way. Can someone
> remind me with a snippet of code?

I am currently writing a paper on exactly this topic. It should be
up on my web site by the end of the week:

    http://mega-nerd.com/FPcast/

I have benchmarked this and achieved speed improvements on Pentium II, P III
and AMD Athlon processors of 6-10 times.

The benchmarking code will be made available for independant verification. Also
included is a cross platform header file so that similar speed improvements can
be achieved on Win32. If I had access to a Mac system I would like to add
support for that as well.

Erik

-- 
+-----------------------------------------------------------+
  Erik de Castro Lopo  nospam_AT_mega-nerd.com (Yes it's valid)
+-----------------------------------------------------------+
Beware the Lollipop of Mediocrity.
Lick it once, and you suck forever.


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

This archive was generated by hypermail 2b28 : Mon Oct 29 2001 - 22:19:16 EET