1.4.4.35 libq_q15_MacR_q31_q15_q15 Function

Multiply accumulate with rounding.

Description

Function libq_q15_MacR_q31_q15_q15:

This function is multiply-accumulate WITH Rounding applied to the accumulator 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 added to the 32-bit fractional input a. Then the 32-bits of the accumulator output 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 Qtype format data only and it therefore will not give the correct results for true integers.

This function relates to the ETSI L_mac_r function.

Parameters

q31 a 32-bit accumulator operand

q15 b 16-bit multiplication operand

q15 c 16-bit multiplication operand

Returns

q15 result - a+b*c rounded

C

q15 libq_q15_MacR_q31_q15_q15 (q31, q15, q15);