2019-01-06 04:53:24 +00:00
|
|
|
// Copyright 2019 Citra Emulator Project
|
2018-12-19 16:12:57 +00:00
|
|
|
// Licensed under GPLv2 or any later version
|
|
|
|
// Refer to the license.txt file included.
|
2019-01-05 00:06:12 +00:00
|
|
|
#if defined(HAVE_MF) || defined(HAVE_FFMPEG)
|
2018-12-19 16:12:57 +00:00
|
|
|
|
2022-09-21 16:36:12 +00:00
|
|
|
#include <catch2/catch_test_macros.hpp>
|
2018-12-19 16:12:57 +00:00
|
|
|
#include "core/core.h"
|
|
|
|
#include "core/core_timing.h"
|
|
|
|
#include "core/hle/kernel/memory.h"
|
|
|
|
#include "core/hle/kernel/process.h"
|
|
|
|
#include "core/hle/kernel/shared_page.h"
|
|
|
|
#include "core/memory.h"
|
|
|
|
|
|
|
|
#include "audio_core/hle/decoder.h"
|
2019-01-05 00:06:12 +00:00
|
|
|
#ifdef HAVE_MF
|
2018-12-19 16:12:57 +00:00
|
|
|
#include "audio_core/hle/wmf_decoder.h"
|
2019-01-05 00:06:12 +00:00
|
|
|
#elif HAVE_FFMPEG
|
|
|
|
#include "audio_core/hle/ffmpeg_decoder.h"
|
|
|
|
#endif
|
2018-12-19 16:12:57 +00:00
|
|
|
#include "audio_fixures.h"
|
|
|
|
|
|
|
|
TEST_CASE("DSP HLE Audio Decoder", "[audio_core]") {
|
2023-08-01 22:40:39 +00:00
|
|
|
Core::System system;
|
|
|
|
Memory::MemorySystem memory{system};
|
2018-12-19 16:12:57 +00:00
|
|
|
SECTION("decoder should produce correct samples") {
|
|
|
|
auto decoder =
|
2019-01-05 00:06:12 +00:00
|
|
|
#ifdef HAVE_MF
|
2019-02-14 19:08:45 +00:00
|
|
|
std::make_unique<AudioCore::HLE::WMFDecoder>(memory);
|
2019-01-05 00:06:12 +00:00
|
|
|
#elif HAVE_FFMPEG
|
2019-02-14 19:08:45 +00:00
|
|
|
std::make_unique<AudioCore::HLE::FFMPEGDecoder>(memory);
|
2019-01-05 00:06:12 +00:00
|
|
|
#endif
|
2023-05-14 16:55:10 +00:00
|
|
|
AudioCore::HLE::BinaryMessage request{};
|
2018-12-19 16:12:57 +00:00
|
|
|
|
2023-05-14 16:55:10 +00:00
|
|
|
request.header.codec = AudioCore::HLE::DecoderCodec::DecodeAAC;
|
|
|
|
request.header.cmd = AudioCore::HLE::DecoderCommand::Init;
|
2018-12-19 16:12:57 +00:00
|
|
|
// initialize decoder
|
2023-05-14 16:55:10 +00:00
|
|
|
std::optional<AudioCore::HLE::BinaryMessage> response = decoder->ProcessRequest(request);
|
2018-12-19 16:12:57 +00:00
|
|
|
|
2023-05-14 16:55:10 +00:00
|
|
|
request.header.cmd = AudioCore::HLE::DecoderCommand::EncodeDecode;
|
2019-02-14 19:08:45 +00:00
|
|
|
u8* fcram = memory.GetFCRAMPointer(0);
|
2018-12-19 16:12:57 +00:00
|
|
|
|
2023-07-06 22:52:40 +00:00
|
|
|
std::memcpy(fcram, fixure_buffer, fixure_buffer_size);
|
2023-05-14 16:55:10 +00:00
|
|
|
request.decode_aac_request.src_addr = Memory::FCRAM_PADDR;
|
|
|
|
request.decode_aac_request.dst_addr_ch0 = Memory::FCRAM_PADDR + 1024;
|
|
|
|
request.decode_aac_request.dst_addr_ch1 = Memory::FCRAM_PADDR + 1048576; // 1 MB
|
|
|
|
request.decode_aac_request.size = fixure_buffer_size;
|
2018-12-19 16:12:57 +00:00
|
|
|
|
|
|
|
response = decoder->ProcessRequest(request);
|
|
|
|
response = decoder->ProcessRequest(request);
|
|
|
|
// remove this line
|
2023-05-14 16:55:10 +00:00
|
|
|
request.decode_aac_request.src_addr = Memory::FCRAM_PADDR;
|
2018-12-19 16:12:57 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|