Operators
[Basic]


Detailed Description

All the fixed point operators functions currently implemented in the DSP library.

Multiplication

These functions multiply two fixed-point numbers.

Relative functions:


Division

These functions divide two fixed-point numbers. Relative functions:


Sine

These functions compute the sine of the argument 'angle'.
Note:
Angle is scaled to fit in the range [-1; 1], where -1 corresponds to -pi and 1 to pi.
Relative functions:


Cosine

These functions compute the cosine of the argument 'angle'. Angles are scale to fit in the range [-1; 1], where -1 corresponds to -pi and 1 to pi. Relative functions:


Arc sine

These functions compute the arc sine of the argument.
Note:
The output is scaled to fit in the range [-0.5; 0.5], where -0.5 corresponds to -pi/2 and 0.5 to pi/2.
Relative functions:


Arc cosine

These functions compute the arc cosine of the argument.
Note:
The output is scaled to fit in the range [0.; 1.], where 0. corresponds to 0. and 1. to pi.
Relative functions:


Absolute

These functions compute the absolute value of the argument. Relative functions:


Square root

These functions compute the square root of the argument. Relative functions:


Natural logarithm

These functions compute the natural logarithm of the argument. Relative functions:

Note:
The output will be limit in the range of the fixed point format used.

Binary logarithm or base 2 logarithm

These functions compute the binary logarithm of the argument.
Note:
The output will be limit in the range of the fixed point format used.
Relative functions:


Common logarithm or base 10 logarithm

These functions compute the common logarithm of the argument.
Note:
The output will be limit in the range of the fixed point format used.
Relative functions:


Exponential

These functions compute the exponential of the argument.
Note:
The output will be limit in the range of the fixed point format used.
Relative functions:


Power

These functions compute x^y.
Note:
The output will be limit in the range of the fixed point format used.
Relative functions:


Random

These functions generate a pseudo-radomized number Relative functions:


Benchmark on the AT32UC targets



Functions

static dsp16_t dsp16_op_abs (dsp16_t number)
 16-bit fixed point version of the absolute function.
static dsp16_t dsp16_op_acos (dsp16_t number)
 16-bit fixed point version of the arc cosine function.
dsp16_t dsp16_op_asin (dsp16_t number)
 16-bit fixed point version of the arc sine function.
static dsp16_t dsp16_op_cos (dsp16_t angle)
 16-bit fixed point version of the cosine function.
static dsp16_t dsp16_op_div (dsp16_t num, dsp16_t den)
 16-bit fixed point version of the division function.
dsp16_t dsp16_op_exp (dsp16_t number)
 16-bit fixed point version of the exponential function.
dsp16_t dsp16_op_ln (dsp16_t number)
 16-bit fixed point version of the natural logarithm function.
dsp16_t dsp16_op_log10 (dsp16_t number)
 16-bit fixed point version of the common logarithm function.
dsp16_t dsp16_op_log2 (dsp16_t number)
 16-bit fixed point version of the binary logarithm function.
static dsp16_t dsp16_op_mul (dsp16_t num1, dsp16_t num2)
 16-bit fixed point version of the multiplication function.
dsp16_t dsp16_op_pow (dsp16_t x, dsp16_t y)
 16-bit fixed point version of the power function.
dsp16_t dsp16_op_rand ()
 16-bit fixed point version of the random operator.
dsp16_t dsp16_op_sin (dsp16_t angle)
 16-bit fixed point version of the sine function.
dsp16_t dsp16_op_sqrt (dsp16_t number)
 16-bit fixed point version of the square root function.
static dsp32_t dsp32_op_abs (dsp32_t number)
 32-bit fixed point version of the absolute function.
static dsp32_t dsp32_op_acos (dsp32_t number)
 32-bit fixed point version of the arc cosine function.
dsp32_t dsp32_op_asin (dsp32_t number)
 32-bit fixed point version of the arc sine function.
