Avoid ambiguous math overloads
Explicitly use double types for fft-related ops. Fixes #25690. PiperOrigin-RevId: 243889652
This commit is contained in:
parent
13a4593d8b
commit
0c70a6da86
@ -41,7 +41,7 @@ bool MfccDct::Initialize(int input_length, int coefficient_count) {
|
|||||||
cosines_.resize(coefficient_count_);
|
cosines_.resize(coefficient_count_);
|
||||||
double fnorm = sqrt(2.0 / input_length_);
|
double fnorm = sqrt(2.0 / input_length_);
|
||||||
// Some platforms don't have M_PI, so define a local constant here.
|
// Some platforms don't have M_PI, so define a local constant here.
|
||||||
const double pi = atan(1) * 4;
|
const double pi = atan(1.0) * 4.0;
|
||||||
double arg = pi / input_length_;
|
double arg = pi / input_length_;
|
||||||
for (int i = 0; i < coefficient_count_; ++i) {
|
for (int i = 0; i < coefficient_count_; ++i) {
|
||||||
cosines_[i].resize(input_length_);
|
cosines_[i].resize(input_length_);
|
||||||
|
@ -29,10 +29,10 @@ namespace {
|
|||||||
// Returns the default Hann window function for the spectrogram.
|
// Returns the default Hann window function for the spectrogram.
|
||||||
void GetPeriodicHann(int window_length, std::vector<double>* window) {
|
void GetPeriodicHann(int window_length, std::vector<double>* window) {
|
||||||
// Some platforms don't have M_PI, so define a local constant here.
|
// Some platforms don't have M_PI, so define a local constant here.
|
||||||
const double pi = std::atan(1) * 4;
|
const double pi = std::atan(1.0) * 4.0;
|
||||||
window->resize(window_length);
|
window->resize(window_length);
|
||||||
for (int i = 0; i < window_length; ++i) {
|
for (int i = 0; i < window_length; ++i) {
|
||||||
(*window)[i] = 0.5 - 0.5 * cos((2 * pi * i) / window_length);
|
(*window)[i] = 0.5 - 0.5 * cos((2.0 * pi * i) / window_length);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} // namespace
|
} // namespace
|
||||||
|
Loading…
Reference in New Issue
Block a user