mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2025-01-13 15:13:42 +01:00
Fix bug in pcm delta compression.
error wasn't being correctly calculated for when new_sample was negative and sample was positive.
This commit is contained in:
parent
c506cf747f
commit
fb396395e9
@ -426,7 +426,9 @@ int get_delta_index(uint8_t sample, uint8_t prev_sample)
|
||||
for (int i = 0; i < 16; i++)
|
||||
{
|
||||
uint8_t new_sample = prev_sample + gDeltaEncodingTable[i];
|
||||
int error = sample > new_sample ? sample - new_sample : new_sample - sample;
|
||||
uint8_t sample_diff_1 = (sample - new_sample) & 0xff;
|
||||
uint8_t sample_diff_2 = (new_sample - sample) & 0xff;
|
||||
int error = sample_diff_1 < sample_diff_2 ? sample_diff_1 : sample_diff_2;
|
||||
|
||||
if (error < best_error)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user