OLD | NEW |
1 /* Copyright (c) 2009-2010 Xiph.Org Foundation | 1 /* Copyright (C) 2008 CSIRO */ |
2 Written by Jean-Marc Valin */ | 2 /** |
| 3 @file fixed_c6x.h |
| 4 @brief Fixed-point operations for the TI C6x DSP family |
| 5 */ |
3 /* | 6 /* |
4 Redistribution and use in source and binary forms, with or without | 7 Redistribution and use in source and binary forms, with or without |
5 modification, are permitted provided that the following conditions | 8 modification, are permitted provided that the following conditions |
6 are met: | 9 are met: |
7 | 10 |
8 - Redistributions of source code must retain the above copyright | 11 - Redistributions of source code must retain the above copyright |
9 notice, this list of conditions and the following disclaimer. | 12 notice, this list of conditions and the following disclaimer. |
10 | 13 |
11 - Redistributions in binary form must reproduce the above copyright | 14 - Redistributions in binary form must reproduce the above copyright |
12 notice, this list of conditions and the following disclaimer in the | 15 notice, this list of conditions and the following disclaimer in the |
13 documentation and/or other materials provided with the distribution. | 16 documentation and/or other materials provided with the distribution. |
14 | 17 |
15 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | 18 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
16 ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | 19 ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
17 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | 20 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
18 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER | 21 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER |
19 OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | 22 OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
20 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | 23 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
21 PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | 24 PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
22 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF | 25 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF |
23 LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | 26 LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
24 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | 27 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
25 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 */ | 29 */ |
27 | 30 |
28 #ifndef PLC_H | 31 #ifndef FIXED_C6X_H |
29 #define PLC_H | 32 #define FIXED_C6X_H |
30 | 33 |
31 #include "arch.h" | 34 #undef MULT16_16SU |
32 #include "cpu_support.h" | 35 #define MULT16_16SU(a,b) _mpysu(a,b) |
33 | 36 |
34 #if defined(OPUS_X86_MAY_HAVE_SSE4_1) | 37 #undef MULT_16_16 |
35 #include "x86/celt_lpc_sse.h" | 38 #define MULT_16_16(a,b) _mpy(a,b) |
36 #endif | |
37 | 39 |
38 #define LPC_ORDER 24 | 40 #define celt_ilog2(x) (30 - _norm(x)) |
| 41 #define OVERRIDE_CELT_ILOG2 |
39 | 42 |
40 void _celt_lpc(opus_val16 *_lpc, const opus_val32 *ac, int p); | 43 #undef MULT16_32_Q15 |
| 44 #define MULT16_32_Q15(a,b) (_mpylill(a, b) >> 15) |
41 | 45 |
42 void celt_fir_c( | 46 #if 0 |
43 const opus_val16 *x, | 47 #include "dsplib.h" |
44 const opus_val16 *num, | |
45 opus_val16 *y, | |
46 int N, | |
47 int ord, | |
48 opus_val16 *mem, | |
49 int arch); | |
50 | 48 |
51 #if !defined(OVERRIDE_CELT_FIR) | 49 #undef MAX16 |
52 #define celt_fir(x, num, y, N, ord, mem, arch) \ | 50 #define MAX16(a,b) _max(a,b) |
53 (celt_fir_c(x, num, y, N, ord, mem, arch)) | |
54 #endif | |
55 | 51 |
56 void celt_iir(const opus_val32 *x, | 52 #undef MIN16 |
57 const opus_val16 *den, | 53 #define MIN16(a,b) _min(a,b) |
58 opus_val32 *y, | |
59 int N, | |
60 int ord, | |
61 opus_val16 *mem, | |
62 int arch); | |
63 | 54 |
64 int _celt_autocorr(const opus_val16 *x, opus_val32 *ac, | 55 #undef MAX32 |
65 const opus_val16 *window, int overlap, int lag, int n, int arch); | 56 #define MAX32(a,b) _lmax(a,b) |
66 | 57 |
67 #endif /* PLC_H */ | 58 #undef MIN32 |
| 59 #define MIN32(a,b) _lmin(a,b) |
| 60 |
| 61 #undef VSHR32 |
| 62 #define VSHR32(a, shift) _lshl(a,-(shift)) |
| 63 |
| 64 #undef MULT16_16_Q15 |
| 65 #define MULT16_16_Q15(a,b) (_smpy(a,b)) |
| 66 |
| 67 #define celt_maxabs16(x, len) MAX32(EXTEND32(maxval((DATA *)x, len)),-EXTEND32(m
inval((DATA *)x, len))) |
| 68 #define OVERRIDE_CELT_MAXABS16 |
| 69 |
| 70 #endif /* FIXED_C6X_H */ |
OLD | NEW |