whisper : fix extra memory usage (#2534)

* passing samples_padded by ref to the threads.

* passing samples_padded by ref to the threads.

---------

Co-authored-by: Vinith Misra <physicsdemon@gmail.com>
This commit is contained in:
Vin Misra 2024-11-06 13:02:11 -08:00 committed by GitHub
parent 0377596b77
commit 31aea563a8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -3164,7 +3164,7 @@ static bool log_mel_spectrogram(
std::vector<std::thread> workers(n_threads - 1); std::vector<std::thread> workers(n_threads - 1);
for (int iw = 0; iw < n_threads - 1; ++iw) { for (int iw = 0; iw < n_threads - 1; ++iw) {
workers[iw] = std::thread( workers[iw] = std::thread(
log_mel_spectrogram_worker_thread, iw + 1, hann, samples_padded, log_mel_spectrogram_worker_thread, iw + 1, hann, std::cref(samples_padded),
n_samples + stage_2_pad, frame_size, frame_step, n_threads, n_samples + stage_2_pad, frame_size, frame_step, n_threads,
std::cref(filters), std::ref(mel)); std::cref(filters), std::ref(mel));
} }