Audio format: Bug fix for erroneous fractional multiplication macro

Due to misplaced parentheses the computation gives half of correct
result and omits rounding. Currently this macro is not used by code
in SOF git repository. Developers who may use format.h macros should
check their code.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
This commit is contained in:
Seppo Ingalsuo 2018-01-30 17:12:39 +02:00 committed by Liam Girdwood
parent dde493c45b
commit 359af81a8a
1 changed files with 2 additions and 1 deletions

View File

@ -85,7 +85,8 @@
/* Fractional multiplication with shift and round /* Fractional multiplication with shift and round
* Note that the parameters px and py must be cast to (int64_t) if other type. * Note that the parameters px and py must be cast to (int64_t) if other type.
*/ */
#define Q_MULTSR_32X32(px, py, qx, qy, qp) (((px) * (py) >> (((qx)+(qy)-(qp)-1) +1) >> 1)) #define Q_MULTSR_32X32(px, py, qx, qy, qp) \
((((px) * (py) >> ((qx)+(qy)-(qp)-1)) + 1) >> 1)
/* Saturation */ /* Saturation */
#define SATP_INT32(x) (((x) > INT32_MAX) ? INT32_MAX : (x)) #define SATP_INT32(x) (((x) > INT32_MAX) ? INT32_MAX : (x))