/**\r
* Rewind N bits in Stream.\r
*/\r
- public void rewindNbits(int N)\r
+ public void rewindNbits(@LOC("IN") int N)\r
{\r
totbit -= N; \r
buf_byte_idx -= N;\r
* @version 0.0.7 12/12/99\r
* @since 0.0.5\r
*/\r
+@LATTICE("ST,OUT,FIL,DE,O,EQ,PA,INIT")\r
public class Decoder implements DecoderErrors\r
{\r
static private final Params DEFAULT_PARAMS = new Params();\r
/**\r
* The Bistream from which the MPEG audio frames are read.\r
*/\r
- private Bitstream stream;\r
+ @LOC("ST") private Bitstream stream;\r
\r
/**\r
* The Obuffer instance that will receive the decoded\r
* PCM samples.\r
*/\r
- private Obuffer output;\r
+ @LOC("OUT") private Obuffer output;\r
\r
/**\r
* Synthesis filter for the left channel.\r
*/\r
- private SynthesisFilter filter1;\r
+ @LOC("FIL") private SynthesisFilter filter1;\r
\r
/**\r
* Sythesis filter for the right channel.\r
*/\r
- private SynthesisFilter filter2; \r
+ @LOC("FIL") private SynthesisFilter filter2; \r
\r
/**\r
* The decoder used to decode layer III frames.\r
*/\r
- private LayerIIIDecoder l3decoder;\r
- private LayerIIDecoder l2decoder;\r
- private LayerIDecoder l1decoder;\r
+ @LOC("DE") private LayerIIIDecoder l3decoder;\r
+ @LOC("DE") private LayerIIDecoder l2decoder;\r
+ @LOC("DE") private LayerIDecoder l1decoder;\r
\r
- private int outputFrequency;\r
- private int outputChannels;\r
+ @LOC("O") private int outputFrequency;\r
+ @LOC("O") private int outputChannels;\r
\r
- private Equalizer equalizer = new Equalizer();\r
+ @LOC("EQ") private Equalizer equalizer = new Equalizer();\r
\r
- private Params params;\r
+ @LOC("PA") private Params params;\r
\r
- private boolean initialized;\r
+ @LOC("INIT") private boolean initialized;\r
\r
\r
/**\r
* \r
* @return A SampleBuffer containing the decoded samples.\r
*/\r
- public Obuffer decodeFrame(Header header, Bitstream stream)\r
+ @LATTICE("O<DE,DE<TH,TH<IN,THISLOC=TH")\r
+ @RETURNLOC("O")\r
+ public Obuffer decodeFrame(@LOC("IN") Header header, @LOC("IN") Bitstream stream)\r
throws DecoderException\r
{\r
// throw decoder initialization out of ssjava loop since it is invoked once\r
// initialize(header,stream);\r
// }\r
\r
- int layer = header.layer();\r
+ @LOC("DELTA(TH)") int layer = header.layer();\r
\r
output.clear_buffer();\r
\r
- FrameDecoder decoder = retrieveDecoder(header, stream, layer);\r
+ @LOC("DE") FrameDecoder decoder = retrieveDecoder(header, stream, layer);\r
\r
decoder.decodeFrame();\r
\r
return new DecoderException(errorcode, throwable);\r
}\r
\r
- protected FrameDecoder retrieveDecoder(Header header, Bitstream stream, int layer)\r
+ @LATTICE("DE<IN,THISLOC=IN")\r
+ @RETURNLOC("DE")\r
+ protected FrameDecoder retrieveDecoder(@LOC("IN") Header header, @LOC("IN") Bitstream stream, @LOC("IN") int layer)\r
throws DecoderException\r
{\r
- FrameDecoder decoder = null;\r
+ @LOC("DE") FrameDecoder decoder = null;\r
\r
// REVIEW: allow channel output selection type\r
// (LEFT, RIGHT, BOTH, DOWNMIX)\r
/**\r
* Returns Layer ID.\r
*/\r
+ @RETURNLOC("THIS")\r
public int layer() { return h_layer; }\r
\r
/**\r
-public @interface LOC{
- String value();
+public @interface LOC {
+ String value();
+}
+
+public @interface RETURNLOC {
+ String value();
}
\ No newline at end of file
* Used for single channel mode
* and in derived class for intensity stereo mode
*/
- @LATTICE("_bottom_<L,S<L,L<H,H<SH,SH*,S*")
+ @LATTICE("S<L,L<H,H<SH,SH*,S*")
@METHODDEFAULT("OUT<V,V<SH,SH<IN,SH*,THISLOC=V,GLOBALLOC=IN")
static class SubbandLayer1 extends Subband
{
/**
* Class for layer I subbands in stereo mode.
*/
- @LATTICE("L<H,H<SH,SH*")
+ @LATTICE("S<L,L<H,H<SH,SH*,S*")
@METHODDEFAULT("OUT<V,V<SH,SH<IN,SH*,THISLOC=V,GLOBALLOC=IN")
static class SubbandLayer1Stereo extends SubbandLayer1
{
@LOC("BR") private BitReserve br;
@LOC("SI") private III_side_info_t si;
- @LOC("SBT") private temporaire2[] III_scalefac_t;
+// @LOC("SBT") private temporaire2[] III_scalefac_t;
@LOC("SF") private temporaire2[] scalefac;
// private III_scalefac_t scalefac;
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;
+// 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
/**
* Base Class for audio output.
*/
-@LATTICE("B<T")
-@METHODDEFAULT("D<IN,D<C,C*")
+@LATTICE("")
+@METHODDEFAULT("D<IN,D<C,C*,THISLOC=D")
public abstract class Obuffer
{
- @LOC("T") public static final int OBUFFERSIZE = 2 * 1152; // max. 2 * 1152 samples per frame
- @LOC("T") public static final int MAXCHANNELS = 2; // max. number of channels
+ 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.
\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,HE<ST,ST<FR")\r
public class Player\r
{ \r
/**\r
* The current frame number. \r
*/\r
- private int frame = 0;\r
+ @LOC("FR") private int frame = 0;\r
\r
/**\r
* The MPEG audio bitstream. \r
*/\r
// javac blank final bug. \r
- /*final*/ private Bitstream bitstream;\r
+ /*final*/ @LOC("ST") private Bitstream bitstream;\r
\r
/**\r
* The MPEG audio decoder. \r
*/\r
- /*final*/ private Decoder decoder; \r
+ /*final*/ @LOC("DE") private Decoder decoder; \r
\r
/**\r
* The AudioDevice the audio samples are written to. \r
/**\r
* Has the player been closed?\r
*/\r
- private boolean closed = false;\r
+ @LOC("B") private boolean closed = false;\r
\r
/**\r
* Has the player played back all frames from the stream?\r
*/\r
- private boolean complete = false;\r
+ @LOC("B") private boolean complete = false;\r
\r
- private int lastPosition = 0;\r
+ @LOC("B") private int lastPosition = 0;\r
\r
- private Header header;\r
+ @LOC("HE") private Header header;\r
\r
/**\r
* Creates a new <code>Player</code> instance. \r
* @return true if the last frame was played, or false if there are\r
* more frames. \r
*/\r
- public boolean play(int frames) throws JavaLayerException\r
+ @LATTICE("IN<T,IN*,THISLOC=T")\r
+ @RETURNLOC("IN")\r
+ public boolean play(@LOC("IN") int frames) throws JavaLayerException\r
{\r
- boolean ret = true;\r
- \r
+ @LOC("IN") boolean ret = true;\r
+ \r
SSJAVA:\r
while (frames-- > 0 && ret)\r
{\r
- ret = decodeFrame(); \r
+ ret = decodeFrame();\r
}\r
/*\r
if (!ret)\r
* \r
* @return true if there are no more frames to decode, false otherwise.\r
*/\r
+ @LATTICE("O,THISLOC=O")\r
+ @RETURNLOC("O")\r
protected boolean decodeFrame() throws JavaLayerException\r
{ \r
try\r
// return false;\r
\r
// sample buffer set when decoder constructed\r
- SampleBuffer output = (SampleBuffer)decoder.decodeFrame(header, bitstream);\r
+ @LOC("O") SampleBuffer output = (SampleBuffer)decoder.decodeFrame(header, bitstream);\r
\r
//synchronized (this)\r
//{\r
/**
* Write the samples to the file (Random Acces).
*/
- public void write_buffer(int val)
+ public void write_buffer(@LOC("IN") int val)
{
//for (int i = 0; i < channels; ++i)
/**
* Abstract base class for subband classes of layer I and II
*/
- @LATTICE("L<H")
+ @LATTICE("S<L,L<H")
static abstract class Subband
{
/*
samples[subbandnumber] = eq[subbandnumber]*sample;\r
}\r
\r
- public void input_samples(float[] s)\r
+ public void input_samples(@LOC("V") float[] s)\r
{\r
for (int i=31; i>=0; i--)\r
{ \r