All Downloads are FREE. Search and download functionalities are using the official Maven repository.

de.jarnbjo.vorbis.MdctFloat Maven / Gradle / Ivy

/*
 * $ProjectName$
 * $ProjectRevision$
 * -----------------------------------------------------------
 * $Id: MdctFloat.java,v 1.3 2003/04/10 19:49:04 jarnbjo Exp $
 * -----------------------------------------------------------
 *
 * $Author: jarnbjo $
 *
 * Description:
 *
 * Copyright 2002-2003 Tor-Einar Jarnbjo
 * -----------------------------------------------------------
 *
 * Change History
 * -----------------------------------------------------------
 * $Log: MdctFloat.java,v $
 * Revision 1.3  2003/04/10 19:49:04  jarnbjo
 * no message
 *
 * Revision 1.2  2003/03/16 01:11:12  jarnbjo
 * no message
 *
 *
 */

package de.jarnbjo.vorbis;

public class MdctFloat {
  static private final float cPI3_8=0.38268343236508977175f;
  static private final float cPI2_8=0.70710678118654752441f;
  static private final float cPI1_8=0.92387953251128675613f;

  private int n;
  private int log2n;

  private float[] trig;
  private int[] bitrev;

  private float[] equalizer;

  private float scale;

  private int itmp1, itmp2, itmp3, itmp4, itmp5, itmp6, itmp7, itmp8, itmp9;
  private float dtmp1, dtmp2, dtmp3, dtmp4, dtmp5, dtmp6, dtmp7, dtmp8, dtmp9;

  protected MdctFloat(int n) {
    bitrev=new int[n/4];
    trig=new float[n+n/4];

    int n2=n>>>1;
    log2n=(int)Math.rint(Math.log(n)/Math.log(2));
    this.n=n;

    int AE=0;
    int AO=1;
    int BE=AE+n/2;
    int BO=BE+1;
    int CE=BE+n/2;
    int CO=CE+1;
    // trig lookups...
    for(int i=0;i>>j!=0;j++)
	  if(((msb>>>j)&i)!=0)acc|=1<>1;
      int n4=n>>2;
      int n8=n>>3;

      if(equalizer!=null) {
         for(int i=0; i32767.0f) temp1=32767.0f;
            //if(temp1<-32768.0f) temp1=-32768.0f;
            //if(temp2>32767.0f) temp2=32767.0f;
            //if(temp2<-32768.0f) temp2=-32768.0f;

	         pcm[o1]=(int)(-temp1*window[o1]);
	         pcm[o2]=(int)( temp1*window[o2]);
	         pcm[o3]=(int)( temp2*window[o3]);
	         pcm[o4]=(int)( temp2*window[o4]);

	         o1++;
	         o2--;
	         o3++;
	         o4--;
	         //xx+=2;
	         //B+=2;
         }
      }
   }

   private float[] kernel(float[] x, float[] w,
	                       int n, int n2, int n4, int n8){
      // step 2

      int xA=n4;
      int xB=0;
      int w2=n4;
      int A=n2;

      for(int i=0;i>>(i+2);
	         int k1=1<<(i+3);
	         int wbase=n2-2;

	         A=0;
	         float[] temp;

	         for(int r=0;r<(k0>>>2);r++){
               int w1=wbase;
               w2=w1-(k0>>1);
               float AEv= trig[A],wA;
               float AOv= trig[A+1],wB;
               wbase-=2;

               k0++;
               for(int s=0;s<(2<




© 2015 - 2025 Weber Informatics LLC | Privacy Policy