1 /* Copyright (C) 2008 CSIRO */
4 @brief Fixed-point operations for the TI C6x DSP family
7 Redistribution and use in source and binary forms, with or without
8 modification, are permitted provided that the following conditions
11 - Redistributions of source code must retain the above copyright
12 notice, this list of conditions and the following disclaimer.
14 - Redistributions in binary form must reproduce the above copyright
15 notice, this list of conditions and the following disclaimer in the
16 documentation and/or other materials provided with the distribution.
18 - Neither the name of the Xiph.org Foundation nor the names of its
19 contributors may be used to endorse or promote products derived from
20 this software without specific prior written permission.
22 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23 ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
25 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
26 CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
27 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
28 PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
29 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
30 LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
31 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
32 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
39 #define MULT16_16SU(a,b) _mpysu(a,b)
42 #define MULT_16_16(a,b) _mpy(a,b)
44 #define celt_ilog2(x) (30 - _norm(x))
45 #define OVERRIDE_CELT_ILOG2
48 #define MULT16_32_Q15(a,b) (_mpylill(a, b) >> 15)
54 #define MAX16(a,b) _max(a,b)
57 #define MIN16(a,b) _min(a,b)
60 #define MAX32(a,b) _lmax(a,b)
63 #define MIN32(a,b) _lmin(a,b)
66 #define VSHR32(a, shift) _lshl(a,-(shift))
69 #define MULT16_16_Q15(a,b) (_smpy(a,b))
71 #define celt_maxabs16(x, len) MAX16(maxval((DATA *)x, len),-minval((DATA *)x, len))
72 #define OVERRIDE_CELT_MAXABS16
74 #define OVERRIDE_FIND_MAX16
75 static inline int find_max16(celt_word16 *x, int len)
77 DATA max_corr16 = -VERY_LARGE16;
79 maxvec((DATA *)x, len, &max_corr16, &pitch16);
84 #endif /* FIXED_C6X_H */