1 /* 2 * Copyright (C) 2020 Linux Studio Plugins Project <https://lsp-plug.in/> 3 * (C) 2020 Vladimir Sadovnikov <sadko4u@gmail.com> 4 * 5 * This file is part of lsp-plugins 6 * Created on: 29 февр. 2016 г. 7 * 8 * lsp-plugins 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-plugins 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-plugins. If not, see <https://www.gnu.org/licenses/>. 20 */ 21 22 // This is the SSE implementation of the scrambling functions for self data 23 24 #define _SSE_FFT_NAME(id) id 25 #define _SSE_CALL_NAME(id, bits) id ## bits 26 27 #define SSE_FFT_NAME(id) _SSE_FFT_NAME(id) 28 #define SSE_CALL_NAME(id, bits) _SSE_CALL_NAME(id, bits)(dst_re, dst_im, src_re, src_im, rank) 29 30 namespace sse 31 { SSE_FFT_NAME(FFT_SCRAMBLE_DIRECT_NAME)32 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) 33 { 34 // Scramble the order of samples 35 if ((dst_re == src_re) || (dst_im == src_im)) 36 { 37 if (rank <= 8) 38 SSE_CALL_NAME(FFT_SCRAMBLE_SELF_DIRECT_NAME, 8); 39 else //if (rank <= 16) 40 SSE_CALL_NAME(FFT_SCRAMBLE_SELF_DIRECT_NAME, 16); 41 } 42 else 43 { 44 rank -= 3; 45 46 if (rank <= 8) 47 SSE_CALL_NAME(FFT_SCRAMBLE_COPY_DIRECT_NAME, 8); 48 else //if (rank <= 16) 49 SSE_CALL_NAME(FFT_SCRAMBLE_COPY_DIRECT_NAME, 16); 50 } 51 } 52 SSE_FFT_NAME(FFT_SCRAMBLE_REVERSE_NAME)53 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) 54 { 55 // Scramble the order of samples 56 if ((dst_re == src_re) || (dst_im == src_im)) 57 { 58 if (rank <= 8) 59 SSE_CALL_NAME(FFT_SCRAMBLE_SELF_REVERSE_NAME, 8); 60 else //if (rank <= 16) 61 SSE_CALL_NAME(FFT_SCRAMBLE_SELF_REVERSE_NAME, 16); 62 } 63 else 64 { 65 rank -= 3; 66 67 if (rank <= 8) 68 SSE_CALL_NAME(FFT_SCRAMBLE_COPY_REVERSE_NAME, 8); 69 else //if (rank <= 16) 70 SSE_CALL_NAME(FFT_SCRAMBLE_COPY_REVERSE_NAME, 16); 71 } 72 } 73 } 74 75 #undef SSE_FFT_NAME 76 #undef SSE_CALL_NAME 77 #undef _SSE_FFT_NAME 78 #undef _SSE_CALL_NAME 79 80 #undef FFT_SCRAMBLE_SELF_DIRECT_NAME 81 #undef FFT_SCRAMBLE_SELF_REVERSE_NAME 82 #undef FFT_SCRAMBLE_COPY_DIRECT_NAME 83 #undef FFT_SCRAMBLE_COPY_REVERSE_NAME 84 85 #undef FFT_SCRAMBLE_DIRECT_NAME 86 #undef FFT_SCRAMBLE_REVERSE_NAME 87 #undef FFT_MODE 88