Microchip® Advanced Software Framework

arm_signal_converge_example/math_helper.c File Reference
#include <math.h>
#include "math_helper.h"

Functions

void arm_apply_guard_bits (float32_t *pIn, uint32_t numSamples, uint32_t guard_bits)
 Converts Q15 to floating-point. More...
 
uint32_t arm_calc_2pow (uint32_t numShifts)
 Calculates pow(2, numShifts) More...
 
uint32_t arm_calc_guard_bits (uint32_t num_adds)
 Caluclates number of guard bits. More...
 
void arm_clip_f32 (float *pIn, uint32_t numSamples)
 Clip the float values to +/- 1. More...
 
uint32_t arm_compare_fixed_q15 (q15_t *pIn, q15_t *pOut, uint32_t numSamples)
 Compare MATLAB Reference Output and ARM Test output. More...
 
uint32_t arm_compare_fixed_q31 (q31_t *pIn, q31_t *pOut, uint32_t numSamples)
 Compare MATLAB Reference Output and ARM Test output. More...
 
void arm_float_to_q12_20 (float *pIn, q31_t *pOut, uint32_t numSamples)
 Converts float to fixed in q12.20 format. More...
 
void arm_float_to_q14 (float *pIn, q15_t *pOut, uint32_t numSamples)
 Converts float to fixed q14. More...
 
void arm_float_to_q28 (float *pIn, q31_t *pOut, uint32_t numSamples)
 Converts float to fixed q28 format. More...
 
void arm_float_to_q29 (float *pIn, q31_t *pOut, uint32_t numSamples)
 Converts float to fixed q30 format. More...
 
void arm_float_to_q30 (float *pIn, q31_t *pOut, uint32_t numSamples)
 Converts float to fixed q30 format. More...
 
void arm_provide_guard_bits_q15 (q15_t *input_buf, uint32_t blockSize, uint32_t guard_bits)
 Provide guard bits for Input buffer. More...
 
void arm_provide_guard_bits_q31 (q31_t *input_buf, uint32_t blockSize, uint32_t guard_bits)
 Provide guard bits for Input buffer. More...
 
void arm_provide_guard_bits_q7 (q7_t *input_buf, uint32_t blockSize, uint32_t guard_bits)
 Provide guard bits for Input buffer. More...
 
float arm_snr_f32 (float *pRef, float *pTest, uint32_t buffSize)
 Caluclation of SNR. More...
 

void arm_apply_guard_bits ( float32_t *  pIn,
uint32_t  numSamples,
uint32_t  guard_bits 
)

Converts Q15 to floating-point.

Parameters
uint32_tnumber of samples in the buffer
Returns
none

References arm_calc_2pow().

uint32_t arm_calc_2pow ( uint32_t  numShifts)

Calculates pow(2, numShifts)

Parameters
uint32_tnumber of shifts
Returns
pow(2, numShifts)
uint32_t arm_calc_guard_bits ( uint32_t  num_adds)

Caluclates number of guard bits.

Parameters
uint32_tnumber of additions
Returns
none The function Caluclates the number of guard bits depending on the numtaps
void arm_clip_f32 ( float *  pIn,
uint32_t  numSamples 
)

Clip the float values to +/- 1.

Parameters
pIninput buffer
numSamplesnumber of samples in the buffer
Returns
none The function converts floating point values to fixed point values
uint32_t arm_compare_fixed_q15 ( q15_t *  pIn,
q15_t *  pOut,
uint32_t  numSamples 
)

Compare MATLAB Reference Output and ARM Test output.

Parameters
q15_t*Pointer to Ref buffer
q15_t*Pointer to Test buffer
uint32_tnumber of samples in the buffer
Returns
none
uint32_t arm_compare_fixed_q31 ( q31_t *  pIn,
q31_t *  pOut,
uint32_t  numSamples 
)

Compare MATLAB Reference Output and ARM Test output.

Parameters
q31_t*Pointer to Ref buffer
q31_t*Pointer to Test buffer
uint32_tnumber of samples in the buffer
Returns
none
void arm_float_to_q12_20 ( float *  pIn,
q31_t *  pOut,
uint32_t  numSamples 
)

Converts float to fixed in q12.20 format.

Parameters
uint32_tnumber of samples in the buffer
Returns
none The function converts floating point values to fixed point(q12.20) values
void arm_float_to_q14 ( float *  pIn,
q15_t *  pOut,
uint32_t  numSamples 
)

Converts float to fixed q14.

Parameters
uint32_tnumber of samples in the buffer
Returns
none The function converts floating point values to fixed point values
void arm_float_to_q28 ( float *  pIn,
q31_t *  pOut,
uint32_t  numSamples 
)

Converts float to fixed q28 format.

Parameters
uint32_tnumber of samples in the buffer
Returns
none The function converts floating point values to fixed point values
void arm_float_to_q29 ( float *  pIn,
q31_t *  pOut,
uint32_t  numSamples 
)

Converts float to fixed q30 format.

Parameters
uint32_tnumber of samples in the buffer
Returns
none The function converts floating point values to fixed point values
void arm_float_to_q30 ( float *  pIn,
q31_t *  pOut,
uint32_t  numSamples 
)

Converts float to fixed q30 format.

Parameters
uint32_tnumber of samples in the buffer
Returns
none The function converts floating point values to fixed point values
void arm_provide_guard_bits_q15 ( q15_t *  input_buf,
uint32_t  blockSize,
uint32_t  guard_bits 
)

Provide guard bits for Input buffer.

Parameters
q15_t*Pointer to input buffer
uint32_tblockSize
uint32_tguard_bits
Returns
none The function Provides the guard bits for the buffer to avoid overflow

References blockSize.

void arm_provide_guard_bits_q31 ( q31_t *  input_buf,
uint32_t  blockSize,
uint32_t  guard_bits 
)

Provide guard bits for Input buffer.

Parameters
q31_t*Pointer to input buffer
uint32_tblockSize
uint32_tguard_bits
Returns
none The function Provides the guard bits for the buffer to avoid overflow

References blockSize.

void arm_provide_guard_bits_q7 ( q7_t *  input_buf,
uint32_t  blockSize,
uint32_t  guard_bits 
)

Provide guard bits for Input buffer.

Parameters
q31_t*Pointer to input buffer
uint32_tblockSize
uint32_tguard_bits
Returns
none The function Provides the guard bits for the buffer to avoid overflow

References blockSize.

float arm_snr_f32 ( float *  pRef,
float *  pTest,
uint32_t  buffSize 
)

Caluclation of SNR.

Parameters
float*Pointer to the reference buffer
float*Pointer to the test buffer
uint32_ttotal number of samples
Returns
float SNR The function Caluclates signal to noise ratio for the reference output and test output

References temp.