case FKind.FlatFieldNode:
case FKind.FlatElementNode: {
-
if (fn.kind() == FKind.FlatFieldNode) {
FlatFieldNode ffn = (FlatFieldNode) fn;
lhs = ffn.getDst();
// read field
NTuple<Descriptor> srcHeapPath = mapHeapPath.get(rhs);
- System.out.println("rhs=" + rhs);
+
NTuple<Descriptor> fldHeapPath;
if (srcHeapPath != null) {
fldHeapPath = new NTuple<Descriptor>(srcHeapPath.getList());
} else {
// if srcHeapPath is null, it is static reference
+ System.out.println("##");
+ System.out.println("rhs=" + rhs + " fd=" + fld);
fldHeapPath = new NTuple<Descriptor>();
+ fldHeapPath.add(rhs);
}
fldHeapPath.add(fld);
}\r
break;\r
default:\r
+ strategyMgr.stop();\r
System.out.println("processIOCommand: Default: opCode = " + Integer.toString((int) opCode)\r
+ " data = " + Integer.toString((int) data));\r
}\r
--- /dev/null
+// dummy audio device
+/**
+ * The <code>JavaSoundAudioDevice</code> 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 <code>true</code> if this audio device is open and playing audio
+ * samples, or <code>false</code> otherwise.
+ */
+ public boolean isOpen() {
+ return true;
+ }
+
+ /**
+ * Writes a number of samples to this <code>AudioDevice</code>.
+ *
+ * @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 <code>write</code> or <code>flush</code> 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
--- /dev/null
+/*\r
+ * 11/19/04 1.0 moved to LGPL.\r
+ * \r
+ * 12/12/99 0.0.7 Implementation stores single bits \r
+ * as ints for better performance. mdm@techie.com.\r
+ *\r
+ * 02/28/99 0.0 Java Conversion by E.B, javalayer@javazoom.net\r
+ *\r
+ * Adapted from the public c code by Jeff Tsay.\r
+ *\r
+ *-----------------------------------------------------------------------\r
+ * This program is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU Library General Public License as published\r
+ * by the Free Software Foundation; either version 2 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Library General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU Library General Public\r
+ * License along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\r
+ *----------------------------------------------------------------------\r
+ */\r
+\r
+/**\r
+ * Implementation of Bit Reservoir for Layer III.\r
+ * <p>\r
+ * The implementation stores single bits as a word in the buffer. If a bit is\r
+ * set, the corresponding word in the buffer will be non-zero. If a bit is\r
+ * clear, the corresponding word is zero. Although this may seem waseful, this\r
+ * can be a factor of two quicker than packing 8 bits to a byte and extracting.\r
+ * <p>\r
+ */\r
+\r
+// REVIEW: there is no range checking, so buffer underflow or overflow\r
+// can silently occur.\r
+@LATTICE("BUF<OFF,BUF<BIT,BIT*,OFF*")\r
+@METHODDEFAULT("OUT<THIS,THIS<IN,IN*,THISLOC=THIS,RETURNLOC=OUT")\r
+final class BitReserve {\r
+ /**\r
+ * Size of the internal buffer to store the reserved bits. Must be a power of\r
+ * 2. And x8, as each bit is stored as a single entry.\r
+ */\r
+ private static final int BUFSIZE = 4096 * 8;\r
+\r
+ /**\r
+ * Mask that can be used to quickly implement the modulus operation on\r
+ * BUFSIZE.\r
+ */\r
+ private static final int BUFSIZE_MASK = BUFSIZE - 1;\r
+\r
+ @LOC("BIT")\r
+ private int offset;\r
+\r
+ @LOC("BIT")\r
+ private int totbit;\r
+\r
+ @LOC("BIT")\r
+ private int buf_byte_idx;\r
+\r
+ @LOC("BIT")\r
+ private final int[] buf;\r
+\r
+ BitReserve() {\r
+ offset = 0;\r
+ totbit = 0;\r
+ buf_byte_idx = 0;\r
+ buf = new int[BUFSIZE];\r
+ }\r
+\r
+ /**\r
+ * Return totbit Field.\r
+ */\r
+ @RETURNLOC("THIS,BitReserve.BIT")\r
+ public int hsstell() {\r
+ return (totbit);\r
+ }\r
+\r
+ /**\r
+ * Read a number bits from the bit stream.\r
+ * \r
+ * @param N\r
+ * the number of\r
+ */\r
+ public int hgetbits(@LOC("THIS,BitReserve.BIT") int N) {\r
+\r
+ totbit += N;\r
+\r
+ @LOC("OUT") int val = 0;\r
+\r
+ @LOC("THIS,BitReserve.BIT") int pos = buf_byte_idx;\r
+ if (pos + N < BUFSIZE) {\r
+ TERMINATE:\r
+ while (N-- > 0) {\r
+ val <<= 1;\r
+ val |= ((buf[pos++] != 0) ? 1 : 0);\r
+ }\r
+ } else {\r
+ TERMINATE:\r
+ while (N-- > 0) {\r
+ val <<= 1;\r
+ val |= ((buf[pos] != 0) ? 1 : 0);\r
+ pos = (pos + 1) & BUFSIZE_MASK;\r
+ }\r
+ }\r
+\r
+ buf_byte_idx = pos;\r
+\r
+ return val;\r
+\r
+ }\r
+\r
+ /**\r
+ * Returns next bit from reserve.\r
+ * \r
+ * @returns 0 if next bit is reset, or 1 if next bit is set.\r
+ */\r
+ @RETURNLOC("THIS,BitReserve.BIT")\r
+ public int hget1bit() {\r
+ totbit++;\r
+ @LOC("THIS,BitReserve.BIT") int val = buf[buf_byte_idx];\r
+ buf_byte_idx = (buf_byte_idx + 1) & BUFSIZE_MASK;\r
+ return val;\r
+ }\r
+\r
+ /**\r
+ * Write 8 bits into the bit stream.\r
+ */\r
+ @LATTICE("OUT<THIS,THIS<IN,THISLOC=THIS,GLOBALLOC=IN")\r
+ public void hputbuf(@LOC("IN") int val) {\r
+ @LOC("THIS,BitReserve.OFF") int ofs = offset;\r
+ buf[ofs++] = val & 0x80;\r
+ buf[ofs++] = val & 0x40;\r
+ buf[ofs++] = val & 0x20;\r
+ buf[ofs++] = val & 0x10;\r
+ buf[ofs++] = val & 0x08;\r
+ buf[ofs++] = val & 0x04;\r
+ buf[ofs++] = val & 0x02;\r
+ buf[ofs++] = val & 0x01;\r
+\r
+ if (ofs == BUFSIZE)\r
+ offset = 0;\r
+ else\r
+ offset = ofs;\r
+\r
+ }\r
+\r
+ /**\r
+ * Rewind N bits in Stream.\r
+ */\r
+ public void rewindNbits(@LOC("THIS,BitReserve.BIT") int N) {\r
+ totbit -= N;\r
+ buf_byte_idx -= N;\r
+ if (buf_byte_idx < 0)\r
+ buf_byte_idx += BUFSIZE;\r
+ }\r
+\r
+ /**\r
+ * Rewind N bytes in Stream.\r
+ */\r
+ @LATTICE("THIS<BIT,BIT<N,THISLOC=THIS,GLOBALLOC=N")\r
+ public void rewindNbytes(@LOC("N") int N) {\r
+ @LOC("BIT") int bits = (N << 3);\r
+ totbit -= bits;\r
+ buf_byte_idx -= bits;\r
+ if (buf_byte_idx < 0)\r
+ buf_byte_idx += BUFSIZE;\r
+ }\r
+}\r
--- /dev/null
+/*
+ * 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 <code>Bistream</code> class is responsible for parsing an MPEG audio
+ * bitstream.
+ *
+ * <b>REVIEW:</b> much of the parsing currently occurs in the various decoders.
+ * This should be moved into this class and associated inner classes.
+ */
+@LATTICE("FB<F,FF<F,WP<BI,FF*,WP*,BI*")
+@METHODDEFAULT("OUT<THIS,THIS<VAR,VAR<IN,VAR*,THISLOC=THIS,GLOBALLOC=IN")
+public final class Bitstream implements BitstreamErrors {
+ /**
+ * Synchronization control constant for the initial synchronization to the
+ * start of a frame.
+ */
+ @LOC("F")
+ static byte INITIAL_SYNC = 0;
+
+ /**
+ * Synchronization control constant for non-initial frame synchronizations.
+ */
+
+ @LOC("F")
+ static byte STRICT_SYNC = 1;
+
+ // max. 1730 bytes per frame: 144 * 384kbit/s / 32000 Hz + 2 Bytes CRC
+ /**
+ * Maximum size of the frame buffer.
+ */
+ @LOC("F")
+ private static final int BUFFER_INT_SIZE = 433;
+
+ /**
+ * The frame buffer that holds the data for the current frame.
+ */
+ @LOC("FB")
+ private final int[] framebuffer = new int[BUFFER_INT_SIZE];
+
+ /**
+ * Number of valid bytes in the frame buffer.
+ */
+ @LOC("F")
+ private int framesize;
+
+ /**
+ * The bytes read from the stream.
+ */
+ @LOC("FB")
+ private byte[] frame_bytes = new byte[BUFFER_INT_SIZE * 4];
+
+ /**
+ * Index into <code>framebuffer</code> where the next bits are retrieved.
+ */
+ @LOC("WP")
+ private int wordpointer;
+
+ /**
+ * Number (0-31, from MSB to LSB) of next bit for get_bits()
+ */
+ @LOC("BI")
+ private int bitindex;
+
+ /**
+ * The current specified syncword
+ */
+ @LOC("F")
+ private int syncword;
+
+ /**
+ * Audio header position in stream.
+ */
+ @LOC("F")
+ private int header_pos = 0;
+
+ /**
+ *
+ */
+ @LOC("F")
+ private boolean single_ch_mode;
+ // private int current_frame_number;
+ // private int last_frame_number;
+
+ @LOC("F")
+ private final int bitmask[] = {
+ 0, // dummy
+ 0x00000001, 0x00000003, 0x00000007, 0x0000000F, 0x0000001F, 0x0000003F, 0x0000007F,
+ 0x000000FF, 0x000001FF, 0x000003FF, 0x000007FF, 0x00000FFF, 0x00001FFF, 0x00003FFF,
+ 0x00007FFF, 0x0000FFFF, 0x0001FFFF };
+
+ @LOC("F")
+ private final PushbackInputStream source;
+
+ @LOC("F")
+ private final Header header = new Header();
+
+ @LOC("F")
+ private final byte syncbuf[] = new byte[4];
+
+ @LOC("F")
+ private Crc16[] crc = new Crc16[1];
+
+ @LOC("F")
+ private byte[] rawid3v2 = null;
+
+ @LOC("FF")
+ 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().
+ */
+ @LATTICE("GLOBAL<B,B<BNUM,BNUM<K,K<BYTE,BYTE<THIS,B*,K*,THISLOC=THIS,GLOBALLOC=GLOBAL")
+ void parse_frame() throws BitstreamException {
+ // Convert Bytes read to int
+ @LOC("B") int b = 0;
+ @LOC("BYTE") byte[] byteread = frame_bytes;
+ @LOC("BYTE") 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 (@LOC("K") int k = 0; k < bytesize; k = k + 4) {
+ @LOC("BYTE") int convert = 0;
+ @LOC("BNUM") byte b0 = 0;
+ @LOC("BNUM") byte b1 = 0;
+ @LOC("BNUM") byte b2 = 0;
+ @LOC("BNUM") 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)
+ */
+ @LATTICE("OUT<RL,RL<THIS,THIS<IN,OUT*,THISLOC=THIS,RETURNLOC=OUT")
+ public int get_bits(@LOC("IN") int number_of_bits) {
+
+ @LOC("OUT") int returnvalue = 0;
+ @LOC("THIS,Bitstream.BI") 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];
+ @LOC("RL") int Right = (framebuffer[wordpointer] & 0x0000FFFF);
+ wordpointer++;
+ @LOC("RL") 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(@LOC("IN") 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.
+ */
+ @LATTICE("OUT<VAR,VAR<THIS,THIS<IN,IN*,VAR*,THISLOC=THIS")
+ @RETURNLOC("OUT")
+ private int readFully(@LOC("OUT") byte[] b, @LOC("IN") int offs, @LOC("IN") int len)
+ throws BitstreamException {
+ @LOC("VAR") int nRead = 0;
+ try {
+ while (len > 0) {
+ @LOC("IN") 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.
+ */
+ @LATTICE("OUT<VAR,VAR<THIS,THIS<IN,IN*,VAR*,THISLOC=THIS")
+ @RETURNLOC("OUT")
+ private int readBytes(@LOC("OUT") byte[] b, @LOC("IN") int offs, @LOC("IN") int len)
+ throws BitstreamException {
+ @LOC("VAR") int totalBytesRead = 0;
+ try {
+ while (len > 0) {
+ @LOC("IN") 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);
+
+ return br;
+ }
+}
--- /dev/null
+/*\r
+ * 11/19/04 1.0 moved to LGPL.\r
+ * 11/17/04 INVALIDFRAME code added. javalayer@javazoom.net\r
+ * 12/12/99 Initial version. mdm@techie.com\r
+ *-----------------------------------------------------------------------\r
+ * This program is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU Library General Public License as published\r
+ * by the Free Software Foundation; either version 2 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Library General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU Library General Public\r
+ * License along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\r
+ *----------------------------------------------------------------------\r
+ */\r
+\r
+/**\r
+ * This interface describes all error codes that can be thrown \r
+ * in <code>BistreamException</code>s.\r
+ * \r
+ * @see BitstreamException\r
+ * \r
+ * @author MDM 12/12/99\r
+ * @since 0.0.6\r
+ */\r
+\r
+public interface BitstreamErrors extends JavaLayerErrors\r
+{\r
+ \r
+ /**\r
+ * An undeterminable error occurred. \r
+ */\r
+ static public final int UNKNOWN_ERROR = BITSTREAM_ERROR + 0;\r
+ \r
+ /**\r
+ * The header describes an unknown sample rate.\r
+ */\r
+ static public final int UNKNOWN_SAMPLE_RATE = BITSTREAM_ERROR + 1;\r
+\r
+ /**\r
+ * A problem occurred reading from the stream.\r
+ */\r
+ static public final int STREAM_ERROR = BITSTREAM_ERROR + 2;\r
+ \r
+ /**\r
+ * The end of the stream was reached prematurely. \r
+ */\r
+ static public final int UNEXPECTED_EOF = BITSTREAM_ERROR + 3;\r
+ \r
+ /**\r
+ * The end of the stream was reached. \r
+ */\r
+ static public final int STREAM_EOF = BITSTREAM_ERROR + 4;\r
+ \r
+ /**\r
+ * Frame data are missing. \r
+ */\r
+ static public final int INVALIDFRAME = BITSTREAM_ERROR + 5;\r
+\r
+ /**\r
+ * \r
+ */\r
+ static public final int BITSTREAM_LAST = 0x1ff;\r
+ \r
+}\r
--- /dev/null
+/*\r
+ * 11/19/04 1.0 moved to LGPL.\r
+ * 12/12/99 Initial version. mdm@techie.com\r
+ *-----------------------------------------------------------------------\r
+ * This program is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU Library General Public License as published\r
+ * by the Free Software Foundation; either version 2 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Library General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU Library General Public\r
+ * License along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\r
+ *----------------------------------------------------------------------\r
+ */\r
+\r
+/**\r
+ * Instances of <code>BitstreamException</code> are thrown \r
+ * when operations on a <code>Bitstream</code> fail. \r
+ * <p>\r
+ * The exception provides details of the exception condition \r
+ * in two ways:\r
+ * <ol><li>\r
+ * as an error-code describing the nature of the error\r
+ * </li><br></br><li>\r
+ * as the <code>Throwable</code> instance, if any, that was thrown\r
+ * indicating that an exceptional condition has occurred. \r
+ * </li></ol></p>\r
+ * \r
+ * @since 0.0.6\r
+ * @author MDM 12/12/99\r
+ */\r
+@LATTICE("E")\r
+public class BitstreamException extends JavaLayerException\r
+ implements BitstreamErrors\r
+{ \r
+ @LOC("E") private int errorcode = UNKNOWN_ERROR;\r
+ \r
+ public BitstreamException(String msg, Throwable t)\r
+ {\r
+ super(msg, t); \r
+ }\r
+ \r
+ public BitstreamException(int errorcode, Throwable t)\r
+ {\r
+ this(getErrorString(errorcode), t);\r
+ this.errorcode = errorcode;\r
+ }\r
+ \r
+ public int getErrorCode()\r
+ {\r
+ return errorcode; \r
+ }\r
+ \r
+ \r
+ static public String getErrorString(int errorcode)\r
+ {\r
+ // REVIEW: use resource bundle to map error codes\r
+ // to locale-sensitive strings.\r
+ \r
+// return "Bitstream errorcode "+Integer.toHexString(errorcode);\r
+ return "Bitstream errorcode "+errorcode;\r
+ }\r
+ \r
+ \r
+}\r
--- /dev/null
+public class BitstreamWrapper {
+
+ private static Bitstream stream;
+
+ @TRUST
+ public static void init(String filename) {
+ FileInputStream fin = new FileInputStream(filename);
+ BufferedInputStream bin = new BufferedInputStream(fin);
+ stream = new Bitstream(bin);
+ }
+
+ @TRUST
+ public static Header readFrame() {
+ return stream.readFrame();
+ }
+
+}
--- /dev/null
+/*\r
+ * 11/19/04 1.0 moved to LGPL. \r
+ *-----------------------------------------------------------------------\r
+ * This program is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU Library General Public License as published\r
+ * by the Free Software Foundation; either version 2 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Library General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU Library General Public\r
+ * License along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\r
+ *----------------------------------------------------------------------\r
+ */\r
+\r
+/**\r
+ * Work in progress.\r
+ */\r
+\r
+public interface Control\r
+{\r
+ \r
+ /**\r
+ * Starts playback of the media presented by this control.\r
+ */\r
+ public void start();\r
+ \r
+ /**\r
+ * Stops playback of the media presented by this control.\r
+ */\r
+ public void stop();\r
+ \r
+ public boolean isPlaying();\r
+ \r
+ public void pause();\r
+ \r
+ \r
+ public boolean isRandomAccess();\r
+ \r
+ /**\r
+ * Retrieves the current position.\r
+ */\r
+ public double getPosition();\r
+ \r
+ /**\r
+ * \r
+ */\r
+ public void setPosition(double d);\r
+ \r
+ \r
+}\r
--- /dev/null
+/*\r
+ * 11/19/04 : 1.0 moved to LGPL.\r
+ * \r
+ * 02/12/99 : Java Conversion by E.B , javalayer@javazoom.net\r
+ *\r
+ * @(#) crc.h 1.5, last edit: 6/15/94 16:55:32\r
+ * @(#) Copyright (C) 1993, 1994 Tobias Bading (bading@cs.tu-berlin.de)\r
+ * @(#) Berlin University of Technology\r
+ *-----------------------------------------------------------------------\r
+ * This program is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU Library General Public License as published\r
+ * by the Free Software Foundation; either version 2 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Library General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU Library General Public\r
+ * License along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\r
+ *----------------------------------------------------------------------\r
+ */\r
+\r
+/**\r
+ * 16-Bit CRC checksum\r
+ */\r
+@LATTICE("B<T,B*")\r
+@METHODDEFAULT("OUT<V,V<SH,SH<IN,SH*,THISLOC=V,GLOBALLOC=V")\r
+public final class Crc16\r
+{\r
+ @LOC("T") private static short polynomial=(short)0x8005;\r
+ @LOC("B") private short crc;\r
+\r
+ /**\r
+ * Dummy Constructor\r
+ */\r
+ public Crc16()\r
+ { \r
+ crc = (short) 0xFFFF;\r
+ }\r
+\r
+ /**\r
+ * Feed a bitstring to the crc calculation (0 < length <= 32).\r
+ */\r
+ //ssjava\r
+ @LATTICE("OUT<V,V<SH,SH<IN,SH*,THISLOC=V,GLOBALLOC=V")\r
+ public void add_bits (@LOC("IN") int bitstring, @LOC("IN") int length)\r
+ {\r
+ @LOC("SH") int bitmask = 1 << (length - 1);\r
+ do{\r
+ if (((crc & 0x8000) == 0) ^ ((bitstring & bitmask) == 0 ))\r
+ {\r
+ crc <<= 1;\r
+ crc ^= polynomial;\r
+ }\r
+ else{\r
+ crc <<= 1;\r
+ }\r
+ }while ((bitmask >>>= 1) != 0);\r
+ }\r
+\r
+ /**\r
+ * Return the calculated checksum.\r
+ * Erase it for next calls to add_bits().\r
+ */\r
+ @RETURNLOC("OUT")\r
+ public short checksum()\r
+ {\r
+ @LOC("OUT") short sum = crc;\r
+ crc = (short) 0xFFFF;\r
+ return sum;\r
+ }\r
+}\r
--- /dev/null
+/*\r
+ * 11/19/04 1.0 moved to LGPL.\r
+ * 01/12/99 Initial version. mdm@techie.com\r
+ *-----------------------------------------------------------------------\r
+ * This program is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU Library General Public License as published\r
+ * by the Free Software Foundation; either version 2 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Library General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU Library General Public\r
+ * License along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\r
+ *----------------------------------------------------------------------\r
+ */\r
+\r
+/**\r
+ * The <code>Decoder</code> class encapsulates the details of decoding an MPEG\r
+ * audio frame.\r
+ * \r
+ * @author MDM\r
+ * @version 0.0.7 12/12/99\r
+ * @since 0.0.5\r
+ */\r
+@LATTICE("OUT<DE,DE<FILTER,FILTER<FACTORS,FACTORS<EQ,EQ<PARAM,PARAM<H,H<INIT,PARAM*,INIT*")\r
+@METHODDEFAULT("THIS,THISLOC=THIS,RETURNLOC=THIS")\r
+public class Decoder implements DecoderErrors {\r
+\r
+ static private final Params DEFAULT_PARAMS = new Params();\r
+\r
+ /**\r
+ * The Bistream from which the MPEG audio frames are read.\r
+ */\r
+ // @LOC("ST")\r
+ // private Bitstream stream;\r
+\r
+ /**\r
+ * The Obuffer instance that will receive the decoded PCM samples.\r
+ */\r
+ // @LOC("OUT")\r
+ // private Obuffer output;\r
+\r
+ /**\r
+ * Synthesis filter for the left channel.\r
+ */\r
+ // @LOC("FIL")\r
+ // private SynthesisFilter filter1;\r
+\r
+ /**\r
+ * Sythesis filter for the right channel.\r
+ */\r
+ // @LOC("FIL")\r
+ // private SynthesisFilter filter2;\r
+\r
+ /**\r
+ * The decoder used to decode layer III frames.\r
+ */\r
+ @LOC("DE")\r
+ private LayerIIIDecoder l3decoder;\r
+ // @LOC("DE")\r
+ // private LayerIIDecoder l2decoder;\r
+ // @LOC("DE")\r
+ // private LayerIDecoder l1decoder;\r
+\r
+ @LOC("OUT")\r
+ private int outputFrequency;\r
+ @LOC("OUT")\r
+ private int outputChannels;\r
+\r
+ @LOC("EQ")\r
+ private Equalizer equalizer = new Equalizer();\r
+\r
+ @LOC("PARAM")\r
+ private Params params;\r
+\r
+ @LOC("INIT")\r
+ private boolean initialized;\r
+\r
+ /**\r
+ * Creates a new <code>Decoder</code> instance with default parameters.\r
+ */\r
+\r
+ public Decoder() {\r
+ this(null);\r
+ }\r
+\r
+ /**\r
+ * Creates a new <code>Decoder</code> instance with default parameters.\r
+ * \r
+ * @param params\r
+ * The <code>Params</code> instance that describes the customizable\r
+ * aspects of the decoder.\r
+ */\r
+ public Decoder(@DELEGATE Params params0) {\r
+\r
+ if (params0 == null) {\r
+ params0 = getDefaultParams();\r
+ }\r
+\r
+ params = params0;\r
+\r
+ Equalizer eq = params.getInitialEqualizerSettings();\r
+ if (eq != null) {\r
+ equalizer.setFrom(eq);\r
+ }\r
+ }\r
+\r
+ static public Params getDefaultParams() {\r
+ return (Params) DEFAULT_PARAMS.clone();\r
+ }\r
+\r
+ // public void setEqualizer(Equalizer eq) {\r
+ // if (eq == null)\r
+ // eq = Equalizer.PASS_THRU_EQ;\r
+ //\r
+ // equalizer.setFrom(eq);\r
+ //\r
+ // float[] factors = equalizer.getBandFactors();\r
+ //\r
+ // if (filter1 != null)\r
+ // filter1.setEQ(factors);\r
+ //\r
+ // if (filter2 != null)\r
+ // filter2.setEQ(factors);\r
+ // }\r
+ @LATTICE("THIS<VAR,THISLOC=THIS,VAR*")\r
+ public void init( @LOC("THIS,Decoder.H") Header header) {\r
+ @LOC("VAR") float scalefactor = 32700.0f;\r
+\r
+ @LOC("THIS,Decoder.PARAM") int mode = header.mode();\r
+ @LOC("THIS,Decoder.PARAM") int layer = header.layer();\r
+ @LOC("THIS,Decoder.PARAM") int channels = mode == Header.SINGLE_CHANNEL ? 1 : 2;\r
+\r
+ // set up output buffer if not set up by client.\r
+ // if (output == null)\r
+ // output = new SampleBuffer(header.frequency(), channels);\r
+ SampleBufferWrapper.init(header.frequency(), channels);\r
+\r
+ @LOC("THIS,Decoder.FACTORS") float[] factors = equalizer.getBandFactors();\r
+ @LOC("THIS,Decoder.FILTER") SynthesisFilter filter1 =\r
+ new SynthesisFilter(0, scalefactor, factors);\r
+\r
+ // REVIEW: allow mono output for stereo\r
+ @LOC("THIS,Decoder.FILTER") SynthesisFilter filter2 = null;\r
+ if (channels == 2) {\r
+ filter2 = new SynthesisFilter(1, scalefactor, factors);\r
+ }\r
+\r
+ outputChannels = channels;\r
+ outputFrequency = header.frequency();\r
+\r
+ l3decoder = new LayerIIIDecoder(header,filter1, filter2, OutputChannels.BOTH_CHANNELS);\r
+\r
+ }\r
+\r
+ /**\r
+ * Decodes one frame from an MPEG audio bitstream.\r
+ * \r
+ * @param header\r
+ * The header describing the frame to decode.\r
+ * @param bitstream\r
+ * The bistream that provides the bits for te body of the frame.\r
+ * \r
+ * @return A SampleBuffer containing the decoded samples.\r
+ */\r
+ @LATTICE("THIS<VAR,THISLOC=THIS,VAR*")\r
+ public void decodeFrame(@LOC("THIS,Decoder.H") Header header) throws DecoderException {\r
+\r
+ SampleBufferWrapper.clear_buffer();\r
+ l3decoder.decode(header);\r
+ // SampleBufferWrapper.getOutput().write_buffer(1);\r
+\r
+ }\r
+\r
+ /**\r
+ * Changes the output buffer. This will take effect the next time\r
+ * decodeFrame() is called.\r
+ */\r
+ // public void setOutputBuffer(Obuffer out) {\r
+ // output = out;\r
+ // }\r
+\r
+ /**\r
+ * Retrieves the sample frequency of the PCM samples output by this decoder.\r
+ * This typically corresponds to the sample rate encoded in the MPEG audio\r
+ * stream.\r
+ * \r
+ * @param the\r
+ * sample rate (in Hz) of the samples written to the output buffer\r
+ * when decoding.\r
+ */\r
+ public int getOutputFrequency() {\r
+ return outputFrequency;\r
+ }\r
+\r
+ /**\r
+ * Retrieves the number of channels of PCM samples output by this decoder.\r
+ * This usually corresponds to the number of channels in the MPEG audio\r
+ * stream, although it may differ.\r
+ * \r
+ * @return The number of output channels in the decoded samples: 1 for mono,\r
+ * or 2 for stereo.\r
+ * \r
+ */\r
+ public int getOutputChannels() {\r
+ return outputChannels;\r
+ }\r
+\r
+ /**\r
+ * Retrieves the maximum number of samples that will be written to the output\r
+ * buffer when one frame is decoded. This can be used to help calculate the\r
+ * size of other buffers whose size is based upon the number of samples\r
+ * written to the output buffer. NB: this is an upper bound and fewer samples\r
+ * may actually be written, depending upon the sample rate and number of\r
+ * channels.\r
+ * \r
+ * @return The maximum number of samples that are written to the output buffer\r
+ * when decoding a single frame of MPEG audio.\r
+ */\r
+ public int getOutputBlockSize() {\r
+ return Obuffer.OBUFFERSIZE;\r
+ }\r
+\r
+ protected DecoderException newDecoderException(int errorcode) {\r
+ return new DecoderException(errorcode, null);\r
+ }\r
+\r
+ protected DecoderException newDecoderException(int errorcode, Throwable throwable) {\r
+ return new DecoderException(errorcode, throwable);\r
+ }\r
+\r
+ /**\r
+ * The <code>Params</code> class presents the customizable aspects of the\r
+ * decoder.\r
+ * <p>\r
+ * Instances of this class are not thread safe.\r
+ */\r
+ public static class Params implements Cloneable {\r
+\r
+ // private OutputChannels outputChannels = OutputChannels.BOTH;\r
+ private OutputChannels outputChannels = new OutputChannels(0);\r
+\r
+ private Equalizer equalizer = new Equalizer();\r
+\r
+ public Params() {\r
+ }\r
+\r
+ public Object clone() {\r
+ // TODO: need to have better clone method\r
+ Params clone = new Params();\r
+ clone.outputChannels = new OutputChannels(outputChannels.getChannelsOutputCode());\r
+ clone.equalizer = new Equalizer();\r
+ return clone;\r
+ // try\r
+ // {\r
+ // return super.clone();\r
+ // }\r
+ // catch (CloneNotSupportedException ex)\r
+ // {\r
+ // throw new InternalError(this+": "+ex);\r
+ // }\r
+ }\r
+\r
+ public void setOutputChannels(OutputChannels out) {\r
+ if (out == null)\r
+ throw new NullPointerException("out");\r
+\r
+ outputChannels = out;\r
+ }\r
+\r
+ public OutputChannels getOutputChannels() {\r
+ return outputChannels;\r
+ }\r
+\r
+ /**\r
+ * Retrieves the equalizer settings that the decoder's equalizer will be\r
+ * initialized from.\r
+ * <p>\r
+ * The <code>Equalizer</code> instance returned cannot be changed in real\r
+ * time to affect the decoder output as it is used only to initialize the\r
+ * decoders EQ settings. To affect the decoder's output in realtime, use the\r
+ * Equalizer returned from the getEqualizer() method on the decoder.\r
+ * \r
+ * @return The <code>Equalizer</code> used to initialize the EQ settings of\r
+ * the decoder.\r
+ */\r
+ public Equalizer getInitialEqualizerSettings() {\r
+ return equalizer;\r
+ }\r
+\r
+ };\r
+}\r
--- /dev/null
+/*\r
+ * 09/26/08 throw exception on subbband alloc error: Christopher G. Jennings (cjennings@acm.org)\r
+ * 11/19/04 1.0 moved to LGPL.\r
+ * 01/12/99 Initial version. mdm@techie.com\r
+ *-----------------------------------------------------------------------\r
+ * This program is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU Library General Public License as published\r
+ * by the Free Software Foundation; either version 2 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Library General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU Library General Public\r
+ * License along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\r
+ *----------------------------------------------------------------------\r
+ */\r
+\r
+\r
+/**\r
+ * This interface provides constants describing the error\r
+ * codes used by the Decoder to indicate errors. \r
+ * \r
+ * @author MDM\r
+ */\r
+public interface DecoderErrors extends JavaLayerErrors\r
+{\r
+ \r
+ static public final int UNKNOWN_ERROR = DECODER_ERROR + 0;\r
+ \r
+ /**\r
+ * Layer not supported by the decoder. \r
+ */\r
+ static public final int UNSUPPORTED_LAYER = DECODER_ERROR + 1;\r
+\r
+ /**\r
+ * Illegal allocation in subband layer. Indicates a corrupt stream.\r
+ */\r
+ static public final int ILLEGAL_SUBBAND_ALLOCATION = DECODER_ERROR + 2;\r
+\r
+}\r
--- /dev/null
+/*\r
+ * 11/19/04 1.0 moved to LGPL.\r
+ * 01/12/99 Initial version. mdm@techie.com\r
+ *-----------------------------------------------------------------------\r
+ * This program is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU Library General Public License as published\r
+ * by the Free Software Foundation; either version 2 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Library General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU Library General Public\r
+ * License along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\r
+ *----------------------------------------------------------------------\r
+ */\r
+\r
+\r
+/**\r
+ * The <code>DecoderException</code> represents the class of\r
+ * errors that can occur when decoding MPEG audio. \r
+ * \r
+ * @author MDM\r
+ */\r
+public class DecoderException extends JavaLayerException\r
+ implements DecoderErrors\r
+{ \r
+ private int errorcode = UNKNOWN_ERROR;\r
+ \r
+ public DecoderException(String msg, Throwable t)\r
+ {\r
+ super(msg, t); \r
+ }\r
+ \r
+ public DecoderException(int errorcode, Throwable t)\r
+ {\r
+ this(getErrorString(errorcode), t);\r
+ this.errorcode = errorcode;\r
+ }\r
+ \r
+ public int getErrorCode()\r
+ {\r
+ return errorcode; \r
+ }\r
+ \r
+ \r
+ static public String getErrorString(int errorcode)\r
+ {\r
+ // REVIEW: use resource file to map error codes\r
+ // to locale-sensitive strings. \r
+ \r
+// return "Decoder errorcode "+Integer.toHexString(errorcode);\r
+ return "Decoder errorcode "+errorcode;\r
+ }\r
+ \r
+ \r
+}\r
+\r
--- /dev/null
+/*\r
+ * 11/19/04 1.0 moved to LGPL.\r
+ * 12/12/99 Initial version. mdm@techie.com\r
+ *-----------------------------------------------------------------------\r
+ * This program is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU Library General Public License as published\r
+ * by the Free Software Foundation; either version 2 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Library General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU Library General Public\r
+ * License along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\r
+ *----------------------------------------------------------------------\r
+ */\r
+\r
+/**\r
+ * The <code>Equalizer</code> class can be used to specify equalization settings\r
+ * for the MPEG audio decoder.\r
+ * <p>\r
+ * The equalizer consists of 32 band-pass filters. Each band of the equalizer\r
+ * can take on a fractional value between -1.0 and +1.0. At -1.0, the input\r
+ * signal is attenuated by 6dB, at +1.0 the signal is amplified by 6dB.\r
+ * \r
+ * @see Decoder\r
+ * \r
+ * @author MDM\r
+ */\r
+@LATTICE("B<IDX,IDX<T,IDX*")\r
+@METHODDEFAULT("OUT<V,V<SH,SH<C,C<IN,SH*,THISLOC=IN,GLOBALLOC=IN")\r
+public final class Equalizer {\r
+ /**\r
+ * Equalizer setting to denote that a given band will not be present in the\r
+ * output signal.\r
+ */\r
+ @LOC("T")\r
+ static public final float BAND_NOT_PRESENT = Float.NEGATIVE_INFINITY;\r
+\r
+ @LOC("T")\r
+ static public final Equalizer PASS_THRU_EQ = new Equalizer();\r
+\r
+ @LOC("T")\r
+ private static final int BANDS = 32;\r
+\r
+ @LOC("B")\r
+ private final float[] settings = new float[BANDS];\r
+\r
+ /**\r
+ * Creates a new <code>Equalizer</code> instance.\r
+ */\r
+ public Equalizer() {\r
+ }\r
+\r
+ // private Equalizer(float b1, float b2, float b3, float b4, float b5,\r
+ // float b6, float b7, float b8, float b9, float b10, float b11,\r
+ // float b12, float b13, float b14, float b15, float b16,\r
+ // float b17, float b18, float b19, float b20);\r
+\r
+ public Equalizer(float[] settings) {\r
+ setFrom(settings);\r
+ }\r
+\r
+ public Equalizer(EQFunction eq) {\r
+ setFrom(eq);\r
+ }\r
+\r
+ public void setFrom(float[] eq) {\r
+ reset();\r
+ int max = (eq.length > BANDS) ? BANDS : eq.length;\r
+\r
+ for (int i = 0; i < max; i++) {\r
+ settings[i] = limit(eq[i]);\r
+ }\r
+ }\r
+\r
+ public void setFrom(EQFunction eq) {\r
+ reset();\r
+ int max = BANDS;\r
+\r
+ for (int i = 0; i < max; i++) {\r
+ settings[i] = limit(eq.getBand(i));\r
+ }\r
+ }\r
+\r
+ /**\r
+ * Sets the bands of this equalizer to the value the bands of another\r
+ * equalizer. Bands that are not present in both equalizers are ignored.\r
+ */\r
+ public void setFrom(Equalizer eq) {\r
+ if (eq != this) {\r
+ setFrom(eq.settings);\r
+ }\r
+ }\r
+\r
+ /**\r
+ * Sets all bands to 0.0\r
+ */\r
+ public void reset() {\r
+ for (int i = 0; i < BANDS; i++) {\r
+ settings[i] = 0.0f;\r
+ }\r
+ }\r
+\r
+ /**\r
+ * Retrieves the number of bands present in this equalizer.\r
+ */\r
+ public int getBandCount() {\r
+ return settings.length;\r
+ }\r
+\r
+ public float setBand(int band, float neweq) {\r
+ float eq = 0.0f;\r
+\r
+ if ((band >= 0) && (band < BANDS)) {\r
+ eq = settings[band];\r
+ settings[band] = limit(neweq);\r
+ }\r
+\r
+ return eq;\r
+ }\r
+\r
+ /**\r
+ * Retrieves the eq setting for a given band.\r
+ */\r
+ public float getBand(int band) {\r
+ float eq = 0.0f;\r
+\r
+ if ((band >= 0) && (band < BANDS)) {\r
+ eq = settings[band];\r
+ }\r
+\r
+ return eq;\r
+ }\r
+\r
+ private float limit(float eq) {\r
+ if (eq == BAND_NOT_PRESENT)\r
+ return eq;\r
+ if (eq > 1.0f)\r
+ return 1.0f;\r
+ if (eq < -1.0f)\r
+ return -1.0f;\r
+\r
+ return eq;\r
+ }\r
+\r
+ /**\r
+ * Retrieves an array of floats whose values represent a scaling factor that\r
+ * can be applied to linear samples in each band to provide the equalization\r
+ * represented by this instance.\r
+ * \r
+ * @return an array of factors that can be applied to the subbands.\r
+ */\r
+ @LATTICE("OUT<THIS,THISLOC=THIS")\r
+ @RETURNLOC("OUT")\r
+ float[] getBandFactors() {\r
+ @LOC("OUT") float[] factors = new float[BANDS];\r
+ @LOC("THIS,Equalizer.IDX") int maxCount = BANDS;\r
+ for (@LOC("THIS,Equalizer.IDX") int i = 0; i < maxCount; i++) {\r
+ factors[i] = getBandFactor(settings[i]);\r
+ }\r
+\r
+ return factors;\r
+ }\r
+\r
+ /**\r
+ * Converts an equalizer band setting to a sample factor. The factor is\r
+ * determined by the function f = 2^n where n is the equalizer band setting in\r
+ * the range [-1.0,1.0].\r
+ * \r
+ */\r
+ @RETURNLOC("C")\r
+ float getBandFactor(@LOC("IN") float eq) {\r
+ if (eq == BAND_NOT_PRESENT)\r
+ return 0.0f;\r
+\r
+ @LOC("C") float f = (float) Math.pow(2.0, eq);\r
+ return f;\r
+ }\r
+\r
+ static abstract public class EQFunction {\r
+ /**\r
+ * Returns the setting of a band in the equalizer.\r
+ * \r
+ * @param band\r
+ * The index of the band to retrieve the setting for.\r
+ * \r
+ * @return the setting of the specified band. This is a value between -1 and\r
+ * +1.\r
+ */\r
+ public float getBand(int band) {\r
+ return 0.0f;\r
+ }\r
+\r
+ }\r
+\r
+}\r
--- /dev/null
+/*\r
+ * 09/26/08 throw exception on subbband alloc error: Christopher G. Jennings (cjennings@acm.org)\r
+ * 11/19/04 1.0 moved to LGPL.\r
+ * 12/12/99 Initial version. mdm@techie.com\r
+ *-----------------------------------------------------------------------\r
+ * This program is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU Library General Public License as published\r
+ * by the Free Software Foundation; either version 2 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Library General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU Library General Public\r
+ * License along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\r
+ *----------------------------------------------------------------------\r
+ */\r
+\r
+\r
+/**\r
+ * Implementations of FrameDecoder are responsible for decoding\r
+ * an MPEG audio frame.\r
+ * \r
+ */\r
+//REVIEW: the interface currently is too thin. There should be\r
+// methods to specify the output buffer, the synthesis filters and\r
+// possibly other objects used by the decoder. \r
+public interface FrameDecoder\r
+{\r
+ /**\r
+ * Decodes one frame of MPEG audio. \r
+ */\r
+ public void decodeFrame() throws DecoderException;\r
+ \r
+}\r
--- /dev/null
+/*
+ * 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.
+ */
+@LATTICE("HI<HNS,HNS<H,C<H,NS<FS,FS<H,FS<HV,H<SYNC,HV<SYNC,H<T,HV<T,SYNC*,HV,FS*,HI*")
+@METHODDEFAULT("THIS<IN,THISLOC=THIS,GLOBALLOC=THIS,RETURNLOC=THIS")
+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;
+
+ @LOC("H")
+ private int h_layer;
+ @LOC("H")
+ private int h_protection_bit;
+ @LOC("H")
+ private int h_bitrate_index;
+ @LOC("H")
+ private int h_padding_bit;
+ @LOC("H")
+ private int h_mode_extension;
+ @LOC("HV")
+ private int h_version;
+ @LOC("H")
+ private int h_mode;
+ @LOC("H")
+ private int h_sample_frequency;
+ @LOC("HNS")
+ private int h_number_of_subbands;
+ @LOC("HI")
+ private int h_intensity_stereo_bound;
+ @LOC("H")
+ private boolean h_copyright;
+ @LOC("H")
+ private boolean h_original;
+ // VBR support added by E.B
+ @LOC("T")
+ private double[] h_vbr_time_per_frame = { -1.0, 384.0, 1152.0, 1152.0 };
+ @LOC("T")
+ private boolean h_vbr;
+ @LOC("T")
+ private int h_vbr_frames;
+ @LOC("T")
+ private int h_vbr_scale;
+ @LOC("T")
+ private int h_vbr_bytes;
+ @LOC("T")
+ private byte[] h_vbr_toc;
+
+ @LOC("SYNC")
+ private byte syncmode = Bitstream.INITIAL_SYNC;
+ @LOC("C")
+ private Crc16 crc;
+
+ @LOC("C")
+ public short checksum;
+ @LOC("FS")
+ public int framesize;
+ @LOC("NS")
+ public int nSlots;
+
+ @LOC("T")
+ private int _headerstring = -1; // E.B
+
+ @LOC("T")
+ private SideInfoBuffer sib;
+ @LOC("T")
+ private BitReserve br;
+
+ Header() {
+ }
+
+ @LATTICE("OUT<BUF,BUF<THIS,THISLOC=THIS,RETURNLOC=OUT")
+ public String toString() {
+ @LOC("BUF") 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());
+
+ @LOC("OUT") 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; i<max; i++) offset[i] = 0; } // E.B :
+ * Investigate more int cf = stream.current_frame(); int lf =
+ * stream.last_frame(); if ((cf > 0) && (cf == lf)) { offset[cf] =
+ * offset[cf-1] + h_padding_bit; } else { offset[0] = h_padding_bit; }
+ */
+ }
+ return 0;
+ }
+
+ /**
+ * Parse frame to extract optionnal VBR frame.
+ *
+ * @param firstframe
+ * @author E.B (javalayer@javazoom.net)
+ */
+ void parseVBR(byte[] firstframe) throws BitstreamException {
+ // Trying Xing header.
+ String xing = "Xing";
+ byte tmp[] = new byte[4];
+ int offset = 0;
+ // Compute "Xing" offset depending on MPEG version and channels.
+ if (h_version == MPEG1) {
+ if (h_mode == SINGLE_CHANNEL)
+ offset = 21 - 4;
+ else
+ offset = 36 - 4;
+ } else {
+ if (h_mode == SINGLE_CHANNEL)
+ offset = 13 - 4;
+ else
+ offset = 21 - 4;
+ }
+ try {
+ System.arraycopy(firstframe, offset, tmp, 0, 4);
+ // Is "Xing" ?
+ if (xing.equals(new String(tmp))) {
+ // Yes.
+ h_vbr = true;
+ h_vbr_frames = -1;
+ h_vbr_bytes = -1;
+ h_vbr_scale = -1;
+ h_vbr_toc = new byte[100];
+
+ int length = 4;
+ // Read flags.
+ byte flags[] = new byte[4];
+ System.arraycopy(firstframe, offset + length, flags, 0, flags.length);
+ length += flags.length;
+ // Read number of frames (if available).
+ if ((flags[3] & (byte) (1 << 0)) != 0) {
+ System.arraycopy(firstframe, offset + length, tmp, 0, tmp.length);
+ h_vbr_frames =
+ (tmp[0] << 24) & 0xFF000000 | (tmp[1] << 16) & 0x00FF0000 | (tmp[2] << 8)
+ & 0x0000FF00 | tmp[3] & 0x000000FF;
+ length += 4;
+ }
+ // Read size (if available).
+ if ((flags[3] & (byte) (1 << 1)) != 0) {
+ System.arraycopy(firstframe, offset + length, tmp, 0, tmp.length);
+ h_vbr_bytes =
+ (tmp[0] << 24) & 0xFF000000 | (tmp[1] << 16) & 0x00FF0000 | (tmp[2] << 8)
+ & 0x0000FF00 | tmp[3] & 0x000000FF;
+ length += 4;
+ }
+ // Read TOC (if available).
+ if ((flags[3] & (byte) (1 << 2)) != 0) {
+ System.arraycopy(firstframe, offset + length, h_vbr_toc, 0, h_vbr_toc.length);
+ length += h_vbr_toc.length;
+ }
+ // Read scale (if available).
+ if ((flags[3] & (byte) (1 << 3)) != 0) {
+ System.arraycopy(firstframe, offset + length, tmp, 0, tmp.length);
+ h_vbr_scale =
+ (tmp[0] << 24) & 0xFF000000 | (tmp[1] << 16) & 0x00FF0000 | (tmp[2] << 8)
+ & 0x0000FF00 | tmp[3] & 0x000000FF;
+ length += 4;
+ }
+ // System.out.println("VBR:"+xing+" Frames:"+ h_vbr_frames
+ // +" Size:"+h_vbr_bytes);
+ }
+ } catch (ArrayIndexOutOfBoundsException e) {
+ throw new BitstreamException("XingVBRHeader Corrupted", e);
+ }
+
+ // Trying VBRI header.
+ String vbri = "VBRI";
+ offset = 36 - 4;
+ try {
+ System.arraycopy(firstframe, offset, tmp, 0, 4);
+ // Is "VBRI" ?
+ if (vbri.equals(new String(tmp))) {
+ // Yes.
+ h_vbr = true;
+ h_vbr_frames = -1;
+ h_vbr_bytes = -1;
+ h_vbr_scale = -1;
+ h_vbr_toc = new byte[100];
+ // Bytes.
+ int length = 4 + 6;
+ System.arraycopy(firstframe, offset + length, tmp, 0, tmp.length);
+ h_vbr_bytes =
+ (tmp[0] << 24) & 0xFF000000 | (tmp[1] << 16) & 0x00FF0000 | (tmp[2] << 8) & 0x0000FF00
+ | tmp[3] & 0x000000FF;
+ length += 4;
+ // Frames.
+ System.arraycopy(firstframe, offset + length, tmp, 0, tmp.length);
+ h_vbr_frames =
+ (tmp[0] << 24) & 0xFF000000 | (tmp[1] << 16) & 0x00FF0000 | (tmp[2] << 8) & 0x0000FF00
+ | tmp[3] & 0x000000FF;
+ length += 4;
+ // System.out.println("VBR:"+vbri+" Frames:"+ h_vbr_frames
+ // +" Size:"+h_vbr_bytes);
+ // TOC
+ // TODO
+ }
+ } catch (ArrayIndexOutOfBoundsException e) {
+ throw new BitstreamException("VBRIVBRHeader Corrupted", e);
+ }
+ }
+
+ // Functions to query header contents:
+ /**
+ * Returns version.
+ */
+ @RETURNLOC("THIS,Header.HV")
+ public int version() {
+ return h_version;
+ }
+
+ /**
+ * Returns Layer ID.
+ */
+ @RETURNLOC("THIS,Header.H")
+ public int layer() {
+ return h_layer;
+ }
+
+ /**
+ * Returns bitrate index.
+ */
+ public int bitrate_index() {
+ return h_bitrate_index;
+ }
+
+ /**
+ * Returns Sample Frequency.
+ */
+ @RETURNLOC("THIS,Header.H")
+ public int sample_frequency() {
+ return h_sample_frequency;
+ }
+
+ /**
+ * Returns Frequency.
+ */
+ @RETURNLOC("THIS,Header.FS")
+ public int frequency() {
+ return frequencies[h_version][h_sample_frequency];
+ }
+
+ /**
+ * Returns Mode.
+ */
+ @RETURNLOC("THIS,Header.H")
+ public int mode() {
+ return h_mode;
+ }
+
+ /**
+ * Returns Protection bit.
+ */
+ @RETURNLOC("THIS,Header.H")
+ public boolean checksums() {
+ if (h_protection_bit == 0)
+ return true;
+ else
+ return false;
+ }
+
+ /**
+ * Returns Copyright.
+ */
+ public boolean copyright() {
+ return h_copyright;
+ }
+
+ /**
+ * Returns Original.
+ */
+ public boolean original() {
+ return h_original;
+ }
+
+ /**
+ * Return VBR.
+ *
+ * @return true if VBR header is found
+ */
+ public boolean vbr() {
+ return h_vbr;
+ }
+
+ /**
+ * Return VBR scale.
+ *
+ * @return scale of -1 if not available
+ */
+ public int vbr_scale() {
+ return h_vbr_scale;
+ }
+
+ /**
+ * Return VBR TOC.
+ *
+ * @return vbr toc ot null if not available
+ */
+ public byte[] vbr_toc() {
+ return h_vbr_toc;
+ }
+
+ /**
+ * Returns Checksum flag. Compares computed checksum with stream checksum.
+ */
+ @RETURNLOC("OUT")
+ public boolean checksum_ok() {
+ return (checksum == crc.checksum());
+ }
+
+ // Seeking and layer III stuff
+ /**
+ * Returns Layer III Padding bit.
+ */
+ public boolean padding() {
+ if (h_padding_bit == 0)
+ return false;
+ else
+ return true;
+ }
+
+ /**
+ * Returns Slots.
+ */
+ @RETURNLOC("THIS,Header.NS")
+ public int slots() {
+ return nSlots;
+ }
+
+ /**
+ * Returns Mode Extension.
+ */
+ @RETURNLOC("THIS,Header.H")
+ public int mode_extension() {
+ return h_mode_extension;
+ }
+
+ // E.B -> private to public
+ public static final int bitrates[][][] = {
+ {
+ { 0 /* free format */, 32000, 48000, 56000, 64000, 80000, 96000, 112000, 128000, 144000,
+ 160000, 176000, 192000, 224000, 256000, 0 },
+ { 0 /* free format */, 8000, 16000, 24000, 32000, 40000, 48000, 56000, 64000, 80000,
+ 96000, 112000, 128000, 144000, 160000, 0 },
+ { 0 /* free format */, 8000, 16000, 24000, 32000, 40000, 48000, 56000, 64000, 80000,
+ 96000, 112000, 128000, 144000, 160000, 0 } },
+
+ {
+ { 0 /* free format */, 32000, 64000, 96000, 128000, 160000, 192000, 224000, 256000,
+ 288000, 320000, 352000, 384000, 416000, 448000, 0 },
+ { 0 /* free format */, 32000, 48000, 56000, 64000, 80000, 96000, 112000, 128000, 160000,
+ 192000, 224000, 256000, 320000, 384000, 0 },
+ { 0 /* free format */, 32000, 40000, 48000, 56000, 64000, 80000, 96000, 112000, 128000,
+ 160000, 192000, 224000, 256000, 320000, 0 } },
+ // SZD: MPEG2.5
+ {
+ { 0 /* free format */, 32000, 48000, 56000, 64000, 80000, 96000, 112000, 128000, 144000,
+ 160000, 176000, 192000, 224000, 256000, 0 },
+ { 0 /* free format */, 8000, 16000, 24000, 32000, 40000, 48000, 56000, 64000, 80000,
+ 96000, 112000, 128000, 144000, 160000, 0 },
+ { 0 /* free format */, 8000, 16000, 24000, 32000, 40000, 48000, 56000, 64000, 80000,
+ 96000, 112000, 128000, 144000, 160000, 0 } },
+
+ };
+
+ // E.B -> private to public
+ /**
+ * Calculate Frame size. Calculates framesize in bytes excluding header size.
+ */
+ public int calculate_framesize() {
+
+ if (h_layer == 1) {
+ framesize =
+ (12 * bitrates[h_version][0][h_bitrate_index])
+ / frequencies[h_version][h_sample_frequency];
+ if (h_padding_bit != 0)
+ framesize++;
+ framesize <<= 2; // one slot is 4 bytes long
+ nSlots = 0;
+ } else {
+ framesize =
+ (144 * bitrates[h_version][h_layer - 1][h_bitrate_index])
+ / frequencies[h_version][h_sample_frequency];
+ if (h_version == MPEG2_LSF || h_version == MPEG25_LSF)
+ framesize >>= 1; // SZD
+ if (h_padding_bit != 0)
+ framesize++;
+ // Layer III slots
+ if (h_layer == 3) {
+ if (h_version == MPEG1) {
+ nSlots = framesize - ((h_mode == SINGLE_CHANNEL) ? 17 : 32) // side
+ // info
+ // size
+ - ((h_protection_bit != 0) ? 0 : 2) // CRC size
+ - 4; // header size
+ } else { // MPEG-2 LSF, SZD: MPEG-2.5 LSF
+ nSlots = framesize - ((h_mode == SINGLE_CHANNEL) ? 9 : 17) // side
+ // info
+ // size
+ - ((h_protection_bit != 0) ? 0 : 2) // CRC size
+ - 4; // header size
+ }
+ } else {
+ nSlots = 0;
+ }
+ }
+ framesize -= 4; // subtract header size
+ return framesize;
+ }
+
+ /**
+ * Returns the maximum number of frames in the stream.
+ *
+ * @param streamsize
+ * @return number of frames
+ */
+ public int max_number_of_frames(int streamsize) // E.B
+ {
+ if (h_vbr == true)
+ return h_vbr_frames;
+ else {
+ if ((framesize + 4 - h_padding_bit) == 0)
+ return 0;
+ else
+ return (streamsize / (framesize + 4 - h_padding_bit));
+ }
+ }
+
+ /**
+ * Returns the maximum number of frames in the stream.
+ *
+ * @param streamsize
+ * @return number of frames
+ */
+ public int min_number_of_frames(int streamsize) // E.B
+ {
+ if (h_vbr == true)
+ return h_vbr_frames;
+ else {
+ if ((framesize + 5 - h_padding_bit) == 0)
+ return 0;
+ else
+ return (streamsize / (framesize + 5 - h_padding_bit));
+ }
+ }
+
+ /**
+ * Returns ms/frame.
+ *
+ * @return milliseconds per frame
+ */
+ @LATTICE("OUT<THIS,THISLOC=THIS,RETURNLOC=OUT")
+ public float ms_per_frame() // E.B
+ {
+ if (h_vbr == true) {
+ @LOC("OUT") double tpf = h_vbr_time_per_frame[layer()] / frequency();
+ if ((h_version == MPEG2_LSF) || (h_version == MPEG25_LSF))
+ tpf /= 2;
+ return ((float) (tpf * 1000));
+ } else {
+ @LOC("OUT") float ms_per_frame_array[][] =
+ { { 8.707483f, 8.0f, 12.0f }, { 26.12245f, 24.0f, 36.0f }, { 26.12245f, 24.0f, 36.0f } };
+ return (ms_per_frame_array[h_layer - 1][h_sample_frequency]);
+ }
+ }
+
+ /**
+ * Returns total ms.
+ *
+ * @param streamsize
+ * @return total milliseconds
+ */
+ public float total_ms(int streamsize) // E.B
+ {
+ return (max_number_of_frames(streamsize) * ms_per_frame());
+ }
+
+ /**
+ * Returns synchronized header.
+ */
+ public int getSyncHeader() // E.B
+ {
+ return _headerstring;
+ }
+
+ // functions which return header informations as strings:
+ /**
+ * Return Layer version.
+ */
+ @RETURNLOC("THIS,Header.H")
+ public String layer_string() {
+ switch (h_layer) {
+ case 1:
+ return "I";
+ case 2:
+ return "II";
+ case 3:
+ return "III";
+ }
+ return null;
+ }
+
+ // E.B -> private to public
+ public static final String bitrate_str[][][] = {
+ {
+ { "free format", "32 kbit/s", "48 kbit/s", "56 kbit/s", "64 kbit/s", "80 kbit/s",
+ "96 kbit/s", "112 kbit/s", "128 kbit/s", "144 kbit/s", "160 kbit/s", "176 kbit/s",
+ "192 kbit/s", "224 kbit/s", "256 kbit/s", "forbidden" },
+ { "free format", "8 kbit/s", "16 kbit/s", "24 kbit/s", "32 kbit/s", "40 kbit/s",
+ "48 kbit/s", "56 kbit/s", "64 kbit/s", "80 kbit/s", "96 kbit/s", "112 kbit/s",
+ "128 kbit/s", "144 kbit/s", "160 kbit/s", "forbidden" },
+ { "free format", "8 kbit/s", "16 kbit/s", "24 kbit/s", "32 kbit/s", "40 kbit/s",
+ "48 kbit/s", "56 kbit/s", "64 kbit/s", "80 kbit/s", "96 kbit/s", "112 kbit/s",
+ "128 kbit/s", "144 kbit/s", "160 kbit/s", "forbidden" } },
+
+ {
+ { "free format", "32 kbit/s", "64 kbit/s", "96 kbit/s", "128 kbit/s", "160 kbit/s",
+ "192 kbit/s", "224 kbit/s", "256 kbit/s", "288 kbit/s", "320 kbit/s", "352 kbit/s",
+ "384 kbit/s", "416 kbit/s", "448 kbit/s", "forbidden" },
+ { "free format", "32 kbit/s", "48 kbit/s", "56 kbit/s", "64 kbit/s", "80 kbit/s",
+ "96 kbit/s", "112 kbit/s", "128 kbit/s", "160 kbit/s", "192 kbit/s", "224 kbit/s",
+ "256 kbit/s", "320 kbit/s", "384 kbit/s", "forbidden" },
+ { "free format", "32 kbit/s", "40 kbit/s", "48 kbit/s", "56 kbit/s", "64 kbit/s",
+ "80 kbit/s", "96 kbit/s", "112 kbit/s", "128 kbit/s", "160 kbit/s", "192 kbit/s",
+ "224 kbit/s", "256 kbit/s", "320 kbit/s", "forbidden" } },
+ // SZD: MPEG2.5
+ {
+ { "free format", "32 kbit/s", "48 kbit/s", "56 kbit/s", "64 kbit/s", "80 kbit/s",
+ "96 kbit/s", "112 kbit/s", "128 kbit/s", "144 kbit/s", "160 kbit/s", "176 kbit/s",
+ "192 kbit/s", "224 kbit/s", "256 kbit/s", "forbidden" },
+ { "free format", "8 kbit/s", "16 kbit/s", "24 kbit/s", "32 kbit/s", "40 kbit/s",
+ "48 kbit/s", "56 kbit/s", "64 kbit/s", "80 kbit/s", "96 kbit/s", "112 kbit/s",
+ "128 kbit/s", "144 kbit/s", "160 kbit/s", "forbidden" },
+ { "free format", "8 kbit/s", "16 kbit/s", "24 kbit/s", "32 kbit/s", "40 kbit/s",
+ "48 kbit/s", "56 kbit/s", "64 kbit/s", "80 kbit/s", "96 kbit/s", "112 kbit/s",
+ "128 kbit/s", "144 kbit/s", "160 kbit/s", "forbidden" } }, };
+
+ /**
+ * Return Bitrate.
+ *
+ * @return bitrate in bps
+ */
+
+ @RETURNLOC("THIS,Header.FS")
+ public String bitrate_string() {
+ @LOC("THIS,Header.T") String kbs = " kb/s";
+ if (h_vbr == true) {
+ return Integer.toString(bitrate() / 1000) + kbs;
+ } else {
+ return bitrate_str[h_version][h_layer - 1][h_bitrate_index];
+ }
+ }
+
+ /**
+ * Return Bitrate.
+ *
+ * @return bitrate in bps and average bitrate for VBR header
+ */
+ @RETURNLOC("THIS,Header.FS")
+ public int bitrate() {
+ if (h_vbr == true) {
+ return ((int) ((h_vbr_bytes * 8) / (ms_per_frame() * h_vbr_frames))) * 1000;
+ } else {
+ return bitrates[h_version][h_layer - 1][h_bitrate_index];
+ }
+ }
+
+ /**
+ * Return Instant Bitrate. Bitrate for VBR is not constant.
+ *
+ * @return bitrate in bps
+ */
+ public int bitrate_instant() {
+ return bitrates[h_version][h_layer - 1][h_bitrate_index];
+ }
+
+ /**
+ * Returns Frequency
+ *
+ * @return frequency string in kHz
+ */
+ @RETURNLOC("THIS,Header.FS")
+ public String sample_frequency_string() {
+ switch (h_sample_frequency) {
+ case THIRTYTWO:
+ if (h_version == MPEG1)
+ return "32 kHz";
+ else if (h_version == MPEG2_LSF)
+ return "16 kHz";
+ else
+ // SZD
+ return "8 kHz";
+ case FOURTYFOUR_POINT_ONE:
+ if (h_version == MPEG1)
+ return "44.1 kHz";
+ else if (h_version == MPEG2_LSF)
+ return "22.05 kHz";
+ else
+ // SZD
+ return "11.025 kHz";
+ case FOURTYEIGHT:
+ if (h_version == MPEG1)
+ return "48 kHz";
+ else if (h_version == MPEG2_LSF)
+ return "24 kHz";
+ else
+ // SZD
+ return "12 kHz";
+ }
+ return (null);
+ }
+
+ /**
+ * Returns Mode.
+ */
+ @RETURNLOC("THIS,Header.H")
+ public String mode_string() {
+ switch (h_mode) {
+ case STEREO:
+ return "Stereo";
+ case JOINT_STEREO:
+ return "Joint stereo";
+ case DUAL_CHANNEL:
+ return "Dual channel";
+ case SINGLE_CHANNEL:
+ return "Single channel";
+ }
+ return null;
+ }
+
+ /**
+ * Returns Version.
+ *
+ * @return MPEG-1 or MPEG-2 LSF or MPEG-2.5 LSF
+ */
+ @RETURNLOC("THIS,Header.HV")
+ public String version_string() {
+ switch (h_version) {
+ case MPEG1:
+ return "MPEG-1";
+ case MPEG2_LSF:
+ return "MPEG-2 LSF";
+ case MPEG25_LSF: // SZD
+ return "MPEG-2.5 LSF";
+ }
+ return (null);
+ }
+
+ /**
+ * Returns the number of subbands in the current frame.
+ *
+ * @return number of subbands
+ */
+ public int number_of_subbands() {
+ return h_number_of_subbands;
+ }
+
+ /**
+ * Returns Intensity Stereo. (Layer II joint stereo only). Returns the number
+ * of subbands which are in stereo mode, subbands above that limit are in
+ * intensity stereo mode.
+ *
+ * @return intensity
+ */
+ public int intensity_stereo_bound() {
+ return h_intensity_stereo_bound;
+ }
+
+ public void setSideInfoBuf(SideInfoBuffer sib) {
+ this.sib = sib;
+ }
+
+ public void setBitReserve(BitReserve br) {
+ this.br = br;
+ }
+
+ @RETURNLOC("THIS,Header.T")
+ public SideInfoBuffer getSideInfoBuffer() {
+ return sib;
+ }
+
+ @RETURNLOC("THIS,Header.T")
+ public BitReserve getBitReserve() {
+ return br;
+ }
+
+}
--- /dev/null
+// need to have this class for liner type system
+@LATTICE("V")
+public class HuffData {
+
+ @LOC("V") public int x;
+ @LOC("V") public int y;
+ @LOC("V") public int w;
+ @LOC("V") public int v;
+ @LOC("V") public BitReserve br;
+
+ public HuffData(int x, int y, int w, int v, BitReserve br) {
+ this.x = x;
+ this.y = y;
+ this.w = w;
+ this.v = v;
+ this.br = br;
+ }
+
+}
--- /dev/null
+/*\r
+ * 11/19/04 1.0 moved to LGPL.\r
+ * 12/12/99 Initial version. mdm@techie.com\r
+ *-----------------------------------------------------------------------\r
+ * This program is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU Library General Public License as published\r
+ * by the Free Software Foundation; either version 2 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Library General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU Library General Public\r
+ * License along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\r
+ *----------------------------------------------------------------------\r
+ */\r
+\r
+import java.io.IOException;\r
+import java.io.InputStream;\r
+\r
+/**\r
+ * <i>Work In Progress.</i>\r
+ * \r
+ * An instance of <code>InputStreamSource</code> implements a\r
+ * <code>Source</code> that provides data from an <code>InputStream\r
+ * </code>. Seeking functionality is not supported. \r
+ * \r
+ * @author MDM\r
+ */\r
+public class InputStreamSource implements Source\r
+{\r
+ private final InputStream in;\r
+ \r
+ public InputStreamSource(InputStream in)\r
+ {\r
+ if (in==null)\r
+ throw new NullPointerException("in");\r
+ \r
+ this.in = in; \r
+ }\r
+ \r
+ public int read(byte[] b, int offs, int len)\r
+ throws IOException\r
+ {\r
+ int read = in.read(b, offs, len);\r
+ return read;\r
+ }\r
+ \r
+ public boolean willReadBlock()\r
+ {\r
+ return true;\r
+ //boolean block = (in.available()==0);\r
+ //return block;\r
+ }\r
+ \r
+ public boolean isSeekable()\r
+ {\r
+ return false; \r
+ }\r
+ \r
+ public long tell()\r
+ {\r
+ return -1; \r
+ }\r
+ \r
+ public long seek(long to)\r
+ {\r
+ return -1; \r
+ }\r
+ \r
+ public long length()\r
+ {\r
+ return -1;\r
+ }\r
+}\r
--- /dev/null
+/*\r
+ * 11/19/04 1.0 moved to LGPL.\r
+ * 12/12/99 Initial version. mdm@techie.com\r
+ *-----------------------------------------------------------------------\r
+ * This program is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU Library General Public License as published\r
+ * by the Free Software Foundation; either version 2 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Library General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU Library General Public\r
+ * License along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\r
+ *----------------------------------------------------------------------\r
+ */\r
+\r
+/**\r
+ * Work in progress.\r
+ * \r
+ * API usage errors may be handled by throwing an instance of this\r
+ * class, as per JMF 2.0. \r
+ */\r
+public class JavaLayerError extends Error\r
+{ \r
+}\r
--- /dev/null
+/*\r
+ * 11/19/04 1.0 moved to LGPL.\r
+ * 12/12/99 Initial version. mdm@techie.com\r
+ *-----------------------------------------------------------------------\r
+ * This program is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU Library General Public License as published\r
+ * by the Free Software Foundation; either version 2 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Library General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU Library General Public\r
+ * License along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\r
+ *----------------------------------------------------------------------\r
+ */\r
+\r
+\r
+/**\r
+ * Exception erorr codes for components of the JavaLayer API.\r
+ */\r
+public interface JavaLayerErrors\r
+{\r
+ /**\r
+ * The first bitstream error code. See the {@link DecoderErrors DecoderErrors}\r
+ * interface for other bitstream error codes.\r
+ */\r
+ static public final int BITSTREAM_ERROR = 0x100;\r
+\r
+ /**\r
+ * The first decoder error code. See the {@link DecoderErrors DecoderErrors}\r
+ * interface for other decoder error codes.\r
+ */\r
+ static public final int DECODER_ERROR = 0x200;\r
+\r
+}\r
--- /dev/null
+/*
+ * 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.
+ * <p>
+ *
+ * @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();
+// }
+ }
+
+
+}
--- /dev/null
+/*\r
+ * 11/19/04 1.0 moved to LGPL.\r
+ *-----------------------------------------------------------------------\r
+ * This program is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU Library General Public License as published\r
+ * by the Free Software Foundation; either version 2 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Library General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU Library General Public\r
+ * License along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\r
+ *----------------------------------------------------------------------\r
+ */\r
+\r
+\r
+//import java.io.InputStream;\r
+\r
+/**\r
+ * The <code>JavaLayerHooks</code> class allows developers to change\r
+ * the way the JavaLayer library uses Resources. \r
+ */\r
+\r
+public interface JavaLayerHook\r
+{\r
+ /**\r
+ * Retrieves the named resource. This allows resources to be\r
+ * obtained without specifying how they are retrieved. \r
+ */\r
+ public InputStream getResourceAsStream(String name);\r
+}\r
--- /dev/null
+/*\r
+ * 11/19/04 1.0 moved to LGPL.\r
+ * 12/12/99 Initial version. mdm@techie.com\r
+ *-----------------------------------------------------------------------\r
+ * This program is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU Library General Public License as published\r
+ * by the Free Software Foundation; either version 2 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Library General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU Library General Public\r
+ * License along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\r
+ *----------------------------------------------------------------------\r
+ */\r
+\r
+\r
+//import java.io.IOException;\r
+//import java.io.InputStream;\r
+//import java.io.InvalidClassException;\r
+//import java.io.InvalidObjectException;\r
+//import java.io.ObjectInputStream;\r
+//import java.io.ObjectOutputStream;\r
+//import java.io.OutputStream;\r
+//import java.lang.reflect.Array;\r
+\r
+/**\r
+ * The JavaLayerUtils class is not strictly part of the JavaLayer API.\r
+ * It serves to provide useful methods and system-wide hooks.\r
+ * \r
+ * @author MDM\r
+ */\r
+public class JavaLayerUtils\r
+{\r
+ static private JavaLayerHook hook = null;\r
+ \r
+ /**\r
+ * Deserializes the object contained in the given input stream.\r
+ * @param in The input stream to deserialize an object from.\r
+ * @param cls The expected class of the deserialized object. \r
+ */\r
+// static public Object deserialize(InputStream in, Class cls)\r
+ static public Object deserialize(InputStream in)\r
+ throws IOException\r
+ {\r
+// if (cls==null)\r
+// throw new NullPointerException("cls");\r
+ \r
+// Object obj = deserialize(in, cls);\r
+ Object obj = deserialize(in);\r
+// if (!cls.isInstance(obj))\r
+// {\r
+// throw new InvalidObjectException("type of deserialized instance not of required class.");\r
+// }\r
+ \r
+ return obj;\r
+ }\r
+ \r
+ /**\r
+ * Deserializes an object from the given <code>InputStream</code>.\r
+ * The deserialization is delegated to an <code>\r
+ * ObjectInputStream</code> instance. \r
+ * \r
+ * @param in The <code>InputStream</code> to deserialize an object\r
+ * from.\r
+ * \r
+ * @return The object deserialized from the stream. \r
+ * @exception IOException is thrown if there was a problem reading\r
+ * the underlying stream, or an object could not be deserialized\r
+ * from the stream.\r
+ * \r
+ * @see java.io.ObjectInputStream\r
+ */\r
+ static public Object deserialize(InputStream in)\r
+ throws IOException\r
+ {\r
+ if (in==null)\r
+ throw new NullPointerException("in");\r
+ \r
+ //TODO : need to enable after having objectinputstream\r
+ /*\r
+ ObjectInputStream objIn = new ObjectInputStream(in);\r
+ \r
+ Object obj;\r
+ \r
+ try\r
+ {\r
+ obj = objIn.readObject();\r
+ }\r
+ catch (ClassNotFoundException ex)\r
+ {\r
+ throw new InvalidClassException(ex.toString());\r
+ }\r
+ \r
+ return obj;\r
+ */\r
+ return null;\r
+ }\r
+\r
+ /**\r
+ * Deserializes an array from a given <code>InputStream</code>.\r
+ * \r
+ * @param in The <code>InputStream</code> to \r
+ * deserialize an object from.\r
+ * \r
+ * @param elemType The class denoting the type of the array\r
+ * elements.\r
+ * @param length The expected length of the array, or -1 if\r
+ * any length is expected.\r
+ */\r
+ static public Object deserializeArray(InputStream in, int length)\r
+ throws IOException\r
+ {\r
+ if (length<-1)\r
+ throw new IllegalArgumentException("length");\r
+ \r
+ Object obj = deserialize(in);\r
+ \r
+ return obj;\r
+ }\r
+// static public Object deserializeArray(InputStream in, Class elemType, int length)\r
+// throws IOException\r
+// {\r
+// if (elemType==null)\r
+// throw new NullPointerException("elemType");\r
+// \r
+// if (length<-1)\r
+// throw new IllegalArgumentException("length");\r
+// \r
+// Object obj = deserialize(in);\r
+// \r
+// //SSJava will never throw exceptions as it is so this code is meaningless\r
+// /*\r
+// Class cls = obj.getClass();\r
+// \r
+// if (!cls.isArray())\r
+// throw new InvalidObjectException("object is not an array");\r
+// \r
+// Class arrayElemType = cls.getComponentType();\r
+// if (arrayElemType!=elemType)\r
+// throw new InvalidObjectException("unexpected array component type");\r
+// \r
+// if (length != -1)\r
+// {\r
+// int arrayLength = Array.getLength(obj);\r
+// if (arrayLength!=length)\r
+// throw new InvalidObjectException("array length mismatch");\r
+// }\r
+// */\r
+// return obj;\r
+// }\r
+\r
+// static public Object deserializeArrayResource(String name, Class elemType, int length)\r
+ static public Object deserializeArrayResource(String name, int length)\r
+ throws IOException\r
+ { \r
+ InputStream str = getResourceAsStream(name);\r
+ if (str==null)\r
+ throw new IOException("unable to load resource '"+name+"'");\r
+ \r
+// Object obj = deserializeArray(str, elemType, length);\r
+ Object obj = deserializeArray(str, length);\r
+ \r
+ return obj;\r
+ } \r
+ \r
+ static public void serialize(OutputStream out, Object obj)\r
+ throws IOException\r
+ {\r
+ //TODO : need to enable after having objectinputstream\r
+// if (out==null)\r
+// throw new NullPointerException("out");\r
+// \r
+// if (obj==null)\r
+// throw new NullPointerException("obj");\r
+// \r
+// ObjectOutputStream objOut = new ObjectOutputStream(out);\r
+// objOut.writeObject(obj);\r
+ \r
+ }\r
+\r
+ /**\r
+ * Sets the system-wide JavaLayer hook.\r
+ */\r
+ static synchronized public void setHook(JavaLayerHook hook0) \r
+ {\r
+ hook = hook0;\r
+ }\r
+ \r
+ static synchronized public JavaLayerHook getHook()\r
+ {\r
+ return hook; \r
+ }\r
+ \r
+ /**\r
+ * Retrieves an InputStream for a named resource. \r
+ * \r
+ * @param name The name of the resource. This must be a simple\r
+ * name, and not a qualified package name.\r
+ * \r
+ * @return The InputStream for the named resource, or null if\r
+ * the resource has not been found. If a hook has been \r
+ * provided, its getResourceAsStream() method is called\r
+ * to retrieve the resource. \r
+ */\r
+ static synchronized public InputStream getResourceAsStream(String name)\r
+ {\r
+ InputStream is = null;\r
+ \r
+ if (hook!=null)\r
+ {\r
+ is = hook.getResourceAsStream(name); \r
+ }\r
+ //TODO java reflection\r
+// else\r
+// {\r
+// Class cls = JavaLayerUtils.class;\r
+// is = cls.getResourceAsStream(name);\r
+// }\r
+ \r
+ return is; \r
+ }\r
+}\r
--- /dev/null
+public @interface LATTICE{
+ String value();
+}
--- /dev/null
+public @interface LOC {
+ String value();
+}
+
+public @interface RETURNLOC {
+ String value();
+}
\ No newline at end of file
--- /dev/null
+/*
+ * 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.
+ */
+@LATTICE("SB1<SB,SB<F,F<H,H<SH,SH*,SB1*")
+@METHODDEFAULT("MODE<THIS,THIS<C,C<IN,THISLOC=THIS,C*")
+class LayerIDecoder implements FrameDecoder {
+
+ @LOC("SH")
+ protected Bitstream stream;
+ @LOC("SH")
+ protected Header header;
+ @LOC("F")
+ protected SynthesisFilter filter1;
+ @LOC("F")
+ protected SynthesisFilter filter2;
+ @LOC("H")
+ protected Obuffer buffer;
+ @LOC("H")
+ protected int which_channels;
+ @LOC("H")
+ protected int mode;
+
+ @LOC("H")
+ protected int num_subbands;
+ @LOC("SB")
+ protected Subband[] subbands;
+
+ @LOC("H")
+ protected Crc16 crc = null; // new Crc16[1] to enable CRC checking.
+
+ public LayerIDecoder() {
+ crc = new Crc16();
+ }
+
+ public void create(@LOC("IN") Bitstream stream0, @LOC("IN") Header header0,
+ @LOC("IN") SynthesisFilter filtera, @LOC("IN") SynthesisFilter filterb,
+ @LOC("IN") Obuffer buffer0, @LOC("IN") 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() {
+ @LOC("THIS,LayerIDecoder.H") 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 (@LOC("THIS,LayerIDecoder.SB") 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 (@LOC("THIS,LayerIDecoder.SB") int i = 0; i < num_subbands; ++i)
+ subbands[i].read_scalefactor(stream, header);
+ }
+
+ @LATTICE("MODE<THIS,THIS<C,THISLOC=THIS,C*")
+ protected void readSampleData() {
+
+ @LOC("THIS,LayerIDecoder.SB1") boolean read_ready = false;
+ @LOC("THIS,LayerIDecoder.SB1") boolean write_ready = false;
+
+ @LOC("MODE") int mode = header.mode(); // header.mode() will return
+ // DELTA(THIS)
+
+ @LOC("THIS,LayerIDecoder.SB1") 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
+ */
+ @LATTICE("S<L,L<H,H<SH,SH<SH0,SH*,L*")
+ @METHODDEFAULT("OUT<V,V<THIS,THIS<C,C<IN,C*,THISLOC=THIS,RETURNLOC=OUT")
+ 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) };
+
+ @LOC("H")
+ protected int subbandnumber;
+ @LOC("SH")
+ protected int samplenumber;
+ @LOC("H")
+ protected int allocation;
+ @LOC("L")
+ protected float scalefactor;
+ @LOC("L")
+ protected int samplelength;
+ @LOC("L")
+ protected float sample;
+ @LOC("L")
+ protected float factor;
+ @LOC("L")
+ protected float offset;
+
+ /**
+ * Construtor.
+ */
+ public SubbandLayer1(@LOC("IN") int subbandnumber) {
+ this.subbandnumber = subbandnumber;
+ samplenumber = 0;
+ }
+
+ /**
+ *
+ */
+ // @LATTICE("IN<THIS,THISLOC=THIS")
+ @LATTICE("THIS<IN,THISLOC=THIS")
+ public void read_allocation(@LOC("THIS,LayerIDecoder$SubbandLayer1.SH") Bitstream stream,
+ @LOC("IN") Header header, @LOC("THIS,LayerIDecoder$SubbandLayer1.L") 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(@LOC("IN") Bitstream stream, @LOC("IN") Header header) {
+ if (allocation != 0)
+ scalefactor = scalefactors[stream.get_bits(6)];
+ }
+
+ // ssjava
+ @LATTICE("THIS<IN,THISLOC=THIS")
+ @RETURNLOC("THIS,LayerIDecoder$SubbandLayer1.S")
+ public boolean read_sampledata(@LOC("THIS,LayerIDecoder$SubbandLayer1.S") Bitstream stream) {
+ if (allocation != 0) {
+ sample = (float) (stream.get_bits(samplelength));
+ }
+ if (++samplenumber == 12) {
+ samplenumber = 0;
+ return true;
+ }
+ return false;
+ }
+
+ // @METHODDEFAULT("OUT<V,V<THIS,THIS<C,C<IN,C*,THISLOC=THIS,RETURNLOC=OUT")
+ @LATTICE("THIS<IN,OUT,THISLOC=THIS,RETURNLOC=OUT")
+ public boolean put_next_sample(@LOC("IN") int channels,
+ @LOC("THIS,LayerIDecoder$SubbandLayer1.S") SynthesisFilter filter1,
+ @LOC("THIS,LayerIDecoder$SubbandLayer1.S") SynthesisFilter filter2) {
+ if ((allocation != 0) && (channels != OutputChannels.RIGHT_CHANNEL)) {
+ @LOC("THIS,LayerIDecoder$SubbandLayer1.L") float scaled_sample =
+ (sample * factor + offset) * scalefactor;
+ filter1.input_sample(scaled_sample, subbandnumber);
+ }
+ return true;
+ }
+ };
+
+ /**
+ * Class for layer I subbands in joint stereo mode.
+ */
+ @LATTICE("S<L,L<H,H<SH,SH<SH0,SH*")
+ @METHODDEFAULT("OUT<V,V<THIS,THIS<C,C<IN,C*,THISLOC=THIS,RETURNLOC=OUT")
+ static class SubbandLayer1IntensityStereo extends SubbandLayer1 {
+ @LOC("L")
+ protected float channel2_scalefactor;
+
+ /**
+ * Constructor
+ */
+ public SubbandLayer1IntensityStereo(@LOC("IN") int subbandnumber) {
+ super(subbandnumber);
+ }
+
+ /**
+ *
+ */
+ @LATTICE("THIS<IN2,IN2<IN1,IN1<IN0,THISLOC=THIS")
+ public void read_allocation(@LOC("IN1") Bitstream stream, @LOC("IN0") Header header,
+ @LOC("IN2") Crc16 crc) throws DecoderException {
+ super.read_allocation(stream, header, crc);
+ }
+
+ /**
+ *
+ */
+ public void read_scalefactor(@LOC("IN") Bitstream stream, @LOC("IN") Header header) {
+ if (allocation != 0) {
+ scalefactor = scalefactors[stream.get_bits(6)];
+ channel2_scalefactor = scalefactors[stream.get_bits(6)];
+ }
+ }
+
+ public boolean read_sampledata(@LOC("IN") Bitstream stream) {
+ return super.read_sampledata(stream);
+ }
+
+ public boolean put_next_sample(@LOC("IN") int channels, @LOC("IN") SynthesisFilter filter1,
+ @LOC("IN") SynthesisFilter filter2) {
+ if (allocation != 0) {
+ sample = sample * factor + offset; // requantization
+ if (channels == OutputChannels.BOTH_CHANNELS) {
+ @LOC("OUT") float sample1 = sample * scalefactor;
+ @LOC("OUT") float sample2 = sample * channel2_scalefactor;
+ filter1.input_sample(sample1, subbandnumber);
+ filter2.input_sample(sample2, subbandnumber);
+ } else if (channels == OutputChannels.LEFT_CHANNEL) {
+ @LOC("OUT") float sample1 = sample * scalefactor;
+ filter1.input_sample(sample1, subbandnumber);
+ } else {
+ @LOC("OUT") float sample2 = sample * channel2_scalefactor;
+ filter1.input_sample(sample2, subbandnumber);
+ }
+ }
+ return true;
+ }
+ };
+
+ /**
+ * Class for layer I subbands in stereo mode.
+ */
+ @LATTICE("S<L,L<H,H<SH,SH<SH0,SH*,S*")
+ @METHODDEFAULT("OUT<V,V<THIS,THIS<C,C<IN,C*,THISLOC=THIS,RETURNLOC=OUT")
+ static class SubbandLayer1Stereo extends SubbandLayer1 {
+ @LOC("H")
+ protected int channel2_allocation;
+ @LOC("L")
+ protected float channel2_scalefactor;
+ @LOC("L")
+ protected int channel2_samplelength;
+ @LOC("S")
+ protected float channel2_sample;
+ @LOC("L")
+ protected float channel2_factor;
+ @LOC("L")
+ protected float channel2_offset;
+
+ /**
+ * Constructor
+ */
+ public SubbandLayer1Stereo(@LOC("IN") int subbandnumber) {
+ super(subbandnumber);
+ }
+
+ /**
+ *
+ */
+ // ssjava
+ public void read_allocation(@LOC("THIS,LayerIDecoder$SubbandLayer1Stereo.SH") Bitstream stream,
+ @LOC("IN") Header header, @LOC("THIS,LayerIDecoder$SubbandLayer1Stereo.L") 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(@LOC("IN") Bitstream stream, @LOC("IN") Header header) {
+ if (allocation != 0)
+ scalefactor = scalefactors[stream.get_bits(6)];
+ if (channel2_allocation != 0)
+ channel2_scalefactor = scalefactors[stream.get_bits(6)];
+ }
+
+ /**
+ *
+ */
+ @RETURNLOC("THIS,LayerIDecoder$SubbandLayer1Stereo.S")
+ public boolean read_sampledata(@LOC("THIS,LayerIDecoder$SubbandLayer1Stereo.S") Bitstream stream) {
+ @LOC("THIS,LayerIDecoder$SubbandLayer1Stereo.S") boolean returnvalue =
+ super.read_sampledata(stream);
+ if (channel2_allocation != 0) {
+ channel2_sample = (float) (stream.get_bits(channel2_samplelength));
+ }
+ return returnvalue;
+ }
+
+ /**
+ *
+ */
+ @RETURNLOC("OUT")
+ public boolean put_next_sample(@LOC("IN") int channels, @LOC("IN") SynthesisFilter filter1,
+ @LOC("IN") SynthesisFilter filter2) {
+ super.put_next_sample(channels, filter1, filter2);
+ if ((channel2_allocation != 0) && (channels != OutputChannels.LEFT_CHANNEL)) {
+ @LOC("OUT") 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;
+ }
+
+ };
+
+}
--- /dev/null
+/*
+ * 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.
+ */
+@LATTICE("SB1<SB,SB<F,F<H,H<SH,SH*,SB1*")
+@METHODDEFAULT("MODE<THIS,THIS<C,C<IN,THISLOC=THIS,C*")
+class LayerIIDecoder extends LayerIDecoder implements FrameDecoder {
+
+ public LayerIIDecoder() {
+ }
+
+ protected void createSubbands() {
+ @LOC("THIS,LayerIIDecoder.H") 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 (@LOC("THIS,LayerIIDecoder.SH") int i = 0; i < num_subbands; ++i) {
+ ((SubbandLayer2) subbands[i]).read_scalefactor_selection(stream, crc);
+ }
+ }
+
+ /**
+ * Class for layer II subbands in single channel mode.
+ */
+ @LATTICE("S<L,L<H,L<SM,SM<H,H<SH,SH<SH0,SH*,SM*,SH0*")
+ @METHODDEFAULT("OUT<V,V<THIS,THIS<C,C<IN,C*,THISLOC=THIS,RETURNLOC=OUT")
+ 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 };
+
+ @LOC("SH")
+ protected int subbandnumber;
+ @LOC("SH")
+ protected int allocation;
+ @LOC("SH")
+ protected int scfsi;
+ @LOC("SH")
+ protected float scalefactor1;
+ @LOC("SH")
+ protected float scalefactor2;
+ @LOC("SH")
+ protected float scalefactor3;
+ @LOC("H")
+ protected int[] codelength = { 0 };
+ @LOC("SH")
+ protected float groupingtable[][] = new float[2][];
+ // protected float[][] groupingtable = {{0},{0}} ;
+ @LOC("SM")
+ protected float[] factor = { 0.0f };
+ @LOC("SH")
+ protected int groupnumber;
+ @LOC("SM")
+ protected int samplenumber;
+ @LOC("SM")
+ protected float[] samples = new float[3];
+ @LOC("SM")
+ protected float[] c = { 0.0f };
+ @LOC("SM")
+ protected float[] d = { 0.0f };
+
+ /**
+ * Constructor
+ */
+ public SubbandLayer2(@LOC("IN") int subbandnumber) {
+ this.subbandnumber = subbandnumber;
+ groupnumber = samplenumber = 0;
+ }
+
+ /**
+ *
+ */
+ protected int get_allocationlength(@LOC("THIS,LayerIIDecoder$SubbandLayer2.SH") Header header) {
+
+ if (header.version() == Header.MPEG1) {
+
+ @LOC("THIS,LayerIIDecoder$SubbandLayer2.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
+ 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;
+ }
+ }
+
+ /**
+ *
+ */
+ @LATTICE("OUT<THIS,THIS<IN,THISLOC=THIS")
+ protected void prepare_sample_reading(@LOC("IN") Header header,
+ @LOC("THIS,LayerIIDecoder$SubbandLayer2.SH") int allocation,
+ // float[][] groupingtable,
+ @LOC("IN") int channel, @LOC("OUT") float[] factor, @LOC("OUT") int[] codelength,
+ @LOC("OUT") float[] c, @LOC("OUT") float[] d) {
+
+ // header.bitrate_index() will generate at most DELTA(THIS,SH*)
+ @LOC("THIS,LayerIIDecoder$SubbandLayer2.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];
+ }
+ }
+ }
+ }
+
+ /**
+ *
+ */
+ @LATTICE("V<THIS,THIS<IN,THISLOC=THIS")
+ // ssjava
+ public void read_allocation(@LOC("THIS,LayerIIDecoder$SubbandLayer2.SH") Bitstream stream,
+ @LOC("THIS,LayerIIDecoder$SubbandLayer2.SH0") Header header,
+ @LOC("THIS,LayerIIDecoder$SubbandLayer2.H") Crc16 crc) {
+
+ @LOC("THIS,LayerIIDecoder$SubbandLayer2.SH0") int length = get_allocationlength(header);
+
+ allocation = stream.get_bits(length);
+ if (crc != null) {
+ crc.add_bits(allocation, length);
+ }
+ }
+
+ /**
+ *
+ */
+ public void read_scalefactor_selection(@LOC("IN") Bitstream stream,
+ @LOC("THIS,LayerIIDecoder$SubbandLayer2.H") Crc16 crc) {
+ if (allocation != 0) {
+ scfsi = stream.get_bits(2);
+ if (crc != null)
+ crc.add_bits(scfsi, 2);
+ }
+ }
+
+ /**
+ *
+ */
+ public void read_scalefactor(@LOC("IN") Bitstream stream, @LOC("IN") 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(@LOC("THIS,LayerIIDecoder$SubbandLayer2.SM") Bitstream stream) {
+ if (allocation != 0) {
+ if (groupingtable[0] != null) {
+
+ @LOC("THIS,LayerIIDecoder$SubbandLayer2.SM") 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:
+ @LOC("THIS,LayerIIDecoder$SubbandLayer2.SM") int tmp = 0;
+ @LOC("THIS,LayerIIDecoder$SubbandLayer2.SM") 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(@LOC("IN") int channels, @LOC("IN") SynthesisFilter filter1,
+ @LOC("IN") SynthesisFilter filter2) {
+
+ if ((allocation != 0) && (channels != OutputChannels.RIGHT_CHANNEL)) {
+
+ @LOC("THIS,LayerIIDecoder$SubbandLayer2.SM") 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.
+ */
+ @LATTICE("S<L,L<H,L<SM,SM<H,H<SH,SH<SH0,SH*,SM*")
+ @METHODDEFAULT("OUT<V,V<THIS,THIS<C,C<IN,C*,THISLOC=THIS,RETURNLOC=OUT")
+ static class SubbandLayer2IntensityStereo extends SubbandLayer2 {
+ @LOC("SH")
+ protected int channel2_scfsi;
+ @LOC("SH")
+ protected float channel2_scalefactor1;
+ @LOC("SH")
+ protected float channel2_scalefactor2;
+ @LOC("SH")
+ protected float channel2_scalefactor3;
+
+ /**
+ * Constructor
+ */
+ public SubbandLayer2IntensityStereo(@LOC("IN") int subbandnumber) {
+ super(subbandnumber);
+ }
+
+ /**
+ *
+ */
+ @LATTICE("THIS<IN2,IN2<IN1,IN1<IN0,THISLOC=THIS")
+ public void read_allocation(@LOC("IN1") Bitstream stream, @LOC("IN0") Header header,
+ @LOC("IN2") Crc16 crc) {
+ super.read_allocation(stream, header, crc);
+ }
+
+ /**
+ *
+ */
+ public void read_scalefactor_selection(@LOC("IN") Bitstream stream,
+ @LOC("THIS,LayerIIDecoder$SubbandLayer2IntensityStereo.H") 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(@LOC("IN") Bitstream stream, @LOC("IN") 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(@LOC("IN") Bitstream stream) {
+ return super.read_sampledata(stream);
+ }
+
+ /**
+ *
+ */
+ @LATTICE("S2<S1,S1<THIS,THIS<GLOBAL,GLOBAL<IN,S1*,THISLOC=THIS,GLOBALLOC=GLOBAL")
+ @RETURNLOC("S2")
+ public boolean put_next_sample(@LOC("IN") int channels, @LOC("IN") SynthesisFilter filter1,
+ @LOC("IN") SynthesisFilter filter2) {
+ if (allocation != 0) {
+ @LOC("S1") float sample = samples[samplenumber];
+
+ if (groupingtable[0] == null)
+ sample = (sample + d[0]) * c[0];
+ if (channels == OutputChannels.BOTH_CHANNELS) {
+ @LOC("S2") 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.
+ */
+ @LATTICE("S<L,L<H,L<SM,SM<H,H<SH,SH<SH0,SH*,SM*,SH0*")
+ @METHODDEFAULT("OUT<V,V<THIS,THIS<C,C<IN,C*,THISLOC=THIS,RETURNLOC=OUT")
+ static class SubbandLayer2Stereo extends SubbandLayer2 {
+ @LOC("SH")
+ protected int channel2_allocation;
+ @LOC("SH")
+ protected int channel2_scfsi;
+ @LOC("SH")
+ protected float channel2_scalefactor1;
+ @LOC("SH")
+ protected float channel2_scalefactor2;
+ @LOC("SH")
+ protected float channel2_scalefactor3;
+ // protected boolean channel2_grouping; ???? Never used!
+ @LOC("H")
+ protected int[] channel2_codelength = { 0 };
+ // protected float[][] channel2_groupingtable = {{0},{0}};
+ @LOC("H")
+ protected float[] channel2_factor = { 0.0f };
+ @LOC("SM")
+ protected float[] channel2_samples;
+ @LOC("SM")
+ protected float[] channel2_c = { 0.0f };
+ @LOC("SM")
+ protected float[] channel2_d = { 0.0f };
+
+ /**
+ * Constructor
+ */
+ public SubbandLayer2Stereo(@LOC("IN") int subbandnumber) {
+ super(subbandnumber);
+ channel2_samples = new float[3];
+ }
+
+ /**
+ *
+ */
+ @LATTICE("V<THIS,THIS<IN,THISLOC=THIS")
+ // ssjava
+ public void read_allocation(
+ @LOC("THIS,LayerIIDecoder$SubbandLayer2Stereo.SH") Bitstream stream,
+ @LOC("THIS,LayerIIDecoder$SubbandLayer2Stereo.SH0") Header header,
+ @LOC("THIS,LayerIIDecoder$SubbandLayer2Stereo.H") Crc16 crc) {
+
+ @LOC("THIS,LayerIIDecoder$SubbandLayer2Stereo.SH0") 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(@LOC("IN") Bitstream stream,
+ @LOC("THIS,LayerIIDecoder$SubbandLayer2Stereo.H") 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(@LOC("IN") Bitstream stream, @LOC("IN") 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(
+ @LOC("THIS,LayerIIDecoder$SubbandLayer2Stereo.SM") Bitstream stream) {
+ @LOC("V") boolean returnvalue = super.read_sampledata(stream);
+
+ if (channel2_allocation != 0)
+ if (groupingtable[1] != null) {
+ @LOC("THIS,LayerIIDecoder$SubbandLayer2Stereo.SM") int samplecode =
+ stream.get_bits(channel2_codelength[0]);
+ // create requantized samples:
+ samplecode += samplecode << 1;
+
+ @LOC("THIS,LayerIIDecoder$SubbandLayer2Stereo.SM") int tmp = 0;
+ @LOC("THIS,LayerIIDecoder$SubbandLayer2Stereo.SM") 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(@LOC("IN") int channels, @LOC("IN") SynthesisFilter filter1,
+ @LOC("IN") SynthesisFilter filter2) {
+
+ @LOC("OUT") boolean returnvalue = super.put_next_sample(channels, filter1, filter2);
+
+ if ((channel2_allocation != 0) && (channels != OutputChannels.LEFT_CHANNEL)) {
+
+ @LOC("THIS,LayerIIDecoder$SubbandLayer2Stereo.SM") 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;
+
+ }
+ }
+}
--- /dev/null
+/*
+ * 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
+ */
+// @LATTICE("FS<BR,BR<SF,LR<IR,IR<IP,IP<SF,LR<K,K<F,LR<VAR,LR<RO,RO<F,VAR<F,VAR<RAW,CSH<F,SAM<O,O<F,NS<SI,SI<CH,SFREQ<H,MAX<H,H<CH,FLCH<CH,FLCH<WC,SF<SFT,SFT<NS,NS<C,TS<RAW,O<TS,LY<F,NZ<VAR,C*,FS*,IP*,IR*,LR*,K*,O*,TS*,TS<BT,BT<GR,GR<SI,LR<S,S<ME,ME<CH,K<SH,K<LSF,LSF<H,LSF<CH,IP<SH,SH<J,J<S,S<ME,SH<SFREQ,SH<RO,IP<TMP2,LSF<H,TMP2<F,J*,SH*,O<RO2,RO2<RO3,RO3<RO4,RO4<RO5,O<RO1,RO1<RO5,RO5<RO6,RO6<RO7,RO7<RO8,RO8<RO9,RO9<SFREQ,RO9<F,RO1*,RO4*,RO5*,RO6*,RO9*,VAR<HD3,HD3<HD2,HD2<HD1,HD1<SI,HD1<SFREQ,HD1<RAW,HD2*,HD3*,SFB<GLSFD5,GLSFD5<NS,GLSFD5<GLSFD4,NS<GLSFD3,GLSFD4<GLSFD3,GLSFD3<GLSFD2,GLSFD2<GLSFD1,GLSFD1<SI,GLSFD5*,SF<GLSFF4,GLSFF4<GLSFF3,GLSFF3<GLSFF2,GLSFF2<GLSFF1,GLSFF1<SI,GLSFF4*,GLSFF3*,GLSFF2*,SF<GSF5,GSF5<GSF4,GSF4<GSF3,GSF3<GSF2,GSF2<GSF1,GSF1<SI,GSF5*,GSF4*,O<D3,D3<D2,D2<D1,D1<FLCH,D1*,D2*")
+// 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
+// @LATTICE("IS1D*,RO<IS1D,IS1D<SI2,SI2<SI1,SI<P2S,SF1<CH0,SF0*,SFB_SH<NS,NS<SI,SFB_SH*,SFB<SFB_SH,C,C*,SI1<SF2,SF2<SFB,SF1<BR,LR*,OUT<LR,LR<RO,NZ*,SI<SF1,SI1<NZ,NZ<SI,SI1<SBI,SBI<SI,BUF<FT,SF1<SF0,SF0<HD1,BR<ST,ST,FT<SP,SP<OUT,OUT<SI1,SI1<SI,P2S<CH0,CH0<MAX0,MAX0<BR1,FS<BR1,BR1<BR,BR<HD1,HD1<HD,OUT*,BR1*,SI1*,MAX0*,CH0*,RAW,TS,F,C,K,LY,VAR,IR,IP,CSH,GLSFD3,GLSFD4,GLSFD5,GLSFF4,GLSFF2,GLSFF3,GLSFF1,GSF4,GSF5,GSF1,GSF2,GSF3,HD2,HD3,BT,GR,RO6,RO5,RO9,RO8,RO7,RO4,RO1,RO3,RO2,SH,ME,TMP2,S,LSF,J")
+@LATTICE("SI0*,INIT*,ISR*,ISP*,HD<CH0,LR<ISR,ISR<ISP,SI1<SF2,NS*,CH0<ST,ST<INIT,IS1D*,RO1<RO,RO1*,RO<IS1D,IS1D<SI2,SI2<SI1,BR<NS,NS<SI,SFB_SH*,SFB<SFB_SH,C,C*,SF2<SFB,LR*,TSOUT*,OUT1<PREV,PREV<RAWFULL,RAWFULL<RAWOUT,RAWOUT<TSOUT,TSOUT<OUT0,OUT0<LR,ISP<RO1,NZ*,SI<SI0,SI0<SF15,SF15<SF1,BR1<NZ,NZ<BR,SI1<RT,RT<SBI,SBI<SI,BUF<FT,SF1<HD1,SF1<HD1,FT<SP,SP<OUT1,SI1<SI,SFB_SH<BR1,BR1<BR,HD1<HD,OUT0*,OUT1*,BR1*,SI1*,CH0*")
+@METHODDEFAULT("OUT<V,V<THIS,THIS<SH,SH<IN,SH*,THISLOC=THIS,GLOBALLOC=IN,RETURNLOC=OUT")
+final class LayerIIIDecoder implements FrameDecoder {
+ static final double d43 = (4.0 / 3.0);
+ @LOC("SFB")
+ public int[] scalefac_buffer;
+
+ // MDM: removed, as this wasn't being used.
+ // private float CheckSumOut1d = 0.0f;
+ @LOC("SI1")
+ private int CheckSumHuff = 0;
+ @LOC("IS1D")
+ private int[] is_1d;
+ @LOC("RO")
+ private float[][][] ro;
+ @LOC("LR")
+ private float[][][] lr;
+ @LOC("OUT0")
+ private float[] inter; // 576 samples
+ @LOC("OUT1")
+ private float[] out_1d; // 576 samples
+ @LOC("PREV")
+ private float[][] prevblck;
+
+ @LOC("LR")
+ private float[][] k;
+ @LOC("NZ")
+ private int[] nonzero;
+ @LOC("FT")
+ private SynthesisFilter filter1;
+ @LOC("FT")
+ private SynthesisFilter filter2;
+ // @LOC("SP")
+ // private Obuffer buffer; // output buffer
+ @LOC("CH0")
+ private int which_channels;
+ @LOC("BR")
+ private BitReserve br;
+ @LOC("SI")
+ private III_side_info_t si;
+
+ // @LOC("SBT") private temporaire2[] III_scalefac_t;
+ @LOC("SF2")
+ private final temporaire2[] scalefac;
+ // private III_scalefac_t scalefac;
+
+ @LOC("CH0")
+ private int max_gr;
+ @LOC("CH0")
+ private int frame_start;
+ // @LOC("SI1") private int part2_start;
+ @LOC("CH0")
+ private final int channels;
+ @LOC("CH0")
+ private int first_channel;
+ @LOC("CH0")
+ private int last_channel;
+ @LOC("SBI")
+ private int sfreq;
+
+ @LOC("BR1")
+ private int part2_start;
+
+ @LOC("INIT")
+ private boolean initialized = false;
+
+ @LOC("RAWFULL")
+ float[][] raw_full; // 18 left shfited since it will be copied into prevblck!
+
+ // constructor for the linear type system
+ public LayerIIIDecoder(Header h, @DELEGATE @LOC("VAR") SynthesisFilter filtera,
+ @DELEGATE @LOC("VAR") SynthesisFilter filterb, @LOC("VAR") 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
+ @LOC("VAR") 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 };
+ @LOC("VAR") int[] s0 = { 0, 4, 8, 12, 18, 24, 32, 42, 56, 74, 100, 132, 174, 192 };
+ @LOC("VAR") 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 };
+ @LOC("VAR") int[] s1 = { 0, 4, 8, 12, 18, 26, 36, 48, 62, 80, 104, 136, 180, 192 };
+ @LOC("VAR") 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 };
+ @LOC("VAR") int[] s2 = { 0, 4, 8, 12, 18, 26, 36, 48, 62, 80, 104, 134, 174, 192 };
+
+ @LOC("VAR") 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 };
+ @LOC("VAR") int[] s3 = { 0, 4, 8, 12, 16, 22, 30, 40, 52, 66, 84, 106, 136, 192 };
+ @LOC("VAR") 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 };
+ @LOC("VAR") int[] s4 = { 0, 4, 8, 12, 16, 22, 28, 38, 50, 64, 80, 100, 126, 192 };
+ @LOC("VAR") 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 };
+ @LOC("VAR") int[] s5 = { 0, 4, 8, 12, 16, 22, 30, 42, 58, 78, 104, 138, 180, 192 };
+ // SZD: MPEG2.5
+ @LOC("VAR") 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 };
+ @LOC("VAR") int[] s6 = { 0, 4, 8, 12, 18, 26, 36, 48, 62, 80, 104, 134, 174, 192 };
+ @LOC("VAR") 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 };
+ @LOC("VAR") int[] s7 = { 0, 4, 8, 12, 18, 26, 36, 48, 62, 80, 104, 134, 174, 192 };
+ @LOC("VAR") 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 };
+ @LOC("VAR") 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 (@LOC("I") 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);
+ }
+
+ @LATTICE("THIS<C,THIS<IN,C*,THISLOC=THIS")
+ private void init(@LOC("THIS,LayerIIIDecoder.HD1") 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 (@LOC("THIS,LayerIIIDecoder.CH0") int ch = 0; ch < 2; ch++)
+ for (@LOC("THIS,LayerIIIDecoder.CH0") 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
+ // @LATTICE("THIS<VAR,THIS<I,THIS<J,J<CH,I*,J*,CH*,THISLOC=THIS,GLOBALLOC=THIS")
+ // public LayerIIIDecoder(@LOC("VAR") Header header0, @LOC("VAR")
+ // SynthesisFilter filtera,
+ // @LOC("VAR") SynthesisFilter filterb, @LOC("VAR") 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
+ // @LOC("VAR") 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 };
+ // @LOC("VAR") int[] s0 = { 0, 4, 8, 12, 18, 24, 32, 42, 56, 74, 100, 132,
+ // 174, 192 };
+ // @LOC("VAR") 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 };
+ // @LOC("VAR") int[] s1 = { 0, 4, 8, 12, 18, 26, 36, 48, 62, 80, 104, 136,
+ // 180, 192 };
+ // @LOC("VAR") 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 };
+ // @LOC("VAR") int[] s2 = { 0, 4, 8, 12, 18, 26, 36, 48, 62, 80, 104, 134,
+ // 174, 192 };
+ //
+ // @LOC("VAR") 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 };
+ // @LOC("VAR") int[] s3 = { 0, 4, 8, 12, 16, 22, 30, 40, 52, 66, 84, 106, 136,
+ // 192 };
+ // @LOC("VAR") 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 };
+ // @LOC("VAR") int[] s4 = { 0, 4, 8, 12, 16, 22, 28, 38, 50, 64, 80, 100, 126,
+ // 192 };
+ // @LOC("VAR") 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 };
+ // @LOC("VAR") int[] s5 = { 0, 4, 8, 12, 16, 22, 30, 42, 58, 78, 104, 138,
+ // 180, 192 };
+ // // SZD: MPEG2.5
+ // @LOC("VAR") 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 };
+ // @LOC("VAR") int[] s6 = { 0, 4, 8, 12, 18, 26, 36, 48, 62, 80, 104, 134,
+ // 174, 192 };
+ // @LOC("VAR") 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 };
+ // @LOC("VAR") int[] s7 = { 0, 4, 8, 12, 18, 26, 36, 48, 62, 80, 104, 134,
+ // 174, 192 };
+ // @LOC("VAR") 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 };
+ // @LOC("VAR") 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 (@LOC("I") int i = 0; i < 9; i++)
+ // reorder_table[i] = reorder(sfBandIndex[i].s);
+ // }
+ //
+ // // Sftable
+ // @LOC("VAR") int[] ll0 = { 0, 6, 11, 16, 21 };
+ // @LOC("VAR") 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 (@LOC("CH") int ch = 0; ch < 2; ch++)
+ // for (@LOC("J") 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.
+ */
+ @LATTICE("THIS<J,J<CH,J*,CH*,THISLOC=THIS,GLOBALLOC=THIS")
+ public void seek_notify() {
+ frame_start = 0;
+ for (@LOC("CH") int ch = 0; ch < 2; ch++)
+ for (@LOC("J") int j = 0; j < 576; j++)
+ prevblck[ch][j] = 0.0f;
+ br = new BitReserve();
+ }
+
+ public void decodeFrame(@LOC("IN") 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.
+ @LOC("SP")
+ private float[] samples1 = new float[32];
+ @LOC("SP")
+ private float[] samples2 = new float[32];
+ @LOC("SI1")
+ 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}
+ */
+ // @LATTICE("BYTE<THIS,THIS<MAIN,MAIN<VAR,THIS<GR,GR<VAR,BYTE*,GR*,THISLOC=THIS,GLOBALLOC=VAR")
+ @LATTICE("HEADER<VAR,VAR<THIS,C<THIS,THIS<IN,THISLOC=THIS,C*,VAR*")
+ public void decode(@LOC("THIS,LayerIIIDecoder.HD") 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);
+ CheckSumHuff = 0;
+ // prevblck = new float[2][SBLIMIT * SSLIMIT];
+ si = new III_side_info_t();
+ //
+
+ @LOC("THIS,LayerIIIDecoder.HD1") int nSlots = header.slots();
+
+ @LOC("THIS,LayerIIIDecoder.CH0") int gr;
+ @LOC("THIS,LayerIIIDecoder.CH0") int ch;
+
+ @LOC("THIS,LayerIIIDecoder.CH0") int ss;
+ @LOC("THIS,LayerIIIDecoder.CH0") int sb;
+ @LOC("THIS,LayerIIIDecoder.CH0") int sb18;
+
+ @LOC("THIS,LayerIIIDecoder.BR,BitReserve.BIT") int main_data_end;
+ @LOC("THIS,LayerIIIDecoder.BR,BitReserve.BIT") int flush_main;
+
+ @LOC("THIS,LayerIIIDecoder.BR,BitReserve.BIT") int bytes_to_discard;
+ @LOC("C") int i;
+
+ // modifications for linear type
+ get_side_info(header);
+ br = header.getBitReserve();
+
+ @LOC("THIS,LayerIIIDecoder.HD1") int version = header.version();
+
+ // additional codes for the definitely written property
+ filter_pos = (filter_pos + 4) & 0xf;
+ filter1.vidx = 1;
+ filter2.vidx = 1;
+ filter1.actual_write_pos = filter_pos;
+ filter2.actual_write_pos = filter_pos;
+ //
+
+ // System.out.println("filter1="+filter1.vidx+" "+filter1.actual_write_pos);
+ // System.out.println("filter1="+filter2.vidx+" "+filter2.actual_write_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();
+ @LOC("THIS,LayerIIIDecoder.BR,BitReserve.BIT") 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 (@LOC("THIS,LayerIIIDecoder.SI1") 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
+ // 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
+
+ // 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)
+ */
+ @LATTICE("OUT<THIS,THIS<C,C<IN,C*,THISLOC=THIS,RETURNLOC=OUT")
+ private boolean get_side_info(@LOC("THIS,LayerIIIDecoder.HD1") Header header) {
+
+ @LOC("THIS,LayerIIIDecoder.SI,LayerIIIDecoder$III_side_info_t.TEMP") SideInfoBuffer sib =
+ header.getSideInfoBuffer();
+ @LOC("THIS,LayerIIIDecoder.SF1") int version = header.version();
+
+ @LOC("THIS,LayerIIIDecoder.SI0") int ch;
+ @LOC("THIS,LayerIIIDecoder.SI0") 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);
+ @LOC("THIS,LayerIIIDecoder.SI,LayerIIIDecoder$III_side_info_t.TEMP") 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);
+
+ @LOC("THIS,LayerIIIDecoder.SI,LayerIIIDecoder$III_side_info_t.TEMP") 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; ch<channels; ch++)
+ } // if (header.version() == MPEG1)
+ return true;
+ }
+
+ /**
+ *
+ */
+ @LATTICE("THIS<IN,THISLOC=THIS,GLOBALLOC=IN")
+ private void get_scale_factors(@LOC("THIS,LayerIIIDecoder.SF1") Header header,
+ @LOC("THIS,LayerIIIDecoder.SF1") int ch, @LOC("THIS,LayerIIIDecoder.SF1") int gr) {
+
+ // gr_info_s gr_info = (si.ch[ch].gr[gr]); remove alias
+
+ @LOC("THIS,LayerIIIDecoder.NS") int sfb;
+ @LOC("THIS,LayerIIIDecoder.NS") int window;
+ @LOC("THIS,LayerIIIDecoder.NS") int scale_comp = si.ch[ch].gr[gr].scalefac_compress;
+ @LOC("THIS,LayerIIIDecoder.NS") int length0 = slen[0][scale_comp];
+ @LOC("THIS,LayerIIIDecoder.NS") int length1 = slen[1][scale_comp];
+
+ if ((si.ch[ch].gr[gr].window_switching_flag != 0) && (si.ch[ch].gr[gr].block_type == 2)) {
+ if ((si.ch[ch].gr[gr].mixed_block_flag) != 0) { // MIXED
+ for (sfb = 0; sfb < 8; sfb++)
+ scalefac[ch].l[sfb] = br.hgetbits(slen[0][si.ch[ch].gr[gr].scalefac_compress]);
+ for (sfb = 3; sfb < 6; sfb++)
+ for (window = 0; window < 3; window++)
+ scalefac[ch].s[window][sfb] = br.hgetbits(slen[0][si.ch[ch].gr[gr].scalefac_compress]);
+ for (sfb = 6; sfb < 12; sfb++)
+ for (window = 0; window < 3; window++)
+ scalefac[ch].s[window][sfb] = br.hgetbits(slen[1][si.ch[ch].gr[gr].scalefac_compress]);
+ for (sfb = 12, window = 0; window < 3; window++)
+ scalefac[ch].s[window][sfb] = 0;
+
+ } else { // SHORT
+
+ scalefac[ch].s[0][0] = br.hgetbits(length0);
+ scalefac[ch].s[1][0] = br.hgetbits(length0);
+ scalefac[ch].s[2][0] = br.hgetbits(length0);
+ scalefac[ch].s[0][1] = br.hgetbits(length0);
+ scalefac[ch].s[1][1] = br.hgetbits(length0);
+ scalefac[ch].s[2][1] = br.hgetbits(length0);
+ scalefac[ch].s[0][2] = br.hgetbits(length0);
+ scalefac[ch].s[1][2] = br.hgetbits(length0);
+ scalefac[ch].s[2][2] = br.hgetbits(length0);
+ scalefac[ch].s[0][3] = br.hgetbits(length0);
+ scalefac[ch].s[1][3] = br.hgetbits(length0);
+ scalefac[ch].s[2][3] = br.hgetbits(length0);
+ scalefac[ch].s[0][4] = br.hgetbits(length0);
+ scalefac[ch].s[1][4] = br.hgetbits(length0);
+ scalefac[ch].s[2][4] = br.hgetbits(length0);
+ scalefac[ch].s[0][5] = br.hgetbits(length0);
+ scalefac[ch].s[1][5] = br.hgetbits(length0);
+ scalefac[ch].s[2][5] = br.hgetbits(length0);
+ scalefac[ch].s[0][6] = br.hgetbits(length1);
+ scalefac[ch].s[1][6] = br.hgetbits(length1);
+ scalefac[ch].s[2][6] = br.hgetbits(length1);
+ scalefac[ch].s[0][7] = br.hgetbits(length1);
+ scalefac[ch].s[1][7] = br.hgetbits(length1);
+ scalefac[ch].s[2][7] = br.hgetbits(length1);
+ scalefac[ch].s[0][8] = br.hgetbits(length1);
+ scalefac[ch].s[1][8] = br.hgetbits(length1);
+ scalefac[ch].s[2][8] = br.hgetbits(length1);
+ scalefac[ch].s[0][9] = br.hgetbits(length1);
+ scalefac[ch].s[1][9] = br.hgetbits(length1);
+ scalefac[ch].s[2][9] = br.hgetbits(length1);
+ scalefac[ch].s[0][10] = br.hgetbits(length1);
+ scalefac[ch].s[1][10] = br.hgetbits(length1);
+ scalefac[ch].s[2][10] = br.hgetbits(length1);
+ scalefac[ch].s[0][11] = br.hgetbits(length1);
+ scalefac[ch].s[1][11] = br.hgetbits(length1);
+ scalefac[ch].s[2][11] = br.hgetbits(length1);
+ scalefac[ch].s[0][12] = 0;
+ scalefac[ch].s[1][12] = 0;
+ scalefac[ch].s[2][12] = 0;
+ } // SHORT
+
+ } else { // LONG types 0,1,3
+
+ if ((si.ch[ch].scfsi[0] == 0) || (gr == 0)) {
+ scalefac[ch].l[0] = br.hgetbits(length0);
+ scalefac[ch].l[1] = br.hgetbits(length0);
+ scalefac[ch].l[2] = br.hgetbits(length0);
+ scalefac[ch].l[3] = br.hgetbits(length0);
+ scalefac[ch].l[4] = br.hgetbits(length0);
+ scalefac[ch].l[5] = br.hgetbits(length0);
+ }
+ if ((si.ch[ch].scfsi[1] == 0) || (gr == 0)) {
+ scalefac[ch].l[6] = br.hgetbits(length0);
+ scalefac[ch].l[7] = br.hgetbits(length0);
+ scalefac[ch].l[8] = br.hgetbits(length0);
+ scalefac[ch].l[9] = br.hgetbits(length0);
+ scalefac[ch].l[10] = br.hgetbits(length0);
+ }
+ if ((si.ch[ch].scfsi[2] == 0) || (gr == 0)) {
+ scalefac[ch].l[11] = br.hgetbits(length1);
+ scalefac[ch].l[12] = br.hgetbits(length1);
+ scalefac[ch].l[13] = br.hgetbits(length1);
+ scalefac[ch].l[14] = br.hgetbits(length1);
+ scalefac[ch].l[15] = br.hgetbits(length1);
+ }
+ if ((si.ch[ch].scfsi[3] == 0) || (gr == 0)) {
+ scalefac[ch].l[16] = br.hgetbits(length1);
+ scalefac[ch].l[17] = br.hgetbits(length1);
+ scalefac[ch].l[18] = br.hgetbits(length1);
+ scalefac[ch].l[19] = br.hgetbits(length1);
+ scalefac[ch].l[20] = br.hgetbits(length1);
+ }
+
+ scalefac[ch].l[21] = 0;
+ scalefac[ch].l[22] = 0;
+ }
+ }
+
+ /**
+ *
+ */
+ // MDM: new_slen is fully initialized before use, no need
+ // to reallocate array.
+ @LOC("NS")
+ private int[] new_slen = new int[4];
+
+ // ssjava
+ @LATTICE("M<THIS,THIS<IN,THIS<C,C*,M*,THISLOC=THIS,GLOBALLOC=THIS")
+ private void get_LSF_scale_data(@LOC("THIS,LayerIIIDecoder.SF15") Header header,
+ @LOC("THIS,LayerIIIDecoder.SF15") int ch, @LOC("THIS,LayerIIIDecoder.SF15") int gr) {
+
+ @LOC("THIS,LayerIIIDecoder.SI0") int mode_ext = header.mode_extension();
+ // @LOC("THIS,LayerIIIDecoder.GLSFD1") gr_info_s gr_info =
+ // (si.ch[ch].gr[gr]); // remove alias
+
+ @LOC("THIS,LayerIIIDecoder.SI,LayerIIIDecoder$III_side_info_t.CH,LayerIIIDecoder$temporaire.GR,LayerIIIDecoder$gr_info_s.V") int scalefac_comp =
+ si.ch[ch].gr[gr].scalefac_compress;
+ @LOC("THIS,LayerIIIDecoder.NS") int blocktypenumber;
+
+ @LOC("THIS,LayerIIIDecoder.SI,LayerIIIDecoder$III_side_info_t.CH,LayerIIIDecoder$temporaire.GR,LayerIIIDecoder$gr_info_s.V") int int_scalefac_comp;
+ @LOC("THIS,LayerIIIDecoder.SFB_SH") int m;
+ @LOC("THIS,LayerIIIDecoder.SI,LayerIIIDecoder$III_side_info_t.CH,LayerIIIDecoder$temporaire.GR,LayerIIIDecoder$gr_info_s.V") int blocknumber =
+ 0;
+
+ if (si.ch[ch].gr[gr].block_type == 2) {
+ if (si.ch[ch].gr[gr].mixed_block_flag == 0) {
+ blocktypenumber = 1;
+ } else if (si.ch[ch].gr[gr].mixed_block_flag == 1) {
+ blocktypenumber = 2;
+ } else {
+ blocktypenumber = 0;
+ }
+ } else {
+ blocktypenumber = 0;
+ }
+
+ if (!(((mode_ext == 1) || (mode_ext == 3)) && (ch == 1))) {
+
+ if (scalefac_comp < 400) {
+
+ new_slen[0] = (scalefac_comp >>> 4) / 5;
+ new_slen[1] = (scalefac_comp >>> 4) % 5;
+ new_slen[2] = (scalefac_comp & 0xF) >>> 2;
+ new_slen[3] = (scalefac_comp & 3);
+ si.ch[ch].gr[gr].preflag = 0;
+ blocknumber = 0;
+
+ } else if (scalefac_comp < 500) {
+
+ new_slen[0] = ((scalefac_comp - 400) >>> 2) / 5;
+ new_slen[1] = ((scalefac_comp - 400) >>> 2) % 5;
+ new_slen[2] = (scalefac_comp - 400) & 3;
+ new_slen[3] = 0;
+ si.ch[ch].gr[gr].preflag = 0;
+ blocknumber = 1;
+
+ } else if (scalefac_comp < 512) {
+
+ new_slen[0] = (scalefac_comp - 500) / 3;
+ new_slen[1] = (scalefac_comp - 500) % 3;
+ new_slen[2] = 0;
+ new_slen[3] = 0;
+ si.ch[ch].gr[gr].preflag = 1;
+ blocknumber = 2;
+ }
+ }
+
+ if ((((mode_ext == 1) || (mode_ext == 3)) && (ch == 1))) {
+ int_scalefac_comp = scalefac_comp >>> 1;
+
+ if (int_scalefac_comp < 180) {
+ new_slen[0] = int_scalefac_comp / 36;
+ new_slen[1] = (int_scalefac_comp % 36) / 6;
+ new_slen[2] = (int_scalefac_comp % 36) % 6;
+ new_slen[3] = 0;
+ si.ch[ch].gr[gr].preflag = 0;
+ blocknumber = 3;
+ } else if (int_scalefac_comp < 244) {
+ new_slen[0] = ((int_scalefac_comp - 180) & 0x3F) >>> 4;
+ new_slen[1] = ((int_scalefac_comp - 180) & 0xF) >>> 2;
+ new_slen[2] = (int_scalefac_comp - 180) & 3;
+ new_slen[3] = 0;
+ si.ch[ch].gr[gr].preflag = 0;
+ blocknumber = 4;
+ } else if (int_scalefac_comp < 255) {
+ new_slen[0] = (int_scalefac_comp - 244) / 3;
+ new_slen[1] = (int_scalefac_comp - 244) % 3;
+ new_slen[2] = 0;
+ new_slen[3] = 0;
+ si.ch[ch].gr[gr].preflag = 0;
+ blocknumber = 5;
+ }
+ }
+
+ // for (@LOC("THIS,LayerIIIDecoder.NS") int x = 0; x < 45; x++)
+ // // why 45, not 54?
+ // scalefac_buffer[x] = 0;
+
+ m = 0;
+ for (@LOC("THIS,LayerIIIDecoder.NS") int i = 0; i < 4; i++) {
+ @LOC("THIS,LayerIIIDecoder.NS") int jmax = nr_of_sfb_block[blocknumber][blocktypenumber][i];
+ for (@LOC("THIS,LayerIIIDecoder.NS") int j = 0; j < jmax; j++) {
+ scalefac_buffer[m] = (new_slen[i] == 0) ? 0 : br.hgetbits(new_slen[i]);
+ m++;
+
+ } // for (unint32 j ...
+ } // for (uint32 i ...
+ }
+
+ /**
+ *
+ */
+ @LATTICE("THIS<IN,THISLOC=THIS,GLOBALLOC=IN")
+ private void get_LSF_scale_factors(@LOC("THIS,LayerIIIDecoder.SF1") Header header,
+ @LOC("THIS,LayerIIIDecoder.SF1") int ch, @LOC("THIS,LayerIIIDecoder.SF1") int gr) {
+
+ @LOC("THIS,LayerIIIDecoder.SFB_SH") int sfb;
+ @LOC("THIS,LayerIIIDecoder.SFB_SH") int m = 0;
+ @LOC("THIS,LayerIIIDecoder.SFB_SH") int window;
+ // gr_info_s gr_info = (si.ch[ch].gr[gr]); // remove alias
+
+ get_LSF_scale_data(header, ch, gr);
+
+ if ((si.ch[ch].gr[gr].window_switching_flag != 0) && (si.ch[ch].gr[gr].block_type == 2)) {
+ if (si.ch[ch].gr[gr].mixed_block_flag != 0) { // MIXED
+ for (sfb = 0; sfb < 8; sfb++) {
+ scalefac[ch].l[sfb] = scalefac_buffer[m];
+ m++;
+ }
+ for (sfb = 3; sfb < 12; sfb++) {
+ for (window = 0; window < 3; window++) {
+ scalefac[ch].s[window][sfb] = scalefac_buffer[m];
+ m++;
+ }
+ }
+ for (window = 0; window < 3; window++)
+ scalefac[ch].s[window][12] = 0;
+
+ } else { // SHORT
+
+ for (sfb = 0; sfb < 12; sfb++) {
+ for (window = 0; window < 3; window++) {
+ scalefac[ch].s[window][sfb] = scalefac_buffer[m];
+ m++;
+ }
+ }
+
+ for (window = 0; window < 3; window++)
+ scalefac[ch].s[window][12] = 0;
+ }
+ } else { // LONG types 0,1,3
+
+ for (sfb = 0; sfb < 21; sfb++) {
+ scalefac[ch].l[sfb] = scalefac_buffer[m];
+ m++;
+ }
+ scalefac[ch].l[21] = 0; // Jeff
+ scalefac[ch].l[22] = 0;
+ }
+ }
+
+ /**
+ *
+ */
+ // @LOC("SI1")
+ // int[] x = { 0 };
+ // @LOC("SI1")
+ // int[] y = { 0 };
+ // @LOC("SI1")
+ // int[] v = { 0 };
+ // @LOC("SI1")
+ // int[] w = { 0 };
+ // @LOC("SI1")
+ // int x[] = { 0 };
+ // @LOC("SI1")
+ // int y[] = { 0 };
+ // @LOC("SI1")
+ // int v[] = { 0 };
+ // @LOC("SI1")
+ // int w[] = { 0 };
+
+ @LATTICE("VAR<OUT,OUT<THIS,THIS<RE,THISLOC=THIS,GLOBALLOC=OUT,RETURNLOC=OUT")
+ private void huffman_decode(@LOC("THIS,LayerIIIDecoder.BR,BitReserve.BIT") int part2_start_local,
+ @LOC("THIS,LayerIIIDecoder.CH0") int ch, @LOC("THIS,LayerIIIDecoder.CH0") int gr) {
+
+ @LOC("RE") int x[] = new int[1];
+ @LOC("RE") int y[] = new int[1];
+ @LOC("RE") int v[] = new int[1];
+ @LOC("RE") int w[] = new int[1];
+
+ @LOC("THIS,LayerIIIDecoder.BR,BitReserve.BIT") int part2_3_end =
+ part2_start_local + si.ch[ch].gr[gr].part2_3_length;
+ @LOC("THIS,LayerIIIDecoder.BR,BitReserve.BIT") int num_bits;
+ @LOC("THIS,LayerIIIDecoder.SI1") int region1Start;
+ @LOC("THIS,LayerIIIDecoder.SI1") int region2Start;
+ @LOC("THIS,LayerIIIDecoder.BR,BitReserve.BIT") int index;
+
+ @LOC("THIS,LayerIIIDecoder.SI1") int buf;
+ @LOC("THIS,LayerIIIDecoder.SI1") int buf1;
+
+ // Find region boundary for short block case
+
+ if (((si.ch[ch].gr[gr].window_switching_flag) != 0) && (si.ch[ch].gr[gr].block_type == 2)) {
+
+ // Region2.
+ // MS: Extrahandling for 8KHZ
+ region1Start = (sfreq == 8) ? 72 : 36; // sfb[9/3]*3=36 or in case
+ // 8KHZ = 72
+ region2Start = 576; // No Region2 for short block case
+
+ } else { // Find region boundary for long block case
+
+ buf = si.ch[ch].gr[gr].region0_count + 1;
+ buf1 = buf + si.ch[ch].gr[gr].region1_count + 1;
+
+ if (buf1 > sfBandIndex[sfreq].l.length - 1)
+ buf1 = sfBandIndex[sfreq].l.length - 1;
+
+ region1Start = sfBandIndex[sfreq].l[buf];
+ region2Start = sfBandIndex[sfreq].l[buf1]; /* MI */
+ }
+
+ index = 0;
+ // Read bigvalues area
+ TERMINATE: for (@LOC("THIS,LayerIIIDecoder.BR,BitReserve.BIT") int i = 0; i < (si.ch[ch].gr[gr].big_values << 1); i +=
+ 2) {
+
+ @LOC("THIS,LayerIIIDecoder.SI2") int htIdx;
+ if (i < region1Start) {
+ htIdx = si.ch[ch].gr[gr].table_select[0];
+ // h = huffcodetab.ht[si.ch[ch].gr[gr].table_select[0]];
+ } else if (i < region2Start) {
+ htIdx = si.ch[ch].gr[gr].table_select[1];
+ // h = huffcodetab.ht[si.ch[ch].gr[gr].table_select[1]];
+ } else {
+ htIdx = si.ch[ch].gr[gr].table_select[2];
+ // h = huffcodetab.ht[si.ch[ch].gr[gr].table_select[2]];
+ }
+
+ huffcodetab.huffman_decoder(htIdx, x, y, v, w, br);
+ // if (index >= is_1d.length)
+ // System.out.println("i0="+i+"/"+(si.ch[ch].gr[gr].big_values<<1)+" Index="+index+" is_1d="+is_1d.length);
+
+ is_1d[index++] = x[0];
+ is_1d[index++] = y[0];
+
+ CheckSumHuff = CheckSumHuff + x[0] + y[0];
+ // System.out.println("x = " + x[0] + " y = " + y[0]);
+ }
+
+ // Read count1 area
+
+ @LOC("THIS,LayerIIIDecoder.SI2") int htIdx = si.ch[ch].gr[gr].count1table_select + 32;
+ // h = huffcodetab.ht[si.ch[ch].gr[gr].count1table_select + 32];
+ num_bits = br.hsstell();
+
+ TERMINATE: while ((num_bits < part2_3_end) && (index < 576)) {
+
+ huffcodetab.huffman_decoder(htIdx, x, y, v, w, br);
+
+ is_1d[index++] = v[0];
+ is_1d[index++] = w[0];
+ is_1d[index++] = x[0];
+ is_1d[index++] = y[0];
+ CheckSumHuff = CheckSumHuff + v[0] + w[0] + x[0] + y[0];
+ // System.out.println("v = "+v[0]+" w = "+w[0]);
+ // System.out.println("x = "+x[0]+" y = "+y[0]);
+ num_bits = br.hsstell();
+ }
+
+ if (num_bits > part2_3_end) {
+ br.rewindNbits(num_bits - part2_3_end);
+ index -= 4;
+ }
+
+ num_bits = br.hsstell();
+
+ // Dismiss stuffing bits
+ if (num_bits < part2_3_end)
+ br.hgetbits(part2_3_end - num_bits);
+
+ // Zero out rest
+
+ if (index < 576)
+ nonzero[ch] = index;
+ else
+ nonzero[ch] = 576;
+
+ if (index < 0)
+ index = 0;
+
+ // may not be necessary
+ for (; index < 576; index++)
+ is_1d[index] = 0;
+ }
+
+ @LATTICE("THIS,IN,THISLOC=THIS,RETURNLOC=THIS")
+ private int huffcodetab_huffman_decoder(@LOC("IN") int h) {
+ // TODO need to move huffmancodetab implementation here
+ return 0;
+ }
+
+ /**
+ *
+ */
+ private void i_stereo_k_values(@LOC("THIS,LayerIIIDecoder.LR") int is_pos,
+ @LOC("THIS,LayerIIIDecoder.LR") int io_type, @LOC("THIS,LayerIIIDecoder.LR") int i) {
+ if (is_pos == 0) {
+ k[0][i] = 1.0f;
+ k[1][i] = 1.0f;
+ } else if ((is_pos & 1) != 0) {
+ k[0][i] = io[io_type][(is_pos + 1) >>> 1];
+ k[1][i] = 1.0f;
+ } else {
+ k[0][i] = 1.0f;
+ k[1][i] = io[io_type][is_pos >>> 1];
+ }
+ }
+
+ /**
+ *
+ */
+ // @LATTICE("OUT<QUO,QUO<REST,REST<IDX,IDX<VAR,VAR<CB,CB<J,CB<GR,GR<IN,J<IN,QUO*,REST*,IDX*,CB*,J*,THISLOC=IN,GLOBALLOC=IN")
+ @LATTICE("THIS,THISLOC=THIS,GLOBALLOC=THIS")
+ // ssjava
+ private void dequantize_sample(
+ /* @LOC("OUT") float xr[][], */@LOC("THIS,LayerIIIDecoder.SI") int ch,
+ @LOC("THIS,LayerIIIDecoder.SI") int gr) {
+
+ // @LOC("GR") gr_info_s gr_info = (si.ch[ch].gr[gr]); remove alias!
+ @LOC("THIS,LayerIIIDecoder.SI1") int cb = 0;
+
+ @LOC("THIS,LayerIIIDecoder.SI1") int next_cb_boundary;
+ @LOC("THIS,LayerIIIDecoder.SI1") int cb_begin = 0;
+ @LOC("THIS,LayerIIIDecoder.SI1") int cb_width = 0;
+ @LOC("THIS,LayerIIIDecoder.SI1") float g_gain;
+
+ @LOC("THIS,LayerIIIDecoder.SI1") int index = 0;
+ @LOC("THIS,LayerIIIDecoder.SI1") int t_index;
+ @LOC("THIS,LayerIIIDecoder.NZ") int j;
+
+ // float[][] xr_1d = xr;//substituted xr for instances of xr_1d to decrease
+ // number of areas
+
+ // choose correct scalefactor band per block type, initalize boundary
+
+ if ((si.ch[ch].gr[gr].window_switching_flag != 0) && (si.ch[ch].gr[gr].block_type == 2)) {
+ if (si.ch[ch].gr[gr].mixed_block_flag != 0)
+ next_cb_boundary = sfBandIndex[sfreq].l[1]; // LONG blocks: 0,1,3
+ else {
+ cb_width = sfBandIndex[sfreq].s[1];
+ next_cb_boundary = (cb_width << 2) - cb_width;
+ cb_begin = 0;
+ }
+ } else {
+ next_cb_boundary = sfBandIndex[sfreq].l[1]; // LONG blocks: 0,1,3
+ }
+
+ // Compute overall (global) scaling.
+
+ g_gain = (float) Math.pow(2.0, (0.25 * (si.ch[ch].gr[gr].global_gain - 210.0)));
+
+ for (j = 0; j < nonzero[ch]; j++) {
+ // Modif E.B 02/22/99
+ @LOC("THIS,LayerIIIDecoder.NZ") int reste = j % SSLIMIT;
+ @LOC("THIS,LayerIIIDecoder.NZ") int quotien = (int) ((j - reste) / SSLIMIT);
+ if (is_1d[j] == 0) {
+ ro[ch][quotien][reste] = 0.0f;
+ } else {
+ @LOC("THIS,LayerIIIDecoder.IS1D") int abv = is_1d[j];
+ // Pow Array fix (11/17/04)
+ if (abv < t_43.length) {
+ if (is_1d[j] > 0)
+ ro[ch][quotien][reste] = g_gain * t_43[abv];
+ else {
+ if (-abv < t_43.length)
+ ro[ch][quotien][reste] = -g_gain * t_43[-abv];
+ else
+ ro[ch][quotien][reste] = -g_gain * (float) Math.pow(-abv, d43);
+ }
+ } else {
+ if (is_1d[j] > 0)
+ ro[ch][quotien][reste] = g_gain * (float) Math.pow(abv, d43);
+ else
+ ro[ch][quotien][reste] = -g_gain * (float) Math.pow(-abv, d43);
+ }
+ }
+ }
+
+ // apply formula per block type
+ for (j = 0; j < nonzero[ch]; j++) {
+ // Modif E.B 02/22/99
+ @LOC("THIS,LayerIIIDecoder.NZ") int reste = j % SSLIMIT;
+ @LOC("THIS,LayerIIIDecoder.NZ") int quotien = (int) ((j - reste) / SSLIMIT);
+
+ if (index == next_cb_boundary) { /* Adjust critical band boundary */
+ if ((si.ch[ch].gr[gr].window_switching_flag != 0) && (si.ch[ch].gr[gr].block_type == 2)) {
+ if (si.ch[ch].gr[gr].mixed_block_flag != 0) {
+
+ if (index == sfBandIndex[sfreq].l[8]) {
+ next_cb_boundary = sfBandIndex[sfreq].s[4];
+ next_cb_boundary = (next_cb_boundary << 2) - next_cb_boundary;
+ cb = 3;
+ cb_width = sfBandIndex[sfreq].s[4] - sfBandIndex[sfreq].s[3];
+
+ cb_begin = sfBandIndex[sfreq].s[3];
+ cb_begin = (cb_begin << 2) - cb_begin;
+
+ } else if (index < sfBandIndex[sfreq].l[8]) {
+
+ next_cb_boundary = sfBandIndex[sfreq].l[(++cb) + 1];
+
+ } else {
+
+ next_cb_boundary = sfBandIndex[sfreq].s[(++cb) + 1];
+ next_cb_boundary = (next_cb_boundary << 2) - next_cb_boundary;
+
+ cb_begin = sfBandIndex[sfreq].s[cb];
+ cb_width = sfBandIndex[sfreq].s[cb + 1] - cb_begin;
+ cb_begin = (cb_begin << 2) - cb_begin;
+ }
+
+ } else {
+
+ next_cb_boundary = sfBandIndex[sfreq].s[(++cb) + 1];
+ next_cb_boundary = (next_cb_boundary << 2) - next_cb_boundary;
+
+ cb_begin = sfBandIndex[sfreq].s[cb];
+ cb_width = sfBandIndex[sfreq].s[cb + 1] - cb_begin;
+ cb_begin = (cb_begin << 2) - cb_begin;
+ }
+
+ } else { // long blocks
+
+ next_cb_boundary = sfBandIndex[sfreq].l[(++cb) + 1];
+
+ }
+ }
+
+ // Do long/short dependent scaling operations
+
+ if ((si.ch[ch].gr[gr].window_switching_flag != 0)
+ && (((si.ch[ch].gr[gr].block_type == 2) && (si.ch[ch].gr[gr].mixed_block_flag == 0)) || ((si.ch[ch].gr[gr].block_type == 2)
+ && (si.ch[ch].gr[gr].mixed_block_flag != 0) && (j >= 36)))) {
+
+ t_index = (index - cb_begin) / cb_width;
+ /*
+ * xr[sb][ss] *= pow(2.0, ((-2.0 * gr_info.subblock_gain[t_index]) -(0.5
+ * * (1.0 + gr_info.scalefac_scale) scalefac[ch].s[t_index][cb])));
+ */
+ @LOC("THIS,LayerIIIDecoder.SI1") int idx =
+ scalefac[ch].s[t_index][cb] << si.ch[ch].gr[gr].scalefac_scale;
+ idx += (si.ch[ch].gr[gr].subblock_gain[t_index] << 2);
+
+ ro[ch][quotien][reste] *= two_to_negative_half_pow[idx];
+
+ } else { // LONG block types 0,1,3 & 1st 2 subbands of switched blocks
+ /*
+ * xr[sb][ss] *= pow(2.0, -0.5 * (1.0+gr_info.scalefac_scale)
+ * (scalefac[ch].l[cb] + gr_info.preflag * pretab[cb]));
+ */
+ @LOC("THIS,LayerIIIDecoder.SI1") int idx = scalefac[ch].l[cb];
+
+ if (si.ch[ch].gr[gr].preflag != 0)
+ idx += pretab[cb];
+
+ idx = idx << si.ch[ch].gr[gr].scalefac_scale;
+ ro[ch][quotien][reste] *= two_to_negative_half_pow[idx];
+ }
+ index++;
+ }
+
+ for (j = nonzero[ch]; j < 576; j++) {
+ // Modif E.B 02/22/99
+ @LOC("THIS,LayerIIIDecoder.NZ") int reste = j % SSLIMIT;
+ @LOC("THIS,LayerIIIDecoder.NZ") int quotien = (int) ((j - reste) / SSLIMIT);
+ if (reste < 0)
+ reste = 0;
+ if (quotien < 0)
+ quotien = 0;
+ ro[ch][quotien][reste] = 0.0f;
+ }
+
+ return;
+ }
+
+ /**
+ *
+ */
+ // ssjava
+ // @LATTICE("THIS<I,I<GR,GR<IN,I*,THISLOC=THIS,GLOBALLOC=IN")
+ @LATTICE("THIS,THISLOC=THIS,GLOBALLOC=THIS")
+ private void reorder(/* @LOC("IN") float xr[][], */@LOC("THIS,LayerIIIDecoder.CH0") int ch,
+ @LOC("THIS,LayerIIIDecoder.CH0") int gr) {
+ // the purpose of reordering: move 'short samples' back to their original
+ // position
+ // after reorder, the samples are no long ordered by frequency
+
+ // the format of input data to reorder:
+ // three small chunks of 192 samples each are combined to 576 samples
+ // ordered by frequency
+
+ // gr_info_s gr_info = (si.ch[ch].gr[gr]); //remove alias
+
+ @LOC("THIS,LayerIIIDecoder.SI1") int index;
+
+ @LOC("THIS,LayerIIIDecoder.SI1") int freq;
+ @LOC("THIS,LayerIIIDecoder.SI1") int freq3;
+ @LOC("THIS,LayerIIIDecoder.SI1") int sfb;
+ @LOC("THIS,LayerIIIDecoder.SI1") int sfb_start;
+ @LOC("THIS,LayerIIIDecoder.SI1") int sfb_lines;
+ @LOC("THIS,LayerIIIDecoder.SI1") int src_line;
+ @LOC("THIS,LayerIIIDecoder.SI1") int des_line;
+ // float[][] xr_1d = xr; subbed in xr for xr_1d so as not to create extra
+ // areas
+
+ if ((si.ch[ch].gr[gr].window_switching_flag != 0) && (si.ch[ch].gr[gr].block_type == 2)) {
+
+ // for (index = 0; index < 576; index++) {
+ // inter[index] = 0.0f;
+ // }
+
+ if (si.ch[ch].gr[gr].mixed_block_flag != 0) {
+ // NO REORDER FOR LOW 2 SUBBANDS
+ for (index = 0; index < 36; index++) {
+ // Modif E.B 02/22/99
+ @LOC("THIS,LayerIIIDecoder.SI1") int reste = index % SSLIMIT;
+ @LOC("THIS,LayerIIIDecoder.SI1") int quotien = (int) ((index - reste) / SSLIMIT);
+ inter[index] = lr[ch][quotien][reste];
+ }
+ // REORDERING FOR REST SWITCHED SHORT
+ /*
+ * for( sfb=3,sfb_start=sfBandIndex[sfreq].s[3],
+ * sfb_lines=sfBandIndex[sfreq].s[4] - sfb_start; sfb < 13;
+ * sfb++,sfb_start = sfBandIndex[sfreq].s[sfb], sfb_lines =
+ * sfBandIndex[sfreq].s[sfb+1] - sfb_start ) {
+ */
+ for (sfb = 3; sfb < 13; sfb++) {
+ // System.out.println("sfreq="+sfreq+" sfb="+sfb+" sfBandIndex="+sfBandIndex.length+" sfBandIndex[sfreq].s="+sfBandIndex[sfreq].s.length);
+ sfb_start = sfBandIndex[sfreq].s[sfb];
+ sfb_lines = sfBandIndex[sfreq].s[sfb + 1] - sfb_start;
+
+ @LOC("THIS,LayerIIIDecoder.SI1") int sfb_start3 = (sfb_start << 2) - sfb_start;
+
+ for (freq = 0, freq3 = 0; freq < sfb_lines; freq++, freq3 += 3) {
+
+ src_line = sfb_start3 + freq;
+ des_line = sfb_start3 + freq3;
+ // Modif E.B 02/22/99
+ @LOC("THIS,LayerIIIDecoder.SI1") int reste = src_line % SSLIMIT;
+ @LOC("THIS,LayerIIIDecoder.SI1") int quotien = (int) ((src_line - reste) / SSLIMIT);
+
+ inter[des_line] = lr[ch][quotien][reste];
+ src_line += sfb_lines;
+ des_line++;
+
+ reste = src_line % SSLIMIT;
+ quotien = (int) ((src_line - reste) / SSLIMIT);
+
+ inter[des_line] = lr[ch][quotien][reste];
+ src_line += sfb_lines;
+ des_line++;
+
+ reste = src_line % SSLIMIT;
+ quotien = (int) ((src_line - reste) / SSLIMIT);
+
+ inter[des_line] = lr[ch][quotien][reste];
+ }
+ }
+
+ } else { // pure short
+ for (index = 0; index < 576; index++) {
+ @LOC("THIS,LayerIIIDecoder.SI1") int j = reorder_table[sfreq][index];
+ @LOC("THIS,LayerIIIDecoder.SI1") int reste = j % SSLIMIT;
+ @LOC("THIS,LayerIIIDecoder.SI1") int quotien = (int) ((j - reste) / SSLIMIT);
+ inter[index] = lr[ch][quotien][reste];
+ }
+ }
+ } else { // long blocks
+ for (index = 0; index < 576; index++) {
+ // Modif E.B 02/22/99
+ @LOC("THIS,LayerIIIDecoder.SI1") int reste = index % SSLIMIT;
+ @LOC("THIS,LayerIIIDecoder.SI1") int quotien = (int) ((index - reste) / SSLIMIT);
+ inter[index] = lr[ch][quotien][reste];
+ }
+ }
+ }
+
+ /**
+ *
+ */
+
+ @LOC("ISP")
+ int[] is_pos = new int[576];
+ @LOC("ISR")
+ float[] is_ratio = new float[576];
+
+ // ssjava
+ @LATTICE("IO<THIS,THIS<IN,THISLOC=THIS,GLOBALLOC=IN")
+ private void stereo(@LOC("THIS,LayerIIIDecoder.HD1") Header header,
+ @LOC("THIS,LayerIIIDecoder.CH0") int gr) {
+ @LOC("THIS,LayerIIIDecoder.RO1") int sb;
+ @LOC("THIS,LayerIIIDecoder.RO1") int ss;
+
+ if (channels == 1) { // mono , bypass xr[0][][] to lr[0][][]
+
+ for (sb = 0; sb < SBLIMIT; sb++)
+ for (ss = 0; ss < SSLIMIT; ss += 3) {
+ lr[0][sb][ss] = ro[0][sb][ss];
+ lr[0][sb][ss + 1] = ro[0][sb][ss + 1];
+ lr[0][sb][ss + 2] = ro[0][sb][ss + 2];
+ }
+
+ } else {
+
+ // gr_info_s gr_info = (si.ch[0].gr[gr]); remove alias
+ @LOC("THIS,LayerIIIDecoder.SF1") int mode_ext = header.mode_extension();
+
+ @LOC("THIS,LayerIIIDecoder.RO1") int sfb;
+ @LOC("THIS,LayerIIIDecoder.RO1") int i;
+ @LOC("THIS,LayerIIIDecoder.RO1") int lines;
+ @LOC("THIS,LayerIIIDecoder.RO1") int temp;
+ @LOC("THIS,LayerIIIDecoder.RO1") int temp2;
+
+ @LOC("THIS,LayerIIIDecoder.SF15") boolean ms_stereo =
+ ((header.mode() == Header.JOINT_STEREO) && ((mode_ext & 0x2) != 0));
+ @LOC("THIS,LayerIIIDecoder.SF15") boolean i_stereo =
+ ((header.mode() == Header.JOINT_STEREO) && ((mode_ext & 0x1) != 0));
+ @LOC("THIS,LayerIIIDecoder.SF15") boolean lsf =
+ ((header.version() == Header.MPEG2_LSF || header.version() == Header.MPEG25_LSF)); // SZD
+
+ @LOC("THIS,LayerIIIDecoder.LR") int io_type = (si.ch[0].gr[gr].scalefac_compress & 1);
+
+ // initialization
+ // for (i = 0; i < 576; i++) {
+ // is_pos[i] = 7;
+ // is_ratio[i] = 0.0f;
+ // }
+
+ if (i_stereo) {
+ if ((si.ch[0].gr[gr].window_switching_flag != 0) && (si.ch[0].gr[gr].block_type == 2)) {
+ if (si.ch[0].gr[gr].mixed_block_flag != 0) {
+
+ @LOC("THIS,LayerIIIDecoder.RO1") int max_sfb = 0;
+
+ for (@LOC("THIS,LayerIIIDecoder.RO1") int j = 0; j < 3; j++) {
+ @LOC("THIS,LayerIIIDecoder.RO1") int sfbcnt;
+ sfbcnt = 2;
+ TERMINATE: for (sfb = 12; sfb >= 3; sfb--) {
+ i = sfBandIndex[sfreq].s[sfb];
+ lines = sfBandIndex[sfreq].s[sfb + 1] - i;
+ i = (i << 2) - i + (j + 1) * lines - 1;
+ TERMINATE: while (lines > 0) {
+ if (ro[1][i / 18][i % 18] != 0.0f) {
+ // MDM: in java, array access is very slow.
+ // Is quicker to compute div and mod values.
+ // if (ro[1][ss_div[i]][ss_mod[i]] != 0.0f) {
+ sfbcnt = sfb;
+ sfb = -10;
+ lines = -10;
+ }
+
+ lines--;
+ i--;
+
+ } // while (lines > 0)
+
+ } // for (sfb=12 ...
+ sfb = sfbcnt + 1;
+
+ if (sfb > max_sfb)
+ max_sfb = sfb;
+
+ while (sfb < 12) {
+ temp = sfBandIndex[sfreq].s[sfb];
+ sb = sfBandIndex[sfreq].s[sfb + 1] - temp;
+ i = (temp << 2) - temp + j * sb;
+
+ TERMINATE: for (; sb > 0; sb--) {
+ is_pos[i] = scalefac[1].s[j][sfb];
+ if (is_pos[i] != 7)
+ if (lsf)
+ i_stereo_k_values(is_pos[i], io_type, i);
+ else
+ is_ratio[i] = TAN12[is_pos[i]];
+
+ i++;
+ } // for (; sb>0...
+ sfb++;
+ } // while (sfb < 12)
+ sfb = sfBandIndex[sfreq].s[10];
+ sb = sfBandIndex[sfreq].s[11] - sfb;
+ sfb = (sfb << 2) - sfb + j * sb;
+ temp = sfBandIndex[sfreq].s[11];
+ sb = sfBandIndex[sfreq].s[12] - temp;
+ i = (temp << 2) - temp + j * sb;
+ TERMINATE: for (; sb > 0; sb--) {
+ is_pos[i] = is_pos[sfb];
+
+ if (lsf) {
+ k[0][i] = k[0][sfb];
+ k[1][i] = k[1][sfb];
+ } else {
+ is_ratio[i] = is_ratio[sfb];
+ }
+ i++;
+ } // for (; sb > 0 ...
+ }
+ if (max_sfb <= 3) {
+ i = 2;
+ ss = 17;
+ sb = -1;
+ TERMINATE: while (i >= 0) {
+ if (ro[1][i][ss] != 0.0f) {
+ sb = (i << 4) + (i << 1) + ss;
+ i = -1;
+ } else {
+ ss--;
+ if (ss < 0) {
+ i--;
+ ss = 17;
+ }
+ } // if (ro ...
+ } // while (i>=0)
+ i = 0;
+ while (sfBandIndex[sfreq].l[i] <= sb)
+ i++;
+ sfb = i;
+ i = sfBandIndex[sfreq].l[i];
+ for (; sfb < 8; sfb++) {
+ sb = sfBandIndex[sfreq].l[sfb + 1] - sfBandIndex[sfreq].l[sfb];
+ TERMINATE: for (; sb > 0; sb--) {
+ is_pos[i] = scalefac[1].l[sfb];
+ if (is_pos[i] != 7)
+ if (lsf)
+ i_stereo_k_values(is_pos[i], io_type, i);
+ else
+ is_ratio[i] = TAN12[is_pos[i]];
+ i++;
+ } // for (; sb>0 ...
+ } // for (; sfb<8 ...
+ } // for (j=0 ...
+ } else { // if (gr_info.mixed_block_flag)
+ for (@LOC("THIS,LayerIIIDecoder.RO1") int j = 0; j < 3; j++) {
+ @LOC("THIS,LayerIIIDecoder.RO1") int sfbcnt;
+ sfbcnt = -1;
+ TERMINATE: for (sfb = 12; sfb >= 0; sfb--) {
+ temp = sfBandIndex[sfreq].s[sfb];
+ lines = sfBandIndex[sfreq].s[sfb + 1] - temp;
+ i = (temp << 2) - temp + (j + 1) * lines - 1;
+ TERMINATE: while (lines > 0) {
+ if (ro[1][i / 18][i % 18] != 0.0f) {
+ // MDM: in java, array access is very slow.
+ // Is quicker to compute div and mod values.
+ // if (ro[1][ss_div[i]][ss_mod[i]] != 0.0f) {
+ sfbcnt = sfb;
+ sfb = -10;
+ lines = -10;
+ }
+ lines--;
+ i--;
+ } // while (lines > 0) */
+
+ } // for (sfb=12 ...
+ sfb = sfbcnt + 1;
+ while (sfb < 12) {
+ temp = sfBandIndex[sfreq].s[sfb];
+ sb = sfBandIndex[sfreq].s[sfb + 1] - temp;
+ i = (temp << 2) - temp + j * sb;
+ TERMINATE: for (; sb > 0; sb--) {
+ is_pos[i] = scalefac[1].s[j][sfb];
+ if (is_pos[i] != 7)
+ if (lsf)
+ i_stereo_k_values(is_pos[i], io_type, i);
+ else
+ is_ratio[i] = TAN12[is_pos[i]];
+ i++;
+ } // for (; sb>0 ...
+ sfb++;
+ } // while (sfb<12)
+
+ temp = sfBandIndex[sfreq].s[10];
+ temp2 = sfBandIndex[sfreq].s[11];
+ sb = temp2 - temp;
+ sfb = (temp << 2) - temp + j * sb;
+ sb = sfBandIndex[sfreq].s[12] - temp2;
+ i = (temp2 << 2) - temp2 + j * sb;
+ TERMINATE: for (; sb > 0; sb--) {
+ is_pos[i] = is_pos[sfb];
+
+ if (lsf) {
+ k[0][i] = k[0][sfb];
+ k[1][i] = k[1][sfb];
+ } else {
+ is_ratio[i] = is_ratio[sfb];
+ }
+ i++;
+ } // for (; sb>0 ...
+ } // for (sfb=12
+ } // for (j=0 ...
+ } else { // if (gr_info.window_switching_flag ...
+ i = 31;
+ ss = 17;
+ sb = 0;
+ TERMINATE: while (i >= 0) {
+ if (ro[1][i][ss] != 0.0f) {
+ sb = (i << 4) + (i << 1) + ss;
+ i = -1;
+ } else {
+ ss--;
+ if (ss < 0) {
+ i--;
+ ss = 17;
+ }
+ }
+ }
+ i = 0;
+ while (sfBandIndex[sfreq].l[i] <= sb)
+ i++;
+
+ sfb = i;
+ i = sfBandIndex[sfreq].l[i];
+ for (; sfb < 21; sfb++) {
+ sb = sfBandIndex[sfreq].l[sfb + 1] - sfBandIndex[sfreq].l[sfb];
+ TERMINATE: for (; sb > 0; sb--) {
+ is_pos[i] = scalefac[1].l[sfb];
+ if (is_pos[i] != 7)
+ if (lsf)
+ i_stereo_k_values(is_pos[i], io_type, i);
+ else
+ is_ratio[i] = TAN12[is_pos[i]];
+ i++;
+ }
+ }
+ sfb = sfBandIndex[sfreq].l[20];
+ TERMINATE: for (sb = 576 - sfBandIndex[sfreq].l[21]; (sb > 0) && (i < 576); sb--) {
+ is_pos[i] = is_pos[sfb]; // error here : i >=576
+
+ if (lsf) {
+ k[0][i] = k[0][sfb];
+ k[1][i] = k[1][sfb];
+ } else {
+ is_ratio[i] = is_ratio[sfb];
+ }
+ i++;
+ } // if (gr_info.mixed_block_flag)
+ } // if (gr_info.window_switching_flag ...
+ } // if (i_stereo)
+
+ i = 0;
+ for (sb = 0; sb < SBLIMIT; sb++)
+ for (ss = 0; ss < SSLIMIT; ss++) {
+ if (is_pos[i] == 7) {
+ if (ms_stereo) {
+ lr[0][sb][ss] = (ro[0][sb][ss] + ro[1][sb][ss]) * 0.707106781f;
+ lr[1][sb][ss] = (ro[0][sb][ss] - ro[1][sb][ss]) * 0.707106781f;
+ } else {
+ lr[0][sb][ss] = ro[0][sb][ss];
+ lr[1][sb][ss] = ro[1][sb][ss];
+ }
+ } else if (i_stereo) {
+
+ if (lsf) {
+ lr[0][sb][ss] = ro[0][sb][ss] * k[0][i];
+ lr[1][sb][ss] = ro[0][sb][ss] * k[1][i];
+ } else {
+ lr[1][sb][ss] = ro[0][sb][ss] / (float) (1 + is_ratio[i]);
+ lr[0][sb][ss] = lr[1][sb][ss] * is_ratio[i];
+ }
+ }
+ /*
+ * else { System.out.println("Error in stereo processing\n"); }
+ */
+ i++;
+ }
+
+ } // channels == 2
+
+ }
+
+ /**
+ *
+ */
+ // @LATTICE("THIS<SRC,SRC<SS,SS<SB18,SB18<SB18LIM,SB18LIM<GR,GR<IN,SB18*,SS*,THISLOC=THIS")
+ @LATTICE("VAR<THIS,THIS<C,C<IN,THISLOC=THIS,C*")
+ private void antialias(@LOC("THIS,LayerIIIDecoder.SI") int ch,
+ @LOC("THIS,LayerIIIDecoder.SI") int gr) {
+
+ @LOC("THIS,LayerIIIDecoder.SI,LayerIIIDecoder$III_side_info_t.CH,LayerIIIDecoder$temporaire.GR2") int sb18;
+ @LOC("THIS,LayerIIIDecoder.SI1") int ss;
+ @LOC("THIS,LayerIIIDecoder.SI,LayerIIIDecoder$III_side_info_t.CH,LayerIIIDecoder$temporaire.GR2") int sb18lim;
+
+ // @LOC("THIS,LayerIIIDecoder.SI,LayerIIIDecoder$III_side_info_t.CH,LayerIIIDecoder$temporaire.GR1")
+ // gr_info_s gr_info =
+ // (si.ch[ch].gr[gr]);
+ // 31 alias-reduction operations between each pair of sub-bands
+ // with 8 butterflies between each pair
+
+ if ((si.ch[ch].gr[gr].window_switching_flag != 0) && (si.ch[ch].gr[gr].block_type == 2)
+ && !(si.ch[ch].gr[gr].mixed_block_flag != 0))
+ return;
+
+ if ((si.ch[ch].gr[gr].window_switching_flag != 0) && (si.ch[ch].gr[gr].mixed_block_flag != 0)
+ && (si.ch[ch].gr[gr].block_type == 2)) {
+ sb18lim = 18;
+ } else {
+ sb18lim = 558;
+ }
+
+ for (sb18 = 0; sb18 < sb18lim; sb18 += 18) {
+ for (ss = 0; ss < 8; ss++) {
+ @LOC("THIS,LayerIIIDecoder.SI1") int src_idx1 = sb18 + 17 - ss;
+ @LOC("THIS,LayerIIIDecoder.SI1") int src_idx2 = sb18 + 18 + ss;
+ @LOC("THIS,LayerIIIDecoder.OUT0") float bu = inter[src_idx1];
+ @LOC("THIS,LayerIIIDecoder.OUT0") float bd = inter[src_idx2];
+ inter[src_idx1] = (bu * cs[ss]) - (bd * ca[ss]);
+ inter[src_idx2] = (bd * cs[ss]) + (bu * ca[ss]);
+ }
+ }
+ }
+
+ /**
+ *
+ */
+
+ // MDM: tsOutCopy and rawout do not need initializing, so the arrays
+ // can be reused.
+ @LOC("TSOUT")
+ float[] tsOutCopy = new float[18];
+ @LOC("RAWOUT")
+ float[] rawout = new float[36];
+
+ @LATTICE("THIS<SB,SB*,THISLOC=THIS")
+ private void hybrid(@LOC("THIS,LayerIIIDecoder.SI") int ch, @LOC("THIS,LayerIIIDecoder.SI") int gr) {
+
+ @LOC("THIS,LayerIIIDecoder.SI1") int bt;
+ @LOC("THIS,LayerIIIDecoder.SI1") int sb18;
+ // gr_info_s gr_info = (si.ch[ch].gr[gr]); //remove alias
+ // @LOC("THIS,LayerIIIDecoder.TS") float[] tsOut; //remove alias
+
+ // float[][] prvblk;
+
+ for (sb18 = 0; sb18 < 576; sb18 += 18) {
+ if ((si.ch[ch].gr[gr].window_switching_flag != 0) && (si.ch[ch].gr[gr].mixed_block_flag != 0)
+ && (sb18 < 36)) {
+ bt = 0;
+ } else {
+ bt = si.ch[ch].gr[gr].block_type;
+ }
+
+ // tsOut = out_1d;
+ // Modif E.B 02/22/99
+ for (@LOC("THIS,LayerIIIDecoder.SI1") int cc = 0; cc < 18; cc++) {
+ // tsOutCopy[cc] = out_1d[cc + sb18];
+ tsOutCopy[cc] = inter[cc + sb18];
+ }
+
+ inv_mdct(bt);
+
+ for (@LOC("THIS,LayerIIIDecoder.SI1") int cc = 0; cc < 18; cc++) {
+ out_1d[cc + sb18] = tsOutCopy[cc];
+ }
+
+ // Fin Modif
+
+ // overlap addition
+ out_1d[0 + sb18] = rawout[0] + prevblck[ch][sb18 + 0];
+ out_1d[1 + sb18] = rawout[1] + prevblck[ch][sb18 + 1];
+ out_1d[2 + sb18] = rawout[2] + prevblck[ch][sb18 + 2];
+ out_1d[3 + sb18] = rawout[3] + prevblck[ch][sb18 + 3];
+ out_1d[4 + sb18] = rawout[4] + prevblck[ch][sb18 + 4];
+ out_1d[5 + sb18] = rawout[5] + prevblck[ch][sb18 + 5];
+ out_1d[6 + sb18] = rawout[6] + prevblck[ch][sb18 + 6];
+ out_1d[7 + sb18] = rawout[7] + prevblck[ch][sb18 + 7];
+ out_1d[8 + sb18] = rawout[8] + prevblck[ch][sb18 + 8];
+ out_1d[9 + sb18] = rawout[9] + prevblck[ch][sb18 + 9];
+ out_1d[10 + sb18] = rawout[10] + prevblck[ch][sb18 + 10];
+ out_1d[11 + sb18] = rawout[11] + prevblck[ch][sb18 + 11];
+ out_1d[12 + sb18] = rawout[12] + prevblck[ch][sb18 + 12];
+ out_1d[13 + sb18] = rawout[13] + prevblck[ch][sb18 + 13];
+ out_1d[14 + sb18] = rawout[14] + prevblck[ch][sb18 + 14];
+ out_1d[15 + sb18] = rawout[15] + prevblck[ch][sb18 + 15];
+ out_1d[16 + sb18] = rawout[16] + prevblck[ch][sb18 + 16];
+ out_1d[17 + sb18] = rawout[17] + prevblck[ch][sb18 + 17];
+ raw_full[ch][sb18 + 0] = rawout[18];
+ raw_full[ch][sb18 + 1] = rawout[19];
+ raw_full[ch][sb18 + 2] = rawout[20];
+ raw_full[ch][sb18 + 3] = rawout[21];
+ raw_full[ch][sb18 + 4] = rawout[22];
+ raw_full[ch][sb18 + 5] = rawout[23];
+ raw_full[ch][sb18 + 6] = rawout[24];
+ raw_full[ch][sb18 + 7] = rawout[25];
+ raw_full[ch][sb18 + 8] = rawout[26];
+ raw_full[ch][sb18 + 9] = rawout[27];
+ raw_full[ch][sb18 + 10] = rawout[28];
+ raw_full[ch][sb18 + 11] = rawout[29];
+ raw_full[ch][sb18 + 12] = rawout[30];
+ raw_full[ch][sb18 + 13] = rawout[31];
+ raw_full[ch][sb18 + 14] = rawout[32];
+ raw_full[ch][sb18 + 15] = rawout[33];
+ raw_full[ch][sb18 + 16] = rawout[34];
+ raw_full[ch][sb18 + 17] = rawout[35];
+
+ // original implementation:
+ // out_1d[0 + sb18] = rawout[0] + prevblck[ch][sb18 + 0];
+ // prevblck[ch][sb18 + 0] = rawout[18];
+ // out_1d[1 + sb18] = rawout[1] + prevblck[ch][sb18 + 1];
+ // prevblck[ch][sb18 + 1] = rawout[19];
+ // out_1d[2 + sb18] = rawout[2] + prevblck[ch][sb18 + 2];
+ // prevblck[ch][sb18 + 2] = rawout[20];
+ // out_1d[3 + sb18] = rawout[3] + prevblck[ch][sb18 + 3];
+ // prevblck[ch][sb18 + 3] = rawout[21];
+ // out_1d[4 + sb18] = rawout[4] + prevblck[ch][sb18 + 4];
+ // prevblck[ch][sb18 + 4] = rawout[22];
+ // out_1d[5 + sb18] = rawout[5] + prevblck[ch][sb18 + 5];
+ // prevblck[ch][sb18 + 5] = rawout[23];
+ // out_1d[6 + sb18] = rawout[6] + prevblck[ch][sb18 + 6];
+ // prevblck[ch][sb18 + 6] = rawout[24];
+ // out_1d[7 + sb18] = rawout[7] + prevblck[ch][sb18 + 7];
+ // prevblck[ch][sb18 + 7] = rawout[25];
+ // out_1d[8 + sb18] = rawout[8] + prevblck[ch][sb18 + 8];
+ // prevblck[ch][sb18 + 8] = rawout[26];
+ // out_1d[9 + sb18] = rawout[9] + prevblck[ch][sb18 + 9];
+ // prevblck[ch][sb18 + 9] = rawout[27];
+ // out_1d[10 + sb18] = rawout[10] + prevblck[ch][sb18 + 10];
+ // prevblck[ch][sb18 + 10] = rawout[28];
+ // out_1d[11 + sb18] = rawout[11] + prevblck[ch][sb18 + 11];
+ // prevblck[ch][sb18 + 11] = rawout[29];
+ // out_1d[12 + sb18] = rawout[12] + prevblck[ch][sb18 + 12];
+ // prevblck[ch][sb18 + 12] = rawout[30];
+ // out_1d[13 + sb18] = rawout[13] + prevblck[ch][sb18 + 13];
+ // prevblck[ch][sb18 + 13] = rawout[31];
+ // out_1d[14 + sb18] = rawout[14] + prevblck[ch][sb18 + 14];
+ // prevblck[ch][sb18 + 14] = rawout[32];
+ // out_1d[15 + sb18] = rawout[15] + prevblck[ch][sb18 + 15];
+ // prevblck[ch][sb18 + 15] = rawout[33];
+ // out_1d[16 + sb18] = rawout[16] + prevblck[ch][sb18 + 16];
+ // prevblck[ch][sb18 + 16] = rawout[34];
+ // out_1d[17 + sb18] = rawout[17] + prevblck[ch][sb18 + 17];
+ // prevblck[ch][sb18 + 17] = rawout[35];
+
+ }
+ }
+
+ /**
+ *
+ */
+ private void do_downmix() {
+ for (@LOC("THIS,LayerIIIDecoder.ISR") int sb = 0; sb < SSLIMIT; sb++) {
+ for (@LOC("THIS,LayerIIIDecoder.ISR") int ss = 0; ss < SSLIMIT; ss += 3) {
+ lr[0][sb][ss] = (lr[0][sb][ss] + lr[1][sb][ss]) * 0.5f;
+ lr[0][sb][ss + 1] = (lr[0][sb][ss + 1] + lr[1][sb][ss + 1]) * 0.5f;
+ lr[0][sb][ss + 2] = (lr[0][sb][ss + 2] + lr[1][sb][ss + 2]) * 0.5f;
+ }
+ }
+ }
+
+ /**
+ * Fast INV_MDCT.
+ */
+ // @LATTICE("OUT<6I,OUT<TMPF,TMPF<EO,EO<TMP,TMP<SUM,TMP<IIP,IIP<I00,I00<SH,SUM<PP,PP<SH,SH<I,I<IN,TMPF*,SH*,I*,6I*,GLOBALLOC=IN,THISLOC=IN")
+ // public void inv_mdct(@LOC("SH") float[] in, @LOC("OUT") float[] out,
+ // @LOC("IN") int block_type) {//remove alias
+ // ssjava
+ @LATTICE("THIS,THISLOC=THIS")
+ public void inv_mdct(@LOC("THIS,LayerIIIDecoder.TSOUT") int block_type) {
+ // float[] win_bt;
+ @LOC("THIS,LayerIIIDecoder.TSOUT") int i;
+
+ @LOC("THIS,LayerIIIDecoder.TSOUT") float tmpf_0;
+ @LOC("THIS,LayerIIIDecoder.TSOUT") float tmpf_1;
+ @LOC("THIS,LayerIIIDecoder.TSOUT") float tmpf_2;
+ @LOC("THIS,LayerIIIDecoder.TSOUT") float tmpf_3;
+ @LOC("THIS,LayerIIIDecoder.TSOUT") float tmpf_4;
+ @LOC("THIS,LayerIIIDecoder.TSOUT") float tmpf_5;
+ @LOC("THIS,LayerIIIDecoder.TSOUT") float tmpf_6;
+ @LOC("THIS,LayerIIIDecoder.TSOUT") float tmpf_7;
+ @LOC("THIS,LayerIIIDecoder.TSOUT") float tmpf_8;
+ @LOC("THIS,LayerIIIDecoder.TSOUT") float tmpf_9;
+ @LOC("THIS,LayerIIIDecoder.TSOUT") float tmpf_10;
+ @LOC("THIS,LayerIIIDecoder.TSOUT") float tmpf_11;
+ @LOC("THIS,LayerIIIDecoder.TSOUT") float tmpf_12;
+ @LOC("THIS,LayerIIIDecoder.TSOUT") float tmpf_13;
+ @LOC("THIS,LayerIIIDecoder.TSOUT") float tmpf_14;
+ @LOC("THIS,LayerIIIDecoder.TSOUT") float tmpf_15;
+ @LOC("THIS,LayerIIIDecoder.TSOUT") float tmpf_16;
+ @LOC("THIS,LayerIIIDecoder.TSOUT") float tmpf_17;
+
+ tmpf_0 =
+ tmpf_1 =
+ tmpf_2 =
+ tmpf_3 =
+ tmpf_4 =
+ tmpf_5 =
+ tmpf_6 =
+ tmpf_7 =
+ tmpf_8 =
+ tmpf_9 =
+ tmpf_10 =
+ tmpf_11 =
+ tmpf_12 =
+ tmpf_13 =
+ tmpf_14 =
+ tmpf_15 = tmpf_16 = tmpf_17 = 0.0f;
+
+ if (block_type == 2) {
+
+ /*
+ *
+ * Under MicrosoftVM 2922, This causes a GPF, or At best, an
+ * ArrayIndexOutOfBoundsExceptin. for(int p=0;p<36;p+=9) { out[p] =
+ * out[p+1] = out[p+2] = out[p+3] = out[p+4] = out[p+5] = out[p+6] =
+ * out[p+7] = out[p+8] = 0.0f; }
+ */
+ rawout[0] = 0.0f;
+ rawout[1] = 0.0f;
+ rawout[2] = 0.0f;
+ rawout[3] = 0.0f;
+ rawout[4] = 0.0f;
+ rawout[5] = 0.0f;
+ rawout[6] = 0.0f;
+ rawout[7] = 0.0f;
+ rawout[8] = 0.0f;
+ rawout[9] = 0.0f;
+ rawout[10] = 0.0f;
+ rawout[11] = 0.0f;
+ rawout[12] = 0.0f;
+ rawout[13] = 0.0f;
+ rawout[14] = 0.0f;
+ rawout[15] = 0.0f;
+ rawout[16] = 0.0f;
+ rawout[17] = 0.0f;
+ rawout[18] = 0.0f;
+ rawout[19] = 0.0f;
+ rawout[20] = 0.0f;
+ rawout[21] = 0.0f;
+ rawout[22] = 0.0f;
+ rawout[23] = 0.0f;
+ rawout[24] = 0.0f;
+ rawout[25] = 0.0f;
+ rawout[26] = 0.0f;
+ rawout[27] = 0.0f;
+ rawout[28] = 0.0f;
+ rawout[29] = 0.0f;
+ rawout[30] = 0.0f;
+ rawout[31] = 0.0f;
+ rawout[32] = 0.0f;
+ rawout[33] = 0.0f;
+ rawout[34] = 0.0f;
+ rawout[35] = 0.0f;
+
+ @LOC("THIS,LayerIIIDecoder.TSOUT") int six_i = 0;
+
+ for (i = 0; i < 3; i++) {
+ // 12 point IMDCT
+ // Begin 12 point IDCT
+ // Input aliasing for 12 pt IDCT
+ tsOutCopy[15 + i] += tsOutCopy[12 + i];
+ tsOutCopy[12 + i] += tsOutCopy[9 + i];
+ tsOutCopy[9 + i] += tsOutCopy[6 + i];
+ tsOutCopy[6 + i] += tsOutCopy[3 + i];
+ tsOutCopy[3 + i] += tsOutCopy[0 + i];
+
+ // Input aliasing on odd indices (for 6 point IDCT)
+ tsOutCopy[15 + i] += tsOutCopy[9 + i];
+ tsOutCopy[9 + i] += tsOutCopy[3 + i];
+
+ // 3 point IDCT on even indices
+ @LOC("THIS,LayerIIIDecoder.TSOUT") float pp1;
+ @LOC("THIS,LayerIIIDecoder.TSOUT") float pp2;
+ @LOC("THIS,LayerIIIDecoder.TSOUT") float sum;
+ pp2 = tsOutCopy[12 + i] * 0.500000000f;
+ pp1 = tsOutCopy[6 + i] * 0.866025403f;
+ sum = tsOutCopy[0 + i] + pp2;
+ tmpf_1 = tsOutCopy[0 + i] - tsOutCopy[12 + i];
+ tmpf_0 = sum + pp1;
+ tmpf_2 = sum - pp1;
+
+ // End 3 point IDCT on even indices
+ // 3 point IDCT on odd indices (for 6 point IDCT)
+ pp2 = tsOutCopy[15 + i] * 0.500000000f;
+ pp1 = tsOutCopy[9 + i] * 0.866025403f;
+ sum = tsOutCopy[3 + i] + pp2;
+ tmpf_4 = tsOutCopy[3 + i] - tsOutCopy[15 + i];
+ tmpf_5 = sum + pp1;
+ tmpf_3 = sum - pp1;
+ // End 3 point IDCT on odd indices
+ // Twiddle factors on odd indices (for 6 point IDCT)
+
+ tmpf_3 *= 1.931851653f;
+ tmpf_4 *= 0.707106781f;
+ tmpf_5 *= 0.517638090f;
+
+ // Output butterflies on 2 3 point IDCT's (for 6 point IDCT)
+ @LOC("THIS,LayerIIIDecoder.TSOUT") float save = tmpf_0;
+ tmpf_0 += tmpf_5;
+ tmpf_5 = save - tmpf_5;
+ save = tmpf_1;
+ tmpf_1 += tmpf_4;
+ tmpf_4 = save - tmpf_4;
+ save = tmpf_2;
+ tmpf_2 += tmpf_3;
+ tmpf_3 = save - tmpf_3;
+
+ // End 6 point IDCT
+ // Twiddle factors on indices (for 12 point IDCT)
+
+ tmpf_0 *= 0.504314480f;
+ tmpf_1 *= 0.541196100f;
+ tmpf_2 *= 0.630236207f;
+ tmpf_3 *= 0.821339815f;
+ tmpf_4 *= 1.306562965f;
+ tmpf_5 *= 3.830648788f;
+
+ // End 12 point IDCT
+
+ // Shift to 12 point modified IDCT, multiply by window type 2
+ tmpf_8 = -tmpf_0 * 0.793353340f;
+ tmpf_9 = -tmpf_0 * 0.608761429f;
+ tmpf_7 = -tmpf_1 * 0.923879532f;
+ tmpf_10 = -tmpf_1 * 0.382683432f;
+ tmpf_6 = -tmpf_2 * 0.991444861f;
+ tmpf_11 = -tmpf_2 * 0.130526192f;
+
+ tmpf_0 = tmpf_3;
+ tmpf_1 = tmpf_4 * 0.382683432f;
+ tmpf_2 = tmpf_5 * 0.608761429f;
+
+ tmpf_3 = -tmpf_5 * 0.793353340f;
+ tmpf_4 = -tmpf_4 * 0.923879532f;
+ tmpf_5 = -tmpf_0 * 0.991444861f;
+
+ tmpf_0 *= 0.130526192f;
+
+ rawout[six_i + 6] += tmpf_0;
+ rawout[six_i + 7] += tmpf_1;
+ rawout[six_i + 8] += tmpf_2;
+ rawout[six_i + 9] += tmpf_3;
+ rawout[six_i + 10] += tmpf_4;
+ rawout[six_i + 11] += tmpf_5;
+ rawout[six_i + 12] += tmpf_6;
+ rawout[six_i + 13] += tmpf_7;
+ rawout[six_i + 14] += tmpf_8;
+ rawout[six_i + 15] += tmpf_9;
+ rawout[six_i + 16] += tmpf_10;
+ rawout[six_i + 17] += tmpf_11;
+
+ six_i += 6;
+ }
+ } else {
+ // 36 point IDCT
+ // input aliasing for 36 point IDCT
+ tsOutCopy[17] += tsOutCopy[16];
+ tsOutCopy[16] += tsOutCopy[15];
+ tsOutCopy[15] += tsOutCopy[14];
+ tsOutCopy[14] += tsOutCopy[13];
+ tsOutCopy[13] += tsOutCopy[12];
+ tsOutCopy[12] += tsOutCopy[11];
+ tsOutCopy[11] += tsOutCopy[10];
+ tsOutCopy[10] += tsOutCopy[9];
+ tsOutCopy[9] += tsOutCopy[8];
+ tsOutCopy[8] += tsOutCopy[7];
+ tsOutCopy[7] += tsOutCopy[6];
+ tsOutCopy[6] += tsOutCopy[5];
+ tsOutCopy[5] += tsOutCopy[4];
+ tsOutCopy[4] += tsOutCopy[3];
+ tsOutCopy[3] += tsOutCopy[2];
+ tsOutCopy[2] += tsOutCopy[1];
+ tsOutCopy[1] += tsOutCopy[0];
+
+ // 18 point IDCT for odd indices
+ // input aliasing for 18 point IDCT
+ tsOutCopy[17] += tsOutCopy[15];
+ tsOutCopy[15] += tsOutCopy[13];
+ tsOutCopy[13] += tsOutCopy[11];
+ tsOutCopy[11] += tsOutCopy[9];
+ tsOutCopy[9] += tsOutCopy[7];
+ tsOutCopy[7] += tsOutCopy[5];
+ tsOutCopy[5] += tsOutCopy[3];
+ tsOutCopy[3] += tsOutCopy[1];
+
+ @LOC("THIS,LayerIIIDecoder.TSOUT") float tmp0;
+ @LOC("THIS,LayerIIIDecoder.TSOUT") float tmp1;
+ @LOC("THIS,LayerIIIDecoder.TSOUT") float tmp2;
+ @LOC("THIS,LayerIIIDecoder.TSOUT") float tmp3;
+ @LOC("THIS,LayerIIIDecoder.TSOUT") float tmp4;
+ @LOC("THIS,LayerIIIDecoder.TSOUT") float tmp0_;
+ @LOC("THIS,LayerIIIDecoder.TSOUT") float tmp1_;
+ @LOC("THIS,LayerIIIDecoder.TSOUT") float tmp2_;
+ @LOC("THIS,LayerIIIDecoder.TSOUT") float tmp3_;
+ @LOC("THIS,LayerIIIDecoder.TSOUT") float tmp0o;
+ @LOC("THIS,LayerIIIDecoder.TSOUT") float tmp1o;
+ @LOC("THIS,LayerIIIDecoder.TSOUT") float tmp2o;
+ @LOC("THIS,LayerIIIDecoder.TSOUT") float tmp3o;
+ @LOC("THIS,LayerIIIDecoder.TSOUT") float tmp4o;
+ @LOC("THIS,LayerIIIDecoder.TSOUT") float tmp0_o;
+ @LOC("THIS,LayerIIIDecoder.TSOUT") float tmp1_o;
+ @LOC("THIS,LayerIIIDecoder.TSOUT") float tmp2_o;
+ @LOC("THIS,LayerIIIDecoder.TSOUT") float tmp3_o;
+
+ // Fast 9 Point Inverse Discrete Cosine Transform
+ //
+ // By Francois-Raymond Boyer
+ // mailto:boyerf@iro.umontreal.ca
+ // http://www.iro.umontreal.ca/~boyerf
+ //
+ // The code has been optimized for Intel processors
+ // (takes a lot of time to convert float to and from iternal FPU
+ // representation)
+ //
+ // It is a simple "factorization" of the IDCT matrix.
+
+ // 9 point IDCT on even indices
+
+ // 5 points on odd indices (not realy an IDCT)
+ @LOC("THIS,LayerIIIDecoder.TSOUT") float i00 = tsOutCopy[0] + tsOutCopy[0];
+ @LOC("THIS,LayerIIIDecoder.TSOUT") float iip12 = i00 + tsOutCopy[12];
+
+ tmp0 =
+ iip12 + tsOutCopy[4] * 1.8793852415718f + tsOutCopy[8] * 1.532088886238f + tsOutCopy[16]
+ * 0.34729635533386f;
+ tmp1 = i00 + tsOutCopy[4] - tsOutCopy[8] - tsOutCopy[12] - tsOutCopy[12] - tsOutCopy[16];
+ tmp2 =
+ iip12 - tsOutCopy[4] * 0.34729635533386f - tsOutCopy[8] * 1.8793852415718f
+ + tsOutCopy[16] * 1.532088886238f;
+ tmp3 =
+ iip12 - tsOutCopy[4] * 1.532088886238f + tsOutCopy[8] * 0.34729635533386f - tsOutCopy[16]
+ * 1.8793852415718f;
+ tmp4 = tsOutCopy[0] - tsOutCopy[4] + tsOutCopy[8] - tsOutCopy[12] + tsOutCopy[16];
+
+ // 4 points on even indices
+ @LOC("THIS,LayerIIIDecoder.TSOUT") float i66_ = tsOutCopy[6] * 1.732050808f; // Sqrt[3]
+
+ tmp0_ =
+ tsOutCopy[2] * 1.9696155060244f + i66_ + tsOutCopy[10] * 1.2855752193731f + tsOutCopy[14]
+ * 0.68404028665134f;
+ tmp1_ = (tsOutCopy[2] - tsOutCopy[10] - tsOutCopy[14]) * 1.732050808f;
+ tmp2_ =
+ tsOutCopy[2] * 1.2855752193731f - i66_ - tsOutCopy[10] * 0.68404028665134f
+ + tsOutCopy[14] * 1.9696155060244f;
+ tmp3_ =
+ tsOutCopy[2] * 0.68404028665134f - i66_ + tsOutCopy[10] * 1.9696155060244f
+ - tsOutCopy[14] * 1.2855752193731f;
+
+ // 9 point IDCT on odd indices
+ // 5 points on odd indices (not realy an IDCT)
+ @LOC("THIS,LayerIIIDecoder.TSOUT") float i0 = tsOutCopy[0 + 1] + tsOutCopy[0 + 1];
+ @LOC("THIS,LayerIIIDecoder.TSOUT") float i0p12 = i0 + tsOutCopy[12 + 1];
+
+ tmp0o =
+ i0p12 + tsOutCopy[4 + 1] * 1.8793852415718f + tsOutCopy[8 + 1] * 1.532088886238f
+ + tsOutCopy[16 + 1] * 0.34729635533386f;
+ tmp1o =
+ i0 + tsOutCopy[4 + 1] - tsOutCopy[8 + 1] - tsOutCopy[12 + 1] - tsOutCopy[12 + 1]
+ - tsOutCopy[16 + 1];
+ tmp2o =
+ i0p12 - tsOutCopy[4 + 1] * 0.34729635533386f - tsOutCopy[8 + 1] * 1.8793852415718f
+ + tsOutCopy[16 + 1] * 1.532088886238f;
+ tmp3o =
+ i0p12 - tsOutCopy[4 + 1] * 1.532088886238f + tsOutCopy[8 + 1] * 0.34729635533386f
+ - tsOutCopy[16 + 1] * 1.8793852415718f;
+ tmp4o =
+ (tsOutCopy[0 + 1] - tsOutCopy[4 + 1] + tsOutCopy[8 + 1] - tsOutCopy[12 + 1] + tsOutCopy[16 + 1]) * 0.707106781f; // Twiddled
+
+ // 4 points on even indices
+ @LOC("THIS,LayerIIIDecoder.TSOUT") float i6_ = tsOutCopy[6 + 1] * 1.732050808f; // Sqrt[3]
+
+ tmp0_o =
+ tsOutCopy[2 + 1] * 1.9696155060244f + i6_ + tsOutCopy[10 + 1] * 1.2855752193731f
+ + tsOutCopy[14 + 1] * 0.68404028665134f;
+ tmp1_o = (tsOutCopy[2 + 1] - tsOutCopy[10 + 1] - tsOutCopy[14 + 1]) * 1.732050808f;
+ tmp2_o =
+ tsOutCopy[2 + 1] * 1.2855752193731f - i6_ - tsOutCopy[10 + 1] * 0.68404028665134f
+ + tsOutCopy[14 + 1] * 1.9696155060244f;
+ tmp3_o =
+ tsOutCopy[2 + 1] * 0.68404028665134f - i6_ + tsOutCopy[10 + 1] * 1.9696155060244f
+ - tsOutCopy[14 + 1] * 1.2855752193731f;
+
+ // Twiddle factors on odd indices
+ // and
+ // Butterflies on 9 point IDCT's
+ // and
+ // twiddle factors for 36 point IDCT
+
+ @LOC("THIS,LayerIIIDecoder.TSOUT") float e;
+ @LOC("THIS,LayerIIIDecoder.TSOUT") float o;
+ e = tmp0 + tmp0_;
+ o = (tmp0o + tmp0_o) * 0.501909918f;
+ tmpf_0 = e + o;
+ tmpf_17 = e - o;
+ e = tmp1 + tmp1_;
+ o = (tmp1o + tmp1_o) * 0.517638090f;
+ tmpf_1 = e + o;
+ tmpf_16 = e - o;
+ e = tmp2 + tmp2_;
+ o = (tmp2o + tmp2_o) * 0.551688959f;
+ tmpf_2 = e + o;
+ tmpf_15 = e - o;
+ e = tmp3 + tmp3_;
+ o = (tmp3o + tmp3_o) * 0.610387294f;
+ tmpf_3 = e + o;
+ tmpf_14 = e - o;
+ tmpf_4 = tmp4 + tmp4o;
+ tmpf_13 = tmp4 - tmp4o;
+ e = tmp3 - tmp3_;
+ o = (tmp3o - tmp3_o) * 0.871723397f;
+ tmpf_5 = e + o;
+ tmpf_12 = e - o;
+ e = tmp2 - tmp2_;
+ o = (tmp2o - tmp2_o) * 1.183100792f;
+ tmpf_6 = e + o;
+ tmpf_11 = e - o;
+ e = tmp1 - tmp1_;
+ o = (tmp1o - tmp1_o) * 1.931851653f;
+ tmpf_7 = e + o;
+ tmpf_10 = e - o;
+ e = tmp0 - tmp0_;
+ o = (tmp0o - tmp0_o) * 5.736856623f;
+ tmpf_8 = e + o;
+ tmpf_9 = e - o;
+
+ // end 36 point IDCT */
+ // shift to modified IDCT
+ // win_bt = win[block_type]; //substituted this so that a new area does
+ // not become created
+
+ rawout[0] = -tmpf_9 * win[block_type][0];
+ rawout[1] = -tmpf_10 * win[block_type][1];
+ rawout[2] = -tmpf_11 * win[block_type][2];
+ rawout[3] = -tmpf_12 * win[block_type][3];
+ rawout[4] = -tmpf_13 * win[block_type][4];
+ rawout[5] = -tmpf_14 * win[block_type][5];
+ rawout[6] = -tmpf_15 * win[block_type][6];
+ rawout[7] = -tmpf_16 * win[block_type][7];
+ rawout[8] = -tmpf_17 * win[block_type][8];
+ rawout[9] = tmpf_17 * win[block_type][9];
+ rawout[10] = tmpf_16 * win[block_type][10];
+ rawout[11] = tmpf_15 * win[block_type][11];
+ rawout[12] = tmpf_14 * win[block_type][12];
+ rawout[13] = tmpf_13 * win[block_type][13];
+ rawout[14] = tmpf_12 * win[block_type][14];
+ rawout[15] = tmpf_11 * win[block_type][15];
+ rawout[16] = tmpf_10 * win[block_type][16];
+ rawout[17] = tmpf_9 * win[block_type][17];
+ rawout[18] = tmpf_8 * win[block_type][18];
+ rawout[19] = tmpf_7 * win[block_type][19];
+ rawout[20] = tmpf_6 * win[block_type][20];
+ rawout[21] = tmpf_5 * win[block_type][21];
+ rawout[22] = tmpf_4 * win[block_type][22];
+ rawout[23] = tmpf_3 * win[block_type][23];
+ rawout[24] = tmpf_2 * win[block_type][24];
+ rawout[25] = tmpf_1 * win[block_type][25];
+ rawout[26] = tmpf_0 * win[block_type][26];
+ rawout[27] = tmpf_0 * win[block_type][27];
+ rawout[28] = tmpf_1 * win[block_type][28];
+ rawout[29] = tmpf_2 * win[block_type][29];
+ rawout[30] = tmpf_3 * win[block_type][30];
+ rawout[31] = tmpf_4 * win[block_type][31];
+ rawout[32] = tmpf_5 * win[block_type][32];
+ rawout[33] = tmpf_6 * win[block_type][33];
+ rawout[34] = tmpf_7 * win[block_type][34];
+ rawout[35] = tmpf_8 * win[block_type][35];
+ }
+
+ }
+
+ @LOC("C")
+ private int counter = 0;
+ private static final int SSLIMIT = 18;
+ private static final int SBLIMIT = 32;
+
+ // Size of the table of whole numbers raised to 4/3 power.
+ // This may be adjusted for performance without any problems.
+ // public static final int POW_TABLE_LIMIT=512;
+
+ /************************************************************/
+ /* L3TABLE */
+ /************************************************************/
+
+ @LATTICE("N<VAR")
+ static class SBI {
+ @LOC("VAR")
+ public int[] l;
+ @LOC("VAR")
+ public int[] s;
+
+ public SBI() {
+ l = new int[23];
+ s = new int[14];
+ }
+
+ @LATTICE("THIS<IN,THISLOC=THIS")
+ public SBI(@DELEGATE @LOC("IN") int[] thel, @DELEGATE @LOC("IN") int[] thes) {
+ l = thel;
+ s = thes;
+ }
+ }
+
+ @LATTICE("V,V*")
+ static class gr_info_s {
+ @LOC("V")
+ public int part2_3_length = 0;
+ @LOC("V")
+ public int big_values = 0;
+ @LOC("V")
+ public int global_gain = 0;
+ @LOC("V")
+ public int scalefac_compress = 0;
+ @LOC("V")
+ public int window_switching_flag = 0;
+ @LOC("V")
+ public int block_type = 0;
+ @LOC("V")
+ public int mixed_block_flag = 0;
+ @LOC("V")
+ public int[] table_select;
+ @LOC("V")
+ public int[] subblock_gain;
+ @LOC("V")
+ public int region0_count = 0;
+ @LOC("V")
+ public int region1_count = 0;
+ @LOC("V")
+ public int preflag = 0;
+ @LOC("V")
+ public int scalefac_scale = 0;
+ @LOC("V")
+ public int count1table_select = 0;
+
+ /**
+ * Dummy Constructor
+ */
+ public gr_info_s() {
+ table_select = new int[3];
+ subblock_gain = new int[3];
+ }
+ }
+
+ @LATTICE("GR2<GR1,GR1<GR,GR2*")
+ static class temporaire {
+ @LOC("GR")
+ public int[] scfsi;
+ @LOC("GR")
+ public gr_info_s[] gr;
+
+ /**
+ * Dummy Constructor
+ */
+ public temporaire() {
+ scfsi = new int[4];
+ gr = new gr_info_s[2];
+ gr[0] = new gr_info_s();
+ gr[1] = new gr_info_s();
+ }
+ }
+
+ @LATTICE("CH<TEMP,TEMP*")
+ static class III_side_info_t {
+
+ @LOC("CH")
+ public int main_data_begin = 0;
+ @LOC("CH")
+ public int private_bits = 0;
+ @LOC("CH")
+ public temporaire[] ch;
+
+ /**
+ * Dummy Constructor
+ */
+ public III_side_info_t() {
+ ch = new temporaire[2];
+ ch[0] = new temporaire();
+ ch[1] = new temporaire();
+ }
+ }
+
+ @LATTICE("N<VAR")
+ static class temporaire2 {
+ @LOC("VAR")
+ public int[] l; /* [cb] */
+ @LOC("VAR")
+ public int[][] s; /* [window][cb] */
+
+ /**
+ * Dummy Constructor
+ */
+ public temporaire2() {
+ l = new int[23];
+ s = new int[3][13];
+ }
+ }
+
+ // class III_scalefac_t
+ // {
+ // public temporaire2[] tab;
+ // /**
+ // * Dummy Constructor
+ // */
+ // public III_scalefac_t()
+ // {
+ // tab = new temporaire2[2];
+ // }
+ // }
+
+ private static final int slen[][] = { { 0, 0, 0, 0, 3, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4 },
+ { 0, 1, 2, 3, 0, 1, 2, 3, 1, 2, 3, 1, 2, 3, 2, 3 } };
+
+ public static final int pretab[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 3, 3, 3,
+ 2, 0 };
+
+ @LOC("SBI")
+ private SBI[] sfBandIndex; // Init in the constructor.
+
+ public static final float two_to_negative_half_pow[] = { 1.0000000000E+00f, 7.0710678119E-01f,
+ 5.0000000000E-01f, 3.5355339059E-01f, 2.5000000000E-01f, 1.7677669530E-01f,
+ 1.2500000000E-01f, 8.8388347648E-02f, 6.2500000000E-02f, 4.4194173824E-02f,
+ 3.1250000000E-02f, 2.2097086912E-02f, 1.5625000000E-02f, 1.1048543456E-02f,
+ 7.8125000000E-03f, 5.5242717280E-03f, 3.9062500000E-03f, 2.7621358640E-03f,
+ 1.9531250000E-03f, 1.3810679320E-03f, 9.7656250000E-04f, 6.9053396600E-04f,
+ 4.8828125000E-04f, 3.4526698300E-04f, 2.4414062500E-04f, 1.7263349150E-04f,
+ 1.2207031250E-04f, 8.6316745750E-05f, 6.1035156250E-05f, 4.3158372875E-05f,
+ 3.0517578125E-05f, 2.1579186438E-05f, 1.5258789062E-05f, 1.0789593219E-05f,
+ 7.6293945312E-06f, 5.3947966094E-06f, 3.8146972656E-06f, 2.6973983047E-06f,
+ 1.9073486328E-06f, 1.3486991523E-06f, 9.5367431641E-07f, 6.7434957617E-07f,
+ 4.7683715820E-07f, 3.3717478809E-07f, 2.3841857910E-07f, 1.6858739404E-07f,
+ 1.1920928955E-07f, 8.4293697022E-08f, 5.9604644775E-08f, 4.2146848511E-08f,
+ 2.9802322388E-08f, 2.1073424255E-08f, 1.4901161194E-08f, 1.0536712128E-08f,
+ 7.4505805969E-09f, 5.2683560639E-09f, 3.7252902985E-09f, 2.6341780319E-09f,
+ 1.8626451492E-09f, 1.3170890160E-09f, 9.3132257462E-10f, 6.5854450798E-10f,
+ 4.6566128731E-10f, 3.2927225399E-10f };
+
+ public static final float t_43[] = create_t_43();
+
+ @RETURNLOC("OUT")
+ static private float[] create_t_43() {
+ @LOC("OUT") float[] t43 = new float[8192];
+ final double d43 = (4.0 / 3.0);
+
+ for (@LOC("SH") int i = 0; i < 8192; i++) {
+ t43[i] = (float) Math.pow(i, d43);
+ }
+ return t43;
+ }
+
+ public static final float io[][] = {
+ { 1.0000000000E+00f, 8.4089641526E-01f, 7.0710678119E-01f, 5.9460355751E-01f,
+ 5.0000000001E-01f, 4.2044820763E-01f, 3.5355339060E-01f, 2.9730177876E-01f,
+ 2.5000000001E-01f, 2.1022410382E-01f, 1.7677669530E-01f, 1.4865088938E-01f,
+ 1.2500000000E-01f, 1.0511205191E-01f, 8.8388347652E-02f, 7.4325444691E-02f,
+ 6.2500000003E-02f, 5.2556025956E-02f, 4.4194173826E-02f, 3.7162722346E-02f,
+ 3.1250000002E-02f, 2.6278012978E-02f, 2.2097086913E-02f, 1.8581361173E-02f,
+ 1.5625000001E-02f, 1.3139006489E-02f, 1.1048543457E-02f, 9.2906805866E-03f,
+ 7.8125000006E-03f, 6.5695032447E-03f, 5.5242717285E-03f, 4.6453402934E-03f },
+ { 1.0000000000E+00f, 7.0710678119E-01f, 5.0000000000E-01f, 3.5355339060E-01f,
+ 2.5000000000E-01f, 1.7677669530E-01f, 1.2500000000E-01f, 8.8388347650E-02f,
+ 6.2500000001E-02f, 4.4194173825E-02f, 3.1250000001E-02f, 2.2097086913E-02f,
+ 1.5625000000E-02f, 1.1048543456E-02f, 7.8125000002E-03f, 5.5242717282E-03f,
+ 3.9062500001E-03f, 2.7621358641E-03f, 1.9531250001E-03f, 1.3810679321E-03f,
+ 9.7656250004E-04f, 6.9053396603E-04f, 4.8828125002E-04f, 3.4526698302E-04f,
+ 2.4414062501E-04f, 1.7263349151E-04f, 1.2207031251E-04f, 8.6316745755E-05f,
+ 6.1035156254E-05f, 4.3158372878E-05f, 3.0517578127E-05f, 2.1579186439E-05f } };
+
+ public static final float TAN12[] = { 0.0f, 0.26794919f, 0.57735027f, 1.0f, 1.73205081f,
+ 3.73205081f, 9.9999999e10f, -3.73205081f, -1.73205081f, -1.0f, -0.57735027f, -0.26794919f,
+ 0.0f, 0.26794919f, 0.57735027f, 1.0f };
+
+ // REVIEW: in java, the array lookup may well be slower than
+ // the actual calculation
+ // 576 / 18
+ /*
+ * private static final int ss_div[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ * 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2,
+ * 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3,
+ * 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
+ * 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6,
+ * 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
+ * 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
+ * 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10,
+ * 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11,
+ * 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12,
+ * 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, 13, 13, 13, 13,
+ * 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14,
+ * 14, 14, 14, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
+ * 15, 15, 15, 15, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+ * 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
+ * 17, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
+ * 18, 18, 18, 18, 18, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
+ * 19, 19, 19, 19, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
+ * 20, 20, 20, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
+ * 21, 21, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
+ * 22, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
+ * 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 25,
+ * 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 26, 26,
+ * 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 27, 27, 27,
+ * 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 28, 28, 28, 28,
+ * 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 29, 29, 29, 29, 29,
+ * 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 30, 30, 30, 30, 30, 30,
+ * 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 31, 31, 31, 31, 31, 31, 31,
+ * 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31 };
+ *
+ * // 576 % 18 private static final int ss_mod[] = { 0, 1, 2, 3, 4, 5, 6, 7,
+ * 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
+ * 12, 13, 14, 15, 16, 17, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
+ * 15, 16, 17, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
+ * 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 0, 1, 2, 3,
+ * 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 0, 1, 2, 3, 4, 5, 6, 7,
+ * 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
+ * 12, 13, 14, 15, 16, 17, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
+ * 15, 16, 17, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
+ * 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 0, 1, 2, 3,
+ * 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 0, 1, 2, 3, 4, 5, 6, 7,
+ * 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
+ * 12, 13, 14, 15, 16, 17, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
+ * 15, 16, 17, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
+ * 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 0, 1, 2, 3,
+ * 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 0, 1, 2, 3, 4, 5, 6, 7,
+ * 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
+ * 12, 13, 14, 15, 16, 17, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
+ * 15, 16, 17, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
+ * 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 0, 1, 2, 3,
+ * 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 0, 1, 2, 3, 4, 5, 6, 7,
+ * 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
+ * 12, 13, 14, 15, 16, 17, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
+ * 15, 16, 17, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
+ * 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 0, 1, 2, 3,
+ * 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 0, 1, 2, 3, 4, 5, 6, 7,
+ * 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
+ * 12, 13, 14, 15, 16, 17 };
+ */
+ @LOC("RT")
+ private static/* final */int reorder_table[][]/* = loadReorderTable() */; // SZD:
+
+ // will
+ // be
+ // generated
+ // on
+ // demand
+
+ /**
+ * Loads the data for the reorder
+ */
+ /*
+ * private static int[][] loadReorderTable() // SZD: table will be generated {
+ * try { Class elemType = int[][].class.getComponentType(); Object o =
+ * JavaLayerUtils.deserializeArrayResource("l3reorder.ser", elemType, 6);
+ * return (int[][])o; } catch (IOException ex) { throw new
+ * ExceptionInInitializerError(ex); } }
+ */
+ @LATTICE("OUT<J,J<I,I<SE,I<WIN,SE<SF,SE<SFB,WIN<SFB,J*,I*,WIN*,SFB*")
+ static int[] reorder(@LOC("SF") int scalefac_band[]) { // SZD: converted from
+ // LAME
+ @LOC("J") int j = 0;
+ @LOC("OUT") int ix[] = new int[576];
+ for (int sfb = 0; sfb < 13; sfb++) {
+ int start = scalefac_band[sfb];
+ int end = scalefac_band[sfb + 1];
+ for (int window = 0; window < 3; window++)
+ for (int i = start; i < end; i++)
+ ix[3 * i + window] = j++;
+ }
+ return ix;
+ }
+
+ /*
+ * static final int reorder_table_data[][]; = { { 0, 4, 8, 1, 5, 9, 2, 6, 10,
+ * 3, 7, 11, 12, 16, 20, 13, 17, 21, 14, 18, 22, 15, 19, 23, 24, 28, 32, 25,
+ * 29, 33, 26, 30, 34, 27, 31, 35, 36, 42, 48, 37, 43, 49, 38, 44, 50, 39, 45,
+ * 51, 40, 46, 52, 41, 47, 53, 54, 60, 66, 55, 61, 67, 56, 62, 68, 57, 63, 69,
+ * 58, 64, 70, 59, 65, 71, 72, 80, 88, 73, 81, 89, 74, 82, 90, 75, 83, 91, 76,
+ * 84, 92, 77, 85, 93, 78, 86, 94, 79, 87, 95, 96,106,116, 97,107,117,
+ * 98,108,118, 99,109,119,100,110,120,101,
+ * 111,121,102,112,122,103,113,123,104,114,124,105,115,125,126,140,
+ * 154,127,141,155,128,142,156,129,143,157,130,144,158,131,145,159,
+ * 132,146,160,133,147,161,134,148,162,135,149,163,136,150,164,137,
+ * 151,165,138,152,166,139,153,167,168,186,204,169,187,205,170,188,
+ * 206,171,189,207,172,190,208,173,191,209,174,192,210,175,193,211,
+ * 176,194,212,177,195,213,178,196,214,179,197,215,180,198,216,181,
+ * 199,217,182,200,218,183,201,219,184,202,220,185,203,221,222,248,
+ * 274,223,249,275,224,250,276,225,251,277,226,252,278,227,253,279,
+ * 228,254,280,229,255,281,230,256,282,231,257,283,232,258,284,233,
+ * 259,285,234,260,286,235,261,287,236,262,288,237,263,289,238,264,
+ * 290,239,265,291,240,266,292,241,267,293,242,268,294,243,269,295,
+ * 244,270,296,245,271,297,246,272,298,247,273,299,300,332,364,301,
+ * 333,365,302,334,366,303,335,367,304,336,368,305,337,369,306,338,
+ * 370,307,339,371,308,340,372,309,341,373,310,342,374,311,343,375,
+ * 312,344,376,313,345,377,314,346,378,315,347,379,316,348,380,317,
+ * 349,381,318,350,382,319,351,383,320,352,384,321,353,385,322,354,
+ * 386,323,355,387,324,356,388,325,357,389,326,358,390,327,359,391,
+ * 328,360,392,329,361,393,330,362,394,331,363,395,396,438,480,397,
+ * 439,481,398,440,482,399,441,483,400,442,484,401,443,485,402,444,
+ * 486,403,445,487,404,446,488,405,447,489,406,448,490,407,449,491,
+ * 408,450,492,409,451,493,410,452,494,411,453,495,412,454,496,413,
+ * 455,497,414,456,498,415,457,499,416,458,500,417,459,501,418,460,
+ * 502,419,461,503,420,462,504,421,463,505,422,464,506,423,465,507,
+ * 424,466,508,425,467,509,426,468,510,427,469,511,428,470,512,429,
+ * 471,513,430,472,514,431,473,515,432,474,516,433,475,517,434,476,
+ * 518,435,477,519,436,478,520,437,479,521,522,540,558,523,541,559,
+ * 524,542,560,525,543,561,526,544,562,527,545,563,528,546,564,529,
+ * 547,565,530,548,566,531,549,567,532,550,568,533,551,569,534,552,
+ * 570,535,553,571,536,554,572,537,555,573,538,556,574,539,557,575}, { 0, 4,
+ * 8, 1, 5, 9, 2, 6, 10, 3, 7, 11, 12, 16, 20, 13, 17, 21, 14, 18, 22, 15, 19,
+ * 23, 24, 28, 32, 25, 29, 33, 26, 30, 34, 27, 31, 35, 36, 42, 48, 37, 43, 49,
+ * 38, 44, 50, 39, 45, 51, 40, 46, 52, 41, 47, 53, 54, 62, 70, 55, 63, 71, 56,
+ * 64, 72, 57, 65, 73, 58, 66, 74, 59, 67, 75, 60, 68, 76, 61, 69, 77, 78, 88,
+ * 98, 79, 89, 99, 80, 90,100, 81, 91,101, 82, 92,102, 83, 93,103, 84, 94,104,
+ * 85, 95,105, 86, 96,106, 87, 97,107,108,120,132,109,
+ * 121,133,110,122,134,111,123,135,112,124,136,113,125,137,114,126,
+ * 138,115,127,139,116,128,140,117,129,141,118,130,142,119,131,143,
+ * 144,158,172,145,159,173,146,160,174,147,161,175,148,162,176,149,
+ * 163,177,150,164,178,151,165,179,152,166,180,153,167,181,154,168,
+ * 182,155,169,183,156,170,184,157,171,185,186,204,222,187,205,223,
+ * 188,206,224,189,207,225,190,208,226,191,209,227,192,210,228,193,
+ * 211,229,194,212,230,195,213,231,196,214,232,197,215,233,198,216,
+ * 234,199,217,235,200,218,236,201,219,237,202,220,238,203,221,239,
+ * 240,264,288,241,265,289,242,266,290,243,267,291,244,268,292,245,
+ * 269,293,246,270,294,247,271,295,248,272,296,249,273,297,250,274,
+ * 298,251,275,299,252,276,300,253,277,301,254,278,302,255,279,303,
+ * 256,280,304,257,281,305,258,282,306,259,283,307,260,284,308,261,
+ * 285,309,262,286,310,263,287,311,312,344,376,313,345,377,314,346,
+ * 378,315,347,379,316,348,380,317,349,381,318,350,382,319,351,383,
+ * 320,352,384,321,353,385,322,354,386,323,355,387,324,356,388,325,
+ * 357,389,326,358,390,327,359,391,328,360,392,329,361,393,330,362,
+ * 394,331,363,395,332,364,396,333,365,397,334,366,398,335,367,399,
+ * 336,368,400,337,369,401,338,370,402,339,371,403,340,372,404,341,
+ * 373,405,342,374,406,343,375,407,408,452,496,409,453,497,410,454,
+ * 498,411,455,499,412,456,500,413,457,501,414,458,502,415,459,503,
+ * 416,460,504,417,461,505,418,462,506,419,463,507,420,464,508,421,
+ * 465,509,422,466,510,423,467,511,424,468,512,425,469,513,426,470,
+ * 514,427,471,515,428,472,516,429,473,517,430,474,518,431,475,519,
+ * 432,476,520,433,477,521,434,478,522,435,479,523,436,480,524,437,
+ * 481,525,438,482,526,439,483,527,440,484,528,441,485,529,442,486,
+ * 530,443,487,531,444,488,532,445,489,533,446,490,534,447,491,535,
+ * 448,492,536,449,493,537,450,494,538,451,495,539,540,552,564,541,
+ * 553,565,542,554,566,543,555,567,544,556,568,545,557,569,546,558,
+ * 570,547,559,571,548,560,572,549,561,573,550,562,574,551,563,575}, { 0, 4,
+ * 8, 1, 5, 9, 2, 6, 10, 3, 7, 11, 12, 16, 20, 13, 17, 21, 14, 18, 22, 15, 19,
+ * 23, 24, 28, 32, 25, 29, 33, 26, 30, 34, 27, 31, 35, 36, 42, 48, 37, 43, 49,
+ * 38, 44, 50, 39, 45, 51, 40, 46, 52, 41, 47, 53, 54, 62, 70, 55, 63, 71, 56,
+ * 64, 72, 57, 65, 73, 58, 66, 74, 59, 67, 75, 60, 68, 76, 61, 69, 77, 78, 88,
+ * 98, 79, 89, 99, 80, 90,100, 81, 91,101, 82, 92,102, 83, 93,103, 84, 94,104,
+ * 85, 95,105, 86, 96,106, 87, 97,107,108,120,132,109,
+ * 121,133,110,122,134,111,123,135,112,124,136,113,125,137,114,126,
+ * 138,115,127,139,116,128,140,117,129,141,118,130,142,119,131,143,
+ * 144,158,172,145,159,173,146,160,174,147,161,175,148,162,176,149,
+ * 163,177,150,164,178,151,165,179,152,166,180,153,167,181,154,168,
+ * 182,155,169,183,156,170,184,157,171,185,186,204,222,187,205,223,
+ * 188,206,224,189,207,225,190,208,226,191,209,227,192,210,228,193,
+ * 211,229,194,212,230,195,213,231,196,214,232,197,215,233,198,216,
+ * 234,199,217,235,200,218,236,201,219,237,202,220,238,203,221,239,
+ * 240,264,288,241,265,289,242,266,290,243,267,291,244,268,292,245,
+ * 269,293,246,270,294,247,271,295,248,272,296,249,273,297,250,274,
+ * 298,251,275,299,252,276,300,253,277,301,254,278,302,255,279,303,
+ * 256,280,304,257,281,305,258,282,306,259,283,307,260,284,308,261,
+ * 285,309,262,286,310,263,287,311,312,342,372,313,343,373,314,344,
+ * 374,315,345,375,316,346,376,317,347,377,318,348,378,319,349,379,
+ * 320,350,380,321,351,381,322,352,382,323,353,383,324,354,384,325,
+ * 355,385,326,356,386,327,357,387,328,358,388,329,359,389,330,360,
+ * 390,331,361,391,332,362,392,333,363,393,334,364,394,335,365,395,
+ * 336,366,396,337,367,397,338,368,398,339,369,399,340,370,400,341,
+ * 371,401,402,442,482,403,443,483,404,444,484,405,445,485,406,446,
+ * 486,407,447,487,408,448,488,409,449,489,410,450,490,411,451,491,
+ * 412,452,492,413,453,493,414,454,494,415,455,495,416,456,496,417,
+ * 457,497,418,458,498,419,459,499,420,460,500,421,461,501,422,462,
+ * 502,423,463,503,424,464,504,425,465,505,426,466,506,427,467,507,
+ * 428,468,508,429,469,509,430,470,510,431,471,511,432,472,512,433,
+ * 473,513,434,474,514,435,475,515,436,476,516,437,477,517,438,478,
+ * 518,439,479,519,440,480,520,441,481,521,522,540,558,523,541,559,
+ * 524,542,560,525,543,561,526,544,562,527,545,563,528,546,564,529,
+ * 547,565,530,548,566,531,549,567,532,550,568,533,551,569,534,552,
+ * 570,535,553,571,536,554,572,537,555,573,538,556,574,539,557,575}, { 0, 4,
+ * 8, 1, 5, 9, 2, 6, 10, 3, 7, 11, 12, 16, 20, 13, 17, 21, 14, 18, 22, 15, 19,
+ * 23, 24, 28, 32, 25, 29, 33, 26, 30, 34, 27, 31, 35, 36, 40, 44, 37, 41, 45,
+ * 38, 42, 46, 39, 43, 47, 48, 54, 60, 49, 55, 61, 50, 56, 62, 51, 57, 63, 52,
+ * 58, 64, 53, 59, 65, 66, 74, 82, 67, 75, 83, 68, 76, 84, 69, 77, 85, 70, 78,
+ * 86, 71, 79, 87, 72, 80, 88, 73, 81, 89, 90,100,110, 91,101,111, 92,102,112,
+ * 93,103,113, 94,104,114, 95,105,115, 96,106,116, 97, 107,117, 98,108,118,
+ * 99,109,119,120,132,144,121,133,145,122,134,
+ * 146,123,135,147,124,136,148,125,137,149,126,138,150,127,139,151,
+ * 128,140,152,129,141,153,130,142,154,131,143,155,156,170,184,157,
+ * 171,185,158,172,186,159,173,187,160,174,188,161,175,189,162,176,
+ * 190,163,177,191,164,178,192,165,179,193,166,180,194,167,181,195,
+ * 168,182,196,169,183,197,198,216,234,199,217,235,200,218,236,201,
+ * 219,237,202,220,238,203,221,239,204,222,240,205,223,241,206,224,
+ * 242,207,225,243,208,226,244,209,227,245,210,228,246,211,229,247,
+ * 212,230,248,213,231,249,214,232,250,215,233,251,252,274,296,253,
+ * 275,297,254,276,298,255,277,299,256,278,300,257,279,301,258,280,
+ * 302,259,281,303,260,282,304,261,283,305,262,284,306,263,285,307,
+ * 264,286,308,265,287,309,266,288,310,267,289,311,268,290,312,269,
+ * 291,313,270,292,314,271,293,315,272,294,316,273,295,317,318,348,
+ * 378,319,349,379,320,350,380,321,351,381,322,352,382,323,353,383,
+ * 324,354,384,325,355,385,326,356,386,327,357,387,328,358,388,329,
+ * 359,389,330,360,390,331,361,391,332,362,392,333,363,393,334,364,
+ * 394,335,365,395,336,366,396,337,367,397,338,368,398,339,369,399,
+ * 340,370,400,341,371,401,342,372,402,343,373,403,344,374,404,345,
+ * 375,405,346,376,406,347,377,407,408,464,520,409,465,521,410,466,
+ * 522,411,467,523,412,468,524,413,469,525,414,470,526,415,471,527,
+ * 416,472,528,417,473,529,418,474,530,419,475,531,420,476,532,421,
+ * 477,533,422,478,534,423,479,535,424,480,536,425,481,537,426,482,
+ * 538,427,483,539,428,484,540,429,485,541,430,486,542,431,487,543,
+ * 432,488,544,433,489,545,434,490,546,435,491,547,436,492,548,437,
+ * 493,549,438,494,550,439,495,551,440,496,552,441,497,553,442,498,
+ * 554,443,499,555,444,500,556,445,501,557,446,502,558,447,503,559,
+ * 448,504,560,449,505,561,450,506,562,451,507,563,452,508,564,453,
+ * 509,565,454,510,566,455,511,567,456,512,568,457,513,569,458,514,
+ * 570,459,515,571,460,516,572,461,517,573,462,518,574,463,519,575}, { 0, 4,
+ * 8, 1, 5, 9, 2, 6, 10, 3, 7, 11, 12, 16, 20, 13, 17, 21, 14, 18, 22, 15, 19,
+ * 23, 24, 28, 32, 25, 29, 33, 26, 30, 34, 27, 31, 35, 36, 40, 44, 37, 41, 45,
+ * 38, 42, 46, 39, 43, 47, 48, 54, 60, 49, 55, 61, 50, 56, 62, 51, 57, 63, 52,
+ * 58, 64, 53, 59, 65, 66, 72, 78, 67, 73, 79, 68, 74, 80, 69, 75, 81, 70, 76,
+ * 82, 71, 77, 83, 84, 94,104, 85, 95,105, 86, 96,106, 87, 97,107, 88, 98,108,
+ * 89, 99,109, 90,100,110, 91,101,111, 92,102,112, 93,
+ * 103,113,114,126,138,115,127,139,116,128,140,117,129,141,118,130,
+ * 142,119,131,143,120,132,144,121,133,145,122,134,146,123,135,147,
+ * 124,136,148,125,137,149,150,164,178,151,165,179,152,166,180,153,
+ * 167,181,154,168,182,155,169,183,156,170,184,157,171,185,158,172,
+ * 186,159,173,187,160,174,188,161,175,189,162,176,190,163,177,191,
+ * 192,208,224,193,209,225,194,210,226,195,211,227,196,212,228,197,
+ * 213,229,198,214,230,199,215,231,200,216,232,201,217,233,202,218,
+ * 234,203,219,235,204,220,236,205,221,237,206,222,238,207,223,239,
+ * 240,260,280,241,261,281,242,262,282,243,263,283,244,264,284,245,
+ * 265,285,246,266,286,247,267,287,248,268,288,249,269,289,250,270,
+ * 290,251,271,291,252,272,292,253,273,293,254,274,294,255,275,295,
+ * 256,276,296,257,277,297,258,278,298,259,279,299,300,326,352,301,
+ * 327,353,302,328,354,303,329,355,304,330,356,305,331,357,306,332,
+ * 358,307,333,359,308,334,360,309,335,361,310,336,362,311,337,363,
+ * 312,338,364,313,339,365,314,340,366,315,341,367,316,342,368,317,
+ * 343,369,318,344,370,319,345,371,320,346,372,321,347,373,322,348,
+ * 374,323,349,375,324,350,376,325,351,377,378,444,510,379,445,511,
+ * 380,446,512,381,447,513,382,448,514,383,449,515,384,450,516,385,
+ * 451,517,386,452,518,387,453,519,388,454,520,389,455,521,390,456,
+ * 522,391,457,523,392,458,524,393,459,525,394,460,526,395,461,527,
+ * 396,462,528,397,463,529,398,464,530,399,465,531,400,466,532,401,
+ * 467,533,402,468,534,403,469,535,404,470,536,405,471,537,406,472,
+ * 538,407,473,539,408,474,540,409,475,541,410,476,542,411,477,543,
+ * 412,478,544,413,479,545,414,480,546,415,481,547,416,482,548,417,
+ * 483,549,418,484,550,419,485,551,420,486,552,421,487,553,422,488,
+ * 554,423,489,555,424,490,556,425,491,557,426,492,558,427,493,559,
+ * 428,494,560,429,495,561,430,496,562,431,497,563,432,498,564,433,
+ * 499,565,434,500,566,435,501,567,436,502,568,437,503,569,438,504,
+ * 570,439,505,571,440,506,572,441,507,573,442,508,574,443,509,575}, { 0, 4,
+ * 8, 1, 5, 9, 2, 6, 10, 3, 7, 11, 12, 16, 20, 13, 17, 21, 14, 18, 22, 15, 19,
+ * 23, 24, 28, 32, 25, 29, 33, 26, 30, 34, 27, 31, 35, 36, 40, 44, 37, 41, 45,
+ * 38, 42, 46, 39, 43, 47, 48, 54, 60, 49, 55, 61, 50, 56, 62, 51, 57, 63, 52,
+ * 58, 64, 53, 59, 65, 66, 74, 82, 67, 75, 83, 68, 76, 84, 69, 77, 85, 70, 78,
+ * 86, 71, 79, 87, 72, 80, 88, 73, 81, 89, 90,102,114, 91,103,115, 92,104,116,
+ * 93,105,117, 94,106,118, 95,107,119, 96,108,120, 97, 109,121, 98,110,122,
+ * 99,111,123,100,112,124,101,113,125,126,142,
+ * 158,127,143,159,128,144,160,129,145,161,130,146,162,131,147,163,
+ * 132,148,164,133,149,165,134,150,166,135,151,167,136,152,168,137,
+ * 153,169,138,154,170,139,155,171,140,156,172,141,157,173,174,194,
+ * 214,175,195,215,176,196,216,177,197,217,178,198,218,179,199,219,
+ * 180,200,220,181,201,221,182,202,222,183,203,223,184,204,224,185,
+ * 205,225,186,206,226,187,207,227,188,208,228,189,209,229,190,210,
+ * 230,191,211,231,192,212,232,193,213,233,234,260,286,235,261,287,
+ * 236,262,288,237,263,289,238,264,290,239,265,291,240,266,292,241,
+ * 267,293,242,268,294,243,269,295,244,270,296,245,271,297,246,272,
+ * 298,247,273,299,248,274,300,249,275,301,250,276,302,251,277,303,
+ * 252,278,304,253,279,305,254,280,306,255,281,307,256,282,308,257,
+ * 283,309,258,284,310,259,285,311,312,346,380,313,347,381,314,348,
+ * 382,315,349,383,316,350,384,317,351,385,318,352,386,319,353,387,
+ * 320,354,388,321,355,389,322,356,390,323,357,391,324,358,392,325,
+ * 359,393,326,360,394,327,361,395,328,362,396,329,363,397,330,364,
+ * 398,331,365,399,332,366,400,333,367,401,334,368,402,335,369,403,
+ * 336,370,404,337,371,405,338,372,406,339,373,407,340,374,408,341,
+ * 375,409,342,376,410,343,377,411,344,378,412,345,379,413,414,456,
+ * 498,415,457,499,416,458,500,417,459,501,418,460,502,419,461,503,
+ * 420,462,504,421,463,505,422,464,506,423,465,507,424,466,508,425,
+ * 467,509,426,468,510,427,469,511,428,470,512,429,471,513,430,472,
+ * 514,431,473,515,432,474,516,433,475,517,434,476,518,435,477,519,
+ * 436,478,520,437,479,521,438,480,522,439,481,523,440,482,524,441,
+ * 483,525,442,484,526,443,485,527,444,486,528,445,487,529,446,488,
+ * 530,447,489,531,448,490,532,449,491,533,450,492,534,451,493,535,
+ * 452,494,536,453,495,537,454,496,538,455,497,539,540,552,564,541,
+ * 553,565,542,554,566,543,555,567,544,556,568,545,557,569,546,558,
+ * 570,547,559,571,548,560,572,549,561,573,550,562,574,551,563,575} };
+ */
+
+ private static final float cs[] = { 0.857492925712f, 0.881741997318f, 0.949628649103f,
+ 0.983314592492f, 0.995517816065f, 0.999160558175f, 0.999899195243f, 0.999993155067f };
+
+ private static final float ca[] = { -0.5144957554270f, -0.4717319685650f, -0.3133774542040f,
+ -0.1819131996110f, -0.0945741925262f, -0.0409655828852f, -0.0141985685725f,
+ -0.00369997467375f };
+
+ /************************************************************/
+ /* END OF L3TABLE */
+ /************************************************************/
+
+ /************************************************************/
+ /* L3TYPE */
+ /************************************************************/
+
+ /***************************************************************/
+ /* END OF L3TYPE */
+ /***************************************************************/
+
+ /***************************************************************/
+ /* INV_MDCT */
+ /***************************************************************/
+ public static final float win[][] = {
+ { -1.6141214951E-02f, -5.3603178919E-02f, -1.0070713296E-01f, -1.6280817573E-01f,
+ -4.9999999679E-01f, -3.8388735032E-01f, -6.2061144372E-01f, -1.1659756083E+00f,
+ -3.8720752656E+00f, -4.2256286556E+00f, -1.5195289984E+00f, -9.7416483388E-01f,
+ -7.3744074053E-01f, -1.2071067773E+00f, -5.1636156596E-01f, -4.5426052317E-01f,
+ -4.0715656898E-01f, -3.6969460527E-01f, -3.3876269197E-01f, -3.1242222492E-01f,
+ -2.8939587111E-01f, -2.6880081906E-01f, -5.0000000266E-01f, -2.3251417468E-01f,
+ -2.1596714708E-01f, -2.0004979098E-01f, -1.8449493497E-01f, -1.6905846094E-01f,
+ -1.5350360518E-01f, -1.3758624925E-01f, -1.2103922149E-01f, -2.0710679058E-01f,
+ -8.4752577594E-02f, -6.4157525656E-02f, -4.1131172614E-02f, -1.4790705759E-02f },
+
+ { -1.6141214951E-02f, -5.3603178919E-02f, -1.0070713296E-01f, -1.6280817573E-01f,
+ -4.9999999679E-01f, -3.8388735032E-01f, -6.2061144372E-01f, -1.1659756083E+00f,
+ -3.8720752656E+00f, -4.2256286556E+00f, -1.5195289984E+00f, -9.7416483388E-01f,
+ -7.3744074053E-01f, -1.2071067773E+00f, -5.1636156596E-01f, -4.5426052317E-01f,
+ -4.0715656898E-01f, -3.6969460527E-01f, -3.3908542600E-01f, -3.1511810350E-01f,
+ -2.9642226150E-01f, -2.8184548650E-01f, -5.4119610000E-01f, -2.6213228100E-01f,
+ -2.5387916537E-01f, -2.3296291359E-01f, -1.9852728987E-01f, -1.5233534808E-01f,
+ -9.6496400054E-02f, -3.3423828516E-02f, 0.0000000000E+00f, 0.0000000000E+00f,
+ 0.0000000000E+00f, 0.0000000000E+00f, 0.0000000000E+00f, 0.0000000000E+00f },
+
+ { -4.8300800645E-02f, -1.5715656932E-01f, -2.8325045177E-01f, -4.2953747763E-01f,
+ -1.2071067795E+00f, -8.2426483178E-01f, -1.1451749106E+00f, -1.7695290101E+00f,
+ -4.5470225061E+00f, -3.4890531002E+00f, -7.3296292804E-01f, -1.5076514758E-01f,
+ 0.0000000000E+00f, 0.0000000000E+00f, 0.0000000000E+00f, 0.0000000000E+00f,
+ 0.0000000000E+00f, 0.0000000000E+00f, 0.0000000000E+00f, 0.0000000000E+00f,
+ 0.0000000000E+00f, 0.0000000000E+00f, 0.0000000000E+00f, 0.0000000000E+00f,
+ 0.0000000000E+00f, 0.0000000000E+00f, 0.0000000000E+00f, 0.0000000000E+00f,
+ 0.0000000000E+00f, 0.0000000000E+00f, 0.0000000000E+00f, 0.0000000000E+00f,
+ 0.0000000000E+00f, 0.0000000000E+00f, 0.0000000000E+00f, 0.0000000000E+00f },
+
+ { 0.0000000000E+00f, 0.0000000000E+00f, 0.0000000000E+00f, 0.0000000000E+00f,
+ 0.0000000000E+00f, 0.0000000000E+00f, -1.5076513660E-01f, -7.3296291107E-01f,
+ -3.4890530566E+00f, -4.5470224727E+00f, -1.7695290031E+00f, -1.1451749092E+00f,
+ -8.3137738100E-01f, -1.3065629650E+00f, -5.4142014250E-01f, -4.6528974900E-01f,
+ -4.1066990750E-01f, -3.7004680800E-01f, -3.3876269197E-01f, -3.1242222492E-01f,
+ -2.8939587111E-01f, -2.6880081906E-01f, -5.0000000266E-01f, -2.3251417468E-01f,
+ -2.1596714708E-01f, -2.0004979098E-01f, -1.8449493497E-01f, -1.6905846094E-01f,
+ -1.5350360518E-01f, -1.3758624925E-01f, -1.2103922149E-01f, -2.0710679058E-01f,
+ -8.4752577594E-02f, -6.4157525656E-02f, -4.1131172614E-02f, -1.4790705759E-02f } };
+
+ /***************************************************************/
+ /* END OF INV_MDCT */
+ /***************************************************************/
+
+ public static final int nr_of_sfb_block[][][] = {
+ { { 6, 5, 5, 5 }, { 9, 9, 9, 9 }, { 6, 9, 9, 9 } },
+ { { 6, 5, 7, 3 }, { 9, 9, 12, 6 }, { 6, 9, 12, 6 } },
+ { { 11, 10, 0, 0 }, { 18, 18, 0, 0 }, { 15, 18, 0, 0 } },
+ { { 7, 7, 7, 0 }, { 12, 12, 12, 0 }, { 6, 15, 12, 0 } },
+ { { 6, 6, 6, 3 }, { 12, 9, 9, 6 }, { 6, 12, 9, 6 } },
+ { { 8, 8, 5, 0 }, { 15, 12, 9, 0 }, { 6, 18, 9, 0 } } };
+
+}
--- /dev/null
+public @interface METHODDEFAULT{
+ String value();
+}
--- /dev/null
+// command line player for MPEG audio file
+public class MP3Player {
+
+ private String filename = null;
+
+ public static void main(@DELEGATE String args[]) {
+
+ MP3Player player = new MP3Player();
+ player.init(args);
+
+ }
+
+ private void init(@DELEGATE String[] args) {
+ if (args.length == 1) {
+ filename = args[0];
+ }
+ play();
+ }
+
+ /**
+ * Playing file from FileInputStream.
+ */
+ // protected InputStream getInputStream() throws IOException {
+ // FileInputStream fin = new FileInputStream(filename);
+ // BufferedInputStream bin = new BufferedInputStream(fin);
+ // return bin;
+ // }
+
+ public void play() throws JavaLayerException {
+ try {
+ System.out.println("playing " + filename + "...");
+ BitstreamWrapper.init(filename);
+ AudioDevice dev = new AudioDevice();
+ Player player = new Player(dev);
+ player.play();
+ } catch (IOException ex) {
+ throw new JavaLayerException("Problem playing file " + filename, ex);
+ }
+ }
+
+}
\ No newline at end of file
--- /dev/null
+/*\r
+ * 11/19/04 1.0 moved to LGPL. \r
+ *-----------------------------------------------------------------------\r
+ * This program is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU Library General Public License as published\r
+ * by the Free Software Foundation; either version 2 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Library General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU Library General Public\r
+ * License along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\r
+ *----------------------------------------------------------------------\r
+ */\r
+\r
+\r
+/**\r
+ * Work in progress.\r
+ * \r
+ * Manages a number of controls.\r
+ */\r
+public class Manager //implements Control\r
+{\r
+ public void addControl(Control c)\r
+ {\r
+ \r
+ }\r
+ \r
+ public void removeControl(Control c)\r
+ {\r
+ \r
+ }\r
+ \r
+ public void removeAll()\r
+ {\r
+ \r
+ }\r
+ \r
+ // control interface delegates to a managed control\r
+ \r
+}\r
--- /dev/null
+/*
+ * 11/19/04 1.0 moved to LGPL.
+ * 12/12/99 Added appendSamples() method for efficiency. MDM.
+ * 15/02/99 ,Java Conversion by E.B ,ebsp@iname.com, JavaLayer
+ *
+ * Declarations for output buffer, includes operating system
+ * implementation of the virtual Obuffer. Optional routines
+ * enabling seeks and stops added by Jeff Tsay.
+ *
+ * @(#) obuffer.h 1.8, last edit: 6/15/94 16:51:56
+ * @(#) Copyright (C) 1993, 1994 Tobias Bading (bading@cs.tu-berlin.de)
+ * @(#) Berlin University of Technology
+ *
+ * Idea and first implementation for u-law output with fast downsampling by
+ * Jim Boucher (jboucher@flash.bu.edu)
+ *
+ * LinuxObuffer class written by
+ * Louis P. Kruger (lpkruger@phoenix.princeton.edu)
+ *-----------------------------------------------------------------------
+ * 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.
+ *----------------------------------------------------------------------
+ */
+
+/**
+ * Base Class for audio output.
+ */
+@LATTICE("")
+@METHODDEFAULT("D<IN,D<C,C*,THISLOC=D")
+public abstract class Obuffer {
+ public static final int OBUFFERSIZE = 2 * 1152; // max. 2 * 1152 samples per
+ // frame
+ public static final int MAXCHANNELS = 2; // max. number of channels
+
+ /**
+ * Takes a 16 Bit PCM sample.
+ */
+ public abstract void append(@LOC("D") int channel, @LOC("D") short value);
+
+ /**
+ * Accepts 32 new PCM samples.
+ */
+ @LATTICE("S<IN,IN<C,C*,THISLOC=IN")
+ public void appendSamples(@LOC("IN") int channel, @LOC("IN") float[] f) {
+ @LOC("S") short s;
+ for (@LOC("C") int i = 0; i < 32;) {
+ s = clip(f[i++]);
+ append(channel, s);
+ }
+ }
+
+ /**
+ * Clip Sample to 16 Bits
+ */
+ @LATTICE("THIS,OUT<IN,RETURNLOC=OUT,THISLOC=THIS")
+ private final short clip(@LOC("IN") float sample) {
+
+ @LOC("OUT") short s = (short) sample;
+
+ if (sample > 32767.0f) {
+ s = (short) 32767;
+ } else if (sample < -32768.0f) {
+ s = (short) -32768;
+ }
+
+ return s;
+
+ }
+
+ /**
+ * Write the samples to the file or directly to the audio hardware.
+ */
+ public abstract void write_buffer(@LOC("IN") int val);
+
+ public abstract void close();
+
+ /**
+ * Clears all data in the buffer (for seeking).
+ */
+ public abstract void clear_buffer();
+
+ /**
+ * Notify the buffer that the user has stopped the stream.
+ */
+ public abstract void set_stop_flag();
+}
--- /dev/null
+/*\r
+ * 11/19/04 1.0 moved to LGPL.\r
+ * 12/12/99 Initial implementation. mdm@techie.com. \r
+ *-----------------------------------------------------------------------\r
+ * This program is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU Library General Public License as published\r
+ * by the Free Software Foundation; either version 2 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Library General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU Library General Public\r
+ * License along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\r
+ *----------------------------------------------------------------------\r
+ */\r
+\r
+/**\r
+ * A Type-safe representation of the the supported output channel constants.\r
+ * \r
+ * This class is immutable and, hence, is thread safe.\r
+ * \r
+ * @author Mat McGowan 12/12/99\r
+ * @since 0.0.7\r
+ */\r
+@LATTICE("B<T")\r
+@METHODDEFAULT("OUT<THIS,THIS<IN,THISLOC=THIS,RETURNLOC=OUT")\r
+public class OutputChannels {\r
+ /**\r
+ * Flag to indicate output should include both channels.\r
+ */\r
+ public static final int BOTH_CHANNELS = 0;\r
+\r
+ /**\r
+ * Flag to indicate output should include the left channel only.\r
+ */\r
+ public static final int LEFT_CHANNEL = 1;\r
+\r
+ /**\r
+ * Flag to indicate output should include the right channel only.\r
+ */\r
+ public static final int RIGHT_CHANNEL = 2;\r
+\r
+ /**\r
+ * Flag to indicate output is mono.\r
+ */\r
+ public static final int DOWNMIX_CHANNELS = 3;\r
+\r
+ public static final OutputChannels LEFT = new OutputChannels(LEFT_CHANNEL);\r
+ public static final OutputChannels RIGHT = new OutputChannels(RIGHT_CHANNEL);\r
+ public static final OutputChannels BOTH = new OutputChannels(BOTH_CHANNELS);\r
+ public static final OutputChannels DOWNMIX = new OutputChannels(DOWNMIX_CHANNELS);\r
+\r
+ @LOC("T")\r
+ private/* final */int outputChannels;\r
+\r
+ /**\r
+ * Creates an <code>OutputChannels</code> instance corresponding to the given\r
+ * channel code.\r
+ * \r
+ * @param code\r
+ * one of the OutputChannels channel code constants.\r
+ * \r
+ * @throws IllegalArgumentException\r
+ * if code is not a valid channel code.\r
+ */\r
+ static public OutputChannels fromInt(int code) {\r
+ switch (code) {\r
+ case LEFT_CHANNEL:\r
+ return LEFT;\r
+ case RIGHT_CHANNEL:\r
+ return RIGHT;\r
+ case BOTH_CHANNELS:\r
+ return BOTH;\r
+ case DOWNMIX_CHANNELS:\r
+ return DOWNMIX;\r
+ default:\r
+ throw new IllegalArgumentException("Invalid channel code: " + code);\r
+ }\r
+ }\r
+\r
+ public OutputChannels(@LOC("IN") int channels) {\r
+ outputChannels = channels;\r
+\r
+ if (channels < 0 || channels > 3)\r
+ throw new IllegalArgumentException("channels");\r
+ }\r
+\r
+ /**\r
+ * Retrieves the code representing the desired output channels. Will be one of\r
+ * LEFT_CHANNEL, RIGHT_CHANNEL, BOTH_CHANNELS or DOWNMIX_CHANNELS.\r
+ * \r
+ * @return the channel code represented by this instance.\r
+ */\r
+ public int getChannelsOutputCode() {\r
+ return outputChannels;\r
+ }\r
+\r
+ /**\r
+ * Retrieves the number of output channels represented by this channel output\r
+ * type.\r
+ * \r
+ * @return The number of output channels for this channel output type. This\r
+ * will be 2 for BOTH_CHANNELS only, and 1 for all other types.\r
+ */\r
+ public int getChannelCount() {\r
+ int count = (outputChannels == BOTH_CHANNELS) ? 2 : 1;\r
+ return count;\r
+ }\r
+\r
+ public boolean equals(Object o) {\r
+ boolean equals = false;\r
+\r
+ if (o instanceof OutputChannels) {\r
+ OutputChannels oc = (OutputChannels) o;\r
+ equals = (oc.outputChannels == outputChannels);\r
+ }\r
+\r
+ return equals;\r
+ }\r
+\r
+ public int hashCode() {\r
+ return outputChannels;\r
+ }\r
+\r
+}\r
--- /dev/null
+import java.awt.image.SampleModel;\r
+\r
+import FileOutputStream;\r
+\r
+/*\r
+ * 11/19/04 1.0 moved to LGPL.\r
+ * 29/01/00 Initial version. mdm@techie.com\r
+ *-----------------------------------------------------------------------\r
+ * This program is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU Library General Public License as published\r
+ * by the Free Software Foundation; either version 2 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Library General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU Library General Public\r
+ * License along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\r
+ *----------------------------------------------------------------------\r
+ */\r
+\r
+/**\r
+ * The <code>Player</code> class implements a simple player for playback of an\r
+ * MPEG audio stream.\r
+ * \r
+ * @author Mat McGowan\r
+ * @since 0.0.8\r
+ */\r
+\r
+// REVIEW: the audio device should not be opened until the\r
+// first MPEG audio frame has been decoded.\r
+@LATTICE("B<DE,DE<ST,DE<HE,HE<ST,ST<FR")\r
+public class Player {\r
+ /**\r
+ * The current frame number.\r
+ */\r
+ @LOC("FR")\r
+ private int frame = 0;\r
+\r
+ /**\r
+ * The MPEG audio bitstream.\r
+ */\r
+ // private Bitstream bitstream;\r
+\r
+ /**\r
+ * The MPEG audio decoder.\r
+ */\r
+ /* final */@LOC("DE")\r
+ private Decoder decoder;\r
+\r
+ /**\r
+ * The AudioDevice the audio samples are written to.\r
+ */\r
+ // private AudioDevice audio;\r
+\r
+ /**\r
+ * Has the player been closed?\r
+ */\r
+ @LOC("B")\r
+ private boolean closed = false;\r
+\r
+ /**\r
+ * Has the player played back all frames from the stream?\r
+ */\r
+ @LOC("B")\r
+ private boolean complete = false;\r
+\r
+ @LOC("B")\r
+ private int lastPosition = 0;\r
+\r
+ /**\r
+ * Creates a new <code>Player</code> instance.\r
+ */\r
+ public Player() throws JavaLayerException {\r
+ this(null);\r
+ }\r
+\r
+ public Player(AudioDevice device) throws JavaLayerException {\r
+ // bitstream = new Bitstream(stream);\r
+ decoder = new Decoder();\r
+\r
+ // if (device!=null)\r
+ // {\r
+ // audio = device;\r
+ // }\r
+ // else\r
+ // {\r
+ // FactoryRegistry r = FactoryRegistry.systemRegistry();\r
+ // audio = r.createAudioDevice();\r
+ // }\r
+\r
+ device.open(decoder);\r
+ }\r
+\r
+ public void play() throws JavaLayerException {\r
+ play(Integer.MAX_VALUE);\r
+ }\r
+\r
+ /**\r
+ * Plays a number of MPEG audio frames.\r
+ * \r
+ * @param frames\r
+ * The number of frames to play.\r
+ * @return true if the last frame was played, or false if there are more\r
+ * frames.\r
+ */\r
+ @LATTICE("OUT<THIS,THIS<IN,IN*,THISLOC=THIS")\r
+ @RETURNLOC("OUT")\r
+ public boolean play(@LOC("IN") int frames) throws JavaLayerException {\r
+ @LOC("OUT") boolean ret = true;\r
+\r
+ // initialization before ssjava loop\r
+ @LOC("THIS,Player.FR") boolean init = true;\r
+ @LOC("THIS,Player.ST") Header h = BitstreamWrapper.readFrame();\r
+ decoder.init(h);\r
+\r
+ @LOC("IN") int count = 0;\r
+ SSJAVA: while (count++ < 2147483646) {\r
+ if (h == null) {\r
+ break;\r
+ }\r
+ ret = decodeFrame(init, h);\r
+ if (!ret) {\r
+ break;\r
+ }\r
+ h = BitstreamWrapper.readFrame();\r
+ }\r
+\r
+ /*\r
+ * if (!ret) { // last frame, ensure all data flushed to the audio device.\r
+ * AudioDevice out = audio; if (out!=null) { out.flush(); synchronized\r
+ * (this) { complete = (!closed); close(); } } }\r
+ */\r
+ return ret;\r
+ }\r
+\r
+ /**\r
+ * Cloases this player. Any audio currently playing is stopped immediately.\r
+ */\r
+\r
+ public synchronized void close() {\r
+ /*\r
+ * AudioDevice out = audio; if (out!=null) { closed = true; audio = null; //\r
+ * this may fail, so ensure object state is set up before // calling this\r
+ * method. out.close(); lastPosition = out.getPosition(); try {\r
+ * bitstream.close(); } catch (BitstreamException ex) { } }\r
+ */\r
+ }\r
+\r
+ /**\r
+ * Returns the completed status of this player.\r
+ * \r
+ * @return true if all available MPEG audio frames have been decoded, or false\r
+ * otherwise.\r
+ */\r
+ public synchronized boolean isComplete() {\r
+ return complete;\r
+ }\r
+\r
+ /**\r
+ * Retrieves the position in milliseconds of the current audio sample being\r
+ * played. This method delegates to the <code>\r
+ * AudioDevice</code> that is used by this player to sound the decoded audio\r
+ * samples.\r
+ */\r
+ public int getPosition() {\r
+ // int position = lastPosition;\r
+\r
+ // AudioDevice out = audio;\r
+ // if (out!=null)\r
+ // {\r
+ // position = out.getPosition();\r
+ // }\r
+ // return position;\r
+ return 0;\r
+ }\r
+\r
+ /**\r
+ * Decodes a single frame.\r
+ * \r
+ * @return true if there are no more frames to decode, false otherwise.\r
+ */\r
+ @LATTICE("C<THIS,O<THIS,THIS<IN,C*,THISLOC=THIS,RETURNLOC=O,GLOBALLOC=THIS")\r
+ protected boolean decodeFrame(@LOC("THIS,Player.FR") boolean init, @LOC("THIS,Player.ST") Header h)\r
+ throws JavaLayerException {\r
+ try {\r
+ // AudioDevice out = audio;\r
+ // if (out==null)\r
+ // return false;\r
+\r
+ // Header h = bitstream.readFrame();\r
+\r
+ // if (h == null){\r
+ // return false;\r
+ // }\r
+\r
+ // @LOC("O") SampleBuffer output = (SampleBuffer) decoder.decodeFrame(h);\r
+ decoder.decodeFrame(h);\r
+\r
+ // eom debug\r
+ @LOC("C") int sum = 0;\r
+ @LOC("C") short[] outbuf = SampleBufferWrapper.getBuffer();\r
+ // short[] outbuf = output.getBuffer();\r
+ TERMINATE: for (@LOC("C") int i = 0; i < SampleBufferWrapper.getBufferLength(); i++) {\r
+ // System.out.println(outbuf[i]);\r
+ sum += outbuf[i];\r
+ }\r
+ System.out.println(sum);\r
+ //\r
+\r
+ // synchronized (this)\r
+ // {\r
+ // out = audio;\r
+ // if (out!=null)\r
+ // {\r
+ // out.write(output.getBuffer(), 0, output.getBufferLength());\r
+ // }\r
+ // }\r
+\r
+ // bitstream.closeFrame();\r
+ } catch (RuntimeException ex) {\r
+ throw new JavaLayerException("Exception decoding audio frame", ex);\r
+ }\r
+ /*\r
+ * catch (IOException ex) {\r
+ * System.out.println("exception decoding audio frame: "+ex); return false;\r
+ * } catch (BitstreamException bitex) {\r
+ * System.out.println("exception decoding audio frame: "+bitex); return\r
+ * false; } catch (DecoderException decex) {\r
+ * System.out.println("exception decoding audio frame: "+decex); return\r
+ * false; }\r
+ */\r
+ return true;\r
+ }\r
+\r
+}\r
--- /dev/null
+/*
+ * 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 <code>SampleBuffer</code> class implements an output buffer that provides
+ * storage for a fixed size block of samples.
+ */
+@LATTICE("BUF<BUFP,BUFP<IDX,IDX<CONT,BUFP*,IDX*")
+@METHODDEFAULT("D<IN,D<C,C*,THISLOC=D")
+public class SampleBuffer extends Obuffer {
+ @LOC("BUF")
+ private short[] buffer;
+ @LOC("BUFP")
+ private int[] bufferp;
+ @LOC("CONT")
+ private int channels;
+ @LOC("CONT")
+ private int frequency;
+ @LOC("IDX")
+ private int idx;
+
+ /**
+ * Constructor
+ */
+ public SampleBuffer(@LOC("IN") int sample_frequency, @LOC("IN") int number_of_channels) {
+ buffer = new short[OBUFFERSIZE];
+ bufferp = new int[MAXCHANNELS];
+ channels = number_of_channels; // [IN] -> [D]
+ frequency = sample_frequency; // [IN] -> [D]
+
+ for (@LOC("C") 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(@LOC("IN") int channel, @LOC("IN") 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]
+
+ }
+
+ @LATTICE("D<IN,IN<C,THISLOC=D,C*")
+ public void appendSamples(@LOC("IN") int channel, @LOC("IN") float[] f) {
+ @LOC("D,SampleBuffer.BUFP") int pos = bufferp[channel];
+ // LOC(bufferp[channel])=[D,SampleBuffer.BUFP]
+ // LOC(pos)=[D,SampleBuffer.BUFP]
+
+ @LOC("D,SampleBuffer.BUFP") short s;
+ @LOC("D,SampleBuffer.BUFP") float fs;
+
+ for (@LOC("C") 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;
+ // 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(@LOC("IN") 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() {
+ }
+}
--- /dev/null
+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);
+ }
+
+}
--- /dev/null
+@LATTICE("BUF<IDX,V,IDX*")
+@METHODDEFAULT("THIS<IN,THISLOC=THIS,RETURNLOC=THIS")
+public class SideInfoBuffer {
+
+ /**
+ * The frame buffer that holds the data for the current frame.
+ */
+ @LOC("BUF")
+ 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 <code>framebuffer</code> where the next bits are retrieved.
+ */
+ @LOC("IDX")
+ private int wordpointer;
+
+ /**
+ * Number (0-31, from MSB to LSB) of next bit for get_bits()
+ */
+ @LOC("IDX")
+ private int bitindex;
+
+ @LOC("V")
+ private int main_data_begin;
+
+ public int getMain_data_begin() {
+ return main_data_begin;
+ }
+
+ public void setMain_data_begin(@LOC("IN") 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 };
+
+ @LATTICE("OUT<THIS,THIS<IN,OUT*,THISLOC=THIS,RETURNLOC=OUT")
+ public int get_bits(@LOC("IN") int number_of_bits) {
+ @LOC("OUT") int returnvalue = 0;
+ @LOC("THIS,SideInfoBuffer.IDX") 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];
+ @LOC("OUT") int Right = (framebuffer[wordpointer] & 0x0000FFFF);
+ wordpointer++;
+ @LOC("OUT") 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;
+ }
+
+}
--- /dev/null
+/*\r
+ * 11/19/04 1.0 moved to LGPL. \r
+ *-----------------------------------------------------------------------\r
+ * This program is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU Library General Public License as published\r
+ * by the Free Software Foundation; either version 2 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Library General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU Library General Public\r
+ * License along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\r
+ *----------------------------------------------------------------------\r
+ */\r
+\r
+\r
+import java.io.IOException;\r
+\r
+/**\r
+ * Work in progress.\r
+ * \r
+ * Class to describe a seekable data source. \r
+ * \r
+ */\r
+public interface Source\r
+{\r
+ \r
+ public static final long LENGTH_UNKNOWN = -1;\r
+ \r
+ public int read(byte[] b, int offs, int len)\r
+ throws IOException;\r
+ \r
+ \r
+ public boolean willReadBlock();\r
+ \r
+ public boolean isSeekable();\r
+ \r
+ public long length();\r
+ \r
+ public long tell();\r
+ \r
+ public long seek(long pos);\r
+ \r
+}\r
--- /dev/null
+//package ssJava.mp3decoder;
+
+/**
+ * Abstract base class for subband classes of layer I and II
+ */
+@LATTICE("S<L,L<H,H<SH,SH<SH0")
+@METHODDEFAULT("OUT<V,V<THIS,THIS<C,C<IN,C*,THISLOC=THIS,RETURNLOC=OUT")
+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(@LOC("IN") Bitstream stream, @LOC("IN") Header header,
+ @LOC("IN") Crc16 crc) throws DecoderException;
+
+ public abstract void read_scalefactor(@LOC("IN") Bitstream stream, @LOC("IN") Header header);
+
+ @RETURNLOC("OUT")
+ public abstract boolean read_sampledata(@LOC("IN") Bitstream stream);
+
+ @RETURNLOC("OUT")
+ public abstract boolean put_next_sample(@LOC("IN") int channels,
+ @LOC("IN") SynthesisFilter filter1, @LOC("IN") SynthesisFilter filter2);
+};
--- /dev/null
+/*\r
+ * 11/19/04 1.0 moved to LGPL.\r
+ * \r
+ * 04/01/00 Fixes for running under build 23xx Microsoft JVM. mdm.\r
+ * \r
+ * 19/12/99 Performance improvements to compute_pcm_samples(). \r
+ * Mat McGowan. mdm@techie.com. \r
+ *\r
+ * 16/02/99 Java Conversion by E.B , javalayer@javazoom.net\r
+ *\r
+ * @(#) synthesis_filter.h 1.8, last edit: 6/15/94 16:52:00\r
+ * @(#) Copyright (C) 1993, 1994 Tobias Bading (bading@cs.tu-berlin.de)\r
+ * @(#) Berlin University of Technology\r
+ *\r
+ *-----------------------------------------------------------------------\r
+ * This program is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU Library General Public License as published\r
+ * by the Free Software Foundation; either version 2 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Library General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU Library General Public\r
+ * License along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\r
+ *----------------------------------------------------------------------\r
+ */\r
+\r
+/**\r
+ * A class for the synthesis filter bank. This class does a fast downsampling\r
+ * from 32, 44.1 or 48 kHz to 8 kHz, if ULAW is defined. Frequencies above 4 kHz\r
+ * are removed by ignoring higher subbands.\r
+ */\r
+@LATTICE("OUT<V2,V2<V1,V1<V,V<NEWV,NEWV<SAMPLE,SAMPLE<EQ,EQ<IDX,V*,NEWV*,IDX*")\r
+@METHODDEFAULT("OUT<THIS,THIS<C,C<IN,C*,THISLOC=THIS,GLOBALLOC=THIS")\r
+final class SynthesisFilter {\r
+\r
+ @LOC("IDX")\r
+ public int vidx;\r
+ @LOC("V1")\r
+ public float[] v1;\r
+ @LOC("V1")\r
+ public float[] v2;\r
+\r
+ @LOC("V")\r
+ public float[] prev1;\r
+ @LOC("V")\r
+ public float[] prev2;\r
+\r
+ // private float[] actual_v; // v1 or v2\r
+ @LOC("IDX")\r
+ public int actual_write_pos; // 0-15\r
+ @LOC("SAMPLE")\r
+ private float[] samples; // 32 new subband samples\r
+ @LOC("EQ")\r
+ public final int channel;\r
+ @LOC("EQ")\r
+ public final float scalefactor;\r
+ @LOC("EQ")\r
+ private float[] eq;\r
+\r
+ /**\r
+ * Quality value for controlling CPU usage/quality tradeoff.\r
+ */\r
+ /*\r
+ * private int quality;\r
+ * \r
+ * private int v_inc;\r
+ * \r
+ * \r
+ * \r
+ * public static final int HIGH_QUALITY = 1; public static final int\r
+ * MEDIUM_QUALITY = 2; public static final int LOW_QUALITY = 4;\r
+ */\r
+\r
+ /**\r
+ * Contructor. The scalefactor scales the calculated float pcm samples to\r
+ * short values (raw pcm samples are in [-1.0, 1.0], if no violations occur).\r
+ */\r
+ public SynthesisFilter(int channelnumber, float factor, float[] eq0) {\r
+\r
+ vidx = 1;\r
+ d16 = splitArray(d, 16);\r
+\r
+ v1 = new float[512];\r
+ v2 = new float[512];\r
+ prev1 = new float[512];\r
+ prev2 = new float[512];\r
+ samples = new float[32];\r
+ channel = channelnumber;\r
+ scalefactor = factor;\r
+ // setEQ(eq);\r
+ // setQuality(HIGH_QUALITY);\r
+\r
+ if (eq == null) {\r
+ eq = new float[32];\r
+ for (int i = 0; i < 32; i++)\r
+ eq[i] = 1.0f;\r
+ }\r
+ if (eq.length < 32) {\r
+ throw new IllegalArgumentException("eq0");\r
+ }\r
+\r
+ // reset();\r
+\r
+ for (int p = 0; p < 512; p++)\r
+ v1[p] = v2[p] = 0.0f;\r
+\r
+ for (int p2 = 0; p2 < 32; p2++)\r
+ samples[p2] = 0.0f;\r
+\r
+ // actual_v = v1;\r
+ actual_write_pos = 15;\r
+\r
+ }\r
+\r
+ /*\r
+ * private void setQuality(int quality0) { switch (quality0) { case\r
+ * HIGH_QUALITY: case MEDIUM_QUALITY: case LOW_QUALITY: v_inc = 16 * quality0;\r
+ * quality = quality0; break; default : throw new\r
+ * IllegalArgumentException("Unknown quality value"); } }\r
+ * \r
+ * public int getQuality() { return quality; }\r
+ */\r
+\r
+ /**\r
+ * Inject Sample.\r
+ */\r
+ public void input_sample(@LOC("IN") float sample, @LOC("IN") int subbandnumber) {\r
+ samples[subbandnumber] = eq[subbandnumber] * sample;\r
+ }\r
+\r
+ public void input_samples(@LOC("IN") float[] s) {\r
+ TERMINATE: for (@LOC("C") int i = 31; i >= 0; i--) {\r
+ samples[i] = s[i] * eq[i];\r
+ }\r
+ }\r
+\r
+ private void compute_new_v2_v1() {\r
+\r
+ @LOC("THIS,SynthesisFilter.NEWV") float new_v0 = 0.0f;\r
+ @LOC("THIS,SynthesisFilter.NEWV") float new_v1 = 0.0f;\r
+ @LOC("THIS,SynthesisFilter.NEWV") float new_v2 = 0.0f;\r
+ @LOC("THIS,SynthesisFilter.NEWV") float new_v3 = 0.0f;\r
+ @LOC("THIS,SynthesisFilter.NEWV") float new_v4 = 0.0f;\r
+ @LOC("THIS,SynthesisFilter.NEWV") float new_v5 = 0.0f;\r
+ @LOC("THIS,SynthesisFilter.NEWV") float new_v6 = 0.0f;\r
+ @LOC("THIS,SynthesisFilter.NEWV") float new_v7 = 0.0f;\r
+ @LOC("THIS,SynthesisFilter.NEWV") float new_v8 = 0.0f;\r
+ @LOC("THIS,SynthesisFilter.NEWV") float new_v9 = 0.0f;\r
+ @LOC("THIS,SynthesisFilter.NEWV") float new_v10 = 0.0f;\r
+ @LOC("THIS,SynthesisFilter.NEWV") float new_v11 = 0.0f;\r
+ @LOC("THIS,SynthesisFilter.NEWV") float new_v12 = 0.0f;\r
+ @LOC("THIS,SynthesisFilter.NEWV") float new_v13 = 0.0f;\r
+ @LOC("THIS,SynthesisFilter.NEWV") float new_v14 = 0.0f;\r
+ @LOC("THIS,SynthesisFilter.NEWV") float new_v15 = 0.0f;\r
+ @LOC("THIS,SynthesisFilter.NEWV") float new_v16 = 0.0f;\r
+ @LOC("THIS,SynthesisFilter.NEWV") float new_v17 = 0.0f;\r
+ @LOC("THIS,SynthesisFilter.NEWV") float new_v18 = 0.0f;\r
+ @LOC("THIS,SynthesisFilter.NEWV") float new_v19 = 0.0f;\r
+ @LOC("THIS,SynthesisFilter.NEWV") float new_v20 = 0.0f;\r
+ @LOC("THIS,SynthesisFilter.NEWV") float new_v21 = 0.0f;\r
+ @LOC("THIS,SynthesisFilter.NEWV") float new_v22 = 0.0f;\r
+ @LOC("THIS,SynthesisFilter.NEWV") float new_v23 = 0.0f;\r
+ @LOC("THIS,SynthesisFilter.NEWV") float new_v24 = 0.0f;\r
+ @LOC("THIS,SynthesisFilter.NEWV") float new_v25 = 0.0f;\r
+ @LOC("THIS,SynthesisFilter.NEWV") float new_v26 = 0.0f;\r
+ @LOC("THIS,SynthesisFilter.NEWV") float new_v27 = 0.0f;\r
+ @LOC("THIS,SynthesisFilter.NEWV") float new_v28 = 0.0f;\r
+ @LOC("THIS,SynthesisFilter.NEWV") float new_v29 = 0.0f;\r
+ @LOC("THIS,SynthesisFilter.NEWV") float new_v30 = 0.0f;\r
+ @LOC("THIS,SynthesisFilter.NEWV") float new_v31 = 0.0f;\r
+\r
+ // float[] new_v = new float[32]; // new V[0-15] and V[33-48] of Figure\r
+ // 3-A.2 in ISO DIS 11172-3\r
+ // float[] p = new float[16];\r
+ // float[] pp = new float[16];\r
+\r
+ // float[] s = samples;\r
+\r
+ @LOC("THIS,SynthesisFilter.NEWV") float s0 = samples[0];\r
+ @LOC("THIS,SynthesisFilter.NEWV") float s1 = samples[1];\r
+ @LOC("THIS,SynthesisFilter.NEWV") float s2 = samples[2];\r
+ @LOC("THIS,SynthesisFilter.NEWV") float s3 = samples[3];\r
+ @LOC("THIS,SynthesisFilter.NEWV") float s4 = samples[4];\r
+ @LOC("THIS,SynthesisFilter.NEWV") float s5 = samples[5];\r
+ @LOC("THIS,SynthesisFilter.NEWV") float s6 = samples[6];\r
+ @LOC("THIS,SynthesisFilter.NEWV") float s7 = samples[7];\r
+ @LOC("THIS,SynthesisFilter.NEWV") float s8 = samples[8];\r
+ @LOC("THIS,SynthesisFilter.NEWV") float s9 = samples[9];\r
+ @LOC("THIS,SynthesisFilter.NEWV") float s10 = samples[10];\r
+ @LOC("THIS,SynthesisFilter.NEWV") float s11 = samples[11];\r
+ @LOC("THIS,SynthesisFilter.NEWV") float s12 = samples[12];\r
+ @LOC("THIS,SynthesisFilter.NEWV") float s13 = samples[13];\r
+ @LOC("THIS,SynthesisFilter.NEWV") float s14 = samples[14];\r
+ @LOC("THIS,SynthesisFilter.NEWV") float s15 = samples[15];\r
+ @LOC("THIS,SynthesisFilter.NEWV") float s16 = samples[16];\r
+ @LOC("THIS,SynthesisFilter.NEWV") float s17 = samples[17];\r
+ @LOC("THIS,SynthesisFilter.NEWV") float s18 = samples[18];\r
+ @LOC("THIS,SynthesisFilter.NEWV") float s19 = samples[19];\r
+ @LOC("THIS,SynthesisFilter.NEWV") float s20 = samples[20];\r
+ @LOC("THIS,SynthesisFilter.NEWV") float s21 = samples[21];\r
+ @LOC("THIS,SynthesisFilter.NEWV") float s22 = samples[22];\r
+ @LOC("THIS,SynthesisFilter.NEWV") float s23 = samples[23];\r
+ @LOC("THIS,SynthesisFilter.NEWV") float s24 = samples[24];\r
+ @LOC("THIS,SynthesisFilter.NEWV") float s25 = samples[25];\r
+ @LOC("THIS,SynthesisFilter.NEWV") float s26 = samples[26];\r
+ @LOC("THIS,SynthesisFilter.NEWV") float s27 = samples[27];\r
+ @LOC("THIS,SynthesisFilter.NEWV") float s28 = samples[28];\r
+ @LOC("THIS,SynthesisFilter.NEWV") float s29 = samples[29];\r
+ @LOC("THIS,SynthesisFilter.NEWV") float s30 = samples[30];\r
+ @LOC("THIS,SynthesisFilter.NEWV") float s31 = samples[31];\r
+\r
+ @LOC("THIS,SynthesisFilter.NEWV") float p0 = s0 + s31;\r
+ @LOC("THIS,SynthesisFilter.NEWV") float p1 = s1 + s30;\r
+ @LOC("THIS,SynthesisFilter.NEWV") float p2 = s2 + s29;\r
+ @LOC("THIS,SynthesisFilter.NEWV") float p3 = s3 + s28;\r
+ @LOC("THIS,SynthesisFilter.NEWV") float p4 = s4 + s27;\r
+ @LOC("THIS,SynthesisFilter.NEWV") float p5 = s5 + s26;\r
+ @LOC("THIS,SynthesisFilter.NEWV") float p6 = s6 + s25;\r
+ @LOC("THIS,SynthesisFilter.NEWV") float p7 = s7 + s24;\r
+ @LOC("THIS,SynthesisFilter.NEWV") float p8 = s8 + s23;\r
+ @LOC("THIS,SynthesisFilter.NEWV") float p9 = s9 + s22;\r
+ @LOC("THIS,SynthesisFilter.NEWV") float p10 = s10 + s21;\r
+ @LOC("THIS,SynthesisFilter.NEWV") float p11 = s11 + s20;\r
+ @LOC("THIS,SynthesisFilter.NEWV") float p12 = s12 + s19;\r
+ @LOC("THIS,SynthesisFilter.NEWV") float p13 = s13 + s18;\r
+ @LOC("THIS,SynthesisFilter.NEWV") float p14 = s14 + s17;\r
+ @LOC("THIS,SynthesisFilter.NEWV") float p15 = s15 + s16;\r
+\r
+ @LOC("THIS,SynthesisFilter.NEWV") float pp0 = p0 + p15;\r
+ @LOC("THIS,SynthesisFilter.NEWV") float pp1 = p1 + p14;\r
+ @LOC("THIS,SynthesisFilter.NEWV") float pp2 = p2 + p13;\r
+ @LOC("THIS,SynthesisFilter.NEWV") float pp3 = p3 + p12;\r
+ @LOC("THIS,SynthesisFilter.NEWV") float pp4 = p4 + p11;\r
+ @LOC("THIS,SynthesisFilter.NEWV") float pp5 = p5 + p10;\r
+ @LOC("THIS,SynthesisFilter.NEWV") float pp6 = p6 + p9;\r
+ @LOC("THIS,SynthesisFilter.NEWV") float pp7 = p7 + p8;\r
+ @LOC("THIS,SynthesisFilter.NEWV") float pp8 = (p0 - p15) * cos1_32;\r
+ @LOC("THIS,SynthesisFilter.NEWV") float pp9 = (p1 - p14) * cos3_32;\r
+ @LOC("THIS,SynthesisFilter.NEWV") float pp10 = (p2 - p13) * cos5_32;\r
+ @LOC("THIS,SynthesisFilter.NEWV") float pp11 = (p3 - p12) * cos7_32;\r
+ @LOC("THIS,SynthesisFilter.NEWV") float pp12 = (p4 - p11) * cos9_32;\r
+ @LOC("THIS,SynthesisFilter.NEWV") float pp13 = (p5 - p10) * cos11_32;\r
+ @LOC("THIS,SynthesisFilter.NEWV") float pp14 = (p6 - p9) * cos13_32;\r
+ @LOC("THIS,SynthesisFilter.NEWV") float pp15 = (p7 - p8) * cos15_32;\r
+\r
+ p0 = pp0 + pp7;\r
+ p1 = pp1 + pp6;\r
+ p2 = pp2 + pp5;\r
+ p3 = pp3 + pp4;\r
+ p4 = (pp0 - pp7) * cos1_16;\r
+ p5 = (pp1 - pp6) * cos3_16;\r
+ p6 = (pp2 - pp5) * cos5_16;\r
+ p7 = (pp3 - pp4) * cos7_16;\r
+ p8 = pp8 + pp15;\r
+ p9 = pp9 + pp14;\r
+ p10 = pp10 + pp13;\r
+ p11 = pp11 + pp12;\r
+ p12 = (pp8 - pp15) * cos1_16;\r
+ p13 = (pp9 - pp14) * cos3_16;\r
+ p14 = (pp10 - pp13) * cos5_16;\r
+ p15 = (pp11 - pp12) * cos7_16;\r
+\r
+ pp0 = p0 + p3;\r
+ pp1 = p1 + p2;\r
+ pp2 = (p0 - p3) * cos1_8;\r
+ pp3 = (p1 - p2) * cos3_8;\r
+ pp4 = p4 + p7;\r
+ pp5 = p5 + p6;\r
+ pp6 = (p4 - p7) * cos1_8;\r
+ pp7 = (p5 - p6) * cos3_8;\r
+ pp8 = p8 + p11;\r
+ pp9 = p9 + p10;\r
+ pp10 = (p8 - p11) * cos1_8;\r
+ pp11 = (p9 - p10) * cos3_8;\r
+ pp12 = p12 + p15;\r
+ pp13 = p13 + p14;\r
+ pp14 = (p12 - p15) * cos1_8;\r
+ pp15 = (p13 - p14) * cos3_8;\r
+\r
+ p0 = pp0 + pp1;\r
+ p1 = (pp0 - pp1) * cos1_4;\r
+ p2 = pp2 + pp3;\r
+ p3 = (pp2 - pp3) * cos1_4;\r
+ p4 = pp4 + pp5;\r
+ p5 = (pp4 - pp5) * cos1_4;\r
+ p6 = pp6 + pp7;\r
+ p7 = (pp6 - pp7) * cos1_4;\r
+ p8 = pp8 + pp9;\r
+ p9 = (pp8 - pp9) * cos1_4;\r
+ p10 = pp10 + pp11;\r
+ p11 = (pp10 - pp11) * cos1_4;\r
+ p12 = pp12 + pp13;\r
+ p13 = (pp12 - pp13) * cos1_4;\r
+ p14 = pp14 + pp15;\r
+ p15 = (pp14 - pp15) * cos1_4;\r
+\r
+ // this is pretty insane coding\r
+ @LOC("THIS,SynthesisFilter.NEWV") float tmp1;\r
+ new_v19/* 36-17 */= -(new_v4 = (new_v12 = p7) + p5) - p6;\r
+ new_v27/* 44-17 */= -p6 - p7 - p4;\r
+ new_v6 = (new_v10 = (new_v14 = p15) + p11) + p13;\r
+ new_v17/* 34-17 */= -(new_v2 = p15 + p13 + p9) - p14;\r
+ new_v21/* 38-17 */= (tmp1 = -p14 - p15 - p10 - p11) - p13;\r
+ new_v29/* 46-17 */= -p14 - p15 - p12 - p8;\r
+ new_v25/* 42-17 */= tmp1 - p12;\r
+ new_v31/* 48-17 */= -p0;\r
+ new_v0 = p1;\r
+ new_v23/* 40-17 */= -(new_v8 = p3) - p2;\r
+\r
+ p0 = (s0 - s31) * cos1_64;\r
+ p1 = (s1 - s30) * cos3_64;\r
+ p2 = (s2 - s29) * cos5_64;\r
+ p3 = (s3 - s28) * cos7_64;\r
+ p4 = (s4 - s27) * cos9_64;\r
+ p5 = (s5 - s26) * cos11_64;\r
+ p6 = (s6 - s25) * cos13_64;\r
+ p7 = (s7 - s24) * cos15_64;\r
+ p8 = (s8 - s23) * cos17_64;\r
+ p9 = (s9 - s22) * cos19_64;\r
+ p10 = (s10 - s21) * cos21_64;\r
+ p11 = (s11 - s20) * cos23_64;\r
+ p12 = (s12 - s19) * cos25_64;\r
+ p13 = (s13 - s18) * cos27_64;\r
+ p14 = (s14 - s17) * cos29_64;\r
+ p15 = (s15 - s16) * cos31_64;\r
+\r
+ pp0 = p0 + p15;\r
+ pp1 = p1 + p14;\r
+ pp2 = p2 + p13;\r
+ pp3 = p3 + p12;\r
+ pp4 = p4 + p11;\r
+ pp5 = p5 + p10;\r
+ pp6 = p6 + p9;\r
+ pp7 = p7 + p8;\r
+ pp8 = (p0 - p15) * cos1_32;\r
+ pp9 = (p1 - p14) * cos3_32;\r
+ pp10 = (p2 - p13) * cos5_32;\r
+ pp11 = (p3 - p12) * cos7_32;\r
+ pp12 = (p4 - p11) * cos9_32;\r
+ pp13 = (p5 - p10) * cos11_32;\r
+ pp14 = (p6 - p9) * cos13_32;\r
+ pp15 = (p7 - p8) * cos15_32;\r
+\r
+ p0 = pp0 + pp7;\r
+ p1 = pp1 + pp6;\r
+ p2 = pp2 + pp5;\r
+ p3 = pp3 + pp4;\r
+ p4 = (pp0 - pp7) * cos1_16;\r
+ p5 = (pp1 - pp6) * cos3_16;\r
+ p6 = (pp2 - pp5) * cos5_16;\r
+ p7 = (pp3 - pp4) * cos7_16;\r
+ p8 = pp8 + pp15;\r
+ p9 = pp9 + pp14;\r
+ p10 = pp10 + pp13;\r
+ p11 = pp11 + pp12;\r
+ p12 = (pp8 - pp15) * cos1_16;\r
+ p13 = (pp9 - pp14) * cos3_16;\r
+ p14 = (pp10 - pp13) * cos5_16;\r
+ p15 = (pp11 - pp12) * cos7_16;\r
+\r
+ pp0 = p0 + p3;\r
+ pp1 = p1 + p2;\r
+ pp2 = (p0 - p3) * cos1_8;\r
+ pp3 = (p1 - p2) * cos3_8;\r
+ pp4 = p4 + p7;\r
+ pp5 = p5 + p6;\r
+ pp6 = (p4 - p7) * cos1_8;\r
+ pp7 = (p5 - p6) * cos3_8;\r
+ pp8 = p8 + p11;\r
+ pp9 = p9 + p10;\r
+ pp10 = (p8 - p11) * cos1_8;\r
+ pp11 = (p9 - p10) * cos3_8;\r
+ pp12 = p12 + p15;\r
+ pp13 = p13 + p14;\r
+ pp14 = (p12 - p15) * cos1_8;\r
+ pp15 = (p13 - p14) * cos3_8;\r
+\r
+ p0 = pp0 + pp1;\r
+ p1 = (pp0 - pp1) * cos1_4;\r
+ p2 = pp2 + pp3;\r
+ p3 = (pp2 - pp3) * cos1_4;\r
+ p4 = pp4 + pp5;\r
+ p5 = (pp4 - pp5) * cos1_4;\r
+ p6 = pp6 + pp7;\r
+ p7 = (pp6 - pp7) * cos1_4;\r
+ p8 = pp8 + pp9;\r
+ p9 = (pp8 - pp9) * cos1_4;\r
+ p10 = pp10 + pp11;\r
+ p11 = (pp10 - pp11) * cos1_4;\r
+ p12 = pp12 + pp13;\r
+ p13 = (pp12 - pp13) * cos1_4;\r
+ p14 = pp14 + pp15;\r
+ p15 = (pp14 - pp15) * cos1_4;\r
+\r
+ // manually doing something that a compiler should handle sucks\r
+ // coding like this is hard to read\r
+ @LOC("THIS,SynthesisFilter.NEWV") float tmp2;\r
+ new_v5 = (new_v11 = (new_v13 = (new_v15 = p15) + p7) + p11) + p5 + p13;\r
+ new_v7 = (new_v9 = p15 + p11 + p3) + p13;\r
+ new_v16/* 33-17 */= -(new_v1 = (tmp1 = p13 + p15 + p9) + p1) - p14;\r
+ new_v18/* 35-17 */= -(new_v3 = tmp1 + p5 + p7) - p6 - p14;\r
+\r
+ new_v22/* 39-17 */= (tmp1 = -p10 - p11 - p14 - p15) - p13 - p2 - p3;\r
+ new_v20/* 37-17 */= tmp1 - p13 - p5 - p6 - p7;\r
+ new_v24/* 41-17 */= tmp1 - p12 - p2 - p3;\r
+ new_v26/* 43-17 */= tmp1 - p12 - (tmp2 = p4 + p6 + p7);\r
+ new_v30/* 47-17 */= (tmp1 = -p8 - p12 - p14 - p15) - p0;\r
+ new_v28/* 45-17 */= tmp1 - tmp2;\r
+\r
+ // insert V[0-15] (== new_v[0-15]) into actual v:\r
+ // float[] x2 = actual_v + actual_write_pos;\r
+ // float dest[] = actual_v; v2\r
+\r
+ @LOC("THIS,SynthesisFilter.NEWV") int pos = actual_write_pos;\r
+\r
+ v2[0 + pos] = new_v0;\r
+ v2[16 + pos] = new_v1;\r
+ v2[32 + pos] = new_v2;\r
+ v2[48 + pos] = new_v3;\r
+ v2[64 + pos] = new_v4;\r
+ v2[80 + pos] = new_v5;\r
+ v2[96 + pos] = new_v6;\r
+ v2[112 + pos] = new_v7;\r
+ v2[128 + pos] = new_v8;\r
+ v2[144 + pos] = new_v9;\r
+ v2[160 + pos] = new_v10;\r
+ v2[176 + pos] = new_v11;\r
+ v2[192 + pos] = new_v12;\r
+ v2[208 + pos] = new_v13;\r
+ v2[224 + pos] = new_v14;\r
+ v2[240 + pos] = new_v15;\r
+\r
+ // V[16] is always 0.0:\r
+ v2[256 + pos] = 0.0f;\r
+\r
+ // insert V[17-31] (== -new_v[15-1]) into actual v:\r
+ v2[272 + pos] = -new_v15;\r
+ v2[288 + pos] = -new_v14;\r
+ v2[304 + pos] = -new_v13;\r
+ v2[320 + pos] = -new_v12;\r
+ v2[336 + pos] = -new_v11;\r
+ v2[352 + pos] = -new_v10;\r
+ v2[368 + pos] = -new_v9;\r
+ v2[384 + pos] = -new_v8;\r
+ v2[400 + pos] = -new_v7;\r
+ v2[416 + pos] = -new_v6;\r
+ v2[432 + pos] = -new_v5;\r
+ v2[448 + pos] = -new_v4;\r
+ v2[464 + pos] = -new_v3;\r
+ v2[480 + pos] = -new_v2;\r
+ v2[496 + pos] = -new_v1;\r
+\r
+ // insert V[32] (== -new_v[0]) into other v:\r
+ // dest = (actual_v == v1) ? v2 : v1;\r
+\r
+ v1[0 + pos] = -new_v0;\r
+ // insert V[33-48] (== new_v[16-31]) into other v:\r
+ v1[16 + pos] = new_v16;\r
+ v1[32 + pos] = new_v17;\r
+ v1[48 + pos] = new_v18;\r
+ v1[64 + pos] = new_v19;\r
+ v1[80 + pos] = new_v20;\r
+ v1[96 + pos] = new_v21;\r
+ v1[112 + pos] = new_v22;\r
+ v1[128 + pos] = new_v23;\r
+ v1[144 + pos] = new_v24;\r
+ v1[160 + pos] = new_v25;\r
+ v1[176 + pos] = new_v26;\r
+ v1[192 + pos] = new_v27;\r
+ v1[208 + pos] = new_v28;\r
+ v1[224 + pos] = new_v29;\r
+ v1[240 + pos] = new_v30;\r
+ v1[256 + pos] = new_v31;\r
+\r
+ // insert V[49-63] (== new_v[30-16]) into other v:\r
+ v1[272 + pos] = new_v30;\r
+ v1[288 + pos] = new_v29;\r
+ v1[304 + pos] = new_v28;\r
+ v1[320 + pos] = new_v27;\r
+ v1[336 + pos] = new_v26;\r
+ v1[352 + pos] = new_v25;\r
+ v1[368 + pos] = new_v24;\r
+ v1[384 + pos] = new_v23;\r
+ v1[400 + pos] = new_v22;\r
+ v1[416 + pos] = new_v21;\r
+ v1[432 + pos] = new_v20;\r
+ v1[448 + pos] = new_v19;\r
+ v1[464 + pos] = new_v18;\r
+ v1[480 + pos] = new_v17;\r
+ v1[496 + pos] = new_v16;\r
+\r
+ /*\r
+ * setup PREV\r
+ */\r
+\r
+ prev2[0 + pos] = new_v0;\r
+ prev2[16 + pos] = new_v1;\r
+ prev2[32 + pos] = new_v2;\r
+ prev2[48 + pos] = new_v3;\r
+ prev2[64 + pos] = new_v4;\r
+ prev2[80 + pos] = new_v5;\r
+ prev2[96 + pos] = new_v6;\r
+ prev2[112 + pos] = new_v7;\r
+ prev2[128 + pos] = new_v8;\r
+ prev2[144 + pos] = new_v9;\r
+ prev2[160 + pos] = new_v10;\r
+ prev2[176 + pos] = new_v11;\r
+ prev2[192 + pos] = new_v12;\r
+ prev2[208 + pos] = new_v13;\r
+ prev2[224 + pos] = new_v14;\r
+ prev2[240 + pos] = new_v15;\r
+\r
+ // V[16] is always 0.0:\r
+ prev2[256 + pos] = 0.0f;\r
+\r
+ // insert V[17-31] (== -new_v[15-1]) into actual v:\r
+ prev2[272 + pos] = -new_v15;\r
+ prev2[288 + pos] = -new_v14;\r
+ prev2[304 + pos] = -new_v13;\r
+ prev2[320 + pos] = -new_v12;\r
+ prev2[336 + pos] = -new_v11;\r
+ prev2[352 + pos] = -new_v10;\r
+ prev2[368 + pos] = -new_v9;\r
+ prev2[384 + pos] = -new_v8;\r
+ prev2[400 + pos] = -new_v7;\r
+ prev2[416 + pos] = -new_v6;\r
+ prev2[432 + pos] = -new_v5;\r
+ prev2[448 + pos] = -new_v4;\r
+ prev2[464 + pos] = -new_v3;\r
+ prev2[480 + pos] = -new_v2;\r
+ prev2[496 + pos] = -new_v1;\r
+\r
+ // insert V[32] (== -new_v[0]) into other v:\r
+ // dest = (actual_v == v1) ? v2 : v1;\r
+\r
+ prev1[0 + pos] = -new_v0;\r
+ // insert V[33-48] (== new_v[16-31]) into other v:\r
+ prev1[16 + pos] = new_v16;\r
+ prev1[32 + pos] = new_v17;\r
+ prev1[48 + pos] = new_v18;\r
+ prev1[64 + pos] = new_v19;\r
+ prev1[80 + pos] = new_v20;\r
+ prev1[96 + pos] = new_v21;\r
+ prev1[112 + pos] = new_v22;\r
+ prev1[128 + pos] = new_v23;\r
+ prev1[144 + pos] = new_v24;\r
+ prev1[160 + pos] = new_v25;\r
+ prev1[176 + pos] = new_v26;\r
+ prev1[192 + pos] = new_v27;\r
+ prev1[208 + pos] = new_v28;\r
+ prev1[224 + pos] = new_v29;\r
+ prev1[240 + pos] = new_v30;\r
+ prev1[256 + pos] = new_v31;\r
+\r
+ // insert V[49-63] (== new_v[30-16]) into other v:\r
+ prev1[272 + pos] = new_v30;\r
+ prev1[288 + pos] = new_v29;\r
+ prev1[304 + pos] = new_v28;\r
+ prev1[320 + pos] = new_v27;\r
+ prev1[336 + pos] = new_v26;\r
+ prev1[352 + pos] = new_v25;\r
+ prev1[368 + pos] = new_v24;\r
+ prev1[384 + pos] = new_v23;\r
+ prev1[400 + pos] = new_v22;\r
+ prev1[416 + pos] = new_v21;\r
+ prev1[432 + pos] = new_v20;\r
+ prev1[448 + pos] = new_v19;\r
+ prev1[464 + pos] = new_v18;\r
+ prev1[480 + pos] = new_v17;\r
+ prev1[496 + pos] = new_v16;\r
+ }\r
+\r
+ private void compute_new_v1_v2() {\r
+\r
+ @LOC("THIS,SynthesisFilter.NEWV") float new_v0 = 0.0f;\r
+ @LOC("THIS,SynthesisFilter.NEWV") float new_v1 = 0.0f;\r
+ @LOC("THIS,SynthesisFilter.NEWV") float new_v2 = 0.0f;\r
+ @LOC("THIS,SynthesisFilter.NEWV") float new_v3 = 0.0f;\r
+ @LOC("THIS,SynthesisFilter.NEWV") float new_v4 = 0.0f;\r
+ @LOC("THIS,SynthesisFilter.NEWV") float new_v5 = 0.0f;\r
+ @LOC("THIS,SynthesisFilter.NEWV") float new_v6 = 0.0f;\r
+ @LOC("THIS,SynthesisFilter.NEWV") float new_v7 = 0.0f;\r
+ @LOC("THIS,SynthesisFilter.NEWV") float new_v8 = 0.0f;\r
+ @LOC("THIS,SynthesisFilter.NEWV") float new_v9 = 0.0f;\r
+ @LOC("THIS,SynthesisFilter.NEWV") float new_v10 = 0.0f;\r
+ @LOC("THIS,SynthesisFilter.NEWV") float new_v11 = 0.0f;\r
+ @LOC("THIS,SynthesisFilter.NEWV") float new_v12 = 0.0f;\r
+ @LOC("THIS,SynthesisFilter.NEWV") float new_v13 = 0.0f;\r
+ @LOC("THIS,SynthesisFilter.NEWV") float new_v14 = 0.0f;\r
+ @LOC("THIS,SynthesisFilter.NEWV") float new_v15 = 0.0f;\r
+ @LOC("THIS,SynthesisFilter.NEWV") float new_v16 = 0.0f;\r
+ @LOC("THIS,SynthesisFilter.NEWV") float new_v17 = 0.0f;\r
+ @LOC("THIS,SynthesisFilter.NEWV") float new_v18 = 0.0f;\r
+ @LOC("THIS,SynthesisFilter.NEWV") float new_v19 = 0.0f;\r
+ @LOC("THIS,SynthesisFilter.NEWV") float new_v20 = 0.0f;\r
+ @LOC("THIS,SynthesisFilter.NEWV") float new_v21 = 0.0f;\r
+ @LOC("THIS,SynthesisFilter.NEWV") float new_v22 = 0.0f;\r
+ @LOC("THIS,SynthesisFilter.NEWV") float new_v23 = 0.0f;\r
+ @LOC("THIS,SynthesisFilter.NEWV") float new_v24 = 0.0f;\r
+ @LOC("THIS,SynthesisFilter.NEWV") float new_v25 = 0.0f;\r
+ @LOC("THIS,SynthesisFilter.NEWV") float new_v26 = 0.0f;\r
+ @LOC("THIS,SynthesisFilter.NEWV") float new_v27 = 0.0f;\r
+ @LOC("THIS,SynthesisFilter.NEWV") float new_v28 = 0.0f;\r
+ @LOC("THIS,SynthesisFilter.NEWV") float new_v29 = 0.0f;\r
+ @LOC("THIS,SynthesisFilter.NEWV") float new_v30 = 0.0f;\r
+ @LOC("THIS,SynthesisFilter.NEWV") float new_v31 = 0.0f;\r
+\r
+ // float[] new_v = new float[32]; // new V[0-15] and V[33-48] of Figure\r
+ // 3-A.2 in ISO DIS 11172-3\r
+ // float[] p = new float[16];\r
+ // float[] pp = new float[16];\r
+\r
+ // float[] s = samples;\r
+\r
+ @LOC("THIS,SynthesisFilter.NEWV") float s0 = samples[0];\r
+ @LOC("THIS,SynthesisFilter.NEWV") float s1 = samples[1];\r
+ @LOC("THIS,SynthesisFilter.NEWV") float s2 = samples[2];\r
+ @LOC("THIS,SynthesisFilter.NEWV") float s3 = samples[3];\r
+ @LOC("THIS,SynthesisFilter.NEWV") float s4 = samples[4];\r
+ @LOC("THIS,SynthesisFilter.NEWV") float s5 = samples[5];\r
+ @LOC("THIS,SynthesisFilter.NEWV") float s6 = samples[6];\r
+ @LOC("THIS,SynthesisFilter.NEWV") float s7 = samples[7];\r
+ @LOC("THIS,SynthesisFilter.NEWV") float s8 = samples[8];\r
+ @LOC("THIS,SynthesisFilter.NEWV") float s9 = samples[9];\r
+ @LOC("THIS,SynthesisFilter.NEWV") float s10 = samples[10];\r
+ @LOC("THIS,SynthesisFilter.NEWV") float s11 = samples[11];\r
+ @LOC("THIS,SynthesisFilter.NEWV") float s12 = samples[12];\r
+ @LOC("THIS,SynthesisFilter.NEWV") float s13 = samples[13];\r
+ @LOC("THIS,SynthesisFilter.NEWV") float s14 = samples[14];\r
+ @LOC("THIS,SynthesisFilter.NEWV") float s15 = samples[15];\r
+ @LOC("THIS,SynthesisFilter.NEWV") float s16 = samples[16];\r
+ @LOC("THIS,SynthesisFilter.NEWV") float s17 = samples[17];\r
+ @LOC("THIS,SynthesisFilter.NEWV") float s18 = samples[18];\r
+ @LOC("THIS,SynthesisFilter.NEWV") float s19 = samples[19];\r
+ @LOC("THIS,SynthesisFilter.NEWV") float s20 = samples[20];\r
+ @LOC("THIS,SynthesisFilter.NEWV") float s21 = samples[21];\r
+ @LOC("THIS,SynthesisFilter.NEWV") float s22 = samples[22];\r
+ @LOC("THIS,SynthesisFilter.NEWV") float s23 = samples[23];\r
+ @LOC("THIS,SynthesisFilter.NEWV") float s24 = samples[24];\r
+ @LOC("THIS,SynthesisFilter.NEWV") float s25 = samples[25];\r
+ @LOC("THIS,SynthesisFilter.NEWV") float s26 = samples[26];\r
+ @LOC("THIS,SynthesisFilter.NEWV") float s27 = samples[27];\r
+ @LOC("THIS,SynthesisFilter.NEWV") float s28 = samples[28];\r
+ @LOC("THIS,SynthesisFilter.NEWV") float s29 = samples[29];\r
+ @LOC("THIS,SynthesisFilter.NEWV") float s30 = samples[30];\r
+ @LOC("THIS,SynthesisFilter.NEWV") float s31 = samples[31];\r
+\r
+ @LOC("THIS,SynthesisFilter.NEWV") float p0 = s0 + s31;\r
+ @LOC("THIS,SynthesisFilter.NEWV") float p1 = s1 + s30;\r
+ @LOC("THIS,SynthesisFilter.NEWV") float p2 = s2 + s29;\r
+ @LOC("THIS,SynthesisFilter.NEWV") float p3 = s3 + s28;\r
+ @LOC("THIS,SynthesisFilter.NEWV") float p4 = s4 + s27;\r
+ @LOC("THIS,SynthesisFilter.NEWV") float p5 = s5 + s26;\r
+ @LOC("THIS,SynthesisFilter.NEWV") float p6 = s6 + s25;\r
+ @LOC("THIS,SynthesisFilter.NEWV") float p7 = s7 + s24;\r
+ @LOC("THIS,SynthesisFilter.NEWV") float p8 = s8 + s23;\r
+ @LOC("THIS,SynthesisFilter.NEWV") float p9 = s9 + s22;\r
+ @LOC("THIS,SynthesisFilter.NEWV") float p10 = s10 + s21;\r
+ @LOC("THIS,SynthesisFilter.NEWV") float p11 = s11 + s20;\r
+ @LOC("THIS,SynthesisFilter.NEWV") float p12 = s12 + s19;\r
+ @LOC("THIS,SynthesisFilter.NEWV") float p13 = s13 + s18;\r
+ @LOC("THIS,SynthesisFilter.NEWV") float p14 = s14 + s17;\r
+ @LOC("THIS,SynthesisFilter.NEWV") float p15 = s15 + s16;\r
+\r
+ @LOC("THIS,SynthesisFilter.NEWV") float pp0 = p0 + p15;\r
+ @LOC("THIS,SynthesisFilter.NEWV") float pp1 = p1 + p14;\r
+ @LOC("THIS,SynthesisFilter.NEWV") float pp2 = p2 + p13;\r
+ @LOC("THIS,SynthesisFilter.NEWV") float pp3 = p3 + p12;\r
+ @LOC("THIS,SynthesisFilter.NEWV") float pp4 = p4 + p11;\r
+ @LOC("THIS,SynthesisFilter.NEWV") float pp5 = p5 + p10;\r
+ @LOC("THIS,SynthesisFilter.NEWV") float pp6 = p6 + p9;\r
+ @LOC("THIS,SynthesisFilter.NEWV") float pp7 = p7 + p8;\r
+ @LOC("THIS,SynthesisFilter.NEWV") float pp8 = (p0 - p15) * cos1_32;\r
+ @LOC("THIS,SynthesisFilter.NEWV") float pp9 = (p1 - p14) * cos3_32;\r
+ @LOC("THIS,SynthesisFilter.NEWV") float pp10 = (p2 - p13) * cos5_32;\r
+ @LOC("THIS,SynthesisFilter.NEWV") float pp11 = (p3 - p12) * cos7_32;\r
+ @LOC("THIS,SynthesisFilter.NEWV") float pp12 = (p4 - p11) * cos9_32;\r
+ @LOC("THIS,SynthesisFilter.NEWV") float pp13 = (p5 - p10) * cos11_32;\r
+ @LOC("THIS,SynthesisFilter.NEWV") float pp14 = (p6 - p9) * cos13_32;\r
+ @LOC("THIS,SynthesisFilter.NEWV") float pp15 = (p7 - p8) * cos15_32;\r
+\r
+ p0 = pp0 + pp7;\r
+ p1 = pp1 + pp6;\r
+ p2 = pp2 + pp5;\r
+ p3 = pp3 + pp4;\r
+ p4 = (pp0 - pp7) * cos1_16;\r
+ p5 = (pp1 - pp6) * cos3_16;\r
+ p6 = (pp2 - pp5) * cos5_16;\r
+ p7 = (pp3 - pp4) * cos7_16;\r
+ p8 = pp8 + pp15;\r
+ p9 = pp9 + pp14;\r
+ p10 = pp10 + pp13;\r
+ p11 = pp11 + pp12;\r
+ p12 = (pp8 - pp15) * cos1_16;\r
+ p13 = (pp9 - pp14) * cos3_16;\r
+ p14 = (pp10 - pp13) * cos5_16;\r
+ p15 = (pp11 - pp12) * cos7_16;\r
+\r
+ pp0 = p0 + p3;\r
+ pp1 = p1 + p2;\r
+ pp2 = (p0 - p3) * cos1_8;\r
+ pp3 = (p1 - p2) * cos3_8;\r
+ pp4 = p4 + p7;\r
+ pp5 = p5 + p6;\r
+ pp6 = (p4 - p7) * cos1_8;\r
+ pp7 = (p5 - p6) * cos3_8;\r
+ pp8 = p8 + p11;\r
+ pp9 = p9 + p10;\r
+ pp10 = (p8 - p11) * cos1_8;\r
+ pp11 = (p9 - p10) * cos3_8;\r
+ pp12 = p12 + p15;\r
+ pp13 = p13 + p14;\r
+ pp14 = (p12 - p15) * cos1_8;\r
+ pp15 = (p13 - p14) * cos3_8;\r
+\r
+ p0 = pp0 + pp1;\r
+ p1 = (pp0 - pp1) * cos1_4;\r
+ p2 = pp2 + pp3;\r
+ p3 = (pp2 - pp3) * cos1_4;\r
+ p4 = pp4 + pp5;\r
+ p5 = (pp4 - pp5) * cos1_4;\r
+ p6 = pp6 + pp7;\r
+ p7 = (pp6 - pp7) * cos1_4;\r
+ p8 = pp8 + pp9;\r
+ p9 = (pp8 - pp9) * cos1_4;\r
+ p10 = pp10 + pp11;\r
+ p11 = (pp10 - pp11) * cos1_4;\r
+ p12 = pp12 + pp13;\r
+ p13 = (pp12 - pp13) * cos1_4;\r
+ p14 = pp14 + pp15;\r
+ p15 = (pp14 - pp15) * cos1_4;\r
+\r
+ // this is pretty insane coding\r
+ @LOC("THIS,SynthesisFilter.NEWV") float tmp1;\r
+ new_v19/* 36-17 */= -(new_v4 = (new_v12 = p7) + p5) - p6;\r
+ new_v27/* 44-17 */= -p6 - p7 - p4;\r
+ new_v6 = (new_v10 = (new_v14 = p15) + p11) + p13;\r
+ new_v17/* 34-17 */= -(new_v2 = p15 + p13 + p9) - p14;\r
+ new_v21/* 38-17 */= (tmp1 = -p14 - p15 - p10 - p11) - p13;\r
+ new_v29/* 46-17 */= -p14 - p15 - p12 - p8;\r
+ new_v25/* 42-17 */= tmp1 - p12;\r
+ new_v31/* 48-17 */= -p0;\r
+ new_v0 = p1;\r
+ new_v23/* 40-17 */= -(new_v8 = p3) - p2;\r
+\r
+ p0 = (s0 - s31) * cos1_64;\r
+ p1 = (s1 - s30) * cos3_64;\r
+ p2 = (s2 - s29) * cos5_64;\r
+ p3 = (s3 - s28) * cos7_64;\r
+ p4 = (s4 - s27) * cos9_64;\r
+ p5 = (s5 - s26) * cos11_64;\r
+ p6 = (s6 - s25) * cos13_64;\r
+ p7 = (s7 - s24) * cos15_64;\r
+ p8 = (s8 - s23) * cos17_64;\r
+ p9 = (s9 - s22) * cos19_64;\r
+ p10 = (s10 - s21) * cos21_64;\r
+ p11 = (s11 - s20) * cos23_64;\r
+ p12 = (s12 - s19) * cos25_64;\r
+ p13 = (s13 - s18) * cos27_64;\r
+ p14 = (s14 - s17) * cos29_64;\r
+ p15 = (s15 - s16) * cos31_64;\r
+\r
+ pp0 = p0 + p15;\r
+ pp1 = p1 + p14;\r
+ pp2 = p2 + p13;\r
+ pp3 = p3 + p12;\r
+ pp4 = p4 + p11;\r
+ pp5 = p5 + p10;\r
+ pp6 = p6 + p9;\r
+ pp7 = p7 + p8;\r
+ pp8 = (p0 - p15) * cos1_32;\r
+ pp9 = (p1 - p14) * cos3_32;\r
+ pp10 = (p2 - p13) * cos5_32;\r
+ pp11 = (p3 - p12) * cos7_32;\r
+ pp12 = (p4 - p11) * cos9_32;\r
+ pp13 = (p5 - p10) * cos11_32;\r
+ pp14 = (p6 - p9) * cos13_32;\r
+ pp15 = (p7 - p8) * cos15_32;\r
+\r
+ p0 = pp0 + pp7;\r
+ p1 = pp1 + pp6;\r
+ p2 = pp2 + pp5;\r
+ p3 = pp3 + pp4;\r
+ p4 = (pp0 - pp7) * cos1_16;\r
+ p5 = (pp1 - pp6) * cos3_16;\r
+ p6 = (pp2 - pp5) * cos5_16;\r
+ p7 = (pp3 - pp4) * cos7_16;\r
+ p8 = pp8 + pp15;\r
+ p9 = pp9 + pp14;\r
+ p10 = pp10 + pp13;\r
+ p11 = pp11 + pp12;\r
+ p12 = (pp8 - pp15) * cos1_16;\r
+ p13 = (pp9 - pp14) * cos3_16;\r
+ p14 = (pp10 - pp13) * cos5_16;\r
+ p15 = (pp11 - pp12) * cos7_16;\r
+\r
+ pp0 = p0 + p3;\r
+ pp1 = p1 + p2;\r
+ pp2 = (p0 - p3) * cos1_8;\r
+ pp3 = (p1 - p2) * cos3_8;\r
+ pp4 = p4 + p7;\r
+ pp5 = p5 + p6;\r
+ pp6 = (p4 - p7) * cos1_8;\r
+ pp7 = (p5 - p6) * cos3_8;\r
+ pp8 = p8 + p11;\r
+ pp9 = p9 + p10;\r
+ pp10 = (p8 - p11) * cos1_8;\r
+ pp11 = (p9 - p10) * cos3_8;\r
+ pp12 = p12 + p15;\r
+ pp13 = p13 + p14;\r
+ pp14 = (p12 - p15) * cos1_8;\r
+ pp15 = (p13 - p14) * cos3_8;\r
+\r
+ p0 = pp0 + pp1;\r
+ p1 = (pp0 - pp1) * cos1_4;\r
+ p2 = pp2 + pp3;\r
+ p3 = (pp2 - pp3) * cos1_4;\r
+ p4 = pp4 + pp5;\r
+ p5 = (pp4 - pp5) * cos1_4;\r
+ p6 = pp6 + pp7;\r
+ p7 = (pp6 - pp7) * cos1_4;\r
+ p8 = pp8 + pp9;\r
+ p9 = (pp8 - pp9) * cos1_4;\r
+ p10 = pp10 + pp11;\r
+ p11 = (pp10 - pp11) * cos1_4;\r
+ p12 = pp12 + pp13;\r
+ p13 = (pp12 - pp13) * cos1_4;\r
+ p14 = pp14 + pp15;\r
+ p15 = (pp14 - pp15) * cos1_4;\r
+\r
+ // manually doing something that a compiler should handle sucks\r
+ // coding like this is hard to read\r
+ @LOC("THIS,SynthesisFilter.NEWV") float tmp2;\r
+ new_v5 = (new_v11 = (new_v13 = (new_v15 = p15) + p7) + p11) + p5 + p13;\r
+ new_v7 = (new_v9 = p15 + p11 + p3) + p13;\r
+ new_v16/* 33-17 */= -(new_v1 = (tmp1 = p13 + p15 + p9) + p1) - p14;\r
+ new_v18/* 35-17 */= -(new_v3 = tmp1 + p5 + p7) - p6 - p14;\r
+\r
+ new_v22/* 39-17 */= (tmp1 = -p10 - p11 - p14 - p15) - p13 - p2 - p3;\r
+ new_v20/* 37-17 */= tmp1 - p13 - p5 - p6 - p7;\r
+ new_v24/* 41-17 */= tmp1 - p12 - p2 - p3;\r
+ new_v26/* 43-17 */= tmp1 - p12 - (tmp2 = p4 + p6 + p7);\r
+ new_v30/* 47-17 */= (tmp1 = -p8 - p12 - p14 - p15) - p0;\r
+ new_v28/* 45-17 */= tmp1 - tmp2;\r
+\r
+ // insert V[0-15] (== new_v[0-15]) into actual v:\r
+ // float[] x2 = actual_v + actual_write_pos;\r
+ // float dest[] = actual_v; actual_v=v1;\r
+\r
+ @LOC("THIS,SynthesisFilter.NEWV") int pos = actual_write_pos;\r
+\r
+ v1[0 + pos] = new_v0;\r
+ v1[16 + pos] = new_v1;\r
+ v1[32 + pos] = new_v2;\r
+ v1[48 + pos] = new_v3;\r
+ v1[64 + pos] = new_v4;\r
+ v1[80 + pos] = new_v5;\r
+ v1[96 + pos] = new_v6;\r
+ v1[112 + pos] = new_v7;\r
+ v1[128 + pos] = new_v8;\r
+ v1[144 + pos] = new_v9;\r
+ v1[160 + pos] = new_v10;\r
+ v1[176 + pos] = new_v11;\r
+ v1[192 + pos] = new_v12;\r
+ v1[208 + pos] = new_v13;\r
+ v1[224 + pos] = new_v14;\r
+ v1[240 + pos] = new_v15;\r
+\r
+ // V[16] is always 0.0:\r
+ v1[256 + pos] = 0.0f;\r
+\r
+ // insert V[17-31] (== -new_v[15-1]) into actual v:\r
+ v1[272 + pos] = -new_v15;\r
+ v1[288 + pos] = -new_v14;\r
+ v1[304 + pos] = -new_v13;\r
+ v1[320 + pos] = -new_v12;\r
+ v1[336 + pos] = -new_v11;\r
+ v1[352 + pos] = -new_v10;\r
+ v1[368 + pos] = -new_v9;\r
+ v1[384 + pos] = -new_v8;\r
+ v1[400 + pos] = -new_v7;\r
+ v1[416 + pos] = -new_v6;\r
+ v1[432 + pos] = -new_v5;\r
+ v1[448 + pos] = -new_v4;\r
+ v1[464 + pos] = -new_v3;\r
+ v1[480 + pos] = -new_v2;\r
+ v1[496 + pos] = -new_v1;\r
+\r
+ // insert V[32] (== -new_v[0]) into other v:\r
+ // dest = (actual_v == v1) ? v2 : v1;\r
+\r
+ v2[0 + pos] = -new_v0;\r
+ // insert V[33-48] (== new_v[16-31]) into other v:\r
+ v2[16 + pos] = new_v16;\r
+ v2[32 + pos] = new_v17;\r
+ v2[48 + pos] = new_v18;\r
+ v2[64 + pos] = new_v19;\r
+ v2[80 + pos] = new_v20;\r
+ v2[96 + pos] = new_v21;\r
+ v2[112 + pos] = new_v22;\r
+ v2[128 + pos] = new_v23;\r
+ v2[144 + pos] = new_v24;\r
+ v2[160 + pos] = new_v25;\r
+ v2[176 + pos] = new_v26;\r
+ v2[192 + pos] = new_v27;\r
+ v2[208 + pos] = new_v28;\r
+ v2[224 + pos] = new_v29;\r
+ v2[240 + pos] = new_v30;\r
+ v2[256 + pos] = new_v31;\r
+\r
+ // insert V[49-63] (== new_v[30-16]) into other v:\r
+ v2[272 + pos] = new_v30;\r
+ v2[288 + pos] = new_v29;\r
+ v2[304 + pos] = new_v28;\r
+ v2[320 + pos] = new_v27;\r
+ v2[336 + pos] = new_v26;\r
+ v2[352 + pos] = new_v25;\r
+ v2[368 + pos] = new_v24;\r
+ v2[384 + pos] = new_v23;\r
+ v2[400 + pos] = new_v22;\r
+ v2[416 + pos] = new_v21;\r
+ v2[432 + pos] = new_v20;\r
+ v2[448 + pos] = new_v19;\r
+ v2[464 + pos] = new_v18;\r
+ v2[480 + pos] = new_v17;\r
+ v2[496 + pos] = new_v16;\r
+\r
+ /*\r
+ * setup PREV\r
+ */\r
+\r
+ prev1[0 + pos] = new_v0;\r
+ prev1[16 + pos] = new_v1;\r
+ prev1[32 + pos] = new_v2;\r
+ prev1[48 + pos] = new_v3;\r
+ prev1[64 + pos] = new_v4;\r
+ prev1[80 + pos] = new_v5;\r
+ prev1[96 + pos] = new_v6;\r
+ prev1[112 + pos] = new_v7;\r
+ prev1[128 + pos] = new_v8;\r
+ prev1[144 + pos] = new_v9;\r
+ prev1[160 + pos] = new_v10;\r
+ prev1[176 + pos] = new_v11;\r
+ prev1[192 + pos] = new_v12;\r
+ prev1[208 + pos] = new_v13;\r
+ prev1[224 + pos] = new_v14;\r
+ prev1[240 + pos] = new_v15;\r
+\r
+ // V[16] is always 0.0:\r
+ prev1[256 + pos] = 0.0f;\r
+\r
+ // insert V[17-31] (== -new_v[15-1]) into actual v:\r
+ prev1[272 + pos] = -new_v15;\r
+ prev1[288 + pos] = -new_v14;\r
+ prev1[304 + pos] = -new_v13;\r
+ prev1[320 + pos] = -new_v12;\r
+ prev1[336 + pos] = -new_v11;\r
+ prev1[352 + pos] = -new_v10;\r
+ prev1[368 + pos] = -new_v9;\r
+ prev1[384 + pos] = -new_v8;\r
+ prev1[400 + pos] = -new_v7;\r
+ prev1[416 + pos] = -new_v6;\r
+ prev1[432 + pos] = -new_v5;\r
+ prev1[448 + pos] = -new_v4;\r
+ prev1[464 + pos] = -new_v3;\r
+ prev1[480 + pos] = -new_v2;\r
+ prev1[496 + pos] = -new_v1;\r
+\r
+ // insert V[32] (== -new_v[0]) into other v:\r
+ // dest = (actual_v == v1) ? v2 : v1;\r
+\r
+ prev2[0 + pos] = -new_v0;\r
+ // insert V[33-48] (== new_v[16-31]) into other v:\r
+ prev2[16 + pos] = new_v16;\r
+ prev2[32 + pos] = new_v17;\r
+ prev2[48 + pos] = new_v18;\r
+ prev2[64 + pos] = new_v19;\r
+ prev2[80 + pos] = new_v20;\r
+ prev2[96 + pos] = new_v21;\r
+ prev2[112 + pos] = new_v22;\r
+ prev2[128 + pos] = new_v23;\r
+ prev2[144 + pos] = new_v24;\r
+ prev2[160 + pos] = new_v25;\r
+ prev2[176 + pos] = new_v26;\r
+ prev2[192 + pos] = new_v27;\r
+ prev2[208 + pos] = new_v28;\r
+ prev2[224 + pos] = new_v29;\r
+ prev2[240 + pos] = new_v30;\r
+ prev2[256 + pos] = new_v31;\r
+\r
+ // insert V[49-63] (== new_v[30-16]) into other v:\r
+ prev2[272 + pos] = new_v30;\r
+ prev2[288 + pos] = new_v29;\r
+ prev2[304 + pos] = new_v28;\r
+ prev2[320 + pos] = new_v27;\r
+ prev2[336 + pos] = new_v26;\r
+ prev2[352 + pos] = new_v25;\r
+ prev2[368 + pos] = new_v24;\r
+ prev2[384 + pos] = new_v23;\r
+ prev2[400 + pos] = new_v22;\r
+ prev2[416 + pos] = new_v21;\r
+ prev2[432 + pos] = new_v20;\r
+ prev2[448 + pos] = new_v19;\r
+ prev2[464 + pos] = new_v18;\r
+ prev2[480 + pos] = new_v17;\r
+ prev2[496 + pos] = new_v16;\r
+ }\r
+\r
+ /**\r
+ * Compute PCM Samples.\r
+ */\r
+\r
+ @LOC("OUT")\r
+ private float[] _tmpOut = new float[32];\r
+\r
+ private void compute_pcm_samples0() {\r
+\r
+ if (vidx == 1) {\r
+ // final float[] vp = actual_v;\r
+ // int inc = v_inc;\r
+ // final float[] tmpOut = _tmpOut;\r
+ @LOC("THIS,SynthesisFilter.NEWV") int dvp = 0;\r
+\r
+ // fat chance of having this loop unroll\r
+ for (@LOC("THIS,SynthesisFilter.NEWV") int i = 0; i < 32; i++) {\r
+ @LOC("THIS,SynthesisFilter.V2") float pcm_sample;\r
+ // final float[] dp = d16[i];\r
+ pcm_sample =\r
+ (float) (((v1[0 + dvp] * d16[i][0]) + (v1[15 + dvp] * d16[i][1])\r
+ + (v1[14 + dvp] * d16[i][2]) + (v1[13 + dvp] * d16[i][3])\r
+ + (v1[12 + dvp] * d16[i][4]) + (v1[11 + dvp] * d16[i][5])\r
+ + (v1[10 + dvp] * d16[i][6]) + (v1[9 + dvp] * d16[i][7])\r
+ + (v1[8 + dvp] * d16[i][8]) + (v1[7 + dvp] * d16[i][9])\r
+ + (v1[6 + dvp] * d16[i][10]) + (v1[5 + dvp] * d16[i][11])\r
+ + (v1[4 + dvp] * d16[i][12]) + (v1[3 + dvp] * d16[i][13])\r
+ + (v1[2 + dvp] * d16[i][14]) + (v1[1 + dvp] * d16[i][15])) * scalefactor);\r
+\r
+ _tmpOut[i] = pcm_sample;\r
+\r
+ dvp += 16;\r
+ } // for\r
+ } else {\r
+ // final float[] vp = actual_v;\r
+ // int inc = v_inc;\r
+ // final float[] tmpOut = _tmpOut;\r
+ @LOC("THIS,SynthesisFilter.NEWV") int dvp = 0;\r
+\r
+ // fat chance of having this loop unroll\r
+ for (@LOC("THIS,SynthesisFilter.NEWV") int i = 0; i < 32; i++) {\r
+ @LOC("THIS,SynthesisFilter.V2") float pcm_sample;\r
+ // final float[] dp = d16[i];\r
+ pcm_sample =\r
+ (float) (((v2[0 + dvp] * d16[i][0]) + (v2[15 + dvp] * d16[i][1])\r
+ + (v2[14 + dvp] * d16[i][2]) + (v2[13 + dvp] * d16[i][3])\r
+ + (v2[12 + dvp] * d16[i][4]) + (v2[11 + dvp] * d16[i][5])\r
+ + (v2[10 + dvp] * d16[i][6]) + (v2[9 + dvp] * d16[i][7])\r
+ + (v2[8 + dvp] * d16[i][8]) + (v2[7 + dvp] * d16[i][9])\r
+ + (v2[6 + dvp] * d16[i][10]) + (v2[5 + dvp] * d16[i][11])\r
+ + (v2[4 + dvp] * d16[i][12]) + (v2[3 + dvp] * d16[i][13])\r
+ + (v2[2 + dvp] * d16[i][14]) + (v2[1 + dvp] * d16[i][15])) * scalefactor);\r
+\r
+ _tmpOut[i] = pcm_sample;\r
+\r
+ dvp += 16;\r
+ } // for\r
+ }\r
+\r
+ }\r
+\r
+ private void compute_pcm_samples1() {\r
+\r
+ if (vidx == 1) {\r
+ // final float[] vp = actual_v;\r
+ // int inc = v_inc;\r
+ // final float[] tmpOut = _tmpOut;\r
+ @LOC("THIS,SynthesisFilter.NEWV") int dvp = 0;\r
+\r
+ // fat chance of having this loop unroll\r
+ for (@LOC("THIS,SynthesisFilter.NEWV") int i = 0; i < 32; i++) {\r
+ // final float[] dp = d16[i];\r
+ @LOC("THIS,SynthesisFilter.V2") float pcm_sample;\r
+\r
+ pcm_sample =\r
+ (float) (((v1[1 + dvp] * d16[i][0]) + (v1[0 + dvp] * d16[i][1])\r
+ + (v1[15 + dvp] * d16[i][2]) + (v1[14 + dvp] * d16[i][3])\r
+ + (v1[13 + dvp] * d16[i][4]) + (v1[12 + dvp] * d16[i][5])\r
+ + (v1[11 + dvp] * d16[i][6]) + (v1[10 + dvp] * d16[i][7])\r
+ + (v1[9 + dvp] * d16[i][8]) + (v1[8 + dvp] * d16[i][9])\r
+ + (v1[7 + dvp] * d16[i][10]) + (v1[6 + dvp] * d16[i][11])\r
+ + (v1[5 + dvp] * d16[i][12]) + (v1[4 + dvp] * d16[i][13])\r
+ + (v1[3 + dvp] * d16[i][14]) + (v1[2 + dvp] * d16[i][15])) * scalefactor);\r
+\r
+ _tmpOut[i] = pcm_sample;\r
+\r
+ dvp += 16;\r
+ } // for\r
+ } else {\r
+ // final float[] vp = actual_v;\r
+ // int inc = v_inc;\r
+ // final float[] tmpOut = _tmpOut;\r
+ @LOC("THIS,SynthesisFilter.NEWV") int dvp = 0;\r
+\r
+ // fat chance of having this loop unroll\r
+ for (@LOC("THIS,SynthesisFilter.NEWV") int i = 0; i < 32; i++) {\r
+ // final float[] dp = d16[i];\r
+ @LOC("THIS,SynthesisFilter.V2") float pcm_sample;\r
+\r
+ pcm_sample =\r
+ (float) (((v2[1 + dvp] * d16[i][0]) + (v2[0 + dvp] * d16[i][1])\r
+ + (v2[15 + dvp] * d16[i][2]) + (v2[14 + dvp] * d16[i][3])\r
+ + (v2[13 + dvp] * d16[i][4]) + (v2[12 + dvp] * d16[i][5])\r
+ + (v2[11 + dvp] * d16[i][6]) + (v2[10 + dvp] * d16[i][7])\r
+ + (v2[9 + dvp] * d16[i][8]) + (v2[8 + dvp] * d16[i][9])\r
+ + (v2[7 + dvp] * d16[i][10]) + (v2[6 + dvp] * d16[i][11])\r
+ + (v2[5 + dvp] * d16[i][12]) + (v2[4 + dvp] * d16[i][13])\r
+ + (v2[3 + dvp] * d16[i][14]) + (v2[2 + dvp] * d16[i][15])) * scalefactor);\r
+\r
+ _tmpOut[i] = pcm_sample;\r
+\r
+ dvp += 16;\r
+ } // for\r
+ }\r
+\r
+ }\r
+\r
+ private void compute_pcm_samples2() {\r
+\r
+ if (vidx == 1) {\r
+ // final float[] vp = actual_v;\r
+ // int inc = v_inc;\r
+ // final float[] tmpOut = _tmpOut;\r
+ @LOC("THIS,SynthesisFilter.NEWV") int dvp = 0;\r
+\r
+ // fat chance of having this loop unroll\r
+ for (@LOC("THIS,SynthesisFilter.NEWV") int i = 0; i < 32; i++) {\r
+ // final float[] dp = d16[i];\r
+ @LOC("THIS,SynthesisFilter.V2") float pcm_sample;\r
+\r
+ pcm_sample =\r
+ (float) (((v1[2 + dvp] * d16[i][0]) + (v1[1 + dvp] * d16[i][1])\r
+ + (v1[0 + dvp] * d16[i][2]) + (v1[15 + dvp] * d16[i][3])\r
+ + (v1[14 + dvp] * d16[i][4]) + (v1[13 + dvp] * d16[i][5])\r
+ + (v1[12 + dvp] * d16[i][6]) + (v1[11 + dvp] * d16[i][7])\r
+ + (v1[10 + dvp] * d16[i][8]) + (v1[9 + dvp] * d16[i][9])\r
+ + (v1[8 + dvp] * d16[i][10]) + (v1[7 + dvp] * d16[i][11])\r
+ + (v1[6 + dvp] * d16[i][12]) + (v1[5 + dvp] * d16[i][13])\r
+ + (v1[4 + dvp] * d16[i][14]) + (v1[3 + dvp] * d16[i][15])) * scalefactor);\r
+\r
+ _tmpOut[i] = pcm_sample;\r
+\r
+ dvp += 16;\r
+ } // for\r
+ } else {\r
+ // final float[] vp = actual_v;\r
+ // int inc = v_inc;\r
+ // final float[] tmpOut = _tmpOut;\r
+ @LOC("THIS,SynthesisFilter.NEWV") int dvp = 0;\r
+\r
+ // fat chance of having this loop unroll\r
+ for (@LOC("THIS,SynthesisFilter.NEWV") int i = 0; i < 32; i++) {\r
+ // final float[] dp = d16[i];\r
+ @LOC("THIS,SynthesisFilter.V2") float pcm_sample;\r
+\r
+ pcm_sample =\r
+ (float) (((v2[2 + dvp] * d16[i][0]) + (v2[1 + dvp] * d16[i][1])\r
+ + (v2[0 + dvp] * d16[i][2]) + (v2[15 + dvp] * d16[i][3])\r
+ + (v2[14 + dvp] * d16[i][4]) + (v2[13 + dvp] * d16[i][5])\r
+ + (v2[12 + dvp] * d16[i][6]) + (v2[11 + dvp] * d16[i][7])\r
+ + (v2[10 + dvp] * d16[i][8]) + (v2[9 + dvp] * d16[i][9])\r
+ + (v2[8 + dvp] * d16[i][10]) + (v2[7 + dvp] * d16[i][11])\r
+ + (v2[6 + dvp] * d16[i][12]) + (v2[5 + dvp] * d16[i][13])\r
+ + (v2[4 + dvp] * d16[i][14]) + (v2[3 + dvp] * d16[i][15])) * scalefactor);\r
+\r
+ _tmpOut[i] = pcm_sample;\r
+\r
+ dvp += 16;\r
+ } // for\r
+ }\r
+\r
+ }\r
+\r
+ private void compute_pcm_samples3() {\r
+\r
+ if (vidx == 1) {\r
+ // final float[] vp = actual_v;\r
+\r
+ // int inc = v_inc;\r
+ // final float[] tmpOut = _tmpOut;\r
+ @LOC("THIS,SynthesisFilter.NEWV") int dvp = 0;\r
+\r
+ // fat chance of having this loop unroll\r
+ for (@LOC("THIS,SynthesisFilter.NEWV") int i = 0; i < 32; i++) {\r
+ // final float[] dp = d16[i];\r
+ @LOC("THIS,SynthesisFilter.V2") float pcm_sample;\r
+\r
+ pcm_sample =\r
+ (float) (((v1[3 + dvp] * d16[i][0]) + (v1[2 + dvp] * d16[i][1])\r
+ + (v1[1 + dvp] * d16[i][2]) + (v1[0 + dvp] * d16[i][3])\r
+ + (v1[15 + dvp] * d16[i][4]) + (v1[14 + dvp] * d16[i][5])\r
+ + (v1[13 + dvp] * d16[i][6]) + (v1[12 + dvp] * d16[i][7])\r
+ + (v1[11 + dvp] * d16[i][8]) + (v1[10 + dvp] * d16[i][9])\r
+ + (v1[9 + dvp] * d16[i][10]) + (v1[8 + dvp] * d16[i][11])\r
+ + (v1[7 + dvp] * d16[i][12]) + (v1[6 + dvp] * d16[i][13])\r
+ + (v1[5 + dvp] * d16[i][14]) + (v1[4 + dvp] * d16[i][15])) * scalefactor);\r
+\r
+ _tmpOut[i] = pcm_sample;\r
+\r
+ dvp += 16;\r
+ } // for\r
+ } else {\r
+ // final float[] vp = actual_v;\r
+\r
+ // int inc = v_inc;\r
+ // final float[] tmpOut = _tmpOut;\r
+ @LOC("THIS,SynthesisFilter.NEWV") int dvp = 0;\r
+\r
+ // fat chance of having this loop unroll\r
+ for (@LOC("THIS,SynthesisFilter.NEWV") int i = 0; i < 32; i++) {\r
+ // final float[] dp = d16[i];\r
+ @LOC("THIS,SynthesisFilter.V2") float pcm_sample;\r
+\r
+ pcm_sample =\r
+ (float) (((v2[3 + dvp] * d16[i][0]) + (v2[2 + dvp] * d16[i][1])\r
+ + (v2[1 + dvp] * d16[i][2]) + (v2[0 + dvp] * d16[i][3])\r
+ + (v2[15 + dvp] * d16[i][4]) + (v2[14 + dvp] * d16[i][5])\r
+ + (v2[13 + dvp] * d16[i][6]) + (v2[12 + dvp] * d16[i][7])\r
+ + (v2[11 + dvp] * d16[i][8]) + (v2[10 + dvp] * d16[i][9])\r
+ + (v2[9 + dvp] * d16[i][10]) + (v2[8 + dvp] * d16[i][11])\r
+ + (v2[7 + dvp] * d16[i][12]) + (v2[6 + dvp] * d16[i][13])\r
+ + (v2[5 + dvp] * d16[i][14]) + (v2[4 + dvp] * d16[i][15])) * scalefactor);\r
+\r
+ _tmpOut[i] = pcm_sample;\r
+\r
+ dvp += 16;\r
+ } // for\r
+ }\r
+\r
+ }\r
+\r
+ private void compute_pcm_samples4() {\r
+\r
+ if (vidx == 1) {\r
+ // final float[] vp = actual_v;\r
+\r
+ // int inc = v_inc;\r
+ // final float[] tmpOut = _tmpOut;\r
+ @LOC("THIS,SynthesisFilter.NEWV") int dvp = 0;\r
+\r
+ // fat chance of having this loop unroll\r
+ for (@LOC("THIS,SynthesisFilter.NEWV") int i = 0; i < 32; i++) {\r
+ // final float[] dp = d16[i];\r
+ @LOC("THIS,SynthesisFilter.V2") float pcm_sample;\r
+\r
+ pcm_sample =\r
+ (float) (((v1[4 + dvp] * d16[i][0]) + (v1[3 + dvp] * d16[i][1])\r
+ + (v1[2 + dvp] * d16[i][2]) + (v1[1 + dvp] * d16[i][3]) + (v1[0 + dvp] * d16[i][4])\r
+ + (v1[15 + dvp] * d16[i][5]) + (v1[14 + dvp] * d16[i][6])\r
+ + (v1[13 + dvp] * d16[i][7]) + (v1[12 + dvp] * d16[i][8])\r
+ + (v1[11 + dvp] * d16[i][9]) + (v1[10 + dvp] * d16[i][10])\r
+ + (v1[9 + dvp] * d16[i][11]) + (v1[8 + dvp] * d16[i][12])\r
+ + (v1[7 + dvp] * d16[i][13]) + (v1[6 + dvp] * d16[i][14]) + (v1[5 + dvp] * d16[i][15])) * scalefactor);\r
+\r
+ _tmpOut[i] = pcm_sample;\r
+\r
+ dvp += 16;\r
+ } // for\r
+ } else {\r
+ // final float[] vp = actual_v;\r
+\r
+ // int inc = v_inc;\r
+ // final float[] tmpOut = _tmpOut;\r
+ @LOC("THIS,SynthesisFilter.NEWV") int dvp = 0;\r
+\r
+ // fat chance of having this loop unroll\r
+ for (@LOC("THIS,SynthesisFilter.NEWV") int i = 0; i < 32; i++) {\r
+ // final float[] dp = d16[i];\r
+ @LOC("THIS,SynthesisFilter.V2") float pcm_sample;\r
+\r
+ pcm_sample =\r
+ (float) (((v2[4 + dvp] * d16[i][0]) + (v2[3 + dvp] * d16[i][1])\r
+ + (v2[2 + dvp] * d16[i][2]) + (v2[1 + dvp] * d16[i][3]) + (v2[0 + dvp] * d16[i][4])\r
+ + (v2[15 + dvp] * d16[i][5]) + (v2[14 + dvp] * d16[i][6])\r
+ + (v2[13 + dvp] * d16[i][7]) + (v2[12 + dvp] * d16[i][8])\r
+ + (v2[11 + dvp] * d16[i][9]) + (v2[10 + dvp] * d16[i][10])\r
+ + (v2[9 + dvp] * d16[i][11]) + (v2[8 + dvp] * d16[i][12])\r
+ + (v2[7 + dvp] * d16[i][13]) + (v2[6 + dvp] * d16[i][14]) + (v2[5 + dvp] * d16[i][15])) * scalefactor);\r
+\r
+ _tmpOut[i] = pcm_sample;\r
+\r
+ dvp += 16;\r
+ } // for\r
+ }\r
+\r
+ }\r
+\r
+ private void compute_pcm_samples5() {\r
+\r
+ if (vidx == 1) {\r
+ // final float[] vp = actual_v;\r
+\r
+ // int inc = v_inc;\r
+ // final float[] tmpOut = _tmpOut;\r
+ @LOC("THIS,SynthesisFilter.NEWV") int dvp = 0;\r
+\r
+ // fat chance of having this loop unroll\r
+ for (@LOC("THIS,SynthesisFilter.NEWV") int i = 0; i < 32; i++) {\r
+ // final float[] dp = d16[i];\r
+ @LOC("THIS,SynthesisFilter.V2") float pcm_sample;\r
+\r
+ pcm_sample =\r
+ (float) (((v1[5 + dvp] * d16[i][0]) + (v1[4 + dvp] * d16[i][1])\r
+ + (v1[3 + dvp] * d16[i][2]) + (v1[2 + dvp] * d16[i][3]) + (v1[1 + dvp] * d16[i][4])\r
+ + (v1[0 + dvp] * d16[i][5]) + (v1[15 + dvp] * d16[i][6])\r
+ + (v1[14 + dvp] * d16[i][7]) + (v1[13 + dvp] * d16[i][8])\r
+ + (v1[12 + dvp] * d16[i][9]) + (v1[11 + dvp] * d16[i][10])\r
+ + (v1[10 + dvp] * d16[i][11]) + (v1[9 + dvp] * d16[i][12])\r
+ + (v1[8 + dvp] * d16[i][13]) + (v1[7 + dvp] * d16[i][14]) + (v1[6 + dvp] * d16[i][15])) * scalefactor);\r
+\r
+ _tmpOut[i] = pcm_sample;\r
+\r
+ dvp += 16;\r
+ } // for\r
+ } else {\r
+ // final float[] vp = actual_v;\r
+\r
+ // int inc = v_inc;\r
+ // final float[] tmpOut = _tmpOut;\r
+ @LOC("THIS,SynthesisFilter.NEWV") int dvp = 0;\r
+\r
+ // fat chance of having this loop unroll\r
+ for (@LOC("THIS,SynthesisFilter.NEWV") int i = 0; i < 32; i++) {\r
+ // final float[] dp = d16[i];\r
+ @LOC("THIS,SynthesisFilter.V2") float pcm_sample;\r
+\r
+ pcm_sample =\r
+ (float) (((v2[5 + dvp] * d16[i][0]) + (v2[4 + dvp] * d16[i][1])\r
+ + (v2[3 + dvp] * d16[i][2]) + (v2[2 + dvp] * d16[i][3]) + (v2[1 + dvp] * d16[i][4])\r
+ + (v2[0 + dvp] * d16[i][5]) + (v2[15 + dvp] * d16[i][6])\r
+ + (v2[14 + dvp] * d16[i][7]) + (v2[13 + dvp] * d16[i][8])\r
+ + (v2[12 + dvp] * d16[i][9]) + (v2[11 + dvp] * d16[i][10])\r
+ + (v2[10 + dvp] * d16[i][11]) + (v2[9 + dvp] * d16[i][12])\r
+ + (v2[8 + dvp] * d16[i][13]) + (v2[7 + dvp] * d16[i][14]) + (v2[6 + dvp] * d16[i][15])) * scalefactor);\r
+\r
+ _tmpOut[i] = pcm_sample;\r
+\r
+ dvp += 16;\r
+ } // for\r
+ }\r
+\r
+ }\r
+\r
+ private void compute_pcm_samples6() {\r
+\r
+ if (vidx == 1) {\r
+\r
+ // final float[] vp = actual_v;\r
+ // int inc = v_inc;\r
+ // final float[] tmpOut = _tmpOut;\r
+ @LOC("THIS,SynthesisFilter.NEWV") int dvp = 0;\r
+\r
+ // fat chance of having this loop unroll\r
+ for (@LOC("THIS,SynthesisFilter.NEWV") int i = 0; i < 32; i++) {\r
+ // final float[] dp = d16[i];\r
+ @LOC("THIS,SynthesisFilter.V2") float pcm_sample;\r
+\r
+ pcm_sample =\r
+ (float) (((v1[6 + dvp] * d16[i][0]) + (v1[5 + dvp] * d16[i][1])\r
+ + (v1[4 + dvp] * d16[i][2]) + (v1[3 + dvp] * d16[i][3]) + (v1[2 + dvp] * d16[i][4])\r
+ + (v1[1 + dvp] * d16[i][5]) + (v1[0 + dvp] * d16[i][6])\r
+ + (v1[15 + dvp] * d16[i][7]) + (v1[14 + dvp] * d16[i][8])\r
+ + (v1[13 + dvp] * d16[i][9]) + (v1[12 + dvp] * d16[i][10])\r
+ + (v1[11 + dvp] * d16[i][11]) + (v1[10 + dvp] * d16[i][12])\r
+ + (v1[9 + dvp] * d16[i][13]) + (v1[8 + dvp] * d16[i][14]) + (v1[7 + dvp] * d16[i][15])) * scalefactor);\r
+\r
+ _tmpOut[i] = pcm_sample;\r
+\r
+ dvp += 16;\r
+ } // for\r
+ } else {\r
+\r
+ // final float[] vp = actual_v;\r
+ // int inc = v_inc;\r
+ // final float[] tmpOut = _tmpOut;\r
+ @LOC("THIS,SynthesisFilter.NEWV") int dvp = 0;\r
+\r
+ // fat chance of having this loop unroll\r
+ for (@LOC("THIS,SynthesisFilter.NEWV") int i = 0; i < 32; i++) {\r
+ // final float[] dp = d16[i];\r
+ @LOC("THIS,SynthesisFilter.V2") float pcm_sample;\r
+\r
+ pcm_sample =\r
+ (float) (((v2[6 + dvp] * d16[i][0]) + (v2[5 + dvp] * d16[i][1])\r
+ + (v2[4 + dvp] * d16[i][2]) + (v2[3 + dvp] * d16[i][3]) + (v2[2 + dvp] * d16[i][4])\r
+ + (v2[1 + dvp] * d16[i][5]) + (v2[0 + dvp] * d16[i][6])\r
+ + (v2[15 + dvp] * d16[i][7]) + (v2[14 + dvp] * d16[i][8])\r
+ + (v2[13 + dvp] * d16[i][9]) + (v2[12 + dvp] * d16[i][10])\r
+ + (v2[11 + dvp] * d16[i][11]) + (v2[10 + dvp] * d16[i][12])\r
+ + (v2[9 + dvp] * d16[i][13]) + (v2[8 + dvp] * d16[i][14]) + (v2[7 + dvp] * d16[i][15])) * scalefactor);\r
+\r
+ _tmpOut[i] = pcm_sample;\r
+\r
+ dvp += 16;\r
+ } // for\r
+ }\r
+\r
+ }\r
+\r
+ private void compute_pcm_samples7() {\r
+\r
+ if (vidx == 1) {\r
+ // final float[] vp = actual_v;\r
+\r
+ // int inc = v_inc;\r
+ // final float[] tmpOut = _tmpOut;\r
+ @LOC("THIS,SynthesisFilter.NEWV") int dvp = 0;\r
+\r
+ // fat chance of having this loop unroll\r
+ for (@LOC("THIS,SynthesisFilter.NEWV") int i = 0; i < 32; i++) {\r
+ // final float[] dp = d16[i];\r
+ @LOC("THIS,SynthesisFilter.V2") float pcm_sample;\r
+\r
+ pcm_sample =\r
+ (float) (((v1[7 + dvp] * d16[i][0]) + (v1[6 + dvp] * d16[i][1])\r
+ + (v1[5 + dvp] * d16[i][2]) + (v1[4 + dvp] * d16[i][3]) + (v1[3 + dvp] * d16[i][4])\r
+ + (v1[2 + dvp] * d16[i][5]) + (v1[1 + dvp] * d16[i][6]) + (v1[0 + dvp] * d16[i][7])\r
+ + (v1[15 + dvp] * d16[i][8]) + (v1[14 + dvp] * d16[i][9])\r
+ + (v1[13 + dvp] * d16[i][10]) + (v1[12 + dvp] * d16[i][11])\r
+ + (v1[11 + dvp] * d16[i][12]) + (v1[10 + dvp] * d16[i][13])\r
+ + (v1[9 + dvp] * d16[i][14]) + (v1[8 + dvp] * d16[i][15])) * scalefactor);\r
+\r
+ _tmpOut[i] = pcm_sample;\r
+\r
+ dvp += 16;\r
+ } // for\r
+ } else {\r
+ // final float[] vp = actual_v;\r
+\r
+ // int inc = v_inc;\r
+ // final float[] tmpOut = _tmpOut;\r
+ @LOC("THIS,SynthesisFilter.NEWV") int dvp = 0;\r
+\r
+ // fat chance of having this loop unroll\r
+ for (@LOC("THIS,SynthesisFilter.NEWV") int i = 0; i < 32; i++) {\r
+ // final float[] dp = d16[i];\r
+ @LOC("THIS,SynthesisFilter.V2") float pcm_sample;\r
+\r
+ pcm_sample =\r
+ (float) (((v2[7 + dvp] * d16[i][0]) + (v2[6 + dvp] * d16[i][1])\r
+ + (v2[5 + dvp] * d16[i][2]) + (v2[4 + dvp] * d16[i][3]) + (v2[3 + dvp] * d16[i][4])\r
+ + (v2[2 + dvp] * d16[i][5]) + (v2[1 + dvp] * d16[i][6]) + (v2[0 + dvp] * d16[i][7])\r
+ + (v2[15 + dvp] * d16[i][8]) + (v2[14 + dvp] * d16[i][9])\r
+ + (v2[13 + dvp] * d16[i][10]) + (v2[12 + dvp] * d16[i][11])\r
+ + (v2[11 + dvp] * d16[i][12]) + (v2[10 + dvp] * d16[i][13])\r
+ + (v2[9 + dvp] * d16[i][14]) + (v2[8 + dvp] * d16[i][15])) * scalefactor);\r
+\r
+ _tmpOut[i] = pcm_sample;\r
+\r
+ dvp += 16;\r
+ } // for\r
+ }\r
+\r
+ }\r
+\r
+ private void compute_pcm_samples8() {\r
+\r
+ if (vidx == 1) {\r
+\r
+ // final float[] vp = actual_v;\r
+\r
+ // int inc = v_inc;\r
+ // final float[] tmpOut = _tmpOut;\r
+ @LOC("THIS,SynthesisFilter.NEWV") int dvp = 0;\r
+\r
+ // fat chance of having this loop unroll\r
+ for (@LOC("THIS,SynthesisFilter.NEWV") int i = 0; i < 32; i++) {\r
+ // final float[] dp = d16[i];\r
+ @LOC("THIS,SynthesisFilter.V2") float pcm_sample;\r
+\r
+ pcm_sample =\r
+ (float) (((v1[8 + dvp] * d16[i][0]) + (v1[7 + dvp] * d16[i][1])\r
+ + (v1[6 + dvp] * d16[i][2]) + (v1[5 + dvp] * d16[i][3]) + (v1[4 + dvp] * d16[i][4])\r
+ + (v1[3 + dvp] * d16[i][5]) + (v1[2 + dvp] * d16[i][6]) + (v1[1 + dvp] * d16[i][7])\r
+ + (v1[0 + dvp] * d16[i][8]) + (v1[15 + dvp] * d16[i][9])\r
+ + (v1[14 + dvp] * d16[i][10]) + (v1[13 + dvp] * d16[i][11])\r
+ + (v1[12 + dvp] * d16[i][12]) + (v1[11 + dvp] * d16[i][13])\r
+ + (v1[10 + dvp] * d16[i][14]) + (v1[9 + dvp] * d16[i][15])) * scalefactor);\r
+\r
+ _tmpOut[i] = pcm_sample;\r
+\r
+ dvp += 16;\r
+ } // for\r
+ } else {\r
+\r
+ // final float[] vp = actual_v;\r
+\r
+ // int inc = v_inc;\r
+ // final float[] tmpOut = _tmpOut;\r
+ @LOC("THIS,SynthesisFilter.NEWV") int dvp = 0;\r
+\r
+ // fat chance of having this loop unroll\r
+ for (@LOC("THIS,SynthesisFilter.NEWV") int i = 0; i < 32; i++) {\r
+ // final float[] dp = d16[i];\r
+ @LOC("THIS,SynthesisFilter.V2") float pcm_sample;\r
+\r
+ pcm_sample =\r
+ (float) (((v2[8 + dvp] * d16[i][0]) + (v2[7 + dvp] * d16[i][1])\r
+ + (v2[6 + dvp] * d16[i][2]) + (v2[5 + dvp] * d16[i][3]) + (v2[4 + dvp] * d16[i][4])\r
+ + (v2[3 + dvp] * d16[i][5]) + (v2[2 + dvp] * d16[i][6]) + (v2[1 + dvp] * d16[i][7])\r
+ + (v2[0 + dvp] * d16[i][8]) + (v2[15 + dvp] * d16[i][9])\r
+ + (v2[14 + dvp] * d16[i][10]) + (v2[13 + dvp] * d16[i][11])\r
+ + (v2[12 + dvp] * d16[i][12]) + (v2[11 + dvp] * d16[i][13])\r
+ + (v2[10 + dvp] * d16[i][14]) + (v2[9 + dvp] * d16[i][15])) * scalefactor);\r
+\r
+ _tmpOut[i] = pcm_sample;\r
+\r
+ dvp += 16;\r
+ } // for\r
+ }\r
+\r
+ }\r
+\r
+ private void compute_pcm_samples9() {\r
+\r
+ if (vidx == 1) {\r
+ // final float[] vp = actual_v;\r
+\r
+ // int inc = v_inc;\r
+ // final float[] tmpOut = _tmpOut;\r
+ @LOC("THIS,SynthesisFilter.NEWV") int dvp = 0;\r
+\r
+ // fat chance of having this loop unroll\r
+ for (@LOC("THIS,SynthesisFilter.NEWV") int i = 0; i < 32; i++) {\r
+ // final float[] dp = d16[i];\r
+ @LOC("THIS,SynthesisFilter.V2") float pcm_sample;\r
+\r
+ pcm_sample =\r
+ (float) (((v1[9 + dvp] * d16[i][0]) + (v1[8 + dvp] * d16[i][1])\r
+ + (v1[7 + dvp] * d16[i][2]) + (v1[6 + dvp] * d16[i][3]) + (v1[5 + dvp] * d16[i][4])\r
+ + (v1[4 + dvp] * d16[i][5]) + (v1[3 + dvp] * d16[i][6]) + (v1[2 + dvp] * d16[i][7])\r
+ + (v1[1 + dvp] * d16[i][8]) + (v1[0 + dvp] * d16[i][9])\r
+ + (v1[15 + dvp] * d16[i][10]) + (v1[14 + dvp] * d16[i][11])\r
+ + (v1[13 + dvp] * d16[i][12]) + (v1[12 + dvp] * d16[i][13])\r
+ + (v1[11 + dvp] * d16[i][14]) + (v1[10 + dvp] * d16[i][15])) * scalefactor);\r
+\r
+ _tmpOut[i] = pcm_sample;\r
+\r
+ dvp += 16;\r
+ } // for\r
+ } else {\r
+ // final float[] vp = actual_v;\r
+\r
+ // int inc = v_inc;\r
+ // final float[] tmpOut = _tmpOut;\r
+ @LOC("THIS,SynthesisFilter.NEWV") int dvp = 0;\r
+\r
+ // fat chance of having this loop unroll\r
+ for (@LOC("THIS,SynthesisFilter.NEWV") int i = 0; i < 32; i++) {\r
+ // final float[] dp = d16[i];\r
+ @LOC("THIS,SynthesisFilter.V2") float pcm_sample;\r
+\r
+ pcm_sample =\r
+ (float) (((v2[9 + dvp] * d16[i][0]) + (v2[8 + dvp] * d16[i][1])\r
+ + (v2[7 + dvp] * d16[i][2]) + (v2[6 + dvp] * d16[i][3]) + (v2[5 + dvp] * d16[i][4])\r
+ + (v2[4 + dvp] * d16[i][5]) + (v2[3 + dvp] * d16[i][6]) + (v2[2 + dvp] * d16[i][7])\r
+ + (v2[1 + dvp] * d16[i][8]) + (v2[0 + dvp] * d16[i][9])\r
+ + (v2[15 + dvp] * d16[i][10]) + (v2[14 + dvp] * d16[i][11])\r
+ + (v2[13 + dvp] * d16[i][12]) + (v2[12 + dvp] * d16[i][13])\r
+ + (v2[11 + dvp] * d16[i][14]) + (v2[10 + dvp] * d16[i][15])) * scalefactor);\r
+\r
+ _tmpOut[i] = pcm_sample;\r
+\r
+ dvp += 16;\r
+ } // for\r
+ }\r
+\r
+ }\r
+\r
+ private void compute_pcm_samples10() {\r
+ if (vidx == 1) {\r
+ // final float[] vp = actual_v;\r
+ // int inc = v_inc;\r
+ // final float[] tmpOut = _tmpOut;\r
+ @LOC("THIS,SynthesisFilter.NEWV") int dvp = 0;\r
+\r
+ // fat chance of having this loop unroll\r
+ for (@LOC("THIS,SynthesisFilter.NEWV") int i = 0; i < 32; i++) {\r
+ // final float[] dp = d16[i];\r
+ @LOC("THIS,SynthesisFilter.V2") float pcm_sample;\r
+\r
+ pcm_sample =\r
+ (float) (((v1[10 + dvp] * d16[i][0]) + (v1[9 + dvp] * d16[i][1])\r
+ + (v1[8 + dvp] * d16[i][2]) + (v1[7 + dvp] * d16[i][3]) + (v1[6 + dvp] * d16[i][4])\r
+ + (v1[5 + dvp] * d16[i][5]) + (v1[4 + dvp] * d16[i][6]) + (v1[3 + dvp] * d16[i][7])\r
+ + (v1[2 + dvp] * d16[i][8]) + (v1[1 + dvp] * d16[i][9])\r
+ + (v1[0 + dvp] * d16[i][10]) + (v1[15 + dvp] * d16[i][11])\r
+ + (v1[14 + dvp] * d16[i][12]) + (v1[13 + dvp] * d16[i][13])\r
+ + (v1[12 + dvp] * d16[i][14]) + (v1[11 + dvp] * d16[i][15])) * scalefactor);\r
+\r
+ _tmpOut[i] = pcm_sample;\r
+\r
+ dvp += 16;\r
+ } // for\r
+ } else {\r
+ // final float[] vp = actual_v;\r
+ // int inc = v_inc;\r
+ // final float[] tmpOut = _tmpOut;\r
+ @LOC("THIS,SynthesisFilter.NEWV") int dvp = 0;\r
+\r
+ // fat chance of having this loop unroll\r
+ for (@LOC("THIS,SynthesisFilter.NEWV") int i = 0; i < 32; i++) {\r
+ // final float[] dp = d16[i];\r
+ @LOC("THIS,SynthesisFilter.V2") float pcm_sample;\r
+\r
+ pcm_sample =\r
+ (float) (((v2[10 + dvp] * d16[i][0]) + (v2[9 + dvp] * d16[i][1])\r
+ + (v2[8 + dvp] * d16[i][2]) + (v2[7 + dvp] * d16[i][3]) + (v2[6 + dvp] * d16[i][4])\r
+ + (v2[5 + dvp] * d16[i][5]) + (v2[4 + dvp] * d16[i][6]) + (v2[3 + dvp] * d16[i][7])\r
+ + (v2[2 + dvp] * d16[i][8]) + (v2[1 + dvp] * d16[i][9])\r
+ + (v2[0 + dvp] * d16[i][10]) + (v2[15 + dvp] * d16[i][11])\r
+ + (v2[14 + dvp] * d16[i][12]) + (v2[13 + dvp] * d16[i][13])\r
+ + (v2[12 + dvp] * d16[i][14]) + (v2[11 + dvp] * d16[i][15])) * scalefactor);\r
+\r
+ _tmpOut[i] = pcm_sample;\r
+\r
+ dvp += 16;\r
+ } // for\r
+ }\r
+\r
+ }\r
+\r
+ private void compute_pcm_samples11() {\r
+\r
+ if (vidx == 1) {\r
+ // final float[] vp = actual_v;\r
+\r
+ // int inc = v_inc;\r
+ // final float[] tmpOut = _tmpOut;\r
+ @LOC("THIS,SynthesisFilter.NEWV") int dvp = 0;\r
+\r
+ // fat chance of having this loop unroll\r
+ for (@LOC("THIS,SynthesisFilter.NEWV") int i = 0; i < 32; i++) {\r
+ // final float[] dp = d16[i];\r
+ @LOC("THIS,SynthesisFilter.V2") float pcm_sample;\r
+\r
+ pcm_sample =\r
+ (float) (((v1[11 + dvp] * d16[i][0]) + (v1[10 + dvp] * d16[i][1])\r
+ + (v1[9 + dvp] * d16[i][2]) + (v1[8 + dvp] * d16[i][3]) + (v1[7 + dvp] * d16[i][4])\r
+ + (v1[6 + dvp] * d16[i][5]) + (v1[5 + dvp] * d16[i][6]) + (v1[4 + dvp] * d16[i][7])\r
+ + (v1[3 + dvp] * d16[i][8]) + (v1[2 + dvp] * d16[i][9])\r
+ + (v1[1 + dvp] * d16[i][10]) + (v1[0 + dvp] * d16[i][11])\r
+ + (v1[15 + dvp] * d16[i][12]) + (v1[14 + dvp] * d16[i][13])\r
+ + (v1[13 + dvp] * d16[i][14]) + (v1[12 + dvp] * d16[i][15])) * scalefactor);\r
+\r
+ _tmpOut[i] = pcm_sample;\r
+\r
+ dvp += 16;\r
+ } // for\r
+ } else {\r
+ // final float[] vp = actual_v;\r
+\r
+ // int inc = v_inc;\r
+ // final float[] tmpOut = _tmpOut;\r
+ @LOC("THIS,SynthesisFilter.NEWV") int dvp = 0;\r
+\r
+ // fat chance of having this loop unroll\r
+ for (@LOC("THIS,SynthesisFilter.NEWV") int i = 0; i < 32; i++) {\r
+ // final float[] dp = d16[i];\r
+ @LOC("THIS,SynthesisFilter.V2") float pcm_sample;\r
+\r
+ pcm_sample =\r
+ (float) (((v2[11 + dvp] * d16[i][0]) + (v2[10 + dvp] * d16[i][1])\r
+ + (v2[9 + dvp] * d16[i][2]) + (v2[8 + dvp] * d16[i][3]) + (v2[7 + dvp] * d16[i][4])\r
+ + (v2[6 + dvp] * d16[i][5]) + (v2[5 + dvp] * d16[i][6]) + (v2[4 + dvp] * d16[i][7])\r
+ + (v2[3 + dvp] * d16[i][8]) + (v2[2 + dvp] * d16[i][9])\r
+ + (v2[1 + dvp] * d16[i][10]) + (v2[0 + dvp] * d16[i][11])\r
+ + (v2[15 + dvp] * d16[i][12]) + (v2[14 + dvp] * d16[i][13])\r
+ + (v2[13 + dvp] * d16[i][14]) + (v2[12 + dvp] * d16[i][15])) * scalefactor);\r
+\r
+ _tmpOut[i] = pcm_sample;\r
+\r
+ dvp += 16;\r
+ } // for\r
+ }\r
+\r
+ }\r
+\r
+ private void compute_pcm_samples12() {\r
+\r
+ if (vidx == 1) {\r
+ // final float[] vp = actual_v;\r
+ // int inc = v_inc;\r
+ // final float[] tmpOut = _tmpOut;\r
+ @LOC("THIS,SynthesisFilter.NEWV") int dvp = 0;\r
+\r
+ // fat chance of having this loop unroll\r
+ for (@LOC("THIS,SynthesisFilter.NEWV") int i = 0; i < 32; i++) {\r
+ // final float[] dp = d16[i];\r
+ @LOC("THIS,SynthesisFilter.V2") float pcm_sample;\r
+\r
+ pcm_sample =\r
+ (float) (((v1[12 + dvp] * d16[i][0]) + (v1[11 + dvp] * d16[i][1])\r
+ + (v1[10 + dvp] * d16[i][2]) + (v1[9 + dvp] * d16[i][3])\r
+ + (v1[8 + dvp] * d16[i][4]) + (v1[7 + dvp] * d16[i][5]) + (v1[6 + dvp] * d16[i][6])\r
+ + (v1[5 + dvp] * d16[i][7]) + (v1[4 + dvp] * d16[i][8]) + (v1[3 + dvp] * d16[i][9])\r
+ + (v1[2 + dvp] * d16[i][10]) + (v1[1 + dvp] * d16[i][11])\r
+ + (v1[0 + dvp] * d16[i][12]) + (v1[15 + dvp] * d16[i][13])\r
+ + (v1[14 + dvp] * d16[i][14]) + (v1[13 + dvp] * d16[i][15])) * scalefactor);\r
+\r
+ _tmpOut[i] = pcm_sample;\r
+\r
+ dvp += 16;\r
+ } // for\r
+ } else {\r
+ // final float[] vp = actual_v;\r
+ // int inc = v_inc;\r
+ // final float[] tmpOut = _tmpOut;\r
+ @LOC("THIS,SynthesisFilter.NEWV") int dvp = 0;\r
+\r
+ // fat chance of having this loop unroll\r
+ for (@LOC("THIS,SynthesisFilter.NEWV") int i = 0; i < 32; i++) {\r
+ // final float[] dp = d16[i];\r
+ @LOC("THIS,SynthesisFilter.V2") float pcm_sample;\r
+\r
+ pcm_sample =\r
+ (float) (((v2[12 + dvp] * d16[i][0]) + (v2[11 + dvp] * d16[i][1])\r
+ + (v2[10 + dvp] * d16[i][2]) + (v2[9 + dvp] * d16[i][3])\r
+ + (v2[8 + dvp] * d16[i][4]) + (v2[7 + dvp] * d16[i][5]) + (v2[6 + dvp] * d16[i][6])\r
+ + (v2[5 + dvp] * d16[i][7]) + (v2[4 + dvp] * d16[i][8]) + (v2[3 + dvp] * d16[i][9])\r
+ + (v2[2 + dvp] * d16[i][10]) + (v2[1 + dvp] * d16[i][11])\r
+ + (v2[0 + dvp] * d16[i][12]) + (v2[15 + dvp] * d16[i][13])\r
+ + (v2[14 + dvp] * d16[i][14]) + (v2[13 + dvp] * d16[i][15])) * scalefactor);\r
+\r
+ _tmpOut[i] = pcm_sample;\r
+\r
+ dvp += 16;\r
+ } // for\r
+ }\r
+\r
+ }\r
+\r
+ private void compute_pcm_samples13() {\r
+\r
+ if (vidx == 1) {\r
+ // final float[] vp = actual_v;\r
+\r
+ // int inc = v_inc;\r
+ // final float[] tmpOut = _tmpOut;\r
+ @LOC("THIS,SynthesisFilter.NEWV") int dvp = 0;\r
+\r
+ // fat chance of having this loop unroll\r
+ for (@LOC("THIS,SynthesisFilter.NEWV") int i = 0; i < 32; i++) {\r
+ // final float[] dp = d16[i];\r
+ @LOC("THIS,SynthesisFilter.V2") float pcm_sample;\r
+\r
+ pcm_sample =\r
+ (float) (((v1[13 + dvp] * d16[i][0]) + (v1[12 + dvp] * d16[i][1])\r
+ + (v1[11 + dvp] * d16[i][2]) + (v1[10 + dvp] * d16[i][3])\r
+ + (v1[9 + dvp] * d16[i][4]) + (v1[8 + dvp] * d16[i][5]) + (v1[7 + dvp] * d16[i][6])\r
+ + (v1[6 + dvp] * d16[i][7]) + (v1[5 + dvp] * d16[i][8]) + (v1[4 + dvp] * d16[i][9])\r
+ + (v1[3 + dvp] * d16[i][10]) + (v1[2 + dvp] * d16[i][11])\r
+ + (v1[1 + dvp] * d16[i][12]) + (v1[0 + dvp] * d16[i][13])\r
+ + (v1[15 + dvp] * d16[i][14]) + (v1[14 + dvp] * d16[i][15])) * scalefactor);\r
+\r
+ _tmpOut[i] = pcm_sample;\r
+\r
+ dvp += 16;\r
+ } // for\r
+ } else {\r
+ // final float[] vp = actual_v;\r
+\r
+ // int inc = v_inc;\r
+ // final float[] tmpOut = _tmpOut;\r
+ @LOC("THIS,SynthesisFilter.NEWV") int dvp = 0;\r
+\r
+ // fat chance of having this loop unroll\r
+ for (@LOC("THIS,SynthesisFilter.NEWV") int i = 0; i < 32; i++) {\r
+ // final float[] dp = d16[i];\r
+ @LOC("THIS,SynthesisFilter.V2") float pcm_sample;\r
+\r
+ pcm_sample =\r
+ (float) (((v2[13 + dvp] * d16[i][0]) + (v2[12 + dvp] * d16[i][1])\r
+ + (v2[11 + dvp] * d16[i][2]) + (v2[10 + dvp] * d16[i][3])\r
+ + (v2[9 + dvp] * d16[i][4]) + (v2[8 + dvp] * d16[i][5]) + (v2[7 + dvp] * d16[i][6])\r
+ + (v2[6 + dvp] * d16[i][7]) + (v2[5 + dvp] * d16[i][8]) + (v2[4 + dvp] * d16[i][9])\r
+ + (v2[3 + dvp] * d16[i][10]) + (v2[2 + dvp] * d16[i][11])\r
+ + (v2[1 + dvp] * d16[i][12]) + (v2[0 + dvp] * d16[i][13])\r
+ + (v2[15 + dvp] * d16[i][14]) + (v2[14 + dvp] * d16[i][15])) * scalefactor);\r
+\r
+ _tmpOut[i] = pcm_sample;\r
+\r
+ dvp += 16;\r
+ } // for\r
+ }\r
+\r
+ }\r
+\r
+ private void compute_pcm_samples14() {\r
+\r
+ if (vidx == 1) {\r
+ // final float[] vp = actual_v;\r
+\r
+ // int inc = v_inc;\r
+ // final float[] tmpOut = _tmpOut;\r
+ @LOC("THIS,SynthesisFilter.NEWV") int dvp = 0;\r
+\r
+ // fat chance of having this loop unroll\r
+ for (@LOC("THIS,SynthesisFilter.NEWV") int i = 0; i < 32; i++) {\r
+ // final float[] dp = d16[i];\r
+ @LOC("THIS,SynthesisFilter.V2") float pcm_sample;\r
+\r
+ pcm_sample =\r
+ (float) (((v1[14 + dvp] * d16[i][0]) + (v1[13 + dvp] * d16[i][1])\r
+ + (v1[12 + dvp] * d16[i][2]) + (v1[11 + dvp] * d16[i][3])\r
+ + (v1[10 + dvp] * d16[i][4]) + (v1[9 + dvp] * d16[i][5])\r
+ + (v1[8 + dvp] * d16[i][6]) + (v1[7 + dvp] * d16[i][7]) + (v1[6 + dvp] * d16[i][8])\r
+ + (v1[5 + dvp] * d16[i][9]) + (v1[4 + dvp] * d16[i][10])\r
+ + (v1[3 + dvp] * d16[i][11]) + (v1[2 + dvp] * d16[i][12])\r
+ + (v1[1 + dvp] * d16[i][13]) + (v1[0 + dvp] * d16[i][14]) + (v1[15 + dvp] * d16[i][15])) * scalefactor);\r
+\r
+ _tmpOut[i] = pcm_sample;\r
+\r
+ dvp += 16;\r
+ } // for\r
+ } else {\r
+ // final float[] vp = actual_v;\r
+\r
+ // int inc = v_inc;\r
+ // final float[] tmpOut = _tmpOut;\r
+ @LOC("THIS,SynthesisFilter.NEWV") int dvp = 0;\r
+\r
+ // fat chance of having this loop unroll\r
+ for (@LOC("THIS,SynthesisFilter.NEWV") int i = 0; i < 32; i++) {\r
+ // final float[] dp = d16[i];\r
+ @LOC("THIS,SynthesisFilter.V2") float pcm_sample;\r
+\r
+ pcm_sample =\r
+ (float) (((v2[14 + dvp] * d16[i][0]) + (v2[13 + dvp] * d16[i][1])\r
+ + (v2[12 + dvp] * d16[i][2]) + (v2[11 + dvp] * d16[i][3])\r
+ + (v2[10 + dvp] * d16[i][4]) + (v2[9 + dvp] * d16[i][5])\r
+ + (v2[8 + dvp] * d16[i][6]) + (v2[7 + dvp] * d16[i][7]) + (v2[6 + dvp] * d16[i][8])\r
+ + (v2[5 + dvp] * d16[i][9]) + (v2[4 + dvp] * d16[i][10])\r
+ + (v2[3 + dvp] * d16[i][11]) + (v2[2 + dvp] * d16[i][12])\r
+ + (v2[1 + dvp] * d16[i][13]) + (v2[0 + dvp] * d16[i][14]) + (v2[15 + dvp] * d16[i][15])) * scalefactor);\r
+\r
+ _tmpOut[i] = pcm_sample;\r
+\r
+ dvp += 16;\r
+ } // for\r
+ }\r
+\r
+ }\r
+\r
+ private void compute_pcm_samples15() {\r
+ if (vidx == 1) {\r
+ // final float[] vp = actual_v;\r
+\r
+ // int inc = v_inc;\r
+ // final float[] tmpOut = _tmpOut;\r
+ @LOC("THIS,SynthesisFilter.NEWV") int dvp = 0;\r
+\r
+ // fat chance of having this loop unroll\r
+ for (@LOC("THIS,SynthesisFilter.NEWV") int i = 0; i < 32; i++) {\r
+ @LOC("THIS,SynthesisFilter.V2") float pcm_sample;\r
+ // final float d16[i][] = d16[i];\r
+ pcm_sample =\r
+ (float) (((v1[15 + dvp] * d16[i][0]) + (v1[14 + dvp] * d16[i][1])\r
+ + (v1[13 + dvp] * d16[i][2]) + (v1[12 + dvp] * d16[i][3])\r
+ + (v1[11 + dvp] * d16[i][4]) + (v1[10 + dvp] * d16[i][5])\r
+ + (v1[9 + dvp] * d16[i][6]) + (v1[8 + dvp] * d16[i][7]) + (v1[7 + dvp] * d16[i][8])\r
+ + (v1[6 + dvp] * d16[i][9]) + (v1[5 + dvp] * d16[i][10])\r
+ + (v1[4 + dvp] * d16[i][11]) + (v1[3 + dvp] * d16[i][12])\r
+ + (v1[2 + dvp] * d16[i][13]) + (v1[1 + dvp] * d16[i][14]) + (v1[0 + dvp] * d16[i][15])) * scalefactor);\r
+\r
+ _tmpOut[i] = pcm_sample;\r
+ dvp += 16;\r
+ } // for\r
+ } else {\r
+ // final float[] vp = actual_v;\r
+\r
+ // int inc = v_inc;\r
+ // final float[] tmpOut = _tmpOut;\r
+ @LOC("THIS,SynthesisFilter.NEWV") int dvp = 0;\r
+\r
+ // fat chance of having this loop unroll\r
+ for (@LOC("THIS,SynthesisFilter.NEWV") int i = 0; i < 32; i++) {\r
+ @LOC("THIS,SynthesisFilter.V2") float pcm_sample;\r
+ // final float d16[i][] = d16[i];\r
+ pcm_sample =\r
+ (float) (((v2[15 + dvp] * d16[i][0]) + (v2[14 + dvp] * d16[i][1])\r
+ + (v2[13 + dvp] * d16[i][2]) + (v2[12 + dvp] * d16[i][3])\r
+ + (v2[11 + dvp] * d16[i][4]) + (v2[10 + dvp] * d16[i][5])\r
+ + (v2[9 + dvp] * d16[i][6]) + (v2[8 + dvp] * d16[i][7]) + (v2[7 + dvp] * d16[i][8])\r
+ + (v2[6 + dvp] * d16[i][9]) + (v2[5 + dvp] * d16[i][10])\r
+ + (v2[4 + dvp] * d16[i][11]) + (v2[3 + dvp] * d16[i][12])\r
+ + (v2[2 + dvp] * d16[i][13]) + (v2[1 + dvp] * d16[i][14]) + (v2[0 + dvp] * d16[i][15])) * scalefactor);\r
+\r
+ _tmpOut[i] = pcm_sample;\r
+ dvp += 16;\r
+ } // for\r
+ }\r
+\r
+ }\r
+\r
+ private void compute_pcm_samples() {\r
+\r
+ switch (actual_write_pos) {\r
+ case 0:\r
+ compute_pcm_samples0();\r
+ break;\r
+ case 1:\r
+ compute_pcm_samples1();\r
+ break;\r
+ case 2:\r
+ compute_pcm_samples2();\r
+ break;\r
+ case 3:\r
+ compute_pcm_samples3();\r
+ break;\r
+ case 4:\r
+ compute_pcm_samples4();\r
+ break;\r
+ case 5:\r
+ compute_pcm_samples5();\r
+ break;\r
+ case 6:\r
+ compute_pcm_samples6();\r
+ break;\r
+ case 7:\r
+ compute_pcm_samples7();\r
+ break;\r
+ case 8:\r
+ compute_pcm_samples8();\r
+ break;\r
+ case 9:\r
+ compute_pcm_samples9();\r
+ break;\r
+ case 10:\r
+ compute_pcm_samples10();\r
+ break;\r
+ case 11:\r
+ compute_pcm_samples11();\r
+ break;\r
+ case 12:\r
+ compute_pcm_samples12();\r
+ break;\r
+ case 13:\r
+ compute_pcm_samples13();\r
+ break;\r
+ case 14:\r
+ compute_pcm_samples14();\r
+ break;\r
+ case 15:\r
+ compute_pcm_samples15();\r
+ break;\r
+ }\r
+\r
+ // if (buffer != null) {\r
+ // buffer.appendSamples(channel, _tmpOut);\r
+ // }\r
+ SampleBufferWrapper.appendSamples(channel, _tmpOut);\r
+\r
+ /*\r
+ * // MDM: I was considering putting in quality control for // low-spec\r
+ * CPUs, but the performance gain (about 10-15%) // did not justify the\r
+ * considerable drop in audio quality. switch (inc) { case 16:\r
+ * buffer.appendSamples(channel, tmpOut); break; case 32: for (int i=0;\r
+ * i<16; i++) { buffer.append(channel, (short)tmpOut[i]);\r
+ * buffer.append(channel, (short)tmpOut[i]); } break; case 64: for (int i=0;\r
+ * i<8; i++) { buffer.append(channel, (short)tmpOut[i]);\r
+ * buffer.append(channel, (short)tmpOut[i]); buffer.append(channel,\r
+ * (short)tmpOut[i]); buffer.append(channel, (short)tmpOut[i]); } break;\r
+ * \r
+ * }\r
+ */\r
+ }\r
+\r
+ @LATTICE("THIS<C,C*,THISLOC=THIS")\r
+ public void clear() {\r
+ // clear out v1,v2\r
+ SSJAVA.arrayinit(v1, 0);\r
+ SSJAVA.arrayinit(v2, 0);\r
+ // copy previous v1,v2\r
+ for (@LOC("THIS,SynthesisFilter.V") int i = 0; i < prev1.length; i++) {\r
+ v1[i] = prev1[i];\r
+ }\r
+ for (@LOC("THIS,SynthesisFilter.V") int i = 0; i < prev2.length; i++) {\r
+ v2[i] = prev2[i];\r
+ }\r
+ // clear out previous buffer\r
+ SSJAVA.arrayinit(prev1, 0);\r
+ SSJAVA.arrayinit(prev2, 0);\r
+ }\r
+\r
+ /**\r
+ * Calculate 32 PCM samples and put the into the Obuffer-object.\r
+ */\r
+\r
+ public void calculate_pcm_samples() {\r
+\r
+ if (vidx == 1) {\r
+ compute_new_v1_v2();\r
+ } else {\r
+ compute_new_v2_v1();\r
+ }\r
+\r
+ // System.out.println("1.actual_v=" + (actual_v == v1) + " vidx=" + vidx);\r
+ // compute_new_v();\r
+ // System.out.println("2.actual_v=" + (actual_v == v1) + " vidx=" + vidx);\r
+ compute_pcm_samples();\r
+ // System.out.println("3.actual_v=" + (actual_v == v1) + " vidx=" + vidx);\r
+\r
+ actual_write_pos = (actual_write_pos + 1) & 0xf;\r
+ // System.out.println("actual_write_pos="+actual_write_pos);\r
+ // actual_v = (actual_v == v1) ? v2 : v1;\r
+\r
+ if (vidx == 1) {\r
+ vidx = 2;\r
+ } else {\r
+ vidx = 1;\r
+ }\r
+\r
+ // initialize samples[]:\r
+ // for (register float *floatp = samples + 32; floatp > samples; )\r
+ // *--floatp = 0.0f;\r
+\r
+ // MDM: this may not be necessary. The Layer III decoder always\r
+ // outputs 32 subband samples, but I haven't checked layer I & II.\r
+ for (@LOC("C") int p = 0; p < 32; p++)\r
+ samples[p] = 0.0f;\r
+ }\r
+\r
+ private static final double MY_PI = 3.14159265358979323846;\r
+ private static final float cos1_64 = (float) (1.0 / (2.0 * Math.cos(MY_PI / 64.0)));\r
+ private static final float cos3_64 = (float) (1.0 / (2.0 * Math.cos(MY_PI * 3.0 / 64.0)));\r
+ private static final float cos5_64 = (float) (1.0 / (2.0 * Math.cos(MY_PI * 5.0 / 64.0)));\r
+ private static final float cos7_64 = (float) (1.0 / (2.0 * Math.cos(MY_PI * 7.0 / 64.0)));\r
+ private static final float cos9_64 = (float) (1.0 / (2.0 * Math.cos(MY_PI * 9.0 / 64.0)));\r
+ private static final float cos11_64 = (float) (1.0 / (2.0 * Math.cos(MY_PI * 11.0 / 64.0)));\r
+ private static final float cos13_64 = (float) (1.0 / (2.0 * Math.cos(MY_PI * 13.0 / 64.0)));\r
+ private static final float cos15_64 = (float) (1.0 / (2.0 * Math.cos(MY_PI * 15.0 / 64.0)));\r
+ private static final float cos17_64 = (float) (1.0 / (2.0 * Math.cos(MY_PI * 17.0 / 64.0)));\r
+ private static final float cos19_64 = (float) (1.0 / (2.0 * Math.cos(MY_PI * 19.0 / 64.0)));\r
+ private static final float cos21_64 = (float) (1.0 / (2.0 * Math.cos(MY_PI * 21.0 / 64.0)));\r
+ private static final float cos23_64 = (float) (1.0 / (2.0 * Math.cos(MY_PI * 23.0 / 64.0)));\r
+ private static final float cos25_64 = (float) (1.0 / (2.0 * Math.cos(MY_PI * 25.0 / 64.0)));\r
+ private static final float cos27_64 = (float) (1.0 / (2.0 * Math.cos(MY_PI * 27.0 / 64.0)));\r
+ private static final float cos29_64 = (float) (1.0 / (2.0 * Math.cos(MY_PI * 29.0 / 64.0)));\r
+ private static final float cos31_64 = (float) (1.0 / (2.0 * Math.cos(MY_PI * 31.0 / 64.0)));\r
+ private static final float cos1_32 = (float) (1.0 / (2.0 * Math.cos(MY_PI / 32.0)));\r
+ private static final float cos3_32 = (float) (1.0 / (2.0 * Math.cos(MY_PI * 3.0 / 32.0)));\r
+ private static final float cos5_32 = (float) (1.0 / (2.0 * Math.cos(MY_PI * 5.0 / 32.0)));\r
+ private static final float cos7_32 = (float) (1.0 / (2.0 * Math.cos(MY_PI * 7.0 / 32.0)));\r
+ private static final float cos9_32 = (float) (1.0 / (2.0 * Math.cos(MY_PI * 9.0 / 32.0)));\r
+ private static final float cos11_32 = (float) (1.0 / (2.0 * Math.cos(MY_PI * 11.0 / 32.0)));\r
+ private static final float cos13_32 = (float) (1.0 / (2.0 * Math.cos(MY_PI * 13.0 / 32.0)));\r
+ private static final float cos15_32 = (float) (1.0 / (2.0 * Math.cos(MY_PI * 15.0 / 32.0)));\r
+ private static final float cos1_16 = (float) (1.0 / (2.0 * Math.cos(MY_PI / 16.0)));\r
+ private static final float cos3_16 = (float) (1.0 / (2.0 * Math.cos(MY_PI * 3.0 / 16.0)));\r
+ private static final float cos5_16 = (float) (1.0 / (2.0 * Math.cos(MY_PI * 5.0 / 16.0)));\r
+ private static final float cos7_16 = (float) (1.0 / (2.0 * Math.cos(MY_PI * 7.0 / 16.0)));\r
+ private static final float cos1_8 = (float) (1.0 / (2.0 * Math.cos(MY_PI / 8.0)));\r
+ private static final float cos3_8 = (float) (1.0 / (2.0 * Math.cos(MY_PI * 3.0 / 8.0)));\r
+ private static final float cos1_4 = (float) (1.0 / (2.0 * Math.cos(MY_PI / 4.0)));\r
+\r
+ // Note: These values are not in the same order\r
+ // as in Annex 3-B.3 of the ISO/IEC DIS 11172-3\r
+ // private float d[] = {0.000000000, -4.000442505};\r
+\r
+ /**\r
+ * d[] split into subarrays of length 16. This provides for more faster access\r
+ * by allowing a block of 16 to be addressed with constant offset.\r
+ **/\r
+ // TODO CONST\r
+ @LOC("V")\r
+ private final static float d16[][] = null;\r
+\r
+ /**\r
+ * Converts a 1D array into a number of smaller arrays. This is used to\r
+ * achieve offset + constant indexing into an array. Each sub-array represents\r
+ * a block of values of the original array.\r
+ * \r
+ * @param array\r
+ * The array to split up into blocks.\r
+ * @param blockSize\r
+ * The size of the blocks to split the array into. This must be an\r
+ * exact divisor of the length of the array, or some data will be\r
+ * lost from the main array.\r
+ * \r
+ * @return An array of arrays in which each element in the returned array will\r
+ * be of length <code>blockSize</code>.\r
+ */\r
+ static private float[][] splitArray(final float[] array, final int blockSize) {\r
+ int size = array.length / blockSize;\r
+ float[][] split = new float[size][];\r
+ for (int i = 0; i < size; i++) {\r
+ split[i] = subArray(array, i * blockSize, blockSize);\r
+ }\r
+ return split;\r
+ }\r
+\r
+ /**\r
+ * Returns a subarray of an existing array.\r
+ * \r
+ * @param array\r
+ * The array to retrieve a subarra from.\r
+ * @param offs\r
+ * The offset in the array that corresponds to the first index of the\r
+ * subarray.\r
+ * @param len\r
+ * The number of indeces in the subarray.\r
+ * @return The subarray, which may be of length 0.\r
+ */\r
+ static private float[] subArray(final float[] array, final int offs, int len) {\r
+ if (offs + len > array.length) {\r
+ len = array.length - offs;\r
+ }\r
+\r
+ if (len < 0)\r
+ len = 0;\r
+\r
+ float[] subarray = new float[len];\r
+ for (int i = 0; i < len; i++) {\r
+ subarray[i] = array[offs + i];\r
+ }\r
+\r
+ return subarray;\r
+ }\r
+\r
+ // The original data for d[]. This data is loaded from a file\r
+ // to reduce the overall package size and to improve performance.\r
+\r
+ static final float d[] = { 0.000000000f, -0.000442505f, 0.003250122f, -0.007003784f,\r
+ 0.031082153f, -0.078628540f, 0.100311279f, -0.572036743f, 1.144989014f, 0.572036743f,\r
+ 0.100311279f, 0.078628540f, 0.031082153f, 0.007003784f, 0.003250122f, 0.000442505f,\r
+ -0.000015259f, -0.000473022f, 0.003326416f, -0.007919312f, 0.030517578f, -0.084182739f,\r
+ 0.090927124f, -0.600219727f, 1.144287109f, 0.543823242f, 0.108856201f, 0.073059082f,\r
+ 0.031478882f, 0.006118774f, 0.003173828f, 0.000396729f, -0.000015259f, -0.000534058f,\r
+ 0.003387451f, -0.008865356f, 0.029785156f, -0.089706421f, 0.080688477f, -0.628295898f,\r
+ 1.142211914f, 0.515609741f, 0.116577148f, 0.067520142f, 0.031738281f, 0.005294800f,\r
+ 0.003082275f, 0.000366211f, -0.000015259f, -0.000579834f, 0.003433228f, -0.009841919f,\r
+ 0.028884888f, -0.095169067f, 0.069595337f, -0.656219482f, 1.138763428f, 0.487472534f,\r
+ 0.123474121f, 0.061996460f, 0.031845093f, 0.004486084f, 0.002990723f, 0.000320435f,\r
+ -0.000015259f, -0.000625610f, 0.003463745f, -0.010848999f, 0.027801514f, -0.100540161f,\r
+ 0.057617188f, -0.683914185f, 1.133926392f, 0.459472656f, 0.129577637f, 0.056533813f,\r
+ 0.031814575f, 0.003723145f, 0.002899170f, 0.000289917f, -0.000015259f, -0.000686646f,\r
+ 0.003479004f, -0.011886597f, 0.026535034f, -0.105819702f, 0.044784546f, -0.711318970f,\r
+ 1.127746582f, 0.431655884f, 0.134887695f, 0.051132202f, 0.031661987f, 0.003005981f,\r
+ 0.002792358f, 0.000259399f, -0.000015259f, -0.000747681f, 0.003479004f, -0.012939453f,\r
+ 0.025085449f, -0.110946655f, 0.031082153f, -0.738372803f, 1.120223999f, 0.404083252f,\r
+ 0.139450073f, 0.045837402f, 0.031387329f, 0.002334595f, 0.002685547f, 0.000244141f,\r
+ -0.000030518f, -0.000808716f, 0.003463745f, -0.014022827f, 0.023422241f, -0.115921021f,\r
+ 0.016510010f, -0.765029907f, 1.111373901f, 0.376800537f, 0.143264771f, 0.040634155f,\r
+ 0.031005859f, 0.001693726f, 0.002578735f, 0.000213623f, -0.000030518f, -0.000885010f,\r
+ 0.003417969f, -0.015121460f, 0.021575928f, -0.120697021f, 0.001068115f, -0.791213989f,\r
+ 1.101211548f, 0.349868774f, 0.146362305f, 0.035552979f, 0.030532837f, 0.001098633f,\r
+ 0.002456665f, 0.000198364f, -0.000030518f, -0.000961304f, 0.003372192f, -0.016235352f,\r
+ 0.019531250f, -0.125259399f, -0.015228271f, -0.816864014f, 1.089782715f, 0.323318481f,\r
+ 0.148773193f, 0.030609131f, 0.029937744f, 0.000549316f, 0.002349854f, 0.000167847f,\r
+ -0.000030518f, -0.001037598f, 0.003280640f, -0.017349243f, 0.017257690f, -0.129562378f,\r
+ -0.032379150f, -0.841949463f, 1.077117920f, 0.297210693f, 0.150497437f, 0.025817871f,\r
+ 0.029281616f, 0.000030518f, 0.002243042f, 0.000152588f, -0.000045776f, -0.001113892f,\r
+ 0.003173828f, -0.018463135f, 0.014801025f, -0.133590698f, -0.050354004f, -0.866363525f,\r
+ 1.063217163f, 0.271591187f, 0.151596069f, 0.021179199f, 0.028533936f, -0.000442505f,\r
+ 0.002120972f, 0.000137329f, -0.000045776f, -0.001205444f, 0.003051758f, -0.019577026f,\r
+ 0.012115479f, -0.137298584f, -0.069168091f, -0.890090942f, 1.048156738f, 0.246505737f,\r
+ 0.152069092f, 0.016708374f, 0.027725220f, -0.000869751f, 0.002014160f, 0.000122070f,\r
+ -0.000061035f, -0.001296997f, 0.002883911f, -0.020690918f, 0.009231567f, -0.140670776f,\r
+ -0.088775635f, -0.913055420f, 1.031936646f, 0.221984863f, 0.151962280f, 0.012420654f,\r
+ 0.026840210f, -0.001266479f, 0.001907349f, 0.000106812f, -0.000061035f, -0.001388550f,\r
+ 0.002700806f, -0.021789551f, 0.006134033f, -0.143676758f, -0.109161377f, -0.935195923f,\r
+ 1.014617920f, 0.198059082f, 0.151306152f, 0.008316040f, 0.025909424f, -0.001617432f,\r
+ 0.001785278f, 0.000106812f, -0.000076294f, -0.001480103f, 0.002487183f, -0.022857666f,\r
+ 0.002822876f, -0.146255493f, -0.130310059f, -0.956481934f, 0.996246338f, 0.174789429f,\r
+ 0.150115967f, 0.004394531f, 0.024932861f, -0.001937866f, 0.001693726f, 0.000091553f,\r
+ -0.000076294f, -0.001586914f, 0.002227783f, -0.023910522f, -0.000686646f, -0.148422241f,\r
+ -0.152206421f, -0.976852417f, 0.976852417f, 0.152206421f, 0.148422241f, 0.000686646f,\r
+ 0.023910522f, -0.002227783f, 0.001586914f, 0.000076294f, -0.000091553f, -0.001693726f,\r
+ 0.001937866f, -0.024932861f, -0.004394531f, -0.150115967f, -0.174789429f, -0.996246338f,\r
+ 0.956481934f, 0.130310059f, 0.146255493f, -0.002822876f, 0.022857666f, -0.002487183f,\r
+ 0.001480103f, 0.000076294f, -0.000106812f, -0.001785278f, 0.001617432f, -0.025909424f,\r
+ -0.008316040f, -0.151306152f, -0.198059082f, -1.014617920f, 0.935195923f, 0.109161377f,\r
+ 0.143676758f, -0.006134033f, 0.021789551f, -0.002700806f, 0.001388550f, 0.000061035f,\r
+ -0.000106812f, -0.001907349f, 0.001266479f, -0.026840210f, -0.012420654f, -0.151962280f,\r
+ -0.221984863f, -1.031936646f, 0.913055420f, 0.088775635f, 0.140670776f, -0.009231567f,\r
+ 0.020690918f, -0.002883911f, 0.001296997f, 0.000061035f, -0.000122070f, -0.002014160f,\r
+ 0.000869751f, -0.027725220f, -0.016708374f, -0.152069092f, -0.246505737f, -1.048156738f,\r
+ 0.890090942f, 0.069168091f, 0.137298584f, -0.012115479f, 0.019577026f, -0.003051758f,\r
+ 0.001205444f, 0.000045776f, -0.000137329f, -0.002120972f, 0.000442505f, -0.028533936f,\r
+ -0.021179199f, -0.151596069f, -0.271591187f, -1.063217163f, 0.866363525f, 0.050354004f,\r
+ 0.133590698f, -0.014801025f, 0.018463135f, -0.003173828f, 0.001113892f, 0.000045776f,\r
+ -0.000152588f, -0.002243042f, -0.000030518f, -0.029281616f, -0.025817871f, -0.150497437f,\r
+ -0.297210693f, -1.077117920f, 0.841949463f, 0.032379150f, 0.129562378f, -0.017257690f,\r
+ 0.017349243f, -0.003280640f, 0.001037598f, 0.000030518f, -0.000167847f, -0.002349854f,\r
+ -0.000549316f, -0.029937744f, -0.030609131f, -0.148773193f, -0.323318481f, -1.089782715f,\r
+ 0.816864014f, 0.015228271f, 0.125259399f, -0.019531250f, 0.016235352f, -0.003372192f,\r
+ 0.000961304f, 0.000030518f, -0.000198364f, -0.002456665f, -0.001098633f, -0.030532837f,\r
+ -0.035552979f, -0.146362305f, -0.349868774f, -1.101211548f, 0.791213989f, -0.001068115f,\r
+ 0.120697021f, -0.021575928f, 0.015121460f, -0.003417969f, 0.000885010f, 0.000030518f,\r
+ -0.000213623f, -0.002578735f, -0.001693726f, -0.031005859f, -0.040634155f, -0.143264771f,\r
+ -0.376800537f, -1.111373901f, 0.765029907f, -0.016510010f, 0.115921021f, -0.023422241f,\r
+ 0.014022827f, -0.003463745f, 0.000808716f, 0.000030518f, -0.000244141f, -0.002685547f,\r
+ -0.002334595f, -0.031387329f, -0.045837402f, -0.139450073f, -0.404083252f, -1.120223999f,\r
+ 0.738372803f, -0.031082153f, 0.110946655f, -0.025085449f, 0.012939453f, -0.003479004f,\r
+ 0.000747681f, 0.000015259f, -0.000259399f, -0.002792358f, -0.003005981f, -0.031661987f,\r
+ -0.051132202f, -0.134887695f, -0.431655884f, -1.127746582f, 0.711318970f, -0.044784546f,\r
+ 0.105819702f, -0.026535034f, 0.011886597f, -0.003479004f, 0.000686646f, 0.000015259f,\r
+ -0.000289917f, -0.002899170f, -0.003723145f, -0.031814575f, -0.056533813f, -0.129577637f,\r
+ -0.459472656f, -1.133926392f, 0.683914185f, -0.057617188f, 0.100540161f, -0.027801514f,\r
+ 0.010848999f, -0.003463745f, 0.000625610f, 0.000015259f, -0.000320435f, -0.002990723f,\r
+ -0.004486084f, -0.031845093f, -0.061996460f, -0.123474121f, -0.487472534f, -1.138763428f,\r
+ 0.656219482f, -0.069595337f, 0.095169067f, -0.028884888f, 0.009841919f, -0.003433228f,\r
+ 0.000579834f, 0.000015259f, -0.000366211f, -0.003082275f, -0.005294800f, -0.031738281f,\r
+ -0.067520142f, -0.116577148f, -0.515609741f, -1.142211914f, 0.628295898f, -0.080688477f,\r
+ 0.089706421f, -0.029785156f, 0.008865356f, -0.003387451f, 0.000534058f, 0.000015259f,\r
+ -0.000396729f, -0.003173828f, -0.006118774f, -0.031478882f, -0.073059082f, -0.108856201f,\r
+ -0.543823242f, -1.144287109f, 0.600219727f, -0.090927124f, 0.084182739f, -0.030517578f,\r
+ 0.007919312f, -0.003326416f, 0.000473022f, 0.000015259f };\r
+\r
+}\r
--- /dev/null
+/*\r
+ * 11/19/04 1.0 moved to LGPL.\r
+ * 16/11/99 Renamed class, added javadoc, and changed table\r
+ * name from String to 3 chars. mdm@techie.com\r
+ * 02/15/99 Java Conversion by E.B, javalayer@javazoom.net\r
+ *\r
+ * 04/19/97 : Adapted from the ISO MPEG Audio Subgroup Software Simulation\r
+ * Group's public c source for its MPEG audio decoder. Miscellaneous\r
+ * changes by Jeff Tsay (ctsay@pasteur.eecs.berkeley.edu).\r
+ *-----------------------------------------------------------------------\r
+ * Copyright (c) 1991 MPEG/audio software simulation group, All Rights Reserved\r
+ * MPEG/audio coding/decoding software, work in progress \r
+ * NOT for public distribution until verified and approved by the \r
+ * MPEG/audio committee. For further information, please contact \r
+ * Davis Pan, 508-493-2241, e-mail: pan@3d.enet.dec.com \r
+ * \r
+ * VERSION 4.1 \r
+ * changes made since last update: \r
+ * date programmers comment \r
+ * 27.2.92 F.O.Witte (ITT Intermetall) \r
+ * 8/24/93 M. Iwadare Changed for 1 pass decoding. \r
+ * 7/14/94 J. Koller useless 'typedef' before huffcodetab removed\r
+ *-----------------------------------------------------------------------\r
+ * This program is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU Library General Public License as published\r
+ * by the Free Software Foundation; either version 2 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Library General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU Library General Public\r
+ * License along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\r
+ *----------------------------------------------------------------------\r
+ */\r
+\r
+/**\r
+ * Class to implements Huffman decoder.\r
+ */\r
+@LATTICE("FIELD<FINAL,FIELD*")\r
+@METHODDEFAULT("OUT<V,V<SH,SH<IN,SH*,THISLOC=IN,GLOBALLOC=IN")\r
+final class huffcodetab {\r
+ private static final int MXOFF = 250;\r
+ private static final int HTN = 34;\r
+\r
+ @LOC("FIELD")\r
+ private char tablename0 = ' '; /* string, containing table_description */\r
+ @LOC("FIELD")\r
+ private char tablename1 = ' '; /* string, containing table_description */\r
+ @LOC("FIELD")\r
+ private char tablename2 = ' '; /* string, containing table_description */\r
+\r
+ @LOC("FIELD")\r
+ private int xlen; /* max. x-index+ */\r
+ @LOC("FIELD")\r
+ private int ylen; /* max. y-index+ */\r
+ @LOC("FIELD")\r
+ private int linbits; /* number of linbits */\r
+ @LOC("FIELD")\r
+ private int linmax; /* max number to be stored in linbits */\r
+ @LOC("FIELD")\r
+ private int ref; /* a positive value indicates a reference */\r
+ @LOC("FIELD")\r
+ private int[] table = null; /* pointer to array[xlen][ylen] */\r
+ @LOC("FIELD")\r
+ private int[] hlen = null; /* pointer to array[xlen][ylen] */\r
+ @LOC("FIELD")\r
+ private int[][] val = null; /* decoder tree */\r
+ @LOC("FIELD")\r
+ private int treelen; /* length of decoder tree */\r
+\r
+ @LOC("FINAL")\r
+ private static int ValTab0[][] = { { 0, 0 } // dummy\r
+ };\r
+\r
+ @LOC("FINAL")\r
+ private static int ValTab1[][] = { { 2, 1 }, { 0, 0 }, { 2, 1 }, { 0, 16 }, { 2, 1 }, { 0, 1 },\r
+ { 0, 17 }, };\r
+\r
+ @LOC("FINAL")\r
+ private static int ValTab2[][] = { { 2, 1 }, { 0, 0 }, { 4, 1 }, { 2, 1 }, { 0, 16 }, { 0, 1 },\r
+ { 2, 1 }, { 0, 17 }, { 4, 1 }, { 2, 1 }, { 0, 32 }, { 0, 33 }, { 2, 1 }, { 0, 18 }, { 2, 1 },\r
+ { 0, 2 }, { 0, 34 }, };\r
+\r
+ @LOC("FINAL")\r
+ private static int ValTab3[][] = { { 4, 1 }, { 2, 1 }, { 0, 0 }, { 0, 1 }, { 2, 1 }, { 0, 17 },\r
+ { 2, 1 }, { 0, 16 }, { 4, 1 }, { 2, 1 }, { 0, 32 }, { 0, 33 }, { 2, 1 }, { 0, 18 }, { 2, 1 },\r
+ { 0, 2 }, { 0, 34 }, };\r
+\r
+ @LOC("FINAL")\r
+ private static int ValTab4[][] = { { 0, 0 } }; // dummy\r
+\r
+ @LOC("FINAL")\r
+ private static int ValTab5[][] = { { 2, 1 }, { 0, 0 }, { 4, 1 }, { 2, 1 }, { 0, 16 }, { 0, 1 },\r
+ { 2, 1 }, { 0, 17 }, { 8, 1 }, { 4, 1 }, { 2, 1 }, { 0, 32 }, { 0, 2 }, { 2, 1 }, { 0, 33 },\r
+ { 0, 18 }, { 8, 1 }, { 4, 1 }, { 2, 1 }, { 0, 34 }, { 0, 48 }, { 2, 1 }, { 0, 3 }, { 0, 19 },\r
+ { 2, 1 }, { 0, 49 }, { 2, 1 }, { 0, 50 }, { 2, 1 }, { 0, 35 }, { 0, 51 }, };\r
+\r
+ @LOC("FINAL")\r
+ private static int ValTab6[][] = { { 6, 1 }, { 4, 1 }, { 2, 1 }, { 0, 0 }, { 0, 16 }, { 0, 17 },\r
+ { 6, 1 }, { 2, 1 }, { 0, 1 }, { 2, 1 }, { 0, 32 }, { 0, 33 }, { 6, 1 }, { 2, 1 }, { 0, 18 },\r
+ { 2, 1 }, { 0, 2 }, { 0, 34 }, { 4, 1 }, { 2, 1 }, { 0, 49 }, { 0, 19 }, { 4, 1 }, { 2, 1 },\r
+ { 0, 48 }, { 0, 50 }, { 2, 1 }, { 0, 35 }, { 2, 1 }, { 0, 3 }, { 0, 51 }, };\r
+\r
+ @LOC("FINAL")\r
+ private static int ValTab7[][] = { { 2, 1 }, { 0, 0 }, { 4, 1 }, { 2, 1 }, { 0, 16 }, { 0, 1 },\r
+ { 8, 1 }, { 2, 1 }, { 0, 17 }, { 4, 1 }, { 2, 1 }, { 0, 32 }, { 0, 2 }, { 0, 33 }, { 18, 1 },\r
+ { 6, 1 }, { 2, 1 }, { 0, 18 }, { 2, 1 }, { 0, 34 }, { 0, 48 }, { 4, 1 }, { 2, 1 }, { 0, 49 },\r
+ { 0, 19 }, { 4, 1 }, { 2, 1 }, { 0, 3 }, { 0, 50 }, { 2, 1 }, { 0, 35 }, { 0, 4 }, { 10, 1 },\r
+ { 4, 1 }, { 2, 1 }, { 0, 64 }, { 0, 65 }, { 2, 1 }, { 0, 20 }, { 2, 1 }, { 0, 66 },\r
+ { 0, 36 }, { 12, 1 }, { 6, 1 }, { 4, 1 }, { 2, 1 }, { 0, 51 }, { 0, 67 }, { 0, 80 },\r
+ { 4, 1 }, { 2, 1 }, { 0, 52 }, { 0, 5 }, { 0, 81 }, { 6, 1 }, { 2, 1 }, { 0, 21 }, { 2, 1 },\r
+ { 0, 82 }, { 0, 37 }, { 4, 1 }, { 2, 1 }, { 0, 68 }, { 0, 53 }, { 4, 1 }, { 2, 1 },\r
+ { 0, 83 }, { 0, 84 }, { 2, 1 }, { 0, 69 }, { 0, 85 }, };\r
+\r
+ @LOC("FINAL")\r
+ private static int ValTab8[][] = { { 6, 1 }, { 2, 1 }, { 0, 0 }, { 2, 1 }, { 0, 16 }, { 0, 1 },\r
+ { 2, 1 }, { 0, 17 }, { 4, 1 }, { 2, 1 }, { 0, 33 }, { 0, 18 }, { 14, 1 }, { 4, 1 }, { 2, 1 },\r
+ { 0, 32 }, { 0, 2 }, { 2, 1 }, { 0, 34 }, { 4, 1 }, { 2, 1 }, { 0, 48 }, { 0, 3 }, { 2, 1 },\r
+ { 0, 49 }, { 0, 19 }, { 14, 1 }, { 8, 1 }, { 4, 1 }, { 2, 1 }, { 0, 50 }, { 0, 35 },\r
+ { 2, 1 }, { 0, 64 }, { 0, 4 }, { 2, 1 }, { 0, 65 }, { 2, 1 }, { 0, 20 }, { 0, 66 },\r
+ { 12, 1 }, { 6, 1 }, { 2, 1 }, { 0, 36 }, { 2, 1 }, { 0, 51 }, { 0, 80 }, { 4, 1 }, { 2, 1 },\r
+ { 0, 67 }, { 0, 52 }, { 0, 81 }, { 6, 1 }, { 2, 1 }, { 0, 21 }, { 2, 1 }, { 0, 5 },\r
+ { 0, 82 }, { 6, 1 }, { 2, 1 }, { 0, 37 }, { 2, 1 }, { 0, 68 }, { 0, 53 }, { 2, 1 },\r
+ { 0, 83 }, { 2, 1 }, { 0, 69 }, { 2, 1 }, { 0, 84 }, { 0, 85 }, };\r
+\r
+ @LOC("FINAL")\r
+ private static int ValTab9[][] = { { 8, 1 }, { 4, 1 }, { 2, 1 }, { 0, 0 }, { 0, 16 }, { 2, 1 },\r
+ { 0, 1 }, { 0, 17 }, { 10, 1 }, { 4, 1 }, { 2, 1 }, { 0, 32 }, { 0, 33 }, { 2, 1 },\r
+ { 0, 18 }, { 2, 1 }, { 0, 2 }, { 0, 34 }, { 12, 1 }, { 6, 1 }, { 4, 1 }, { 2, 1 }, { 0, 48 },\r
+ { 0, 3 }, { 0, 49 }, { 2, 1 }, { 0, 19 }, { 2, 1 }, { 0, 50 }, { 0, 35 }, { 12, 1 },\r
+ { 4, 1 }, { 2, 1 }, { 0, 65 }, { 0, 20 }, { 4, 1 }, { 2, 1 }, { 0, 64 }, { 0, 51 }, { 2, 1 },\r
+ { 0, 66 }, { 0, 36 }, { 10, 1 }, { 6, 1 }, { 4, 1 }, { 2, 1 }, { 0, 4 }, { 0, 80 },\r
+ { 0, 67 }, { 2, 1 }, { 0, 52 }, { 0, 81 }, { 8, 1 }, { 4, 1 }, { 2, 1 }, { 0, 21 },\r
+ { 0, 82 }, { 2, 1 }, { 0, 37 }, { 0, 68 }, { 6, 1 }, { 4, 1 }, { 2, 1 }, { 0, 5 }, { 0, 84 },\r
+ { 0, 83 }, { 2, 1 }, { 0, 53 }, { 2, 1 }, { 0, 69 }, { 0, 85 }, };\r
+\r
+ @LOC("FINAL")\r
+ private static int ValTab10[][] = { { 2, 1 }, { 0, 0 }, { 4, 1 }, { 2, 1 }, { 0, 16 }, { 0, 1 },\r
+ { 10, 1 }, { 2, 1 }, { 0, 17 }, { 4, 1 }, { 2, 1 }, { 0, 32 }, { 0, 2 }, { 2, 1 }, { 0, 33 },\r
+ { 0, 18 }, { 28, 1 }, { 8, 1 }, { 4, 1 }, { 2, 1 }, { 0, 34 }, { 0, 48 }, { 2, 1 },\r
+ { 0, 49 }, { 0, 19 }, { 8, 1 }, { 4, 1 }, { 2, 1 }, { 0, 3 }, { 0, 50 }, { 2, 1 }, { 0, 35 },\r
+ { 0, 64 }, { 4, 1 }, { 2, 1 }, { 0, 65 }, { 0, 20 }, { 4, 1 }, { 2, 1 }, { 0, 4 }, { 0, 51 },\r
+ { 2, 1 }, { 0, 66 }, { 0, 36 }, { 28, 1 }, { 10, 1 }, { 6, 1 }, { 4, 1 }, { 2, 1 },\r
+ { 0, 80 }, { 0, 5 }, { 0, 96 }, { 2, 1 }, { 0, 97 }, { 0, 22 }, { 12, 1 }, { 6, 1 },\r
+ { 4, 1 }, { 2, 1 }, { 0, 67 }, { 0, 52 }, { 0, 81 }, { 2, 1 }, { 0, 21 }, { 2, 1 },\r
+ { 0, 82 }, { 0, 37 }, { 4, 1 }, { 2, 1 }, { 0, 38 }, { 0, 54 }, { 0, 113 }, { 20, 1 },\r
+ { 8, 1 }, { 2, 1 }, { 0, 23 }, { 4, 1 }, { 2, 1 }, { 0, 68 }, { 0, 83 }, { 0, 6 }, { 6, 1 },\r
+ { 4, 1 }, { 2, 1 }, { 0, 53 }, { 0, 69 }, { 0, 98 }, { 2, 1 }, { 0, 112 }, { 2, 1 },\r
+ { 0, 7 }, { 0, 100 }, { 14, 1 }, { 4, 1 }, { 2, 1 }, { 0, 114 }, { 0, 39 }, { 6, 1 },\r
+ { 2, 1 }, { 0, 99 }, { 2, 1 }, { 0, 84 }, { 0, 85 }, { 2, 1 }, { 0, 70 }, { 0, 115 },\r
+ { 8, 1 }, { 4, 1 }, { 2, 1 }, { 0, 55 }, { 0, 101 }, { 2, 1 }, { 0, 86 }, { 0, 116 },\r
+ { 6, 1 }, { 2, 1 }, { 0, 71 }, { 2, 1 }, { 0, 102 }, { 0, 117 }, { 4, 1 }, { 2, 1 },\r
+ { 0, 87 }, { 0, 118 }, { 2, 1 }, { 0, 103 }, { 0, 119 }, };\r
+\r
+ @LOC("FINAL")\r
+ private static int ValTab11[][] = { { 6, 1 }, { 2, 1 }, { 0, 0 }, { 2, 1 }, { 0, 16 }, { 0, 1 },\r
+ { 8, 1 }, { 2, 1 }, { 0, 17 }, { 4, 1 }, { 2, 1 }, { 0, 32 }, { 0, 2 }, { 0, 18 }, { 24, 1 },\r
+ { 8, 1 }, { 2, 1 }, { 0, 33 }, { 2, 1 }, { 0, 34 }, { 2, 1 }, { 0, 48 }, { 0, 3 }, { 4, 1 },\r
+ { 2, 1 }, { 0, 49 }, { 0, 19 }, { 4, 1 }, { 2, 1 }, { 0, 50 }, { 0, 35 }, { 4, 1 }, { 2, 1 },\r
+ { 0, 64 }, { 0, 4 }, { 2, 1 }, { 0, 65 }, { 0, 20 }, { 30, 1 }, { 16, 1 }, { 10, 1 },\r
+ { 4, 1 }, { 2, 1 }, { 0, 66 }, { 0, 36 }, { 4, 1 }, { 2, 1 }, { 0, 51 }, { 0, 67 },\r
+ { 0, 80 }, { 4, 1 }, { 2, 1 }, { 0, 52 }, { 0, 81 }, { 0, 97 }, { 6, 1 }, { 2, 1 },\r
+ { 0, 22 }, { 2, 1 }, { 0, 6 }, { 0, 38 }, { 2, 1 }, { 0, 98 }, { 2, 1 }, { 0, 21 }, { 2, 1 },\r
+ { 0, 5 }, { 0, 82 }, { 16, 1 }, { 10, 1 }, { 6, 1 }, { 4, 1 }, { 2, 1 }, { 0, 37 },\r
+ { 0, 68 }, { 0, 96 }, { 2, 1 }, { 0, 99 }, { 0, 54 }, { 4, 1 }, { 2, 1 }, { 0, 112 },\r
+ { 0, 23 }, { 0, 113 }, { 16, 1 }, { 6, 1 }, { 4, 1 }, { 2, 1 }, { 0, 7 }, { 0, 100 },\r
+ { 0, 114 }, { 2, 1 }, { 0, 39 }, { 4, 1 }, { 2, 1 }, { 0, 83 }, { 0, 53 }, { 2, 1 },\r
+ { 0, 84 }, { 0, 69 }, { 10, 1 }, { 4, 1 }, { 2, 1 }, { 0, 70 }, { 0, 115 }, { 2, 1 },\r
+ { 0, 55 }, { 2, 1 }, { 0, 101 }, { 0, 86 }, { 10, 1 }, { 6, 1 }, { 4, 1 }, { 2, 1 },\r
+ { 0, 85 }, { 0, 87 }, { 0, 116 }, { 2, 1 }, { 0, 71 }, { 0, 102 }, { 4, 1 }, { 2, 1 },\r
+ { 0, 117 }, { 0, 118 }, { 2, 1 }, { 0, 103 }, { 0, 119 }, };\r
+\r
+ @LOC("FINAL")\r
+ private static int ValTab12[][] = { { 12, 1 }, { 4, 1 }, { 2, 1 }, { 0, 16 }, { 0, 1 }, { 2, 1 },\r
+ { 0, 17 }, { 2, 1 }, { 0, 0 }, { 2, 1 }, { 0, 32 }, { 0, 2 }, { 16, 1 }, { 4, 1 }, { 2, 1 },\r
+ { 0, 33 }, { 0, 18 }, { 4, 1 }, { 2, 1 }, { 0, 34 }, { 0, 49 }, { 2, 1 }, { 0, 19 },\r
+ { 2, 1 }, { 0, 48 }, { 2, 1 }, { 0, 3 }, { 0, 64 }, { 26, 1 }, { 8, 1 }, { 4, 1 }, { 2, 1 },\r
+ { 0, 50 }, { 0, 35 }, { 2, 1 }, { 0, 65 }, { 0, 51 }, { 10, 1 }, { 4, 1 }, { 2, 1 },\r
+ { 0, 20 }, { 0, 66 }, { 2, 1 }, { 0, 36 }, { 2, 1 }, { 0, 4 }, { 0, 80 }, { 4, 1 }, { 2, 1 },\r
+ { 0, 67 }, { 0, 52 }, { 2, 1 }, { 0, 81 }, { 0, 21 }, { 28, 1 }, { 14, 1 }, { 8, 1 },\r
+ { 4, 1 }, { 2, 1 }, { 0, 82 }, { 0, 37 }, { 2, 1 }, { 0, 83 }, { 0, 53 }, { 4, 1 }, { 2, 1 },\r
+ { 0, 96 }, { 0, 22 }, { 0, 97 }, { 4, 1 }, { 2, 1 }, { 0, 98 }, { 0, 38 }, { 6, 1 },\r
+ { 4, 1 }, { 2, 1 }, { 0, 5 }, { 0, 6 }, { 0, 68 }, { 2, 1 }, { 0, 84 }, { 0, 69 }, { 18, 1 },\r
+ { 10, 1 }, { 4, 1 }, { 2, 1 }, { 0, 99 }, { 0, 54 }, { 4, 1 }, { 2, 1 }, { 0, 112 },\r
+ { 0, 7 }, { 0, 113 }, { 4, 1 }, { 2, 1 }, { 0, 23 }, { 0, 100 }, { 2, 1 }, { 0, 70 },\r
+ { 0, 114 }, { 10, 1 }, { 6, 1 }, { 2, 1 }, { 0, 39 }, { 2, 1 }, { 0, 85 }, { 0, 115 },\r
+ { 2, 1 }, { 0, 55 }, { 0, 86 }, { 8, 1 }, { 4, 1 }, { 2, 1 }, { 0, 101 }, { 0, 116 },\r
+ { 2, 1 }, { 0, 71 }, { 0, 102 }, { 4, 1 }, { 2, 1 }, { 0, 117 }, { 0, 87 }, { 2, 1 },\r
+ { 0, 118 }, { 2, 1 }, { 0, 103 }, { 0, 119 }, };\r
+\r
+ @LOC("FINAL")\r
+ private static int ValTab13[][] = { { 2, 1 }, { 0, 0 }, { 6, 1 }, { 2, 1 }, { 0, 16 }, { 2, 1 },\r
+ { 0, 1 }, { 0, 17 }, { 28, 1 }, { 8, 1 }, { 4, 1 }, { 2, 1 }, { 0, 32 }, { 0, 2 }, { 2, 1 },\r
+ { 0, 33 }, { 0, 18 }, { 8, 1 }, { 4, 1 }, { 2, 1 }, { 0, 34 }, { 0, 48 }, { 2, 1 }, { 0, 3 },\r
+ { 0, 49 }, { 6, 1 }, { 2, 1 }, { 0, 19 }, { 2, 1 }, { 0, 50 }, { 0, 35 }, { 4, 1 }, { 2, 1 },\r
+ { 0, 64 }, { 0, 4 }, { 0, 65 }, { 70, 1 }, { 28, 1 }, { 14, 1 }, { 6, 1 }, { 2, 1 },\r
+ { 0, 20 }, { 2, 1 }, { 0, 51 }, { 0, 66 }, { 4, 1 }, { 2, 1 }, { 0, 36 }, { 0, 80 },\r
+ { 2, 1 }, { 0, 67 }, { 0, 52 }, { 4, 1 }, { 2, 1 }, { 0, 81 }, { 0, 21 }, { 4, 1 }, { 2, 1 },\r
+ { 0, 5 }, { 0, 82 }, { 2, 1 }, { 0, 37 }, { 2, 1 }, { 0, 68 }, { 0, 83 }, { 14, 1 },\r
+ { 8, 1 }, { 4, 1 }, { 2, 1 }, { 0, 96 }, { 0, 6 }, { 2, 1 }, { 0, 97 }, { 0, 22 }, { 4, 1 },\r
+ { 2, 1 }, { 0, 128 }, { 0, 8 }, { 0, 129 }, { 16, 1 }, { 8, 1 }, { 4, 1 }, { 2, 1 },\r
+ { 0, 53 }, { 0, 98 }, { 2, 1 }, { 0, 38 }, { 0, 84 }, { 4, 1 }, { 2, 1 }, { 0, 69 },\r
+ { 0, 99 }, { 2, 1 }, { 0, 54 }, { 0, 112 }, { 6, 1 }, { 4, 1 }, { 2, 1 }, { 0, 7 },\r
+ { 0, 85 }, { 0, 113 }, { 2, 1 }, { 0, 23 }, { 2, 1 }, { 0, 39 }, { 0, 55 }, { 72, 1 },\r
+ { 24, 1 }, { 12, 1 }, { 4, 1 }, { 2, 1 }, { 0, 24 }, { 0, 130 }, { 2, 1 }, { 0, 40 },\r
+ { 4, 1 }, { 2, 1 }, { 0, 100 }, { 0, 70 }, { 0, 114 }, { 8, 1 }, { 4, 1 }, { 2, 1 },\r
+ { 0, 132 }, { 0, 72 }, { 2, 1 }, { 0, 144 }, { 0, 9 }, { 2, 1 }, { 0, 145 }, { 0, 25 },\r
+ { 24, 1 }, { 14, 1 }, { 8, 1 }, { 4, 1 }, { 2, 1 }, { 0, 115 }, { 0, 101 }, { 2, 1 },\r
+ { 0, 86 }, { 0, 116 }, { 4, 1 }, { 2, 1 }, { 0, 71 }, { 0, 102 }, { 0, 131 }, { 6, 1 },\r
+ { 2, 1 }, { 0, 56 }, { 2, 1 }, { 0, 117 }, { 0, 87 }, { 2, 1 }, { 0, 146 }, { 0, 41 },\r
+ { 14, 1 }, { 8, 1 }, { 4, 1 }, { 2, 1 }, { 0, 103 }, { 0, 133 }, { 2, 1 }, { 0, 88 },\r
+ { 0, 57 }, { 2, 1 }, { 0, 147 }, { 2, 1 }, { 0, 73 }, { 0, 134 }, { 6, 1 }, { 2, 1 },\r
+ { 0, 160 }, { 2, 1 }, { 0, 104 }, { 0, 10 }, { 2, 1 }, { 0, 161 }, { 0, 26 }, { 68, 1 },\r
+ { 24, 1 }, { 12, 1 }, { 4, 1 }, { 2, 1 }, { 0, 162 }, { 0, 42 }, { 4, 1 }, { 2, 1 },\r
+ { 0, 149 }, { 0, 89 }, { 2, 1 }, { 0, 163 }, { 0, 58 }, { 8, 1 }, { 4, 1 }, { 2, 1 },\r
+ { 0, 74 }, { 0, 150 }, { 2, 1 }, { 0, 176 }, { 0, 11 }, { 2, 1 }, { 0, 177 }, { 0, 27 },\r
+ { 20, 1 }, { 8, 1 }, { 2, 1 }, { 0, 178 }, { 4, 1 }, { 2, 1 }, { 0, 118 }, { 0, 119 },\r
+ { 0, 148 }, { 6, 1 }, { 4, 1 }, { 2, 1 }, { 0, 135 }, { 0, 120 }, { 0, 164 }, { 4, 1 },\r
+ { 2, 1 }, { 0, 105 }, { 0, 165 }, { 0, 43 }, { 12, 1 }, { 6, 1 }, { 4, 1 }, { 2, 1 },\r
+ { 0, 90 }, { 0, 136 }, { 0, 179 }, { 2, 1 }, { 0, 59 }, { 2, 1 }, { 0, 121 }, { 0, 166 },\r
+ { 6, 1 }, { 4, 1 }, { 2, 1 }, { 0, 106 }, { 0, 180 }, { 0, 192 }, { 4, 1 }, { 2, 1 },\r
+ { 0, 12 }, { 0, 152 }, { 0, 193 }, { 60, 1 }, { 22, 1 }, { 10, 1 }, { 6, 1 }, { 2, 1 },\r
+ { 0, 28 }, { 2, 1 }, { 0, 137 }, { 0, 181 }, { 2, 1 }, { 0, 91 }, { 0, 194 }, { 4, 1 },\r
+ { 2, 1 }, { 0, 44 }, { 0, 60 }, { 4, 1 }, { 2, 1 }, { 0, 182 }, { 0, 107 }, { 2, 1 },\r
+ { 0, 196 }, { 0, 76 }, { 16, 1 }, { 8, 1 }, { 4, 1 }, { 2, 1 }, { 0, 168 }, { 0, 138 },\r
+ { 2, 1 }, { 0, 208 }, { 0, 13 }, { 2, 1 }, { 0, 209 }, { 2, 1 }, { 0, 75 }, { 2, 1 },\r
+ { 0, 151 }, { 0, 167 }, { 12, 1 }, { 6, 1 }, { 2, 1 }, { 0, 195 }, { 2, 1 }, { 0, 122 },\r
+ { 0, 153 }, { 4, 1 }, { 2, 1 }, { 0, 197 }, { 0, 92 }, { 0, 183 }, { 4, 1 }, { 2, 1 },\r
+ { 0, 29 }, { 0, 210 }, { 2, 1 }, { 0, 45 }, { 2, 1 }, { 0, 123 }, { 0, 211 }, { 52, 1 },\r
+ { 28, 1 }, { 12, 1 }, { 4, 1 }, { 2, 1 }, { 0, 61 }, { 0, 198 }, { 4, 1 }, { 2, 1 },\r
+ { 0, 108 }, { 0, 169 }, { 2, 1 }, { 0, 154 }, { 0, 212 }, { 8, 1 }, { 4, 1 }, { 2, 1 },\r
+ { 0, 184 }, { 0, 139 }, { 2, 1 }, { 0, 77 }, { 0, 199 }, { 4, 1 }, { 2, 1 }, { 0, 124 },\r
+ { 0, 213 }, { 2, 1 }, { 0, 93 }, { 0, 224 }, { 10, 1 }, { 4, 1 }, { 2, 1 }, { 0, 225 },\r
+ { 0, 30 }, { 4, 1 }, { 2, 1 }, { 0, 14 }, { 0, 46 }, { 0, 226 }, { 8, 1 }, { 4, 1 },\r
+ { 2, 1 }, { 0, 227 }, { 0, 109 }, { 2, 1 }, { 0, 140 }, { 0, 228 }, { 4, 1 }, { 2, 1 },\r
+ { 0, 229 }, { 0, 186 }, { 0, 240 }, { 38, 1 }, { 16, 1 }, { 4, 1 }, { 2, 1 }, { 0, 241 },\r
+ { 0, 31 }, { 6, 1 }, { 4, 1 }, { 2, 1 }, { 0, 170 }, { 0, 155 }, { 0, 185 }, { 2, 1 },\r
+ { 0, 62 }, { 2, 1 }, { 0, 214 }, { 0, 200 }, { 12, 1 }, { 6, 1 }, { 2, 1 }, { 0, 78 },\r
+ { 2, 1 }, { 0, 215 }, { 0, 125 }, { 2, 1 }, { 0, 171 }, { 2, 1 }, { 0, 94 }, { 0, 201 },\r
+ { 6, 1 }, { 2, 1 }, { 0, 15 }, { 2, 1 }, { 0, 156 }, { 0, 110 }, { 2, 1 }, { 0, 242 },\r
+ { 0, 47 }, { 32, 1 }, { 16, 1 }, { 6, 1 }, { 4, 1 }, { 2, 1 }, { 0, 216 }, { 0, 141 },\r
+ { 0, 63 }, { 6, 1 }, { 2, 1 }, { 0, 243 }, { 2, 1 }, { 0, 230 }, { 0, 202 }, { 2, 1 },\r
+ { 0, 244 }, { 0, 79 }, { 8, 1 }, { 4, 1 }, { 2, 1 }, { 0, 187 }, { 0, 172 }, { 2, 1 },\r
+ { 0, 231 }, { 0, 245 }, { 4, 1 }, { 2, 1 }, { 0, 217 }, { 0, 157 }, { 2, 1 }, { 0, 95 },\r
+ { 0, 232 }, { 30, 1 }, { 12, 1 }, { 6, 1 }, { 2, 1 }, { 0, 111 }, { 2, 1 }, { 0, 246 },\r
+ { 0, 203 }, { 4, 1 }, { 2, 1 }, { 0, 188 }, { 0, 173 }, { 0, 218 }, { 8, 1 }, { 2, 1 },\r
+ { 0, 247 }, { 4, 1 }, { 2, 1 }, { 0, 126 }, { 0, 127 }, { 0, 142 }, { 6, 1 }, { 4, 1 },\r
+ { 2, 1 }, { 0, 158 }, { 0, 174 }, { 0, 204 }, { 2, 1 }, { 0, 248 }, { 0, 143 }, { 18, 1 },\r
+ { 8, 1 }, { 4, 1 }, { 2, 1 }, { 0, 219 }, { 0, 189 }, { 2, 1 }, { 0, 234 }, { 0, 249 },\r
+ { 4, 1 }, { 2, 1 }, { 0, 159 }, { 0, 235 }, { 2, 1 }, { 0, 190 }, { 2, 1 }, { 0, 205 },\r
+ { 0, 250 }, { 14, 1 }, { 4, 1 }, { 2, 1 }, { 0, 221 }, { 0, 236 }, { 6, 1 }, { 4, 1 },\r
+ { 2, 1 }, { 0, 233 }, { 0, 175 }, { 0, 220 }, { 2, 1 }, { 0, 206 }, { 0, 251 }, { 8, 1 },\r
+ { 4, 1 }, { 2, 1 }, { 0, 191 }, { 0, 222 }, { 2, 1 }, { 0, 207 }, { 0, 238 }, { 4, 1 },\r
+ { 2, 1 }, { 0, 223 }, { 0, 239 }, { 2, 1 }, { 0, 255 }, { 2, 1 }, { 0, 237 }, { 2, 1 },\r
+ { 0, 253 }, { 2, 1 }, { 0, 252 }, { 0, 254 }, };\r
+\r
+ @LOC("FINAL")\r
+ private static int ValTab14[][] = { { 0, 0 } // dummy\r
+ };\r
+\r
+ @LOC("FINAL")\r
+ private static int ValTab15[][] = { { 16, 1 }, { 6, 1 }, { 2, 1 }, { 0, 0 }, { 2, 1 }, { 0, 16 },\r
+ { 0, 1 }, { 2, 1 }, { 0, 17 }, { 4, 1 }, { 2, 1 }, { 0, 32 }, { 0, 2 }, { 2, 1 }, { 0, 33 },\r
+ { 0, 18 }, { 50, 1 }, { 16, 1 }, { 6, 1 }, { 2, 1 }, { 0, 34 }, { 2, 1 }, { 0, 48 },\r
+ { 0, 49 }, { 6, 1 }, { 2, 1 }, { 0, 19 }, { 2, 1 }, { 0, 3 }, { 0, 64 }, { 2, 1 }, { 0, 50 },\r
+ { 0, 35 }, { 14, 1 }, { 6, 1 }, { 4, 1 }, { 2, 1 }, { 0, 4 }, { 0, 20 }, { 0, 65 }, { 4, 1 },\r
+ { 2, 1 }, { 0, 51 }, { 0, 66 }, { 2, 1 }, { 0, 36 }, { 0, 67 }, { 10, 1 }, { 6, 1 },\r
+ { 2, 1 }, { 0, 52 }, { 2, 1 }, { 0, 80 }, { 0, 5 }, { 2, 1 }, { 0, 81 }, { 0, 21 }, { 4, 1 },\r
+ { 2, 1 }, { 0, 82 }, { 0, 37 }, { 4, 1 }, { 2, 1 }, { 0, 68 }, { 0, 83 }, { 0, 97 },\r
+ { 90, 1 }, { 36, 1 }, { 18, 1 }, { 10, 1 }, { 6, 1 }, { 2, 1 }, { 0, 53 }, { 2, 1 },\r
+ { 0, 96 }, { 0, 6 }, { 2, 1 }, { 0, 22 }, { 0, 98 }, { 4, 1 }, { 2, 1 }, { 0, 38 },\r
+ { 0, 84 }, { 2, 1 }, { 0, 69 }, { 0, 99 }, { 10, 1 }, { 6, 1 }, { 2, 1 }, { 0, 54 },\r
+ { 2, 1 }, { 0, 112 }, { 0, 7 }, { 2, 1 }, { 0, 113 }, { 0, 85 }, { 4, 1 }, { 2, 1 },\r
+ { 0, 23 }, { 0, 100 }, { 2, 1 }, { 0, 114 }, { 0, 39 }, { 24, 1 }, { 16, 1 }, { 8, 1 },\r
+ { 4, 1 }, { 2, 1 }, { 0, 70 }, { 0, 115 }, { 2, 1 }, { 0, 55 }, { 0, 101 }, { 4, 1 },\r
+ { 2, 1 }, { 0, 86 }, { 0, 128 }, { 2, 1 }, { 0, 8 }, { 0, 116 }, { 4, 1 }, { 2, 1 },\r
+ { 0, 129 }, { 0, 24 }, { 2, 1 }, { 0, 130 }, { 0, 40 }, { 16, 1 }, { 8, 1 }, { 4, 1 },\r
+ { 2, 1 }, { 0, 71 }, { 0, 102 }, { 2, 1 }, { 0, 131 }, { 0, 56 }, { 4, 1 }, { 2, 1 },\r
+ { 0, 117 }, { 0, 87 }, { 2, 1 }, { 0, 132 }, { 0, 72 }, { 6, 1 }, { 4, 1 }, { 2, 1 },\r
+ { 0, 144 }, { 0, 25 }, { 0, 145 }, { 4, 1 }, { 2, 1 }, { 0, 146 }, { 0, 118 }, { 2, 1 },\r
+ { 0, 103 }, { 0, 41 }, { 92, 1 }, { 36, 1 }, { 18, 1 }, { 10, 1 }, { 4, 1 }, { 2, 1 },\r
+ { 0, 133 }, { 0, 88 }, { 4, 1 }, { 2, 1 }, { 0, 9 }, { 0, 119 }, { 0, 147 }, { 4, 1 },\r
+ { 2, 1 }, { 0, 57 }, { 0, 148 }, { 2, 1 }, { 0, 73 }, { 0, 134 }, { 10, 1 }, { 6, 1 },\r
+ { 2, 1 }, { 0, 104 }, { 2, 1 }, { 0, 160 }, { 0, 10 }, { 2, 1 }, { 0, 161 }, { 0, 26 },\r
+ { 4, 1 }, { 2, 1 }, { 0, 162 }, { 0, 42 }, { 2, 1 }, { 0, 149 }, { 0, 89 }, { 26, 1 },\r
+ { 14, 1 }, { 6, 1 }, { 2, 1 }, { 0, 163 }, { 2, 1 }, { 0, 58 }, { 0, 135 }, { 4, 1 },\r
+ { 2, 1 }, { 0, 120 }, { 0, 164 }, { 2, 1 }, { 0, 74 }, { 0, 150 }, { 6, 1 }, { 4, 1 },\r
+ { 2, 1 }, { 0, 105 }, { 0, 176 }, { 0, 177 }, { 4, 1 }, { 2, 1 }, { 0, 27 }, { 0, 165 },\r
+ { 0, 178 }, { 14, 1 }, { 8, 1 }, { 4, 1 }, { 2, 1 }, { 0, 90 }, { 0, 43 }, { 2, 1 },\r
+ { 0, 136 }, { 0, 151 }, { 2, 1 }, { 0, 179 }, { 2, 1 }, { 0, 121 }, { 0, 59 }, { 8, 1 },\r
+ { 4, 1 }, { 2, 1 }, { 0, 106 }, { 0, 180 }, { 2, 1 }, { 0, 75 }, { 0, 193 }, { 4, 1 },\r
+ { 2, 1 }, { 0, 152 }, { 0, 137 }, { 2, 1 }, { 0, 28 }, { 0, 181 }, { 80, 1 }, { 34, 1 },\r
+ { 16, 1 }, { 6, 1 }, { 4, 1 }, { 2, 1 }, { 0, 91 }, { 0, 44 }, { 0, 194 }, { 6, 1 },\r
+ { 4, 1 }, { 2, 1 }, { 0, 11 }, { 0, 192 }, { 0, 166 }, { 2, 1 }, { 0, 167 }, { 0, 122 },\r
+ { 10, 1 }, { 4, 1 }, { 2, 1 }, { 0, 195 }, { 0, 60 }, { 4, 1 }, { 2, 1 }, { 0, 12 },\r
+ { 0, 153 }, { 0, 182 }, { 4, 1 }, { 2, 1 }, { 0, 107 }, { 0, 196 }, { 2, 1 }, { 0, 76 },\r
+ { 0, 168 }, { 20, 1 }, { 10, 1 }, { 4, 1 }, { 2, 1 }, { 0, 138 }, { 0, 197 }, { 4, 1 },\r
+ { 2, 1 }, { 0, 208 }, { 0, 92 }, { 0, 209 }, { 4, 1 }, { 2, 1 }, { 0, 183 }, { 0, 123 },\r
+ { 2, 1 }, { 0, 29 }, { 2, 1 }, { 0, 13 }, { 0, 45 }, { 12, 1 }, { 4, 1 }, { 2, 1 },\r
+ { 0, 210 }, { 0, 211 }, { 4, 1 }, { 2, 1 }, { 0, 61 }, { 0, 198 }, { 2, 1 }, { 0, 108 },\r
+ { 0, 169 }, { 6, 1 }, { 4, 1 }, { 2, 1 }, { 0, 154 }, { 0, 184 }, { 0, 212 }, { 4, 1 },\r
+ { 2, 1 }, { 0, 139 }, { 0, 77 }, { 2, 1 }, { 0, 199 }, { 0, 124 }, { 68, 1 }, { 34, 1 },\r
+ { 18, 1 }, { 10, 1 }, { 4, 1 }, { 2, 1 }, { 0, 213 }, { 0, 93 }, { 4, 1 }, { 2, 1 },\r
+ { 0, 224 }, { 0, 14 }, { 0, 225 }, { 4, 1 }, { 2, 1 }, { 0, 30 }, { 0, 226 }, { 2, 1 },\r
+ { 0, 170 }, { 0, 46 }, { 8, 1 }, { 4, 1 }, { 2, 1 }, { 0, 185 }, { 0, 155 }, { 2, 1 },\r
+ { 0, 227 }, { 0, 214 }, { 4, 1 }, { 2, 1 }, { 0, 109 }, { 0, 62 }, { 2, 1 }, { 0, 200 },\r
+ { 0, 140 }, { 16, 1 }, { 8, 1 }, { 4, 1 }, { 2, 1 }, { 0, 228 }, { 0, 78 }, { 2, 1 },\r
+ { 0, 215 }, { 0, 125 }, { 4, 1 }, { 2, 1 }, { 0, 229 }, { 0, 186 }, { 2, 1 }, { 0, 171 },\r
+ { 0, 94 }, { 8, 1 }, { 4, 1 }, { 2, 1 }, { 0, 201 }, { 0, 156 }, { 2, 1 }, { 0, 241 },\r
+ { 0, 31 }, { 6, 1 }, { 4, 1 }, { 2, 1 }, { 0, 240 }, { 0, 110 }, { 0, 242 }, { 2, 1 },\r
+ { 0, 47 }, { 0, 230 }, { 38, 1 }, { 18, 1 }, { 8, 1 }, { 4, 1 }, { 2, 1 }, { 0, 216 },\r
+ { 0, 243 }, { 2, 1 }, { 0, 63 }, { 0, 244 }, { 6, 1 }, { 2, 1 }, { 0, 79 }, { 2, 1 },\r
+ { 0, 141 }, { 0, 217 }, { 2, 1 }, { 0, 187 }, { 0, 202 }, { 8, 1 }, { 4, 1 }, { 2, 1 },\r
+ { 0, 172 }, { 0, 231 }, { 2, 1 }, { 0, 126 }, { 0, 245 }, { 8, 1 }, { 4, 1 }, { 2, 1 },\r
+ { 0, 157 }, { 0, 95 }, { 2, 1 }, { 0, 232 }, { 0, 142 }, { 2, 1 }, { 0, 246 }, { 0, 203 },\r
+ { 34, 1 }, { 18, 1 }, { 10, 1 }, { 6, 1 }, { 4, 1 }, { 2, 1 }, { 0, 15 }, { 0, 174 },\r
+ { 0, 111 }, { 2, 1 }, { 0, 188 }, { 0, 218 }, { 4, 1 }, { 2, 1 }, { 0, 173 }, { 0, 247 },\r
+ { 2, 1 }, { 0, 127 }, { 0, 233 }, { 8, 1 }, { 4, 1 }, { 2, 1 }, { 0, 158 }, { 0, 204 },\r
+ { 2, 1 }, { 0, 248 }, { 0, 143 }, { 4, 1 }, { 2, 1 }, { 0, 219 }, { 0, 189 }, { 2, 1 },\r
+ { 0, 234 }, { 0, 249 }, { 16, 1 }, { 8, 1 }, { 4, 1 }, { 2, 1 }, { 0, 159 }, { 0, 220 },\r
+ { 2, 1 }, { 0, 205 }, { 0, 235 }, { 4, 1 }, { 2, 1 }, { 0, 190 }, { 0, 250 }, { 2, 1 },\r
+ { 0, 175 }, { 0, 221 }, { 14, 1 }, { 6, 1 }, { 4, 1 }, { 2, 1 }, { 0, 236 }, { 0, 206 },\r
+ { 0, 251 }, { 4, 1 }, { 2, 1 }, { 0, 191 }, { 0, 237 }, { 2, 1 }, { 0, 222 }, { 0, 252 },\r
+ { 6, 1 }, { 4, 1 }, { 2, 1 }, { 0, 207 }, { 0, 253 }, { 0, 238 }, { 4, 1 }, { 2, 1 },\r
+ { 0, 223 }, { 0, 254 }, { 2, 1 }, { 0, 239 }, { 0, 255 }, };\r
+\r
+ @LOC("FINAL")\r
+ private static int ValTab16[][] = { { 2, 1 }, { 0, 0 }, { 6, 1 }, { 2, 1 }, { 0, 16 }, { 2, 1 },\r
+ { 0, 1 }, { 0, 17 }, { 42, 1 }, { 8, 1 }, { 4, 1 }, { 2, 1 }, { 0, 32 }, { 0, 2 }, { 2, 1 },\r
+ { 0, 33 }, { 0, 18 }, { 10, 1 }, { 6, 1 }, { 2, 1 }, { 0, 34 }, { 2, 1 }, { 0, 48 },\r
+ { 0, 3 }, { 2, 1 }, { 0, 49 }, { 0, 19 }, { 10, 1 }, { 4, 1 }, { 2, 1 }, { 0, 50 },\r
+ { 0, 35 }, { 4, 1 }, { 2, 1 }, { 0, 64 }, { 0, 4 }, { 0, 65 }, { 6, 1 }, { 2, 1 }, { 0, 20 },\r
+ { 2, 1 }, { 0, 51 }, { 0, 66 }, { 4, 1 }, { 2, 1 }, { 0, 36 }, { 0, 80 }, { 2, 1 },\r
+ { 0, 67 }, { 0, 52 }, { 138, 1 }, { 40, 1 }, { 16, 1 }, { 6, 1 }, { 4, 1 }, { 2, 1 },\r
+ { 0, 5 }, { 0, 21 }, { 0, 81 }, { 4, 1 }, { 2, 1 }, { 0, 82 }, { 0, 37 }, { 4, 1 }, { 2, 1 },\r
+ { 0, 68 }, { 0, 53 }, { 0, 83 }, { 10, 1 }, { 6, 1 }, { 4, 1 }, { 2, 1 }, { 0, 96 },\r
+ { 0, 6 }, { 0, 97 }, { 2, 1 }, { 0, 22 }, { 0, 98 }, { 8, 1 }, { 4, 1 }, { 2, 1 }, { 0, 38 },\r
+ { 0, 84 }, { 2, 1 }, { 0, 69 }, { 0, 99 }, { 4, 1 }, { 2, 1 }, { 0, 54 }, { 0, 112 },\r
+ { 0, 113 }, { 40, 1 }, { 18, 1 }, { 8, 1 }, { 2, 1 }, { 0, 23 }, { 2, 1 }, { 0, 7 },\r
+ { 2, 1 }, { 0, 85 }, { 0, 100 }, { 4, 1 }, { 2, 1 }, { 0, 114 }, { 0, 39 }, { 4, 1 },\r
+ { 2, 1 }, { 0, 70 }, { 0, 101 }, { 0, 115 }, { 10, 1 }, { 6, 1 }, { 2, 1 }, { 0, 55 },\r
+ { 2, 1 }, { 0, 86 }, { 0, 8 }, { 2, 1 }, { 0, 128 }, { 0, 129 }, { 6, 1 }, { 2, 1 },\r
+ { 0, 24 }, { 2, 1 }, { 0, 116 }, { 0, 71 }, { 2, 1 }, { 0, 130 }, { 2, 1 }, { 0, 40 },\r
+ { 0, 102 }, { 24, 1 }, { 14, 1 }, { 8, 1 }, { 4, 1 }, { 2, 1 }, { 0, 131 }, { 0, 56 },\r
+ { 2, 1 }, { 0, 117 }, { 0, 132 }, { 4, 1 }, { 2, 1 }, { 0, 72 }, { 0, 144 }, { 0, 145 },\r
+ { 6, 1 }, { 2, 1 }, { 0, 25 }, { 2, 1 }, { 0, 9 }, { 0, 118 }, { 2, 1 }, { 0, 146 },\r
+ { 0, 41 }, { 14, 1 }, { 8, 1 }, { 4, 1 }, { 2, 1 }, { 0, 133 }, { 0, 88 }, { 2, 1 },\r
+ { 0, 147 }, { 0, 57 }, { 4, 1 }, { 2, 1 }, { 0, 160 }, { 0, 10 }, { 0, 26 }, { 8, 1 },\r
+ { 2, 1 }, { 0, 162 }, { 2, 1 }, { 0, 103 }, { 2, 1 }, { 0, 87 }, { 0, 73 }, { 6, 1 },\r
+ { 2, 1 }, { 0, 148 }, { 2, 1 }, { 0, 119 }, { 0, 134 }, { 2, 1 }, { 0, 161 }, { 2, 1 },\r
+ { 0, 104 }, { 0, 149 }, { 220, 1 }, { 126, 1 }, { 50, 1 }, { 26, 1 }, { 12, 1 }, { 6, 1 },\r
+ { 2, 1 }, { 0, 42 }, { 2, 1 }, { 0, 89 }, { 0, 58 }, { 2, 1 }, { 0, 163 }, { 2, 1 },\r
+ { 0, 135 }, { 0, 120 }, { 8, 1 }, { 4, 1 }, { 2, 1 }, { 0, 164 }, { 0, 74 }, { 2, 1 },\r
+ { 0, 150 }, { 0, 105 }, { 4, 1 }, { 2, 1 }, { 0, 176 }, { 0, 11 }, { 0, 177 }, { 10, 1 },\r
+ { 4, 1 }, { 2, 1 }, { 0, 27 }, { 0, 178 }, { 2, 1 }, { 0, 43 }, { 2, 1 }, { 0, 165 },\r
+ { 0, 90 }, { 6, 1 }, { 2, 1 }, { 0, 179 }, { 2, 1 }, { 0, 166 }, { 0, 106 }, { 4, 1 },\r
+ { 2, 1 }, { 0, 180 }, { 0, 75 }, { 2, 1 }, { 0, 12 }, { 0, 193 }, { 30, 1 }, { 14, 1 },\r
+ { 6, 1 }, { 4, 1 }, { 2, 1 }, { 0, 181 }, { 0, 194 }, { 0, 44 }, { 4, 1 }, { 2, 1 },\r
+ { 0, 167 }, { 0, 195 }, { 2, 1 }, { 0, 107 }, { 0, 196 }, { 8, 1 }, { 2, 1 }, { 0, 29 },\r
+ { 4, 1 }, { 2, 1 }, { 0, 136 }, { 0, 151 }, { 0, 59 }, { 4, 1 }, { 2, 1 }, { 0, 209 },\r
+ { 0, 210 }, { 2, 1 }, { 0, 45 }, { 0, 211 }, { 18, 1 }, { 6, 1 }, { 4, 1 }, { 2, 1 },\r
+ { 0, 30 }, { 0, 46 }, { 0, 226 }, { 6, 1 }, { 4, 1 }, { 2, 1 }, { 0, 121 }, { 0, 152 },\r
+ { 0, 192 }, { 2, 1 }, { 0, 28 }, { 2, 1 }, { 0, 137 }, { 0, 91 }, { 14, 1 }, { 6, 1 },\r
+ { 2, 1 }, { 0, 60 }, { 2, 1 }, { 0, 122 }, { 0, 182 }, { 4, 1 }, { 2, 1 }, { 0, 76 },\r
+ { 0, 153 }, { 2, 1 }, { 0, 168 }, { 0, 138 }, { 6, 1 }, { 2, 1 }, { 0, 13 }, { 2, 1 },\r
+ { 0, 197 }, { 0, 92 }, { 4, 1 }, { 2, 1 }, { 0, 61 }, { 0, 198 }, { 2, 1 }, { 0, 108 },\r
+ { 0, 154 }, { 88, 1 }, { 86, 1 }, { 36, 1 }, { 16, 1 }, { 8, 1 }, { 4, 1 }, { 2, 1 },\r
+ { 0, 139 }, { 0, 77 }, { 2, 1 }, { 0, 199 }, { 0, 124 }, { 4, 1 }, { 2, 1 }, { 0, 213 },\r
+ { 0, 93 }, { 2, 1 }, { 0, 224 }, { 0, 14 }, { 8, 1 }, { 2, 1 }, { 0, 227 }, { 4, 1 },\r
+ { 2, 1 }, { 0, 208 }, { 0, 183 }, { 0, 123 }, { 6, 1 }, { 4, 1 }, { 2, 1 }, { 0, 169 },\r
+ { 0, 184 }, { 0, 212 }, { 2, 1 }, { 0, 225 }, { 2, 1 }, { 0, 170 }, { 0, 185 }, { 24, 1 },\r
+ { 10, 1 }, { 6, 1 }, { 4, 1 }, { 2, 1 }, { 0, 155 }, { 0, 214 }, { 0, 109 }, { 2, 1 },\r
+ { 0, 62 }, { 0, 200 }, { 6, 1 }, { 4, 1 }, { 2, 1 }, { 0, 140 }, { 0, 228 }, { 0, 78 },\r
+ { 4, 1 }, { 2, 1 }, { 0, 215 }, { 0, 229 }, { 2, 1 }, { 0, 186 }, { 0, 171 }, { 12, 1 },\r
+ { 4, 1 }, { 2, 1 }, { 0, 156 }, { 0, 230 }, { 4, 1 }, { 2, 1 }, { 0, 110 }, { 0, 216 },\r
+ { 2, 1 }, { 0, 141 }, { 0, 187 }, { 8, 1 }, { 4, 1 }, { 2, 1 }, { 0, 231 }, { 0, 157 },\r
+ { 2, 1 }, { 0, 232 }, { 0, 142 }, { 4, 1 }, { 2, 1 }, { 0, 203 }, { 0, 188 }, { 0, 158 },\r
+ { 0, 241 }, { 2, 1 }, { 0, 31 }, { 2, 1 }, { 0, 15 }, { 0, 47 }, { 66, 1 }, { 56, 1 },\r
+ { 2, 1 }, { 0, 242 }, { 52, 1 }, { 50, 1 }, { 20, 1 }, { 8, 1 }, { 2, 1 }, { 0, 189 },\r
+ { 2, 1 }, { 0, 94 }, { 2, 1 }, { 0, 125 }, { 0, 201 }, { 6, 1 }, { 2, 1 }, { 0, 202 },\r
+ { 2, 1 }, { 0, 172 }, { 0, 126 }, { 4, 1 }, { 2, 1 }, { 0, 218 }, { 0, 173 }, { 0, 204 },\r
+ { 10, 1 }, { 6, 1 }, { 2, 1 }, { 0, 174 }, { 2, 1 }, { 0, 219 }, { 0, 220 }, { 2, 1 },\r
+ { 0, 205 }, { 0, 190 }, { 6, 1 }, { 4, 1 }, { 2, 1 }, { 0, 235 }, { 0, 237 }, { 0, 238 },\r
+ { 6, 1 }, { 4, 1 }, { 2, 1 }, { 0, 217 }, { 0, 234 }, { 0, 233 }, { 2, 1 }, { 0, 222 },\r
+ { 4, 1 }, { 2, 1 }, { 0, 221 }, { 0, 236 }, { 0, 206 }, { 0, 63 }, { 0, 240 }, { 4, 1 },\r
+ { 2, 1 }, { 0, 243 }, { 0, 244 }, { 2, 1 }, { 0, 79 }, { 2, 1 }, { 0, 245 }, { 0, 95 },\r
+ { 10, 1 }, { 2, 1 }, { 0, 255 }, { 4, 1 }, { 2, 1 }, { 0, 246 }, { 0, 111 }, { 2, 1 },\r
+ { 0, 247 }, { 0, 127 }, { 12, 1 }, { 6, 1 }, { 2, 1 }, { 0, 143 }, { 2, 1 }, { 0, 248 },\r
+ { 0, 249 }, { 4, 1 }, { 2, 1 }, { 0, 159 }, { 0, 250 }, { 0, 175 }, { 8, 1 }, { 4, 1 },\r
+ { 2, 1 }, { 0, 251 }, { 0, 191 }, { 2, 1 }, { 0, 252 }, { 0, 207 }, { 4, 1 }, { 2, 1 },\r
+ { 0, 253 }, { 0, 223 }, { 2, 1 }, { 0, 254 }, { 0, 239 }, };\r
+\r
+ @LOC("FINAL")\r
+ private static int ValTab24[][] = { { 60, 1 }, { 8, 1 }, { 4, 1 }, { 2, 1 }, { 0, 0 }, { 0, 16 },\r
+ { 2, 1 }, { 0, 1 }, { 0, 17 }, { 14, 1 }, { 6, 1 }, { 4, 1 }, { 2, 1 }, { 0, 32 }, { 0, 2 },\r
+ { 0, 33 }, { 2, 1 }, { 0, 18 }, { 2, 1 }, { 0, 34 }, { 2, 1 }, { 0, 48 }, { 0, 3 },\r
+ { 14, 1 }, { 4, 1 }, { 2, 1 }, { 0, 49 }, { 0, 19 }, { 4, 1 }, { 2, 1 }, { 0, 50 },\r
+ { 0, 35 }, { 4, 1 }, { 2, 1 }, { 0, 64 }, { 0, 4 }, { 0, 65 }, { 8, 1 }, { 4, 1 }, { 2, 1 },\r
+ { 0, 20 }, { 0, 51 }, { 2, 1 }, { 0, 66 }, { 0, 36 }, { 6, 1 }, { 4, 1 }, { 2, 1 },\r
+ { 0, 67 }, { 0, 52 }, { 0, 81 }, { 6, 1 }, { 4, 1 }, { 2, 1 }, { 0, 80 }, { 0, 5 },\r
+ { 0, 21 }, { 2, 1 }, { 0, 82 }, { 0, 37 }, { 250, 1 }, { 98, 1 }, { 34, 1 }, { 18, 1 },\r
+ { 10, 1 }, { 4, 1 }, { 2, 1 }, { 0, 68 }, { 0, 83 }, { 2, 1 }, { 0, 53 }, { 2, 1 },\r
+ { 0, 96 }, { 0, 6 }, { 4, 1 }, { 2, 1 }, { 0, 97 }, { 0, 22 }, { 2, 1 }, { 0, 98 },\r
+ { 0, 38 }, { 8, 1 }, { 4, 1 }, { 2, 1 }, { 0, 84 }, { 0, 69 }, { 2, 1 }, { 0, 99 },\r
+ { 0, 54 }, { 4, 1 }, { 2, 1 }, { 0, 113 }, { 0, 85 }, { 2, 1 }, { 0, 100 }, { 0, 70 },\r
+ { 32, 1 }, { 14, 1 }, { 6, 1 }, { 2, 1 }, { 0, 114 }, { 2, 1 }, { 0, 39 }, { 0, 55 },\r
+ { 2, 1 }, { 0, 115 }, { 4, 1 }, { 2, 1 }, { 0, 112 }, { 0, 7 }, { 0, 23 }, { 10, 1 },\r
+ { 4, 1 }, { 2, 1 }, { 0, 101 }, { 0, 86 }, { 4, 1 }, { 2, 1 }, { 0, 128 }, { 0, 8 },\r
+ { 0, 129 }, { 4, 1 }, { 2, 1 }, { 0, 116 }, { 0, 71 }, { 2, 1 }, { 0, 24 }, { 0, 130 },\r
+ { 16, 1 }, { 8, 1 }, { 4, 1 }, { 2, 1 }, { 0, 40 }, { 0, 102 }, { 2, 1 }, { 0, 131 },\r
+ { 0, 56 }, { 4, 1 }, { 2, 1 }, { 0, 117 }, { 0, 87 }, { 2, 1 }, { 0, 132 }, { 0, 72 },\r
+ { 8, 1 }, { 4, 1 }, { 2, 1 }, { 0, 145 }, { 0, 25 }, { 2, 1 }, { 0, 146 }, { 0, 118 },\r
+ { 4, 1 }, { 2, 1 }, { 0, 103 }, { 0, 41 }, { 2, 1 }, { 0, 133 }, { 0, 88 }, { 92, 1 },\r
+ { 34, 1 }, { 16, 1 }, { 8, 1 }, { 4, 1 }, { 2, 1 }, { 0, 147 }, { 0, 57 }, { 2, 1 },\r
+ { 0, 148 }, { 0, 73 }, { 4, 1 }, { 2, 1 }, { 0, 119 }, { 0, 134 }, { 2, 1 }, { 0, 104 },\r
+ { 0, 161 }, { 8, 1 }, { 4, 1 }, { 2, 1 }, { 0, 162 }, { 0, 42 }, { 2, 1 }, { 0, 149 },\r
+ { 0, 89 }, { 4, 1 }, { 2, 1 }, { 0, 163 }, { 0, 58 }, { 2, 1 }, { 0, 135 }, { 2, 1 },\r
+ { 0, 120 }, { 0, 74 }, { 22, 1 }, { 12, 1 }, { 4, 1 }, { 2, 1 }, { 0, 164 }, { 0, 150 },\r
+ { 4, 1 }, { 2, 1 }, { 0, 105 }, { 0, 177 }, { 2, 1 }, { 0, 27 }, { 0, 165 }, { 6, 1 },\r
+ { 2, 1 }, { 0, 178 }, { 2, 1 }, { 0, 90 }, { 0, 43 }, { 2, 1 }, { 0, 136 }, { 0, 179 },\r
+ { 16, 1 }, { 10, 1 }, { 6, 1 }, { 2, 1 }, { 0, 144 }, { 2, 1 }, { 0, 9 }, { 0, 160 },\r
+ { 2, 1 }, { 0, 151 }, { 0, 121 }, { 4, 1 }, { 2, 1 }, { 0, 166 }, { 0, 106 }, { 0, 180 },\r
+ { 12, 1 }, { 6, 1 }, { 2, 1 }, { 0, 26 }, { 2, 1 }, { 0, 10 }, { 0, 176 }, { 2, 1 },\r
+ { 0, 59 }, { 2, 1 }, { 0, 11 }, { 0, 192 }, { 4, 1 }, { 2, 1 }, { 0, 75 }, { 0, 193 },\r
+ { 2, 1 }, { 0, 152 }, { 0, 137 }, { 67, 1 }, { 34, 1 }, { 16, 1 }, { 8, 1 }, { 4, 1 },\r
+ { 2, 1 }, { 0, 28 }, { 0, 181 }, { 2, 1 }, { 0, 91 }, { 0, 194 }, { 4, 1 }, { 2, 1 },\r
+ { 0, 44 }, { 0, 167 }, { 2, 1 }, { 0, 122 }, { 0, 195 }, { 10, 1 }, { 6, 1 }, { 2, 1 },\r
+ { 0, 60 }, { 2, 1 }, { 0, 12 }, { 0, 208 }, { 2, 1 }, { 0, 182 }, { 0, 107 }, { 4, 1 },\r
+ { 2, 1 }, { 0, 196 }, { 0, 76 }, { 2, 1 }, { 0, 153 }, { 0, 168 }, { 16, 1 }, { 8, 1 },\r
+ { 4, 1 }, { 2, 1 }, { 0, 138 }, { 0, 197 }, { 2, 1 }, { 0, 92 }, { 0, 209 }, { 4, 1 },\r
+ { 2, 1 }, { 0, 183 }, { 0, 123 }, { 2, 1 }, { 0, 29 }, { 0, 210 }, { 9, 1 }, { 4, 1 },\r
+ { 2, 1 }, { 0, 45 }, { 0, 211 }, { 2, 1 }, { 0, 61 }, { 0, 198 }, { 85, 250 }, { 4, 1 },\r
+ { 2, 1 }, { 0, 108 }, { 0, 169 }, { 2, 1 }, { 0, 154 }, { 0, 212 }, { 32, 1 }, { 16, 1 },\r
+ { 8, 1 }, { 4, 1 }, { 2, 1 }, { 0, 184 }, { 0, 139 }, { 2, 1 }, { 0, 77 }, { 0, 199 },\r
+ { 4, 1 }, { 2, 1 }, { 0, 124 }, { 0, 213 }, { 2, 1 }, { 0, 93 }, { 0, 225 }, { 8, 1 },\r
+ { 4, 1 }, { 2, 1 }, { 0, 30 }, { 0, 226 }, { 2, 1 }, { 0, 170 }, { 0, 185 }, { 4, 1 },\r
+ { 2, 1 }, { 0, 155 }, { 0, 227 }, { 2, 1 }, { 0, 214 }, { 0, 109 }, { 20, 1 }, { 10, 1 },\r
+ { 6, 1 }, { 2, 1 }, { 0, 62 }, { 2, 1 }, { 0, 46 }, { 0, 78 }, { 2, 1 }, { 0, 200 },\r
+ { 0, 140 }, { 4, 1 }, { 2, 1 }, { 0, 228 }, { 0, 215 }, { 4, 1 }, { 2, 1 }, { 0, 125 },\r
+ { 0, 171 }, { 0, 229 }, { 10, 1 }, { 4, 1 }, { 2, 1 }, { 0, 186 }, { 0, 94 }, { 2, 1 },\r
+ { 0, 201 }, { 2, 1 }, { 0, 156 }, { 0, 110 }, { 8, 1 }, { 2, 1 }, { 0, 230 }, { 2, 1 },\r
+ { 0, 13 }, { 2, 1 }, { 0, 224 }, { 0, 14 }, { 4, 1 }, { 2, 1 }, { 0, 216 }, { 0, 141 },\r
+ { 2, 1 }, { 0, 187 }, { 0, 202 }, { 74, 1 }, { 2, 1 }, { 0, 255 }, { 64, 1 }, { 58, 1 },\r
+ { 32, 1 }, { 16, 1 }, { 8, 1 }, { 4, 1 }, { 2, 1 }, { 0, 172 }, { 0, 231 }, { 2, 1 },\r
+ { 0, 126 }, { 0, 217 }, { 4, 1 }, { 2, 1 }, { 0, 157 }, { 0, 232 }, { 2, 1 }, { 0, 142 },\r
+ { 0, 203 }, { 8, 1 }, { 4, 1 }, { 2, 1 }, { 0, 188 }, { 0, 218 }, { 2, 1 }, { 0, 173 },\r
+ { 0, 233 }, { 4, 1 }, { 2, 1 }, { 0, 158 }, { 0, 204 }, { 2, 1 }, { 0, 219 }, { 0, 189 },\r
+ { 16, 1 }, { 8, 1 }, { 4, 1 }, { 2, 1 }, { 0, 234 }, { 0, 174 }, { 2, 1 }, { 0, 220 },\r
+ { 0, 205 }, { 4, 1 }, { 2, 1 }, { 0, 235 }, { 0, 190 }, { 2, 1 }, { 0, 221 }, { 0, 236 },\r
+ { 8, 1 }, { 4, 1 }, { 2, 1 }, { 0, 206 }, { 0, 237 }, { 2, 1 }, { 0, 222 }, { 0, 238 },\r
+ { 0, 15 }, { 4, 1 }, { 2, 1 }, { 0, 240 }, { 0, 31 }, { 0, 241 }, { 4, 1 }, { 2, 1 },\r
+ { 0, 242 }, { 0, 47 }, { 2, 1 }, { 0, 243 }, { 0, 63 }, { 18, 1 }, { 8, 1 }, { 4, 1 },\r
+ { 2, 1 }, { 0, 244 }, { 0, 79 }, { 2, 1 }, { 0, 245 }, { 0, 95 }, { 4, 1 }, { 2, 1 },\r
+ { 0, 246 }, { 0, 111 }, { 2, 1 }, { 0, 247 }, { 2, 1 }, { 0, 127 }, { 0, 143 }, { 10, 1 },\r
+ { 4, 1 }, { 2, 1 }, { 0, 248 }, { 0, 249 }, { 4, 1 }, { 2, 1 }, { 0, 159 }, { 0, 175 },\r
+ { 0, 250 }, { 8, 1 }, { 4, 1 }, { 2, 1 }, { 0, 251 }, { 0, 191 }, { 2, 1 }, { 0, 252 },\r
+ { 0, 207 }, { 4, 1 }, { 2, 1 }, { 0, 253 }, { 0, 223 }, { 2, 1 }, { 0, 254 }, { 0, 239 }, };\r
+\r
+ @LOC("FINAL")\r
+ private static int ValTab32[][] = { { 2, 1 }, { 0, 0 }, { 8, 1 }, { 4, 1 }, { 2, 1 }, { 0, 8 },\r
+ { 0, 4 }, { 2, 1 }, { 0, 1 }, { 0, 2 }, { 8, 1 }, { 4, 1 }, { 2, 1 }, { 0, 12 }, { 0, 10 },\r
+ { 2, 1 }, { 0, 3 }, { 0, 6 }, { 6, 1 }, { 2, 1 }, { 0, 9 }, { 2, 1 }, { 0, 5 }, { 0, 7 },\r
+ { 4, 1 }, { 2, 1 }, { 0, 14 }, { 0, 13 }, { 2, 1 }, { 0, 15 }, { 0, 11 }, };\r
+\r
+ @LOC("FINAL")\r
+ private static int ValTab33[][] = { { 16, 1 }, { 8, 1 }, { 4, 1 }, { 2, 1 }, { 0, 0 }, { 0, 1 },\r
+ { 2, 1 }, { 0, 2 }, { 0, 3 }, { 4, 1 }, { 2, 1 }, { 0, 4 }, { 0, 5 }, { 2, 1 }, { 0, 6 },\r
+ { 0, 7 }, { 8, 1 }, { 4, 1 }, { 2, 1 }, { 0, 8 }, { 0, 9 }, { 2, 1 }, { 0, 10 }, { 0, 11 },\r
+ { 4, 1 }, { 2, 1 }, { 0, 12 }, { 0, 13 }, { 2, 1 }, { 0, 14 }, { 0, 15 }, };\r
+\r
+ @LOC("FINAL")\r
+ public static huffcodetab[] ht = null; /* Simulate extern struct */\r
+\r
+ @LOC("FINAL")\r
+ private static int[] bitbuf = new int[32];\r
+\r
+ /**\r
+ * Big Constructor : Computes all Huffman Tables.\r
+ */\r
+ private huffcodetab(@LOC("V") String S, @LOC("V") int XLEN, @LOC("V") int YLEN,\r
+ @LOC("V") int LINBITS, @LOC("V") int LINMAX, @LOC("V") int REF,\r
+ @DELEGATE @LOC("V") int[] TABLE, @DELEGATE @LOC("V") int[] HLEN,\r
+ @DELEGATE @LOC("V") int[][] VAL, @LOC("V") int TREELEN) {\r
+ tablename0 = S.charAt(0);\r
+ tablename1 = S.charAt(1);\r
+ tablename2 = S.charAt(2);\r
+ xlen = XLEN;\r
+ ylen = YLEN;\r
+ linbits = LINBITS;\r
+ linmax = LINMAX;\r
+ ref = REF;\r
+ table = TABLE;\r
+ TABLE = null;\r
+ hlen = HLEN;\r
+ HLEN = null;\r
+ val = VAL;\r
+ VAL = null;\r
+ treelen = TREELEN;\r
+ }\r
+\r
+ /**\r
+ * Do the huffman-decoding. note! for counta,countb -the 4 bit value is\r
+ * returned in y, discard x.\r
+ */\r
+ @LATTICE("OUT<V1,THIS<V1,V1<V,V<IN,IN<C,C*,V*,THISLOC=THIS,GLOBALLOC=IN")\r
+ @RETURNLOC("OUT,BitReserve.BIT")\r
+ public static int huffman_decoder(@LOC("THIS,LayerIIIDecoder.SI2") int htIdx,\r
+ @LOC("OUT,BitReserve.BIT") int[] x, @LOC("OUT,BitReserve.BIT") int[] y,\r
+ @LOC("OUT,BitReserve.BIT") int[] v, @LOC("OUT,BitReserve.BIT") int[] w,\r
+ @LOC("OUT") BitReserve br) {\r
+ // array of all huffcodtable headers\r
+ // 0..31 Huffman code table 0..31\r
+ // 32,33 count1-tables\r
+\r
+ @LOC("C") int dmask = 1 << ((4 * 8) - 1);\r
+ @LOC("THIS,LayerIIIDecoder.SI1") int hs = 4 * 8;\r
+ @LOC("OUT,BitReserve.BIT") int level;\r
+ @LOC("OUT,BitReserve.BIT") int point = 0;\r
+ @LOC("OUT,BitReserve.BIT") int error = 1;\r
+ level = dmask;\r
+\r
+ if (ht[htIdx].val == null)\r
+ return 2;\r
+\r
+ /* table 0 needs no bits */\r
+ if (ht[htIdx].treelen == 0) {\r
+ x[0] = 0;\r
+ y[0] = 0;\r
+ return 0;\r
+ }\r
+\r
+ /* Lookup in Huffman table. */\r
+\r
+ /*\r
+ * int bitsAvailable = 0; int bitIndex = 0;\r
+ * \r
+ * int bits[] = bitbuf;\r
+ */\r
+ TERMINATE: do {\r
+ if (ht[htIdx].val[point][0] == 0) { /* end of tree */\r
+ x[0] = ht[htIdx].val[point][1] >>> 4;\r
+ y[0] = ht[htIdx].val[point][1] & 0xf;\r
+ error = 0;\r
+ break;\r
+ }\r
+\r
+ // hget1bit() is called thousands of times, and so needs to be\r
+ // ultra fast.\r
+ /*\r
+ * if (bitIndex==bitsAvailable) { bitsAvailable = br.readBits(bits, 32);\r
+ * bitIndex = 0; }\r
+ */\r
+ // if (bits[bitIndex++]!=0)\r
+ if (br.hget1bit() != 0) {\r
+ TERMINATE: while (ht[htIdx].val[point][1] >= MXOFF)\r
+ point += ht[htIdx].val[point][1];\r
+ point += ht[htIdx].val[point][1];\r
+ } else {\r
+ TERMINATE: while (ht[htIdx].val[point][0] >= MXOFF)\r
+ point += ht[htIdx].val[point][0];\r
+ point += ht[htIdx].val[point][0];\r
+ }\r
+ level >>>= 1;\r
+ // MDM: ht[0] is always 0;\r
+ } while ((level != 0) || (point < 0 /* ht[0].treelen */));\r
+\r
+ // put back any bits not consumed\r
+ /*\r
+ * int unread = (bitsAvailable-bitIndex); if (unread>0)\r
+ * br.rewindNbits(unread);\r
+ */\r
+ /* Process sign encodings for quadruples tables. */\r
+ // System.out.println(ht[htIdx].tablename);\r
+ if (ht[htIdx].tablename0 == '3' && (ht[htIdx].tablename1 == '2' || ht[htIdx].tablename1 == '3')) {\r
+ v[0] = (y[0] >> 3) & 1;\r
+ w[0] = (y[0] >> 2) & 1;\r
+ x[0] = (y[0] >> 1) & 1;\r
+ y[0] = y[0] & 1;\r
+\r
+ /*\r
+ * v, w, x and y are reversed in the bitstream. switch them around to make\r
+ * test bistream work.\r
+ */\r
+\r
+ if (v[0] != 0)\r
+ if (br.hget1bit() != 0)\r
+ v[0] = -v[0];\r
+ if (w[0] != 0)\r
+ if (br.hget1bit() != 0)\r
+ w[0] = -w[0];\r
+ if (x[0] != 0)\r
+ if (br.hget1bit() != 0)\r
+ x[0] = -x[0];\r
+ if (y[0] != 0)\r
+ if (br.hget1bit() != 0)\r
+ y[0] = -y[0];\r
+ } else {\r
+ // Process sign and escape encodings for dual tables.\r
+ // x and y are reversed in the test bitstream.\r
+ // Reverse x and y here to make test bitstream work.\r
+\r
+ if (ht[htIdx].linbits != 0)\r
+ if ((ht[htIdx].xlen - 1) == x[0])\r
+ x[0] += br.hgetbits(ht[htIdx].linbits);\r
+ if (x[0] != 0)\r
+ if (br.hget1bit() != 0)\r
+ x[0] = -x[0];\r
+ if (ht[htIdx].linbits != 0)\r
+ if ((ht[htIdx].ylen - 1) == y[0])\r
+ y[0] += br.hgetbits(ht[htIdx].linbits);\r
+ if (y[0] != 0)\r
+ if (br.hget1bit() != 0)\r
+ y[0] = -y[0];\r
+ }\r
+ return error;\r
+ }\r
+\r
+ public static void inithuff() {\r
+\r
+ if (ht != null)\r
+ return;\r
+\r
+ ht = new huffcodetab[HTN];\r
+ ht[0] = new huffcodetab("0 ", 0, 0, 0, 0, -1, null, null, ValTab0, 0);\r
+ ht[1] = new huffcodetab("1 ", 2, 2, 0, 0, -1, null, null, ValTab1, 7);\r
+ ht[2] = new huffcodetab("2 ", 3, 3, 0, 0, -1, null, null, ValTab2, 17);\r
+ ht[3] = new huffcodetab("3 ", 3, 3, 0, 0, -1, null, null, ValTab3, 17);\r
+ ht[4] = new huffcodetab("4 ", 0, 0, 0, 0, -1, null, null, ValTab4, 0);\r
+ ht[5] = new huffcodetab("5 ", 4, 4, 0, 0, -1, null, null, ValTab5, 31);\r
+ ht[6] = new huffcodetab("6 ", 4, 4, 0, 0, -1, null, null, ValTab6, 31);\r
+ ht[7] = new huffcodetab("7 ", 6, 6, 0, 0, -1, null, null, ValTab7, 71);\r
+ ht[8] = new huffcodetab("8 ", 6, 6, 0, 0, -1, null, null, ValTab8, 71);\r
+ ht[9] = new huffcodetab("9 ", 6, 6, 0, 0, -1, null, null, ValTab9, 71);\r
+ ht[10] = new huffcodetab("10 ", 8, 8, 0, 0, -1, null, null, ValTab10, 127);\r
+ ht[11] = new huffcodetab("11 ", 8, 8, 0, 0, -1, null, null, ValTab11, 127);\r
+ ht[12] = new huffcodetab("12 ", 8, 8, 0, 0, -1, null, null, ValTab12, 127);\r
+ ht[13] = new huffcodetab("13 ", 16, 16, 0, 0, -1, null, null, ValTab13, 511);\r
+ ht[14] = new huffcodetab("14 ", 0, 0, 0, 0, -1, null, null, ValTab14, 0);\r
+ ht[15] = new huffcodetab("15 ", 16, 16, 0, 0, -1, null, null, ValTab15, 511);\r
+ ht[16] = new huffcodetab("16 ", 16, 16, 1, 1, -1, null, null, ValTab16, 511);\r
+ ht[17] = new huffcodetab("17 ", 16, 16, 2, 3, 16, null, null, ValTab16, 511);\r
+ ht[18] = new huffcodetab("18 ", 16, 16, 3, 7, 16, null, null, ValTab16, 511);\r
+ ht[19] = new huffcodetab("19 ", 16, 16, 4, 15, 16, null, null, ValTab16, 511);\r
+ ht[20] = new huffcodetab("20 ", 16, 16, 6, 63, 16, null, null, ValTab16, 511);\r
+ ht[21] = new huffcodetab("21 ", 16, 16, 8, 255, 16, null, null, ValTab16, 511);\r
+ ht[22] = new huffcodetab("22 ", 16, 16, 10, 1023, 16, null, null, ValTab16, 511);\r
+ ht[23] = new huffcodetab("23 ", 16, 16, 13, 8191, 16, null, null, ValTab16, 511);\r
+ ht[24] = new huffcodetab("24 ", 16, 16, 4, 15, -1, null, null, ValTab24, 512);\r
+ ht[25] = new huffcodetab("25 ", 16, 16, 5, 31, 24, null, null, ValTab24, 512);\r
+ ht[26] = new huffcodetab("26 ", 16, 16, 6, 63, 24, null, null, ValTab24, 512);\r
+ ht[27] = new huffcodetab("27 ", 16, 16, 7, 127, 24, null, null, ValTab24, 512);\r
+ ht[28] = new huffcodetab("28 ", 16, 16, 8, 255, 24, null, null, ValTab24, 512);\r
+ ht[29] = new huffcodetab("29 ", 16, 16, 9, 511, 24, null, null, ValTab24, 512);\r
+ ht[30] = new huffcodetab("30 ", 16, 16, 11, 2047, 24, null, null, ValTab24, 512);\r
+ ht[31] = new huffcodetab("31 ", 16, 16, 13, 8191, 24, null, null, ValTab24, 512);\r
+ ht[32] = new huffcodetab("32 ", 1, 16, 0, 0, -1, null, null, ValTab32, 31);\r
+ ht[33] = new huffcodetab("33 ", 1, 16, 0, 0, -1, null, null, ValTab33, 31);\r
+ }\r
+}\r
--- /dev/null
+BUILDSCRIPT=../../../buildscript
+
+PROGRAM=MP3Player
+SOURCE_FILES=MP3Player.java
+
+BSFLAGS= -32bit -ssjava -mainclass $(PROGRAM) -heapsize-mb 1000 -nooptimize -debug -garbagestats -ssjavadebug #-printlinenum #-joptimize
+
+default: $(PROGRAM)s.bin
+
+$(PROGRAM)s.bin: $(SOURCE_FILES) makefile
+ $(BUILDSCRIPT) $(BSFLAGS) -o $(PROGRAM) -builddir sing $(SOURCE_FILES)
+
+clean:
+ rm -f $(PROGRAM).bin
+ rm -fr sing
+ rm -f *~
+ rm -f *.dot
+ rm -f *.png
+ rm -f *.txt
+ rm -f aliases.txt
+ rm -f results*txt
+ rm -f *log
+
--- /dev/null
+playing focus.mp3...
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+-4777
+-631072
+1293323
+-1326139
+861767
+451288
+-47296
+-1248777
+1925353
+-2179234
+1182947
+683998
+-2517503
+2835485
+-2320058
+2460065
+-2306413
+195502
+1310892
+-1577569
+2430640
+-2328745
+1740775
+-1051879
+-376916
+1246895
+-1709109
+1874073
+-1369555
+601164
+293020
+-738830
+499587
+-630175
+1256735
+-783515
+104125
+-124200
+-342781
+812927
+-998554
+947185
+-717666
+353871
+163304
+-621030
+722986
+-594950
+632691
+-271096
+-144508
+104417
+-298261
+621697
+-447509
+308172
+-393156
+152638
+150214
+-265019
+545920
+-590735
+387837
+-202976
+-59867
+392340
+-483584
+362935
+-348877
+211165
+-163997
+17939
+244738
+-312426
+949236
+-261437
+-240964
+850661
+744267
+-2000037
+-1233522
+130242
+743770
+1774653
+357115
+-1197546
+-1206982
+-843540
+184622
+2128890
+359831
+442096
+-818716
+-689965
+-947304
+773965
+646175
+520632
+-72768
+-630029
+-808955
+-155733
+682029
+576228
+188296
+-67453
+-549263
+-718693
+488039
+350375
+350661
+65091
+-277534
+-1095438
+155867
+396317
+488158
+190983
+-211400
+-626435
+-132469
+118532
+187159
+206311
+312933
+-494249
+-59286
+-154420
+13707
+235088
+178369
+27036
+-238910
+-136433
+8957
+133869
+61867
+159041
+-102253
+-137070
+60010
+-87635
+15930
+209339
+-92839
+-5986
+-38700
+-20011
+26409
+29158
+16768
+-21964
+1477
+0
+0
+0
+0
--- /dev/null
+./MP3Player.bin focus.mp3
\ No newline at end of file
--- /dev/null
+playing focus.mp3...
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+-4777
+-631072
+1293323
+-1326139
+861767
+451288
+-47296
+-1248777
+1925353
+-2179234
+1182947
+683998
+-2517503
+2835485
+-2320058
+2460065
+-2306413
+195502
+1310892
+-1577569
+2430640
+-2328745
+1740775
+-1051879
+-376916
+1246895
+-1709109
+1874073
+-1369555
+601164
+293020
+-738830
+499587
+-630175
+1256735
+-783515
+104125
+-124200
+-342781
+812927
+-998554
+947185
+-717666
+353871
+163304
+-621030
+722986
+-594950
+632691
+-271096
+-144508
+104417
+-298261
+621697
+-447509
+308172
+-393156
+152638
+150214
+-265019
+545920
+-590735
+387837
+-202976
+-59867
+392340
+-483584
+362935
+-348877
+211165
+-163997
+17939
+244738
+-312426
+949236
+-261437
+-240964
+850661
+744267
+-2000037
+-1233522
+130242
+743770
+1774653
+357115
+-1197546
+-1206982
+-843540
+184622
+2128890
+359831
+442096
+-818716
+-689965
+-947304
+773965
+646175
+520632
+-72768
+-630029
+-808955
+-155733
+682029
+576228
+188296
+-67453
+-549263
+-718693
+488039
+350375
+350661
+65091
+-277534
+-1095438
+155867
+396317
+488158
+190983
+-211400
+-626435
+-132469
+118532
+187159
+206311
+312933
+-494249
+-59286
+-154420
+13707
+235088
+178369
+27036
+-238910
+-136433
+8957
+133869
+61867
+159041
+-102253
+-137070
+60010
+-87635
+15930
+209339
+-92839
+-5986
+-38700
+-20011
+26409
+29158
+16768
+-21964
+1477
+0
+0
+0
+0