diff --git a/src/javax/microedition/media/javazoom/jl/decoder/Control.java b/src/javax/microedition/media/javazoom/jl/decoder/Control.java
deleted file mode 100644
index 080ed521..00000000
--- a/src/javax/microedition/media/javazoom/jl/decoder/Control.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * 11/19/04 1.0 moved to LGPL.
- *-----------------------------------------------------------------------
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Library General Public License as published
- * by the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *----------------------------------------------------------------------
- */
-
-package javazoom.jl.decoder;
-
-/**
- * Work in progress.
- */
-
-public interface Control
-{
-
- /**
- * Starts playback of the media presented by this control.
- */
- public void start();
-
- /**
- * Stops playback of the media presented by this control.
- */
- public void stop();
-
- public boolean isPlaying();
-
- public void pause();
-
-
- public boolean isRandomAccess();
-
- /**
- * Retrieves the current position.
- */
- public double getPosition();
-
- /**
- *
- */
- public void setPosition(double d);
-
-
-}
diff --git a/src/javax/microedition/media/javazoom/jl/decoder/Decoder.java b/src/javax/microedition/media/javazoom/jl/decoder/Decoder.java
index 0d6a23e0..aa004c67 100644
--- a/src/javax/microedition/media/javazoom/jl/decoder/Decoder.java
+++ b/src/javax/microedition/media/javazoom/jl/decoder/Decoder.java
@@ -62,8 +62,6 @@ public class Decoder implements DecoderErrors
private int outputFrequency;
private int outputChannels;
-
- private Equalizer equalizer = new Equalizer();
private boolean initialized;
@@ -231,11 +229,10 @@ private void initialize(Header header)
if (output==null)
output = new SampleBuffer(header.frequency(), channels);
- float[] factors = equalizer.getBandFactors();
- filter1 = new SynthesisFilter(0, scalefactor, factors);
+ filter1 = new SynthesisFilter(0);
// REVIEW: allow mono output for stereo
- if (channels==2) { filter2 = new SynthesisFilter(1, scalefactor, factors); }
+ if (channels==2) { filter2 = new SynthesisFilter(1); }
outputChannels = channels;
outputFrequency = header.frequency();
diff --git a/src/javax/microedition/media/javazoom/jl/decoder/Equalizer.java b/src/javax/microedition/media/javazoom/jl/decoder/Equalizer.java
deleted file mode 100644
index 57545a93..00000000
--- a/src/javax/microedition/media/javazoom/jl/decoder/Equalizer.java
+++ /dev/null
@@ -1,227 +0,0 @@
-/*
- * 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.
- *----------------------------------------------------------------------
- */
-
-
-package javazoom.jl.decoder;
-
-/**
- * The Equalizer
class can be used to specify
- * equalization settings for the MPEG audio decoder.
- *
- * The equalizer consists of 32 band-pass filters.
- * Each band of the equalizer can take on a fractional value between
- * -1.0 and +1.0.
- * At -1.0, the input signal is attenuated by 6dB, at +1.0 the signal is
- * amplified by 6dB.
- *
- * @see Decoder
- *
- * @author MDM
- */
-public final class Equalizer
-{
- /**
- * Equalizer setting to denote that a given band will not be
- * present in the output signal.
- */
- static public final float BAND_NOT_PRESENT = Float.NEGATIVE_INFINITY;
-
- static public final Equalizer PASS_THRU_EQ = new Equalizer();
-
- private static final int BANDS = 32;
-
- private final float[] settings = new float[BANDS];
-
- /**
- * Creates a new Equalizer
instance.
- */
- public Equalizer()
- {
- }
-
-// private Equalizer(float b1, float b2, float b3, float b4, float b5,
-// float b6, float b7, float b8, float b9, float b10, float b11,
-// float b12, float b13, float b14, float b15, float b16,
-// float b17, float b18, float b19, float b20);
-
- public Equalizer(float[] settings)
- {
- setFrom(settings);
- }
-
- public Equalizer(EQFunction eq)
- {
- setFrom(eq);
- }
-
- public void setFrom(float[] eq)
- {
- reset();
- int max = (eq.length > BANDS) ? BANDS : eq.length;
-
- for (int i=0; i=0) && (band=0) && (band 1.0f)
- return 1.0f;
- if (eq < -1.0f)
- return -1.0f;
-
- return eq;
- }
-
- /**
- * Retrieves an array of floats whose values represent a
- * scaling factor that can be applied to linear samples
- * in each band to provide the equalization represented by
- * this instance.
- *
- * @return an array of factors that can be applied to the
- * subbands.
- */
- float[] getBandFactors()
- {
- float[] factors = new float[BANDS];
- for (int i=0, maxCount=BANDS; iWork In Progress.
- *
- * An instance of InputStreamSource
implements a
- * Source
that provides data from an InputStream
- *
. Seeking functionality is not supported.
- *
- * @author MDM
- */
-public class InputStreamSource implements Source
-{
- private final InputStream in;
-
- public InputStreamSource(InputStream in)
- {
- if (in==null)
- throw new NullPointerException("in");
-
- this.in = in;
- }
-
- public int read(byte[] b, int offs, int len)
- throws IOException
- {
- int read = in.read(b, offs, len);
- return read;
- }
-
- public boolean willReadBlock()
- {
- return true;
- //boolean block = (in.available()==0);
- //return block;
- }
-
- public boolean isSeekable()
- {
- return false;
- }
-
- public long tell()
- {
- return -1;
- }
-
- public long seek(long to)
- {
- return -1;
- }
-
- public long length()
- {
- return -1;
- }
-}
diff --git a/src/javax/microedition/media/javazoom/jl/decoder/LayerIDecoder.java b/src/javax/microedition/media/javazoom/jl/decoder/LayerIDecoder.java
index cfdc7b6f..d650883f 100644
--- a/src/javax/microedition/media/javazoom/jl/decoder/LayerIDecoder.java
+++ b/src/javax/microedition/media/javazoom/jl/decoder/LayerIDecoder.java
@@ -135,9 +135,9 @@ protected void readSampleData()
for (i = 0; i < num_subbands; ++i)
write_ready = subbands[i].put_next_sample(which_channels,filter1, filter2);
- filter1.calculate_pcm_samples(buffer);
+ filter1.calculate_pcm_samples_layer_i_ii(buffer);
if ((which_channels == OutputChannels.BOTH_CHANNELS) && (mode != Header.SINGLE_CHANNEL))
- filter2.calculate_pcm_samples(buffer);
+ filter2.calculate_pcm_samples_layer_i_ii(buffer);
} while (!write_ready);
} while (!read_ready);
diff --git a/src/javax/microedition/media/javazoom/jl/decoder/LayerIIIDecoder.java b/src/javax/microedition/media/javazoom/jl/decoder/LayerIIIDecoder.java
index f886f51d..16180fc9 100644
--- a/src/javax/microedition/media/javazoom/jl/decoder/LayerIIIDecoder.java
+++ b/src/javax/microedition/media/javazoom/jl/decoder/LayerIIIDecoder.java
@@ -44,8 +44,8 @@
final class LayerIIIDecoder implements FrameDecoder
{
final double d43 = (4.0/3.0);
-
- public int[] scalefac_buffer;
+ private static final float SCALE_FACTOR = 32760;
+ public final int[] scalefac_buffer;
private int CheckSumHuff = 0;
private int[] is_1d;
@@ -223,119 +223,109 @@ public void decodeFrame()
* Decode one frame, filling the buffer with the output samples.
*/
- // subband samples are buffered and passed to the
- // SynthesisFilter in one go.
- private float[] samples1 = new float[32];
- private float[] samples2 = new float[32];
-
public void decode()
{
- int nSlots = header.slots();
- int flush_main;
- int gr, ch, ss, sb, sb18;
- int main_data_end;
+ final int nSlots = header.slots();
+ final int flush_main;
+ int gr, ch, ss, sb, sb18;
+ int main_data_end;
int bytes_to_discard;
- int i;
+ int i;
get_side_info();
- for (i=0; i>> 3; // of previous frame
+ main_data_end = br.hsstell() >>> 3; // of previous frame
- if ((flush_main = (br.hsstell() & 7)) != 0) {
- br.hgetbits(8 - flush_main);
+ if ((flush_main = (br.hsstell() & 7)) != 0)
+ {
+ br.hgetbits(8 - flush_main);
main_data_end++;
- }
+ }
- bytes_to_discard = frame_start - main_data_end
- - si.main_data_begin;
+ bytes_to_discard = frame_start - main_data_end
+ - si.main_data_begin;
- frame_start += nSlots;
+ frame_start += nSlots;
- if (bytes_to_discard < 0)
+ if (bytes_to_discard < 0)
return;
- if (main_data_end > 4096) {
+ if (main_data_end > 4096)
+ {
frame_start -= 4096;
br.rewindNbytes(4096);
- }
-
- for (; bytes_to_discard > 0; bytes_to_discard--)
- br.hgetbits(8);
+ }
- for (gr=0;gr 0; bytes_to_discard--)
+ br.hgetbits(8);
- for (ch=0; ch 1))
- do_downmix();
+ stereo(gr);
- for (ch=first_channel; ch<=last_channel; ch++) {
+ if ((which_channels == OutputChannels.DOWNMIX_CHANNELS) && (channels > 1))
+ do_downmix();
- reorder(lr[ch], ch, gr);
- antialias(ch, gr);
-
- hybrid(ch, gr);
+ for (ch=first_channel; ch<=last_channel; ch++)
+ {
- for (sb18=18;sb18<576;sb18+=36) // Frequency inversion
- for (ss=1;ss=0; i--)
- {
- samples[i] = s[i]*eq[i];
- }
+ samples[subbandnumber] = sample;
}
/**
- * Compute new values via a fast cosine transform.
- */
- private void compute_new_v()
- {
- // p is fully initialized from x1
- //float[] p = _p;
- // pp is fully initialized from p
- //float[] pp = _pp;
-
- //float[] new_v = _new_v;
-
- //float[] new_v = new float[32]; // new V[0-15] and V[33-48] of Figure 3-A.2 in ISO DIS 11172-3
- //float[] p = new float[16];
- //float[] pp = new float[16];
-
- /*
- for (int i=31; i>=0; i--)
- {
- new_v[i] = 0.0f;
- }
- */
-
- float new_v0, new_v1, new_v2, new_v3, new_v4, new_v5, new_v6, new_v7, new_v8, new_v9;
- float new_v10, new_v11, new_v12, new_v13, new_v14, new_v15, new_v16, new_v17, new_v18, new_v19;
- float new_v20, new_v21, new_v22, new_v23, new_v24, new_v25, new_v26, new_v27, new_v28, new_v29;
- float new_v30, new_v31;
-
- new_v0 = new_v1 = new_v2 = new_v3 = new_v4 = new_v5 = new_v6 = new_v7 = new_v8 = new_v9 =
- new_v10 = new_v11 = new_v12 = new_v13 = new_v14 = new_v15 = new_v16 = new_v17 = new_v18 = new_v19 =
- new_v20 = new_v21 = new_v22 = new_v23 = new_v24 = new_v25 = new_v26 = new_v27 = new_v28 = new_v29 =
- new_v30 = new_v31 = 0.0f;
-
-
-// float[] new_v = new float[32]; // new V[0-15] and V[33-48] of Figure 3-A.2 in ISO DIS 11172-3
-// float[] p = new float[16];
-// float[] pp = new float[16];
-
- float[] s = samples;
-
- float s0 = s[0];
- float s1 = s[1];
- float s2 = s[2];
- float s3 = s[3];
- float s4 = s[4];
- float s5 = s[5];
- float s6 = s[6];
- float s7 = s[7];
- float s8 = s[8];
- float s9 = s[9];
- float s10 = s[10];
- float s11 = s[11];
- float s12 = s[12];
- float s13 = s[13];
- float s14 = s[14];
- float s15 = s[15];
- float s16 = s[16];
- float s17 = s[17];
- float s18 = s[18];
- float s19 = s[19];
- float s20 = s[20];
- float s21 = s[21];
- float s22 = s[22];
- float s23 = s[23];
- float s24 = s[24];
- float s25 = s[25];
- float s26 = s[26];
- float s27 = s[27];
- float s28 = s[28];
- float s29 = s[29];
- float s30 = s[30];
- float s31 = s[31];
-
- float p0 = s0 + s31;
- float p1 = s1 + s30;
- float p2 = s2 + s29;
- float p3 = s3 + s28;
- float p4 = s4 + s27;
- float p5 = s5 + s26;
- float p6 = s6 + s25;
- float p7 = s7 + s24;
- float p8 = s8 + s23;
- float p9 = s9 + s22;
- float p10 = s10 + s21;
- float p11 = s11 + s20;
- float p12 = s12 + s19;
- float p13 = s13 + s18;
- float p14 = s14 + s17;
- float p15 = s15 + s16;
-
- float pp0 = p0 + p15;
- float pp1 = p1 + p14;
- float pp2 = p2 + p13;
- float pp3 = p3 + p12;
- float pp4 = p4 + p11;
- float pp5 = p5 + p10;
- float pp6 = p6 + p9;
- float pp7 = p7 + p8;
- float pp8 = (p0 - p15) * cos1_32;
- float pp9 = (p1 - p14) * cos3_32;
- float pp10 = (p2 - p13) * cos5_32;
- float pp11 = (p3 - p12) * cos7_32;
- float pp12 = (p4 - p11) * cos9_32;
- float pp13 = (p5 - p10) * cos11_32;
- float pp14 = (p6 - p9) * cos13_32;
- float pp15 = (p7 - p8) * cos15_32;
-
- p0 = pp0 + pp7;
- p1 = pp1 + pp6;
- p2 = pp2 + pp5;
- p3 = pp3 + pp4;
- p4 = (pp0 - pp7) * cos1_16;
- p5 = (pp1 - pp6) * cos3_16;
- p6 = (pp2 - pp5) * cos5_16;
- p7 = (pp3 - pp4) * cos7_16;
- p8 = pp8 + pp15;
- p9 = pp9 + pp14;
- p10 = pp10 + pp13;
- p11 = pp11 + pp12;
- p12 = (pp8 - pp15) * cos1_16;
- p13 = (pp9 - pp14) * cos3_16;
- p14 = (pp10 - pp13) * cos5_16;
- p15 = (pp11 - pp12) * cos7_16;
-
-
- pp0 = p0 + p3;
- pp1 = p1 + p2;
- pp2 = (p0 - p3) * cos1_8;
- pp3 = (p1 - p2) * cos3_8;
- pp4 = p4 + p7;
- pp5 = p5 + p6;
- pp6 = (p4 - p7) * cos1_8;
- pp7 = (p5 - p6) * cos3_8;
- pp8 = p8 + p11;
- pp9 = p9 + p10;
- pp10 = (p8 - p11) * cos1_8;
- pp11 = (p9 - p10) * cos3_8;
- pp12 = p12 + p15;
- pp13 = p13 + p14;
- pp14 = (p12 - p15) * cos1_8;
- pp15 = (p13 - p14) * cos3_8;
-
- p0 = pp0 + pp1;
- p1 = (pp0 - pp1) * cos1_4;
- p2 = pp2 + pp3;
- p3 = (pp2 - pp3) * cos1_4;
- p4 = pp4 + pp5;
- p5 = (pp4 - pp5) * cos1_4;
- p6 = pp6 + pp7;
- p7 = (pp6 - pp7) * cos1_4;
- p8 = pp8 + pp9;
- p9 = (pp8 - pp9) * cos1_4;
- p10 = pp10 + pp11;
- p11 = (pp10 - pp11) * cos1_4;
- p12 = pp12 + pp13;
- p13 = (pp12 - pp13) * cos1_4;
- p14 = pp14 + pp15;
- p15 = (pp14 - pp15) * cos1_4;
-
- // this is pretty insane coding
- float tmp1;
- new_v19/*36-17*/ = -(new_v4 = (new_v12 = p7) + p5) - p6;
- new_v27/*44-17*/ = -p6 - p7 - p4;
- new_v6 = (new_v10 = (new_v14 = p15) + p11) + p13;
- new_v17/*34-17*/ = -(new_v2 = p15 + p13 + p9) - p14;
- new_v21/*38-17*/ = (tmp1 = -p14 - p15 - p10 - p11) - p13;
- new_v29/*46-17*/ = -p14 - p15 - p12 - p8;
- new_v25/*42-17*/ = tmp1 - p12;
- new_v31/*48-17*/ = -p0;
- new_v0 = p1;
- new_v23/*40-17*/ = -(new_v8 = p3) - p2;
-
- p0 = (s0 - s31) * cos1_64;
- p1 = (s1 - s30) * cos3_64;
- p2 = (s2 - s29) * cos5_64;
- p3 = (s3 - s28) * cos7_64;
- p4 = (s4 - s27) * cos9_64;
- p5 = (s5 - s26) * cos11_64;
- p6 = (s6 - s25) * cos13_64;
- p7 = (s7 - s24) * cos15_64;
- p8 = (s8 - s23) * cos17_64;
- p9 = (s9 - s22) * cos19_64;
- p10 = (s10 - s21) * cos21_64;
- p11 = (s11 - s20) * cos23_64;
- p12 = (s12 - s19) * cos25_64;
- p13 = (s13 - s18) * cos27_64;
- p14 = (s14 - s17) * cos29_64;
- p15 = (s15 - s16) * cos31_64;
-
-
- pp0 = p0 + p15;
- pp1 = p1 + p14;
- pp2 = p2 + p13;
- pp3 = p3 + p12;
- pp4 = p4 + p11;
- pp5 = p5 + p10;
- pp6 = p6 + p9;
- pp7 = p7 + p8;
- pp8 = (p0 - p15) * cos1_32;
- pp9 = (p1 - p14) * cos3_32;
- pp10 = (p2 - p13) * cos5_32;
- pp11 = (p3 - p12) * cos7_32;
- pp12 = (p4 - p11) * cos9_32;
- pp13 = (p5 - p10) * cos11_32;
- pp14 = (p6 - p9) * cos13_32;
- pp15 = (p7 - p8) * cos15_32;
-
-
- p0 = pp0 + pp7;
- p1 = pp1 + pp6;
- p2 = pp2 + pp5;
- p3 = pp3 + pp4;
- p4 = (pp0 - pp7) * cos1_16;
- p5 = (pp1 - pp6) * cos3_16;
- p6 = (pp2 - pp5) * cos5_16;
- p7 = (pp3 - pp4) * cos7_16;
- p8 = pp8 + pp15;
- p9 = pp9 + pp14;
- p10 = pp10 + pp13;
- p11 = pp11 + pp12;
- p12 = (pp8 - pp15) * cos1_16;
- p13 = (pp9 - pp14) * cos3_16;
- p14 = (pp10 - pp13) * cos5_16;
- p15 = (pp11 - pp12) * cos7_16;
-
-
- pp0 = p0 + p3;
- pp1 = p1 + p2;
- pp2 = (p0 - p3) * cos1_8;
- pp3 = (p1 - p2) * cos3_8;
- pp4 = p4 + p7;
- pp5 = p5 + p6;
- pp6 = (p4 - p7) * cos1_8;
- pp7 = (p5 - p6) * cos3_8;
- pp8 = p8 + p11;
- pp9 = p9 + p10;
- pp10 = (p8 - p11) * cos1_8;
- pp11 = (p9 - p10) * cos3_8;
- pp12 = p12 + p15;
- pp13 = p13 + p14;
- pp14 = (p12 - p15) * cos1_8;
- pp15 = (p13 - p14) * cos3_8;
-
-
- p0 = pp0 + pp1;
- p1 = (pp0 - pp1) * cos1_4;
- p2 = pp2 + pp3;
- p3 = (pp2 - pp3) * cos1_4;
- p4 = pp4 + pp5;
- p5 = (pp4 - pp5) * cos1_4;
- p6 = pp6 + pp7;
- p7 = (pp6 - pp7) * cos1_4;
- p8 = pp8 + pp9;
- p9 = (pp8 - pp9) * cos1_4;
- p10 = pp10 + pp11;
- p11 = (pp10 - pp11) * cos1_4;
- p12 = pp12 + pp13;
- p13 = (pp12 - pp13) * cos1_4;
- p14 = pp14 + pp15;
- p15 = (pp14 - pp15) * cos1_4;
-
-
- // manually doing something that a compiler should handle sucks
- // coding like this is hard to read
- float tmp2;
- new_v5 = (new_v11 = (new_v13 = (new_v15 = p15) + p7) + p11)
- + p5 + p13;
- new_v7 = (new_v9 = p15 + p11 + p3) + p13;
- new_v16/*33-17*/ = -(new_v1 = (tmp1 = p13 + p15 + p9) + p1) - p14;
- new_v18/*35-17*/ = -(new_v3 = tmp1 + p5 + p7) - p6 - p14;
-
- new_v22/*39-17*/ = (tmp1 = -p10 - p11 - p14 - p15)
- - p13 - p2 - p3;
- new_v20/*37-17*/ = tmp1 - p13 - p5 - p6 - p7;
- new_v24/*41-17*/ = tmp1 - p12 - p2 - p3;
- new_v26/*43-17*/ = tmp1 - p12 - (tmp2 = p4 + p6 + p7);
- new_v30/*47-17*/ = (tmp1 = -p8 - p12 - p14 - p15) - p0;
- new_v28/*45-17*/ = tmp1 - tmp2;
-
- // insert V[0-15] (== new_v[0-15]) into actual v:
- // float[] x2 = actual_v + actual_write_pos;
- float dest[] = actual_v;
-
- int pos = actual_write_pos;
-
- dest[0 + pos] = new_v0;
- dest[16 + pos] = new_v1;
- dest[32 + pos] = new_v2;
- dest[48 + pos] = new_v3;
- dest[64 + pos] = new_v4;
- dest[80 + pos] = new_v5;
- dest[96 + pos] = new_v6;
- dest[112 + pos] = new_v7;
- dest[128 + pos] = new_v8;
- dest[144 + pos] = new_v9;
- dest[160 + pos] = new_v10;
- dest[176 + pos] = new_v11;
- dest[192 + pos] = new_v12;
- dest[208 + pos] = new_v13;
- dest[224 + pos] = new_v14;
- dest[240 + pos] = new_v15;
-
- // V[16] is always 0.0:
- dest[256 + pos] = 0.0f;
-
- // insert V[17-31] (== -new_v[15-1]) into actual v:
- dest[272 + pos] = -new_v15;
- dest[288 + pos] = -new_v14;
- dest[304 + pos] = -new_v13;
- dest[320 + pos] = -new_v12;
- dest[336 + pos] = -new_v11;
- dest[352 + pos] = -new_v10;
- dest[368 + pos] = -new_v9;
- dest[384 + pos] = -new_v8;
- dest[400 + pos] = -new_v7;
- dest[416 + pos] = -new_v6;
- dest[432 + pos] = -new_v5;
- dest[448 + pos] = -new_v4;
- dest[464 + pos] = -new_v3;
- dest[480 + pos] = -new_v2;
- dest[496 + pos] = -new_v1;
-
- // insert V[32] (== -new_v[0]) into other v:
- dest = (actual_v==v1) ? v2 : v1;
-
- dest[0 + pos] = -new_v0;
- // insert V[33-48] (== new_v[16-31]) into other v:
- dest[16 + pos] = new_v16;
- dest[32 + pos] = new_v17;
- dest[48 + pos] = new_v18;
- dest[64 + pos] = new_v19;
- dest[80 + pos] = new_v20;
- dest[96 + pos] = new_v21;
- dest[112 + pos] = new_v22;
- dest[128 + pos] = new_v23;
- dest[144 + pos] = new_v24;
- dest[160 + pos] = new_v25;
- dest[176 + pos] = new_v26;
- dest[192 + pos] = new_v27;
- dest[208 + pos] = new_v28;
- dest[224 + pos] = new_v29;
- dest[240 + pos] = new_v30;
- dest[256 + pos] = new_v31;
-
- // insert V[49-63] (== new_v[30-16]) into other v:
- dest[272 + pos] = new_v30;
- dest[288 + pos] = new_v29;
- dest[304 + pos] = new_v28;
- dest[320 + pos] = new_v27;
- dest[336 + pos] = new_v26;
- dest[352 + pos] = new_v25;
- dest[368 + pos] = new_v24;
- dest[384 + pos] = new_v23;
- dest[400 + pos] = new_v22;
- dest[416 + pos] = new_v21;
- dest[432 + pos] = new_v20;
- dest[448 + pos] = new_v19;
- dest[464 + pos] = new_v18;
- dest[480 + pos] = new_v17;
- dest[496 + pos] = new_v16;
-/*
- }
- else
- {
- v1[0 + actual_write_pos] = -new_v0;
+ * Compute new values via a fast cosine transform.
+ */
+ private void compute_new_v()
+ {
+ final float new_v0, new_v1, new_v2, new_v3, new_v4, new_v5, new_v6, new_v7, new_v8, new_v9;
+ final float new_v10, new_v11, new_v12, new_v13, new_v14, new_v15, new_v16, new_v17, new_v18, new_v19;
+ final float new_v20, new_v21, new_v22, new_v23, new_v24, new_v25, new_v26, new_v27, new_v28, new_v29;
+ final float new_v30, new_v31;
+
+ final float[] s = samples;
+
+ final float s0 = s[0];
+ final float s1 = s[1];
+ final float s2 = s[2];
+ final float s3 = s[3];
+ final float s4 = s[4];
+ final float s5 = s[5];
+ final float s6 = s[6];
+ final float s7 = s[7];
+ final float s8 = s[8];
+ final float s9 = s[9];
+ final float s10 = s[10];
+ final float s11 = s[11];
+ final float s12 = s[12];
+ final float s13 = s[13];
+ final float s14 = s[14];
+ final float s15 = s[15];
+ final float s16 = s[16];
+ final float s17 = s[17];
+ final float s18 = s[18];
+ final float s19 = s[19];
+ final float s20 = s[20];
+ final float s21 = s[21];
+ final float s22 = s[22];
+ final float s23 = s[23];
+ final float s24 = s[24];
+ final float s25 = s[25];
+ final float s26 = s[26];
+ final float s27 = s[27];
+ final float s28 = s[28];
+ final float s29 = s[29];
+ final float s30 = s[30];
+ final float s31 = s[31];
+
+ float p0 = s0 + s31;
+ float p1 = s1 + s30;
+ float p2 = s2 + s29;
+ float p3 = s3 + s28;
+ float p4 = s4 + s27;
+ float p5 = s5 + s26;
+ float p6 = s6 + s25;
+ float p7 = s7 + s24;
+ float p8 = s8 + s23;
+ float p9 = s9 + s22;
+ float p10 = s10 + s21;
+ float p11 = s11 + s20;
+ float p12 = s12 + s19;
+ float p13 = s13 + s18;
+ float p14 = s14 + s17;
+ float p15 = s15 + s16;
+
+ float pp0 = p0 + p15;
+ float pp1 = p1 + p14;
+ float pp2 = p2 + p13;
+ float pp3 = p3 + p12;
+ float pp4 = p4 + p11;
+ float pp5 = p5 + p10;
+ float pp6 = p6 + p9;
+ float pp7 = p7 + p8;
+ float pp8 = (p0 - p15) * cos1_32;
+ float pp9 = (p1 - p14) * cos3_32;
+ float pp10 = (p2 - p13) * cos5_32;
+ float pp11 = (p3 - p12) * cos7_32;
+ float pp12 = (p4 - p11) * cos9_32;
+ float pp13 = (p5 - p10) * cos11_32;
+ float pp14 = (p6 - p9) * cos13_32;
+ float pp15 = (p7 - p8) * cos15_32;
+
+ p0 = pp0 + pp7;
+ p1 = pp1 + pp6;
+ p2 = pp2 + pp5;
+ p3 = pp3 + pp4;
+ p4 = (pp0 - pp7) * cos1_16;
+ p5 = (pp1 - pp6) * cos3_16;
+ p6 = (pp2 - pp5) * cos5_16;
+ p7 = (pp3 - pp4) * cos7_16;
+ p8 = pp8 + pp15;
+ p9 = pp9 + pp14;
+ p10 = pp10 + pp13;
+ p11 = pp11 + pp12;
+ p12 = (pp8 - pp15) * cos1_16;
+ p13 = (pp9 - pp14) * cos3_16;
+ p14 = (pp10 - pp13) * cos5_16;
+ p15 = (pp11 - pp12) * cos7_16;
+
+
+ pp0 = p0 + p3;
+ pp1 = p1 + p2;
+ pp2 = (p0 - p3) * cos1_8;
+ pp3 = (p1 - p2) * cos3_8;
+ pp4 = p4 + p7;
+ pp5 = p5 + p6;
+ pp6 = (p4 - p7) * cos1_8;
+ pp7 = (p5 - p6) * cos3_8;
+ pp8 = p8 + p11;
+ pp9 = p9 + p10;
+ pp10 = (p8 - p11) * cos1_8;
+ pp11 = (p9 - p10) * cos3_8;
+ pp12 = p12 + p15;
+ pp13 = p13 + p14;
+ pp14 = (p12 - p15) * cos1_8;
+ pp15 = (p13 - p14) * cos3_8;
+
+ p0 = pp0 + pp1;
+ p1 = (pp0 - pp1) * cos1_4;
+ p2 = pp2 + pp3;
+ p3 = (pp2 - pp3) * cos1_4;
+ p4 = pp4 + pp5;
+ p5 = (pp4 - pp5) * cos1_4;
+ p6 = pp6 + pp7;
+ p7 = (pp6 - pp7) * cos1_4;
+ p8 = pp8 + pp9;
+ p9 = (pp8 - pp9) * cos1_4;
+ p10 = pp10 + pp11;
+ p11 = (pp10 - pp11) * cos1_4;
+ p12 = pp12 + pp13;
+ p13 = (pp12 - pp13) * cos1_4;
+ p14 = pp14 + pp15;
+ p15 = (pp14 - pp15) * cos1_4;
+
+ // this is pretty insane coding
+ float tmp1;
+ new_v19/*36-17*/ = -(new_v4 = (new_v12 = p7) + p5) - p6;
+ new_v27/*44-17*/ = -p6 - p7 - p4;
+ new_v6 = (new_v10 = (new_v14 = p15) + p11) + p13;
+ new_v17/*34-17*/ = -(new_v2 = p15 + p13 + p9) - p14;
+ new_v21/*38-17*/ = (tmp1 = -p14 - p15 - p10 - p11) - p13;
+ new_v29/*46-17*/ = -p14 - p15 - p12 - p8;
+ new_v25/*42-17*/ = tmp1 - p12;
+ new_v31/*48-17*/ = -p0;
+ new_v0 = p1;
+ new_v23/*40-17*/ = -(new_v8 = p3) - p2;
+
+ p0 = (s0 - s31) * cos1_64;
+ p1 = (s1 - s30) * cos3_64;
+ p2 = (s2 - s29) * cos5_64;
+ p3 = (s3 - s28) * cos7_64;
+ p4 = (s4 - s27) * cos9_64;
+ p5 = (s5 - s26) * cos11_64;
+ p6 = (s6 - s25) * cos13_64;
+ p7 = (s7 - s24) * cos15_64;
+ p8 = (s8 - s23) * cos17_64;
+ p9 = (s9 - s22) * cos19_64;
+ p10 = (s10 - s21) * cos21_64;
+ p11 = (s11 - s20) * cos23_64;
+ p12 = (s12 - s19) * cos25_64;
+ p13 = (s13 - s18) * cos27_64;
+ p14 = (s14 - s17) * cos29_64;
+ p15 = (s15 - s16) * cos31_64;
+
+
+ pp0 = p0 + p15;
+ pp1 = p1 + p14;
+ pp2 = p2 + p13;
+ pp3 = p3 + p12;
+ pp4 = p4 + p11;
+ pp5 = p5 + p10;
+ pp6 = p6 + p9;
+ pp7 = p7 + p8;
+ pp8 = (p0 - p15) * cos1_32;
+ pp9 = (p1 - p14) * cos3_32;
+ pp10 = (p2 - p13) * cos5_32;
+ pp11 = (p3 - p12) * cos7_32;
+ pp12 = (p4 - p11) * cos9_32;
+ pp13 = (p5 - p10) * cos11_32;
+ pp14 = (p6 - p9) * cos13_32;
+ pp15 = (p7 - p8) * cos15_32;
+
+
+ p0 = pp0 + pp7;
+ p1 = pp1 + pp6;
+ p2 = pp2 + pp5;
+ p3 = pp3 + pp4;
+ p4 = (pp0 - pp7) * cos1_16;
+ p5 = (pp1 - pp6) * cos3_16;
+ p6 = (pp2 - pp5) * cos5_16;
+ p7 = (pp3 - pp4) * cos7_16;
+ p8 = pp8 + pp15;
+ p9 = pp9 + pp14;
+ p10 = pp10 + pp13;
+ p11 = pp11 + pp12;
+ p12 = (pp8 - pp15) * cos1_16;
+ p13 = (pp9 - pp14) * cos3_16;
+ p14 = (pp10 - pp13) * cos5_16;
+ p15 = (pp11 - pp12) * cos7_16;
+
+
+ pp0 = p0 + p3;
+ pp1 = p1 + p2;
+ pp2 = (p0 - p3) * cos1_8;
+ pp3 = (p1 - p2) * cos3_8;
+ pp4 = p4 + p7;
+ pp5 = p5 + p6;
+ pp6 = (p4 - p7) * cos1_8;
+ pp7 = (p5 - p6) * cos3_8;
+ pp8 = p8 + p11;
+ pp9 = p9 + p10;
+ pp10 = (p8 - p11) * cos1_8;
+ pp11 = (p9 - p10) * cos3_8;
+ pp12 = p12 + p15;
+ pp13 = p13 + p14;
+ pp14 = (p12 - p15) * cos1_8;
+ pp15 = (p13 - p14) * cos3_8;
+
+
+ p0 = pp0 + pp1;
+ p1 = (pp0 - pp1) * cos1_4;
+ p2 = pp2 + pp3;
+ p3 = (pp2 - pp3) * cos1_4;
+ p4 = pp4 + pp5;
+ p5 = (pp4 - pp5) * cos1_4;
+ p6 = pp6 + pp7;
+ p7 = (pp6 - pp7) * cos1_4;
+ p8 = pp8 + pp9;
+ p9 = (pp8 - pp9) * cos1_4;
+ p10 = pp10 + pp11;
+ p11 = (pp10 - pp11) * cos1_4;
+ p12 = pp12 + pp13;
+ p13 = (pp12 - pp13) * cos1_4;
+ p14 = pp14 + pp15;
+ p15 = (pp14 - pp15) * cos1_4;
+
+
+ // manually doing something that a compiler should handle sucks
+ // coding like this is hard to read
+ float tmp2;
+ new_v5 = (new_v11 = (new_v13 = (new_v15 = p15) + p7) + p11)
+ + p5 + p13;
+ new_v7 = (new_v9 = p15 + p11 + p3) + p13;
+ new_v16/*33-17*/ = -(new_v1 = (tmp1 = p13 + p15 + p9) + p1) - p14;
+ new_v18/*35-17*/ = -(new_v3 = tmp1 + p5 + p7) - p6 - p14;
+
+ new_v22/*39-17*/ = (tmp1 = -p10 - p11 - p14 - p15)
+ - p13 - p2 - p3;
+ new_v20/*37-17*/ = tmp1 - p13 - p5 - p6 - p7;
+ new_v24/*41-17*/ = tmp1 - p12 - p2 - p3;
+ new_v26/*43-17*/ = tmp1 - p12 - (tmp2 = p4 + p6 + p7);
+ new_v30/*47-17*/ = (tmp1 = -p8 - p12 - p14 - p15) - p0;
+ new_v28/*45-17*/ = tmp1 - tmp2;
+
+ // insert V[0-15] (== new_v[0-15]) into actual v:
+ // float[] x2 = actual_v + actual_write_pos;
+ float dest[] = actual_v;
+
+ int pos = actual_write_pos;
+
+ dest[0 + pos] = new_v0;
+ dest[16 + pos] = new_v1;
+ dest[32 + pos] = new_v2;
+ dest[48 + pos] = new_v3;
+ dest[64 + pos] = new_v4;
+ dest[80 + pos] = new_v5;
+ dest[96 + pos] = new_v6;
+ dest[112 + pos] = new_v7;
+ dest[128 + pos] = new_v8;
+ dest[144 + pos] = new_v9;
+ dest[160 + pos] = new_v10;
+ dest[176 + pos] = new_v11;
+ dest[192 + pos] = new_v12;
+ dest[208 + pos] = new_v13;
+ dest[224 + pos] = new_v14;
+ dest[240 + pos] = new_v15;
+
+ // V[16] is always 0.0:
+ dest[256 + pos] = 0.0f;
+
+ // insert V[17-31] (== -new_v[15-1]) into actual v:
+ dest[272 + pos] = -new_v15;
+ dest[288 + pos] = -new_v14;
+ dest[304 + pos] = -new_v13;
+ dest[320 + pos] = -new_v12;
+ dest[336 + pos] = -new_v11;
+ dest[352 + pos] = -new_v10;
+ dest[368 + pos] = -new_v9;
+ dest[384 + pos] = -new_v8;
+ dest[400 + pos] = -new_v7;
+ dest[416 + pos] = -new_v6;
+ dest[432 + pos] = -new_v5;
+ dest[448 + pos] = -new_v4;
+ dest[464 + pos] = -new_v3;
+ dest[480 + pos] = -new_v2;
+ dest[496 + pos] = -new_v1;
+
+ // insert V[32] (== -new_v[0]) into other v:
+ dest = (actual_v==v1) ? v2 : v1;
+
+ dest[0 + pos] = -new_v0;
// insert V[33-48] (== new_v[16-31]) into other v:
- v1[16 + actual_write_pos] = new_v16;
- v1[32 + actual_write_pos] = new_v17;
- v1[48 + actual_write_pos] = new_v18;
- v1[64 + actual_write_pos] = new_v19;
- v1[80 + actual_write_pos] = new_v20;
- v1[96 + actual_write_pos] = new_v21;
- v1[112 + actual_write_pos] = new_v22;
- v1[128 + actual_write_pos] = new_v23;
- v1[144 + actual_write_pos] = new_v24;
- v1[160 + actual_write_pos] = new_v25;
- v1[176 + actual_write_pos] = new_v26;
- v1[192 + actual_write_pos] = new_v27;
- v1[208 + actual_write_pos] = new_v28;
- v1[224 + actual_write_pos] = new_v29;
- v1[240 + actual_write_pos] = new_v30;
- v1[256 + actual_write_pos] = new_v31;
+ dest[16 + pos] = new_v16;
+ dest[32 + pos] = new_v17;
+ dest[48 + pos] = new_v18;
+ dest[64 + pos] = new_v19;
+ dest[80 + pos] = new_v20;
+ dest[96 + pos] = new_v21;
+ dest[112 + pos] = new_v22;
+ dest[128 + pos] = new_v23;
+ dest[144 + pos] = new_v24;
+ dest[160 + pos] = new_v25;
+ dest[176 + pos] = new_v26;
+ dest[192 + pos] = new_v27;
+ dest[208 + pos] = new_v28;
+ dest[224 + pos] = new_v29;
+ dest[240 + pos] = new_v30;
+ dest[256 + pos] = new_v31;
// insert V[49-63] (== new_v[30-16]) into other v:
- v1[272 + actual_write_pos] = new_v30;
- v1[288 + actual_write_pos] = new_v29;
- v1[304 + actual_write_pos] = new_v28;
- v1[320 + actual_write_pos] = new_v27;
- v1[336 + actual_write_pos] = new_v26;
- v1[352 + actual_write_pos] = new_v25;
- v1[368 + actual_write_pos] = new_v24;
- v1[384 + actual_write_pos] = new_v23;
- v1[400 + actual_write_pos] = new_v22;
- v1[416 + actual_write_pos] = new_v21;
- v1[432 + actual_write_pos] = new_v20;
- v1[448 + actual_write_pos] = new_v19;
- v1[464 + actual_write_pos] = new_v18;
- v1[480 + actual_write_pos] = new_v17;
- v1[496 + actual_write_pos] = new_v16;
+ dest[272 + pos] = new_v30;
+ dest[288 + pos] = new_v29;
+ dest[304 + pos] = new_v28;
+ dest[320 + pos] = new_v27;
+ dest[336 + pos] = new_v26;
+ dest[352 + pos] = new_v25;
+ dest[368 + pos] = new_v24;
+ dest[384 + pos] = new_v23;
+ dest[400 + pos] = new_v22;
+ dest[416 + pos] = new_v21;
+ dest[432 + pos] = new_v20;
+ dest[448 + pos] = new_v19;
+ dest[464 + pos] = new_v18;
+ dest[480 + pos] = new_v17;
+ dest[496 + pos] = new_v16;
}
-*/
- }
-
- /**
- * Compute new values via a fast cosine transform.
- */
- private void compute_new_v_old()
- {
- // p is fully initialized from x1
- //float[] p = _p;
- // pp is fully initialized from p
- //float[] pp = _pp;
-
- //float[] new_v = _new_v;
-
- float[] new_v = new float[32]; // new V[0-15] and V[33-48] of Figure 3-A.2 in ISO DIS 11172-3
- float[] p = new float[16];
- float[] pp = new float[16];
-
-
- for (int i=31; i>=0; i--)
- {
- new_v[i] = 0.0f;
- }
-
-// float[] new_v = new float[32]; // new V[0-15] and V[33-48] of Figure 3-A.2 in ISO DIS 11172-3
-// float[] p = new float[16];
-// float[] pp = new float[16];
-
- float[] x1 = samples;
-
- p[0] = x1[0] + x1[31];
- p[1] = x1[1] + x1[30];
- p[2] = x1[2] + x1[29];
- p[3] = x1[3] + x1[28];
- p[4] = x1[4] + x1[27];
- p[5] = x1[5] + x1[26];
- p[6] = x1[6] + x1[25];
- p[7] = x1[7] + x1[24];
- p[8] = x1[8] + x1[23];
- p[9] = x1[9] + x1[22];
- p[10] = x1[10] + x1[21];
- p[11] = x1[11] + x1[20];
- p[12] = x1[12] + x1[19];
- p[13] = x1[13] + x1[18];
- p[14] = x1[14] + x1[17];
- p[15] = x1[15] + x1[16];
-
- pp[0] = p[0] + p[15];
- pp[1] = p[1] + p[14];
- pp[2] = p[2] + p[13];
- pp[3] = p[3] + p[12];
- pp[4] = p[4] + p[11];
- pp[5] = p[5] + p[10];
- pp[6] = p[6] + p[9];
- pp[7] = p[7] + p[8];
- pp[8] = (p[0] - p[15]) * cos1_32;
- pp[9] = (p[1] - p[14]) * cos3_32;
- pp[10] = (p[2] - p[13]) * cos5_32;
- pp[11] = (p[3] - p[12]) * cos7_32;
- pp[12] = (p[4] - p[11]) * cos9_32;
- pp[13] = (p[5] - p[10]) * cos11_32;
- pp[14] = (p[6] - p[9]) * cos13_32;
- pp[15] = (p[7] - p[8]) * cos15_32;
-
- p[0] = pp[0] + pp[7];
- p[1] = pp[1] + pp[6];
- p[2] = pp[2] + pp[5];
- p[3] = pp[3] + pp[4];
- p[4] = (pp[0] - pp[7]) * cos1_16;
- p[5] = (pp[1] - pp[6]) * cos3_16;
- p[6] = (pp[2] - pp[5]) * cos5_16;
- p[7] = (pp[3] - pp[4]) * cos7_16;
- p[8] = pp[8] + pp[15];
- p[9] = pp[9] + pp[14];
- p[10] = pp[10] + pp[13];
- p[11] = pp[11] + pp[12];
- p[12] = (pp[8] - pp[15]) * cos1_16;
- p[13] = (pp[9] - pp[14]) * cos3_16;
- p[14] = (pp[10] - pp[13]) * cos5_16;
- p[15] = (pp[11] - pp[12]) * cos7_16;
-
-
- pp[0] = p[0] + p[3];
- pp[1] = p[1] + p[2];
- pp[2] = (p[0] - p[3]) * cos1_8;
- pp[3] = (p[1] - p[2]) * cos3_8;
- pp[4] = p[4] + p[7];
- pp[5] = p[5] + p[6];
- pp[6] = (p[4] - p[7]) * cos1_8;
- pp[7] = (p[5] - p[6]) * cos3_8;
- pp[8] = p[8] + p[11];
- pp[9] = p[9] + p[10];
- pp[10] = (p[8] - p[11]) * cos1_8;
- pp[11] = (p[9] - p[10]) * cos3_8;
- pp[12] = p[12] + p[15];
- pp[13] = p[13] + p[14];
- pp[14] = (p[12] - p[15]) * cos1_8;
- pp[15] = (p[13] - p[14]) * cos3_8;
-
- p[0] = pp[0] + pp[1];
- p[1] = (pp[0] - pp[1]) * cos1_4;
- p[2] = pp[2] + pp[3];
- p[3] = (pp[2] - pp[3]) * cos1_4;
- p[4] = pp[4] + pp[5];
- p[5] = (pp[4] - pp[5]) * cos1_4;
- p[6] = pp[6] + pp[7];
- p[7] = (pp[6] - pp[7]) * cos1_4;
- p[8] = pp[8] + pp[9];
- p[9] = (pp[8] - pp[9]) * cos1_4;
- p[10] = pp[10] + pp[11];
- p[11] = (pp[10] - pp[11]) * cos1_4;
- p[12] = pp[12] + pp[13];
- p[13] = (pp[12] - pp[13]) * cos1_4;
- p[14] = pp[14] + pp[15];
- p[15] = (pp[14] - pp[15]) * cos1_4;
-
- // this is pretty insane coding
- float tmp1;
- new_v[36-17] = -(new_v[4] = (new_v[12] = p[7]) + p[5]) - p[6];
- new_v[44-17] = -p[6] - p[7] - p[4];
- new_v[6] = (new_v[10] = (new_v[14] = p[15]) + p[11]) + p[13];
- new_v[34-17] = -(new_v[2] = p[15] + p[13] + p[9]) - p[14];
- new_v[38-17] = (tmp1 = -p[14] - p[15] - p[10] - p[11]) - p[13];
- new_v[46-17] = -p[14] - p[15] - p[12] - p[8];
- new_v[42-17] = tmp1 - p[12];
- new_v[48-17] = -p[0];
- new_v[0] = p[1];
- new_v[40-17] = -(new_v[8] = p[3]) - p[2];
-
- p[0] = (x1[0] - x1[31]) * cos1_64;
- p[1] = (x1[1] - x1[30]) * cos3_64;
- p[2] = (x1[2] - x1[29]) * cos5_64;
- p[3] = (x1[3] - x1[28]) * cos7_64;
- p[4] = (x1[4] - x1[27]) * cos9_64;
- p[5] = (x1[5] - x1[26]) * cos11_64;
- p[6] = (x1[6] - x1[25]) * cos13_64;
- p[7] = (x1[7] - x1[24]) * cos15_64;
- p[8] = (x1[8] - x1[23]) * cos17_64;
- p[9] = (x1[9] - x1[22]) * cos19_64;
- p[10] = (x1[10] - x1[21]) * cos21_64;
- p[11] = (x1[11] - x1[20]) * cos23_64;
- p[12] = (x1[12] - x1[19]) * cos25_64;
- p[13] = (x1[13] - x1[18]) * cos27_64;
- p[14] = (x1[14] - x1[17]) * cos29_64;
- p[15] = (x1[15] - x1[16]) * cos31_64;
-
-
- pp[0] = p[0] + p[15];
- pp[1] = p[1] + p[14];
- pp[2] = p[2] + p[13];
- pp[3] = p[3] + p[12];
- pp[4] = p[4] + p[11];
- pp[5] = p[5] + p[10];
- pp[6] = p[6] + p[9];
- pp[7] = p[7] + p[8];
- pp[8] = (p[0] - p[15]) * cos1_32;
- pp[9] = (p[1] - p[14]) * cos3_32;
- pp[10] = (p[2] - p[13]) * cos5_32;
- pp[11] = (p[3] - p[12]) * cos7_32;
- pp[12] = (p[4] - p[11]) * cos9_32;
- pp[13] = (p[5] - p[10]) * cos11_32;
- pp[14] = (p[6] - p[9]) * cos13_32;
- pp[15] = (p[7] - p[8]) * cos15_32;
-
- p[0] = pp[0] + pp[7];
- p[1] = pp[1] + pp[6];
- p[2] = pp[2] + pp[5];
- p[3] = pp[3] + pp[4];
- p[4] = (pp[0] - pp[7]) * cos1_16;
- p[5] = (pp[1] - pp[6]) * cos3_16;
- p[6] = (pp[2] - pp[5]) * cos5_16;
- p[7] = (pp[3] - pp[4]) * cos7_16;
- p[8] = pp[8] + pp[15];
- p[9] = pp[9] + pp[14];
- p[10] = pp[10] + pp[13];
- p[11] = pp[11] + pp[12];
- p[12] = (pp[8] - pp[15]) * cos1_16;
- p[13] = (pp[9] - pp[14]) * cos3_16;
- p[14] = (pp[10] - pp[13]) * cos5_16;
- p[15] = (pp[11] - pp[12]) * cos7_16;
-
-
- pp[0] = p[0] + p[3];
- pp[1] = p[1] + p[2];
- pp[2] = (p[0] - p[3]) * cos1_8;
- pp[3] = (p[1] - p[2]) * cos3_8;
- pp[4] = p[4] + p[7];
- pp[5] = p[5] + p[6];
- pp[6] = (p[4] - p[7]) * cos1_8;
- pp[7] = (p[5] - p[6]) * cos3_8;
- pp[8] = p[8] + p[11];
- pp[9] = p[9] + p[10];
- pp[10] = (p[8] - p[11]) * cos1_8;
- pp[11] = (p[9] - p[10]) * cos3_8;
- pp[12] = p[12] + p[15];
- pp[13] = p[13] + p[14];
- pp[14] = (p[12] - p[15]) * cos1_8;
- pp[15] = (p[13] - p[14]) * cos3_8;
+ /**
+ * Compute PCM Samples.
+ */
+ private final float[] _tmpOut = new float[32];
-
- p[0] = pp[0] + pp[1];
- p[1] = (pp[0] - pp[1]) * cos1_4;
- p[2] = pp[2] + pp[3];
- p[3] = (pp[2] - pp[3]) * cos1_4;
- p[4] = pp[4] + pp[5];
- p[5] = (pp[4] - pp[5]) * cos1_4;
- p[6] = pp[6] + pp[7];
- p[7] = (pp[6] - pp[7]) * cos1_4;
- p[8] = pp[8] + pp[9];
- p[9] = (pp[8] - pp[9]) * cos1_4;
- p[10] = pp[10] + pp[11];
- p[11] = (pp[10] - pp[11]) * cos1_4;
- p[12] = pp[12] + pp[13];
- p[13] = (pp[12] - pp[13]) * cos1_4;
- p[14] = pp[14] + pp[15];
- p[15] = (pp[14] - pp[15]) * cos1_4;
-
+ private void compute_pcm_samples0( )
+ {
+ final float[] vp = actual_v;
+ //int inc = v_inc;
+ final float[] tmpOut = _tmpOut;
+ int dvp =0;
- // manually doing something that a compiler should handle sucks
- // coding like this is hard to read
- float tmp2;
- new_v[5] = (new_v[11] = (new_v[13] = (new_v[15] = p[15]) + p[7]) + p[11])
- + p[5] + p[13];
- new_v[7] = (new_v[9] = p[15] + p[11] + p[3]) + p[13];
- new_v[33-17] = -(new_v[1] = (tmp1 = p[13] + p[15] + p[9]) + p[1]) - p[14];
- new_v[35-17] = -(new_v[3] = tmp1 + p[5] + p[7]) - p[6] - p[14];
-
- new_v[39-17] = (tmp1 = -p[10] - p[11] - p[14] - p[15])
- - p[13] - p[2] - p[3];
- new_v[37-17] = tmp1 - p[13] - p[5] - p[6] - p[7];
- new_v[41-17] = tmp1 - p[12] - p[2] - p[3];
- new_v[43-17] = tmp1 - p[12] - (tmp2 = p[4] + p[6] + p[7]);
- new_v[47-17] = (tmp1 = -p[8] - p[12] - p[14] - p[15]) - p[0];
- new_v[45-17] = tmp1 - tmp2;
-
- // insert V[0-15] (== new_v[0-15]) into actual v:
- x1 = new_v;
- // float[] x2 = actual_v + actual_write_pos;
- float[] dest = actual_v;
-
- dest[0 + actual_write_pos] = x1[0];
- dest[16 + actual_write_pos] = x1[1];
- dest[32 + actual_write_pos] = x1[2];
- dest[48 + actual_write_pos] = x1[3];
- dest[64 + actual_write_pos] = x1[4];
- dest[80 + actual_write_pos] = x1[5];
- dest[96 + actual_write_pos] = x1[6];
- dest[112 + actual_write_pos] = x1[7];
- dest[128 + actual_write_pos] = x1[8];
- dest[144 + actual_write_pos] = x1[9];
- dest[160 + actual_write_pos] = x1[10];
- dest[176 + actual_write_pos] = x1[11];
- dest[192 + actual_write_pos] = x1[12];
- dest[208 + actual_write_pos] = x1[13];
- dest[224 + actual_write_pos] = x1[14];
- dest[240 + actual_write_pos] = x1[15];
-
- // V[16] is always 0.0:
- dest[256 + actual_write_pos] = 0.0f;
-
- // insert V[17-31] (== -new_v[15-1]) into actual v:
- dest[272 + actual_write_pos] = -x1[15];
- dest[288 + actual_write_pos] = -x1[14];
- dest[304 + actual_write_pos] = -x1[13];
- dest[320 + actual_write_pos] = -x1[12];
- dest[336 + actual_write_pos] = -x1[11];
- dest[352 + actual_write_pos] = -x1[10];
- dest[368 + actual_write_pos] = -x1[9];
- dest[384 + actual_write_pos] = -x1[8];
- dest[400 + actual_write_pos] = -x1[7];
- dest[416 + actual_write_pos] = -x1[6];
- dest[432 + actual_write_pos] = -x1[5];
- dest[448 + actual_write_pos] = -x1[4];
- dest[464 + actual_write_pos] = -x1[3];
- dest[480 + actual_write_pos] = -x1[2];
- dest[496 + actual_write_pos] = -x1[1];
-
- // insert V[32] (== -new_v[0]) into other v:
-
- }
+ // fat chance of having this loop unroll
+ for( int i=0; i<32; i++)
+ {
+ float pcm_sample;
+ final float[] dp = d16[i];
+ pcm_sample = (float)(((vp[0 + dvp] * dp[0]) +
+ (vp[15 + dvp] * dp[1]) +
+ (vp[14 + dvp] * dp[2]) +
+ (vp[13 + dvp] * dp[3]) +
+ (vp[12 + dvp] * dp[4]) +
+ (vp[11 + dvp] * dp[5]) +
+ (vp[10 + dvp] * dp[6]) +
+ (vp[9 + dvp] * dp[7]) +
+ (vp[8 + dvp] * dp[8]) +
+ (vp[7 + dvp] * dp[9]) +
+ (vp[6 + dvp] * dp[10]) +
+ (vp[5 + dvp] * dp[11]) +
+ (vp[4 + dvp] * dp[12]) +
+ (vp[3 + dvp] * dp[13]) +
+ (vp[2 + dvp] * dp[14]) +
+ (vp[1 + dvp] * dp[15])
+ ) );
+
+ tmpOut[i] = pcm_sample;
- /**
- * Compute PCM Samples.
- */
-
- private float[] _tmpOut = new float[32];
-
-
- private void compute_pcm_samples0(Obuffer buffer)
- {
- final float[] vp = actual_v;
- //int inc = v_inc;
- final float[] tmpOut = _tmpOut;
- int dvp =0;
-
- // fat chance of having this loop unroll
- for( int i=0; i<32; i++)
- {
- float pcm_sample;
- final float[] dp = d16[i];
- pcm_sample = (float)(((vp[0 + dvp] * dp[0]) +
- (vp[15 + dvp] * dp[1]) +
- (vp[14 + dvp] * dp[2]) +
- (vp[13 + dvp] * dp[3]) +
- (vp[12 + dvp] * dp[4]) +
- (vp[11 + dvp] * dp[5]) +
- (vp[10 + dvp] * dp[6]) +
- (vp[9 + dvp] * dp[7]) +
- (vp[8 + dvp] * dp[8]) +
- (vp[7 + dvp] * dp[9]) +
- (vp[6 + dvp] * dp[10]) +
- (vp[5 + dvp] * dp[11]) +
- (vp[4 + dvp] * dp[12]) +
- (vp[3 + dvp] * dp[13]) +
- (vp[2 + dvp] * dp[14]) +
- (vp[1 + dvp] * dp[15])
- ) * scalefactor);
-
- tmpOut[i] = pcm_sample;
-
dvp += 16;
- } // for
- }
-
- private void compute_pcm_samples1(Obuffer buffer)
- {
- final float[] vp = actual_v;
- //int inc = v_inc;
- final float[] tmpOut = _tmpOut;
- int dvp =0;
-
- // fat chance of having this loop unroll
- for( int i=0; i<32; i++)
- {
- final float[] dp = d16[i];
- float pcm_sample;
+ } // for
+ }
+ private void compute_pcm_samples1( )
+ {
+ final float[] vp = actual_v;
+ //int inc = v_inc;
+ final float[] tmpOut = _tmpOut;
+ int dvp =0;
- pcm_sample = (float)(((vp[1 + dvp] * dp[0]) +
+ // fat chance of having this loop unroll
+ for( int i=0; i<32; i++)
+ {
+ final float[] dp = d16[i];
+ float pcm_sample;
+
+ pcm_sample = (((vp[1 + dvp] * dp[0]) +
(vp[0 + dvp] * dp[1]) +
(vp[15 + dvp] * dp[2]) +
(vp[14 + dvp] * dp[3]) +
@@ -917,28 +536,28 @@ private void compute_pcm_samples1(Obuffer buffer)
(vp[4 + dvp] * dp[13]) +
(vp[3 + dvp] * dp[14]) +
(vp[2 + dvp] * dp[15])
- ) * scalefactor);
+ ) );
+
+ tmpOut[i] = pcm_sample;
- tmpOut[i] = pcm_sample;
-
dvp += 16;
- } // for
- }
- private void compute_pcm_samples2(Obuffer buffer)
- {
- final float[] vp = actual_v;
-
- //int inc = v_inc;
- final float[] tmpOut = _tmpOut;
- int dvp =0;
-
- // fat chance of having this loop unroll
- for( int i=0; i<32; i++)
- {
- final float[] dp = d16[i];
- float pcm_sample;
+ } // for
+ }
+ private void compute_pcm_samples2( )
+ {
+ final float[] vp = actual_v;
+
+ //int inc = v_inc;
+ final float[] tmpOut = _tmpOut;
+ int dvp =0;
+
+ // fat chance of having this loop unroll
+ for( int i=0; i<32; i++)
+ {
+ final float[] dp = d16[i];
+ float pcm_sample;
- pcm_sample = (float)(((vp[2 + dvp] * dp[0]) +
+ pcm_sample = (float)(((vp[2 + dvp] * dp[0]) +
(vp[1 + dvp] * dp[1]) +
(vp[0 + dvp] * dp[2]) +
(vp[15 + dvp] * dp[3]) +
@@ -954,30 +573,28 @@ private void compute_pcm_samples2(Obuffer buffer)
(vp[5 + dvp] * dp[13]) +
(vp[4 + dvp] * dp[14]) +
(vp[3 + dvp] * dp[15])
- ) * scalefactor);
+ ) );
+
+ tmpOut[i] = pcm_sample;
- tmpOut[i] = pcm_sample;
-
dvp += 16;
- } // for
+ } // for
}
-
- private void compute_pcm_samples3(Obuffer buffer)
- {
- final float[] vp = actual_v;
-
- int idx = 0;
- //int inc = v_inc;
- final float[] tmpOut = _tmpOut;
- int dvp =0;
-
- // fat chance of having this loop unroll
- for( int i=0; i<32; i++)
- {
- final float[] dp = d16[i];
- float pcm_sample;
+ private void compute_pcm_samples3( )
+ {
+ final float[] vp = actual_v;
- pcm_sample = (float)(((vp[3 + dvp] * dp[0]) +
+ //int inc = v_inc;
+ final float[] tmpOut = _tmpOut;
+ int dvp =0;
+
+ // fat chance of having this loop unroll
+ for( int i=0; i<32; i++)
+ {
+ final float[] dp = d16[i];
+ float pcm_sample;
+
+ pcm_sample = (float)(((vp[3 + dvp] * dp[0]) +
(vp[2 + dvp] * dp[1]) +
(vp[1 + dvp] * dp[2]) +
(vp[0 + dvp] * dp[3]) +
@@ -993,29 +610,28 @@ private void compute_pcm_samples3(Obuffer buffer)
(vp[6 + dvp] * dp[13]) +
(vp[5 + dvp] * dp[14]) +
(vp[4 + dvp] * dp[15])
- ) * scalefactor);
+ ) );
+
+ tmpOut[i] = pcm_sample;
- tmpOut[i] = pcm_sample;
-
dvp += 16;
- } // for
- }
-
- private void compute_pcm_samples4(Obuffer buffer)
- {
- final float[] vp = actual_v;
-
- //int inc = v_inc;
- final float[] tmpOut = _tmpOut;
- int dvp =0;
-
- // fat chance of having this loop unroll
- for( int i=0; i<32; i++)
- {
- final float[] dp = d16[i];
- float pcm_sample;
+ } // for
+ }
+ private void compute_pcm_samples4()
+ {
+ final float[] vp = actual_v;
- pcm_sample = (float)(((vp[4 + dvp] * dp[0]) +
+ //int inc = v_inc;
+ final float[] tmpOut = _tmpOut;
+ int dvp =0;
+
+ // fat chance of having this loop unroll
+ for( int i=0; i<32; i++)
+ {
+ final float[] dp = d16[i];
+ float pcm_sample;
+
+ pcm_sample = (float)(((vp[4 + dvp] * dp[0]) +
(vp[3 + dvp] * dp[1]) +
(vp[2 + dvp] * dp[2]) +
(vp[1 + dvp] * dp[3]) +
@@ -1031,29 +647,28 @@ private void compute_pcm_samples4(Obuffer buffer)
(vp[7 + dvp] * dp[13]) +
(vp[6 + dvp] * dp[14]) +
(vp[5 + dvp] * dp[15])
- ) * scalefactor);
+ ) );
+
+ tmpOut[i] = pcm_sample;
- tmpOut[i] = pcm_sample;
-
dvp += 16;
- } // for
- }
-
- private void compute_pcm_samples5(Obuffer buffer)
- {
- final float[] vp = actual_v;
-
- //int inc = v_inc;
- final float[] tmpOut = _tmpOut;
- int dvp =0;
-
- // fat chance of having this loop unroll
- for( int i=0; i<32; i++)
- {
- final float[] dp = d16[i];
- float pcm_sample;
+ } // for
+ }
+ private void compute_pcm_samples5()
+ {
+ final float[] vp = actual_v;
- pcm_sample = (float)(((vp[5 + dvp] * dp[0]) +
+ //int inc = v_inc;
+ final float[] tmpOut = _tmpOut;
+ int dvp =0;
+
+ // fat chance of having this loop unroll
+ for( int i=0; i<32; i++)
+ {
+ final float[] dp = d16[i];
+ float pcm_sample;
+
+ pcm_sample = (float)(((vp[5 + dvp] * dp[0]) +
(vp[4 + dvp] * dp[1]) +
(vp[3 + dvp] * dp[2]) +
(vp[2 + dvp] * dp[3]) +
@@ -1069,28 +684,27 @@ private void compute_pcm_samples5(Obuffer buffer)
(vp[8 + dvp] * dp[13]) +
(vp[7 + dvp] * dp[14]) +
(vp[6 + dvp] * dp[15])
- ) * scalefactor);
+ ) );
+
+ tmpOut[i] = pcm_sample;
- tmpOut[i] = pcm_sample;
-
dvp += 16;
- } // for
- }
-
- private void compute_pcm_samples6(Obuffer buffer)
- {
- final float[] vp = actual_v;
- //int inc = v_inc;
- final float[] tmpOut = _tmpOut;
- int dvp =0;
-
- // fat chance of having this loop unroll
- for( int i=0; i<32; i++)
- {
- final float[] dp = d16[i];
- float pcm_sample;
+ } // for
+ }
+ private void compute_pcm_samples6()
+ {
+ final float[] vp = actual_v;
+ //int inc = v_inc;
+ final float[] tmpOut = _tmpOut;
+ int dvp =0;
+
+ // fat chance of having this loop unroll
+ for( int i=0; i<32; i++)
+ {
+ final float[] dp = d16[i];
+ float pcm_sample;
- pcm_sample = (float)(((vp[6 + dvp] * dp[0]) +
+ pcm_sample = (float)(((vp[6 + dvp] * dp[0]) +
(vp[5 + dvp] * dp[1]) +
(vp[4 + dvp] * dp[2]) +
(vp[3 + dvp] * dp[3]) +
@@ -1106,29 +720,28 @@ private void compute_pcm_samples6(Obuffer buffer)
(vp[9 + dvp] * dp[13]) +
(vp[8 + dvp] * dp[14]) +
(vp[7 + dvp] * dp[15])
- ) * scalefactor);
+ ) );
+
+ tmpOut[i] = pcm_sample;
- tmpOut[i] = pcm_sample;
-
dvp += 16;
- } // for
- }
-
- private void compute_pcm_samples7(Obuffer buffer)
- {
- final float[] vp = actual_v;
-
- //int inc = v_inc;
- final float[] tmpOut = _tmpOut;
- int dvp =0;
-
- // fat chance of having this loop unroll
- for( int i=0; i<32; i++)
- {
- final float[] dp = d16[i];
- float pcm_sample;
+ } // for
+ }
+ private void compute_pcm_samples7()
+ {
+ final float[] vp = actual_v;
+
+ //int inc = v_inc;
+ final float[] tmpOut = _tmpOut;
+ int dvp =0;
+
+ // fat chance of having this loop unroll
+ for( int i=0; i<32; i++)
+ {
+ final float[] dp = d16[i];
+ float pcm_sample;
- pcm_sample = (float)(((vp[7 + dvp] * dp[0]) +
+ pcm_sample = (float)(((vp[7 + dvp] * dp[0]) +
(vp[6 + dvp] * dp[1]) +
(vp[5 + dvp] * dp[2]) +
(vp[4 + dvp] * dp[3]) +
@@ -1144,28 +757,28 @@ private void compute_pcm_samples7(Obuffer buffer)
(vp[10 + dvp] * dp[13]) +
(vp[9 + dvp] * dp[14]) +
(vp[8 + dvp] * dp[15])
- ) * scalefactor);
+ ) );
+
+ tmpOut[i] = pcm_sample;
- tmpOut[i] = pcm_sample;
-
dvp += 16;
- } // for
+ } // for
}
- private void compute_pcm_samples8(Obuffer buffer)
- {
- final float[] vp = actual_v;
-
- //int inc = v_inc;
- final float[] tmpOut = _tmpOut;
- int dvp =0;
-
- // fat chance of having this loop unroll
- for( int i=0; i<32; i++)
- {
- final float[] dp = d16[i];
- float pcm_sample;
+ private void compute_pcm_samples8()
+ {
+ final float[] vp = actual_v;
+
+ //int inc = v_inc;
+ final float[] tmpOut = _tmpOut;
+ int dvp =0;
+
+ // fat chance of having this loop unroll
+ for( int i=0; i<32; i++)
+ {
+ final float[] dp = d16[i];
+ float pcm_sample;
- pcm_sample = (float)(((vp[8 + dvp] * dp[0]) +
+ pcm_sample = (float)(((vp[8 + dvp] * dp[0]) +
(vp[7 + dvp] * dp[1]) +
(vp[6 + dvp] * dp[2]) +
(vp[5 + dvp] * dp[3]) +
@@ -1181,29 +794,28 @@ private void compute_pcm_samples8(Obuffer buffer)
(vp[11 + dvp] * dp[13]) +
(vp[10 + dvp] * dp[14]) +
(vp[9 + dvp] * dp[15])
- ) * scalefactor);
+ ) );
+
+ tmpOut[i] = pcm_sample;
- tmpOut[i] = pcm_sample;
-
dvp += 16;
- } // for
- }
-
- private void compute_pcm_samples9(Obuffer buffer)
- {
- final float[] vp = actual_v;
-
- //int inc = v_inc;
- final float[] tmpOut = _tmpOut;
- int dvp =0;
-
- // fat chance of having this loop unroll
- for( int i=0; i<32; i++)
- {
- final float[] dp = d16[i];
- float pcm_sample;
+ } // for
+ }
+ private void compute_pcm_samples9()
+ {
+ final float[] vp = actual_v;
+
+ //int inc = v_inc;
+ final float[] tmpOut = _tmpOut;
+ int dvp =0;
+
+ // fat chance of having this loop unroll
+ for( int i=0; i<32; i++)
+ {
+ final float[] dp = d16[i];
+ float pcm_sample;
- pcm_sample = (float)(((vp[9 + dvp] * dp[0]) +
+ pcm_sample = (float)(((vp[9 + dvp] * dp[0]) +
(vp[8 + dvp] * dp[1]) +
(vp[7 + dvp] * dp[2]) +
(vp[6 + dvp] * dp[3]) +
@@ -1219,28 +831,27 @@ private void compute_pcm_samples9(Obuffer buffer)
(vp[12 + dvp] * dp[13]) +
(vp[11 + dvp] * dp[14]) +
(vp[10 + dvp] * dp[15])
- ) * scalefactor);
+ ) );
+
+ tmpOut[i] = pcm_sample;
- tmpOut[i] = pcm_sample;
-
dvp += 16;
- } // for
- }
-
- private void compute_pcm_samples10(Obuffer buffer)
- {
- final float[] vp = actual_v;
- //int inc = v_inc;
- final float[] tmpOut = _tmpOut;
- int dvp =0;
-
- // fat chance of having this loop unroll
- for( int i=0; i<32; i++)
- {
- final float[] dp = d16[i];
- float pcm_sample;
+ } // for
+ }
+ private void compute_pcm_samples10()
+ {
+ final float[] vp = actual_v;
+ //int inc = v_inc;
+ final float[] tmpOut = _tmpOut;
+ int dvp =0;
- pcm_sample = (float)(((vp[10 + dvp] * dp[0]) +
+ // fat chance of having this loop unroll
+ for( int i=0; i<32; i++)
+ {
+ final float[] dp = d16[i];
+ float pcm_sample;
+
+ pcm_sample = (float)(((vp[10 + dvp] * dp[0]) +
(vp[9 + dvp] * dp[1]) +
(vp[8 + dvp] * dp[2]) +
(vp[7 + dvp] * dp[3]) +
@@ -1256,28 +867,28 @@ private void compute_pcm_samples10(Obuffer buffer)
(vp[13 + dvp] * dp[13]) +
(vp[12 + dvp] * dp[14]) +
(vp[11 + dvp] * dp[15])
- ) * scalefactor);
+ ) );
+
+ tmpOut[i] = pcm_sample;
- tmpOut[i] = pcm_sample;
-
dvp += 16;
- } // for
- }
- private void compute_pcm_samples11(Obuffer buffer)
- {
- final float[] vp = actual_v;
-
- //int inc = v_inc;
- final float[] tmpOut = _tmpOut;
- int dvp =0;
-
- // fat chance of having this loop unroll
- for( int i=0; i<32; i++)
- {
- final float[] dp = d16[i];
- float pcm_sample;
+ } // for
+ }
+ private void compute_pcm_samples11()
+ {
+ final float[] vp = actual_v;
+
+ //int inc = v_inc;
+ final float[] tmpOut = _tmpOut;
+ int dvp =0;
+
+ // fat chance of having this loop unroll
+ for( int i=0; i<32; i++)
+ {
+ final float[] dp = d16[i];
+ float pcm_sample;
- pcm_sample = (float)(((vp[11 + dvp] * dp[0]) +
+ pcm_sample = (float)(((vp[11 + dvp] * dp[0]) +
(vp[10 + dvp] * dp[1]) +
(vp[9 + dvp] * dp[2]) +
(vp[8 + dvp] * dp[3]) +
@@ -1293,27 +904,27 @@ private void compute_pcm_samples11(Obuffer buffer)
(vp[14 + dvp] * dp[13]) +
(vp[13 + dvp] * dp[14]) +
(vp[12 + dvp] * dp[15])
- ) * scalefactor);
+ ) );
+
+ tmpOut[i] = pcm_sample;
- tmpOut[i] = pcm_sample;
-
dvp += 16;
- } // for
- }
- private void compute_pcm_samples12(Obuffer buffer)
- {
- final float[] vp = actual_v;
- //int inc = v_inc;
- final float[] tmpOut = _tmpOut;
- int dvp =0;
-
- // fat chance of having this loop unroll
- for( int i=0; i<32; i++)
- {
- final float[] dp = d16[i];
- float pcm_sample;
+ } // for
+ }
+ private void compute_pcm_samples12()
+ {
+ final float[] vp = actual_v;
+ //int inc = v_inc;
+ final float[] tmpOut = _tmpOut;
+ int dvp =0;
- pcm_sample = (float)(((vp[12 + dvp] * dp[0]) +
+ // fat chance of having this loop unroll
+ for( int i=0; i<32; i++)
+ {
+ final float[] dp = d16[i];
+ float pcm_sample;
+
+ pcm_sample = (float)(((vp[12 + dvp] * dp[0]) +
(vp[11 + dvp] * dp[1]) +
(vp[10 + dvp] * dp[2]) +
(vp[9 + dvp] * dp[3]) +
@@ -1329,28 +940,28 @@ private void compute_pcm_samples12(Obuffer buffer)
(vp[15 + dvp] * dp[13]) +
(vp[14 + dvp] * dp[14]) +
(vp[13 + dvp] * dp[15])
- ) * scalefactor);
+ ) );
+
+ tmpOut[i] = pcm_sample;
- tmpOut[i] = pcm_sample;
-
dvp += 16;
- } // for
+ } // for
}
- private void compute_pcm_samples13(Obuffer buffer)
- {
- final float[] vp = actual_v;
-
- //int inc = v_inc;
- final float[] tmpOut = _tmpOut;
- int dvp =0;
-
- // fat chance of having this loop unroll
- for( int i=0; i<32; i++)
- {
- final float[] dp = d16[i];
- float pcm_sample;
+ private void compute_pcm_samples13()
+ {
+ final float[] vp = actual_v;
+
+ //int inc = v_inc;
+ final float[] tmpOut = _tmpOut;
+ int dvp =0;
- pcm_sample = (float)(((vp[13 + dvp] * dp[0]) +
+ // fat chance of having this loop unroll
+ for( int i=0; i<32; i++)
+ {
+ final float[] dp = d16[i];
+ float pcm_sample;
+
+ pcm_sample = (float)(((vp[13 + dvp] * dp[0]) +
(vp[12 + dvp] * dp[1]) +
(vp[11 + dvp] * dp[2]) +
(vp[10 + dvp] * dp[3]) +
@@ -1366,28 +977,28 @@ private void compute_pcm_samples13(Obuffer buffer)
(vp[0 + dvp] * dp[13]) +
(vp[15 + dvp] * dp[14]) +
(vp[14 + dvp] * dp[15])
- ) * scalefactor);
+ ) );
+
+ tmpOut[i] = pcm_sample;
- tmpOut[i] = pcm_sample;
-
dvp += 16;
- } // for
- }
- private void compute_pcm_samples14(Obuffer buffer)
- {
- final float[] vp = actual_v;
-
- //int inc = v_inc;
- final float[] tmpOut = _tmpOut;
- int dvp =0;
-
- // fat chance of having this loop unroll
- for( int i=0; i<32; i++)
- {
- final float[] dp = d16[i];
- float pcm_sample;
+ } // for
+ }
+ private void compute_pcm_samples14()
+ {
+ final float[] vp = actual_v;
+
+ //int inc = v_inc;
+ final float[] tmpOut = _tmpOut;
+ int dvp =0;
+
+ // fat chance of having this loop unroll
+ for( int i=0; i<32; i++)
+ {
+ final float[] dp = d16[i];
+ float pcm_sample;
- pcm_sample = (float)(((vp[14 + dvp] * dp[0]) +
+ pcm_sample = (vp[14 + dvp] * dp[0]) +
(vp[13 + dvp] * dp[1]) +
(vp[12 + dvp] * dp[2]) +
(vp[11 + dvp] * dp[3]) +
@@ -1402,28 +1013,23 @@ private void compute_pcm_samples14(Obuffer buffer)
(vp[2 + dvp] * dp[12]) +
(vp[1 + dvp] * dp[13]) +
(vp[0 + dvp] * dp[14]) +
- (vp[15 + dvp] * dp[15])
- ) * scalefactor);
+ (vp[15 + dvp] * dp[15]);
+
+ tmpOut[i] = pcm_sample;
- tmpOut[i] = pcm_sample;
-
dvp += 16;
- } // for
- }
- private void compute_pcm_samples15(Obuffer buffer)
- {
- final float[] vp = actual_v;
-
- //int inc = v_inc;
- final float[] tmpOut = _tmpOut;
- int dvp =0;
-
- // fat chance of having this loop unroll
- for( int i=0; i<32; i++)
- {
- float pcm_sample;
- final float dp[] = d16[i];
- pcm_sample = (float)(((vp[15 + dvp] * dp[0]) +
+ } // for
+ }
+ private void compute_pcm_samples15()
+ {
+ final float[] vp = actual_v;
+ final float[] tmpOut = _tmpOut;
+ int dvp =0;
+ for( int i=0; i<32; i++)
+ {
+ float pcm_sample;
+ final float dp[] = d16[i];
+ pcm_sample = (vp[15 + dvp] * dp[0]) +
(vp[14 + dvp] * dp[1]) +
(vp[13 + dvp] * dp[2]) +
(vp[12 + dvp] * dp[3]) +
@@ -1438,125 +1044,91 @@ private void compute_pcm_samples15(Obuffer buffer)
(vp[3 + dvp] * dp[12]) +
(vp[2 + dvp] * dp[13]) +
(vp[1 + dvp] * dp[14]) +
- (vp[0 + dvp] * dp[15])
- ) * scalefactor);
+ (vp[0 + dvp] * dp[15]);
- tmpOut[i] = pcm_sample;
+ tmpOut[i] = pcm_sample;
dvp += 16;
- } // for
}
-
-private void compute_pcm_samples(Obuffer buffer)
-{
-
- switch (actual_write_pos)
- {
- case 0:
- compute_pcm_samples0(buffer);
- break;
- case 1:
- compute_pcm_samples1(buffer);
- break;
- case 2:
- compute_pcm_samples2(buffer);
- break;
- case 3:
- compute_pcm_samples3(buffer);
- break;
- case 4:
- compute_pcm_samples4(buffer);
- break;
- case 5:
- compute_pcm_samples5(buffer);
- break;
- case 6:
- compute_pcm_samples6(buffer);
- break;
- case 7:
- compute_pcm_samples7(buffer);
- break;
- case 8:
- compute_pcm_samples8(buffer);
- break;
- case 9:
- compute_pcm_samples9(buffer);
- break;
- case 10:
- compute_pcm_samples10(buffer);
- break;
- case 11:
- compute_pcm_samples11(buffer);
- break;
- case 12:
- compute_pcm_samples12(buffer);
- break;
- case 13:
- compute_pcm_samples13(buffer);
- break;
- case 14:
- compute_pcm_samples14(buffer);
- break;
- case 15:
- compute_pcm_samples15(buffer);
- break;
}
-
- if (buffer!=null)
- {
- buffer.appendSamples(channel, _tmpOut);
- }
-
-/*
- // MDM: I was considering putting in quality control for
- // low-spec CPUs, but the performance gain (about 10-15%)
- // did not justify the considerable drop in audio quality.
- switch (inc)
+
+ private void compute_pcm_samples(Obuffer buffer)
+ {
+ switch (actual_write_pos)
{
- case 16:
- buffer.appendSamples(channel, tmpOut);
- break;
- case 32:
- for (int i=0; i<16; i++)
- {
- buffer.append(channel, (short)tmpOut[i]);
- buffer.append(channel, (short)tmpOut[i]);
- }
- break;
- case 64:
- for (int i=0; i<8; i++)
- {
- buffer.append(channel, (short)tmpOut[i]);
- buffer.append(channel, (short)tmpOut[i]);
- buffer.append(channel, (short)tmpOut[i]);
- buffer.append(channel, (short)tmpOut[i]);
- }
- break;
-
+ case 0:
+ compute_pcm_samples0();
+ break;
+ case 1:
+ compute_pcm_samples1();
+ break;
+ case 2:
+ compute_pcm_samples2();
+ break;
+ case 3:
+ compute_pcm_samples3();
+ break;
+ case 4:
+ compute_pcm_samples4();
+ break;
+ case 5:
+ compute_pcm_samples5();
+ break;
+ case 6:
+ compute_pcm_samples6();
+ break;
+ case 7:
+ compute_pcm_samples7();
+ break;
+ case 8:
+ compute_pcm_samples8();
+ break;
+ case 9:
+ compute_pcm_samples9();
+ break;
+ case 10:
+ compute_pcm_samples10();
+ break;
+ case 11:
+ compute_pcm_samples11();
+ break;
+ case 12:
+ compute_pcm_samples12();
+ break;
+ case 13:
+ compute_pcm_samples13();
+ break;
+ case 14:
+ compute_pcm_samples14();
+ break;
+ case 15:
+ compute_pcm_samples15();
+ break;
}
-*/
- }
+
+ if (buffer!=null)
+ buffer.appendSamples(channel, _tmpOut);
+ }
/**
- * Calculate 32 PCM samples and put the into the Obuffer-object.
- */
-
- public void calculate_pcm_samples(Obuffer buffer)
- {
- compute_new_v();
- compute_pcm_samples(buffer);
-
- actual_write_pos = (actual_write_pos + 1) & 0xf;
- actual_v = (actual_v == v1) ? v2 : v1;
-
- // initialize samples[]:
- //for (register float *floatp = samples + 32; floatp > samples; )
- // *--floatp = 0.0f;
-
- // MDM: this may not be necessary. The Layer III decoder always
- // outputs 32 subband samples, but I haven't checked layer I & II.
- for (int p=0;p<32;p++)
- samples[p] = 0.0f;
- }
+ * Calculate 32 PCM samples and put the into the Obuffer-object.
+ */
+ public void calculate_pcm_samples_layer_iii(Obuffer buffer)
+ {
+ compute_new_v();
+ compute_pcm_samples(buffer);
+
+ actual_write_pos = (actual_write_pos + 1) & 0xf;
+ actual_v = (actual_v == v1) ? v2 : v1;
+ }
+
+ public void calculate_pcm_samples_layer_i_ii(Obuffer buffer)
+ {
+ calculate_pcm_samples_layer_iii(buffer);
+ // MDM: this may not be necessary. The Layer III decoder always
+ // outputs 32 subband samples, but I haven't checked layer I & II.
+ for (int p=0;p<32;p++)
+ samples[p] = 0.0f;
+ }
private static final double MY_PI = 3.14159265358979323846;
diff --git a/src/javax/microedition/media/javazoom/jl/player/NullAudioDevice.java b/src/javax/microedition/media/javazoom/jl/player/NullAudioDevice.java
deleted file mode 100644
index f8449201..00000000
--- a/src/javax/microedition/media/javazoom/jl/player/NullAudioDevice.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * 11/19/04 1.0 moved o LGPL.
- * 29/01/00 Initial version. mdm@techie.com
- *-----------------------------------------------------------------------
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Library General Public License as published
- * by the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *----------------------------------------------------------------------
- */
-
-package javazoom.jl.player;
-
-/**
- * The NullAudioDevice
implements a silent, no-op
- * audio device. This is useful for testing purposes.
- *
- * @since 0.0.8
- * @author Mat McGowan
- */
-public class NullAudioDevice extends AudioDeviceBase
-{
-
- public int getPosition()
- {
- return 0;
- }
-
- public void setVolume(int vol) {
- }
-
- public int getVolume() {
- return 100;
- }
-}