aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Audio/Renderer/Server/CommandProcessingTimeEstimatorVersion3.cs
diff options
context:
space:
mode:
authorMary <me@thog.eu>2021-05-25 19:01:09 +0200
committerGitHub <noreply@github.com>2021-05-25 19:01:09 +0200
commitf3b0b4831c323a20393aa0388f947317354372b7 (patch)
tree478412fd3a8c2de6eab5e54dd47944f59bf1a836 /Ryujinx.Audio/Renderer/Server/CommandProcessingTimeEstimatorVersion3.cs
parent54ea2285f05ef6f59a6f1c63df4a7bdd77d7b883 (diff)
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
Diffstat (limited to 'Ryujinx.Audio/Renderer/Server/CommandProcessingTimeEstimatorVersion3.cs')
-rw-r--r--Ryujinx.Audio/Renderer/Server/CommandProcessingTimeEstimatorVersion3.cs123
1 files changed, 123 insertions, 0 deletions
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}");
+ }
+ }
}
}