Software‎ > ‎

JTransforms

Description

JTransforms is the first, open source, multithreaded FFT library written in pure Java. Currently, four types of transforms are available: Discrete Fourier Transform (DFT), Discrete Cosine Transform (DCT), Discrete Sine Transform (DST) and Discrete Hartley Transform (DHT). The code is derived from General Purpose FFT Package written by Takuya Ooura and from Java FFTPack written by Baoshe Zhang. Here are the projects that use JTransforms:

  • VisNow - a generic visualization framework.

  • MusicReader - a software that makes reading music easy and convenient.

  • Spectro-Edit - a software for showing the audio visually in a time vs. frequency plot.

  • yaprnn - yet another pattern recognizing neural network.

  • ExpertEyes - an open source eyetracking application.

  • TarsosDSP - a real-time audio processing framework.

  • FFT plugin for Icy - Fast Fourier Transform for 2D/3D images.

  • REW - Room EQ Wizard.

Features

  • The fastest implementation of DFT, DCT, DST and DHT in pure Java (see benchmark).

  • 1, 2 and 3-dimensional transforms.

  • Arbitrary size of the data.

  • Support for very large 1-dimensional arrays (up  to 263 elements).

  • Single and double precision.

  • 1-dimensional and multi-dimensional variants of 2D and 3D transforms.

  • Automatic multithreading - threads are used automatically if #CPUs > 1.

  • Optimized FFTs for real input data (40% faster than complex).

Limitations

  • 1-dimensional transforms for not power-of-two sizes are sequential (when the mixed-radix is used).

  • 1-dimensional transforms for power-of-two sizes can use only 2 or 4 threads.

  • The number of threads must be a power-of-two number.

  • Only in-place transforms are available.

  • Only DCT-II and DCT-III are available.

  • Only DST-II and DST-III are available.

  • Only real DHT is available.

Benchmark

JTransforms 3.0 were benchmarked against FFTW 3.3.4. 16 threads were used for all tested algorithms. Only single precision, in-place transforms were computed. The timings in the tables below show a minimal execution time among 100 calls of each transform. They do not incorporate the JVM warm-up phase for JTransforms.

Benchmark code:

Testbed:

  • 2 x Intel Xeon E5-2687W (3.1GHz, 20MB Cache),
  • 512 GB RAM,
  • OpenSuse 13.1,
  • GCC 4.8.1,
  • Oracle Java 1.8.0_05,
  • Configure flags for FFTW: --enable-threads --enable-float --enable-sse.
  • Java flags: -Xms400G -Xmx400G -XX:+UseG1GC.
Library \ Size 2^18 2^19 2^20 2^21 2^22 2^23 2^24 2^25
JTransforms without constructor
2.89
5.30
10.22
20.61
67.20
149.30
321.79
685.70
JTransforms with constructor
13.28
18.65
29.25
63.95
141.77
297.16
616.76
1322.77
FFTW_ESTIMATE without planning 2.01
4.22
4.60
6.87
46.92
69.87
192.16
317.02
FFTW_ESTIMATE with planning 8.05
30.21
17.98
17.44
53.98
82.23
201.57
332.80
FFTW_MEASURE without planning 1.27
1.32
5.54
5.80
27.36
35.82
115.15
131.74
FFTW_MEASURE with planning 12008.53
1596.05
1510.43
4111.33
3925.72
31026.67
17122.96
118312.39

Minimal execution time (in milliseconds) for 1D complex forward FFT (powers of two).


Library \ Size 2^8 2^9 2^10 2^11 2^12 2^13 2^14 2^15
JTransforms without constructor (1D input)
0.28
1.07
3.96
17.40
102.31
496.66
1559.39
8210.29
JTransforms with constructor (1D input)
0.30
1.09
4.02
17.51
102.45
496.92
1559.78
8212.69
JTransforms without constructor (2D input) 0.391.10
 4.4315.27
88.21
407.86
1903.79
7987.69
JTransforms with constructor (2D input) 0.431.16 4.51 15.4188.42 408.311904.56 7990.43
FFTW_ESTIMATE without planning 1.46
0.93
2.60
74.89
394.00
1253.60
7046.70
30440.67
FFTW_ESTIMATE with planning 3.47
2.98
5.24
77.38
397.38
1257.47
7051.96
30451.29
FFTW_MEASURE without planning 0.11
0.47
1.52
11.85
46.06
161.59
1063.78
5193.38
FFTW_MEASURE with planning 188.87
351.94
828.64
4101.07
17668.54
35372.05
67427.75
255687.17

Minimal execution time (in milliseconds) for 2D complex forward FFT (powers of two).


Library \ Size 2^4 2^5 2^6 2^7 2^8 2^9 2^10 2^11
JTransforms without constructor (1D input)
0.28
0.96
1.12
8.28
102.96
699.93
13408.71
99048.46
JTransforms with constructor (1D input)
0.29
0.97
1.16
8.31
103.02
699.99
13408.90
99049.52
JTransforms without constructor (3D input)0.10
0.90
1.12
5.33
46.60
451.24
7673.80
43472.17
JTransforms with constructor (3D input)0.110.92
1.13
5.38
46.66
451.35
7673.93
43472.38
FFTW_ESTIMATE without planning 0.03
0.06
0.28
2.13
207.78
1874.07
25742.89
segfault
FFTW_ESTIMATE with planning 0.40
0.44
0.68
2.54
210.14
1876.29
25745.86
segfault
FFTW_MEASURE without planning 0.03
0.06
0.31
2.09
54.22
265.38
2783.82
segfault
FFTW_MEASURE with planning 19.06
82.60
256.62
808.09
6184.67
27990.87
180315.01
segfault

Minimal execution time (in milliseconds) for 3D complex forward FFT (powers of two).

License

JTransforms is distributed under the terms of the BSD-2-Clause license.

Download

JTransforms 3.0 is available on maven central as

<dependency>
    <groupId>com.github.wendykierp</groupId>
    <artifactId>JTransforms</artifactId>
    <version>3.0</version>
</dependency>

version 3.0 (July 8, 2014)

binary: 

doc: 

source: 

Donations

If you have found this library useful and would like to thank the author, you can make a donation to show your appreciation.

Support This Project

Comments