static dsp32_t dsp32_op_cos (dsp32_t angle)
 32-bit fixed point version of the cosine function.
static dsp32_t dsp32_op_div (dsp32_t num, dsp32_t den)
 32-bit fixed point version of the division function.
dsp32_t dsp32_op_exp (dsp32_t number)
 32-bit fixed point version of the exponential function.
dsp32_t dsp32_op_ln (dsp32_t number)
 32-bit fixed point version of the natural logarithm function.
dsp32_t dsp32_op_log10 (dsp32_t number)
 32-bit fixed point version of the common logarithm function.
dsp32_t dsp32_op_log2 (dsp32_t number)
 32-bit fixed point version of the binary logarithm function.
static dsp32_t dsp32_op_mul (dsp32_t num1, dsp32_t num2)
 32-bit fixed point version of the multiplication function.
dsp32_t dsp32_op_pow (dsp32_t x, dsp32_t y)
 32-bit fixed point version of the power function.
dsp32_t dsp32_op_rand ()
 32-bit fixed point version of the random operator.
dsp32_t dsp32_op_sin (dsp32_t angle)
 32-bit fixed point version of the sine function.
dsp32_t dsp32_op_sqrt (dsp32_t number)
 32-bit fixed point version of the square root function.
void dsp_op_srand (int new_seed)
 Initialize the pseudo-random number generator.


Function Documentation

static dsp16_t dsp16_op_abs ( dsp16_t  number  )  [inline, static]

16-bit fixed point version of the absolute function.

Parameters:
number The number to compute
Returns:
The absolute value of the number.

Definition at line 267 of file dsp_operators.h.

00267 { return (number < 0)?-number:number; }

static dsp16_t dsp16_op_acos ( dsp16_t  number  )  [inline, static]

16-bit fixed point version of the arc cosine function.

Parameters:
number The number to compute
Returns:
The arc cosine of 'number' is returned.
Note:
If you are using a number greater than 1 (or lower than -1) for the 'number', the function will limit the output to the range [0.; 1.].

Definition at line 240 of file dsp_operators.h.

References dsp16_op_asin(), and DSP16_Q.

00240 { return (DSP16_Q(0.5)-1) - dsp16_op_asin(number); }

dsp16_t dsp16_op_asin ( dsp16_t  number  ) 

16-bit fixed point version of the arc sine function.

Parameters:
number The number to compute
Returns:
The arc sine of 'number' is returned.
Note:
If you are using a number greater than 1 (or lower than -1) for the 'number', the function will limit the output to the range [-0.5; 0.5].

Referenced by dsp16_op_acos().

static dsp16_t dsp16_op_cos ( dsp16_t  angle  )  [inline, static]

16-bit fixed point version of the cosine function.

Parameters:
angle The angle to compute
Returns:
The cosine of 'angle' is returned.
Note:
If you are using a number greater than 1 (or lower than -1) for the angle, the function will take the modulo 1 of this angle.

Definition at line 178 of file dsp_operators.h.

References dsp16_op_sin(), and DSP16_Q.

00178 { return dsp16_op_sin(angle + DSP16_Q(0.5)); }

static dsp16_t dsp16_op_div ( dsp16_t  num,
dsp16_t  den 
) [inline, static]

16-bit fixed point version of the division function.

Parameters:
num The numerator of the division.
den The denominator of the division.
Returns:
The result of the division.

Definition at line 118 of file dsp_operators.h.

References DSP16_QB.

00118 { return (dsp16_t) ((((S32) num) << DSP16_QB)/((S32) den)); }

dsp16_t dsp16_op_exp ( dsp16_t  number  ) 

16-bit fixed point version of the exponential function.

Parameters:
number The number to compute
Returns:
The exponential of 'number' is returned.

dsp16_t dsp16_op_ln ( dsp16_t  number  ) 

16-bit fixed point version of the natural logarithm function.

