• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* Copyright (c) 2010 Xiph.Org Foundation
2  * Copyright (c) 2013 Parrot */
3 /*
4    Redistribution and use in source and binary forms, with or without
5    modification, are permitted provided that the following conditions
6    are met:
7 
8    - Redistributions of source code must retain the above copyright
9    notice, this list of conditions and the following disclaimer.
10 
11    - Redistributions in binary form must reproduce the above copyright
12    notice, this list of conditions and the following disclaimer in the
13    documentation and/or other materials provided with the distribution.
14 
15    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
16    ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
17    LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
18    A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
19    OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
20    EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
21    PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
22    PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
23    LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
24    NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25    SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27 
28 #ifdef HAVE_CONFIG_H
29 #include "config.h"
30 #endif
31 
32 #include "pitch.h"
33 #include "kiss_fft.h"
34 #include "mdct.h"
35 
36 #if defined(OPUS_HAVE_RTCD)
37 
38 # if defined(FIXED_POINT)
39 #  if ((defined(OPUS_ARM_MAY_HAVE_NEON) && !defined(OPUS_ARM_PRESUME_NEON)) || \
40     (defined(OPUS_ARM_MAY_HAVE_MEDIA) && !defined(OPUS_ARM_PRESUME_MEDIA)) || \
41     (defined(OPUS_ARM_MAY_HAVE_EDSP) && !defined(OPUS_ARM_PRESUME_EDSP)))
42 opus_val32 (*const CELT_PITCH_XCORR_IMPL[OPUS_ARCHMASK+1])(const opus_val16 *,
43     const opus_val16 *, opus_val32 *, int , int) = {
44   celt_pitch_xcorr_c,               /* ARMv4 */
45   MAY_HAVE_EDSP(celt_pitch_xcorr),  /* EDSP */
46   MAY_HAVE_MEDIA(celt_pitch_xcorr), /* Media */
47   MAY_HAVE_NEON(celt_pitch_xcorr)   /* NEON */
48 };
49 
50 #  endif
51 # else /* !FIXED_POINT */
52 #  if defined(OPUS_ARM_MAY_HAVE_NEON_INTR) && !defined(OPUS_ARM_PRESUME_NEON_INTR)
53 void (*const CELT_PITCH_XCORR_IMPL[OPUS_ARCHMASK+1])(const opus_val16 *,
54     const opus_val16 *, opus_val32 *, int, int) = {
55   celt_pitch_xcorr_c,              /* ARMv4 */
56   celt_pitch_xcorr_c,              /* EDSP */
57   celt_pitch_xcorr_c,              /* Media */
58   celt_pitch_xcorr_float_neon      /* Neon */
59 };
60 #  endif
61 # endif /* FIXED_POINT */
62 
63 #if defined(FIXED_POINT) && defined(OPUS_HAVE_RTCD) && \
64  defined(OPUS_ARM_MAY_HAVE_NEON_INTR) && !defined(OPUS_ARM_PRESUME_NEON_INTR)
65 
66 void (*const XCORR_KERNEL_IMPL[OPUS_ARCHMASK + 1])(
67          const opus_val16 *x,
68          const opus_val16 *y,
69          opus_val32       sum[4],
70          int              len
71 ) = {
72   xcorr_kernel_c,                /* ARMv4 */
73   xcorr_kernel_c,                /* EDSP */
74   xcorr_kernel_c,                /* Media */
75   xcorr_kernel_neon_fixed,       /* Neon */
76 };
77 
78 #endif
79 
80 # if defined(OPUS_ARM_MAY_HAVE_NEON_INTR)
81 #  if defined(HAVE_ARM_NE10)
82 #   if defined(CUSTOM_MODES)
83 int (*const OPUS_FFT_ALLOC_ARCH_IMPL[OPUS_ARCHMASK+1])(kiss_fft_state *st) = {
84    opus_fft_alloc_arch_c,        /* ARMv4 */
85    opus_fft_alloc_arch_c,        /* EDSP */
86    opus_fft_alloc_arch_c,        /* Media */
87    opus_fft_alloc_arm_neon       /* Neon with NE10 library support */
88 };
89 
90 void (*const OPUS_FFT_FREE_ARCH_IMPL[OPUS_ARCHMASK+1])(kiss_fft_state *st) = {
91    opus_fft_free_arch_c,         /* ARMv4 */
92    opus_fft_free_arch_c,         /* EDSP */
93    opus_fft_free_arch_c,         /* Media */
94    opus_fft_free_arm_neon        /* Neon with NE10 */
95 };
96 #   endif /* CUSTOM_MODES */
97 
98 void (*const OPUS_FFT[OPUS_ARCHMASK+1])(const kiss_fft_state *cfg,
99                                         const kiss_fft_cpx *fin,
100                                         kiss_fft_cpx *fout) = {
101    opus_fft_c,                   /* ARMv4 */
102    opus_fft_c,                   /* EDSP */
103    opus_fft_c,                   /* Media */
104    opus_fft_neon                 /* Neon with NE10 */
105 };
106 
107 void (*const OPUS_IFFT[OPUS_ARCHMASK+1])(const kiss_fft_state *cfg,
108                                          const kiss_fft_cpx *fin,
109                                          kiss_fft_cpx *fout) = {
110    opus_ifft_c,                   /* ARMv4 */
111    opus_ifft_c,                   /* EDSP */
112    opus_ifft_c,                   /* Media */
113    opus_ifft_neon                 /* Neon with NE10 */
114 };
115 
116 void (*const CLT_MDCT_FORWARD_IMPL[OPUS_ARCHMASK+1])(const mdct_lookup *l,
117                                                      kiss_fft_scalar *in,
118                                                      kiss_fft_scalar * OPUS_RESTRICT out,
119                                                      const opus_val16 *window,
120                                                      int overlap, int shift,
121                                                      int stride, int arch) = {
122    clt_mdct_forward_c,           /* ARMv4 */
123    clt_mdct_forward_c,           /* EDSP */
124    clt_mdct_forward_c,           /* Media */
125    clt_mdct_forward_neon         /* Neon with NE10 */
126 };
127 
128 void (*const CLT_MDCT_BACKWARD_IMPL[OPUS_ARCHMASK+1])(const mdct_lookup *l,
129                                                       kiss_fft_scalar *in,
130                                                       kiss_fft_scalar * OPUS_RESTRICT out,
131                                                       const opus_val16 *window,
132                                                       int overlap, int shift,
133                                                       int stride, int arch) = {
134    clt_mdct_backward_c,           /* ARMv4 */
135    clt_mdct_backward_c,           /* EDSP */
136    clt_mdct_backward_c,           /* Media */
137    clt_mdct_backward_neon         /* Neon with NE10 */
138 };
139 
140 #  endif /* HAVE_ARM_NE10 */
141 # endif /* OPUS_ARM_MAY_HAVE_NEON_INTR */
142 
143 #endif /* OPUS_HAVE_RTCD */
144