From bab4f71e5ab6b7b885818a4a38f604c6cead458f Mon Sep 17 00:00:00 2001
From: yeom
+ * The implementation stores single bits as a word in the buffer. If a bit is
+ * set, the corresponding word in the buffer will be non-zero. If a bit is
+ * clear, the corresponding word is zero. Although this may seem waseful, this
+ * can be a factor of two quicker than packing 8 bits to a byte and extracting.
+ *
+ */
+
+// REVIEW: there is no range checking, so buffer underflow or overflow
+// can silently occur.
+
+
+final class BitReserve {
+ /**
+ * Size of the internal buffer to store the reserved bits. Must be a power of
+ * 2. And x8, as each bit is stored as a single entry.
+ */
+ private static final int BUFSIZE = 4096 * 8;
+
+ /**
+ * Mask that can be used to quickly implement the modulus operation on
+ * BUFSIZE.
+ */
+ private static final int BUFSIZE_MASK = BUFSIZE - 1;
+
+
+ private int offset;
+
+
+ public int totbit;
+
+
+ public int buf_byte_idx;
+
+
+ private final int[] buf;
+
+ BitReserve() {
+ offset = 0;
+ totbit = 0;
+ buf_byte_idx = 0;
+ buf = new int[BUFSIZE];
+ }
+
+ /**
+ * Return totbit Field.
+ */
+
+ public int hsstell() {
+ return (totbit);
+ }
+
+ /**
+ * Read a number bits from the bit stream.
+ *
+ * @param N
+ * the number of
+ */
+ public int hgetbits( int N) {
+
+ totbit += N;
+
+ int val = 0;
+
+ int pos = buf_byte_idx;
+ if (pos + N < BUFSIZE) {
+ TERMINATE: while (N-- > 0) {
+ val <<= 1;
+ val |= ((buf[pos++] != 0) ? 1 : 0);
+ }
+ } else {
+ TERMINATE: while (N-- > 0) {
+ val <<= 1;
+ val |= ((buf[pos] != 0) ? 1 : 0);
+ pos = (pos + 1) & BUFSIZE_MASK;
+ }
+ }
+
+ buf_byte_idx = pos;
+
+ return val;
+
+ }
+
+ /**
+ * Returns next bit from reserve.
+ *
+ * @returns 0 if next bit is reset, or 1 if next bit is set.
+ */
+
+ public int hget1bit() {
+ totbit++;
+ int val = buf[buf_byte_idx];
+ buf_byte_idx = (buf_byte_idx + 1) & BUFSIZE_MASK;
+ return val;
+ }
+
+ /**
+ * Write 8 bits into the bit stream.
+ */
+
+ public void hputbuf( int val) {
+ int ofs = offset;
+ buf[ofs++] = val & 0x80;
+ buf[ofs++] = val & 0x40;
+ buf[ofs++] = val & 0x20;
+ buf[ofs++] = val & 0x10;
+ buf[ofs++] = val & 0x08;
+ buf[ofs++] = val & 0x04;
+ buf[ofs++] = val & 0x02;
+ buf[ofs++] = val & 0x01;
+
+ if (ofs == BUFSIZE)
+ offset = 0;
+ else
+ offset = ofs;
+
+ }
+
+ /**
+ * Rewind N bits in Stream.
+ */
+ public void rewindNbits( int N) {
+ totbit -= N;
+ buf_byte_idx -= N;
+ if (buf_byte_idx < 0)
+ buf_byte_idx += BUFSIZE;
+ }
+
+ /**
+ * Rewind N bytes in Stream.
+ */
+
+ public void rewindNbytes( int N) {
+ int bits = (N << 3);
+ totbit -= bits;
+ buf_byte_idx -= bits;
+ if (buf_byte_idx < 0)
+ buf_byte_idx += BUFSIZE;
+ }
+}
diff --git a/Robust/src/Benchmarks/SSJava/MP3DecoderInfer/Bitstream.java b/Robust/src/Benchmarks/SSJava/MP3DecoderInfer/Bitstream.java
new file mode 100644
index 00000000..5bb23eba
--- /dev/null
+++ b/Robust/src/Benchmarks/SSJava/MP3DecoderInfer/Bitstream.java
@@ -0,0 +1,749 @@
+/*
+ * 11/19/04 1.0 moved to LGPL.
+ *
+ * 11/17/04 Uncomplete frames discarded. E.B, javalayer@javazoom.net
+ *
+ * 12/05/03 ID3v2 tag returned. E.B, javalayer@javazoom.net
+ *
+ * 12/12/99 Based on Ibitstream. Exceptions thrown on errors,
+ * Temporary removed seek functionality. mdm@techie.com
+ *
+ * 02/12/99 : Java Conversion by E.B , javalayer@javazoom.net
+ *
+ * 04/14/97 : Added function prototypes for new syncing and seeking
+ * mechanisms. Also made this file portable. Changes made by Jeff Tsay
+ *
+ * @(#) ibitstream.h 1.5, last edit: 6/15/94 16:55:34
+ * @(#) Copyright (C) 1993, 1994 Tobias Bading (bading@cs.tu-berlin.de)
+ * @(#) Berlin University of Technology
+ *-----------------------------------------------------------------------
+ * 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.
+ *----------------------------------------------------------------------
+ */
+
+/**
+ * The
+ * The exception provides details of the exception condition
+ * in two ways:
+ * JavaSoundAudioDevice
implements an audio device by using the
+ * JavaSound API.
+ *
+ * @since 0.0.8
+ * @author Mat McGowan
+ */
+public class AudioDevice {
+
+ /**
+ * Prepares the AudioDevice for playback of audio samples.
+ *
+ * @param decoder
+ * The decoder that will be providing the audio samples.
+ *
+ * If the audio device is already open, this method returns silently.
+ *
+ */
+ public void open(Decoder decoder) throws JavaLayerException {
+
+ }
+
+ /**
+ * Retrieves the open state of this audio device.
+ *
+ * @return true
if this audio device is open and playing audio
+ * samples, or false
otherwise.
+ */
+ public boolean isOpen() {
+ return true;
+ }
+
+ /**
+ * Writes a number of samples to this AudioDevice
.
+ *
+ * @param samples
+ * The array of signed 16-bit samples to write to the audio device.
+ * @param offs
+ * The offset of the first sample.
+ * @param len
+ * The number of samples to write.
+ *
+ * This method may return prior to the samples actually being played
+ * by the audio device.
+ */
+ public void write(short[] samples, int offs, int len) throws JavaLayerException {
+
+ }
+
+ /**
+ * Closes this audio device. Any currently playing audio is stopped as soon as
+ * possible. Any previously written audio data that has not been heard is
+ * discarded.
+ *
+ * The implementation should ensure that any threads currently blocking on the
+ * device (e.g. during a write
or flush
operation
+ * should be unblocked by this method.
+ */
+ public void close() {
+
+ }
+
+ /**
+ * Blocks until all audio samples previously written to this audio device have
+ * been heard.
+ */
+ public void flush() {
+
+ }
+
+ /**
+ * Retrieves the current playback position in milliseconds.
+ */
+ public int getPosition() {
+ return 0;
+ }
+
+}
\ No newline at end of file
diff --git a/Robust/src/Benchmarks/SSJava/MP3DecoderInfer/BitReserve.java b/Robust/src/Benchmarks/SSJava/MP3DecoderInfer/BitReserve.java
new file mode 100644
index 00000000..eb54d964
--- /dev/null
+++ b/Robust/src/Benchmarks/SSJava/MP3DecoderInfer/BitReserve.java
@@ -0,0 +1,170 @@
+/*
+ * 11/19/04 1.0 moved to LGPL.
+ *
+ * 12/12/99 0.0.7 Implementation stores single bits
+ * as ints for better performance. mdm@techie.com.
+ *
+ * 02/28/99 0.0 Java Conversion by E.B, javalayer@javazoom.net
+ *
+ * Adapted from the public c code by Jeff Tsay.
+ *
+ *-----------------------------------------------------------------------
+ * 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.
+ *----------------------------------------------------------------------
+ */
+
+/**
+ * Implementation of Bit Reservoir for Layer III.
+ * Bistream
class is responsible for parsing an MPEG audio
+ * bitstream.
+ *
+ * REVIEW: much of the parsing currently occurs in the various decoders.
+ * This should be moved into this class and associated inner classes.
+ */
+
+
+public final class Bitstream implements BitstreamErrors {
+ /**
+ * Synchronization control constant for the initial synchronization to the
+ * start of a frame.
+ */
+
+ static byte INITIAL_SYNC = 0;
+
+ /**
+ * Synchronization control constant for non-initial frame synchronizations.
+ */
+
+
+ static byte STRICT_SYNC = 1;
+
+ // max. 1730 bytes per frame: 144 * 384kbit/s / 32000 Hz + 2 Bytes CRC
+ /**
+ * Maximum size of the frame buffer.
+ */
+
+ private static final int BUFFER_INT_SIZE = 433;
+
+ /**
+ * The frame buffer that holds the data for the current frame.
+ */
+
+ private final int[] framebuffer = new int[BUFFER_INT_SIZE];
+
+ /**
+ * Number of valid bytes in the frame buffer.
+ */
+
+ private int framesize;
+
+ /**
+ * The bytes read from the stream.
+ */
+
+ private byte[] frame_bytes = new byte[BUFFER_INT_SIZE * 4];
+
+ /**
+ * Index into framebuffer
where the next bits are retrieved.
+ */
+
+ private int wordpointer;
+
+ /**
+ * Number (0-31, from MSB to LSB) of next bit for get_bits()
+ */
+
+ private int bitindex;
+
+ /**
+ * The current specified syncword
+ */
+
+ private int syncword;
+
+ /**
+ * Audio header position in stream.
+ */
+
+ private int header_pos = 0;
+
+ /**
+ *
+ */
+
+ private boolean single_ch_mode;
+ // private int current_frame_number;
+ // private int last_frame_number;
+
+
+ private final int bitmask[] = {
+ 0, // dummy
+ 0x00000001, 0x00000003, 0x00000007, 0x0000000F, 0x0000001F, 0x0000003F, 0x0000007F,
+ 0x000000FF, 0x000001FF, 0x000003FF, 0x000007FF, 0x00000FFF, 0x00001FFF, 0x00003FFF,
+ 0x00007FFF, 0x0000FFFF, 0x0001FFFF };
+
+
+ private final PushbackInputStream source;
+
+
+ private final Header header = new Header();
+
+
+ private final byte syncbuf[] = new byte[4];
+
+
+ private Crc16[] crc = new Crc16[1];
+
+
+ private byte[] rawid3v2 = null;
+
+
+ private boolean firstframe = true;
+
+ private BitReserve br;
+ private int main_data_begin;
+ private int frame_start;
+
+ /**
+ * Construct a IBitstream that reads data from a given InputStream.
+ *
+ * @param in
+ * The InputStream to read from.
+ */
+ public Bitstream(InputStream in) {
+ if (in == null)
+ throw new NullPointerException("in");
+ in = new BufferedInputStream(in);
+ loadID3v2(in);
+ firstframe = true;
+ // source = new PushbackInputStream(in, 1024);
+ source = new PushbackInputStream(in, BUFFER_INT_SIZE * 4);
+
+ closeFrame();
+ // current_frame_number = -1;
+ // last_frame_number = -1;
+
+ br = new BitReserve();
+
+ }
+
+ /**
+ * Return position of the first audio header.
+ *
+ * @return size of ID3v2 tag frames.
+ */
+ public int header_pos() {
+ return header_pos;
+ }
+
+ /**
+ * Load ID3v2 frames.
+ *
+ * @param in
+ * MP3 InputStream.
+ * @author JavaZOOM
+ */
+ private void loadID3v2(InputStream in) {
+ int size = -1;
+ try {
+ // Read ID3v2 header (10 bytes).
+ in.mark(10);
+ size = readID3v2Header(in);
+ header_pos = size;
+ } catch (IOException e) {
+ } finally {
+ try {
+ // Unread ID3v2 header (10 bytes).
+ in.reset();
+ } catch (IOException e) {
+ }
+ }
+ // Load ID3v2 tags.
+ try {
+ if (size > 0) {
+ rawid3v2 = new byte[size];
+ in.read(rawid3v2, 0, rawid3v2.length);
+ }
+ } catch (IOException e) {
+ }
+ }
+
+ /**
+ * Parse ID3v2 tag header to find out size of ID3v2 frames.
+ *
+ * @param in
+ * MP3 InputStream
+ * @return size of ID3v2 frames + header
+ * @throws IOException
+ * @author JavaZOOM
+ */
+ private int readID3v2Header(InputStream in) throws IOException {
+ byte[] id3header = new byte[4];
+ int size = -10;
+ in.read(id3header, 0, 3);
+ // Look for ID3v2
+ if ((id3header[0] == 'I') && (id3header[1] == 'D') && (id3header[2] == '3')) {
+ in.read(id3header, 0, 3);
+ int majorVersion = id3header[0];
+ int revision = id3header[1];
+ in.read(id3header, 0, 4);
+ size =
+ (int) (id3header[0] << 21) + (id3header[1] << 14) + (id3header[2] << 7) + (id3header[3]);
+ }
+ return (size + 10);
+ }
+
+ /**
+ * Return raw ID3v2 frames + header.
+ *
+ * @return ID3v2 InputStream or null if ID3v2 frames are not available.
+ */
+ public InputStream getRawID3v2() {
+ if (rawid3v2 == null)
+ return null;
+ else {
+ ByteArrayInputStream bain = new ByteArrayInputStream(rawid3v2);
+ return bain;
+ }
+ }
+
+ /**
+ * Close the Bitstream.
+ *
+ * @throws BitstreamException
+ */
+ public void close() throws BitstreamException {
+ try {
+ source.close();
+ } catch (IOException ex) {
+ throw newBitstreamException(STREAM_ERROR, ex);
+ }
+ }
+
+ /**
+ * Reads and parses the next frame from the input source.
+ *
+ * @return the Header describing details of the frame read, or null if the end
+ * of the stream has been reached.
+ */
+ public Header readFrame() throws BitstreamException {
+
+ Header result = null;
+ try {
+ result = readNextFrame();
+ if (result == null) {
+ return null;
+ }
+ // E.B, Parse VBR (if any) first frame.
+ if (firstframe == true) {
+ result.parseVBR(frame_bytes);
+ firstframe = false;
+ }
+
+ int channels = (header.mode() == Header.SINGLE_CHANNEL) ? 1 : 2;
+
+ result.setSideInfoBuf(getSideInfoBuffer(channels));
+ result.setBitReserve(getBitReserve(result.slots()));
+
+ closeFrame();
+
+ } catch (BitstreamException ex) {
+ if ((ex.getErrorCode() == INVALIDFRAME)) {
+ // Try to skip this frame.
+ // System.out.println("INVALIDFRAME");
+ try {
+ closeFrame();
+ result = readNextFrame();
+ } catch (BitstreamException e) {
+ if ((e.getErrorCode() != STREAM_EOF)) {
+ // wrap original exception so stack trace is maintained.
+ throw newBitstreamException(e.getErrorCode(), e);
+ }
+ }
+ } else if ((ex.getErrorCode() != STREAM_EOF)) {
+ // wrap original exception so stack trace is maintained.
+ throw newBitstreamException(ex.getErrorCode(), ex);
+ }
+ }
+
+ return result;
+ }
+
+ /**
+ * Read next MP3 frame.
+ *
+ * @return MP3 frame header.
+ * @throws BitstreamException
+ */
+ private Header readNextFrame() throws BitstreamException {
+ if (framesize == -1) {
+ if (nextFrame() == -1) {
+ return null;
+ }
+ }
+ return header;
+ }
+
+ /**
+ * Read next MP3 frame.
+ *
+ * @throws BitstreamException
+ */
+ private int nextFrame() throws BitstreamException {
+ // entire frame is read by the header class.
+ // header.read_header(this, crc);
+ return header.read_header(this, crc);
+ }
+
+ /**
+ * Unreads the bytes read from the frame.
+ *
+ * @throws BitstreamException
+ */
+ // REVIEW: add new error codes for this.
+ public void unreadFrame() throws BitstreamException {
+ if (wordpointer == -1 && bitindex == -1 && (framesize > 0)) {
+ try {
+ source.unread(frame_bytes, 0, framesize);
+ } catch (IOException ex) {
+ throw newBitstreamException(STREAM_ERROR);
+ }
+ }
+ }
+
+ /**
+ * Close MP3 frame.
+ */
+ public void closeFrame() {
+ framesize = -1;
+ wordpointer = -1;
+ bitindex = -1;
+ }
+
+ /**
+ * Determines if the next 4 bytes of the stream represent a frame header.
+ */
+ public boolean isSyncCurrentPosition(int syncmode) throws BitstreamException {
+ int read = readBytes(syncbuf, 0, 4);
+ int headerstring =
+ ((syncbuf[0] << 24) & 0xFF000000) | ((syncbuf[1] << 16) & 0x00FF0000)
+ | ((syncbuf[2] << 8) & 0x0000FF00) | ((syncbuf[3] << 0) & 0x000000FF);
+
+ try {
+ source.unread(syncbuf, 0, read);
+ } catch (IOException ex) {
+ }
+
+ boolean sync = false;
+ switch (read) {
+ case 0:
+ sync = true;
+ break;
+ case 4:
+ sync = isSyncMark(headerstring, syncmode, syncword);
+ break;
+ }
+
+ return sync;
+ }
+
+ // REVIEW: this class should provide inner classes to
+ // parse the frame contents. Eventually, readBits will
+ // be removed.
+ public int readBits(int n) {
+ return get_bits(n);
+ }
+
+ public int peek_bits(int number_of_bits) {
+
+ int peekbitindex = bitindex;
+ int peekPointer = wordpointer;
+
+ int returnvalue = 0;
+ int sum = peekbitindex + number_of_bits;
+
+ if (peekPointer < 0) {
+ peekPointer = 0;
+ }
+
+ if (sum <= 32) {
+ // all bits contained in *wordpointer
+ returnvalue = (framebuffer[peekPointer] >>> (32 - sum)) & bitmask[number_of_bits];
+ // returnvalue = (wordpointer[0] >> (32 - sum)) &
+ // bitmask[number_of_bits];
+ if ((peekbitindex += number_of_bits) == 32) {
+ peekbitindex = 0;
+ peekPointer++; // added by me!
+ }
+ return returnvalue;
+ }
+
+ // E.B : Check that ?
+ // ((short[])&returnvalue)[0] = ((short[])wordpointer + 1)[0];
+ // wordpointer++; // Added by me!
+ // ((short[])&returnvalue + 1)[0] = ((short[])wordpointer)[0];
+ int Right = (framebuffer[peekPointer] & 0x0000FFFF);
+ peekPointer++;
+ int Left = (framebuffer[peekPointer] & 0xFFFF0000);
+ returnvalue = ((Right << 16) & 0xFFFF0000) | ((Left >>> 16) & 0x0000FFFF);
+
+ returnvalue >>>= 48 - sum; // returnvalue >>= 16 - (number_of_bits - (32
+ // - bitindex))
+ returnvalue &= bitmask[number_of_bits];
+ peekbitindex = sum - 32;
+ return returnvalue;
+
+ }
+
+ public int readCheckedBits(int n) {
+ // REVIEW: implement CRC check.
+ return get_bits(n);
+ }
+
+ protected BitstreamException newBitstreamException(int errorcode) {
+ return new BitstreamException(errorcode, null);
+ }
+
+ protected BitstreamException newBitstreamException(int errorcode, Throwable throwable) {
+ return new BitstreamException(errorcode, throwable);
+ }
+
+ /**
+ * Get next 32 bits from bitstream. They are stored in the headerstring.
+ * syncmod allows Synchro flag ID The returned value is False at the end of
+ * stream.
+ */
+
+ int syncHeader(byte syncmode) throws BitstreamException {
+ boolean sync;
+ int headerstring;
+ // read additional 2 bytes
+ int bytesRead = readBytes(syncbuf, 0, 3);
+
+ if (bytesRead != 3)
+ throw newBitstreamException(STREAM_EOF, null);
+
+ headerstring =
+ ((syncbuf[0] << 16) & 0x00FF0000) | ((syncbuf[1] << 8) & 0x0000FF00)
+ | ((syncbuf[2] << 0) & 0x000000FF);
+
+ do {
+ headerstring <<= 8;
+
+ if (readBytes(syncbuf, 3, 1) != 1) {
+ // System.out.println("THROW NEW BITSTREAM EXCEPTION");
+ return -1;
+ throw newBitstreamException(STREAM_EOF, null);
+ }
+
+ headerstring |= (syncbuf[3] & 0x000000FF);
+
+ sync = isSyncMark(headerstring, syncmode, syncword);
+ } while (!sync);
+
+ // current_frame_number++;
+ // if (last_frame_number < current_frame_number) last_frame_number =
+ // current_frame_number;
+
+ return headerstring;
+ }
+
+ public boolean isSyncMark(int headerstring, int syncmode, int word) {
+ boolean sync = false;
+
+ if (syncmode == INITIAL_SYNC) {
+ // sync = ((headerstring & 0xFFF00000) == 0xFFF00000);
+ sync = ((headerstring & 0xFFE00000) == 0xFFE00000); // SZD: MPEG 2.5
+ } else {
+ sync =
+ ((headerstring & 0xFFF80C00) == word)
+ && (((headerstring & 0x000000C0) == 0x000000C0) == single_ch_mode);
+ }
+
+ // filter out invalid sample rate
+ if (sync)
+ sync = (((headerstring >>> 10) & 3) != 3);
+ // filter out invalid layer
+ if (sync)
+ sync = (((headerstring >>> 17) & 3) != 0);
+ // filter out invalid version
+ if (sync)
+ sync = (((headerstring >>> 19) & 3) != 1);
+
+ return sync;
+ }
+
+ /**
+ * Reads the data for the next frame. The frame is not parsed until parse
+ * frame is called.
+ */
+ int read_frame_data(int bytesize) throws BitstreamException {
+ int numread = 0;
+ numread = readFully(frame_bytes, 0, bytesize);
+ framesize = bytesize;
+ wordpointer = -1;
+ bitindex = -1;
+ return numread;
+ }
+
+ /**
+ * Parses the data previously read with read_frame_data().
+ */
+
+ void parse_frame() throws BitstreamException {
+ // Convert Bytes read to int
+ int b = 0;
+ byte[] byteread = frame_bytes;
+ int bytesize = framesize;
+
+ // Check ID3v1 TAG (True only if last frame).
+ // for (int t=0;t<(byteread.length)-2;t++)
+ // {
+ // if ((byteread[t]=='T') && (byteread[t+1]=='A') && (byteread[t+2]=='G'))
+ // {
+ // System.out.println("ID3v1 detected at offset "+t);
+ // throw newBitstreamException(INVALIDFRAME, null);
+ // }
+ // }
+
+ for ( int k = 0; k < bytesize; k = k + 4) {
+ int convert = 0;
+ byte b0 = 0;
+ byte b1 = 0;
+ byte b2 = 0;
+ byte b3 = 0;
+ b0 = byteread[k];
+ if (k + 1 < bytesize)
+ b1 = byteread[k + 1];
+ if (k + 2 < bytesize)
+ b2 = byteread[k + 2];
+ if (k + 3 < bytesize)
+ b3 = byteread[k + 3];
+ framebuffer[b++] =
+ ((b0 << 24) & 0xFF000000) | ((b1 << 16) & 0x00FF0000) | ((b2 << 8) & 0x0000FF00)
+ | (b3 & 0x000000FF);
+ }
+ wordpointer = 0;
+ bitindex = 0;
+ }
+
+ /**
+ * Read bits from buffer into the lower bits of an unsigned int. The LSB
+ * contains the latest read bit of the stream. (1 <= number_of_bits <= 16)
+ */
+
+ public int get_bits( int number_of_bits) {
+
+ int returnvalue = 0;
+ int sum = bitindex + number_of_bits;
+
+ // E.B
+ // There is a problem here, wordpointer could be -1 ?!
+ if (wordpointer < 0)
+ wordpointer = 0;
+ // E.B : End.
+
+ if (sum <= 32) {
+ // all bits contained in *wordpointer
+ returnvalue = (framebuffer[wordpointer] >>> (32 - sum)) & bitmask[number_of_bits];
+ // returnvalue = (wordpointer[0] >> (32 - sum)) & bitmask[number_of_bits];
+ if ((bitindex += number_of_bits) == 32) {
+ bitindex = 0;
+ wordpointer++; // added by me!
+ }
+ return returnvalue;
+ }
+
+ // E.B : Check that ?
+ // ((short[])&returnvalue)[0] = ((short[])wordpointer + 1)[0];
+ // wordpointer++; // Added by me!
+ // ((short[])&returnvalue + 1)[0] = ((short[])wordpointer)[0];
+ int Right = (framebuffer[wordpointer] & 0x0000FFFF);
+ wordpointer++;
+ int Left = (framebuffer[wordpointer] & 0xFFFF0000);
+ returnvalue = ((Right << 16) & 0xFFFF0000) | ((Left >>> 16) & 0x0000FFFF);
+
+ returnvalue >>>= 48 - sum; // returnvalue >>= 16 - (number_of_bits - (32 -
+ // bitindex))
+ returnvalue &= bitmask[number_of_bits];
+ bitindex = sum - 32;
+ return returnvalue;
+ }
+
+ /**
+ * Set the word we want to sync the header to. In Big-Endian byte order
+ */
+ void set_syncword( int syncword0) {
+ syncword = syncword0 & 0xFFFFFF3F;
+ single_ch_mode = ((syncword0 & 0x000000C0) == 0x000000C0);
+ }
+
+ /**
+ * Reads the exact number of bytes from the source input stream into a byte
+ * array.
+ *
+ * @param b
+ * The byte array to read the specified number of bytes into.
+ * @param offs
+ * The index in the array where the first byte read should be stored.
+ * @param len
+ * the number of bytes to read.
+ *
+ * @exception BitstreamException
+ * is thrown if the specified number of bytes could not be read
+ * from the stream.
+ */
+
+
+ private int readFully( byte[] b, int offs, int len)
+ throws BitstreamException {
+ int nRead = 0;
+ try {
+ while (len > 0) {
+ int bytesread = source.read(b, offs, len);
+ if (bytesread == -1) {
+ while (len-- > 0) {
+ b[offs++] = 0;
+ }
+ break;
+ // throw newBitstreamException(UNEXPECTED_EOF, new EOFException());
+ }
+ nRead = nRead + bytesread;
+ offs += bytesread;
+ len -= bytesread;
+ }
+ } catch (IOException ex) {
+ throw newBitstreamException(STREAM_ERROR, ex);
+ }
+ return nRead;
+ }
+
+ /**
+ * Simlar to readFully, but doesn't throw exception when EOF is reached.
+ */
+
+
+ private int readBytes( byte[] b, int offs, int len)
+ throws BitstreamException {
+ int totalBytesRead = 0;
+ try {
+ while (len > 0) {
+ int bytesread = source.read(b, offs, len);
+ if (bytesread == -1) {
+ break;
+ }
+ totalBytesRead += bytesread;
+ offs += bytesread;
+ len -= bytesread;
+ }
+ } catch (IOException ex) {
+ throw newBitstreamException(STREAM_ERROR, ex);
+ }
+ return totalBytesRead;
+ }
+
+ public SideInfoBuffer getSideInfoBuffer(int channelType) {
+
+ if (wordpointer < 0)
+ wordpointer = 0;
+
+ SideInfoBuffer sib = new SideInfoBuffer();
+
+ // first, store main_data_begin from the side inforamtion
+ main_data_begin = peek_bits(9);
+
+ int max;
+ if (channelType == 1) { // mono
+ max = wordpointer + 4;
+ } else {
+ max = wordpointer + 8;
+ }
+
+ try {
+ for (; wordpointer < max; wordpointer++) {
+ sib.setBuffer(wordpointer, framebuffer[wordpointer]);
+ }
+ } catch (ArrayIndexOutOfBoundsException e) {
+ System.out.print("wordpointer=" + wordpointer);
+ System.out.println("framebuffer length=" + framebuffer.length);
+ }
+
+ return sib;
+ }
+
+ public BitReserve getBitReserve(int nSlots) {
+
+ int flush_main;
+ int bytes_to_discard;
+ int i;
+
+ for (i = 0; i < nSlots; i++)
+ br.hputbuf(get_bits(8));
+
+ int main_data_end = br.hsstell() >>> 3; // of previous frame
+
+ if ((flush_main = (br.hsstell() & 7)) != 0) {
+ br.hgetbits(8 - flush_main);
+ main_data_end++;
+ }
+
+ bytes_to_discard = frame_start - main_data_end - main_data_begin;
+
+ frame_start += nSlots;
+
+ if (bytes_to_discard < 0) {
+ return null;
+ }
+
+ if (main_data_end > 4096) {
+ frame_start -= 4096;
+ br.rewindNbytes(4096);
+ }
+
+ for (; bytes_to_discard > 0; bytes_to_discard--)
+ br.hgetbits(8);
+
+ // resynch index by trusted code
+ br.buf_byte_idx = br.totbit % br.BUFSIZE;
+ return br;
+ }
+}
diff --git a/Robust/src/Benchmarks/SSJava/MP3DecoderInfer/BitstreamErrors.java b/Robust/src/Benchmarks/SSJava/MP3DecoderInfer/BitstreamErrors.java
new file mode 100644
index 00000000..07114dbf
--- /dev/null
+++ b/Robust/src/Benchmarks/SSJava/MP3DecoderInfer/BitstreamErrors.java
@@ -0,0 +1,70 @@
+/*
+ * 11/19/04 1.0 moved to LGPL.
+ * 11/17/04 INVALIDFRAME code added. javalayer@javazoom.net
+ * 12/12/99 Initial version. mdm@techie.com
+ *-----------------------------------------------------------------------
+ * 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.
+ *----------------------------------------------------------------------
+ */
+
+/**
+ * This interface describes all error codes that can be thrown
+ * in BistreamException
s.
+ *
+ * @see BitstreamException
+ *
+ * @author MDM 12/12/99
+ * @since 0.0.6
+ */
+
+public interface BitstreamErrors extends JavaLayerErrors
+{
+
+ /**
+ * An undeterminable error occurred.
+ */
+ static public final int UNKNOWN_ERROR = BITSTREAM_ERROR + 0;
+
+ /**
+ * The header describes an unknown sample rate.
+ */
+ static public final int UNKNOWN_SAMPLE_RATE = BITSTREAM_ERROR + 1;
+
+ /**
+ * A problem occurred reading from the stream.
+ */
+ static public final int STREAM_ERROR = BITSTREAM_ERROR + 2;
+
+ /**
+ * The end of the stream was reached prematurely.
+ */
+ static public final int UNEXPECTED_EOF = BITSTREAM_ERROR + 3;
+
+ /**
+ * The end of the stream was reached.
+ */
+ static public final int STREAM_EOF = BITSTREAM_ERROR + 4;
+
+ /**
+ * Frame data are missing.
+ */
+ static public final int INVALIDFRAME = BITSTREAM_ERROR + 5;
+
+ /**
+ *
+ */
+ static public final int BITSTREAM_LAST = 0x1ff;
+
+}
diff --git a/Robust/src/Benchmarks/SSJava/MP3DecoderInfer/BitstreamException.java b/Robust/src/Benchmarks/SSJava/MP3DecoderInfer/BitstreamException.java
new file mode 100644
index 00000000..1889add6
--- /dev/null
+++ b/Robust/src/Benchmarks/SSJava/MP3DecoderInfer/BitstreamException.java
@@ -0,0 +1,70 @@
+/*
+ * 11/19/04 1.0 moved to LGPL.
+ * 12/12/99 Initial version. mdm@techie.com
+ *-----------------------------------------------------------------------
+ * 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.
+ *----------------------------------------------------------------------
+ */
+
+/**
+ * Instances of BitstreamException
are thrown
+ * when operations on a Bitstream
fail.
+ * Throwable
instance, if any, that was thrown
+ * indicating that an exceptional condition has occurred.
+ *
Decoder
class encapsulates the details of decoding an MPEG
+ * audio frame.
+ *
+ * @author MDM
+ * @version 0.0.7 12/12/99
+ * @since 0.0.5
+ */
+
+
+public class Decoder implements DecoderErrors {
+
+ static private final Params DEFAULT_PARAMS = new Params();
+
+ /**
+ * The Bistream from which the MPEG audio frames are read.
+ */
+ //
+ // private Bitstream stream;
+
+ /**
+ * The Obuffer instance that will receive the decoded PCM samples.
+ */
+ //
+ // private Obuffer output;
+
+ /**
+ * Synthesis filter for the left channel.
+ */
+ //
+ // private SynthesisFilter filter1;
+
+ /**
+ * Sythesis filter for the right channel.
+ */
+ //
+ // private SynthesisFilter filter2;
+
+ /**
+ * The decoder used to decode layer III frames.
+ */
+
+ private LayerIIIDecoder l3decoder;
+ //
+ // private LayerIIDecoder l2decoder;
+ //
+ // private LayerIDecoder l1decoder;
+
+
+ private int outputFrequency;
+
+ private int outputChannels;
+
+
+ private Equalizer equalizer = new Equalizer();
+
+
+ private Params params;
+
+
+ private boolean initialized;
+
+ /**
+ * Creates a new Decoder
instance with default parameters.
+ */
+
+ public Decoder() {
+ this(null);
+ }
+
+ /**
+ * Creates a new Decoder
instance with default parameters.
+ *
+ * @param params
+ * The Params
instance that describes the customizable
+ * aspects of the decoder.
+ */
+ public Decoder(@DELEGATE Params params0) {
+
+ if (params0 == null) {
+ params0 = getDefaultParams();
+ }
+
+ params = params0;
+
+ Equalizer eq = params.getInitialEqualizerSettings();
+ if (eq != null) {
+ equalizer.setFrom(eq);
+ }
+ }
+
+ static public Params getDefaultParams() {
+ return (Params) DEFAULT_PARAMS.clone();
+ }
+
+ // public void setEqualizer(Equalizer eq) {
+ // if (eq == null)
+ // eq = Equalizer.PASS_THRU_EQ;
+ //
+ // equalizer.setFrom(eq);
+ //
+ // float[] factors = equalizer.getBandFactors();
+ //
+ // if (filter1 != null)
+ // filter1.setEQ(factors);
+ //
+ // if (filter2 != null)
+ // filter2.setEQ(factors);
+ // }
+
+ public void init( Header header) {
+ float scalefactor = 32700.0f;
+
+ int mode = header.mode();
+ int layer = header.layer();
+ int channels = mode == Header.SINGLE_CHANNEL ? 1 : 2;
+
+ // set up output buffer if not set up by client.
+ // if (output == null)
+ // output = new SampleBuffer(header.frequency(), channels);
+ SampleBufferWrapper.init(header.frequency(), channels);
+
+ float[] factors = equalizer.getBandFactors();
+ SynthesisFilter filter1 =
+ new SynthesisFilter(0, scalefactor, factors);
+
+ // REVIEW: allow mono output for stereo
+ SynthesisFilter filter2 = null;
+ if (channels == 2) {
+ filter2 = new SynthesisFilter(1, scalefactor, factors);
+ }
+
+ outputChannels = channels;
+ outputFrequency = header.frequency();
+
+ l3decoder = new LayerIIIDecoder(header,filter1, filter2, OutputChannels.BOTH_CHANNELS);
+
+ }
+
+ /**
+ * Decodes one frame from an MPEG audio bitstream.
+ *
+ * @param header
+ * The header describing the frame to decode.
+ * @param bitstream
+ * The bistream that provides the bits for te body of the frame.
+ *
+ * @return A SampleBuffer containing the decoded samples.
+ */
+
+ public void decodeFrame( Header header) throws DecoderException {
+
+ SampleBufferWrapper.clear_buffer();
+ l3decoder.decode(header);
+ // SampleBufferWrapper.getOutput().write_buffer(1);
+
+ }
+
+ /**
+ * Changes the output buffer. This will take effect the next time
+ * decodeFrame() is called.
+ */
+ // public void setOutputBuffer(Obuffer out) {
+ // output = out;
+ // }
+
+ /**
+ * Retrieves the sample frequency of the PCM samples output by this decoder.
+ * This typically corresponds to the sample rate encoded in the MPEG audio
+ * stream.
+ *
+ * @param the
+ * sample rate (in Hz) of the samples written to the output buffer
+ * when decoding.
+ */
+ public int getOutputFrequency() {
+ return outputFrequency;
+ }
+
+ /**
+ * Retrieves the number of channels of PCM samples output by this decoder.
+ * This usually corresponds to the number of channels in the MPEG audio
+ * stream, although it may differ.
+ *
+ * @return The number of output channels in the decoded samples: 1 for mono,
+ * or 2 for stereo.
+ *
+ */
+ public int getOutputChannels() {
+ return outputChannels;
+ }
+
+ /**
+ * Retrieves the maximum number of samples that will be written to the output
+ * buffer when one frame is decoded. This can be used to help calculate the
+ * size of other buffers whose size is based upon the number of samples
+ * written to the output buffer. NB: this is an upper bound and fewer samples
+ * may actually be written, depending upon the sample rate and number of
+ * channels.
+ *
+ * @return The maximum number of samples that are written to the output buffer
+ * when decoding a single frame of MPEG audio.
+ */
+ public int getOutputBlockSize() {
+ return Obuffer.OBUFFERSIZE;
+ }
+
+ protected DecoderException newDecoderException(int errorcode) {
+ return new DecoderException(errorcode, null);
+ }
+
+ protected DecoderException newDecoderException(int errorcode, Throwable throwable) {
+ return new DecoderException(errorcode, throwable);
+ }
+}
+
+
+
+
+
+ /**
+ * The Params
class presents the customizable aspects of the
+ * decoder.
+ * + * Instances of this class are not thread safe. + */ + public class Params implements Cloneable { + + // private OutputChannels outputChannels = OutputChannels.BOTH; + private OutputChannels outputChannels = new OutputChannels(0); + + private Equalizer equalizer = new Equalizer(); + + public Params() { + } + + public Object clone() { + // TODO: need to have better clone method + Params clone = new Params(); + clone.outputChannels = new OutputChannels(outputChannels.getChannelsOutputCode()); + clone.equalizer = new Equalizer(); + return clone; + // try + // { + // return super.clone(); + // } + // catch (CloneNotSupportedException ex) + // { + // throw new InternalError(this+": "+ex); + // } + } + + public void setOutputChannels(OutputChannels out) { + if (out == null) + throw new NullPointerException("out"); + + outputChannels = out; + } + + public OutputChannels getOutputChannels() { + return outputChannels; + } + + /** + * Retrieves the equalizer settings that the decoder's equalizer will be + * initialized from. + *
+ * The Equalizer
instance returned cannot be changed in real
+ * time to affect the decoder output as it is used only to initialize the
+ * decoders EQ settings. To affect the decoder's output in realtime, use the
+ * Equalizer returned from the getEqualizer() method on the decoder.
+ *
+ * @return The Equalizer
used to initialize the EQ settings of
+ * the decoder.
+ */
+ public Equalizer getInitialEqualizerSettings() {
+ return equalizer;
+ }
+
+ }
\ No newline at end of file
diff --git a/Robust/src/Benchmarks/SSJava/MP3DecoderInfer/DecoderErrors.java b/Robust/src/Benchmarks/SSJava/MP3DecoderInfer/DecoderErrors.java
new file mode 100644
index 00000000..ef3552ad
--- /dev/null
+++ b/Robust/src/Benchmarks/SSJava/MP3DecoderInfer/DecoderErrors.java
@@ -0,0 +1,44 @@
+/*
+ * 09/26/08 throw exception on subbband alloc error: Christopher G. Jennings (cjennings@acm.org)
+ * 11/19/04 1.0 moved to LGPL.
+ * 01/12/99 Initial version. mdm@techie.com
+ *-----------------------------------------------------------------------
+ * 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.
+ *----------------------------------------------------------------------
+ */
+
+
+/**
+ * This interface provides constants describing the error
+ * codes used by the Decoder to indicate errors.
+ *
+ * @author MDM
+ */
+public interface DecoderErrors extends JavaLayerErrors
+{
+
+ static public final int UNKNOWN_ERROR = DECODER_ERROR + 0;
+
+ /**
+ * Layer not supported by the decoder.
+ */
+ static public final int UNSUPPORTED_LAYER = DECODER_ERROR + 1;
+
+ /**
+ * Illegal allocation in subband layer. Indicates a corrupt stream.
+ */
+ static public final int ILLEGAL_SUBBAND_ALLOCATION = DECODER_ERROR + 2;
+
+}
diff --git a/Robust/src/Benchmarks/SSJava/MP3DecoderInfer/DecoderException.java b/Robust/src/Benchmarks/SSJava/MP3DecoderInfer/DecoderException.java
new file mode 100644
index 00000000..d33b0f09
--- /dev/null
+++ b/Robust/src/Benchmarks/SSJava/MP3DecoderInfer/DecoderException.java
@@ -0,0 +1,61 @@
+/*
+ * 11/19/04 1.0 moved to LGPL.
+ * 01/12/99 Initial version. mdm@techie.com
+ *-----------------------------------------------------------------------
+ * 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.
+ *----------------------------------------------------------------------
+ */
+
+
+/**
+ * The DecoderException
represents the class of
+ * errors that can occur when decoding MPEG audio.
+ *
+ * @author MDM
+ */
+public class DecoderException extends JavaLayerException
+ implements DecoderErrors
+{
+ private int errorcode = UNKNOWN_ERROR;
+
+ public DecoderException(String msg, Throwable t)
+ {
+ super(msg, t);
+ }
+
+ public DecoderException(int errorcode, Throwable t)
+ {
+ this(getErrorString(errorcode), t);
+ this.errorcode = errorcode;
+ }
+
+ public int getErrorCode()
+ {
+ return errorcode;
+ }
+
+
+ static public String getErrorString(int errorcode)
+ {
+ // REVIEW: use resource file to map error codes
+ // to locale-sensitive strings.
+
+// return "Decoder errorcode "+Integer.toHexString(errorcode);
+ return "Decoder errorcode "+errorcode;
+ }
+
+
+}
+
diff --git a/Robust/src/Benchmarks/SSJava/MP3DecoderInfer/Equalizer.java b/Robust/src/Benchmarks/SSJava/MP3DecoderInfer/Equalizer.java
new file mode 100644
index 00000000..1fe7fb9e
--- /dev/null
+++ b/Robust/src/Benchmarks/SSJava/MP3DecoderInfer/Equalizer.java
@@ -0,0 +1,200 @@
+/*
+ * 11/19/04 1.0 moved to LGPL.
+ * 12/12/99 Initial version. mdm@techie.com
+ *-----------------------------------------------------------------------
+ * 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.
+ *----------------------------------------------------------------------
+ */
+
+/**
+ * The Equalizer
class can be used to specify equalization settings
+ * for the MPEG audio decoder.
+ *
+ * The equalizer consists of 32 band-pass filters. Each band of the equalizer
+ * can take on a fractional value between -1.0 and +1.0. At -1.0, the input
+ * signal is attenuated by 6dB, at +1.0 the signal is amplified by 6dB.
+ *
+ * @see Decoder
+ *
+ * @author MDM
+ */
+
+
+public final class Equalizer {
+ /**
+ * Equalizer setting to denote that a given band will not be present in the
+ * output signal.
+ */
+
+ static public final float BAND_NOT_PRESENT = Float.NEGATIVE_INFINITY;
+
+
+ static public final Equalizer PASS_THRU_EQ = new Equalizer();
+
+
+ private static final int BANDS = 32;
+
+
+ private final float[] settings = new float[BANDS];
+
+ /**
+ * Creates a new
+ *
+ * @author MDM
+ */
+public class JavaLayerException extends Exception
+{
+
+ private Throwable exception;
+
+
+ public JavaLayerException()
+ {
+ }
+
+ public JavaLayerException(String msg)
+ {
+ super(msg);
+ }
+
+ public JavaLayerException(String msg, Throwable t)
+ {
+ super(msg);
+ exception = t;
+ }
+
+ public Throwable getException()
+ {
+ return exception;
+ }
+
+
+ public void printStackTrace()
+ {
+// printStackTrace(System.err);
+ }
+
+ public void printStackTrace(PrintStream ps)
+ {
+// if (this.exception==null)
+// {
+// super.printStackTrace(ps);
+// }
+// else
+// {
+// exception.printStackTrace();
+// }
+ }
+
+
+}
diff --git a/Robust/src/Benchmarks/SSJava/MP3DecoderInfer/JavaLayerHook.java b/Robust/src/Benchmarks/SSJava/MP3DecoderInfer/JavaLayerHook.java
new file mode 100644
index 00000000..eda09dec
--- /dev/null
+++ b/Robust/src/Benchmarks/SSJava/MP3DecoderInfer/JavaLayerHook.java
@@ -0,0 +1,35 @@
+/*
+ * 11/19/04 1.0 moved to LGPL.
+ *-----------------------------------------------------------------------
+ * 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.
+ *----------------------------------------------------------------------
+ */
+
+
+//import java.io.InputStream;
+
+/**
+ * The Equalizer
instance.
+ */
+ public Equalizer() {
+ }
+
+ // private Equalizer(float b1, float b2, float b3, float b4, float b5,
+ // float b6, float b7, float b8, float b9, float b10, float b11,
+ // float b12, float b13, float b14, float b15, float b16,
+ // float b17, float b18, float b19, float b20);
+
+ public Equalizer(float[] settings) {
+ setFrom(settings);
+ }
+
+ public Equalizer(EQFunction eq) {
+ setFrom(eq);
+ }
+
+ public void setFrom(float[] eq) {
+ reset();
+ int max = (eq.length > BANDS) ? BANDS : eq.length;
+
+ for (int i = 0; i < max; i++) {
+ settings[i] = limit(eq[i]);
+ }
+ }
+
+ public void setFrom(EQFunction eq) {
+ reset();
+ int max = BANDS;
+
+ for (int i = 0; i < max; i++) {
+ settings[i] = limit(eq.getBand(i));
+ }
+ }
+
+ /**
+ * Sets the bands of this equalizer to the value the bands of another
+ * equalizer. Bands that are not present in both equalizers are ignored.
+ */
+ public void setFrom(Equalizer eq) {
+ if (eq != this) {
+ setFrom(eq.settings);
+ }
+ }
+
+ /**
+ * Sets all bands to 0.0
+ */
+ public void reset() {
+ for (int i = 0; i < BANDS; i++) {
+ settings[i] = 0.0f;
+ }
+ }
+
+ /**
+ * Retrieves the number of bands present in this equalizer.
+ */
+ public int getBandCount() {
+ return settings.length;
+ }
+
+ public float setBand(int band, float neweq) {
+ float eq = 0.0f;
+
+ if ((band >= 0) && (band < BANDS)) {
+ eq = settings[band];
+ settings[band] = limit(neweq);
+ }
+
+ return eq;
+ }
+
+ /**
+ * Retrieves the eq setting for a given band.
+ */
+ public float getBand(int band) {
+ float eq = 0.0f;
+
+ if ((band >= 0) && (band < BANDS)) {
+ eq = settings[band];
+ }
+
+ return eq;
+ }
+
+ private float limit(float eq) {
+ if (eq == BAND_NOT_PRESENT)
+ return eq;
+ if (eq > 1.0f)
+ return 1.0f;
+ if (eq < -1.0f)
+ return -1.0f;
+
+ return eq;
+ }
+
+ /**
+ * Retrieves an array of floats whose values represent a scaling factor that
+ * can be applied to linear samples in each band to provide the equalization
+ * represented by this instance.
+ *
+ * @return an array of factors that can be applied to the subbands.
+ */
+
+
+ float[] getBandFactors() {
+ float[] factors = new float[BANDS];
+ int maxCount = BANDS;
+ for ( int i = 0; i < maxCount; i++) {
+ factors[i] = getBandFactor(settings[i]);
+ }
+
+ return factors;
+ }
+
+ /**
+ * Converts an equalizer band setting to a sample factor. The factor is
+ * determined by the function f = 2^n where n is the equalizer band setting in
+ * the range [-1.0,1.0].
+ *
+ */
+
+ float getBandFactor( float eq) {
+ if (eq == BAND_NOT_PRESENT)
+ return 0.0f;
+
+ float f = (float) Math.pow(2.0, eq);
+ return f;
+ }
+
+ static abstract public class EQFunction {
+ /**
+ * Returns the setting of a band in the equalizer.
+ *
+ * @param band
+ * The index of the band to retrieve the setting for.
+ *
+ * @return the setting of the specified band. This is a value between -1 and
+ * +1.
+ */
+ public float getBand(int band) {
+ return 0.0f;
+ }
+
+ }
+
+}
diff --git a/Robust/src/Benchmarks/SSJava/MP3DecoderInfer/FrameDecoder.java b/Robust/src/Benchmarks/SSJava/MP3DecoderInfer/FrameDecoder.java
new file mode 100644
index 00000000..9c7029dd
--- /dev/null
+++ b/Robust/src/Benchmarks/SSJava/MP3DecoderInfer/FrameDecoder.java
@@ -0,0 +1,38 @@
+/*
+ * 09/26/08 throw exception on subbband alloc error: Christopher G. Jennings (cjennings@acm.org)
+ * 11/19/04 1.0 moved to LGPL.
+ * 12/12/99 Initial version. mdm@techie.com
+ *-----------------------------------------------------------------------
+ * 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.
+ *----------------------------------------------------------------------
+ */
+
+
+/**
+ * Implementations of FrameDecoder are responsible for decoding
+ * an MPEG audio frame.
+ *
+ */
+//REVIEW: the interface currently is too thin. There should be
+// methods to specify the output buffer, the synthesis filters and
+// possibly other objects used by the decoder.
+public interface FrameDecoder
+{
+ /**
+ * Decodes one frame of MPEG audio.
+ */
+ public void decodeFrame() throws DecoderException;
+
+}
diff --git a/Robust/src/Benchmarks/SSJava/MP3DecoderInfer/Header.java b/Robust/src/Benchmarks/SSJava/MP3DecoderInfer/Header.java
new file mode 100644
index 00000000..55bf5ed8
--- /dev/null
+++ b/Robust/src/Benchmarks/SSJava/MP3DecoderInfer/Header.java
@@ -0,0 +1,855 @@
+/*
+ * 11/19/04 : 1.0 moved to LGPL.
+ * VBRI header support added, E.B javalayer@javazoom.net
+ *
+ * 12/04/03 : VBR (XING) header support added, E.B javalayer@javazoom.net
+ *
+ * 02/13/99 : Java Conversion by JavaZOOM , E.B javalayer@javazoom.net
+ *
+ * Declarations for MPEG header class
+ * A few layer III, MPEG-2 LSF, and seeking modifications made by Jeff Tsay.
+ * Last modified : 04/19/97
+ *
+ * @(#) header.h 1.7, last edit: 6/15/94 16:55:33
+ * @(#) Copyright (C) 1993, 1994 Tobias Bading (bading@cs.tu-berlin.de)
+ * @(#) Berlin University of Technology
+ *-----------------------------------------------------------------------
+ * 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.
+ *----------------------------------------------------------------------
+ */
+
+/**
+ * Class for extracting information from a frame header.
+ */
+
+
+public final class Header {
+
+ public static final int[][] frequencies = { { 22050, 24000, 16000, 1 },
+ { 44100, 48000, 32000, 1 }, { 11025, 12000, 8000, 1 } }; // SZD: MPEG25
+
+ /**
+ * Constant for MPEG-2 LSF version
+ */
+ public static final int MPEG2_LSF = 0;
+ public static final int MPEG25_LSF = 2; // SZD
+
+ /**
+ * Constant for MPEG-1 version
+ */
+ public static final int MPEG1 = 1;
+
+ public static final int STEREO = 0;
+ public static final int JOINT_STEREO = 1;
+ public static final int DUAL_CHANNEL = 2;
+ public static final int SINGLE_CHANNEL = 3;
+ public static final int FOURTYFOUR_POINT_ONE = 0;
+ public static final int FOURTYEIGHT = 1;
+ public static final int THIRTYTWO = 2;
+
+
+ private int h_layer;
+
+ private int h_protection_bit;
+
+ private int h_bitrate_index;
+
+ private int h_padding_bit;
+
+ private int h_mode_extension;
+
+ private int h_version;
+
+ private int h_mode;
+
+ private int h_sample_frequency;
+
+ private int h_number_of_subbands;
+
+ private int h_intensity_stereo_bound;
+
+ private boolean h_copyright;
+
+ private boolean h_original;
+ // VBR support added by E.B
+
+ private double[] h_vbr_time_per_frame = { -1.0, 384.0, 1152.0, 1152.0 };
+
+ private boolean h_vbr;
+
+ private int h_vbr_frames;
+
+ private int h_vbr_scale;
+
+ private int h_vbr_bytes;
+
+ private byte[] h_vbr_toc;
+
+
+ private byte syncmode = Bitstream.INITIAL_SYNC;
+
+ private Crc16 crc;
+
+
+ public short checksum;
+
+ public int framesize;
+
+ public int nSlots;
+
+
+ private int _headerstring = -1; // E.B
+
+
+ private SideInfoBuffer sib;
+
+ private BitReserve br;
+
+
+ private int idx;
+
+ Header() {
+ }
+
+
+ public String toString() {
+ StringBuffer buffer = new StringBuffer(200);
+ buffer.append("Layer ");
+ buffer.append(layer_string());
+ buffer.append(" frame ");
+ buffer.append(mode_string());
+ buffer.append(' ');
+ buffer.append(version_string());
+ if (!checksums())
+ buffer.append(" no");
+ buffer.append(" checksums");
+ buffer.append(' ');
+ buffer.append(sample_frequency_string());
+ buffer.append(',');
+ buffer.append(' ');
+ buffer.append(bitrate_string());
+
+ String s = buffer.toString();
+ return s;
+ }
+
+ /**
+ * Read a 32-bit header from the bitstream.
+ */
+ int read_header(Bitstream stream, Crc16[] crcp) throws BitstreamException {
+ int headerstring;
+ int channel_bitrate;
+ boolean sync = false;
+ do {
+ headerstring = stream.syncHeader(syncmode);
+ if (headerstring == -1) {
+ return -1;
+ }
+ _headerstring = headerstring; // E.B
+ if (syncmode == Bitstream.INITIAL_SYNC) {
+ h_version = ((headerstring >>> 19) & 1);
+ if (((headerstring >>> 20) & 1) == 0) // SZD: MPEG2.5 detection
+ if (h_version == MPEG2_LSF)
+ h_version = MPEG25_LSF;
+ else
+ throw stream.newBitstreamException(Bitstream.UNKNOWN_ERROR);
+ if ((h_sample_frequency = ((headerstring >>> 10) & 3)) == 3) {
+ throw stream.newBitstreamException(Bitstream.UNKNOWN_ERROR);
+ }
+ }
+ h_layer = 4 - (headerstring >>> 17) & 3;
+ h_protection_bit = (headerstring >>> 16) & 1;
+ h_bitrate_index = (headerstring >>> 12) & 0xF;
+ h_padding_bit = (headerstring >>> 9) & 1;
+ h_mode = ((headerstring >>> 6) & 3);
+ h_mode_extension = (headerstring >>> 4) & 3;
+ if (h_mode == JOINT_STEREO)
+ h_intensity_stereo_bound = (h_mode_extension << 2) + 4;
+ else
+ h_intensity_stereo_bound = 0; // should never be used
+ if (((headerstring >>> 3) & 1) == 1)
+ h_copyright = true;
+ if (((headerstring >>> 2) & 1) == 1)
+ h_original = true;
+ // calculate number of subbands:
+ if (h_layer == 1)
+ h_number_of_subbands = 32;
+ else {
+ channel_bitrate = h_bitrate_index;
+ // calculate bitrate per channel:
+ if (h_mode != SINGLE_CHANNEL)
+ if (channel_bitrate == 4)
+ channel_bitrate = 1;
+ else
+ channel_bitrate -= 4;
+ if ((channel_bitrate == 1) || (channel_bitrate == 2))
+ if (h_sample_frequency == THIRTYTWO)
+ h_number_of_subbands = 12;
+ else
+ h_number_of_subbands = 8;
+ else if ((h_sample_frequency == FOURTYEIGHT)
+ || ((channel_bitrate >= 3) && (channel_bitrate <= 5)))
+ h_number_of_subbands = 27;
+ else
+ h_number_of_subbands = 30;
+ }
+ if (h_intensity_stereo_bound > h_number_of_subbands)
+ h_intensity_stereo_bound = h_number_of_subbands;
+ // calculate framesize and nSlots
+ calculate_framesize();
+ // read framedata:
+ int framesizeloaded = stream.read_frame_data(framesize);
+ if ((framesize >= 0) && (framesizeloaded != framesize)) {
+ // Data loaded does not match to expected framesize,
+ // it might be an ID3v1 TAG. (Fix 11/17/04).
+ throw stream.newBitstreamException(Bitstream.INVALIDFRAME);
+ }
+ if (stream.isSyncCurrentPosition(syncmode)) {
+ if (syncmode == Bitstream.INITIAL_SYNC) {
+ syncmode = Bitstream.STRICT_SYNC;
+ stream.set_syncword(headerstring & 0xFFF80CC0);
+ }
+ sync = true;
+ } else {
+ stream.unreadFrame();
+ }
+ } while (!sync);
+ stream.parse_frame();
+ if (h_protection_bit == 0) {
+ // frame contains a crc checksum
+ checksum = (short) stream.get_bits(16);
+ if (crc == null)
+ crc = new Crc16();
+ crc.add_bits(headerstring, 16);
+ crcp[0] = crc;
+ } else
+ crcp[0] = null;
+ if (h_sample_frequency == FOURTYFOUR_POINT_ONE) {
+ /*
+ * if (offset == null) { int max = max_number_of_frames(stream); offset =
+ * new int[max]; for(int i=0; iInputStreamSource
implements a
+ * Source
that provides data from an InputStream
+ *
. Seeking functionality is not supported.
+ *
+ * @author MDM
+ */
+public class InputStreamSource implements Source
+{
+ private final InputStream in;
+
+ public InputStreamSource(InputStream in)
+ {
+ if (in==null)
+ throw new NullPointerException("in");
+
+ this.in = in;
+ }
+
+ public int read(byte[] b, int offs, int len)
+ throws IOException
+ {
+ int read = in.read(b, offs, len);
+ return read;
+ }
+
+ public boolean willReadBlock()
+ {
+ return true;
+ //boolean block = (in.available()==0);
+ //return block;
+ }
+
+ public boolean isSeekable()
+ {
+ return false;
+ }
+
+ public long tell()
+ {
+ return -1;
+ }
+
+ public long seek(long to)
+ {
+ return -1;
+ }
+
+ public long length()
+ {
+ return -1;
+ }
+}
diff --git a/Robust/src/Benchmarks/SSJava/MP3DecoderInfer/JavaLayerError.java b/Robust/src/Benchmarks/SSJava/MP3DecoderInfer/JavaLayerError.java
new file mode 100644
index 00000000..cc8dde73
--- /dev/null
+++ b/Robust/src/Benchmarks/SSJava/MP3DecoderInfer/JavaLayerError.java
@@ -0,0 +1,29 @@
+/*
+ * 11/19/04 1.0 moved to LGPL.
+ * 12/12/99 Initial version. mdm@techie.com
+ *-----------------------------------------------------------------------
+ * 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.
+ *----------------------------------------------------------------------
+ */
+
+/**
+ * Work in progress.
+ *
+ * API usage errors may be handled by throwing an instance of this
+ * class, as per JMF 2.0.
+ */
+public class JavaLayerError extends Error
+{
+}
diff --git a/Robust/src/Benchmarks/SSJava/MP3DecoderInfer/JavaLayerErrors.java b/Robust/src/Benchmarks/SSJava/MP3DecoderInfer/JavaLayerErrors.java
new file mode 100644
index 00000000..4d11270c
--- /dev/null
+++ b/Robust/src/Benchmarks/SSJava/MP3DecoderInfer/JavaLayerErrors.java
@@ -0,0 +1,39 @@
+/*
+ * 11/19/04 1.0 moved to LGPL.
+ * 12/12/99 Initial version. mdm@techie.com
+ *-----------------------------------------------------------------------
+ * 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.
+ *----------------------------------------------------------------------
+ */
+
+
+/**
+ * Exception erorr codes for components of the JavaLayer API.
+ */
+public interface JavaLayerErrors
+{
+ /**
+ * The first bitstream error code. See the {@link DecoderErrors DecoderErrors}
+ * interface for other bitstream error codes.
+ */
+ static public final int BITSTREAM_ERROR = 0x100;
+
+ /**
+ * The first decoder error code. See the {@link DecoderErrors DecoderErrors}
+ * interface for other decoder error codes.
+ */
+ static public final int DECODER_ERROR = 0x200;
+
+}
diff --git a/Robust/src/Benchmarks/SSJava/MP3DecoderInfer/JavaLayerException.java b/Robust/src/Benchmarks/SSJava/MP3DecoderInfer/JavaLayerException.java
new file mode 100644
index 00000000..2759a9a8
--- /dev/null
+++ b/Robust/src/Benchmarks/SSJava/MP3DecoderInfer/JavaLayerException.java
@@ -0,0 +1,79 @@
+/*
+ * 11/19/04 1.0 moved to LGPL.
+ * 12/12/99 Initial version. mdm@techie.com
+ *-----------------------------------------------------------------------
+ * 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.
+ *----------------------------------------------------------------------
+ */
+
+
+//import java.io.PrintStream;
+
+
+/**
+ * The JavaLayerException is the base class for all API-level
+ * exceptions thrown by JavaLayer. To facilitate conversion and
+ * common handling of exceptions from other domains, the class
+ * can delegate some functionality to a contained Throwable instance.
+ * JavaLayerHooks
class allows developers to change
+ * the way the JavaLayer library uses Resources.
+ */
+
+public interface JavaLayerHook
+{
+ /**
+ * Retrieves the named resource. This allows resources to be
+ * obtained without specifying how they are retrieved.
+ */
+ public InputStream getResourceAsStream(String name);
+}
diff --git a/Robust/src/Benchmarks/SSJava/MP3DecoderInfer/JavaLayerUtils.java b/Robust/src/Benchmarks/SSJava/MP3DecoderInfer/JavaLayerUtils.java
new file mode 100644
index 00000000..13f2ac0b
--- /dev/null
+++ b/Robust/src/Benchmarks/SSJava/MP3DecoderInfer/JavaLayerUtils.java
@@ -0,0 +1,227 @@
+/*
+ * 11/19/04 1.0 moved to LGPL.
+ * 12/12/99 Initial version. mdm@techie.com
+ *-----------------------------------------------------------------------
+ * 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.
+ *----------------------------------------------------------------------
+ */
+
+
+//import java.io.IOException;
+//import java.io.InputStream;
+//import java.io.InvalidClassException;
+//import java.io.InvalidObjectException;
+//import java.io.ObjectInputStream;
+//import java.io.ObjectOutputStream;
+//import java.io.OutputStream;
+//import java.lang.reflect.Array;
+
+/**
+ * The JavaLayerUtils class is not strictly part of the JavaLayer API.
+ * It serves to provide useful methods and system-wide hooks.
+ *
+ * @author MDM
+ */
+public class JavaLayerUtils
+{
+ static private JavaLayerHook hook = null;
+
+ /**
+ * Deserializes the object contained in the given input stream.
+ * @param in The input stream to deserialize an object from.
+ * @param cls The expected class of the deserialized object.
+ */
+// static public Object deserialize(InputStream in, Class cls)
+ static public Object deserialize(InputStream in)
+ throws IOException
+ {
+// if (cls==null)
+// throw new NullPointerException("cls");
+
+// Object obj = deserialize(in, cls);
+ Object obj = deserialize(in);
+// if (!cls.isInstance(obj))
+// {
+// throw new InvalidObjectException("type of deserialized instance not of required class.");
+// }
+
+ return obj;
+ }
+
+ /**
+ * Deserializes an object from the given InputStream
.
+ * The deserialization is delegated to an
+ * ObjectInputStream
instance.
+ *
+ * @param in The InputStream
to deserialize an object
+ * from.
+ *
+ * @return The object deserialized from the stream.
+ * @exception IOException is thrown if there was a problem reading
+ * the underlying stream, or an object could not be deserialized
+ * from the stream.
+ *
+ * @see java.io.ObjectInputStream
+ */
+ static public Object deserialize(InputStream in)
+ throws IOException
+ {
+ if (in==null)
+ throw new NullPointerException("in");
+
+ //TODO : need to enable after having objectinputstream
+ /*
+ ObjectInputStream objIn = new ObjectInputStream(in);
+
+ Object obj;
+
+ try
+ {
+ obj = objIn.readObject();
+ }
+ catch (ClassNotFoundException ex)
+ {
+ throw new InvalidClassException(ex.toString());
+ }
+
+ return obj;
+ */
+ return null;
+ }
+
+ /**
+ * Deserializes an array from a given InputStream
.
+ *
+ * @param in The InputStream
to
+ * deserialize an object from.
+ *
+ * @param elemType The class denoting the type of the array
+ * elements.
+ * @param length The expected length of the array, or -1 if
+ * any length is expected.
+ */
+ static public Object deserializeArray(InputStream in, int length)
+ throws IOException
+ {
+ if (length<-1)
+ throw new IllegalArgumentException("length");
+
+ Object obj = deserialize(in);
+
+ return obj;
+ }
+// static public Object deserializeArray(InputStream in, Class elemType, int length)
+// throws IOException
+// {
+// if (elemType==null)
+// throw new NullPointerException("elemType");
+//
+// if (length<-1)
+// throw new IllegalArgumentException("length");
+//
+// Object obj = deserialize(in);
+//
+// //SSJava will never throw exceptions as it is so this code is meaningless
+// /*
+// Class cls = obj.getClass();
+//
+// if (!cls.isArray())
+// throw new InvalidObjectException("object is not an array");
+//
+// Class arrayElemType = cls.getComponentType();
+// if (arrayElemType!=elemType)
+// throw new InvalidObjectException("unexpected array component type");
+//
+// if (length != -1)
+// {
+// int arrayLength = Array.getLength(obj);
+// if (arrayLength!=length)
+// throw new InvalidObjectException("array length mismatch");
+// }
+// */
+// return obj;
+// }
+
+// static public Object deserializeArrayResource(String name, Class elemType, int length)
+ static public Object deserializeArrayResource(String name, int length)
+ throws IOException
+ {
+ InputStream str = getResourceAsStream(name);
+ if (str==null)
+ throw new IOException("unable to load resource '"+name+"'");
+
+// Object obj = deserializeArray(str, elemType, length);
+ Object obj = deserializeArray(str, length);
+
+ return obj;
+ }
+
+ static public void serialize(OutputStream out, Object obj)
+ throws IOException
+ {
+ //TODO : need to enable after having objectinputstream
+// if (out==null)
+// throw new NullPointerException("out");
+//
+// if (obj==null)
+// throw new NullPointerException("obj");
+//
+// ObjectOutputStream objOut = new ObjectOutputStream(out);
+// objOut.writeObject(obj);
+
+ }
+
+ /**
+ * Sets the system-wide JavaLayer hook.
+ */
+ static synchronized public void setHook(JavaLayerHook hook0)
+ {
+ hook = hook0;
+ }
+
+ static synchronized public JavaLayerHook getHook()
+ {
+ return hook;
+ }
+
+ /**
+ * Retrieves an InputStream for a named resource.
+ *
+ * @param name The name of the resource. This must be a simple
+ * name, and not a qualified package name.
+ *
+ * @return The InputStream for the named resource, or null if
+ * the resource has not been found. If a hook has been
+ * provided, its getResourceAsStream() method is called
+ * to retrieve the resource.
+ */
+ static synchronized public InputStream getResourceAsStream(String name)
+ {
+ InputStream is = null;
+
+ if (hook!=null)
+ {
+ is = hook.getResourceAsStream(name);
+ }
+ //TODO java reflection
+// else
+// {
+// Class cls = JavaLayerUtils.class;
+// is = cls.getResourceAsStream(name);
+// }
+
+ return is;
+ }
+}
diff --git a/Robust/src/Benchmarks/SSJava/MP3DecoderInfer/LATTICE.java b/Robust/src/Benchmarks/SSJava/MP3DecoderInfer/LATTICE.java
new file mode 100644
index 00000000..3dc53b81
--- /dev/null
+++ b/Robust/src/Benchmarks/SSJava/MP3DecoderInfer/LATTICE.java
@@ -0,0 +1,3 @@
+public @interface LATTICE{
+ String value();
+}
diff --git a/Robust/src/Benchmarks/SSJava/MP3DecoderInfer/LOC.java b/Robust/src/Benchmarks/SSJava/MP3DecoderInfer/LOC.java
new file mode 100644
index 00000000..0165516c
--- /dev/null
+++ b/Robust/src/Benchmarks/SSJava/MP3DecoderInfer/LOC.java
@@ -0,0 +1,7 @@
+public @interface LOC {
+ String value();
+}
+
+public @interface RETURNLOC {
+ String value();
+}
\ No newline at end of file
diff --git a/Robust/src/Benchmarks/SSJava/MP3DecoderInfer/LayerIDecoder.java b/Robust/src/Benchmarks/SSJava/MP3DecoderInfer/LayerIDecoder.java
new file mode 100644
index 00000000..2b28d2d8
--- /dev/null
+++ b/Robust/src/Benchmarks/SSJava/MP3DecoderInfer/LayerIDecoder.java
@@ -0,0 +1,432 @@
+/*
+ * 09/26/08 throw exception on subbband alloc error: Christopher G. Jennings (cjennings@acm.org)
+ *
+ * 11/19/04 1.0 moved to LGPL.
+ *
+ * 12/12/99 Initial version. Adapted from javalayer.java
+ * and Subband*.java. mdm@techie.com
+ *
+ * 02/28/99 Initial version : javalayer.java by E.B
+ *-----------------------------------------------------------------------
+ * 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.
+ *----------------------------------------------------------------------
+ */
+
+/**
+ * Implements decoding of MPEG Audio Layer I frames.
+ */
+
+
+class LayerIDecoder implements FrameDecoder {
+
+
+ protected Bitstream stream;
+
+ protected Header header;
+
+ protected SynthesisFilter filter1;
+
+ protected SynthesisFilter filter2;
+
+ protected Obuffer buffer;
+
+ protected int which_channels;
+
+ protected int mode;
+
+
+ protected int num_subbands;
+
+ protected Subband[] subbands;
+
+
+ protected Crc16 crc = null; // new Crc16[1] to enable CRC checking.
+
+ public LayerIDecoder() {
+ crc = new Crc16();
+ }
+
+ public void create( Bitstream stream0, Header header0,
+ SynthesisFilter filtera, SynthesisFilter filterb,
+ Obuffer buffer0, int which_ch0) {
+ stream = stream0;
+ header = header0;
+ filter1 = filtera;
+ filter2 = filterb;
+ buffer = buffer0;
+ which_channels = which_ch0;
+
+ }
+
+ public void decodeFrame() throws DecoderException {
+
+ num_subbands = header.number_of_subbands();
+ subbands = new Subband[32];
+ mode = header.mode();
+
+ createSubbands();
+
+ readAllocation();
+ readScaleFactorSelection();
+
+ if ((crc != null) || header.checksum_ok()) {
+ readScaleFactors();
+
+ readSampleData();
+ }
+
+ }
+
+ protected void createSubbands() {
+ int i;
+ if (mode == Header.SINGLE_CHANNEL) {
+ for (i = 0; i < num_subbands; ++i) {
+ subbands[i] = new SubbandLayer1(i);
+ }
+ } else if (mode == Header.JOINT_STEREO) {
+ for (i = 0; i < header.intensity_stereo_bound(); ++i) {
+ subbands[i] = new SubbandLayer1Stereo(i);
+ }
+ for (; i < num_subbands; ++i) {
+ subbands[i] = new SubbandLayer1IntensityStereo(i);
+ }
+ } else {
+ for (i = 0; i < num_subbands; ++i) {
+ subbands[i] = new SubbandLayer1Stereo(i);
+ }
+ }
+ }
+
+ protected void readAllocation() throws DecoderException {
+ // start to read audio data:
+ for ( int i = 0; i < num_subbands; ++i)
+ subbands[i].read_allocation(stream, header, crc);
+
+ }
+
+ protected void readScaleFactorSelection() {
+ // scale factor selection not present for layer I.
+ }
+
+ protected void readScaleFactors() {
+ for ( int i = 0; i < num_subbands; ++i)
+ subbands[i].read_scalefactor(stream, header);
+ }
+
+
+ protected void readSampleData() {
+
+ boolean read_ready = false;
+ boolean write_ready = false;
+
+ int mode = header.mode(); // header.mode() will return
+ // DELTA(THIS)
+
+ int i;
+ do {
+
+ for (i = 0; i < num_subbands; ++i) {
+ read_ready = subbands[i].read_sampledata(stream); // DELTA[Loc[readSampleData.V],Loc[LayerIDecoder.L]]
+ }
+
+ do {
+ for (i = 0; i < num_subbands; ++i) {
+ write_ready = subbands[i].put_next_sample(which_channels, filter1, filter2);
+ }
+
+ filter1.calculate_pcm_samples(buffer);
+ if ((which_channels == OutputChannels.BOTH_CHANNELS) && (mode != Header.SINGLE_CHANNEL)) {
+ filter2.calculate_pcm_samples(buffer);
+ }
+
+ } while (!write_ready);
+
+ } while (!read_ready);
+
+ }
+
+ /**
+ * Class for layer I subbands in single channel mode. Used for single channel
+ * mode and in derived class for intensity stereo mode
+ */
+
+
+ static class SubbandLayer1 extends Subband {
+
+ // Factors and offsets for sample requantization
+ public static final float table_factor[] = { 0.0f, (1.0f / 2.0f) * (4.0f / 3.0f),
+ (1.0f / 4.0f) * (8.0f / 7.0f), (1.0f / 8.0f) * (16.0f / 15.0f),
+ (1.0f / 16.0f) * (32.0f / 31.0f), (1.0f / 32.0f) * (64.0f / 63.0f),
+ (1.0f / 64.0f) * (128.0f / 127.0f), (1.0f / 128.0f) * (256.0f / 255.0f),
+ (1.0f / 256.0f) * (512.0f / 511.0f), (1.0f / 512.0f) * (1024.0f / 1023.0f),
+ (1.0f / 1024.0f) * (2048.0f / 2047.0f), (1.0f / 2048.0f) * (4096.0f / 4095.0f),
+ (1.0f / 4096.0f) * (8192.0f / 8191.0f), (1.0f / 8192.0f) * (16384.0f / 16383.0f),
+ (1.0f / 16384.0f) * (32768.0f / 32767.0f) };
+
+ public static final float table_offset[] = { 0.0f, ((1.0f / 2.0f) - 1.0f) * (4.0f / 3.0f),
+ ((1.0f / 4.0f) - 1.0f) * (8.0f / 7.0f), ((1.0f / 8.0f) - 1.0f) * (16.0f / 15.0f),
+ ((1.0f / 16.0f) - 1.0f) * (32.0f / 31.0f), ((1.0f / 32.0f) - 1.0f) * (64.0f / 63.0f),
+ ((1.0f / 64.0f) - 1.0f) * (128.0f / 127.0f), ((1.0f / 128.0f) - 1.0f) * (256.0f / 255.0f),
+ ((1.0f / 256.0f) - 1.0f) * (512.0f / 511.0f),
+ ((1.0f / 512.0f) - 1.0f) * (1024.0f / 1023.0f),
+ ((1.0f / 1024.0f) - 1.0f) * (2048.0f / 2047.0f),
+ ((1.0f / 2048.0f) - 1.0f) * (4096.0f / 4095.0f),
+ ((1.0f / 4096.0f) - 1.0f) * (8192.0f / 8191.0f),
+ ((1.0f / 8192.0f) - 1.0f) * (16384.0f / 16383.0f),
+ ((1.0f / 16384.0f) - 1.0f) * (32768.0f / 32767.0f) };
+
+
+ protected int subbandnumber;
+
+ protected int samplenumber;
+
+ protected int allocation;
+
+ protected float scalefactor;
+
+ protected int samplelength;
+
+ protected float sample;
+
+ protected float factor;
+
+ protected float offset;
+
+ /**
+ * Construtor.
+ */
+ public SubbandLayer1( int subbandnumber) {
+ this.subbandnumber = subbandnumber;
+ samplenumber = 0;
+ }
+
+ /**
+ *
+ */
+ //
+
+ public void read_allocation( Bitstream stream,
+ Header header, Crc16 crc)
+ throws DecoderException {
+
+ if ((allocation = stream.get_bits(4)) == 15) {
+ // CGJ: catch this condition and throw appropriate exception
+ throw new DecoderException(DecoderErrors.ILLEGAL_SUBBAND_ALLOCATION, null);
+ // cerr << "WARNING: stream contains an illegal allocation!\n";
+ // MPEG-stream is corrupted!
+ }
+
+ if (crc != null) {
+ crc.add_bits(allocation, 4); // allocation has [THIS,H]
+ // crc has [IN]
+ }
+ if (allocation != 0) {
+ samplelength = allocation + 1;
+ factor = table_factor[allocation];
+ offset = table_offset[allocation];
+ }
+ }
+
+ /**
+ *
+ */
+ public void read_scalefactor( Bitstream stream, Header header) {
+ if (allocation != 0)
+ scalefactor = scalefactors[stream.get_bits(6)];
+ }
+
+ // ssjava
+
+
+ public boolean read_sampledata( Bitstream stream) {
+ if (allocation != 0) {
+ sample = (float) (stream.get_bits(samplelength));
+ }
+ if (++samplenumber == 12) {
+ samplenumber = 0;
+ return true;
+ }
+ return false;
+ }
+
+ //
+
+ public boolean put_next_sample( int channels,
+ SynthesisFilter filter1,
+ SynthesisFilter filter2) {
+ if ((allocation != 0) && (channels != OutputChannels.RIGHT_CHANNEL)) {
+ float scaled_sample =
+ (sample * factor + offset) * scalefactor;
+ filter1.input_sample(scaled_sample, subbandnumber);
+ }
+ return true;
+ }
+ };
+
+ /**
+ * Class for layer I subbands in joint stereo mode.
+ */
+
+
+ static class SubbandLayer1IntensityStereo extends SubbandLayer1 {
+
+ protected float channel2_scalefactor;
+
+ /**
+ * Constructor
+ */
+ public SubbandLayer1IntensityStereo( int subbandnumber) {
+ super(subbandnumber);
+ }
+
+ /**
+ *
+ */
+
+ public void read_allocation( Bitstream stream, Header header,
+ Crc16 crc) throws DecoderException {
+ super.read_allocation(stream, header, crc);
+ }
+
+ /**
+ *
+ */
+ public void read_scalefactor( Bitstream stream, Header header) {
+ if (allocation != 0) {
+ scalefactor = scalefactors[stream.get_bits(6)];
+ channel2_scalefactor = scalefactors[stream.get_bits(6)];
+ }
+ }
+
+ public boolean read_sampledata( Bitstream stream) {
+ return super.read_sampledata(stream);
+ }
+
+ public boolean put_next_sample( int channels, SynthesisFilter filter1,
+ SynthesisFilter filter2) {
+ if (allocation != 0) {
+ sample = sample * factor + offset; // requantization
+ if (channels == OutputChannels.BOTH_CHANNELS) {
+ float sample1 = sample * scalefactor;
+ float sample2 = sample * channel2_scalefactor;
+ filter1.input_sample(sample1, subbandnumber);
+ filter2.input_sample(sample2, subbandnumber);
+ } else if (channels == OutputChannels.LEFT_CHANNEL) {
+ float sample1 = sample * scalefactor;
+ filter1.input_sample(sample1, subbandnumber);
+ } else {
+ float sample2 = sample * channel2_scalefactor;
+ filter1.input_sample(sample2, subbandnumber);
+ }
+ }
+ return true;
+ }
+ };
+
+ /**
+ * Class for layer I subbands in stereo mode.
+ */
+
+
+ static class SubbandLayer1Stereo extends SubbandLayer1 {
+
+ protected int channel2_allocation;
+
+ protected float channel2_scalefactor;
+
+ protected int channel2_samplelength;
+
+ protected float channel2_sample;
+
+ protected float channel2_factor;
+
+ protected float channel2_offset;
+
+ /**
+ * Constructor
+ */
+ public SubbandLayer1Stereo( int subbandnumber) {
+ super(subbandnumber);
+ }
+
+ /**
+ *
+ */
+ // ssjava
+ public void read_allocation( Bitstream stream,
+ Header header, Crc16 crc)
+ throws DecoderException {
+ allocation = stream.get_bits(4);
+ channel2_allocation = stream.get_bits(4);
+ if (crc != null) {
+ crc.add_bits(allocation, 4);
+ crc.add_bits(channel2_allocation, 4);
+ }
+ if (allocation != 0) {
+ samplelength = allocation + 1;
+ factor = table_factor[allocation];
+ offset = table_offset[allocation];
+ }
+ if (channel2_allocation != 0) {
+ channel2_samplelength = channel2_allocation + 1;
+ channel2_factor = table_factor[channel2_allocation];
+ channel2_offset = table_offset[channel2_allocation];
+ }
+ }
+
+ /**
+ *
+ */
+ public void read_scalefactor( Bitstream stream, Header header) {
+ if (allocation != 0)
+ scalefactor = scalefactors[stream.get_bits(6)];
+ if (channel2_allocation != 0)
+ channel2_scalefactor = scalefactors[stream.get_bits(6)];
+ }
+
+ /**
+ *
+ */
+
+ public boolean read_sampledata( Bitstream stream) {
+ boolean returnvalue =
+ super.read_sampledata(stream);
+ if (channel2_allocation != 0) {
+ channel2_sample = (float) (stream.get_bits(channel2_samplelength));
+ }
+ return returnvalue;
+ }
+
+ /**
+ *
+ */
+
+ public boolean put_next_sample( int channels, SynthesisFilter filter1,
+ SynthesisFilter filter2) {
+ super.put_next_sample(channels, filter1, filter2);
+ if ((channel2_allocation != 0) && (channels != OutputChannels.LEFT_CHANNEL)) {
+ float sample2 =
+ (channel2_sample * channel2_factor + channel2_offset) * channel2_scalefactor;
+ if (channels == OutputChannels.BOTH_CHANNELS)
+ filter2.input_sample(sample2, subbandnumber);
+ else
+ filter1.input_sample(sample2, subbandnumber);
+ }
+ return true;
+ }
+
+ };
+
+}
diff --git a/Robust/src/Benchmarks/SSJava/MP3DecoderInfer/LayerIIDecoder.java b/Robust/src/Benchmarks/SSJava/MP3DecoderInfer/LayerIIDecoder.java
new file mode 100644
index 00000000..d9af8f4b
--- /dev/null
+++ b/Robust/src/Benchmarks/SSJava/MP3DecoderInfer/LayerIIDecoder.java
@@ -0,0 +1,1130 @@
+/*
+ * 11/19/04 1.0 moved to LGPL.
+ *
+ * 29/05/01 Michael Scheerer, Fixed some C++ to Java porting bugs.
+ *
+ * 16/07/01 Michael Scheerer, Catched a bug in method
+ * read_sampledata, which causes an outOfIndexException.
+ *
+ * 12/12/99 Initial version. Adapted from javalayer.java
+ * and Subband*.java. mdm@techie.com
+ *
+ * 02/28/99 Initial version : javalayer.java by E.B
+ *-----------------------------------------------------------------------
+ * 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.
+ *----------------------------------------------------------------------
+ */
+
+/**
+ * Implements decoding of MPEG Audio Layer II frames.
+ */
+
+
+class LayerIIDecoder extends LayerIDecoder implements FrameDecoder {
+
+ public LayerIIDecoder() {
+ }
+
+ protected void createSubbands() {
+ int i;
+ if (mode == Header.SINGLE_CHANNEL)
+ for (i = 0; i < num_subbands; ++i)
+ subbands[i] = new SubbandLayer2(i);
+ else if (mode == Header.JOINT_STEREO) {
+ for (i = 0; i < header.intensity_stereo_bound(); ++i)
+ subbands[i] = new SubbandLayer2Stereo(i);
+ for (; i < num_subbands; ++i)
+ subbands[i] = new SubbandLayer2IntensityStereo(i);
+ } else {
+ for (i = 0; i < num_subbands; ++i)
+ subbands[i] = new SubbandLayer2Stereo(i);
+ }
+
+ }
+
+ protected void readScaleFactorSelection() {
+ // eom note: num_subbands is defined in LayerIDecoder so it has (THIS,
+ // LayerIDecoder) Loc
+ for ( int i = 0; i < num_subbands; ++i) {
+ ((SubbandLayer2) subbands[i]).read_scalefactor_selection(stream, crc);
+ }
+ }
+
+ /**
+ * Class for layer II subbands in single channel mode.
+ */
+
+
+ static class SubbandLayer2 extends Subband {
+ // this table contains 3 requantized samples for each legal codeword
+ // when grouped in 5 bits, i.e. 3 quantizationsteps per sample
+ public static final float grouping_5bits[] = new float[] { -2.0f / 3.0f, -2.0f / 3.0f,
+ -2.0f / 3.0f, 0.0f, -2.0f / 3.0f, -2.0f / 3.0f, 2.0f / 3.0f, -2.0f / 3.0f, -2.0f / 3.0f,
+ -2.0f / 3.0f, 0.0f, -2.0f / 3.0f, 0.0f, 0.0f, -2.0f / 3.0f, 2.0f / 3.0f, 0.0f,
+ -2.0f / 3.0f, -2.0f / 3.0f, 2.0f / 3.0f, -2.0f / 3.0f, 0.0f, 2.0f / 3.0f, -2.0f / 3.0f,
+ 2.0f / 3.0f, 2.0f / 3.0f, -2.0f / 3.0f, -2.0f / 3.0f, -2.0f / 3.0f, 0.0f, 0.0f,
+ -2.0f / 3.0f, 0.0f, 2.0f / 3.0f, -2.0f / 3.0f, 0.0f, -2.0f / 3.0f, 0.0f, 0.0f, 0.0f, 0.0f,
+ 0.0f, 2.0f / 3.0f, 0.0f, 0.0f, -2.0f / 3.0f, 2.0f / 3.0f, 0.0f, 0.0f, 2.0f / 3.0f, 0.0f,
+ 2.0f / 3.0f, 2.0f / 3.0f, 0.0f, -2.0f / 3.0f, -2.0f / 3.0f, 2.0f / 3.0f, 0.0f,
+ -2.0f / 3.0f, 2.0f / 3.0f, 2.0f / 3.0f, -2.0f / 3.0f, 2.0f / 3.0f, -2.0f / 3.0f, 0.0f,
+ 2.0f / 3.0f, 0.0f, 0.0f, 2.0f / 3.0f, 2.0f / 3.0f, 0.0f, 2.0f / 3.0f, -2.0f / 3.0f,
+ 2.0f / 3.0f, 2.0f / 3.0f, 0.0f, 2.0f / 3.0f, 2.0f / 3.0f, 2.0f / 3.0f, 2.0f / 3.0f,
+ 2.0f / 3.0f };
+
+ // this table contains 3 requantized samples for each legal codeword
+ // when grouped in 7 bits, i.e. 5 quantizationsteps per sample
+ public static final float grouping_7bits[] = new float[] { -0.8f, -0.8f, -0.8f, -0.4f, -0.8f,
+ -0.8f, 0.0f, -0.8f, -0.8f, 0.4f, -0.8f, -0.8f, 0.8f, -0.8f, -0.8f, -0.8f, -0.4f, -0.8f,
+ -0.4f, -0.4f, -0.8f, 0.0f, -0.4f, -0.8f, 0.4f, -0.4f, -0.8f, 0.8f, -0.4f, -0.8f, -0.8f,
+ 0.0f, -0.8f, -0.4f, 0.0f, -0.8f, 0.0f, 0.0f, -0.8f, 0.4f, 0.0f, -0.8f, 0.8f, 0.0f, -0.8f,
+ -0.8f, 0.4f, -0.8f, -0.4f, 0.4f, -0.8f, 0.0f, 0.4f, -0.8f, 0.4f, 0.4f, -0.8f, 0.8f, 0.4f,
+ -0.8f, -0.8f, 0.8f, -0.8f, -0.4f, 0.8f, -0.8f, 0.0f, 0.8f, -0.8f, 0.4f, 0.8f, -0.8f, 0.8f,
+ 0.8f, -0.8f, -0.8f, -0.8f, -0.4f, -0.4f, -0.8f, -0.4f, 0.0f, -0.8f, -0.4f, 0.4f, -0.8f,
+ -0.4f, 0.8f, -0.8f, -0.4f, -0.8f, -0.4f, -0.4f, -0.4f, -0.4f, -0.4f, 0.0f, -0.4f, -0.4f,
+ 0.4f, -0.4f, -0.4f, 0.8f, -0.4f, -0.4f, -0.8f, 0.0f, -0.4f, -0.4f, 0.0f, -0.4f, 0.0f, 0.0f,
+ -0.4f, 0.4f, 0.0f, -0.4f, 0.8f, 0.0f, -0.4f, -0.8f, 0.4f, -0.4f, -0.4f, 0.4f, -0.4f, 0.0f,
+ 0.4f, -0.4f, 0.4f, 0.4f, -0.4f, 0.8f, 0.4f, -0.4f, -0.8f, 0.8f, -0.4f, -0.4f, 0.8f, -0.4f,
+ 0.0f, 0.8f, -0.4f, 0.4f, 0.8f, -0.4f, 0.8f, 0.8f, -0.4f, -0.8f, -0.8f, 0.0f, -0.4f, -0.8f,
+ 0.0f, 0.0f, -0.8f, 0.0f, 0.4f, -0.8f, 0.0f, 0.8f, -0.8f, 0.0f, -0.8f, -0.4f, 0.0f, -0.4f,
+ -0.4f, 0.0f, 0.0f, -0.4f, 0.0f, 0.4f, -0.4f, 0.0f, 0.8f, -0.4f, 0.0f, -0.8f, 0.0f, 0.0f,
+ -0.4f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.4f, 0.0f, 0.0f, 0.8f, 0.0f, 0.0f, -0.8f, 0.4f, 0.0f,
+ -0.4f, 0.4f, 0.0f, 0.0f, 0.4f, 0.0f, 0.4f, 0.4f, 0.0f, 0.8f, 0.4f, 0.0f, -0.8f, 0.8f, 0.0f,
+ -0.4f, 0.8f, 0.0f, 0.0f, 0.8f, 0.0f, 0.4f, 0.8f, 0.0f, 0.8f, 0.8f, 0.0f, -0.8f, -0.8f,
+ 0.4f, -0.4f, -0.8f, 0.4f, 0.0f, -0.8f, 0.4f, 0.4f, -0.8f, 0.4f, 0.8f, -0.8f, 0.4f, -0.8f,
+ -0.4f, 0.4f, -0.4f, -0.4f, 0.4f, 0.0f, -0.4f, 0.4f, 0.4f, -0.4f, 0.4f, 0.8f, -0.4f, 0.4f,
+ -0.8f, 0.0f, 0.4f, -0.4f, 0.0f, 0.4f, 0.0f, 0.0f, 0.4f, 0.4f, 0.0f, 0.4f, 0.8f, 0.0f, 0.4f,
+ -0.8f, 0.4f, 0.4f, -0.4f, 0.4f, 0.4f, 0.0f, 0.4f, 0.4f, 0.4f, 0.4f, 0.4f, 0.8f, 0.4f, 0.4f,
+ -0.8f, 0.8f, 0.4f, -0.4f, 0.8f, 0.4f, 0.0f, 0.8f, 0.4f, 0.4f, 0.8f, 0.4f, 0.8f, 0.8f, 0.4f,
+ -0.8f, -0.8f, 0.8f, -0.4f, -0.8f, 0.8f, 0.0f, -0.8f, 0.8f, 0.4f, -0.8f, 0.8f, 0.8f, -0.8f,
+ 0.8f, -0.8f, -0.4f, 0.8f, -0.4f, -0.4f, 0.8f, 0.0f, -0.4f, 0.8f, 0.4f, -0.4f, 0.8f, 0.8f,
+ -0.4f, 0.8f, -0.8f, 0.0f, 0.8f, -0.4f, 0.0f, 0.8f, 0.0f, 0.0f, 0.8f, 0.4f, 0.0f, 0.8f,
+ 0.8f, 0.0f, 0.8f, -0.8f, 0.4f, 0.8f, -0.4f, 0.4f, 0.8f, 0.0f, 0.4f, 0.8f, 0.4f, 0.4f, 0.8f,
+ 0.8f, 0.4f, 0.8f, -0.8f, 0.8f, 0.8f, -0.4f, 0.8f, 0.8f, 0.0f, 0.8f, 0.8f, 0.4f, 0.8f, 0.8f,
+ 0.8f, 0.8f, 0.8f };
+
+ // this table contains 3 requantized samples for each legal codeword
+ // when grouped in 10 bits, i.e. 9 quantizationsteps per sample
+ public static final float grouping_10bits[] = { -8.0f / 9.0f, -8.0f / 9.0f, -8.0f / 9.0f,
+ -6.0f / 9.0f, -8.0f / 9.0f, -8.0f / 9.0f, -4.0f / 9.0f, -8.0f / 9.0f, -8.0f / 9.0f,
+ -2.0f / 9.0f, -8.0f / 9.0f, -8.0f / 9.0f, 0.0f, -8.0f / 9.0f, -8.0f / 9.0f, 2.0f / 9.0f,
+ -8.0f / 9.0f, -8.0f / 9.0f, 4.0f / 9.0f, -8.0f / 9.0f, -8.0f / 9.0f, 6.0f / 9.0f,
+ -8.0f / 9.0f, -8.0f / 9.0f, 8.0f / 9.0f, -8.0f / 9.0f, -8.0f / 9.0f, -8.0f / 9.0f,
+ -6.0f / 9.0f, -8.0f / 9.0f, -6.0f / 9.0f, -6.0f / 9.0f, -8.0f / 9.0f, -4.0f / 9.0f,
+ -6.0f / 9.0f, -8.0f / 9.0f, -2.0f / 9.0f, -6.0f / 9.0f, -8.0f / 9.0f, 0.0f, -6.0f / 9.0f,
+ -8.0f / 9.0f, 2.0f / 9.0f, -6.0f / 9.0f, -8.0f / 9.0f, 4.0f / 9.0f, -6.0f / 9.0f,
+ -8.0f / 9.0f, 6.0f / 9.0f, -6.0f / 9.0f, -8.0f / 9.0f, 8.0f / 9.0f, -6.0f / 9.0f,
+ -8.0f / 9.0f, -8.0f / 9.0f, -4.0f / 9.0f, -8.0f / 9.0f, -6.0f / 9.0f, -4.0f / 9.0f,
+ -8.0f / 9.0f, -4.0f / 9.0f, -4.0f / 9.0f, -8.0f / 9.0f, -2.0f / 9.0f, -4.0f / 9.0f,
+ -8.0f / 9.0f, 0.0f, -4.0f / 9.0f, -8.0f / 9.0f, 2.0f / 9.0f, -4.0f / 9.0f, -8.0f / 9.0f,
+ 4.0f / 9.0f, -4.0f / 9.0f, -8.0f / 9.0f, 6.0f / 9.0f, -4.0f / 9.0f, -8.0f / 9.0f,
+ 8.0f / 9.0f, -4.0f / 9.0f, -8.0f / 9.0f, -8.0f / 9.0f, -2.0f / 9.0f, -8.0f / 9.0f,
+ -6.0f / 9.0f, -2.0f / 9.0f, -8.0f / 9.0f, -4.0f / 9.0f, -2.0f / 9.0f, -8.0f / 9.0f,
+ -2.0f / 9.0f, -2.0f / 9.0f, -8.0f / 9.0f, 0.0f, -2.0f / 9.0f, -8.0f / 9.0f, 2.0f / 9.0f,
+ -2.0f / 9.0f, -8.0f / 9.0f, 4.0f / 9.0f, -2.0f / 9.0f, -8.0f / 9.0f, 6.0f / 9.0f,
+ -2.0f / 9.0f, -8.0f / 9.0f, 8.0f / 9.0f, -2.0f / 9.0f, -8.0f / 9.0f, -8.0f / 9.0f, 0.0f,
+ -8.0f / 9.0f, -6.0f / 9.0f, 0.0f, -8.0f / 9.0f, -4.0f / 9.0f, 0.0f, -8.0f / 9.0f,
+ -2.0f / 9.0f, 0.0f, -8.0f / 9.0f, 0.0f, 0.0f, -8.0f / 9.0f, 2.0f / 9.0f, 0.0f,
+ -8.0f / 9.0f, 4.0f / 9.0f, 0.0f, -8.0f / 9.0f, 6.0f / 9.0f, 0.0f, -8.0f / 9.0f,
+ 8.0f / 9.0f, 0.0f, -8.0f / 9.0f, -8.0f / 9.0f, 2.0f / 9.0f, -8.0f / 9.0f, -6.0f / 9.0f,
+ 2.0f / 9.0f, -8.0f / 9.0f, -4.0f / 9.0f, 2.0f / 9.0f, -8.0f / 9.0f, -2.0f / 9.0f,
+ 2.0f / 9.0f, -8.0f / 9.0f, 0.0f, 2.0f / 9.0f, -8.0f / 9.0f, 2.0f / 9.0f, 2.0f / 9.0f,
+ -8.0f / 9.0f, 4.0f / 9.0f, 2.0f / 9.0f, -8.0f / 9.0f, 6.0f / 9.0f, 2.0f / 9.0f,
+ -8.0f / 9.0f, 8.0f / 9.0f, 2.0f / 9.0f, -8.0f / 9.0f, -8.0f / 9.0f, 4.0f / 9.0f,
+ -8.0f / 9.0f, -6.0f / 9.0f, 4.0f / 9.0f, -8.0f / 9.0f, -4.0f / 9.0f, 4.0f / 9.0f,
+ -8.0f / 9.0f, -2.0f / 9.0f, 4.0f / 9.0f, -8.0f / 9.0f, 0.0f, 4.0f / 9.0f, -8.0f / 9.0f,
+ 2.0f / 9.0f, 4.0f / 9.0f, -8.0f / 9.0f, 4.0f / 9.0f, 4.0f / 9.0f, -8.0f / 9.0f,
+ 6.0f / 9.0f, 4.0f / 9.0f, -8.0f / 9.0f, 8.0f / 9.0f, 4.0f / 9.0f, -8.0f / 9.0f,
+ -8.0f / 9.0f, 6.0f / 9.0f, -8.0f / 9.0f, -6.0f / 9.0f, 6.0f / 9.0f, -8.0f / 9.0f,
+ -4.0f / 9.0f, 6.0f / 9.0f, -8.0f / 9.0f, -2.0f / 9.0f, 6.0f / 9.0f, -8.0f / 9.0f, 0.0f,
+ 6.0f / 9.0f, -8.0f / 9.0f, 2.0f / 9.0f, 6.0f / 9.0f, -8.0f / 9.0f, 4.0f / 9.0f,
+ 6.0f / 9.0f, -8.0f / 9.0f, 6.0f / 9.0f, 6.0f / 9.0f, -8.0f / 9.0f, 8.0f / 9.0f,
+ 6.0f / 9.0f, -8.0f / 9.0f, -8.0f / 9.0f, 8.0f / 9.0f, -8.0f / 9.0f, -6.0f / 9.0f,
+ 8.0f / 9.0f, -8.0f / 9.0f, -4.0f / 9.0f, 8.0f / 9.0f, -8.0f / 9.0f, -2.0f / 9.0f,
+ 8.0f / 9.0f, -8.0f / 9.0f, 0.0f, 8.0f / 9.0f, -8.0f / 9.0f, 2.0f / 9.0f, 8.0f / 9.0f,
+ -8.0f / 9.0f, 4.0f / 9.0f, 8.0f / 9.0f, -8.0f / 9.0f, 6.0f / 9.0f, 8.0f / 9.0f,
+ -8.0f / 9.0f, 8.0f / 9.0f, 8.0f / 9.0f, -8.0f / 9.0f, -8.0f / 9.0f, -8.0f / 9.0f,
+ -6.0f / 9.0f, -6.0f / 9.0f, -8.0f / 9.0f, -6.0f / 9.0f, -4.0f / 9.0f, -8.0f / 9.0f,
+ -6.0f / 9.0f, -2.0f / 9.0f, -8.0f / 9.0f, -6.0f / 9.0f, 0.0f, -8.0f / 9.0f, -6.0f / 9.0f,
+ 2.0f / 9.0f, -8.0f / 9.0f, -6.0f / 9.0f, 4.0f / 9.0f, -8.0f / 9.0f, -6.0f / 9.0f,
+ 6.0f / 9.0f, -8.0f / 9.0f, -6.0f / 9.0f, 8.0f / 9.0f, -8.0f / 9.0f, -6.0f / 9.0f,
+ -8.0f / 9.0f, -6.0f / 9.0f, -6.0f / 9.0f, -6.0f / 9.0f, -6.0f / 9.0f, -6.0f / 9.0f,
+ -4.0f / 9.0f, -6.0f / 9.0f, -6.0f / 9.0f, -2.0f / 9.0f, -6.0f / 9.0f, -6.0f / 9.0f, 0.0f,
+ -6.0f / 9.0f, -6.0f / 9.0f, 2.0f / 9.0f, -6.0f / 9.0f, -6.0f / 9.0f, 4.0f / 9.0f,
+ -6.0f / 9.0f, -6.0f / 9.0f, 6.0f / 9.0f, -6.0f / 9.0f, -6.0f / 9.0f, 8.0f / 9.0f,
+ -6.0f / 9.0f, -6.0f / 9.0f, -8.0f / 9.0f, -4.0f / 9.0f, -6.0f / 9.0f, -6.0f / 9.0f,
+ -4.0f / 9.0f, -6.0f / 9.0f, -4.0f / 9.0f, -4.0f / 9.0f, -6.0f / 9.0f, -2.0f / 9.0f,
+ -4.0f / 9.0f, -6.0f / 9.0f, 0.0f, -4.0f / 9.0f, -6.0f / 9.0f, 2.0f / 9.0f, -4.0f / 9.0f,
+ -6.0f / 9.0f, 4.0f / 9.0f, -4.0f / 9.0f, -6.0f / 9.0f, 6.0f / 9.0f, -4.0f / 9.0f,
+ -6.0f / 9.0f, 8.0f / 9.0f, -4.0f / 9.0f, -6.0f / 9.0f, -8.0f / 9.0f, -2.0f / 9.0f,
+ -6.0f / 9.0f, -6.0f / 9.0f, -2.0f / 9.0f, -6.0f / 9.0f, -4.0f / 9.0f, -2.0f / 9.0f,
+ -6.0f / 9.0f, -2.0f / 9.0f, -2.0f / 9.0f, -6.0f / 9.0f, 0.0f, -2.0f / 9.0f, -6.0f / 9.0f,
+ 2.0f / 9.0f, -2.0f / 9.0f, -6.0f / 9.0f, 4.0f / 9.0f, -2.0f / 9.0f, -6.0f / 9.0f,
+ 6.0f / 9.0f, -2.0f / 9.0f, -6.0f / 9.0f, 8.0f / 9.0f, -2.0f / 9.0f, -6.0f / 9.0f,
+ -8.0f / 9.0f, 0.0f, -6.0f / 9.0f, -6.0f / 9.0f, 0.0f, -6.0f / 9.0f, -4.0f / 9.0f, 0.0f,
+ -6.0f / 9.0f, -2.0f / 9.0f, 0.0f, -6.0f / 9.0f, 0.0f, 0.0f, -6.0f / 9.0f, 2.0f / 9.0f,
+ 0.0f, -6.0f / 9.0f, 4.0f / 9.0f, 0.0f, -6.0f / 9.0f, 6.0f / 9.0f, 0.0f, -6.0f / 9.0f,
+ 8.0f / 9.0f, 0.0f, -6.0f / 9.0f, -8.0f / 9.0f, 2.0f / 9.0f, -6.0f / 9.0f, -6.0f / 9.0f,
+ 2.0f / 9.0f, -6.0f / 9.0f, -4.0f / 9.0f, 2.0f / 9.0f, -6.0f / 9.0f, -2.0f / 9.0f,
+ 2.0f / 9.0f, -6.0f / 9.0f, 0.0f, 2.0f / 9.0f, -6.0f / 9.0f, 2.0f / 9.0f, 2.0f / 9.0f,
+ -6.0f / 9.0f, 4.0f / 9.0f, 2.0f / 9.0f, -6.0f / 9.0f, 6.0f / 9.0f, 2.0f / 9.0f,
+ -6.0f / 9.0f, 8.0f / 9.0f, 2.0f / 9.0f, -6.0f / 9.0f, -8.0f / 9.0f, 4.0f / 9.0f,
+ -6.0f / 9.0f, -6.0f / 9.0f, 4.0f / 9.0f, -6.0f / 9.0f, -4.0f / 9.0f, 4.0f / 9.0f,
+ -6.0f / 9.0f, -2.0f / 9.0f, 4.0f / 9.0f, -6.0f / 9.0f, 0.0f, 4.0f / 9.0f, -6.0f / 9.0f,
+ 2.0f / 9.0f, 4.0f / 9.0f, -6.0f / 9.0f, 4.0f / 9.0f, 4.0f / 9.0f, -6.0f / 9.0f,
+ 6.0f / 9.0f, 4.0f / 9.0f, -6.0f / 9.0f, 8.0f / 9.0f, 4.0f / 9.0f, -6.0f / 9.0f,
+ -8.0f / 9.0f, 6.0f / 9.0f, -6.0f / 9.0f, -6.0f / 9.0f, 6.0f / 9.0f, -6.0f / 9.0f,
+ -4.0f / 9.0f, 6.0f / 9.0f, -6.0f / 9.0f, -2.0f / 9.0f, 6.0f / 9.0f, -6.0f / 9.0f, 0.0f,
+ 6.0f / 9.0f, -6.0f / 9.0f, 2.0f / 9.0f, 6.0f / 9.0f, -6.0f / 9.0f, 4.0f / 9.0f,
+ 6.0f / 9.0f, -6.0f / 9.0f, 6.0f / 9.0f, 6.0f / 9.0f, -6.0f / 9.0f, 8.0f / 9.0f,
+ 6.0f / 9.0f, -6.0f / 9.0f, -8.0f / 9.0f, 8.0f / 9.0f, -6.0f / 9.0f, -6.0f / 9.0f,
+ 8.0f / 9.0f, -6.0f / 9.0f, -4.0f / 9.0f, 8.0f / 9.0f, -6.0f / 9.0f, -2.0f / 9.0f,
+ 8.0f / 9.0f, -6.0f / 9.0f, 0.0f, 8.0f / 9.0f, -6.0f / 9.0f, 2.0f / 9.0f, 8.0f / 9.0f,
+ -6.0f / 9.0f, 4.0f / 9.0f, 8.0f / 9.0f, -6.0f / 9.0f, 6.0f / 9.0f, 8.0f / 9.0f,
+ -6.0f / 9.0f, 8.0f / 9.0f, 8.0f / 9.0f, -6.0f / 9.0f, -8.0f / 9.0f, -8.0f / 9.0f,
+ -4.0f / 9.0f, -6.0f / 9.0f, -8.0f / 9.0f, -4.0f / 9.0f, -4.0f / 9.0f, -8.0f / 9.0f,
+ -4.0f / 9.0f, -2.0f / 9.0f, -8.0f / 9.0f, -4.0f / 9.0f, 0.0f, -8.0f / 9.0f, -4.0f / 9.0f,
+ 2.0f / 9.0f, -8.0f / 9.0f, -4.0f / 9.0f, 4.0f / 9.0f, -8.0f / 9.0f, -4.0f / 9.0f,
+ 6.0f / 9.0f, -8.0f / 9.0f, -4.0f / 9.0f, 8.0f / 9.0f, -8.0f / 9.0f, -4.0f / 9.0f,
+ -8.0f / 9.0f, -6.0f / 9.0f, -4.0f / 9.0f, -6.0f / 9.0f, -6.0f / 9.0f, -4.0f / 9.0f,
+ -4.0f / 9.0f, -6.0f / 9.0f, -4.0f / 9.0f, -2.0f / 9.0f, -6.0f / 9.0f, -4.0f / 9.0f, 0.0f,
+ -6.0f / 9.0f, -4.0f / 9.0f, 2.0f / 9.0f, -6.0f / 9.0f, -4.0f / 9.0f, 4.0f / 9.0f,
+ -6.0f / 9.0f, -4.0f / 9.0f, 6.0f / 9.0f, -6.0f / 9.0f, -4.0f / 9.0f, 8.0f / 9.0f,
+ -6.0f / 9.0f, -4.0f / 9.0f, -8.0f / 9.0f, -4.0f / 9.0f, -4.0f / 9.0f, -6.0f / 9.0f,
+ -4.0f / 9.0f, -4.0f / 9.0f, -4.0f / 9.0f, -4.0f / 9.0f, -4.0f / 9.0f, -2.0f / 9.0f,
+ -4.0f / 9.0f, -4.0f / 9.0f, 0.0f, -4.0f / 9.0f, -4.0f / 9.0f, 2.0f / 9.0f, -4.0f / 9.0f,
+ -4.0f / 9.0f, 4.0f / 9.0f, -4.0f / 9.0f, -4.0f / 9.0f, 6.0f / 9.0f, -4.0f / 9.0f,
+ -4.0f / 9.0f, 8.0f / 9.0f, -4.0f / 9.0f, -4.0f / 9.0f, -8.0f / 9.0f, -2.0f / 9.0f,
+ -4.0f / 9.0f, -6.0f / 9.0f, -2.0f / 9.0f, -4.0f / 9.0f, -4.0f / 9.0f, -2.0f / 9.0f,
+ -4.0f / 9.0f, -2.0f / 9.0f, -2.0f / 9.0f, -4.0f / 9.0f, 0.0f, -2.0f / 9.0f, -4.0f / 9.0f,
+ 2.0f / 9.0f, -2.0f / 9.0f, -4.0f / 9.0f, 4.0f / 9.0f, -2.0f / 9.0f, -4.0f / 9.0f,
+ 6.0f / 9.0f, -2.0f / 9.0f, -4.0f / 9.0f, 8.0f / 9.0f, -2.0f / 9.0f, -4.0f / 9.0f,
+ -8.0f / 9.0f, 0.0f, -4.0f / 9.0f, -6.0f / 9.0f, 0.0f, -4.0f / 9.0f, -4.0f / 9.0f, 0.0f,
+ -4.0f / 9.0f, -2.0f / 9.0f, 0.0f, -4.0f / 9.0f, 0.0f, 0.0f, -4.0f / 9.0f, 2.0f / 9.0f,
+ 0.0f, -4.0f / 9.0f, 4.0f / 9.0f, 0.0f, -4.0f / 9.0f, 6.0f / 9.0f, 0.0f, -4.0f / 9.0f,
+ 8.0f / 9.0f, 0.0f, -4.0f / 9.0f, -8.0f / 9.0f, 2.0f / 9.0f, -4.0f / 9.0f, -6.0f / 9.0f,
+ 2.0f / 9.0f, -4.0f / 9.0f, -4.0f / 9.0f, 2.0f / 9.0f, -4.0f / 9.0f, -2.0f / 9.0f,
+ 2.0f / 9.0f, -4.0f / 9.0f, 0.0f, 2.0f / 9.0f, -4.0f / 9.0f, 2.0f / 9.0f, 2.0f / 9.0f,
+ -4.0f / 9.0f, 4.0f / 9.0f, 2.0f / 9.0f, -4.0f / 9.0f, 6.0f / 9.0f, 2.0f / 9.0f,
+ -4.0f / 9.0f, 8.0f / 9.0f, 2.0f / 9.0f, -4.0f / 9.0f, -8.0f / 9.0f, 4.0f / 9.0f,
+ -4.0f / 9.0f, -6.0f / 9.0f, 4.0f / 9.0f, -4.0f / 9.0f, -4.0f / 9.0f, 4.0f / 9.0f,
+ -4.0f / 9.0f, -2.0f / 9.0f, 4.0f / 9.0f, -4.0f / 9.0f, 0.0f, 4.0f / 9.0f, -4.0f / 9.0f,
+ 2.0f / 9.0f, 4.0f / 9.0f, -4.0f / 9.0f, 4.0f / 9.0f, 4.0f / 9.0f, -4.0f / 9.0f,
+ 6.0f / 9.0f, 4.0f / 9.0f, -4.0f / 9.0f, 8.0f / 9.0f, 4.0f / 9.0f, -4.0f / 9.0f,
+ -8.0f / 9.0f, 6.0f / 9.0f, -4.0f / 9.0f, -6.0f / 9.0f, 6.0f / 9.0f, -4.0f / 9.0f,
+ -4.0f / 9.0f, 6.0f / 9.0f, -4.0f / 9.0f, -2.0f / 9.0f, 6.0f / 9.0f, -4.0f / 9.0f, 0.0f,
+ 6.0f / 9.0f, -4.0f / 9.0f, 2.0f / 9.0f, 6.0f / 9.0f, -4.0f / 9.0f, 4.0f / 9.0f,
+ 6.0f / 9.0f, -4.0f / 9.0f, 6.0f / 9.0f, 6.0f / 9.0f, -4.0f / 9.0f, 8.0f / 9.0f,
+ 6.0f / 9.0f, -4.0f / 9.0f, -8.0f / 9.0f, 8.0f / 9.0f, -4.0f / 9.0f, -6.0f / 9.0f,
+ 8.0f / 9.0f, -4.0f / 9.0f, -4.0f / 9.0f, 8.0f / 9.0f, -4.0f / 9.0f, -2.0f / 9.0f,
+ 8.0f / 9.0f, -4.0f / 9.0f, 0.0f, 8.0f / 9.0f, -4.0f / 9.0f, 2.0f / 9.0f, 8.0f / 9.0f,
+ -4.0f / 9.0f, 4.0f / 9.0f, 8.0f / 9.0f, -4.0f / 9.0f, 6.0f / 9.0f, 8.0f / 9.0f,
+ -4.0f / 9.0f, 8.0f / 9.0f, 8.0f / 9.0f, -4.0f / 9.0f, -8.0f / 9.0f, -8.0f / 9.0f,
+ -2.0f / 9.0f, -6.0f / 9.0f, -8.0f / 9.0f, -2.0f / 9.0f, -4.0f / 9.0f, -8.0f / 9.0f,
+ -2.0f / 9.0f, -2.0f / 9.0f, -8.0f / 9.0f, -2.0f / 9.0f, 0.0f, -8.0f / 9.0f, -2.0f / 9.0f,
+ 2.0f / 9.0f, -8.0f / 9.0f, -2.0f / 9.0f, 4.0f / 9.0f, -8.0f / 9.0f, -2.0f / 9.0f,
+ 6.0f / 9.0f, -8.0f / 9.0f, -2.0f / 9.0f, 8.0f / 9.0f, -8.0f / 9.0f, -2.0f / 9.0f,
+ -8.0f / 9.0f, -6.0f / 9.0f, -2.0f / 9.0f, -6.0f / 9.0f, -6.0f / 9.0f, -2.0f / 9.0f,
+ -4.0f / 9.0f, -6.0f / 9.0f, -2.0f / 9.0f, -2.0f / 9.0f, -6.0f / 9.0f, -2.0f / 9.0f, 0.0f,
+ -6.0f / 9.0f, -2.0f / 9.0f, 2.0f / 9.0f, -6.0f / 9.0f, -2.0f / 9.0f, 4.0f / 9.0f,
+ -6.0f / 9.0f, -2.0f / 9.0f, 6.0f / 9.0f, -6.0f / 9.0f, -2.0f / 9.0f, 8.0f / 9.0f,
+ -6.0f / 9.0f, -2.0f / 9.0f, -8.0f / 9.0f, -4.0f / 9.0f, -2.0f / 9.0f, -6.0f / 9.0f,
+ -4.0f / 9.0f, -2.0f / 9.0f, -4.0f / 9.0f, -4.0f / 9.0f, -2.0f / 9.0f, -2.0f / 9.0f,
+ -4.0f / 9.0f, -2.0f / 9.0f, 0.0f, -4.0f / 9.0f, -2.0f / 9.0f, 2.0f / 9.0f, -4.0f / 9.0f,
+ -2.0f / 9.0f, 4.0f / 9.0f, -4.0f / 9.0f, -2.0f / 9.0f, 6.0f / 9.0f, -4.0f / 9.0f,
+ -2.0f / 9.0f, 8.0f / 9.0f, -4.0f / 9.0f, -2.0f / 9.0f, -8.0f / 9.0f, -2.0f / 9.0f,
+ -2.0f / 9.0f, -6.0f / 9.0f, -2.0f / 9.0f, -2.0f / 9.0f, -4.0f / 9.0f, -2.0f / 9.0f,
+ -2.0f / 9.0f, -2.0f / 9.0f, -2.0f / 9.0f, -2.0f / 9.0f, 0.0f, -2.0f / 9.0f, -2.0f / 9.0f,
+ 2.0f / 9.0f, -2.0f / 9.0f, -2.0f / 9.0f, 4.0f / 9.0f, -2.0f / 9.0f, -2.0f / 9.0f,
+ 6.0f / 9.0f, -2.0f / 9.0f, -2.0f / 9.0f, 8.0f / 9.0f, -2.0f / 9.0f, -2.0f / 9.0f,
+ -8.0f / 9.0f, 0.0f, -2.0f / 9.0f, -6.0f / 9.0f, 0.0f, -2.0f / 9.0f, -4.0f / 9.0f, 0.0f,
+ -2.0f / 9.0f, -2.0f / 9.0f, 0.0f, -2.0f / 9.0f, 0.0f, 0.0f, -2.0f / 9.0f, 2.0f / 9.0f,
+ 0.0f, -2.0f / 9.0f, 4.0f / 9.0f, 0.0f, -2.0f / 9.0f, 6.0f / 9.0f, 0.0f, -2.0f / 9.0f,
+ 8.0f / 9.0f, 0.0f, -2.0f / 9.0f, -8.0f / 9.0f, 2.0f / 9.0f, -2.0f / 9.0f, -6.0f / 9.0f,
+ 2.0f / 9.0f, -2.0f / 9.0f, -4.0f / 9.0f, 2.0f / 9.0f, -2.0f / 9.0f, -2.0f / 9.0f,
+ 2.0f / 9.0f, -2.0f / 9.0f, 0.0f, 2.0f / 9.0f, -2.0f / 9.0f, 2.0f / 9.0f, 2.0f / 9.0f,
+ -2.0f / 9.0f, 4.0f / 9.0f, 2.0f / 9.0f, -2.0f / 9.0f, 6.0f / 9.0f, 2.0f / 9.0f,
+ -2.0f / 9.0f, 8.0f / 9.0f, 2.0f / 9.0f, -2.0f / 9.0f, -8.0f / 9.0f, 4.0f / 9.0f,
+ -2.0f / 9.0f, -6.0f / 9.0f, 4.0f / 9.0f, -2.0f / 9.0f, -4.0f / 9.0f, 4.0f / 9.0f,
+ -2.0f / 9.0f, -2.0f / 9.0f, 4.0f / 9.0f, -2.0f / 9.0f, 0.0f, 4.0f / 9.0f, -2.0f / 9.0f,
+ 2.0f / 9.0f, 4.0f / 9.0f, -2.0f / 9.0f, 4.0f / 9.0f, 4.0f / 9.0f, -2.0f / 9.0f,
+ 6.0f / 9.0f, 4.0f / 9.0f, -2.0f / 9.0f, 8.0f / 9.0f, 4.0f / 9.0f, -2.0f / 9.0f,
+ -8.0f / 9.0f, 6.0f / 9.0f, -2.0f / 9.0f, -6.0f / 9.0f, 6.0f / 9.0f, -2.0f / 9.0f,
+ -4.0f / 9.0f, 6.0f / 9.0f, -2.0f / 9.0f, -2.0f / 9.0f, 6.0f / 9.0f, -2.0f / 9.0f, 0.0f,
+ 6.0f / 9.0f, -2.0f / 9.0f, 2.0f / 9.0f, 6.0f / 9.0f, -2.0f / 9.0f, 4.0f / 9.0f,
+ 6.0f / 9.0f, -2.0f / 9.0f, 6.0f / 9.0f, 6.0f / 9.0f, -2.0f / 9.0f, 8.0f / 9.0f,
+ 6.0f / 9.0f, -2.0f / 9.0f, -8.0f / 9.0f, 8.0f / 9.0f, -2.0f / 9.0f, -6.0f / 9.0f,
+ 8.0f / 9.0f, -2.0f / 9.0f, -4.0f / 9.0f, 8.0f / 9.0f, -2.0f / 9.0f, -2.0f / 9.0f,
+ 8.0f / 9.0f, -2.0f / 9.0f, 0.0f, 8.0f / 9.0f, -2.0f / 9.0f, 2.0f / 9.0f, 8.0f / 9.0f,
+ -2.0f / 9.0f, 4.0f / 9.0f, 8.0f / 9.0f, -2.0f / 9.0f, 6.0f / 9.0f, 8.0f / 9.0f,
+ -2.0f / 9.0f, 8.0f / 9.0f, 8.0f / 9.0f, -2.0f / 9.0f, -8.0f / 9.0f, -8.0f / 9.0f, 0.0f,
+ -6.0f / 9.0f, -8.0f / 9.0f, 0.0f, -4.0f / 9.0f, -8.0f / 9.0f, 0.0f, -2.0f / 9.0f,
+ -8.0f / 9.0f, 0.0f, 0.0f, -8.0f / 9.0f, 0.0f, 2.0f / 9.0f, -8.0f / 9.0f, 0.0f, 4.0f / 9.0f,
+ -8.0f / 9.0f, 0.0f, 6.0f / 9.0f, -8.0f / 9.0f, 0.0f, 8.0f / 9.0f, -8.0f / 9.0f, 0.0f,
+ -8.0f / 9.0f, -6.0f / 9.0f, 0.0f, -6.0f / 9.0f, -6.0f / 9.0f, 0.0f, -4.0f / 9.0f,
+ -6.0f / 9.0f, 0.0f, -2.0f / 9.0f, -6.0f / 9.0f, 0.0f, 0.0f, -6.0f / 9.0f, 0.0f,
+ 2.0f / 9.0f, -6.0f / 9.0f, 0.0f, 4.0f / 9.0f, -6.0f / 9.0f, 0.0f, 6.0f / 9.0f,
+ -6.0f / 9.0f, 0.0f, 8.0f / 9.0f, -6.0f / 9.0f, 0.0f, -8.0f / 9.0f, -4.0f / 9.0f, 0.0f,
+ -6.0f / 9.0f, -4.0f / 9.0f, 0.0f, -4.0f / 9.0f, -4.0f / 9.0f, 0.0f, -2.0f / 9.0f,
+ -4.0f / 9.0f, 0.0f, 0.0f, -4.0f / 9.0f, 0.0f, 2.0f / 9.0f, -4.0f / 9.0f, 0.0f, 4.0f / 9.0f,
+ -4.0f / 9.0f, 0.0f, 6.0f / 9.0f, -4.0f / 9.0f, 0.0f, 8.0f / 9.0f, -4.0f / 9.0f, 0.0f,
+ -8.0f / 9.0f, -2.0f / 9.0f, 0.0f, -6.0f / 9.0f, -2.0f / 9.0f, 0.0f, -4.0f / 9.0f,
+ -2.0f / 9.0f, 0.0f, -2.0f / 9.0f, -2.0f / 9.0f, 0.0f, 0.0f, -2.0f / 9.0f, 0.0f,
+ 2.0f / 9.0f, -2.0f / 9.0f, 0.0f, 4.0f / 9.0f, -2.0f / 9.0f, 0.0f, 6.0f / 9.0f,
+ -2.0f / 9.0f, 0.0f, 8.0f / 9.0f, -2.0f / 9.0f, 0.0f, -8.0f / 9.0f, 0.0f, 0.0f,
+ -6.0f / 9.0f, 0.0f, 0.0f, -4.0f / 9.0f, 0.0f, 0.0f, -2.0f / 9.0f, 0.0f, 0.0f, 0.0f, 0.0f,
+ 0.0f, 2.0f / 9.0f, 0.0f, 0.0f, 4.0f / 9.0f, 0.0f, 0.0f, 6.0f / 9.0f, 0.0f, 0.0f,
+ 8.0f / 9.0f, 0.0f, 0.0f, -8.0f / 9.0f, 2.0f / 9.0f, 0.0f, -6.0f / 9.0f, 2.0f / 9.0f, 0.0f,
+ -4.0f / 9.0f, 2.0f / 9.0f, 0.0f, -2.0f / 9.0f, 2.0f / 9.0f, 0.0f, 0.0f, 2.0f / 9.0f, 0.0f,
+ 2.0f / 9.0f, 2.0f / 9.0f, 0.0f, 4.0f / 9.0f, 2.0f / 9.0f, 0.0f, 6.0f / 9.0f, 2.0f / 9.0f,
+ 0.0f, 8.0f / 9.0f, 2.0f / 9.0f, 0.0f, -8.0f / 9.0f, 4.0f / 9.0f, 0.0f, -6.0f / 9.0f,
+ 4.0f / 9.0f, 0.0f, -4.0f / 9.0f, 4.0f / 9.0f, 0.0f, -2.0f / 9.0f, 4.0f / 9.0f, 0.0f, 0.0f,
+ 4.0f / 9.0f, 0.0f, 2.0f / 9.0f, 4.0f / 9.0f, 0.0f, 4.0f / 9.0f, 4.0f / 9.0f, 0.0f,
+ 6.0f / 9.0f, 4.0f / 9.0f, 0.0f, 8.0f / 9.0f, 4.0f / 9.0f, 0.0f, -8.0f / 9.0f, 6.0f / 9.0f,
+ 0.0f, -6.0f / 9.0f, 6.0f / 9.0f, 0.0f, -4.0f / 9.0f, 6.0f / 9.0f, 0.0f, -2.0f / 9.0f,
+ 6.0f / 9.0f, 0.0f, 0.0f, 6.0f / 9.0f, 0.0f, 2.0f / 9.0f, 6.0f / 9.0f, 0.0f, 4.0f / 9.0f,
+ 6.0f / 9.0f, 0.0f, 6.0f / 9.0f, 6.0f / 9.0f, 0.0f, 8.0f / 9.0f, 6.0f / 9.0f, 0.0f,
+ -8.0f / 9.0f, 8.0f / 9.0f, 0.0f, -6.0f / 9.0f, 8.0f / 9.0f, 0.0f, -4.0f / 9.0f,
+ 8.0f / 9.0f, 0.0f, -2.0f / 9.0f, 8.0f / 9.0f, 0.0f, 0.0f, 8.0f / 9.0f, 0.0f, 2.0f / 9.0f,
+ 8.0f / 9.0f, 0.0f, 4.0f / 9.0f, 8.0f / 9.0f, 0.0f, 6.0f / 9.0f, 8.0f / 9.0f, 0.0f,
+ 8.0f / 9.0f, 8.0f / 9.0f, 0.0f, -8.0f / 9.0f, -8.0f / 9.0f, 2.0f / 9.0f, -6.0f / 9.0f,
+ -8.0f / 9.0f, 2.0f / 9.0f, -4.0f / 9.0f, -8.0f / 9.0f, 2.0f / 9.0f, -2.0f / 9.0f,
+ -8.0f / 9.0f, 2.0f / 9.0f, 0.0f, -8.0f / 9.0f, 2.0f / 9.0f, 2.0f / 9.0f, -8.0f / 9.0f,
+ 2.0f / 9.0f, 4.0f / 9.0f, -8.0f / 9.0f, 2.0f / 9.0f, 6.0f / 9.0f, -8.0f / 9.0f,
+ 2.0f / 9.0f, 8.0f / 9.0f, -8.0f / 9.0f, 2.0f / 9.0f, -8.0f / 9.0f, -6.0f / 9.0f,
+ 2.0f / 9.0f, -6.0f / 9.0f, -6.0f / 9.0f, 2.0f / 9.0f, -4.0f / 9.0f, -6.0f / 9.0f,
+ 2.0f / 9.0f, -2.0f / 9.0f, -6.0f / 9.0f, 2.0f / 9.0f, 0.0f, -6.0f / 9.0f, 2.0f / 9.0f,
+ 2.0f / 9.0f, -6.0f / 9.0f, 2.0f / 9.0f, 4.0f / 9.0f, -6.0f / 9.0f, 2.0f / 9.0f,
+ 6.0f / 9.0f, -6.0f / 9.0f, 2.0f / 9.0f, 8.0f / 9.0f, -6.0f / 9.0f, 2.0f / 9.0f,
+ -8.0f / 9.0f, -4.0f / 9.0f, 2.0f / 9.0f, -6.0f / 9.0f, -4.0f / 9.0f, 2.0f / 9.0f,
+ -4.0f / 9.0f, -4.0f / 9.0f, 2.0f / 9.0f, -2.0f / 9.0f, -4.0f / 9.0f, 2.0f / 9.0f, 0.0f,
+ -4.0f / 9.0f, 2.0f / 9.0f, 2.0f / 9.0f, -4.0f / 9.0f, 2.0f / 9.0f, 4.0f / 9.0f,
+ -4.0f / 9.0f, 2.0f / 9.0f, 6.0f / 9.0f, -4.0f / 9.0f, 2.0f / 9.0f, 8.0f / 9.0f,
+ -4.0f / 9.0f, 2.0f / 9.0f, -8.0f / 9.0f, -2.0f / 9.0f, 2.0f / 9.0f, -6.0f / 9.0f,
+ -2.0f / 9.0f, 2.0f / 9.0f, -4.0f / 9.0f, -2.0f / 9.0f, 2.0f / 9.0f, -2.0f / 9.0f,
+ -2.0f / 9.0f, 2.0f / 9.0f, 0.0f, -2.0f / 9.0f, 2.0f / 9.0f, 2.0f / 9.0f, -2.0f / 9.0f,
+ 2.0f / 9.0f, 4.0f / 9.0f, -2.0f / 9.0f, 2.0f / 9.0f, 6.0f / 9.0f, -2.0f / 9.0f,
+ 2.0f / 9.0f, 8.0f / 9.0f, -2.0f / 9.0f, 2.0f / 9.0f, -8.0f / 9.0f, 0.0f, 2.0f / 9.0f,
+ -6.0f / 9.0f, 0.0f, 2.0f / 9.0f, -4.0f / 9.0f, 0.0f, 2.0f / 9.0f, -2.0f / 9.0f, 0.0f,
+ 2.0f / 9.0f, 0.0f, 0.0f, 2.0f / 9.0f, 2.0f / 9.0f, 0.0f, 2.0f / 9.0f, 4.0f / 9.0f, 0.0f,
+ 2.0f / 9.0f, 6.0f / 9.0f, 0.0f, 2.0f / 9.0f, 8.0f / 9.0f, 0.0f, 2.0f / 9.0f, -8.0f / 9.0f,
+ 2.0f / 9.0f, 2.0f / 9.0f, -6.0f / 9.0f, 2.0f / 9.0f, 2.0f / 9.0f, -4.0f / 9.0f,
+ 2.0f / 9.0f, 2.0f / 9.0f, -2.0f / 9.0f, 2.0f / 9.0f, 2.0f / 9.0f, 0.0f, 2.0f / 9.0f,
+ 2.0f / 9.0f, 2.0f / 9.0f, 2.0f / 9.0f, 2.0f / 9.0f, 4.0f / 9.0f, 2.0f / 9.0f, 2.0f / 9.0f,
+ 6.0f / 9.0f, 2.0f / 9.0f, 2.0f / 9.0f, 8.0f / 9.0f, 2.0f / 9.0f, 2.0f / 9.0f, -8.0f / 9.0f,
+ 4.0f / 9.0f, 2.0f / 9.0f, -6.0f / 9.0f, 4.0f / 9.0f, 2.0f / 9.0f, -4.0f / 9.0f,
+ 4.0f / 9.0f, 2.0f / 9.0f, -2.0f / 9.0f, 4.0f / 9.0f, 2.0f / 9.0f, 0.0f, 4.0f / 9.0f,
+ 2.0f / 9.0f, 2.0f / 9.0f, 4.0f / 9.0f, 2.0f / 9.0f, 4.0f / 9.0f, 4.0f / 9.0f, 2.0f / 9.0f,
+ 6.0f / 9.0f, 4.0f / 9.0f, 2.0f / 9.0f, 8.0f / 9.0f, 4.0f / 9.0f, 2.0f / 9.0f, -8.0f / 9.0f,
+ 6.0f / 9.0f, 2.0f / 9.0f, -6.0f / 9.0f, 6.0f / 9.0f, 2.0f / 9.0f, -4.0f / 9.0f,
+ 6.0f / 9.0f, 2.0f / 9.0f, -2.0f / 9.0f, 6.0f / 9.0f, 2.0f / 9.0f, 0.0f, 6.0f / 9.0f,
+ 2.0f / 9.0f, 2.0f / 9.0f, 6.0f / 9.0f, 2.0f / 9.0f, 4.0f / 9.0f, 6.0f / 9.0f, 2.0f / 9.0f,
+ 6.0f / 9.0f, 6.0f / 9.0f, 2.0f / 9.0f, 8.0f / 9.0f, 6.0f / 9.0f, 2.0f / 9.0f, -8.0f / 9.0f,
+ 8.0f / 9.0f, 2.0f / 9.0f, -6.0f / 9.0f, 8.0f / 9.0f, 2.0f / 9.0f, -4.0f / 9.0f,
+ 8.0f / 9.0f, 2.0f / 9.0f, -2.0f / 9.0f, 8.0f / 9.0f, 2.0f / 9.0f, 0.0f, 8.0f / 9.0f,
+ 2.0f / 9.0f, 2.0f / 9.0f, 8.0f / 9.0f, 2.0f / 9.0f, 4.0f / 9.0f, 8.0f / 9.0f, 2.0f / 9.0f,
+ 6.0f / 9.0f, 8.0f / 9.0f, 2.0f / 9.0f, 8.0f / 9.0f, 8.0f / 9.0f, 2.0f / 9.0f, -8.0f / 9.0f,
+ -8.0f / 9.0f, 4.0f / 9.0f, -6.0f / 9.0f, -8.0f / 9.0f, 4.0f / 9.0f, -4.0f / 9.0f,
+ -8.0f / 9.0f, 4.0f / 9.0f, -2.0f / 9.0f, -8.0f / 9.0f, 4.0f / 9.0f, 0.0f, -8.0f / 9.0f,
+ 4.0f / 9.0f, 2.0f / 9.0f, -8.0f / 9.0f, 4.0f / 9.0f, 4.0f / 9.0f, -8.0f / 9.0f,
+ 4.0f / 9.0f, 6.0f / 9.0f, -8.0f / 9.0f, 4.0f / 9.0f, 8.0f / 9.0f, -8.0f / 9.0f,
+ 4.0f / 9.0f, -8.0f / 9.0f, -6.0f / 9.0f, 4.0f / 9.0f, -6.0f / 9.0f, -6.0f / 9.0f,
+ 4.0f / 9.0f, -4.0f / 9.0f, -6.0f / 9.0f, 4.0f / 9.0f, -2.0f / 9.0f, -6.0f / 9.0f,
+ 4.0f / 9.0f, 0.0f, -6.0f / 9.0f, 4.0f / 9.0f, 2.0f / 9.0f, -6.0f / 9.0f, 4.0f / 9.0f,
+ 4.0f / 9.0f, -6.0f / 9.0f, 4.0f / 9.0f, 6.0f / 9.0f, -6.0f / 9.0f, 4.0f / 9.0f,
+ 8.0f / 9.0f, -6.0f / 9.0f, 4.0f / 9.0f, -8.0f / 9.0f, -4.0f / 9.0f, 4.0f / 9.0f,
+ -6.0f / 9.0f, -4.0f / 9.0f, 4.0f / 9.0f, -4.0f / 9.0f, -4.0f / 9.0f, 4.0f / 9.0f,
+ -2.0f / 9.0f, -4.0f / 9.0f, 4.0f / 9.0f, 0.0f, -4.0f / 9.0f, 4.0f / 9.0f, 2.0f / 9.0f,
+ -4.0f / 9.0f, 4.0f / 9.0f, 4.0f / 9.0f, -4.0f / 9.0f, 4.0f / 9.0f, 6.0f / 9.0f,
+ -4.0f / 9.0f, 4.0f / 9.0f, 8.0f / 9.0f, -4.0f / 9.0f, 4.0f / 9.0f, -8.0f / 9.0f,
+ -2.0f / 9.0f, 4.0f / 9.0f, -6.0f / 9.0f, -2.0f / 9.0f, 4.0f / 9.0f, -4.0f / 9.0f,
+ -2.0f / 9.0f, 4.0f / 9.0f, -2.0f / 9.0f, -2.0f / 9.0f, 4.0f / 9.0f, 0.0f, -2.0f / 9.0f,
+ 4.0f / 9.0f, 2.0f / 9.0f, -2.0f / 9.0f, 4.0f / 9.0f, 4.0f / 9.0f, -2.0f / 9.0f,
+ 4.0f / 9.0f, 6.0f / 9.0f, -2.0f / 9.0f, 4.0f / 9.0f, 8.0f / 9.0f, -2.0f / 9.0f,
+ 4.0f / 9.0f, -8.0f / 9.0f, 0.0f, 4.0f / 9.0f, -6.0f / 9.0f, 0.0f, 4.0f / 9.0f,
+ -4.0f / 9.0f, 0.0f, 4.0f / 9.0f, -2.0f / 9.0f, 0.0f, 4.0f / 9.0f, 0.0f, 0.0f, 4.0f / 9.0f,
+ 2.0f / 9.0f, 0.0f, 4.0f / 9.0f, 4.0f / 9.0f, 0.0f, 4.0f / 9.0f, 6.0f / 9.0f, 0.0f,
+ 4.0f / 9.0f, 8.0f / 9.0f, 0.0f, 4.0f / 9.0f, -8.0f / 9.0f, 2.0f / 9.0f, 4.0f / 9.0f,
+ -6.0f / 9.0f, 2.0f / 9.0f, 4.0f / 9.0f, -4.0f / 9.0f, 2.0f / 9.0f, 4.0f / 9.0f,
+ -2.0f / 9.0f, 2.0f / 9.0f, 4.0f / 9.0f, 0.0f, 2.0f / 9.0f, 4.0f / 9.0f, 2.0f / 9.0f,
+ 2.0f / 9.0f, 4.0f / 9.0f, 4.0f / 9.0f, 2.0f / 9.0f, 4.0f / 9.0f, 6.0f / 9.0f, 2.0f / 9.0f,
+ 4.0f / 9.0f, 8.0f / 9.0f, 2.0f / 9.0f, 4.0f / 9.0f, -8.0f / 9.0f, 4.0f / 9.0f, 4.0f / 9.0f,
+ -6.0f / 9.0f, 4.0f / 9.0f, 4.0f / 9.0f, -4.0f / 9.0f, 4.0f / 9.0f, 4.0f / 9.0f,
+ -2.0f / 9.0f, 4.0f / 9.0f, 4.0f / 9.0f, 0.0f, 4.0f / 9.0f, 4.0f / 9.0f, 2.0f / 9.0f,
+ 4.0f / 9.0f, 4.0f / 9.0f, 4.0f / 9.0f, 4.0f / 9.0f, 4.0f / 9.0f, 6.0f / 9.0f, 4.0f / 9.0f,
+ 4.0f / 9.0f, 8.0f / 9.0f, 4.0f / 9.0f, 4.0f / 9.0f, -8.0f / 9.0f, 6.0f / 9.0f, 4.0f / 9.0f,
+ -6.0f / 9.0f, 6.0f / 9.0f, 4.0f / 9.0f, -4.0f / 9.0f, 6.0f / 9.0f, 4.0f / 9.0f,
+ -2.0f / 9.0f, 6.0f / 9.0f, 4.0f / 9.0f, 0.0f, 6.0f / 9.0f, 4.0f / 9.0f, 2.0f / 9.0f,
+ 6.0f / 9.0f, 4.0f / 9.0f, 4.0f / 9.0f, 6.0f / 9.0f, 4.0f / 9.0f, 6.0f / 9.0f, 6.0f / 9.0f,
+ 4.0f / 9.0f, 8.0f / 9.0f, 6.0f / 9.0f, 4.0f / 9.0f, -8.0f / 9.0f, 8.0f / 9.0f, 4.0f / 9.0f,
+ -6.0f / 9.0f, 8.0f / 9.0f, 4.0f / 9.0f, -4.0f / 9.0f, 8.0f / 9.0f, 4.0f / 9.0f,
+ -2.0f / 9.0f, 8.0f / 9.0f, 4.0f / 9.0f, 0.0f, 8.0f / 9.0f, 4.0f / 9.0f, 2.0f / 9.0f,
+ 8.0f / 9.0f, 4.0f / 9.0f, 4.0f / 9.0f, 8.0f / 9.0f, 4.0f / 9.0f, 6.0f / 9.0f, 8.0f / 9.0f,
+ 4.0f / 9.0f, 8.0f / 9.0f, 8.0f / 9.0f, 4.0f / 9.0f, -8.0f / 9.0f, -8.0f / 9.0f,
+ 6.0f / 9.0f, -6.0f / 9.0f, -8.0f / 9.0f, 6.0f / 9.0f, -4.0f / 9.0f, -8.0f / 9.0f,
+ 6.0f / 9.0f, -2.0f / 9.0f, -8.0f / 9.0f, 6.0f / 9.0f, 0.0f, -8.0f / 9.0f, 6.0f / 9.0f,
+ 2.0f / 9.0f, -8.0f / 9.0f, 6.0f / 9.0f, 4.0f / 9.0f, -8.0f / 9.0f, 6.0f / 9.0f,
+ 6.0f / 9.0f, -8.0f / 9.0f, 6.0f / 9.0f, 8.0f / 9.0f, -8.0f / 9.0f, 6.0f / 9.0f,
+ -8.0f / 9.0f, -6.0f / 9.0f, 6.0f / 9.0f, -6.0f / 9.0f, -6.0f / 9.0f, 6.0f / 9.0f,
+ -4.0f / 9.0f, -6.0f / 9.0f, 6.0f / 9.0f, -2.0f / 9.0f, -6.0f / 9.0f, 6.0f / 9.0f, 0.0f,
+ -6.0f / 9.0f, 6.0f / 9.0f, 2.0f / 9.0f, -6.0f / 9.0f, 6.0f / 9.0f, 4.0f / 9.0f,
+ -6.0f / 9.0f, 6.0f / 9.0f, 6.0f / 9.0f, -6.0f / 9.0f, 6.0f / 9.0f, 8.0f / 9.0f,
+ -6.0f / 9.0f, 6.0f / 9.0f, -8.0f / 9.0f, -4.0f / 9.0f, 6.0f / 9.0f, -6.0f / 9.0f,
+ -4.0f / 9.0f, 6.0f / 9.0f, -4.0f / 9.0f, -4.0f / 9.0f, 6.0f / 9.0f, -2.0f / 9.0f,
+ -4.0f / 9.0f, 6.0f / 9.0f, 0.0f, -4.0f / 9.0f, 6.0f / 9.0f, 2.0f / 9.0f, -4.0f / 9.0f,
+ 6.0f / 9.0f, 4.0f / 9.0f, -4.0f / 9.0f, 6.0f / 9.0f, 6.0f / 9.0f, -4.0f / 9.0f,
+ 6.0f / 9.0f, 8.0f / 9.0f, -4.0f / 9.0f, 6.0f / 9.0f, -8.0f / 9.0f, -2.0f / 9.0f,
+ 6.0f / 9.0f, -6.0f / 9.0f, -2.0f / 9.0f, 6.0f / 9.0f, -4.0f / 9.0f, -2.0f / 9.0f,
+ 6.0f / 9.0f, -2.0f / 9.0f, -2.0f / 9.0f, 6.0f / 9.0f, 0.0f, -2.0f / 9.0f, 6.0f / 9.0f,
+ 2.0f / 9.0f, -2.0f / 9.0f, 6.0f / 9.0f, 4.0f / 9.0f, -2.0f / 9.0f, 6.0f / 9.0f,
+ 6.0f / 9.0f, -2.0f / 9.0f, 6.0f / 9.0f, 8.0f / 9.0f, -2.0f / 9.0f, 6.0f / 9.0f,
+ -8.0f / 9.0f, 0.0f, 6.0f / 9.0f, -6.0f / 9.0f, 0.0f, 6.0f / 9.0f, -4.0f / 9.0f, 0.0f,
+ 6.0f / 9.0f, -2.0f / 9.0f, 0.0f, 6.0f / 9.0f, 0.0f, 0.0f, 6.0f / 9.0f, 2.0f / 9.0f, 0.0f,
+ 6.0f / 9.0f, 4.0f / 9.0f, 0.0f, 6.0f / 9.0f, 6.0f / 9.0f, 0.0f, 6.0f / 9.0f, 8.0f / 9.0f,
+ 0.0f, 6.0f / 9.0f, -8.0f / 9.0f, 2.0f / 9.0f, 6.0f / 9.0f, -6.0f / 9.0f, 2.0f / 9.0f,
+ 6.0f / 9.0f, -4.0f / 9.0f, 2.0f / 9.0f, 6.0f / 9.0f, -2.0f / 9.0f, 2.0f / 9.0f,
+ 6.0f / 9.0f, 0.0f, 2.0f / 9.0f, 6.0f / 9.0f, 2.0f / 9.0f, 2.0f / 9.0f, 6.0f / 9.0f,
+ 4.0f / 9.0f, 2.0f / 9.0f, 6.0f / 9.0f, 6.0f / 9.0f, 2.0f / 9.0f, 6.0f / 9.0f, 8.0f / 9.0f,
+ 2.0f / 9.0f, 6.0f / 9.0f, -8.0f / 9.0f, 4.0f / 9.0f, 6.0f / 9.0f, -6.0f / 9.0f,
+ 4.0f / 9.0f, 6.0f / 9.0f, -4.0f / 9.0f, 4.0f / 9.0f, 6.0f / 9.0f, -2.0f / 9.0f,
+ 4.0f / 9.0f, 6.0f / 9.0f, 0.0f, 4.0f / 9.0f, 6.0f / 9.0f, 2.0f / 9.0f, 4.0f / 9.0f,
+ 6.0f / 9.0f, 4.0f / 9.0f, 4.0f / 9.0f, 6.0f / 9.0f, 6.0f / 9.0f, 4.0f / 9.0f, 6.0f / 9.0f,
+ 8.0f / 9.0f, 4.0f / 9.0f, 6.0f / 9.0f, -8.0f / 9.0f, 6.0f / 9.0f, 6.0f / 9.0f,
+ -6.0f / 9.0f, 6.0f / 9.0f, 6.0f / 9.0f, -4.0f / 9.0f, 6.0f / 9.0f, 6.0f / 9.0f,
+ -2.0f / 9.0f, 6.0f / 9.0f, 6.0f / 9.0f, 0.0f, 6.0f / 9.0f, 6.0f / 9.0f, 2.0f / 9.0f,
+ 6.0f / 9.0f, 6.0f / 9.0f, 4.0f / 9.0f, 6.0f / 9.0f, 6.0f / 9.0f, 6.0f / 9.0f, 6.0f / 9.0f,
+ 6.0f / 9.0f, 8.0f / 9.0f, 6.0f / 9.0f, 6.0f / 9.0f, -8.0f / 9.0f, 8.0f / 9.0f, 6.0f / 9.0f,
+ -6.0f / 9.0f, 8.0f / 9.0f, 6.0f / 9.0f, -4.0f / 9.0f, 8.0f / 9.0f, 6.0f / 9.0f,
+ -2.0f / 9.0f, 8.0f / 9.0f, 6.0f / 9.0f, 0.0f, 8.0f / 9.0f, 6.0f / 9.0f, 2.0f / 9.0f,
+ 8.0f / 9.0f, 6.0f / 9.0f, 4.0f / 9.0f, 8.0f / 9.0f, 6.0f / 9.0f, 6.0f / 9.0f, 8.0f / 9.0f,
+ 6.0f / 9.0f, 8.0f / 9.0f, 8.0f / 9.0f, 6.0f / 9.0f, -8.0f / 9.0f, -8.0f / 9.0f,
+ 8.0f / 9.0f, -6.0f / 9.0f, -8.0f / 9.0f, 8.0f / 9.0f, -4.0f / 9.0f, -8.0f / 9.0f,
+ 8.0f / 9.0f, -2.0f / 9.0f, -8.0f / 9.0f, 8.0f / 9.0f, 0.0f, -8.0f / 9.0f, 8.0f / 9.0f,
+ 2.0f / 9.0f, -8.0f / 9.0f, 8.0f / 9.0f, 4.0f / 9.0f, -8.0f / 9.0f, 8.0f / 9.0f,
+ 6.0f / 9.0f, -8.0f / 9.0f, 8.0f / 9.0f, 8.0f / 9.0f, -8.0f / 9.0f, 8.0f / 9.0f,
+ -8.0f / 9.0f, -6.0f / 9.0f, 8.0f / 9.0f, -6.0f / 9.0f, -6.0f / 9.0f, 8.0f / 9.0f,
+ -4.0f / 9.0f, -6.0f / 9.0f, 8.0f / 9.0f, -2.0f / 9.0f, -6.0f / 9.0f, 8.0f / 9.0f, 0.0f,
+ -6.0f / 9.0f, 8.0f / 9.0f, 2.0f / 9.0f, -6.0f / 9.0f, 8.0f / 9.0f, 4.0f / 9.0f,
+ -6.0f / 9.0f, 8.0f / 9.0f, 6.0f / 9.0f, -6.0f / 9.0f, 8.0f / 9.0f, 8.0f / 9.0f,
+ -6.0f / 9.0f, 8.0f / 9.0f, -8.0f / 9.0f, -4.0f / 9.0f, 8.0f / 9.0f, -6.0f / 9.0f,
+ -4.0f / 9.0f, 8.0f / 9.0f, -4.0f / 9.0f, -4.0f / 9.0f, 8.0f / 9.0f, -2.0f / 9.0f,
+ -4.0f / 9.0f, 8.0f / 9.0f, 0.0f, -4.0f / 9.0f, 8.0f / 9.0f, 2.0f / 9.0f, -4.0f / 9.0f,
+ 8.0f / 9.0f, 4.0f / 9.0f, -4.0f / 9.0f, 8.0f / 9.0f, 6.0f / 9.0f, -4.0f / 9.0f,
+ 8.0f / 9.0f, 8.0f / 9.0f, -4.0f / 9.0f, 8.0f / 9.0f, -8.0f / 9.0f, -2.0f / 9.0f,
+ 8.0f / 9.0f, -6.0f / 9.0f, -2.0f / 9.0f, 8.0f / 9.0f, -4.0f / 9.0f, -2.0f / 9.0f,
+ 8.0f / 9.0f, -2.0f / 9.0f, -2.0f / 9.0f, 8.0f / 9.0f, 0.0f, -2.0f / 9.0f, 8.0f / 9.0f,
+ 2.0f / 9.0f, -2.0f / 9.0f, 8.0f / 9.0f, 4.0f / 9.0f, -2.0f / 9.0f, 8.0f / 9.0f,
+ 6.0f / 9.0f, -2.0f / 9.0f, 8.0f / 9.0f, 8.0f / 9.0f, -2.0f / 9.0f, 8.0f / 9.0f,
+ -8.0f / 9.0f, 0.0f, 8.0f / 9.0f, -6.0f / 9.0f, 0.0f, 8.0f / 9.0f, -4.0f / 9.0f, 0.0f,
+ 8.0f / 9.0f, -2.0f / 9.0f, 0.0f, 8.0f / 9.0f, 0.0f, 0.0f, 8.0f / 9.0f, 2.0f / 9.0f, 0.0f,
+ 8.0f / 9.0f, 4.0f / 9.0f, 0.0f, 8.0f / 9.0f, 6.0f / 9.0f, 0.0f, 8.0f / 9.0f, 8.0f / 9.0f,
+ 0.0f, 8.0f / 9.0f, -8.0f / 9.0f, 2.0f / 9.0f, 8.0f / 9.0f, -6.0f / 9.0f, 2.0f / 9.0f,
+ 8.0f / 9.0f, -4.0f / 9.0f, 2.0f / 9.0f, 8.0f / 9.0f, -2.0f / 9.0f, 2.0f / 9.0f,
+ 8.0f / 9.0f, 0.0f, 2.0f / 9.0f, 8.0f / 9.0f, 2.0f / 9.0f, 2.0f / 9.0f, 8.0f / 9.0f,
+ 4.0f / 9.0f, 2.0f / 9.0f, 8.0f / 9.0f, 6.0f / 9.0f, 2.0f / 9.0f, 8.0f / 9.0f, 8.0f / 9.0f,
+ 2.0f / 9.0f, 8.0f / 9.0f, -8.0f / 9.0f, 4.0f / 9.0f, 8.0f / 9.0f, -6.0f / 9.0f,
+ 4.0f / 9.0f, 8.0f / 9.0f, -4.0f / 9.0f, 4.0f / 9.0f, 8.0f / 9.0f, -2.0f / 9.0f,
+ 4.0f / 9.0f, 8.0f / 9.0f, 0.0f, 4.0f / 9.0f, 8.0f / 9.0f, 2.0f / 9.0f, 4.0f / 9.0f,
+ 8.0f / 9.0f, 4.0f / 9.0f, 4.0f / 9.0f, 8.0f / 9.0f, 6.0f / 9.0f, 4.0f / 9.0f, 8.0f / 9.0f,
+ 8.0f / 9.0f, 4.0f / 9.0f, 8.0f / 9.0f, -8.0f / 9.0f, 6.0f / 9.0f, 8.0f / 9.0f,
+ -6.0f / 9.0f, 6.0f / 9.0f, 8.0f / 9.0f, -4.0f / 9.0f, 6.0f / 9.0f, 8.0f / 9.0f,
+ -2.0f / 9.0f, 6.0f / 9.0f, 8.0f / 9.0f, 0.0f, 6.0f / 9.0f, 8.0f / 9.0f, 2.0f / 9.0f,
+ 6.0f / 9.0f, 8.0f / 9.0f, 4.0f / 9.0f, 6.0f / 9.0f, 8.0f / 9.0f, 6.0f / 9.0f, 6.0f / 9.0f,
+ 8.0f / 9.0f, 8.0f / 9.0f, 6.0f / 9.0f, 8.0f / 9.0f, -8.0f / 9.0f, 8.0f / 9.0f, 8.0f / 9.0f,
+ -6.0f / 9.0f, 8.0f / 9.0f, 8.0f / 9.0f, -4.0f / 9.0f, 8.0f / 9.0f, 8.0f / 9.0f,
+ -2.0f / 9.0f, 8.0f / 9.0f, 8.0f / 9.0f, 0.0f, 8.0f / 9.0f, 8.0f / 9.0f, 2.0f / 9.0f,
+ 8.0f / 9.0f, 8.0f / 9.0f, 4.0f / 9.0f, 8.0f / 9.0f, 8.0f / 9.0f, 6.0f / 9.0f, 8.0f / 9.0f,
+ 8.0f / 9.0f, 8.0f / 9.0f, 8.0f / 9.0f, 8.0f / 9.0f };
+
+ // data taken from ISO/IEC DIS 11172, Annexes 3-B.2[abcd] and 3-B.4:
+
+ // subbands 0-2 in tables 3-B.2a and 2b: (index is allocation)
+ public static final int table_ab1_codelength[] =
+ // bits per codeword
+ { 0, 5, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 };
+
+ public static final float table_ab1_groupingtables[][] =
+ // pointer to sample grouping table, or NULL-pointer if ungrouped
+ { null, grouping_5bits, null, null, null, null, null, null, null, null, null, null, null,
+ null, null, null };
+
+ public static final float table_ab1_factor[] =
+ // factor for requantization: (real)sample * factor - 1.0 gives requantized
+ // sample
+ { 0.0f, 1.0f / 2.0f, 1.0f / 4.0f, 1.0f / 8.0f, 1.0f / 16.0f, 1.0f / 32.0f, 1.0f / 64.0f,
+ 1.0f / 128.0f, 1.0f / 256.0f, 1.0f / 512.0f, 1.0f / 1024.0f, 1.0f / 2048.0f,
+ 1.0f / 4096.0f, 1.0f / 8192.0f, 1.0f / 16384.0f, 1.0f / 32768.0f };
+
+ public static final float table_ab1_c[] =
+ // factor c for requantization from table 3-B.4
+ { 0.0f, 1.33333333333f, 1.14285714286f, 1.06666666666f, 1.03225806452f, 1.01587301587f,
+ 1.00787401575f, 1.00392156863f, 1.00195694716f, 1.00097751711f, 1.00048851979f,
+ 1.00024420024f, 1.00012208522f, 1.00006103888f, 1.00003051851f, 1.00001525902f };
+
+ public static final float table_ab1_d[] =
+ // addend d for requantization from table 3-B.4
+ { 0.0f, 0.50000000000f, 0.25000000000f, 0.12500000000f, 0.06250000000f, 0.03125000000f,
+ 0.01562500000f, 0.00781250000f, 0.00390625000f, 0.00195312500f, 0.00097656250f,
+ 0.00048828125f, 0.00024414063f, 0.00012207031f, 0.00006103516f, 0.00003051758f };
+
+ // subbands 3-... tables 3-B.2a and 2b:
+ public static final float[] table_ab234_groupingtables[] = { null, grouping_5bits,
+ grouping_7bits, null, grouping_10bits, null, null, null, null, null, null, null, null,
+ null, null, null };
+
+ // subbands 3-10 in tables 3-B.2a and 2b:
+ public static final int table_ab2_codelength[] = { 0, 5, 7, 3, 10, 4, 5, 6, 7, 8, 9, 10, 11,
+ 12, 13, 16 };
+ public static final float table_ab2_factor[] = { 0.0f, 1.0f / 2.0f, 1.0f / 4.0f, 1.0f / 4.0f,
+ 1.0f / 8.0f, 1.0f / 8.0f, 1.0f / 16.0f, 1.0f / 32.0f, 1.0f / 64.0f, 1.0f / 128.0f,
+ 1.0f / 256.0f, 1.0f / 512.0f, 1.0f / 1024.0f, 1.0f / 2048.0f, 1.0f / 4096.0f,
+ 1.0f / 32768.0f };
+ public static final float table_ab2_c[] = { 0.0f, 1.33333333333f, 1.60000000000f,
+ 1.14285714286f, 1.77777777777f, 1.06666666666f, 1.03225806452f, 1.01587301587f,
+ 1.00787401575f, 1.00392156863f, 1.00195694716f, 1.00097751711f, 1.00048851979f,
+ 1.00024420024f, 1.00012208522f, 1.00001525902f };
+ public static final float table_ab2_d[] = { 0.0f, 0.50000000000f, 0.50000000000f,
+ 0.25000000000f, 0.50000000000f, 0.12500000000f, 0.06250000000f, 0.03125000000f,
+ 0.01562500000f, 0.00781250000f, 0.00390625000f, 0.00195312500f, 0.00097656250f,
+ 0.00048828125f, 0.00024414063f, 0.00003051758f };
+
+ // subbands 11-22 in tables 3-B.2a and 2b:
+ public static final int table_ab3_codelength[] = { 0, 5, 7, 3, 10, 4, 5, 16 };
+ public static final float table_ab3_factor[] = { 0.0f, 1.0f / 2.0f, 1.0f / 4.0f, 1.0f / 4.0f,
+ 1.0f / 8.0f, 1.0f / 8.0f, 1.0f / 16.0f, 1.0f / 32768.0f };
+ public static final float table_ab3_c[] = { 0.0f, 1.33333333333f, 1.60000000000f,
+ 1.14285714286f, 1.77777777777f, 1.06666666666f, 1.03225806452f, 1.00001525902f };
+ public static final float table_ab3_d[] = { 0.0f, 0.50000000000f, 0.50000000000f,
+ 0.25000000000f, 0.50000000000f, 0.12500000000f, 0.06250000000f, 0.00003051758f };
+
+ // subbands 23-... in tables 3-B.2a and 2b:
+ public static final int table_ab4_codelength[] = { 0, 5, 7, 16 };
+ public static final float table_ab4_factor[] = { 0.0f, 1.0f / 2.0f, 1.0f / 4.0f,
+ 1.0f / 32768.0f };
+ public static final float table_ab4_c[] = { 0.0f, 1.33333333333f, 1.60000000000f,
+ 1.00001525902f };
+ public static final float table_ab4_d[] = { 0.0f, 0.50000000000f, 0.50000000000f,
+ 0.00003051758f };
+
+ // subbands in tables 3-B.2c and 2d:
+ public static final int table_cd_codelength[] = { 0, 5, 7, 10, 4, 5, 6, 7, 8, 9, 10, 11, 12,
+ 13, 14, 15 };
+ public static final float table_cd_groupingtables[][] = { null, grouping_5bits, grouping_7bits,
+ grouping_10bits, null, null, null, null, null, null, null, null, null, null, null, null };
+ public static final float table_cd_factor[] = { 0.0f, 1.0f / 2.0f, 1.0f / 4.0f, 1.0f / 8.0f,
+ 1.0f / 8.0f, 1.0f / 16.0f, 1.0f / 32.0f, 1.0f / 64.0f, 1.0f / 128.0f, 1.0f / 256.0f,
+ 1.0f / 512.0f, 1.0f / 1024.0f, 1.0f / 2048.0f, 1.0f / 4096.0f, 1.0f / 8192.0f,
+ 1.0f / 16384.0f };
+ public static final float table_cd_c[] = { 0.0f, 1.33333333333f, 1.60000000000f,
+ 1.77777777777f, 1.06666666666f, 1.03225806452f, 1.01587301587f, 1.00787401575f,
+ 1.00392156863f, 1.00195694716f, 1.00097751711f, 1.00048851979f, 1.00024420024f,
+ 1.00012208522f, 1.00006103888f, 1.00003051851f };
+ public static final float table_cd_d[] = { 0.0f, 0.50000000000f, 0.50000000000f,
+ 0.50000000000f, 0.12500000000f, 0.06250000000f, 0.03125000000f, 0.01562500000f,
+ 0.00781250000f, 0.00390625000f, 0.00195312500f, 0.00097656250f, 0.00048828125f,
+ 0.00024414063f, 0.00012207031f, 0.00006103516f };
+
+
+ protected int subbandnumber;
+
+ protected int allocation;
+
+ protected int scfsi;
+
+ protected float scalefactor1;
+
+ protected float scalefactor2;
+
+ protected float scalefactor3;
+
+ protected int[] codelength = { 0 };
+
+ protected float groupingtable[][] = new float[2][];
+ // protected float[][] groupingtable = {{0},{0}} ;
+
+ protected float[] factor = { 0.0f };
+
+ protected int groupnumber;
+
+ protected int samplenumber;
+
+ protected float[] samples = new float[3];
+
+ protected float[] c = { 0.0f };
+
+ protected float[] d = { 0.0f };
+
+ /**
+ * Constructor
+ */
+ public SubbandLayer2( int subbandnumber) {
+ this.subbandnumber = subbandnumber;
+ groupnumber = samplenumber = 0;
+ }
+
+ /**
+ *
+ */
+ protected int get_allocationlength( Header header) {
+
+ if (header.version() == Header.MPEG1) {
+
+ int channel_bitrate = header.bitrate_index();
+
+ // calculate bitrate per channel:
+ if (header.mode() != Header.SINGLE_CHANNEL)
+ if (channel_bitrate == 4)
+ channel_bitrate = 1;
+ else
+ channel_bitrate -= 4;
+
+ if (channel_bitrate == 1 || channel_bitrate == 2)
+ // table 3-B.2c or 3-B.2d
+ if (subbandnumber <= 1)
+ return 4;
+ else
+ return 3;
+ else
+ // tables 3-B.2a or 3-B.2b
+ if (subbandnumber <= 10)
+ return 4;
+ else if (subbandnumber <= 22)
+ return 3;
+ else
+ return 2;
+ } else { // MPEG-2 LSF -- Jeff
+
+ // table B.1 of ISO/IEC 13818-3
+ if (subbandnumber <= 3)
+ return 4;
+ else if (subbandnumber <= 10)
+ return 3;
+ else
+ return 2;
+ }
+ }
+
+ /**
+ *
+ */
+
+ protected void prepare_sample_reading( Header header,
+ int allocation,
+ // float[][] groupingtable,
+ int channel, float[] factor, int[] codelength,
+ float[] c, float[] d) {
+
+ // header.bitrate_index() will generate at most DELTA(THIS,SH*)
+ int channel_bitrate = header.bitrate_index();
+
+ // calculate bitrate per channel:
+ if (header.mode() != Header.SINGLE_CHANNEL) {
+ if (channel_bitrate == 4) {
+ channel_bitrate = 1;
+ } else {
+ channel_bitrate -= 4;
+ }
+ }
+
+ if (channel_bitrate == 1 || channel_bitrate == 2) {
+ // table 3-B.2c or 3-B.2d
+ groupingtable[channel] = table_cd_groupingtables[allocation];
+ factor[0] = table_cd_factor[allocation];
+ codelength[0] = table_cd_codelength[allocation];
+ c[0] = table_cd_c[allocation];
+ d[0] = table_cd_d[allocation];
+ } else {
+ // tables 3-B.2a or 3-B.2b
+ if (subbandnumber <= 2) {
+ groupingtable[channel] = table_ab1_groupingtables[allocation];
+ factor[0] = table_ab1_factor[allocation];
+ codelength[0] = table_ab1_codelength[allocation];
+ c[0] = table_ab1_c[allocation];
+ d[0] = table_ab1_d[allocation];
+ } else {
+ groupingtable[channel] = table_ab234_groupingtables[allocation];
+ if (subbandnumber <= 10) {
+ factor[0] = table_ab2_factor[allocation];
+ codelength[0] = table_ab2_codelength[allocation];
+ c[0] = table_ab2_c[allocation];
+ d[0] = table_ab2_d[allocation];
+ } else if (subbandnumber <= 22) {
+ factor[0] = table_ab3_factor[allocation];
+ codelength[0] = table_ab3_codelength[allocation];
+ c[0] = table_ab3_c[allocation];
+ d[0] = table_ab3_d[allocation];
+ } else {
+ factor[0] = table_ab4_factor[allocation];
+ codelength[0] = table_ab4_codelength[allocation];
+ c[0] = table_ab4_c[allocation];
+ d[0] = table_ab4_d[allocation];
+ }
+ }
+ }
+ }
+
+ /**
+ *
+ */
+
+ // ssjava
+ public void read_allocation( Bitstream stream,
+ Header header,
+ Crc16 crc) {
+
+ int length = get_allocationlength(header);
+
+ allocation = stream.get_bits(length);
+ if (crc != null) {
+ crc.add_bits(allocation, length);
+ }
+ }
+
+ /**
+ *
+ */
+ public void read_scalefactor_selection( Bitstream stream,
+ Crc16 crc) {
+ if (allocation != 0) {
+ scfsi = stream.get_bits(2);
+ if (crc != null)
+ crc.add_bits(scfsi, 2);
+ }
+ }
+
+ /**
+ *
+ */
+ public void read_scalefactor( Bitstream stream, Header header) {
+ if (allocation != 0) {
+ switch (scfsi) {
+ case 0:
+ scalefactor1 = scalefactors[stream.get_bits(6)];
+ scalefactor2 = scalefactors[stream.get_bits(6)];
+ scalefactor3 = scalefactors[stream.get_bits(6)];
+ break;
+ case 1:
+ scalefactor1 = scalefactor2 = scalefactors[stream.get_bits(6)];
+ scalefactor3 = scalefactors[stream.get_bits(6)];
+ break;
+ case 2:
+ scalefactor1 = scalefactor2 = scalefactor3 = scalefactors[stream.get_bits(6)];
+ break;
+ case 3:
+ scalefactor1 = scalefactors[stream.get_bits(6)];
+ scalefactor2 = scalefactor3 = scalefactors[stream.get_bits(6)];
+ break;
+ }
+ prepare_sample_reading(header, allocation, 0, factor, codelength, c, d);
+ }
+ }
+
+ /**
+ *
+ */
+ // ssjava
+ public boolean read_sampledata( Bitstream stream) {
+ if (allocation != 0) {
+ if (groupingtable[0] != null) {
+
+ int samplecode =
+ stream.get_bits(codelength[0]);
+ // create requantized samples:
+ samplecode += samplecode << 1;
+ // float[] target = samples; //subbed in variable to reduce areas
+ // float[] source = groupingtable[0]; //subbed in variable to reduce
+ // areas
+ /*
+ * int tmp = 0; int temp = 0; target[tmp++] = source[samplecode +
+ * temp]; temp++; target[tmp++] = source[samplecode + temp]; temp++;
+ * target[tmp] = source[samplecode + temp];
+ */
+ // Bugfix:
+ int tmp = 0;
+ int temp = samplecode;
+
+ // if(temp > source.length - 3) temp = source.length - 3;
+ if (temp > groupingtable[0].length - 3) {
+ temp = groupingtable[0].length - 3;
+ }
+
+ samples[tmp] = groupingtable[0][temp];
+ temp++;
+ tmp++;
+ samples[tmp] = groupingtable[0][temp];
+ temp++;
+ tmp++;
+ samples[tmp] = groupingtable[0][temp];
+
+ // memcpy (samples, groupingtable + samplecode, 3 * sizeof (real));
+ } else {
+ samples[0] = (float) ((stream.get_bits(codelength[0])) * factor[0] - 1.0);
+ samples[1] = (float) ((stream.get_bits(codelength[0])) * factor[0] - 1.0);
+ samples[2] = (float) ((stream.get_bits(codelength[0])) * factor[0] - 1.0);
+ }
+ }
+ samplenumber = 0;
+ if (++groupnumber == 12)
+ return true;
+ else
+ return false;
+ }
+
+ // ssjava
+ public boolean put_next_sample( int channels, SynthesisFilter filter1,
+ SynthesisFilter filter2) {
+
+ if ((allocation != 0) && (channels != OutputChannels.RIGHT_CHANNEL)) {
+
+ float sample = samples[samplenumber];
+
+ if (groupingtable[0] == null) {
+ sample = (sample + d[0]) * c[0];
+ }
+ if (groupnumber <= 4) {
+ sample *= scalefactor1;
+ } else if (groupnumber <= 8) {
+ sample *= scalefactor2;
+ } else {
+ sample *= scalefactor3;
+ }
+ filter1.input_sample(sample, subbandnumber);
+ }
+
+ if (++samplenumber == 3)
+ return true;
+ else
+ return false;
+ }
+ };
+
+ /**
+ * Class for layer II subbands in joint stereo mode.
+ */
+
+
+ static class SubbandLayer2IntensityStereo extends SubbandLayer2 {
+
+ protected int channel2_scfsi;
+
+ protected float channel2_scalefactor1;
+
+ protected float channel2_scalefactor2;
+
+ protected float channel2_scalefactor3;
+
+ /**
+ * Constructor
+ */
+ public SubbandLayer2IntensityStereo( int subbandnumber) {
+ super(subbandnumber);
+ }
+
+ /**
+ *
+ */
+
+ public void read_allocation( Bitstream stream, Header header,
+ Crc16 crc) {
+ super.read_allocation(stream, header, crc);
+ }
+
+ /**
+ *
+ */
+ public void read_scalefactor_selection( Bitstream stream,
+ Crc16 crc) {
+ if (allocation != 0) {
+ scfsi = stream.get_bits(2);
+ channel2_scfsi = stream.get_bits(2);
+ if (crc != null) {
+ crc.add_bits(scfsi, 2);
+ crc.add_bits(channel2_scfsi, 2);
+ }
+ }
+ }
+
+ /**
+ *
+ */
+ public void read_scalefactor( Bitstream stream, Header header) {
+ if (allocation != 0) {
+ super.read_scalefactor(stream, header);
+ switch (channel2_scfsi) {
+ case 0:
+ channel2_scalefactor1 = scalefactors[stream.get_bits(6)];
+ channel2_scalefactor2 = scalefactors[stream.get_bits(6)];
+ channel2_scalefactor3 = scalefactors[stream.get_bits(6)];
+ break;
+
+ case 1:
+ channel2_scalefactor1 = scalefactors[stream.get_bits(6)];
+ channel2_scalefactor2 = channel2_scalefactor1;
+ channel2_scalefactor3 = scalefactors[stream.get_bits(6)];
+ break;
+
+ case 2:
+ channel2_scalefactor1 = scalefactors[stream.get_bits(6)];
+ channel2_scalefactor2 = channel2_scalefactor1;
+ channel2_scalefactor3 = channel2_scalefactor2;
+ break;
+
+ case 3:
+ channel2_scalefactor1 = scalefactors[stream.get_bits(6)];
+ channel2_scalefactor2 = scalefactors[stream.get_bits(6)];
+ channel2_scalefactor3 = channel2_scalefactor2;
+ break;
+ }
+ }
+
+ }
+
+ /**
+ *
+ */
+ public boolean read_sampledata( Bitstream stream) {
+ return super.read_sampledata(stream);
+ }
+
+ /**
+ *
+ */
+
+
+ public boolean put_next_sample( int channels, SynthesisFilter filter1,
+ SynthesisFilter filter2) {
+ if (allocation != 0) {
+ float sample = samples[samplenumber];
+
+ if (groupingtable[0] == null)
+ sample = (sample + d[0]) * c[0];
+ if (channels == OutputChannels.BOTH_CHANNELS) {
+ float sample2 = sample;
+ if (groupnumber <= 4) {
+ sample *= scalefactor1;
+ sample2 *= channel2_scalefactor1;
+ } else if (groupnumber <= 8) {
+ sample *= scalefactor2;
+ sample2 *= channel2_scalefactor2;
+ } else {
+ sample *= scalefactor3;
+ sample2 *= channel2_scalefactor3;
+ }
+ filter1.input_sample(sample, subbandnumber);
+ filter2.input_sample(sample2, subbandnumber);
+ } else if (channels == OutputChannels.LEFT_CHANNEL) {
+ if (groupnumber <= 4)
+ sample *= scalefactor1;
+ else if (groupnumber <= 8)
+ sample *= scalefactor2;
+ else
+ sample *= scalefactor3;
+ filter1.input_sample(sample, subbandnumber);
+ } else {
+ if (groupnumber <= 4)
+ sample *= channel2_scalefactor1;
+ else if (groupnumber <= 8)
+ sample *= channel2_scalefactor2;
+ else
+ sample *= channel2_scalefactor3;
+ filter1.input_sample(sample, subbandnumber);
+ }
+ }
+
+ if (++samplenumber == 3)
+ return true;
+ else
+ return false;
+ }
+ };
+
+ /**
+ * Class for layer II subbands in stereo mode.
+ */
+
+
+ static class SubbandLayer2Stereo extends SubbandLayer2 {
+
+ protected int channel2_allocation;
+
+ protected int channel2_scfsi;
+
+ protected float channel2_scalefactor1;
+
+ protected float channel2_scalefactor2;
+
+ protected float channel2_scalefactor3;
+ // protected boolean channel2_grouping; ???? Never used!
+
+ protected int[] channel2_codelength = { 0 };
+ // protected float[][] channel2_groupingtable = {{0},{0}};
+
+ protected float[] channel2_factor = { 0.0f };
+
+ protected float[] channel2_samples;
+
+ protected float[] channel2_c = { 0.0f };
+
+ protected float[] channel2_d = { 0.0f };
+
+ /**
+ * Constructor
+ */
+ public SubbandLayer2Stereo( int subbandnumber) {
+ super(subbandnumber);
+ channel2_samples = new float[3];
+ }
+
+ /**
+ *
+ */
+
+ // ssjava
+ public void read_allocation(
+ Bitstream stream,
+ Header header,
+ Crc16 crc) {
+
+ int length = get_allocationlength(header);
+ allocation = stream.get_bits(length);
+ channel2_allocation = stream.get_bits(length);
+ if (crc != null) {
+ crc.add_bits(allocation, length);
+ crc.add_bits(channel2_allocation, length);
+ }
+
+ }
+
+ /**
+ *
+ */
+ public void read_scalefactor_selection( Bitstream stream,
+ Crc16 crc) {
+ if (allocation != 0) {
+ scfsi = stream.get_bits(2);
+ if (crc != null)
+ crc.add_bits(scfsi, 2);
+ }
+ if (channel2_allocation != 0) {
+ channel2_scfsi = stream.get_bits(2);
+ if (crc != null)
+ crc.add_bits(channel2_scfsi, 2);
+ }
+ }
+
+ /**
+ *
+ */
+ public void read_scalefactor( Bitstream stream, Header header) {
+ super.read_scalefactor(stream, header);
+ if (channel2_allocation != 0) {
+ switch (channel2_scfsi) {
+ case 0:
+ channel2_scalefactor1 = scalefactors[stream.get_bits(6)];
+ channel2_scalefactor2 = scalefactors[stream.get_bits(6)];
+ channel2_scalefactor3 = scalefactors[stream.get_bits(6)];
+ break;
+
+ case 1:
+ channel2_scalefactor1 = channel2_scalefactor2 = scalefactors[stream.get_bits(6)];
+ channel2_scalefactor3 = scalefactors[stream.get_bits(6)];
+ break;
+
+ case 2:
+ channel2_scalefactor1 =
+ channel2_scalefactor2 = channel2_scalefactor3 = scalefactors[stream.get_bits(6)];
+ break;
+
+ case 3:
+ channel2_scalefactor1 = scalefactors[stream.get_bits(6)];
+ channel2_scalefactor2 = channel2_scalefactor3 = scalefactors[stream.get_bits(6)];
+ break;
+ }
+ prepare_sample_reading(header, channel2_allocation, 1, channel2_factor,
+ channel2_codelength, channel2_c, channel2_d);
+ }
+ }
+
+ /**
+ *
+ */
+ // ssjava
+ public boolean read_sampledata(
+ Bitstream stream) {
+ boolean returnvalue = super.read_sampledata(stream);
+
+ if (channel2_allocation != 0)
+ if (groupingtable[1] != null) {
+ int samplecode =
+ stream.get_bits(channel2_codelength[0]);
+ // create requantized samples:
+ samplecode += samplecode << 1;
+
+ int tmp = 0;
+ int temp = samplecode;
+
+ channel2_samples[tmp] = groupingtable[1][temp];
+ temp++;
+ tmp++;
+ channel2_samples[tmp] = groupingtable[1][temp];
+ temp++;
+ tmp++;
+ channel2_samples[tmp] = groupingtable[1][temp];
+
+ } else {
+ channel2_samples[0] =
+ (float) ((stream.get_bits(channel2_codelength[0])) * channel2_factor[0] - 1.0);
+ channel2_samples[1] =
+ (float) ((stream.get_bits(channel2_codelength[0])) * channel2_factor[0] - 1.0);
+ channel2_samples[2] =
+ (float) ((stream.get_bits(channel2_codelength[0])) * channel2_factor[0] - 1.0);
+ }
+ return returnvalue;
+ }
+
+ // ssjava
+ public boolean put_next_sample( int channels, SynthesisFilter filter1,
+ SynthesisFilter filter2) {
+
+ boolean returnvalue = super.put_next_sample(channels, filter1, filter2);
+
+ if ((channel2_allocation != 0) && (channels != OutputChannels.LEFT_CHANNEL)) {
+
+ float sample =
+ channel2_samples[samplenumber - 1];
+
+ if (groupingtable[1] == null) {
+ sample = (sample + channel2_d[0]) * channel2_c[0];
+ }
+
+ if (groupnumber <= 4) {
+ sample *= channel2_scalefactor1;
+ } else if (groupnumber <= 8) {
+ sample *= channel2_scalefactor2;
+ } else {
+ sample *= channel2_scalefactor3;
+ }
+
+ if (channels == OutputChannels.BOTH_CHANNELS) {
+ filter2.input_sample(sample, subbandnumber);
+ } else {
+ filter1.input_sample(sample, subbandnumber);
+ }
+ }
+
+ return returnvalue;
+
+ }
+ }
+}
diff --git a/Robust/src/Benchmarks/SSJava/MP3DecoderInfer/LayerIIIDecoder.java b/Robust/src/Benchmarks/SSJava/MP3DecoderInfer/LayerIIIDecoder.java
new file mode 100644
index 00000000..ebbf8ec7
--- /dev/null
+++ b/Robust/src/Benchmarks/SSJava/MP3DecoderInfer/LayerIIIDecoder.java
@@ -0,0 +1,2973 @@
+/*
+ * 11/19/04 1.0 moved to LGPL.
+ *
+ * 18/06/01 Michael Scheerer, Fixed bugs which causes
+ * negative indexes in method huffmann_decode and in method
+ * dequanisize_sample.
+ *
+ * 16/07/01 Michael Scheerer, Catched a bug in method
+ * huffmann_decode, which causes an outOfIndexException.
+ * Cause : Indexnumber of 24 at SfBandIndex,
+ * which has only a length of 22. I have simply and dirty
+ * fixed the index to <= 22, because I'm not really be able
+ * to fix the bug. The Indexnumber is taken from the MP3
+ * file and the origin Ma-Player with the same code works
+ * well.
+ *
+ * 02/19/99 Java Conversion by E.B, javalayer@javazoom.net
+ *-----------------------------------------------------------------------
+ * 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.
+ *----------------------------------------------------------------------
+ */
+
+/**
+ * Class Implementing Layer 3 Decoder.
+ *
+ * @since 0.0
+ */
+//
+// 4th line added for hybrid.
+// 5th added for stereo
+// 6th added for reorder method
+// 7th added for huffman_decode method
+// 8th added for get_LSF_scale_data
+// 9th added for get_LSF_scale_factors
+// 10th added for get_scale_factors
+// llth added for decode
+//
+
+
+final class LayerIIIDecoder implements FrameDecoder {
+ static final double d43 = (4.0 / 3.0);
+
+ public int[] scalefac_buffer;
+
+ // MDM: removed, as this wasn't being used.
+ // private float CheckSumOut1d = 0.0f;
+
+ private int CheckSumHuff = 0;
+
+ private int[] is_1d;
+
+ private float[][][] ro;
+
+ private float[][][] lr;
+
+ private float[] inter; // 576 samples
+
+ private float[] out_1d; // 576 samples
+
+ private float[][] prevblck;
+
+
+ private float[][] k;
+
+ private int[] nonzero;
+
+ private SynthesisFilter filter1;
+
+ private SynthesisFilter filter2;
+ //
+ // private Obuffer buffer; // output buffer
+
+ private int which_channels;
+
+ private BitReserve br;
+
+ private III_side_info_t si;
+
+ // private temporaire2[] III_scalefac_t;
+
+ private final temporaire2[] scalefac;
+ // private III_scalefac_t scalefac;
+
+
+ private int max_gr;
+
+ private int frame_start;
+ // private int part2_start;
+
+ private final int channels;
+
+ private int first_channel;
+
+ private int last_channel;
+
+ private int sfreq;
+
+
+ private int part2_start;
+
+
+ private boolean initialized = false;
+
+
+ float[][] raw_full; // 18 left shfited since it will be copied into prevblck!
+
+ // constructor for the linear type system
+ public LayerIIIDecoder(Header h, @DELEGATE SynthesisFilter filtera,
+ @DELEGATE SynthesisFilter filterb, int which_ch0) {
+
+ filter_pos = 11;
+ raw_full = new float[2][SBLIMIT * SSLIMIT];
+
+ filter1 = filtera;
+ filter2 = filterb;
+
+ huffcodetab.inithuff();
+ is_1d = new int[SBLIMIT * SSLIMIT + 4];
+ ro = new float[2][SBLIMIT][SSLIMIT];
+ lr = new float[2][SBLIMIT][SSLIMIT];
+ out_1d = new float[SBLIMIT * SSLIMIT];
+ inter = new float[SBLIMIT * SSLIMIT];
+ prevblck = new float[2][SBLIMIT * SSLIMIT];
+ k = new float[2][SBLIMIT * SSLIMIT];
+ nonzero = new int[2];
+
+ // removes unnecessary aliases
+ // III_scalefact_t
+ // III_scalefac_t = new temporaire2[2];
+ // III_scalefac_t[0] = new temporaire2();
+ // III_scalefac_t[1] = new temporaire2();
+ // scalefac = III_scalefac_t;
+
+ scalefac = new temporaire2[2];
+ scalefac[0] = new temporaire2();
+ scalefac[1] = new temporaire2();
+
+ // L3TABLE INIT
+
+ sfBandIndex = new SBI[9]; // SZD: MPEG2.5 +3 indices
+ int[] l0 =
+ { 0, 6, 12, 18, 24, 30, 36, 44, 54, 66, 80, 96, 116, 140, 168, 200, 238, 284, 336, 396,
+ 464, 522, 576 };
+ int[] s0 = { 0, 4, 8, 12, 18, 24, 32, 42, 56, 74, 100, 132, 174, 192 };
+ int[] l1 =
+ { 0, 6, 12, 18, 24, 30, 36, 44, 54, 66, 80, 96, 114, 136, 162, 194, 232, 278, 330, 394,
+ 464, 540, 576 };
+ int[] s1 = { 0, 4, 8, 12, 18, 26, 36, 48, 62, 80, 104, 136, 180, 192 };
+ int[] l2 =
+ { 0, 6, 12, 18, 24, 30, 36, 44, 54, 66, 80, 96, 116, 140, 168, 200, 238, 284, 336, 396,
+ 464, 522, 576 };
+ int[] s2 = { 0, 4, 8, 12, 18, 26, 36, 48, 62, 80, 104, 134, 174, 192 };
+
+ int[] l3 =
+ { 0, 4, 8, 12, 16, 20, 24, 30, 36, 44, 52, 62, 74, 90, 110, 134, 162, 196, 238, 288, 342,
+ 418, 576 };
+ int[] s3 = { 0, 4, 8, 12, 16, 22, 30, 40, 52, 66, 84, 106, 136, 192 };
+ int[] l4 =
+ { 0, 4, 8, 12, 16, 20, 24, 30, 36, 42, 50, 60, 72, 88, 106, 128, 156, 190, 230, 276, 330,
+ 384, 576 };
+ int[] s4 = { 0, 4, 8, 12, 16, 22, 28, 38, 50, 64, 80, 100, 126, 192 };
+ int[] l5 =
+ { 0, 4, 8, 12, 16, 20, 24, 30, 36, 44, 54, 66, 82, 102, 126, 156, 194, 240, 296, 364, 448,
+ 550, 576 };
+ int[] s5 = { 0, 4, 8, 12, 16, 22, 30, 42, 58, 78, 104, 138, 180, 192 };
+ // SZD: MPEG2.5
+ int[] l6 =
+ { 0, 6, 12, 18, 24, 30, 36, 44, 54, 66, 80, 96, 116, 140, 168, 200, 238, 284, 336, 396,
+ 464, 522, 576 };
+ int[] s6 = { 0, 4, 8, 12, 18, 26, 36, 48, 62, 80, 104, 134, 174, 192 };
+ int[] l7 =
+ { 0, 6, 12, 18, 24, 30, 36, 44, 54, 66, 80, 96, 116, 140, 168, 200, 238, 284, 336, 396,
+ 464, 522, 576 };
+ int[] s7 = { 0, 4, 8, 12, 18, 26, 36, 48, 62, 80, 104, 134, 174, 192 };
+ int[] l8 =
+ { 0, 12, 24, 36, 48, 60, 72, 88, 108, 132, 160, 192, 232, 280, 336, 400, 476, 566, 568,
+ 570, 572, 574, 576 };
+ int[] s8 = { 0, 8, 16, 24, 36, 52, 72, 96, 124, 160, 162, 164, 166, 192 };
+
+ sfBandIndex[0] = new SBI(l0, s0);
+ sfBandIndex[1] = new SBI(l1, s1);
+ sfBandIndex[2] = new SBI(l2, s2);
+
+ sfBandIndex[3] = new SBI(l3, s3);
+ sfBandIndex[4] = new SBI(l4, s4);
+ sfBandIndex[5] = new SBI(l5, s5);
+ // SZD: MPEG2.5
+ sfBandIndex[6] = new SBI(l6, s6);
+ sfBandIndex[7] = new SBI(l7, s7);
+ sfBandIndex[8] = new SBI(l8, s8);
+ // END OF L3TABLE INIT
+
+ if (reorder_table == null) { // SZD: generate LUT
+ reorder_table = new int[9][];
+ for ( int i = 0; i < 9; i++)
+ reorder_table[i] = reorder(sfBandIndex[i].s);
+ }
+
+ // scalefac_buffer
+ scalefac_buffer = new int[54];
+ // END OF scalefac_buffer
+
+ init(h);
+ }
+
+
+ private void init( Header header) {
+
+ frame_start = 0;
+ channels = (header.mode() == Header.SINGLE_CHANNEL) ? 1 : 2;
+ max_gr = (header.version() == Header.MPEG1) ? 2 : 1;
+
+ sfreq =
+ header.sample_frequency()
+ + ((header.version() == Header.MPEG1) ? 3 : (header.version() == Header.MPEG25_LSF) ? 6
+ : 0); // SZD
+
+ if (channels == 2) {
+ switch (which_channels) {
+ case OutputChannels.LEFT_CHANNEL:
+ case OutputChannels.DOWNMIX_CHANNELS:
+ first_channel = last_channel = 0;
+ break;
+
+ case OutputChannels.RIGHT_CHANNEL:
+ first_channel = last_channel = 1;
+ break;
+
+ case OutputChannels.BOTH_CHANNELS:
+ default:
+ first_channel = 0;
+ last_channel = 1;
+ break;
+ }
+ } else {
+ first_channel = last_channel = 0;
+ }
+
+ for ( int ch = 0; ch < 2; ch++)
+ for ( int j = 0; j < 576; j++)
+ prevblck[ch][j] = 0.0f;
+
+ nonzero[0] = nonzero[1] = 576;
+
+ si = new III_side_info_t();
+
+ initialized = true;
+
+ }
+
+ /**
+ * Constructor.
+ */
+ // REVIEW: these constructor arguments should be moved to the
+ // decodeFrame() method, where possible, so that one
+ //
+ // public LayerIIIDecoder( Header header0,
+ // SynthesisFilter filtera,
+ // SynthesisFilter filterb, int which_ch0) {
+ //
+ // huffcodetab.inithuff();
+ // is_1d = new int[SBLIMIT * SSLIMIT + 4];
+ // ro = new float[2][SBLIMIT][SSLIMIT];
+ // lr = new float[2][SBLIMIT][SSLIMIT];
+ // out_1d = new float[SBLIMIT * SSLIMIT];
+ // prevblck = new float[2][SBLIMIT * SSLIMIT];
+ // k = new float[2][SBLIMIT * SSLIMIT];
+ // nonzero = new int[2];
+ //
+ // // removes unnecessary aliases
+ // // III_scalefact_t
+ // // III_scalefac_t = new temporaire2[2];
+ // // III_scalefac_t[0] = new temporaire2();
+ // // III_scalefac_t[1] = new temporaire2();
+ // // scalefac = III_scalefac_t;
+ //
+ // scalefac = new temporaire2[2];
+ // scalefac[0] = new temporaire2();
+ // scalefac[1] = new temporaire2();
+ //
+ // // L3TABLE INIT
+ //
+ // sfBandIndex = new SBI[9]; // SZD: MPEG2.5 +3 indices
+ // int[] l0 =
+ // { 0, 6, 12, 18, 24, 30, 36, 44, 54, 66, 80, 96, 116, 140, 168, 200, 238,
+ // 284, 336, 396,
+ // 464, 522, 576 };
+ // int[] s0 = { 0, 4, 8, 12, 18, 24, 32, 42, 56, 74, 100, 132,
+ // 174, 192 };
+ // int[] l1 =
+ // { 0, 6, 12, 18, 24, 30, 36, 44, 54, 66, 80, 96, 114, 136, 162, 194, 232,
+ // 278, 330, 394,
+ // 464, 540, 576 };
+ // int[] s1 = { 0, 4, 8, 12, 18, 26, 36, 48, 62, 80, 104, 136,
+ // 180, 192 };
+ // int[] l2 =
+ // { 0, 6, 12, 18, 24, 30, 36, 44, 54, 66, 80, 96, 116, 140, 168, 200, 238,
+ // 284, 336, 396,
+ // 464, 522, 576 };
+ // int[] s2 = { 0, 4, 8, 12, 18, 26, 36, 48, 62, 80, 104, 134,
+ // 174, 192 };
+ //
+ // int[] l3 =
+ // { 0, 4, 8, 12, 16, 20, 24, 30, 36, 44, 52, 62, 74, 90, 110, 134, 162, 196,
+ // 238, 288, 342,
+ // 418, 576 };
+ // int[] s3 = { 0, 4, 8, 12, 16, 22, 30, 40, 52, 66, 84, 106, 136,
+ // 192 };
+ // int[] l4 =
+ // { 0, 4, 8, 12, 16, 20, 24, 30, 36, 42, 50, 60, 72, 88, 106, 128, 156, 190,
+ // 230, 276, 330,
+ // 384, 576 };
+ // int[] s4 = { 0, 4, 8, 12, 16, 22, 28, 38, 50, 64, 80, 100, 126,
+ // 192 };
+ // int[] l5 =
+ // { 0, 4, 8, 12, 16, 20, 24, 30, 36, 44, 54, 66, 82, 102, 126, 156, 194, 240,
+ // 296, 364, 448,
+ // 550, 576 };
+ // int[] s5 = { 0, 4, 8, 12, 16, 22, 30, 42, 58, 78, 104, 138,
+ // 180, 192 };
+ // // SZD: MPEG2.5
+ // int[] l6 =
+ // { 0, 6, 12, 18, 24, 30, 36, 44, 54, 66, 80, 96, 116, 140, 168, 200, 238,
+ // 284, 336, 396,
+ // 464, 522, 576 };
+ // int[] s6 = { 0, 4, 8, 12, 18, 26, 36, 48, 62, 80, 104, 134,
+ // 174, 192 };
+ // int[] l7 =
+ // { 0, 6, 12, 18, 24, 30, 36, 44, 54, 66, 80, 96, 116, 140, 168, 200, 238,
+ // 284, 336, 396,
+ // 464, 522, 576 };
+ // int[] s7 = { 0, 4, 8, 12, 18, 26, 36, 48, 62, 80, 104, 134,
+ // 174, 192 };
+ // int[] l8 =
+ // { 0, 12, 24, 36, 48, 60, 72, 88, 108, 132, 160, 192, 232, 280, 336, 400,
+ // 476, 566, 568,
+ // 570, 572, 574, 576 };
+ // int[] s8 = { 0, 8, 16, 24, 36, 52, 72, 96, 124, 160, 162, 164,
+ // 166, 192 };
+ //
+ // sfBandIndex[0] = new SBI(l0, s0);
+ // sfBandIndex[1] = new SBI(l1, s1);
+ // sfBandIndex[2] = new SBI(l2, s2);
+ //
+ // sfBandIndex[3] = new SBI(l3, s3);
+ // sfBandIndex[4] = new SBI(l4, s4);
+ // sfBandIndex[5] = new SBI(l5, s5);
+ // // SZD: MPEG2.5
+ // sfBandIndex[6] = new SBI(l6, s6);
+ // sfBandIndex[7] = new SBI(l7, s7);
+ // sfBandIndex[8] = new SBI(l8, s8);
+ // // END OF L3TABLE INIT
+ //
+ // if (reorder_table == null) { // SZD: generate LUT
+ // reorder_table = new int[9][];
+ // for ( int i = 0; i < 9; i++)
+ // reorder_table[i] = reorder(sfBandIndex[i].s);
+ // }
+ //
+ // // Sftable
+ // int[] ll0 = { 0, 6, 11, 16, 21 };
+ // int[] ss0 = { 0, 6, 12 };
+ // sftable = new Sftable(ll0, ss0);
+ // // END OF Sftable
+ //
+ // // scalefac_buffer
+ // scalefac_buffer = new int[54];
+ // // END OF scalefac_buffer
+ //
+ // // header = header0;
+ // filter1 = filtera;
+ // filter2 = filterb;
+ // // buffer = buffer0;
+ // which_channels = which_ch0;
+ //
+ // frame_start = 0;
+ // channels = (header.mode() == Header.SINGLE_CHANNEL) ? 1 : 2;
+ // max_gr = (header.version() == Header.MPEG1) ? 2 : 1;
+ //
+ // sfreq =
+ // header.sample_frequency()
+ // + ((header.version() == Header.MPEG1) ? 3 : (header.version() ==
+ // Header.MPEG25_LSF) ? 6
+ // : 0); // SZD
+ //
+ // if (channels == 2) {
+ // switch (which_channels) {
+ // case OutputChannels.LEFT_CHANNEL:
+ // case OutputChannels.DOWNMIX_CHANNELS:
+ // first_channel = last_channel = 0;
+ // break;
+ //
+ // case OutputChannels.RIGHT_CHANNEL:
+ // first_channel = last_channel = 1;
+ // break;
+ //
+ // case OutputChannels.BOTH_CHANNELS:
+ // default:
+ // first_channel = 0;
+ // last_channel = 1;
+ // break;
+ // }
+ // } else {
+ // first_channel = last_channel = 0;
+ // }
+ //
+ // for ( int ch = 0; ch < 2; ch++)
+ // for ( int j = 0; j < 576; j++)
+ // prevblck[ch][j] = 0.0f;
+ //
+ // nonzero[0] = nonzero[1] = 576;
+ //
+ // br = new BitReserve();
+ // si = new III_side_info_t();
+ // }
+
+ /**
+ * Notify decoder that a seek is being made.
+ */
+
+ public void seek_notify() {
+ frame_start = 0;
+ for ( int ch = 0; ch < 2; ch++)
+ for ( int j = 0; j < 576; j++)
+ prevblck[ch][j] = 0.0f;
+ br = new BitReserve();
+ }
+
+ public void decodeFrame( Header header) {
+ decode(header);
+ }
+
+ /**
+ * Decode one frame, filling the buffer with the output samples.
+ */
+
+ // subband samples are buffered and passed to the
+ // SynthesisFilter in one go.
+
+ private float[] samples1 = new float[32];
+
+ private float[] samples2 = new float[32];
+
+ private int filter_pos;
+
+ /*
+ * location hierarchy of decode() {header} {stream} {si} {br, flush_main,
+ * main_data_end,frame_start,nSlots,bytes_to_discard}* {gr,max_gr} // granule
+ * {ch,channels,first_channel, last_channel, which_channels} // channel
+ * {part2_start} {sb18, ss} {out_1d}* {sb}* {samples1,sample2}
+ * {filter1,filter2}
+ */
+ //
+
+ public void decode( Header header) {
+
+ // if (!initialized) {
+ // init(header);
+ // }
+
+ // overwrites once per a loop
+ SSJAVA.arrayinit(samples1, 0);
+ SSJAVA.arrayinit(samples2, 0);
+ SSJAVA.arrayinit(ro, 2, SBLIMIT, SSLIMIT, 0);
+ SSJAVA.arrayinit(lr, 2, SBLIMIT, SSLIMIT, 0);
+ SSJAVA.arrayinit(is_pos, 7);
+ SSJAVA.arrayinit(is_ratio, 0);
+ SSJAVA.arrayinit(out_1d, 0);
+ SSJAVA.arrayinit(inter, 0);
+ SSJAVA.arrayinit(k, 2, SBLIMIT * SSLIMIT, 0);
+ SSJAVA.arrayinit(is_1d, 0);
+ SSJAVA.arrayinit(tsOutCopy, 0);
+ SSJAVA.arrayinit(scalefac_buffer, 0);
+ SSJAVA.arrayinit(nonzero, 576);
+ SSJAVA.arrayinit(new_slen, 0);
+
+ SSJAVA.arrayinit(raw_full, 2, SBLIMIT * SSLIMIT, 0);
+ SSJAVA.arrayinit(rawout, 0);
+ CheckSumHuff = 0;
+ // prevblck = new float[2][SBLIMIT * SSLIMIT];
+ si = new III_side_info_t();
+ //
+
+ int nSlots = header.slots();
+
+ int gr;
+ int ch;
+
+ int ss;
+ int sb;
+ int sb18;
+
+ int main_data_end;
+ int flush_main;
+
+ int bytes_to_discard;
+ int i;
+
+ // modifications for linear type
+ get_side_info(header);
+ br = header.getBitReserve();
+
+ int version = header.version();
+
+ // additional codes for the definitely written property
+ filter_pos = (header.getIdx() * 4) & 0xf;
+ filter1.vidx = 1;
+ filter2.vidx = 1;
+ filter1.actual_write_pos = filter_pos;
+ filter2.actual_write_pos = filter_pos;
+
+ // here 'gr' and 'max_gr' should be higher than 'ch','channels', and more
+ for (gr = 0; gr < max_gr; gr++) { // two granules per channel
+ // in the loop body, access set={part2_start}
+
+ // 'ch', 'channels' should be higher than all locs in the below body
+ for (ch = 0; ch < channels; ch++) {
+ // part2_start = br.hsstell();
+ int part2_start_local = br.hsstell();
+
+ // grab scale factors from the main data.
+ // following the scale factors is the actual compressed data
+ if (version == Header.MPEG1)
+ get_scale_factors(header, ch, gr); // no need to care from this side
+ // here move scale factor data from 'br' buffer to 'scalefac' field
+ else
+ // MPEG-2 LSF, SZD: MPEG-2.5 LSF
+ get_LSF_scale_factors(header, ch, gr); // no need to care from this
+ // side
+
+ // here, decoding the compressed audio data
+ huffman_decode(part2_start_local, ch, gr); // no need to care from this
+ // side
+ // System.out.println("CheckSum HuffMan = " + CheckSumHuff);
+ dequantize_sample(/* ro[ch], */ch, gr); // no need to care from this
+ // side
+ }
+
+ stereo(header, gr); // no need to care from this side
+
+ if ((which_channels == OutputChannels.DOWNMIX_CHANNELS) && (channels > 1)) {
+ do_downmix();
+ }
+
+ for (ch = first_channel; ch <= last_channel; ch++) { // 'ch' and
+ // 'first_channel' >
+ // the body
+
+ reorder(/* lr[ch], */ch, gr);
+ antialias(ch, gr);
+
+ // float CheckSumOut1d=0;
+ // for (int hb = 0;hb<576;hb++) {
+ // CheckSumOut1d = CheckSumOut1d + out_1d[hb];
+ // }
+ // System.out.println("CheckSumOut1d = "+CheckSumOut1d);
+
+ for ( int index = 0; index < 576; index++) {
+ out_1d[index] = inter[index];
+ }
+
+ hybrid(ch, gr);
+
+ // float CheckSumOut1d=0;
+ // for (int hb = 0;hb<576;hb++) {
+ // CheckSumOut1d = CheckSumOut1d + out_1d[hb];
+ // }
+ // System.out.println("CheckSumOut1d = "+CheckSumOut1d);
+
+ for (sb18 = 18; sb18 < 576; sb18 += 36) {
+ // sb18 > ss, SSLIMIT, out1d
+ // Frequency inversion
+ for (ss = 1; ss < SSLIMIT; ss += 2) {
+ // 'ss','SSLIMIT' > out_1d
+ out_1d[sb18 + ss] = -out_1d[sb18 + ss]; // out1d*
+ }
+ }
+
+ // 'ch', 'which_channels' should be higher than if/else body!
+ // location set written by if/else body
+ // = {samples1, samples2, filter1, filter2}
+ if ((ch == 0) || (which_channels == OutputChannels.RIGHT_CHANNEL)) {
+ for (ss = 0; ss < SSLIMIT; ss++) { // Polyphase synthesis
+ sb = 0;
+ for (sb18 = 0; sb18 < 576; sb18 += 18) {
+ samples1[sb] = out_1d[sb18 + ss]; // out_1d > samples1
+ // filter1.input_sample(out_1d[sb18+ss], sb);
+ sb++; // sb should be loc*
+ }
+ filter1.input_samples(samples1);
+ // System.out.println("filter1 writepos=" + filter1.actual_write_pos
+ // + " vidx=" + filter1.vidx);
+ filter1.calculate_pcm_samples();
+ }
+ } else {
+ for (ss = 0; ss < SSLIMIT; ss++) { // Polyphase synthesis
+ sb = 0;
+ for (sb18 = 0; sb18 < 576; sb18 += 18) {
+ samples2[sb] = out_1d[sb18 + ss]; // out_1d > samples2
+ // filter2.input_sample(out_1d[sb18+ss], sb);
+ sb++;
+ }
+ filter2.input_samples(samples2);
+ filter2.calculate_pcm_samples();
+ }
+ }
+ // System.out.println("#END CH=" + ch + " actual_write_pos=" +
+ // filter1.actual_write_pos);
+ } // channels
+
+ // TODO
+ if (gr < max_gr - 1) {
+ // init prev
+ SSJAVA.arrayinit(prevblck, 2, SBLIMIT * SSLIMIT, 0);
+ // copy from raw_full to prev
+ SSJAVA.arraycopy(prevblck, raw_full, 2, SBLIMIT * SSLIMIT);
+ }
+ // for (int chidx = 0; chidx < 2; chidx++) {
+ // for (int sidx = 0; sidx < SBLIMIT * SSLIMIT; sidx++) {
+ // prevblck[chidx][sidx] = raw_full[chidx][sidx];
+ // }
+ // }
+ // System.out.println("#END GR=" + gr + " actual_write_pos=" +
+ // filter1.actual_write_pos);
+ } // granule
+
+ // TODO
+ // init prev
+ SSJAVA.arrayinit(prevblck, 2, SBLIMIT * SSLIMIT, 0);
+ // copy from raw_full to prev
+ SSJAVA.arraycopy(prevblck, raw_full, 2, SBLIMIT * SSLIMIT);
+
+ // System.out.println("#END FRAME actual_write_pos=" +
+ // filter1.actual_write_pos);
+
+ filter1.clear();
+ filter2.clear();
+
+ // System.out.println("Counter = ................................."+counter);
+ // if (counter < 609)
+ // {
+ // counter++; // count should be loc*
+ // buffer.write_buffer(1); // buffer!!!
+ // }
+ // else if (counter == 609)
+ // {
+ // buffer.close();
+ // counter++;
+ // }
+ // else
+ // {
+ // }
+
+ }
+
+ /**
+ * Reads the side info from the stream, assuming the entire. frame has been
+ * read already. Mono : 136 bits (= 17 bytes) Stereo : 256 bits (= 32 bytes)
+ */
+
+ private boolean get_side_info( Header header) {
+
+ SideInfoBuffer sib =
+ header.getSideInfoBuffer();
+ int version = header.version();
+
+ int ch;
+ int gr;
+ // System.out.println("#get_side_info");
+ if (version == Header.MPEG1) {
+
+ si.main_data_begin = sib.get_bits(9);
+ if (channels == 1)
+ si.private_bits = sib.get_bits(5);
+ else
+ si.private_bits = sib.get_bits(3);
+
+ for (ch = 0; ch < channels; ch++) {
+ si.ch[ch].scfsi[0] = sib.get_bits(1);
+ si.ch[ch].scfsi[1] = sib.get_bits(1);
+ si.ch[ch].scfsi[2] = sib.get_bits(1);
+ si.ch[ch].scfsi[3] = sib.get_bits(1);
+ }
+
+ // System.out.println("BEFORE GR,CH");
+
+ for (gr = 0; gr < 2; gr++) {
+ // System.out.println("GR=" + gr);
+ for (ch = 0; ch < channels; ch++) {
+ // System.out.println("CH");
+ si.ch[ch].gr[gr].part2_3_length = sib.get_bits(12);
+ si.ch[ch].gr[gr].big_values = sib.get_bits(9);
+ si.ch[ch].gr[gr].global_gain = sib.get_bits(8);
+ si.ch[ch].gr[gr].scalefac_compress = sib.get_bits(4);
+ int cond = sib.get_bits(1);
+ // si.ch[ch].gr[gr].window_switching_flag = sib.get_bits(1);
+ // if ((si.ch[ch].gr[gr].window_switching_flag) != 0) {
+ if (cond != 0) {
+ si.ch[ch].gr[gr].block_type = sib.get_bits(2);
+ si.ch[ch].gr[gr].mixed_block_flag = sib.get_bits(1);
+
+ si.ch[ch].gr[gr].table_select[0] = sib.get_bits(5);
+ si.ch[ch].gr[gr].table_select[1] = sib.get_bits(5);
+
+ si.ch[ch].gr[gr].subblock_gain[0] = sib.get_bits(3);
+ si.ch[ch].gr[gr].subblock_gain[1] = sib.get_bits(3);
+ si.ch[ch].gr[gr].subblock_gain[2] = sib.get_bits(3);
+
+ // Set region_count parameters since they are implicit
+ // in this case.
+
+ if (si.ch[ch].gr[gr].block_type == 0) {
+ // Side info bad: block_type == 0 in split block
+ return false;
+ } else if (si.ch[ch].gr[gr].block_type == 2 && si.ch[ch].gr[gr].mixed_block_flag == 0) {
+ si.ch[ch].gr[gr].region0_count = 8;
+ } else {
+ si.ch[ch].gr[gr].region0_count = 7;
+ }
+ si.ch[ch].gr[gr].region1_count = 20 - si.ch[ch].gr[gr].region0_count;
+ } else {
+ si.ch[ch].gr[gr].table_select[0] = sib.get_bits(5);
+ si.ch[ch].gr[gr].table_select[1] = sib.get_bits(5);
+ si.ch[ch].gr[gr].table_select[2] = sib.get_bits(5);
+ si.ch[ch].gr[gr].region0_count = sib.get_bits(4);
+ si.ch[ch].gr[gr].region1_count = sib.get_bits(3);
+ si.ch[ch].gr[gr].block_type = 0;
+ }
+ //
+ si.ch[ch].gr[gr].window_switching_flag = cond;
+ //
+ si.ch[ch].gr[gr].preflag = sib.get_bits(1);
+ si.ch[ch].gr[gr].scalefac_scale = sib.get_bits(1);
+ si.ch[ch].gr[gr].count1table_select = sib.get_bits(1);
+ }
+ }
+
+ } else { // MPEG-2 LSF, SZD: MPEG-2.5 LSF
+
+ si.main_data_begin = sib.get_bits(8);
+ if (channels == 1)
+ si.private_bits = sib.get_bits(1);
+ else
+ si.private_bits = sib.get_bits(2);
+
+ for (ch = 0; ch < channels; ch++) {
+
+ si.ch[ch].gr[0].part2_3_length = sib.get_bits(12);
+ si.ch[ch].gr[0].big_values = sib.get_bits(9);
+ si.ch[ch].gr[0].global_gain = sib.get_bits(8);
+ si.ch[ch].gr[0].scalefac_compress = sib.get_bits(9);
+
+ int cond = sib.get_bits(1);
+ // si.ch[ch].gr[0].window_switching_flag = sib.get_bits(1);
+ // if ((si.ch[ch].gr[0].window_switching_flag) != 0) {
+ if (cond != 0) {
+
+ si.ch[ch].gr[0].block_type = sib.get_bits(2);
+ si.ch[ch].gr[0].mixed_block_flag = sib.get_bits(1);
+ si.ch[ch].gr[0].table_select[0] = sib.get_bits(5);
+ si.ch[ch].gr[0].table_select[1] = sib.get_bits(5);
+
+ si.ch[ch].gr[0].subblock_gain[0] = sib.get_bits(3);
+ si.ch[ch].gr[0].subblock_gain[1] = sib.get_bits(3);
+ si.ch[ch].gr[0].subblock_gain[2] = sib.get_bits(3);
+
+ // Set region_count parameters since they are implicit in
+ // this case.
+
+ if (si.ch[ch].gr[0].block_type == 0) {
+ // Side info bad: block_type == 0 in split block
+ return false;
+ } else if (si.ch[ch].gr[0].block_type == 2 && si.ch[ch].gr[0].mixed_block_flag == 0) {
+ si.ch[ch].gr[0].region0_count = 8;
+ } else {
+ si.ch[ch].gr[0].region0_count = 7;
+ si.ch[ch].gr[0].region1_count = 20 - si.ch[ch].gr[0].region0_count;
+ }
+
+ } else {
+ si.ch[ch].gr[0].table_select[0] = sib.get_bits(5);
+ si.ch[ch].gr[0].table_select[1] = sib.get_bits(5);
+ si.ch[ch].gr[0].table_select[2] = sib.get_bits(5);
+ si.ch[ch].gr[0].region0_count = sib.get_bits(4);
+ si.ch[ch].gr[0].region1_count = sib.get_bits(3);
+ si.ch[ch].gr[0].block_type = 0;
+ }
+ //
+ si.ch[ch].gr[gr].window_switching_flag = cond;
+ //
+
+ si.ch[ch].gr[0].scalefac_scale = sib.get_bits(1);
+ si.ch[ch].gr[0].count1table_select = sib.get_bits(1);
+ } // for(ch=0; chOutputChannels
instance corresponding to the given
+ * channel code.
+ *
+ * @param code
+ * one of the OutputChannels channel code constants.
+ *
+ * @throws IllegalArgumentException
+ * if code is not a valid channel code.
+ */
+ static public OutputChannels fromInt(int code) {
+ switch (code) {
+ case LEFT_CHANNEL:
+ return LEFT;
+ case RIGHT_CHANNEL:
+ return RIGHT;
+ case BOTH_CHANNELS:
+ return BOTH;
+ case DOWNMIX_CHANNELS:
+ return DOWNMIX;
+ default:
+ throw new IllegalArgumentException("Invalid channel code: " + code);
+ }
+ }
+
+ public OutputChannels( int channels) {
+ outputChannels = channels;
+
+ if (channels < 0 || channels > 3)
+ throw new IllegalArgumentException("channels");
+ }
+
+ /**
+ * Retrieves the code representing the desired output channels. Will be one of
+ * LEFT_CHANNEL, RIGHT_CHANNEL, BOTH_CHANNELS or DOWNMIX_CHANNELS.
+ *
+ * @return the channel code represented by this instance.
+ */
+ public int getChannelsOutputCode() {
+ return outputChannels;
+ }
+
+ /**
+ * Retrieves the number of output channels represented by this channel output
+ * type.
+ *
+ * @return The number of output channels for this channel output type. This
+ * will be 2 for BOTH_CHANNELS only, and 1 for all other types.
+ */
+ public int getChannelCount() {
+ int count = (outputChannels == BOTH_CHANNELS) ? 2 : 1;
+ return count;
+ }
+
+ public boolean equals(Object o) {
+ boolean equals = false;
+
+ if (o instanceof OutputChannels) {
+ OutputChannels oc = (OutputChannels) o;
+ equals = (oc.outputChannels == outputChannels);
+ }
+
+ return equals;
+ }
+
+ public int hashCode() {
+ return outputChannels;
+ }
+
+}
diff --git a/Robust/src/Benchmarks/SSJava/MP3DecoderInfer/Player.java b/Robust/src/Benchmarks/SSJava/MP3DecoderInfer/Player.java
new file mode 100644
index 00000000..f9593476
--- /dev/null
+++ b/Robust/src/Benchmarks/SSJava/MP3DecoderInfer/Player.java
@@ -0,0 +1,261 @@
+import java.awt.image.SampleModel;
+
+import FileOutputStream;
+
+/*
+ * 11/19/04 1.0 moved to LGPL.
+ * 29/01/00 Initial version. mdm@techie.com
+ *-----------------------------------------------------------------------
+ * 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.
+ *----------------------------------------------------------------------
+ */
+
+/**
+ * The Player
class implements a simple player for playback of an
+ * MPEG audio stream.
+ *
+ * @author Mat McGowan
+ * @since 0.0.8
+ */
+
+// REVIEW: the audio device should not be opened until the
+// first MPEG audio frame has been decoded.
+
+public class Player {
+ /**
+ * The current frame number.
+ */
+
+ private int frame = 0;
+
+ /**
+ * The MPEG audio bitstream.
+ */
+ // private Bitstream bitstream;
+
+ /**
+ * The MPEG audio decoder.
+ */
+ /* final */
+ private Decoder decoder;
+
+ /**
+ * The AudioDevice the audio samples are written to.
+ */
+ // private AudioDevice audio;
+
+ /**
+ * Has the player been closed?
+ */
+
+ private boolean closed = false;
+
+ /**
+ * Has the player played back all frames from the stream?
+ */
+
+ private boolean complete = false;
+
+
+ private int lastPosition = 0;
+
+
+ private long sampleNumber;
+
+ /**
+ * Creates a new Player
instance.
+ */
+ public Player() throws JavaLayerException {
+ this(null);
+ }
+
+ public Player(AudioDevice device) throws JavaLayerException {
+ // bitstream = new Bitstream(stream);
+ decoder = new Decoder();
+
+ // if (device!=null)
+ // {
+ // audio = device;
+ // }
+ // else
+ // {
+ // FactoryRegistry r = FactoryRegistry.systemRegistry();
+ // audio = r.createAudioDevice();
+ // }
+
+ device.open(decoder);
+ }
+
+ public void play() throws JavaLayerException {
+ play(Integer.MAX_VALUE);
+ }
+
+ /**
+ * Plays a number of MPEG audio frames.
+ *
+ * @param frames
+ * The number of frames to play.
+ * @return true if the last frame was played, or false if there are more
+ * frames.
+ */
+
+
+ public boolean play( int frames) throws JavaLayerException {
+ boolean ret = true;
+
+ // initialization before ssjava loop
+ boolean init = true;
+ Header h = BitstreamWrapper.readFrame();
+ decoder.init(h);
+
+ sampleNumber = 1;
+ System.out.println("Gobble sentinel: +++");
+
+ // int count = 0;
+ SSJAVA: while (true) {
+ if (h == null) {
+ break;
+ }
+ ret = decodeFrame(init, h);
+ if (!ret) {
+ break;
+ }
+ h = BitstreamWrapper.readFrame();
+ }
+
+ /*
+ * if (!ret) { // last frame, ensure all data flushed to the audio device.
+ * AudioDevice out = audio; if (out!=null) { out.flush(); synchronized
+ * (this) { complete = (!closed); close(); } } }
+ */
+ return ret;
+ }
+
+ /**
+ * Cloases this player. Any audio currently playing is stopped immediately.
+ */
+
+ public synchronized void close() {
+ /*
+ * AudioDevice out = audio; if (out!=null) { closed = true; audio = null; //
+ * this may fail, so ensure object state is set up before // calling this
+ * method. out.close(); lastPosition = out.getPosition(); try {
+ * bitstream.close(); } catch (BitstreamException ex) { } }
+ */
+ }
+
+ /**
+ * Returns the completed status of this player.
+ *
+ * @return true if all available MPEG audio frames have been decoded, or false
+ * otherwise.
+ */
+ public synchronized boolean isComplete() {
+ return complete;
+ }
+
+ /**
+ * Retrieves the position in milliseconds of the current audio sample being
+ * played. This method delegates to the
+ * AudioDevice
that is used by this player to sound the decoded audio
+ * samples.
+ */
+ public int getPosition() {
+ // int position = lastPosition;
+
+ // AudioDevice out = audio;
+ // if (out!=null)
+ // {
+ // position = out.getPosition();
+ // }
+ // return position;
+ return 0;
+ }
+
+ /**
+ * Decodes a single frame.
+ *
+ * @return true if there are no more frames to decode, false otherwise.
+ */
+
+ protected boolean decodeFrame( boolean init, Header h)
+ throws JavaLayerException {
+ try {
+ // AudioDevice out = audio;
+ // if (out==null)
+ // return false;
+
+ // Header h = bitstream.readFrame();
+
+ // if (h == null){
+ // return false;
+ // }
+
+ // SampleBuffer output = (SampleBuffer) decoder.decodeFrame(h);
+ decoder.decodeFrame(h);
+
+// DEBUG_OUTPUT_CHECKSUM();
+// DEBUG_OUTPUT();
+ // synchronized (this)
+ // {
+ // out = audio;
+ // if (out!=null)
+ // {
+ // out.write(output.getBuffer(), 0, output.getBufferLength());
+ // }
+ // }
+
+ // bitstream.closeFrame();
+ } catch (RuntimeException ex) {
+ throw new JavaLayerException("Exception decoding audio frame", ex);
+ }
+ /*
+ * catch (IOException ex) {
+ * System.out.println("exception decoding audio frame: "+ex); return false;
+ * } catch (BitstreamException bitex) {
+ * System.out.println("exception decoding audio frame: "+bitex); return
+ * false; } catch (DecoderException decex) {
+ * System.out.println("exception decoding audio frame: "+decex); return
+ * false; }
+ */
+ return true;
+ }
+
+ @TRUST
+ public void DEBUG_OUTPUT() {
+ // it looks like there is left and right channel interleaved into the
+ // output buffer, so only sample one channel (stride=2)
+ short[] outbuf = SampleBufferWrapper.getBuffer();
+ for (int i = 0; i < SampleBufferWrapper.getBufferLength(); i = i + 2) {
+ System.out.println(sampleNumber + " " + outbuf[i]);
+ sampleNumber++;
+ }
+ }
+
+ @TRUST
+ public void DEBUG_OUTPUT_CHECKSUM() {
+ // eom debug
+ int sum = 0;
+ short[] outbuf = SampleBufferWrapper.getBuffer();
+ // short[] outbuf = output.getBuffer();
+ TERMINATE: for ( int i = 0; i < SampleBufferWrapper.getBufferLength(); i++) {
+ // System.out.println(outbuf[i]);
+ sum += outbuf[i];
+ }
+ System.out.println(sum);
+ //
+ }
+
+}
diff --git a/Robust/src/Benchmarks/SSJava/MP3DecoderInfer/SampleBuffer.java b/Robust/src/Benchmarks/SSJava/MP3DecoderInfer/SampleBuffer.java
new file mode 100644
index 00000000..5e710561
--- /dev/null
+++ b/Robust/src/Benchmarks/SSJava/MP3DecoderInfer/SampleBuffer.java
@@ -0,0 +1,177 @@
+/*
+ * 11/19/04 1.0 moved to LGPL.
+ *
+ * 12/12/99 Initial Version based on FileObuffer. mdm@techie.com.
+ *
+ * FileObuffer:
+ * 15/02/99 Java Conversion by E.B ,javalayer@javazoom.net
+ *
+ *-----------------------------------------------------------------------
+ * 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.
+ *----------------------------------------------------------------------
+ */
+
+/**
+ * The SampleBuffer
class implements an output buffer that provides
+ * storage for a fixed size block of samples.
+ */
+
+
+public class SampleBuffer extends Obuffer {
+
+ private short[] buffer;
+
+ private int[] bufferp;
+
+ private int channels;
+
+ private int frequency;
+
+ private int idx;
+
+ static public long sampleNumber = 0;
+
+ /**
+ * Constructor
+ */
+ public SampleBuffer( int sample_frequency, int number_of_channels) {
+ buffer = new short[OBUFFERSIZE];
+ bufferp = new int[MAXCHANNELS];
+ channels = number_of_channels; // [IN] -> [D]
+ frequency = sample_frequency; // [IN] -> [D]
+
+ for ( int i = 0; i < number_of_channels; ++i) {
+ bufferp[i] = (short) i; // LOC(bufferp[i]) has indirect flows from the
+ // location C, IN
+ // also, it has a direct flow from C
+ // anyway, LOC(bufferp[i])=[D,SampleBuffer.BUFP] is lower than all
+ // locations that have in-flows
+ }
+
+ }
+
+ public int getChannelCount() {
+ return this.channels;
+ }
+
+ public int getSampleFrequency() {
+ return this.frequency;
+ }
+
+ public short[] getBuffer() {
+ return this.buffer;
+ }
+
+ public int getBufferLength() {
+ return bufferp[0];
+ }
+
+ /**
+ * Takes a 16 Bit PCM sample.
+ */
+ public void append( int channel, short value) {
+ buffer[bufferp[channel]] = value;
+ // LOC(bufferp[channel])= [local.D,SampleBuffer.BUF]
+ // so, for LHS, LOC(buffer) < LOC(bufferp[channle])
+ // also, bet' LHS and RHS, LOC(LHS) < LOC(RHS) since LOC(value)=[IN]
+
+ bufferp[channel] += channels;
+ // for lhs, LOC(bufferp[channel]) = [local.D, SampleBuffer.BUFP]
+ // for rhs, LOC(channels) = [local.D, SampleBuffer.CON]
+
+ }
+
+
+ public void appendSamples( int channel, float[] f) {
+ int pos = bufferp[channel];
+ // LOC(bufferp[channel])=[D,SampleBuffer.BUFP]
+ // LOC(pos)=[D,SampleBuffer.BUFP]
+
+ short s;
+ float fs;
+
+ for ( int i = 0; i < 32;) {
+ fs = f[i++]; // [IN] -> [D,BUFP]
+
+ if (fs > 32767.0f) {
+ fs = 32767.0f;
+ // it has an indirect flow from LOC(fs)
+ // since LOC(fs) is a shared location, it's okay
+ } else {
+ if (fs < -32767.0f) {
+ fs = -32767.0f;
+ }
+ }
+
+ /*
+ * fs = (fs>32767.0f ? 32767.0f : (fs < -32767.0f ? -32767.0f : fs));
+ */
+
+ s = (short) fs; // it's okay since BUFP of [D,BUFP] is a shared location
+ buffer[pos] = s;
+
+ // DEBUG_OUTPUT(pos, s);
+
+ // for LHS, LOC(buffer[pos])= GLB( [D,BUF] , [D,BUFP] ) = [D,BUF]
+ // for RHS, LOC(s) = [D,BUFP]
+ // so it's okay: [D,BUFP] -> [D,BUF]
+
+ pos += channels; // [D,BUFP] -> [D,BUFP]
+ }
+
+ bufferp[channel] = pos;
+ // for lhs, LOC(bufferp[channel])=[D,BUFP]
+ // for rhs, LOC(pos)=[D,BUFP]
+ // since BUFP is a shared location, the assignment is okay
+ }
+
+ /**
+ * Write the samples to the file (Random Acces).
+ */
+ public void write_buffer( int val) {
+
+ // for (int i = 0; i < channels; ++i)
+ // bufferp[i] = (short)i;
+
+ }
+
+ public void close() {
+ }
+
+ /**
+ *
+ */
+
+ public void clear_buffer() {
+ for (idx = 0; idx < channels; ++idx)
+ bufferp[idx] = (short) idx;
+ }
+
+ /**
+ *
+ */
+ public void set_stop_flag() {
+ }
+
+ @TRUST
+ private void DEBUG_OUTPUT(int pos, short s) {
+ // there is left and right channel interleaved into the
+ // output buffer, so only sample one channel (stride=2)
+ if (pos % 2 == 0) {
+ System.out.println(sampleNumber + " " + s);
+ sampleNumber++;
+ }
+ }
+}
diff --git a/Robust/src/Benchmarks/SSJava/MP3DecoderInfer/SampleBufferWrapper.java b/Robust/src/Benchmarks/SSJava/MP3DecoderInfer/SampleBufferWrapper.java
new file mode 100644
index 00000000..5c691eb2
--- /dev/null
+++ b/Robust/src/Benchmarks/SSJava/MP3DecoderInfer/SampleBufferWrapper.java
@@ -0,0 +1,35 @@
+public class SampleBufferWrapper {
+
+ static SampleBuffer output;
+
+ @TRUST
+ static void init(int freq, int channels) {
+ output = new SampleBuffer(freq, channels);
+ }
+
+ @TRUST
+ static void clear_buffer(){
+ output.clear_buffer();
+ }
+
+ @TRUST
+ static SampleBuffer getOutput() {
+ return output;
+ }
+
+ @TRUST
+ static short[] getBuffer() {
+ return output.getBuffer();
+ }
+
+ @TRUST
+ static int getBufferLength() {
+ return output.getBufferLength();
+ }
+
+ @TRUST
+ static void appendSamples(int channel, float[] f) {
+ output.appendSamples(channel, f);
+ }
+
+}
diff --git a/Robust/src/Benchmarks/SSJava/MP3DecoderInfer/SideInfoBuffer.java b/Robust/src/Benchmarks/SSJava/MP3DecoderInfer/SideInfoBuffer.java
new file mode 100644
index 00000000..d62c4885
--- /dev/null
+++ b/Robust/src/Benchmarks/SSJava/MP3DecoderInfer/SideInfoBuffer.java
@@ -0,0 +1,89 @@
+
+
+public class SideInfoBuffer {
+
+ /**
+ * The frame buffer that holds the data for the current frame.
+ */
+
+ private final int[] framebuffer = new int[BUFFER_INT_SIZE];
+
+ /**
+ * Maximum size of the frame buffer.
+ */
+ private static final int BUFFER_INT_SIZE = 433;
+
+ /**
+ * Index into framebuffer
where the next bits are retrieved.
+ */
+
+ private int wordpointer;
+
+ /**
+ * Number (0-31, from MSB to LSB) of next bit for get_bits()
+ */
+
+ private int bitindex;
+
+
+ private int main_data_begin;
+
+ public int getMain_data_begin() {
+ return main_data_begin;
+ }
+
+ public void setMain_data_begin( int main_data_begin) {
+ this.main_data_begin = main_data_begin;
+ }
+
+ private static final int bitmask[] = {
+ 0, // dummy
+ 0x00000001, 0x00000003, 0x00000007, 0x0000000F, 0x0000001F, 0x0000003F, 0x0000007F,
+ 0x000000FF, 0x000001FF, 0x000003FF, 0x000007FF, 0x00000FFF, 0x00001FFF, 0x00003FFF,
+ 0x00007FFF, 0x0000FFFF, 0x0001FFFF };
+
+
+ public int get_bits( int number_of_bits) {
+ int returnvalue = 0;
+ int sum = bitindex + number_of_bits;
+ // System.out.println("bitindex=" + bitindex + " wordpointer="
+ // + wordpointer);
+ // E.B
+ // There is a problem here, wordpointer could be -1 ?!
+ if (wordpointer < 0)
+ wordpointer = 0;
+ // E.B : End.
+
+ if (sum <= 32) {
+ // all bits contained in *wordpointer
+ returnvalue = (framebuffer[wordpointer] >>> (32 - sum)) & bitmask[number_of_bits];
+ // returnvalue = (wordpointer[0] >> (32 - sum)) &
+ // bitmask[number_of_bits];
+ if ((bitindex += number_of_bits) == 32) {
+ bitindex = 0;
+ wordpointer++; // added by me!
+ }
+ return returnvalue;
+ }
+
+ // E.B : Check that ?
+ // ((short[])&returnvalue)[0] = ((short[])wordpointer + 1)[0];
+ // wordpointer++; // Added by me!
+ // ((short[])&returnvalue + 1)[0] = ((short[])wordpointer)[0];
+ int Right = (framebuffer[wordpointer] & 0x0000FFFF);
+ wordpointer++;
+ int Left = (framebuffer[wordpointer] & 0xFFFF0000);
+ returnvalue = ((Right << 16) & 0xFFFF0000) | ((Left >>> 16) & 0x0000FFFF);
+
+ returnvalue >>>= 48 - sum; // returnvalue >>= 16 - (number_of_bits - (32
+ // - bitindex))
+ returnvalue &= bitmask[number_of_bits];
+ bitindex = sum - 32;
+ return returnvalue;
+ }
+
+ public void setBuffer(int idx, int value) {
+ framebuffer[idx] = value;
+ }
+
+}
diff --git a/Robust/src/Benchmarks/SSJava/MP3DecoderInfer/Source.java b/Robust/src/Benchmarks/SSJava/MP3DecoderInfer/Source.java
new file mode 100644
index 00000000..ad2f0c91
--- /dev/null
+++ b/Robust/src/Benchmarks/SSJava/MP3DecoderInfer/Source.java
@@ -0,0 +1,48 @@
+/*
+ * 11/19/04 1.0 moved to LGPL.
+ *-----------------------------------------------------------------------
+ * 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.
+ *----------------------------------------------------------------------
+ */
+
+
+import java.io.IOException;
+
+/**
+ * Work in progress.
+ *
+ * Class to describe a seekable data source.
+ *
+ */
+public interface Source
+{
+
+ public static final long LENGTH_UNKNOWN = -1;
+
+ public int read(byte[] b, int offs, int len)
+ throws IOException;
+
+
+ public boolean willReadBlock();
+
+ public boolean isSeekable();
+
+ public long length();
+
+ public long tell();
+
+ public long seek(long pos);
+
+}
diff --git a/Robust/src/Benchmarks/SSJava/MP3DecoderInfer/Subband.java b/Robust/src/Benchmarks/SSJava/MP3DecoderInfer/Subband.java
new file mode 100644
index 00000000..cadd0af3
--- /dev/null
+++ b/Robust/src/Benchmarks/SSJava/MP3DecoderInfer/Subband.java
@@ -0,0 +1,44 @@
+//package ssJava.mp3decoder;
+
+/**
+ * Abstract base class for subband classes of layer I and II
+ */
+
+
+static abstract class Subband {
+ /*
+ * Changes from version 1.1 to 1.2: - array size increased by one, although a
+ * scalefactor with index 63 is illegal (to prevent segmentation faults)
+ */
+ // Scalefactors for layer I and II, Annex 3-B.1 in ISO/IEC DIS 11172:
+ public static final float scalefactors[] = { 2.00000000000000f, 1.58740105196820f,
+ 1.25992104989487f, 1.00000000000000f, 0.79370052598410f, 0.62996052494744f,
+ 0.50000000000000f, 0.39685026299205f, 0.31498026247372f, 0.25000000000000f,
+ 0.19842513149602f, 0.15749013123686f, 0.12500000000000f, 0.09921256574801f,
+ 0.07874506561843f, 0.06250000000000f, 0.04960628287401f, 0.03937253280921f,
+ 0.03125000000000f, 0.02480314143700f, 0.01968626640461f, 0.01562500000000f,
+ 0.01240157071850f, 0.00984313320230f, 0.00781250000000f, 0.00620078535925f,
+ 0.00492156660115f, 0.00390625000000f, 0.00310039267963f, 0.00246078330058f,
+ 0.00195312500000f, 0.00155019633981f, 0.00123039165029f, 0.00097656250000f,
+ 0.00077509816991f, 0.00061519582514f, 0.00048828125000f, 0.00038754908495f,
+ 0.00030759791257f, 0.00024414062500f, 0.00019377454248f, 0.00015379895629f,
+ 0.00012207031250f, 0.00009688727124f, 0.00007689947814f, 0.00006103515625f,
+ 0.00004844363562f, 0.00003844973907f, 0.00003051757813f, 0.00002422181781f,
+ 0.00001922486954f, 0.00001525878906f, 0.00001211090890f, 0.00000961243477f,
+ 0.00000762939453f, 0.00000605545445f, 0.00000480621738f, 0.00000381469727f,
+ 0.00000302772723f, 0.00000240310869f, 0.00000190734863f, 0.00000151386361f,
+ 0.00000120155435f, 0.00000000000000f /* illegal scalefactor */
+ };
+
+ public abstract void read_allocation( Bitstream stream, Header header,
+ Crc16 crc) throws DecoderException;
+
+ public abstract void read_scalefactor( Bitstream stream, Header header);
+
+
+ public abstract boolean read_sampledata( Bitstream stream);
+
+
+ public abstract boolean put_next_sample( int channels,
+ SynthesisFilter filter1, SynthesisFilter filter2);
+};
diff --git a/Robust/src/Benchmarks/SSJava/MP3DecoderInfer/SynthesisFilter.java b/Robust/src/Benchmarks/SSJava/MP3DecoderInfer/SynthesisFilter.java
new file mode 100644
index 00000000..6641d730
--- /dev/null
+++ b/Robust/src/Benchmarks/SSJava/MP3DecoderInfer/SynthesisFilter.java
@@ -0,0 +1,2231 @@
+/*
+ * 11/19/04 1.0 moved to LGPL.
+ *
+ * 04/01/00 Fixes for running under build 23xx Microsoft JVM. mdm.
+ *
+ * 19/12/99 Performance improvements to compute_pcm_samples().
+ * Mat McGowan. mdm@techie.com.
+ *
+ * 16/02/99 Java Conversion by E.B , javalayer@javazoom.net
+ *
+ * @(#) synthesis_filter.h 1.8, last edit: 6/15/94 16:52:00
+ * @(#) Copyright (C) 1993, 1994 Tobias Bading (bading@cs.tu-berlin.de)
+ * @(#) Berlin University of Technology
+ *
+ *-----------------------------------------------------------------------
+ * 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.
+ *----------------------------------------------------------------------
+ */
+
+/**
+ * A class for the synthesis filter bank. This class does a fast downsampling
+ * from 32, 44.1 or 48 kHz to 8 kHz, if ULAW is defined. Frequencies above 4 kHz
+ * are removed by ignoring higher subbands.
+ */
+
+
+final class SynthesisFilter {
+
+
+ public int vidx;
+
+ public float[] v1;
+
+ public float[] v2;
+
+
+ public float[] prev1;
+
+ public float[] prev2;
+
+ // private float[] actual_v; // v1 or v2
+
+ public int actual_write_pos; // 0-15
+
+ private float[] samples; // 32 new subband samples
+
+ public final int channel;
+
+ public final float scalefactor;
+
+ private float[] eq;
+
+ /**
+ * Quality value for controlling CPU usage/quality tradeoff.
+ */
+ /*
+ * private int quality;
+ *
+ * private int v_inc;
+ *
+ *
+ *
+ * public static final int HIGH_QUALITY = 1; public static final int
+ * MEDIUM_QUALITY = 2; public static final int LOW_QUALITY = 4;
+ */
+
+ /**
+ * Contructor. The scalefactor scales the calculated float pcm samples to
+ * short values (raw pcm samples are in [-1.0, 1.0], if no violations occur).
+ */
+ public SynthesisFilter(int channelnumber, float factor, float[] eq0) {
+
+ vidx = 1;
+ d16 = splitArray(d, 16);
+
+ v1 = new float[512];
+ v2 = new float[512];
+ prev1 = new float[512];
+ prev2 = new float[512];
+ samples = new float[32];
+ channel = channelnumber;
+ scalefactor = factor;
+ // setEQ(eq);
+ // setQuality(HIGH_QUALITY);
+
+ if (eq == null) {
+ eq = new float[32];
+ for (int i = 0; i < 32; i++)
+ eq[i] = 1.0f;
+ }
+ if (eq.length < 32) {
+ throw new IllegalArgumentException("eq0");
+ }
+
+ // reset();
+
+ for (int p = 0; p < 512; p++)
+ v1[p] = v2[p] = 0.0f;
+
+ for (int p2 = 0; p2 < 32; p2++)
+ samples[p2] = 0.0f;
+
+ // actual_v = v1;
+ actual_write_pos = 15;
+
+ }
+
+ /*
+ * private void setQuality(int quality0) { switch (quality0) { case
+ * HIGH_QUALITY: case MEDIUM_QUALITY: case LOW_QUALITY: v_inc = 16 * quality0;
+ * quality = quality0; break; default : throw new
+ * IllegalArgumentException("Unknown quality value"); } }
+ *
+ * public int getQuality() { return quality; }
+ */
+
+ /**
+ * Inject Sample.
+ */
+ public void input_sample( float sample, int subbandnumber) {
+ samples[subbandnumber] = eq[subbandnumber] * sample;
+ }
+
+ public void input_samples( float[] s) {
+ TERMINATE: for ( int i = 31; i >= 0; i--) {
+ samples[i] = s[i] * eq[i];
+ }
+ }
+
+ private void compute_new_v2_v1() {
+
+ float new_v0 = 0.0f;
+ float new_v1 = 0.0f;
+ float new_v2 = 0.0f;
+ float new_v3 = 0.0f;
+ float new_v4 = 0.0f;
+ float new_v5 = 0.0f;
+ float new_v6 = 0.0f;
+ float new_v7 = 0.0f;
+ float new_v8 = 0.0f;
+ float new_v9 = 0.0f;
+ float new_v10 = 0.0f;
+ float new_v11 = 0.0f;
+ float new_v12 = 0.0f;
+ float new_v13 = 0.0f;
+ float new_v14 = 0.0f;
+ float new_v15 = 0.0f;
+ float new_v16 = 0.0f;
+ float new_v17 = 0.0f;
+ float new_v18 = 0.0f;
+ float new_v19 = 0.0f;
+ float new_v20 = 0.0f;
+ float new_v21 = 0.0f;
+ float new_v22 = 0.0f;
+ float new_v23 = 0.0f;
+ float new_v24 = 0.0f;
+ float new_v25 = 0.0f;
+ float new_v26 = 0.0f;
+ float new_v27 = 0.0f;
+ float new_v28 = 0.0f;
+ float new_v29 = 0.0f;
+ float new_v30 = 0.0f;
+ float new_v31 = 0.0f;
+
+ // float[] new_v = new float[32]; // new V[0-15] and V[33-48] of Figure
+ // 3-A.2 in ISO DIS 11172-3
+ // float[] p = new float[16];
+ // float[] pp = new float[16];
+
+ // float[] s = samples;
+
+ float s0 = samples[0];
+ float s1 = samples[1];
+ float s2 = samples[2];
+ float s3 = samples[3];
+ float s4 = samples[4];
+ float s5 = samples[5];
+ float s6 = samples[6];
+ float s7 = samples[7];
+ float s8 = samples[8];
+ float s9 = samples[9];
+ float s10 = samples[10];
+ float s11 = samples[11];
+ float s12 = samples[12];
+ float s13 = samples[13];
+ float s14 = samples[14];
+ float s15 = samples[15];
+ float s16 = samples[16];
+ float s17 = samples[17];
+ float s18 = samples[18];
+ float s19 = samples[19];
+ float s20 = samples[20];
+ float s21 = samples[21];
+ float s22 = samples[22];
+ float s23 = samples[23];
+ float s24 = samples[24];
+ float s25 = samples[25];
+ float s26 = samples[26];
+ float s27 = samples[27];
+ float s28 = samples[28];
+ float s29 = samples[29];
+ float s30 = samples[30];
+ float s31 = samples[31];
+
+ float p0 = s0 + s31;
+ float p1 = s1 + s30;
+ float p2 = s2 + s29;
+ float p3 = s3 + s28;
+ float p4 = s4 + s27;
+ float p5 = s5 + s26;
+ float p6 = s6 + s25;
+ float p7 = s7 + s24;
+ float p8 = s8 + s23;
+ float p9 = s9 + s22;
+ float p10 = s10 + s21;
+ float p11 = s11 + s20;
+ float p12 = s12 + s19;
+ float p13 = s13 + s18;
+ float p14 = s14 + s17;
+ float p15 = s15 + s16;
+
+ float pp0 = p0 + p15;
+ float pp1 = p1 + p14;
+ float pp2 = p2 + p13;
+ float pp3 = p3 + p12;
+ float pp4 = p4 + p11;
+ float pp5 = p5 + p10;
+ float pp6 = p6 + p9;
+ float pp7 = p7 + p8;
+ float pp8 = (p0 - p15) * cos1_32;
+ float pp9 = (p1 - p14) * cos3_32;
+ float pp10 = (p2 - p13) * cos5_32;
+ float pp11 = (p3 - p12) * cos7_32;
+ float pp12 = (p4 - p11) * cos9_32;
+ float pp13 = (p5 - p10) * cos11_32;
+ float pp14 = (p6 - p9) * cos13_32;
+ float pp15 = (p7 - p8) * cos15_32;
+
+ p0 = pp0 + pp7;
+ p1 = pp1 + pp6;
+ p2 = pp2 + pp5;
+ p3 = pp3 + pp4;
+ p4 = (pp0 - pp7) * cos1_16;
+ p5 = (pp1 - pp6) * cos3_16;
+ p6 = (pp2 - pp5) * cos5_16;
+ p7 = (pp3 - pp4) * cos7_16;
+ p8 = pp8 + pp15;
+ p9 = pp9 + pp14;
+ p10 = pp10 + pp13;
+ p11 = pp11 + pp12;
+ p12 = (pp8 - pp15) * cos1_16;
+ p13 = (pp9 - pp14) * cos3_16;
+ p14 = (pp10 - pp13) * cos5_16;
+ p15 = (pp11 - pp12) * cos7_16;
+
+ pp0 = p0 + p3;
+ pp1 = p1 + p2;
+ pp2 = (p0 - p3) * cos1_8;
+ pp3 = (p1 - p2) * cos3_8;
+ pp4 = p4 + p7;
+ pp5 = p5 + p6;
+ pp6 = (p4 - p7) * cos1_8;
+ pp7 = (p5 - p6) * cos3_8;
+ pp8 = p8 + p11;
+ pp9 = p9 + p10;
+ pp10 = (p8 - p11) * cos1_8;
+ pp11 = (p9 - p10) * cos3_8;
+ pp12 = p12 + p15;
+ pp13 = p13 + p14;
+ pp14 = (p12 - p15) * cos1_8;
+ pp15 = (p13 - p14) * cos3_8;
+
+ p0 = pp0 + pp1;
+ p1 = (pp0 - pp1) * cos1_4;
+ p2 = pp2 + pp3;
+ p3 = (pp2 - pp3) * cos1_4;
+ p4 = pp4 + pp5;
+ p5 = (pp4 - pp5) * cos1_4;
+ p6 = pp6 + pp7;
+ p7 = (pp6 - pp7) * cos1_4;
+ p8 = pp8 + pp9;
+ p9 = (pp8 - pp9) * cos1_4;
+ p10 = pp10 + pp11;
+ p11 = (pp10 - pp11) * cos1_4;
+ p12 = pp12 + pp13;
+ p13 = (pp12 - pp13) * cos1_4;
+ p14 = pp14 + pp15;
+ p15 = (pp14 - pp15) * cos1_4;
+
+ // this is pretty insane coding
+ float tmp1;
+ new_v19/* 36-17 */= -(new_v4 = (new_v12 = p7) + p5) - p6;
+ new_v27/* 44-17 */= -p6 - p7 - p4;
+ new_v6 = (new_v10 = (new_v14 = p15) + p11) + p13;
+ new_v17/* 34-17 */= -(new_v2 = p15 + p13 + p9) - p14;
+ new_v21/* 38-17 */= (tmp1 = -p14 - p15 - p10 - p11) - p13;
+ new_v29/* 46-17 */= -p14 - p15 - p12 - p8;
+ new_v25/* 42-17 */= tmp1 - p12;
+ new_v31/* 48-17 */= -p0;
+ new_v0 = p1;
+ new_v23/* 40-17 */= -(new_v8 = p3) - p2;
+
+ p0 = (s0 - s31) * cos1_64;
+ p1 = (s1 - s30) * cos3_64;
+ p2 = (s2 - s29) * cos5_64;
+ p3 = (s3 - s28) * cos7_64;
+ p4 = (s4 - s27) * cos9_64;
+ p5 = (s5 - s26) * cos11_64;
+ p6 = (s6 - s25) * cos13_64;
+ p7 = (s7 - s24) * cos15_64;
+ p8 = (s8 - s23) * cos17_64;
+ p9 = (s9 - s22) * cos19_64;
+ p10 = (s10 - s21) * cos21_64;
+ p11 = (s11 - s20) * cos23_64;
+ p12 = (s12 - s19) * cos25_64;
+ p13 = (s13 - s18) * cos27_64;
+ p14 = (s14 - s17) * cos29_64;
+ p15 = (s15 - s16) * cos31_64;
+
+ pp0 = p0 + p15;
+ pp1 = p1 + p14;
+ pp2 = p2 + p13;
+ pp3 = p3 + p12;
+ pp4 = p4 + p11;
+ pp5 = p5 + p10;
+ pp6 = p6 + p9;
+ pp7 = p7 + p8;
+ pp8 = (p0 - p15) * cos1_32;
+ pp9 = (p1 - p14) * cos3_32;
+ pp10 = (p2 - p13) * cos5_32;
+ pp11 = (p3 - p12) * cos7_32;
+ pp12 = (p4 - p11) * cos9_32;
+ pp13 = (p5 - p10) * cos11_32;
+ pp14 = (p6 - p9) * cos13_32;
+ pp15 = (p7 - p8) * cos15_32;
+
+ p0 = pp0 + pp7;
+ p1 = pp1 + pp6;
+ p2 = pp2 + pp5;
+ p3 = pp3 + pp4;
+ p4 = (pp0 - pp7) * cos1_16;
+ p5 = (pp1 - pp6) * cos3_16;
+ p6 = (pp2 - pp5) * cos5_16;
+ p7 = (pp3 - pp4) * cos7_16;
+ p8 = pp8 + pp15;
+ p9 = pp9 + pp14;
+ p10 = pp10 + pp13;
+ p11 = pp11 + pp12;
+ p12 = (pp8 - pp15) * cos1_16;
+ p13 = (pp9 - pp14) * cos3_16;
+ p14 = (pp10 - pp13) * cos5_16;
+ p15 = (pp11 - pp12) * cos7_16;
+
+ pp0 = p0 + p3;
+ pp1 = p1 + p2;
+ pp2 = (p0 - p3) * cos1_8;
+ pp3 = (p1 - p2) * cos3_8;
+ pp4 = p4 + p7;
+ pp5 = p5 + p6;
+ pp6 = (p4 - p7) * cos1_8;
+ pp7 = (p5 - p6) * cos3_8;
+ pp8 = p8 + p11;
+ pp9 = p9 + p10;
+ pp10 = (p8 - p11) * cos1_8;
+ pp11 = (p9 - p10) * cos3_8;
+ pp12 = p12 + p15;
+ pp13 = p13 + p14;
+ pp14 = (p12 - p15) * cos1_8;
+ pp15 = (p13 - p14) * cos3_8;
+
+ p0 = pp0 + pp1;
+ p1 = (pp0 - pp1) * cos1_4;
+ p2 = pp2 + pp3;
+ p3 = (pp2 - pp3) * cos1_4;
+ p4 = pp4 + pp5;
+ p5 = (pp4 - pp5) * cos1_4;
+ p6 = pp6 + pp7;
+ p7 = (pp6 - pp7) * cos1_4;
+ p8 = pp8 + pp9;
+ p9 = (pp8 - pp9) * cos1_4;
+ p10 = pp10 + pp11;
+ p11 = (pp10 - pp11) * cos1_4;
+ p12 = pp12 + pp13;
+ p13 = (pp12 - pp13) * cos1_4;
+ p14 = pp14 + pp15;
+ p15 = (pp14 - pp15) * cos1_4;
+
+ // manually doing something that a compiler should handle sucks
+ // coding like this is hard to read
+ float tmp2;
+ new_v5 = (new_v11 = (new_v13 = (new_v15 = p15) + p7) + p11) + p5 + p13;
+ new_v7 = (new_v9 = p15 + p11 + p3) + p13;
+ new_v16/* 33-17 */= -(new_v1 = (tmp1 = p13 + p15 + p9) + p1) - p14;
+ new_v18/* 35-17 */= -(new_v3 = tmp1 + p5 + p7) - p6 - p14;
+
+ new_v22/* 39-17 */= (tmp1 = -p10 - p11 - p14 - p15) - p13 - p2 - p3;
+ new_v20/* 37-17 */= tmp1 - p13 - p5 - p6 - p7;
+ new_v24/* 41-17 */= tmp1 - p12 - p2 - p3;
+ new_v26/* 43-17 */= tmp1 - p12 - (tmp2 = p4 + p6 + p7);
+ new_v30/* 47-17 */= (tmp1 = -p8 - p12 - p14 - p15) - p0;
+ new_v28/* 45-17 */= tmp1 - tmp2;
+
+ // insert V[0-15] (== new_v[0-15]) into actual v:
+ // float[] x2 = actual_v + actual_write_pos;
+ // float dest[] = actual_v; v2
+
+ int pos = actual_write_pos;
+
+ v2[0 + pos] = new_v0;
+ v2[16 + pos] = new_v1;
+ v2[32 + pos] = new_v2;
+ v2[48 + pos] = new_v3;
+ v2[64 + pos] = new_v4;
+ v2[80 + pos] = new_v5;
+ v2[96 + pos] = new_v6;
+ v2[112 + pos] = new_v7;
+ v2[128 + pos] = new_v8;
+ v2[144 + pos] = new_v9;
+ v2[160 + pos] = new_v10;
+ v2[176 + pos] = new_v11;
+ v2[192 + pos] = new_v12;
+ v2[208 + pos] = new_v13;
+ v2[224 + pos] = new_v14;
+ v2[240 + pos] = new_v15;
+
+ // V[16] is always 0.0:
+ v2[256 + pos] = 0.0f;
+
+ // insert V[17-31] (== -new_v[15-1]) into actual v:
+ v2[272 + pos] = -new_v15;
+ v2[288 + pos] = -new_v14;
+ v2[304 + pos] = -new_v13;
+ v2[320 + pos] = -new_v12;
+ v2[336 + pos] = -new_v11;
+ v2[352 + pos] = -new_v10;
+ v2[368 + pos] = -new_v9;
+ v2[384 + pos] = -new_v8;
+ v2[400 + pos] = -new_v7;
+ v2[416 + pos] = -new_v6;
+ v2[432 + pos] = -new_v5;
+ v2[448 + pos] = -new_v4;
+ v2[464 + pos] = -new_v3;
+ v2[480 + pos] = -new_v2;
+ v2[496 + pos] = -new_v1;
+
+ // insert V[32] (== -new_v[0]) into other v:
+ // dest = (actual_v == v1) ? v2 : v1;
+
+ v1[0 + pos] = -new_v0;
+ // insert V[33-48] (== new_v[16-31]) into other v:
+ v1[16 + pos] = new_v16;
+ v1[32 + pos] = new_v17;
+ v1[48 + pos] = new_v18;
+ v1[64 + pos] = new_v19;
+ v1[80 + pos] = new_v20;
+ v1[96 + pos] = new_v21;
+ v1[112 + pos] = new_v22;
+ v1[128 + pos] = new_v23;
+ v1[144 + pos] = new_v24;
+ v1[160 + pos] = new_v25;
+ v1[176 + pos] = new_v26;
+ v1[192 + pos] = new_v27;
+ v1[208 + pos] = new_v28;
+ v1[224 + pos] = new_v29;
+ v1[240 + pos] = new_v30;
+ v1[256 + pos] = new_v31;
+
+ // insert V[49-63] (== new_v[30-16]) into other v:
+ v1[272 + pos] = new_v30;
+ v1[288 + pos] = new_v29;
+ v1[304 + pos] = new_v28;
+ v1[320 + pos] = new_v27;
+ v1[336 + pos] = new_v26;
+ v1[352 + pos] = new_v25;
+ v1[368 + pos] = new_v24;
+ v1[384 + pos] = new_v23;
+ v1[400 + pos] = new_v22;
+ v1[416 + pos] = new_v21;
+ v1[432 + pos] = new_v20;
+ v1[448 + pos] = new_v19;
+ v1[464 + pos] = new_v18;
+ v1[480 + pos] = new_v17;
+ v1[496 + pos] = new_v16;
+
+ /*
+ * setup PREV
+ */
+
+ prev2[0 + pos] = new_v0;
+ prev2[16 + pos] = new_v1;
+ prev2[32 + pos] = new_v2;
+ prev2[48 + pos] = new_v3;
+ prev2[64 + pos] = new_v4;
+ prev2[80 + pos] = new_v5;
+ prev2[96 + pos] = new_v6;
+ prev2[112 + pos] = new_v7;
+ prev2[128 + pos] = new_v8;
+ prev2[144 + pos] = new_v9;
+ prev2[160 + pos] = new_v10;
+ prev2[176 + pos] = new_v11;
+ prev2[192 + pos] = new_v12;
+ prev2[208 + pos] = new_v13;
+ prev2[224 + pos] = new_v14;
+ prev2[240 + pos] = new_v15;
+
+ // V[16] is always 0.0:
+ prev2[256 + pos] = 0.0f;
+
+ // insert V[17-31] (== -new_v[15-1]) into actual v:
+ prev2[272 + pos] = -new_v15;
+ prev2[288 + pos] = -new_v14;
+ prev2[304 + pos] = -new_v13;
+ prev2[320 + pos] = -new_v12;
+ prev2[336 + pos] = -new_v11;
+ prev2[352 + pos] = -new_v10;
+ prev2[368 + pos] = -new_v9;
+ prev2[384 + pos] = -new_v8;
+ prev2[400 + pos] = -new_v7;
+ prev2[416 + pos] = -new_v6;
+ prev2[432 + pos] = -new_v5;
+ prev2[448 + pos] = -new_v4;
+ prev2[464 + pos] = -new_v3;
+ prev2[480 + pos] = -new_v2;
+ prev2[496 + pos] = -new_v1;
+
+ // insert V[32] (== -new_v[0]) into other v:
+ // dest = (actual_v == v1) ? v2 : v1;
+
+ prev1[0 + pos] = -new_v0;
+ // insert V[33-48] (== new_v[16-31]) into other v:
+ prev1[16 + pos] = new_v16;
+ prev1[32 + pos] = new_v17;
+ prev1[48 + pos] = new_v18;
+ prev1[64 + pos] = new_v19;
+ prev1[80 + pos] = new_v20;
+ prev1[96 + pos] = new_v21;
+ prev1[112 + pos] = new_v22;
+ prev1[128 + pos] = new_v23;
+ prev1[144 + pos] = new_v24;
+ prev1[160 + pos] = new_v25;
+ prev1[176 + pos] = new_v26;
+ prev1[192 + pos] = new_v27;
+ prev1[208 + pos] = new_v28;
+ prev1[224 + pos] = new_v29;
+ prev1[240 + pos] = new_v30;
+ prev1[256 + pos] = new_v31;
+
+ // insert V[49-63] (== new_v[30-16]) into other v:
+ prev1[272 + pos] = new_v30;
+ prev1[288 + pos] = new_v29;
+ prev1[304 + pos] = new_v28;
+ prev1[320 + pos] = new_v27;
+ prev1[336 + pos] = new_v26;
+ prev1[352 + pos] = new_v25;
+ prev1[368 + pos] = new_v24;
+ prev1[384 + pos] = new_v23;
+ prev1[400 + pos] = new_v22;
+ prev1[416 + pos] = new_v21;
+ prev1[432 + pos] = new_v20;
+ prev1[448 + pos] = new_v19;
+ prev1[464 + pos] = new_v18;
+ prev1[480 + pos] = new_v17;
+ prev1[496 + pos] = new_v16;
+ }
+
+ private void compute_new_v1_v2() {
+
+ float new_v0 = 0.0f;
+ float new_v1 = 0.0f;
+ float new_v2 = 0.0f;
+ float new_v3 = 0.0f;
+ float new_v4 = 0.0f;
+ float new_v5 = 0.0f;
+ float new_v6 = 0.0f;
+ float new_v7 = 0.0f;
+ float new_v8 = 0.0f;
+ float new_v9 = 0.0f;
+ float new_v10 = 0.0f;
+ float new_v11 = 0.0f;
+ float new_v12 = 0.0f;
+ float new_v13 = 0.0f;
+ float new_v14 = 0.0f;
+ float new_v15 = 0.0f;
+ float new_v16 = 0.0f;
+ float new_v17 = 0.0f;
+ float new_v18 = 0.0f;
+ float new_v19 = 0.0f;
+ float new_v20 = 0.0f;
+ float new_v21 = 0.0f;
+ float new_v22 = 0.0f;
+ float new_v23 = 0.0f;
+ float new_v24 = 0.0f;
+ float new_v25 = 0.0f;
+ float new_v26 = 0.0f;
+ float new_v27 = 0.0f;
+ float new_v28 = 0.0f;
+ float new_v29 = 0.0f;
+ float new_v30 = 0.0f;
+ float new_v31 = 0.0f;
+
+ // float[] new_v = new float[32]; // new V[0-15] and V[33-48] of Figure
+ // 3-A.2 in ISO DIS 11172-3
+ // float[] p = new float[16];
+ // float[] pp = new float[16];
+
+ // float[] s = samples;
+
+ float s0 = samples[0];
+ float s1 = samples[1];
+ float s2 = samples[2];
+ float s3 = samples[3];
+ float s4 = samples[4];
+ float s5 = samples[5];
+ float s6 = samples[6];
+ float s7 = samples[7];
+ float s8 = samples[8];
+ float s9 = samples[9];
+ float s10 = samples[10];
+ float s11 = samples[11];
+ float s12 = samples[12];
+ float s13 = samples[13];
+ float s14 = samples[14];
+ float s15 = samples[15];
+ float s16 = samples[16];
+ float s17 = samples[17];
+ float s18 = samples[18];
+ float s19 = samples[19];
+ float s20 = samples[20];
+ float s21 = samples[21];
+ float s22 = samples[22];
+ float s23 = samples[23];
+ float s24 = samples[24];
+ float s25 = samples[25];
+ float s26 = samples[26];
+ float s27 = samples[27];
+ float s28 = samples[28];
+ float s29 = samples[29];
+ float s30 = samples[30];
+ float s31 = samples[31];
+
+ float p0 = s0 + s31;
+ float p1 = s1 + s30;
+ float p2 = s2 + s29;
+ float p3 = s3 + s28;
+ float p4 = s4 + s27;
+ float p5 = s5 + s26;
+ float p6 = s6 + s25;
+ float p7 = s7 + s24;
+ float p8 = s8 + s23;
+ float p9 = s9 + s22;
+ float p10 = s10 + s21;
+ float p11 = s11 + s20;
+ float p12 = s12 + s19;
+ float p13 = s13 + s18;
+ float p14 = s14 + s17;
+ float p15 = s15 + s16;
+
+ float pp0 = p0 + p15;
+ float pp1 = p1 + p14;
+ float pp2 = p2 + p13;
+ float pp3 = p3 + p12;
+ float pp4 = p4 + p11;
+ float pp5 = p5 + p10;
+ float pp6 = p6 + p9;
+ float pp7 = p7 + p8;
+ float pp8 = (p0 - p15) * cos1_32;
+ float pp9 = (p1 - p14) * cos3_32;
+ float pp10 = (p2 - p13) * cos5_32;
+ float pp11 = (p3 - p12) * cos7_32;
+ float pp12 = (p4 - p11) * cos9_32;
+ float pp13 = (p5 - p10) * cos11_32;
+ float pp14 = (p6 - p9) * cos13_32;
+ float pp15 = (p7 - p8) * cos15_32;
+
+ p0 = pp0 + pp7;
+ p1 = pp1 + pp6;
+ p2 = pp2 + pp5;
+ p3 = pp3 + pp4;
+ p4 = (pp0 - pp7) * cos1_16;
+ p5 = (pp1 - pp6) * cos3_16;
+ p6 = (pp2 - pp5) * cos5_16;
+ p7 = (pp3 - pp4) * cos7_16;
+ p8 = pp8 + pp15;
+ p9 = pp9 + pp14;
+ p10 = pp10 + pp13;
+ p11 = pp11 + pp12;
+ p12 = (pp8 - pp15) * cos1_16;
+ p13 = (pp9 - pp14) * cos3_16;
+ p14 = (pp10 - pp13) * cos5_16;
+ p15 = (pp11 - pp12) * cos7_16;
+
+ pp0 = p0 + p3;
+ pp1 = p1 + p2;
+ pp2 = (p0 - p3) * cos1_8;
+ pp3 = (p1 - p2) * cos3_8;
+ pp4 = p4 + p7;
+ pp5 = p5 + p6;
+ pp6 = (p4 - p7) * cos1_8;
+ pp7 = (p5 - p6) * cos3_8;
+ pp8 = p8 + p11;
+ pp9 = p9 + p10;
+ pp10 = (p8 - p11) * cos1_8;
+ pp11 = (p9 - p10) * cos3_8;
+ pp12 = p12 + p15;
+ pp13 = p13 + p14;
+ pp14 = (p12 - p15) * cos1_8;
+ pp15 = (p13 - p14) * cos3_8;
+
+ p0 = pp0 + pp1;
+ p1 = (pp0 - pp1) * cos1_4;
+ p2 = pp2 + pp3;
+ p3 = (pp2 - pp3) * cos1_4;
+ p4 = pp4 + pp5;
+ p5 = (pp4 - pp5) * cos1_4;
+ p6 = pp6 + pp7;
+ p7 = (pp6 - pp7) * cos1_4;
+ p8 = pp8 + pp9;
+ p9 = (pp8 - pp9) * cos1_4;
+ p10 = pp10 + pp11;
+ p11 = (pp10 - pp11) * cos1_4;
+ p12 = pp12 + pp13;
+ p13 = (pp12 - pp13) * cos1_4;
+ p14 = pp14 + pp15;
+ p15 = (pp14 - pp15) * cos1_4;
+
+ // this is pretty insane coding
+ float tmp1;
+ new_v19/* 36-17 */= -(new_v4 = (new_v12 = p7) + p5) - p6;
+ new_v27/* 44-17 */= -p6 - p7 - p4;
+ new_v6 = (new_v10 = (new_v14 = p15) + p11) + p13;
+ new_v17/* 34-17 */= -(new_v2 = p15 + p13 + p9) - p14;
+ new_v21/* 38-17 */= (tmp1 = -p14 - p15 - p10 - p11) - p13;
+ new_v29/* 46-17 */= -p14 - p15 - p12 - p8;
+ new_v25/* 42-17 */= tmp1 - p12;
+ new_v31/* 48-17 */= -p0;
+ new_v0 = p1;
+ new_v23/* 40-17 */= -(new_v8 = p3) - p2;
+
+ p0 = (s0 - s31) * cos1_64;
+ p1 = (s1 - s30) * cos3_64;
+ p2 = (s2 - s29) * cos5_64;
+ p3 = (s3 - s28) * cos7_64;
+ p4 = (s4 - s27) * cos9_64;
+ p5 = (s5 - s26) * cos11_64;
+ p6 = (s6 - s25) * cos13_64;
+ p7 = (s7 - s24) * cos15_64;
+ p8 = (s8 - s23) * cos17_64;
+ p9 = (s9 - s22) * cos19_64;
+ p10 = (s10 - s21) * cos21_64;
+ p11 = (s11 - s20) * cos23_64;
+ p12 = (s12 - s19) * cos25_64;
+ p13 = (s13 - s18) * cos27_64;
+ p14 = (s14 - s17) * cos29_64;
+ p15 = (s15 - s16) * cos31_64;
+
+ pp0 = p0 + p15;
+ pp1 = p1 + p14;
+ pp2 = p2 + p13;
+ pp3 = p3 + p12;
+ pp4 = p4 + p11;
+ pp5 = p5 + p10;
+ pp6 = p6 + p9;
+ pp7 = p7 + p8;
+ pp8 = (p0 - p15) * cos1_32;
+ pp9 = (p1 - p14) * cos3_32;
+ pp10 = (p2 - p13) * cos5_32;
+ pp11 = (p3 - p12) * cos7_32;
+ pp12 = (p4 - p11) * cos9_32;
+ pp13 = (p5 - p10) * cos11_32;
+ pp14 = (p6 - p9) * cos13_32;
+ pp15 = (p7 - p8) * cos15_32;
+
+ p0 = pp0 + pp7;
+ p1 = pp1 + pp6;
+ p2 = pp2 + pp5;
+ p3 = pp3 + pp4;
+ p4 = (pp0 - pp7) * cos1_16;
+ p5 = (pp1 - pp6) * cos3_16;
+ p6 = (pp2 - pp5) * cos5_16;
+ p7 = (pp3 - pp4) * cos7_16;
+ p8 = pp8 + pp15;
+ p9 = pp9 + pp14;
+ p10 = pp10 + pp13;
+ p11 = pp11 + pp12;
+ p12 = (pp8 - pp15) * cos1_16;
+ p13 = (pp9 - pp14) * cos3_16;
+ p14 = (pp10 - pp13) * cos5_16;
+ p15 = (pp11 - pp12) * cos7_16;
+
+ pp0 = p0 + p3;
+ pp1 = p1 + p2;
+ pp2 = (p0 - p3) * cos1_8;
+ pp3 = (p1 - p2) * cos3_8;
+ pp4 = p4 + p7;
+ pp5 = p5 + p6;
+ pp6 = (p4 - p7) * cos1_8;
+ pp7 = (p5 - p6) * cos3_8;
+ pp8 = p8 + p11;
+ pp9 = p9 + p10;
+ pp10 = (p8 - p11) * cos1_8;
+ pp11 = (p9 - p10) * cos3_8;
+ pp12 = p12 + p15;
+ pp13 = p13 + p14;
+ pp14 = (p12 - p15) * cos1_8;
+ pp15 = (p13 - p14) * cos3_8;
+
+ p0 = pp0 + pp1;
+ p1 = (pp0 - pp1) * cos1_4;
+ p2 = pp2 + pp3;
+ p3 = (pp2 - pp3) * cos1_4;
+ p4 = pp4 + pp5;
+ p5 = (pp4 - pp5) * cos1_4;
+ p6 = pp6 + pp7;
+ p7 = (pp6 - pp7) * cos1_4;
+ p8 = pp8 + pp9;
+ p9 = (pp8 - pp9) * cos1_4;
+ p10 = pp10 + pp11;
+ p11 = (pp10 - pp11) * cos1_4;
+ p12 = pp12 + pp13;
+ p13 = (pp12 - pp13) * cos1_4;
+ p14 = pp14 + pp15;
+ p15 = (pp14 - pp15) * cos1_4;
+
+ // manually doing something that a compiler should handle sucks
+ // coding like this is hard to read
+ float tmp2;
+ new_v5 = (new_v11 = (new_v13 = (new_v15 = p15) + p7) + p11) + p5 + p13;
+ new_v7 = (new_v9 = p15 + p11 + p3) + p13;
+ new_v16/* 33-17 */= -(new_v1 = (tmp1 = p13 + p15 + p9) + p1) - p14;
+ new_v18/* 35-17 */= -(new_v3 = tmp1 + p5 + p7) - p6 - p14;
+
+ new_v22/* 39-17 */= (tmp1 = -p10 - p11 - p14 - p15) - p13 - p2 - p3;
+ new_v20/* 37-17 */= tmp1 - p13 - p5 - p6 - p7;
+ new_v24/* 41-17 */= tmp1 - p12 - p2 - p3;
+ new_v26/* 43-17 */= tmp1 - p12 - (tmp2 = p4 + p6 + p7);
+ new_v30/* 47-17 */= (tmp1 = -p8 - p12 - p14 - p15) - p0;
+ new_v28/* 45-17 */= tmp1 - tmp2;
+
+ // insert V[0-15] (== new_v[0-15]) into actual v:
+ // float[] x2 = actual_v + actual_write_pos;
+ // float dest[] = actual_v; actual_v=v1;
+
+ int pos = actual_write_pos;
+
+ v1[0 + pos] = new_v0;
+ v1[16 + pos] = new_v1;
+ v1[32 + pos] = new_v2;
+ v1[48 + pos] = new_v3;
+ v1[64 + pos] = new_v4;
+ v1[80 + pos] = new_v5;
+ v1[96 + pos] = new_v6;
+ v1[112 + pos] = new_v7;
+ v1[128 + pos] = new_v8;
+ v1[144 + pos] = new_v9;
+ v1[160 + pos] = new_v10;
+ v1[176 + pos] = new_v11;
+ v1[192 + pos] = new_v12;
+ v1[208 + pos] = new_v13;
+ v1[224 + pos] = new_v14;
+ v1[240 + pos] = new_v15;
+
+ // V[16] is always 0.0:
+ v1[256 + pos] = 0.0f;
+
+ // insert V[17-31] (== -new_v[15-1]) into actual v:
+ v1[272 + pos] = -new_v15;
+ v1[288 + pos] = -new_v14;
+ v1[304 + pos] = -new_v13;
+ v1[320 + pos] = -new_v12;
+ v1[336 + pos] = -new_v11;
+ v1[352 + pos] = -new_v10;
+ v1[368 + pos] = -new_v9;
+ v1[384 + pos] = -new_v8;
+ v1[400 + pos] = -new_v7;
+ v1[416 + pos] = -new_v6;
+ v1[432 + pos] = -new_v5;
+ v1[448 + pos] = -new_v4;
+ v1[464 + pos] = -new_v3;
+ v1[480 + pos] = -new_v2;
+ v1[496 + pos] = -new_v1;
+
+ // insert V[32] (== -new_v[0]) into other v:
+ // dest = (actual_v == v1) ? v2 : v1;
+
+ v2[0 + pos] = -new_v0;
+ // insert V[33-48] (== new_v[16-31]) into other v:
+ v2[16 + pos] = new_v16;
+ v2[32 + pos] = new_v17;
+ v2[48 + pos] = new_v18;
+ v2[64 + pos] = new_v19;
+ v2[80 + pos] = new_v20;
+ v2[96 + pos] = new_v21;
+ v2[112 + pos] = new_v22;
+ v2[128 + pos] = new_v23;
+ v2[144 + pos] = new_v24;
+ v2[160 + pos] = new_v25;
+ v2[176 + pos] = new_v26;
+ v2[192 + pos] = new_v27;
+ v2[208 + pos] = new_v28;
+ v2[224 + pos] = new_v29;
+ v2[240 + pos] = new_v30;
+ v2[256 + pos] = new_v31;
+
+ // insert V[49-63] (== new_v[30-16]) into other v:
+ v2[272 + pos] = new_v30;
+ v2[288 + pos] = new_v29;
+ v2[304 + pos] = new_v28;
+ v2[320 + pos] = new_v27;
+ v2[336 + pos] = new_v26;
+ v2[352 + pos] = new_v25;
+ v2[368 + pos] = new_v24;
+ v2[384 + pos] = new_v23;
+ v2[400 + pos] = new_v22;
+ v2[416 + pos] = new_v21;
+ v2[432 + pos] = new_v20;
+ v2[448 + pos] = new_v19;
+ v2[464 + pos] = new_v18;
+ v2[480 + pos] = new_v17;
+ v2[496 + pos] = new_v16;
+
+ /*
+ * setup PREV
+ */
+
+ prev1[0 + pos] = new_v0;
+ prev1[16 + pos] = new_v1;
+ prev1[32 + pos] = new_v2;
+ prev1[48 + pos] = new_v3;
+ prev1[64 + pos] = new_v4;
+ prev1[80 + pos] = new_v5;
+ prev1[96 + pos] = new_v6;
+ prev1[112 + pos] = new_v7;
+ prev1[128 + pos] = new_v8;
+ prev1[144 + pos] = new_v9;
+ prev1[160 + pos] = new_v10;
+ prev1[176 + pos] = new_v11;
+ prev1[192 + pos] = new_v12;
+ prev1[208 + pos] = new_v13;
+ prev1[224 + pos] = new_v14;
+ prev1[240 + pos] = new_v15;
+
+ // V[16] is always 0.0:
+ prev1[256 + pos] = 0.0f;
+
+ // insert V[17-31] (== -new_v[15-1]) into actual v:
+ prev1[272 + pos] = -new_v15;
+ prev1[288 + pos] = -new_v14;
+ prev1[304 + pos] = -new_v13;
+ prev1[320 + pos] = -new_v12;
+ prev1[336 + pos] = -new_v11;
+ prev1[352 + pos] = -new_v10;
+ prev1[368 + pos] = -new_v9;
+ prev1[384 + pos] = -new_v8;
+ prev1[400 + pos] = -new_v7;
+ prev1[416 + pos] = -new_v6;
+ prev1[432 + pos] = -new_v5;
+ prev1[448 + pos] = -new_v4;
+ prev1[464 + pos] = -new_v3;
+ prev1[480 + pos] = -new_v2;
+ prev1[496 + pos] = -new_v1;
+
+ // insert V[32] (== -new_v[0]) into other v:
+ // dest = (actual_v == v1) ? v2 : v1;
+
+ prev2[0 + pos] = -new_v0;
+ // insert V[33-48] (== new_v[16-31]) into other v:
+ prev2[16 + pos] = new_v16;
+ prev2[32 + pos] = new_v17;
+ prev2[48 + pos] = new_v18;
+ prev2[64 + pos] = new_v19;
+ prev2[80 + pos] = new_v20;
+ prev2[96 + pos] = new_v21;
+ prev2[112 + pos] = new_v22;
+ prev2[128 + pos] = new_v23;
+ prev2[144 + pos] = new_v24;
+ prev2[160 + pos] = new_v25;
+ prev2[176 + pos] = new_v26;
+ prev2[192 + pos] = new_v27;
+ prev2[208 + pos] = new_v28;
+ prev2[224 + pos] = new_v29;
+ prev2[240 + pos] = new_v30;
+ prev2[256 + pos] = new_v31;
+
+ // insert V[49-63] (== new_v[30-16]) into other v:
+ prev2[272 + pos] = new_v30;
+ prev2[288 + pos] = new_v29;
+ prev2[304 + pos] = new_v28;
+ prev2[320 + pos] = new_v27;
+ prev2[336 + pos] = new_v26;
+ prev2[352 + pos] = new_v25;
+ prev2[368 + pos] = new_v24;
+ prev2[384 + pos] = new_v23;
+ prev2[400 + pos] = new_v22;
+ prev2[416 + pos] = new_v21;
+ prev2[432 + pos] = new_v20;
+ prev2[448 + pos] = new_v19;
+ prev2[464 + pos] = new_v18;
+ prev2[480 + pos] = new_v17;
+ prev2[496 + pos] = new_v16;
+ }
+
+ /**
+ * Compute PCM Samples.
+ */
+
+
+ private float[] _tmpOut = new float[32];
+
+ private void compute_pcm_samples0() {
+
+ if (vidx == 1) {
+ // final float[] vp = actual_v;
+ // int inc = v_inc;
+ // final float[] tmpOut = _tmpOut;
+ int dvp = 0;
+
+ // fat chance of having this loop unroll
+ for ( int i = 0; i < 32; i++) {
+ float pcm_sample;
+ // final float[] dp = d16[i];
+ pcm_sample =
+ (float) (((v1[0 + dvp] * d16[i][0]) + (v1[15 + dvp] * d16[i][1])
+ + (v1[14 + dvp] * d16[i][2]) + (v1[13 + dvp] * d16[i][3])
+ + (v1[12 + dvp] * d16[i][4]) + (v1[11 + dvp] * d16[i][5])
+ + (v1[10 + dvp] * d16[i][6]) + (v1[9 + dvp] * d16[i][7])
+ + (v1[8 + dvp] * d16[i][8]) + (v1[7 + dvp] * d16[i][9])
+ + (v1[6 + dvp] * d16[i][10]) + (v1[5 + dvp] * d16[i][11])
+ + (v1[4 + dvp] * d16[i][12]) + (v1[3 + dvp] * d16[i][13])
+ + (v1[2 + dvp] * d16[i][14]) + (v1[1 + dvp] * d16[i][15])) * scalefactor);
+
+ _tmpOut[i] = pcm_sample;
+
+ dvp += 16;
+ } // for
+ } else {
+ // final float[] vp = actual_v;
+ // int inc = v_inc;
+ // final float[] tmpOut = _tmpOut;
+ int dvp = 0;
+
+ // fat chance of having this loop unroll
+ for ( int i = 0; i < 32; i++) {
+ float pcm_sample;
+ // final float[] dp = d16[i];
+ pcm_sample =
+ (float) (((v2[0 + dvp] * d16[i][0]) + (v2[15 + dvp] * d16[i][1])
+ + (v2[14 + dvp] * d16[i][2]) + (v2[13 + dvp] * d16[i][3])
+ + (v2[12 + dvp] * d16[i][4]) + (v2[11 + dvp] * d16[i][5])
+ + (v2[10 + dvp] * d16[i][6]) + (v2[9 + dvp] * d16[i][7])
+ + (v2[8 + dvp] * d16[i][8]) + (v2[7 + dvp] * d16[i][9])
+ + (v2[6 + dvp] * d16[i][10]) + (v2[5 + dvp] * d16[i][11])
+ + (v2[4 + dvp] * d16[i][12]) + (v2[3 + dvp] * d16[i][13])
+ + (v2[2 + dvp] * d16[i][14]) + (v2[1 + dvp] * d16[i][15])) * scalefactor);
+
+ _tmpOut[i] = pcm_sample;
+
+ dvp += 16;
+ } // for
+ }
+
+ }
+
+ private void compute_pcm_samples1() {
+
+ if (vidx == 1) {
+ // final float[] vp = actual_v;
+ // int inc = v_inc;
+ // final float[] tmpOut = _tmpOut;
+ int dvp = 0;
+
+ // fat chance of having this loop unroll
+ for ( int i = 0; i < 32; i++) {
+ // final float[] dp = d16[i];
+ float pcm_sample;
+
+ pcm_sample =
+ (float) (((v1[1 + dvp] * d16[i][0]) + (v1[0 + dvp] * d16[i][1])
+ + (v1[15 + dvp] * d16[i][2]) + (v1[14 + dvp] * d16[i][3])
+ + (v1[13 + dvp] * d16[i][4]) + (v1[12 + dvp] * d16[i][5])
+ + (v1[11 + dvp] * d16[i][6]) + (v1[10 + dvp] * d16[i][7])
+ + (v1[9 + dvp] * d16[i][8]) + (v1[8 + dvp] * d16[i][9])
+ + (v1[7 + dvp] * d16[i][10]) + (v1[6 + dvp] * d16[i][11])
+ + (v1[5 + dvp] * d16[i][12]) + (v1[4 + dvp] * d16[i][13])
+ + (v1[3 + dvp] * d16[i][14]) + (v1[2 + dvp] * d16[i][15])) * scalefactor);
+
+ _tmpOut[i] = pcm_sample;
+
+ dvp += 16;
+ } // for
+ } else {
+ // final float[] vp = actual_v;
+ // int inc = v_inc;
+ // final float[] tmpOut = _tmpOut;
+ int dvp = 0;
+
+ // fat chance of having this loop unroll
+ for ( int i = 0; i < 32; i++) {
+ // final float[] dp = d16[i];
+ float pcm_sample;
+
+ pcm_sample =
+ (float) (((v2[1 + dvp] * d16[i][0]) + (v2[0 + dvp] * d16[i][1])
+ + (v2[15 + dvp] * d16[i][2]) + (v2[14 + dvp] * d16[i][3])
+ + (v2[13 + dvp] * d16[i][4]) + (v2[12 + dvp] * d16[i][5])
+ + (v2[11 + dvp] * d16[i][6]) + (v2[10 + dvp] * d16[i][7])
+ + (v2[9 + dvp] * d16[i][8]) + (v2[8 + dvp] * d16[i][9])
+ + (v2[7 + dvp] * d16[i][10]) + (v2[6 + dvp] * d16[i][11])
+ + (v2[5 + dvp] * d16[i][12]) + (v2[4 + dvp] * d16[i][13])
+ + (v2[3 + dvp] * d16[i][14]) + (v2[2 + dvp] * d16[i][15])) * scalefactor);
+
+ _tmpOut[i] = pcm_sample;
+
+ dvp += 16;
+ } // for
+ }
+
+ }
+
+ private void compute_pcm_samples2() {
+
+ if (vidx == 1) {
+ // final float[] vp = actual_v;
+ // int inc = v_inc;
+ // final float[] tmpOut = _tmpOut;
+ int dvp = 0;
+
+ // fat chance of having this loop unroll
+ for ( int i = 0; i < 32; i++) {
+ // final float[] dp = d16[i];
+ float pcm_sample;
+
+ pcm_sample =
+ (float) (((v1[2 + dvp] * d16[i][0]) + (v1[1 + dvp] * d16[i][1])
+ + (v1[0 + dvp] * d16[i][2]) + (v1[15 + dvp] * d16[i][3])
+ + (v1[14 + dvp] * d16[i][4]) + (v1[13 + dvp] * d16[i][5])
+ + (v1[12 + dvp] * d16[i][6]) + (v1[11 + dvp] * d16[i][7])
+ + (v1[10 + dvp] * d16[i][8]) + (v1[9 + dvp] * d16[i][9])
+ + (v1[8 + dvp] * d16[i][10]) + (v1[7 + dvp] * d16[i][11])
+ + (v1[6 + dvp] * d16[i][12]) + (v1[5 + dvp] * d16[i][13])
+ + (v1[4 + dvp] * d16[i][14]) + (v1[3 + dvp] * d16[i][15])) * scalefactor);
+
+ _tmpOut[i] = pcm_sample;
+
+ dvp += 16;
+ } // for
+ } else {
+ // final float[] vp = actual_v;
+ // int inc = v_inc;
+ // final float[] tmpOut = _tmpOut;
+ int dvp = 0;
+
+ // fat chance of having this loop unroll
+ for ( int i = 0; i < 32; i++) {
+ // final float[] dp = d16[i];
+ float pcm_sample;
+
+ pcm_sample =
+ (float) (((v2[2 + dvp] * d16[i][0]) + (v2[1 + dvp] * d16[i][1])
+ + (v2[0 + dvp] * d16[i][2]) + (v2[15 + dvp] * d16[i][3])
+ + (v2[14 + dvp] * d16[i][4]) + (v2[13 + dvp] * d16[i][5])
+ + (v2[12 + dvp] * d16[i][6]) + (v2[11 + dvp] * d16[i][7])
+ + (v2[10 + dvp] * d16[i][8]) + (v2[9 + dvp] * d16[i][9])
+ + (v2[8 + dvp] * d16[i][10]) + (v2[7 + dvp] * d16[i][11])
+ + (v2[6 + dvp] * d16[i][12]) + (v2[5 + dvp] * d16[i][13])
+ + (v2[4 + dvp] * d16[i][14]) + (v2[3 + dvp] * d16[i][15])) * scalefactor);
+
+ _tmpOut[i] = pcm_sample;
+
+ dvp += 16;
+ } // for
+ }
+
+ }
+
+ private void compute_pcm_samples3() {
+
+ if (vidx == 1) {
+ // final float[] vp = actual_v;
+
+ // int inc = v_inc;
+ // final float[] tmpOut = _tmpOut;
+ int dvp = 0;
+
+ // fat chance of having this loop unroll
+ for ( int i = 0; i < 32; i++) {
+ // final float[] dp = d16[i];
+ float pcm_sample;
+
+ pcm_sample =
+ (float) (((v1[3 + dvp] * d16[i][0]) + (v1[2 + dvp] * d16[i][1])
+ + (v1[1 + dvp] * d16[i][2]) + (v1[0 + dvp] * d16[i][3])
+ + (v1[15 + dvp] * d16[i][4]) + (v1[14 + dvp] * d16[i][5])
+ + (v1[13 + dvp] * d16[i][6]) + (v1[12 + dvp] * d16[i][7])
+ + (v1[11 + dvp] * d16[i][8]) + (v1[10 + dvp] * d16[i][9])
+ + (v1[9 + dvp] * d16[i][10]) + (v1[8 + dvp] * d16[i][11])
+ + (v1[7 + dvp] * d16[i][12]) + (v1[6 + dvp] * d16[i][13])
+ + (v1[5 + dvp] * d16[i][14]) + (v1[4 + dvp] * d16[i][15])) * scalefactor);
+
+ _tmpOut[i] = pcm_sample;
+
+ dvp += 16;
+ } // for
+ } else {
+ // final float[] vp = actual_v;
+
+ // int inc = v_inc;
+ // final float[] tmpOut = _tmpOut;
+ int dvp = 0;
+
+ // fat chance of having this loop unroll
+ for ( int i = 0; i < 32; i++) {
+ // final float[] dp = d16[i];
+ float pcm_sample;
+
+ pcm_sample =
+ (float) (((v2[3 + dvp] * d16[i][0]) + (v2[2 + dvp] * d16[i][1])
+ + (v2[1 + dvp] * d16[i][2]) + (v2[0 + dvp] * d16[i][3])
+ + (v2[15 + dvp] * d16[i][4]) + (v2[14 + dvp] * d16[i][5])
+ + (v2[13 + dvp] * d16[i][6]) + (v2[12 + dvp] * d16[i][7])
+ + (v2[11 + dvp] * d16[i][8]) + (v2[10 + dvp] * d16[i][9])
+ + (v2[9 + dvp] * d16[i][10]) + (v2[8 + dvp] * d16[i][11])
+ + (v2[7 + dvp] * d16[i][12]) + (v2[6 + dvp] * d16[i][13])
+ + (v2[5 + dvp] * d16[i][14]) + (v2[4 + dvp] * d16[i][15])) * scalefactor);
+
+ _tmpOut[i] = pcm_sample;
+
+ dvp += 16;
+ } // for
+ }
+
+ }
+
+ private void compute_pcm_samples4() {
+
+ if (vidx == 1) {
+ // final float[] vp = actual_v;
+
+ // int inc = v_inc;
+ // final float[] tmpOut = _tmpOut;
+ int dvp = 0;
+
+ // fat chance of having this loop unroll
+ for ( int i = 0; i < 32; i++) {
+ // final float[] dp = d16[i];
+ float pcm_sample;
+
+ pcm_sample =
+ (float) (((v1[4 + dvp] * d16[i][0]) + (v1[3 + dvp] * d16[i][1])
+ + (v1[2 + dvp] * d16[i][2]) + (v1[1 + dvp] * d16[i][3]) + (v1[0 + dvp] * d16[i][4])
+ + (v1[15 + dvp] * d16[i][5]) + (v1[14 + dvp] * d16[i][6])
+ + (v1[13 + dvp] * d16[i][7]) + (v1[12 + dvp] * d16[i][8])
+ + (v1[11 + dvp] * d16[i][9]) + (v1[10 + dvp] * d16[i][10])
+ + (v1[9 + dvp] * d16[i][11]) + (v1[8 + dvp] * d16[i][12])
+ + (v1[7 + dvp] * d16[i][13]) + (v1[6 + dvp] * d16[i][14]) + (v1[5 + dvp] * d16[i][15])) * scalefactor);
+
+ _tmpOut[i] = pcm_sample;
+
+ dvp += 16;
+ } // for
+ } else {
+ // final float[] vp = actual_v;
+
+ // int inc = v_inc;
+ // final float[] tmpOut = _tmpOut;
+ int dvp = 0;
+
+ // fat chance of having this loop unroll
+ for ( int i = 0; i < 32; i++) {
+ // final float[] dp = d16[i];
+ float pcm_sample;
+
+ pcm_sample =
+ (float) (((v2[4 + dvp] * d16[i][0]) + (v2[3 + dvp] * d16[i][1])
+ + (v2[2 + dvp] * d16[i][2]) + (v2[1 + dvp] * d16[i][3]) + (v2[0 + dvp] * d16[i][4])
+ + (v2[15 + dvp] * d16[i][5]) + (v2[14 + dvp] * d16[i][6])
+ + (v2[13 + dvp] * d16[i][7]) + (v2[12 + dvp] * d16[i][8])
+ + (v2[11 + dvp] * d16[i][9]) + (v2[10 + dvp] * d16[i][10])
+ + (v2[9 + dvp] * d16[i][11]) + (v2[8 + dvp] * d16[i][12])
+ + (v2[7 + dvp] * d16[i][13]) + (v2[6 + dvp] * d16[i][14]) + (v2[5 + dvp] * d16[i][15])) * scalefactor);
+
+ _tmpOut[i] = pcm_sample;
+
+ dvp += 16;
+ } // for
+ }
+
+ }
+
+ private void compute_pcm_samples5() {
+
+ if (vidx == 1) {
+ // final float[] vp = actual_v;
+
+ // int inc = v_inc;
+ // final float[] tmpOut = _tmpOut;
+ int dvp = 0;
+
+ // fat chance of having this loop unroll
+ for ( int i = 0; i < 32; i++) {
+ // final float[] dp = d16[i];
+ float pcm_sample;
+
+ pcm_sample =
+ (float) (((v1[5 + dvp] * d16[i][0]) + (v1[4 + dvp] * d16[i][1])
+ + (v1[3 + dvp] * d16[i][2]) + (v1[2 + dvp] * d16[i][3]) + (v1[1 + dvp] * d16[i][4])
+ + (v1[0 + dvp] * d16[i][5]) + (v1[15 + dvp] * d16[i][6])
+ + (v1[14 + dvp] * d16[i][7]) + (v1[13 + dvp] * d16[i][8])
+ + (v1[12 + dvp] * d16[i][9]) + (v1[11 + dvp] * d16[i][10])
+ + (v1[10 + dvp] * d16[i][11]) + (v1[9 + dvp] * d16[i][12])
+ + (v1[8 + dvp] * d16[i][13]) + (v1[7 + dvp] * d16[i][14]) + (v1[6 + dvp] * d16[i][15])) * scalefactor);
+
+ _tmpOut[i] = pcm_sample;
+
+ dvp += 16;
+ } // for
+ } else {
+ // final float[] vp = actual_v;
+
+ // int inc = v_inc;
+ // final float[] tmpOut = _tmpOut;
+ int dvp = 0;
+
+ // fat chance of having this loop unroll
+ for ( int i = 0; i < 32; i++) {
+ // final float[] dp = d16[i];
+ float pcm_sample;
+
+ pcm_sample =
+ (float) (((v2[5 + dvp] * d16[i][0]) + (v2[4 + dvp] * d16[i][1])
+ + (v2[3 + dvp] * d16[i][2]) + (v2[2 + dvp] * d16[i][3]) + (v2[1 + dvp] * d16[i][4])
+ + (v2[0 + dvp] * d16[i][5]) + (v2[15 + dvp] * d16[i][6])
+ + (v2[14 + dvp] * d16[i][7]) + (v2[13 + dvp] * d16[i][8])
+ + (v2[12 + dvp] * d16[i][9]) + (v2[11 + dvp] * d16[i][10])
+ + (v2[10 + dvp] * d16[i][11]) + (v2[9 + dvp] * d16[i][12])
+ + (v2[8 + dvp] * d16[i][13]) + (v2[7 + dvp] * d16[i][14]) + (v2[6 + dvp] * d16[i][15])) * scalefactor);
+
+ _tmpOut[i] = pcm_sample;
+
+ dvp += 16;
+ } // for
+ }
+
+ }
+
+ private void compute_pcm_samples6() {
+
+ if (vidx == 1) {
+
+ // final float[] vp = actual_v;
+ // int inc = v_inc;
+ // final float[] tmpOut = _tmpOut;
+ int dvp = 0;
+
+ // fat chance of having this loop unroll
+ for ( int i = 0; i < 32; i++) {
+ // final float[] dp = d16[i];
+ float pcm_sample;
+
+ pcm_sample =
+ (float) (((v1[6 + dvp] * d16[i][0]) + (v1[5 + dvp] * d16[i][1])
+ + (v1[4 + dvp] * d16[i][2]) + (v1[3 + dvp] * d16[i][3]) + (v1[2 + dvp] * d16[i][4])
+ + (v1[1 + dvp] * d16[i][5]) + (v1[0 + dvp] * d16[i][6])
+ + (v1[15 + dvp] * d16[i][7]) + (v1[14 + dvp] * d16[i][8])
+ + (v1[13 + dvp] * d16[i][9]) + (v1[12 + dvp] * d16[i][10])
+ + (v1[11 + dvp] * d16[i][11]) + (v1[10 + dvp] * d16[i][12])
+ + (v1[9 + dvp] * d16[i][13]) + (v1[8 + dvp] * d16[i][14]) + (v1[7 + dvp] * d16[i][15])) * scalefactor);
+
+ _tmpOut[i] = pcm_sample;
+
+ dvp += 16;
+ } // for
+ } else {
+
+ // final float[] vp = actual_v;
+ // int inc = v_inc;
+ // final float[] tmpOut = _tmpOut;
+ int dvp = 0;
+
+ // fat chance of having this loop unroll
+ for ( int i = 0; i < 32; i++) {
+ // final float[] dp = d16[i];
+ float pcm_sample;
+
+ pcm_sample =
+ (float) (((v2[6 + dvp] * d16[i][0]) + (v2[5 + dvp] * d16[i][1])
+ + (v2[4 + dvp] * d16[i][2]) + (v2[3 + dvp] * d16[i][3]) + (v2[2 + dvp] * d16[i][4])
+ + (v2[1 + dvp] * d16[i][5]) + (v2[0 + dvp] * d16[i][6])
+ + (v2[15 + dvp] * d16[i][7]) + (v2[14 + dvp] * d16[i][8])
+ + (v2[13 + dvp] * d16[i][9]) + (v2[12 + dvp] * d16[i][10])
+ + (v2[11 + dvp] * d16[i][11]) + (v2[10 + dvp] * d16[i][12])
+ + (v2[9 + dvp] * d16[i][13]) + (v2[8 + dvp] * d16[i][14]) + (v2[7 + dvp] * d16[i][15])) * scalefactor);
+
+ _tmpOut[i] = pcm_sample;
+
+ dvp += 16;
+ } // for
+ }
+
+ }
+
+ private void compute_pcm_samples7() {
+
+ if (vidx == 1) {
+ // final float[] vp = actual_v;
+
+ // int inc = v_inc;
+ // final float[] tmpOut = _tmpOut;
+ int dvp = 0;
+
+ // fat chance of having this loop unroll
+ for ( int i = 0; i < 32; i++) {
+ // final float[] dp = d16[i];
+ float pcm_sample;
+
+ pcm_sample =
+ (float) (((v1[7 + dvp] * d16[i][0]) + (v1[6 + dvp] * d16[i][1])
+ + (v1[5 + dvp] * d16[i][2]) + (v1[4 + dvp] * d16[i][3]) + (v1[3 + dvp] * d16[i][4])
+ + (v1[2 + dvp] * d16[i][5]) + (v1[1 + dvp] * d16[i][6]) + (v1[0 + dvp] * d16[i][7])
+ + (v1[15 + dvp] * d16[i][8]) + (v1[14 + dvp] * d16[i][9])
+ + (v1[13 + dvp] * d16[i][10]) + (v1[12 + dvp] * d16[i][11])
+ + (v1[11 + dvp] * d16[i][12]) + (v1[10 + dvp] * d16[i][13])
+ + (v1[9 + dvp] * d16[i][14]) + (v1[8 + dvp] * d16[i][15])) * scalefactor);
+
+ _tmpOut[i] = pcm_sample;
+
+ dvp += 16;
+ } // for
+ } else {
+ // final float[] vp = actual_v;
+
+ // int inc = v_inc;
+ // final float[] tmpOut = _tmpOut;
+ int dvp = 0;
+
+ // fat chance of having this loop unroll
+ for ( int i = 0; i < 32; i++) {
+ // final float[] dp = d16[i];
+ float pcm_sample;
+
+ pcm_sample =
+ (float) (((v2[7 + dvp] * d16[i][0]) + (v2[6 + dvp] * d16[i][1])
+ + (v2[5 + dvp] * d16[i][2]) + (v2[4 + dvp] * d16[i][3]) + (v2[3 + dvp] * d16[i][4])
+ + (v2[2 + dvp] * d16[i][5]) + (v2[1 + dvp] * d16[i][6]) + (v2[0 + dvp] * d16[i][7])
+ + (v2[15 + dvp] * d16[i][8]) + (v2[14 + dvp] * d16[i][9])
+ + (v2[13 + dvp] * d16[i][10]) + (v2[12 + dvp] * d16[i][11])
+ + (v2[11 + dvp] * d16[i][12]) + (v2[10 + dvp] * d16[i][13])
+ + (v2[9 + dvp] * d16[i][14]) + (v2[8 + dvp] * d16[i][15])) * scalefactor);
+
+ _tmpOut[i] = pcm_sample;
+
+ dvp += 16;
+ } // for
+ }
+
+ }
+
+ private void compute_pcm_samples8() {
+
+ if (vidx == 1) {
+
+ // final float[] vp = actual_v;
+
+ // int inc = v_inc;
+ // final float[] tmpOut = _tmpOut;
+ int dvp = 0;
+
+ // fat chance of having this loop unroll
+ for ( int i = 0; i < 32; i++) {
+ // final float[] dp = d16[i];
+ float pcm_sample;
+
+ pcm_sample =
+ (float) (((v1[8 + dvp] * d16[i][0]) + (v1[7 + dvp] * d16[i][1])
+ + (v1[6 + dvp] * d16[i][2]) + (v1[5 + dvp] * d16[i][3]) + (v1[4 + dvp] * d16[i][4])
+ + (v1[3 + dvp] * d16[i][5]) + (v1[2 + dvp] * d16[i][6]) + (v1[1 + dvp] * d16[i][7])
+ + (v1[0 + dvp] * d16[i][8]) + (v1[15 + dvp] * d16[i][9])
+ + (v1[14 + dvp] * d16[i][10]) + (v1[13 + dvp] * d16[i][11])
+ + (v1[12 + dvp] * d16[i][12]) + (v1[11 + dvp] * d16[i][13])
+ + (v1[10 + dvp] * d16[i][14]) + (v1[9 + dvp] * d16[i][15])) * scalefactor);
+
+ _tmpOut[i] = pcm_sample;
+
+ dvp += 16;
+ } // for
+ } else {
+
+ // final float[] vp = actual_v;
+
+ // int inc = v_inc;
+ // final float[] tmpOut = _tmpOut;
+ int dvp = 0;
+
+ // fat chance of having this loop unroll
+ for ( int i = 0; i < 32; i++) {
+ // final float[] dp = d16[i];
+ float pcm_sample;
+
+ pcm_sample =
+ (float) (((v2[8 + dvp] * d16[i][0]) + (v2[7 + dvp] * d16[i][1])
+ + (v2[6 + dvp] * d16[i][2]) + (v2[5 + dvp] * d16[i][3]) + (v2[4 + dvp] * d16[i][4])
+ + (v2[3 + dvp] * d16[i][5]) + (v2[2 + dvp] * d16[i][6]) + (v2[1 + dvp] * d16[i][7])
+ + (v2[0 + dvp] * d16[i][8]) + (v2[15 + dvp] * d16[i][9])
+ + (v2[14 + dvp] * d16[i][10]) + (v2[13 + dvp] * d16[i][11])
+ + (v2[12 + dvp] * d16[i][12]) + (v2[11 + dvp] * d16[i][13])
+ + (v2[10 + dvp] * d16[i][14]) + (v2[9 + dvp] * d16[i][15])) * scalefactor);
+
+ _tmpOut[i] = pcm_sample;
+
+ dvp += 16;
+ } // for
+ }
+
+ }
+
+ private void compute_pcm_samples9() {
+
+ if (vidx == 1) {
+ // final float[] vp = actual_v;
+
+ // int inc = v_inc;
+ // final float[] tmpOut = _tmpOut;
+ int dvp = 0;
+
+ // fat chance of having this loop unroll
+ for ( int i = 0; i < 32; i++) {
+ // final float[] dp = d16[i];
+ float pcm_sample;
+
+ pcm_sample =
+ (float) (((v1[9 + dvp] * d16[i][0]) + (v1[8 + dvp] * d16[i][1])
+ + (v1[7 + dvp] * d16[i][2]) + (v1[6 + dvp] * d16[i][3]) + (v1[5 + dvp] * d16[i][4])
+ + (v1[4 + dvp] * d16[i][5]) + (v1[3 + dvp] * d16[i][6]) + (v1[2 + dvp] * d16[i][7])
+ + (v1[1 + dvp] * d16[i][8]) + (v1[0 + dvp] * d16[i][9])
+ + (v1[15 + dvp] * d16[i][10]) + (v1[14 + dvp] * d16[i][11])
+ + (v1[13 + dvp] * d16[i][12]) + (v1[12 + dvp] * d16[i][13])
+ + (v1[11 + dvp] * d16[i][14]) + (v1[10 + dvp] * d16[i][15])) * scalefactor);
+
+ _tmpOut[i] = pcm_sample;
+
+ dvp += 16;
+ } // for
+ } else {
+ // final float[] vp = actual_v;
+
+ // int inc = v_inc;
+ // final float[] tmpOut = _tmpOut;
+ int dvp = 0;
+
+ // fat chance of having this loop unroll
+ for ( int i = 0; i < 32; i++) {
+ // final float[] dp = d16[i];
+ float pcm_sample;
+
+ pcm_sample =
+ (float) (((v2[9 + dvp] * d16[i][0]) + (v2[8 + dvp] * d16[i][1])
+ + (v2[7 + dvp] * d16[i][2]) + (v2[6 + dvp] * d16[i][3]) + (v2[5 + dvp] * d16[i][4])
+ + (v2[4 + dvp] * d16[i][5]) + (v2[3 + dvp] * d16[i][6]) + (v2[2 + dvp] * d16[i][7])
+ + (v2[1 + dvp] * d16[i][8]) + (v2[0 + dvp] * d16[i][9])
+ + (v2[15 + dvp] * d16[i][10]) + (v2[14 + dvp] * d16[i][11])
+ + (v2[13 + dvp] * d16[i][12]) + (v2[12 + dvp] * d16[i][13])
+ + (v2[11 + dvp] * d16[i][14]) + (v2[10 + dvp] * d16[i][15])) * scalefactor);
+
+ _tmpOut[i] = pcm_sample;
+
+ dvp += 16;
+ } // for
+ }
+
+ }
+
+ private void compute_pcm_samples10() {
+ if (vidx == 1) {
+ // final float[] vp = actual_v;
+ // int inc = v_inc;
+ // final float[] tmpOut = _tmpOut;
+ int dvp = 0;
+
+ // fat chance of having this loop unroll
+ for ( int i = 0; i < 32; i++) {
+ // final float[] dp = d16[i];
+ float pcm_sample;
+
+ pcm_sample =
+ (float) (((v1[10 + dvp] * d16[i][0]) + (v1[9 + dvp] * d16[i][1])
+ + (v1[8 + dvp] * d16[i][2]) + (v1[7 + dvp] * d16[i][3]) + (v1[6 + dvp] * d16[i][4])
+ + (v1[5 + dvp] * d16[i][5]) + (v1[4 + dvp] * d16[i][6]) + (v1[3 + dvp] * d16[i][7])
+ + (v1[2 + dvp] * d16[i][8]) + (v1[1 + dvp] * d16[i][9])
+ + (v1[0 + dvp] * d16[i][10]) + (v1[15 + dvp] * d16[i][11])
+ + (v1[14 + dvp] * d16[i][12]) + (v1[13 + dvp] * d16[i][13])
+ + (v1[12 + dvp] * d16[i][14]) + (v1[11 + dvp] * d16[i][15])) * scalefactor);
+
+ _tmpOut[i] = pcm_sample;
+
+ dvp += 16;
+ } // for
+ } else {
+ // final float[] vp = actual_v;
+ // int inc = v_inc;
+ // final float[] tmpOut = _tmpOut;
+ int dvp = 0;
+
+ // fat chance of having this loop unroll
+ for ( int i = 0; i < 32; i++) {
+ // final float[] dp = d16[i];
+ float pcm_sample;
+
+ pcm_sample =
+ (float) (((v2[10 + dvp] * d16[i][0]) + (v2[9 + dvp] * d16[i][1])
+ + (v2[8 + dvp] * d16[i][2]) + (v2[7 + dvp] * d16[i][3]) + (v2[6 + dvp] * d16[i][4])
+ + (v2[5 + dvp] * d16[i][5]) + (v2[4 + dvp] * d16[i][6]) + (v2[3 + dvp] * d16[i][7])
+ + (v2[2 + dvp] * d16[i][8]) + (v2[1 + dvp] * d16[i][9])
+ + (v2[0 + dvp] * d16[i][10]) + (v2[15 + dvp] * d16[i][11])
+ + (v2[14 + dvp] * d16[i][12]) + (v2[13 + dvp] * d16[i][13])
+ + (v2[12 + dvp] * d16[i][14]) + (v2[11 + dvp] * d16[i][15])) * scalefactor);
+
+ _tmpOut[i] = pcm_sample;
+
+ dvp += 16;
+ } // for
+ }
+
+ }
+
+ private void compute_pcm_samples11() {
+
+ if (vidx == 1) {
+ // final float[] vp = actual_v;
+
+ // int inc = v_inc;
+ // final float[] tmpOut = _tmpOut;
+ int dvp = 0;
+
+ // fat chance of having this loop unroll
+ for ( int i = 0; i < 32; i++) {
+ // final float[] dp = d16[i];
+ float pcm_sample;
+
+ pcm_sample =
+ (float) (((v1[11 + dvp] * d16[i][0]) + (v1[10 + dvp] * d16[i][1])
+ + (v1[9 + dvp] * d16[i][2]) + (v1[8 + dvp] * d16[i][3]) + (v1[7 + dvp] * d16[i][4])
+ + (v1[6 + dvp] * d16[i][5]) + (v1[5 + dvp] * d16[i][6]) + (v1[4 + dvp] * d16[i][7])
+ + (v1[3 + dvp] * d16[i][8]) + (v1[2 + dvp] * d16[i][9])
+ + (v1[1 + dvp] * d16[i][10]) + (v1[0 + dvp] * d16[i][11])
+ + (v1[15 + dvp] * d16[i][12]) + (v1[14 + dvp] * d16[i][13])
+ + (v1[13 + dvp] * d16[i][14]) + (v1[12 + dvp] * d16[i][15])) * scalefactor);
+
+ _tmpOut[i] = pcm_sample;
+
+ dvp += 16;
+ } // for
+ } else {
+ // final float[] vp = actual_v;
+
+ // int inc = v_inc;
+ // final float[] tmpOut = _tmpOut;
+ int dvp = 0;
+
+ // fat chance of having this loop unroll
+ for ( int i = 0; i < 32; i++) {
+ // final float[] dp = d16[i];
+ float pcm_sample;
+
+ pcm_sample =
+ (float) (((v2[11 + dvp] * d16[i][0]) + (v2[10 + dvp] * d16[i][1])
+ + (v2[9 + dvp] * d16[i][2]) + (v2[8 + dvp] * d16[i][3]) + (v2[7 + dvp] * d16[i][4])
+ + (v2[6 + dvp] * d16[i][5]) + (v2[5 + dvp] * d16[i][6]) + (v2[4 + dvp] * d16[i][7])
+ + (v2[3 + dvp] * d16[i][8]) + (v2[2 + dvp] * d16[i][9])
+ + (v2[1 + dvp] * d16[i][10]) + (v2[0 + dvp] * d16[i][11])
+ + (v2[15 + dvp] * d16[i][12]) + (v2[14 + dvp] * d16[i][13])
+ + (v2[13 + dvp] * d16[i][14]) + (v2[12 + dvp] * d16[i][15])) * scalefactor);
+
+ _tmpOut[i] = pcm_sample;
+
+ dvp += 16;
+ } // for
+ }
+
+ }
+
+ private void compute_pcm_samples12() {
+
+ if (vidx == 1) {
+ // final float[] vp = actual_v;
+ // int inc = v_inc;
+ // final float[] tmpOut = _tmpOut;
+ int dvp = 0;
+
+ // fat chance of having this loop unroll
+ for ( int i = 0; i < 32; i++) {
+ // final float[] dp = d16[i];
+ float pcm_sample;
+
+ pcm_sample =
+ (float) (((v1[12 + dvp] * d16[i][0]) + (v1[11 + dvp] * d16[i][1])
+ + (v1[10 + dvp] * d16[i][2]) + (v1[9 + dvp] * d16[i][3])
+ + (v1[8 + dvp] * d16[i][4]) + (v1[7 + dvp] * d16[i][5]) + (v1[6 + dvp] * d16[i][6])
+ + (v1[5 + dvp] * d16[i][7]) + (v1[4 + dvp] * d16[i][8]) + (v1[3 + dvp] * d16[i][9])
+ + (v1[2 + dvp] * d16[i][10]) + (v1[1 + dvp] * d16[i][11])
+ + (v1[0 + dvp] * d16[i][12]) + (v1[15 + dvp] * d16[i][13])
+ + (v1[14 + dvp] * d16[i][14]) + (v1[13 + dvp] * d16[i][15])) * scalefactor);
+
+ _tmpOut[i] = pcm_sample;
+
+ dvp += 16;
+ } // for
+ } else {
+ // final float[] vp = actual_v;
+ // int inc = v_inc;
+ // final float[] tmpOut = _tmpOut;
+ int dvp = 0;
+
+ // fat chance of having this loop unroll
+ for ( int i = 0; i < 32; i++) {
+ // final float[] dp = d16[i];
+ float pcm_sample;
+
+ pcm_sample =
+ (float) (((v2[12 + dvp] * d16[i][0]) + (v2[11 + dvp] * d16[i][1])
+ + (v2[10 + dvp] * d16[i][2]) + (v2[9 + dvp] * d16[i][3])
+ + (v2[8 + dvp] * d16[i][4]) + (v2[7 + dvp] * d16[i][5]) + (v2[6 + dvp] * d16[i][6])
+ + (v2[5 + dvp] * d16[i][7]) + (v2[4 + dvp] * d16[i][8]) + (v2[3 + dvp] * d16[i][9])
+ + (v2[2 + dvp] * d16[i][10]) + (v2[1 + dvp] * d16[i][11])
+ + (v2[0 + dvp] * d16[i][12]) + (v2[15 + dvp] * d16[i][13])
+ + (v2[14 + dvp] * d16[i][14]) + (v2[13 + dvp] * d16[i][15])) * scalefactor);
+
+ _tmpOut[i] = pcm_sample;
+
+ dvp += 16;
+ } // for
+ }
+
+ }
+
+ private void compute_pcm_samples13() {
+
+ if (vidx == 1) {
+ // final float[] vp = actual_v;
+
+ // int inc = v_inc;
+ // final float[] tmpOut = _tmpOut;
+ int dvp = 0;
+
+ // fat chance of having this loop unroll
+ for ( int i = 0; i < 32; i++) {
+ // final float[] dp = d16[i];
+ float pcm_sample;
+
+ pcm_sample =
+ (float) (((v1[13 + dvp] * d16[i][0]) + (v1[12 + dvp] * d16[i][1])
+ + (v1[11 + dvp] * d16[i][2]) + (v1[10 + dvp] * d16[i][3])
+ + (v1[9 + dvp] * d16[i][4]) + (v1[8 + dvp] * d16[i][5]) + (v1[7 + dvp] * d16[i][6])
+ + (v1[6 + dvp] * d16[i][7]) + (v1[5 + dvp] * d16[i][8]) + (v1[4 + dvp] * d16[i][9])
+ + (v1[3 + dvp] * d16[i][10]) + (v1[2 + dvp] * d16[i][11])
+ + (v1[1 + dvp] * d16[i][12]) + (v1[0 + dvp] * d16[i][13])
+ + (v1[15 + dvp] * d16[i][14]) + (v1[14 + dvp] * d16[i][15])) * scalefactor);
+
+ _tmpOut[i] = pcm_sample;
+
+ dvp += 16;
+ } // for
+ } else {
+ // final float[] vp = actual_v;
+
+ // int inc = v_inc;
+ // final float[] tmpOut = _tmpOut;
+ int dvp = 0;
+
+ // fat chance of having this loop unroll
+ for ( int i = 0; i < 32; i++) {
+ // final float[] dp = d16[i];
+ float pcm_sample;
+
+ pcm_sample =
+ (float) (((v2[13 + dvp] * d16[i][0]) + (v2[12 + dvp] * d16[i][1])
+ + (v2[11 + dvp] * d16[i][2]) + (v2[10 + dvp] * d16[i][3])
+ + (v2[9 + dvp] * d16[i][4]) + (v2[8 + dvp] * d16[i][5]) + (v2[7 + dvp] * d16[i][6])
+ + (v2[6 + dvp] * d16[i][7]) + (v2[5 + dvp] * d16[i][8]) + (v2[4 + dvp] * d16[i][9])
+ + (v2[3 + dvp] * d16[i][10]) + (v2[2 + dvp] * d16[i][11])
+ + (v2[1 + dvp] * d16[i][12]) + (v2[0 + dvp] * d16[i][13])
+ + (v2[15 + dvp] * d16[i][14]) + (v2[14 + dvp] * d16[i][15])) * scalefactor);
+
+ _tmpOut[i] = pcm_sample;
+
+ dvp += 16;
+ } // for
+ }
+
+ }
+
+ private void compute_pcm_samples14() {
+
+ if (vidx == 1) {
+ // final float[] vp = actual_v;
+
+ // int inc = v_inc;
+ // final float[] tmpOut = _tmpOut;
+ int dvp = 0;
+
+ // fat chance of having this loop unroll
+ for ( int i = 0; i < 32; i++) {
+ // final float[] dp = d16[i];
+ float pcm_sample;
+
+ pcm_sample =
+ (float) (((v1[14 + dvp] * d16[i][0]) + (v1[13 + dvp] * d16[i][1])
+ + (v1[12 + dvp] * d16[i][2]) + (v1[11 + dvp] * d16[i][3])
+ + (v1[10 + dvp] * d16[i][4]) + (v1[9 + dvp] * d16[i][5])
+ + (v1[8 + dvp] * d16[i][6]) + (v1[7 + dvp] * d16[i][7]) + (v1[6 + dvp] * d16[i][8])
+ + (v1[5 + dvp] * d16[i][9]) + (v1[4 + dvp] * d16[i][10])
+ + (v1[3 + dvp] * d16[i][11]) + (v1[2 + dvp] * d16[i][12])
+ + (v1[1 + dvp] * d16[i][13]) + (v1[0 + dvp] * d16[i][14]) + (v1[15 + dvp] * d16[i][15])) * scalefactor);
+
+ _tmpOut[i] = pcm_sample;
+
+ dvp += 16;
+ } // for
+ } else {
+ // final float[] vp = actual_v;
+
+ // int inc = v_inc;
+ // final float[] tmpOut = _tmpOut;
+ int dvp = 0;
+
+ // fat chance of having this loop unroll
+ for ( int i = 0; i < 32; i++) {
+ // final float[] dp = d16[i];
+ float pcm_sample;
+
+ pcm_sample =
+ (float) (((v2[14 + dvp] * d16[i][0]) + (v2[13 + dvp] * d16[i][1])
+ + (v2[12 + dvp] * d16[i][2]) + (v2[11 + dvp] * d16[i][3])
+ + (v2[10 + dvp] * d16[i][4]) + (v2[9 + dvp] * d16[i][5])
+ + (v2[8 + dvp] * d16[i][6]) + (v2[7 + dvp] * d16[i][7]) + (v2[6 + dvp] * d16[i][8])
+ + (v2[5 + dvp] * d16[i][9]) + (v2[4 + dvp] * d16[i][10])
+ + (v2[3 + dvp] * d16[i][11]) + (v2[2 + dvp] * d16[i][12])
+ + (v2[1 + dvp] * d16[i][13]) + (v2[0 + dvp] * d16[i][14]) + (v2[15 + dvp] * d16[i][15])) * scalefactor);
+
+ _tmpOut[i] = pcm_sample;
+
+ dvp += 16;
+ } // for
+ }
+
+ }
+
+ private void compute_pcm_samples15() {
+ if (vidx == 1) {
+ // final float[] vp = actual_v;
+
+ // int inc = v_inc;
+ // final float[] tmpOut = _tmpOut;
+ int dvp = 0;
+
+ // fat chance of having this loop unroll
+ for ( int i = 0; i < 32; i++) {
+ float pcm_sample;
+ // final float d16[i][] = d16[i];
+ pcm_sample =
+ (float) (((v1[15 + dvp] * d16[i][0]) + (v1[14 + dvp] * d16[i][1])
+ + (v1[13 + dvp] * d16[i][2]) + (v1[12 + dvp] * d16[i][3])
+ + (v1[11 + dvp] * d16[i][4]) + (v1[10 + dvp] * d16[i][5])
+ + (v1[9 + dvp] * d16[i][6]) + (v1[8 + dvp] * d16[i][7]) + (v1[7 + dvp] * d16[i][8])
+ + (v1[6 + dvp] * d16[i][9]) + (v1[5 + dvp] * d16[i][10])
+ + (v1[4 + dvp] * d16[i][11]) + (v1[3 + dvp] * d16[i][12])
+ + (v1[2 + dvp] * d16[i][13]) + (v1[1 + dvp] * d16[i][14]) + (v1[0 + dvp] * d16[i][15])) * scalefactor);
+
+ _tmpOut[i] = pcm_sample;
+ dvp += 16;
+ } // for
+ } else {
+ // final float[] vp = actual_v;
+
+ // int inc = v_inc;
+ // final float[] tmpOut = _tmpOut;
+ int dvp = 0;
+
+ // fat chance of having this loop unroll
+ for ( int i = 0; i < 32; i++) {
+ float pcm_sample;
+ // final float d16[i][] = d16[i];
+ pcm_sample =
+ (float) (((v2[15 + dvp] * d16[i][0]) + (v2[14 + dvp] * d16[i][1])
+ + (v2[13 + dvp] * d16[i][2]) + (v2[12 + dvp] * d16[i][3])
+ + (v2[11 + dvp] * d16[i][4]) + (v2[10 + dvp] * d16[i][5])
+ + (v2[9 + dvp] * d16[i][6]) + (v2[8 + dvp] * d16[i][7]) + (v2[7 + dvp] * d16[i][8])
+ + (v2[6 + dvp] * d16[i][9]) + (v2[5 + dvp] * d16[i][10])
+ + (v2[4 + dvp] * d16[i][11]) + (v2[3 + dvp] * d16[i][12])
+ + (v2[2 + dvp] * d16[i][13]) + (v2[1 + dvp] * d16[i][14]) + (v2[0 + dvp] * d16[i][15])) * scalefactor);
+
+ _tmpOut[i] = pcm_sample;
+ dvp += 16;
+ } // for
+ }
+
+ }
+
+ private void compute_pcm_samples() {
+
+ switch (actual_write_pos) {
+ case 0:
+ compute_pcm_samples0();
+ break;
+ case 1:
+ compute_pcm_samples1();
+ break;
+ case 2:
+ compute_pcm_samples2();
+ break;
+ case 3:
+ compute_pcm_samples3();
+ break;
+ case 4:
+ compute_pcm_samples4();
+ break;
+ case 5:
+ compute_pcm_samples5();
+ break;
+ case 6:
+ compute_pcm_samples6();
+ break;
+ case 7:
+ compute_pcm_samples7();
+ break;
+ case 8:
+ compute_pcm_samples8();
+ break;
+ case 9:
+ compute_pcm_samples9();
+ break;
+ case 10:
+ compute_pcm_samples10();
+ break;
+ case 11:
+ compute_pcm_samples11();
+ break;
+ case 12:
+ compute_pcm_samples12();
+ break;
+ case 13:
+ compute_pcm_samples13();
+ break;
+ case 14:
+ compute_pcm_samples14();
+ break;
+ case 15:
+ compute_pcm_samples15();
+ break;
+ }
+
+ // if (buffer != null) {
+ // buffer.appendSamples(channel, _tmpOut);
+ // }
+ SampleBufferWrapper.appendSamples(channel, _tmpOut);
+
+ /*
+ * // MDM: I was considering putting in quality control for // low-spec
+ * CPUs, but the performance gain (about 10-15%) // did not justify the
+ * considerable drop in audio quality. switch (inc) { case 16:
+ * buffer.appendSamples(channel, tmpOut); break; case 32: for (int i=0;
+ * i<16; i++) { buffer.append(channel, (short)tmpOut[i]);
+ * buffer.append(channel, (short)tmpOut[i]); } break; case 64: for (int i=0;
+ * i<8; i++) { buffer.append(channel, (short)tmpOut[i]);
+ * buffer.append(channel, (short)tmpOut[i]); buffer.append(channel,
+ * (short)tmpOut[i]); buffer.append(channel, (short)tmpOut[i]); } break;
+ *
+ * }
+ */
+ }
+
+
+ public void clear() {
+ // clear out v1,v2
+ SSJAVA.arrayinit(v1, 0);
+ SSJAVA.arrayinit(v2, 0);
+ // copy previous v1,v2
+
+ for ( int i = 0; i < prev1.length; i++) {
+ v1[i] = prev1[i];
+ }
+ for ( int i = 0; i < prev2.length; i++) {
+ v2[i] = prev2[i];
+ }
+ // clear out previous buffer
+ SSJAVA.arrayinit(prev1, 0);
+ SSJAVA.arrayinit(prev2, 0);
+ SSJAVA.arrayinit(samples, 0);
+ SSJAVA.arrayinit(_tmpOut, 0);
+ }
+
+ /**
+ * Calculate 32 PCM samples and put the into the Obuffer-object.
+ */
+
+ public void calculate_pcm_samples() {
+
+// System.out.println("#calculate_pcm_samples::actual_write_pos=" + actual_write_pos);
+
+ if (vidx == 1) {
+ compute_new_v1_v2();
+ } else {
+ compute_new_v2_v1();
+ }
+
+ // System.out.println("1.actual_v=" + (actual_v == v1) + " vidx=" + vidx);
+ // compute_new_v();
+ // System.out.println("2.actual_v=" + (actual_v == v1) + " vidx=" + vidx);
+ compute_pcm_samples();
+ // System.out.println("3.actual_v=" + (actual_v == v1) + " vidx=" + vidx);
+
+ actual_write_pos = (actual_write_pos + 1) & 0xf;
+// System.out.println("actual_write_pos="+actual_write_pos);
+ // actual_v = (actual_v == v1) ? v2 : v1;
+
+ if (vidx == 1) {
+ vidx = 2;
+ } else {
+ vidx = 1;
+ }
+
+ // initialize samples[]:
+ // for (register float *floatp = samples + 32; floatp > samples; )
+ // *--floatp = 0.0f;
+
+ // MDM: this may not be necessary. The Layer III decoder always
+ // outputs 32 subband samples, but I haven't checked layer I & II.
+ // for ( int p = 0; p < 32; p++){
+ // samples[p] = 0.0f;
+ // }
+ SSJAVA.arrayinit(samples, 0);
+ }
+
+ private static final double MY_PI = 3.14159265358979323846;
+ private static final float cos1_64 = (float) (1.0 / (2.0 * Math.cos(MY_PI / 64.0)));
+ private static final float cos3_64 = (float) (1.0 / (2.0 * Math.cos(MY_PI * 3.0 / 64.0)));
+ private static final float cos5_64 = (float) (1.0 / (2.0 * Math.cos(MY_PI * 5.0 / 64.0)));
+ private static final float cos7_64 = (float) (1.0 / (2.0 * Math.cos(MY_PI * 7.0 / 64.0)));
+ private static final float cos9_64 = (float) (1.0 / (2.0 * Math.cos(MY_PI * 9.0 / 64.0)));
+ private static final float cos11_64 = (float) (1.0 / (2.0 * Math.cos(MY_PI * 11.0 / 64.0)));
+ private static final float cos13_64 = (float) (1.0 / (2.0 * Math.cos(MY_PI * 13.0 / 64.0)));
+ private static final float cos15_64 = (float) (1.0 / (2.0 * Math.cos(MY_PI * 15.0 / 64.0)));
+ private static final float cos17_64 = (float) (1.0 / (2.0 * Math.cos(MY_PI * 17.0 / 64.0)));
+ private static final float cos19_64 = (float) (1.0 / (2.0 * Math.cos(MY_PI * 19.0 / 64.0)));
+ private static final float cos21_64 = (float) (1.0 / (2.0 * Math.cos(MY_PI * 21.0 / 64.0)));
+ private static final float cos23_64 = (float) (1.0 / (2.0 * Math.cos(MY_PI * 23.0 / 64.0)));
+ private static final float cos25_64 = (float) (1.0 / (2.0 * Math.cos(MY_PI * 25.0 / 64.0)));
+ private static final float cos27_64 = (float) (1.0 / (2.0 * Math.cos(MY_PI * 27.0 / 64.0)));
+ private static final float cos29_64 = (float) (1.0 / (2.0 * Math.cos(MY_PI * 29.0 / 64.0)));
+ private static final float cos31_64 = (float) (1.0 / (2.0 * Math.cos(MY_PI * 31.0 / 64.0)));
+ private static final float cos1_32 = (float) (1.0 / (2.0 * Math.cos(MY_PI / 32.0)));
+ private static final float cos3_32 = (float) (1.0 / (2.0 * Math.cos(MY_PI * 3.0 / 32.0)));
+ private static final float cos5_32 = (float) (1.0 / (2.0 * Math.cos(MY_PI * 5.0 / 32.0)));
+ private static final float cos7_32 = (float) (1.0 / (2.0 * Math.cos(MY_PI * 7.0 / 32.0)));
+ private static final float cos9_32 = (float) (1.0 / (2.0 * Math.cos(MY_PI * 9.0 / 32.0)));
+ private static final float cos11_32 = (float) (1.0 / (2.0 * Math.cos(MY_PI * 11.0 / 32.0)));
+ private static final float cos13_32 = (float) (1.0 / (2.0 * Math.cos(MY_PI * 13.0 / 32.0)));
+ private static final float cos15_32 = (float) (1.0 / (2.0 * Math.cos(MY_PI * 15.0 / 32.0)));
+ private static final float cos1_16 = (float) (1.0 / (2.0 * Math.cos(MY_PI / 16.0)));
+ private static final float cos3_16 = (float) (1.0 / (2.0 * Math.cos(MY_PI * 3.0 / 16.0)));
+ private static final float cos5_16 = (float) (1.0 / (2.0 * Math.cos(MY_PI * 5.0 / 16.0)));
+ private static final float cos7_16 = (float) (1.0 / (2.0 * Math.cos(MY_PI * 7.0 / 16.0)));
+ private static final float cos1_8 = (float) (1.0 / (2.0 * Math.cos(MY_PI / 8.0)));
+ private static final float cos3_8 = (float) (1.0 / (2.0 * Math.cos(MY_PI * 3.0 / 8.0)));
+ private static final float cos1_4 = (float) (1.0 / (2.0 * Math.cos(MY_PI / 4.0)));
+
+ // Note: These values are not in the same order
+ // as in Annex 3-B.3 of the ISO/IEC DIS 11172-3
+ // private float d[] = {0.000000000, -4.000442505};
+
+ /**
+ * d[] split into subarrays of length 16. This provides for more faster access
+ * by allowing a block of 16 to be addressed with constant offset.
+ **/
+ // TODO CONST
+
+ private final static float d16[][] = null;
+
+ /**
+ * Converts a 1D array into a number of smaller arrays. This is used to
+ * achieve offset + constant indexing into an array. Each sub-array represents
+ * a block of values of the original array.
+ *
+ * @param array
+ * The array to split up into blocks.
+ * @param blockSize
+ * The size of the blocks to split the array into. This must be an
+ * exact divisor of the length of the array, or some data will be
+ * lost from the main array.
+ *
+ * @return An array of arrays in which each element in the returned array will
+ * be of length blockSize
.
+ */
+ static private float[][] splitArray(final float[] array, final int blockSize) {
+ int size = array.length / blockSize;
+ float[][] split = new float[size][];
+ for (int i = 0; i < size; i++) {
+ split[i] = subArray(array, i * blockSize, blockSize);
+ }
+ return split;
+ }
+
+ /**
+ * Returns a subarray of an existing array.
+ *
+ * @param array
+ * The array to retrieve a subarra from.
+ * @param offs
+ * The offset in the array that corresponds to the first index of the
+ * subarray.
+ * @param len
+ * The number of indeces in the subarray.
+ * @return The subarray, which may be of length 0.
+ */
+ static private float[] subArray(final float[] array, final int offs, int len) {
+ if (offs + len > array.length) {
+ len = array.length - offs;
+ }
+
+ if (len < 0)
+ len = 0;
+
+ float[] subarray = new float[len];
+ for (int i = 0; i < len; i++) {
+ subarray[i] = array[offs + i];
+ }
+
+ return subarray;
+ }
+
+ // The original data for d[]. This data is loaded from a file
+ // to reduce the overall package size and to improve performance.
+
+ static final float d[] = { 0.000000000f, -0.000442505f, 0.003250122f, -0.007003784f,
+ 0.031082153f, -0.078628540f, 0.100311279f, -0.572036743f, 1.144989014f, 0.572036743f,
+ 0.100311279f, 0.078628540f, 0.031082153f, 0.007003784f, 0.003250122f, 0.000442505f,
+ -0.000015259f, -0.000473022f, 0.003326416f, -0.007919312f, 0.030517578f, -0.084182739f,
+ 0.090927124f, -0.600219727f, 1.144287109f, 0.543823242f, 0.108856201f, 0.073059082f,
+ 0.031478882f, 0.006118774f, 0.003173828f, 0.000396729f, -0.000015259f, -0.000534058f,
+ 0.003387451f, -0.008865356f, 0.029785156f, -0.089706421f, 0.080688477f, -0.628295898f,
+ 1.142211914f, 0.515609741f, 0.116577148f, 0.067520142f, 0.031738281f, 0.005294800f,
+ 0.003082275f, 0.000366211f, -0.000015259f, -0.000579834f, 0.003433228f, -0.009841919f,
+ 0.028884888f, -0.095169067f, 0.069595337f, -0.656219482f, 1.138763428f, 0.487472534f,
+ 0.123474121f, 0.061996460f, 0.031845093f, 0.004486084f, 0.002990723f, 0.000320435f,
+ -0.000015259f, -0.000625610f, 0.003463745f, -0.010848999f, 0.027801514f, -0.100540161f,
+ 0.057617188f, -0.683914185f, 1.133926392f, 0.459472656f, 0.129577637f, 0.056533813f,
+ 0.031814575f, 0.003723145f, 0.002899170f, 0.000289917f, -0.000015259f, -0.000686646f,
+ 0.003479004f, -0.011886597f, 0.026535034f, -0.105819702f, 0.044784546f, -0.711318970f,
+ 1.127746582f, 0.431655884f, 0.134887695f, 0.051132202f, 0.031661987f, 0.003005981f,
+ 0.002792358f, 0.000259399f, -0.000015259f, -0.000747681f, 0.003479004f, -0.012939453f,
+ 0.025085449f, -0.110946655f, 0.031082153f, -0.738372803f, 1.120223999f, 0.404083252f,
+ 0.139450073f, 0.045837402f, 0.031387329f, 0.002334595f, 0.002685547f, 0.000244141f,
+ -0.000030518f, -0.000808716f, 0.003463745f, -0.014022827f, 0.023422241f, -0.115921021f,
+ 0.016510010f, -0.765029907f, 1.111373901f, 0.376800537f, 0.143264771f, 0.040634155f,
+ 0.031005859f, 0.001693726f, 0.002578735f, 0.000213623f, -0.000030518f, -0.000885010f,
+ 0.003417969f, -0.015121460f, 0.021575928f, -0.120697021f, 0.001068115f, -0.791213989f,
+ 1.101211548f, 0.349868774f, 0.146362305f, 0.035552979f, 0.030532837f, 0.001098633f,
+ 0.002456665f, 0.000198364f, -0.000030518f, -0.000961304f, 0.003372192f, -0.016235352f,
+ 0.019531250f, -0.125259399f, -0.015228271f, -0.816864014f, 1.089782715f, 0.323318481f,
+ 0.148773193f, 0.030609131f, 0.029937744f, 0.000549316f, 0.002349854f, 0.000167847f,
+ -0.000030518f, -0.001037598f, 0.003280640f, -0.017349243f, 0.017257690f, -0.129562378f,
+ -0.032379150f, -0.841949463f, 1.077117920f, 0.297210693f, 0.150497437f, 0.025817871f,
+ 0.029281616f, 0.000030518f, 0.002243042f, 0.000152588f, -0.000045776f, -0.001113892f,
+ 0.003173828f, -0.018463135f, 0.014801025f, -0.133590698f, -0.050354004f, -0.866363525f,
+ 1.063217163f, 0.271591187f, 0.151596069f, 0.021179199f, 0.028533936f, -0.000442505f,
+ 0.002120972f, 0.000137329f, -0.000045776f, -0.001205444f, 0.003051758f, -0.019577026f,
+ 0.012115479f, -0.137298584f, -0.069168091f, -0.890090942f, 1.048156738f, 0.246505737f,
+ 0.152069092f, 0.016708374f, 0.027725220f, -0.000869751f, 0.002014160f, 0.000122070f,
+ -0.000061035f, -0.001296997f, 0.002883911f, -0.020690918f, 0.009231567f, -0.140670776f,
+ -0.088775635f, -0.913055420f, 1.031936646f, 0.221984863f, 0.151962280f, 0.012420654f,
+ 0.026840210f, -0.001266479f, 0.001907349f, 0.000106812f, -0.000061035f, -0.001388550f,
+ 0.002700806f, -0.021789551f, 0.006134033f, -0.143676758f, -0.109161377f, -0.935195923f,
+ 1.014617920f, 0.198059082f, 0.151306152f, 0.008316040f, 0.025909424f, -0.001617432f,
+ 0.001785278f, 0.000106812f, -0.000076294f, -0.001480103f, 0.002487183f, -0.022857666f,
+ 0.002822876f, -0.146255493f, -0.130310059f, -0.956481934f, 0.996246338f, 0.174789429f,
+ 0.150115967f, 0.004394531f, 0.024932861f, -0.001937866f, 0.001693726f, 0.000091553f,
+ -0.000076294f, -0.001586914f, 0.002227783f, -0.023910522f, -0.000686646f, -0.148422241f,
+ -0.152206421f, -0.976852417f, 0.976852417f, 0.152206421f, 0.148422241f, 0.000686646f,
+ 0.023910522f, -0.002227783f, 0.001586914f, 0.000076294f, -0.000091553f, -0.001693726f,
+ 0.001937866f, -0.024932861f, -0.004394531f, -0.150115967f, -0.174789429f, -0.996246338f,
+ 0.956481934f, 0.130310059f, 0.146255493f, -0.002822876f, 0.022857666f, -0.002487183f,
+ 0.001480103f, 0.000076294f, -0.000106812f, -0.001785278f, 0.001617432f, -0.025909424f,
+ -0.008316040f, -0.151306152f, -0.198059082f, -1.014617920f, 0.935195923f, 0.109161377f,
+ 0.143676758f, -0.006134033f, 0.021789551f, -0.002700806f, 0.001388550f, 0.000061035f,
+ -0.000106812f, -0.001907349f, 0.001266479f, -0.026840210f, -0.012420654f, -0.151962280f,
+ -0.221984863f, -1.031936646f, 0.913055420f, 0.088775635f, 0.140670776f, -0.009231567f,
+ 0.020690918f, -0.002883911f, 0.001296997f, 0.000061035f, -0.000122070f, -0.002014160f,
+ 0.000869751f, -0.027725220f, -0.016708374f, -0.152069092f, -0.246505737f, -1.048156738f,
+ 0.890090942f, 0.069168091f, 0.137298584f, -0.012115479f, 0.019577026f, -0.003051758f,
+ 0.001205444f, 0.000045776f, -0.000137329f, -0.002120972f, 0.000442505f, -0.028533936f,
+ -0.021179199f, -0.151596069f, -0.271591187f, -1.063217163f, 0.866363525f, 0.050354004f,
+ 0.133590698f, -0.014801025f, 0.018463135f, -0.003173828f, 0.001113892f, 0.000045776f,
+ -0.000152588f, -0.002243042f, -0.000030518f, -0.029281616f, -0.025817871f, -0.150497437f,
+ -0.297210693f, -1.077117920f, 0.841949463f, 0.032379150f, 0.129562378f, -0.017257690f,
+ 0.017349243f, -0.003280640f, 0.001037598f, 0.000030518f, -0.000167847f, -0.002349854f,
+ -0.000549316f, -0.029937744f, -0.030609131f, -0.148773193f, -0.323318481f, -1.089782715f,
+ 0.816864014f, 0.015228271f, 0.125259399f, -0.019531250f, 0.016235352f, -0.003372192f,
+ 0.000961304f, 0.000030518f, -0.000198364f, -0.002456665f, -0.001098633f, -0.030532837f,
+ -0.035552979f, -0.146362305f, -0.349868774f, -1.101211548f, 0.791213989f, -0.001068115f,
+ 0.120697021f, -0.021575928f, 0.015121460f, -0.003417969f, 0.000885010f, 0.000030518f,
+ -0.000213623f, -0.002578735f, -0.001693726f, -0.031005859f, -0.040634155f, -0.143264771f,
+ -0.376800537f, -1.111373901f, 0.765029907f, -0.016510010f, 0.115921021f, -0.023422241f,
+ 0.014022827f, -0.003463745f, 0.000808716f, 0.000030518f, -0.000244141f, -0.002685547f,
+ -0.002334595f, -0.031387329f, -0.045837402f, -0.139450073f, -0.404083252f, -1.120223999f,
+ 0.738372803f, -0.031082153f, 0.110946655f, -0.025085449f, 0.012939453f, -0.003479004f,
+ 0.000747681f, 0.000015259f, -0.000259399f, -0.002792358f, -0.003005981f, -0.031661987f,
+ -0.051132202f, -0.134887695f, -0.431655884f, -1.127746582f, 0.711318970f, -0.044784546f,
+ 0.105819702f, -0.026535034f, 0.011886597f, -0.003479004f, 0.000686646f, 0.000015259f,
+ -0.000289917f, -0.002899170f, -0.003723145f, -0.031814575f, -0.056533813f, -0.129577637f,
+ -0.459472656f, -1.133926392f, 0.683914185f, -0.057617188f, 0.100540161f, -0.027801514f,
+ 0.010848999f, -0.003463745f, 0.000625610f, 0.000015259f, -0.000320435f, -0.002990723f,
+ -0.004486084f, -0.031845093f, -0.061996460f, -0.123474121f, -0.487472534f, -1.138763428f,
+ 0.656219482f, -0.069595337f, 0.095169067f, -0.028884888f, 0.009841919f, -0.003433228f,
+ 0.000579834f, 0.000015259f, -0.000366211f, -0.003082275f, -0.005294800f, -0.031738281f,
+ -0.067520142f, -0.116577148f, -0.515609741f, -1.142211914f, 0.628295898f, -0.080688477f,
+ 0.089706421f, -0.029785156f, 0.008865356f, -0.003387451f, 0.000534058f, 0.000015259f,
+ -0.000396729f, -0.003173828f, -0.006118774f, -0.031478882f, -0.073059082f, -0.108856201f,
+ -0.543823242f, -1.144287109f, 0.600219727f, -0.090927124f, 0.084182739f, -0.030517578f,
+ 0.007919312f, -0.003326416f, 0.000473022f, 0.000015259f };
+
+}
diff --git a/Robust/src/Benchmarks/SSJava/MP3DecoderInfer/huffcodetab.java b/Robust/src/Benchmarks/SSJava/MP3DecoderInfer/huffcodetab.java
new file mode 100644
index 00000000..d3c2f221
--- /dev/null
+++ b/Robust/src/Benchmarks/SSJava/MP3DecoderInfer/huffcodetab.java
@@ -0,0 +1,663 @@
+/*
+ * 11/19/04 1.0 moved to LGPL.
+ * 16/11/99 Renamed class, added javadoc, and changed table
+ * name from String to 3 chars. mdm@techie.com
+ * 02/15/99 Java Conversion by E.B, javalayer@javazoom.net
+ *
+ * 04/19/97 : Adapted from the ISO MPEG Audio Subgroup Software Simulation
+ * Group's public c source for its MPEG audio decoder. Miscellaneous
+ * changes by Jeff Tsay (ctsay@pasteur.eecs.berkeley.edu).
+ *-----------------------------------------------------------------------
+ * Copyright (c) 1991 MPEG/audio software simulation group, All Rights Reserved
+ * MPEG/audio coding/decoding software, work in progress
+ * NOT for public distribution until verified and approved by the
+ * MPEG/audio committee. For further information, please contact
+ * Davis Pan, 508-493-2241, e-mail: pan@3d.enet.dec.com
+ *
+ * VERSION 4.1
+ * changes made since last update:
+ * date programmers comment
+ * 27.2.92 F.O.Witte (ITT Intermetall)
+ * 8/24/93 M. Iwadare Changed for 1 pass decoding.
+ * 7/14/94 J. Koller useless 'typedef' before huffcodetab removed
+ *-----------------------------------------------------------------------
+ * 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.
+ *----------------------------------------------------------------------
+ */
+
+/**
+ * Class to implements Huffman decoder.
+ */
+
+
+final class huffcodetab {
+ private static final int MXOFF = 250;
+ private static final int HTN = 34;
+
+
+ private char tablename0 = ' '; /* string, containing table_description */
+
+ private char tablename1 = ' '; /* string, containing table_description */
+
+ private char tablename2 = ' '; /* string, containing table_description */
+
+
+ private int xlen; /* max. x-index+ */
+
+ private int ylen; /* max. y-index+ */
+
+ private int linbits; /* number of linbits */
+
+ private int linmax; /* max number to be stored in linbits */
+
+ private int ref; /* a positive value indicates a reference */
+
+ private int[] table = null; /* pointer to array[xlen][ylen] */
+
+ private int[] hlen = null; /* pointer to array[xlen][ylen] */
+
+ private int[][] val = null; /* decoder tree */
+
+ private int treelen; /* length of decoder tree */
+
+
+ private static int ValTab0[][] = { { 0, 0 } // dummy
+ };
+
+
+ private static int ValTab1[][] = { { 2, 1 }, { 0, 0 }, { 2, 1 }, { 0, 16 }, { 2, 1 }, { 0, 1 },
+ { 0, 17 }, };
+
+
+ private static int ValTab2[][] = { { 2, 1 }, { 0, 0 }, { 4, 1 }, { 2, 1 }, { 0, 16 }, { 0, 1 },
+ { 2, 1 }, { 0, 17 }, { 4, 1 }, { 2, 1 }, { 0, 32 }, { 0, 33 }, { 2, 1 }, { 0, 18 }, { 2, 1 },
+ { 0, 2 }, { 0, 34 }, };
+
+
+ private static int ValTab3[][] = { { 4, 1 }, { 2, 1 }, { 0, 0 }, { 0, 1 }, { 2, 1 }, { 0, 17 },
+ { 2, 1 }, { 0, 16 }, { 4, 1 }, { 2, 1 }, { 0, 32 }, { 0, 33 }, { 2, 1 }, { 0, 18 }, { 2, 1 },
+ { 0, 2 }, { 0, 34 }, };
+
+
+ private static int ValTab4[][] = { { 0, 0 } }; // dummy
+
+
+ private static int ValTab5[][] = { { 2, 1 }, { 0, 0 }, { 4, 1 }, { 2, 1 }, { 0, 16 }, { 0, 1 },
+ { 2, 1 }, { 0, 17 }, { 8, 1 }, { 4, 1 }, { 2, 1 }, { 0, 32 }, { 0, 2 }, { 2, 1 }, { 0, 33 },
+ { 0, 18 }, { 8, 1 }, { 4, 1 }, { 2, 1 }, { 0, 34 }, { 0, 48 }, { 2, 1 }, { 0, 3 }, { 0, 19 },
+ { 2, 1 }, { 0, 49 }, { 2, 1 }, { 0, 50 }, { 2, 1 }, { 0, 35 }, { 0, 51 }, };
+
+
+ private static int ValTab6[][] = { { 6, 1 }, { 4, 1 }, { 2, 1 }, { 0, 0 }, { 0, 16 }, { 0, 17 },
+ { 6, 1 }, { 2, 1 }, { 0, 1 }, { 2, 1 }, { 0, 32 }, { 0, 33 }, { 6, 1 }, { 2, 1 }, { 0, 18 },
+ { 2, 1 }, { 0, 2 }, { 0, 34 }, { 4, 1 }, { 2, 1 }, { 0, 49 }, { 0, 19 }, { 4, 1 }, { 2, 1 },
+ { 0, 48 }, { 0, 50 }, { 2, 1 }, { 0, 35 }, { 2, 1 }, { 0, 3 }, { 0, 51 }, };
+
+
+ private static int ValTab7[][] = { { 2, 1 }, { 0, 0 }, { 4, 1 }, { 2, 1 }, { 0, 16 }, { 0, 1 },
+ { 8, 1 }, { 2, 1 }, { 0, 17 }, { 4, 1 }, { 2, 1 }, { 0, 32 }, { 0, 2 }, { 0, 33 }, { 18, 1 },
+ { 6, 1 }, { 2, 1 }, { 0, 18 }, { 2, 1 }, { 0, 34 }, { 0, 48 }, { 4, 1 }, { 2, 1 }, { 0, 49 },
+ { 0, 19 }, { 4, 1 }, { 2, 1 }, { 0, 3 }, { 0, 50 }, { 2, 1 }, { 0, 35 }, { 0, 4 }, { 10, 1 },
+ { 4, 1 }, { 2, 1 }, { 0, 64 }, { 0, 65 }, { 2, 1 }, { 0, 20 }, { 2, 1 }, { 0, 66 },
+ { 0, 36 }, { 12, 1 }, { 6, 1 }, { 4, 1 }, { 2, 1 }, { 0, 51 }, { 0, 67 }, { 0, 80 },
+ { 4, 1 }, { 2, 1 }, { 0, 52 }, { 0, 5 }, { 0, 81 }, { 6, 1 }, { 2, 1 }, { 0, 21 }, { 2, 1 },
+ { 0, 82 }, { 0, 37 }, { 4, 1 }, { 2, 1 }, { 0, 68 }, { 0, 53 }, { 4, 1 }, { 2, 1 },
+ { 0, 83 }, { 0, 84 }, { 2, 1 }, { 0, 69 }, { 0, 85 }, };
+
+
+ private static int ValTab8[][] = { { 6, 1 }, { 2, 1 }, { 0, 0 }, { 2, 1 }, { 0, 16 }, { 0, 1 },
+ { 2, 1 }, { 0, 17 }, { 4, 1 }, { 2, 1 }, { 0, 33 }, { 0, 18 }, { 14, 1 }, { 4, 1 }, { 2, 1 },
+ { 0, 32 }, { 0, 2 }, { 2, 1 }, { 0, 34 }, { 4, 1 }, { 2, 1 }, { 0, 48 }, { 0, 3 }, { 2, 1 },
+ { 0, 49 }, { 0, 19 }, { 14, 1 }, { 8, 1 }, { 4, 1 }, { 2, 1 }, { 0, 50 }, { 0, 35 },
+ { 2, 1 }, { 0, 64 }, { 0, 4 }, { 2, 1 }, { 0, 65 }, { 2, 1 }, { 0, 20 }, { 0, 66 },
+ { 12, 1 }, { 6, 1 }, { 2, 1 }, { 0, 36 }, { 2, 1 }, { 0, 51 }, { 0, 80 }, { 4, 1 }, { 2, 1 },
+ { 0, 67 }, { 0, 52 }, { 0, 81 }, { 6, 1 }, { 2, 1 }, { 0, 21 }, { 2, 1 }, { 0, 5 },
+ { 0, 82 }, { 6, 1 }, { 2, 1 }, { 0, 37 }, { 2, 1 }, { 0, 68 }, { 0, 53 }, { 2, 1 },
+ { 0, 83 }, { 2, 1 }, { 0, 69 }, { 2, 1 }, { 0, 84 }, { 0, 85 }, };
+
+
+ private static int ValTab9[][] = { { 8, 1 }, { 4, 1 }, { 2, 1 }, { 0, 0 }, { 0, 16 }, { 2, 1 },
+ { 0, 1 }, { 0, 17 }, { 10, 1 }, { 4, 1 }, { 2, 1 }, { 0, 32 }, { 0, 33 }, { 2, 1 },
+ { 0, 18 }, { 2, 1 }, { 0, 2 }, { 0, 34 }, { 12, 1 }, { 6, 1 }, { 4, 1 }, { 2, 1 }, { 0, 48 },
+ { 0, 3 }, { 0, 49 }, { 2, 1 }, { 0, 19 }, { 2, 1 }, { 0, 50 }, { 0, 35 }, { 12, 1 },
+ { 4, 1 }, { 2, 1 }, { 0, 65 }, { 0, 20 }, { 4, 1 }, { 2, 1 }, { 0, 64 }, { 0, 51 }, { 2, 1 },
+ { 0, 66 }, { 0, 36 }, { 10, 1 }, { 6, 1 }, { 4, 1 }, { 2, 1 }, { 0, 4 }, { 0, 80 },
+ { 0, 67 }, { 2, 1 }, { 0, 52 }, { 0, 81 }, { 8, 1 }, { 4, 1 }, { 2, 1 }, { 0, 21 },
+ { 0, 82 }, { 2, 1 }, { 0, 37 }, { 0, 68 }, { 6, 1 }, { 4, 1 }, { 2, 1 }, { 0, 5 }, { 0, 84 },
+ { 0, 83 }, { 2, 1 }, { 0, 53 }, { 2, 1 }, { 0, 69 }, { 0, 85 }, };
+
+
+ private static int ValTab10[][] = { { 2, 1 }, { 0, 0 }, { 4, 1 }, { 2, 1 }, { 0, 16 }, { 0, 1 },
+ { 10, 1 }, { 2, 1 }, { 0, 17 }, { 4, 1 }, { 2, 1 }, { 0, 32 }, { 0, 2 }, { 2, 1 }, { 0, 33 },
+ { 0, 18 }, { 28, 1 }, { 8, 1 }, { 4, 1 }, { 2, 1 }, { 0, 34 }, { 0, 48 }, { 2, 1 },
+ { 0, 49 }, { 0, 19 }, { 8, 1 }, { 4, 1 }, { 2, 1 }, { 0, 3 }, { 0, 50 }, { 2, 1 }, { 0, 35 },
+ { 0, 64 }, { 4, 1 }, { 2, 1 }, { 0, 65 }, { 0, 20 }, { 4, 1 }, { 2, 1 }, { 0, 4 }, { 0, 51 },
+ { 2, 1 }, { 0, 66 }, { 0, 36 }, { 28, 1 }, { 10, 1 }, { 6, 1 }, { 4, 1 }, { 2, 1 },
+ { 0, 80 }, { 0, 5 }, { 0, 96 }, { 2, 1 }, { 0, 97 }, { 0, 22 }, { 12, 1 }, { 6, 1 },
+ { 4, 1 }, { 2, 1 }, { 0, 67 }, { 0, 52 }, { 0, 81 }, { 2, 1 }, { 0, 21 }, { 2, 1 },
+ { 0, 82 }, { 0, 37 }, { 4, 1 }, { 2, 1 }, { 0, 38 }, { 0, 54 }, { 0, 113 }, { 20, 1 },
+ { 8, 1 }, { 2, 1 }, { 0, 23 }, { 4, 1 }, { 2, 1 }, { 0, 68 }, { 0, 83 }, { 0, 6 }, { 6, 1 },
+ { 4, 1 }, { 2, 1 }, { 0, 53 }, { 0, 69 }, { 0, 98 }, { 2, 1 }, { 0, 112 }, { 2, 1 },
+ { 0, 7 }, { 0, 100 }, { 14, 1 }, { 4, 1 }, { 2, 1 }, { 0, 114 }, { 0, 39 }, { 6, 1 },
+ { 2, 1 }, { 0, 99 }, { 2, 1 }, { 0, 84 }, { 0, 85 }, { 2, 1 }, { 0, 70 }, { 0, 115 },
+ { 8, 1 }, { 4, 1 }, { 2, 1 }, { 0, 55 }, { 0, 101 }, { 2, 1 }, { 0, 86 }, { 0, 116 },
+ { 6, 1 }, { 2, 1 }, { 0, 71 }, { 2, 1 }, { 0, 102 }, { 0, 117 }, { 4, 1 }, { 2, 1 },
+ { 0, 87 }, { 0, 118 }, { 2, 1 }, { 0, 103 }, { 0, 119 }, };
+
+
+ private static int ValTab11[][] = { { 6, 1 }, { 2, 1 }, { 0, 0 }, { 2, 1 }, { 0, 16 }, { 0, 1 },
+ { 8, 1 }, { 2, 1 }, { 0, 17 }, { 4, 1 }, { 2, 1 }, { 0, 32 }, { 0, 2 }, { 0, 18 }, { 24, 1 },
+ { 8, 1 }, { 2, 1 }, { 0, 33 }, { 2, 1 }, { 0, 34 }, { 2, 1 }, { 0, 48 }, { 0, 3 }, { 4, 1 },
+ { 2, 1 }, { 0, 49 }, { 0, 19 }, { 4, 1 }, { 2, 1 }, { 0, 50 }, { 0, 35 }, { 4, 1 }, { 2, 1 },
+ { 0, 64 }, { 0, 4 }, { 2, 1 }, { 0, 65 }, { 0, 20 }, { 30, 1 }, { 16, 1 }, { 10, 1 },
+ { 4, 1 }, { 2, 1 }, { 0, 66 }, { 0, 36 }, { 4, 1 }, { 2, 1 }, { 0, 51 }, { 0, 67 },
+ { 0, 80 }, { 4, 1 }, { 2, 1 }, { 0, 52 }, { 0, 81 }, { 0, 97 }, { 6, 1 }, { 2, 1 },
+ { 0, 22 }, { 2, 1 }, { 0, 6 }, { 0, 38 }, { 2, 1 }, { 0, 98 }, { 2, 1 }, { 0, 21 }, { 2, 1 },
+ { 0, 5 }, { 0, 82 }, { 16, 1 }, { 10, 1 }, { 6, 1 }, { 4, 1 }, { 2, 1 }, { 0, 37 },
+ { 0, 68 }, { 0, 96 }, { 2, 1 }, { 0, 99 }, { 0, 54 }, { 4, 1 }, { 2, 1 }, { 0, 112 },
+ { 0, 23 }, { 0, 113 }, { 16, 1 }, { 6, 1 }, { 4, 1 }, { 2, 1 }, { 0, 7 }, { 0, 100 },
+ { 0, 114 }, { 2, 1 }, { 0, 39 }, { 4, 1 }, { 2, 1 }, { 0, 83 }, { 0, 53 }, { 2, 1 },
+ { 0, 84 }, { 0, 69 }, { 10, 1 }, { 4, 1 }, { 2, 1 }, { 0, 70 }, { 0, 115 }, { 2, 1 },
+ { 0, 55 }, { 2, 1 }, { 0, 101 }, { 0, 86 }, { 10, 1 }, { 6, 1 }, { 4, 1 }, { 2, 1 },
+ { 0, 85 }, { 0, 87 }, { 0, 116 }, { 2, 1 }, { 0, 71 }, { 0, 102 }, { 4, 1 }, { 2, 1 },
+ { 0, 117 }, { 0, 118 }, { 2, 1 }, { 0, 103 }, { 0, 119 }, };
+
+
+ private static int ValTab12[][] = { { 12, 1 }, { 4, 1 }, { 2, 1 }, { 0, 16 }, { 0, 1 }, { 2, 1 },
+ { 0, 17 }, { 2, 1 }, { 0, 0 }, { 2, 1 }, { 0, 32 }, { 0, 2 }, { 16, 1 }, { 4, 1 }, { 2, 1 },
+ { 0, 33 }, { 0, 18 }, { 4, 1 }, { 2, 1 }, { 0, 34 }, { 0, 49 }, { 2, 1 }, { 0, 19 },
+ { 2, 1 }, { 0, 48 }, { 2, 1 }, { 0, 3 }, { 0, 64 }, { 26, 1 }, { 8, 1 }, { 4, 1 }, { 2, 1 },
+ { 0, 50 }, { 0, 35 }, { 2, 1 }, { 0, 65 }, { 0, 51 }, { 10, 1 }, { 4, 1 }, { 2, 1 },
+ { 0, 20 }, { 0, 66 }, { 2, 1 }, { 0, 36 }, { 2, 1 }, { 0, 4 }, { 0, 80 }, { 4, 1 }, { 2, 1 },
+ { 0, 67 }, { 0, 52 }, { 2, 1 }, { 0, 81 }, { 0, 21 }, { 28, 1 }, { 14, 1 }, { 8, 1 },
+ { 4, 1 }, { 2, 1 }, { 0, 82 }, { 0, 37 }, { 2, 1 }, { 0, 83 }, { 0, 53 }, { 4, 1 }, { 2, 1 },
+ { 0, 96 }, { 0, 22 }, { 0, 97 }, { 4, 1 }, { 2, 1 }, { 0, 98 }, { 0, 38 }, { 6, 1 },
+ { 4, 1 }, { 2, 1 }, { 0, 5 }, { 0, 6 }, { 0, 68 }, { 2, 1 }, { 0, 84 }, { 0, 69 }, { 18, 1 },
+ { 10, 1 }, { 4, 1 }, { 2, 1 }, { 0, 99 }, { 0, 54 }, { 4, 1 }, { 2, 1 }, { 0, 112 },
+ { 0, 7 }, { 0, 113 }, { 4, 1 }, { 2, 1 }, { 0, 23 }, { 0, 100 }, { 2, 1 }, { 0, 70 },
+ { 0, 114 }, { 10, 1 }, { 6, 1 }, { 2, 1 }, { 0, 39 }, { 2, 1 }, { 0, 85 }, { 0, 115 },
+ { 2, 1 }, { 0, 55 }, { 0, 86 }, { 8, 1 }, { 4, 1 }, { 2, 1 }, { 0, 101 }, { 0, 116 },
+ { 2, 1 }, { 0, 71 }, { 0, 102 }, { 4, 1 }, { 2, 1 }, { 0, 117 }, { 0, 87 }, { 2, 1 },
+ { 0, 118 }, { 2, 1 }, { 0, 103 }, { 0, 119 }, };
+
+
+ private static int ValTab13[][] = { { 2, 1 }, { 0, 0 }, { 6, 1 }, { 2, 1 }, { 0, 16 }, { 2, 1 },
+ { 0, 1 }, { 0, 17 }, { 28, 1 }, { 8, 1 }, { 4, 1 }, { 2, 1 }, { 0, 32 }, { 0, 2 }, { 2, 1 },
+ { 0, 33 }, { 0, 18 }, { 8, 1 }, { 4, 1 }, { 2, 1 }, { 0, 34 }, { 0, 48 }, { 2, 1 }, { 0, 3 },
+ { 0, 49 }, { 6, 1 }, { 2, 1 }, { 0, 19 }, { 2, 1 }, { 0, 50 }, { 0, 35 }, { 4, 1 }, { 2, 1 },
+ { 0, 64 }, { 0, 4 }, { 0, 65 }, { 70, 1 }, { 28, 1 }, { 14, 1 }, { 6, 1 }, { 2, 1 },
+ { 0, 20 }, { 2, 1 }, { 0, 51 }, { 0, 66 }, { 4, 1 }, { 2, 1 }, { 0, 36 }, { 0, 80 },
+ { 2, 1 }, { 0, 67 }, { 0, 52 }, { 4, 1 }, { 2, 1 }, { 0, 81 }, { 0, 21 }, { 4, 1 }, { 2, 1 },
+ { 0, 5 }, { 0, 82 }, { 2, 1 }, { 0, 37 }, { 2, 1 }, { 0, 68 }, { 0, 83 }, { 14, 1 },
+ { 8, 1 }, { 4, 1 }, { 2, 1 }, { 0, 96 }, { 0, 6 }, { 2, 1 }, { 0, 97 }, { 0, 22 }, { 4, 1 },
+ { 2, 1 }, { 0, 128 }, { 0, 8 }, { 0, 129 }, { 16, 1 }, { 8, 1 }, { 4, 1 }, { 2, 1 },
+ { 0, 53 }, { 0, 98 }, { 2, 1 }, { 0, 38 }, { 0, 84 }, { 4, 1 }, { 2, 1 }, { 0, 69 },
+ { 0, 99 }, { 2, 1 }, { 0, 54 }, { 0, 112 }, { 6, 1 }, { 4, 1 }, { 2, 1 }, { 0, 7 },
+ { 0, 85 }, { 0, 113 }, { 2, 1 }, { 0, 23 }, { 2, 1 }, { 0, 39 }, { 0, 55 }, { 72, 1 },
+ { 24, 1 }, { 12, 1 }, { 4, 1 }, { 2, 1 }, { 0, 24 }, { 0, 130 }, { 2, 1 }, { 0, 40 },
+ { 4, 1 }, { 2, 1 }, { 0, 100 }, { 0, 70 }, { 0, 114 }, { 8, 1 }, { 4, 1 }, { 2, 1 },
+ { 0, 132 }, { 0, 72 }, { 2, 1 }, { 0, 144 }, { 0, 9 }, { 2, 1 }, { 0, 145 }, { 0, 25 },
+ { 24, 1 }, { 14, 1 }, { 8, 1 }, { 4, 1 }, { 2, 1 }, { 0, 115 }, { 0, 101 }, { 2, 1 },
+ { 0, 86 }, { 0, 116 }, { 4, 1 }, { 2, 1 }, { 0, 71 }, { 0, 102 }, { 0, 131 }, { 6, 1 },
+ { 2, 1 }, { 0, 56 }, { 2, 1 }, { 0, 117 }, { 0, 87 }, { 2, 1 }, { 0, 146 }, { 0, 41 },
+ { 14, 1 }, { 8, 1 }, { 4, 1 }, { 2, 1 }, { 0, 103 }, { 0, 133 }, { 2, 1 }, { 0, 88 },
+ { 0, 57 }, { 2, 1 }, { 0, 147 }, { 2, 1 }, { 0, 73 }, { 0, 134 }, { 6, 1 }, { 2, 1 },
+ { 0, 160 }, { 2, 1 }, { 0, 104 }, { 0, 10 }, { 2, 1 }, { 0, 161 }, { 0, 26 }, { 68, 1 },
+ { 24, 1 }, { 12, 1 }, { 4, 1 }, { 2, 1 }, { 0, 162 }, { 0, 42 }, { 4, 1 }, { 2, 1 },
+ { 0, 149 }, { 0, 89 }, { 2, 1 }, { 0, 163 }, { 0, 58 }, { 8, 1 }, { 4, 1 }, { 2, 1 },
+ { 0, 74 }, { 0, 150 }, { 2, 1 }, { 0, 176 }, { 0, 11 }, { 2, 1 }, { 0, 177 }, { 0, 27 },
+ { 20, 1 }, { 8, 1 }, { 2, 1 }, { 0, 178 }, { 4, 1 }, { 2, 1 }, { 0, 118 }, { 0, 119 },
+ { 0, 148 }, { 6, 1 }, { 4, 1 }, { 2, 1 }, { 0, 135 }, { 0, 120 }, { 0, 164 }, { 4, 1 },
+ { 2, 1 }, { 0, 105 }, { 0, 165 }, { 0, 43 }, { 12, 1 }, { 6, 1 }, { 4, 1 }, { 2, 1 },
+ { 0, 90 }, { 0, 136 }, { 0, 179 }, { 2, 1 }, { 0, 59 }, { 2, 1 }, { 0, 121 }, { 0, 166 },
+ { 6, 1 }, { 4, 1 }, { 2, 1 }, { 0, 106 }, { 0, 180 }, { 0, 192 }, { 4, 1 }, { 2, 1 },
+ { 0, 12 }, { 0, 152 }, { 0, 193 }, { 60, 1 }, { 22, 1 }, { 10, 1 }, { 6, 1 }, { 2, 1 },
+ { 0, 28 }, { 2, 1 }, { 0, 137 }, { 0, 181 }, { 2, 1 }, { 0, 91 }, { 0, 194 }, { 4, 1 },
+ { 2, 1 }, { 0, 44 }, { 0, 60 }, { 4, 1 }, { 2, 1 }, { 0, 182 }, { 0, 107 }, { 2, 1 },
+ { 0, 196 }, { 0, 76 }, { 16, 1 }, { 8, 1 }, { 4, 1 }, { 2, 1 }, { 0, 168 }, { 0, 138 },
+ { 2, 1 }, { 0, 208 }, { 0, 13 }, { 2, 1 }, { 0, 209 }, { 2, 1 }, { 0, 75 }, { 2, 1 },
+ { 0, 151 }, { 0, 167 }, { 12, 1 }, { 6, 1 }, { 2, 1 }, { 0, 195 }, { 2, 1 }, { 0, 122 },
+ { 0, 153 }, { 4, 1 }, { 2, 1 }, { 0, 197 }, { 0, 92 }, { 0, 183 }, { 4, 1 }, { 2, 1 },
+ { 0, 29 }, { 0, 210 }, { 2, 1 }, { 0, 45 }, { 2, 1 }, { 0, 123 }, { 0, 211 }, { 52, 1 },
+ { 28, 1 }, { 12, 1 }, { 4, 1 }, { 2, 1 }, { 0, 61 }, { 0, 198 }, { 4, 1 }, { 2, 1 },
+ { 0, 108 }, { 0, 169 }, { 2, 1 }, { 0, 154 }, { 0, 212 }, { 8, 1 }, { 4, 1 }, { 2, 1 },
+ { 0, 184 }, { 0, 139 }, { 2, 1 }, { 0, 77 }, { 0, 199 }, { 4, 1 }, { 2, 1 }, { 0, 124 },
+ { 0, 213 }, { 2, 1 }, { 0, 93 }, { 0, 224 }, { 10, 1 }, { 4, 1 }, { 2, 1 }, { 0, 225 },
+ { 0, 30 }, { 4, 1 }, { 2, 1 }, { 0, 14 }, { 0, 46 }, { 0, 226 }, { 8, 1 }, { 4, 1 },
+ { 2, 1 }, { 0, 227 }, { 0, 109 }, { 2, 1 }, { 0, 140 }, { 0, 228 }, { 4, 1 }, { 2, 1 },
+ { 0, 229 }, { 0, 186 }, { 0, 240 }, { 38, 1 }, { 16, 1 }, { 4, 1 }, { 2, 1 }, { 0, 241 },
+ { 0, 31 }, { 6, 1 }, { 4, 1 }, { 2, 1 }, { 0, 170 }, { 0, 155 }, { 0, 185 }, { 2, 1 },
+ { 0, 62 }, { 2, 1 }, { 0, 214 }, { 0, 200 }, { 12, 1 }, { 6, 1 }, { 2, 1 }, { 0, 78 },
+ { 2, 1 }, { 0, 215 }, { 0, 125 }, { 2, 1 }, { 0, 171 }, { 2, 1 }, { 0, 94 }, { 0, 201 },
+ { 6, 1 }, { 2, 1 }, { 0, 15 }, { 2, 1 }, { 0, 156 }, { 0, 110 }, { 2, 1 }, { 0, 242 },
+ { 0, 47 }, { 32, 1 }, { 16, 1 }, { 6, 1 }, { 4, 1 }, { 2, 1 }, { 0, 216 }, { 0, 141 },
+ { 0, 63 }, { 6, 1 }, { 2, 1 }, { 0, 243 }, { 2, 1 }, { 0, 230 }, { 0, 202 }, { 2, 1 },
+ { 0, 244 }, { 0, 79 }, { 8, 1 }, { 4, 1 }, { 2, 1 }, { 0, 187 }, { 0, 172 }, { 2, 1 },
+ { 0, 231 }, { 0, 245 }, { 4, 1 }, { 2, 1 }, { 0, 217 }, { 0, 157 }, { 2, 1 }, { 0, 95 },
+ { 0, 232 }, { 30, 1 }, { 12, 1 }, { 6, 1 }, { 2, 1 }, { 0, 111 }, { 2, 1 }, { 0, 246 },
+ { 0, 203 }, { 4, 1 }, { 2, 1 }, { 0, 188 }, { 0, 173 }, { 0, 218 }, { 8, 1 }, { 2, 1 },
+ { 0, 247 }, { 4, 1 }, { 2, 1 }, { 0, 126 }, { 0, 127 }, { 0, 142 }, { 6, 1 }, { 4, 1 },
+ { 2, 1 }, { 0, 158 }, { 0, 174 }, { 0, 204 }, { 2, 1 }, { 0, 248 }, { 0, 143 }, { 18, 1 },
+ { 8, 1 }, { 4, 1 }, { 2, 1 }, { 0, 219 }, { 0, 189 }, { 2, 1 }, { 0, 234 }, { 0, 249 },
+ { 4, 1 }, { 2, 1 }, { 0, 159 }, { 0, 235 }, { 2, 1 }, { 0, 190 }, { 2, 1 }, { 0, 205 },
+ { 0, 250 }, { 14, 1 }, { 4, 1 }, { 2, 1 }, { 0, 221 }, { 0, 236 }, { 6, 1 }, { 4, 1 },
+ { 2, 1 }, { 0, 233 }, { 0, 175 }, { 0, 220 }, { 2, 1 }, { 0, 206 }, { 0, 251 }, { 8, 1 },
+ { 4, 1 }, { 2, 1 }, { 0, 191 }, { 0, 222 }, { 2, 1 }, { 0, 207 }, { 0, 238 }, { 4, 1 },
+ { 2, 1 }, { 0, 223 }, { 0, 239 }, { 2, 1 }, { 0, 255 }, { 2, 1 }, { 0, 237 }, { 2, 1 },
+ { 0, 253 }, { 2, 1 }, { 0, 252 }, { 0, 254 }, };
+
+
+ private static int ValTab14[][] = { { 0, 0 } // dummy
+ };
+
+
+ private static int ValTab15[][] = { { 16, 1 }, { 6, 1 }, { 2, 1 }, { 0, 0 }, { 2, 1 }, { 0, 16 },
+ { 0, 1 }, { 2, 1 }, { 0, 17 }, { 4, 1 }, { 2, 1 }, { 0, 32 }, { 0, 2 }, { 2, 1 }, { 0, 33 },
+ { 0, 18 }, { 50, 1 }, { 16, 1 }, { 6, 1 }, { 2, 1 }, { 0, 34 }, { 2, 1 }, { 0, 48 },
+ { 0, 49 }, { 6, 1 }, { 2, 1 }, { 0, 19 }, { 2, 1 }, { 0, 3 }, { 0, 64 }, { 2, 1 }, { 0, 50 },
+ { 0, 35 }, { 14, 1 }, { 6, 1 }, { 4, 1 }, { 2, 1 }, { 0, 4 }, { 0, 20 }, { 0, 65 }, { 4, 1 },
+ { 2, 1 }, { 0, 51 }, { 0, 66 }, { 2, 1 }, { 0, 36 }, { 0, 67 }, { 10, 1 }, { 6, 1 },
+ { 2, 1 }, { 0, 52 }, { 2, 1 }, { 0, 80 }, { 0, 5 }, { 2, 1 }, { 0, 81 }, { 0, 21 }, { 4, 1 },
+ { 2, 1 }, { 0, 82 }, { 0, 37 }, { 4, 1 }, { 2, 1 }, { 0, 68 }, { 0, 83 }, { 0, 97 },
+ { 90, 1 }, { 36, 1 }, { 18, 1 }, { 10, 1 }, { 6, 1 }, { 2, 1 }, { 0, 53 }, { 2, 1 },
+ { 0, 96 }, { 0, 6 }, { 2, 1 }, { 0, 22 }, { 0, 98 }, { 4, 1 }, { 2, 1 }, { 0, 38 },
+ { 0, 84 }, { 2, 1 }, { 0, 69 }, { 0, 99 }, { 10, 1 }, { 6, 1 }, { 2, 1 }, { 0, 54 },
+ { 2, 1 }, { 0, 112 }, { 0, 7 }, { 2, 1 }, { 0, 113 }, { 0, 85 }, { 4, 1 }, { 2, 1 },
+ { 0, 23 }, { 0, 100 }, { 2, 1 }, { 0, 114 }, { 0, 39 }, { 24, 1 }, { 16, 1 }, { 8, 1 },
+ { 4, 1 }, { 2, 1 }, { 0, 70 }, { 0, 115 }, { 2, 1 }, { 0, 55 }, { 0, 101 }, { 4, 1 },
+ { 2, 1 }, { 0, 86 }, { 0, 128 }, { 2, 1 }, { 0, 8 }, { 0, 116 }, { 4, 1 }, { 2, 1 },
+ { 0, 129 }, { 0, 24 }, { 2, 1 }, { 0, 130 }, { 0, 40 }, { 16, 1 }, { 8, 1 }, { 4, 1 },
+ { 2, 1 }, { 0, 71 }, { 0, 102 }, { 2, 1 }, { 0, 131 }, { 0, 56 }, { 4, 1 }, { 2, 1 },
+ { 0, 117 }, { 0, 87 }, { 2, 1 }, { 0, 132 }, { 0, 72 }, { 6, 1 }, { 4, 1 }, { 2, 1 },
+ { 0, 144 }, { 0, 25 }, { 0, 145 }, { 4, 1 }, { 2, 1 }, { 0, 146 }, { 0, 118 }, { 2, 1 },
+ { 0, 103 }, { 0, 41 }, { 92, 1 }, { 36, 1 }, { 18, 1 }, { 10, 1 }, { 4, 1 }, { 2, 1 },
+ { 0, 133 }, { 0, 88 }, { 4, 1 }, { 2, 1 }, { 0, 9 }, { 0, 119 }, { 0, 147 }, { 4, 1 },
+ { 2, 1 }, { 0, 57 }, { 0, 148 }, { 2, 1 }, { 0, 73 }, { 0, 134 }, { 10, 1 }, { 6, 1 },
+ { 2, 1 }, { 0, 104 }, { 2, 1 }, { 0, 160 }, { 0, 10 }, { 2, 1 }, { 0, 161 }, { 0, 26 },
+ { 4, 1 }, { 2, 1 }, { 0, 162 }, { 0, 42 }, { 2, 1 }, { 0, 149 }, { 0, 89 }, { 26, 1 },
+ { 14, 1 }, { 6, 1 }, { 2, 1 }, { 0, 163 }, { 2, 1 }, { 0, 58 }, { 0, 135 }, { 4, 1 },
+ { 2, 1 }, { 0, 120 }, { 0, 164 }, { 2, 1 }, { 0, 74 }, { 0, 150 }, { 6, 1 }, { 4, 1 },
+ { 2, 1 }, { 0, 105 }, { 0, 176 }, { 0, 177 }, { 4, 1 }, { 2, 1 }, { 0, 27 }, { 0, 165 },
+ { 0, 178 }, { 14, 1 }, { 8, 1 }, { 4, 1 }, { 2, 1 }, { 0, 90 }, { 0, 43 }, { 2, 1 },
+ { 0, 136 }, { 0, 151 }, { 2, 1 }, { 0, 179 }, { 2, 1 }, { 0, 121 }, { 0, 59 }, { 8, 1 },
+ { 4, 1 }, { 2, 1 }, { 0, 106 }, { 0, 180 }, { 2, 1 }, { 0, 75 }, { 0, 193 }, { 4, 1 },
+ { 2, 1 }, { 0, 152 }, { 0, 137 }, { 2, 1 }, { 0, 28 }, { 0, 181 }, { 80, 1 }, { 34, 1 },
+ { 16, 1 }, { 6, 1 }, { 4, 1 }, { 2, 1 }, { 0, 91 }, { 0, 44 }, { 0, 194 }, { 6, 1 },
+ { 4, 1 }, { 2, 1 }, { 0, 11 }, { 0, 192 }, { 0, 166 }, { 2, 1 }, { 0, 167 }, { 0, 122 },
+ { 10, 1 }, { 4, 1 }, { 2, 1 }, { 0, 195 }, { 0, 60 }, { 4, 1 }, { 2, 1 }, { 0, 12 },
+ { 0, 153 }, { 0, 182 }, { 4, 1 }, { 2, 1 }, { 0, 107 }, { 0, 196 }, { 2, 1 }, { 0, 76 },
+ { 0, 168 }, { 20, 1 }, { 10, 1 }, { 4, 1 }, { 2, 1 }, { 0, 138 }, { 0, 197 }, { 4, 1 },
+ { 2, 1 }, { 0, 208 }, { 0, 92 }, { 0, 209 }, { 4, 1 }, { 2, 1 }, { 0, 183 }, { 0, 123 },
+ { 2, 1 }, { 0, 29 }, { 2, 1 }, { 0, 13 }, { 0, 45 }, { 12, 1 }, { 4, 1 }, { 2, 1 },
+ { 0, 210 }, { 0, 211 }, { 4, 1 }, { 2, 1 }, { 0, 61 }, { 0, 198 }, { 2, 1 }, { 0, 108 },
+ { 0, 169 }, { 6, 1 }, { 4, 1 }, { 2, 1 }, { 0, 154 }, { 0, 184 }, { 0, 212 }, { 4, 1 },
+ { 2, 1 }, { 0, 139 }, { 0, 77 }, { 2, 1 }, { 0, 199 }, { 0, 124 }, { 68, 1 }, { 34, 1 },
+ { 18, 1 }, { 10, 1 }, { 4, 1 }, { 2, 1 }, { 0, 213 }, { 0, 93 }, { 4, 1 }, { 2, 1 },
+ { 0, 224 }, { 0, 14 }, { 0, 225 }, { 4, 1 }, { 2, 1 }, { 0, 30 }, { 0, 226 }, { 2, 1 },
+ { 0, 170 }, { 0, 46 }, { 8, 1 }, { 4, 1 }, { 2, 1 }, { 0, 185 }, { 0, 155 }, { 2, 1 },
+ { 0, 227 }, { 0, 214 }, { 4, 1 }, { 2, 1 }, { 0, 109 }, { 0, 62 }, { 2, 1 }, { 0, 200 },
+ { 0, 140 }, { 16, 1 }, { 8, 1 }, { 4, 1 }, { 2, 1 }, { 0, 228 }, { 0, 78 }, { 2, 1 },
+ { 0, 215 }, { 0, 125 }, { 4, 1 }, { 2, 1 }, { 0, 229 }, { 0, 186 }, { 2, 1 }, { 0, 171 },
+ { 0, 94 }, { 8, 1 }, { 4, 1 }, { 2, 1 }, { 0, 201 }, { 0, 156 }, { 2, 1 }, { 0, 241 },
+ { 0, 31 }, { 6, 1 }, { 4, 1 }, { 2, 1 }, { 0, 240 }, { 0, 110 }, { 0, 242 }, { 2, 1 },
+ { 0, 47 }, { 0, 230 }, { 38, 1 }, { 18, 1 }, { 8, 1 }, { 4, 1 }, { 2, 1 }, { 0, 216 },
+ { 0, 243 }, { 2, 1 }, { 0, 63 }, { 0, 244 }, { 6, 1 }, { 2, 1 }, { 0, 79 }, { 2, 1 },
+ { 0, 141 }, { 0, 217 }, { 2, 1 }, { 0, 187 }, { 0, 202 }, { 8, 1 }, { 4, 1 }, { 2, 1 },
+ { 0, 172 }, { 0, 231 }, { 2, 1 }, { 0, 126 }, { 0, 245 }, { 8, 1 }, { 4, 1 }, { 2, 1 },
+ { 0, 157 }, { 0, 95 }, { 2, 1 }, { 0, 232 }, { 0, 142 }, { 2, 1 }, { 0, 246 }, { 0, 203 },
+ { 34, 1 }, { 18, 1 }, { 10, 1 }, { 6, 1 }, { 4, 1 }, { 2, 1 }, { 0, 15 }, { 0, 174 },
+ { 0, 111 }, { 2, 1 }, { 0, 188 }, { 0, 218 }, { 4, 1 }, { 2, 1 }, { 0, 173 }, { 0, 247 },
+ { 2, 1 }, { 0, 127 }, { 0, 233 }, { 8, 1 }, { 4, 1 }, { 2, 1 }, { 0, 158 }, { 0, 204 },
+ { 2, 1 }, { 0, 248 }, { 0, 143 }, { 4, 1 }, { 2, 1 }, { 0, 219 }, { 0, 189 }, { 2, 1 },
+ { 0, 234 }, { 0, 249 }, { 16, 1 }, { 8, 1 }, { 4, 1 }, { 2, 1 }, { 0, 159 }, { 0, 220 },
+ { 2, 1 }, { 0, 205 }, { 0, 235 }, { 4, 1 }, { 2, 1 }, { 0, 190 }, { 0, 250 }, { 2, 1 },
+ { 0, 175 }, { 0, 221 }, { 14, 1 }, { 6, 1 }, { 4, 1 }, { 2, 1 }, { 0, 236 }, { 0, 206 },
+ { 0, 251 }, { 4, 1 }, { 2, 1 }, { 0, 191 }, { 0, 237 }, { 2, 1 }, { 0, 222 }, { 0, 252 },
+ { 6, 1 }, { 4, 1 }, { 2, 1 }, { 0, 207 }, { 0, 253 }, { 0, 238 }, { 4, 1 }, { 2, 1 },
+ { 0, 223 }, { 0, 254 }, { 2, 1 }, { 0, 239 }, { 0, 255 }, };
+
+
+ private static int ValTab16[][] = { { 2, 1 }, { 0, 0 }, { 6, 1 }, { 2, 1 }, { 0, 16 }, { 2, 1 },
+ { 0, 1 }, { 0, 17 }, { 42, 1 }, { 8, 1 }, { 4, 1 }, { 2, 1 }, { 0, 32 }, { 0, 2 }, { 2, 1 },
+ { 0, 33 }, { 0, 18 }, { 10, 1 }, { 6, 1 }, { 2, 1 }, { 0, 34 }, { 2, 1 }, { 0, 48 },
+ { 0, 3 }, { 2, 1 }, { 0, 49 }, { 0, 19 }, { 10, 1 }, { 4, 1 }, { 2, 1 }, { 0, 50 },
+ { 0, 35 }, { 4, 1 }, { 2, 1 }, { 0, 64 }, { 0, 4 }, { 0, 65 }, { 6, 1 }, { 2, 1 }, { 0, 20 },
+ { 2, 1 }, { 0, 51 }, { 0, 66 }, { 4, 1 }, { 2, 1 }, { 0, 36 }, { 0, 80 }, { 2, 1 },
+ { 0, 67 }, { 0, 52 }, { 138, 1 }, { 40, 1 }, { 16, 1 }, { 6, 1 }, { 4, 1 }, { 2, 1 },
+ { 0, 5 }, { 0, 21 }, { 0, 81 }, { 4, 1 }, { 2, 1 }, { 0, 82 }, { 0, 37 }, { 4, 1 }, { 2, 1 },
+ { 0, 68 }, { 0, 53 }, { 0, 83 }, { 10, 1 }, { 6, 1 }, { 4, 1 }, { 2, 1 }, { 0, 96 },
+ { 0, 6 }, { 0, 97 }, { 2, 1 }, { 0, 22 }, { 0, 98 }, { 8, 1 }, { 4, 1 }, { 2, 1 }, { 0, 38 },
+ { 0, 84 }, { 2, 1 }, { 0, 69 }, { 0, 99 }, { 4, 1 }, { 2, 1 }, { 0, 54 }, { 0, 112 },
+ { 0, 113 }, { 40, 1 }, { 18, 1 }, { 8, 1 }, { 2, 1 }, { 0, 23 }, { 2, 1 }, { 0, 7 },
+ { 2, 1 }, { 0, 85 }, { 0, 100 }, { 4, 1 }, { 2, 1 }, { 0, 114 }, { 0, 39 }, { 4, 1 },
+ { 2, 1 }, { 0, 70 }, { 0, 101 }, { 0, 115 }, { 10, 1 }, { 6, 1 }, { 2, 1 }, { 0, 55 },
+ { 2, 1 }, { 0, 86 }, { 0, 8 }, { 2, 1 }, { 0, 128 }, { 0, 129 }, { 6, 1 }, { 2, 1 },
+ { 0, 24 }, { 2, 1 }, { 0, 116 }, { 0, 71 }, { 2, 1 }, { 0, 130 }, { 2, 1 }, { 0, 40 },
+ { 0, 102 }, { 24, 1 }, { 14, 1 }, { 8, 1 }, { 4, 1 }, { 2, 1 }, { 0, 131 }, { 0, 56 },
+ { 2, 1 }, { 0, 117 }, { 0, 132 }, { 4, 1 }, { 2, 1 }, { 0, 72 }, { 0, 144 }, { 0, 145 },
+ { 6, 1 }, { 2, 1 }, { 0, 25 }, { 2, 1 }, { 0, 9 }, { 0, 118 }, { 2, 1 }, { 0, 146 },
+ { 0, 41 }, { 14, 1 }, { 8, 1 }, { 4, 1 }, { 2, 1 }, { 0, 133 }, { 0, 88 }, { 2, 1 },
+ { 0, 147 }, { 0, 57 }, { 4, 1 }, { 2, 1 }, { 0, 160 }, { 0, 10 }, { 0, 26 }, { 8, 1 },
+ { 2, 1 }, { 0, 162 }, { 2, 1 }, { 0, 103 }, { 2, 1 }, { 0, 87 }, { 0, 73 }, { 6, 1 },
+ { 2, 1 }, { 0, 148 }, { 2, 1 }, { 0, 119 }, { 0, 134 }, { 2, 1 }, { 0, 161 }, { 2, 1 },
+ { 0, 104 }, { 0, 149 }, { 220, 1 }, { 126, 1 }, { 50, 1 }, { 26, 1 }, { 12, 1 }, { 6, 1 },
+ { 2, 1 }, { 0, 42 }, { 2, 1 }, { 0, 89 }, { 0, 58 }, { 2, 1 }, { 0, 163 }, { 2, 1 },
+ { 0, 135 }, { 0, 120 }, { 8, 1 }, { 4, 1 }, { 2, 1 }, { 0, 164 }, { 0, 74 }, { 2, 1 },
+ { 0, 150 }, { 0, 105 }, { 4, 1 }, { 2, 1 }, { 0, 176 }, { 0, 11 }, { 0, 177 }, { 10, 1 },
+ { 4, 1 }, { 2, 1 }, { 0, 27 }, { 0, 178 }, { 2, 1 }, { 0, 43 }, { 2, 1 }, { 0, 165 },
+ { 0, 90 }, { 6, 1 }, { 2, 1 }, { 0, 179 }, { 2, 1 }, { 0, 166 }, { 0, 106 }, { 4, 1 },
+ { 2, 1 }, { 0, 180 }, { 0, 75 }, { 2, 1 }, { 0, 12 }, { 0, 193 }, { 30, 1 }, { 14, 1 },
+ { 6, 1 }, { 4, 1 }, { 2, 1 }, { 0, 181 }, { 0, 194 }, { 0, 44 }, { 4, 1 }, { 2, 1 },
+ { 0, 167 }, { 0, 195 }, { 2, 1 }, { 0, 107 }, { 0, 196 }, { 8, 1 }, { 2, 1 }, { 0, 29 },
+ { 4, 1 }, { 2, 1 }, { 0, 136 }, { 0, 151 }, { 0, 59 }, { 4, 1 }, { 2, 1 }, { 0, 209 },
+ { 0, 210 }, { 2, 1 }, { 0, 45 }, { 0, 211 }, { 18, 1 }, { 6, 1 }, { 4, 1 }, { 2, 1 },
+ { 0, 30 }, { 0, 46 }, { 0, 226 }, { 6, 1 }, { 4, 1 }, { 2, 1 }, { 0, 121 }, { 0, 152 },
+ { 0, 192 }, { 2, 1 }, { 0, 28 }, { 2, 1 }, { 0, 137 }, { 0, 91 }, { 14, 1 }, { 6, 1 },
+ { 2, 1 }, { 0, 60 }, { 2, 1 }, { 0, 122 }, { 0, 182 }, { 4, 1 }, { 2, 1 }, { 0, 76 },
+ { 0, 153 }, { 2, 1 }, { 0, 168 }, { 0, 138 }, { 6, 1 }, { 2, 1 }, { 0, 13 }, { 2, 1 },
+ { 0, 197 }, { 0, 92 }, { 4, 1 }, { 2, 1 }, { 0, 61 }, { 0, 198 }, { 2, 1 }, { 0, 108 },
+ { 0, 154 }, { 88, 1 }, { 86, 1 }, { 36, 1 }, { 16, 1 }, { 8, 1 }, { 4, 1 }, { 2, 1 },
+ { 0, 139 }, { 0, 77 }, { 2, 1 }, { 0, 199 }, { 0, 124 }, { 4, 1 }, { 2, 1 }, { 0, 213 },
+ { 0, 93 }, { 2, 1 }, { 0, 224 }, { 0, 14 }, { 8, 1 }, { 2, 1 }, { 0, 227 }, { 4, 1 },
+ { 2, 1 }, { 0, 208 }, { 0, 183 }, { 0, 123 }, { 6, 1 }, { 4, 1 }, { 2, 1 }, { 0, 169 },
+ { 0, 184 }, { 0, 212 }, { 2, 1 }, { 0, 225 }, { 2, 1 }, { 0, 170 }, { 0, 185 }, { 24, 1 },
+ { 10, 1 }, { 6, 1 }, { 4, 1 }, { 2, 1 }, { 0, 155 }, { 0, 214 }, { 0, 109 }, { 2, 1 },
+ { 0, 62 }, { 0, 200 }, { 6, 1 }, { 4, 1 }, { 2, 1 }, { 0, 140 }, { 0, 228 }, { 0, 78 },
+ { 4, 1 }, { 2, 1 }, { 0, 215 }, { 0, 229 }, { 2, 1 }, { 0, 186 }, { 0, 171 }, { 12, 1 },
+ { 4, 1 }, { 2, 1 }, { 0, 156 }, { 0, 230 }, { 4, 1 }, { 2, 1 }, { 0, 110 }, { 0, 216 },
+ { 2, 1 }, { 0, 141 }, { 0, 187 }, { 8, 1 }, { 4, 1 }, { 2, 1 }, { 0, 231 }, { 0, 157 },
+ { 2, 1 }, { 0, 232 }, { 0, 142 }, { 4, 1 }, { 2, 1 }, { 0, 203 }, { 0, 188 }, { 0, 158 },
+ { 0, 241 }, { 2, 1 }, { 0, 31 }, { 2, 1 }, { 0, 15 }, { 0, 47 }, { 66, 1 }, { 56, 1 },
+ { 2, 1 }, { 0, 242 }, { 52, 1 }, { 50, 1 }, { 20, 1 }, { 8, 1 }, { 2, 1 }, { 0, 189 },
+ { 2, 1 }, { 0, 94 }, { 2, 1 }, { 0, 125 }, { 0, 201 }, { 6, 1 }, { 2, 1 }, { 0, 202 },
+ { 2, 1 }, { 0, 172 }, { 0, 126 }, { 4, 1 }, { 2, 1 }, { 0, 218 }, { 0, 173 }, { 0, 204 },
+ { 10, 1 }, { 6, 1 }, { 2, 1 }, { 0, 174 }, { 2, 1 }, { 0, 219 }, { 0, 220 }, { 2, 1 },
+ { 0, 205 }, { 0, 190 }, { 6, 1 }, { 4, 1 }, { 2, 1 }, { 0, 235 }, { 0, 237 }, { 0, 238 },
+ { 6, 1 }, { 4, 1 }, { 2, 1 }, { 0, 217 }, { 0, 234 }, { 0, 233 }, { 2, 1 }, { 0, 222 },
+ { 4, 1 }, { 2, 1 }, { 0, 221 }, { 0, 236 }, { 0, 206 }, { 0, 63 }, { 0, 240 }, { 4, 1 },
+ { 2, 1 }, { 0, 243 }, { 0, 244 }, { 2, 1 }, { 0, 79 }, { 2, 1 }, { 0, 245 }, { 0, 95 },
+ { 10, 1 }, { 2, 1 }, { 0, 255 }, { 4, 1 }, { 2, 1 }, { 0, 246 }, { 0, 111 }, { 2, 1 },
+ { 0, 247 }, { 0, 127 }, { 12, 1 }, { 6, 1 }, { 2, 1 }, { 0, 143 }, { 2, 1 }, { 0, 248 },
+ { 0, 249 }, { 4, 1 }, { 2, 1 }, { 0, 159 }, { 0, 250 }, { 0, 175 }, { 8, 1 }, { 4, 1 },
+ { 2, 1 }, { 0, 251 }, { 0, 191 }, { 2, 1 }, { 0, 252 }, { 0, 207 }, { 4, 1 }, { 2, 1 },
+ { 0, 253 }, { 0, 223 }, { 2, 1 }, { 0, 254 }, { 0, 239 }, };
+
+
+ private static int ValTab24[][] = { { 60, 1 }, { 8, 1 }, { 4, 1 }, { 2, 1 }, { 0, 0 }, { 0, 16 },
+ { 2, 1 }, { 0, 1 }, { 0, 17 }, { 14, 1 }, { 6, 1 }, { 4, 1 }, { 2, 1 }, { 0, 32 }, { 0, 2 },
+ { 0, 33 }, { 2, 1 }, { 0, 18 }, { 2, 1 }, { 0, 34 }, { 2, 1 }, { 0, 48 }, { 0, 3 },
+ { 14, 1 }, { 4, 1 }, { 2, 1 }, { 0, 49 }, { 0, 19 }, { 4, 1 }, { 2, 1 }, { 0, 50 },
+ { 0, 35 }, { 4, 1 }, { 2, 1 }, { 0, 64 }, { 0, 4 }, { 0, 65 }, { 8, 1 }, { 4, 1 }, { 2, 1 },
+ { 0, 20 }, { 0, 51 }, { 2, 1 }, { 0, 66 }, { 0, 36 }, { 6, 1 }, { 4, 1 }, { 2, 1 },
+ { 0, 67 }, { 0, 52 }, { 0, 81 }, { 6, 1 }, { 4, 1 }, { 2, 1 }, { 0, 80 }, { 0, 5 },
+ { 0, 21 }, { 2, 1 }, { 0, 82 }, { 0, 37 }, { 250, 1 }, { 98, 1 }, { 34, 1 }, { 18, 1 },
+ { 10, 1 }, { 4, 1 }, { 2, 1 }, { 0, 68 }, { 0, 83 }, { 2, 1 }, { 0, 53 }, { 2, 1 },
+ { 0, 96 }, { 0, 6 }, { 4, 1 }, { 2, 1 }, { 0, 97 }, { 0, 22 }, { 2, 1 }, { 0, 98 },
+ { 0, 38 }, { 8, 1 }, { 4, 1 }, { 2, 1 }, { 0, 84 }, { 0, 69 }, { 2, 1 }, { 0, 99 },
+ { 0, 54 }, { 4, 1 }, { 2, 1 }, { 0, 113 }, { 0, 85 }, { 2, 1 }, { 0, 100 }, { 0, 70 },
+ { 32, 1 }, { 14, 1 }, { 6, 1 }, { 2, 1 }, { 0, 114 }, { 2, 1 }, { 0, 39 }, { 0, 55 },
+ { 2, 1 }, { 0, 115 }, { 4, 1 }, { 2, 1 }, { 0, 112 }, { 0, 7 }, { 0, 23 }, { 10, 1 },
+ { 4, 1 }, { 2, 1 }, { 0, 101 }, { 0, 86 }, { 4, 1 }, { 2, 1 }, { 0, 128 }, { 0, 8 },
+ { 0, 129 }, { 4, 1 }, { 2, 1 }, { 0, 116 }, { 0, 71 }, { 2, 1 }, { 0, 24 }, { 0, 130 },
+ { 16, 1 }, { 8, 1 }, { 4, 1 }, { 2, 1 }, { 0, 40 }, { 0, 102 }, { 2, 1 }, { 0, 131 },
+ { 0, 56 }, { 4, 1 }, { 2, 1 }, { 0, 117 }, { 0, 87 }, { 2, 1 }, { 0, 132 }, { 0, 72 },
+ { 8, 1 }, { 4, 1 }, { 2, 1 }, { 0, 145 }, { 0, 25 }, { 2, 1 }, { 0, 146 }, { 0, 118 },
+ { 4, 1 }, { 2, 1 }, { 0, 103 }, { 0, 41 }, { 2, 1 }, { 0, 133 }, { 0, 88 }, { 92, 1 },
+ { 34, 1 }, { 16, 1 }, { 8, 1 }, { 4, 1 }, { 2, 1 }, { 0, 147 }, { 0, 57 }, { 2, 1 },
+ { 0, 148 }, { 0, 73 }, { 4, 1 }, { 2, 1 }, { 0, 119 }, { 0, 134 }, { 2, 1 }, { 0, 104 },
+ { 0, 161 }, { 8, 1 }, { 4, 1 }, { 2, 1 }, { 0, 162 }, { 0, 42 }, { 2, 1 }, { 0, 149 },
+ { 0, 89 }, { 4, 1 }, { 2, 1 }, { 0, 163 }, { 0, 58 }, { 2, 1 }, { 0, 135 }, { 2, 1 },
+ { 0, 120 }, { 0, 74 }, { 22, 1 }, { 12, 1 }, { 4, 1 }, { 2, 1 }, { 0, 164 }, { 0, 150 },
+ { 4, 1 }, { 2, 1 }, { 0, 105 }, { 0, 177 }, { 2, 1 }, { 0, 27 }, { 0, 165 }, { 6, 1 },
+ { 2, 1 }, { 0, 178 }, { 2, 1 }, { 0, 90 }, { 0, 43 }, { 2, 1 }, { 0, 136 }, { 0, 179 },
+ { 16, 1 }, { 10, 1 }, { 6, 1 }, { 2, 1 }, { 0, 144 }, { 2, 1 }, { 0, 9 }, { 0, 160 },
+ { 2, 1 }, { 0, 151 }, { 0, 121 }, { 4, 1 }, { 2, 1 }, { 0, 166 }, { 0, 106 }, { 0, 180 },
+ { 12, 1 }, { 6, 1 }, { 2, 1 }, { 0, 26 }, { 2, 1 }, { 0, 10 }, { 0, 176 }, { 2, 1 },
+ { 0, 59 }, { 2, 1 }, { 0, 11 }, { 0, 192 }, { 4, 1 }, { 2, 1 }, { 0, 75 }, { 0, 193 },
+ { 2, 1 }, { 0, 152 }, { 0, 137 }, { 67, 1 }, { 34, 1 }, { 16, 1 }, { 8, 1 }, { 4, 1 },
+ { 2, 1 }, { 0, 28 }, { 0, 181 }, { 2, 1 }, { 0, 91 }, { 0, 194 }, { 4, 1 }, { 2, 1 },
+ { 0, 44 }, { 0, 167 }, { 2, 1 }, { 0, 122 }, { 0, 195 }, { 10, 1 }, { 6, 1 }, { 2, 1 },
+ { 0, 60 }, { 2, 1 }, { 0, 12 }, { 0, 208 }, { 2, 1 }, { 0, 182 }, { 0, 107 }, { 4, 1 },
+ { 2, 1 }, { 0, 196 }, { 0, 76 }, { 2, 1 }, { 0, 153 }, { 0, 168 }, { 16, 1 }, { 8, 1 },
+ { 4, 1 }, { 2, 1 }, { 0, 138 }, { 0, 197 }, { 2, 1 }, { 0, 92 }, { 0, 209 }, { 4, 1 },
+ { 2, 1 }, { 0, 183 }, { 0, 123 }, { 2, 1 }, { 0, 29 }, { 0, 210 }, { 9, 1 }, { 4, 1 },
+ { 2, 1 }, { 0, 45 }, { 0, 211 }, { 2, 1 }, { 0, 61 }, { 0, 198 }, { 85, 250 }, { 4, 1 },
+ { 2, 1 }, { 0, 108 }, { 0, 169 }, { 2, 1 }, { 0, 154 }, { 0, 212 }, { 32, 1 }, { 16, 1 },
+ { 8, 1 }, { 4, 1 }, { 2, 1 }, { 0, 184 }, { 0, 139 }, { 2, 1 }, { 0, 77 }, { 0, 199 },
+ { 4, 1 }, { 2, 1 }, { 0, 124 }, { 0, 213 }, { 2, 1 }, { 0, 93 }, { 0, 225 }, { 8, 1 },
+ { 4, 1 }, { 2, 1 }, { 0, 30 }, { 0, 226 }, { 2, 1 }, { 0, 170 }, { 0, 185 }, { 4, 1 },
+ { 2, 1 }, { 0, 155 }, { 0, 227 }, { 2, 1 }, { 0, 214 }, { 0, 109 }, { 20, 1 }, { 10, 1 },
+ { 6, 1 }, { 2, 1 }, { 0, 62 }, { 2, 1 }, { 0, 46 }, { 0, 78 }, { 2, 1 }, { 0, 200 },
+ { 0, 140 }, { 4, 1 }, { 2, 1 }, { 0, 228 }, { 0, 215 }, { 4, 1 }, { 2, 1 }, { 0, 125 },
+ { 0, 171 }, { 0, 229 }, { 10, 1 }, { 4, 1 }, { 2, 1 }, { 0, 186 }, { 0, 94 }, { 2, 1 },
+ { 0, 201 }, { 2, 1 }, { 0, 156 }, { 0, 110 }, { 8, 1 }, { 2, 1 }, { 0, 230 }, { 2, 1 },
+ { 0, 13 }, { 2, 1 }, { 0, 224 }, { 0, 14 }, { 4, 1 }, { 2, 1 }, { 0, 216 }, { 0, 141 },
+ { 2, 1 }, { 0, 187 }, { 0, 202 }, { 74, 1 }, { 2, 1 }, { 0, 255 }, { 64, 1 }, { 58, 1 },
+ { 32, 1 }, { 16, 1 }, { 8, 1 }, { 4, 1 }, { 2, 1 }, { 0, 172 }, { 0, 231 }, { 2, 1 },
+ { 0, 126 }, { 0, 217 }, { 4, 1 }, { 2, 1 }, { 0, 157 }, { 0, 232 }, { 2, 1 }, { 0, 142 },
+ { 0, 203 }, { 8, 1 }, { 4, 1 }, { 2, 1 }, { 0, 188 }, { 0, 218 }, { 2, 1 }, { 0, 173 },
+ { 0, 233 }, { 4, 1 }, { 2, 1 }, { 0, 158 }, { 0, 204 }, { 2, 1 }, { 0, 219 }, { 0, 189 },
+ { 16, 1 }, { 8, 1 }, { 4, 1 }, { 2, 1 }, { 0, 234 }, { 0, 174 }, { 2, 1 }, { 0, 220 },
+ { 0, 205 }, { 4, 1 }, { 2, 1 }, { 0, 235 }, { 0, 190 }, { 2, 1 }, { 0, 221 }, { 0, 236 },
+ { 8, 1 }, { 4, 1 }, { 2, 1 }, { 0, 206 }, { 0, 237 }, { 2, 1 }, { 0, 222 }, { 0, 238 },
+ { 0, 15 }, { 4, 1 }, { 2, 1 }, { 0, 240 }, { 0, 31 }, { 0, 241 }, { 4, 1 }, { 2, 1 },
+ { 0, 242 }, { 0, 47 }, { 2, 1 }, { 0, 243 }, { 0, 63 }, { 18, 1 }, { 8, 1 }, { 4, 1 },
+ { 2, 1 }, { 0, 244 }, { 0, 79 }, { 2, 1 }, { 0, 245 }, { 0, 95 }, { 4, 1 }, { 2, 1 },
+ { 0, 246 }, { 0, 111 }, { 2, 1 }, { 0, 247 }, { 2, 1 }, { 0, 127 }, { 0, 143 }, { 10, 1 },
+ { 4, 1 }, { 2, 1 }, { 0, 248 }, { 0, 249 }, { 4, 1 }, { 2, 1 }, { 0, 159 }, { 0, 175 },
+ { 0, 250 }, { 8, 1 }, { 4, 1 }, { 2, 1 }, { 0, 251 }, { 0, 191 }, { 2, 1 }, { 0, 252 },
+ { 0, 207 }, { 4, 1 }, { 2, 1 }, { 0, 253 }, { 0, 223 }, { 2, 1 }, { 0, 254 }, { 0, 239 }, };
+
+
+ private static int ValTab32[][] = { { 2, 1 }, { 0, 0 }, { 8, 1 }, { 4, 1 }, { 2, 1 }, { 0, 8 },
+ { 0, 4 }, { 2, 1 }, { 0, 1 }, { 0, 2 }, { 8, 1 }, { 4, 1 }, { 2, 1 }, { 0, 12 }, { 0, 10 },
+ { 2, 1 }, { 0, 3 }, { 0, 6 }, { 6, 1 }, { 2, 1 }, { 0, 9 }, { 2, 1 }, { 0, 5 }, { 0, 7 },
+ { 4, 1 }, { 2, 1 }, { 0, 14 }, { 0, 13 }, { 2, 1 }, { 0, 15 }, { 0, 11 }, };
+
+
+ private static int ValTab33[][] = { { 16, 1 }, { 8, 1 }, { 4, 1 }, { 2, 1 }, { 0, 0 }, { 0, 1 },
+ { 2, 1 }, { 0, 2 }, { 0, 3 }, { 4, 1 }, { 2, 1 }, { 0, 4 }, { 0, 5 }, { 2, 1 }, { 0, 6 },
+ { 0, 7 }, { 8, 1 }, { 4, 1 }, { 2, 1 }, { 0, 8 }, { 0, 9 }, { 2, 1 }, { 0, 10 }, { 0, 11 },
+ { 4, 1 }, { 2, 1 }, { 0, 12 }, { 0, 13 }, { 2, 1 }, { 0, 14 }, { 0, 15 }, };
+
+
+ public static huffcodetab[] ht = null; /* Simulate extern struct */
+
+
+ private static int[] bitbuf = new int[32];
+
+ /**
+ * Big Constructor : Computes all Huffman Tables.
+ */
+ private huffcodetab( String S, int XLEN, int YLEN,
+ int LINBITS, int LINMAX, int REF,
+ @DELEGATE int[] TABLE, @DELEGATE int[] HLEN,
+ @DELEGATE int[][] VAL, int TREELEN) {
+ tablename0 = S.charAt(0);
+ tablename1 = S.charAt(1);
+ tablename2 = S.charAt(2);
+ xlen = XLEN;
+ ylen = YLEN;
+ linbits = LINBITS;
+ linmax = LINMAX;
+ ref = REF;
+ table = TABLE;
+ TABLE = null;
+ hlen = HLEN;
+ HLEN = null;
+ val = VAL;
+ VAL = null;
+ treelen = TREELEN;
+ }
+
+ /**
+ * Do the huffman-decoding. note! for counta,countb -the 4 bit value is
+ * returned in y, discard x.
+ */
+
+
+ public static int huffman_decoder( int htIdx,
+ int[] x, int[] y,
+ int[] v, int[] w,
+ BitReserve br) {
+ // array of all huffcodtable headers
+ // 0..31 Huffman code table 0..31
+ // 32,33 count1-tables
+
+ int dmask = 1 << ((4 * 8) - 1);
+ int hs = 4 * 8;
+ int level;
+ int point = 0;
+ int error = 1;
+ level = dmask;
+
+ if (ht[htIdx].val == null)
+ return 2;
+
+ /* table 0 needs no bits */
+ if (ht[htIdx].treelen == 0) {
+ x[0] = 0;
+ y[0] = 0;
+ return 0;
+ }
+
+ /* Lookup in Huffman table. */
+
+ /*
+ * int bitsAvailable = 0; int bitIndex = 0;
+ *
+ * int bits[] = bitbuf;
+ */
+ TERMINATE: do {
+ if (ht[htIdx].val[point][0] == 0) { /* end of tree */
+ x[0] = ht[htIdx].val[point][1] >>> 4;
+ y[0] = ht[htIdx].val[point][1] & 0xf;
+ error = 0;
+ break;
+ }
+
+ // hget1bit() is called thousands of times, and so needs to be
+ // ultra fast.
+ /*
+ * if (bitIndex==bitsAvailable) { bitsAvailable = br.readBits(bits, 32);
+ * bitIndex = 0; }
+ */
+ // if (bits[bitIndex++]!=0)
+ if (br.hget1bit() != 0) {
+ TERMINATE: while (ht[htIdx].val[point][1] >= MXOFF)
+ point += ht[htIdx].val[point][1];
+ point += ht[htIdx].val[point][1];
+ } else {
+ TERMINATE: while (ht[htIdx].val[point][0] >= MXOFF)
+ point += ht[htIdx].val[point][0];
+ point += ht[htIdx].val[point][0];
+ }
+ level >>>= 1;
+ // MDM: ht[0] is always 0;
+ } while ((level != 0) || (point < 0 /* ht[0].treelen */));
+
+ // put back any bits not consumed
+ /*
+ * int unread = (bitsAvailable-bitIndex); if (unread>0)
+ * br.rewindNbits(unread);
+ */
+ /* Process sign encodings for quadruples tables. */
+ // System.out.println(ht[htIdx].tablename);
+ if (ht[htIdx].tablename0 == '3' && (ht[htIdx].tablename1 == '2' || ht[htIdx].tablename1 == '3')) {
+ v[0] = (y[0] >> 3) & 1;
+ w[0] = (y[0] >> 2) & 1;
+ x[0] = (y[0] >> 1) & 1;
+ y[0] = y[0] & 1;
+
+ /*
+ * v, w, x and y are reversed in the bitstream. switch them around to make
+ * test bistream work.
+ */
+
+ if (v[0] != 0)
+ if (br.hget1bit() != 0)
+ v[0] = -v[0];
+ if (w[0] != 0)
+ if (br.hget1bit() != 0)
+ w[0] = -w[0];
+ if (x[0] != 0)
+ if (br.hget1bit() != 0)
+ x[0] = -x[0];
+ if (y[0] != 0)
+ if (br.hget1bit() != 0)
+ y[0] = -y[0];
+ } else {
+ // Process sign and escape encodings for dual tables.
+ // x and y are reversed in the test bitstream.
+ // Reverse x and y here to make test bitstream work.
+
+ if (ht[htIdx].linbits != 0)
+ if ((ht[htIdx].xlen - 1) == x[0])
+ x[0] += br.hgetbits(ht[htIdx].linbits);
+ if (x[0] != 0)
+ if (br.hget1bit() != 0)
+ x[0] = -x[0];
+ if (ht[htIdx].linbits != 0)
+ if ((ht[htIdx].ylen - 1) == y[0])
+ y[0] += br.hgetbits(ht[htIdx].linbits);
+ if (y[0] != 0)
+ if (br.hget1bit() != 0)
+ y[0] = -y[0];
+ }
+ return error;
+ }
+
+ public static void inithuff() {
+
+ if (ht != null)
+ return;
+
+ ht = new huffcodetab[HTN];
+ ht[0] = new huffcodetab("0 ", 0, 0, 0, 0, -1, null, null, ValTab0, 0);
+ ht[1] = new huffcodetab("1 ", 2, 2, 0, 0, -1, null, null, ValTab1, 7);
+ ht[2] = new huffcodetab("2 ", 3, 3, 0, 0, -1, null, null, ValTab2, 17);
+ ht[3] = new huffcodetab("3 ", 3, 3, 0, 0, -1, null, null, ValTab3, 17);
+ ht[4] = new huffcodetab("4 ", 0, 0, 0, 0, -1, null, null, ValTab4, 0);
+ ht[5] = new huffcodetab("5 ", 4, 4, 0, 0, -1, null, null, ValTab5, 31);
+ ht[6] = new huffcodetab("6 ", 4, 4, 0, 0, -1, null, null, ValTab6, 31);
+ ht[7] = new huffcodetab("7 ", 6, 6, 0, 0, -1, null, null, ValTab7, 71);
+ ht[8] = new huffcodetab("8 ", 6, 6, 0, 0, -1, null, null, ValTab8, 71);
+ ht[9] = new huffcodetab("9 ", 6, 6, 0, 0, -1, null, null, ValTab9, 71);
+ ht[10] = new huffcodetab("10 ", 8, 8, 0, 0, -1, null, null, ValTab10, 127);
+ ht[11] = new huffcodetab("11 ", 8, 8, 0, 0, -1, null, null, ValTab11, 127);
+ ht[12] = new huffcodetab("12 ", 8, 8, 0, 0, -1, null, null, ValTab12, 127);
+ ht[13] = new huffcodetab("13 ", 16, 16, 0, 0, -1, null, null, ValTab13, 511);
+ ht[14] = new huffcodetab("14 ", 0, 0, 0, 0, -1, null, null, ValTab14, 0);
+ ht[15] = new huffcodetab("15 ", 16, 16, 0, 0, -1, null, null, ValTab15, 511);
+ ht[16] = new huffcodetab("16 ", 16, 16, 1, 1, -1, null, null, ValTab16, 511);
+ ht[17] = new huffcodetab("17 ", 16, 16, 2, 3, 16, null, null, ValTab16, 511);
+ ht[18] = new huffcodetab("18 ", 16, 16, 3, 7, 16, null, null, ValTab16, 511);
+ ht[19] = new huffcodetab("19 ", 16, 16, 4, 15, 16, null, null, ValTab16, 511);
+ ht[20] = new huffcodetab("20 ", 16, 16, 6, 63, 16, null, null, ValTab16, 511);
+ ht[21] = new huffcodetab("21 ", 16, 16, 8, 255, 16, null, null, ValTab16, 511);
+ ht[22] = new huffcodetab("22 ", 16, 16, 10, 1023, 16, null, null, ValTab16, 511);
+ ht[23] = new huffcodetab("23 ", 16, 16, 13, 8191, 16, null, null, ValTab16, 511);
+ ht[24] = new huffcodetab("24 ", 16, 16, 4, 15, -1, null, null, ValTab24, 512);
+ ht[25] = new huffcodetab("25 ", 16, 16, 5, 31, 24, null, null, ValTab24, 512);
+ ht[26] = new huffcodetab("26 ", 16, 16, 6, 63, 24, null, null, ValTab24, 512);
+ ht[27] = new huffcodetab("27 ", 16, 16, 7, 127, 24, null, null, ValTab24, 512);
+ ht[28] = new huffcodetab("28 ", 16, 16, 8, 255, 24, null, null, ValTab24, 512);
+ ht[29] = new huffcodetab("29 ", 16, 16, 9, 511, 24, null, null, ValTab24, 512);
+ ht[30] = new huffcodetab("30 ", 16, 16, 11, 2047, 24, null, null, ValTab24, 512);
+ ht[31] = new huffcodetab("31 ", 16, 16, 13, 8191, 24, null, null, ValTab24, 512);
+ ht[32] = new huffcodetab("32 ", 1, 16, 0, 0, -1, null, null, ValTab32, 31);
+ ht[33] = new huffcodetab("33 ", 1, 16, 0, 0, -1, null, null, ValTab33, 31);
+ }
+}
diff --git a/Robust/src/Benchmarks/SSJava/MP3DecoderInfer/makefile b/Robust/src/Benchmarks/SSJava/MP3DecoderInfer/makefile
new file mode 100644
index 00000000..3619a326
--- /dev/null
+++ b/Robust/src/Benchmarks/SSJava/MP3DecoderInfer/makefile
@@ -0,0 +1,50 @@
+BUILDSCRIPT=../../../buildscript
+
+PROGRAM=MP3Player
+SOURCE_FILES=MP3Player.java Player.java
+
+ifndef INV_ERROR_PROB
+INV_ERROR_PROB=1000
+endif
+
+ifndef RANDOMSEED
+RANDOMSEED=12345
+endif
+
+SSJAVA= -ssjava -ssjavainfer -ssjavadebug
+BSFLAGS= -32bit -mainclass $(PROGRAM) -heapsize-mb 1350 -nooptimize -debug -garbagestats #-printlinenum #-joptimize
+NORMAL= -ssjava-inject-error 0 0
+INJECT_ERROR= -ssjava-inject-error $(INV_ERROR_PROB) $(RANDOMSEED)
+
+
+default: $(PROGRAM)s.bin
+
+normal: $(PROGRAM)n.bin
+
+error: $(PROGRAM)e.bin
+
+
+$(PROGRAM)s.bin: $(SOURCE_FILES) makefile
+ $(BUILDSCRIPT) $(SSJAVA) $(BSFLAGS) -o $(PROGRAM)s -builddir ssj $(SOURCE_FILES)
+
+$(PROGRAM)n.bin: $(SOURCE_FILES) makefile
+ $(BUILDSCRIPT) $(NORMAL) $(BSFLAGS) -o $(PROGRAM)n -builddir norm $(SOURCE_FILES)
+
+$(PROGRAM)e.bin: $(SOURCE_FILES) makefile
+ $(BUILDSCRIPT) $(SSJAVA) $(INJECT_ERROR) $(BSFLAGS) -o $(PROGRAM)e -builddir injerr $(SOURCE_FILES)
+
+cleanerror:
+ rm -f $(PROGRAM)e.bin
+ rm -rf injerr
+
+clean:
+ rm -f $(PROGRAM)s.bin $(PROGRAM)n.bin $(PROGRAM)e.bin
+ rm -fr ssj norm injerr
+ rm -f nve-diff.tmp nve-diff-ranges.tmp
+ rm -f *~
+ rm -f *.dot
+ rm -f *.png
+ rm -f aliases.txt
+ rm -f results*txt
+ rm -f *log
+
--
2.34.1