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

com.jcraft.jorbis.Mapping0 Maven / Gradle / Ivy

There is a newer version: 1.4.3
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.jcraft.jorbis;

import com.jcraft.jogg.*;

class Mapping0 extends FuncMapping{
  static int seq=0;

  void free_info(Object imap){
  };

  void free_look(Object imap){
  }

  Object look(DspState vd, InfoMode vm, Object m){
    //System.err.println("Mapping0.look");
    Info vi=vd.vi;
    LookMapping0 look=new LookMapping0();
    InfoMapping0 info=look.map=(InfoMapping0)m;
    look.mode=vm;

    look.time_look=new Object[info.submaps];
    look.floor_look=new Object[info.submaps];
    look.residue_look=new Object[info.submaps];

    look.time_func=new FuncTime[info.submaps];
    look.floor_func=new FuncFloor[info.submaps];
    look.residue_func=new FuncResidue[info.submaps];

    for(int i=0; i1){
      opb.write(1, 1);
      opb.write(info.submaps-1, 4);
    }
    else{
      opb.write(0, 1);
    }

    if(info.coupling_steps>0){
      opb.write(1, 1);
      opb.write(info.coupling_steps-1, 8);
      for(int i=0; i1){
      for(int i=0; i=vi.channels
            ||testA>=vi.channels){
          //goto err_out;
          info.free();
          return (null);
        }
      }
    }

    if(opb.read(2)>0){ /* 2,3:reserved */
      info.free();
      return (null);
    }

    if(info.submaps>1){
      for(int i=0; i=info.submaps){
          info.free();
          return (null);
        }
      }
    }

    for(int i=0; i=vi.times){
        info.free();
        return (null);
      }
      info.floorsubmap[i]=opb.read(8);
      if(info.floorsubmap[i]>=vi.floors){
        info.free();
        return (null);
      }
      info.residuesubmap[i]=opb.read(8);
      if(info.residuesubmap[i]>=vi.residues){
        info.free();
        return (null);
      }
    }
    return info;
  }

  float[][] pcmbundle=null;
  int[] zerobundle=null;
  int[] nonzero=null;
  Object[] floormemo=null;

  synchronized int inverse(Block vb, Object l){
    DspState vd=vb.vd;
    Info vi=vd.vi;
    LookMapping0 look=(LookMapping0)l;
    InfoMapping0 info=look.map;
    InfoMode mode=look.mode;
    int n=vb.pcmend=vi.blocksizes[vb.W];

    float[] window=vd.window[vb.W][vb.lW][vb.nW][mode.windowtype];
    if(pcmbundle==null||pcmbundle.length=0; i--){
      float[] pcmM=vb.pcm[info.coupling_mag[i]];
      float[] pcmA=vb.pcm[info.coupling_ang[i]];

      for(int j=0; j0){
          if(ang>0){
            pcmM[j]=mag;
            pcmA[j]=mag-ang;
          }
          else{
            pcmA[j]=mag;
            pcmM[j]=mag+ang;
          }
        }
        else{
          if(ang>0){
            pcmM[j]=mag;
            pcmA[j]=mag+ang;
          }
          else{
            pcmA[j]=mag;
            pcmM[j]=mag-ang;
          }
        }
      }
    }

    //    /* compute and apply spectral envelope */

    for(int i=0; i




© 2015 - 2025 Weber Informatics LLC | Privacy Policy