Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AX: use AVX2 to save some CPU time #12745

Draft
wants to merge 6 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions Source/Core/Core/HW/DSPHLE/UCodes/AX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -436,9 +436,9 @@ void AXUCode::ProcessPBList(u32 pb_addr)
{
ApplyUpdatesForMs(curr_ms, pb, pb.updates.num_updates, updates);

ProcessVoice(static_cast<HLEAccelerator*>(m_accelerator.get()), pb, buffers, spms,
ConvertMixerControl(pb.mixer_control),
m_coeffs_checksum ? m_coeffs.data() : nullptr);
ProcessVoice<spms>(static_cast<HLEAccelerator*>(m_accelerator.get()), pb, buffers,
ConvertMixerControl(pb.mixer_control),
m_coeffs_checksum ? m_coeffs.data() : nullptr, false);

// Forward the buffers
for (auto& ptr : buffers.ptrs)
Expand Down
18 changes: 9 additions & 9 deletions Source/Core/Core/HW/DSPHLE/UCodes/AX.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,15 +87,15 @@ class AXUCode /* not final: subclassed by AXWiiUCode */ : public UCodeInterface
static constexpr u32 MAIL_CMDLIST_MASK = 0xFFFF0000;

// 32 * 5 because 32 samples per millisecond, for max 5 milliseconds.
int m_samples_main_left[32 * 5]{};
int m_samples_main_right[32 * 5]{};
int m_samples_main_surround[32 * 5]{};
int m_samples_auxA_left[32 * 5]{};
int m_samples_auxA_right[32 * 5]{};
int m_samples_auxA_surround[32 * 5]{};
int m_samples_auxB_left[32 * 5]{};
int m_samples_auxB_right[32 * 5]{};
int m_samples_auxB_surround[32 * 5]{};
alignas(32) int m_samples_main_left[32 * 5]{};
alignas(32) int m_samples_main_right[32 * 5]{};
alignas(32) int m_samples_main_surround[32 * 5]{};
alignas(32) int m_samples_auxA_left[32 * 5]{};
alignas(32) int m_samples_auxA_right[32 * 5]{};
alignas(32) int m_samples_auxA_surround[32 * 5]{};
alignas(32) int m_samples_auxB_left[32 * 5]{};
alignas(32) int m_samples_auxB_right[32 * 5]{};
alignas(32) int m_samples_auxB_surround[32 * 5]{};

u16 m_cmdlist[512]{};
u32 m_cmdlist_size = 0;
Expand Down
29 changes: 15 additions & 14 deletions Source/Core/Core/HW/DSPHLE/UCodes/AXStructs.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace DSP::HLE
struct VolumeData
{
u16 volume;
u16 volume_delta;
s16 volume_delta;
};

struct PBMixer
Expand Down Expand Up @@ -177,13 +177,13 @@ struct PBADPCMLoopInfo

struct PBLowPassFilter
{
u16 enabled;
u16 on;
s16 yn1;
u16 a0;
u16 b0;
};

struct AXPB
struct alignas(32) AXPB
{
u16 next_pb_hi;
u16 next_pb_lo;
Expand Down Expand Up @@ -215,25 +215,26 @@ struct AXPB

struct PBBiquadFilter
{
u16 on; // on = 2, off = 0
u16 xn1; // History data
u16 xn2;
u16 yn1;
u16 yn2;
u16 b0; // Filter coefficients
u16 b1;
u16 b2;
u16 a1;
u16 a2;
u16 on;
s16 xn1; // History data
s16 xn2;
s16 yn1;
s16 yn2;
s16 b0; // Filter coefficients
s16 b1;
s16 b2;
s16 a1;
s16 a2;
};

union PBInfImpulseResponseWM
{
u16 on; // 0: off, 2: biquad, other: low-pass
PBLowPassFilter lpf;
PBBiquadFilter biquad;
};

struct AXPBWii
struct alignas(32) AXPBWii
{
u16 next_pb_hi;
u16 next_pb_lo;
Expand Down