Zephyr API 3.6.99
|
Functions | |
void | zdsp_scale_f32 (const float32_t *src, float32_t scale, float32_t *dst, uint32_t block_size) |
Multiplies a floating-point vector by a scalar. | |
void | zdsp_scale_q7 (const q7_t *src, q7_t scale_fract, int8_t shift, q7_t *dst, uint32_t block_size) |
Multiplies a Q7 vector by a scalar. | |
void | zdsp_scale_q15 (const q15_t *src, q15_t scale_fract, int8_t shift, q15_t *dst, uint32_t block_size) |
Multiplies a Q15 vector by a scalar. | |
void | zdsp_scale_q31 (const q31_t *src, q31_t scale_fract, int8_t shift, q31_t *dst, uint32_t block_size) |
Multiplies a Q31 vector by a scalar. | |
DSP_FUNC_SCOPE void | zdsp_scale_f16 (const float16_t *src, float16_t scale, float16_t *dst, uint32_t block_size) |
Multiplies a floating-point vector by a scalar. | |
Multiply a vector by a scalar value. For floating-point data, the algorithm used is:
dst[n] = src[n] * scale, 0 <= n < block_size.
In the fixed-point Q7, Q15, and Q31 functions, scale is represented by a fractional multiplication scale_fract
and an arithmetic shift shift
. The shift allows the gain of the scaling operation to exceed 1.0. The algorithm used with fixed-point data is:
dst[n] = (src[n] * scale_fract) << shift, 0 <= n < block_size.
The overall scale factor applied to the fixed-point data is
scale = scale_fract * 2^shift.
The functions support in-place computation allowing the source and destination pointers to reference the same memory buffer.
DSP_FUNC_SCOPE void zdsp_scale_f16 | ( | const float16_t * | src, |
float16_t | scale, | ||
float16_t * | dst, | ||
uint32_t | block_size ) |
#include <zephyr/dsp/basicmath_f16.h>
Multiplies a floating-point vector by a scalar.
[in] | src | points to the input vector |
[in] | scale | scale factor to be applied |
[out] | dst | points to the output vector |
[in] | block_size | number of samples in the vector |
void zdsp_scale_f32 | ( | const float32_t * | src, |
float32_t | scale, | ||
float32_t * | dst, | ||
uint32_t | block_size ) |
#include <zephyr/dsp/basicmath.h>
Multiplies a floating-point vector by a scalar.
[in] | src | points to the input vector |
[in] | scale | scale factor to be applied |
[out] | dst | points to the output vector |
[in] | block_size | number of samples in the vector |
void zdsp_scale_q15 | ( | const q15_t * | src, |
q15_t | scale_fract, | ||
int8_t | shift, | ||
q15_t * | dst, | ||
uint32_t | block_size ) |
#include <zephyr/dsp/basicmath.h>
Multiplies a Q15 vector by a scalar.
*src
and scale_fract
are in 1.15 format. These are multiplied to yield a 2.30 intermediate result and this is shifted with saturation to 1.15 format.[in] | src | points to the input vector |
[in] | scale_fract | fractional portion of the scale value |
[in] | shift | number of bits to shift the result by |
[out] | dst | points to the output vector |
[in] | block_size | number of samples in the vector |
void zdsp_scale_q31 | ( | const q31_t * | src, |
q31_t | scale_fract, | ||
int8_t | shift, | ||
q31_t * | dst, | ||
uint32_t | block_size ) |
#include <zephyr/dsp/basicmath.h>
Multiplies a Q31 vector by a scalar.
*src
and scale_fract
are in 1.31 format. These are multiplied to yield a 2.62 intermediate result and this is shifted with saturation to 1.31 format.[in] | src | points to the input vector |
[in] | scale_fract | fractional portion of the scale value |
[in] | shift | number of bits to shift the result by |
[out] | dst | points to the output vector |
[in] | block_size | number of samples in the vector |
void zdsp_scale_q7 | ( | const q7_t * | src, |
q7_t | scale_fract, | ||
int8_t | shift, | ||
q7_t * | dst, | ||
uint32_t | block_size ) |
#include <zephyr/dsp/basicmath.h>
Multiplies a Q7 vector by a scalar.
*src
and scale_fract
are in 1.7 format. These are multiplied to yield a 2.14 intermediate result and this is shifted with saturation to 1.7 format.[in] | src | points to the input vector |
[in] | scale_fract | fractional portion of the scale value |
[in] | shift | number of bits to shift the result by |
[out] | dst | points to the output vector |
[in] | block_size | number of samples in the vector |