From 9fee0ec4ca0c5b7a334cc29dbb58e76c7a4c736e Mon Sep 17 00:00:00 2001 From: Michiel Van Der Kolk Date: Mon, 11 Jul 2005 15:42:37 +0000 Subject: Songdb java version, source. only 1.5 compatible git-svn-id: svn://svn.rockbox.org/rockbox/trunk@7101 a1c6a512-1295-4272-9138-f99709370657 --- songdbj/de/jarnbjo/vorbis/Floor1.java | 324 ++++++++++++++++++++++++++++++++++ 1 file changed, 324 insertions(+) create mode 100644 songdbj/de/jarnbjo/vorbis/Floor1.java (limited to 'songdbj/de/jarnbjo/vorbis/Floor1.java') diff --git a/songdbj/de/jarnbjo/vorbis/Floor1.java b/songdbj/de/jarnbjo/vorbis/Floor1.java new file mode 100644 index 0000000000..69a118b44e --- /dev/null +++ b/songdbj/de/jarnbjo/vorbis/Floor1.java @@ -0,0 +1,324 @@ +/* + * $ProjectName$ + * $ProjectRevision$ + * ----------------------------------------------------------- + * $Id$multip + * ----------------------------------------------------------- + * + * $Author$ + * + * Description: + * + * Copyright 2002-2003 Tor-Einar Jarnbjo + * ----------------------------------------------------------- + * + * Change History + * ----------------------------------------------------------- + * $Log$ + * Revision 1.1 2005/07/11 15:42:36 hcl + * Songdb java version, source. only 1.5 compatible + * + * Revision 1.1.1.1 2004/04/04 22:09:12 shred + * First Import + * + * Revision 1.2 2003/03/16 01:11:12 jarnbjo + * no message + * + * + */ + +package de.jarnbjo.vorbis; + +import java.io.IOException; +import java.util.*; + +import de.jarnbjo.util.io.BitInputStream; + + +class Floor1 extends Floor implements Cloneable { + + private int[] partitionClassList; + private int maximumClass, multiplier, rangeBits; + private int[] classDimensions; + private int[] classSubclasses; + private int[] classMasterbooks; + private int[][] subclassBooks; + private int[] xList; + private int[] yList; + private int[] lowNeighbours, highNeighbours; + //private boolean[] step2Flags; + + private static final int[] RANGES = {256, 128, 86, 64}; + + private Floor1() { + } + + protected Floor1(BitInputStream source, SetupHeader header) throws VorbisFormatException, IOException { + + maximumClass=-1; + int partitions=source.getInt(5); + partitionClassList=new int[partitions]; + + for(int i=0; imaximumClass) { + maximumClass=partitionClassList[i]; + } + } + + + classDimensions=new int[maximumClass+1]; + classSubclasses=new int[maximumClass+1]; + classMasterbooks=new int[maximumClass+1]; + subclassBooks=new int[maximumClass+1][]; + + int xListLength=2; + + for(int i=0; i<=maximumClass; i++) { + classDimensions[i]=source.getInt(3)+1; + xListLength+=classDimensions[i]; + classSubclasses[i]=source.getInt(2); + + if(classDimensions[i] > header.getCodeBooks().length || + classSubclasses[i] > header.getCodeBooks().length) { + throw new VorbisFormatException("There is a class dimension or class subclasses entry higher than the number of codebooks in the setup header."); + } + if(classSubclasses[i]!=0) { + classMasterbooks[i]=source.getInt(8); + } + subclassBooks[i]=new int[1<0) { + cval=source.getInt(vorbis.getSetupHeader().getCodeBooks()[classMasterbooks[cls]].getHuffmanRoot()); + //cval=vorbis.getSetupHeader().getCodeBooks()[classMasterbooks[cls]].readInt(source); + //System.out.println("cval: "+cval); + } + //System.out.println("0: "+cls+" "+cdim+" "+cbits+" "+csub+" "+cval); + for(int j=0; j>>=cbits; + if(book>=0) { + clone.yList[j+offset]=source.getInt(vorbis.getSetupHeader().getCodeBooks()[book].getHuffmanRoot()); + //clone.yList[j+offset]=vorbis.getSetupHeader().getCodeBooks()[book].readInt(source); + //System.out.println("b: "+(j+offset)+" "+book+" "+clone.yList[j+offset]); + //System.out.println(""); + } + else { + clone.yList[j+offset]=0; + } + } + offset+=cdim; + } + + //System.out.println(""); + //for(int i=0; i=room) { + yList[i]=highRoom>lowRoom? + val-lowRoom+predicted: + -val+highRoom+predicted-1; + } + else { + yList[i]=(val&1)==1? + predicted-((val+1)>>1): + predicted+(val>>1); + } + } + else { + step2Flags[i]=false; + yList[i]=predicted; + } + } + + final int[] xList2=new int[values]; + + System.arraycopy(xList, 0, xList2, 0, values); + sort(xList2, yList, step2Flags); + + int hx=0, hy=0, lx=0, ly=yList[0]*multiplier; + + float[] vector2=new float[vector.length]; + float[] vector3=new float[vector.length]; + Arrays.fill(vector2, 1.0f); + System.arraycopy(vector, 0, vector3, 0, vector.length); + + for(int i=1; ioff && x[j-1]>x[j]; j--) { + itmp=x[j]; + x[j]=x[j-1]; + x[j-1]=itmp; + itmp=y[j]; + y[j]=y[j-1]; + y[j-1]=itmp; + btmp=b[j]; + b[j]=b[j-1]; + b[j-1]=btmp; + //swap(x, j, j-1); + //swap(y, j, j-1); + //swap(b, j, j-1); + } + } + } + + private final static void swap(int x[], int a, int b) { + int t = x[a]; + x[a] = x[b]; + x[b] = t; + } + + private final static void swap(boolean x[], int a, int b) { + boolean t = x[a]; + x[a] = x[b]; + x[b] = t; + } +} \ No newline at end of file -- cgit v1.2.3