Android Open Source - renderScriptFFT D C T






From Project

Back to project page renderScriptFFT.

License

The source code is released under:

Copyright (c) 2013 The Regents of the University of California. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided...

If you think the Android project renderScriptFFT listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.android.rs.mel;
/*  ww  w .  j a v a  2  s .  co m*/
import org.apache.commons.math3.complex.Complex;
import org.apache.commons.math3.util.FastMath;

public class DCT {
  int numCoeffs = 0;
  double[] coeffs;
  public DCT(int _numCoeffs){
    numCoeffs = _numCoeffs;
    coeffs = new double[_numCoeffs*2];
    genCoeffs();
  }
  
  private void genCoeffs(){
    coeffs[0] = FastMath.sqrt(2);
    coeffs[1] = 0.0;
    Complex base = new Complex(0.0, 1.0);
    for (int i = 1; i < numCoeffs; ++i){
      Complex tmp = base.multiply((-0.5*FastMath.PI / numCoeffs) * (double) i).exp().multiply(2.0);
      coeffs[2*i] = tmp.getReal();
      coeffs[2*i + 1] = tmp.getImaginary();    
    } 
  }

  public double[] getCoeffs() {
    return coeffs;
  }
  
  
  
}




Java Source Code List

com.android.rs.MainActivity.java
com.android.rs.Mel_Test_MicroBench.java
com.android.rs.Mel_Test_Microphone.java
com.android.rs.Mel_Test.java
com.android.rs.mel.DCT.java
com.android.rs.mel.HammingFilter.java
com.android.rs.mel.MelFilterbank.java
com.android.rs.utils.ArrayConversion.java
com.android.rs.utils.MatrixMath.java
com.android.rs.utils.MelMath.java