package jsci.maths.wavelet.daubechies2;
import jsci.maths.wavelet.FWT;
/************************
* This is a very fast implementation of the
* Fast Wavelet Transform. It uses in-place computations
* for less memory usage. Data length should be
* a power of 2 a be at least of length 4.
* Handles boundaries by assuming periodicity.
* Ideal for image processing or processing large
* amount of data. Uses floats for more performance.
* Safety is minimal, so be careful!
* @author Daniel Lemire
*************************/
public final class FastDaubechies2 extends FWT {
static final private float root3 = (float)(Math.sqrt(3.0));
static final private float normalizer = (float)(Math.pow(2d,-.5d));
static final float[] scale = {(1f+(root3))*normalizer/4f,(3f+(root3))*normalizer/4f,(3f+(-1*(root3)))*normalizer/4f,(1f+(-1*(root3)))*normalizer/4f};
static final float[] wavelet = {-(1f+(-1*(root3)))*normalizer/4f,(3f+(-1*(root3)))*normalizer/4f,-(3f+(root3))*normalizer/4f,(1f+(root3))*normalizer/4f};
public FastDaubechies2() {
}
public static void transform (float[] v,int last) {
float[] ans=new float[last];
final int half=last/2;
try {
for(int k=0;/*k4;last/=2) {
transform(v,last);
}
if(last!=4)
System.err.println("Careful! this should be a power of 2 : "+v.length);
}
public void invTransform(float[] v) {
int last;
for (last=4;2*last<=v.length;last*=2) {
invTransform(v,last);
}
if(last!=v.length)
System.err.println("Careful! this should be a power of 2 : "+v.length);
}
public static void invTransform (float[] v, int last) {
int ResultingLength=2*last;
float[] ans=new float[ResultingLength];
try {
for(int k=0;/*k
Ads help maintain this website.