aboutsummaryrefslogtreecommitdiff
path: root/src/Ryujinx.Audio/Renderer/Dsp/ResamplerHelper.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Ryujinx.Audio/Renderer/Dsp/ResamplerHelper.cs')
-rw-r--r--src/Ryujinx.Audio/Renderer/Dsp/ResamplerHelper.cs45
1 files changed, 20 insertions, 25 deletions
diff --git a/src/Ryujinx.Audio/Renderer/Dsp/ResamplerHelper.cs b/src/Ryujinx.Audio/Renderer/Dsp/ResamplerHelper.cs
index 7873c4d2..e44e9f41 100644
--- a/src/Ryujinx.Audio/Renderer/Dsp/ResamplerHelper.cs
+++ b/src/Ryujinx.Audio/Renderer/Dsp/ResamplerHelper.cs
@@ -1,6 +1,5 @@
using System;
using System.Linq;
-using System.Numerics;
using System.Runtime.CompilerServices;
using System.Runtime.Intrinsics;
using System.Runtime.Intrinsics.X86;
@@ -11,8 +10,7 @@ namespace Ryujinx.Audio.Renderer.Dsp
public static class ResamplerHelper
{
#region "Default Quality Lookup Tables"
- private static short[] _normalCurveLut0 = new short[]
- {
+ private static readonly short[] _normalCurveLut0 = {
6600, 19426, 6722, 3, 6479, 19424, 6845, 9, 6359, 19419, 6968, 15, 6239, 19412, 7093, 22,
6121, 19403, 7219, 28, 6004, 19391, 7345, 34, 5888, 19377, 7472, 41, 5773, 19361, 7600, 48,
5659, 19342, 7728, 55, 5546, 19321, 7857, 62, 5434, 19298, 7987, 69, 5323, 19273, 8118, 77,
@@ -44,11 +42,10 @@ namespace Ryujinx.Audio.Renderer.Dsp
109, 8646, 19148, 4890, 101, 8513, 19183, 4997, 92, 8381, 19215, 5104, 84, 8249, 19245, 5213,
77, 8118, 19273, 5323, 69, 7987, 19298, 5434, 62, 7857, 19321, 5546, 55, 7728, 19342, 5659,
48, 7600, 19361, 5773, 41, 7472, 19377, 5888, 34, 7345, 19391, 6004, 28, 7219, 19403, 6121,
- 22, 7093, 19412, 6239, 15, 6968, 19419, 6359, 9, 6845, 19424, 6479, 3, 6722, 19426, 6600
+ 22, 7093, 19412, 6239, 15, 6968, 19419, 6359, 9, 6845, 19424, 6479, 3, 6722, 19426, 6600,
};
- private static short[] _normalCurveLut1 = new short[]
- {
+ private static readonly short[] _normalCurveLut1 = {
-68, 32639, 69, -5, -200, 32630, 212, -15, -328, 32613, 359, -26, -450, 32586, 512, -36,
-568, 32551, 669, -47, -680, 32507, 832, -58, -788, 32454, 1000, -69, -891, 32393, 1174, -80,
-990, 32323, 1352, -92, -1084, 32244, 1536, -103, -1173, 32157, 1724, -115, -1258, 32061, 1919, -128,
@@ -80,11 +77,10 @@ namespace Ryujinx.Audio.Renderer.Dsp
-180, 2747, 31593, -1554, -167, 2532, 31723, -1486, -153, 2322, 31844, -1414, -140, 2118, 31956, -1338,
-128, 1919, 32061, -1258, -115, 1724, 32157, -1173, -103, 1536, 32244, -1084, -92, 1352, 32323, -990,
-80, 1174, 32393, -891, -69, 1000, 32454, -788, -58, 832, 32507, -680, -47, 669, 32551, -568,
- -36, 512, 32586, -450, -26, 359, 32613, -328, -15, 212, 32630, -200, -5, 69, 32639, -68
+ -36, 512, 32586, -450, -26, 359, 32613, -328, -15, 212, 32630, -200, -5, 69, 32639, -68,
};
- private static short[] _normalCurveLut2 = new short[]
- {
+ private static readonly short[] _normalCurveLut2 = {
3195, 26287, 3329, -32, 3064, 26281, 3467, -34, 2936, 26270, 3608, -38, 2811, 26253, 3751, -42,
2688, 26230, 3897, -46, 2568, 26202, 4046, -50, 2451, 26169, 4199, -54, 2338, 26130, 4354, -58,
2227, 26085, 4512, -63, 2120, 26035, 4673, -67, 2015, 25980, 4837, -72, 1912, 25919, 5004, -76,
@@ -116,13 +112,12 @@ namespace Ryujinx.Audio.Renderer.Dsp
-98, 5701, 25621, 1531, -92, 5522, 25704, 1622, -87, 5347, 25780, 1716, -81, 5174, 25852, 1813,
-76, 5004, 25919, 1912, -72, 4837, 25980, 2015, -67, 4673, 26035, 2120, -63, 4512, 26085, 2227,
-58, 4354, 26130, 2338, -54, 4199, 26169, 2451, -50, 4046, 26202, 2568, -46, 3897, 26230, 2688,
- -42, 3751, 26253, 2811, -38, 3608, 26270, 2936, -34, 3467, 26281, 3064, -32, 3329, 26287, 3195
+ -42, 3751, 26253, 2811, -38, 3608, 26270, 2936, -34, 3467, 26281, 3064, -32, 3329, 26287, 3195,
};
#endregion
#region "High Quality Lookup Tables"
- private static short[] _highCurveLut0 = new short[]
- {
+ private static readonly short[] _highCurveLut0 = {
-582, -23, 8740, 16386, 8833, 8, -590, 0, -573, -54, 8647, 16385, 8925, 40, -598, -1,
-565, -84, 8555, 16383, 9018, 72, -606, -1, -557, -113, 8462, 16379, 9110, 105, -614, -2,
-549, -142, 8370, 16375, 9203, 139, -622, -2, -541, -170, 8277, 16369, 9295, 173, -630, -3,
@@ -189,8 +184,7 @@ namespace Ryujinx.Audio.Renderer.Dsp
-1, -598, 40, 8925, 16385, 8647, -54, -573, 0, -590, 8, 8833, 16386, 8740, -23, -582,
};
- private static short[] _highCurveLut1 = new short[]
- {
+ private static readonly short[] _highCurveLut1 = {
-12, 47, -134, 32767, 81, -16, 2, 0, -26, 108, -345, 32760, 301, -79, 17, -1,
-40, 168, -552, 32745, 526, -144, 32, -2, -53, 226, -753, 32723, 755, -210, 47, -3,
-66, 284, -950, 32694, 989, -277, 63, -5, -78, 340, -1143, 32658, 1226, -346, 79, -6,
@@ -257,8 +251,7 @@ namespace Ryujinx.Audio.Renderer.Dsp
-1, 17, -79, 301, 32760, -345, 108, -26, 0, 2, -16, 81, 32767, -134, 47, -12,
};
- private static short[] _highCurveLut2 = new short[]
- {
+ private static readonly short[] _highCurveLut2 = {
418, -2538, 6118, 24615, 6298, -2563, 417, 0, 420, -2512, 5939, 24611, 6479, -2588, 415, 1,
421, -2485, 5761, 24605, 6662, -2612, 412, 2, 422, -2458, 5585, 24595, 6846, -2635, 409, 3,
423, -2430, 5410, 24582, 7030, -2658, 406, 4, 423, -2402, 5236, 24565, 7216, -2680, 403, 5,
@@ -326,13 +319,13 @@ namespace Ryujinx.Audio.Renderer.Dsp
};
#endregion
- private static float[] _normalCurveLut0F;
- private static float[] _normalCurveLut1F;
- private static float[] _normalCurveLut2F;
+ private static readonly float[] _normalCurveLut0F;
+ private static readonly float[] _normalCurveLut1F;
+ private static readonly float[] _normalCurveLut2F;
- private static float[] _highCurveLut0F;
- private static float[] _highCurveLut1F;
- private static float[] _highCurveLut2F;
+ private static readonly float[] _highCurveLut0F;
+ private static readonly float[] _highCurveLut1F;
+ private static readonly float[] _highCurveLut2F;
static ResamplerHelper()
{
@@ -373,7 +366,8 @@ namespace Ryujinx.Audio.Renderer.Dsp
{
return _normalCurveLut1F;
}
- else if (ratio > 1.333313f)
+
+ if (ratio > 1.333313f)
{
return _normalCurveLut0F;
}
@@ -514,7 +508,8 @@ namespace Ryujinx.Audio.Renderer.Dsp
{
return _highCurveLut1F;
}
- else if (ratio > 1.333313f)
+
+ if (ratio > 1.333313f)
{
return _highCurveLut0F;
}
@@ -601,4 +596,4 @@ namespace Ryujinx.Audio.Renderer.Dsp
}
}
}
-} \ No newline at end of file
+}