diff --git a/celt/arm/fixed_armv5e.h b/celt/arm/fixed_armv5e.h index 9d70d35653d03cc220342b4d53969f0daf40f737..80632c4a949df5fabb74b37412c98d99978fd6e7 100644 --- a/celt/arm/fixed_armv5e.h +++ b/celt/arm/fixed_armv5e.h @@ -84,7 +84,8 @@ static inline opus_val32 MAC16_32_Q15_armv5e(opus_val32 c, opus_val16 a, /** 16x16 multiply-add where the result fits in 32 bits */ #undef MAC16_16 -static inline opus_val32 MAC16_16(opus_val32 c, opus_val16 a, opus_val16 b) +static inline opus_val32 MAC16_16_armv5e(opus_val32 c, opus_val16 a, + opus_val16 b) { int res; __asm__( @@ -95,11 +96,11 @@ static inline opus_val32 MAC16_16(opus_val32 c, opus_val16 a, opus_val16 b) ); return res; } -#define MAC16_16(c, a, b) (MAC16_16(c, a, b)) +#define MAC16_16(c, a, b) (MAC16_16_armv5e(c, a, b)) /** 16x16 multiplication where the result fits in 32 bits */ #undef MULT16_16 -static inline opus_val32 MULT16_16(opus_val16 a, opus_val16 b) +static inline opus_val32 MULT16_16_armv5e(opus_val16 a, opus_val16 b) { int res; __asm__( @@ -110,6 +111,6 @@ static inline opus_val32 MULT16_16(opus_val16 a, opus_val16 b) ); return res; } -#define MULT16_16(a, b) (MULT16_16(a, b)) +#define MULT16_16(a, b) (MULT16_16_armv5e(a, b)) #endif diff --git a/celt/fixed_generic.h b/celt/fixed_generic.h index 71e28d62a888de164cf0dce05cf707d39ac59c62..ac01a43454faf4318a81c834e2e04805ffbb260e 100644 --- a/celt/fixed_generic.h +++ b/celt/fixed_generic.h @@ -108,7 +108,9 @@ /** 16x16 multiply-add where the result fits in 32 bits */ #define MAC16_16(c,a,b) (ADD32((c),MULT16_16((a),(b)))) -/** 16x32 multiply-add, followed by a 15-bit shift right. Results fits in 32 bits */ +/** 16x32 multiply, followed by a 15-bit shift right and 32-bit add. + b must fit in 31 bits. + Result fits in 32 bits. */ #define MAC16_32_Q15(c,a,b) ADD32(c,ADD32(MULT16_16((a),SHR((b),15)), SHR(MULT16_16((a),((b)&0x00007fff)),15))) #define MULT16_16_Q11_32(a,b) (SHR(MULT16_16((a),(b)),11))