From a6bb1b642a408005bb5aa15624e1f6758e34c319 Mon Sep 17 00:00:00 2001 From: JosJuice Date: Sat, 15 Oct 2016 15:01:24 +0200 Subject: [PATCH] DVDInterface: Better memory locality for DTK byteswapping --- Source/Core/Core/HW/DVDInterface.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Source/Core/Core/HW/DVDInterface.cpp b/Source/Core/Core/HW/DVDInterface.cpp index dabb290efa..b87f3e88e2 100644 --- a/Source/Core/Core/HW/DVDInterface.cpp +++ b/Source/Core/Core/HW/DVDInterface.cpp @@ -324,14 +324,15 @@ static size_t ProcessDTKSamples(std::vector* temp_pcm, const std::vectorsize() / 2 && bytes_processed < audio_data.size()) { StreamADPCM::DecodeBlock(&(*temp_pcm)[samples_processed * 2], &audio_data[bytes_processed]); + for (size_t i = 0; i < StreamADPCM::SAMPLES_PER_BLOCK * 2; ++i) + { + // TODO: Fix the mixer so it can accept non-byte-swapped samples. + s16* sample = &(*temp_pcm)[samples_processed * 2 + i]; + *sample = Common::swap16(*sample); + } samples_processed += StreamADPCM::SAMPLES_PER_BLOCK; bytes_processed += StreamADPCM::ONE_BLOCK_SIZE; } - for (size_t i = 0; i < samples_processed * 2; ++i) - { - // TODO: Fix the mixer so it can accept non-byte-swapped samples. - (*temp_pcm)[i] = Common::swap16((*temp_pcm)[i]); - } return samples_processed; }