summaryrefslogtreecommitdiffstats
path: root/src/audio_core/adsp/apps/opus/opus_multistream_decode_object.h
diff options
context:
space:
mode:
authorliamwhite <liamwhite@users.noreply.github.com>2023-09-17 16:42:44 +0200
committerGitHub <noreply@github.com>2023-09-17 16:42:44 +0200
commit474739a37920ff8e8a2f5d6f480a9116fdfba825 (patch)
tree8331fac91e1e96ddd379917ad51167cef48868f3 /src/audio_core/adsp/apps/opus/opus_multistream_decode_object.h
parentMerge pull request #11523 from t895/shader-workers (diff)
parentReimplement HardwareOpus (diff)
downloadyuzu-474739a37920ff8e8a2f5d6f480a9116fdfba825.tar
yuzu-474739a37920ff8e8a2f5d6f480a9116fdfba825.tar.gz
yuzu-474739a37920ff8e8a2f5d6f480a9116fdfba825.tar.bz2
yuzu-474739a37920ff8e8a2f5d6f480a9116fdfba825.tar.lz
yuzu-474739a37920ff8e8a2f5d6f480a9116fdfba825.tar.xz
yuzu-474739a37920ff8e8a2f5d6f480a9116fdfba825.tar.zst
yuzu-474739a37920ff8e8a2f5d6f480a9116fdfba825.zip
Diffstat (limited to 'src/audio_core/adsp/apps/opus/opus_multistream_decode_object.h')
-rw-r--r--src/audio_core/adsp/apps/opus/opus_multistream_decode_object.h39
1 files changed, 39 insertions, 0 deletions
diff --git a/src/audio_core/adsp/apps/opus/opus_multistream_decode_object.h b/src/audio_core/adsp/apps/opus/opus_multistream_decode_object.h
new file mode 100644
index 000000000..93558ded5
--- /dev/null
+++ b/src/audio_core/adsp/apps/opus/opus_multistream_decode_object.h
@@ -0,0 +1,39 @@
+// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#pragma once
+
+#include <opus_multistream.h>
+
+#include "common/common_types.h"
+
+namespace AudioCore::ADSP::OpusDecoder {
+using LibOpusMSDecoder = ::OpusMSDecoder;
+static constexpr u32 DecodeMultiStreamObjectMagic = 0xDEADBEEF;
+
+class OpusMultiStreamDecodeObject {
+public:
+ static u32 GetWorkBufferSize(u32 total_stream_count, u32 stereo_stream_count);
+ static OpusMultiStreamDecodeObject& Initialize(u64 buffer, u64 buffer2);
+
+ s32 InitializeDecoder(u32 sample_rate, u32 total_stream_count, u32 channel_count,
+ u32 stereo_stream_count, u8* mappings);
+ s32 Shutdown();
+ s32 ResetDecoder();
+ s32 Decode(u32& out_sample_count, u64 output_data, u64 output_data_size, u64 input_data,
+ u64 input_data_size);
+ u32 GetFinalRange() const noexcept {
+ return final_range;
+ }
+
+private:
+ u32 magic;
+ bool initialized;
+ bool state_valid;
+ OpusMultiStreamDecodeObject* self;
+ u32 final_range;
+ LibOpusMSDecoder* decoder;
+};
+static_assert(std::is_trivially_constructible_v<OpusMultiStreamDecodeObject>);
+
+} // namespace AudioCore::ADSP::OpusDecoder