Skip to content

Commit 08dc705

Browse files
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 <ggerganov@gmail.com> Co-authored-by: Georgi Gerganov <ggerganov@gmail.com>
1 parent 1512545 commit 08dc705

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

whisper.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -3388,7 +3388,7 @@ static int timestamp_to_sample(int64_t t, int n_samples) {
33883388
}
33893389

33903390
static int64_t sample_to_timestamp(int i_sample) {
3391-
return (100*i_sample)/WHISPER_SAMPLE_RATE;
3391+
return (100ll*i_sample)/WHISPER_SAMPLE_RATE;
33923392
}
33933393

33943394
// a cost-function / heuristic that is high for text that takes longer to pronounce

0 commit comments

Comments
 (0)