Zephyr API Documentation 4.4.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches

Convert number representation in Float or Double to Q31/Q15/Q7. More...

Functions

static q7_t zdsp_f32_to_q7_shift (float32_t src, uint32_t m)
 Convert a floating-point (float32_t) value to a Q7 fixed-point value with a right shift.
static q15_t zdsp_f32_to_q15_shift (float32_t src, uint32_t m)
 Convert a floating-point (float32_t) value to a Q15 fixed-point value with a right shift.
static q31_t zdsp_f32_to_q31_shift (float32_t src, uint32_t m)
 Convert a floating-point (float32_t) value to a Q31 fixed-point value with a right shift.
static q7_t zdsp_f64_to_q7_shift (float64_t src, uint32_t m)
 Convert a floating-point (float64_t) value to a Q7 fixed-point value with a right shift.
static q15_t zdsp_f64_to_q15_shift (float64_t src, uint32_t m)
 Convert a floating-point (float64_t) value to a Q15 fixed-point value with a right shift.
static q31_t zdsp_f64_to_q31_shift (float64_t src, uint32_t m)
 Convert a floating-point (float64_t) value to a Q31 fixed-point value with a right shift.

Detailed Description

Convert number representation in Float or Double to Q31/Q15/Q7.

There are separate functions for floating-point, Q7, Q15, and Q31 data types.

Function Documentation

◆ zdsp_f32_to_q15_shift()

q15_t zdsp_f32_to_q15_shift ( float32_t src,
uint32_t m )
inlinestatic

#include <zephyr/dsp/utils.h>

Convert a floating-point (float32_t) value to a Q15 fixed-point value with a right shift.

Parameters
srcThe input floating-point (float32_t) value.
mThe number of bits to right shift the input value (0 to 15).
Returns
The converted Q15 fixed-point value.

◆ zdsp_f32_to_q31_shift()

q31_t zdsp_f32_to_q31_shift ( float32_t src,
uint32_t m )
inlinestatic

#include <zephyr/dsp/utils.h>

Convert a floating-point (float32_t) value to a Q31 fixed-point value with a right shift.

Parameters
srcThe input floating-point (float32_t) value.
mThe number of bits to right shift the input value (0 to 31).
Returns
The converted Q31 fixed-point value.

◆ zdsp_f32_to_q7_shift()

q7_t zdsp_f32_to_q7_shift ( float32_t src,
uint32_t m )
inlinestatic

#include <zephyr/dsp/utils.h>

Convert a floating-point (float32_t) value to a Q7 fixed-point value with a right shift.

Parameters
srcThe input floating-point (float32_t) value.
mThe number of bits to right shift the input value (0 to 7).
Returns
The converted Q7 fixed-point value.

◆ zdsp_f64_to_q15_shift()

q15_t zdsp_f64_to_q15_shift ( float64_t src,
uint32_t m )
inlinestatic

#include <zephyr/dsp/utils.h>

Convert a floating-point (float64_t) value to a Q15 fixed-point value with a right shift.

Parameters
srcThe input floating-point (float64_t) value.
mThe number of bits to right shift the input value (0 to 15).
Returns
The converted Q15 fixed-point value.

◆ zdsp_f64_to_q31_shift()

q31_t zdsp_f64_to_q31_shift ( float64_t src,
uint32_t m )
inlinestatic

#include <zephyr/dsp/utils.h>

Convert a floating-point (float64_t) value to a Q31 fixed-point value with a right shift.

Parameters
srcThe input floating-point (float64_t) value.
mThe number of bits to right shift the input value (0 to 31).
Returns
The converted Q31 fixed-point value.

◆ zdsp_f64_to_q7_shift()

q7_t zdsp_f64_to_q7_shift ( float64_t src,
uint32_t m )
inlinestatic

#include <zephyr/dsp/utils.h>

Convert a floating-point (float64_t) value to a Q7 fixed-point value with a right shift.

Parameters
srcThe input floating-point (float64_t) value.
mThe number of bits to right shift the input value (0 to 7).
Returns
The converted Q7 fixed-point value.