Skip to content

Commit

Permalink
Fix difference output with Matlab anthonix/ffts#55
Browse files Browse the repository at this point in the history
  • Loading branch information
dzungpv committed Jul 16, 2019
1 parent d2a417f commit 265995f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions library/src/main/jni/ffts_jni.c
Original file line number Diff line number Diff line change
Expand Up @@ -186,23 +186,23 @@ JNIEXPORT void JNICALL Java_nz_ac_waikato_ffts_FFTS_execute__JJ_3FI_3FI
// On oracle jvm this is faster than GetFloatArrayElements()
void *src, *dst;

src = xmemalign(64, size * 4);
src = xmemalign(64, (*env)->GetArrayLength(env, jsrc) * 4);
if (!src)
{
throwOutOfMemoryError(env, NULL);
return;
}
dst = xmemalign(64, size * 4);
dst = xmemalign(64, (*env)->GetArrayLength(env, jdst) * 4);
if (!dst)
{
free(src);
throwOutOfMemoryError(env, NULL);
return;
}

(*env)->GetFloatArrayRegion(env, jsrc, 0, size, src + soff);
(*env)->GetFloatArrayRegion(env, jsrc, 0, (*env)->GetArrayLength(env, jsrc), src + soff);
ffts_execute(plan, src, dst);
(*env)->SetFloatArrayRegion(env, jdst, 0, size, dst + doff);
(*env)->SetFloatArrayRegion(env, jdst, 0, (*env)->GetArrayLength(env, jdst), dst + doff);

free(dst);
free(src);
Expand Down

0 comments on commit 265995f

Please sign in to comment.