From 08dc705a694248fb94b6f64cbeb93f4e474635e3 Mon Sep 17 00:00:00 2001 From: boolemancer <48014766+boolemancer@users.noreply.github.com> Date: Sun, 8 Jan 2023 05:08:45 -0800 Subject: [PATCH] whisper : fix sample_to_timestamp calculation with 64 bit precision to avoid overflow (#388) * Do calculation with 64 bit precision to avoid overflow * Update whisper.cpp Co-authored-by: Georgi Gerganov Co-authored-by: Georgi Gerganov --- whisper.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/whisper.cpp b/whisper.cpp index 433b735..f1985a4 100644 --- a/whisper.cpp +++ b/whisper.cpp @@ -3388,7 +3388,7 @@ static int timestamp_to_sample(int64_t t, int n_samples) { } static int64_t sample_to_timestamp(int i_sample) { - return (100*i_sample)/WHISPER_SAMPLE_RATE; + return (100ll*i_sample)/WHISPER_SAMPLE_RATE; } // a cost-function / heuristic that is high for text that takes longer to pronounce