Re: Asymmetry in CoreAudio representation?
Re: Asymmetry in CoreAudio representation?
- Subject: Re: Asymmetry in CoreAudio representation?
- From: Doug Wyatt <email@hidden>
- Date: Fri, 5 Apr 2002 12:52:48 -0800
On Thursday, April 4, 2002, at 07:08 , Herbie Robinson wrote:
The code in Daisy in incorrect, and your symmetrical version:
*outDataPtr /= 32768.0;
is the correct interpretation.
Just out of curiosity, is the compiler clever enough to go in and
subtract 16 from the exponent in the floating point number when you
write it that way, or does it load the floating point number, do a
hellishly slow floating point divide and then store the number again?
The logic on the chip might be smart enough to do that, but it's
completely out of the domain of the compiler; it's still a floating
point math op.
I would have thought the following to be faster:
short iSample;
float * fSamplep;
*fSamplep = iSample * (1.0/32768.0);
If you understand the format of an IEEE float and look at the code that
the compiler uses to convert an integer to a float, you can discover a
trick with assembly language to insert a free multiplication or division
by any power of two.
Doug
--
Doug Wyatt
work: email@hidden (CoreAudio)
personal: email@hidden
http://www.sonosphere.com
"Am I painting myself into a corner? Or giving myself lines to paint
within?"
-- dsw
_______________________________________________
coreaudio-api mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/coreaudio-api
Do not post admin requests to the list. They will be ignored.