Home : Signal Processing Library | Types, Macros and Basic Math

Description

Fixed-point types and macros, and basic math functions.

Source Files

xsignalproc_common.h Common types, macros and basic math functions
xsignalproc_common.xc  

Source Listings

xsignalproc_common.h

#ifndef XSTREAM_DSP__COMMON__INCLUDED
#define XSTREAM_DSP__COMMON__INCLUDED

#include "xstream_types.h"

typedef struct {xsint real; xsint imag;} xcomplex_t;

// Compile-time floating point constant to signed fixed-point constant conversion.
// Q31 represents the signed fixedpoint format Q1.31, Q28 represents Q3.28, and so-forth.

#define Q31(f) (((f) < 0.0) ? ((int)(2147483648.0 * (f) - 0.5)) : ((int)(2147483647.0 * (f) + 0.5)))
#define Q30(f) (((f) < 0.0) ? ((int)(1073741824.0 * (f) - 0.5)) : ((int)(1073741823.0 * (f) + 0.5)))
#define Q29(f) (((f) < 0.0) ? ((int)( 536870912.0 * (f) - 0.5)) : ((int)( 536870911.0 * (f) + 0.5)))
#define Q28(f) (((f) < 0.0) ? ((int)( 268435456.0 * (f) - 0.5)) : ((int)( 268435455.0 * (f) + 0.5)))
#define Q27(f) (((f) < 0.0) ? ((int)( 134217728.0 * (f) - 0.5)) : ((int)( 134217727.0 * (f) + 0.5)))
#define Q26(f) (((f) < 0.0) ? ((int)(  67108864.0 * (f) - 0.5)) : ((int)(  67108863.0 * (f) + 0.5)))
#define Q25(f) (((f) < 0.0) ? ((int)(  33554432.0 * (f) - 0.5)) : ((int)(  33554431.0 * (f) + 0.5)))

int xstream_dsp__mult_r25x25y25( int x, int y );
int xstream_dsp__mult_r25x25y28( int x, int y );
int xstream_dsp__mult_r25x25y31( int x, int y );
int xstream_dsp__mult_r25x28y25( int x, int y );
int xstream_dsp__mult_r25x28y28( int x, int y );
int xstream_dsp__mult_r25x28y31( int x, int y );
int xstream_dsp__mult_r25x31y25( int x, int y );
int xstream_dsp__mult_r25x31y28( int x, int y );
int xstream_dsp__mult_r25x31y31( int x, int y );
int xstream_dsp__mult_r28x25y25( int x, int y );
int xstream_dsp__mult_r28x25y28( int x, int y );
int xstream_dsp__mult_r28x25y31( int x, int y );
int xstream_dsp__mult_r28x28y25( int x, int y );
int xstream_dsp__mult_r28x28y28( int x, int y );
int xstream_dsp__mult_r28x28y31( int x, int y );
int xstream_dsp__mult_r28x31y25( int x, int y );
int xstream_dsp__mult_r28x31y28( int x, int y );
int xstream_dsp__mult_r28x31y31( int x, int y );
int xstream_dsp__mult_r31x25y25( int x, int y );
int xstream_dsp__mult_r31x25y28( int x, int y );
int xstream_dsp__mult_r31x25y31( int x, int y );
int xstream_dsp__mult_r31x28y25( int x, int y );
int xstream_dsp__mult_r31x28y28( int x, int y );
int xstream_dsp__mult_r31x28y31( int x, int y );
int xstream_dsp__mult_r31x31y25( int x, int y );
int xstream_dsp__mult_r31x31y28( int x, int y );
int xstream_dsp__mult_r31x31y31( int x, int y );

#endif