| 1 |
/* |
| 2 |
* Copyright (C) 2020 Linux Studio Plugins Project <https://lsp-plug.in/> |
| 3 |
* (C) 2020 Vladimir Sadovnikov <[email protected]> |
| 4 |
* |
| 5 |
* This file is part of lsp-dsp-lib |
| 6 |
* Created on: 31 мар. 2020 г. |
| 7 |
* |
| 8 |
* lsp-dsp-lib is free software: you can redistribute it and/or modify |
| 9 |
* it under the terms of the GNU Lesser General Public License as published by |
| 10 |
* the Free Software Foundation, either version 3 of the License, or |
| 11 |
* any later version. |
| 12 |
* |
| 13 |
* lsp-dsp-lib is distributed in the hope that it will be useful, |
| 14 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 |
* GNU Lesser General Public License for more details. |
| 17 |
* |
| 18 |
* You should have received a copy of the GNU Lesser General Public License |
| 19 |
* along with lsp-dsp-lib. If not, see <https://www.gnu.org/licenses/>. |
| 20 |
*/ |
| 21 |
|
| 22 |
#ifndef PRIVATE_DSP_ARCH_X86_SSE_IMPL |
| 23 |
#error "This header should not be included directly" |
| 24 |
#endif /* PRIVATE_DSP_ARCH_X86_SSE_IMPL */ |
| 25 |
|
| 26 |
#define _SSE_FFT_NAME(id) id |
| 27 |
#define _SSE_CALL_NAME(id, bits) id ## bits |
| 28 |
|
| 29 |
#define SSE_FFT_NAME(id) _SSE_FFT_NAME(id) |
| 30 |
#define SSE_CALL_NAME(id, bits) _SSE_CALL_NAME(id, bits)(dst_re, dst_im, src_re, src_im, rank) |
| 31 |
|
| 32 |
namespace lsp |
| 33 |
{ |
| 34 |
namespace sse |
| 35 |
{ |
| 36 |
static inline void SSE_FFT_NAME(FFT_SCRAMBLE_DIRECT_NAME)(float *dst_re, float *dst_im, const float *src_re, const float *src_im, size_t rank) |
| 37 |
{ |
| 38 |
// Scramble the order of samples |
| 39 |
if ((dst_re == src_re) || (dst_im == src_im)) |
| 40 |
{ |
| 41 |
if (rank <= 8) |
| 42 |
SSE_CALL_NAME(FFT_SCRAMBLE_SELF_DIRECT_NAME, 8); |
| 43 |
else //if (rank <= 16) |
| 44 |
SSE_CALL_NAME(FFT_SCRAMBLE_SELF_DIRECT_NAME, 16); |
| 45 |
} |
| 46 |
else |
| 47 |
{ |
| 48 |
rank -= 3; |
| 49 |
|
| 50 |
if (rank <= 8) |
| 51 |
SSE_CALL_NAME(FFT_SCRAMBLE_COPY_DIRECT_NAME, 8); |
| 52 |
else //if (rank <= 16) |
| 53 |
SSE_CALL_NAME(FFT_SCRAMBLE_COPY_DIRECT_NAME, 16); |
| 54 |
} |
| 55 |
} |
| 56 |
|
| 57 |
static inline void SSE_FFT_NAME(FFT_SCRAMBLE_REVERSE_NAME)(float *dst_re, float *dst_im, const float *src_re, const float *src_im, size_t rank) |
| 58 |
{ |
| 59 |
// Scramble the order of samples |
| 60 |
if ((dst_re == src_re) || (dst_im == src_im)) |
| 61 |
{ |
| 62 |
if (rank <= 8) |
| 63 |
SSE_CALL_NAME(FFT_SCRAMBLE_SELF_REVERSE_NAME, 8); |
| 64 |
else //if (rank <= 16) |
| 65 |
SSE_CALL_NAME(FFT_SCRAMBLE_SELF_REVERSE_NAME, 16); |
| 66 |
} |
| 67 |
else |
| 68 |
{ |
| 69 |
rank -= 3; |
| 70 |
|
| 71 |
if (rank <= 8) |
| 72 |
SSE_CALL_NAME(FFT_SCRAMBLE_COPY_REVERSE_NAME, 8); |
| 73 |
else //if (rank <= 16) |
| 74 |
SSE_CALL_NAME(FFT_SCRAMBLE_COPY_REVERSE_NAME, 16); |
| 75 |
} |
| 76 |
} |
| 77 |
} |
| 78 |
} |
| 79 |
|
| 80 |
#undef SSE_FFT_NAME |
| 81 |
#undef SSE_CALL_NAME |
| 82 |
#undef _SSE_FFT_NAME |
| 83 |
#undef _SSE_CALL_NAME |
| 84 |
|
| 85 |
#undef FFT_SCRAMBLE_SELF_DIRECT_NAME |
| 86 |
#undef FFT_SCRAMBLE_SELF_REVERSE_NAME |
| 87 |
#undef FFT_SCRAMBLE_COPY_DIRECT_NAME |
| 88 |
#undef FFT_SCRAMBLE_COPY_REVERSE_NAME |
| 89 |
|
| 90 |
#undef FFT_SCRAMBLE_DIRECT_NAME |
| 91 |
#undef FFT_SCRAMBLE_REVERSE_NAME |
| 92 |
#undef FFT_MODE |
| 93 |
|