]> git.djapps.eu Git - pkg/ggml/sources/whisper.cpp/commitdiff
whisper : fix sample_to_timestamp calculation with 64 bit precision to avoid overflow...
authorboolemancer <redacted>
Sun, 8 Jan 2023 13:08:45 +0000 (05:08 -0800)
committerGitHub <redacted>
Sun, 8 Jan 2023 13:08:45 +0000 (15:08 +0200)
* Do calculation with 64 bit precision to avoid overflow

* Update whisper.cpp

Co-authored-by: Georgi Gerganov <redacted>
Co-authored-by: Georgi Gerganov <redacted>
whisper.cpp

index 433b735502918e1e77f3f13661a1111e93d7ade7..f1985a496d36f52713520994972d62546473a4b1 100644 (file)
@@ -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