Add SQRT_HANN window type to both SpectrogramCalculator and InverseSpectrogramCalculator.

PiperOrigin-RevId: 503041493
This commit is contained in:
MediaPipe Team 2023-01-18 19:40:19 -08:00 committed by Copybara-Service
parent 97af47ebf5
commit e2dedcbfe5
2 changed files with 8 additions and 0 deletions

View File

@ -280,6 +280,13 @@ absl::Status SpectrogramCalculator::Open(CalculatorContext* cc) {
audio_dsp::HammingWindow().GetPeriodicSamples(frame_duration_samples_,
&window);
break;
case SpectrogramCalculatorOptions::SQRT_HANN: {
audio_dsp::HannWindow().GetPeriodicSamples(frame_duration_samples_,
&window);
absl::c_transform(window, window.begin(),
[](double x) { return std::sqrt(x); });
break;
}
}
// Propagate settings down to the actual Spectrogram object.

View File

@ -68,6 +68,7 @@ message SpectrogramCalculatorOptions {
HANN = 0;
HAMMING = 1;
COSINE = 2;
SQRT_HANN = 4;
}
optional WindowType window_type = 6 [default = HANN];