summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
authorAdmiral H. Curtiss <pikachu025@gmail.com>2024-04-13 03:57:13 +0200
committerGitHub <noreply@github.com>2024-04-13 03:57:13 +0200
commit1bfeeb8a631bf3ad3d357b3c920ca8e8a456344e (patch)
tree2428947d3e77b039bc32ee4c180e79c0cb08e0ff /Source/Core
parentb3939052b4319e7c93de6ce424bf1c5d71ea2d41 (diff)
parent8533b5649e858bd43c4855094cb278a86909ad86 (diff)
Merge pull request #12693 from Tilka/zelda3
DSPHLE/Zelda: simplify AFC decoding
Diffstat (limited to 'Source/Core')
-rw-r--r--Source/Core/Core/HW/DSPHLE/UCodes/Zelda.cpp14
1 files changed, 4 insertions, 10 deletions
diff --git a/Source/Core/Core/HW/DSPHLE/UCodes/Zelda.cpp b/Source/Core/Core/HW/DSPHLE/UCodes/Zelda.cpp
index 996db94991..b11a2bcb0b 100644
--- a/Source/Core/Core/HW/DSPHLE/UCodes/Zelda.cpp
+++ b/Source/Core/Core/HW/DSPHLE/UCodes/Zelda.cpp
@@ -1735,6 +1735,7 @@ void ZeldaAudioRenderer::DecodeAFC(VPB* vpb, s16* dst, size_t block_count)
if (vpb->samples_source_type == VPB::SRC_AFC_HQ_FROM_ARAM)
{
+ // 4-bit samples
for (size_t i = 0; i < 16; i += 2)
{
nibbles[i + 0] = *src >> 4;
@@ -1742,14 +1743,11 @@ void ZeldaAudioRenderer::DecodeAFC(VPB* vpb, s16* dst, size_t block_count)
src++;
}
for (auto& nibble : nibbles)
- {
- if (nibble >= 8)
- nibble -= 16;
- nibble <<= 11;
- }
+ nibble = s16(nibble << 12) >> 1;
}
else
{
+ // 2-bit samples
for (size_t i = 0; i < 16; i += 4)
{
nibbles[i + 0] = (*src >> 6) & 3;
@@ -1759,11 +1757,7 @@ void ZeldaAudioRenderer::DecodeAFC(VPB* vpb, s16* dst, size_t block_count)
src++;
}
for (auto& nibble : nibbles)
- {
- if (nibble >= 2)
- nibble -= 4;
- nibble <<= 13;
- }
+ nibble = s16(nibble << 14) >> 1;
}
s32 yn1 = *vpb->AFCYN1(), yn2 = *vpb->AFCYN2();