#include "tensorflow/lite/kernels/internal/spectrogram.h"
#include <assert.h>
#include <math.h>
#include <stdint.h>
#include "third_party/fft2d/fft.h"
namespace tflite {
namespace internal {
complex;
namespace {
void GetPeriodicHann(int window_length, std::vector<double>* window) { … }
}
bool Spectrogram::Initialize(int window_length, int step_length) { … }
inline int Log2Floor(uint32_t n) { … }
inline int Log2Ceiling(uint32_t n) { … }
inline uint32_t NextPowerOfTwo(uint32_t value) { … }
bool Spectrogram::Initialize(const std::vector<double>& window,
int step_length) { … }
template <class InputSample, class OutputSample>
bool Spectrogram::ComputeComplexSpectrogram(
const std::vector<InputSample>& input,
std::vector<std::vector<complex<OutputSample>>>* output) { … }
template bool Spectrogram::ComputeComplexSpectrogram(
const std::vector<float>& input, std::vector<std::vector<complex<float>>>*);
template bool Spectrogram::ComputeComplexSpectrogram(
const std::vector<double>& input,
std::vector<std::vector<complex<float>>>*);
template bool Spectrogram::ComputeComplexSpectrogram(
const std::vector<float>& input,
std::vector<std::vector<complex<double>>>*);
template bool Spectrogram::ComputeComplexSpectrogram(
const std::vector<double>& input,
std::vector<std::vector<complex<double>>>*);
template <class InputSample, class OutputSample>
bool Spectrogram::ComputeSquaredMagnitudeSpectrogram(
const std::vector<InputSample>& input,
std::vector<std::vector<OutputSample>>* output) { … }
template bool Spectrogram::ComputeSquaredMagnitudeSpectrogram(
const std::vector<float>& input, std::vector<std::vector<float>>*);
template bool Spectrogram::ComputeSquaredMagnitudeSpectrogram(
const std::vector<double>& input, std::vector<std::vector<float>>*);
template bool Spectrogram::ComputeSquaredMagnitudeSpectrogram(
const std::vector<float>& input, std::vector<std::vector<double>>*);
template bool Spectrogram::ComputeSquaredMagnitudeSpectrogram(
const std::vector<double>& input, std::vector<std::vector<double>>*);
template <class InputSample>
bool Spectrogram::GetNextWindowOfSamples(const std::vector<InputSample>& input,
int* input_start) { … }
void Spectrogram::ProcessCoreFFT() { … }
}
}