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>
pull/390/head
boolemancer 1 year ago committed by GitHub
parent 1512545149
commit 08dc705a69
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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

Loading…
Cancel
Save