1.4.4.36 libq_q15_MsuR_q31_q15_q15 Function
Multiply-Subtraction with rounding
Description
Function libq_q15_MsuR_q31_q15_q15:
This function is like Multiply-Subtract but WITH Rounding applied to the subtractor result before it is saturated and the top 16-bits taken. This function first multiplies the two 16-bit input values b x c which results in a 32-bit value. This result is left shifted by one to account for the extra sign bit inherent in the fractional-type multiply. So, the shifted number now has a 0 in the Lsb. The shifted multiplier output is then SUBTRACTED From the 32-bit fractional input a. Then the 32-bits output From this subtraction are rounded by adding 2^15. This value is then saturated to be within the q15 range. It is assumed that the binary point of the 32-bit input value a is in the same bit position as the shifted multiplier output.
This function is for fractional Q-type format data only and it therefore will not give the correct results for true integers.
This function relates to the ETSI msu_r function.
Parameters
q31 a Value which is subtracted from
q15 b multiplication operand 1
q15 c multiplication operand 2
Returns
q15 result - a-b*c rounded to Q1.15
C
q15 libq_q15_MsuR_q31_q15_q15 (q31, q15, q15);