From: boolemancer Date: Sun, 8 Jan 2023 13:08:45 +0000 (-0800) Subject: whisper : fix sample_to_timestamp calculation with 64 bit precision to avoid overflow... X-Git-Tag: upstream/1.7.4~1626 X-Git-Url: https://git.djapps.eu/?a=commitdiff_plain;h=08dc705a694248fb94b6f64cbeb93f4e474635e3;p=pkg%2Fggml%2Fsources%2Fwhisper.cpp 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 --- diff --git a/whisper.cpp b/whisper.cpp index 433b7355..f1985a49 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