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(OPUS_ARM_MAY_HAVE_NEON_INTR) && !defined(OPUS_ARM_PRESUME_NEON_INTR) 39 opus_val32 (*const CELT_INNER_PROD_IMPL[OPUS_ARCHMASK+1])(const opus_val16 *x, const opus_val16 *y, int N) = { 40 celt_inner_prod_c, /* ARMv4 */ 41 celt_inner_prod_c, /* EDSP */ 42 celt_inner_prod_c, /* Media */ 43 celt_inner_prod_neon /* NEON */ 44 }; 45 46 void (*const DUAL_INNER_PROD_IMPL[OPUS_ARCHMASK+1])(const opus_val16 *x, const opus_val16 *y01, const opus_val16 *y02, 47 int N, opus_val32 *xy1, opus_val32 *xy2) = { 48 dual_inner_prod_c, /* ARMv4 */ 49 dual_inner_prod_c, /* EDSP */ 50 dual_inner_prod_c, /* Media */ 51 dual_inner_prod_neon /* NEON */ 52 }; 53 # endif 54 55 # if defined(FIXED_POINT) 56 # if ((defined(OPUS_ARM_MAY_HAVE_NEON) && !defined(OPUS_ARM_PRESUME_NEON)) || \ 57 (defined(OPUS_ARM_MAY_HAVE_MEDIA) && !defined(OPUS_ARM_PRESUME_MEDIA)) || \ 58 (defined(OPUS_ARM_MAY_HAVE_EDSP) && !defined(OPUS_ARM_PRESUME_EDSP))) 59 opus_val32 (*const CELT_PITCH_XCORR_IMPL[OPUS_ARCHMASK+1])(const opus_val16 *, 60 const opus_val16 *, opus_val32 *, int, int, int) = { 61 celt_pitch_xcorr_c, /* ARMv4 */ 62 MAY_HAVE_EDSP(celt_pitch_xcorr), /* EDSP */ 63 MAY_HAVE_MEDIA(celt_pitch_xcorr), /* Media */ 64 MAY_HAVE_NEON(celt_pitch_xcorr) /* NEON */ 65 }; 66 67 # endif 68 # else /* !FIXED_POINT */ 69 # if defined(OPUS_ARM_MAY_HAVE_NEON_INTR) && !defined(OPUS_ARM_PRESUME_NEON_INTR) 70 void (*const CELT_PITCH_XCORR_IMPL[OPUS_ARCHMASK+1])(const opus_val16 *, 71 const opus_val16 *, opus_val32 *, int, int, int) = { 72 celt_pitch_xcorr_c, /* ARMv4 */ 73 celt_pitch_xcorr_c, /* EDSP */ 74 celt_pitch_xcorr_c, /* Media */ 75 celt_pitch_xcorr_float_neon /* Neon */ 76 }; 77 # endif 78 # endif /* FIXED_POINT */ 79 80 #if defined(FIXED_POINT) && defined(OPUS_HAVE_RTCD) && \ 81 defined(OPUS_ARM_MAY_HAVE_NEON_INTR) && !defined(OPUS_ARM_PRESUME_NEON_INTR) 82 83 void (*const XCORR_KERNEL_IMPL[OPUS_ARCHMASK + 1])( 84 const opus_val16 *x, 85 const opus_val16 *y, 86 opus_val32 sum[4], 87 int len 88 ) = { 89 xcorr_kernel_c, /* ARMv4 */ 90 xcorr_kernel_c, /* EDSP */ 91 xcorr_kernel_c, /* Media */ 92 xcorr_kernel_neon_fixed, /* Neon */ 93 }; 94 95 #endif 96 97 # if defined(OPUS_ARM_MAY_HAVE_NEON_INTR) 98 # if defined(HAVE_ARM_NE10) 99 # if defined(CUSTOM_MODES) 100 int (*const OPUS_FFT_ALLOC_ARCH_IMPL[OPUS_ARCHMASK+1])(kiss_fft_state *st) = { 101 opus_fft_alloc_arch_c, /* ARMv4 */ 102 opus_fft_alloc_arch_c, /* EDSP */ 103 opus_fft_alloc_arch_c, /* Media */ 104 opus_fft_alloc_arm_neon /* Neon with NE10 library support */ 105 }; 106 107 void (*const OPUS_FFT_FREE_ARCH_IMPL[OPUS_ARCHMASK+1])(kiss_fft_state *st) = { 108 opus_fft_free_arch_c, /* ARMv4 */ 109 opus_fft_free_arch_c, /* EDSP */ 110 opus_fft_free_arch_c, /* Media */ 111 opus_fft_free_arm_neon /* Neon with NE10 */ 112 }; 113 # endif /* CUSTOM_MODES */ 114 115 void (*const OPUS_FFT[OPUS_ARCHMASK+1])(const kiss_fft_state *cfg, 116 const kiss_fft_cpx *fin, 117 kiss_fft_cpx *fout) = { 118 opus_fft_c, /* ARMv4 */ 119 opus_fft_c, /* EDSP */ 120 opus_fft_c, /* Media */ 121 opus_fft_neon /* Neon with NE10 */ 122 }; 123 124 void (*const OPUS_IFFT[OPUS_ARCHMASK+1])(const kiss_fft_state *cfg, 125 const kiss_fft_cpx *fin, 126 kiss_fft_cpx *fout) = { 127 opus_ifft_c, /* ARMv4 */ 128 opus_ifft_c, /* EDSP */ 129 opus_ifft_c, /* Media */ 130 opus_ifft_neon /* Neon with NE10 */ 131 }; 132 133 void (*const CLT_MDCT_FORWARD_IMPL[OPUS_ARCHMASK+1])(const mdct_lookup *l, 134 kiss_fft_scalar *in, 135 kiss_fft_scalar * OPUS_RESTRICT out, 136 const opus_val16 *window, 137 int overlap, int shift, 138 int stride, int arch) = { 139 clt_mdct_forward_c, /* ARMv4 */ 140 clt_mdct_forward_c, /* EDSP */ 141 clt_mdct_forward_c, /* Media */ 142 clt_mdct_forward_neon /* Neon with NE10 */ 143 }; 144 145 void (*const CLT_MDCT_BACKWARD_IMPL[OPUS_ARCHMASK+1])(const mdct_lookup *l, 146 kiss_fft_scalar *in, 147 kiss_fft_scalar * OPUS_RESTRICT out, 148 const opus_val16 *window, 149 int overlap, int shift, 150 int stride, int arch) = { 151 clt_mdct_backward_c, /* ARMv4 */ 152 clt_mdct_backward_c, /* EDSP */ 153 clt_mdct_backward_c, /* Media */ 154 clt_mdct_backward_neon /* Neon with NE10 */ 155 }; 156 157 # endif /* HAVE_ARM_NE10 */ 158 # endif /* OPUS_ARM_MAY_HAVE_NEON_INTR */ 159 160 #endif /* OPUS_HAVE_RTCD */ 161