| 1006 | Vevo2FlowMatchingRuntime::~Vevo2FlowMatchingRuntime() = default; |
| 1007 | |
| 1008 | Vevo2MelSequence 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 | } |
nothing calls this directly
no test coverage detected