CMSIS-DSP: math_helper.c File Reference

| CMSIS-DSP Version 1.5.2 CMSIS DSP Software Library

- Main Page
- Usage and Description
- Reference

All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Functions
arm_linear_interp_example/math_helper.c File Reference

## Functions
float | arm_snr_f32 (float *pRef, float *pTest, uint32_t buffSize)
| Caluclation of SNR. 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_float_to_q12_20 (float *pIn, q31_t *pOut, uint32_t numSamples)
| Converts float to fixed in q12.20 format. 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_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...
uint32_t | arm_calc_guard_bits (uint32_t num_adds)
| Caluclates number of guard bits. More...
void | arm_apply_guard_bits (float32_t *pIn, uint32_t numSamples, uint32_t guard_bits)
| Apply guard bits to buffer. More...
uint32_t | arm_calc_2pow (uint32_t numShifts)
| Calculates pow(2, numShifts) More...
void | arm_float_to_q14 (float *pIn, q15_t *pOut, uint32_t numSamples)
| Converts float to fixed q14. More...
void | arm_float_to_q30 (float *pIn, q31_t *pOut, uint32_t numSamples)
| Converts float to fixed q30 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_q28 (float *pIn, q31_t *pOut, uint32_t numSamples)
| Converts float to fixed q28 format. More...
void | arm_clip_f32 (float *pIn, uint32_t numSamples)
| Clip the float values to +/- 1. More...

## Function Documentation

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

Parameters

  [in,out] | pIn | pointer to input buffer
  [in] | numSamples | number of samples in the input buffer
  [in] | guard_bits | guard bits

Returns
  none

References arm_calc_2pow().

uint32_t arm_calc_2pow | ( | uint32_t | numShifts | ) |

Parameters

  [in] | numShifts | number of shifts

Returns
  pow(2, numShifts)

Referenced by arm_apply_guard_bits().

uint32_t arm_calc_guard_bits | ( | uint32_t | num_adds | ) |

Parameters

  [in] | num_adds | number of additions

Returns
  guard bits The function Caluclates the number of guard bits depending on the numtaps

void arm_clip_f32 | ( | float * | pIn,
|  | uint32_t | numSamples
| ) |  |

Parameters

  [in,out] | pIn | input buffer
  [in] | numSamples | number 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
| ) |  |

Parameters

  [in] | pIn | Pointer to Ref buffer
  [in] | pOut | Pointer to Test buffer
  [in] | numSamples | number of samples in the buffer

Returns
  maximum difference

uint32_t arm_compare_fixed_q31 | ( | q31_t * | pIn,
|  | q31_t * | pOut,
|  | uint32_t | numSamples
| ) |  |

Parameters

  [in] | pIn | Pointer to Ref buffer
  [in] | pOut | Pointer to Test buffer
  [in] | numSamples | number of samples in the buffer

Returns
  maximum difference

void arm_float_to_q12_20 | ( | float * | pIn,
|  | q31_t * | pOut,
|  | uint32_t | numSamples
| ) |  |

Parameters

  [in] | pIn | pointer to input buffer
  [out] | pOut | pointer to outputbuffer
  [in] | numSamples | number of samples in the input 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
| ) |  |

Parameters

  [in] | pIn | pointer to input buffer
  [out] | pOut | pointer to output buffer
  [in] | numSamples | number 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
| ) |  |

Parameters

  [in] | pIn | pointer to input buffer
  [out] | pOut | pointer to output buffer
  [in] | numSamples | number 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
| ) |  |

Parameters

  [in] | pIn | pointer to input buffer
  [out] | pOut | pointer to output buffer
  [in] | numSamples | number 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
| ) |  |

Parameters

  [in] | pIn | pointer to input buffer
  [out] | pOut | pointer to output buffer
  [in] | numSamples | number 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
| ) |  |

Parameters

  [in,out] | input_buf | Pointer to input buffer
  [in] | blockSize | block Size
  [in] | guard_bits | guard 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
| ) |  |

Parameters

  [in,out] | input_buf | Pointer to input buffer
  [in] | blockSize | block Size
  [in] | guard_bits | guard 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
| ) |  |

Parameters

  [in,out] | input_buf | Pointer to input buffer
  [in] | blockSize | block Size
  [in] | guard_bits | guard 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
| ) |  |

Parameters

  [in] | pRef | Pointer to the reference buffer
  [in] | pTest | Pointer to the test buffer
  [in] | buffSize | total number of samples

Returns
  SNR The function Caluclates signal to noise ratio for the reference output and test output