diff options
| author | 2023-11-04 18:25:40 +0000 | |
|---|---|---|
| committer | 2023-11-04 18:25:40 +0000 | |
| commit | 90aa937593e53a5d5e070fb623b228578b0b225f (patch) | |
| tree | 784daaa873597eb414d63ec680a8a1203b4b11b0 /src | |
| parent | Merge pull request #11952 from liamwhite/opus_stereo_count (diff) | |
| download | yuzu-90aa937593e53a5d5e070fb623b228578b0b225f.tar.gz yuzu-90aa937593e53a5d5e070fb623b228578b0b225f.tar.xz yuzu-90aa937593e53a5d5e070fb623b228578b0b225f.zip | |
Convert files to LF eol
Diffstat (limited to 'src')
| -rw-r--r-- | src/audio_core/adsp/apps/opus/opus_decode_object.cpp | 214 | ||||
| -rw-r--r-- | src/audio_core/adsp/apps/opus/opus_multistream_decode_object.cpp | 222 | ||||
| -rw-r--r-- | src/audio_core/opus/decoder.cpp | 358 | ||||
| -rw-r--r-- | src/audio_core/opus/decoder.h | 106 | ||||
| -rw-r--r-- | src/audio_core/opus/decoder_manager.cpp | 204 | ||||
| -rw-r--r-- | src/audio_core/opus/decoder_manager.h | 76 | ||||
| -rw-r--r-- | src/audio_core/opus/hardware_opus.cpp | 482 | ||||
| -rw-r--r-- | src/audio_core/opus/hardware_opus.h | 90 | ||||
| -rw-r--r-- | src/yuzu/configuration/config.h | 2 | ||||
| -rw-r--r-- | src/yuzu/configuration/configure_camera.h | 2 | ||||
| -rw-r--r-- | src/yuzu/configuration/configure_input.h | 2 | ||||
| -rw-r--r-- | src/yuzu/configuration/configure_input_player.h | 2 | ||||
| -rw-r--r-- | src/yuzu/configuration/configure_per_game.h | 2 | ||||
| -rw-r--r-- | src/yuzu/configuration/configure_ringcon.h | 2 | ||||
| -rw-r--r-- | src/yuzu/configuration/configure_tas.h | 2 | ||||
| -rw-r--r-- | src/yuzu/configuration/configure_touchscreen_advanced.h | 2 |
16 files changed, 884 insertions, 884 deletions
diff --git a/src/audio_core/adsp/apps/opus/opus_decode_object.cpp b/src/audio_core/adsp/apps/opus/opus_decode_object.cpp index 2c16d3769..e2b9eb566 100644 --- a/src/audio_core/adsp/apps/opus/opus_decode_object.cpp +++ b/src/audio_core/adsp/apps/opus/opus_decode_object.cpp | |||
| @@ -1,107 +1,107 @@ | |||
| 1 | // SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project | 1 | // SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project |
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later | 2 | // SPDX-License-Identifier: GPL-2.0-or-later |
| 3 | 3 | ||
| 4 | #include "audio_core/adsp/apps/opus/opus_decode_object.h" | 4 | #include "audio_core/adsp/apps/opus/opus_decode_object.h" |
| 5 | #include "common/assert.h" | 5 | #include "common/assert.h" |
| 6 | 6 | ||
| 7 | namespace AudioCore::ADSP::OpusDecoder { | 7 | namespace AudioCore::ADSP::OpusDecoder { |
| 8 | namespace { | 8 | namespace { |
| 9 | bool IsValidChannelCount(u32 channel_count) { | 9 | bool IsValidChannelCount(u32 channel_count) { |
| 10 | return channel_count == 1 || channel_count == 2; | 10 | return channel_count == 1 || channel_count == 2; |
| 11 | } | 11 | } |
| 12 | } // namespace | 12 | } // namespace |
| 13 | 13 | ||
| 14 | u32 OpusDecodeObject::GetWorkBufferSize(u32 channel_count) { | 14 | u32 OpusDecodeObject::GetWorkBufferSize(u32 channel_count) { |
| 15 | if (!IsValidChannelCount(channel_count)) { | 15 | if (!IsValidChannelCount(channel_count)) { |
| 16 | return 0; | 16 | return 0; |
| 17 | } | 17 | } |
| 18 | return static_cast<u32>(sizeof(OpusDecodeObject)) + opus_decoder_get_size(channel_count); | 18 | return static_cast<u32>(sizeof(OpusDecodeObject)) + opus_decoder_get_size(channel_count); |
| 19 | } | 19 | } |
| 20 | 20 | ||
| 21 | OpusDecodeObject& OpusDecodeObject::Initialize(u64 buffer, u64 buffer2) { | 21 | OpusDecodeObject& OpusDecodeObject::Initialize(u64 buffer, u64 buffer2) { |
| 22 | auto* new_decoder = reinterpret_cast<OpusDecodeObject*>(buffer); | 22 | auto* new_decoder = reinterpret_cast<OpusDecodeObject*>(buffer); |
| 23 | auto* comparison = reinterpret_cast<OpusDecodeObject*>(buffer2); | 23 | auto* comparison = reinterpret_cast<OpusDecodeObject*>(buffer2); |
| 24 | 24 | ||
| 25 | if (new_decoder->magic == DecodeObjectMagic) { | 25 | if (new_decoder->magic == DecodeObjectMagic) { |
| 26 | if (!new_decoder->initialized || | 26 | if (!new_decoder->initialized || |
| 27 | (new_decoder->initialized && new_decoder->self == comparison)) { | 27 | (new_decoder->initialized && new_decoder->self == comparison)) { |
| 28 | new_decoder->state_valid = true; | 28 | new_decoder->state_valid = true; |
| 29 | } | 29 | } |
| 30 | } else { | 30 | } else { |
| 31 | new_decoder->initialized = false; | 31 | new_decoder->initialized = false; |
| 32 | new_decoder->state_valid = true; | 32 | new_decoder->state_valid = true; |
| 33 | } | 33 | } |
| 34 | return *new_decoder; | 34 | return *new_decoder; |
| 35 | } | 35 | } |
| 36 | 36 | ||
| 37 | s32 OpusDecodeObject::InitializeDecoder(u32 sample_rate, u32 channel_count) { | 37 | s32 OpusDecodeObject::InitializeDecoder(u32 sample_rate, u32 channel_count) { |
| 38 | if (!state_valid) { | 38 | if (!state_valid) { |
| 39 | return OPUS_INVALID_STATE; | 39 | return OPUS_INVALID_STATE; |
| 40 | } | 40 | } |
| 41 | 41 | ||
| 42 | if (initialized) { | 42 | if (initialized) { |
| 43 | return OPUS_OK; | 43 | return OPUS_OK; |
| 44 | } | 44 | } |
| 45 | 45 | ||
| 46 | // Unfortunately libopus does not expose the OpusDecoder struct publicly, so we can't include | 46 | // Unfortunately libopus does not expose the OpusDecoder struct publicly, so we can't include |
| 47 | // it in this class. Nintendo does not allocate memory, which is why we have a workbuffer | 47 | // it in this class. Nintendo does not allocate memory, which is why we have a workbuffer |
| 48 | // provided. | 48 | // provided. |
| 49 | // We could use _create and have libopus allocate it for us, but then we have to separately | 49 | // We could use _create and have libopus allocate it for us, but then we have to separately |
| 50 | // track which decoder is being used between this and multistream in order to call the correct | 50 | // track which decoder is being used between this and multistream in order to call the correct |
| 51 | // destroy from the host side. | 51 | // destroy from the host side. |
| 52 | // This is a bit cringe, but is safe as these objects are only ever initialized inside the given | 52 | // This is a bit cringe, but is safe as these objects are only ever initialized inside the given |
| 53 | // workbuffer, and GetWorkBufferSize will guarantee there's enough space to follow. | 53 | // workbuffer, and GetWorkBufferSize will guarantee there's enough space to follow. |
| 54 | decoder = (LibOpusDecoder*)(this + 1); | 54 | decoder = (LibOpusDecoder*)(this + 1); |
| 55 | s32 ret = opus_decoder_init(decoder, sample_rate, channel_count); | 55 | s32 ret = opus_decoder_init(decoder, sample_rate, channel_count); |
| 56 | if (ret == OPUS_OK) { | 56 | if (ret == OPUS_OK) { |
| 57 | magic = DecodeObjectMagic; | 57 | magic = DecodeObjectMagic; |
| 58 | initialized = true; | 58 | initialized = true; |
| 59 | state_valid = true; | 59 | state_valid = true; |
| 60 | self = this; | 60 | self = this; |
| 61 | final_range = 0; | 61 | final_range = 0; |
| 62 | } | 62 | } |
| 63 | return ret; | 63 | return ret; |
| 64 | } | 64 | } |
| 65 | 65 | ||
| 66 | s32 OpusDecodeObject::Shutdown() { | 66 | s32 OpusDecodeObject::Shutdown() { |
| 67 | if (!state_valid) { | 67 | if (!state_valid) { |
| 68 | return OPUS_INVALID_STATE; | 68 | return OPUS_INVALID_STATE; |
| 69 | } | 69 | } |
| 70 | 70 | ||
| 71 | if (initialized) { | 71 | if (initialized) { |
| 72 | magic = 0x0; | 72 | magic = 0x0; |
| 73 | initialized = false; | 73 | initialized = false; |
| 74 | state_valid = false; | 74 | state_valid = false; |
| 75 | self = nullptr; | 75 | self = nullptr; |
| 76 | final_range = 0; | 76 | final_range = 0; |
| 77 | decoder = nullptr; | 77 | decoder = nullptr; |
| 78 | } | 78 | } |
| 79 | return OPUS_OK; | 79 | return OPUS_OK; |
| 80 | } | 80 | } |
| 81 | 81 | ||
| 82 | s32 OpusDecodeObject::ResetDecoder() { | 82 | s32 OpusDecodeObject::ResetDecoder() { |
| 83 | return opus_decoder_ctl(decoder, OPUS_RESET_STATE); | 83 | return opus_decoder_ctl(decoder, OPUS_RESET_STATE); |
| 84 | } | 84 | } |
| 85 | 85 | ||
| 86 | s32 OpusDecodeObject::Decode(u32& out_sample_count, u64 output_data, u64 output_data_size, | 86 | s32 OpusDecodeObject::Decode(u32& out_sample_count, u64 output_data, u64 output_data_size, |
| 87 | u64 input_data, u64 input_data_size) { | 87 | u64 input_data, u64 input_data_size) { |
| 88 | ASSERT(initialized); | 88 | ASSERT(initialized); |
| 89 | out_sample_count = 0; | 89 | out_sample_count = 0; |
| 90 | 90 | ||
| 91 | if (!state_valid) { | 91 | if (!state_valid) { |
| 92 | return OPUS_INVALID_STATE; | 92 | return OPUS_INVALID_STATE; |
| 93 | } | 93 | } |
| 94 | 94 | ||
| 95 | auto ret_code_or_samples = opus_decode( | 95 | auto ret_code_or_samples = opus_decode( |
| 96 | decoder, reinterpret_cast<const u8*>(input_data), static_cast<opus_int32>(input_data_size), | 96 | decoder, reinterpret_cast<const u8*>(input_data), static_cast<opus_int32>(input_data_size), |
| 97 | reinterpret_cast<opus_int16*>(output_data), static_cast<opus_int32>(output_data_size), 0); | 97 | reinterpret_cast<opus_int16*>(output_data), static_cast<opus_int32>(output_data_size), 0); |
| 98 | 98 | ||
| 99 | if (ret_code_or_samples < OPUS_OK) { | 99 | if (ret_code_or_samples < OPUS_OK) { |
| 100 | return ret_code_or_samples; | 100 | return ret_code_or_samples; |
| 101 | } | 101 | } |
| 102 | 102 | ||
| 103 | out_sample_count = ret_code_or_samples; | 103 | out_sample_count = ret_code_or_samples; |
| 104 | return opus_decoder_ctl(decoder, OPUS_GET_FINAL_RANGE_REQUEST, &final_range); | 104 | return opus_decoder_ctl(decoder, OPUS_GET_FINAL_RANGE_REQUEST, &final_range); |
| 105 | } | 105 | } |
| 106 | 106 | ||
| 107 | } // namespace AudioCore::ADSP::OpusDecoder | 107 | } // namespace AudioCore::ADSP::OpusDecoder |
diff --git a/src/audio_core/adsp/apps/opus/opus_multistream_decode_object.cpp b/src/audio_core/adsp/apps/opus/opus_multistream_decode_object.cpp index f6d362e68..7f1ed0450 100644 --- a/src/audio_core/adsp/apps/opus/opus_multistream_decode_object.cpp +++ b/src/audio_core/adsp/apps/opus/opus_multistream_decode_object.cpp | |||
| @@ -1,111 +1,111 @@ | |||
| 1 | // SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project | 1 | // SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project |
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later | 2 | // SPDX-License-Identifier: GPL-2.0-or-later |
| 3 | 3 | ||
| 4 | #include "audio_core/adsp/apps/opus/opus_multistream_decode_object.h" | 4 | #include "audio_core/adsp/apps/opus/opus_multistream_decode_object.h" |
| 5 | #include "common/assert.h" | 5 | #include "common/assert.h" |
| 6 | 6 | ||
| 7 | namespace AudioCore::ADSP::OpusDecoder { | 7 | namespace AudioCore::ADSP::OpusDecoder { |
| 8 | 8 | ||
| 9 | namespace { | 9 | namespace { |
| 10 | bool IsValidChannelCount(u32 channel_count) { | 10 | bool IsValidChannelCount(u32 channel_count) { |
| 11 | return channel_count == 1 || channel_count == 2; | 11 | return channel_count == 1 || channel_count == 2; |
| 12 | } | 12 | } |
| 13 | 13 | ||
| 14 | bool IsValidStreamCounts(u32 total_stream_count, u32 stereo_stream_count) { | 14 | bool IsValidStreamCounts(u32 total_stream_count, u32 stereo_stream_count) { |
| 15 | return total_stream_count > 0 && stereo_stream_count > 0 && | 15 | return total_stream_count > 0 && stereo_stream_count > 0 && |
| 16 | stereo_stream_count <= total_stream_count && IsValidChannelCount(total_stream_count); | 16 | stereo_stream_count <= total_stream_count && IsValidChannelCount(total_stream_count); |
| 17 | } | 17 | } |
| 18 | } // namespace | 18 | } // namespace |
| 19 | 19 | ||
| 20 | u32 OpusMultiStreamDecodeObject::GetWorkBufferSize(u32 total_stream_count, | 20 | u32 OpusMultiStreamDecodeObject::GetWorkBufferSize(u32 total_stream_count, |
| 21 | u32 stereo_stream_count) { | 21 | u32 stereo_stream_count) { |
| 22 | if (IsValidStreamCounts(total_stream_count, stereo_stream_count)) { | 22 | if (IsValidStreamCounts(total_stream_count, stereo_stream_count)) { |
| 23 | return static_cast<u32>(sizeof(OpusMultiStreamDecodeObject)) + | 23 | return static_cast<u32>(sizeof(OpusMultiStreamDecodeObject)) + |
| 24 | opus_multistream_decoder_get_size(total_stream_count, stereo_stream_count); | 24 | opus_multistream_decoder_get_size(total_stream_count, stereo_stream_count); |
| 25 | } | 25 | } |
| 26 | return 0; | 26 | return 0; |
| 27 | } | 27 | } |
| 28 | 28 | ||
| 29 | OpusMultiStreamDecodeObject& OpusMultiStreamDecodeObject::Initialize(u64 buffer, u64 buffer2) { | 29 | OpusMultiStreamDecodeObject& OpusMultiStreamDecodeObject::Initialize(u64 buffer, u64 buffer2) { |
| 30 | auto* new_decoder = reinterpret_cast<OpusMultiStreamDecodeObject*>(buffer); | 30 | auto* new_decoder = reinterpret_cast<OpusMultiStreamDecodeObject*>(buffer); |
| 31 | auto* comparison = reinterpret_cast<OpusMultiStreamDecodeObject*>(buffer2); | 31 | auto* comparison = reinterpret_cast<OpusMultiStreamDecodeObject*>(buffer2); |
| 32 | 32 | ||
| 33 | if (new_decoder->magic == DecodeMultiStreamObjectMagic) { | 33 | if (new_decoder->magic == DecodeMultiStreamObjectMagic) { |
| 34 | if (!new_decoder->initialized || | 34 | if (!new_decoder->initialized || |
| 35 | (new_decoder->initialized && new_decoder->self == comparison)) { | 35 | (new_decoder->initialized && new_decoder->self == comparison)) { |
| 36 | new_decoder->state_valid = true; | 36 | new_decoder->state_valid = true; |
| 37 | } | 37 | } |
| 38 | } else { | 38 | } else { |
| 39 | new_decoder->initialized = false; | 39 | new_decoder->initialized = false; |
| 40 | new_decoder->state_valid = true; | 40 | new_decoder->state_valid = true; |
| 41 | } | 41 | } |
| 42 | return *new_decoder; | 42 | return *new_decoder; |
| 43 | } | 43 | } |
| 44 | 44 | ||
| 45 | s32 OpusMultiStreamDecodeObject::InitializeDecoder(u32 sample_rate, u32 total_stream_count, | 45 | s32 OpusMultiStreamDecodeObject::InitializeDecoder(u32 sample_rate, u32 total_stream_count, |
| 46 | u32 channel_count, u32 stereo_stream_count, | 46 | u32 channel_count, u32 stereo_stream_count, |
| 47 | u8* mappings) { | 47 | u8* mappings) { |
| 48 | if (!state_valid) { | 48 | if (!state_valid) { |
| 49 | return OPUS_INVALID_STATE; | 49 | return OPUS_INVALID_STATE; |
| 50 | } | 50 | } |
| 51 | 51 | ||
| 52 | if (initialized) { | 52 | if (initialized) { |
| 53 | return OPUS_OK; | 53 | return OPUS_OK; |
| 54 | } | 54 | } |
| 55 | 55 | ||
| 56 | // See OpusDecodeObject::InitializeDecoder for an explanation of this | 56 | // See OpusDecodeObject::InitializeDecoder for an explanation of this |
| 57 | decoder = (LibOpusMSDecoder*)(this + 1); | 57 | decoder = (LibOpusMSDecoder*)(this + 1); |
| 58 | s32 ret = opus_multistream_decoder_init(decoder, sample_rate, channel_count, total_stream_count, | 58 | s32 ret = opus_multistream_decoder_init(decoder, sample_rate, channel_count, total_stream_count, |
| 59 | stereo_stream_count, mappings); | 59 | stereo_stream_count, mappings); |
| 60 | if (ret == OPUS_OK) { | 60 | if (ret == OPUS_OK) { |
| 61 | magic = DecodeMultiStreamObjectMagic; | 61 | magic = DecodeMultiStreamObjectMagic; |
| 62 | initialized = true; | 62 | initialized = true; |
| 63 | state_valid = true; | 63 | state_valid = true; |
| 64 | self = this; | 64 | self = this; |
| 65 | final_range = 0; | 65 | final_range = 0; |
| 66 | } | 66 | } |
| 67 | return ret; | 67 | return ret; |
| 68 | } | 68 | } |
| 69 | 69 | ||
| 70 | s32 OpusMultiStreamDecodeObject::Shutdown() { | 70 | s32 OpusMultiStreamDecodeObject::Shutdown() { |
| 71 | if (!state_valid) { | 71 | if (!state_valid) { |
| 72 | return OPUS_INVALID_STATE; | 72 | return OPUS_INVALID_STATE; |
| 73 | } | 73 | } |
| 74 | 74 | ||
| 75 | if (initialized) { | 75 | if (initialized) { |
| 76 | magic = 0x0; | 76 | magic = 0x0; |
| 77 | initialized = false; | 77 | initialized = false; |
| 78 | state_valid = false; | 78 | state_valid = false; |
| 79 | self = nullptr; | 79 | self = nullptr; |
| 80 | final_range = 0; | 80 | final_range = 0; |
| 81 | decoder = nullptr; | 81 | decoder = nullptr; |
| 82 | } | 82 | } |
| 83 | return OPUS_OK; | 83 | return OPUS_OK; |
| 84 | } | 84 | } |
| 85 | 85 | ||
| 86 | s32 OpusMultiStreamDecodeObject::ResetDecoder() { | 86 | s32 OpusMultiStreamDecodeObject::ResetDecoder() { |
| 87 | return opus_multistream_decoder_ctl(decoder, OPUS_RESET_STATE); | 87 | return opus_multistream_decoder_ctl(decoder, OPUS_RESET_STATE); |
| 88 | } | 88 | } |
| 89 | 89 | ||
| 90 | s32 OpusMultiStreamDecodeObject::Decode(u32& out_sample_count, u64 output_data, | 90 | s32 OpusMultiStreamDecodeObject::Decode(u32& out_sample_count, u64 output_data, |
| 91 | u64 output_data_size, u64 input_data, u64 input_data_size) { | 91 | u64 output_data_size, u64 input_data, u64 input_data_size) { |
| 92 | ASSERT(initialized); | 92 | ASSERT(initialized); |
| 93 | out_sample_count = 0; | 93 | out_sample_count = 0; |
| 94 | 94 | ||
| 95 | if (!state_valid) { | 95 | if (!state_valid) { |
| 96 | return OPUS_INVALID_STATE; | 96 | return OPUS_INVALID_STATE; |
| 97 | } | 97 | } |
| 98 | 98 | ||
| 99 | auto ret_code_or_samples = opus_multistream_decode( | 99 | auto ret_code_or_samples = opus_multistream_decode( |
| 100 | decoder, reinterpret_cast<const u8*>(input_data), static_cast<opus_int32>(input_data_size), | 100 | decoder, reinterpret_cast<const u8*>(input_data), static_cast<opus_int32>(input_data_size), |
| 101 | reinterpret_cast<opus_int16*>(output_data), static_cast<opus_int32>(output_data_size), 0); | 101 | reinterpret_cast<opus_int16*>(output_data), static_cast<opus_int32>(output_data_size), 0); |
| 102 | 102 | ||
| 103 | if (ret_code_or_samples < OPUS_OK) { | 103 | if (ret_code_or_samples < OPUS_OK) { |
| 104 | return ret_code_or_samples; | 104 | return ret_code_or_samples; |
| 105 | } | 105 | } |
| 106 | 106 | ||
| 107 | out_sample_count = ret_code_or_samples; | 107 | out_sample_count = ret_code_or_samples; |
| 108 | return opus_multistream_decoder_ctl(decoder, OPUS_GET_FINAL_RANGE_REQUEST, &final_range); | 108 | return opus_multistream_decoder_ctl(decoder, OPUS_GET_FINAL_RANGE_REQUEST, &final_range); |
| 109 | } | 109 | } |
| 110 | 110 | ||
| 111 | } // namespace AudioCore::ADSP::OpusDecoder | 111 | } // namespace AudioCore::ADSP::OpusDecoder |
diff --git a/src/audio_core/opus/decoder.cpp b/src/audio_core/opus/decoder.cpp index 5b23fce14..c6fd45f47 100644 --- a/src/audio_core/opus/decoder.cpp +++ b/src/audio_core/opus/decoder.cpp | |||
| @@ -1,179 +1,179 @@ | |||
| 1 | // SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project | 1 | // SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project |
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later | 2 | // SPDX-License-Identifier: GPL-2.0-or-later |
| 3 | 3 | ||
| 4 | #include "audio_core/opus/decoder.h" | 4 | #include "audio_core/opus/decoder.h" |
| 5 | #include "audio_core/opus/hardware_opus.h" | 5 | #include "audio_core/opus/hardware_opus.h" |
| 6 | #include "audio_core/opus/parameters.h" | 6 | #include "audio_core/opus/parameters.h" |
| 7 | #include "common/alignment.h" | 7 | #include "common/alignment.h" |
| 8 | #include "common/swap.h" | 8 | #include "common/swap.h" |
| 9 | #include "core/core.h" | 9 | #include "core/core.h" |
| 10 | 10 | ||
| 11 | namespace AudioCore::OpusDecoder { | 11 | namespace AudioCore::OpusDecoder { |
| 12 | using namespace Service::Audio; | 12 | using namespace Service::Audio; |
| 13 | namespace { | 13 | namespace { |
| 14 | OpusPacketHeader ReverseHeader(OpusPacketHeader header) { | 14 | OpusPacketHeader ReverseHeader(OpusPacketHeader header) { |
| 15 | OpusPacketHeader out; | 15 | OpusPacketHeader out; |
| 16 | out.size = Common::swap32(header.size); | 16 | out.size = Common::swap32(header.size); |
| 17 | out.final_range = Common::swap32(header.final_range); | 17 | out.final_range = Common::swap32(header.final_range); |
| 18 | return out; | 18 | return out; |
| 19 | } | 19 | } |
| 20 | } // namespace | 20 | } // namespace |
| 21 | 21 | ||
| 22 | OpusDecoder::OpusDecoder(Core::System& system_, HardwareOpus& hardware_opus_) | 22 | OpusDecoder::OpusDecoder(Core::System& system_, HardwareOpus& hardware_opus_) |
| 23 | : system{system_}, hardware_opus{hardware_opus_} {} | 23 | : system{system_}, hardware_opus{hardware_opus_} {} |
| 24 | 24 | ||
| 25 | OpusDecoder::~OpusDecoder() { | 25 | OpusDecoder::~OpusDecoder() { |
| 26 | if (decode_object_initialized) { | 26 | if (decode_object_initialized) { |
| 27 | hardware_opus.ShutdownDecodeObject(shared_buffer.get(), shared_buffer_size); | 27 | hardware_opus.ShutdownDecodeObject(shared_buffer.get(), shared_buffer_size); |
| 28 | } | 28 | } |
| 29 | } | 29 | } |
| 30 | 30 | ||
| 31 | Result OpusDecoder::Initialize(OpusParametersEx& params, Kernel::KTransferMemory* transfer_memory, | 31 | Result OpusDecoder::Initialize(OpusParametersEx& params, Kernel::KTransferMemory* transfer_memory, |
| 32 | u64 transfer_memory_size) { | 32 | u64 transfer_memory_size) { |
| 33 | auto frame_size{params.use_large_frame_size ? 5760 : 1920}; | 33 | auto frame_size{params.use_large_frame_size ? 5760 : 1920}; |
| 34 | shared_buffer_size = transfer_memory_size; | 34 | shared_buffer_size = transfer_memory_size; |
| 35 | shared_buffer = std::make_unique<u8[]>(shared_buffer_size); | 35 | shared_buffer = std::make_unique<u8[]>(shared_buffer_size); |
| 36 | shared_memory_mapped = true; | 36 | shared_memory_mapped = true; |
| 37 | 37 | ||
| 38 | buffer_size = | 38 | buffer_size = |
| 39 | Common::AlignUp((frame_size * params.channel_count) / (48'000 / params.sample_rate), 16); | 39 | Common::AlignUp((frame_size * params.channel_count) / (48'000 / params.sample_rate), 16); |
| 40 | 40 | ||
| 41 | out_data = {shared_buffer.get() + shared_buffer_size - buffer_size, buffer_size}; | 41 | out_data = {shared_buffer.get() + shared_buffer_size - buffer_size, buffer_size}; |
| 42 | size_t in_data_size{0x600u}; | 42 | size_t in_data_size{0x600u}; |
| 43 | in_data = {out_data.data() - in_data_size, in_data_size}; | 43 | in_data = {out_data.data() - in_data_size, in_data_size}; |
| 44 | 44 | ||
| 45 | ON_RESULT_FAILURE { | 45 | ON_RESULT_FAILURE { |
| 46 | if (shared_memory_mapped) { | 46 | if (shared_memory_mapped) { |
| 47 | shared_memory_mapped = false; | 47 | shared_memory_mapped = false; |
| 48 | ASSERT(R_SUCCEEDED(hardware_opus.UnmapMemory(shared_buffer.get(), shared_buffer_size))); | 48 | ASSERT(R_SUCCEEDED(hardware_opus.UnmapMemory(shared_buffer.get(), shared_buffer_size))); |
| 49 | } | 49 | } |
| 50 | }; | 50 | }; |
| 51 | 51 | ||
| 52 | R_TRY(hardware_opus.InitializeDecodeObject(params.sample_rate, params.channel_count, | 52 | R_TRY(hardware_opus.InitializeDecodeObject(params.sample_rate, params.channel_count, |
| 53 | shared_buffer.get(), shared_buffer_size)); | 53 | shared_buffer.get(), shared_buffer_size)); |
| 54 | 54 | ||
| 55 | sample_rate = params.sample_rate; | 55 | sample_rate = params.sample_rate; |
| 56 | channel_count = params.channel_count; | 56 | channel_count = params.channel_count; |
| 57 | use_large_frame_size = params.use_large_frame_size; | 57 | use_large_frame_size = params.use_large_frame_size; |
| 58 | decode_object_initialized = true; | 58 | decode_object_initialized = true; |
| 59 | R_SUCCEED(); | 59 | R_SUCCEED(); |
| 60 | } | 60 | } |
| 61 | 61 | ||
| 62 | Result OpusDecoder::Initialize(OpusMultiStreamParametersEx& params, | 62 | Result OpusDecoder::Initialize(OpusMultiStreamParametersEx& params, |
| 63 | Kernel::KTransferMemory* transfer_memory, u64 transfer_memory_size) { | 63 | Kernel::KTransferMemory* transfer_memory, u64 transfer_memory_size) { |
| 64 | auto frame_size{params.use_large_frame_size ? 5760 : 1920}; | 64 | auto frame_size{params.use_large_frame_size ? 5760 : 1920}; |
| 65 | shared_buffer_size = transfer_memory_size; | 65 | shared_buffer_size = transfer_memory_size; |
| 66 | shared_buffer = std::make_unique<u8[]>(shared_buffer_size); | 66 | shared_buffer = std::make_unique<u8[]>(shared_buffer_size); |
| 67 | shared_memory_mapped = true; | 67 | shared_memory_mapped = true; |
| 68 | 68 | ||
| 69 | buffer_size = | 69 | buffer_size = |
| 70 | Common::AlignUp((frame_size * params.channel_count) / (48'000 / params.sample_rate), 16); | 70 | Common::AlignUp((frame_size * params.channel_count) / (48'000 / params.sample_rate), 16); |
| 71 | 71 | ||
| 72 | out_data = {shared_buffer.get() + shared_buffer_size - buffer_size, buffer_size}; | 72 | out_data = {shared_buffer.get() + shared_buffer_size - buffer_size, buffer_size}; |
| 73 | size_t in_data_size{Common::AlignUp(1500ull * params.total_stream_count, 64u)}; | 73 | size_t in_data_size{Common::AlignUp(1500ull * params.total_stream_count, 64u)}; |
| 74 | in_data = {out_data.data() - in_data_size, in_data_size}; | 74 | in_data = {out_data.data() - in_data_size, in_data_size}; |
| 75 | 75 | ||
| 76 | ON_RESULT_FAILURE { | 76 | ON_RESULT_FAILURE { |
| 77 | if (shared_memory_mapped) { | 77 | if (shared_memory_mapped) { |
| 78 | shared_memory_mapped = false; | 78 | shared_memory_mapped = false; |
| 79 | ASSERT(R_SUCCEEDED(hardware_opus.UnmapMemory(shared_buffer.get(), shared_buffer_size))); | 79 | ASSERT(R_SUCCEEDED(hardware_opus.UnmapMemory(shared_buffer.get(), shared_buffer_size))); |
| 80 | } | 80 | } |
| 81 | }; | 81 | }; |
| 82 | 82 | ||
| 83 | R_TRY(hardware_opus.InitializeMultiStreamDecodeObject( | 83 | R_TRY(hardware_opus.InitializeMultiStreamDecodeObject( |
| 84 | params.sample_rate, params.channel_count, params.total_stream_count, | 84 | params.sample_rate, params.channel_count, params.total_stream_count, |
| 85 | params.stereo_stream_count, params.mappings.data(), shared_buffer.get(), | 85 | params.stereo_stream_count, params.mappings.data(), shared_buffer.get(), |
| 86 | shared_buffer_size)); | 86 | shared_buffer_size)); |
| 87 | 87 | ||
| 88 | sample_rate = params.sample_rate; | 88 | sample_rate = params.sample_rate; |
| 89 | channel_count = params.channel_count; | 89 | channel_count = params.channel_count; |
| 90 | total_stream_count = params.total_stream_count; | 90 | total_stream_count = params.total_stream_count; |
| 91 | stereo_stream_count = params.stereo_stream_count; | 91 | stereo_stream_count = params.stereo_stream_count; |
| 92 | use_large_frame_size = params.use_large_frame_size; | 92 | use_large_frame_size = params.use_large_frame_size; |
| 93 | decode_object_initialized = true; | 93 | decode_object_initialized = true; |
| 94 | R_SUCCEED(); | 94 | R_SUCCEED(); |
| 95 | } | 95 | } |
| 96 | 96 | ||
| 97 | Result OpusDecoder::DecodeInterleaved(u32* out_data_size, u64* out_time_taken, | 97 | Result OpusDecoder::DecodeInterleaved(u32* out_data_size, u64* out_time_taken, |
| 98 | u32* out_sample_count, std::span<const u8> input_data, | 98 | u32* out_sample_count, std::span<const u8> input_data, |
| 99 | std::span<u8> output_data, bool reset) { | 99 | std::span<u8> output_data, bool reset) { |
| 100 | u32 out_samples; | 100 | u32 out_samples; |
| 101 | u64 time_taken{}; | 101 | u64 time_taken{}; |
| 102 | 102 | ||
| 103 | R_UNLESS(input_data.size_bytes() > sizeof(OpusPacketHeader), ResultInputDataTooSmall); | 103 | R_UNLESS(input_data.size_bytes() > sizeof(OpusPacketHeader), ResultInputDataTooSmall); |
| 104 | 104 | ||
| 105 | auto* header_p{reinterpret_cast<const OpusPacketHeader*>(input_data.data())}; | 105 | auto* header_p{reinterpret_cast<const OpusPacketHeader*>(input_data.data())}; |
| 106 | OpusPacketHeader header{ReverseHeader(*header_p)}; | 106 | OpusPacketHeader header{ReverseHeader(*header_p)}; |
| 107 | 107 | ||
| 108 | R_UNLESS(in_data.size_bytes() >= header.size && | 108 | R_UNLESS(in_data.size_bytes() >= header.size && |
| 109 | header.size + sizeof(OpusPacketHeader) <= input_data.size_bytes(), | 109 | header.size + sizeof(OpusPacketHeader) <= input_data.size_bytes(), |
| 110 | ResultBufferTooSmall); | 110 | ResultBufferTooSmall); |
| 111 | 111 | ||
| 112 | if (!shared_memory_mapped) { | 112 | if (!shared_memory_mapped) { |
| 113 | R_TRY(hardware_opus.MapMemory(shared_buffer.get(), shared_buffer_size)); | 113 | R_TRY(hardware_opus.MapMemory(shared_buffer.get(), shared_buffer_size)); |
| 114 | shared_memory_mapped = true; | 114 | shared_memory_mapped = true; |
| 115 | } | 115 | } |
| 116 | 116 | ||
| 117 | std::memcpy(in_data.data(), input_data.data() + sizeof(OpusPacketHeader), header.size); | 117 | std::memcpy(in_data.data(), input_data.data() + sizeof(OpusPacketHeader), header.size); |
| 118 | 118 | ||
| 119 | R_TRY(hardware_opus.DecodeInterleaved(out_samples, out_data.data(), out_data.size_bytes(), | 119 | R_TRY(hardware_opus.DecodeInterleaved(out_samples, out_data.data(), out_data.size_bytes(), |
| 120 | channel_count, in_data.data(), header.size, | 120 | channel_count, in_data.data(), header.size, |
| 121 | shared_buffer.get(), time_taken, reset)); | 121 | shared_buffer.get(), time_taken, reset)); |
| 122 | 122 | ||
| 123 | std::memcpy(output_data.data(), out_data.data(), out_samples * channel_count * sizeof(s16)); | 123 | std::memcpy(output_data.data(), out_data.data(), out_samples * channel_count * sizeof(s16)); |
| 124 | 124 | ||
| 125 | *out_data_size = header.size + sizeof(OpusPacketHeader); | 125 | *out_data_size = header.size + sizeof(OpusPacketHeader); |
| 126 | *out_sample_count = out_samples; | 126 | *out_sample_count = out_samples; |
| 127 | if (out_time_taken) { | 127 | if (out_time_taken) { |
| 128 | *out_time_taken = time_taken / 1000; | 128 | *out_time_taken = time_taken / 1000; |
| 129 | } | 129 | } |
| 130 | R_SUCCEED(); | 130 | R_SUCCEED(); |
| 131 | } | 131 | } |
| 132 | 132 | ||
| 133 | Result OpusDecoder::SetContext([[maybe_unused]] std::span<const u8> context) { | 133 | Result OpusDecoder::SetContext([[maybe_unused]] std::span<const u8> context) { |
| 134 | R_SUCCEED_IF(shared_memory_mapped); | 134 | R_SUCCEED_IF(shared_memory_mapped); |
| 135 | shared_memory_mapped = true; | 135 | shared_memory_mapped = true; |
| 136 | R_RETURN(hardware_opus.MapMemory(shared_buffer.get(), shared_buffer_size)); | 136 | R_RETURN(hardware_opus.MapMemory(shared_buffer.get(), shared_buffer_size)); |
| 137 | } | 137 | } |
| 138 | 138 | ||
| 139 | Result OpusDecoder::DecodeInterleavedForMultiStream(u32* out_data_size, u64* out_time_taken, | 139 | Result OpusDecoder::DecodeInterleavedForMultiStream(u32* out_data_size, u64* out_time_taken, |
| 140 | u32* out_sample_count, | 140 | u32* out_sample_count, |
| 141 | std::span<const u8> input_data, | 141 | std::span<const u8> input_data, |
| 142 | std::span<u8> output_data, bool reset) { | 142 | std::span<u8> output_data, bool reset) { |
| 143 | u32 out_samples; | 143 | u32 out_samples; |
| 144 | u64 time_taken{}; | 144 | u64 time_taken{}; |
| 145 | 145 | ||
| 146 | R_UNLESS(input_data.size_bytes() > sizeof(OpusPacketHeader), ResultInputDataTooSmall); | 146 | R_UNLESS(input_data.size_bytes() > sizeof(OpusPacketHeader), ResultInputDataTooSmall); |
| 147 | 147 | ||
| 148 | auto* header_p{reinterpret_cast<const OpusPacketHeader*>(input_data.data())}; | 148 | auto* header_p{reinterpret_cast<const OpusPacketHeader*>(input_data.data())}; |
| 149 | OpusPacketHeader header{ReverseHeader(*header_p)}; | 149 | OpusPacketHeader header{ReverseHeader(*header_p)}; |
| 150 | 150 | ||
| 151 | LOG_ERROR(Service_Audio, "header size 0x{:X} input data size 0x{:X} in_data size 0x{:X}", | 151 | LOG_ERROR(Service_Audio, "header size 0x{:X} input data size 0x{:X} in_data size 0x{:X}", |
| 152 | header.size, input_data.size_bytes(), in_data.size_bytes()); | 152 | header.size, input_data.size_bytes(), in_data.size_bytes()); |
| 153 | 153 | ||
| 154 | R_UNLESS(in_data.size_bytes() >= header.size && | 154 | R_UNLESS(in_data.size_bytes() >= header.size && |
| 155 | header.size + sizeof(OpusPacketHeader) <= input_data.size_bytes(), | 155 | header.size + sizeof(OpusPacketHeader) <= input_data.size_bytes(), |
| 156 | ResultBufferTooSmall); | 156 | ResultBufferTooSmall); |
| 157 | 157 | ||
| 158 | if (!shared_memory_mapped) { | 158 | if (!shared_memory_mapped) { |
| 159 | R_TRY(hardware_opus.MapMemory(shared_buffer.get(), shared_buffer_size)); | 159 | R_TRY(hardware_opus.MapMemory(shared_buffer.get(), shared_buffer_size)); |
| 160 | shared_memory_mapped = true; | 160 | shared_memory_mapped = true; |
| 161 | } | 161 | } |
| 162 | 162 | ||
| 163 | std::memcpy(in_data.data(), input_data.data() + sizeof(OpusPacketHeader), header.size); | 163 | std::memcpy(in_data.data(), input_data.data() + sizeof(OpusPacketHeader), header.size); |
| 164 | 164 | ||
| 165 | R_TRY(hardware_opus.DecodeInterleavedForMultiStream( | 165 | R_TRY(hardware_opus.DecodeInterleavedForMultiStream( |
| 166 | out_samples, out_data.data(), out_data.size_bytes(), channel_count, in_data.data(), | 166 | out_samples, out_data.data(), out_data.size_bytes(), channel_count, in_data.data(), |
| 167 | header.size, shared_buffer.get(), time_taken, reset)); | 167 | header.size, shared_buffer.get(), time_taken, reset)); |
| 168 | 168 | ||
| 169 | std::memcpy(output_data.data(), out_data.data(), out_samples * channel_count * sizeof(s16)); | 169 | std::memcpy(output_data.data(), out_data.data(), out_samples * channel_count * sizeof(s16)); |
| 170 | 170 | ||
| 171 | *out_data_size = header.size + sizeof(OpusPacketHeader); | 171 | *out_data_size = header.size + sizeof(OpusPacketHeader); |
| 172 | *out_sample_count = out_samples; | 172 | *out_sample_count = out_samples; |
| 173 | if (out_time_taken) { | 173 | if (out_time_taken) { |
| 174 | *out_time_taken = time_taken / 1000; | 174 | *out_time_taken = time_taken / 1000; |
| 175 | } | 175 | } |
| 176 | R_SUCCEED(); | 176 | R_SUCCEED(); |
| 177 | } | 177 | } |
| 178 | 178 | ||
| 179 | } // namespace AudioCore::OpusDecoder | 179 | } // namespace AudioCore::OpusDecoder |
diff --git a/src/audio_core/opus/decoder.h b/src/audio_core/opus/decoder.h index d08d8a4a4..fd728958a 100644 --- a/src/audio_core/opus/decoder.h +++ b/src/audio_core/opus/decoder.h | |||
| @@ -1,53 +1,53 @@ | |||
| 1 | // SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project | 1 | // SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project |
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later | 2 | // SPDX-License-Identifier: GPL-2.0-or-later |
| 3 | 3 | ||
| 4 | #pragma once | 4 | #pragma once |
| 5 | 5 | ||
| 6 | #include <span> | 6 | #include <span> |
| 7 | 7 | ||
| 8 | #include "audio_core/opus/parameters.h" | 8 | #include "audio_core/opus/parameters.h" |
| 9 | #include "common/common_types.h" | 9 | #include "common/common_types.h" |
| 10 | #include "core/hle/kernel/k_transfer_memory.h" | 10 | #include "core/hle/kernel/k_transfer_memory.h" |
| 11 | #include "core/hle/service/audio/errors.h" | 11 | #include "core/hle/service/audio/errors.h" |
| 12 | 12 | ||
| 13 | namespace Core { | 13 | namespace Core { |
| 14 | class System; | 14 | class System; |
| 15 | } | 15 | } |
| 16 | 16 | ||
| 17 | namespace AudioCore::OpusDecoder { | 17 | namespace AudioCore::OpusDecoder { |
| 18 | class HardwareOpus; | 18 | class HardwareOpus; |
| 19 | 19 | ||
| 20 | class OpusDecoder { | 20 | class OpusDecoder { |
| 21 | public: | 21 | public: |
| 22 | explicit OpusDecoder(Core::System& system, HardwareOpus& hardware_opus_); | 22 | explicit OpusDecoder(Core::System& system, HardwareOpus& hardware_opus_); |
| 23 | ~OpusDecoder(); | 23 | ~OpusDecoder(); |
| 24 | 24 | ||
| 25 | Result Initialize(OpusParametersEx& params, Kernel::KTransferMemory* transfer_memory, | 25 | Result Initialize(OpusParametersEx& params, Kernel::KTransferMemory* transfer_memory, |
| 26 | u64 transfer_memory_size); | 26 | u64 transfer_memory_size); |
| 27 | Result Initialize(OpusMultiStreamParametersEx& params, Kernel::KTransferMemory* transfer_memory, | 27 | Result Initialize(OpusMultiStreamParametersEx& params, Kernel::KTransferMemory* transfer_memory, |
| 28 | u64 transfer_memory_size); | 28 | u64 transfer_memory_size); |
| 29 | Result DecodeInterleaved(u32* out_data_size, u64* out_time_taken, u32* out_sample_count, | 29 | Result DecodeInterleaved(u32* out_data_size, u64* out_time_taken, u32* out_sample_count, |
| 30 | std::span<const u8> input_data, std::span<u8> output_data, bool reset); | 30 | std::span<const u8> input_data, std::span<u8> output_data, bool reset); |
| 31 | Result SetContext([[maybe_unused]] std::span<const u8> context); | 31 | Result SetContext([[maybe_unused]] std::span<const u8> context); |
| 32 | Result DecodeInterleavedForMultiStream(u32* out_data_size, u64* out_time_taken, | 32 | Result DecodeInterleavedForMultiStream(u32* out_data_size, u64* out_time_taken, |
| 33 | u32* out_sample_count, std::span<const u8> input_data, | 33 | u32* out_sample_count, std::span<const u8> input_data, |
| 34 | std::span<u8> output_data, bool reset); | 34 | std::span<u8> output_data, bool reset); |
| 35 | 35 | ||
| 36 | private: | 36 | private: |
| 37 | Core::System& system; | 37 | Core::System& system; |
| 38 | HardwareOpus& hardware_opus; | 38 | HardwareOpus& hardware_opus; |
| 39 | std::unique_ptr<u8[]> shared_buffer{}; | 39 | std::unique_ptr<u8[]> shared_buffer{}; |
| 40 | u64 shared_buffer_size; | 40 | u64 shared_buffer_size; |
| 41 | std::span<u8> in_data{}; | 41 | std::span<u8> in_data{}; |
| 42 | std::span<u8> out_data{}; | 42 | std::span<u8> out_data{}; |
| 43 | u64 buffer_size{}; | 43 | u64 buffer_size{}; |
| 44 | s32 sample_rate{}; | 44 | s32 sample_rate{}; |
| 45 | s32 channel_count{}; | 45 | s32 channel_count{}; |
| 46 | bool use_large_frame_size{false}; | 46 | bool use_large_frame_size{false}; |
| 47 | s32 total_stream_count{}; | 47 | s32 total_stream_count{}; |
| 48 | s32 stereo_stream_count{}; | 48 | s32 stereo_stream_count{}; |
| 49 | bool shared_memory_mapped{false}; | 49 | bool shared_memory_mapped{false}; |
| 50 | bool decode_object_initialized{false}; | 50 | bool decode_object_initialized{false}; |
| 51 | }; | 51 | }; |
| 52 | 52 | ||
| 53 | } // namespace AudioCore::OpusDecoder | 53 | } // namespace AudioCore::OpusDecoder |
diff --git a/src/audio_core/opus/decoder_manager.cpp b/src/audio_core/opus/decoder_manager.cpp index fdeccdf50..1464880a1 100644 --- a/src/audio_core/opus/decoder_manager.cpp +++ b/src/audio_core/opus/decoder_manager.cpp | |||
| @@ -1,102 +1,102 @@ | |||
| 1 | // SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project | 1 | // SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project |
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later | 2 | // SPDX-License-Identifier: GPL-2.0-or-later |
| 3 | 3 | ||
| 4 | #include "audio_core/adsp/apps/opus/opus_decoder.h" | 4 | #include "audio_core/adsp/apps/opus/opus_decoder.h" |
| 5 | #include "audio_core/opus/decoder_manager.h" | 5 | #include "audio_core/opus/decoder_manager.h" |
| 6 | #include "common/alignment.h" | 6 | #include "common/alignment.h" |
| 7 | #include "core/core.h" | 7 | #include "core/core.h" |
| 8 | 8 | ||
| 9 | namespace AudioCore::OpusDecoder { | 9 | namespace AudioCore::OpusDecoder { |
| 10 | using namespace Service::Audio; | 10 | using namespace Service::Audio; |
| 11 | 11 | ||
| 12 | namespace { | 12 | namespace { |
| 13 | bool IsValidChannelCount(u32 channel_count) { | 13 | bool IsValidChannelCount(u32 channel_count) { |
| 14 | return channel_count == 1 || channel_count == 2; | 14 | return channel_count == 1 || channel_count == 2; |
| 15 | } | 15 | } |
| 16 | 16 | ||
| 17 | bool IsValidMultiStreamChannelCount(u32 channel_count) { | 17 | bool IsValidMultiStreamChannelCount(u32 channel_count) { |
| 18 | return channel_count > 0 && channel_count <= OpusStreamCountMax; | 18 | return channel_count > 0 && channel_count <= OpusStreamCountMax; |
| 19 | } | 19 | } |
| 20 | 20 | ||
| 21 | bool IsValidSampleRate(u32 sample_rate) { | 21 | bool IsValidSampleRate(u32 sample_rate) { |
| 22 | return sample_rate == 8'000 || sample_rate == 12'000 || sample_rate == 16'000 || | 22 | return sample_rate == 8'000 || sample_rate == 12'000 || sample_rate == 16'000 || |
| 23 | sample_rate == 24'000 || sample_rate == 48'000; | 23 | sample_rate == 24'000 || sample_rate == 48'000; |
| 24 | } | 24 | } |
| 25 | 25 | ||
| 26 | bool IsValidStreamCount(u32 channel_count, u32 total_stream_count, u32 stereo_stream_count) { | 26 | bool IsValidStreamCount(u32 channel_count, u32 total_stream_count, u32 stereo_stream_count) { |
| 27 | return total_stream_count > 0 && static_cast<s32>(stereo_stream_count) >= 0 && | 27 | return total_stream_count > 0 && static_cast<s32>(stereo_stream_count) >= 0 && |
| 28 | stereo_stream_count <= total_stream_count && | 28 | stereo_stream_count <= total_stream_count && |
| 29 | total_stream_count + stereo_stream_count <= channel_count; | 29 | total_stream_count + stereo_stream_count <= channel_count; |
| 30 | } | 30 | } |
| 31 | 31 | ||
| 32 | } // namespace | 32 | } // namespace |
| 33 | 33 | ||
| 34 | OpusDecoderManager::OpusDecoderManager(Core::System& system_) | 34 | OpusDecoderManager::OpusDecoderManager(Core::System& system_) |
| 35 | : system{system_}, hardware_opus{system} { | 35 | : system{system_}, hardware_opus{system} { |
| 36 | for (u32 i = 0; i < MaxChannels; i++) { | 36 | for (u32 i = 0; i < MaxChannels; i++) { |
| 37 | required_workbuffer_sizes[i] = hardware_opus.GetWorkBufferSize(1 + i); | 37 | required_workbuffer_sizes[i] = hardware_opus.GetWorkBufferSize(1 + i); |
| 38 | } | 38 | } |
| 39 | } | 39 | } |
| 40 | 40 | ||
| 41 | Result OpusDecoderManager::GetWorkBufferSize(OpusParameters& params, u64& out_size) { | 41 | Result OpusDecoderManager::GetWorkBufferSize(OpusParameters& params, u64& out_size) { |
| 42 | OpusParametersEx ex{ | 42 | OpusParametersEx ex{ |
| 43 | .sample_rate = params.sample_rate, | 43 | .sample_rate = params.sample_rate, |
| 44 | .channel_count = params.channel_count, | 44 | .channel_count = params.channel_count, |
| 45 | .use_large_frame_size = false, | 45 | .use_large_frame_size = false, |
| 46 | }; | 46 | }; |
| 47 | R_RETURN(GetWorkBufferSizeExEx(ex, out_size)); | 47 | R_RETURN(GetWorkBufferSizeExEx(ex, out_size)); |
| 48 | } | 48 | } |
| 49 | 49 | ||
| 50 | Result OpusDecoderManager::GetWorkBufferSizeEx(OpusParametersEx& params, u64& out_size) { | 50 | Result OpusDecoderManager::GetWorkBufferSizeEx(OpusParametersEx& params, u64& out_size) { |
| 51 | R_RETURN(GetWorkBufferSizeExEx(params, out_size)); | 51 | R_RETURN(GetWorkBufferSizeExEx(params, out_size)); |
| 52 | } | 52 | } |
| 53 | 53 | ||
| 54 | Result OpusDecoderManager::GetWorkBufferSizeExEx(OpusParametersEx& params, u64& out_size) { | 54 | Result OpusDecoderManager::GetWorkBufferSizeExEx(OpusParametersEx& params, u64& out_size) { |
| 55 | R_UNLESS(IsValidChannelCount(params.channel_count), ResultInvalidOpusChannelCount); | 55 | R_UNLESS(IsValidChannelCount(params.channel_count), ResultInvalidOpusChannelCount); |
| 56 | R_UNLESS(IsValidSampleRate(params.sample_rate), ResultInvalidOpusSampleRate); | 56 | R_UNLESS(IsValidSampleRate(params.sample_rate), ResultInvalidOpusSampleRate); |
| 57 | 57 | ||
| 58 | auto work_buffer_size{required_workbuffer_sizes[params.channel_count - 1]}; | 58 | auto work_buffer_size{required_workbuffer_sizes[params.channel_count - 1]}; |
| 59 | auto frame_size{params.use_large_frame_size ? 5760 : 1920}; | 59 | auto frame_size{params.use_large_frame_size ? 5760 : 1920}; |
| 60 | work_buffer_size += | 60 | work_buffer_size += |
| 61 | Common::AlignUp((frame_size * params.channel_count) / (48'000 / params.sample_rate), 64); | 61 | Common::AlignUp((frame_size * params.channel_count) / (48'000 / params.sample_rate), 64); |
| 62 | out_size = work_buffer_size + 0x600; | 62 | out_size = work_buffer_size + 0x600; |
| 63 | R_SUCCEED(); | 63 | R_SUCCEED(); |
| 64 | } | 64 | } |
| 65 | 65 | ||
| 66 | Result OpusDecoderManager::GetWorkBufferSizeForMultiStream(OpusMultiStreamParameters& params, | 66 | Result OpusDecoderManager::GetWorkBufferSizeForMultiStream(OpusMultiStreamParameters& params, |
| 67 | u64& out_size) { | 67 | u64& out_size) { |
| 68 | OpusMultiStreamParametersEx ex{ | 68 | OpusMultiStreamParametersEx ex{ |
| 69 | .sample_rate = params.sample_rate, | 69 | .sample_rate = params.sample_rate, |
| 70 | .channel_count = params.channel_count, | 70 | .channel_count = params.channel_count, |
| 71 | .total_stream_count = params.total_stream_count, | 71 | .total_stream_count = params.total_stream_count, |
| 72 | .stereo_stream_count = params.stereo_stream_count, | 72 | .stereo_stream_count = params.stereo_stream_count, |
| 73 | .use_large_frame_size = false, | 73 | .use_large_frame_size = false, |
| 74 | .mappings = {}, | 74 | .mappings = {}, |
| 75 | }; | 75 | }; |
| 76 | R_RETURN(GetWorkBufferSizeForMultiStreamExEx(ex, out_size)); | 76 | R_RETURN(GetWorkBufferSizeForMultiStreamExEx(ex, out_size)); |
| 77 | } | 77 | } |
| 78 | 78 | ||
| 79 | Result OpusDecoderManager::GetWorkBufferSizeForMultiStreamEx(OpusMultiStreamParametersEx& params, | 79 | Result OpusDecoderManager::GetWorkBufferSizeForMultiStreamEx(OpusMultiStreamParametersEx& params, |
| 80 | u64& out_size) { | 80 | u64& out_size) { |
| 81 | R_RETURN(GetWorkBufferSizeForMultiStreamExEx(params, out_size)); | 81 | R_RETURN(GetWorkBufferSizeForMultiStreamExEx(params, out_size)); |
| 82 | } | 82 | } |
| 83 | 83 | ||
| 84 | Result OpusDecoderManager::GetWorkBufferSizeForMultiStreamExEx(OpusMultiStreamParametersEx& params, | 84 | Result OpusDecoderManager::GetWorkBufferSizeForMultiStreamExEx(OpusMultiStreamParametersEx& params, |
| 85 | u64& out_size) { | 85 | u64& out_size) { |
| 86 | R_UNLESS(IsValidMultiStreamChannelCount(params.channel_count), ResultInvalidOpusChannelCount); | 86 | R_UNLESS(IsValidMultiStreamChannelCount(params.channel_count), ResultInvalidOpusChannelCount); |
| 87 | R_UNLESS(IsValidSampleRate(params.sample_rate), ResultInvalidOpusSampleRate); | 87 | R_UNLESS(IsValidSampleRate(params.sample_rate), ResultInvalidOpusSampleRate); |
| 88 | R_UNLESS(IsValidStreamCount(params.channel_count, params.total_stream_count, | 88 | R_UNLESS(IsValidStreamCount(params.channel_count, params.total_stream_count, |
| 89 | params.stereo_stream_count), | 89 | params.stereo_stream_count), |
| 90 | ResultInvalidOpusSampleRate); | 90 | ResultInvalidOpusSampleRate); |
| 91 | 91 | ||
| 92 | auto work_buffer_size{hardware_opus.GetWorkBufferSizeForMultiStream( | 92 | auto work_buffer_size{hardware_opus.GetWorkBufferSizeForMultiStream( |
| 93 | params.total_stream_count, params.stereo_stream_count)}; | 93 | params.total_stream_count, params.stereo_stream_count)}; |
| 94 | auto frame_size{params.use_large_frame_size ? 5760 : 1920}; | 94 | auto frame_size{params.use_large_frame_size ? 5760 : 1920}; |
| 95 | work_buffer_size += Common::AlignUp(1500 * params.total_stream_count, 64); | 95 | work_buffer_size += Common::AlignUp(1500 * params.total_stream_count, 64); |
| 96 | work_buffer_size += | 96 | work_buffer_size += |
| 97 | Common::AlignUp((frame_size * params.channel_count) / (48'000 / params.sample_rate), 64); | 97 | Common::AlignUp((frame_size * params.channel_count) / (48'000 / params.sample_rate), 64); |
| 98 | out_size = work_buffer_size; | 98 | out_size = work_buffer_size; |
| 99 | R_SUCCEED(); | 99 | R_SUCCEED(); |
| 100 | } | 100 | } |
| 101 | 101 | ||
| 102 | } // namespace AudioCore::OpusDecoder | 102 | } // namespace AudioCore::OpusDecoder |
diff --git a/src/audio_core/opus/decoder_manager.h b/src/audio_core/opus/decoder_manager.h index 466e1967b..70ebc4bab 100644 --- a/src/audio_core/opus/decoder_manager.h +++ b/src/audio_core/opus/decoder_manager.h | |||
| @@ -1,38 +1,38 @@ | |||
| 1 | // SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project | 1 | // SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project |
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later | 2 | // SPDX-License-Identifier: GPL-2.0-or-later |
| 3 | 3 | ||
| 4 | #pragma once | 4 | #pragma once |
| 5 | 5 | ||
| 6 | #include "audio_core/opus/hardware_opus.h" | 6 | #include "audio_core/opus/hardware_opus.h" |
| 7 | #include "audio_core/opus/parameters.h" | 7 | #include "audio_core/opus/parameters.h" |
| 8 | #include "common/common_types.h" | 8 | #include "common/common_types.h" |
| 9 | #include "core/hle/service/audio/errors.h" | 9 | #include "core/hle/service/audio/errors.h" |
| 10 | 10 | ||
| 11 | namespace Core { | 11 | namespace Core { |
| 12 | class System; | 12 | class System; |
| 13 | } | 13 | } |
| 14 | 14 | ||
| 15 | namespace AudioCore::OpusDecoder { | 15 | namespace AudioCore::OpusDecoder { |
| 16 | 16 | ||
| 17 | class OpusDecoderManager { | 17 | class OpusDecoderManager { |
| 18 | public: | 18 | public: |
| 19 | OpusDecoderManager(Core::System& system); | 19 | OpusDecoderManager(Core::System& system); |
| 20 | 20 | ||
| 21 | HardwareOpus& GetHardwareOpus() { | 21 | HardwareOpus& GetHardwareOpus() { |
| 22 | return hardware_opus; | 22 | return hardware_opus; |
| 23 | } | 23 | } |
| 24 | 24 | ||
| 25 | Result GetWorkBufferSize(OpusParameters& params, u64& out_size); | 25 | Result GetWorkBufferSize(OpusParameters& params, u64& out_size); |
| 26 | Result GetWorkBufferSizeEx(OpusParametersEx& params, u64& out_size); | 26 | Result GetWorkBufferSizeEx(OpusParametersEx& params, u64& out_size); |
| 27 | Result GetWorkBufferSizeExEx(OpusParametersEx& params, u64& out_size); | 27 | Result GetWorkBufferSizeExEx(OpusParametersEx& params, u64& out_size); |
| 28 | Result GetWorkBufferSizeForMultiStream(OpusMultiStreamParameters& params, u64& out_size); | 28 | Result GetWorkBufferSizeForMultiStream(OpusMultiStreamParameters& params, u64& out_size); |
| 29 | Result GetWorkBufferSizeForMultiStreamEx(OpusMultiStreamParametersEx& params, u64& out_size); | 29 | Result GetWorkBufferSizeForMultiStreamEx(OpusMultiStreamParametersEx& params, u64& out_size); |
| 30 | Result GetWorkBufferSizeForMultiStreamExEx(OpusMultiStreamParametersEx& params, u64& out_size); | 30 | Result GetWorkBufferSizeForMultiStreamExEx(OpusMultiStreamParametersEx& params, u64& out_size); |
| 31 | 31 | ||
| 32 | private: | 32 | private: |
| 33 | Core::System& system; | 33 | Core::System& system; |
| 34 | HardwareOpus hardware_opus; | 34 | HardwareOpus hardware_opus; |
| 35 | std::array<u64, MaxChannels> required_workbuffer_sizes{}; | 35 | std::array<u64, MaxChannels> required_workbuffer_sizes{}; |
| 36 | }; | 36 | }; |
| 37 | 37 | ||
| 38 | } // namespace AudioCore::OpusDecoder | 38 | } // namespace AudioCore::OpusDecoder |
diff --git a/src/audio_core/opus/hardware_opus.cpp b/src/audio_core/opus/hardware_opus.cpp index d6544dcb0..5ff71ab2d 100644 --- a/src/audio_core/opus/hardware_opus.cpp +++ b/src/audio_core/opus/hardware_opus.cpp | |||
| @@ -1,241 +1,241 @@ | |||
| 1 | // SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project | 1 | // SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project |
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later | 2 | // SPDX-License-Identifier: GPL-2.0-or-later |
| 3 | 3 | ||
| 4 | #include <array> | 4 | #include <array> |
| 5 | 5 | ||
| 6 | #include "audio_core/audio_core.h" | 6 | #include "audio_core/audio_core.h" |
| 7 | #include "audio_core/opus/hardware_opus.h" | 7 | #include "audio_core/opus/hardware_opus.h" |
| 8 | #include "core/core.h" | 8 | #include "core/core.h" |
| 9 | 9 | ||
| 10 | namespace AudioCore::OpusDecoder { | 10 | namespace AudioCore::OpusDecoder { |
| 11 | namespace { | 11 | namespace { |
| 12 | using namespace Service::Audio; | 12 | using namespace Service::Audio; |
| 13 | 13 | ||
| 14 | static constexpr Result ResultCodeFromLibOpusErrorCode(u64 error_code) { | 14 | static constexpr Result ResultCodeFromLibOpusErrorCode(u64 error_code) { |
| 15 | s32 error{static_cast<s32>(error_code)}; | 15 | s32 error{static_cast<s32>(error_code)}; |
| 16 | ASSERT(error <= OPUS_OK); | 16 | ASSERT(error <= OPUS_OK); |
| 17 | switch (error) { | 17 | switch (error) { |
| 18 | case OPUS_ALLOC_FAIL: | 18 | case OPUS_ALLOC_FAIL: |
| 19 | R_THROW(ResultLibOpusAllocFail); | 19 | R_THROW(ResultLibOpusAllocFail); |
| 20 | case OPUS_INVALID_STATE: | 20 | case OPUS_INVALID_STATE: |
| 21 | R_THROW(ResultLibOpusInvalidState); | 21 | R_THROW(ResultLibOpusInvalidState); |
| 22 | case OPUS_UNIMPLEMENTED: | 22 | case OPUS_UNIMPLEMENTED: |
| 23 | R_THROW(ResultLibOpusUnimplemented); | 23 | R_THROW(ResultLibOpusUnimplemented); |
| 24 | case OPUS_INVALID_PACKET: | 24 | case OPUS_INVALID_PACKET: |
| 25 | R_THROW(ResultLibOpusInvalidPacket); | 25 | R_THROW(ResultLibOpusInvalidPacket); |
| 26 | case OPUS_INTERNAL_ERROR: | 26 | case OPUS_INTERNAL_ERROR: |
| 27 | R_THROW(ResultLibOpusInternalError); | 27 | R_THROW(ResultLibOpusInternalError); |
| 28 | case OPUS_BUFFER_TOO_SMALL: | 28 | case OPUS_BUFFER_TOO_SMALL: |
| 29 | R_THROW(ResultBufferTooSmall); | 29 | R_THROW(ResultBufferTooSmall); |
| 30 | case OPUS_BAD_ARG: | 30 | case OPUS_BAD_ARG: |
| 31 | R_THROW(ResultLibOpusBadArg); | 31 | R_THROW(ResultLibOpusBadArg); |
| 32 | case OPUS_OK: | 32 | case OPUS_OK: |
| 33 | R_RETURN(ResultSuccess); | 33 | R_RETURN(ResultSuccess); |
| 34 | } | 34 | } |
| 35 | UNREACHABLE(); | 35 | UNREACHABLE(); |
| 36 | } | 36 | } |
| 37 | 37 | ||
| 38 | } // namespace | 38 | } // namespace |
| 39 | 39 | ||
| 40 | HardwareOpus::HardwareOpus(Core::System& system_) | 40 | HardwareOpus::HardwareOpus(Core::System& system_) |
| 41 | : system{system_}, opus_decoder{system.AudioCore().ADSP().OpusDecoder()} { | 41 | : system{system_}, opus_decoder{system.AudioCore().ADSP().OpusDecoder()} { |
| 42 | opus_decoder.SetSharedMemory(shared_memory); | 42 | opus_decoder.SetSharedMemory(shared_memory); |
| 43 | } | 43 | } |
| 44 | 44 | ||
| 45 | u64 HardwareOpus::GetWorkBufferSize(u32 channel) { | 45 | u64 HardwareOpus::GetWorkBufferSize(u32 channel) { |
| 46 | if (!opus_decoder.IsRunning()) { | 46 | if (!opus_decoder.IsRunning()) { |
| 47 | return 0; | 47 | return 0; |
| 48 | } | 48 | } |
| 49 | std::scoped_lock l{mutex}; | 49 | std::scoped_lock l{mutex}; |
| 50 | shared_memory.host_send_data[0] = channel; | 50 | shared_memory.host_send_data[0] = channel; |
| 51 | opus_decoder.Send(ADSP::Direction::DSP, ADSP::OpusDecoder::Message::GetWorkBufferSize); | 51 | opus_decoder.Send(ADSP::Direction::DSP, ADSP::OpusDecoder::Message::GetWorkBufferSize); |
| 52 | auto msg = opus_decoder.Receive(ADSP::Direction::Host); | 52 | auto msg = opus_decoder.Receive(ADSP::Direction::Host); |
| 53 | if (msg != ADSP::OpusDecoder::Message::GetWorkBufferSizeOK) { | 53 | if (msg != ADSP::OpusDecoder::Message::GetWorkBufferSizeOK) { |
| 54 | LOG_ERROR(Service_Audio, "OpusDecoder returned invalid message. Expected {} got {}", | 54 | LOG_ERROR(Service_Audio, "OpusDecoder returned invalid message. Expected {} got {}", |
| 55 | ADSP::OpusDecoder::Message::GetWorkBufferSizeOK, msg); | 55 | ADSP::OpusDecoder::Message::GetWorkBufferSizeOK, msg); |
| 56 | return 0; | 56 | return 0; |
| 57 | } | 57 | } |
| 58 | return shared_memory.dsp_return_data[0]; | 58 | return shared_memory.dsp_return_data[0]; |
| 59 | } | 59 | } |
| 60 | 60 | ||
| 61 | u64 HardwareOpus::GetWorkBufferSizeForMultiStream(u32 total_stream_count, u32 stereo_stream_count) { | 61 | u64 HardwareOpus::GetWorkBufferSizeForMultiStream(u32 total_stream_count, u32 stereo_stream_count) { |
| 62 | std::scoped_lock l{mutex}; | 62 | std::scoped_lock l{mutex}; |
| 63 | shared_memory.host_send_data[0] = total_stream_count; | 63 | shared_memory.host_send_data[0] = total_stream_count; |
| 64 | shared_memory.host_send_data[1] = stereo_stream_count; | 64 | shared_memory.host_send_data[1] = stereo_stream_count; |
| 65 | opus_decoder.Send(ADSP::Direction::DSP, | 65 | opus_decoder.Send(ADSP::Direction::DSP, |
| 66 | ADSP::OpusDecoder::Message::GetWorkBufferSizeForMultiStream); | 66 | ADSP::OpusDecoder::Message::GetWorkBufferSizeForMultiStream); |
| 67 | auto msg = opus_decoder.Receive(ADSP::Direction::Host); | 67 | auto msg = opus_decoder.Receive(ADSP::Direction::Host); |
| 68 | if (msg != ADSP::OpusDecoder::Message::GetWorkBufferSizeForMultiStreamOK) { | 68 | if (msg != ADSP::OpusDecoder::Message::GetWorkBufferSizeForMultiStreamOK) { |
| 69 | LOG_ERROR(Service_Audio, "OpusDecoder returned invalid message. Expected {} got {}", | 69 | LOG_ERROR(Service_Audio, "OpusDecoder returned invalid message. Expected {} got {}", |
| 70 | ADSP::OpusDecoder::Message::GetWorkBufferSizeForMultiStreamOK, msg); | 70 | ADSP::OpusDecoder::Message::GetWorkBufferSizeForMultiStreamOK, msg); |
| 71 | return 0; | 71 | return 0; |
| 72 | } | 72 | } |
| 73 | return shared_memory.dsp_return_data[0]; | 73 | return shared_memory.dsp_return_data[0]; |
| 74 | } | 74 | } |
| 75 | 75 | ||
| 76 | Result HardwareOpus::InitializeDecodeObject(u32 sample_rate, u32 channel_count, void* buffer, | 76 | Result HardwareOpus::InitializeDecodeObject(u32 sample_rate, u32 channel_count, void* buffer, |
| 77 | u64 buffer_size) { | 77 | u64 buffer_size) { |
| 78 | std::scoped_lock l{mutex}; | 78 | std::scoped_lock l{mutex}; |
| 79 | shared_memory.host_send_data[0] = (u64)buffer; | 79 | shared_memory.host_send_data[0] = (u64)buffer; |
| 80 | shared_memory.host_send_data[1] = buffer_size; | 80 | shared_memory.host_send_data[1] = buffer_size; |
| 81 | shared_memory.host_send_data[2] = sample_rate; | 81 | shared_memory.host_send_data[2] = sample_rate; |
| 82 | shared_memory.host_send_data[3] = channel_count; | 82 | shared_memory.host_send_data[3] = channel_count; |
| 83 | 83 | ||
| 84 | opus_decoder.Send(ADSP::Direction::DSP, ADSP::OpusDecoder::Message::InitializeDecodeObject); | 84 | opus_decoder.Send(ADSP::Direction::DSP, ADSP::OpusDecoder::Message::InitializeDecodeObject); |
| 85 | auto msg = opus_decoder.Receive(ADSP::Direction::Host); | 85 | auto msg = opus_decoder.Receive(ADSP::Direction::Host); |
| 86 | if (msg != ADSP::OpusDecoder::Message::InitializeDecodeObjectOK) { | 86 | if (msg != ADSP::OpusDecoder::Message::InitializeDecodeObjectOK) { |
| 87 | LOG_ERROR(Service_Audio, "OpusDecoder returned invalid message. Expected {} got {}", | 87 | LOG_ERROR(Service_Audio, "OpusDecoder returned invalid message. Expected {} got {}", |
| 88 | ADSP::OpusDecoder::Message::InitializeDecodeObjectOK, msg); | 88 | ADSP::OpusDecoder::Message::InitializeDecodeObjectOK, msg); |
| 89 | R_THROW(ResultInvalidOpusDSPReturnCode); | 89 | R_THROW(ResultInvalidOpusDSPReturnCode); |
| 90 | } | 90 | } |
| 91 | 91 | ||
| 92 | R_RETURN(ResultCodeFromLibOpusErrorCode(shared_memory.dsp_return_data[0])); | 92 | R_RETURN(ResultCodeFromLibOpusErrorCode(shared_memory.dsp_return_data[0])); |
| 93 | } | 93 | } |
| 94 | 94 | ||
| 95 | Result HardwareOpus::InitializeMultiStreamDecodeObject(u32 sample_rate, u32 channel_count, | 95 | Result HardwareOpus::InitializeMultiStreamDecodeObject(u32 sample_rate, u32 channel_count, |
| 96 | u32 total_stream_count, | 96 | u32 total_stream_count, |
| 97 | u32 stereo_stream_count, void* mappings, | 97 | u32 stereo_stream_count, void* mappings, |
| 98 | void* buffer, u64 buffer_size) { | 98 | void* buffer, u64 buffer_size) { |
| 99 | std::scoped_lock l{mutex}; | 99 | std::scoped_lock l{mutex}; |
| 100 | shared_memory.host_send_data[0] = (u64)buffer; | 100 | shared_memory.host_send_data[0] = (u64)buffer; |
| 101 | shared_memory.host_send_data[1] = buffer_size; | 101 | shared_memory.host_send_data[1] = buffer_size; |
| 102 | shared_memory.host_send_data[2] = sample_rate; | 102 | shared_memory.host_send_data[2] = sample_rate; |
| 103 | shared_memory.host_send_data[3] = channel_count; | 103 | shared_memory.host_send_data[3] = channel_count; |
| 104 | shared_memory.host_send_data[4] = total_stream_count; | 104 | shared_memory.host_send_data[4] = total_stream_count; |
| 105 | shared_memory.host_send_data[5] = stereo_stream_count; | 105 | shared_memory.host_send_data[5] = stereo_stream_count; |
| 106 | 106 | ||
| 107 | ASSERT(channel_count <= MaxChannels); | 107 | ASSERT(channel_count <= MaxChannels); |
| 108 | std::memcpy(shared_memory.channel_mapping.data(), mappings, channel_count * sizeof(u8)); | 108 | std::memcpy(shared_memory.channel_mapping.data(), mappings, channel_count * sizeof(u8)); |
| 109 | 109 | ||
| 110 | opus_decoder.Send(ADSP::Direction::DSP, | 110 | opus_decoder.Send(ADSP::Direction::DSP, |
| 111 | ADSP::OpusDecoder::Message::InitializeMultiStreamDecodeObject); | 111 | ADSP::OpusDecoder::Message::InitializeMultiStreamDecodeObject); |
| 112 | auto msg = opus_decoder.Receive(ADSP::Direction::Host); | 112 | auto msg = opus_decoder.Receive(ADSP::Direction::Host); |
| 113 | if (msg != ADSP::OpusDecoder::Message::InitializeMultiStreamDecodeObjectOK) { | 113 | if (msg != ADSP::OpusDecoder::Message::InitializeMultiStreamDecodeObjectOK) { |
| 114 | LOG_ERROR(Service_Audio, "OpusDecoder returned invalid message. Expected {} got {}", | 114 | LOG_ERROR(Service_Audio, "OpusDecoder returned invalid message. Expected {} got {}", |
| 115 | ADSP::OpusDecoder::Message::InitializeMultiStreamDecodeObjectOK, msg); | 115 | ADSP::OpusDecoder::Message::InitializeMultiStreamDecodeObjectOK, msg); |
| 116 | R_THROW(ResultInvalidOpusDSPReturnCode); | 116 | R_THROW(ResultInvalidOpusDSPReturnCode); |
| 117 | } | 117 | } |
| 118 | 118 | ||
| 119 | R_RETURN(ResultCodeFromLibOpusErrorCode(shared_memory.dsp_return_data[0])); | 119 | R_RETURN(ResultCodeFromLibOpusErrorCode(shared_memory.dsp_return_data[0])); |
| 120 | } | 120 | } |
| 121 | 121 | ||
| 122 | Result HardwareOpus::ShutdownDecodeObject(void* buffer, u64 buffer_size) { | 122 | Result HardwareOpus::ShutdownDecodeObject(void* buffer, u64 buffer_size) { |
| 123 | std::scoped_lock l{mutex}; | 123 | std::scoped_lock l{mutex}; |
| 124 | shared_memory.host_send_data[0] = (u64)buffer; | 124 | shared_memory.host_send_data[0] = (u64)buffer; |
| 125 | shared_memory.host_send_data[1] = buffer_size; | 125 | shared_memory.host_send_data[1] = buffer_size; |
| 126 | 126 | ||
| 127 | opus_decoder.Send(ADSP::Direction::DSP, ADSP::OpusDecoder::Message::ShutdownDecodeObject); | 127 | opus_decoder.Send(ADSP::Direction::DSP, ADSP::OpusDecoder::Message::ShutdownDecodeObject); |
| 128 | auto msg = opus_decoder.Receive(ADSP::Direction::Host); | 128 | auto msg = opus_decoder.Receive(ADSP::Direction::Host); |
| 129 | ASSERT_MSG(msg == ADSP::OpusDecoder::Message::ShutdownDecodeObjectOK, | 129 | ASSERT_MSG(msg == ADSP::OpusDecoder::Message::ShutdownDecodeObjectOK, |
| 130 | "Expected Opus shutdown code {}, got {}", | 130 | "Expected Opus shutdown code {}, got {}", |
| 131 | ADSP::OpusDecoder::Message::ShutdownDecodeObjectOK, msg); | 131 | ADSP::OpusDecoder::Message::ShutdownDecodeObjectOK, msg); |
| 132 | 132 | ||
| 133 | R_RETURN(ResultCodeFromLibOpusErrorCode(shared_memory.dsp_return_data[0])); | 133 | R_RETURN(ResultCodeFromLibOpusErrorCode(shared_memory.dsp_return_data[0])); |
| 134 | } | 134 | } |
| 135 | 135 | ||
| 136 | Result HardwareOpus::ShutdownMultiStreamDecodeObject(void* buffer, u64 buffer_size) { | 136 | Result HardwareOpus::ShutdownMultiStreamDecodeObject(void* buffer, u64 buffer_size) { |
| 137 | std::scoped_lock l{mutex}; | 137 | std::scoped_lock l{mutex}; |
| 138 | shared_memory.host_send_data[0] = (u64)buffer; | 138 | shared_memory.host_send_data[0] = (u64)buffer; |
| 139 | shared_memory.host_send_data[1] = buffer_size; | 139 | shared_memory.host_send_data[1] = buffer_size; |
| 140 | 140 | ||
| 141 | opus_decoder.Send(ADSP::Direction::DSP, | 141 | opus_decoder.Send(ADSP::Direction::DSP, |
| 142 | ADSP::OpusDecoder::Message::ShutdownMultiStreamDecodeObject); | 142 | ADSP::OpusDecoder::Message::ShutdownMultiStreamDecodeObject); |
| 143 | auto msg = opus_decoder.Receive(ADSP::Direction::Host); | 143 | auto msg = opus_decoder.Receive(ADSP::Direction::Host); |
| 144 | ASSERT_MSG(msg == ADSP::OpusDecoder::Message::ShutdownMultiStreamDecodeObjectOK, | 144 | ASSERT_MSG(msg == ADSP::OpusDecoder::Message::ShutdownMultiStreamDecodeObjectOK, |
| 145 | "Expected Opus shutdown code {}, got {}", | 145 | "Expected Opus shutdown code {}, got {}", |
| 146 | ADSP::OpusDecoder::Message::ShutdownMultiStreamDecodeObjectOK, msg); | 146 | ADSP::OpusDecoder::Message::ShutdownMultiStreamDecodeObjectOK, msg); |
| 147 | 147 | ||
| 148 | R_RETURN(ResultCodeFromLibOpusErrorCode(shared_memory.dsp_return_data[0])); | 148 | R_RETURN(ResultCodeFromLibOpusErrorCode(shared_memory.dsp_return_data[0])); |
| 149 | } | 149 | } |
| 150 | 150 | ||
| 151 | Result HardwareOpus::DecodeInterleaved(u32& out_sample_count, void* output_data, | 151 | Result HardwareOpus::DecodeInterleaved(u32& out_sample_count, void* output_data, |
| 152 | u64 output_data_size, u32 channel_count, void* input_data, | 152 | u64 output_data_size, u32 channel_count, void* input_data, |
| 153 | u64 input_data_size, void* buffer, u64& out_time_taken, | 153 | u64 input_data_size, void* buffer, u64& out_time_taken, |
| 154 | bool reset) { | 154 | bool reset) { |
| 155 | std::scoped_lock l{mutex}; | 155 | std::scoped_lock l{mutex}; |
| 156 | shared_memory.host_send_data[0] = (u64)buffer; | 156 | shared_memory.host_send_data[0] = (u64)buffer; |
| 157 | shared_memory.host_send_data[1] = (u64)input_data; | 157 | shared_memory.host_send_data[1] = (u64)input_data; |
| 158 | shared_memory.host_send_data[2] = input_data_size; | 158 | shared_memory.host_send_data[2] = input_data_size; |
| 159 | shared_memory.host_send_data[3] = (u64)output_data; | 159 | shared_memory.host_send_data[3] = (u64)output_data; |
| 160 | shared_memory.host_send_data[4] = output_data_size; | 160 | shared_memory.host_send_data[4] = output_data_size; |
| 161 | shared_memory.host_send_data[5] = 0; | 161 | shared_memory.host_send_data[5] = 0; |
| 162 | shared_memory.host_send_data[6] = reset; | 162 | shared_memory.host_send_data[6] = reset; |
| 163 | 163 | ||
| 164 | opus_decoder.Send(ADSP::Direction::DSP, ADSP::OpusDecoder::Message::DecodeInterleaved); | 164 | opus_decoder.Send(ADSP::Direction::DSP, ADSP::OpusDecoder::Message::DecodeInterleaved); |
| 165 | auto msg = opus_decoder.Receive(ADSP::Direction::Host); | 165 | auto msg = opus_decoder.Receive(ADSP::Direction::Host); |
| 166 | if (msg != ADSP::OpusDecoder::Message::DecodeInterleavedOK) { | 166 | if (msg != ADSP::OpusDecoder::Message::DecodeInterleavedOK) { |
| 167 | LOG_ERROR(Service_Audio, "OpusDecoder returned invalid message. Expected {} got {}", | 167 | LOG_ERROR(Service_Audio, "OpusDecoder returned invalid message. Expected {} got {}", |
| 168 | ADSP::OpusDecoder::Message::DecodeInterleavedOK, msg); | 168 | ADSP::OpusDecoder::Message::DecodeInterleavedOK, msg); |
| 169 | R_THROW(ResultInvalidOpusDSPReturnCode); | 169 | R_THROW(ResultInvalidOpusDSPReturnCode); |
| 170 | } | 170 | } |
| 171 | 171 | ||
| 172 | auto error_code{static_cast<s32>(shared_memory.dsp_return_data[0])}; | 172 | auto error_code{static_cast<s32>(shared_memory.dsp_return_data[0])}; |
| 173 | if (error_code == OPUS_OK) { | 173 | if (error_code == OPUS_OK) { |
| 174 | out_sample_count = static_cast<u32>(shared_memory.dsp_return_data[1]); | 174 | out_sample_count = static_cast<u32>(shared_memory.dsp_return_data[1]); |
| 175 | out_time_taken = 1000 * shared_memory.dsp_return_data[2]; | 175 | out_time_taken = 1000 * shared_memory.dsp_return_data[2]; |
| 176 | } | 176 | } |
| 177 | R_RETURN(ResultCodeFromLibOpusErrorCode(error_code)); | 177 | R_RETURN(ResultCodeFromLibOpusErrorCode(error_code)); |
| 178 | } | 178 | } |
| 179 | 179 | ||
| 180 | Result HardwareOpus::DecodeInterleavedForMultiStream(u32& out_sample_count, void* output_data, | 180 | Result HardwareOpus::DecodeInterleavedForMultiStream(u32& out_sample_count, void* output_data, |
| 181 | u64 output_data_size, u32 channel_count, | 181 | u64 output_data_size, u32 channel_count, |
| 182 | void* input_data, u64 input_data_size, | 182 | void* input_data, u64 input_data_size, |
| 183 | void* buffer, u64& out_time_taken, | 183 | void* buffer, u64& out_time_taken, |
| 184 | bool reset) { | 184 | bool reset) { |
| 185 | std::scoped_lock l{mutex}; | 185 | std::scoped_lock l{mutex}; |
| 186 | shared_memory.host_send_data[0] = (u64)buffer; | 186 | shared_memory.host_send_data[0] = (u64)buffer; |
| 187 | shared_memory.host_send_data[1] = (u64)input_data; | 187 | shared_memory.host_send_data[1] = (u64)input_data; |
| 188 | shared_memory.host_send_data[2] = input_data_size; | 188 | shared_memory.host_send_data[2] = input_data_size; |
| 189 | shared_memory.host_send_data[3] = (u64)output_data; | 189 | shared_memory.host_send_data[3] = (u64)output_data; |
| 190 | shared_memory.host_send_data[4] = output_data_size; | 190 | shared_memory.host_send_data[4] = output_data_size; |
| 191 | shared_memory.host_send_data[5] = 0; | 191 | shared_memory.host_send_data[5] = 0; |
| 192 | shared_memory.host_send_data[6] = reset; | 192 | shared_memory.host_send_data[6] = reset; |
| 193 | 193 | ||
| 194 | opus_decoder.Send(ADSP::Direction::DSP, | 194 | opus_decoder.Send(ADSP::Direction::DSP, |
| 195 | ADSP::OpusDecoder::Message::DecodeInterleavedForMultiStream); | 195 | ADSP::OpusDecoder::Message::DecodeInterleavedForMultiStream); |
| 196 | auto msg = opus_decoder.Receive(ADSP::Direction::Host); | 196 | auto msg = opus_decoder.Receive(ADSP::Direction::Host); |
| 197 | if (msg != ADSP::OpusDecoder::Message::DecodeInterleavedForMultiStreamOK) { | 197 | if (msg != ADSP::OpusDecoder::Message::DecodeInterleavedForMultiStreamOK) { |
| 198 | LOG_ERROR(Service_Audio, "OpusDecoder returned invalid message. Expected {} got {}", | 198 | LOG_ERROR(Service_Audio, "OpusDecoder returned invalid message. Expected {} got {}", |
| 199 | ADSP::OpusDecoder::Message::DecodeInterleavedForMultiStreamOK, msg); | 199 | ADSP::OpusDecoder::Message::DecodeInterleavedForMultiStreamOK, msg); |
| 200 | R_THROW(ResultInvalidOpusDSPReturnCode); | 200 | R_THROW(ResultInvalidOpusDSPReturnCode); |
| 201 | } | 201 | } |
| 202 | 202 | ||
| 203 | auto error_code{static_cast<s32>(shared_memory.dsp_return_data[0])}; | 203 | auto error_code{static_cast<s32>(shared_memory.dsp_return_data[0])}; |
| 204 | if (error_code == OPUS_OK) { | 204 | if (error_code == OPUS_OK) { |
| 205 | out_sample_count = static_cast<u32>(shared_memory.dsp_return_data[1]); | 205 | out_sample_count = static_cast<u32>(shared_memory.dsp_return_data[1]); |
| 206 | out_time_taken = 1000 * shared_memory.dsp_return_data[2]; | 206 | out_time_taken = 1000 * shared_memory.dsp_return_data[2]; |
| 207 | } | 207 | } |
| 208 | R_RETURN(ResultCodeFromLibOpusErrorCode(error_code)); | 208 | R_RETURN(ResultCodeFromLibOpusErrorCode(error_code)); |
| 209 | } | 209 | } |
| 210 | 210 | ||
| 211 | Result HardwareOpus::MapMemory(void* buffer, u64 buffer_size) { | 211 | Result HardwareOpus::MapMemory(void* buffer, u64 buffer_size) { |
| 212 | std::scoped_lock l{mutex}; | 212 | std::scoped_lock l{mutex}; |
| 213 | shared_memory.host_send_data[0] = (u64)buffer; | 213 | shared_memory.host_send_data[0] = (u64)buffer; |
| 214 | shared_memory.host_send_data[1] = buffer_size; | 214 | shared_memory.host_send_data[1] = buffer_size; |
| 215 | 215 | ||
| 216 | opus_decoder.Send(ADSP::Direction::DSP, ADSP::OpusDecoder::Message::MapMemory); | 216 | opus_decoder.Send(ADSP::Direction::DSP, ADSP::OpusDecoder::Message::MapMemory); |
| 217 | auto msg = opus_decoder.Receive(ADSP::Direction::Host); | 217 | auto msg = opus_decoder.Receive(ADSP::Direction::Host); |
| 218 | if (msg != ADSP::OpusDecoder::Message::MapMemoryOK) { | 218 | if (msg != ADSP::OpusDecoder::Message::MapMemoryOK) { |
| 219 | LOG_ERROR(Service_Audio, "OpusDecoder returned invalid message. Expected {} got {}", | 219 | LOG_ERROR(Service_Audio, "OpusDecoder returned invalid message. Expected {} got {}", |
| 220 | ADSP::OpusDecoder::Message::MapMemoryOK, msg); | 220 | ADSP::OpusDecoder::Message::MapMemoryOK, msg); |
| 221 | R_THROW(ResultInvalidOpusDSPReturnCode); | 221 | R_THROW(ResultInvalidOpusDSPReturnCode); |
| 222 | } | 222 | } |
| 223 | R_SUCCEED(); | 223 | R_SUCCEED(); |
| 224 | } | 224 | } |
| 225 | 225 | ||
| 226 | Result HardwareOpus::UnmapMemory(void* buffer, u64 buffer_size) { | 226 | Result HardwareOpus::UnmapMemory(void* buffer, u64 buffer_size) { |
| 227 | std::scoped_lock l{mutex}; | 227 | std::scoped_lock l{mutex}; |
| 228 | shared_memory.host_send_data[0] = (u64)buffer; | 228 | shared_memory.host_send_data[0] = (u64)buffer; |
| 229 | shared_memory.host_send_data[1] = buffer_size; | 229 | shared_memory.host_send_data[1] = buffer_size; |
| 230 | 230 | ||
| 231 | opus_decoder.Send(ADSP::Direction::DSP, ADSP::OpusDecoder::Message::UnmapMemory); | 231 | opus_decoder.Send(ADSP::Direction::DSP, ADSP::OpusDecoder::Message::UnmapMemory); |
| 232 | auto msg = opus_decoder.Receive(ADSP::Direction::Host); | 232 | auto msg = opus_decoder.Receive(ADSP::Direction::Host); |
| 233 | if (msg != ADSP::OpusDecoder::Message::UnmapMemoryOK) { | 233 | if (msg != ADSP::OpusDecoder::Message::UnmapMemoryOK) { |
| 234 | LOG_ERROR(Service_Audio, "OpusDecoder returned invalid message. Expected {} got {}", | 234 | LOG_ERROR(Service_Audio, "OpusDecoder returned invalid message. Expected {} got {}", |
| 235 | ADSP::OpusDecoder::Message::UnmapMemoryOK, msg); | 235 | ADSP::OpusDecoder::Message::UnmapMemoryOK, msg); |
| 236 | R_THROW(ResultInvalidOpusDSPReturnCode); | 236 | R_THROW(ResultInvalidOpusDSPReturnCode); |
| 237 | } | 237 | } |
| 238 | R_SUCCEED(); | 238 | R_SUCCEED(); |
| 239 | } | 239 | } |
| 240 | 240 | ||
| 241 | } // namespace AudioCore::OpusDecoder | 241 | } // namespace AudioCore::OpusDecoder |
diff --git a/src/audio_core/opus/hardware_opus.h b/src/audio_core/opus/hardware_opus.h index 7013a6b40..b10184baa 100644 --- a/src/audio_core/opus/hardware_opus.h +++ b/src/audio_core/opus/hardware_opus.h | |||
| @@ -1,45 +1,45 @@ | |||
| 1 | // SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project | 1 | // SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project |
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later | 2 | // SPDX-License-Identifier: GPL-2.0-or-later |
| 3 | 3 | ||
| 4 | #pragma once | 4 | #pragma once |
| 5 | 5 | ||
| 6 | #include <mutex> | 6 | #include <mutex> |
| 7 | #include <opus.h> | 7 | #include <opus.h> |
| 8 | 8 | ||
| 9 | #include "audio_core/adsp/apps/opus/opus_decoder.h" | 9 | #include "audio_core/adsp/apps/opus/opus_decoder.h" |
| 10 | #include "audio_core/adsp/apps/opus/shared_memory.h" | 10 | #include "audio_core/adsp/apps/opus/shared_memory.h" |
| 11 | #include "audio_core/adsp/mailbox.h" | 11 | #include "audio_core/adsp/mailbox.h" |
| 12 | #include "core/hle/service/audio/errors.h" | 12 | #include "core/hle/service/audio/errors.h" |
| 13 | 13 | ||
| 14 | namespace AudioCore::OpusDecoder { | 14 | namespace AudioCore::OpusDecoder { |
| 15 | class HardwareOpus { | 15 | class HardwareOpus { |
| 16 | public: | 16 | public: |
| 17 | HardwareOpus(Core::System& system); | 17 | HardwareOpus(Core::System& system); |
| 18 | 18 | ||
| 19 | u64 GetWorkBufferSize(u32 channel); | 19 | u64 GetWorkBufferSize(u32 channel); |
| 20 | u64 GetWorkBufferSizeForMultiStream(u32 total_stream_count, u32 stereo_stream_count); | 20 | u64 GetWorkBufferSizeForMultiStream(u32 total_stream_count, u32 stereo_stream_count); |
| 21 | 21 | ||
| 22 | Result InitializeDecodeObject(u32 sample_rate, u32 channel_count, void* buffer, | 22 | Result InitializeDecodeObject(u32 sample_rate, u32 channel_count, void* buffer, |
| 23 | u64 buffer_size); | 23 | u64 buffer_size); |
| 24 | Result InitializeMultiStreamDecodeObject(u32 sample_rate, u32 channel_count, | 24 | Result InitializeMultiStreamDecodeObject(u32 sample_rate, u32 channel_count, |
| 25 | u32 totaL_stream_count, u32 stereo_stream_count, | 25 | u32 totaL_stream_count, u32 stereo_stream_count, |
| 26 | void* mappings, void* buffer, u64 buffer_size); | 26 | void* mappings, void* buffer, u64 buffer_size); |
| 27 | Result ShutdownDecodeObject(void* buffer, u64 buffer_size); | 27 | Result ShutdownDecodeObject(void* buffer, u64 buffer_size); |
| 28 | Result ShutdownMultiStreamDecodeObject(void* buffer, u64 buffer_size); | 28 | Result ShutdownMultiStreamDecodeObject(void* buffer, u64 buffer_size); |
| 29 | Result DecodeInterleaved(u32& out_sample_count, void* output_data, u64 output_data_size, | 29 | Result DecodeInterleaved(u32& out_sample_count, void* output_data, u64 output_data_size, |
| 30 | u32 channel_count, void* input_data, u64 input_data_size, void* buffer, | 30 | u32 channel_count, void* input_data, u64 input_data_size, void* buffer, |
| 31 | u64& out_time_taken, bool reset); | 31 | u64& out_time_taken, bool reset); |
| 32 | Result DecodeInterleavedForMultiStream(u32& out_sample_count, void* output_data, | 32 | Result DecodeInterleavedForMultiStream(u32& out_sample_count, void* output_data, |
| 33 | u64 output_data_size, u32 channel_count, | 33 | u64 output_data_size, u32 channel_count, |
| 34 | void* input_data, u64 input_data_size, void* buffer, | 34 | void* input_data, u64 input_data_size, void* buffer, |
| 35 | u64& out_time_taken, bool reset); | 35 | u64& out_time_taken, bool reset); |
| 36 | Result MapMemory(void* buffer, u64 buffer_size); | 36 | Result MapMemory(void* buffer, u64 buffer_size); |
| 37 | Result UnmapMemory(void* buffer, u64 buffer_size); | 37 | Result UnmapMemory(void* buffer, u64 buffer_size); |
| 38 | 38 | ||
| 39 | private: | 39 | private: |
| 40 | Core::System& system; | 40 | Core::System& system; |
| 41 | std::mutex mutex; | 41 | std::mutex mutex; |
| 42 | ADSP::OpusDecoder::OpusDecoder& opus_decoder; | 42 | ADSP::OpusDecoder::OpusDecoder& opus_decoder; |
| 43 | ADSP::OpusDecoder::SharedMemory shared_memory; | 43 | ADSP::OpusDecoder::SharedMemory shared_memory; |
| 44 | }; | 44 | }; |
| 45 | } // namespace AudioCore::OpusDecoder | 45 | } // namespace AudioCore::OpusDecoder |
diff --git a/src/yuzu/configuration/config.h b/src/yuzu/configuration/config.h index 74ec4f771..1589ba057 100644 --- a/src/yuzu/configuration/config.h +++ b/src/yuzu/configuration/config.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | // SPDX-FileCopyrightText: 2014 Citra Emulator Project | 1 | // SPDX-FileCopyrightText: 2014 Citra Emulator Project |
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later | 2 | // SPDX-License-Identifier: GPL-2.0-or-later |
| 3 | 3 | ||
| 4 | #pragma once | 4 | #pragma once |
diff --git a/src/yuzu/configuration/configure_camera.h b/src/yuzu/configuration/configure_camera.h index 9a90512b3..3d822da7b 100644 --- a/src/yuzu/configuration/configure_camera.h +++ b/src/yuzu/configuration/configure_camera.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | // Text : Copyright 2022 yuzu Emulator Project | 1 | // Text : Copyright 2022 yuzu Emulator Project |
| 2 | // SPDX-License-Identifier: GPL-3.0-or-later | 2 | // SPDX-License-Identifier: GPL-3.0-or-later |
| 3 | 3 | ||
| 4 | #pragma once | 4 | #pragma once |
diff --git a/src/yuzu/configuration/configure_input.h b/src/yuzu/configuration/configure_input.h index 136cd3a0a..beb503dae 100644 --- a/src/yuzu/configuration/configure_input.h +++ b/src/yuzu/configuration/configure_input.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | // SPDX-FileCopyrightText: 2016 Citra Emulator Project | 1 | // SPDX-FileCopyrightText: 2016 Citra Emulator Project |
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later | 2 | // SPDX-License-Identifier: GPL-2.0-or-later |
| 3 | 3 | ||
| 4 | #pragma once | 4 | #pragma once |
diff --git a/src/yuzu/configuration/configure_input_player.h b/src/yuzu/configuration/configure_input_player.h index d3255d2b4..fda09e925 100644 --- a/src/yuzu/configuration/configure_input_player.h +++ b/src/yuzu/configuration/configure_input_player.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | // SPDX-FileCopyrightText: 2016 Citra Emulator Project | 1 | // SPDX-FileCopyrightText: 2016 Citra Emulator Project |
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later | 2 | // SPDX-License-Identifier: GPL-2.0-or-later |
| 3 | 3 | ||
| 4 | #pragma once | 4 | #pragma once |
diff --git a/src/yuzu/configuration/configure_per_game.h b/src/yuzu/configuration/configure_per_game.h index 1a727f32c..cc2513001 100644 --- a/src/yuzu/configuration/configure_per_game.h +++ b/src/yuzu/configuration/configure_per_game.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | // SPDX-FileCopyrightText: Copyright 2020 yuzu Emulator Project | 1 | // SPDX-FileCopyrightText: Copyright 2020 yuzu Emulator Project |
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later | 2 | // SPDX-License-Identifier: GPL-2.0-or-later |
| 3 | 3 | ||
| 4 | #pragma once | 4 | #pragma once |
diff --git a/src/yuzu/configuration/configure_ringcon.h b/src/yuzu/configuration/configure_ringcon.h index b23c27906..6fd95e2b8 100644 --- a/src/yuzu/configuration/configure_ringcon.h +++ b/src/yuzu/configuration/configure_ringcon.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | // SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project | 1 | // SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project |
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later | 2 | // SPDX-License-Identifier: GPL-2.0-or-later |
| 3 | 3 | ||
| 4 | #pragma once | 4 | #pragma once |
diff --git a/src/yuzu/configuration/configure_tas.h b/src/yuzu/configuration/configure_tas.h index 4a6b0ba4e..a91891906 100644 --- a/src/yuzu/configuration/configure_tas.h +++ b/src/yuzu/configuration/configure_tas.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | // SPDX-FileCopyrightText: Copyright 2021 yuzu Emulator Project | 1 | // SPDX-FileCopyrightText: Copyright 2021 yuzu Emulator Project |
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later | 2 | // SPDX-License-Identifier: GPL-2.0-or-later |
| 3 | 3 | ||
| 4 | #pragma once | 4 | #pragma once |
diff --git a/src/yuzu/configuration/configure_touchscreen_advanced.h b/src/yuzu/configuration/configure_touchscreen_advanced.h index 034dc0d46..b6fdffdc8 100644 --- a/src/yuzu/configuration/configure_touchscreen_advanced.h +++ b/src/yuzu/configuration/configure_touchscreen_advanced.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | // SPDX-FileCopyrightText: 2016 Citra Emulator Project | 1 | // SPDX-FileCopyrightText: 2016 Citra Emulator Project |
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later | 2 | // SPDX-License-Identifier: GPL-2.0-or-later |
| 3 | 3 | ||
| 4 | #pragma once | 4 | #pragma once |