citra-emu
/
citra-canary
Archived
1
0
Fork 0

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:
Tobias 2020-12-07 16:05:45 +01:00 committed by GitHub
parent 702af87f0d
commit f0e3637c7a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 3 deletions

View File

@ -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.

View File

@ -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);
/** /**