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
This commit is contained in:
Mary 2021-05-25 19:01:09 +02:00 committed by GitHub
parent 54ea2285f0
commit f3b0b4831c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
45 changed files with 1591 additions and 68 deletions

View file

@ -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}");
}
}
}
}