#pragma once #include "engine/framework/assets/tensor_source.h" #include "engine/framework/core/execution_context.h" #include "engine/framework/runtime/session.h" #include #include #include #include namespace engine::models::meanvc2 { struct MeanVC2VocosWeights; struct MeanVC2VocosGraph; class MeanVC2VocosRuntime final { public: MeanVC2VocosRuntime( std::shared_ptr source, engine::core::ExecutionContext & execution_context, size_t weight_context_bytes, size_t graph_context_bytes, engine::assets::TensorStorageType matmul_weight_storage_type, engine::assets::TensorStorageType conv_weight_storage_type); ~MeanVC2VocosRuntime(); runtime::AudioBuffer decode(const std::vector & mel_frames, int64_t frames) const; runtime::AudioBuffer decode_streaming(const std::vector & mel_frames, int64_t frames) const; void reset_streaming_state() const; runtime::AudioBuffer decode_streaming_chunk(const std::vector & mel_frames, int64_t frames) const; runtime::AudioBuffer finish_streaming() const; private: MeanVC2VocosGraph & graph_for_frames(int64_t frames) const; engine::core::ExecutionContext & execution_context_; size_t graph_context_bytes_ = 0; std::shared_ptr source_; std::shared_ptr weights_; mutable std::vector> graphs_; mutable std::vector streaming_mel_cache_; mutable std::vector streaming_last_wav_; }; } // namespace engine::models::meanvc2