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

com.github.trilarion.jcraft.jorbis.Drft Maven / Gradle / Ivy

There is a newer version: 1.1.0
Show newest version
/* -*-mode:java; c-basic-offset:2; indent-tabs-mode:nil -*- */
/* JOrbis
 * Copyright (C) 2000 ymnk, JCraft,Inc.
 *  
 * Written by: 2000 ymnk
 *   
 * Many thanks to 
 *   Monty  and 
 *   The XIPHOPHORUS Company http://www.xiph.org/ .
 * JOrbis has been based on their awesome works, Vorbis codec.
 *   
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public License
 * as published by the Free Software Foundation; either version 2 of
 * the License, or (at your option) any later version.
   
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Library General Public License for more details.
 * 
 * You should have received a copy of the GNU Library General Public
 * License along with this program; if not, write to the Free Software
 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */

package com.github.trilarion.jcraft.jorbis;

class Drft{
  int n;
  float[] trigcache;
  int[] splitcache;

  void backward(float[] data){
    if(n==1)
      return;
    drftb1(n, data, trigcache, trigcache, n, splitcache);
  }

  void init(int n){
    this.n=n;
    trigcache=new float[3*n];
    splitcache=new int[32];
    fdrffti(n, trigcache, splitcache);
  }

  void clear(){
    if(trigcache!=null)
      trigcache=null;
    if(splitcache!=null)
      splitcache=null;
  }

  static int[] ntryh= {4, 2, 3, 5};
  static float tpi=6.28318530717958647692528676655900577f;
  static float hsqt2=.70710678118654752440084436210485f;
  static float taui=.86602540378443864676372317075293618f;
  static float taur=-.5f;
  static float sqrt2=1.4142135623730950488016887242097f;

  static void drfti1(int n, float[] wa, int index, int[] ifac){
    float arg, argh, argld, fi;
    int ntry=0, i, j=-1;
    int k1, l1, l2, ib;
    int ld, ii, ip, is, nq, nr;
    int ido, ipm, nfm1;
    int nl=n;
    int nf=0;

    int state=101;

    loop: while(true){
      switch(state){
        case 101:
          j++;
          if(j<4)
            ntry=ntryh[j];
          else
            ntry+=2;
        case 104:
          nq=nl/ntry;
          nr=nl-ntry*nq;
          if(nr!=0){
            state=101;
            break;
          }
          nf++;
          ifac[nf+1]=ntry;
          nl=nq;
          if(ntry!=2){
            state=107;
            break;
          }
          if(nf==1){
            state=107;
            break;
          }

          for(i=1; i>1;
    ipp2=ip;
    idp2=ido;
    nbd=(ido-1)>>1;
    t0=l1*ido;
    t10=ip*ido;

    int state=100;
    loop: while(true){
      switch(state){
        case 101:
          if(ido==1){
            state=119;
            break;
          }
          for(ik=0; ikl1){
            for(j=1; j>>1;
          ipp2=ip;
          ipph=(ip+1)>>>1;
          if(idol1){
            state=139;
            break;
          }

          is=-ido-1;
          t1=0;
          for(j=1; j




© 2015 - 2025 Weber Informatics LLC | Privacy Policy