⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mpad.java

📁 优秀的MPEG2-TS流分析软件
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
/*
 * @(#)MPAD.java - MPA dec
 *
 * Copyright (c) 2003-2005 by dvb.matt, All Rights Reserved. 
 * 
 * This file is part of X, a free Java based demux utility.
 * X is intended for educational purposes only, as a non-commercial test project.
 * It may not be used otherwise. Most parts are only experimental.
 * 
 *
 * The mostly part of audio decoding was derived from the MPEG/Audio
 * Software Simulation Group's audio codec.
 *
 * simple resampling, amplifying and others added.
 * now decoding MPEG Layer1,2
 *
 * This program is free software; you can redistribute it free of charge
 * and/or modify it under the terms of the GNU 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 General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 */

package net.sourceforge.dvb.projectx.audio;


import java.io.*;

import net.sourceforge.dvb.projectx.common.X;

public class MPAD {

static int ERROR_CODE=0, ERROR_CODE1=0;

static final double table_b1[] = {  // scalefactors
	2.00000000000000, 1.58740105196820, 1.25992104989487, 1.00000000000000,
	0.79370042498410, 0.62996052494744, 0.50000000000000, 0.39685026299205,
	0.31498026247372, 0.25000000000000, 0.19842513149602, 0.15749013123686,
	0.12500000000000, 0.09921256574801, 0.07874506561843, 0.06250000000000,

	0.04960628287401, 0.03937253280921, 0.03125000000000, 0.02480314143700,
	0.01968626640461, 0.01562500000000, 0.01240157071850, 0.00984313320230,
	0.00781250000000, 0.00620078535925, 0.00492156660115, 0.00390625000000,
	0.00310039267963, 0.00246078330058, 0.00195312500000, 0.00155019633981,
	
	0.00123039165029, 0.00097656250000, 0.00077509816991, 0.00061519582514,
	0.00048828125000, 0.00038754908495, 0.00030759791257, 0.00024414062500,
	0.00019377454248, 0.00015379895629, 0.00012207031250, 0.00009688727124,
	0.00007689947814, 0.00006103515625, 0.00004844363562, 0.00003844973907,

	0.00003051757813, 0.00002422181781, 0.00001922486954, 0.00001525878906,
	0.00001211090890, 0.00000961243477, 0.00000762939453, 0.00000605545445,
	0.00000480621738, 0.00000381469727, 0.00000302772723, 0.00000240310869,
	0.00000190734863, 0.00000151386361, 0.00000120155435, 1E-20
};
	
static final int table_b2ab_nbal[] = {  // sblimit 27,30
	4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 3, 3, 3, 3, 3,
	3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2
};

static final int table_b2cd_nbal[] = { // sblimit 8,12
	4, 4, 3, 3, 3, 3, 3, 3,	3, 3, 3, 3
};

static final int table_MPG2_nbal[] = { // sblimit 30
	4, 4, 4, 4, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2,
	2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ,2 ,2
};

static final int table_b2_4a[] = {
	0, 1, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17
      //0, 1,_3, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17  changed due to grouping
};

static final int table_b2_4b[] = {
	0, 1, 2, 4, 3, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 17
      //0, 1, 2,_3,_4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 17  changed due to grouping
};

static final int table_b2_4c[] = {
	0, 1, 2, 3, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16
      //0, 1, 2,_4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 changed due to grouping
};

static final int table_b2_3a[] = {
	0, 1, 2, 4, 3, 5, 6, 17
      //0, 1, 2,_3,_4, 5, 6, 17 changed due to grouping
};

static final int table_b2_3b[] = {
	0, 1, 2, 3, 5, 6, 7, 8
      //0, 1, 2,_4, 5, 6, 7,_127 changed due to grouping
};

static final int table_b2_2[] = {
	0, 1, 2, 17
      //0, 1, 2, 17
};

static final int table_MPG2_a[] = {
	//0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15  changed due to grouping
	0, 1, 2, 4, 3, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
};

static final int table_MPG2_b[] = {
	//0, 1, 2, 4, 5, 6, 7, 8  changed due to grouping
	0, 1, 2, 3, 5, 6, 7, 8
};

static final int table_MPG2_c[] = {
	//0, 1, 2, 4  changed due to grouping
	0, 1, 2, 3
};

static final int table_MPG2[][] = {
	table_MPG2_a, table_MPG2_a, table_MPG2_a, table_MPG2_a,
	table_MPG2_b, table_MPG2_b, table_MPG2_b, table_MPG2_b,
	table_MPG2_b, table_MPG2_b, table_MPG2_b, table_MPG2_c,
	table_MPG2_c, table_MPG2_c, table_MPG2_c, table_MPG2_c,
	table_MPG2_c, table_MPG2_c, table_MPG2_c, table_MPG2_c,
	table_MPG2_c, table_MPG2_c, table_MPG2_c, table_MPG2_c,
	table_MPG2_c, table_MPG2_c, table_MPG2_c, table_MPG2_c,
	table_MPG2_c, table_MPG2_c
};

static final int table_b2ab[][] = { //sblimit 27,30
	table_b2_4a, table_b2_4a, table_b2_4a, table_b2_4b,
	table_b2_4b, table_b2_4b, table_b2_4b, table_b2_4b,
	table_b2_4b, table_b2_4b, table_b2_4b, table_b2_3a,
	table_b2_3a, table_b2_3a, table_b2_3a, table_b2_3a,
	table_b2_3a, table_b2_3a, table_b2_3a, table_b2_3a,
	table_b2_3a, table_b2_3a, table_b2_3a, table_b2_2,
	table_b2_2,  table_b2_2,  table_b2_2,  table_b2_2,
	table_b2_2,  table_b2_2,  table_b2_2,  table_b2_2
};

static final int table_b2cd[][] = { //sblimit 8,12
	table_b2_4c, table_b2_4c, table_b2_3b, table_b2_3b,
	table_b2_3b, table_b2_3b, table_b2_3b, table_b2_3b,
	table_b2_3b, table_b2_3b, table_b2_3b, table_b2_3b
};

static final double table_b4[][] = {  //c,d,bits,step
	{0.0,             0.0,          0,     0},
	{1.0+1.0/3.0,     1.0/2.0,      5,     3},
	{1.0+3.0/5.0,     1.0/2.0,      7,     5},
	{1.0+7.0/9.0,     1.0/2.0,     10,     9},
	{1.0+1.0/7.0,     1.0/4.0,      3,     4},
	{1.0+1.0/15.0,    1.0/8.0,      4,     8},
	{1.0+1.0/31.0,    1.0/16.0,     5,    16},
	{1.0+1.0/63.0,    1.0/32.0,     6,    32},
	{1.0+1.0/127.0,   1.0/64.0,     7,    64},
	{1.0+1.0/255.0,   1.0/128.0,    8,   128},
	{1.0+1.0/511.0,   1.0/256.0,    9,   256},
	{1.0+1.0/1023.0,  1.0/512.0,   10,   512},
	{1.0+1.0/2047.0,  1.0/1024.0,  11,  1024},
	{1.0+1.0/4095.0,  1.0/2048.0,  12,  2048},
	{1.0+1.0/8191.0,  1.0/4096.0,  13,  4096},
	{1.0+1.0/16383.0, 1.0/8192.0,  14,  8192},
	{1.0+1.0/32767.0, 1.0/16384.0, 15, 16384},
	{1.0+1.0/65535.0, 1.0/32768.0, 16, 32768}
};

static final double table_b3[] = {
	 0.000000000, -0.000015259, -0.000015259, -0.000015259,
	-0.000015259, -0.000015259, -0.000015259, -0.000030518,
	-0.000030518, -0.000030518, -0.000030518, -0.000045776,
	-0.000045776, -0.000061035, -0.000061035, -0.000076294, /* 15 */

	-0.000076294, -0.000091553, -0.000106812, -0.000106812,
	-0.000122070, -0.000137329, -0.000152588, -0.000167847,
	-0.000198364, -0.000213623, -0.000244141, -0.000259399,
	-0.000289917, -0.000320435, -0.000366211, -0.000396729, /* 31 */

	-0.000442505, -0.000473022, -0.000534058, -0.000579834,
	-0.000625610, -0.000686646, -0.000747681, -0.000808716,

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -