From cc97e45a1418fa9f63a34ceafcf4aa4c01fbdd0d Mon Sep 17 00:00:00 2001 From: Pascal Date: Thu, 7 May 2026 14:01:01 +0200 Subject: [PATCH] mtmd: fix whisper audio tail truncation by exposing padded buffer to FFT (#22770) --- tools/mtmd/mtmd-audio.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tools/mtmd/mtmd-audio.cpp b/tools/mtmd/mtmd-audio.cpp index 6bab1b6be9..8f0a9875b1 100644 --- a/tools/mtmd/mtmd-audio.cpp +++ b/tools/mtmd/mtmd-audio.cpp @@ -403,6 +403,11 @@ static bool log_mel_spectrogram( return false; } std::reverse_copy(samples + 1, samples + 1 + stage_2_pad, samples_padded.begin()); + + // expose the padded buffer to downstream FFT and to out.n_len computation + // mirrors the no_padding and center_padding branches above + samples = samples_padded.data(); + n_samples = samples_padded.size(); } // preemphasis