dsp_types.h File Reference
#include "compiler.h"
#include "preprocessor.h"

## Data Structures

struct  dsp16_complex_t
16-bit complex signed fixed point type More...

struct  dsp32_complex_t
32-bit complex signed fixed point type More...

## Macros

#define A_ALIGNED   __attribute__ ((aligned(4)))
Alignment attribute on 4 bytes for 32-bit or lower microcontroller optimization for GCC compiler. More...

#define A_PACKED   __attribute__ ((__packed__))
Packed data attribute for GCC compiler. More...

#define CST_E   2.718281828459045235360287471352662497757
E definition also known as the natural logarithmic base. More...

#define CST_INV_SQUARE_ROOT_2   0.70710678118654752440084436210485
1/sqrt(2) definition More...

#define CST_LN_10   2.3025850929940456840179914546844
ln(10) definition More...

#define CST_LN_2   0.69314718055994530941723212145818
ln(2) definition More...

#define CST_PI   3.141592653589793238462643383279502884197
PI definition also known as the Archimedes' constant. More...

#define CST_SQUARE_ROOT_2   1.4142135623730950488016887242097
sqrt(2) definition More...

#define DSP16_PI_DIV_4   DSP16_Q(CST_PI/4.)
PI/4 definition for the 16-bit fixed point type. More...

#define dsp16_t__   S16
16-bit signed fixed point type More...

#define DSP32_PI_DIV_4   DSP32_Q(CST_PI/4.)
PI/4 definition for the 32-bit fixed point type. More...

#define dsp32_t__   S32
32-bit signed fixed point type More...

#define FALSE   0
Boolean FALSE constant. More...

#define TRUE   1
Boolean TRUE constant. More...

Q Format definition for the 16-bit type
Note
The 16-bit functions are optimized to work with a Q1.15 format:
Resolution: 0.00003
Range: [-1.; 0.99997]
#define DSP16_QA   1
number of integer bits More...

#define DSP16_QB   15
number of fractional bits More...

Q Format definition for the 32-bit type
Note
The 32-bit functions are optimized to work with a Q1.31 format:
Resolution: 0.00000000047
Range: [-1.; 0.99999999953]
#define DSP32_QA   1
number of integer bits More...

#define DSP32_QB   31
number of fractional bits More...

Limit values in floating-point format of a signed fixed-point number typed Qa.b
#define DSP_FP_MAX(a, b)   (((float) (1 << ((a)-1))) - DSP_FP_RES(a, b))
Return the maximal value of a fixed-point Qa.b typed number. The result is returned as a floating point number. More...

#define DSP_FP_MIN(a, b)   (-((float) (1 << ((a)-1))))
Return the minimal value of a fixed-point Qa.b typed number. The result is returned as a floating point number. More...

Limit values in fixed-point format of a signed fixed-point number typed Qa.b
#define DSP_Q_MAX(a, b)   ((S32) (((U32) -1) >> (32 - ((a)+(b)-1))))
Return the maximal value of a fixed-point Qa.b typed number. More...

#define DSP_Q_MIN(a, b)   ((S32) ((-1) << ((a)+(b)-1)))
Return the minimal value of a fixed-point Qa.b typed number. More...

Resolution in floating-point format of a signed fixed-point number typed Qa.b
#define DSP_FP_RES(a, b)   (1./((unsigned) (1 << (b))))
Return the resolution of a fixed-point Qa.b typed number. More...

Convertion macro from a float to a Q Formated value
Note
These macros limit the number in its range
#define DSP_Q(a, b, fnum)
Convert a float into a signed fixed-point typed Qa.b. More...

#define DSP16_Q(fnum)   ((dsp16_t__) DSP_Q(DSP16_QA, DSP16_QB, fnum))
Convert a float into a 16-bit signed fixed-point type. More...

#define DSP32_Q(fnum)   ((dsp32_t__) DSP_Q(DSP32_QA, DSP32_QB, fnum))
Convert a float into a 32-bit signed fixed-point type. More...

## Typedefs

typedef struct A_PACKED
dsp16_complex_t
dsp16_complex_t
16-bit complex signed fixed point type More...

typedef dsp16_t__ dsp16_t
16-bit signed fixed point type optimized for 32-bit or lower microcontrollers More...

typedef struct A_PACKED
dsp32_complex_t
dsp32_complex_t
32-bit complex signed fixed point type More...

typedef dsp32_t__ dsp32_t
32-bit signed fixed point type optimized for 32-bit or lower microcontrollers More...

 #define A_ALIGNED   __attribute__ ((aligned(4)))

Alignment attribute on 4 bytes for 32-bit or lower microcontroller optimization for GCC compiler.

Referenced by generate_input_signal(), and mfcc_fft_512pts().

 #define A_PACKED   __attribute__ ((__packed__))

Packed data attribute for GCC compiler.