codec: Make lookup table static constexpr (#5572)
Allows compilers to elide needing to push these values on the stack every time the function is called. Co-authored-by: Lioncash <mathew1800@gmail.com>
This commit is contained in:
parent
702af87f0d
commit
f0e3637c7a
|
@ -21,8 +21,9 @@ StereoBuffer16 DecodeADPCM(const u8* const data, const std::size_t sample_count,
|
||||||
|
|
||||||
constexpr std::size_t FRAME_LEN = 8;
|
constexpr std::size_t FRAME_LEN = 8;
|
||||||
constexpr std::size_t SAMPLES_PER_FRAME = 14;
|
constexpr std::size_t SAMPLES_PER_FRAME = 14;
|
||||||
constexpr std::array<int, 16> SIGNED_NIBBLES = {
|
static constexpr std::array<int, 16> SIGNED_NIBBLES{
|
||||||
{0, 1, 2, 3, 4, 5, 6, 7, -8, -7, -6, -5, -4, -3, -2, -1}};
|
0, 1, 2, 3, 4, 5, 6, 7, -8, -7, -6, -5, -4, -3, -2, -1,
|
||||||
|
};
|
||||||
|
|
||||||
const std::size_t ret_size =
|
const std::size_t ret_size =
|
||||||
sample_count % 2 == 0 ? sample_count : sample_count + 1; // Ensure multiple of two.
|
sample_count % 2 == 0 ? sample_count : sample_count + 1; // Ensure multiple of two.
|
||||||
|
|
|
@ -25,7 +25,7 @@ struct ADPCMState {
|
||||||
* @param state ADPCM state, this is updated with new state
|
* @param state ADPCM state, this is updated with new state
|
||||||
* @return Decoded stereo signed PCM16 data, sample_count in length
|
* @return Decoded stereo signed PCM16 data, sample_count in length
|
||||||
*/
|
*/
|
||||||
StereoBuffer16 DecodeADPCM(const u8* const data, const std::size_t sample_count,
|
StereoBuffer16 DecodeADPCM(const u8* data, const std::size_t sample_count,
|
||||||
const std::array<s16, 16>& adpcm_coeff, ADPCMState& state);
|
const std::array<s16, 16>& adpcm_coeff, ADPCMState& state);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Reference in New Issue