I am using the Java fftw3 wrapper taken from this question. (Code here)
I just wanted to apply a 2nd type DCT transform to an array of double elements, but I keep getting this error if i try to call the fftw_execute
method:
java(787,0x10b243000) malloc: *** error for object 0x7fba642c5408: incorrect checksum for freed object - object was probably modified after being freed.
*** set a breakpoint in malloc_error_break to debug
Why?
Here's my code:
package com.project.fftw3;
import java.io.File;
import java.io.IOException;
import java.nio.DoubleBuffer;
import fftw3.FFTW3Library;
import fftw3.FFTW3Library.fftw_plan;
public class MainClass {
static FFTW3Library fftw = FFTW3Library.INSTANCE;
public static void main(String[] args) {
int i,j,w,h;
File in = new File("Images/Baboon.bmp");
//File out = new File("Baboon-" + System.currentTimeMillis() + ".txt");
try {
ImageMatrix im = new ImageMatrix(in);
w=im.getImageWidth();
h=im.getImageHeight();
double [] row = im.getRow(0);
double [] oarr = new double[w];
DoubleBuffer din = DoubleBuffer.wrap(row);
DoubleBuffer dout = DoubleBuffer.wrap(oarr);
fftw_plan p = fftw.fftw_plan_dft_1d(din.array().length,din,dout,5,FFTW3Library.FFTW_ESTIMATE); //5 is REDFT10
fftw.fftw_execute(p);
fftw.fftw_destroy_plan(p);
} catch (IOException e) {
}
}
}