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

📄 layeriiidecoder.java

📁 java处理声音文件
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
		   		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;
			
	   			out[six_i + 6]  += tmpf_0;
				out[six_i + 7]  += tmpf_1;
		   		out[six_i + 8]  += tmpf_2;
				out[six_i + 9]  += tmpf_3;
	   			out[six_i + 10] += tmpf_4;
				out[six_i + 11] += tmpf_5;
		   		out[six_i + 12] += tmpf_6;
				out[six_i + 13] += tmpf_7;
		   		out[six_i + 14] += tmpf_8;
				out[six_i + 15] += tmpf_9;
		   		out[six_i + 16] += tmpf_10;
				out[six_i + 17] += tmpf_11;
	
	   			six_i += 6;
	   		}
		 }
		 else
		 {
	   		// 36 point IDCT
	   		// input aliasing for 36 point IDCT
	   		in[17]+=in[16]; in[16]+=in[15]; in[15]+=in[14]; in[14]+=in[13];
	   		in[13]+=in[12]; in[12]+=in[11]; in[11]+=in[10]; in[10]+=in[9];
	   		in[9] +=in[8];  in[8] +=in[7];  in[7] +=in[6];  in[6] +=in[5];
	   		in[5] +=in[4];  in[4] +=in[3];  in[3] +=in[2];  in[2] +=in[1];
	   		in[1] +=in[0];
	
	   		// 18 point IDCT for odd indices
	   		// input aliasing for 18 point IDCT
	   		in[17]+=in[15]; in[15]+=in[13]; in[13]+=in[11]; in[11]+=in[9];
	   		in[9] +=in[7];  in[7] +=in[5];  in[5] +=in[3];  in[3] +=in[1];
	
	   		float tmp0,tmp1,tmp2,tmp3,tmp4,tmp0_,tmp1_,tmp2_,tmp3_;
	   		float tmp0o,tmp1o,tmp2o,tmp3o,tmp4o,tmp0_o,tmp1_o,tmp2_o,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)
	   		float i00 = in[0]+in[0];
	   		float iip12 = i00 + in[12];
	
	   		tmp0 = iip12 + in[4]*1.8793852415718f  + in[8]*1.532088886238f   + in[16]*0.34729635533386f;
	   		tmp1 = i00    + in[4]                   - in[8] - in[12] - in[12] - in[16];
	   		tmp2 = iip12 - in[4]*0.34729635533386f - in[8]*1.8793852415718f  + in[16]*1.532088886238f;
	   		tmp3 = iip12 - in[4]*1.532088886238f   + in[8]*0.34729635533386f - in[16]*1.8793852415718f;
	   		tmp4 = in[0] - in[4]                   + in[8] - in[12]          + in[16];
	
			// 4 points on even indices
	   		float i66_ = in[6]*1.732050808f;		// Sqrt[3]
	
	   		tmp0_ = in[2]*1.9696155060244f  + i66_ + in[10]*1.2855752193731f  + in[14]*0.68404028665134f;
	   		tmp1_ = (in[2]                        - in[10]                   - in[14])*1.732050808f;
	   		tmp2_ = in[2]*1.2855752193731f  - i66_ - in[10]*0.68404028665134f + in[14]*1.9696155060244f;
	   		tmp3_ = in[2]*0.68404028665134f - i66_ + in[10]*1.9696155060244f  - in[14]*1.2855752193731f;
	
	   		// 9 point IDCT on odd indices
			// 5 points on odd indices (not realy an IDCT)
	   		float i0 = in[0+1]+in[0+1];
	   		float i0p12 = i0 + in[12+1];
	
	   		tmp0o = i0p12   + in[4+1]*1.8793852415718f  + in[8+1]*1.532088886238f       + in[16+1]*0.34729635533386f;
	   		tmp1o = i0      + in[4+1]                   - in[8+1] - in[12+1] - in[12+1] - in[16+1];
	   		tmp2o = i0p12   - in[4+1]*0.34729635533386f - in[8+1]*1.8793852415718f      + in[16+1]*1.532088886238f;
	   		tmp3o = i0p12   - in[4+1]*1.532088886238f   + in[8+1]*0.34729635533386f     - in[16+1]*1.8793852415718f;
	   		tmp4o = (in[0+1] - in[4+1]                   + in[8+1] - in[12+1]            + in[16+1])*0.707106781f; // Twiddled
	
			// 4 points on even indices
	   		float i6_ = in[6+1]*1.732050808f;		// Sqrt[3]
	
	   		tmp0_o = in[2+1]*1.9696155060244f  + i6_ + in[10+1]*1.2855752193731f  + in[14+1]*0.68404028665134f;
	   		tmp1_o = (in[2+1]                        - in[10+1]                   - in[14+1])*1.732050808f;
	   		tmp2_o = in[2+1]*1.2855752193731f  - i6_ - in[10+1]*0.68404028665134f + in[14+1]*1.9696155060244f;
	   		tmp3_o = in[2+1]*0.68404028665134f - i6_ + in[10+1]*1.9696155060244f  - in[14+1]*1.2855752193731f;
	
	   		// Twiddle factors on odd indices
	   		// and
	   		// Butterflies on 9 point IDCT's
	   		// and
	   		// twiddle factors for 36 point IDCT
	
	   		float e, 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];
	
			out[0] =-tmpf_9  * win_bt[0];
	   		out[1] =-tmpf_10 * win_bt[1];
			out[2] =-tmpf_11 * win_bt[2];
	   		out[3] =-tmpf_12 * win_bt[3];
	   		out[4] =-tmpf_13 * win_bt[4];
			out[5] =-tmpf_14 * win_bt[5];
			out[6] =-tmpf_15 * win_bt[6];
			out[7] =-tmpf_16 * win_bt[7];
			out[8] =-tmpf_17 * win_bt[8];
	   		out[9] = tmpf_17 * win_bt[9];
	   		out[10]= tmpf_16 * win_bt[10];
			out[11]= tmpf_15 * win_bt[11];
			out[12]= tmpf_14 * win_bt[12];
			out[13]= tmpf_13 * win_bt[13];
			out[14]= tmpf_12 * win_bt[14];
	   		out[15]= tmpf_11 * win_bt[15];
			out[16]= tmpf_10 * win_bt[16];
			out[17]= tmpf_9  * win_bt[17];
			out[18]= tmpf_8  * win_bt[18];
	   		out[19]= tmpf_7  * win_bt[19];
			out[20]= tmpf_6  * win_bt[20];
	   		out[21]= tmpf_5  * win_bt[21];
			out[22]= tmpf_4  * win_bt[22];
			out[23]= tmpf_3  * win_bt[23];
	 		out[24]= tmpf_2  * win_bt[24];
	   		out[25]= tmpf_1  * win_bt[25];
			out[26]= tmpf_0  * win_bt[26];
	   		out[27]= tmpf_0  * win_bt[27];
			out[28]= tmpf_1  * win_bt[28];
			out[29]= tmpf_2  * win_bt[29];
			out[30]= tmpf_3  * win_bt[30];
			out[31]= tmpf_4  * win_bt[31];
	   		out[32]= tmpf_5  * win_bt[32];
			out[33]= tmpf_6  * win_bt[33];
			out[34]= tmpf_7  * win_bt[34];
			out[35]= tmpf_8  * win_bt[35];
		}	
	}
	
    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                       */
	/************************************************************/

	static class SBI
	{
	   public int[] 		l;
   	   public int[] 		s;
	   
	   public SBI()
	   {
	   		l = new int[23];
			s = new int[14];
	   }
	   public SBI(int[] thel, int[] thes)
	   {
	   		l = thel;
			s = thes;
	   }
	}

	static class gr_info_s
	{
		public int 		part2_3_length = 0;
		public int 		big_values = 0;
		public int 		global_gain = 0;
		public int 		scalefac_compress = 0;
		public int 		window_switching_flag = 0;
		public int 		block_type = 0;
		public int 		mixed_block_flag = 0;
		public int[]	table_select;
		public int[]	subblock_gain;
		public int 		region0_count = 0;
		public int 		region1_count = 0;
		public int 		preflag = 0;
		public int 		scalefac_scale = 0;
		public int 		count1table_select = 0;
		
		/**
		 * Dummy Constructor
		 */
		public gr_info_s()
		{
			table_select = new int[3];
			subblock_gain = new int[3];
		}
	}

	static class temporaire
	{
		public int[]			scfsi;
		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();
		}
	}

	static class III_side_info_t
	{
	
		public int 				main_data_begin = 0;
		public int 				private_bits = 0;
		public temporaire[]		ch;
	   	/**
	   	 * Dummy Constructor
	   	 */
	   	public III_side_info_t()
	   	{
	   			ch = new temporaire[2];
	   			ch[0] = new temporaire();
	   			ch[1] = new temporaire();
		}
	}
	
	static class temporaire2
	{
		public int[]		 l;         /* [cb] */
        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};
	
    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();
	
	static private float[] create_t_43()
	{
		float[] t43 = new float[8192];
		final double d43 = (4.0/3.0);
				
		for (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

⌨️ 快捷键说明

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