Skip to content

Commit ce3c9fe

Browse files
committed
Merge commit '6755b249148a3b8c6d12c01f03259ea5ba62f8a4'
2 parents ec630e9 + 6755b24 commit ce3c9fe

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

libjamesdsp/subtree/Main/libjamesdsp/jni/jamesdsp/jdsp/jdspController.c

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,15 @@
88
#include "Effects/eel2/ns-eel.h"
99
#include "jdsp_header.h"
1010
#define TAG "EffectDSPMain"
11+
12+
#ifdef __ANDROID_API__
13+
#if __ANDROID_API__ < __ANDROID_API_J_MR2__
14+
double log2(double x) {
15+
return (log(x)*1.4426950408889634);
16+
}
17+
#endif
18+
#endif
19+
1120
// Range: 0x800000, 0x7fffff
1221
int32_t i32_from_p24_big_endian(const uint8_t *packed24)
1322
{
@@ -107,6 +116,7 @@ double getProcTime(int flen, int num, double dur)
107116
free(y);
108117
return t_diff / (double)counter;
109118
}
119+
char benchmarkEnable = 0;
110120
char benchmarkCompletionFlag = 0;
111121
double convbench_c0[MAX_BENCHMARK] = { 2.4999999e-05f,4.9999999e-05f,9.9999997e-05f,0.0002f,0.0005f,0.001f,0.0021f,0.0057f,0.0126f,0.0293f };
112122
double convbench_c1[MAX_BENCHMARK] = { 3.1249999e-06f,6.2499998e-06f,1.2500000e-05f,2.4999999e-05f,4.9999999e-05f,9.9999997e-05f,0.0002f,0.0004f,0.0009f,0.0019f };
@@ -200,6 +210,7 @@ void JamesDSPGlobalMemoryAllocation(int do_benchmark)
200210
{
201211
benchmarkCompletionFlag = 0;
202212
NSEEL_start();
213+
benchmarkEnable = do_benchmark;
203214
if(do_benchmark) {
204215
pthread_t benchmarkThread;
205216
pthread_create(&benchmarkThread, NULL, convBench, 0);
@@ -247,6 +258,14 @@ void JamesDSPReallocateBlock(JamesDSPLib *jdsp, size_t n)
247258
}
248259
void JamesDSPRefreshConvolutions(JamesDSPLib *jdsp, char refreshAll)
249260
{
261+
// Temporary(?) bug fix when benchmarks are off
262+
if(!benchmarkEnable) {
263+
#ifdef DEBUG
264+
__android_log_print(ANDROID_LOG_INFO, TAG, "ignoring call to JamesDSPRefreshConvolutions(...) because benchmarks are disabled");
265+
#endif
266+
return;
267+
}
268+
250269
#ifdef DEBUG
251270
__android_log_print(ANDROID_LOG_INFO, TAG, "Buffer size changed, update convolution object to maximize performance");
252271
#endif
@@ -876,6 +895,7 @@ void pfloat32Multiplexed(JamesDSPLib *jdsp, float *x, float *y, size_t n)
876895
if (jdsp->blockSize != n)
877896
{
878897
jdsp->blockSize = n;
898+
879899
JamesDSPRefreshConvolutions(jdsp, 1);
880900
}
881901
for (size_t i = 0; i < n; i++)
@@ -1225,4 +1245,4 @@ void JamesDSPFree(JamesDSPLib *jdsp)
12251245
FreeIntegerASRCHandler(&jdsp->asrc[1]);
12261246
}
12271247
jdsp_unlock(jdsp);
1228-
}
1248+
}

0 commit comments

Comments
 (0)