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

Method run

src/framework/audio/flashsr.cpp:378–392  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

376 }
377
378 std::vector<float> run(const std::vector<float> & waveform) {
379 if (static_cast<int64_t>(waveform.size()) != input_samples_) {
380 throw std::runtime_error("FlashSR input size changed without rebuilding graph");
381 }
382 ggml_backend_tensor_set(input_, waveform.data(), 0, waveform.size() * sizeof(float));
383 core::set_backend_threads(weights_.backend.get(), weights_.threads);
384 const auto status = core::compute_backend_graph(weights_.backend.get(), graph_, plan_, "FlashSR");
385 ggml_backend_synchronize(weights_.backend.get());
386 if (status != GGML_STATUS_SUCCESS) {
387 throw std::runtime_error("FlashSR GGML graph compute failed");
388 }
389 std::vector<float> output(ggml_nelements(output_));
390 ggml_backend_tensor_get(output_, output.data(), 0, output.size() * sizeof(float));
391 return output;
392 }
393
394private:
395 const FlashSrWeights & weights_;

Callers 2

plan_vad_audio_chunksFunction · 0.45

Calls 9

ggml_backend_tensor_setFunction · 0.85
set_backend_threadsFunction · 0.85
compute_backend_graphFunction · 0.85
ggml_backend_synchronizeFunction · 0.85
ggml_nelementsFunction · 0.85
ggml_backend_tensor_getFunction · 0.85
sizeMethod · 0.45
dataMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected