CSI-DSP
Version 1.0.0
CSI DSP Software Library
|
Functions | |
void | csky_dsp_lib_vec_scale_q15 (q15_t *A, q15_t scaleFract, int8_t shift, q15_t *C, uint32_t N) |
Q15 vector scale. More... | |
void | csky_dsp_lib_vec_scale_q31 (q31_t *A, q31_t scaleFract, int8_t shift, q31_t *C, uint32_t N) |
Q31 vector scale. More... | |
Scale means that Multiply a vector by a scalar value. For float pointing data, the algorithm used is:
Result = Src * scale.
For fixed-point data, scale
is represented by a fractional multiplication scaleFract
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:
*(C+i) = (*(A+i) * scaleFract) << shift, 0 <= i < N.
The overall scale factor applied to the fixed-point data is
scale = scaleFract * 2^shift.
support for Q15 and Q31 data.
void csky_dsp_lib_vec_scale_q15 | ( | q15_t * | A, |
q15_t | scaleFract, | ||
int8_t | shift, | ||
q15_t * | C, | ||
uint32_t | N | ||
) |
[in] | *A | points to the input buffer |
[in] | scaleFactor | the fractional multiplication |
[in] | shift | the shift value |
[out] | *C | points to the output buffer |
[in] | N | number of samples in each vector |
Scaling and Overflow Behavior:
*A
and scaleFract
are in Q15 format. The results of they are multiplied are in Q30. So the results will be shifted with saturation at last. void csky_dsp_lib_vec_scale_q31 | ( | q31_t * | A, |
q31_t | scaleFract, | ||
int8_t | shift, | ||
q31_t * | C, | ||
uint32_t | N | ||
) |
[in] | *A | points to the input buffer |
[in] | scaleFactor | the fractional multiplication |
[in] | shift | the shift value |
[out] | *C | points to the output buffer |
[in] | N | number of samples in each vector |
Scaling and Overflow Behavior:
*A
and scaleFract
are in Q31 format. The results of they are multiplied are in Q62. So the results will be shifted with saturation at last.