voice_audio_multi/include/engine/models/sherpa_kws/encoder.h
Fabio c36510c21e
Some checks failed
Linux Build / Linux cpu (push) Has been cancelled
Linux Build / Linux cpu-clang (push) Has been cancelled
Linux Build / Linux vulkan (push) Has been cancelled
mac-build / macOS CPU (push) Has been cancelled
Nix Build / Nix (cpu) (push) Has been cancelled
Nix Build / Nix (vulkan) (push) Has been cancelled
windows-build / Windows CPU (push) Has been cancelled
Initial import: audio.cpp with Orange Pi documentation
2026-11-04 19:05:22 +01:00

40 lines
1.1 KiB
C++

#pragma once
#include "engine/models/sherpa_kws/assets.h"
#include "engine/framework/core/execution_context.h"
#include <memory>
#include <vector>
namespace engine::models::sherpa_kws {
struct SherpaSubsampledChunk {
std::vector<float> values;
int64_t frames = 0;
int64_t channels = 0;
};
// Native implementation of the exported streaming Conv2dSubsampling
// boundary. Keeping this model-specific avoids changing the shared
// ZipEnhancer implementation while the complete Zipformer2 runtime is
// validated.
class SherpaEncoderRuntime {
public:
SherpaEncoderRuntime(
std::shared_ptr<const SherpaKwsAssets> assets,
core::ExecutionContext & execution_context);
~SherpaEncoderRuntime();
SherpaEncoderRuntime(const SherpaEncoderRuntime &) = delete;
SherpaEncoderRuntime & operator=(const SherpaEncoderRuntime &) = delete;
SherpaSubsampledChunk encode_subsampled_chunk(
const std::vector<float> & features) const;
void reset();
private:
struct Impl;
std::unique_ptr<Impl> impl_;
};
} // namespace engine::models::sherpa_kws