From f3b0b4831c323a20393aa0388f947317354372b7 Mon Sep 17 00:00:00 2001 From: Mary Date: Tue, 25 May 2021 19:01:09 +0200 Subject: amadeus: Update to REV9 (#2309) * amadeus: Update to REV9 This implements all the changes made with REV9 on 12.0.0. * Address Ac_k's comments --- .../CommandProcessingTimeEstimatorVersion3.cs | 123 +++++++++++++++++++++ 1 file changed, 123 insertions(+) (limited to 'Ryujinx.Audio/Renderer/Server/CommandProcessingTimeEstimatorVersion3.cs') diff --git a/Ryujinx.Audio/Renderer/Server/CommandProcessingTimeEstimatorVersion3.cs b/Ryujinx.Audio/Renderer/Server/CommandProcessingTimeEstimatorVersion3.cs index b48ff8b5..e00fcf7b 100644 --- a/Ryujinx.Audio/Renderer/Server/CommandProcessingTimeEstimatorVersion3.cs +++ b/Ryujinx.Audio/Renderer/Server/CommandProcessingTimeEstimatorVersion3.cs @@ -18,6 +18,7 @@ using Ryujinx.Audio.Common; using Ryujinx.Audio.Renderer.Common; using Ryujinx.Audio.Renderer.Dsp.Command; +using Ryujinx.Audio.Renderer.Parameter.Effect; using System; using System.Diagnostics; using static Ryujinx.Audio.Renderer.Parameter.VoiceInParameter; @@ -632,5 +633,127 @@ namespace Ryujinx.Audio.Renderer.Server throw new NotImplementedException($"{format}"); } } + + private uint EstimateLimiterCommandCommon(LimiterParameter parameter, bool enabled) + { + Debug.Assert(_sampleCount == 160 || _sampleCount == 240); + + if (_sampleCount == 160) + { + if (enabled) + { + switch (parameter.ChannelCount) + { + case 1: + return (uint)21392.0f; + case 2: + return (uint)26829.0f; + case 4: + return (uint)32405.0f; + case 6: + return (uint)52219.0f; + default: + throw new NotImplementedException($"{parameter.ChannelCount}"); + } + } + else + { + switch (parameter.ChannelCount) + { + case 1: + return (uint)897.0f; + case 2: + return (uint)931.55f; + case 4: + return (uint)975.39f; + case 6: + return (uint)1016.8f; + default: + throw new NotImplementedException($"{parameter.ChannelCount}"); + } + } + } + + if (enabled) + { + switch (parameter.ChannelCount) + { + case 1: + return (uint)30556.0f; + case 2: + return (uint)39011.0f; + case 4: + return (uint)48270.0f; + case 6: + return (uint)76712.0f; + default: + throw new NotImplementedException($"{parameter.ChannelCount}"); + } + } + else + { + switch (parameter.ChannelCount) + { + case 1: + return (uint)874.43f; + case 2: + return (uint)921.55f; + case 4: + return (uint)945.26f; + case 6: + return (uint)992.26f; + default: + throw new NotImplementedException($"{parameter.ChannelCount}"); + } + } + } + + public uint Estimate(LimiterCommandVersion1 command) + { + Debug.Assert(_sampleCount == 160 || _sampleCount == 240); + + return EstimateLimiterCommandCommon(command.Parameter, command.IsEffectEnabled); + } + + public uint Estimate(LimiterCommandVersion2 command) + { + Debug.Assert(_sampleCount == 160 || _sampleCount == 240); + + if (!command.Parameter.StatisticsEnabled || !command.IsEffectEnabled) + { + return EstimateLimiterCommandCommon(command.Parameter, command.IsEffectEnabled); + } + + if (_sampleCount == 160) + { + switch (command.Parameter.ChannelCount) + { + case 1: + return (uint)23309.0f; + case 2: + return (uint)29954.0f; + case 4: + return (uint)35807.0f; + case 6: + return (uint)58340.0f; + default: + throw new NotImplementedException($"{command.Parameter.ChannelCount}"); + } + } + + switch (command.Parameter.ChannelCount) + { + case 1: + return (uint)33526.0f; + case 2: + return (uint)43549.0f; + case 4: + return (uint)52190.0f; + case 6: + return (uint)85527.0f; + default: + throw new NotImplementedException($"{command.Parameter.ChannelCount}"); + } + } } } -- cgit v1.2.3