| OLD | NEW |
| 1 /* Copyright (c) 2002-2008 Jean-Marc Valin | 1 /* Copyright (c) 2002-2008 Jean-Marc Valin |
| 2 Copyright (c) 2007-2008 CSIRO | 2 Copyright (c) 2007-2008 CSIRO |
| 3 Copyright (c) 2007-2009 Xiph.Org Foundation | 3 Copyright (c) 2007-2009 Xiph.Org Foundation |
| 4 Written by Jean-Marc Valin */ | 4 Written by Jean-Marc Valin */ |
| 5 /** | 5 /** |
| 6 @file mathops.h | 6 @file mathops.h |
| 7 @brief Various math functions | 7 @brief Various math functions |
| 8 */ | 8 */ |
| 9 /* | 9 /* |
| 10 Redistribution and use in source and binary forms, with or without | 10 Redistribution and use in source and binary forms, with or without |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 MULT16_16_Q15(n, ADD16(C[3], MULT16_16_Q15(n, (C[4]))))))))); | 132 MULT16_16_Q15(n, ADD16(C[3], MULT16_16_Q15(n, (C[4]))))))))); |
| 133 rt = VSHR32(rt,7-k); | 133 rt = VSHR32(rt,7-k); |
| 134 return rt; | 134 return rt; |
| 135 } | 135 } |
| 136 | 136 |
| 137 #define L1 32767 | 137 #define L1 32767 |
| 138 #define L2 -7651 | 138 #define L2 -7651 |
| 139 #define L3 8277 | 139 #define L3 8277 |
| 140 #define L4 -626 | 140 #define L4 -626 |
| 141 | 141 |
| 142 static inline opus_val16 _celt_cos_pi_2(opus_val16 x) | 142 static OPUS_INLINE opus_val16 _celt_cos_pi_2(opus_val16 x) |
| 143 { | 143 { |
| 144 opus_val16 x2; | 144 opus_val16 x2; |
| 145 | 145 |
| 146 x2 = MULT16_16_P15(x,x); | 146 x2 = MULT16_16_P15(x,x); |
| 147 return ADD16(1,MIN16(32766,ADD32(SUB16(L1,x2), MULT16_16_P15(x2, ADD32(L2, MU
LT16_16_P15(x2, ADD32(L3, MULT16_16_P15(L4, x2 | 147 return ADD16(1,MIN16(32766,ADD32(SUB16(L1,x2), MULT16_16_P15(x2, ADD32(L2, MU
LT16_16_P15(x2, ADD32(L3, MULT16_16_P15(L4, x2 |
| 148
)))))))); | 148
)))))))); |
| 149 } | 149 } |
| 150 | 150 |
| 151 #undef L1 | 151 #undef L1 |
| 152 #undef L2 | 152 #undef L2 |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 neatly compensates for truncation error in the rest of the process. */ | 199 neatly compensates for truncation error in the rest of the process. */ |
| 200 r = SUB16(r, ADD16(1, MULT16_16_Q15(r, | 200 r = SUB16(r, ADD16(1, MULT16_16_Q15(r, |
| 201 ADD16(MULT16_16_Q15(r, n), ADD16(r, -32768))))); | 201 ADD16(MULT16_16_Q15(r, n), ADD16(r, -32768))))); |
| 202 /* r is now the Q15 solution to 2/(n+1), with a maximum relative error | 202 /* r is now the Q15 solution to 2/(n+1), with a maximum relative error |
| 203 of 7.05346E-5, a (relative) RMSE of 2.14418E-5, and a peak absolute | 203 of 7.05346E-5, a (relative) RMSE of 2.14418E-5, and a peak absolute |
| 204 error of 1.24665/32768. */ | 204 error of 1.24665/32768. */ |
| 205 return VSHR32(EXTEND32(r),i-16); | 205 return VSHR32(EXTEND32(r),i-16); |
| 206 } | 206 } |
| 207 | 207 |
| 208 #endif | 208 #endif |
| OLD | NEW |