discuss-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Discuss-gnuradio] Good sugestions - gr_fast_atan2() and gr_fast_nco


From: Eric Blossom
Subject: Re: [Discuss-gnuradio] Good sugestions - gr_fast_atan2() and gr_fast_nco()
Date: Thu, 7 Jul 2005 12:32:28 -0700
User-agent: Mutt/1.5.6i

On Thu, Jul 07, 2005 at 02:11:28PM -0300, Jose Marcelo Lima Duarte wrote:
> I'm trying to build a costas loop to demodulate a BPSK signal from a 
> non-geostationary satellite. I need to make it work at real 
> time; since our computer can't store all the data during the transmission 
> period. The base band signal has a frequency of 70 kHz.


> In order to make a fast costas loop, I made a fast_atan2() function. I think 
> it would be interesting to include it into the GNU Radio library.
> I create the function following  the instructions of the site below.
> http://www.dspguru.com/comp.dsp/tricks/alg/fxdatan2.htm

Good.  Just out of curiosity, did you benchmark your demodulator code
to determine if atan2 was anywhere near the critical path?


> I would like to know if someone has developed a nco  that use table technique 
> to calculate the sin and -cos? It would be nice to make an gr_fast_nco that 
> find the values of sin and cos in a table instead of calculate them at each 
> nco step.  

See gr_fxpt_nco.h It uses a table lookup plus interpolation strategy
to compute sine and cosine to 16-bits.


BTW, the code below divides by zero when:
  x >= 0 and x == -y  or
  x < 0  and x == y

<soap_box_mode>

    "Premature optimization is the root of all evil" 

         http://en.wikipedia.org/wiki/Talk:C._A._R._Hoare


    Rules for software success:
          * Write test cases first
          * Ensure it computes the right answer for all cases
          * MEASURE PERFORMANCE in your application (oprofile is handy).
          * Then, if it's really a problem (top one or two cycle burners)
            consider making it faster.

</soap_box_mode>

> float fast_atan2( float y, float x){
>  float r, theta;
>  if ( x>=0 ){   // quadrante 1 ou 4
>   r = (x-y) / (x+y);
>   theta = PI4 - PI4 * r;
>   if ( y>=0 )
>    return theta; //quadrante 1
>   else
>    return -theta; //quadrante 4
>  } 
>  else {    // quadrante 2 ou 3
>   r = (x+y) / (x-y); 
>   theta = 3*PI4 - PI4 * r;
>   if ( y>=0 )
>    return theta; // quadrante 2
>   else
>    return -theta; // quadrante 3
>  }
> }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]