MCPcopy Create free account
hub / github.com/0xShug0/audio.cpp / Vevo2FlowMatchingRuntime

Method Vevo2FlowMatchingRuntime

src/models/vevo2/fm.cpp:1008–1031  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1006Vevo2FlowMatchingRuntime::~Vevo2FlowMatchingRuntime() = default;
1007
1008Vevo2MelSequence Vevo2FlowMatchingRuntime::cached_timbre_mel(const runtime::AudioBuffer & timbre_ref_audio) const {
1009 const TimbreMelCacheKey key{
1010 hash_audio_buffer(timbre_ref_audio),
1011 timbre_ref_audio.sample_rate,
1012 timbre_ref_audio.channels,
1013 timbre_ref_audio.samples.size(),
1014 };
1015 if (const auto * cached = timbre_mel_cache_.find(key)) {
1016 engine::debug::trace_log_scalar("vevo2.timbre_mel_cache.hit", 1);
1017 engine::debug::trace_log_scalar("vevo2.timbre_mel_cache.slots", static_cast<int64_t>(timbre_mel_cache_.capacity()));
1018 engine::debug::trace_log_scalar("vevo2.timbre_mel_cache.entries", static_cast<int64_t>(timbre_mel_cache_.size()));
1019 engine::debug::trace_log_scalar("vevo2.timbre_mel_cache.evicted", 0);
1020 return cached->mel;
1021 }
1022 auto mel = extract_timbre_mel(
1023 timbre_ref_audio,
1024 config_.preprocess,
1025 static_cast<size_t>(execution_context_.config().threads));
1026 const bool will_evict =
1027 timbre_mel_cache_.capacity() > 0 && timbre_mel_cache_.size() >= timbre_mel_cache_.capacity();
1028 timbre_mel_cache_.put(key, TimbreMelCacheValue{mel});
1029 engine::debug::trace_log_scalar("vevo2.timbre_mel_cache.hit", 0);
1030 engine::debug::trace_log_scalar("vevo2.timbre_mel_cache.slots", static_cast<int64_t>(timbre_mel_cache_.capacity()));
1031 engine::debug::trace_log_scalar("vevo2.timbre_mel_cache.entries", static_cast<int64_t>(timbre_mel_cache_.size()));
1032 engine::debug::trace_log_scalar("vevo2.timbre_mel_cache.evicted", will_evict ? 1 : 0);
1033 return mel;
1034}

Callers

nothing calls this directly

Calls 5

open_tensor_sourceFunction · 0.85
load_fm_weightsFunction · 0.85
backendMethod · 0.45
backend_typeMethod · 0.45
release_storageMethod · 0.45

Tested by

no test coverage detected