Re: Canonical format max amp limits?
Re: Canonical format max amp limits?
- Subject: Re: Canonical format max amp limits?
- From: Brian Willoughby <email@hidden>
- Date: Wed, 14 Jul 2004 03:38:32 -0700
I forgot to point out one key thing regarding that last bit (see below).
I have not seen the source code to the AudioConverter, but I can guarantee you
that it is not a single loop of generic code that attempts to handle
everything. Apple is undoubtedly checking the input and output formats and
selecting from many specially optimized loops for each type of conversion.
Upon rereading your message, I realized that you might be concerned about how
inefficient it would be to do a simple conversion with generic code, but the
AudioConverter is smarter than that :-)
Brian
Begin message excerpt:
[ Since CoreAudio provides a generic conversion from one format to
[ another, would it not be simpler if you could tell ahead of time the
[ formats between which you were converting and if they required a simple
[ 16 bit int to 32 bit float conversion like this to simply do it
[ yourself? If the formats don't match the ones you expected then you
[ could go ahead and use the AudioConverter.
It's actually simpler to just always use the AudioConverter.
The DIY method requires that you learn a lot about optimization, and there's
no reason to believe that you'll do a better job than Apple. For example, your
code uses the C language ?: operator, which is equivalent to an if-else
construct, which really messes up the instruction cache. Your code is already
slower than the AudioConverter for that reason alone, not to mention that some
manual unrolling, or use of non-standard compiler options, is needed for top
speed. Add to all the above the fact that AltiVec optimization is not fully
automatic, and that takes performance to an entirely higher level if you know
how to write AltiVec code.
In other words, what you suggest would be a great learning opportunity, but it
is not recommended.
Brian Willoughby
Sound Consulting
_______________________________________________
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.