static int[][] getDct(string filename)
{
jpeg_decompress_struct cinfo = new jpeg_decompress_struct();
FileStream objFileStreamHeaderImage = new FileStream(filename, FileMode.Open, FileAccess.Read);
cinfo.jpeg_stdio_src(objFileStreamHeaderImage);
cinfo.jpeg_read_header(true);
var coeffs = cinfo.jpeg_read_coefficients();
const int size = 64;
int height = cinfo.Image_height / size;
int width = cinfo.Image_width / size;
int[][] result = new int[height * width][];
var dct = coeffs[0].Access(0, height);
for (int i = 0; i < height * width; i++)
{
result[i] = new int[size];
}
for (int i = 0; i < height; i++)
{
for (int j = 0; j < width; j++)
{
for (int k = 0; k < 64; k++)
{
result[i * width + j][k] = dct[i][j][k];
}
}
}
return result;
}