Android Open Source - renderScriptFFT Array Conversion






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.utils;
/*from   www.  j  a v a  2s  .c om*/
import org.apache.commons.math3.util.FastMath;

public class ArrayConversion {
  private ArrayConversion() {
  }

  public static float[] bytesToFloat(byte[] in){
    float[] out = new float[in.length];
    for (int i = 0; i < in.length; ++i) {
      out[i] = (float) in[i];
    }
    return out;
  }
  
  public static float[] doublesToFloats(double[] in) {
    float[] out = new float[in.length];
    for (int i = 0; i < in.length; ++i) {
      out[i] = (float) in[i];
    }
    return out;
  }
  
  public static float[] createRealImag(float[] in, int frameSize) {
    int dataLength = in.length;
    int numFrames = (int) FastMath.ceil((double) dataLength
        / (double) frameSize);
    
    float[] out = new float[numFrames * frameSize * 2];
    for (int i = 0; i < in.length; ++i) {
      out[i * 2] = in[i];
    }

    return out;
  }
  
}




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