audio_core: dsp_hle: add Media Foundation decoder...
* appveyor: switch to Media Foundation API * Travis CI MinGW build needs an update with the container image
This commit is contained in:
parent
1581dea6de
commit
80b4dd21d2
13 changed files with 839 additions and 22 deletions
|
@ -9,6 +9,7 @@ add_executable(tests
|
|||
core/hle/kernel/hle_ipc.cpp
|
||||
core/memory/memory.cpp
|
||||
core/memory/vm_manager.cpp
|
||||
audio_core/decoder_tests.cpp
|
||||
tests.cpp
|
||||
)
|
||||
|
||||
|
@ -21,7 +22,7 @@ endif()
|
|||
|
||||
create_target_directory_groups(tests)
|
||||
|
||||
target_link_libraries(tests PRIVATE common core video_core)
|
||||
target_link_libraries(tests PRIVATE common core video_core audio_core)
|
||||
target_link_libraries(tests PRIVATE ${PLATFORM_LIBRARIES} catch-single-include nihstro-headers Threads::Threads)
|
||||
|
||||
add_test(NAME tests COMMAND tests)
|
||||
|
|
5
src/tests/audio_core/audio_fixures.h
Normal file
5
src/tests/audio_core/audio_fixures.h
Normal file
|
@ -0,0 +1,5 @@
|
|||
const int fixure_buffer_size = 41;
|
||||
const unsigned char fixure_buffer[41] = {
|
||||
0xff, 0xf1, 0x4c, 0x80, 0x05, 0x3f, 0xfc, 0x21, 0x1a, 0x4e, 0xb0, 0x00, 0x00, 0x00,
|
||||
0x05, 0xfc, 0x4e, 0x1f, 0x08, 0x88, 0x00, 0x00, 0x00, 0xc4, 0x1a, 0x03, 0xfc, 0x9c,
|
||||
0x3e, 0x1d, 0x08, 0x84, 0x03, 0xd8, 0x3f, 0xe4, 0xe1, 0x20, 0x00, 0x0b, 0x38};
|
50
src/tests/audio_core/decoder_tests.cpp
Normal file
50
src/tests/audio_core/decoder_tests.cpp
Normal file
|
@ -0,0 +1,50 @@
|
|||
// Copyright 2017 Citra Emulator Project
|
||||
// Licensed under GPLv2 or any later version
|
||||
// Refer to the license.txt file included.
|
||||
#ifdef HAVE_MF
|
||||
|
||||
#include <catch2/catch.hpp>
|
||||
#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"
|
||||
#include "audio_core/hle/wmf_decoder.h"
|
||||
#include "audio_fixures.h"
|
||||
|
||||
TEST_CASE("DSP HLE Audio Decoder", "[audio_core]") {
|
||||
// HACK: see comments of member timing
|
||||
Core::System::GetInstance().timing = std::make_unique<Core::Timing>();
|
||||
Core::System::GetInstance().memory = std::make_unique<Memory::MemorySystem>();
|
||||
Kernel::KernelSystem kernel(*Core::System::GetInstance().memory, 0);
|
||||
SECTION("decoder should produce correct samples") {
|
||||
auto process = kernel.CreateProcess(kernel.CreateCodeSet("", 0));
|
||||
auto decoder =
|
||||
std::make_unique<AudioCore::HLE::WMFDecoder>(*Core::System::GetInstance().memory);
|
||||
AudioCore::HLE::BinaryRequest request;
|
||||
|
||||
request.codec = AudioCore::HLE::DecoderCodec::AAC;
|
||||
request.cmd = AudioCore::HLE::DecoderCommand::Init;
|
||||
// initialize decoder
|
||||
std::optional<AudioCore::HLE::BinaryResponse> response = decoder->ProcessRequest(request);
|
||||
|
||||
request.cmd = AudioCore::HLE::DecoderCommand::Decode;
|
||||
u8* fcram = Core::System::GetInstance().memory->GetFCRAMPointer(0);
|
||||
|
||||
memcpy(fcram, fixure_buffer, fixure_buffer_size);
|
||||
request.src_addr = Memory::FCRAM_PADDR;
|
||||
request.dst_addr_ch0 = Memory::FCRAM_PADDR + 1024;
|
||||
request.dst_addr_ch1 = Memory::FCRAM_PADDR + 1048576; // 1 MB
|
||||
request.size = fixure_buffer_size;
|
||||
|
||||
response = decoder->ProcessRequest(request);
|
||||
response = decoder->ProcessRequest(request);
|
||||
// remove this line
|
||||
request.src_addr = Memory::FCRAM_PADDR;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
Loading…
Add table
Add a link
Reference in a new issue