mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-21 05:09:34 -06:00
Name gain shift/scaling better
This commit is contained in:

committed by
Tillmann Karras

parent
512da86b1a
commit
cd77e682ca
@ -190,16 +190,16 @@ u16 Accelerator::ReadSample(const s16* coefs)
|
||||
{
|
||||
// Gain seems to only apply for PCM decoding
|
||||
u8 gain_shift = 0;
|
||||
switch (m_sample_format.gain_cfg)
|
||||
switch (m_sample_format.gain_scale)
|
||||
{
|
||||
case FormatGainCfg::GainShift11:
|
||||
gain_shift = 11;
|
||||
case FormatGainScale::GainScale2048:
|
||||
gain_shift = 11; // x / 2048 = x >> 11
|
||||
break;
|
||||
case FormatGainCfg::GainShift0:
|
||||
gain_shift = 0;
|
||||
case FormatGainScale::GainScale1:
|
||||
gain_shift = 0; // x / 1 = x >> 0
|
||||
break;
|
||||
case FormatGainCfg::GainShift16:
|
||||
gain_shift = 16;
|
||||
case FormatGainScale::GainScale65536:
|
||||
gain_shift = 16; // x / 65536 = x >> 16
|
||||
break;
|
||||
default:
|
||||
ERROR_LOG_FMT(DSPLLE, "dsp_read_accelerator_sample() invalid gain mode in format {:#x}",
|
||||
|
@ -70,14 +70,14 @@ protected:
|
||||
MMIOPCMInc = 3 // PCM reads from ACIN, ACCA increments
|
||||
};
|
||||
|
||||
// When reading samples (at least in PCM mode), they are multiplied by the gain, then shifted
|
||||
// right by an amount dependent on this config
|
||||
enum class FormatGainCfg : u16
|
||||
// When reading samples (at least in PCM mode), they are multiplied by the gain, then divided by
|
||||
// the value specified here
|
||||
enum class FormatGainScale : u16
|
||||
{
|
||||
GainShift11 = 0,
|
||||
GainShift0 = 1,
|
||||
GainShift16 = 2,
|
||||
GainInvalid = 3
|
||||
GainScale2048 = 0,
|
||||
GainScale1 = 1,
|
||||
GainScale65536 = 2,
|
||||
GainScaleInvalid = 3
|
||||
};
|
||||
|
||||
union SampleFormat
|
||||
@ -85,7 +85,7 @@ protected:
|
||||
u16 hex;
|
||||
BitField<0, 2, FormatSize> size;
|
||||
BitField<2, 2, FormatDecode> decode;
|
||||
BitField<4, 2, FormatGainCfg> gain_cfg;
|
||||
BitField<4, 2, FormatGainScale> gain_scale;
|
||||
BitField<6, 10, u16> unk;
|
||||
} m_sample_format{0};
|
||||
|
||||
|
Reference in New Issue
Block a user