Decompiled source of Custom Radio v0.1.1

plugins/CrackRadio/CrackRadio.dll

Decompiled 15 hours ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Text.RegularExpressions;
using System.Threading;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using CrackMods.Shared;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Mirror;
using SharpJaad.AAC;
using SharpJaad.AAC.Error;
using SharpJaad.AAC.Filterbank;
using SharpJaad.AAC.Gain;
using SharpJaad.AAC.Huffman;
using SharpJaad.AAC.Ps;
using SharpJaad.AAC.Sbr;
using SharpJaad.AAC.Syntax;
using SharpJaad.AAC.Tools;
using SharpJaad.AAC.Transport;
using Steamworks;
using UnityEngine;
using UnityEngine.Networking;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyCompany("CrackRadio")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("CrackRadio")]
[assembly: AssemblyTitle("CrackRadio")]
[assembly: AssemblyVersion("1.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace CrackMods.Shared
{
	internal static class ModHandshake
	{
		[HarmonyPatch(typeof(SteamLobby), "OnLobbyCreated")]
		private static class PublishPatch
		{
			private static void Postfix(SteamLobby __instance)
			{
				Publish(__instance);
			}
		}

		[HarmonyPatch(typeof(SteamLobby), "RefreshModdedLobbyData")]
		private static class RefreshPatch
		{
			private static void Postfix(SteamLobby __instance)
			{
				Publish(__instance);
			}
		}

		[HarmonyPatch(typeof(SteamLobby), "HostIsInLobby")]
		private static class JoinCheckPatch
		{
			private static bool Prefix(CSteamID lobby, ref bool __result)
			{
				//IL_000e: Unknown result type (might be due to invalid IL or missing references)
				if (!IsLeader(_ownGuid))
				{
					return true;
				}
				string lobbyData = SteamMatchmaking.GetLobbyData(lobby, "cmods");
				string text = LocalToken();
				if (lobbyData == text)
				{
					return true;
				}
				_pendingReason = Describe(lobbyData, text);
				Debug.LogWarning((object)("[CrackMods] refusing to join: " + _pendingReason));
				__result = false;
				return false;
			}
		}

		[HarmonyPatch(typeof(SteamLobby), "FailConnect")]
		private static class FailMessagePatch
		{
			private static void Prefix(ref string messageKey)
			{
				if (_pendingReason != null && !(messageKey != "Error_JoinFailed"))
				{
					messageKey = _pendingReason;
					_pendingReason = null;
				}
			}
		}

		internal const string GuidPrefix = "com.altma.crack.";

		private const string LobbyKey = "cmods";

		private static string _ownGuid;

		private static string _pendingReason;

		internal static string LocalToken()
		{
			List<string> list = new List<string>();
			foreach (KeyValuePair<string, PluginInfo> item in Chainloader.PluginInfos.OrderBy((KeyValuePair<string, PluginInfo> k) => k.Key))
			{
				if (item.Key.StartsWith("com.altma.crack."))
				{
					string text = item.Key.Substring("com.altma.crack.".Length) + "=" + item.Value.Metadata.Version;
					object instance = item.Value.Instance;
					PropertyInfo propertyInfo = ((instance != null) ? AccessTools.Property(instance.GetType(), "HandshakeExtra") : null);
					if (propertyInfo != null && propertyInfo.GetGetMethod() != null && propertyInfo.GetGetMethod().IsStatic)
					{
						text = text + "+" + propertyInfo.GetValue(null, null);
					}
					list.Add(text);
				}
			}
			return string.Join(";", list.ToArray());
		}

		private static bool IsLeader(string ownGuid)
		{
			string text = (from k in Chainloader.PluginInfos.Keys
				where k.StartsWith("com.altma.crack.")
				orderby k
				select k).FirstOrDefault();
			if (text != null)
			{
				return text == ownGuid;
			}
			return true;
		}

		internal static void Install(string ownGuid)
		{
			_ownGuid = ownGuid;
		}

		private static void Publish(SteamLobby lobby)
		{
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			if (IsLeader(_ownGuid) && !((Object)(object)lobby == (Object)null) && ((CSteamID)(ref lobby.currentLobbyID)).IsValid())
			{
				string text = LocalToken();
				SteamMatchmaking.SetLobbyData(lobby.currentLobbyID, "cmods", text);
				Debug.Log((object)("[CrackMods] lobby mods: " + text));
			}
		}

		internal static string Describe(string host, string local)
		{
			Dictionary<string, string> dictionary = Parse(host);
			Dictionary<string, string> dictionary2 = Parse(local);
			List<string> list = new List<string>();
			foreach (string item in from k in dictionary.Keys.Union(dictionary2.Keys)
				orderby k
				select k)
			{
				dictionary.TryGetValue(item, out var value);
				dictionary2.TryGetValue(item, out var value2);
				if (!(value == value2))
				{
					list.Add(item + ": host " + (value ?? "doesn't have it") + ", you " + (value2 ?? "don't have it"));
				}
			}
			return "CrackMods don't match the host. " + string.Join(". ", list.ToArray());
			static Dictionary<string, string> Parse(string s)
			{
				return (from p in (s ?? "").Split(new char[1] { ';' })
					where p.Contains("=")
					select p).ToDictionary((string p) => p.Substring(0, p.IndexOf('=')), (string p) => p.Substring(p.IndexOf('=') + 1));
			}
		}
	}
}
namespace SharpJaad.AAC
{
	public class AACException : IOException
	{
		private readonly bool _eos;

		public bool IsEndOfStream => _eos;

		public AACException(string message)
			: this(message, eos: false)
		{
		}

		public AACException(string message, bool eos)
			: base(message)
		{
			_eos = eos;
		}
	}
	public enum ChannelConfiguration
	{
		CHANNEL_CONFIG_UNSUPPORTED = -1,
		CHANNEL_CONFIG_NONE,
		CHANNEL_CONFIG_MONO,
		CHANNEL_CONFIG_STEREO,
		CHANNEL_CONFIG_STEREO_PLUS_CENTER,
		CHANNEL_CONFIG_STEREO_PLUS_CENTER_PLUS_REAR_MONO,
		CHANNEL_CONFIG_FIVE,
		CHANNEL_CONFIG_FIVE_PLUS_ONE,
		CHANNEL_CONFIG_SEVEN_PLUS_ONE
	}
	public class Decoder
	{
		private DecoderConfig _config;

		private SyntacticElements _syntacticElements;

		private FilterBank _filterBank;

		private BitStream _input;

		private ADIFHeader _adifHeader;

		public static bool CanDecode(Profile profile)
		{
			return profile.IsDecodingSupported();
		}

		public Decoder(byte[] decoderSpecificInfo)
		{
			_config = DecoderConfig.ParseMP4DecoderSpecificInfo(decoderSpecificInfo);
			if (_config == null)
			{
				throw new InvalidEnumArgumentException("illegal MP4 decoder specific info");
			}
			if (!CanDecode(_config.GetProfile()))
			{
				throw new AACException("unsupported profile: " + _config.GetProfile());
			}
			_syntacticElements = new SyntacticElements(_config);
			_filterBank = new FilterBank(_config.IsSmallFrameUsed(), (int)_config.GetChannelConfiguration());
			_input = new BitStream();
		}

		public Decoder(DecoderConfig cfg)
		{
			_config = cfg ?? throw new InvalidEnumArgumentException("illegal MP4 decoder specific info");
			if (!CanDecode(_config.GetProfile()))
			{
				throw new AACException("unsupported profile: " + _config.GetProfile());
			}
			_syntacticElements = new SyntacticElements(_config);
			_filterBank = new FilterBank(_config.IsSmallFrameUsed(), (int)_config.GetChannelConfiguration());
			_input = new BitStream();
		}

		public DecoderConfig GetConfig()
		{
			return _config;
		}

		public void DecodeFrame(byte[] frame, SampleBuffer buffer)
		{
			if (frame != null)
			{
				_input.SetData(frame);
			}
			try
			{
				Decode(buffer);
			}
			catch (AACException ex)
			{
				if (!ex.IsEndOfStream)
				{
					throw ex;
				}
			}
		}

		private void Decode(SampleBuffer buffer)
		{
			if (ADIFHeader.IsPresent(_input))
			{
				_adifHeader = ADIFHeader.ReadHeader(_input);
				PCE firstPCE = _adifHeader.GetFirstPCE();
				_config.SetProfile(firstPCE.GetProfile());
				_config.SetSampleFrequency(firstPCE.GetSampleFrequency());
				_config.SetChannelConfiguration((ChannelConfiguration)firstPCE.GetChannelCount());
			}
			if (!CanDecode(_config.GetProfile()))
			{
				throw new AACException("unsupported profile: " + _config.GetProfile());
			}
			_syntacticElements.StartNewFrame();
			try
			{
				_syntacticElements.Decode(_input);
				_syntacticElements.Process(_filterBank);
				_syntacticElements.SendToOutput(buffer);
			}
			catch (AACException ex)
			{
				buffer.SetData(new byte[0], 0, 0, 0, 0);
				throw ex;
			}
			catch (Exception ex2)
			{
				buffer.SetData(new byte[0], 0, 0, 0, 0);
				throw new AACException(ex2.Message);
			}
		}
	}
	public class DecoderConfig
	{
		private Profile _profile;

		private Profile _extProfile;

		private SampleFrequency _sampleFrequency;

		private ChannelConfiguration _channelConfiguration;

		private bool _frameLengthFlag;

		private bool _dependsOnCoreCoder;

		private int _coreCoderDelay;

		private bool _extensionFlag;

		private bool _sbrPresent;

		private bool _downSampledSBR;

		private bool _sbrEnabled;

		private bool _sectionDataResilience;

		private bool _scalefactorResilience;

		private bool _spectralDataResilience;

		public DecoderConfig()
		{
			_profile = Profile.AAC_MAIN;
			_extProfile = Profile.UNKNOWN;
			_sampleFrequency = SampleFrequency.SAMPLE_FREQUENCY_NONE;
			_channelConfiguration = ChannelConfiguration.CHANNEL_CONFIG_UNSUPPORTED;
			_frameLengthFlag = false;
			_sbrPresent = false;
			_downSampledSBR = false;
			_sbrEnabled = true;
			_sectionDataResilience = false;
			_scalefactorResilience = false;
			_spectralDataResilience = false;
		}

		public void SetSBRPresent(bool sbr)
		{
			_sbrPresent = sbr;
		}

		public void SetSBRDownsampled(bool sbr)
		{
			_downSampledSBR = sbr;
		}

		public ChannelConfiguration GetChannelConfiguration()
		{
			return _channelConfiguration;
		}

		public void SetChannelConfiguration(ChannelConfiguration channelConfiguration)
		{
			_channelConfiguration = channelConfiguration;
		}

		public int GetCoreCoderDelay()
		{
			return _coreCoderDelay;
		}

		public void SetCoreCoderDelay(int coreCoderDelay)
		{
			_coreCoderDelay = coreCoderDelay;
		}

		public bool IsDependsOnCoreCoder()
		{
			return _dependsOnCoreCoder;
		}

		public void SetDependsOnCoreCoder(bool dependsOnCoreCoder)
		{
			_dependsOnCoreCoder = dependsOnCoreCoder;
		}

		public Profile GetExtObjectType()
		{
			return _extProfile;
		}

		public void SetExtObjectType(Profile extObjectType)
		{
			_extProfile = extObjectType;
		}

		public int GetFrameLength()
		{
			if (!_frameLengthFlag)
			{
				return 1024;
			}
			return 960;
		}

		public bool IsSmallFrameUsed()
		{
			return _frameLengthFlag;
		}

		public void SetSmallFrameUsed(bool shortFrame)
		{
			_frameLengthFlag = shortFrame;
		}

		public Profile GetProfile()
		{
			return _profile;
		}

		public void SetProfile(Profile profile)
		{
			_profile = profile;
		}

		public SampleFrequency GetSampleFrequency()
		{
			return _sampleFrequency;
		}

		public void SetSampleFrequency(SampleFrequency sampleFrequency)
		{
			_sampleFrequency = sampleFrequency;
		}

		public bool IsSBRPresent()
		{
			return _sbrPresent;
		}

		public bool IsSBRDownSampled()
		{
			return _downSampledSBR;
		}

		public bool IsSBREnabled()
		{
			return _sbrEnabled;
		}

		public void IetSBREnabled(bool enabled)
		{
			_sbrEnabled = enabled;
		}

		public bool IsScalefactorResilienceUsed()
		{
			return _scalefactorResilience;
		}

		public bool IsSectionDataResilienceUsed()
		{
			return _sectionDataResilience;
		}

		public bool IsSpectralDataResilienceUsed()
		{
			return _spectralDataResilience;
		}

		public static DecoderConfig ParseMP4DecoderSpecificInfo(byte[] data)
		{
			BitStream bitStream = new BitStream(data);
			DecoderConfig decoderConfig = new DecoderConfig();
			try
			{
				decoderConfig._profile = ReadProfile(bitStream);
				int num = bitStream.ReadBits(4);
				if (num == 15)
				{
					decoderConfig._sampleFrequency = SampleFrequencyExtensions.FromFrequency(bitStream.ReadBits(24));
				}
				else
				{
					decoderConfig._sampleFrequency = (SampleFrequency)num;
				}
				decoderConfig._channelConfiguration = (ChannelConfiguration)bitStream.ReadBits(4);
				switch (decoderConfig._profile)
				{
				case Profile.AAC_SBR:
					decoderConfig._extProfile = decoderConfig._profile;
					decoderConfig._sbrPresent = true;
					num = bitStream.ReadBits(4);
					decoderConfig._downSampledSBR = decoderConfig._sampleFrequency == (SampleFrequency)num;
					decoderConfig._sampleFrequency = (SampleFrequency)num;
					decoderConfig._profile = ReadProfile(bitStream);
					break;
				case Profile.AAC_MAIN:
				case Profile.AAC_LC:
				case Profile.AAC_SSR:
				case Profile.AAC_LTP:
				case Profile.ER_AAC_LC:
				case Profile.ER_AAC_LTP:
				case Profile.ER_AAC_LD:
					decoderConfig._frameLengthFlag = bitStream.ReadBool();
					if (decoderConfig._frameLengthFlag)
					{
						throw new AACException("config uses 960-sample frames, not yet supported");
					}
					decoderConfig._dependsOnCoreCoder = bitStream.ReadBool();
					if (decoderConfig._dependsOnCoreCoder)
					{
						decoderConfig._coreCoderDelay = bitStream.ReadBits(14);
					}
					else
					{
						decoderConfig._coreCoderDelay = 0;
					}
					decoderConfig._extensionFlag = bitStream.ReadBool();
					if (decoderConfig._extensionFlag)
					{
						if (decoderConfig._profile.IsErrorResilientProfile())
						{
							decoderConfig._sectionDataResilience = bitStream.ReadBool();
							decoderConfig._scalefactorResilience = bitStream.ReadBool();
							decoderConfig._spectralDataResilience = bitStream.ReadBool();
						}
						bitStream.SkipBit();
					}
					if (decoderConfig._channelConfiguration == ChannelConfiguration.CHANNEL_CONFIG_NONE)
					{
						bitStream.SkipBits(3);
						PCE pCE = new PCE();
						pCE.Decode(bitStream);
						decoderConfig._profile = pCE.GetProfile();
						decoderConfig._sampleFrequency = pCE.GetSampleFrequency();
						decoderConfig._channelConfiguration = (ChannelConfiguration)pCE.GetChannelCount();
					}
					if (bitStream.GetBitsLeft() > 10)
					{
						ReadSyncExtension(bitStream, decoderConfig);
					}
					break;
				default:
				{
					int profile = (int)decoderConfig._profile;
					throw new AACException("profile not supported: " + profile);
				}
				}
				return decoderConfig;
			}
			finally
			{
				bitStream.Destroy();
			}
		}

		private static Profile ReadProfile(BitStream input)
		{
			int num = input.ReadBits(5);
			if (num == 31)
			{
				num = 32 + input.ReadBits(6);
			}
			return (Profile)num;
		}

		private static void ReadSyncExtension(BitStream input, DecoderConfig config)
		{
			if (input.ReadBits(11) != 695)
			{
				return;
			}
			Profile profile = (Profile)input.ReadBits(5);
			if (!profile.Equals(Profile.AAC_SBR))
			{
				return;
			}
			config._sbrPresent = input.ReadBool();
			if (config._sbrPresent)
			{
				config._profile = profile;
				int num = input.ReadBits(4);
				if (num == (int)config._sampleFrequency)
				{
					config._downSampledSBR = true;
				}
				if (num == 15)
				{
					throw new AACException("sample rate specified explicitly, not supported yet!");
				}
			}
		}
	}
	public enum Profile
	{
		UNKNOWN = -1,
		AAC_MAIN = 1,
		AAC_LC = 2,
		AAC_SSR = 3,
		AAC_LTP = 4,
		AAC_SBR = 5,
		AAC_SCALABLE = 6,
		TWIN_VQ = 7,
		AAC_LD = 11,
		ER_AAC_LC = 17,
		ER_AAC_SSR = 18,
		ER_AAC_LTP = 19,
		ER_AAC_SCALABLE = 20,
		ER_TWIN_VQ = 21,
		ER_BSAC = 22,
		ER_AAC_LD = 23
	}
	public static class ProfileExtensions
	{
		public static bool IsErrorResilientProfile(this Profile profile)
		{
			return profile > (Profile)16;
		}

		public static bool IsDecodingSupported(this Profile profile)
		{
			if (profile != Profile.AAC_MAIN && profile != Profile.AAC_LC && profile != Profile.AAC_SBR && profile != Profile.ER_AAC_LC && profile != Profile.AAC_LTP)
			{
				return profile == Profile.ER_AAC_LTP;
			}
			return true;
		}
	}
	public class SampleBuffer
	{
		public int SampleRate { get; private set; }

		public int Channels { get; private set; }

		public int BitsPerSample { get; private set; }

		public double Length { get; private set; }

		public double Bitrate { get; private set; }

		public double EncodedBitrate { get; private set; }

		public byte[] Data { get; private set; }

		public bool BigEndian { get; private set; }

		public SampleBuffer()
		{
			Data = new byte[0];
			SampleRate = 0;
			Channels = 0;
			BitsPerSample = 0;
			BigEndian = true;
		}

		public void SetBigEndian(bool bigEndian)
		{
			if (bigEndian != BigEndian)
			{
				for (int i = 0; i < Data.Length; i += 2)
				{
					byte b = Data[i];
					Data[i] = Data[i + 1];
					Data[i + 1] = b;
				}
				BigEndian = bigEndian;
			}
		}

		public void SetData(byte[] data, int sampleRate, int channels, int bitsPerSample, int bitsRead)
		{
			Data = data;
			SampleRate = sampleRate;
			Channels = channels;
			BitsPerSample = bitsPerSample;
			if (sampleRate == 0)
			{
				Length = 0.0;
				Bitrate = 0.0;
				EncodedBitrate = 0.0;
			}
			else
			{
				int num = bitsPerSample / 8;
				int num2 = data.Length / (num * channels);
				Length = (double)num2 / (double)sampleRate;
				Bitrate = (double)(num2 * bitsPerSample * channels) / Length;
				EncodedBitrate = (double)bitsRead / Length;
			}
		}
	}
	public enum SampleFrequency
	{
		SAMPLE_FREQUENCY_96000 = 0,
		SAMPLE_FREQUENCY_88200 = 1,
		SAMPLE_FREQUENCY_64000 = 2,
		SAMPLE_FREQUENCY_48000 = 3,
		SAMPLE_FREQUENCY_44100 = 4,
		SAMPLE_FREQUENCY_32000 = 5,
		SAMPLE_FREQUENCY_24000 = 6,
		SAMPLE_FREQUENCY_22050 = 7,
		SAMPLE_FREQUENCY_16000 = 8,
		SAMPLE_FREQUENCY_12000 = 9,
		SAMPLE_FREQUENCY_11025 = 10,
		SAMPLE_FREQUENCY_8000 = 11,
		SAMPLE_FREQUENCY_NONE = -1
	}
	public static class SampleFrequencyExtensions
	{
		public static SampleFrequency FromFrequency(int frequency)
		{
			return frequency switch
			{
				96000 => SampleFrequency.SAMPLE_FREQUENCY_96000, 
				88200 => SampleFrequency.SAMPLE_FREQUENCY_88200, 
				64000 => SampleFrequency.SAMPLE_FREQUENCY_64000, 
				48000 => SampleFrequency.SAMPLE_FREQUENCY_48000, 
				44100 => SampleFrequency.SAMPLE_FREQUENCY_44100, 
				32000 => SampleFrequency.SAMPLE_FREQUENCY_32000, 
				24000 => SampleFrequency.SAMPLE_FREQUENCY_24000, 
				22050 => SampleFrequency.SAMPLE_FREQUENCY_22050, 
				16000 => SampleFrequency.SAMPLE_FREQUENCY_16000, 
				12000 => SampleFrequency.SAMPLE_FREQUENCY_12000, 
				11025 => SampleFrequency.SAMPLE_FREQUENCY_11025, 
				8000 => SampleFrequency.SAMPLE_FREQUENCY_8000, 
				_ => SampleFrequency.SAMPLE_FREQUENCY_NONE, 
			};
		}

		public static int GetFrequency(this SampleFrequency frequency)
		{
			return frequency switch
			{
				SampleFrequency.SAMPLE_FREQUENCY_96000 => 96000, 
				SampleFrequency.SAMPLE_FREQUENCY_88200 => 88200, 
				SampleFrequency.SAMPLE_FREQUENCY_64000 => 64000, 
				SampleFrequency.SAMPLE_FREQUENCY_48000 => 48000, 
				SampleFrequency.SAMPLE_FREQUENCY_44100 => 44100, 
				SampleFrequency.SAMPLE_FREQUENCY_32000 => 32000, 
				SampleFrequency.SAMPLE_FREQUENCY_24000 => 24000, 
				SampleFrequency.SAMPLE_FREQUENCY_22050 => 22050, 
				SampleFrequency.SAMPLE_FREQUENCY_16000 => 16000, 
				SampleFrequency.SAMPLE_FREQUENCY_12000 => 12000, 
				SampleFrequency.SAMPLE_FREQUENCY_11025 => 11025, 
				SampleFrequency.SAMPLE_FREQUENCY_8000 => 8000, 
				_ => 0, 
			};
		}

		public static int GetMaximalPredictionSFB(this SampleFrequency frequency)
		{
			switch (frequency)
			{
			case SampleFrequency.SAMPLE_FREQUENCY_96000:
			case SampleFrequency.SAMPLE_FREQUENCY_88200:
				return 33;
			case SampleFrequency.SAMPLE_FREQUENCY_64000:
				return 38;
			case SampleFrequency.SAMPLE_FREQUENCY_48000:
			case SampleFrequency.SAMPLE_FREQUENCY_44100:
			case SampleFrequency.SAMPLE_FREQUENCY_32000:
				return 40;
			case SampleFrequency.SAMPLE_FREQUENCY_24000:
			case SampleFrequency.SAMPLE_FREQUENCY_22050:
				return 41;
			case SampleFrequency.SAMPLE_FREQUENCY_16000:
			case SampleFrequency.SAMPLE_FREQUENCY_12000:
			case SampleFrequency.SAMPLE_FREQUENCY_11025:
				return 37;
			case SampleFrequency.SAMPLE_FREQUENCY_8000:
				return 34;
			default:
				return 0;
			}
		}

		public static int GetPredictorCount(this SampleFrequency frequency)
		{
			switch (frequency)
			{
			case SampleFrequency.SAMPLE_FREQUENCY_96000:
			case SampleFrequency.SAMPLE_FREQUENCY_88200:
				return 512;
			case SampleFrequency.SAMPLE_FREQUENCY_64000:
				return 664;
			case SampleFrequency.SAMPLE_FREQUENCY_48000:
			case SampleFrequency.SAMPLE_FREQUENCY_44100:
			case SampleFrequency.SAMPLE_FREQUENCY_32000:
				return 672;
			case SampleFrequency.SAMPLE_FREQUENCY_24000:
			case SampleFrequency.SAMPLE_FREQUENCY_22050:
				return 652;
			case SampleFrequency.SAMPLE_FREQUENCY_16000:
			case SampleFrequency.SAMPLE_FREQUENCY_12000:
			case SampleFrequency.SAMPLE_FREQUENCY_11025:
			case SampleFrequency.SAMPLE_FREQUENCY_8000:
				return 664;
			default:
				return 0;
			}
		}

		public static int GetMaximalTNS_SFB(this SampleFrequency frequency, bool shortWindow)
		{
			switch (frequency)
			{
			case SampleFrequency.SAMPLE_FREQUENCY_96000:
			case SampleFrequency.SAMPLE_FREQUENCY_88200:
				return shortWindow ? 9 : 31;
			case SampleFrequency.SAMPLE_FREQUENCY_64000:
				return shortWindow ? 10 : 34;
			case SampleFrequency.SAMPLE_FREQUENCY_48000:
				return shortWindow ? 14 : 40;
			case SampleFrequency.SAMPLE_FREQUENCY_44100:
				return shortWindow ? 14 : 42;
			case SampleFrequency.SAMPLE_FREQUENCY_32000:
				return shortWindow ? 14 : 51;
			case SampleFrequency.SAMPLE_FREQUENCY_24000:
			case SampleFrequency.SAMPLE_FREQUENCY_22050:
				return shortWindow ? 14 : 46;
			case SampleFrequency.SAMPLE_FREQUENCY_16000:
			case SampleFrequency.SAMPLE_FREQUENCY_12000:
			case SampleFrequency.SAMPLE_FREQUENCY_11025:
				return shortWindow ? 14 : 42;
			case SampleFrequency.SAMPLE_FREQUENCY_8000:
				return shortWindow ? 14 : 39;
			default:
				return 0;
			}
		}
	}
}
namespace SharpJaad.AAC.Transport
{
	public sealed class ADIFHeader
	{
		private const long ADIF_ID = 1094994246L;

		private long _id;

		private bool _copyrightIDPresent;

		private byte[] _copyrightID;

		private bool _originalCopy;

		private bool _home;

		private bool _bitstreamType;

		private int _bitrate;

		private int _pceCount;

		private int[] _adifBufferFullness;

		private PCE[] _pces;

		public static bool IsPresent(BitStream input)
		{
			return (long)input.PeekBits(32) == 1094994246;
		}

		private ADIFHeader()
		{
			_copyrightID = new byte[9];
		}

		public static ADIFHeader ReadHeader(BitStream input)
		{
			ADIFHeader aDIFHeader = new ADIFHeader();
			aDIFHeader.Decode(input);
			return aDIFHeader;
		}

		private void Decode(BitStream input)
		{
			_id = input.ReadBits(32);
			_copyrightIDPresent = input.ReadBool();
			if (_copyrightIDPresent)
			{
				for (int i = 0; i < 9; i++)
				{
					_copyrightID[i] = (byte)input.ReadBits(8);
				}
			}
			_originalCopy = input.ReadBool();
			_home = input.ReadBool();
			_bitstreamType = input.ReadBool();
			_bitrate = input.ReadBits(23);
			_pceCount = input.ReadBits(4) + 1;
			_pces = new PCE[_pceCount];
			_adifBufferFullness = new int[_pceCount];
			for (int i = 0; i < _pceCount; i++)
			{
				if (_bitstreamType)
				{
					_adifBufferFullness[i] = -1;
				}
				else
				{
					_adifBufferFullness[i] = input.ReadBits(20);
				}
				_pces[i] = new PCE();
				_pces[i].Decode(input);
			}
		}

		public PCE GetFirstPCE()
		{
			return _pces[0];
		}
	}
}
namespace SharpJaad.AAC.Tools
{
	internal class Arrays
	{
		public static void Fill<T>(T[] array, T value)
		{
			Fill(array, 0, array.Length, value);
		}

		public static void Fill<T>(T[] array, int fromIndex, int toIndex, T value)
		{
			for (int i = fromIndex; i < toIndex; i++)
			{
				array[i] = value;
			}
		}
	}
	public class ICPrediction
	{
		private sealed class PredictorState
		{
			public float _cor0;

			public float _cor1;

			public float _var0;

			public float _var1;

			public float _r0 = 1f;

			public float _r1 = 1f;
		}

		private const float SF_SCALE = -0.0009765625f;

		private const float INV_SF_SCALE = -1024f;

		private const int MAX_PREDICTORS = 672;

		private const float A = 61f / 64f;

		private const float ALPHA = 29f / 32f;

		private bool _predictorReset;

		private int _predictorResetGroup;

		private bool[] _predictionUsed;

		private PredictorState[] _states;

		public ICPrediction()
		{
			_states = new PredictorState[672];
			ResetAllPredictors();
		}

		public void Decode(BitStream input, int maxSFB, SampleFrequency sf)
		{
			sf.GetPredictorCount();
			if (_predictorReset = input.ReadBool())
			{
				_predictorResetGroup = input.ReadBits(5);
			}
			int maximalPredictionSFB = sf.GetMaximalPredictionSFB();
			int num = Math.Min(maxSFB, maximalPredictionSFB);
			_predictionUsed = new bool[num];
			for (int i = 0; i < num; i++)
			{
				_predictionUsed[i] = input.ReadBool();
			}
		}

		public void SetPredictionUnused(int sfb)
		{
			_predictionUsed[sfb] = false;
		}

		public void Process(ICStream ics, float[] data, SampleFrequency sf)
		{
			ICSInfo info = ics.GetInfo();
			if (info.IsEightShortFrame())
			{
				ResetAllPredictors();
				return;
			}
			int num = Math.Min(sf.GetMaximalPredictionSFB(), info.GetMaxSFB());
			int[] sWBOffsets = info.GetSWBOffsets();
			for (int i = 0; i < num; i++)
			{
				for (int j = sWBOffsets[i]; j < sWBOffsets[i + 1]; j++)
				{
					Predict(data, j, _predictionUsed[i]);
				}
			}
			if (_predictorReset)
			{
				ResetPredictorGroup(_predictorResetGroup);
			}
		}

		private void ResetPredictState(int index)
		{
			if (_states[index] == null)
			{
				_states[index] = new PredictorState();
			}
			_states[index]._r0 = 0f;
			_states[index]._r1 = 0f;
			_states[index]._cor0 = 0f;
			_states[index]._cor1 = 0f;
			_states[index]._var0 = 16256f;
			_states[index]._var1 = 16256f;
		}

		private void ResetAllPredictors()
		{
			for (int i = 0; i < _states.Length; i++)
			{
				ResetPredictState(i);
			}
		}

		private void ResetPredictorGroup(int group)
		{
			for (int i = group - 1; i < _states.Length; i += 30)
			{
				ResetPredictState(i);
			}
		}

		private void Predict(float[] data, int off, bool output)
		{
			if (_states[off] == null)
			{
				_states[off] = new PredictorState();
			}
			PredictorState obj = _states[off];
			float r = obj._r0;
			float r2 = obj._r1;
			float cor = obj._cor0;
			float cor2 = obj._cor1;
			float var = obj._var0;
			float var2 = obj._var1;
			float num = ((var > 1f) ? (cor * Even(61f / 64f / var)) : 0f);
			float num2 = ((var2 > 1f) ? (cor2 * Even(61f / 64f / var2)) : 0f);
			float num3 = Round(num * r + num2 * r2);
			if (output)
			{
				data[off] += num3 * -0.0009765625f;
			}
			float num4 = data[off] * -1024f;
			float num5 = num4 - num * r;
			obj._cor1 = Trunc(29f / 32f * cor2 + r2 * num5);
			obj._var1 = Trunc(29f / 32f * var2 + 0.5f * (r2 * r2 + num5 * num5));
			obj._cor0 = Trunc(29f / 32f * cor + r * num4);
			obj._var0 = Trunc(29f / 32f * var + 0.5f * (r * r + num4 * num4));
			obj._r1 = Trunc(61f / 64f * (r - num * num4));
			obj._r0 = Trunc(61f / 64f * num4);
		}

		private float Round(float pf)
		{
			return IntBitsToFloat((int)((FloatToIntBits(pf) + 32768) & 0xFFFF0000u));
		}

		private float Even(float pf)
		{
			int num = FloatToIntBits(pf);
			num = (int)((num + 32767 + (num & 1)) & 0xFFFF0000u);
			return IntBitsToFloat(num);
		}

		private float Trunc(float pf)
		{
			return IntBitsToFloat((int)(FloatToIntBits(pf) & 0xFFFF0000u));
		}

		private static int FloatToIntBits(float f)
		{
			return BitConverter.ToInt32(BitConverter.GetBytes(f), 0);
		}

		private static float IntBitsToFloat(int i)
		{
			return BitConverter.ToSingle(BitConverter.GetBytes(i), 0);
		}
	}
	public class IS
	{
		public static void Process(CPE cpe, float[] specL, float[] specR)
		{
			ICStream rightChannel = cpe.GetRightChannel();
			ICSInfo info = rightChannel.GetInfo();
			int[] sWBOffsets = info.GetSWBOffsets();
			int windowGroupCount = info.GetWindowGroupCount();
			int maxSFB = info.GetMaxSFB();
			int[] sfbCB = rightChannel.getSfbCB();
			int[] sectEnd = rightChannel.GetSectEnd();
			float[] scaleFactors = rightChannel.GetScaleFactors();
			int num = 0;
			int num2 = 0;
			for (int i = 0; i < windowGroupCount; i++)
			{
				int num3 = 0;
				while (num3 < maxSFB)
				{
					if (sfbCB[num] == 15 || sfbCB[num] == 14)
					{
						int num4 = sectEnd[num];
						while (num3 < num4)
						{
							int num5 = ((sfbCB[num] == 15) ? 1 : (-1));
							if (cpe.IsMSMaskPresent())
							{
								num5 *= ((!cpe.IsMSUsed(num)) ? 1 : (-1));
							}
							float num6 = (float)num5 * scaleFactors[num];
							for (int j = 0; j < info.GetWindowGroupLength(i); j++)
							{
								int num7 = num2 + j * 128 + sWBOffsets[num3];
								for (int k = 0; k < sWBOffsets[num3 + 1] - sWBOffsets[num3]; k++)
								{
									specR[num7 + k] = specL[num7 + k] * num6;
								}
							}
							num3++;
							num++;
						}
					}
					else
					{
						int num4 = sectEnd[num];
						num += num4 - num3;
						num3 = num4;
					}
				}
				num2 += info.GetWindowGroupLength(i) * 128;
			}
		}
	}
	public static class ISScaleTable
	{
		public static float[] SCALE_TABLE = new float[255]
		{
			1f,
			0.8408964f,
			0.70710677f,
			0.59460354f,
			0.5f,
			0.4204482f,
			0.35355338f,
			0.29730177f,
			0.25f,
			0.2102241f,
			0.17677669f,
			0.14865088f,
			0.125f,
			0.10511205f,
			0.088388346f,
			0.07432544f,
			0.0625f,
			0.052556027f,
			0.044194173f,
			0.03716272f,
			1f / 32f,
			0.026278013f,
			0.022097087f,
			0.01858136f,
			1f / 64f,
			0.013139007f,
			0.011048543f,
			0.00929068f,
			1f / 128f,
			0.0065695033f,
			0.0055242716f,
			0.00464534f,
			0.00390625f,
			0.0032847517f,
			0.0027621358f,
			0.00232267f,
			0.001953125f,
			0.0016423758f,
			0.0013810679f,
			0.001161335f,
			0.0009765625f,
			0.0008211879f,
			0.00069053395f,
			0.0005806675f,
			0.00048828125f,
			0.00041059396f,
			0.00034526698f,
			0.00029033376f,
			0.00024414062f,
			0.00020529698f,
			0.00017263349f,
			0.00014516688f,
			0.00012207031f,
			0.00010264849f,
			8.6316744E-05f,
			7.258344E-05f,
			6.1035156E-05f,
			5.1324245E-05f,
			4.3158372E-05f,
			3.629172E-05f,
			3.0517578E-05f,
			2.5662122E-05f,
			2.1579186E-05f,
			1.814586E-05f,
			1.5258789E-05f,
			1.2831061E-05f,
			1.0789593E-05f,
			9.07293E-06f,
			7.6293945E-06f,
			6.4155306E-06f,
			5.3947965E-06f,
			4.536465E-06f,
			3.8146973E-06f,
			3.2077653E-06f,
			2.6973983E-06f,
			2.2682325E-06f,
			1.9073486E-06f,
			1.6038827E-06f,
			1.3486991E-06f,
			1.1341162E-06f,
			9.536743E-07f,
			8.019413E-07f,
			6.7434956E-07f,
			5.670581E-07f,
			4.7683716E-07f,
			4.0097066E-07f,
			3.3717478E-07f,
			2.8352906E-07f,
			2.3841858E-07f,
			2.0048533E-07f,
			1.6858739E-07f,
			1.4176453E-07f,
			1.1920929E-07f,
			1.00242666E-07f,
			8.4293696E-08f,
			7.0882265E-08f,
			5.9604645E-08f,
			5.0121333E-08f,
			4.2146848E-08f,
			3.5441133E-08f,
			2.9802322E-08f,
			2.5060666E-08f,
			2.1073424E-08f,
			1.7720566E-08f,
			1.4901161E-08f,
			1.2530333E-08f,
			1.0536712E-08f,
			8.860283E-09f,
			7.450581E-09f,
			6.2651666E-09f,
			5.268356E-09f,
			4.4301416E-09f,
			3.7252903E-09f,
			3.1325833E-09f,
			2.634178E-09f,
			2.2150708E-09f,
			1.8626451E-09f,
			1.5662917E-09f,
			1.317089E-09f,
			1.1075354E-09f,
			9.313226E-10f,
			7.831458E-10f,
			6.585445E-10f,
			5.537677E-10f,
			4.656613E-10f,
			3.915729E-10f,
			3.2927225E-10f,
			2.7688385E-10f,
			2.3283064E-10f,
			1.9578646E-10f,
			1.6463612E-10f,
			1.3844192E-10f,
			1.1641532E-10f,
			9.789323E-11f,
			8.231806E-11f,
			6.922096E-11f,
			5.820766E-11f,
			4.8946614E-11f,
			4.115903E-11f,
			3.461048E-11f,
			2.910383E-11f,
			2.4473307E-11f,
			2.0579516E-11f,
			1.730524E-11f,
			1.4551915E-11f,
			1.22366535E-11f,
			1.0289758E-11f,
			8.65262E-12f,
			7.275958E-12f,
			6.1183268E-12f,
			5.144879E-12f,
			4.32631E-12f,
			3.637979E-12f,
			3.0591634E-12f,
			2.5724394E-12f,
			2.163155E-12f,
			1.8189894E-12f,
			1.5295817E-12f,
			1.2862197E-12f,
			1.0815775E-12f,
			9.094947E-13f,
			7.6479085E-13f,
			6.4310986E-13f,
			5.4078877E-13f,
			4.5474735E-13f,
			3.8239542E-13f,
			3.2155493E-13f,
			2.7039438E-13f,
			2.2737368E-13f,
			1.9119771E-13f,
			1.6077747E-13f,
			1.3519719E-13f,
			1.1368684E-13f,
			9.5598856E-14f,
			8.038873E-14f,
			6.7598596E-14f,
			5.684342E-14f,
			4.7799428E-14f,
			4.0194366E-14f,
			3.3799298E-14f,
			2.842171E-14f,
			2.3899714E-14f,
			2.0097183E-14f,
			1.6899649E-14f,
			1.4210855E-14f,
			1.1949857E-14f,
			1.00485916E-14f,
			8.4498245E-15f,
			7.1054274E-15f,
			5.9749285E-15f,
			5.0242958E-15f,
			4.2249122E-15f,
			3.5527137E-15f,
			2.9874642E-15f,
			2.5121479E-15f,
			2.1124561E-15f,
			1.7763568E-15f,
			1.4937321E-15f,
			1.2560739E-15f,
			1.0562281E-15f,
			8.881784E-16f,
			7.4686606E-16f,
			6.2803697E-16f,
			5.2811403E-16f,
			4.440892E-16f,
			3.7343303E-16f,
			3.1401849E-16f,
			2.6405702E-16f,
			2.220446E-16f,
			1.8671652E-16f,
			1.5700924E-16f,
			1.3202851E-16f,
			1.110223E-16f,
			9.335826E-17f,
			7.850462E-17f,
			6.6014254E-17f,
			5.551115E-17f,
			4.667913E-17f,
			3.925231E-17f,
			3.3007127E-17f,
			2.7755576E-17f,
			2.3339564E-17f,
			1.9626155E-17f,
			1.6503563E-17f,
			1.3877788E-17f,
			1.1669782E-17f,
			9.813078E-18f,
			8.251782E-18f,
			6.938894E-18f,
			5.834891E-18f,
			4.906539E-18f,
			4.125891E-18f,
			3.469447E-18f,
			2.9174455E-18f,
			2.4532694E-18f,
			2.0629454E-18f,
			1.7347235E-18f,
			1.4587228E-18f,
			1.2266347E-18f,
			1.0314727E-18f,
			8.6736174E-19f,
			7.293614E-19f,
			6.1331736E-19f,
			5.1573636E-19f,
			4.3368087E-19f,
			3.646807E-19f,
			3.0665868E-19f,
			2.5786818E-19f,
			2.1684043E-19f,
			1.8234035E-19f,
			1.5332934E-19f,
			1.2893409E-19f,
			1.0842022E-19f,
			9.1170173E-20f,
			7.666467E-20f
		};
	}
	public class LTPrediction
	{
		private static readonly float[] CODEBOOK = new float[8] { 0.570829f, 0.696616f, 0.813004f, 0.911304f, 0.9849f, 1.067894f, 1.194601f, 1.369533f };

		private bool _isPresent;

		private int _frameLength;

		private int[] _states;

		private int _coef;

		private int _lag;

		private int _lastBand;

		private bool _lagUpdate;

		private bool[] _shortUsed;

		private bool[] _shortLagPresent;

		private bool[] _longUsed;

		private int[] _shortLag;

		public LTPrediction(int frameLength)
		{
			_frameLength = frameLength;
			_states = new int[4 * frameLength];
		}

		public bool IsPresent()
		{
			return _isPresent;
		}

		public void Decode(BitStream input, ICSInfo info, Profile profile)
		{
			_lag = 0;
			_isPresent = input.ReadBool();
			if (!_isPresent)
			{
				return;
			}
			if (profile.Equals(Profile.AAC_LD))
			{
				_lagUpdate = input.ReadBool();
				if (_lagUpdate)
				{
					_lag = input.ReadBits(10);
				}
			}
			else
			{
				_lag = input.ReadBits(11);
			}
			if (_lag > _frameLength << 1)
			{
				throw new AACException("LTP lag too large: " + _lag);
			}
			_coef = input.ReadBits(3);
			int windowCount = info.GetWindowCount();
			if (info.IsEightShortFrame())
			{
				_shortUsed = new bool[windowCount];
				_shortLagPresent = new bool[windowCount];
				_shortLag = new int[windowCount];
				for (int i = 0; i < windowCount; i++)
				{
					bool flag;
					_shortUsed[i] = (flag = input.ReadBool());
					if (flag)
					{
						_shortLagPresent[i] = input.ReadBool();
						if (_shortLagPresent[i])
						{
							_shortLag[i] = input.ReadBits(4);
						}
					}
				}
			}
			else
			{
				_lastBand = Math.Min(info.GetMaxSFB(), 40);
				_longUsed = new bool[_lastBand];
				for (int j = 0; j < _lastBand; j++)
				{
					_longUsed[j] = input.ReadBool();
				}
			}
		}

		public void SetPredictionUnused(int sfb)
		{
			if (_longUsed != null)
			{
				_longUsed[sfb] = false;
			}
		}

		public void Process(ICStream ics, float[] data, FilterBank filterBank, SampleFrequency sf)
		{
			if (!_isPresent)
			{
				return;
			}
			ICSInfo info = ics.GetInfo();
			if (info.IsEightShortFrame())
			{
				return;
			}
			int num = _frameLength << 1;
			float[] array = new float[2048];
			float[] array2 = new float[2048];
			for (int i = 0; i < num; i++)
			{
				array[i] = (float)_states[num + i - _lag] * CODEBOOK[_coef];
			}
			filterBank.ProcessLTP(info.GetWindowSequence(), info.GetWindowShape(1), info.GetWindowShape(0), array, array2);
			if (ics.IsTNSDataPresent())
			{
				ics.GetTNS().Process(ics, array2, sf, decode: true);
			}
			int[] sWBOffsets = info.GetSWBOffsets();
			int sWBOffsetMax = info.GetSWBOffsetMax();
			for (int j = 0; j < _lastBand; j++)
			{
				if (_longUsed[j])
				{
					int num2 = sWBOffsets[j];
					int num3 = Math.Min(sWBOffsets[j + 1], sWBOffsetMax);
					for (int k = num2; k < num3; k++)
					{
						data[k] += array2[k];
					}
				}
			}
		}

		public void UpdateState(float[] time, float[] overlap, Profile profile)
		{
			if (profile.Equals(Profile.AAC_LD))
			{
				for (int i = 0; i < _frameLength; i++)
				{
					_states[i] = _states[i + _frameLength];
					_states[_frameLength + i] = _states[i + _frameLength * 2];
					_states[_frameLength * 2 + i] = (int)Math.Round(time[i]);
					_states[_frameLength * 3 + i] = (int)Math.Round(overlap[i]);
				}
			}
			else
			{
				for (int i = 0; i < _frameLength; i++)
				{
					_states[i] = _states[i + _frameLength];
					_states[_frameLength + i] = (int)Math.Round(time[i]);
					_states[_frameLength * 2 + i] = (int)Math.Round(overlap[i]);
				}
			}
			_isPresent = false;
		}

		public static bool IsLTPProfile(Profile profile)
		{
			if (!profile.Equals(Profile.AAC_LTP) && !profile.Equals(Profile.ER_AAC_LTP))
			{
				return profile.Equals(Profile.AAC_LD);
			}
			return true;
		}

		public void Copy(LTPrediction ltp)
		{
			Array.Copy(ltp._states, 0, _states, 0, _states.Length);
			_coef = ltp._coef;
			_lag = ltp._lag;
			_lastBand = ltp._lastBand;
			_lagUpdate = ltp._lagUpdate;
			_shortUsed = ltp._shortUsed.ToArray();
			_shortLagPresent = ltp._shortLagPresent.ToArray();
			_shortLag = ltp._shortLag.ToArray();
			_longUsed = ltp._longUsed.ToArray();
		}
	}
	public class MS
	{
		public static void Process(CPE cpe, float[] specL, float[] specR)
		{
			ICStream leftChannel = cpe.GetLeftChannel();
			ICSInfo info = leftChannel.GetInfo();
			int[] sWBOffsets = info.GetSWBOffsets();
			int windowGroupCount = info.GetWindowGroupCount();
			int maxSFB = info.GetMaxSFB();
			int[] sfbCB = leftChannel.getSfbCB();
			int[] sfbCB2 = cpe.GetRightChannel().getSfbCB();
			int num = 0;
			int num2 = 0;
			for (int i = 0; i < windowGroupCount; i++)
			{
				int num3 = 0;
				while (num3 < maxSFB)
				{
					if (cpe.IsMSUsed(num2) && sfbCB[num2] < 13 && sfbCB2[num2] < 13)
					{
						for (int j = 0; j < info.GetWindowGroupLength(i); j++)
						{
							int num4 = num + j * 128 + sWBOffsets[num3];
							for (int k = 0; k < sWBOffsets[num3 + 1] - sWBOffsets[num3]; k++)
							{
								float num5 = specL[num4 + k] - specR[num4 + k];
								specL[num4 + k] += specR[num4 + k];
								specR[num4 + k] = num5;
							}
						}
					}
					num3++;
					num2++;
				}
				num += info.GetWindowGroupLength(i) * 128;
			}
		}
	}
	public enum MSMask
	{
		TYPE_ALL_0,
		TYPE_USED,
		TYPE_ALL_1,
		TYPE_RESERVED
	}
	public class TNS
	{
		private static int TNS_MAX_ORDER = 20;

		private static int[] SHORT_BITS = new int[3] { 1, 4, 3 };

		private static int[] LONG_BITS = new int[3] { 2, 6, 5 };

		private int[] _nFilt;

		private int[,] _length;

		private int[,] _order;

		private bool[,] _direction;

		private float[,,] _coef;

		public TNS()
		{
			_nFilt = new int[8];
			_length = new int[8, 4];
			_direction = new bool[8, 4];
			_order = new int[8, 4];
			_coef = new float[8, 4, TNS_MAX_ORDER];
		}

		public void Decode(BitStream input, ICSInfo info)
		{
			int windowCount = info.GetWindowCount();
			int[] array = (info.IsEightShortFrame() ? SHORT_BITS : LONG_BITS);
			for (int i = 0; i < windowCount; i++)
			{
				if ((_nFilt[i] = input.ReadBits(array[0])) == 0)
				{
					continue;
				}
				int num = input.ReadBit();
				for (int j = 0; j < _nFilt[i]; j++)
				{
					_length[i, j] = input.ReadBits(array[1]);
					if ((_order[i, j] = input.ReadBits(array[2])) > 20)
					{
						throw new AACException("TNS filter out of range: " + _order[i, j]);
					}
					if (_order[i, j] != 0)
					{
						_direction[i, j] = input.ReadBool();
						int num2 = input.ReadBit();
						int n = num + 3 - num2;
						int num3 = 2 * num2 + num;
						for (int k = 0; k < _order[i, j]; k++)
						{
							_coef[i, j, k] = TNSTables.TNS_TABLES[num3][input.ReadBits(n)];
						}
					}
				}
			}
		}

		public void Process(ICStream ics, float[] spec, SampleFrequency sf, bool decode)
		{
		}
	}
	public static class TNSTables
	{
		public static float[] TNS_COEF_1_3 = new float[4] { 0f, -0.43388373f, 0.6427876f, 0.34202015f };

		public static float[] TNS_COEF_0_3 = new float[8] { 0f, -0.43388373f, -0.7818315f, -0.9749279f, 0.9848077f, 0.8660254f, 0.6427876f, 0.34202015f };

		public static float[] TNS_COEF_1_4 = new float[8] { 0f, -0.2079117f, -0.40673664f, -0.58778524f, 0.6736956f, 0.52643216f, 0.36124167f, 0.18374951f };

		public static float[] TNS_COEF_0_4 = new float[16]
		{
			0f, -0.2079117f, -0.40673664f, -0.58778524f, -0.7431448f, -0.8660254f, -0.95105654f, -0.9945219f, 0.99573416f, 0.9618256f,
			0.8951633f, 0.7980172f, 0.6736956f, 0.52643216f, 0.36124167f, 0.18374951f
		};

		public static float[][] TNS_TABLES = new float[4][] { TNS_COEF_0_3, TNS_COEF_0_4, TNS_COEF_1_3, TNS_COEF_1_4 };
	}
}
namespace SharpJaad.AAC.Syntax
{
	public class BitStream
	{
		private const int WORD_BITS = 32;

		private const int WORD_BYTES = 4;

		private const int BYTE_MASK = 255;

		private byte[] _buffer;

		private int _pos;

		private int _cache;

		protected int _bitsCached;

		protected int _position;

		public BitStream()
		{
		}

		public BitStream(byte[] data)
		{
			SetData(data);
		}

		public void Destroy()
		{
			Reset();
			_buffer = null;
		}

		public void SetData(byte[] data)
		{
			Reset();
			int num = data.Length;
			int num2 = num % 4;
			_bitsCached = 8 * num2;
			for (int i = 0; i < num2; i++)
			{
				byte b = data[i];
				_cache <<= 8;
				_cache |= 0xFF & b;
			}
			num -= num2;
			if (_buffer == null || _buffer.Length != num)
			{
				_buffer = new byte[num];
			}
			Buffer.BlockCopy(data, num2, _buffer, 0, _buffer.Length);
		}

		public void ByteAlign()
		{
			int num = _bitsCached & 7;
			if (num > 0)
			{
				SkipBits(num);
			}
		}

		public void Reset()
		{
			_pos = 0;
			_bitsCached = 0;
			_cache = 0;
			_position = 0;
		}

		public int GetPosition()
		{
			return _position;
		}

		public int GetBitsLeft()
		{
			return 8 * (_buffer.Length - _pos) + _bitsCached;
		}

		protected int ReadCache(bool peek)
		{
			if (_pos > _buffer.Length - 4)
			{
				throw new AACException("end of stream", eos: true);
			}
			int result = ((_buffer[_pos] & 0xFF) << 24) | ((_buffer[_pos + 1] & 0xFF) << 16) | ((_buffer[_pos + 2] & 0xFF) << 8) | (_buffer[_pos + 3] & 0xFF);
			if (!peek)
			{
				_pos += 4;
			}
			return result;
		}

		public int ReadBits(int n)
		{
			int result;
			if (_bitsCached >= n)
			{
				_bitsCached -= n;
				result = (_cache >> _bitsCached) & MaskBits(n);
				_position += n;
			}
			else
			{
				_position += n;
				int num = _cache & MaskBits(_bitsCached);
				int num2 = n - _bitsCached;
				_cache = ReadCache(peek: false);
				_bitsCached = 32 - num2;
				result = ((_cache >> _bitsCached) & MaskBits(num2)) | (num << num2);
			}
			return result;
		}

		public int ReadBit()
		{
			int result;
			if (_bitsCached > 0)
			{
				_bitsCached--;
				result = (_cache >> _bitsCached) & 1;
				_position++;
			}
			else
			{
				_cache = ReadCache(peek: false);
				_bitsCached = 31;
				_position++;
				result = (_cache >> _bitsCached) & 1;
			}
			return result;
		}

		public bool ReadBool()
		{
			return (ReadBit() & 1) != 0;
		}

		public int PeekBits(int n)
		{
			if (_bitsCached >= n)
			{
				return (_cache >> _bitsCached - n) & MaskBits(n);
			}
			int num = _cache & MaskBits(_bitsCached);
			n -= _bitsCached;
			return ((ReadCache(peek: true) >> 32 - n) & MaskBits(n)) | (num << n);
		}

		public int PeekBit()
		{
			if (_bitsCached > 0)
			{
				return (_cache >> _bitsCached - 1) & 1;
			}
			return (ReadCache(peek: true) >> 31) & 1;
		}

		public void SkipBits(int n)
		{
			_position += n;
			if (n <= _bitsCached)
			{
				_bitsCached -= n;
				return;
			}
			n -= _bitsCached;
			while (n >= 32)
			{
				n -= 32;
				ReadCache(peek: false);
			}
			if (n > 0)
			{
				_cache = ReadCache(peek: false);
				_bitsCached = 32 - n;
			}
			else
			{
				_cache = 0;
				_bitsCached = 0;
			}
		}

		public void SkipBit()
		{
			_position++;
			if (_bitsCached > 0)
			{
				_bitsCached--;
				return;
			}
			_cache = ReadCache(peek: false);
			_bitsCached = 31;
		}

		public int MaskBits(int n)
		{
			if (n == 32)
			{
				return -1;
			}
			return (1 << n) - 1;
		}
	}
	public class CCE : Element
	{
		public const int BEFORE_TNS = 0;

		public const int AFTER_TNS = 1;

		public const int AFTER_IMDCT = 2;

		private static readonly float[] CCE_SCALE = new float[4] { 1.0905077f, 1.1892071f, 1.4142135f, 2f };

		private readonly ICStream _ics;

		private int _couplingPoint;

		private int _coupledCount;

		private readonly bool[] _channelPair;

		private readonly int[] _idSelect;

		private readonly int[] _chSelect;

		private readonly float[,] _gain;

		public CCE(DecoderConfig config)
		{
			_ics = new ICStream(config);
			_channelPair = new bool[8];
			_idSelect = new int[8];
			_chSelect = new int[8];
			_gain = new float[16, 120];
		}

		public int GetCouplingPoint()
		{
			return _couplingPoint;
		}

		public int GetCoupledCount()
		{
			return _coupledCount;
		}

		public bool IsChannelPair(int index)
		{
			return _channelPair[index];
		}

		public int GetIDSelect(int index)
		{
			return _idSelect[index];
		}

		public int GetCHSelect(int index)
		{
			return _chSelect[index];
		}

		public void Decode(BitStream input, DecoderConfig conf)
		{
			ReadElementInstanceTag(input);
			_couplingPoint = 2 * input.ReadBit();
			_coupledCount = input.ReadBits(3);
			int num = 0;
			for (int i = 0; i <= _coupledCount; i++)
			{
				num++;
				_channelPair[i] = input.ReadBool();
				_idSelect[i] = input.ReadBits(4);
				if (_channelPair[i])
				{
					_chSelect[i] = input.ReadBits(2);
					if (_chSelect[i] == 3)
					{
						num++;
					}
				}
				else
				{
					_chSelect[i] = 2;
				}
			}
			_couplingPoint += input.ReadBit();
			_couplingPoint |= _couplingPoint >> 1;
			bool flag = input.ReadBool();
			double x = CCE_SCALE[input.ReadBits(2)];
			_ics.Decode(input, commonWindow: false, conf);
			ICSInfo info = _ics.GetInfo();
			int windowGroupCount = info.GetWindowGroupCount();
			int maxSFB = info.GetMaxSFB();
			int[] sfbCB = _ics.getSfbCB();
			for (int i = 0; i < num; i++)
			{
				int num2 = 0;
				int num3 = 1;
				int num4 = 0;
				float num5 = 1f;
				if (i > 0)
				{
					num3 = ((_couplingPoint == 2) ? 1 : input.ReadBit());
					num4 = ((num3 != 0) ? (HuffmanDec.DecodeScaleFactor(input) - 60) : 0);
					num5 = (float)Math.Pow(x, -num4);
				}
				if (_couplingPoint == 2)
				{
					_gain[i, 0] = num5;
					continue;
				}
				for (int j = 0; j < windowGroupCount; j++)
				{
					int num6 = 0;
					while (num6 < maxSFB)
					{
						if (sfbCB[num2] != 0)
						{
							if (num3 == 0)
							{
								int num7 = HuffmanDec.DecodeScaleFactor(input) - 60;
								if (num7 != 0)
								{
									int num8 = 1;
									num7 = (num4 += num7);
									if (!flag)
									{
										num8 -= 2 * (num7 & 1);
										num7 >>= 1;
									}
									num5 = (float)(Math.Pow(x, -num7) * (double)num8);
								}
							}
							_gain[i, num2] = num5;
						}
						num6++;
						num2++;
					}
				}
			}
		}

		public void Process()
		{
		}

		public void ApplyIndependentCoupling(int index, float[] data)
		{
			double num = _gain[index, 0];
			float[] invQuantData = _ics.GetInvQuantData();
			for (int i = 0; i < data.Length; i++)
			{
				data[i] += (float)(num * (double)invQuantData[i]);
			}
		}

		public void ApplyDependentCoupling(int index, float[] data)
		{
			ICSInfo info = _ics.GetInfo();
			int[] sWBOffsets = info.GetSWBOffsets();
			int windowGroupCount = info.GetWindowGroupCount();
			int maxSFB = info.GetMaxSFB();
			int[] sfbCB = _ics.getSfbCB();
			float[] invQuantData = _ics.GetInvQuantData();
			int num = 0;
			int num2 = 0;
			int num3 = 0;
			for (int i = 0; i < windowGroupCount; i++)
			{
				int windowGroupLength = info.GetWindowGroupLength(i);
				int num4 = 0;
				while (num4 < maxSFB)
				{
					if (sfbCB[num3] != 0)
					{
						float num5 = _gain[index, num3];
						for (int j = 0; j < windowGroupLength; j++)
						{
							for (int k = sWBOffsets[num4]; k < sWBOffsets[num4 + 1]; k++)
							{
								data[num2 + j * 128 + k] += num5 * invQuantData[num + j * 128 + k];
							}
						}
					}
					num4++;
					num3++;
				}
				num2 += windowGroupLength * 128;
				num += windowGroupLength * 128;
			}
		}
	}
	public class Constants
	{
		public const int MAX_ELEMENTS = 16;

		public const int BYTE_MASK = 255;

		public const int MIN_INPUT_SIZE = 768;

		public const int WINDOW_LEN_LONG = 1024;

		public const int WINDOW_LEN_SHORT = 128;

		public const int WINDOW_SMALL_LEN_LONG = 960;

		public const int WINDOW_SMALL_LEN_SHORT = 120;

		public const int ELEMENT_SCE = 0;

		public const int ELEMENT_CPE = 1;

		public const int ELEMENT_CCE = 2;

		public const int ELEMENT_LFE = 3;

		public const int ELEMENT_DSE = 4;

		public const int ELEMENT_PCE = 5;

		public const int ELEMENT_FIL = 6;

		public const int ELEMENT_END = 7;

		public const int MAX_WINDOW_COUNT = 8;

		public const int MAX_WINDOW_GROUP_COUNT = 8;

		public const int MAX_LTP_SFB = 40;

		public const int MAX_SECTIONS = 120;

		public const int MAX_MS_MASK = 128;

		public const float SQRT2 = 1.4142135f;
	}
	public class CPE : Element
	{
		private MSMask _msMask;

		private bool[] _msUsed;

		private bool _commonWindow;

		private ICStream _icsL;

		private ICStream _icsR;

		public CPE(DecoderConfig config)
		{
			_msUsed = new bool[128];
			_icsL = new ICStream(config);
			_icsR = new ICStream(config);
		}

		public void Decode(BitStream input, DecoderConfig conf)
		{
			Profile profile = conf.GetProfile();
			if (conf.GetSampleFrequency().Equals(SampleFrequency.SAMPLE_FREQUENCY_NONE))
			{
				throw new AACException("invalid sample frequency");
			}
			ReadElementInstanceTag(input);
			_commonWindow = input.ReadBool();
			ICSInfo info = _icsL.GetInfo();
			if (_commonWindow)
			{
				info.Decode(input, conf, _commonWindow);
				_icsR.GetInfo().SetData(input, conf, info);
				_msMask = (MSMask)input.ReadBits(2);
				if (_msMask.Equals(MSMask.TYPE_USED))
				{
					int maxSFB = info.GetMaxSFB();
					int windowGroupCount = info.GetWindowGroupCount();
					for (int i = 0; i < windowGroupCount * maxSFB; i++)
					{
						_msUsed[i] = input.ReadBool();
					}
				}
				else if (_msMask.Equals(MSMask.TYPE_ALL_1))
				{
					Arrays.Fill(_msUsed, value: true);
				}
				else
				{
					if (!_msMask.Equals(MSMask.TYPE_ALL_0))
					{
						throw new AACException("reserved MS mask type used");
					}
					Arrays.Fill(_msUsed, value: false);
				}
			}
			else
			{
				_msMask = MSMask.TYPE_ALL_0;
				Arrays.Fill(_msUsed, value: false);
			}
			if (profile.IsErrorResilientProfile())
			{
				_icsR.GetInfo().GetLTPrediction()?.Decode(input, info, profile);
			}
			_icsL.Decode(input, _commonWindow, conf);
			_icsR.Decode(input, _commonWindow, conf);
		}

		public ICStream GetLeftChannel()
		{
			return _icsL;
		}

		public ICStream GetRightChannel()
		{
			return _icsR;
		}

		public MSMask GetMSMask()
		{
			return _msMask;
		}

		public bool IsMSUsed(int off)
		{
			return _msUsed[off];
		}

		public bool IsMSMaskPresent()
		{
			return !_msMask.Equals(MSMask.TYPE_ALL_0);
		}

		public bool IsCommonWindow()
		{
			return _commonWindow;
		}
	}
	public class DSE : Element
	{
		private byte[] _dataStreamBytes;

		public void Decode(BitStream input)
		{
			ReadElementInstanceTag(input);
			bool num = input.ReadBool();
			int num2 = input.ReadBits(8);
			if (num2 == 255)
			{
				num2 += input.ReadBits(8);
			}
			if (num)
			{
				input.ByteAlign();
			}
			_dataStreamBytes = new byte[num2];
			for (int i = 0; i < num2; i++)
			{
				_dataStreamBytes[i] = (byte)input.ReadBits(8);
			}
		}
	}
	public abstract class Element
	{
		private int _elementInstanceTag;

		private SBR _sbr;

		protected void ReadElementInstanceTag(BitStream input)
		{
			_elementInstanceTag = input.ReadBits(4);
		}

		public int GetElementInstanceTag()
		{
			return _elementInstanceTag;
		}

		public void DecodeSBR(BitStream input, SampleFrequency sf, int count, bool stereo, bool crc, bool downSampled, bool smallFrames)
		{
			if (_sbr == null)
			{
				int frequency = sf.GetFrequency();
				if (frequency < 24000 && !downSampled)
				{
					sf = SampleFrequencyExtensions.FromFrequency(2 * frequency);
				}
				_sbr = new SBR(smallFrames, stereo, sf, downSampled);
			}
			_sbr.Decode(input, count, crc);
		}

		public bool IsSBRPresent()
		{
			return _sbr != null;
		}

		public SBR GetSBR()
		{
			return _sbr;
		}
	}
	public class FIL
	{
		public class DynamicRangeInfo
		{
			public const int MAX_NBR_BANDS = 7;

			public bool[] _excludeMask;

			public bool[] _additionalExcludedChannels;

			public bool _pceTagPresent;

			public int _pceInstanceTag;

			public int _tagReservedBits;

			public bool _excludedChannelsPresent;

			public bool _bandsPresent;

			public int _bandsIncrement;

			public int _interpolationScheme;

			public int[] _bandTop;

			public bool _progRefLevelPresent;

			public int _progRefLevel;

			public int _progRefLevelReservedBits;

			public bool[] _dynRngSgn;

			public int[] _dynRngCtl;

			public DynamicRangeInfo()
			{
				_excludeMask = new bool[7];
				_additionalExcludedChannels = new bool[7];
			}
		}

		private const int TYPE_FILL = 0;

		private const int TYPE_FILL_DATA = 1;

		private const int TYPE_EXT_DATA_ELEMENT = 2;

		private const int TYPE_DYNAMIC_RANGE = 11;

		private const int TYPE_SBR_DATA = 13;

		private const int TYPE_SBR_DATA_CRC = 14;

		private bool _downSampledSBR;

		private DynamicRangeInfo _dri;

		public FIL(bool downSampledSBR)
		{
			_downSampledSBR = downSampledSBR;
		}

		public void Decode(BitStream input, Element prev, SampleFrequency sf, bool sbrEnabled, bool smallFrames)
		{
			int num = input.ReadBits(4);
			if (num == 15)
			{
				num += input.ReadBits(8) - 1;
			}
			num *= 8;
			int num2 = num;
			int position = input.GetPosition();
			while (num > 0)
			{
				num = DecodeExtensionPayload(input, num, prev, sf, sbrEnabled, smallFrames);
			}
			int num3 = input.GetPosition() - position;
			int num4 = num2 - num3;
			if (num4 > 0)
			{
				input.SkipBits(num3);
			}
			else if (num4 < 0)
			{
				throw new AACException("FIL element overread: " + num4);
			}
		}

		private int DecodeExtensionPayload(BitStream input, int count, Element prev, SampleFrequency sf, bool sbrEnabled, bool smallFrames)
		{
			int num = input.ReadBits(4);
			int num2 = count - 4;
			switch (num)
			{
			case 11:
				return DecodeDynamicRangeInfo(input, num2);
			case 13:
			case 14:
				if (sbrEnabled)
				{
					if (prev is SCE_LFE || prev is CPE || prev is CCE)
					{
						prev.DecodeSBR(input, sf, num2, prev is CPE, num == 14, _downSampledSBR, smallFrames);
						return 0;
					}
					throw new AACException("SBR applied on unexpected element: " + prev);
				}
				input.SkipBits(num2);
				return 0;
			default:
				input.SkipBits(num2);
				return 0;
			}
		}

		private int DecodeDynamicRangeInfo(BitStream input, int count)
		{
			if (_dri == null)
			{
				_dri = new DynamicRangeInfo();
			}
			int num = count;
			int num2 = 1;
			if (_dri._pceTagPresent = input.ReadBool())
			{
				_dri._pceInstanceTag = input.ReadBits(4);
				_dri._tagReservedBits = input.ReadBits(4);
			}
			if (_dri._excludedChannelsPresent = input.ReadBool())
			{
				num -= DecodeExcludedChannels(input);
			}
			if (_dri._bandsPresent = input.ReadBool())
			{
				_dri._bandsIncrement = input.ReadBits(4);
				_dri._interpolationScheme = input.ReadBits(4);
				num -= 8;
				num2 += _dri._bandsIncrement;
				_dri._bandTop = new int[num2];
				for (int i = 0; i < num2; i++)
				{
					_dri._bandTop[i] = input.ReadBits(8);
					num -= 8;
				}
			}
			if (_dri._progRefLevelPresent = input.ReadBool())
			{
				_dri._progRefLevel = input.ReadBits(7);
				_dri._progRefLevelReservedBits = input.ReadBits(1);
				num -= 8;
			}
			_dri._dynRngSgn = new bool[num2];
			_dri._dynRngCtl = new int[num2];
			for (int j = 0; j < num2; j++)
			{
				_dri._dynRngSgn[j] = input.ReadBool();
				_dri._dynRngCtl[j] = input.ReadBits(7);
				num -= 8;
			}
			return num;
		}

		private int DecodeExcludedChannels(BitStream input)
		{
			int num = 0;
			do
			{
				for (int i = 0; i < 7; i++)
				{
					_dri._excludeMask[num] = input.ReadBool();
					num++;
				}
			}
			while (num < 57 && input.ReadBool());
			return num / 7 * 8;
		}
	}
	public class ICSInfo
	{
		public enum WindowSequence
		{
			ONLY_LONG_SEQUENCE,
			LONG_START_SEQUENCE,
			EIGHT_SHORT_SEQUENCE,
			LONG_STOP_SEQUENCE
		}

		public const int WINDOW_SHAPE_SINE = 0;

		public const int WINDOW_SHAPE_KAISER = 1;

		public const int PREVIOUS = 0;

		public const int CURRENT = 1;

		private int _frameLength;

		private WindowSequence _windowSequence;

		private int[] _windowShape;

		private int _maxSFB;

		private bool _predictionDataPresent;

		private ICPrediction _icPredict;

		private LTPrediction _ltPredict;

		private int _windowCount;

		private int _windowGroupCount;

		private int[] _windowGroupLength;

		private int _swbCount;

		private int[] _swbOffsets;

		public ICSInfo(DecoderConfig config)
		{
			_frameLength = config.GetFrameLength();
			_windowShape = new int[2];
			_windowSequence = WindowSequence.ONLY_LONG_SEQUENCE;
			_windowGroupLength = new int[8];
			if (LTPrediction.IsLTPProfile(config.GetProfile()))
			{
				_ltPredict = new LTPrediction(_frameLength);
			}
			else
			{
				_ltPredict = null;
			}
		}

		public void Decode(BitStream input, DecoderConfig conf, bool commonWindow)
		{
			SampleFrequency sampleFrequency = conf.GetSampleFrequency();
			if (sampleFrequency.Equals(SampleFrequency.SAMPLE_FREQUENCY_NONE))
			{
				throw new AACException("invalid sample frequency");
			}
			input.SkipBit();
			_windowSequence = (WindowSequence)input.ReadBits(2);
			_windowShape[0] = _windowShape[1];
			_windowShape[1] = input.ReadBit();
			_windowGroupCount = 1;
			_windowGroupLength[0] = 1;
			if (_windowSequence.Equals(WindowSequence.EIGHT_SHORT_SEQUENCE))
			{
				_maxSFB = input.ReadBits(4);
				for (int i = 0; i < 7; i++)
				{
					if (input.ReadBool())
					{
						_windowGroupLength[_windowGroupCount - 1]++;
						continue;
					}
					_windowGroupCount++;
					_windowGroupLength[_windowGroupCount - 1] = 1;
				}
				_windowCount = 8;
				_swbOffsets = ScaleFactorBands.SWB_OFFSET_SHORT_WINDOW[(int)sampleFrequency];
				_swbCount = ScaleFactorBands.SWB_SHORT_WINDOW_COUNT[(int)sampleFrequency];
			}
			else
			{
				_maxSFB = input.ReadBits(6);
				_windowCount = 1;
				_swbOffsets = ScaleFactorBands.SWB_OFFSET_LONG_WINDOW[(int)sampleFrequency];
				_swbCount = ScaleFactorBands.SWB_LONG_WINDOW_COUNT[(int)sampleFrequency];
				_predictionDataPresent = input.ReadBool();
				if (_predictionDataPresent)
				{
					ReadPredictionData(input, conf.GetProfile(), sampleFrequency, commonWindow);
				}
			}
		}

		private void ReadPredictionData(BitStream input, Profile profile, SampleFrequency sf, bool commonWindow)
		{
			switch (profile)
			{
			case Profile.AAC_MAIN:
				if (_icPredict == null)
				{
					_icPredict = new ICPrediction();
				}
				_icPredict.Decode(input, _maxSFB, sf);
				break;
			case Profile.AAC_LTP:
				_ltPredict.Decode(input, this, profile);
				break;
			case Profile.ER_AAC_LTP:
				if (!commonWindow)
				{
					_ltPredict.Decode(input, this, profile);
				}
				break;
			default:
				throw new AACException("unexpected profile for LTP: " + profile);
			}
		}

		public int GetMaxSFB()
		{
			return _maxSFB;
		}

		public int GetSWBCount()
		{
			return _swbCount;
		}

		public int[] GetSWBOffsets()
		{
			return _swbOffsets;
		}

		public int GetSWBOffsetMax()
		{
			return _swbOffsets[_swbCount];
		}

		public int GetWindowCount()
		{
			return _windowCount;
		}

		public int GetWindowGroupCount()
		{
			return _windowGroupCount;
		}

		public int GetWindowGroupLength(int g)
		{
			return _windowGroupLength[g];
		}

		public WindowSequence GetWindowSequence()
		{
			return _windowSequence;
		}

		public bool IsEightShortFrame()
		{
			return _windowSequence.Equals(WindowSequence.EIGHT_SHORT_SEQUENCE);
		}

		public int GetWindowShape(int index)
		{
			return _windowShape[index];
		}

		public bool IsICPredictionPresent()
		{
			return _predictionDataPresent;
		}

		public ICPrediction GetICPrediction()
		{
			return _icPredict;
		}

		public LTPrediction GetLTPrediction()
		{
			return _ltPredict;
		}

		public void UnsetPredictionSFB(int sfb)
		{
			if (_predictionDataPresent)
			{
				_icPredict.SetPredictionUnused(sfb);
			}
			if (_ltPredict != null)
			{
				_ltPredict.SetPredictionUnused(sfb);
			}
		}

		public void SetData(BitStream input, DecoderConfig conf, ICSInfo info)
		{
			_windowSequence = info._windowSequence;
			_windowShape[0] = _windowShape[1];
			_windowShape[1] = info._windowShape[1];
			_maxSFB = info._maxSFB;
			_predictionDataPresent = info._predictionDataPresent;
			if (_predictionDataPresent)
			{
				_icPredict = info._icPredict;
			}
			_windowCount = info._windowCount;
			_windowGroupCount = info._windowGroupCount;
			_windowGroupLength = info._windowGroupLength.ToArray();
			_swbCount = info._swbCount;
			_swbOffsets = info._swbOffsets.ToArray();
			if (_predictionDataPresent)
			{
				_ltPredict.Decode(input, this, conf.GetProfile());
			}
		}
	}
	public class ICStream
	{
		private const int SF_DELTA = 60;

		private const int SF_OFFSET = 200;

		private static int randomState = 523124044;

		private int _frameLength;

		private ICSInfo _info;

		private int[] _sfbCB;

		private int[] _sectEnd;

		private float[] _data;

		private float[] _scaleFactors;

		private int _globalGain;

		private bool _pulseDataPresent;

		private bool _tnsDataPresent;

		private bool _gainControlPresent;

		private TNS _tns;

		private GainControl _gainControl;

		private int[] _pulseOffset;

		private int[] _pulseAmp;

		private int _pulseCount;

		private int _pulseStartSWB;

		private bool _noiseUsed;

		private int _reorderedSpectralDataLen;

		private int _longestCodewordLen;

		private RVLC _rvlc;

		public ICStream(DecoderConfig config)
		{
			_frameLength = config.GetFrameLength();
			_info = new ICSInfo(config);
			_sfbCB = new int[120];
			_sectEnd = new int[120];
			_data = new float[_frameLength];
			_scaleFactors = new float[120];
		}

		public void Decode(BitStream input, bool commonWindow, DecoderConfig conf)
		{
			if (conf.IsScalefactorResilienceUsed() && _rvlc == null)
			{
				_rvlc = new RVLC();
			}
			bool flag = conf.GetProfile().IsErrorResilientProfile();
			_globalGain = input.ReadBits(8);
			if (!commonWindow)
			{
				_info.Decode(input, conf, commonWindow);
			}
			DecodeSectionData(input, conf.IsSectionDataResilienceUsed());
			DecodeScaleFactors(input);
			_pulseDataPresent = input.ReadBool();
			if (_pulseDataPresent)
			{
				if (_info.IsEightShortFrame())
				{
					throw new AACException("pulse data not allowed for short frames");
				}
				DecodePulseData(input);
			}
			_tnsDataPresent = input.ReadBool();
			if (_tnsDataPresent && !flag)
			{
				if (_tns == null)
				{
					_tns = new TNS();
				}
				_tns.Decode(input, _info);
			}
			_gainControlPresent = input.ReadBool();
			if (_gainControlPresent)
			{
				if (_gainControl == null)
				{
					_gainControl = new GainControl(_frameLength);
				}
				_gainControl.Decode(input, _info.GetWindowSequence());
			}
			if (conf.IsSpectralDataResilienceUsed())
			{
				int val = ((conf.GetChannelConfiguration() == ChannelConfiguration.CHANNEL_CONFIG_STEREO) ? 6144 : 12288);
				_reorderedSpectralDataLen = Math.Max(input.ReadBits(14), val);
				_longestCodewordLen = Math.Max(input.ReadBits(6), 49);
			}
			else
			{
				DecodeSpectralData(input);
			}
		}

		public void DecodeSectionData(BitStream input, bool sectionDataResilienceUsed)
		{
			Arrays.Fill(_sfbCB, 0);
			Arrays.Fill(_sectEnd, 0);
			int num = (_info.IsEightShortFrame() ? 3 : 5);
			int num2 = (1 << num) - 1;
			int windowGroupCount = _info.GetWindowGroupCount();
			int maxSFB = _info.GetMaxSFB();
			int num3 = 0;
			for (int i = 0; i < windowGroupCount; i++)
			{
				int j = 0;
				while (j < maxSFB)
				{
					int num4 = j;
					int num5 = input.ReadBits(4);
					if (num5 == 12)
					{
						throw new AACException("invalid huffman codebook: 12");
					}
					int num6;
					while ((num6 = input.ReadBits(num)) == num2)
					{
						num4 += num6;
					}
					num4 += num6;
					if (num4 > maxSFB)
					{
						throw new AACException("too many bands: " + num4 + ", allowed: " + maxSFB);
					}
					for (; j < num4; j++)
					{
						_sfbCB[num3] = num5;
						_sectEnd[num3++] = num4;
					}
				}
			}
		}

		private void DecodePulseData(BitStream input)
		{
			_pulseCount = input.ReadBits(2) + 1;
			_pulseStartSWB = input.ReadBits(6);
			if (_pulseStartSWB >= _info.GetSWBCount())
			{
				throw new AACException("pulse SWB out of range: " + _pulseStartSWB + " > " + _info.GetSWBCount());
			}
			if (_pulseOffset == null || _pulseCount != _pulseOffset.Length)
			{
				_pulseOffset = new int[_pulseCount];
				_pulseAmp = new int[_pulseCount];
			}
			_pulseOffset[0] = _info.GetSWBOffsets()[_pulseStartSWB];
			_pulseOffset[0] += input.ReadBits(5);
			_pulseAmp[0] = input.ReadBits(4);
			for (int i = 1; i < _pulseCount; i++)
			{
				_pulseOffset[i] = input.ReadBits(5) + _pulseOffset[i - 1];
				if (_pulseOffset[i] > 1023)
				{
					throw new AACException("pulse offset out of range: " + _pulseOffset[0]);
				}
				_pulseAmp[i] = input.ReadBits(4);
			}
		}

		public void DecodeScaleFactors(BitStream input)
		{
			int windowGroupCount = _info.GetWindowGroupCount();
			int maxSFB = _info.GetMaxSFB();
			int[] array = new int[3]
			{
				_globalGain,
				_globalGain - 90,
				0
			};
			bool flag = true;
			int num = 0;
			for (int i = 0; i < windowGroupCount; i++)
			{
				int num2 = 0;
				while (num2 < maxSFB)
				{
					int num3 = _sectEnd[num];
					int num4 = _sfbCB[num];
					if (num4 != 0)
					{
						if (num4 != 13)
						{
							if ((uint)(num4 - 14) <= 1u)
							{
								while (num2 < num3)
								{
									array[2] += HuffmanDec.DecodeScaleFactor(input) - 60;
									int num5 = Math.Min(Math.Max(array[2], -155), 100);
									_scaleFactors[num] = ScaleFactorTable.SCALEFACTOR_TABLE[-num5 + 200];
									num2++;
									num++;
								}
								continue;
							}
							while (num2 < num3)
							{
								array[0] += HuffmanDec.DecodeScaleFactor(input) - 60;
								if (array[0] > 255)
								{
									throw new AACException("scalefactor out of range: " + array[0]);
								}
								_scaleFactors[num] = ScaleFactorTable.SCALEFACTOR_TABLE[array[0] - 100 + 200];
								num2++;
								num++;
							}
							continue;
						}
						while (num2 < num3)
						{
							if (flag)
							{
								array[1] += input.ReadBits(9) - 256;
								flag = false;
							}
							else
							{
								array[1] += HuffmanDec.DecodeScaleFactor(input) - 60;
							}
							int num5 = Math.Min(Math.Max(array[1], -100), 155);
							_scaleFactors[num] = 0f - ScaleFactorTable.SCALEFACTOR_TABLE[num5 + 200];
							num2++;
							num++;
						}
					}
					else
					{
						while (num2 < num3)
						{
							_scaleFactors[num] = 0f;
							num2++;
							num++;
						}
					}
				}
			}
		}

		private void DecodeSpectralData(BitStream input)
		{
			Arrays.Fill(_data, 0f);
			int maxSFB = _info.GetMaxSFB();
			int windowGroupCount = _info.GetWindowGroupCount();
			int[] sWBOffsets = _info.GetSWBOffsets();
			int[] array = new int[4];
			int num = 0;
			int num2 = 0;
			for (int i = 0; i < windowGroupCount; i++)
			{
				int windowGroupLength = _info.GetWindowGroupLength(i);
				int num3 = 0;
				while (num3 < maxSFB)
				{
					int num4 = _sfbCB[num2];
					int num5 = num + sWBOffsets[num3];
					int num6 = sWBOffsets[num3 + 1] - sWBOffsets[num3];
					switch (num4)
					{
					case 0:
					case 14:
					case 15:
					{
						int num7 = 0;
						while (num7 < windowGroupLength)
						{
							Arrays.Fill(_data, num5, num5 + num6, 0f);
							num7++;
							num5 += 128;
						}
						break;
					}
					case 13:
					{
						int num7 = 0;
						while (num7 < windowGroupLength)
						{
							float num9 = 0f;
							for (int j = 0; j < num6; j++)
							{
								randomState = 1664525 * randomState + 1013904223;
								_data[num5 + j] = randomState;
								num9 += _data[num5 + j] * _data[num5 + j];
							}
							float num10 = (float)((double)_scaleFactors[num2] / Math.Sqrt(num9));
							for (int j = 0; j < num6; j++)
							{
								_data[num5 + j] *= num10;
							}
							num7++;
							num5 += 128;
						}
						break;
					}
					default:
					{
						int num7 = 0;
						while (num7 < windowGroupLength)
						{
							int num8 = ((num4 >= 5) ? 2 : 4);
							for (int j = 0; j < num6; j += num8)
							{
								HuffmanDec.DecodeSpectralData(input, num4, array, 0);
								for (int k = 0; k < num8; k++)
								{
									_data[num5 + j + k] = ((array[k] > 0) ? IQTable.IQ_TABLE[array[k]] : (0f - IQTable.IQ_TABLE[-array[k]]));
									_data[num5 + j + k] *= _scaleFactors[num2];
								}
							}
							num7++;
							num5 += 128;
						}
						break;
					}
					}
					num3++;
					num2++;
				}
				num += windowGroupLength << 7;
			}
		}

		public float[] GetInvQuantData()
		{
			return _data;
		}

		public ICSInfo GetInfo()
		{
			return _info;
		}

		public int[] GetSectEnd()
		{
			return _sectEnd;
		}

		public int[] getSfbCB()
		{
			return _sfbCB;
		}

		public float[] GetScaleFactors()
		{
			return _scaleFactors;
		}

		public bool IsTNSDataPresent()
		{
			return _tnsDataPresent;
		}

		public TNS GetTNS()
		{
			return _tns;
		}

		public int GetGlobalGain()
		{
			return _globalGain;
		}

		public bool IsNoiseUsed()
		{
			return _noiseUsed;
		}

		public int GetLongestCodewordLength()
		{
			return _longestCodewordLen;
		}

		public int GetReorderedSpectralDataLength()
		{
			return _reorderedSpectralDataLen;
		}

		public bool IsGainControlPresent()
		{
			return _gainControlPresent;
		}

		public GainControl GetGainControl()
		{
			return _gainControl;
		}
	}
	public static class IQTable
	{
		public static float[] IQ_TABLE = new float[8191]
		{
			0f,
			1f,
			2.5198421f,
			4.326749f,
			6.349604f,
			8.54988f,
			10.902723f,
			13.390518f,
			16f,
			18.720755f,
			21.544348f,
			24.463781f,
			27.473143f,
			30.56735f,
			33.741993f,
			36.99318f,
			40.317474f,
			43.71179f,
			47.173344f,
			50.69963f,
			54.288353f,
			57.93741f,
			61.644867f,
			65.40894f,
			69.22798f,
			73.10044f,
			77.024895f,
			81f,
			85.02449f,
			89.09719f,
			93.21697f,
			97.3828f,
			101.593666f,
			105.84863f,
			110.146805f,
			114.48732f,
			118.869385f,
			123.292206f,
			127.755066f,
			132.25725f,
			136.79808f,
			141.3769f,
			145.99312f,
			150.64612f,
			155.33533f,
			160.0602f,
			164.8202f,
			169.61482f,
			174.44357f,
			179.30598f,
			184.20157f,
			189.12991f,
			194.09058f,
			199.08315f,
			204.10721f,
			209.16238f,
			214.24829f,
			219.36456f,
			224.51085f,
			229.68678f,
			234.89206f,
			240.12633f,
			245.38928f,
			250.6806f,
			256f,
			261.34717f,
			266.72183f,
			272.12372f,
			277.55255f,
			283.00806f,
			288.48996f,
			293.99805f,
			299.53207f,
			305.09177f,
			310.6769f,
			316.28726f,
			321.9226f,
			327.5827f,
			333.26736f,
			338.97638f,
			344.70956f,
			350.46664f,
			356.24747f,
			362.05188f,
			367.8796f,
			373.73053f,
			379.60443f,
			385.50113f,
			391.4205f,
			397.3623f,
			403.32642f,
			409.31268f,
			415.3209f,
			421.3509f,
			427.4026f,
			433.47574f,
			439.57028f,
			445.68597f,
			451.82275f,
			457.98044f,
			464.15887f,
			470.35797f,
			476.57755f,
			482.81747f,
			489.0776f,
			495.35788f,
			501.65808f,
			507.97815f,
			514.31793f,
			520.6773f,
			527.0562f,
			533.4544f,
			539.8719f,
			546.3085f,
			552.76404f,
			559.2386f,
			565.7319f,
			572.2439f,
			578.7744f,
			585.3235f,
			591.89087f,
			598.47656f,
			605.08044f,
			611.70233f,
			618.3422f,
			625f,
			631.67554f,
			638.3688f,
			645.0796f,
			651.80786f,
			658.5536f,
			665.31665f,
			672.0969f,
			678.89435f,
			685.7088f,
			692.5403f,
			699.3886f,
			706.2537f,
			713.1356f,
			720.0341f,
			726.94916f,
			733.88074f,
			740.8287f,
			747.79297f,
			754.7735f,
			761.77026f,
			768.7831f,
			775.8119f,
			782.85675f,
			789.9174f,
			796.9939f,
			804.0862f,
			811.1941f,
			818.3176f,
			825.45667f,
			832.6112f,
			839.7812f,
			846.96643f,
			854.167f,
			861.38275f,
			868.61365f,
			875.8596f,
			883.1206f,
			890.39655f,
			897.6874f,
			904.9931f,
			912.31354f,
			919.6487f,
			926.99854f,
			934.3629f,
			941.7419f,
			949.1354f,
			956.5432f,
			963.96545f,
			971.40204f,
			978.85284f,
			986.3179f,
			993.797f,
			1001.2903f,
			1008.7976f,
			1016.3189f,
			1023.8542f,
			1031.4033f,
			1038.9663f,
			1046.5431f,
			1054.1335f,
			1061.7378f,
			1069.3556f,
			1076.987f,
			1084.632f,
			1092.2904f,
			1099.9624f,
			1107.6477f,
			1115.3463f,
			1123.0583f,
			1130.7836f,
			1138.522f,
			1146.2737f,
			1154.0383f,
			1161.8162f,
			1169.607f,
			1177.411f,
			1185.2278f,
			1193.0575f,
			1200.9001f,
			1208.7555f,
			1216.6238f,
			1224.5048f,
			1232.3983f,
			1240.3047f,
			1248.2236f,
			1256.1552f,
			1264.0991f,
			1272.0558f,
			1280.0248f,
			1288.0062f,
			1296f,
			1304.0062f,
			1312.0247f,
			1320.0554f,
			1328.0984f,
			1336.1536f,
			1344.2208f,
			1352.3003f,
			1360.3918f,
			1368.4955f,
			1376.6111f,
			1384.7386f,
			1392.8782f,
			1401.0295f,
			1409.1929f,
			1417.368f,
			1425.555f,
			1433.7538f,
			1441.9642f,
			1450.1864f,
			1458.4202f,
			1466.6656f,
			1474.9227f,
			1483.1914f,
			1491.4716f,
			1499.7633f,
			1508.0665f,
			1516.3811f,
			1524.7072f,
			1533.0446f,
			1541.3933f,
			1549.7534f,
			1558.1248f,
			1566.5074f,
			1574.9014f,
			1583.3064f,
			1591.7227f,
			1600.15f,
			1608.5885f,
			1617.0381f,
			1625.4987f,
			1633.9703f,
			1642.453f,
			1650.9465f,
			1659.4512f,
			1667.9666f,
			1676.4929f,
			1685.0302f,
			1693.5781f,
			1702.137f,
			1710.7065f,
			1719.2869f,
			1727.8779f,
			1736.4797f,
			1745.092f,
			1753.7152f,
			1762.3489f,
			1770.993f,
			1779.648f,
			1788.3132f,
			1796.9891f,
			1805.6754f,
			1814.3722f,
			1823.0795f,
			1831.7971f,
			1840.5251f,
			1849.2635f,
			1858.0123f,
			1866.7714f,
			1875.5406f,
			1884.3202f,
			1893.1101f,
			1901.9102f,
			1910.7203f,
			1919.5408f,
			1928.3712f,
			1937.2119f,
			1946.0627f,
			1954.9236f,
			1963.7944f,
			1972.6753f,
			1981.5663f,
			1990.4672f,
			1999.378f,
			2008.2988f,
			2017.2296f,
			2026.1702f,
			2035.1207f,
			2044.081f,
			2053.0513f,
			2062.0312f,
			2071.021f,
			2080.0205f,
			2089.0298f,
			2098.0488f,
			2107.0776f,
			2116.116f,
			2125.164f,
			2134.2217f,
			2143.289f,
			2152.366f,
			2161.4524f,
			2170.5486f,
			2179.654f,
			2188.7693f,
			2197.8938f,
			2207.0278f,
			2216.1714f,
			2225.3245f,
			2234.4868f,
			2243.6587f,
			2252.8398f,
			2262.0305f,
			2271.2305f,
			2280.4397f,
			2289.6582f,
			2298.886f,
			2308.123f,
			2317.3696f,
			2326.625f,
			2335.89f,
			2345.1638f,
			2354.447f,
			2363.7395f,
			2373.041f,
			2382.3516f,
			2391.6711f,
			2401f,
			2410.338f,
			2419.6848f,
			2429.0408f,
			2438.4058f,
			2447.7798f,
			2457.1626f,
			2466.5544f,
			2475.9553f,
			2485.3652f,
			2494.784f,
			2504.2117f,
			2513.648f,
			2523.0935f,
			2532.5476f,
			2542.0107f,
			2551.4824f,
			2560.9631f,
			2570.4526f,
			2579.951f,
			2589.4578f,
			2598.9734f,
			2608.4978f,
			2618.031f,
			2627.5728f,
			2637.1233f,
			2646.6824f,
			2656.25f,
			2665.8264f,
			2675.4114f,
			2685.0051f,
			2694.6072f,
			2704.218f,
			2713.8372f,
			2723.465f,
			2733.1013f,
			2742.746f,
			2752.3994f,
			2762.0613f,
			2771.7314f,
			2781.4102f,
			2791.0972f,
			2800.7927f,
			2810.4966f,
			2820.209f,
			2829.9297f,
			2839.6587f,
			2849.396f,
			2859.1416f,
			2868.8958f,
			2878.658f,
			2888.4285f,
			2898.2075f,
			2907.9944f,
			2917.7898f,
			2927.5935f,
			2937.4053f,
			2947.225f,
			2957.0535f,
			2966.8896f,
			2976.7341f,
			2986.587f,
			2996.4478f,
			3006.3167f,
			3016.1936f,
			3026.0786f,
			3035.972f,
			3045.873f,
			3055.7825f,
			3065.6997f,
			3075.6252f,
			3085.5586f,
			3095.5f,
			3105.4492f,
			3115.4067f,
			3125.3718f,
			3135.3452f,
			3145.3264f,
			3155.3154f,
			3165.3125f,
			3175.3174f,
			3185.3303f,
			3195.351f,
			3205.3796f,
			3215.416f,
			3225.4602f,
			3235.5122f,
			3245.5723f,
			3255.64f,
			3265.7153f,
			3275.7986f,
			3285.8896f,
			3295.9885f,
			3306.095f,
			3316.2092f,
			3326.331f,
			3336.4607f,
			3346.5981f,
			3356.7432f,
			3366.896f,
			3377.0564f,
			3387.2244f,
			3397.4f,
			3407.5833f,
			3417.7742f,
			3427.9727f,
			3438.1787f,
			3448.3923f,
			3458.6138f,
			3468.8425f,
			3479.0789f,
			3489.3228f,
			3499.5742f,
			3509.833f,
			3520.0994f,
			3530.3733f,
			3540.6548f,
			3550.9436f,
			3561.24f,
			3571.5437f,
			3581.855f,
			3592.1736f,
			3602.4995f,
			3612.833f,
			3623.1738f,
			3633.522f,
			3643.8777f,
			3654.2407f,
			3664.6108f,
			3674.9885f,
			3685.3735f,
			3695.7659f,
			3706.1655f,
			3716.5725f,
			3726.9866f,
			3737.4082f,
			3747.837f,
			3758.273f,
			3768.7163f,
			3779.1667f,
			3789.6245f,
			3800.0894f,
			3810.5615f,
			3821.041f,
			3831.5276f,
			3842.0212f,
			3852.5222f,
			3863.0303f,
			3873.5454f,
			3884.0679f,
			3894.5974f,
			3905.134f,
			3915.6777f,
			3926.2285f,
			3936.7864f,
			3947.3513f,
			3957.9236f,
			3968.5027f,
			3979.0889f,
			3989.6821f,
			4000.2825f,
			4010.8896f,
			4021.504f,
			4032.1252f,
			4042.7537f,
			4053.389f,
			4064.0312f,
			4074.6807f,
			4085.337f,
			4096f,
			4106.67f,
			4117.347f,
			4128.0312f,
			4138.722f,
			4149.42f,
			4160.1245f,
			4170.8364f,
			4181.5547f,
			4192.2803f,
			4203.012f,
			4213.7515f,
			4224.4976f,
			4235.25f,
			4246.01f,
			4256.7764f,
			4267.5493f,
			4278.3296f,
			4289.116f,
			4299.91f,
			4310.7104f,
			4321.5176f,
			4332.3315f,
			4343.1523f,
			4353.9795f,
			4364.814f,
			4375.655f,
			4386.5024f,
			4397.3564f,
			4408.218f,
			4419.0854f,
			4429.9595f,
			4440.841f,
			4451.7285f,
			4462.623f,
			4473.524f,
			4484.4316f,
			4495.346f,
			4506.267f,
			4517.195f,
			4528.129f,
			4539.07f,
			4550.017f,
			4560.971f,
			4571.9316f,
			4582.899f,
			4593.8726f,
			4604.8525f,
			4615.8394f,
			4626.833f,
			4637.833f,
			4648.8394f,
			4659.852f,
			4670.8716f,
			4681.8975f,
			4692.93f,
			4703.9688f,
			4715.014f,
			4726.0664f,
			4737.1245f,
			4748.1895f,
			4759.2607f,
			4770.3384f,
			4781.4224f,
			4792.513f,
			4803.6104f,
			4814.7134f,
			4825.823f,
			4836.9395f,
			4848.062f,
			4859.191f,
			4870.3267f,
			4881.4683f,
			4892.616f,
			4903.7705f,
			4914.9316f,
			4926.0986f,
			4937.272f,
			4948.4517f,
			4959.638f,
			4970.8306f,
			4982.0293f,
			4993.234f,
			5004.4453f,
			5015.663f,
			5026.8867f,
			5038.117f,
			5049.3535f,
			5060.596f,
			5071.8447f,
			5083.1f,
			5094.3613f,
			5105.629f,
			5116.903f,
			5128.1826f,
			5139.469f,
			5150.7617f,
			5162.06f,
			5173.3647f,
			5184.676f,
			5195.993f,
			5207.3164f,
			5218.646f,
			5229.9814f,
			5241.323f,
			5252.6714f,
			5264.0254f,
			5275.3853f,
			5286.752f,
			5298.124f,
			5309.503f,
			5320.887f,
			5332.278f,
			5343.675f,
			5355.0776f,
			5366.487f,
			5377.902f,
			5389.3228f,
			5400.75f,
			5412.183f,
			5423.622f,
			5435.0674f,
			5446.519f,
			5457.976f,
			5469.4395f,
			5480.9087f,
			5492.3843f,
			5503.8657f,
			5515.353f,
			5526.846f,
			5538.345f,
			5549.8506f,
			5561.362f,
			5572.879f,
			5584.4023f,
			5595.931f,
			5607.4663f,
			5619.0073f,
			5630.554f,
			5642.107f,
			5653.6655f,
			5665.2305f,
			5676.801f,
			5688.3774f,
			5699.9595f,
			5711.548f,
			5723.142f,
			5734.742f,
			5746.3477f,
			5757.9595f,
			5769.577f,
			5781.2007f,
			5792.83f,
			5804.465f,
			5816.106f,
			5827.7524f,
			5839.4053f,
			5851.0635f,
			5862.728f,
			5874.398f,
			5886.0737f,
			5897.7554f,
			5909.443f,
			5921.1357f,
			5932.835f,
			5944.5396f,
			5956.25f,
			5967.9663f,
			5979.6885f,
			5991.416f,
			6003.1494f,
			6014.8887f,
			6026.634f,
			6038.3843f,
			6050.141f,
			6061.903f,
			19081f / (float)Math.PI,
			6085.4443f,
			6097.2236f,
			6109.0083f,
			6120.7993f,
			6132.595f,
			6144.3975f,
			6156.205f,
			6168.018f,
			6179.8374f,
			6191.6616f,
			6203.492f,
			6215.328f,
			6227.1694f,
			6239.0166f,
			6250.8696f,
			6262.728f,
			6274.592f,
			6286.4614f,
			6298.337f,
			6310.218f,
			6322.104f,
			6333.996f,
			6345.894f,
			6357.797f,
			6369.7056f,
			6381.62f,
			6393.54f,
			6405.4653f,
			6417.3965f,
			6429.333f,
			6441.2754f,
			6453.2227f,
			6465.176f,
			6477.135f,
			6489.099f,
			6501.069f,
			6513.044f,
			6525.025f,
			6537.0107f,
			6549.003f,
			6561f,
			6573.003f,
			6585.0107f,
			6597.025f,
			6609.044f,
			6621.0684f,
			6633.0986f,
			6645.1343f,
			6657.1753f,
			6669.2217f,
			6681.2734f,
			6693.331f,
			6705.3936f,
			6717.462f,
			6729.5356f,
			6741.6143f,
			6753.6987f,
			6765.7886f,
			6777.8843f,
			6789.985f,
			6802.091f,
			6814.202f,
			6826.319f,
			6838.4414f,
			6850.569f,
			6862.7017f,
			6874.8403f,
			6886.984f,
			6899.133f,
			6911.287f,
			6923.447f,
			6935.612f,
			6947.782f,
			6959.958f,
			6972.139f,
			6984.3257f,
			6996.517f,
			7008.7144f,
			7020.9165f,
			7033.1245f,
			7045.3374f,
			7057.5557f,
			7069.779f,
			7082.008f,
			7094.2417f,
			7106.4814f,
			7118.726f,
			7130.9756f,
			7143.231f,
			7155.491f,
			7167.757f,
			7180.028f,
			7192.304f,
			7204.5854f,
			7216.872f,
			7229.164f,
			7241.4614f,
			7253.7637f,
			7266.0713f,
			7278.384f,
			7290.7017f,
			7303.025f,
			7315.3535f,
			7327.687f,
			7340.026f,
			7352.3696f,
			7364.7188f,
			7377.073f,
			7389.4326f,
			7401.7974f,
			7414.167f,
			7426.542f,
			7438.9224f,
			7451.3076f,
			7463.698f,
			7476.0938f,
			7488.494f,
			7500.9004f,
			7513.311f,
			7525.7275f,
			7538.1484f,
			7550.575f,
			7563.0063f,
			7575.443f,
			7587.885f,
			7600.3315f,
			7612.7837f,
			7625.2407f,
			7637.7026f,
			7650.17f,
			7662.642f,
			7675.119f,
			7687.6016f,
			7700.0894f,
			7712.5815f,
			7725.0796f,
			7737.582f,
			7750.09f,
			7762.6025f,
			7775.12f,
			7787.643f,
			7800.171f,
			7812.704f,
			7825.2417f,
			7837.7847f,
			7850.333f,
			7862.8857f,
			7875.444f,
			7888.007f,
			7900.5747f,
			7913.148f,
			7925.726f,
			7938.309f,
			7950.897f,
			7963.4897f,
			7976.088f,
			7988.691f,
			8001.299f,
			8013.9116f,
			8026.5293f,
			8039.1523f,
			8051.78f,
			8064.4126f,
			8077.0503f,
			8089.693f,
			8102.3403f,
			8114.993f,
			8127.6504f,
			8140.313f,
			8152.98f,
			8165.6523f,
			8178.3296f,
			8191.0117f,
			8203.698f,
			8216.391f,
			8229.087f,
			8241.789f,
			8254.495f,
			8267.207f,
			8279.923f,
			8292.645f,
			8305.37f,
			8318.102f,
			8330.837f,
			8343.578f,
			8356.323f,
			8369.074f,
			8381.829f,
			8394.59f,
			8407.3545f,
			8420.124f,
			8432.899f,
			8445.679f,
			8458.463f,
			8471.252f,
			8484.046f,
			8496.845f,
			8509.648f,
			8522.457f,
			8535.2705f,
			8548.089f,
			8560.911f,
			8573.739f,
			8586.572f,
			8599.409f,
			8612.251f,
			8625.099f,
			8637.95f,
			8650.807f,
			8663.668f,
			8676.533f,
			8689.404f,
			8702.28f,
			8715.16f,
			8728.046f,
			8740.936f,
			8753.83f,
			8766.7295f,
			8779.634f,
			8792.542f,
			8805.456f,
			8818.374f,
			8831.297f,
			8844.225f,
			8857.157f,
			8870.095f,
			8883.037f,
			8895.983f,
			8908.935f,
			8921.891f,
			8934.852f,
			8947.817f,
			8960.787f,
			8973.763f,
			8986.742f,
			8999.727f,
			9012.715f,
			9025.709f,
			9038.707f,
			9051.71f,
			9064.718f,
			9077.73f,
			9090.747f,
			9103.769f,
			9116.795f,
			9129.826f,
			9142.861f,
			9155.902f,
			9168.947f,
			9181.996f,
			9195.051f,
			9208.109f,
			9221.173f,
			9234.241f,
			9247.313f,
			9260.391f,
			9273.473f,
			9286.56f,
			9299.65f,
			9312.746f,
			9325.847f,
			9338.952f,
			9352.062f,
			9365.176f,
			9378.295f,
			9391.418f,
			9404.546f,
			9417.679f,
			9430.815f,
			9443.957f,
			9457.104f,
			9470.254f,
			9483.41f,
			9496.569f,
			9509.734f,
			9522.903f,
			9536.077f,
			9549.255f,
			9562.438f,
			9575.625f,
			9588.817f,
			9602.014f,
			9615.215f,
			9628.42f,
			9641.63f,
			9654.845f,
			9668.063f,
			9681.287f,
			9694.515f,
			9707.747f,
			9720.984f,
			9734.227f,
			9747.473f,
			9760.723f,
			9773.978f,
			9787.237f,
			9800.502f,
			9813.7705f,
			9827.043f,
			9840.321f,
			9853.603f,
			9866.89f,
			9880.181f,
			9893.476f,
			9906.775f,
			9920.08f,
			9933.389f,
			9946.702f,
			9960.02f,
			9973.342f,
			9986.669f,
			10000f,
			10013.336f,
			10026.676f,
			10040.02f,
			10053.369f,
			10066.722f,
			10080.08f,
			10093.442f,
			10106.809f,
			10120.18f,
			10133.555f,
			10146.935f,
			10160.319f,
			10173.708f,
			10187.101f,
			10200.498f,
			10213.9f,
			10227.307f,
			10240.717f,
			10254.132f,
			10267.552f,
			10280.976f,
			10294.403f,
			10307.836f,
			10321.273f,
			10334.715f,
			10348.16f,
			10361.61f,
			10375.064f,
			10388.523f,
			10401.987f,
			10415.454f,
			10428.926f,
			10442.402f,
			10455.883f,
			10469.368f,
			10482.857f,
			10496.351f,
			10509.849f,
			10523.352f,
			10536.857f,
			10550.369f,
			10563.884f,
			10577.403f,
			10590.928f,
			10604.456f,
			10617.988f,
			10631.525f,
			10645.066f,
			10658.612f,
			10672.162f,
			10685.716f,
			10699.274f,
			10712.837f,
			10726.404f,
			10739.976f,
			10753.551f,
			10767.131f,
			10780.715f,
			10794.303f,
			10807.8955f,
			10821.493f,
			10835.094f,
			10848.699f,
			10862.31f,
			10875.924f,
			10889.542f,
			10903.164f,
			10916.791f,
			10930.422f,
			10944.058f,
			10957.697f,
			10971.341f,
			10984.989f,
			10998.642f,
			11012.298f,
			11025.959f,
			11039.624f,
			11053.293f,
			11066.967f,
			11080.645f,
			11094.326f,
			11108.012f,
			11121.702f,
			11135.397f,
			11149.096f,
			11162.799f,
			11176.506f,
			11190.218f,
			11203.933f,
			11217.653f,
			11231.377f,
			11245.105f,
			11258.838f,
			11272.574f,
			11286.314f,
			11300.06f,
			11313.809f,
			11327.5625f,
			11341.319f,
			11355.081f,
			11368.847f,
			11382.617f,
			11396.392f,
			11410.17f,
			11423.952f,
			11437.738f,
			11451.529f,
			11465.324f,
			11479.123f,
			11492.927f,
			11506.734f,
			11520.546f,
			11534.361f,
			11548.181f,
			11562.005f,
			11575.833f,
			11589.665f,
			11603.502f,
			11617.342f,
			11631.187f,
			11645.035f,
			11658.889f,
			11672.745f,
			11686.606f,
			11700.472f,
			11714.341f,
			11728.214f,
			11742.092f,
			11755.974f,
			11769.859f,
			11783.749f,
			11797.643f,
			11811.541f,
			11825.442f,
			11839.349f,
			11853.259f,
			11867.174f,
			11881.092f,
			11895.015f,
			11908.94f,
			11922.871f,
			11936.806f,
			11950.745f,
			11964.6875f,
			11978.635f,
			11992.586f,
			12006.54f,
			12020.5f,
			12034.463f,
			12048.43f,
			12062.401f,
			12076.376f,
			12090.355f,
			12104.339f,
			12118.326f,
			12132.317f,
			12146.313f,
			12160.3125f,
			12174.316f,
			12188.324f,
			12202.335f,
			12216.351f,
			12230.371f,
			12244.395f,
			12258.422f,
			12272.454f,
			12286.489f,
			12300.529f,
			12314.572f,
			12328.62f,
			12342.672f,
			12356.728f,
			12370.787f,
			12384.852f,
			12398.919f,
			12412.99f,
			12427.066f,
			12441.146f,
			12455.2295f,
			12469.317f,
			12483.409f,
			12497.505f,
			12511.6045f,
			12525.708f,
			12539.815f,
			12553.927f,
			12568.042f,
			12582.161f,
			12596.285f,
			12610.412f,
			12624.544f,
			12638.679f,
			12652.818f,
			12666.961f,
			12681.108f,
			12695.259f,
			12709.414f,
			12723.573f,
			12737.736f,
			12751.902f,
			12766.073f,
			12780.248f,
			12794.427f,
			12808.609f,
			12822.796f,
			12836.986f,
			12851.181f,
			12865.379f,
			12879.581f,
			12893.787f,
			12907.997f,
			12922.211f,
			12936.429f,
			12950.65f,
			12964.876f,
			12979.105f,
			12993.339f,
			13007.576f,
			13021.817f,
			40954f / (float)Math.PI,
			13050.312f,
			13064.564f,
			13078.821f,
			13093.082f,
			13107.347f,
			13121.615f,
			13135.888f,
			13150.164f,
			13164.443f,
			13178.728f,
			13193.016f,
			13207.307f,
			13221.603f,
			13235.902f,
			13250.205f,
			13264.513f,
			13278.823f,
			13293.139f,
			13307.457f,
			13321.779f,
			13336.106f,
			13350.437f,
			13364.7705f,
			13379.108f,
			13393.45f,
			13407.796f,
			13422.1455f,
			13436.499f,
			13450.855f,
			13465.217f,
			13479.582f,
			13493.95f,
			13508.322f,
			13522.699f,
			13537.079f,
			13551.463f,
			13565.851f,
			13580.242f,
			13594.638f,
			13609.037f,
			13623.44f,
			13637.847f,
			13652.258f,
			13666.672f,
			13681.09f,
			13695.512f,
			13709.9375f,
			13724.367f,
			13738.801f,
			13753.238f,
			13767.679f,
			13782.124f,
			13796.572f,
			13811.024f,
			13825.48f,
			13839.94f,
			13854.404f,
			13868.872f,
			13883.343f,
			13897.818f,
			13912.297f,
			13926.779f,
			13941.266f,
			13955.756f,
			13970.25f,
			13984.747f,
			13999.249f,
			14013.754f,
			14028.263f,
			14042.775f,
			14057.292f,
			14071.812f,
			14086.336f,
			14100.863f,
			14115.395f,
			14129.93f,
			14144.469f,
			14159.011f,
			14173.558f,
			14188.107f,
			14202.661f,
			14217.219f,
			14231.78f,
			14246.345f,
			14260.914f,
			14275.486f,
			14290.0625f,
			14304.642f,
			14319.226f,
			45031f / (float)Math.PI,
			14348.403f,
			14362.998f,
			14377.597f,
			14392.199f,
			14406.805f,
			14421.414f,
			14436.027f,
			14450.645f,
			14465.265f,
			14479.89f,
			14494.518f,
			14509.149f,
			14523.784f,
			14538.424f,
			14553.066f,
			14567.713f,
			14582.362f,
			14597.017f,
			14611.674f,
			14626.335f,
			14641f,
			14655.669f,
			14670.341f,
			14685.017f,
			14699.696f,
			14714.379f,
			14729.066f,
			14743.757f,
			14758.451f,
			14773.148f,
			14787.85f,
			14802.555f,
			14817.264f,
			14831.977f,
			14846.692f,
			14861.412f,
			14876.136f,
			14890.862f,
			14905.594f,
			14920.327f,
			14935.065f,
			14949.807f,
			14964.553f,
			14979.301f,
			14994.054f,
			15008.81f,
			15023.569f,
			15038.333f,
			15053.1f,
			15067.87f,
			15082.645f,
			15097.423f,
			15112.204f,
			15126.989f,
			15141.777f,
			15156.57f,
			15171.366f,
			15186.166f,
			15200.969f,
			15215.775f,
			15230.586f,
			15245.399f,
			15260.217f,
			15275.038f,
			15289.863f,
			15304.691f,
			15319.523f,
			15334.359f,
			15349.198f,
			15364.041f,
			15378.887f,
			15393.737f,
			15408.59f,
			15423.447f,
			15438.308f,
			15453.172f,
			15468.04f,
			48641f / (float)Math.PI,
			15497.786f,
			15512.664f,
			15527.547f,
			15542.433f,
			15557.321f,
			15572.214f,
			15587.11f,
			15602.01f,
			15616.914f,
			15631.82f,
			15646.731f,
			15661.6455f,
			15676.5625f,
			15691.484f,
			15706.409f,
			15721.337f,
			15736.269f,
			15751.204f,
			15766.144f,
			15781.086f,
			15796.031f,
			15810.981f,
			15825.934f,
			15840.891f,
			15855.851f,
			15870.814f,
			15885.781f,
			15900.752f,
			15915.727f,
			15930.704f,
			15945.686f,
			15960.67f,
			15975.658f,
			15990.65f,
			16005.6455f,
			16020.645f,
			16035.646f,
			16050.652f,
			16065.662f,
			16080.675f,
			16095.691f,
			16110.711f,
			16125.734f,
			16140.762f,
			16155.792f,
			16170.826f,
			16185.863f,
			16200.904f,
			16215.948f,
			16230.996f,
			16246.048f,
			16261.103f,
			16276.161f,
			16291.223f,
			16306.288f,
			16321.356f,
			16336.429f,
			16351.505f,
			16366.584f,
			16381.667f,
			16396.752f,
			16411.842f,
			16426.936f,
			16442.031f,
			16457.133f,
			16472.236f,
			16487.342f,
			16502.453f,
			16517.566f,
			16532.684f,
			16547.805f,
			16562.93f,
			16578.057f,
			16593.188f,
			16608.322f,
			16623.46f,
			16638.602f,
			16653.746f,
			16668.895f,
			16684.047f,
			16699.203f,
			16714.361f,
			16729.523f,
			(float)Math.PI * 5330f,
			16759.857f,
			16775.03f,
			16790.207f,
			16805.385f,
			16820.568f,
			16835.754f,
			16850.943f,
			16866.137f,
			16881.334f,
			16896.533f,
			16911.736f,
			16926.943f,
			16942.152f,
			16957.367f,
			16972.584f,
			16987.805f,
			17003.027f,
			17018.256f,
			17033.486f,
			17048.719f,
			17063.957f,
			17079.197f,
			17094.441f,
			17109.69f,
			17124.94f,
			17140.195f,
			17155.453f,
			17170.713f,
			17185.979f,
			17201.246f,
			17216.518f,
			17231.793f,
			17247.07f,
			17262.352f,
			17277.637f,
			17292.926f,
			17308.217f,
			17323.512f,
			17338.81f,
			17354.111f,
			17369.416f,
			17384.725f,
			17400.037f,
			17415.352f,
			17430.672f,
			17445.992f,
			17461.318f,
			17476.646f,
			17491.979f,
			17507.314f,
			17522.654f,
			17537.996f,
			17553.342f,
			17568.69f,
			17584.043f,
			17599.398f,
			17614.756f,
			17630.12f,
			17645.484f,
			17660.854f,
			17676.227f,
			17691.602f,
			17706.98f,
			17722.363f,
			17737.748f,
			17753.137f,
			17768.53f,
			17783.926f,
			17799.324f,
			17814.727f,
			17830.133f,
			17845.541f,
			17860.953f,
			17876.37f,
			17891.79f,
			17907.21f,
			17922.637f,
			17938.064f,
			17953.498f,
			17968.934f,
			17984.371f,
			17999.814f,
			18015.26f,
			18030.709f,
			18046.16f,
			18061.615f,
			18077.074f,
			18092.537f,
			18108.002f,
			18123.47f,
			18138.943f,
			18154.418f,
			18169.896f,
			18185.379f,
			18200.863f,
			18216.352f,
			18231.844f,
			18247.338f,
			18262.838f,
			18278.338f,
			18293.844f,
			18309.352f,
			18324.863f,
			57618f / (float)Math.PI,
			18355.896f,
			18371.418f,
			18386.941f,
			18402.47f,
			18418.002f,
			18433.535f,
			18449.072f,
			18464.613f,
			18480.158f,
			18495.705f,
			18511.256f,
			18526.81f,
			18542.367f,
			18557.928f,
			18573.492f,
			18589.059f,
			18604.629f,
			18620.203f,
			18635.781f,
			18651.361f,
			18666.943f,
			18682.531f,
			18698.121f,
			18713.713f,
			18729.31f,
			18744.91f,
			18760.512f,
			18776.12f,
			18791.729f,
			18807.34f,
			18822.957f,
			18838.576f,
			18854.197f,
			18869.824f,
			18885.453f,
			18901.084f,
			18916.719f,
			18932.357f,
			18948f,
			18963.645f,
			18979.293f,
			18994.943f,
			19010.6f,
			19026.256f,
			19041.918f,
			19057.582f,
			19073.25f,
			19088.92f,
			19104.594f,
			19120.271f,
			19135.951f,
			19151.635f,
			19167.322f,
			19183.012f,
			19198.705f,
			19214.402f,
			19230.102f,
			19245.805f,
			19261.51f,
			19277.22f,
			19292.932f,
			19308.648f,
			19324.367f,
			19340.088f,
			19355.814f,
			19371.543f,
			19387.273f,
			19403.01f,
			19418.746f,
			19434.488f,
			19450.232f,
			19465.98f,
			19481.73f,
			19497.484f,
			19513.242f,
			19529.002f,
			19544.766f,
			19560.533f,
			19576.303f,
			19592.076f,
			19607.852f,
			19623.63f,
			19639.414f,
			19655.2f,
			19670.988f,
			19686.78f,
			19702.576f,
			19718.373f,
			19734.176f,
			19749.98f,
			19765.787f,
			19781.6f,
			19797.414f,
			19813.23f,
			19829.05f,
			19844.875f,
			19860.701f,
			19876.531f,
			19892.365f,
			19908.201f,
			19924.041f,
			19939.883f,
			19955.729f,
			19971.578f,
			19987.43f,
			20003.285f,
			20019.143f,
			20035.004f,
			20050.87f,
			20066.736f,
			20082.607f,
			20098.482f,
			20114.36f,
			20130.24f,
			20146.123f,
			20162.01f,
			20177.898f,
			20193.791f,
			20209.688f,
			20225.586f,
			20241.488f,
			20257.395f,
			20273.303f,
			20289.215f,
			20305.129f,
			20321.047f,
			20336.967f,
			20352.893f,
			20368.818f,
			20384.75f,
			20400.682f,
			20416.62f,
			20432.559f,
			20448.502f,
			20464.447f,
			20480.396f,
			20496.348f,
			20512.303f,
			20528.262f,
			20544.223f,
			20560.188f,
			20576.154f,
			20592.125f,
			20608.1f,
			20624.076f,
			20640.055f,
			20656.04f,
			20672.025f,
			20688.014f,
			20704.006f,
			20720.002f,
			20736f,
			20752.002f,
			20768.006f,
			20784.014f,
			20800.025f,
			20816.04f,
			20832.055f,
			20848.076f,
			20864.1f,
			20880.125f,
			20896.154f,
			20912.186f,
			20928.223f,
			20944.26f,
			20960.303f,
			20976.346f,
			20992.395f,
			21008.445f,
			21024.498f,
			21040.557f,
			21056.615f,
			21072.68f,
			21088.744f,
			21104.814f,
			21120.887f,
			21136.96f,
			21153.04f,
			21169.121f,
			21185.205f,
			21201.293f,
			21217.383f,
			21233.477f,
			21249.574f,
			21265.674f,
			21281.775f,
			21297.883f,
			21313.99f,
			21330.104f,
			21346.217f,
			21362.336f,
			21378.457f,
			21394.58f,
			21410.707f,
			21426.838f,
			21442.97f,
			21459.107f,
			21475.246f,
			21491.389f,
			21507.533f,
			21523.682f,
			21539.834f,
			21555.988f,
			21572.145f,
			21588.307f,
			21604.469f,
			21620.635f,
			21636.805f,
			21652.979f,
			21669.152f,
			21685.332f,
			21701.514f,
			21717.697f,
			21733.885f,
			21750.076f,
			21766.27f,
			21782.467f,
			21798.666f,
			21814.87f,
			21831.074f,
			21847.283f,
			21863.494f,
			21879.709f,
			21895.928f,
			21912.148f,
			21928.371f,
			21944.598f,
			21960.828f,
			21977.06f,
			21993.297f,
			22009.535f,
			22025.777f,
			22042.021f,
			22058.27f,
			22074.52f,
			22090.773f,
			22107.03f,
			22123.29f,
			22139.553f,
			22155.818f,
			22172.086f,
			22188.357f,
			22204.633f,
			22220.91f,
			22237.191f,
			22253.475f,
			22269.762f,
			22286.05f,
			22302.344f,
			22318.639f,
			22334.938f,
			22351.238f,
			22367.543f,
			22383.85f,
			22400.16f,
			22416.473f,
			22432.79f,
			22449.11f,
			22465.432f,
			22481.756f,
			22498.084f,
			22514.416f,
			22530.75f,
			22547.086f,
			22563.426f,
			22579.77f,
			22596.115f,
			22612.465f,
			22628.816f,
			22645.17f,
			22661.527f,
			22677.889f,
			22694.252f,
			22710.62f,
			22726.988f,
			22743.361f,
			22759.736f,
			22776.115f,
			22792.496f,
			22808.88f,
			22825.268f,
			22841.658f,
			22858.05f,
			22874.447f,
			22890.846f,
			22907.248f,
			22923.652f,
			22940.06f,
			22956.47f,
			22972.885f,
			22989.3f,
			23005.72f,
			23022.143f,
			23038.568f,
			23054.996f,
			23071.428f,
			23087.861f,
			23104.299f,
			23120.738f,
			23137.182f,
			23153.627f,
			23170.076f,
			23186.527f,
			23202.982f,
			23219.44f,
			23235.9f,
			23252.363f,
			23268.83f,
			23285.299f,
			23301.77f,
			23318.246f,
			23334.723f,
			23351.203f,
			23367.688f,
			23384.174f,
			23400.664f,
			23417.156f,
			23433.652f,
			23450.15f,
			23466.65f,
			23483.154f,
			23499.662f,
			23516.172f,
			23532.684f,
			23549.2f,
			23565.719f,
			23582.24f,
			23598.764f,
			23615.291f,
			23631.822f,
			23648.354f,
			23664.89f,
			23681.43f,
			23697.97f,
			23714.516f,
			23731.062f,
			23747.613f,
			23764.166f,
			23780.723f,
			23797.281f,
			23813.844f,
			23830.408f,
			23846.975f,
			23863.545f,
			23880.12f,
			23896.695f,
			23913.273f,
			23929.855f,
			23946.441f,
			23963.03f,
			23979.62f,
			23996.213f,
			24012.809f,
			24029.408f,
			24046.01f,
			24062.615f,
			24079.223f,
			24095.834f,
			24112.447f,
			24129.064f,
			24145.684f,
			24162.305f,
			24178.93f,
			24195.559f,
			24212.19f,
			24228.822f,
			24245.459f,
			24262.098f,
			24278.74f,
			24295.385f,
			24312.033f,
			24328.684f,
			24345.336f,
			24361.992f,
			24378.652f,
			24395.314f,
			24411.979f,
			24428.646f,
			24445.318f,
			24461.99f,
			24478.668f,
			24495.346f,
			24512.027f,
			24528.713f,
			24545.4f,
			24562.092f,
			24578.785f,
			24595.48f,
			24612.18f,
			24628.88f,
			24645.586f,
			24662.293f,
			24679.004f,
			24695.717f,
			24712.434f,
			24729.152f,
			24745.873f,
			77794f / (float)Math.PI,
			24779.324f,
			24796.055f,
			24812.787f,
			24829.523f,
			24846.262f,
			24863.004f,
			24879.748f,
			24896.494f,
			24913.244f,
			24929.996f,
			24946.752f,
			24963.51f,
			24980.271f,
			24997.035f,
			25013.803f,
			25030.572f,
			25047.344f,
			25064.12f,
			25080.896f,
			25097.678f,
			25114.46f,
			25131.248f,
			25148.037f,
			25164.828f,
			25181.623f,
			25198.422f,
			25215.22f,
			25232.025f,
			25248.83f,
			25265.639f,
			25282.451f,
			25299.266f,
			25316.082f,
			25332.902f,
			25349.725f,
			25366.55f,
			25383.379f,
			25400.209f,
			79850f / (float)Math.PI,
			25433.88f,
			25450.719f,
			25467.562f,
			25484.406f,
			25501.254f,
			25518.105f,
			25534.959f,
			25551.814f,
			25568.674f,
			25585.535f,
			25602.4f,
			25619.268f,
			25636.137f,
			25653.01f,
			25669.885f,
			25686.764f,
			25703.645f,
			25720.53f,
			25737.416f,
			25754.305f,
			25771.197f,
			25788.092f,
			25804.99f,
			25821.89f,
			25838.795f,
			25855.7f,
			25872.61f,
			25889.52f,
			25906.436f,
			25923.352f,
			25940.271f,
			25957.195f,
			25974.12f,
			25991.049f,
			26007.979f,
			26024.912f,
			26041.85f,
			26058.787f,
			26075.73f,
			26092.674f,
			26109.623f,
			26126.572f,
			26143.525f,
			26160.48f,
			26177.44f,
			26194.4f,
			26211.365f,
			26228.33f,
			26245.3f,
			26262.273f,
			26279.248f,
			26296.225f,
			26313.205f,
			26330.19f,
			26347.174f,
			26364.162f,
			26381.154f,
			26398.148f,
			26415.145f,
			26432.145f,
			26449.146f,
			264