Integer Scaling
Because some signal processing functions improve precision during internal computations, a scale factor is added as a function parameter when these functions are called, and the called function scales the internal computation result by using an integer scale factor. The scale factor must be 2^n and cannot be positive infinity or NaN. These signal processing functions have the "S" descriptor in their names.
Scaling of a computation result is done by multiplying the output vector by scale before the function returns. This helps retain the output data range or its precision.
For example, a multiplication is performed on a 16-bit signed integer 300. Because the result is saturated, the actual result that can be stored is 32767 instead of 90000. If the scale factor scale is set to 0.25 (2-2), the result is 22500, which is not saturated, and the actual result can be restored by using 22500*4.
If some precision needs to be reserved, for example, the root extraction of integer 3, the HMPPS_Sqrt function calls the library function sqrt for calculation. If scale is not transferred, the program output is 2 instead of 1.732. If the scale parameter 8 (23) is transferred to the program, the program scales the calculation result and outputs the result 14. The program caller can use the output result 14 and the scale parameter 0.125 (2-3) to obtain a more accurate result after calculation: 14*2-3 = 1.75.