| 724 | return "vevo2"; |
| 725 | } |
| 726 | |
| 727 | runtime::VoiceTaskKind Vevo2Session::task_kind() const { |
| 728 | return task_.task; |
| 729 | } |
| 730 | |
| 731 | runtime::RunMode Vevo2Session::run_mode() const { |
| 732 | return task_.mode; |
| 733 | } |
| 734 | |
| 735 | void Vevo2Session::prepare(const runtime::SessionPreparationRequest & request) { |
| 736 | (void) request; |
| 737 | mark_prepared(); |
| 738 | } |
| 739 | |
| 740 | std::vector<float> Vevo2Session::cached_whisper_features( |
| 741 | const runtime::AudioBuffer & audio, |
| 742 | int64_t target_frames, |
| 743 | size_t threads) { |
| 744 | const AudioCacheKey key{ |
| 745 | hash_audio_buffer(audio), |
| 746 | audio.sample_rate, |
| 747 | audio.channels, |
| 748 | audio.samples.size(), |
| 749 | target_frames, |
| 750 | }; |
| 751 | if (const auto * cached = whisper_feature_cache_.find(key)) { |
| 752 | engine::debug::trace_log_scalar("vevo2.whisper_feature_cache.hit", 1); |
| 753 | engine::debug::trace_log_scalar("vevo2.whisper_feature_cache.slots", static_cast<int64_t>(whisper_feature_cache_.capacity())); |
| 754 | engine::debug::trace_log_scalar("vevo2.whisper_feature_cache.entries", static_cast<int64_t>(whisper_feature_cache_.size())); |
| 755 | engine::debug::trace_log_scalar("vevo2.whisper_feature_cache.evicted", 0); |
| 756 | return cached->features; |
| 757 | } |
| 758 | |
| 759 | auto features = extract_whisper_features(whisper_frontend_, audio, target_frames, threads); |
| 760 | const bool will_evict = |
| 761 | whisper_feature_cache_.capacity() > 0 && whisper_feature_cache_.size() >= whisper_feature_cache_.capacity(); |
| 762 | whisper_feature_cache_.put(key, AudioFeatureCacheValue{features}); |
| 763 | engine::debug::trace_log_scalar("vevo2.whisper_feature_cache.hit", 0); |
| 764 | engine::debug::trace_log_scalar("vevo2.whisper_feature_cache.slots", static_cast<int64_t>(whisper_feature_cache_.capacity())); |
| 765 | engine::debug::trace_log_scalar("vevo2.whisper_feature_cache.entries", static_cast<int64_t>(whisper_feature_cache_.size())); |
| 766 | engine::debug::trace_log_scalar("vevo2.whisper_feature_cache.evicted", will_evict ? 1 : 0); |
| 767 | return features; |
| 768 | } |
| 769 | |
| 770 | Vevo2TokenSequence Vevo2Session::cached_content_style_tokens( |
| 771 | const runtime::AudioBuffer & audio, |
| 772 | const std::vector<float> & whisper_features, |
| 773 | int64_t feature_frames) { |
| 774 | const AudioCacheKey key{ |
| 775 | hash_audio_buffer(audio), |
| 776 | audio.sample_rate, |
| 777 | audio.channels, |
| 778 | audio.samples.size(), |
| 779 | feature_frames, |
| 780 | }; |
| 781 | if (const auto * cached = content_style_token_cache_.find(key)) { |
| 782 | engine::debug::trace_log_scalar("vevo2.content_style_token_cache.hit", 1); |
| 783 | engine::debug::trace_log_scalar("vevo2.content_style_token_cache.slots", static_cast<int64_t>(content_style_token_cache_.capacity())); |
nothing calls this directly
no test coverage detected