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

sound.jarnbjo.vorbis.Residue2 Maven / Gradle / Ivy

There is a newer version: 6.0.0
Show newest version
/*
 * $ProjectName$
 * $ProjectRevision$
 * -----------------------------------------------------------
 * $Id: Residue2.java,v 1.2 2003/03/16 01:11:12 jarnbjo Exp $
 * -----------------------------------------------------------
 *
 * $Author: jarnbjo $
 *
 * Description:
 *
 * Copyright 2002-2003 Tor-Einar Jarnbjo
 * -----------------------------------------------------------
 *
 * Change History
 * -----------------------------------------------------------
 * $Log: Residue2.java,v $
 * Revision 1.2  2003/03/16 01:11:12  jarnbjo
 * no message
 *
 *
 */

package sound.jarnbjo.vorbis;

import java.io.IOException;

import sound.jarnbjo.util.io.BitInputStream;


public class Residue2 extends Residue {

   private double[][] decodedVectors;

   private Residue2() {
   }

   protected Residue2(BitInputStream source, SetupHeader header) throws VorbisFormatException, IOException {
      super(source, header);
   }

   protected int getType() {
      return 2;
   }

   protected void decodeResidue(VorbisStream vorbis, BitInputStream source, Mode mode, int ch, boolean[] doNotDecodeFlags, float[][] vectors) throws VorbisFormatException, IOException {

      Look look=getLook(vorbis, mode);

      CodeBook codeBook=vorbis.getSetupHeader().getCodeBooks()[getClassBook()];

      int classvalsPerCodeword=codeBook.getDimensions();
      int nToRead=getEnd()-getBegin();
      int partitionsToRead=nToRead/getPartitionSize(); // partvals

      int samplesPerPartition=getPartitionSize();
      int partitionsPerWord=look.getPhraseBook().getDimensions();

      int partWords=(partitionsToRead+partitionsPerWord-1)/partitionsPerWord;

      int realCh=0;
      for(int i=0; i




© 2015 - 2025 Weber Informatics LLC | Privacy Policy