| 411 | } |
| 412 | |
| 413 | std::vector<float> nearest_upsample_f0(const std::vector<float> & f0, int64_t frames, int64_t scale) { |
| 414 | if (static_cast<int64_t>(f0.size()) != frames) { |
| 415 | throw std::runtime_error("HiFT F0 shape mismatch"); |
| 416 | } |
| 417 | std::vector<float> out(static_cast<size_t>(frames * scale), 0.0F); |
| 418 | for (int64_t t = 0; t < frames; ++t) { |
| 419 | std::fill( |
| 420 | out.begin() + static_cast<std::ptrdiff_t>(t * scale), |
| 421 | out.begin() + static_cast<std::ptrdiff_t>((t + 1) * scale), |
| 422 | f0[static_cast<size_t>(t)]); |
| 423 | } |
| 424 | return out; |
| 425 | } |
| 426 | |
| 427 | std::vector<float> make_sine_source( |
| 428 | const HiftVocoderWeights & weights, |