arccos and arctan approximation

For my thesis, I am implementing the 2.4 kbps MELP algorithm in assembly. One subroutine in that algorithm is the conversion of LPC coefficients to their LSF counterparts. In my implementation, I used Chebyshev polynomials, proposed by Peter Kabal and Ravi Prakash Ramachandran. Part of this method is to compute for Error: http://www.daejavu.com/wp-content/plugins/wpmathpub/phpmathpublisher/img/ must have write access Read the official wpmathpub plugin FAQ for more details, thus giving the radian frequencies.

I was looking for a closed-form equation or an algorithm that computes for Error: http://www.daejavu.com/wp-content/plugins/wpmathpub/phpmathpublisher/img/ must have write access Read the official wpmathpub plugin FAQ for more details but I wasn’t able to find one in the internet… (maybe its just me being not very good at finding stuff I need in the internet). But anyways, I realized that Matlab has a documentation on all its functions and acos is one of those functions. Here’s a bit of what is in the Matlab’s documentation on the function acos (click on Help button or type doc acos):

Error: http://www.daejavu.com/wp-content/plugins/wpmathpub/phpmathpublisher/img/ must have write access Read the official wpmathpub plugin FAQ for more details

And I thought, good, cos I already have a code for log approximation. And then I saw the imaginary part in the log, and I honestly don’t know how to compute for Error: http://www.daejavu.com/wp-content/plugins/wpmathpub/phpmathpublisher/img/ must have write access Read the official wpmathpub plugin FAQ for more details. But having Matlab to my rescue, here’s what I got:

Error: http://www.daejavu.com/wp-content/plugins/wpmathpub/phpmathpublisher/img/ must have write access Read the official wpmathpub plugin FAQ for more details

The input to the acos function was any number Error: http://www.daejavu.com/wp-content/plugins/wpmathpub/phpmathpublisher/img/ must have write access Read the official wpmathpub plugin FAQ for more details. I let Error: http://www.daejavu.com/wp-content/plugins/wpmathpub/phpmathpublisher/img/ must have write access Read the official wpmathpub plugin FAQ for more details and Error: http://www.daejavu.com/wp-content/plugins/wpmathpub/phpmathpublisher/img/ must have write access Read the official wpmathpub plugin FAQ for more details and then I used these values in the computation of Error: http://www.daejavu.com/wp-content/plugins/wpmathpub/phpmathpublisher/img/ must have write access Read the official wpmathpub plugin FAQ for more details. Good thing was that Error: http://www.daejavu.com/wp-content/plugins/wpmathpub/phpmathpublisher/img/ must have write access Read the official wpmathpub plugin FAQ for more details which zeros out the first log term and all I had to worry about was the atan2 function. Basically, atan2 computes for Error: http://www.daejavu.com/wp-content/plugins/wpmathpub/phpmathpublisher/img/ must have write access Read the official wpmathpub plugin FAQ for more details. And thank goodness, there is a closed-form approximation for Error: http://www.daejavu.com/wp-content/plugins/wpmathpub/phpmathpublisher/img/ must have write access Read the official wpmathpub plugin FAQ for more details. For any value w, Error: http://www.daejavu.com/wp-content/plugins/wpmathpub/phpmathpublisher/img/ must have write access Read the official wpmathpub plugin FAQ for more details, Error: http://www.daejavu.com/wp-content/plugins/wpmathpub/phpmathpublisher/img/ must have write access Read the official wpmathpub plugin FAQ for more details is computed using the equation below:

Error: http://www.daejavu.com/wp-content/plugins/wpmathpub/phpmathpublisher/img/ must have write access Read the official wpmathpub plugin FAQ for more detailsError: http://www.daejavu.com/wp-content/plugins/wpmathpub/phpmathpublisher/img/ must have write access Read the official wpmathpub plugin FAQ for more details

Error: http://www.daejavu.com/wp-content/plugins/wpmathpub/phpmathpublisher/img/ must have write access Read the official wpmathpub plugin FAQ for more detailsError: http://www.daejavu.com/wp-content/plugins/wpmathpub/phpmathpublisher/img/ must have write access Read the official wpmathpub plugin FAQ for more details.

If Error: http://www.daejavu.com/wp-content/plugins/wpmathpub/phpmathpublisher/img/ must have write access Read the official wpmathpub plugin FAQ for more details, Error: http://www.daejavu.com/wp-content/plugins/wpmathpub/phpmathpublisher/img/ must have write access Read the official wpmathpub plugin FAQ for more details. These equations were taken from the ADSP User Manual, Chapter 4 on Function Approximation. Lastly, using the tangent’s odd symmetric property, Error: http://www.daejavu.com/wp-content/plugins/wpmathpub/phpmathpublisher/img/ must have write access Read the official wpmathpub plugin FAQ for more details.

After knowing all these equations, I now have a working Error: http://www.daejavu.com/wp-content/plugins/wpmathpub/phpmathpublisher/img/ must have write access Read the official wpmathpub plugin FAQ for more details approximation in assembly! ;)



?>