diff --git a/CSharp/LibAtrac9/BandExtension.cs b/CSharp/LibAtrac9/BandExtension.cs index 0afc667..297c79b 100644 --- a/CSharp/LibAtrac9/BandExtension.cs +++ b/CSharp/LibAtrac9/BandExtension.cs @@ -40,23 +40,23 @@ private static void ApplyBandExtensionChannel(Channel channel) switch (bandCount) { case 3: - scales[0] = Tables.BexMode0Bands3[0][values[0]]; - scales[1] = Tables.BexMode0Bands3[1][values[0]]; - scales[2] = Tables.BexMode0Bands3[2][values[1]]; - scales[3] = Tables.BexMode0Bands3[3][values[2]]; - scales[4] = Tables.BexMode0Bands3[4][values[3]]; + scales[0] = BexMode0Bands3[0][values[0]]; + scales[1] = BexMode0Bands3[1][values[0]]; + scales[2] = BexMode0Bands3[2][values[1]]; + scales[3] = BexMode0Bands3[3][values[2]]; + scales[4] = BexMode0Bands3[4][values[3]]; break; case 4: - scales[0] = Tables.BexMode0Bands4[0][values[0]]; - scales[1] = Tables.BexMode0Bands4[1][values[0]]; - scales[2] = Tables.BexMode0Bands4[2][values[1]]; - scales[3] = Tables.BexMode0Bands4[3][values[2]]; - scales[4] = Tables.BexMode0Bands4[4][values[3]]; + scales[0] = BexMode0Bands4[0][values[0]]; + scales[1] = BexMode0Bands4[1][values[0]]; + scales[2] = BexMode0Bands4[2][values[1]]; + scales[3] = BexMode0Bands4[3][values[2]]; + scales[4] = BexMode0Bands4[4][values[3]]; break; case 5: - scales[0] = Tables.BexMode0Bands5[0][values[0]]; - scales[1] = Tables.BexMode0Bands5[1][values[1]]; - scales[2] = Tables.BexMode0Bands5[2][values[1]]; + scales[0] = BexMode0Bands5[0][values[0]]; + scales[1] = BexMode0Bands5[1][values[1]]; + scales[2] = BexMode0Bands5[2][values[1]]; break; } @@ -76,8 +76,8 @@ private static void ApplyBandExtensionChannel(Channel channel) ScaleBexQuantUnits(spectra, scales, groupAUnit, totalUnits); break; case 2: - double groupAScale2 = Tables.BexMode2Scale[values[0]]; - double groupBScale2 = Tables.BexMode2Scale[values[1]]; + double groupAScale2 = BexMode2Scale[values[0]]; + double groupBScale2 = BexMode2Scale[values[1]]; for (int i = groupABin; i < groupBBin; i++) { @@ -90,8 +90,8 @@ private static void ApplyBandExtensionChannel(Channel channel) } return; case 3: - double rate = Math.Pow(2, Tables.BexMode3Rate[values[1]]); - double scale = Tables.BexMode3Initial[values[0]]; + double rate = Math.Pow(2, BexMode3Rate[values[1]]); + double scale = BexMode3Initial[values[0]]; for (int i = groupABin; i < totalBins; i++) { scale *= rate; @@ -99,7 +99,7 @@ private static void ApplyBandExtensionChannel(Channel channel) } return; case 4: - double mult = Tables.BexMode4Multiplier[values[0]]; + double mult = BexMode4Multiplier[values[0]]; double groupAScale4 = 0.7079468 * mult; double groupBScale4 = 0.5011902 * mult; double groupCScale4 = 0.3548279 * mult; @@ -167,9 +167,206 @@ private static void AddNoiseToSpectrum(Channel channel, int index, int count) public static void GetBexBandInfo(out int bandCount, out int groupAUnit, out int groupBUnit, int quantUnits) { - groupAUnit = Tables.BexGroupInfo[quantUnits - 13][0]; - groupBUnit = Tables.BexGroupInfo[quantUnits - 13][1]; - bandCount = Tables.BexGroupInfo[quantUnits - 13][2]; + groupAUnit = BexGroupInfo[quantUnits - 13][0]; + groupBUnit = BexGroupInfo[quantUnits - 13][1]; + bandCount = BexGroupInfo[quantUnits - 13][2]; } + + public static readonly byte[][] BexGroupInfo = + { + new byte[] {16, 21, 0}, + new byte[] {18, 22, 1}, + new byte[] {20, 22, 2}, + new byte[] {21, 22, 3}, + new byte[] {21, 22, 3}, + new byte[] {23, 24, 4}, + new byte[] {23, 24, 4}, + new byte[] {24, 24, 5} + }; + + // [mode][bands] + + public static readonly byte[][] BexEncodedValueCounts = + { + new byte[] {0, 0, 0, 4, 4, 2}, + new byte[] {0, 0, 0, 0, 0, 0}, + new byte[] {0, 0, 0, 2, 2, 1}, + new byte[] {0, 0, 0, 2, 2, 2}, + new byte[] {1, 1, 1, 0, 0, 0} + }; + + // [mode][bands][valueIndex] + + public static readonly byte[][][] BexDataLengths = + { + new[] { + new byte[] {0, 0, 0, 0}, + new byte[] {0, 0, 0, 0}, + new byte[] {0, 0, 0, 0}, + new byte[] {5, 4, 3, 3}, + new byte[] {4, 4, 3, 4}, + new byte[] {4, 5, 0, 0} + }, new[] { + new byte[] {0, 0, 0, 0}, + new byte[] {0, 0, 0, 0}, + new byte[] {0, 0, 0, 0}, + new byte[] {0, 0, 0, 0}, + new byte[] {0, 0, 0, 0}, + new byte[] {0, 0, 0, 0} + }, new[] { + new byte[] {0, 0, 0, 0}, + new byte[] {0, 0, 0, 0}, + new byte[] {0, 0, 0, 0}, + new byte[] {6, 6, 0, 0}, + new byte[] {6, 6, 0, 0}, + new byte[] {6, 0, 0, 0} + }, new[] { + new byte[] {0, 0, 0, 0}, + new byte[] {0, 0, 0, 0}, + new byte[] {0, 0, 0, 0}, + new byte[] {4, 4, 0, 0}, + new byte[] {4, 4, 0, 0}, + new byte[] {4, 4, 0, 0} + }, new[] { + new byte[] {3, 0, 0, 0}, + new byte[] {3, 0, 0, 0}, + new byte[] {3, 0, 0, 0}, + new byte[] {0, 0, 0, 0}, + new byte[] {0, 0, 0, 0}, + new byte[] {0, 0, 0, 0} + } + }; + + public static readonly double[][] BexMode0Bands3 = + { + new[] { + 0.000000e+0, 1.988220e-1, 2.514343e-1, 2.960510e-1, + 3.263550e-1, 3.771362e-1, 3.786926e-1, 4.540405e-1, + 4.877625e-1, 5.262451e-1, 5.447083e-1, 5.737000e-1, + 6.212158e-1, 6.222839e-1, 6.560974e-1, 6.896667e-1, + 7.555542e-1, 7.677917e-1, 7.918091e-1, 7.971497e-1, + 8.188171e-1, 8.446045e-1, 9.790649e-1, 9.822083e-1, + 9.846191e-1, 9.859314e-1, 9.863586e-1, 9.863892e-1, + 9.873352e-1, 9.881287e-1, 9.898682e-1, 9.913330e-1 + }, new[] { + 0.000000e+0, 9.982910e-1, 7.592773e-2, 7.179565e-1, + 9.851379e-1, 5.340271e-1, 9.013672e-1, 6.349182e-1, + 7.226257e-1, 1.948547e-1, 7.628174e-1, 9.873657e-1, + 8.112183e-1, 2.715454e-1, 9.734192e-1, 1.443787e-1, + 4.640198e-1, 3.249207e-1, 3.790894e-1, 8.276367e-2, + 5.954590e-1, 2.864380e-1, 9.806824e-1, 7.929077e-1, + 6.292114e-1, 4.887085e-1, 2.905273e-1, 1.301880e-1, + 3.140869e-1, 5.482483e-1, 4.210815e-1, 1.182861e-1 + }, new[] { + 0.000000e+0, 3.155518e-2, 8.581543e-2, 1.364746e-1, + 1.858826e-1, 2.368469e-1, 2.888184e-1, 3.432617e-1, + 4.012451e-1, 4.623108e-1, 5.271301e-1, 5.954895e-1, + 6.681213e-1, 7.448425e-1, 8.245239e-1, 9.097290e-1 + }, new[] { + 0.000000e+0, 4.418945e-2, 1.303711e-1, 2.273560e-1, + 3.395996e-1, 4.735718e-1, 6.267090e-1, 8.003845e-1 + }, new[] { + 0.000000e+0, 2.804565e-2, 9.683228e-2, 1.849976e-1, + 3.005981e-1, 4.470520e-1, 6.168518e-1, 8.007813e-1 + } + }; + + public static readonly double[][] BexMode0Bands4 = + { + new[] { + 0.000000e+0, 2.708740e-1, 3.479614e-1, 3.578186e-1, + 5.083618e-1, 5.299072e-1, 5.819092e-1, 6.381836e-1, + 7.276917e-1, 7.595520e-1, 7.878723e-1, 9.707336e-1, + 9.713135e-1, 9.736023e-1, 9.759827e-1, 9.832458e-1 + }, new[] { + 0.000000e+0, 2.330627e-1, 5.891418e-1, 7.170410e-1, + 2.036438e-1, 1.613464e-1, 6.668701e-1, 9.481201e-1, + 9.769897e-1, 5.111694e-1, 3.522644e-1, 8.209534e-1, + 2.933960e-1, 9.757690e-1, 5.289917e-1, 4.372253e-1 + }, new[] { + 0.000000e+0, 4.360962e-2, 1.056519e-1, 1.590576e-1, + 2.078857e-1, 2.572937e-1, 3.082581e-1, 3.616028e-1, + 4.191589e-1, 4.792175e-1, 5.438538e-1, 6.125183e-1, + 6.841125e-1, 7.589417e-1, 8.365173e-1, 9.148254e-1 + }, new[] { + 0.000000e+0, 4.074097e-2, 1.164551e-1, 2.077026e-1, + 3.184509e-1, 4.532166e-1, 6.124268e-1, 7.932129e-1 + }, new[] { + 0.000000e+0, 8.880615e-3, 2.932739e-2, 5.593872e-2, + 8.825684e-2, 1.259155e-1, 1.721497e-1, 2.270813e-1, + 2.901611e-1, 3.579712e-1, 4.334106e-1, 5.147095e-1, + 6.023254e-1, 6.956177e-1, 7.952881e-1, 8.977356e-1 + } + }; + + public static readonly double[][] BexMode0Bands5 = + { + new[] { + 0.000000e+0, 7.379150e-2, 1.806335e-1, 2.687073e-1, + 3.407898e-1, 4.047546e-1, 4.621887e-1, 5.168762e-1, + 5.703125e-1, 6.237488e-1, 6.763611e-1, 7.288208e-1, + 7.808533e-1, 8.337708e-1, 8.874512e-1, 9.418030e-1 + }, new[] { + 0.000000e+0, 7.980347e-2, 1.615295e-1, 1.665649e-1, + 1.822205e-1, 2.185669e-1, 2.292175e-1, 2.456665e-1, + 2.666321e-1, 3.306580e-1, 3.330688e-1, 3.765259e-1, + 4.085083e-1, 4.400024e-1, 4.407654e-1, 4.817505e-1, + 4.924011e-1, 5.320740e-1, 5.893860e-1, 6.131287e-1, + 6.212463e-1, 6.278076e-1, 6.308899e-1, 7.660828e-1, + 7.850647e-1, 7.910461e-1, 7.929382e-1, 8.038330e-1, + 9.834900e-1, 9.846191e-1, 9.852295e-1, 9.862671e-1 + }, new[] { + 0.000000e+0, 6.084290e-1, 3.672791e-1, 3.151855e-1, + 1.488953e-1, 2.571716e-1, 5.103455e-1, 3.311157e-1, + 5.426025e-2, 4.254456e-1, 7.998352e-1, 7.873230e-1, + 5.418701e-1, 2.925110e-1, 8.468628e-2, 1.410522e-1, + 9.819641e-1, 9.609070e-1, 3.530884e-2, 9.729004e-2, + 5.758362e-1, 9.941711e-1, 7.215576e-1, 7.183228e-1, + 2.028809e-1, 9.588623e-2, 2.032166e-1, 1.338806e-1, + 5.003357e-1, 1.874390e-1, 9.804993e-1, 1.107788e-1 + } + }; + + public static readonly double[] BexMode2Scale = + { + 4.272461e-4, 1.312256e-3, 2.441406e-3, 3.692627e-3, + 4.913330e-3, 6.134033e-3, 7.507324e-3, 8.972168e-3, + 1.049805e-2, 1.223755e-2, 1.406860e-2, 1.599121e-2, + 1.800537e-2, 2.026367e-2, 2.264404e-2, 2.517700e-2, + 2.792358e-2, 3.073120e-2, 3.344727e-2, 3.631592e-2, + 3.952026e-2, 4.275513e-2, 4.608154e-2, 4.968262e-2, + 5.355835e-2, 5.783081e-2, 6.195068e-2, 6.677246e-2, + 7.196045e-2, 7.745361e-2, 8.319092e-2, 8.993530e-2, + 9.759521e-2, 1.056213e-1, 1.138916e-1, 1.236267e-1, + 1.348267e-1, 1.470337e-1, 1.603394e-1, 1.755676e-1, + 1.905823e-1, 2.071228e-1, 2.245178e-1, 2.444153e-1, + 2.658997e-1, 2.897644e-1, 3.146057e-1, 3.450012e-1, + 3.766174e-1, 4.122620e-1, 4.505615e-1, 4.893799e-1, + 5.305481e-1, 5.731201e-1, 6.157837e-1, 6.580811e-1, + 6.985168e-1, 7.435303e-1, 7.865906e-1, 8.302612e-1, + 8.718567e-1, 9.125671e-1, 9.575806e-1, 9.996643e-1 + }; + + public static readonly double[] BexMode3Initial = + { + 3.491211e-1, 5.371094e-1, 6.782227e-1, 7.910156e-1, + 9.057617e-1, 1.024902e+0, 1.156250e+0, 1.290527e+0, + 1.458984e+0, 1.664551e+0, 1.929688e+0, 2.278320e+0, + 2.831543e+0, 3.659180e+0, 5.257813e+0, 8.373047e+0 + }; + + public static readonly double[] BexMode3Rate = + { + -2.913818e-1, -2.541504e-1, -1.664429e-1, -1.476440e-1, + -1.342163e-1, -1.220703e-1, -1.117554e-1, -1.026611e-1, + -9.436035e-2, -8.483887e-2, -7.476807e-2, -6.304932e-2, + -4.492188e-2, -2.447510e-2, +1.831055e-4, +4.174805e-2 + }; + + public static readonly double[] BexMode4Multiplier = + { + 3.610229e-2, 1.260681e-1, 2.227478e-1, 3.338318e-1, + 4.662170e-1, 6.221313e-1, 7.989197e-1, 9.939575e-1 + }; } } diff --git a/CSharp/LibAtrac9/HuffmanCodebooks.cs b/CSharp/LibAtrac9/HuffmanCodebooks.cs index 1f7f0f3..8c350d0 100644 --- a/CSharp/LibAtrac9/HuffmanCodebooks.cs +++ b/CSharp/LibAtrac9/HuffmanCodebooks.cs @@ -29,59 +29,59 @@ public static HuffmanCodebook[] GenerateHuffmanCodebooks(short[][] codes, byte[] } // For scale factor table names, {letter}{number} correspond to the signedness and word length - public static readonly byte[] ScaleFactorsA1Bits = + private static readonly byte[] ScaleFactorsA1Bits = { 1, 1 }; - public static readonly short[] ScaleFactorsA1Codes = + private static readonly short[] ScaleFactorsA1Codes = { 0x00, 0x01 }; - public static readonly byte[] ScaleFactorsA2Bits = + private static readonly byte[] ScaleFactorsA2Bits = { 1, 3, 3, 2 }; - public static readonly short[] ScaleFactorsA2Codes = + private static readonly short[] ScaleFactorsA2Codes = { 0x00, 0x06, 0x07, 0x02 }; - public static readonly byte[] ScaleFactorsA3Bits = + private static readonly byte[] ScaleFactorsA3Bits = { 2, 2, 4, 6, 6, 5, 3, 2 }; - public static readonly short[] ScaleFactorsA3Codes = + private static readonly short[] ScaleFactorsA3Codes = { 0x00, 0x01, 0x0E, 0x3E, 0x3F, 0x1E, 0x06, 0x02 }; - public static readonly byte[] ScaleFactorsA4Bits = + private static readonly byte[] ScaleFactorsA4Bits = { 2, 2, 4, 5, 6, 7, 8, 8, 8, 8, 8, 8, 6, 5, 4, 2 }; - public static readonly short[] ScaleFactorsA4Codes = + private static readonly short[] ScaleFactorsA4Codes = { 0x01, 0x02, 0x00, 0x06, 0x0F, 0x13, 0x23, 0x24, 0x25, 0x22, 0x21, 0x20, 0x0E, 0x05, 0x01, 0x03 }; - public static readonly byte[] ScaleFactorsA5Bits = + private static readonly byte[] ScaleFactorsA5Bits = { 2, 3, 3, 4, 5, 5, 6, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 7, 7, 6, 5, 5, 4, 3 }; - public static readonly short[] ScaleFactorsA5Codes = + private static readonly short[] ScaleFactorsA5Codes = { 0x02, 0x01, 0x07, 0x0D, 0x0C, 0x18, 0x1B, 0x21, 0x3F, 0x6A, 0x6B, 0x68, 0x73, 0x79, 0x7C, 0x7D, 0x7A, 0x7B, 0x78, 0x72, 0x44, 0x45, 0x47, 0x46, 0x69, 0x38, 0x20, 0x1D, 0x19, 0x09, 0x05, 0x00 }; - public static readonly byte[] ScaleFactorsA6Bits = + private static readonly byte[] ScaleFactorsA6Bits = { 3, 3, 4, 4, 5, 5, 6, 6, 6, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, @@ -89,7 +89,7 @@ public static HuffmanCodebook[] GenerateHuffmanCodebooks(short[][] codes, byte[] 8, 8, 8, 8, 8, 7, 7, 7, 6, 6, 5, 5, 5, 4, 4, 4 }; - public static readonly short[] ScaleFactorsA6Codes = + private static readonly short[] ScaleFactorsA6Codes = { 0x00, 0x01, 0x04, 0x05, 0x12, 0x13, 0x2E, 0x2F, 0x30, 0x66, 0x67, 0xD6, 0xD7, 0xD8, 0xD9, 0xDA, 0xDB, 0xDC, 0xDD, 0xDE, 0xDF, 0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7, 0xE8, 0xE9, 0xEA, @@ -97,43 +97,43 @@ public static HuffmanCodebook[] GenerateHuffmanCodebooks(short[][] codes, byte[] 0xFB, 0xFC, 0xFD, 0xFE, 0xFF, 0x68, 0x69, 0x6A, 0x31, 0x32, 0x14, 0x15, 0x16, 0x06, 0x07, 0x08 }; - public static readonly byte[] ScaleFactorsB2Bits = + private static readonly byte[] ScaleFactorsB2Bits = { 1, 2, 0, 2 }; - public static readonly short[] ScaleFactorsB2Codes = + private static readonly short[] ScaleFactorsB2Codes = { 0x00, 0x03, 0x00, 0x02 }; - public static readonly byte[] ScaleFactorsB3Bits = + private static readonly byte[] ScaleFactorsB3Bits = { 1, 3, 5, 6, 0, 6, 4, 2 }; - public static readonly short[] ScaleFactorsB3Codes = + private static readonly short[] ScaleFactorsB3Codes = { 0x01, 0x00, 0x04, 0x0B, 0x00, 0x0A, 0x03, 0x01 }; - public static readonly byte[] ScaleFactorsB4Bits = + private static readonly byte[] ScaleFactorsB4Bits = { 1, 3, 4, 5, 5, 7, 8, 8, 0, 8, 8, 7, 6, 6, 4, 3 }; - public static readonly short[] ScaleFactorsB4Codes = + private static readonly short[] ScaleFactorsB4Codes = { 0x01, 0x01, 0x04, 0x0E, 0x0F, 0x2C, 0x5A, 0x5D, 0x00, 0x5C, 0x5B, 0x2F, 0x15, 0x14, 0x06, 0x00 }; - public static readonly byte[] ScaleFactorsB5Bits = + private static readonly byte[] ScaleFactorsB5Bits = { 3, 3, 4, 4, 4, 4, 4, 4, 4, 5, 6, 7, 7, 7, 8, 8, 8, 8, 8, 8, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 6, 3 }; - public static readonly short[] ScaleFactorsB5Codes = + private static readonly short[] ScaleFactorsB5Codes = { 0x00, 0x05, 0x07, 0x0C, 0x04, 0x02, 0x03, 0x05, 0x09, 0x10, 0x23, 0x33, 0x36, 0x6E, 0x60, 0x65, 0x62, 0x61, 0x63, 0x64, 0x6F, 0x6D, 0x6C, 0x6B, 0x6A, 0x68, 0x69, 0x45, 0x44, 0x37, 0x1A, 0x07 @@ -141,17 +141,17 @@ public static HuffmanCodebook[] GenerateHuffmanCodebooks(short[][] codes, byte[] // For spectrum table names, {letter}{number}{number} correspond to the // codebook set, word length, and band group - public static readonly byte[] SpectrumA21Bits = + private static readonly byte[] SpectrumA21Bits = { 0, 3, 0, 3, 3, 3, 0, 3, 0, 0, 0, 0, 3, 3, 0, 3 }; - public static readonly short[] SpectrumA21Codes = + private static readonly short[] SpectrumA21Codes = { 0x00, 0x00, 0x00, 0x01, 0x03, 0x07, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x02, 0x05, 0x00, 0x06 }; - public static readonly byte[] SpectrumA22Bits = + private static readonly byte[] SpectrumA22Bits = { 0, 4, 0, 4, 5, 6, 0, 6, 0, 0, 0, 0, 5, 6, 0, 6, 5, 6, 0, 6, 6, 7, 0, 7, 0, 0, 0, 0, 6, 7, 0, 7, @@ -171,7 +171,7 @@ public static HuffmanCodebook[] GenerateHuffmanCodebooks(short[][] codes, byte[] 6, 7, 0, 7, 7, 7, 0, 8, 0, 0, 0, 0, 7, 8, 0, 8 }; - public static readonly short[] SpectrumA22Codes = + private static readonly short[] SpectrumA22Codes = { 0x00, 0x02, 0x00, 0x03, 0x10, 0x3C, 0x00, 0x3F, 0x00, 0x00, 0x00, 0x00, 0x11, 0x3E, 0x00, 0x3D, 0x0E, 0x00, 0x00, 0x39, 0x18, 0x26, 0x00, 0x75, 0x00, 0x00, 0x00, 0x00, 0x1B, 0x24, 0x00, 0x6D, @@ -191,7 +191,7 @@ public static HuffmanCodebook[] GenerateHuffmanCodebooks(short[][] codes, byte[] 0x27, 0x62, 0x00, 0x05, 0x66, 0x0C, 0x00, 0xA1, 0x00, 0x00, 0x00, 0x00, 0x23, 0x96, 0x00, 0xA3 }; - public static readonly byte[] SpectrumA23Bits = + private static readonly byte[] SpectrumA23Bits = { 3, 4, 0, 4, 5, 6, 0, 6, 0, 0, 0, 0, 5, 6, 0, 6, 5, 7, 0, 6, 6, 8, 0, 7, 0, 0, 0, 0, 6, 8, 0, 7, @@ -211,7 +211,7 @@ public static HuffmanCodebook[] GenerateHuffmanCodebooks(short[][] codes, byte[] 6, 7, 0, 8, 7, 8, 0, 9, 0, 0, 0, 0, 8, 9, 0, 9 }; - public static readonly short[] SpectrumA23Codes = + private static readonly short[] SpectrumA23Codes = { 0x006, 0x002, 0x000, 0x003, 0x016, 0x01E, 0x000, 0x021, 0x000, 0x000, 0x000, 0x000, 0x017, 0x020, 0x000, 0x01F, 0x01C, 0x054, 0x000, 0x027, 0x010, 0x0A6, 0x000, 0x027, @@ -237,7 +237,7 @@ public static HuffmanCodebook[] GenerateHuffmanCodebooks(short[][] codes, byte[] 0x0A3, 0x122, 0x000, 0x15B }; - public static readonly byte[] SpectrumA24Bits = + private static readonly byte[] SpectrumA24Bits = { 02, 04, 00, 04, 05, 06, 00, 06, 00, 00, 00, 00, 05, 06, 00, 06, 05, 07, 00, 06, 06, 08, 00, 08, 00, 00, 00, 00, 06, 08, 00, 08, @@ -257,7 +257,7 @@ public static HuffmanCodebook[] GenerateHuffmanCodebooks(short[][] codes, byte[] 06, 08, 00, 09, 08, 09, 00, 10, 00, 00, 00, 00, 08, 10, 00, 10 }; - public static readonly short[] SpectrumA24Codes = + private static readonly short[] SpectrumA24Codes = { 0x002, 0x002, 0x000, 0x003, 0x01E, 0x010, 0x000, 0x013, 0x000, 0x000, 0x000, 0x000, 0x01F, 0x012, 0x000, 0x011, 0x01A, 0x030, 0x000, 0x01B, 0x000, 0x064, 0x000, 0x0C1, @@ -282,8 +282,8 @@ public static HuffmanCodebook[] GenerateHuffmanCodebooks(short[][] codes, byte[] 0x005, 0x076, 0x000, 0x0FF, 0x072, 0x0E0, 0x000, 0x339, 0x000, 0x000, 0x000, 0x000, 0x051, 0x1F8, 0x000, 0x33B }; - - public static readonly byte[] SpectrumA31Bits = + + private static readonly byte[] SpectrumA31Bits = { 0, 0, 4, 5, 0, 5, 4, 0, 0, 0, 5, 5, 0, 5, 5, 0, 5, 5, 6, 6, 0, 6, 5, 5, 5, 6, 6, 7, 0, 7, 6, 6, @@ -291,7 +291,7 @@ public static HuffmanCodebook[] GenerateHuffmanCodebooks(short[][] codes, byte[] 5, 5, 5, 6, 0, 6, 6, 5, 0, 0, 5, 5, 0, 5, 5, 0 }; - public static readonly short[] SpectrumA31Codes = + private static readonly short[] SpectrumA31Codes = { 0x00, 0x00, 0x02, 0x18, 0x00, 0x19, 0x03, 0x00, 0x00, 0x00, 0x12, 0x02, 0x00, 0x09, 0x15, 0x00, 0x1A, 0x0A, 0x3E, 0x2C, 0x00, 0x2F, 0x01, 0x0D, 0x0E, 0x38, 0x20, 0x78, 0x00, 0x7B, 0x23, 0x3B, @@ -299,7 +299,7 @@ public static HuffmanCodebook[] GenerateHuffmanCodebooks(short[][] codes, byte[] 0x1B, 0x0C, 0x00, 0x2E, 0x00, 0x2D, 0x3F, 0x0B, 0x00, 0x00, 0x14, 0x08, 0x00, 0x03, 0x13, 0x00 }; - public static readonly byte[] SpectrumA32Bits = + private static readonly byte[] SpectrumA32Bits = { 4, 5, 5, 6, 0, 6, 5, 5, 5, 6, 5, 6, 0, 6, 5, 5, 5, 5, 6, 7, 0, 7, 6, 5, 6, 6, 7, 7, 0, 7, 7, 6, @@ -307,7 +307,7 @@ public static HuffmanCodebook[] GenerateHuffmanCodebooks(short[][] codes, byte[] 5, 5, 6, 7, 0, 7, 6, 5, 5, 5, 5, 6, 0, 6, 5, 6 }; - public static readonly short[] SpectrumA32Codes = + private static readonly short[] SpectrumA32Codes = { 0x0D, 0x18, 0x16, 0x3A, 0x00, 0x3B, 0x17, 0x19, 0x12, 0x3E, 0x08, 0x1C, 0x00, 0x1B, 0x07, 0x01, 0x10, 0x02, 0x28, 0x78, 0x00, 0x7B, 0x1F, 0x05, 0x2A, 0x16, 0x72, 0x2A, 0x00, 0x29, 0x71, 0x19, @@ -315,7 +315,7 @@ public static HuffmanCodebook[] GenerateHuffmanCodebooks(short[][] codes, byte[] 0x11, 0x04, 0x1E, 0x7A, 0x00, 0x79, 0x29, 0x03, 0x13, 0x00, 0x06, 0x1A, 0x00, 0x1D, 0x09, 0x3F }; - public static readonly byte[] SpectrumA33Bits = + private static readonly byte[] SpectrumA33Bits = { 3, 4, 5, 6, 0, 6, 5, 4, 4, 5, 6, 7, 0, 7, 6, 5, 5, 6, 6, 7, 0, 7, 6, 6, 6, 7, 8, 8, 0, 8, 8, 7, @@ -323,7 +323,7 @@ public static HuffmanCodebook[] GenerateHuffmanCodebooks(short[][] codes, byte[] 5, 6, 6, 7, 0, 7, 6, 6, 4, 5, 6, 7, 0, 7, 6, 5 }; - public static readonly short[] SpectrumA33Codes = + private static readonly short[] SpectrumA33Codes = { 0x05, 0x06, 0x10, 0x08, 0x00, 0x09, 0x11, 0x07, 0x04, 0x12, 0x3E, 0x6A, 0x00, 0x6D, 0x3D, 0x19, 0x06, 0x3A, 0x06, 0x02, 0x00, 0x01, 0x05, 0x39, 0x02, 0x16, 0xDC, 0x2A, 0x00, 0x29, 0xDF, 0x69, @@ -331,7 +331,7 @@ public static HuffmanCodebook[] GenerateHuffmanCodebooks(short[][] codes, byte[] 0x07, 0x38, 0x04, 0x00, 0x00, 0x03, 0x07, 0x3B, 0x05, 0x18, 0x3C, 0x6C, 0x00, 0x6B, 0x3F, 0x13 }; - public static readonly byte[] SpectrumA34Bits = + private static readonly byte[] SpectrumA34Bits = { 02, 04, 05, 07, 00, 07, 05, 04, 04, 05, 06, 08, 00, 08, 06, 05, 05, 06, 07, 08, 00, 08, 07, 06, 07, 08, 08, 10, 00, 10, 09, 08, @@ -339,7 +339,7 @@ public static HuffmanCodebook[] GenerateHuffmanCodebooks(short[][] codes, byte[] 05, 06, 07, 08, 00, 08, 07, 06, 04, 05, 06, 08, 00, 08, 06, 05 }; - public static readonly short[] SpectrumA34Codes = + private static readonly short[] SpectrumA34Codes = { 0x000, 0x00A, 0x00A, 0x034, 0x000, 0x035, 0x00B, 0x00B, 0x008, 0x01C, 0x032, 0x0DA, 0x000, 0x0DD, 0x035, 0x01F, 0x008, 0x01E, 0x03A, 0x06C, 0x000, 0x063, 0x039, 0x031, @@ -349,7 +349,7 @@ public static HuffmanCodebook[] GenerateHuffmanCodebooks(short[][] codes, byte[] 0x000, 0x0DB, 0x033, 0x01D }; - public static readonly byte[] SpectrumA41Bits = + private static readonly byte[] SpectrumA41Bits = { 0, 0, 0, 0, 6, 6, 7, 7, 0, 7, 7, 6, 6, 0, 0, 0, 0, 0, 0, 0, 7, 7, 7, 7, 0, 7, 7, 7, 6, 0, 0, 0, @@ -369,7 +369,7 @@ public static HuffmanCodebook[] GenerateHuffmanCodebooks(short[][] codes, byte[] 0, 0, 0, 0, 6, 7, 7, 7, 0, 7, 7, 7, 7, 0, 0, 0 }; - public static readonly short[] SpectrumA41Codes = + private static readonly short[] SpectrumA41Codes = { 0x000, 0x000, 0x000, 0x000, 0x018, 0x00E, 0x05E, 0x028, 0x000, 0x029, 0x05F, 0x00F, 0x019, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x076, 0x06E, 0x03E, 0x004, @@ -395,7 +395,7 @@ public static HuffmanCodebook[] GenerateHuffmanCodebooks(short[][] codes, byte[] 0x077, 0x000, 0x000, 0x000 }; - public static readonly byte[] SpectrumA42Bits = + private static readonly byte[] SpectrumA42Bits = { 05, 06, 07, 07, 07, 07, 08, 08, 00, 08, 08, 07, 07, 07, 07, 06, 06, 07, 07, 08, 07, 07, 08, 08, 00, 08, 08, 07, 07, 08, 07, 07, @@ -415,7 +415,7 @@ public static HuffmanCodebook[] GenerateHuffmanCodebooks(short[][] codes, byte[] 06, 07, 07, 08, 07, 07, 08, 08, 00, 08, 08, 07, 07, 08, 07, 07 }; - public static readonly short[] SpectrumA42Codes = + private static readonly short[] SpectrumA42Codes = { 0x003, 0x018, 0x058, 0x000, 0x066, 0x03C, 0x0D6, 0x07C, 0x000, 0x07D, 0x0D7, 0x03D, 0x067, 0x001, 0x059, 0x019, 0x002, 0x064, 0x036, 0x0DA, 0x04C, 0x01C, 0x0BE, 0x02C, @@ -441,7 +441,7 @@ public static HuffmanCodebook[] GenerateHuffmanCodebooks(short[][] codes, byte[] 0x04D, 0x0DB, 0x037, 0x065 }; - public static readonly byte[] SpectrumA43Bits = + private static readonly byte[] SpectrumA43Bits = { 04, 06, 06, 07, 07, 08, 08, 09, 00, 09, 08, 08, 07, 07, 06, 06, 05, 06, 07, 07, 07, 08, 08, 09, 00, 09, 08, 08, 07, 07, 07, 06, @@ -461,7 +461,7 @@ public static HuffmanCodebook[] GenerateHuffmanCodebooks(short[][] codes, byte[] 05, 06, 07, 07, 07, 08, 08, 09, 00, 09, 08, 08, 07, 07, 07, 06 }; - public static readonly short[] SpectrumA43Codes = + private static readonly short[] SpectrumA43Codes = { 0x002, 0x03E, 0x016, 0x060, 0x04E, 0x0DC, 0x04A, 0x130, 0x000, 0x131, 0x04B, 0x0DD, 0x04F, 0x061, 0x017, 0x03F, 0x002, 0x02C, 0x076, 0x042, 0x034, 0x0CE, 0x002, 0x0E8, @@ -487,7 +487,7 @@ public static HuffmanCodebook[] GenerateHuffmanCodebooks(short[][] codes, byte[] 0x035, 0x043, 0x077, 0x02D }; - public static readonly byte[] SpectrumA44Bits = + private static readonly byte[] SpectrumA44Bits = { 04, 05, 06, 07, 07, 08, 09, 10, 00, 10, 09, 08, 07, 07, 06, 05, 05, 06, 06, 07, 07, 08, 09, 10, 00, 10, 09, 08, 07, 07, 06, 06, @@ -507,7 +507,7 @@ public static HuffmanCodebook[] GenerateHuffmanCodebooks(short[][] codes, byte[] 05, 06, 06, 07, 07, 08, 09, 10, 00, 10, 09, 08, 07, 07, 06, 06 }; - public static readonly short[] SpectrumA44Codes = + private static readonly short[] SpectrumA44Codes = { 0x00A, 0x012, 0x030, 0x06E, 0x024, 0x074, 0x0EC, 0x07E, 0x000, 0x07F, 0x0ED, 0x075, 0x025, 0x06F, 0x031, 0x013, 0x010, 0x03C, 0x018, 0x05A, 0x002, 0x046, 0x09E, 0x07C, @@ -533,55 +533,55 @@ public static HuffmanCodebook[] GenerateHuffmanCodebooks(short[][] codes, byte[] 0x003, 0x05B, 0x019, 0x03D }; - public static readonly byte[] SpectrumA51Bits = + private static readonly byte[] SpectrumA51Bits = { 5, 5, 5, 5, 5, 6, 6, 6, 4, 4, 5, 5, 5, 5, 5, 5, 0, 5, 5, 5, 5, 5, 5, 4, 4, 6, 6, 6, 5, 5, 5, 5 }; - public static readonly short[] SpectrumA51Codes = + private static readonly short[] SpectrumA51Codes = { 0x19, 0x16, 0x12, 0x0E, 0x06, 0x3A, 0x38, 0x30, 0x00, 0x04, 0x1E, 0x1A, 0x14, 0x10, 0x0C, 0x04, 0x00, 0x05, 0x0D, 0x11, 0x15, 0x1B, 0x1F, 0x05, 0x01, 0x31, 0x39, 0x3B, 0x07, 0x0F, 0x13, 0x17 }; - public static readonly byte[] SpectrumA52Bits = + private static readonly byte[] SpectrumA52Bits = { 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 0, 6, 6, 6, 6, 5, 5, 5, 5, 5, 5, 5, 5, 5, 4, 4 }; - public static readonly short[] SpectrumA52Codes = + private static readonly short[] SpectrumA52Codes = { 0x09, 0x04, 0x00, 0x1E, 0x1A, 0x14, 0x0C, 0x06, 0x18, 0x16, 0x0E, 0x04, 0x3A, 0x38, 0x22, 0x20, 0x00, 0x21, 0x23, 0x39, 0x3B, 0x05, 0x0F, 0x17, 0x19, 0x07, 0x0D, 0x15, 0x1B, 0x1F, 0x01, 0x05 }; - public static readonly byte[] SpectrumA53Bits = + private static readonly byte[] SpectrumA53Bits = { 3, 4, 4, 4, 5, 5, 5, 5, 5, 5, 6, 6, 7, 7, 7, 7, 0, 7, 7, 7, 7, 6, 6, 5, 5, 5, 5, 5, 5, 4, 4, 4 }; - public static readonly short[] SpectrumA53Codes = + private static readonly short[] SpectrumA53Codes = { 0x00, 0x0C, 0x08, 0x04, 0x1E, 0x16, 0x14, 0x06, 0x0C, 0x04, 0x38, 0x1E, 0x76, 0x74, 0x3A, 0x38, 0x00, 0x39, 0x3B, 0x75, 0x77, 0x1F, 0x39, 0x05, 0x0D, 0x07, 0x15, 0x17, 0x1F, 0x05, 0x09, 0x0D }; - public static readonly byte[] SpectrumA54Bits = + private static readonly byte[] SpectrumA54Bits = { 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 7, 7, 7, 8, 8, 0, 8, 8, 7, 7, 7, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4 }; - public static readonly short[] SpectrumA54Codes = + private static readonly short[] SpectrumA54Codes = { 0x02, 0x0E, 0x0A, 0x08, 0x02, 0x1A, 0x0E, 0x02, 0x00, 0x30, 0x18, 0x66, 0x36, 0x34, 0xCA, 0xC8, 0x00, 0xC9, 0xCB, 0x35, 0x37, 0x67, 0x19, 0x31, 0x01, 0x03, 0x0F, 0x1B, 0x03, 0x09, 0x0B, 0x0F }; - public static readonly byte[] SpectrumA61Bits = + private static readonly byte[] SpectrumA61Bits = { 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, @@ -589,7 +589,7 @@ public static HuffmanCodebook[] GenerateHuffmanCodebooks(short[][] codes, byte[] 5, 7, 7, 7, 7, 7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 6 }; - public static readonly short[] SpectrumA61Codes = + private static readonly short[] SpectrumA61Codes = { 0x35, 0x30, 0x2A, 0x28, 0x24, 0x20, 0x18, 0x0E, 0x0C, 0x7E, 0x7C, 0x72, 0x70, 0x68, 0x5E, 0x5C, 0x04, 0x0E, 0x08, 0x00, 0x3C, 0x3A, 0x36, 0x32, 0x2C, 0x26, 0x22, 0x1A, 0x16, 0x14, 0x06, 0x04, @@ -597,7 +597,7 @@ public static HuffmanCodebook[] GenerateHuffmanCodebooks(short[][] codes, byte[] 0x05, 0x5D, 0x5F, 0x69, 0x71, 0x73, 0x7D, 0x7F, 0x0D, 0x0F, 0x19, 0x21, 0x25, 0x29, 0x2B, 0x31 }; - public static readonly byte[] SpectrumA62Bits = + private static readonly byte[] SpectrumA62Bits = { 5, 5, 5, 5, 5, 6, 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, @@ -605,7 +605,7 @@ public static HuffmanCodebook[] GenerateHuffmanCodebooks(short[][] codes, byte[] 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5 }; - public static readonly short[] SpectrumA62Codes = + private static readonly short[] SpectrumA62Codes = { 0x14, 0x0E, 0x08, 0x04, 0x02, 0x3E, 0x3C, 0x38, 0x34, 0x30, 0x2A, 0x24, 0x1A, 0x18, 0x0E, 0x02, 0x32, 0x36, 0x2C, 0x26, 0x20, 0x16, 0x0C, 0x00, 0x76, 0x74, 0x5E, 0x5C, 0x46, 0x44, 0x2A, 0x28, @@ -613,7 +613,7 @@ public static HuffmanCodebook[] GenerateHuffmanCodebooks(short[][] codes, byte[] 0x33, 0x03, 0x0F, 0x19, 0x1B, 0x25, 0x2B, 0x31, 0x35, 0x39, 0x3D, 0x3F, 0x03, 0x05, 0x09, 0x0F }; - public static readonly byte[] SpectrumA63Bits = + private static readonly byte[] SpectrumA63Bits = { 4, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, @@ -621,7 +621,7 @@ public static HuffmanCodebook[] GenerateHuffmanCodebooks(short[][] codes, byte[] 6, 6, 6, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5, 5, 5, 5 }; - public static readonly short[] SpectrumA63Codes = + private static readonly short[] SpectrumA63Codes = { 0x00, 0x1C, 0x18, 0x14, 0x10, 0x0A, 0x08, 0x02, 0x3E, 0x36, 0x2E, 0x2C, 0x24, 0x1C, 0x0E, 0x08, 0x1E, 0x1A, 0x0C, 0x7A, 0x6A, 0x68, 0x4C, 0x32, 0x16, 0x14, 0xF2, 0xF0, 0x9E, 0x9C, 0x62, 0x60, @@ -629,7 +629,7 @@ public static HuffmanCodebook[] GenerateHuffmanCodebooks(short[][] codes, byte[] 0x1F, 0x09, 0x0F, 0x1D, 0x25, 0x2D, 0x2F, 0x37, 0x3F, 0x03, 0x09, 0x0B, 0x11, 0x15, 0x19, 0x1D }; - public static readonly byte[] SpectrumA64Bits = + private static readonly byte[] SpectrumA64Bits = { 4, 4, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 7, 6, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, @@ -637,7 +637,7 @@ public static HuffmanCodebook[] GenerateHuffmanCodebooks(short[][] codes, byte[] 6, 7, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5, 5, 5, 5, 4 }; - public static readonly short[] SpectrumA64Codes = + private static readonly short[] SpectrumA64Codes = { 0x006, 0x002, 0x01C, 0x01A, 0x016, 0x012, 0x00E, 0x00A, 0x002, 0x03E, 0x032, 0x02A, 0x022, 0x020, 0x010, 0x07A, 0x000, 0x078, 0x060, 0x050, 0x024, 0x006, 0x0C6, 0x0C4, @@ -647,7 +647,7 @@ public static HuffmanCodebook[] GenerateHuffmanCodebooks(short[][] codes, byte[] 0x017, 0x01B, 0x01D, 0x003 }; - public static readonly byte[] SpectrumA71Bits = + private static readonly byte[] SpectrumA71Bits = { 7, 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, @@ -659,7 +659,7 @@ public static HuffmanCodebook[] GenerateHuffmanCodebooks(short[][] codes, byte[] 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7 }; - public static readonly short[] SpectrumA71Codes = + private static readonly short[] SpectrumA71Codes = { 0x6C, 0x66, 0x62, 0x5C, 0x56, 0x50, 0x52, 0x4E, 0x48, 0x3E, 0x36, 0x34, 0x2A, 0x26, 0x1E, 0x16, 0x0E, 0x08, 0x00, 0xF6, 0xF4, 0xEE, 0xEC, 0xE2, 0xE0, 0xDA, 0xD2, 0xD0, 0xBE, 0xBC, 0xB2, 0xB0, @@ -671,7 +671,7 @@ public static HuffmanCodebook[] GenerateHuffmanCodebooks(short[][] codes, byte[] 0x0F, 0x17, 0x1F, 0x27, 0x2B, 0x35, 0x37, 0x3F, 0x49, 0x4F, 0x53, 0x51, 0x57, 0x5D, 0x63, 0x67 }; - public static readonly byte[] SpectrumA72Bits = + private static readonly byte[] SpectrumA72Bits = { 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, 7, 7, 7, 7, 7, @@ -683,7 +683,7 @@ public static HuffmanCodebook[] GenerateHuffmanCodebooks(short[][] codes, byte[] 7, 7, 7, 7, 7, 7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 6 }; - public static readonly short[] SpectrumA72Codes = + private static readonly short[] SpectrumA72Codes = { 0x2A, 0x24, 0x1C, 0x18, 0x12, 0x0E, 0x0A, 0x06, 0x02, 0x7E, 0x7C, 0x7A, 0x76, 0x72, 0x70, 0x6A, 0x68, 0x62, 0x5C, 0x5A, 0x52, 0x4E, 0x46, 0x42, 0x3C, 0x34, 0x2A, 0x28, 0x20, 0x12, 0x10, 0x08, @@ -695,7 +695,7 @@ public static HuffmanCodebook[] GenerateHuffmanCodebooks(short[][] codes, byte[] 0x69, 0x6B, 0x71, 0x73, 0x77, 0x7B, 0x7D, 0x7F, 0x03, 0x07, 0x0B, 0x0F, 0x13, 0x19, 0x1D, 0x25 }; - public static readonly byte[] SpectrumA73Bits = + private static readonly byte[] SpectrumA73Bits = { 5, 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, @@ -707,7 +707,7 @@ public static HuffmanCodebook[] GenerateHuffmanCodebooks(short[][] codes, byte[] 7, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6 }; - public static readonly short[] SpectrumA73Codes = + private static readonly short[] SpectrumA73Codes = { 0x003, 0x03E, 0x038, 0x034, 0x030, 0x02C, 0x028, 0x024, 0x020, 0x01C, 0x016, 0x014, 0x00E, 0x00A, 0x004, 0x000, 0x07A, 0x076, 0x06E, 0x06C, 0x064, 0x05E, 0x056, 0x04E, @@ -722,7 +722,7 @@ public static HuffmanCodebook[] GenerateHuffmanCodebooks(short[][] codes, byte[] 0x021, 0x025, 0x029, 0x02D, 0x031, 0x035, 0x039, 0x03F }; - public static readonly byte[] SpectrumA74Bits = + private static readonly byte[] SpectrumA74Bits = { 05, 05, 05, 05, 06, 06, 06, 06, 06, 06, 06, 06, 06, 06, 06, 06, 06, 07, 07, 07, 07, 07, 07, 07, 07, 07, 07, 07, 07, 07, 08, 08, @@ -734,7 +734,7 @@ public static HuffmanCodebook[] GenerateHuffmanCodebooks(short[][] codes, byte[] 06, 06, 06, 06, 06, 06, 06, 06, 06, 06, 06, 06, 06, 05, 05, 05 }; - public static readonly short[] SpectrumA74Codes = + private static readonly short[] SpectrumA74Codes = { 0x00D, 0x00A, 0x004, 0x000, 0x03A, 0x036, 0x032, 0x030, 0x02C, 0x028, 0x026, 0x022, 0x01E, 0x018, 0x012, 0x00E, 0x006, 0x07E, 0x07A, 0x070, 0x06A, 0x05E, 0x056, 0x054, @@ -749,7 +749,7 @@ public static HuffmanCodebook[] GenerateHuffmanCodebooks(short[][] codes, byte[] 0x02D, 0x031, 0x033, 0x037, 0x03B, 0x001, 0x005, 0x00B }; - public static readonly byte[] SpectrumB22Bits = + private static readonly byte[] SpectrumB22Bits = { 00, 04, 00, 04, 04, 05, 00, 05, 00, 00, 00, 00, 04, 05, 00, 05, 04, 07, 00, 06, 06, 09, 00, 07, 00, 00, 00, 00, 06, 09, 00, 07, @@ -769,7 +769,7 @@ public static HuffmanCodebook[] GenerateHuffmanCodebooks(short[][] codes, byte[] 05, 09, 00, 10, 07, 10, 00, 10, 00, 00, 00, 00, 09, 10, 00, 10 }; - public static readonly short[] SpectrumB22Codes = + private static readonly short[] SpectrumB22Codes = { 0x000, 0x00E, 0x000, 0x00F, 0x008, 0x006, 0x000, 0x00B, 0x000, 0x000, 0x000, 0x000, 0x009, 0x00A, 0x000, 0x007, 0x006, 0x00A, 0x000, 0x029, 0x006, 0x158, 0x000, 0x023, @@ -795,7 +795,7 @@ public static HuffmanCodebook[] GenerateHuffmanCodebooks(short[][] codes, byte[] 0x043, 0x040, 0x000, 0x04B }; - public static readonly byte[] SpectrumB23Bits = + private static readonly byte[] SpectrumB23Bits = { 02, 04, 00, 04, 04, 06, 00, 06, 00, 00, 00, 00, 04, 06, 00, 06, 04, 09, 00, 07, 07, 09, 00, 08, 00, 00, 00, 00, 07, 09, 00, 08, @@ -815,7 +815,7 @@ public static HuffmanCodebook[] GenerateHuffmanCodebooks(short[][] codes, byte[] 07, 10, 00, 10, 09, 10, 00, 10, 00, 00, 00, 00, 10, 10, 00, 10 }; - public static readonly short[] SpectrumB23Codes = + private static readonly short[] SpectrumB23Codes = { 0x003, 0x008, 0x000, 0x009, 0x002, 0x018, 0x000, 0x01B, 0x000, 0x000, 0x000, 0x000, 0x003, 0x01A, 0x000, 0x019, 0x000, 0x17C, 0x000, 0x055, 0x056, 0x0E8, 0x000, 0x07D, @@ -841,7 +841,7 @@ public static HuffmanCodebook[] GenerateHuffmanCodebooks(short[][] codes, byte[] 0x1EB, 0x1CE, 0x000, 0x1E3 }; - public static readonly byte[] SpectrumB24Bits = + private static readonly byte[] SpectrumB24Bits = { 01, 04, 00, 04, 05, 07, 00, 07, 00, 00, 00, 00, 05, 07, 00, 07, 05, 09, 00, 07, 08, 10, 00, 09, 00, 00, 00, 00, 07, 10, 00, 09, @@ -861,7 +861,7 @@ public static HuffmanCodebook[] GenerateHuffmanCodebooks(short[][] codes, byte[] 07, 10, 00, 10, 10, 10, 00, 10, 00, 00, 00, 00, 10, 10, 00, 10 }; - public static readonly short[] SpectrumB24Codes = + private static readonly short[] SpectrumB24Codes = { 0x001, 0x000, 0x000, 0x001, 0x00A, 0x01C, 0x000, 0x033, 0x000, 0x000, 0x000, 0x000, 0x00B, 0x032, 0x000, 0x01D, 0x008, 0x0D8, 0x000, 0x031, 0x06E, 0x0FA, 0x000, 0x0D7, @@ -887,7 +887,7 @@ public static HuffmanCodebook[] GenerateHuffmanCodebooks(short[][] codes, byte[] 0x0F3, 0x09A, 0x000, 0x0D7 }; - public static readonly byte[] SpectrumB32Bits = + private static readonly byte[] SpectrumB32Bits = { 2, 4, 5, 6, 0, 6, 5, 4, 5, 6, 6, 7, 0, 6, 5, 6, 5, 6, 7, 7, 0, 8, 7, 6, 6, 7, 8, 9, 0, 9, 8, 7, @@ -895,7 +895,7 @@ public static HuffmanCodebook[] GenerateHuffmanCodebooks(short[][] codes, byte[] 5, 6, 7, 8, 0, 7, 7, 6, 5, 6, 5, 6, 0, 7, 6, 6 }; - public static readonly short[] SpectrumB32Codes = + private static readonly short[] SpectrumB32Codes = { 0x001, 0x002, 0x01E, 0x02A, 0x000, 0x02B, 0x01F, 0x003, 0x016, 0x020, 0x03A, 0x064, 0x000, 0x005, 0x001, 0x023, 0x01A, 0x026, 0x070, 0x00C, 0x000, 0x0CF, 0x073, 0x031, @@ -905,7 +905,7 @@ public static HuffmanCodebook[] GenerateHuffmanCodebooks(short[][] codes, byte[] 0x000, 0x065, 0x03B, 0x021 }; - public static readonly byte[] SpectrumB33Bits = + private static readonly byte[] SpectrumB33Bits = { 02, 04, 05, 07, 00, 07, 05, 04, 04, 05, 06, 08, 00, 07, 06, 05, 05, 06, 07, 09, 00, 08, 07, 06, 07, 08, 09, 10, 00, 10, 09, 08, @@ -913,7 +913,7 @@ public static HuffmanCodebook[] GenerateHuffmanCodebooks(short[][] codes, byte[] 05, 06, 07, 08, 00, 09, 07, 06, 04, 05, 06, 07, 00, 08, 06, 05 }; - public static readonly short[] SpectrumB33Codes = + private static readonly short[] SpectrumB33Codes = { 0x003, 0x008, 0x014, 0x05E, 0x000, 0x05F, 0x015, 0x009, 0x004, 0x002, 0x01C, 0x0BA, 0x000, 0x011, 0x01F, 0x001, 0x00C, 0x00C, 0x014, 0x166, 0x000, 0x02D, 0x013, 0x00F, @@ -923,7 +923,7 @@ public static HuffmanCodebook[] GenerateHuffmanCodebooks(short[][] codes, byte[] 0x000, 0x0BB, 0x01D, 0x003 }; - public static readonly byte[] SpectrumB34Bits = + private static readonly byte[] SpectrumB34Bits = { 01, 04, 06, 08, 00, 08, 06, 04, 04, 06, 07, 09, 00, 08, 07, 06, 06, 07, 08, 10, 00, 10, 08, 07, 08, 09, 10, 10, 00, 10, 10, 09, @@ -931,7 +931,7 @@ public static HuffmanCodebook[] GenerateHuffmanCodebooks(short[][] codes, byte[] 06, 07, 08, 10, 00, 10, 08, 07, 04, 06, 07, 08, 00, 09, 07, 06 }; - public static readonly short[] SpectrumB34Codes = + private static readonly short[] SpectrumB34Codes = { 0x000, 0x00A, 0x038, 0x0EE, 0x000, 0x0EF, 0x039, 0x00B, 0x008, 0x03C, 0x06E, 0x1D8, 0x000, 0x0C1, 0x075, 0x03F, 0x032, 0x068, 0x0C4, 0x358, 0x000, 0x30F, 0x0C7, 0x06D, @@ -941,7 +941,7 @@ public static HuffmanCodebook[] GenerateHuffmanCodebooks(short[][] codes, byte[] 0x000, 0x1D9, 0x06F, 0x03D }; - public static readonly byte[] SpectrumB42Bits = + private static readonly byte[] SpectrumB42Bits = { 04, 05, 06, 08, 06, 07, 08, 08, 00, 08, 08, 07, 06, 08, 06, 05, 05, 06, 07, 08, 07, 07, 08, 09, 00, 08, 08, 07, 07, 08, 07, 06, @@ -961,7 +961,7 @@ public static HuffmanCodebook[] GenerateHuffmanCodebooks(short[][] codes, byte[] 05, 06, 07, 08, 07, 07, 08, 08, 00, 09, 08, 07, 07, 08, 07, 06 }; - public static readonly short[] SpectrumB42Codes = + private static readonly short[] SpectrumB42Codes = { 0x00E, 0x018, 0x010, 0x0F0, 0x024, 0x05A, 0x0F6, 0x078, 0x000, 0x079, 0x0F7, 0x05B, 0x025, 0x0F1, 0x011, 0x019, 0x00C, 0x014, 0x01C, 0x036, 0x05C, 0x012, 0x09E, 0x1E4, @@ -987,7 +987,7 @@ public static HuffmanCodebook[] GenerateHuffmanCodebooks(short[][] codes, byte[] 0x05D, 0x037, 0x01D, 0x015 }; - public static readonly byte[] SpectrumB43Bits = + private static readonly byte[] SpectrumB43Bits = { 02, 05, 06, 07, 07, 08, 08, 09, 00, 09, 08, 08, 07, 07, 06, 05, 05, 06, 07, 08, 07, 08, 09, 10, 00, 10, 09, 08, 07, 08, 07, 06, @@ -1007,7 +1007,7 @@ public static HuffmanCodebook[] GenerateHuffmanCodebooks(short[][] codes, byte[] 05, 06, 07, 08, 07, 08, 09, 10, 00, 10, 09, 08, 07, 08, 07, 06 }; - public static readonly short[] SpectrumB43Codes = + private static readonly short[] SpectrumB43Codes = { 0x001, 0x01E, 0x022, 0x018, 0x064, 0x0EC, 0x008, 0x100, 0x000, 0x101, 0x009, 0x0ED, 0x065, 0x019, 0x023, 0x01F, 0x01A, 0x030, 0x056, 0x09A, 0x00A, 0x090, 0x12C, 0x0A6, @@ -1033,7 +1033,7 @@ public static HuffmanCodebook[] GenerateHuffmanCodebooks(short[][] codes, byte[] 0x00B, 0x09B, 0x057, 0x031 }; - public static readonly byte[] SpectrumB44Bits = + private static readonly byte[] SpectrumB44Bits = { 02, 04, 06, 07, 07, 08, 10, 10, 00, 10, 10, 08, 07, 07, 06, 04, 05, 05, 07, 08, 08, 10, 10, 10, 00, 10, 10, 10, 08, 08, 07, 05, @@ -1053,7 +1053,7 @@ public static HuffmanCodebook[] GenerateHuffmanCodebooks(short[][] codes, byte[] 05, 05, 07, 08, 08, 10, 10, 10, 00, 10, 10, 10, 08, 08, 07, 05 }; - public static readonly short[] SpectrumB44Codes = + private static readonly short[] SpectrumB44Codes = { 0x002, 0x002, 0x030, 0x000, 0x002, 0x00C, 0x1D2, 0x1AE, 0x000, 0x1AF, 0x1D3, 0x00D, 0x003, 0x001, 0x031, 0x003, 0x01E, 0x002, 0x070, 0x0C8, 0x07E, 0x1E8, 0x1C0, 0x176, @@ -1079,44 +1079,44 @@ public static HuffmanCodebook[] GenerateHuffmanCodebooks(short[][] codes, byte[] 0x07F, 0x0C9, 0x071, 0x003 }; - public static readonly byte[] SpectrumB52Bits = + private static readonly byte[] SpectrumB52Bits = { 3, 4, 4, 4, 5, 5, 6, 6, 5, 5, 5, 6, 6, 6, 7, 7, 0, 7, 7, 6, 6, 6, 5, 5, 5, 6, 6, 5, 5, 4, 4, 4 }; - public static readonly short[] SpectrumB52Codes = + private static readonly short[] SpectrumB52Codes = { 0x06, 0x0E, 0x06, 0x00, 0x0A, 0x04, 0x2C, 0x12, 0x14, 0x10, 0x06, 0x2E, 0x24, 0x10, 0x4E, 0x4C, 0x00, 0x4D, 0x4F, 0x11, 0x25, 0x2F, 0x07, 0x11, 0x15, 0x13, 0x2D, 0x05, 0x0B, 0x01, 0x07, 0x0F }; - public static readonly byte[] SpectrumB53Bits = + private static readonly byte[] SpectrumB53Bits = { 2, 3, 4, 5, 5, 6, 6, 6, 6, 6, 6, 7, 7, 7, 8, 8, 0, 8, 8, 7, 7, 7, 6, 6, 6, 6, 6, 6, 5, 5, 4, 3 }; - public static readonly short[] SpectrumB53Codes = + private static readonly short[] SpectrumB53Codes = { 0x02, 0x00, 0x06, 0x1C, 0x18, 0x3E, 0x16, 0x10, 0x3C, 0x36, 0x14, 0x6A, 0x26, 0x24, 0xD2, 0xD0, 0x00, 0xD1, 0xD3, 0x25, 0x27, 0x6B, 0x15, 0x37, 0x3D, 0x11, 0x17, 0x3F, 0x19, 0x1D, 0x07, 0x01 }; - public static readonly byte[] SpectrumB54Bits = + private static readonly byte[] SpectrumB54Bits = { 2, 3, 4, 4, 5, 6, 6, 7, 6, 6, 7, 8, 8, 8, 9, 9, 0, 9, 9, 8, 8, 8, 7, 6, 6, 7, 6, 6, 5, 4, 4, 3 }; - public static readonly short[] SpectrumB54Codes = + private static readonly short[] SpectrumB54Codes = { 0x003, 0x002, 0x008, 0x000, 0x014, 0x02E, 0x00E, 0x05A, 0x00A, 0x008, 0x01A, 0x0B2, 0x032, 0x030, 0x162, 0x160, 0x000, 0x161, 0x163, 0x031, 0x033, 0x0B3, 0x01B, 0x009, 0x00B, 0x05B, 0x00F, 0x02F, 0x015, 0x001, 0x009, 0x003 }; - public static readonly byte[] SpectrumB62Bits = + private static readonly byte[] SpectrumB62Bits = { 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, @@ -1124,7 +1124,7 @@ public static HuffmanCodebook[] GenerateHuffmanCodebooks(short[][] codes, byte[] 6, 7, 7, 7, 7, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5, 4 }; - public static readonly short[] SpectrumB62Codes = + private static readonly short[] SpectrumB62Codes = { 0x0D, 0x06, 0x1C, 0x14, 0x0A, 0x04, 0x3E, 0x2E, 0x22, 0x0E, 0x06, 0x00, 0x5A, 0x4E, 0x40, 0x20, 0x30, 0x32, 0x24, 0x12, 0x0C, 0x02, 0x78, 0x58, 0x42, 0x22, 0x0A, 0x08, 0xF6, 0xF4, 0x9A, 0x98, @@ -1132,7 +1132,7 @@ public static HuffmanCodebook[] GenerateHuffmanCodebooks(short[][] codes, byte[] 0x31, 0x21, 0x41, 0x4F, 0x5B, 0x01, 0x07, 0x0F, 0x23, 0x2F, 0x3F, 0x05, 0x0B, 0x15, 0x1D, 0x07 }; - public static readonly byte[] SpectrumB63Bits = + private static readonly byte[] SpectrumB63Bits = { 3, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, @@ -1140,7 +1140,7 @@ public static HuffmanCodebook[] GenerateHuffmanCodebooks(short[][] codes, byte[] 6, 8, 7, 7, 7, 7, 6, 6, 6, 6, 5, 5, 5, 5, 4, 4 }; - public static readonly short[] SpectrumB63Codes = + private static readonly short[] SpectrumB63Codes = { 0x006, 0x00E, 0x004, 0x014, 0x010, 0x006, 0x000, 0x026, 0x01C, 0x018, 0x004, 0x05C, 0x04A, 0x03C, 0x016, 0x0BC, 0x006, 0x008, 0x058, 0x03E, 0x036, 0x014, 0x0B6, 0x0B4, @@ -1150,7 +1150,7 @@ public static HuffmanCodebook[] GenerateHuffmanCodebooks(short[][] codes, byte[] 0x011, 0x015, 0x005, 0x00F }; - public static readonly byte[] SpectrumB64Bits = + private static readonly byte[] SpectrumB64Bits = { 03, 03, 04, 05, 05, 05, 06, 06, 06, 06, 07, 07, 07, 07, 07, 08, 07, 07, 07, 08, 08, 08, 09, 09, 09, 09, 09, 09, 10, 10, 10, 10, @@ -1158,7 +1158,7 @@ public static HuffmanCodebook[] GenerateHuffmanCodebooks(short[][] codes, byte[] 07, 08, 07, 07, 07, 07, 07, 06, 06, 06, 06, 05, 05, 05, 04, 03 }; - public static readonly short[] SpectrumB64Codes = + private static readonly short[] SpectrumB64Codes = { 0x007, 0x000, 0x008, 0x01A, 0x014, 0x00C, 0x032, 0x02E, 0x01E, 0x014, 0x062, 0x05A, 0x03A, 0x026, 0x020, 0x0B2, 0x038, 0x02C, 0x022, 0x0C0, 0x05E, 0x04A, 0x186, 0x184, @@ -1168,7 +1168,7 @@ public static HuffmanCodebook[] GenerateHuffmanCodebooks(short[][] codes, byte[] 0x015, 0x01B, 0x009, 0x001 }; - public static readonly byte[] SpectrumB72Bits = + private static readonly byte[] SpectrumB72Bits = { 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, @@ -1180,7 +1180,7 @@ public static HuffmanCodebook[] GenerateHuffmanCodebooks(short[][] codes, byte[] 7, 7, 7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, 5, 5, 5 }; - public static readonly short[] SpectrumB72Codes = + private static readonly short[] SpectrumB72Codes = { 0x01E, 0x016, 0x00C, 0x000, 0x038, 0x032, 0x028, 0x022, 0x01C, 0x012, 0x00E, 0x006, 0x076, 0x06C, 0x060, 0x04E, 0x03E, 0x02A, 0x022, 0x01A, 0x012, 0x00A, 0x0FC, 0x0DC, @@ -1195,7 +1195,7 @@ public static HuffmanCodebook[] GenerateHuffmanCodebooks(short[][] codes, byte[] 0x01D, 0x023, 0x029, 0x033, 0x039, 0x001, 0x00D, 0x017 }; - public static readonly byte[] SpectrumB73Bits = + private static readonly byte[] SpectrumB73Bits = { 03, 04, 05, 05, 05, 06, 06, 06, 06, 06, 06, 07, 07, 07, 07, 07, 07, 07, 07, 07, 08, 08, 08, 08, 08, 08, 08, 08, 08, 08, 09, 09, @@ -1207,7 +1207,7 @@ public static HuffmanCodebook[] GenerateHuffmanCodebooks(short[][] codes, byte[] 07, 07, 07, 07, 07, 07, 06, 06, 06, 06, 06, 06, 05, 05, 05, 04 }; - public static readonly short[] SpectrumB73Codes = + private static readonly short[] SpectrumB73Codes = { 0x000, 0x006, 0x018, 0x010, 0x004, 0x03A, 0x034, 0x02A, 0x026, 0x014, 0x010, 0x07E, 0x072, 0x06E, 0x05C, 0x052, 0x04A, 0x02C, 0x024, 0x018, 0x0F4, 0x0E0, 0x0DA, 0x0B6, @@ -1222,7 +1222,7 @@ public static HuffmanCodebook[] GenerateHuffmanCodebooks(short[][] codes, byte[] 0x027, 0x02B, 0x035, 0x03B, 0x005, 0x011, 0x019, 0x007 }; - public static readonly byte[] SpectrumB74Bits = + private static readonly byte[] SpectrumB74Bits = { 03, 04, 05, 05, 05, 05, 06, 06, 06, 06, 06, 06, 07, 07, 07, 07, 07, 07, 07, 07, 08, 08, 08, 08, 08, 08, 08, 08, 08, 09, 09, 09, @@ -1234,7 +1234,7 @@ public static HuffmanCodebook[] GenerateHuffmanCodebooks(short[][] codes, byte[] 07, 07, 07, 07, 07, 06, 06, 06, 06, 06, 06, 05, 05, 05, 05, 04 }; - public static readonly short[] SpectrumB74Codes = + private static readonly short[] SpectrumB74Codes = { 0x001, 0x008, 0x01E, 0x018, 0x00C, 0x002, 0x03A, 0x034, 0x02C, 0x01E, 0x016, 0x012, 0x072, 0x06E, 0x05E, 0x056, 0x050, 0x038, 0x022, 0x004, 0x0E2, 0x0DA, 0x0BA, 0x0A8, @@ -1248,5 +1248,105 @@ public static HuffmanCodebook[] GenerateHuffmanCodebooks(short[][] codes, byte[] 0x0E3, 0x005, 0x023, 0x039, 0x051, 0x057, 0x05F, 0x06F, 0x073, 0x013, 0x017, 0x01F, 0x02D, 0x035, 0x03B, 0x003, 0x00D, 0x019, 0x01F, 0x009 }; + + public static readonly byte[][] HuffmanScaleFactorsABits = + { + null, + ScaleFactorsA1Bits, ScaleFactorsA2Bits, ScaleFactorsA3Bits, + ScaleFactorsA4Bits, ScaleFactorsA5Bits, ScaleFactorsA6Bits + }; + + public static readonly short[][] HuffmanScaleFactorsACodes = + { + null, + ScaleFactorsA1Codes, ScaleFactorsA2Codes, ScaleFactorsA3Codes, + ScaleFactorsA4Codes, ScaleFactorsA5Codes, ScaleFactorsA6Codes + }; + + public static readonly byte[][] HuffmanScaleFactorsBBits = + { + null, null, + ScaleFactorsB2Bits, ScaleFactorsB3Bits, ScaleFactorsB4Bits, ScaleFactorsB5Bits + }; + + public static readonly short[][] HuffmanScaleFactorsBCodes = + { + null, null, + ScaleFactorsB2Codes, ScaleFactorsB3Codes, ScaleFactorsB4Codes, ScaleFactorsB5Codes + }; + + public static readonly byte[] HuffmanScaleFactorsGroupSizes = { 0, 0, 0, 0, 0, 0, 0 }; + + public static readonly byte[][][] HuffmanSpectrumABits = + { + null, + null, + new[] {SpectrumA21Bits, SpectrumA22Bits, SpectrumA23Bits, SpectrumA24Bits}, + new[] {SpectrumA31Bits, SpectrumA32Bits, SpectrumA33Bits, SpectrumA34Bits}, + new[] {SpectrumA41Bits, SpectrumA42Bits, SpectrumA43Bits, SpectrumA44Bits}, + new[] {SpectrumA51Bits, SpectrumA52Bits, SpectrumA53Bits, SpectrumA54Bits}, + new[] {SpectrumA61Bits, SpectrumA62Bits, SpectrumA63Bits, SpectrumA64Bits}, + new[] {SpectrumA71Bits, SpectrumA72Bits, SpectrumA73Bits, SpectrumA74Bits} + }; + + public static readonly short[][][] HuffmanSpectrumACodes = + { + null, + null, + new[] {SpectrumA21Codes, SpectrumA22Codes, SpectrumA23Codes, SpectrumA24Codes}, + new[] {SpectrumA31Codes, SpectrumA32Codes, SpectrumA33Codes, SpectrumA34Codes}, + new[] {SpectrumA41Codes, SpectrumA42Codes, SpectrumA43Codes, SpectrumA44Codes}, + new[] {SpectrumA51Codes, SpectrumA52Codes, SpectrumA53Codes, SpectrumA54Codes}, + new[] {SpectrumA61Codes, SpectrumA62Codes, SpectrumA63Codes, SpectrumA64Codes}, + new[] {SpectrumA71Codes, SpectrumA72Codes, SpectrumA73Codes, SpectrumA74Codes} + }; + + public static readonly byte[][] HuffmanSpectrumAGroupSizes = + { + new byte[] {0, 0, 0, 0}, + new byte[] {0, 0, 0, 0}, + new byte[] {1, 2, 2, 2}, + new byte[] {1, 1, 1, 1}, + new byte[] {1, 1, 1, 1}, + new byte[] {0, 0, 0, 0}, + new byte[] {0, 0, 0, 0}, + new byte[] {0, 0, 0, 0} + }; + + public static readonly byte[][][] HuffmanSpectrumBBits = + { + null, + null, + new[] {null, SpectrumB22Bits, SpectrumB23Bits, SpectrumB24Bits}, + new[] {null, SpectrumB32Bits, SpectrumB33Bits, SpectrumB34Bits}, + new[] {null, SpectrumB42Bits, SpectrumB43Bits, SpectrumB44Bits}, + new[] {null, SpectrumB52Bits, SpectrumB53Bits, SpectrumB54Bits}, + new[] {null, SpectrumB62Bits, SpectrumB63Bits, SpectrumB64Bits}, + new[] {null, SpectrumB72Bits, SpectrumB73Bits, SpectrumB74Bits} + }; + + public static readonly short[][][] HuffmanSpectrumBCodes = + { + null, + null, + new[] {null, SpectrumB22Codes, SpectrumB23Codes, SpectrumB24Codes}, + new[] {null, SpectrumB32Codes, SpectrumB33Codes, SpectrumB34Codes}, + new[] {null, SpectrumB42Codes, SpectrumB43Codes, SpectrumB44Codes}, + new[] {null, SpectrumB52Codes, SpectrumB53Codes, SpectrumB54Codes}, + new[] {null, SpectrumB62Codes, SpectrumB63Codes, SpectrumB64Codes}, + new[] {null, SpectrumB72Codes, SpectrumB73Codes, SpectrumB74Codes} + }; + + public static readonly byte[][] HuffmanSpectrumBGroupSizes = + { + new byte[] {0, 0, 0, 0}, + new byte[] {0, 0, 0, 0}, + new byte[] {0, 2, 2, 2}, + new byte[] {0, 1, 1, 1}, + new byte[] {0, 1, 1, 1}, + new byte[] {0, 0, 0, 0}, + new byte[] {0, 0, 0, 0}, + new byte[] {0, 0, 0, 0} + }; } } \ No newline at end of file diff --git a/CSharp/LibAtrac9/ScaleFactors.cs b/CSharp/LibAtrac9/ScaleFactors.cs index e8992fb..55634a9 100644 --- a/CSharp/LibAtrac9/ScaleFactors.cs +++ b/CSharp/LibAtrac9/ScaleFactors.cs @@ -78,7 +78,7 @@ private static void ReadClcOffset(BitReader reader, Channel channel) private static void ReadVlcDeltaOffset(BitReader reader, Channel channel) { int weightIndex = reader.ReadInt(3); - byte[] weights = Tables.ScaleFactorWeights[weightIndex]; + byte[] weights = ScaleFactorWeights[weightIndex]; int[] sf = channel.ScaleFactors; int baseValue = reader.ReadInt(5); @@ -144,5 +144,28 @@ private static void ReadVlcDeltaOffsetWithBaseline(BitReader reader, Channel cha sf[i] = reader.ReadInt(5); } } + + public static readonly byte[][] ScaleFactorWeights = + { + new byte[] { + 0, 0, 0, 1, 1, 2, 2, 2, 2, 2, 2, 3, 2, 3, 3, 4, 4, 4, 4, 4, 4, 5, 5, 6, 6, 7, 7, 8, 10, 12, 12, 12 + }, new byte[] { + 3, 2, 2, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 2, 3, 3, 4, 5, 7, 10, 10, 10 + }, new byte[] { + 0, 2, 4, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 8, 9, 12, 12, 12 + }, new byte[] { + 0, 1, 1, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 6, 7, 8, 8, 10, 11, 11, 12, 13, 13, 13, 13 + }, new byte[] { + 0, 2, 2, 3, 3, 4, 4, 5, 4, 5, 5, 5, 5, 6, 7, 8, 8, 8, 8, 9, 9, 9, 10, 10, 11, 12, 12, 13, 13, 14, 14, 14 + }, new byte[] { + 1, 1, 0, 0, 0, 0, 1, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 4, 4, 5, 6, 7, 7, 9, 11, 11, 11 + }, new byte[] { + 0, 5, 8, 10, 11, 11, 12, 12, 12, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 12, 12, 12, + 12, 13, 15, 15, 15 + }, new byte[] { + 0, 2, 3, 4, 5, 6, 6, 7, 7, 8, 8, 8, 9, 9, 10, 10, 10, 11, 11, 11, 11, 11, 11, 12, 12, 12, 12, 13, 13, + 15, 15, 15 + } + }; } } diff --git a/CSharp/LibAtrac9/Tables.cs b/CSharp/LibAtrac9/Tables.cs index 97fe508..150759c 100644 --- a/CSharp/LibAtrac9/Tables.cs +++ b/CSharp/LibAtrac9/Tables.cs @@ -1,19 +1,10 @@ using System; +using static LibAtrac9.HuffmanCodebooks; namespace LibAtrac9 { internal static class Tables { - static Tables() - { - var huffmanSpectrumA = HuffmanCodebooks.GenerateHuffmanCodebooks(HuffmanSpectrumACodes, HuffmanSpectrumABits, HuffmanSpectrumAGroupSizes); - var huffmanSpectrumB = HuffmanCodebooks.GenerateHuffmanCodebooks(HuffmanSpectrumBCodes, HuffmanSpectrumBBits, HuffmanSpectrumBGroupSizes); - HuffmanSpectrum = new[] { huffmanSpectrumA, huffmanSpectrumB }; - - HuffmanScaleFactorsUnsigned = HuffmanCodebooks.GenerateHuffmanCodebooks(HuffmanScaleFactorsACodes, HuffmanScaleFactorsABits, HuffmanScaleFactorsGroupSizes); - HuffmanScaleFactorsSigned = HuffmanCodebooks.GenerateHuffmanCodebooks(HuffmanScaleFactorsBCodes, HuffmanScaleFactorsBBits, HuffmanScaleFactorsGroupSizes); - } - public static int MaxHuffPrecision(bool highSampleRate) => highSampleRate ? 1 : 7; public static int MinBandCount(bool highSampleRate) => highSampleRate ? 1 : 3; public static int MaxExtensionBand(bool highSampleRate) => highSampleRate ? 16 : 18; @@ -58,9 +49,17 @@ static Tables() new ChannelConfig(BlockType.Stereo, BlockType.Stereo) }; - public static readonly HuffmanCodebook[] HuffmanScaleFactorsUnsigned; - public static readonly HuffmanCodebook[] HuffmanScaleFactorsSigned; - public static readonly HuffmanCodebook[][][] HuffmanSpectrum; + public static readonly HuffmanCodebook[] HuffmanScaleFactorsUnsigned = + GenerateHuffmanCodebooks(HuffmanScaleFactorsACodes, HuffmanScaleFactorsABits, HuffmanScaleFactorsGroupSizes); + + public static readonly HuffmanCodebook[] HuffmanScaleFactorsSigned = + GenerateHuffmanCodebooks(HuffmanScaleFactorsBCodes, HuffmanScaleFactorsBBits, HuffmanScaleFactorsGroupSizes); + + public static readonly HuffmanCodebook[][][] HuffmanSpectrum = + { + GenerateHuffmanCodebooks(HuffmanSpectrumACodes, HuffmanSpectrumABits, HuffmanSpectrumAGroupSizes), + GenerateHuffmanCodebooks(HuffmanSpectrumBCodes, HuffmanSpectrumBBits, HuffmanSpectrumBGroupSizes) + }; public static readonly double[][] ImdctWindow = { GenerateImdctWindow(6), GenerateImdctWindow(7), GenerateImdctWindow(8) }; @@ -111,322 +110,6 @@ private static T[] Generate(int count, Func elementGenerator) return table; } - public static readonly byte[][] ScaleFactorWeights = - { - new byte[] { - 0, 0, 0, 1, 1, 2, 2, 2, 2, 2, 2, 3, 2, 3, 3, 4, 4, 4, 4, 4, 4, 5, 5, 6, 6, 7, 7, 8, 10, 12, 12, 12 - }, new byte[] { - 3, 2, 2, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 2, 3, 3, 4, 5, 7, 10, 10, 10 - }, new byte[] { - 0, 2, 4, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 8, 9, 12, 12, 12 - }, new byte[] { - 0, 1, 1, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 6, 7, 8, 8, 10, 11, 11, 12, 13, 13, 13, 13 - }, new byte[] { - 0, 2, 2, 3, 3, 4, 4, 5, 4, 5, 5, 5, 5, 6, 7, 8, 8, 8, 8, 9, 9, 9, 10, 10, 11, 12, 12, 13, 13, 14, 14, 14 - }, new byte[] { - 1, 1, 0, 0, 0, 0, 1, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 4, 4, 5, 6, 7, 7, 9, 11, 11, 11 - }, new byte[] { - 0, 5, 8, 10, 11, 11, 12, 12, 12, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 12, 12, 12, - 12, 13, 15, 15, 15 - }, new byte[] { - 0, 2, 3, 4, 5, 6, 6, 7, 7, 8, 8, 8, 9, 9, 10, 10, 10, 11, 11, 11, 11, 11, 11, 12, 12, 12, 12, 13, 13, - 15, 15, 15 - } - }; - - public static readonly byte[][] BexGroupInfo = - { - new byte[] {16, 21, 0}, - new byte[] {18, 22, 1}, - new byte[] {20, 22, 2}, - new byte[] {21, 22, 3}, - new byte[] {21, 22, 3}, - new byte[] {23, 24, 4}, - new byte[] {23, 24, 4}, - new byte[] {24, 24, 5} - }; - - // [mode][bands] - public static readonly byte[][] BexEncodedValueCounts = - { - new byte[] {0, 0, 0, 4, 4, 2}, - new byte[] {0, 0, 0, 0, 0, 0}, - new byte[] {0, 0, 0, 2, 2, 1}, - new byte[] {0, 0, 0, 2, 2, 2}, - new byte[] {1, 1, 1, 0, 0, 0} - }; - - // [mode][bands][valueIndex] - public static readonly byte[][][] BexDataLengths = - { - new[] { - new byte[] {0, 0, 0, 0}, - new byte[] {0, 0, 0, 0}, - new byte[] {0, 0, 0, 0}, - new byte[] {5, 4, 3, 3}, - new byte[] {4, 4, 3, 4}, - new byte[] {4, 5, 0, 0} - }, new[] { - new byte[] {0, 0, 0, 0}, - new byte[] {0, 0, 0, 0}, - new byte[] {0, 0, 0, 0}, - new byte[] {0, 0, 0, 0}, - new byte[] {0, 0, 0, 0}, - new byte[] {0, 0, 0, 0} - }, new[] { - new byte[] {0, 0, 0, 0}, - new byte[] {0, 0, 0, 0}, - new byte[] {0, 0, 0, 0}, - new byte[] {6, 6, 0, 0}, - new byte[] {6, 6, 0, 0}, - new byte[] {6, 0, 0, 0} - }, new[] { - new byte[] {0, 0, 0, 0}, - new byte[] {0, 0, 0, 0}, - new byte[] {0, 0, 0, 0}, - new byte[] {4, 4, 0, 0}, - new byte[] {4, 4, 0, 0}, - new byte[] {4, 4, 0, 0} - }, new[] { - new byte[] {3, 0, 0, 0}, - new byte[] {3, 0, 0, 0}, - new byte[] {3, 0, 0, 0}, - new byte[] {0, 0, 0, 0}, - new byte[] {0, 0, 0, 0}, - new byte[] {0, 0, 0, 0} - } - }; - - public static readonly double[][] BexMode0Bands3 = - { - new[] { - 0.000000e+0, 1.988220e-1, 2.514343e-1, 2.960510e-1, - 3.263550e-1, 3.771362e-1, 3.786926e-1, 4.540405e-1, - 4.877625e-1, 5.262451e-1, 5.447083e-1, 5.737000e-1, - 6.212158e-1, 6.222839e-1, 6.560974e-1, 6.896667e-1, - 7.555542e-1, 7.677917e-1, 7.918091e-1, 7.971497e-1, - 8.188171e-1, 8.446045e-1, 9.790649e-1, 9.822083e-1, - 9.846191e-1, 9.859314e-1, 9.863586e-1, 9.863892e-1, - 9.873352e-1, 9.881287e-1, 9.898682e-1, 9.913330e-1 - }, new[] { - 0.000000e+0, 9.982910e-1, 7.592773e-2, 7.179565e-1, - 9.851379e-1, 5.340271e-1, 9.013672e-1, 6.349182e-1, - 7.226257e-1, 1.948547e-1, 7.628174e-1, 9.873657e-1, - 8.112183e-1, 2.715454e-1, 9.734192e-1, 1.443787e-1, - 4.640198e-1, 3.249207e-1, 3.790894e-1, 8.276367e-2, - 5.954590e-1, 2.864380e-1, 9.806824e-1, 7.929077e-1, - 6.292114e-1, 4.887085e-1, 2.905273e-1, 1.301880e-1, - 3.140869e-1, 5.482483e-1, 4.210815e-1, 1.182861e-1 - }, new[] { - 0.000000e+0, 3.155518e-2, 8.581543e-2, 1.364746e-1, - 1.858826e-1, 2.368469e-1, 2.888184e-1, 3.432617e-1, - 4.012451e-1, 4.623108e-1, 5.271301e-1, 5.954895e-1, - 6.681213e-1, 7.448425e-1, 8.245239e-1, 9.097290e-1 - }, new[] { - 0.000000e+0, 4.418945e-2, 1.303711e-1, 2.273560e-1, - 3.395996e-1, 4.735718e-1, 6.267090e-1, 8.003845e-1 - }, new[] { - 0.000000e+0, 2.804565e-2, 9.683228e-2, 1.849976e-1, - 3.005981e-1, 4.470520e-1, 6.168518e-1, 8.007813e-1 - } - }; - - public static readonly double[][] BexMode0Bands4 = - { - new[] { - 0.000000e+0, 2.708740e-1, 3.479614e-1, 3.578186e-1, - 5.083618e-1, 5.299072e-1, 5.819092e-1, 6.381836e-1, - 7.276917e-1, 7.595520e-1, 7.878723e-1, 9.707336e-1, - 9.713135e-1, 9.736023e-1, 9.759827e-1, 9.832458e-1 - }, new[] { - 0.000000e+0, 2.330627e-1, 5.891418e-1, 7.170410e-1, - 2.036438e-1, 1.613464e-1, 6.668701e-1, 9.481201e-1, - 9.769897e-1, 5.111694e-1, 3.522644e-1, 8.209534e-1, - 2.933960e-1, 9.757690e-1, 5.289917e-1, 4.372253e-1 - }, new[] { - 0.000000e+0, 4.360962e-2, 1.056519e-1, 1.590576e-1, - 2.078857e-1, 2.572937e-1, 3.082581e-1, 3.616028e-1, - 4.191589e-1, 4.792175e-1, 5.438538e-1, 6.125183e-1, - 6.841125e-1, 7.589417e-1, 8.365173e-1, 9.148254e-1 - }, new[] { - 0.000000e+0, 4.074097e-2, 1.164551e-1, 2.077026e-1, - 3.184509e-1, 4.532166e-1, 6.124268e-1, 7.932129e-1 - }, new[] { - 0.000000e+0, 8.880615e-3, 2.932739e-2, 5.593872e-2, - 8.825684e-2, 1.259155e-1, 1.721497e-1, 2.270813e-1, - 2.901611e-1, 3.579712e-1, 4.334106e-1, 5.147095e-1, - 6.023254e-1, 6.956177e-1, 7.952881e-1, 8.977356e-1 - } - }; - - public static readonly double[][] BexMode0Bands5 = - { - new[] { - 0.000000e+0, 7.379150e-2, 1.806335e-1, 2.687073e-1, - 3.407898e-1, 4.047546e-1, 4.621887e-1, 5.168762e-1, - 5.703125e-1, 6.237488e-1, 6.763611e-1, 7.288208e-1, - 7.808533e-1, 8.337708e-1, 8.874512e-1, 9.418030e-1 - }, new[] { - 0.000000e+0, 7.980347e-2, 1.615295e-1, 1.665649e-1, - 1.822205e-1, 2.185669e-1, 2.292175e-1, 2.456665e-1, - 2.666321e-1, 3.306580e-1, 3.330688e-1, 3.765259e-1, - 4.085083e-1, 4.400024e-1, 4.407654e-1, 4.817505e-1, - 4.924011e-1, 5.320740e-1, 5.893860e-1, 6.131287e-1, - 6.212463e-1, 6.278076e-1, 6.308899e-1, 7.660828e-1, - 7.850647e-1, 7.910461e-1, 7.929382e-1, 8.038330e-1, - 9.834900e-1, 9.846191e-1, 9.852295e-1, 9.862671e-1 - }, new[] { - 0.000000e+0, 6.084290e-1, 3.672791e-1, 3.151855e-1, - 1.488953e-1, 2.571716e-1, 5.103455e-1, 3.311157e-1, - 5.426025e-2, 4.254456e-1, 7.998352e-1, 7.873230e-1, - 5.418701e-1, 2.925110e-1, 8.468628e-2, 1.410522e-1, - 9.819641e-1, 9.609070e-1, 3.530884e-2, 9.729004e-2, - 5.758362e-1, 9.941711e-1, 7.215576e-1, 7.183228e-1, - 2.028809e-1, 9.588623e-2, 2.032166e-1, 1.338806e-1, - 5.003357e-1, 1.874390e-1, 9.804993e-1, 1.107788e-1 - } - }; - - public static readonly double[] BexMode2Scale = - { - 4.272461e-4, 1.312256e-3, 2.441406e-3, 3.692627e-3, - 4.913330e-3, 6.134033e-3, 7.507324e-3, 8.972168e-3, - 1.049805e-2, 1.223755e-2, 1.406860e-2, 1.599121e-2, - 1.800537e-2, 2.026367e-2, 2.264404e-2, 2.517700e-2, - 2.792358e-2, 3.073120e-2, 3.344727e-2, 3.631592e-2, - 3.952026e-2, 4.275513e-2, 4.608154e-2, 4.968262e-2, - 5.355835e-2, 5.783081e-2, 6.195068e-2, 6.677246e-2, - 7.196045e-2, 7.745361e-2, 8.319092e-2, 8.993530e-2, - 9.759521e-2, 1.056213e-1, 1.138916e-1, 1.236267e-1, - 1.348267e-1, 1.470337e-1, 1.603394e-1, 1.755676e-1, - 1.905823e-1, 2.071228e-1, 2.245178e-1, 2.444153e-1, - 2.658997e-1, 2.897644e-1, 3.146057e-1, 3.450012e-1, - 3.766174e-1, 4.122620e-1, 4.505615e-1, 4.893799e-1, - 5.305481e-1, 5.731201e-1, 6.157837e-1, 6.580811e-1, - 6.985168e-1, 7.435303e-1, 7.865906e-1, 8.302612e-1, - 8.718567e-1, 9.125671e-1, 9.575806e-1, 9.996643e-1 - }; - - public static readonly double[] BexMode3Initial = - { - 3.491211e-1, 5.371094e-1, 6.782227e-1, 7.910156e-1, - 9.057617e-1, 1.024902e+0, 1.156250e+0, 1.290527e+0, - 1.458984e+0, 1.664551e+0, 1.929688e+0, 2.278320e+0, - 2.831543e+0, 3.659180e+0, 5.257813e+0, 8.373047e+0 - }; - - public static readonly double[] BexMode3Rate = - { - -2.913818e-1, -2.541504e-1, -1.664429e-1, -1.476440e-1, - -1.342163e-1, -1.220703e-1, -1.117554e-1, -1.026611e-1, - -9.436035e-2, -8.483887e-2, -7.476807e-2, -6.304932e-2, - -4.492188e-2, -2.447510e-2, +1.831055e-4, +4.174805e-2 - }; - - public static readonly double[] BexMode4Multiplier = - { - 3.610229e-2, 1.260681e-1, 2.227478e-1, 3.338318e-1, - 4.662170e-1, 6.221313e-1, 7.989197e-1, 9.939575e-1 - }; - - private static readonly byte[][] HuffmanScaleFactorsABits = - { - null, - HuffmanCodebooks.ScaleFactorsA1Bits, HuffmanCodebooks.ScaleFactorsA2Bits, HuffmanCodebooks.ScaleFactorsA3Bits, - HuffmanCodebooks.ScaleFactorsA4Bits, HuffmanCodebooks.ScaleFactorsA5Bits, HuffmanCodebooks.ScaleFactorsA6Bits - }; - - private static readonly short[][] HuffmanScaleFactorsACodes = - { - null, - HuffmanCodebooks.ScaleFactorsA1Codes, HuffmanCodebooks.ScaleFactorsA2Codes, HuffmanCodebooks.ScaleFactorsA3Codes, - HuffmanCodebooks.ScaleFactorsA4Codes, HuffmanCodebooks.ScaleFactorsA5Codes, HuffmanCodebooks.ScaleFactorsA6Codes - }; - - private static readonly byte[][] HuffmanScaleFactorsBBits = - { - null, null, - HuffmanCodebooks.ScaleFactorsB2Bits, HuffmanCodebooks.ScaleFactorsB3Bits, HuffmanCodebooks.ScaleFactorsB4Bits, HuffmanCodebooks.ScaleFactorsB5Bits - }; - - private static readonly short[][] HuffmanScaleFactorsBCodes = - { - null, null, - HuffmanCodebooks.ScaleFactorsB2Codes, HuffmanCodebooks.ScaleFactorsB3Codes, HuffmanCodebooks.ScaleFactorsB4Codes, HuffmanCodebooks.ScaleFactorsB5Codes - }; - - private static readonly byte[] HuffmanScaleFactorsGroupSizes = { 0, 0, 0, 0, 0, 0, 0 }; - - private static readonly byte[][][] HuffmanSpectrumABits = - { - null, - null, - new[] {HuffmanCodebooks.SpectrumA21Bits, HuffmanCodebooks.SpectrumA22Bits, HuffmanCodebooks.SpectrumA23Bits, HuffmanCodebooks.SpectrumA24Bits}, - new[] {HuffmanCodebooks.SpectrumA31Bits, HuffmanCodebooks.SpectrumA32Bits, HuffmanCodebooks.SpectrumA33Bits, HuffmanCodebooks.SpectrumA34Bits}, - new[] {HuffmanCodebooks.SpectrumA41Bits, HuffmanCodebooks.SpectrumA42Bits, HuffmanCodebooks.SpectrumA43Bits, HuffmanCodebooks.SpectrumA44Bits}, - new[] {HuffmanCodebooks.SpectrumA51Bits, HuffmanCodebooks.SpectrumA52Bits, HuffmanCodebooks.SpectrumA53Bits, HuffmanCodebooks.SpectrumA54Bits}, - new[] {HuffmanCodebooks.SpectrumA61Bits, HuffmanCodebooks.SpectrumA62Bits, HuffmanCodebooks.SpectrumA63Bits, HuffmanCodebooks.SpectrumA64Bits}, - new[] {HuffmanCodebooks.SpectrumA71Bits, HuffmanCodebooks.SpectrumA72Bits, HuffmanCodebooks.SpectrumA73Bits, HuffmanCodebooks.SpectrumA74Bits} - }; - - private static readonly short[][][] HuffmanSpectrumACodes = - { - null, - null, - new[] {HuffmanCodebooks.SpectrumA21Codes, HuffmanCodebooks.SpectrumA22Codes, HuffmanCodebooks.SpectrumA23Codes, HuffmanCodebooks.SpectrumA24Codes}, - new[] {HuffmanCodebooks.SpectrumA31Codes, HuffmanCodebooks.SpectrumA32Codes, HuffmanCodebooks.SpectrumA33Codes, HuffmanCodebooks.SpectrumA34Codes}, - new[] {HuffmanCodebooks.SpectrumA41Codes, HuffmanCodebooks.SpectrumA42Codes, HuffmanCodebooks.SpectrumA43Codes, HuffmanCodebooks.SpectrumA44Codes}, - new[] {HuffmanCodebooks.SpectrumA51Codes, HuffmanCodebooks.SpectrumA52Codes, HuffmanCodebooks.SpectrumA53Codes, HuffmanCodebooks.SpectrumA54Codes}, - new[] {HuffmanCodebooks.SpectrumA61Codes, HuffmanCodebooks.SpectrumA62Codes, HuffmanCodebooks.SpectrumA63Codes, HuffmanCodebooks.SpectrumA64Codes}, - new[] {HuffmanCodebooks.SpectrumA71Codes, HuffmanCodebooks.SpectrumA72Codes, HuffmanCodebooks.SpectrumA73Codes, HuffmanCodebooks.SpectrumA74Codes} - }; - - private static readonly byte[][] HuffmanSpectrumAGroupSizes = - { - new byte[] {0, 0, 0, 0}, - new byte[] {0, 0, 0, 0}, - new byte[] {1, 2, 2, 2}, - new byte[] {1, 1, 1, 1}, - new byte[] {1, 1, 1, 1}, - new byte[] {0, 0, 0, 0}, - new byte[] {0, 0, 0, 0}, - new byte[] {0, 0, 0, 0} - }; - - private static readonly byte[][][] HuffmanSpectrumBBits = - { - null, - null, - new[] {null, HuffmanCodebooks.SpectrumB22Bits, HuffmanCodebooks.SpectrumB23Bits, HuffmanCodebooks.SpectrumB24Bits}, - new[] {null, HuffmanCodebooks.SpectrumB32Bits, HuffmanCodebooks.SpectrumB33Bits, HuffmanCodebooks.SpectrumB34Bits}, - new[] {null, HuffmanCodebooks.SpectrumB42Bits, HuffmanCodebooks.SpectrumB43Bits, HuffmanCodebooks.SpectrumB44Bits}, - new[] {null, HuffmanCodebooks.SpectrumB52Bits, HuffmanCodebooks.SpectrumB53Bits, HuffmanCodebooks.SpectrumB54Bits}, - new[] {null, HuffmanCodebooks.SpectrumB62Bits, HuffmanCodebooks.SpectrumB63Bits, HuffmanCodebooks.SpectrumB64Bits}, - new[] {null, HuffmanCodebooks.SpectrumB72Bits, HuffmanCodebooks.SpectrumB73Bits, HuffmanCodebooks.SpectrumB74Bits} - }; - - private static readonly short[][][] HuffmanSpectrumBCodes = - { - null, - null, - new[] {null, HuffmanCodebooks.SpectrumB22Codes, HuffmanCodebooks.SpectrumB23Codes, HuffmanCodebooks.SpectrumB24Codes}, - new[] {null, HuffmanCodebooks.SpectrumB32Codes, HuffmanCodebooks.SpectrumB33Codes, HuffmanCodebooks.SpectrumB34Codes}, - new[] {null, HuffmanCodebooks.SpectrumB42Codes, HuffmanCodebooks.SpectrumB43Codes, HuffmanCodebooks.SpectrumB44Codes}, - new[] {null, HuffmanCodebooks.SpectrumB52Codes, HuffmanCodebooks.SpectrumB53Codes, HuffmanCodebooks.SpectrumB54Codes}, - new[] {null, HuffmanCodebooks.SpectrumB62Codes, HuffmanCodebooks.SpectrumB63Codes, HuffmanCodebooks.SpectrumB64Codes}, - new[] {null, HuffmanCodebooks.SpectrumB72Codes, HuffmanCodebooks.SpectrumB73Codes, HuffmanCodebooks.SpectrumB74Codes} - }; - - private static readonly byte[][] HuffmanSpectrumBGroupSizes = - { - new byte[] {0, 0, 0, 0}, - new byte[] {0, 0, 0, 0}, - new byte[] {0, 2, 2, 2}, - new byte[] {0, 1, 1, 1}, - new byte[] {0, 1, 1, 1}, - new byte[] {0, 0, 0, 0}, - new byte[] {0, 0, 0, 0}, - new byte[] {0, 0, 0, 0} - }; + } } diff --git a/CSharp/LibAtrac9/Unpack.cs b/CSharp/LibAtrac9/Unpack.cs index 3f1df17..29c25fe 100644 --- a/CSharp/LibAtrac9/Unpack.cs +++ b/CSharp/LibAtrac9/Unpack.cs @@ -235,14 +235,14 @@ void ReadHeader(Channel channel) { int bexMode = reader.ReadInt(2); channel.BexMode = bexBand > 2 ? bexMode : 4; - channel.BexValueCount = Tables.BexEncodedValueCounts[channel.BexMode][bexBand]; + channel.BexValueCount = BandExtension.BexEncodedValueCounts[channel.BexMode][bexBand]; } void ReadData(Channel channel) { for (int i = 0; i < channel.BexValueCount; i++) { - int dataLength = Tables.BexDataLengths[channel.BexMode][bexBand][i]; + int dataLength = BandExtension.BexDataLengths[channel.BexMode][bexBand][i]; channel.BexValues[i] = reader.ReadInt(dataLength); } }