Parameters:
number The number to compute
Returns:
The natural logarithm of 'number' is returned.
Note:
If you are using a number lower than 0 for the number, the function will return DSP_Q_MIN(DSP16_QA, DSP16_QB).

dsp16_t dsp16_op_log10 ( dsp16_t  number  ) 

16-bit fixed point version of the common logarithm function.

Parameters:
number The number to compute
Returns:
The common logarithm of 'number' is returned.
Note:
If you are using a number lower than 0 for the number, the function will return DSP_Q_MIN(DSP16_QA, DSP16_QB).

dsp16_t dsp16_op_log2 ( dsp16_t  number  ) 

16-bit fixed point version of the binary logarithm function.

Parameters:
number The number to compute
Returns:
The binary logarithm of 'number' is returned.
Note:
If you are using a number lower than 0 for the number, the function will return DSP_Q_MIN(DSP16_QA, DSP16_QB).

static dsp16_t dsp16_op_mul ( dsp16_t  num1,
dsp16_t  num2 
) [inline, static]

16-bit fixed point version of the multiplication function.

Parameters:
num1 The first member of the multiplication.
num2 The second member of the multiplication.
Returns:
The result of the multiplication.

Definition at line 91 of file dsp_operators.h.

References DSP16_QB.

00091 { return (dsp16_t) ((((S32) num1)*((S32) num2)) >> DSP16_QB); }

dsp16_t dsp16_op_pow ( dsp16_t  x,
dsp16_t  y 
)

16-bit fixed point version of the power function.

Parameters:
x The number from which the power has to be applied.
y The power.
Returns:
The x power y is returned.

DSP_Q_MIN if the argument x is negative: this would result in a complex number.

dsp16_t dsp16_op_rand (  ) 

16-bit fixed point version of the random operator.

