Skip to content

Commit e8a8b3c

Browse files
committed
cleaned a ton of bitrot
1 parent 5f47c16 commit e8a8b3c

File tree

7 files changed

+55
-28
lines changed

7 files changed

+55
-28
lines changed

libjamesdsp/JdspImpResToolbox.c

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -252,10 +252,26 @@ static void decompressResamplerMQ(const double y[701], float *yi)
252252
yi[k] = xloc * (xloc * (xloc * coefs[low_i] + coefs[low_i + 700]) + coefs[low_i + 1400]) + coefs[low_i + 2100];
253253
}
254254
}
255-
255+
void jds_reverse(float *arr, int32_t start, int32_t end) {
256+
while (start < end)
257+
{
258+
float tmp = arr[start];
259+
arr[start] = arr[end];
260+
arr[end] = tmp;
261+
start++;
262+
end--;
263+
}
264+
}
265+
void jds_shift(float *arr, int32_t k, int32_t n)
266+
{
267+
k = k % n;
268+
jds_reverse(arr, 0, n - 1);
269+
jds_reverse(arr, 0, n - k - 1);
270+
jds_reverse(arr, n - k, n - 1);
271+
}
256272
void circshift(float *x, int n, int k)
257273
{
258-
k < 0 ? shift(x, -k, n) : shift(x, n - k, n);
274+
k < 0 ? jds_shift(x, -k, n) : jds_shift(x, n - k, n);
259275
}
260276
#define NUMPTS 15
261277
#define NUMPTS_DRS (7)
@@ -303,10 +319,11 @@ float* loadAudioFile(const char *filename, double targetFs, unsigned int *channe
303319
unsigned int fs = 1;
304320
const char *ext = get_filename_ext(filename);
305321
float *pSampleData = 0;
322+
drflac_uintptr *totalPCMFrameFlac = (drflac_uintptr *) totalPCMFrameCount;
306323
if (!strncmp(ext, "wav", 5) || !strncmp(ext, "irs", 5))
307324
pSampleData = drwav_open_file_and_read_pcm_frames_f32(filename, channels, &fs, totalPCMFrameCount, 0);
308325
if (!strncmp(ext, "flac", 5))
309-
pSampleData = drflac_open_file_and_read_pcm_frames_f32(filename, channels, &fs, totalPCMFrameCount, 0);
326+
pSampleData = drflac_open_file_and_read_pcm_frames_f32(filename, channels, &fs, totalPCMFrameFlac, 0);
310327
/*if (!strncmp(ext, "mp3", 5))
311328
{
312329
drmp3_config mp3Conf;

libjamesdsp/JdspImpResToolbox.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#ifndef JDSPIMPRESTOOLBOX_H
22
#define JDSPIMPRESTOOLBOX_H
3-
43
extern float* ReadImpulseResponseToFloat(const char* mIRFileName, int targetSampleRate, int* jImpInfo, int convMode, int* javaAdvSetPtr);
54
extern int ComputeEqResponse(const double* jfreq, double* jgain, int interpolationMode, int queryPts, double* dispFreq, float* response);
65
extern int ComputeCompResponse(int n, const double* jfreq, const double* jgain, int queryPts, const double* dispFreq, float* response);

libjamesdsp/PrintfStdOutExtension.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#include "PrintfStdOutExtension.h"
22
#include <stdarg.h>
3+
#include <stdio.h>
4+
#include <stdlib.h>
35

46
static stdOutHandler _printfStdOutHandlerPtr = 0;
57
static void* _printfStdOutHandlerUserPtr = 0;
@@ -23,7 +25,7 @@ int redirected_printf(const char * format, ...) {
2325
return result;
2426
}
2527

26-
void __android_log_print(int severity, const char* tag, const char* msg) {
28+
void __android_log_print(int severity, const char* tag, const char* msg, ...) {
2729
char *s;
2830
if (asprintf(&s, "%s: %s", tag, msg) > 0 && s != 0)
2931
{

libjamesdsp/PrintfStdOutExtension.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,10 @@ typedef void (*stdOutHandler)(const char*, void*);
66

77
extern void setPrintfStdOutHandler(stdOutHandler funcPtr, void* userData);
88
extern int isPrintfStdOutHandlerSet();
9+
extern void __android_log_print(int severity, const char* tag, const char* msg, ...)
10+
#if defined(__GNUC__)
11+
__attribute__ ((format(printf, 3, 4)))
12+
#endif
13+
;
914

1015
#endif // EELSTDOUTEXTENSION_H

libjamesdsp/subtree/Main/libjamesdsp/jni/jamesdsp/jdsp/Effects/eel2/nseel-compiler.c

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1366,6 +1366,24 @@ static float NSEEL_CGEN_CALL arburgPredictBackward(float *blocks, float *start)
13661366
double output = predictArburg(backwardState, predictionCoefficients, *flag);
13671367
return (float)output;
13681368
}
1369+
void reverse(float *arr, int32_t start, int32_t end)
1370+
{
1371+
while (start < end)
1372+
{
1373+
float tmp = arr[start];
1374+
arr[start] = arr[end];
1375+
arr[end] = tmp;
1376+
start++;
1377+
end--;
1378+
}
1379+
}
1380+
void shift(float *arr, int32_t k, int32_t n)
1381+
{
1382+
k = k % n;
1383+
reverse(arr, 0, n - 1);
1384+
reverse(arr, 0, n - k - 1);
1385+
reverse(arr, n - k, n - 1);
1386+
}
13691387
static float NSEEL_CGEN_CALL arburgPredictForward(float *blocks, float *start)
13701388
{
13711389
int32_t offs = (int32_t)(*start + NSEEL_CLOSEFACTOR);
@@ -1376,24 +1394,6 @@ static float NSEEL_CGEN_CALL arburgPredictForward(float *blocks, float *start)
13761394
double output = predictArburg(forwardState, predictionCoefficients, *flag);
13771395
return (float)output;
13781396
}
1379-
void reverse(float *arr, int32_t start, int32_t end)
1380-
{
1381-
while (start < end)
1382-
{
1383-
float tmp = arr[start];
1384-
arr[start] = arr[end];
1385-
arr[end] = tmp;
1386-
start++;
1387-
end--;
1388-
}
1389-
}
1390-
void shift(float *arr, int32_t k, int32_t n)
1391-
{
1392-
k = k % n;
1393-
reverse(arr, 0, n - 1);
1394-
reverse(arr, 0, n - k - 1);
1395-
reverse(arr, n - k, n - 1);
1396-
}
13971397
float * NSEEL_CGEN_CALL __NSEEL_circshift(float *blocks, float *offptr, float *shiftptr, float *lenptr)
13981398
{
13991399
uint32_t offs = (uint32_t)(*offptr + NSEEL_CLOSEFACTOR);
@@ -1646,7 +1646,7 @@ static float NSEEL_CGEN_CALL eel_mean(float *blocks, float *start, float *lengt
16461646
---------------------------------------------------------------------------*/
16471647
float kth_smallest(float a[], int n, int k)
16481648
{
1649-
register i, j, l, m;
1649+
register int i, j, l, m;
16501650
register float x;
16511651

16521652
l = 0; m = n - 1;
@@ -3855,7 +3855,7 @@ static float NSEEL_CGEN_CALL _eel_flacDecodeFile(void *opaque, INT_PTR num_param
38553855
float *blocks = c->ram_state;
38563856
const char *filename = (const char*)GetStringForIndex(c->region_context, *parms[0], 0);
38573857
uint32_t channels, fs;
3858-
uint64_t frameCount;
3858+
drflac_uintptr frameCount;
38593859
float *signal = drflac_open_file_and_read_pcm_frames_f32(filename, &channels, &fs, &frameCount, 0);
38603860
float targetFs = *parms[2];
38613861
if (targetFs > FLT_EPSILON)
@@ -3917,7 +3917,7 @@ static float NSEEL_CGEN_CALL _eel_flacDecodeMemory(void *opaque, INT_PTR num_par
39173917
size_t actualSize;
39183918
unsigned char *memoryBlk = base64_decode((const unsigned char*)base64String, strlen(base64String), &actualSize);
39193919
uint32_t channels, fs;
3920-
uint64_t frameCount;
3920+
drflac_uintptr frameCount;
39213921
float *signal = drflac_open_memory_and_read_pcm_frames_f32(memoryBlk, actualSize, &channels, &fs, &frameCount, 0);
39223922
float targetFs = *parms[2];
39233923
if (targetFs > FLT_EPSILON)
@@ -8185,4 +8185,4 @@ opcodeRec *nseel_translate(compileContext *ctx, const char *tmp, size_t tmplen)
81858185
return nseel_createCompiledValue(ctx, (float)rv);
81868186
}
81878187
return nseel_createCompiledValue(ctx, (float)atof(tmp));
8188-
}
8188+
}

libjamesdsp/subtree/Main/libjamesdsp/jni/jamesdsp/jdsp/Effects/liveprogWrapper.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
void NSEEL_HOSTSTUB_EnterMutex() { }
22
void NSEEL_HOSTSTUB_LeaveMutex() { }
3+
#include <math.h>
34
#include "../jdsp_header.h"
45
void LiveProgConstructor(JamesDSPLib *jdsp)
56
{

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,14 @@
33
#include <string.h>
44
#include <math.h>
55
#include <time.h>
6+
#include <sys/time.h>
67
#include <float.h>
8+
#include <unistd.h>
79
#include "Effects/eel2/dr_flac.h"
810
#include "Effects/eel2/ns-eel.h"
911
#include "jdsp_header.h"
1012
#define TAG "EffectDSPMain"
13+
#include "PrintfStdOutExtension.h"
1114

1215
#ifdef __ANDROID_API__
1316
#if __ANDROID_API__ < __ANDROID_API_J_MR2__
@@ -1259,4 +1262,4 @@ void JamesDSPFree(JamesDSPLib *jdsp)
12591262
FreeIntegerASRCHandler(&jdsp->asrc[1]);
12601263
}
12611264
jdsp_unlock(jdsp);
1262-
}
1265+
}

0 commit comments

Comments
 (0)