is this optimization, or DE-optimization?!

This commit is contained in:
tildearrow 2023-02-11 18:51:35 -05:00
parent aa7ebae3db
commit 2d7a4b6f5f
2 changed files with 11 additions and 20 deletions

View File

@ -429,8 +429,6 @@ class es550x_shared_core : public vgsound_emu_core
inline s32 o4_1() { return m_o[4][0]; }
private:
void lp_exec(s32 coeff, const s32 in, const s32 out);
void hp_exec(s32 coeff, const s32 in, const s32 out);
// Registers
u8 m_lp = 0; // Filter mode

View File

@ -8,6 +8,17 @@
#include "es550x.hpp"
// Yn = K*(Xn - Yn-1) + Yn-1
#define lp_exec(coeff,in,out) \
m_o[out][1] = m_o[out][0]; \
m_o[out][0] = ((coeff * (m_o[in][0] - m_o[out][0])) / 4096) + m_o[out][0];
// Yn = Xn - Xn-1 + K*Yn-1
#define hp_exec(coeff,in,out) \
m_o[out][1] = m_o[out][0]; \
m_o[out][0] = m_o[in][0] - m_o[in][1] + ((coeff * m_o[out][0]) / 8192) + (m_o[out][0] / 2);
// Filter functions
void es550x_shared_core::es550x_voice_t::es550x_filter_t::reset()
{
@ -49,21 +60,3 @@ void es550x_shared_core::es550x_voice_t::es550x_filter_t::tick(s32 in)
break;
}
}
void es550x_shared_core::es550x_voice_t::es550x_filter_t::lp_exec(s32 coeff, const s32 in, const s32 out)
{
// Store previous filter data
m_o[out][1] = m_o[out][0];
// Yn = K*(Xn - Yn-1) + Yn-1
m_o[out][0] = ((coeff * (m_o[in][0] - m_o[out][0])) / 4096) + m_o[out][0];
}
void es550x_shared_core::es550x_voice_t::es550x_filter_t::hp_exec(s32 coeff, const s32 in, const s32 out)
{
// Store previous filter data
m_o[out][1] = m_o[out][0];
// Yn = Xn - Xn-1 + K*Yn-1
m_o[out][0] = m_o[in][0] - m_o[in][1] + ((coeff * m_o[out][0]) / 8192) + (m_o[out][0] / 2);
}