Returns:
The cosine of 'angle' is returned.
Note:
The number generated can be any 16-bit value in the range [-1; 1[.

dsp16_t dsp16_op_sin ( dsp16_t  angle  ) 

16-bit fixed point version of the sine function.

Parameters:
angle The angle to compute
Returns:
The sine of 'angle' is returned.
Note:
If you are using a number greater than 1 (or lower than -1) for the angle, the function will take the modulo 1 of this angle.

Referenced by dsp16_op_cos().

dsp16_t dsp16_op_sqrt ( dsp16_t  number  ) 

16-bit fixed point version of the square root function.

Parameters:
number The number to compute
Returns:
The square root of 'number' is returned.
Note:
If you are using a number lower than 0 for the number, the function will return 0.

static dsp32_t dsp32_op_abs ( dsp32_t  number  )  [inline, static]

32-bit fixed point version of the absolute function.

Parameters:
number The number to compute
Returns:
The absolute value of the number.

Definition at line 273 of file dsp_operators.h.

00273 { return (number < 0)?-number:number; }

static dsp32_t dsp32_op_acos ( dsp32_t  number  )  [inline, static]

32-bit fixed point version of the arc cosine function.

Parameters:
number The number to compute
Returns:
The arc cosine of 'number' is returned.
Note:
If you are using a number greater than 1 (or lower than -1) for the 'number', the function will limit the output to the range [0.; 1.].

Definition at line 248 of file dsp_operators.h.

References dsp32_op_asin(), and DSP32_Q.

00248 { return (DSP32_Q(0.5)-1) - dsp32_op_asin(number); }

dsp32_t dsp32_op_asin ( dsp32_t  number  ) 

32-bit fixed point version of the arc sine function.

Parameters:
number The number to compute
Returns:
The arc sine of 'number' is returned.
Note:
If you are using a number greater than 1 (or lower than -1) for the 'number', the function will limit the output to the range [-0.5; 0.5].

Referenced by dsp32_op_acos().

static dsp32_t dsp32_op_cos ( dsp32_t  angle  )  [inline, static]

32-bit fixed point version of the cosine function.

Parameters:
angle The angle to compute
Returns:
The cosine of 'angle' is returned.
Note:
If you are using a number greater than 1 (or lower than -1) for the angle, the function will take the modulo 1 of this angle.

Definition at line 186 of file dsp_operators.h.

References dsp32_op_sin(), and DSP32_Q.

00186 { return dsp32_op_sin(angle + DSP32_Q(0.5)); }

static dsp32_t dsp32_op_div ( dsp32_t  num,
dsp32_t  den 
) [inline, static]

32-bit fixed point version of the division function.

Parameters:
num The numerator of the division.
den The denominator of the division.
Returns:
The result of the division.

Definition at line 125 of file dsp_operators.h.

References DSP32_QB.

00125 { return (dsp32_t) ((((S64) num) << DSP32_QB)/((S64) den)); }

dsp32_t dsp32_op_exp ( dsp32_t  number  ) 

32-bit fixed point version of the exponential function.

Parameters:
number The number to compute
Returns:
The exponential of 'number' is returned.

dsp32_t dsp32_op_ln ( dsp32_t  number  ) 

32-bit fixed point version of the natural logarithm function.

Parameters:
number The number to compute
Returns:
The natural logarithm of 'number' is returned.
Note:
If you are using a number lower than 0 for the number, the function will return DSP_Q_MIN(DSP32_QA, DSP32_QB).

dsp32_t dsp32_op_log10 ( dsp32_t  number  ) 

32-bit fixed point version of the common logarithm function.

Parameters:
number The number to compute
Returns:
The common logarithm of 'number' is returned.
Note:
If you are using a number lower than 0 for the number, the function will return DSP_Q_MIN(DSP32_QA, DSP32_QB).

dsp32_t dsp32_op_log2 ( dsp32_t  number  ) 

32-bit fixed point version of the binary logarithm function.

Parameters:
number The number to compute
Returns:
The binary logarithm of 'number' is returned.
Note:
If you are using a number lower than 0 for the number, the function will return DSP_Q_MIN(DSP32_QA, DSP32_QB).

static dsp32_t dsp32_op_mul ( dsp32_t  num1,
dsp32_t  num2 
) [inline, static]

32-bit fixed point version of the multiplication function.

Parameters:
num1 The first member of the multiplication.
num2 The second member of the multiplication.
Returns:
The result of the multiplication.

Definition at line 98 of file dsp_operators.h.

References DSP32_QB.

00098 { return (dsp32_t) ((((S64) num1)*((S64) num2)) >> DSP32_QB); }

dsp32_t dsp32_op_pow ( dsp32_t  x,
dsp32_t  y 
)

32-bit fixed point version of the power function.

Parameters:
x The number from which the power has to be applied.
y The power.
Returns:
The x power y is returned.

DSP_Q_MIN if the argument x is negative: this would result in a complex number.

dsp32_t dsp32_op_rand (  ) 

32-bit fixed point version of the random operator.

Returns:
The cosine of 'angle' is returned.
Note:
The number generated can be any 32-bit value in the range [-1; 1[.

dsp32_t dsp32_op_sin ( dsp32_t  angle  ) 

32-bit fixed point version of the sine function.

Parameters:
angle The angle to compute
Returns:
The sine of 'angle' is returned.
Note:
If you are using a number greater than 1 (or lower than -1) for the angle, the function will take the modulo 1 of this angle.

Referenced by dsp32_op_cos().

dsp32_t dsp32_op_sqrt ( dsp32_t  number  ) 

32-bit fixed point version of the square root function.

Parameters:
number The number to compute
Returns:
The square root of 'number' is returned.
Note:
If you are using a number lower than 0 for the number, the function will return 0.

void dsp_op_srand ( int  new_seed  ) 

Initialize the pseudo-random number generator.

Parameters:
new_seed An integer value to be used as seed by the pseudo-random number generator algorithm.


Generated on Fri Feb 19 02:28:00 2010 for AVR32 - Fixed point DSP Library by  doxygen 1.5.5