From b8ad676fb8cbe0a43617df41daaf284ab4421c75 Mon Sep 17 00:00:00 2001 From: Mary Date: Sun, 18 Jul 2021 13:05:11 +0200 Subject: Amadeus: DSP code generation improvements (#2460) This improve RyuJIT codegen drastically on the DSP side. This may reduce CPU usage of the DSP thread quite a lot. --- .../Dsp/Command/DownMixSurroundToStereoCommand.cs | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) (limited to 'Ryujinx.Audio/Renderer/Dsp/Command/DownMixSurroundToStereoCommand.cs') diff --git a/Ryujinx.Audio/Renderer/Dsp/Command/DownMixSurroundToStereoCommand.cs b/Ryujinx.Audio/Renderer/Dsp/Command/DownMixSurroundToStereoCommand.cs index f81a2849..1c62ef07 100644 --- a/Ryujinx.Audio/Renderer/Dsp/Command/DownMixSurroundToStereoCommand.cs +++ b/Ryujinx.Audio/Renderer/Dsp/Command/DownMixSurroundToStereoCommand.cs @@ -35,7 +35,7 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command public float[] Coefficients { get; } - public DownMixSurroundToStereoCommand(uint bufferOffset, Span inputBufferOffset, Span outputBufferOffset, ReadOnlySpan downMixParameter, int nodeId) + public DownMixSurroundToStereoCommand(uint bufferOffset, Span inputBufferOffset, Span outputBufferOffset, float[] downMixParameter, int nodeId) { Enabled = true; NodeId = nodeId; @@ -49,7 +49,7 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command OutputBufferIndices[i] = (ushort)(bufferOffset + outputBufferOffset[i]); } - Coefficients = downMixParameter.ToArray(); + Coefficients = downMixParameter; } [MethodImpl(MethodImplOptions.AggressiveInlining)] @@ -69,10 +69,6 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command Span stereoLeft = context.GetBuffer(OutputBufferIndices[0]); Span stereoRight = context.GetBuffer(OutputBufferIndices[1]); - Span unused2 = context.GetBuffer(OutputBufferIndices[2]); - Span unused3 = context.GetBuffer(OutputBufferIndices[3]); - Span unused4 = context.GetBuffer(OutputBufferIndices[4]); - Span unused5 = context.GetBuffer(OutputBufferIndices[5]); for (int i = 0; i < context.SampleCount; i++) { @@ -80,10 +76,10 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command stereoRight[i] = DownMixSurroundToStereo(Coefficients, backRight[i], lowFrequency[i], frontCenter[i], frontRight[i]); } - unused2.Fill(0); - unused3.Fill(0); - unused4.Fill(0); - unused5.Fill(0); + context.ClearBuffer(OutputBufferIndices[2]); + context.ClearBuffer(OutputBufferIndices[3]); + context.ClearBuffer(OutputBufferIndices[4]); + context.ClearBuffer(OutputBufferIndices[5]); } } } -- cgit v1.2.3