/*
* 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.
*----------------------------------------------------------------------
*/
package de.quippy.mp3.decoder;
/**
* Class Implementing Layer 3 Decoder.
*
* @since 0.0
*/
final class LayerIIIDecoder implements FrameDecoder
{
private static final double d43 = (4.0 / 3.0);
public int[] scalefac_buffer;
// MDM: removed, as this wasn't being used.
// private float CheckSumOut1d = 0.0f;
private int CheckSumHuff = 0;
private int[] is_1d;
private float[][][] ro;
private float[][][] lr;
private float[] out_1d;
private float[][] prevblck;
private float[][] k;
private int[] nonzero;
private Bitstream stream;
private Header header;
private SynthesisFilter filter1, filter2;
private Obuffer buffer;
private int which_channels;
private BitReserve br;
private III_side_info_t si;
private temporaire2[] III_scalefac_t;
private temporaire2[] scalefac;
// private III_scalefac_t scalefac;
private int max_gr;
private int frame_start;
private int part2_start;
private int channels;
private int first_channel;
private int last_channel;
private int sfreq;
/**
* Constructor.
*/
// REVIEW: these constructor arguments should be moved to the
// decodeFrame() method, where possible, so that one
public LayerIIIDecoder(Bitstream stream0, Header header0, SynthesisFilter filtera, SynthesisFilter filterb, Obuffer buffer0, 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];
// 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;
// L3TABLE INIT
sfBandIndex = new SBI[9]; // SZD: MPEG2.5 +3 indices
int[] l0 =
{
0, 6, 12, 18, 24, 30, 36, 44, 54, 66, 80, 96, 116, 140, 168, 200, 238, 284, 336, 396, 464, 522, 576
};
int[] s0 =
{
0, 4, 8, 12, 18, 24, 32, 42, 56, 74, 100, 132, 174, 192
};
int[] l1 =
{
0, 6, 12, 18, 24, 30, 36, 44, 54, 66, 80, 96, 114, 136, 162, 194, 232, 278, 330, 394, 464, 540, 576
};
int[] s1 =
{
0, 4, 8, 12, 18, 26, 36, 48, 62, 80, 104, 136, 180, 192
};
int[] l2 =
{
0, 6, 12, 18, 24, 30, 36, 44, 54, 66, 80, 96, 116, 140, 168, 200, 238, 284, 336, 396, 464, 522, 576
};
int[] s2 =
{
0, 4, 8, 12, 18, 26, 36, 48, 62, 80, 104, 134, 174, 192
};
int[] l3 =
{
0, 4, 8, 12, 16, 20, 24, 30, 36, 44, 52, 62, 74, 90, 110, 134, 162, 196, 238, 288, 342, 418, 576
};
int[] s3 =
{
0, 4, 8, 12, 16, 22, 30, 40, 52, 66, 84, 106, 136, 192
};
int[] l4 =
{
0, 4, 8, 12, 16, 20, 24, 30, 36, 42, 50, 60, 72, 88, 106, 128, 156, 190, 230, 276, 330, 384, 576
};
int[] s4 =
{
0, 4, 8, 12, 16, 22, 28, 38, 50, 64, 80, 100, 126, 192
};
int[] l5 =
{
0, 4, 8, 12, 16, 20, 24, 30, 36, 44, 54, 66, 82, 102, 126, 156, 194, 240, 296, 364, 448, 550, 576
};
int[] s5 =
{
0, 4, 8, 12, 16, 22, 30, 42, 58, 78, 104, 138, 180, 192
};
// SZD: MPEG2.5
int[] l6 =
{
0, 6, 12, 18, 24, 30, 36, 44, 54, 66, 80, 96, 116, 140, 168, 200, 238, 284, 336, 396, 464, 522, 576
};
int[] s6 =
{
0, 4, 8, 12, 18, 26, 36, 48, 62, 80, 104, 134, 174, 192
};
int[] l7 =
{
0, 6, 12, 18, 24, 30, 36, 44, 54, 66, 80, 96, 116, 140, 168, 200, 238, 284, 336, 396, 464, 522, 576
};
int[] s7 =
{
0, 4, 8, 12, 18, 26, 36, 48, 62, 80, 104, 134, 174, 192
};
int[] l8 =
{
0, 12, 24, 36, 48, 60, 72, 88, 108, 132, 160, 192, 232, 280, 336, 400, 476, 566, 568, 570, 572, 574, 576
};
int[] s8 =
{
0, 8, 16, 24, 36, 52, 72, 96, 124, 160, 162, 164, 166, 192
};
sfBandIndex[0] = new SBI(l0, s0);
sfBandIndex[1] = new SBI(l1, s1);
sfBandIndex[2] = new SBI(l2, s2);
sfBandIndex[3] = new SBI(l3, s3);
sfBandIndex[4] = new SBI(l4, s4);
sfBandIndex[5] = new SBI(l5, s5);
// SZD: MPEG2.5
sfBandIndex[6] = new SBI(l6, s6);
sfBandIndex[7] = new SBI(l7, s7);
sfBandIndex[8] = new SBI(l8, s8);
// END OF L3TABLE INIT
// SZD: generate LUT
reorder_table = new int[9][];
for (int i = 0; i < 9; i++)
reorder_table[i] = reorder(sfBandIndex[i].s);
// Sftable
// int[] ll0 = {0, 6, 11, 16, 21};
// int[] ss0 = {0, 6, 12};
// sftable = new Sftable(ll0,ss0);
// END OF Sftable
// scalefac_buffer
scalefac_buffer = new int[54];
// END OF scalefac_buffer
stream = stream0;
header = header0;
filter1 = filtera;
filter2 = filterb;
buffer = buffer0;
which_channels = which_ch0;
frame_start = 0;
channels = (header.mode() == Header.SINGLE_CHANNEL) ? 1 : 2;
max_gr = (header.version() == Header.MPEG1) ? 2 : 1;
sfreq = header.sample_frequency() + ((header.version() == Header.MPEG1) ? 3 : (header.version() == Header.MPEG25_LSF) ? 6 : 0); // SZD
if (channels == 2)
{
switch (which_channels)
{
case OutputChannels.LEFT_CHANNEL:
case OutputChannels.DOWNMIX_CHANNELS:
first_channel = last_channel = 0;
break;
case OutputChannels.RIGHT_CHANNEL:
first_channel = last_channel = 1;
break;
case OutputChannels.BOTH_CHANNELS:
default:
first_channel = 0;
last_channel = 1;
break;
}
}
else
{
first_channel = last_channel = 0;
}
for (int ch = 0; ch < 2; ch++)
for (int j = 0; j < 576; j++)
prevblck[ch][j] = 0.0f;
nonzero[0] = nonzero[1] = 576;
br = new BitReserve();
si = new III_side_info_t();
}
/**
* Notify decoder that a seek is being made.
*/
public void seek_notify()
{
frame_start = 0;
for (int ch = 0; ch < 2; ch++)
for (int j = 0; j < 576; j++)
prevblck[ch][j] = 0.0f;
br = new BitReserve();
}
public void decodeFrame()
{
decode();
}
/**
* 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;
int bytes_to_discard;
int i;
get_side_info();
for (i = 0; i < nSlots; i++)
br.hputbuf(stream.get_bits(8));
main_data_end = br.hsstell() >>> 3; // of previous frame
if ((flush_main = (br.hsstell() & 7))
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
该项目为基于树莓派和max7219模块的LED矩阵钟表及闹铃设计源码,包含335个文件,包括280个Java源文件、24个WAV音频文件、14个XML配置文件、5个JPG图片文件、2个YML配置文件、2个PNG图片文件、1个.gitignore文件、1个LICENSE文件、1个Markdown文件和1个CSS样式文件。此项目采用Java和CSS语言编写,适用于构建智能时钟和闹铃系统。
资源推荐
资源详情
资源评论
收起资源包目录
基于树莓派和max7219模块的LED矩阵钟表及闹铃设计源码 (335个子文件)
toggleButton.css 281B
index.fxml 499B
.gitignore 395B
weather.city.info 81KB
LayerIIIDecoder.java 83KB
Helpers.java 57KB
LayerIIDecoder.java 53KB
SynthesisFilter.java 51KB
VorbisFile.java 37KB
FLACDecoder.java 33KB
Drft.java 30KB
huffcodetab.java 29KB
BitInputStream.java 27KB
ClockInfoServiceImpl.java 27KB
BitOutputStream.java 24KB
Header.java 21KB
Floor1.java 18KB
OLEDDisplay.java 17KB
AudioProcessor.java 16KB
ID3v2Tag.java 15KB
Bitstream.java 15KB
ID3v2Frame.java 14KB
StreamState.java 14KB
ComponentManager.java 13KB
StartListener.java 13KB
Info.java 13KB
LayerIDecoder.java 13KB
OGGMixer.java 13KB
StaticCodeBook.java 12KB
CodeBook.java 12KB
LocalDateComponent.java 12KB
OggPlayer.java 12KB
ID3v1Tag.java 12KB
DefaultFont8x8.java 11KB
LPCPredictor.java 11KB
SecondNotifyJob.java 11KB
SoundOutputStreamImpl.java 11KB
JOrbisComment.java 11KB
DspState.java 11KB
Header.java 11KB
AudioPlayer.java 10KB
MPEGAudioFrameHeader.java 10KB
FixedPredictor.java 10KB
Mapping0.java 10KB
TableConfig.java 10KB
RiffFile.java 10KB
Residue0.java 9KB
CRC16.java 9KB
WeatherComponent.java 9KB
ID3v2ExtendedHeader.java 9KB
AudioLevelManager.java 9KB
DefaultFont8x8.java 9KB
ID3v2Footer.java 9KB
Lunar.java 9KB
Floor0.java 9KB
Decoder.java 8KB
ID3v2Header.java 8KB
CRC8.java 8KB
DiyNextTimeServiceImpl.java 8KB
IndexController.java 8KB
MP3Mixer.java 8KB
StreamInfo.java 8KB
ListenerHttpClient.java 8KB
Lookup.java 8KB
DefaultFont8x8.java 8KB
ID3v2Frames.java 7KB
SyncState.java 7KB
WavMixer.java 7KB
UploadFileController.java 7KB
WeatherServiceImpl.java 7KB
ChannelLPC.java 6KB
Mixer.java 6KB
MultiFilePlayer.java 6KB
FLACMixer.java 6KB
Buffer.java 6KB
FileUtils.java 6KB
Comment.java 6KB
FastFFT.java 6KB
FileOrPackedInputStream.java 6KB
AnnotationScannerConfigurer.java 5KB
JavaLayerUtils.java 5KB
GovHolidayServiceImpl.java 5KB
CueSheet.java 5KB
WaveFile.java 5KB
Mdct.java 5KB
ReceiverDecoder.java 5KB
SettingController.java 5KB
MergedSpi.java 5KB
MusicListController.java 5KB
LocalTimeComponent.java 5KB
OggMetaData.java 5KB
VorbisComment.java 5KB
BitReserve.java 5KB
BasicMixer.java 5KB
ProcessStateComponent.java 5KB
TextPxCreater.java 5KB
Equalizer.java 5KB
Mp3Player.java 5KB
VolumeSettingServiceImpl.java 5KB
Lpc.java 5KB
共 335 条
- 1
- 2
- 3
- 4
资源评论
csbysj2020
- 粉丝: 2650
- 资源: 5505
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功