修訂 | aa89e378b2310ce5949f6d5469a5fe0e2f35b9b0 (tree) |
---|---|
時間 | 2018-04-14 17:48:10 |
作者 | Teru Kamogashira <tkamogashira@user...> |
Commiter | Teru Kamogashira |
Updates to Freeverb3 library
@@ -22,51 +22,23 @@ | ||
22 | 22 | |
23 | 23 | int detectCPU() |
24 | 24 | { |
25 | - int check = 1, prefer = 0; | |
25 | + int check = 1; | |
26 | 26 | uint32_t simdFlag = UTILS::getSIMDFlag(); |
27 | 27 | fprintf(stderr, "simdFlag: %08x\n", simdFlag); |
28 | - | |
29 | 28 | #ifdef PLUGDOUBLE |
30 | -#ifdef ENABLE_AVX | |
31 | - if(!(simdFlag & FV3_FLAG_AVX)) | |
29 | + if(!(simdFlag & FV3_X86SIMD_FLAG_SSE2)) | |
32 | 30 | check = 0; |
33 | -#endif | |
34 | -#ifdef ENABLE_SSE4 | |
35 | - if(!(simdFlag & FV3_FLAG_SSE4_1)) | |
36 | - check = 0; | |
37 | -#endif | |
38 | -#ifdef ENABLE_SSE2 | |
39 | - if(!(simdFlag & FV3_FLAG_SSE2)) | |
40 | - check = 0; | |
41 | -#endif | |
42 | - | |
43 | 31 | #else |
44 | - | |
45 | -#ifdef ENABLE_SSE_V2 | |
46 | -#define ENABLE_SSE | |
47 | -#endif | |
48 | - | |
49 | -#ifdef ENABLE_AVX | |
50 | - if(!(simdFlag & FV3_FLAG_AVX)) | |
32 | + if(!(simdFlag & FV3_X86SIMD_FLAG_SSE)) | |
51 | 33 | check = 0; |
52 | 34 | #endif |
53 | -#ifdef ENABLE_SSE3 | |
54 | - if(!(simdFlag & FV3_FLAG_SSE3)) | |
55 | - check = 0; | |
56 | -#endif | |
57 | -#ifdef ENABLE_SSE | |
58 | - if(!(simdFlag & FV3_FLAG_SSE)) | |
59 | - check = 0; | |
60 | -#endif | |
61 | -#endif | |
62 | 35 | |
63 | 36 | if(check == 0) |
64 | 37 | { |
65 | 38 | #ifdef WIN32 |
66 | 39 | MessageBoxW(NULL, |
67 | - L"This binary version is not supported on this machine.\n" | |
68 | - L"Try using check_cpu.exe to find the optimized binary version of Freeverb3_VST.", | |
69 | - L"Freeverb3_VST CPU MISMATCH ERROR", | |
40 | + L"SSE/SSE2 instruction set is not supported on this machine.\n", | |
41 | + L"Freeverb3_VST CPU SIMD ERROR", | |
70 | 42 | MB_OK); |
71 | 43 | #endif |
72 | 44 | return check; |
@@ -321,7 +321,7 @@ | ||
321 | 321 | void ProcessBlock::p_process(float **inputs, float **outputs, VstInt32 sampleFrames) |
322 | 322 | { |
323 | 323 | uint32_t mxcsr = UTILS::getMXCSR(); |
324 | - UTILS::setMXCSR(FV3_FLAG_MXCSR_FZ|FV3_FLAG_MXCSR_DAZ|FV3_FLAG_MXCSR_EMASK_ALL); | |
324 | + UTILS::setMXCSR(FV3_X86SIMD_MXCSR_FZ|FV3_X86SIMD_MXCSR_DAZ|FV3_X86SIMD_MXCSR_EMASK_ALL); | |
325 | 325 | if(processBlockSize < sampleFrames) |
326 | 326 | if(allocProcessBlock(sampleFrames) != sampleFrames) return; |
327 | 327 | #ifdef PLUGDOUBLE |
@@ -356,7 +356,7 @@ | ||
356 | 356 | VstInt32 sampleFrames) |
357 | 357 | { |
358 | 358 | uint32_t mxcsr = UTILS::getMXCSR(); |
359 | - UTILS::setMXCSR(FV3_FLAG_MXCSR_FZ|FV3_FLAG_MXCSR_DAZ|FV3_FLAG_MXCSR_EMASK_ALL); | |
359 | + UTILS::setMXCSR(FV3_X86SIMD_MXCSR_FZ|FV3_X86SIMD_MXCSR_DAZ|FV3_X86SIMD_MXCSR_EMASK_ALL); | |
360 | 360 | if(processBlockSize < sampleFrames) if(allocProcessBlock(sampleFrames) != sampleFrames) return; |
361 | 361 | #ifdef PLUGDOUBLE |
362 | 362 | float2double(inputs[0], inputBlock.L, sampleFrames); |
@@ -382,7 +382,7 @@ | ||
382 | 382 | void ProcessBlock::p_processDoubleReplacing(double **inputs, double **outputs, VstInt32 sampleFrames) |
383 | 383 | { |
384 | 384 | uint32_t mxcsr = UTILS::getMXCSR(); |
385 | - UTILS::setMXCSR(FV3_FLAG_MXCSR_FZ|FV3_FLAG_MXCSR_DAZ|FV3_FLAG_MXCSR_EMASK_ALL); | |
385 | + UTILS::setMXCSR(FV3_X86SIMD_MXCSR_FZ|FV3_X86SIMD_MXCSR_DAZ|FV3_X86SIMD_MXCSR_EMASK_ALL); | |
386 | 386 | if(processBlockSize < sampleFrames) if(allocProcessBlock(sampleFrames) != sampleFrames) return; |
387 | 387 | memcpy(inputBlock.L, inputs[0], sizeof(double)*sampleFrames); |
388 | 388 | memcpy(inputBlock.R, inputs[1], sizeof(double)*sampleFrames); |
@@ -87,6 +87,25 @@ | ||
87 | 87 | AC_DEFINE([HAVE_FLEXIBLE_ARRAY],0) |
88 | 88 | fi |
89 | 89 | |
90 | +AC_ARG_ENABLE(x86simd, AC_HELP_STRING([--enable-x86simd], [Use X86/X64 SIMD.(default=auto)]), [cv_x86simd="$enable_x86simd"], [cv_x86simd="auto"]) | |
91 | + | |
92 | +case "${target_cpu}" in | |
93 | + x86*|i386*|i486*|i586*|i686*|amd64*|x86_64*) | |
94 | + if test "x$cv_x86simd" = "xauto"; then | |
95 | + AC_MSG_NOTICE([Auto-enabling x86/x64 SIMD codes]) | |
96 | + cv_x86simd=yes | |
97 | + fi | |
98 | + ;; | |
99 | + *) | |
100 | + cv_x86simd=no | |
101 | + ;; | |
102 | +esac | |
103 | + | |
104 | +if test "x$cv_x86simd" = "xyes"; then | |
105 | + AC_DEFINE(ENABLE_X86SIMD,1,Define to 1 if you use x86 SIMD) | |
106 | + AC_MSG_RESULT([Using x86/x64 SIMD codes]) | |
107 | +fi | |
108 | + | |
90 | 109 | AC_ARG_ENABLE(vsttarget,AS_HELP_STRING([--enable-vsttarget],[TARGET(default=windows,macosx).]),[cv_vsttarget="$enable_vsttarget"], [cv_vsttarget="windows"]) |
91 | 110 | AC_SUBST(cv_vsttarget) |
92 | 111 | case "$cv_vsttarget" in |
@@ -4,7 +4,7 @@ | ||
4 | 4 | export set target=i686-w64-mingw32 |
5 | 5 | export set host=$target |
6 | 6 | export set build=i486-linux-gnu |
7 | -export CFLAGS="-pipe -Wall -O3 -ffast-math -DENABLE_SSE2 -march=pentium4 -mfpmath=sse -mstackrealign" | |
7 | +export CFLAGS="-pipe -Wall -O3 -ffast-math -march=pentium4 -mfpmath=sse -mstackrealign" | |
8 | 8 | export CXXFLAGS=$CFLAGS |
9 | 9 | |
10 | 10 | ./configure --prefix=/Freeverb3_VST --build=$build --host=$host --target=$target \ |
@@ -1,78 +0,0 @@ | ||
1 | -/** | |
2 | - * Freeverb3 CPU Checker | |
3 | - * | |
4 | - * Copyright (C) 2007-2017 Teru Kamogashira | |
5 | - * | |
6 | - * This program is free software; you can redistribute it and/or modify | |
7 | - * it under the terms of the GNU General Public License as published by | |
8 | - * the Free Software Foundation; either version 2 of the License, or | |
9 | - * (at your option) any later version. | |
10 | - * | |
11 | - * This program is distributed in the hope that it will be useful, | |
12 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | - * GNU General Public License for more details. | |
15 | - * | |
16 | - * You should have received a copy of the GNU General Public License | |
17 | - * along with this program; if not, write to the Free Software | |
18 | - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
19 | - */ | |
20 | - | |
21 | -#include <stdio.h> | |
22 | -#include <stdint.h> | |
23 | -#include <string> | |
24 | -#include <windows.h> | |
25 | -#include <freeverb/utils.hpp> | |
26 | - | |
27 | -#ifdef PLUGDOUBLE | |
28 | -typedef fv3::utils_ UTILS; | |
29 | -typedef double pfloat_t; | |
30 | -#else | |
31 | -typedef fv3::utils_f UTILS; | |
32 | -typedef float pfloat_t; | |
33 | -#endif | |
34 | - | |
35 | -int main() | |
36 | -{ | |
37 | - uint32_t simdFlag = UTILS::getSIMDFlag(); | |
38 | - | |
39 | - MessageBoxW(NULL, | |
40 | - L"CPU Instruction Detector for Windows", | |
41 | - L"Freeverb3VST",MB_OK); | |
42 | - MessageBoxW(NULL, | |
43 | - L"There are two types of binary distribution.\n" | |
44 | - L"\"fast\" is a single precision version, \n" | |
45 | - L"which is suitable for realtime effect.\n" | |
46 | - L"\"slow\" is a double precision version, \n" | |
47 | - L"which may be slower than the fast version.\n" | |
48 | - L"\"fast\" version should be used for realtime operation.", | |
49 | - L"Freeverb3VST",MB_OK); | |
50 | - | |
51 | - std::string fl = "", db = ""; | |
52 | - //if((simdFlag&FV3_FLAG_3DNOW)) { fl = "3DNOW"; } | |
53 | - if((simdFlag&FV3_FLAG_SSE)) { fl = "SSE"; } | |
54 | - if((simdFlag&FV3_FLAG_SSE2)) { db = "SSE2"; } | |
55 | - //if((simdFlag&FV3_FLAG_SSE3)) { fl = "SSE3"; } | |
56 | - //if((simdFlag&FV3_FLAG_SSE4_1)){ fl = "SSE4"; } | |
57 | - if((simdFlag&FV3_FLAG_AVX)) { fl = "AVX"; db = "AVX"; } | |
58 | - | |
59 | - std::string out = ""; | |
60 | - if(fl != "") | |
61 | - out = | |
62 | - "You should use\n" | |
63 | - "\"fast-" + fl + "-singleprecision\"\n" | |
64 | - "version for realtime operation.\n"; | |
65 | - else | |
66 | - out = | |
67 | - "There are no supported version for single precision plugins.\n"; | |
68 | - | |
69 | - if(db != "") | |
70 | - out += "You can use\n" | |
71 | - "\"slow-" + db + "-doubleprecision\"\n" | |
72 | - "version for precise processing.\n"; | |
73 | - else | |
74 | - out += | |
75 | - "There are no supported version for double precision plugins.\n"; | |
76 | - | |
77 | - MessageBoxA(NULL, out.c_str(), "Freeverb3VST", MB_OK); | |
78 | -} |