18#ifndef KALDI_NATIVE_FBANK_CSRC_FEATURE_WINDOW_H_
19#define KALDI_NATIVE_FBANK_CSRC_FEATURE_WINDOW_H_
35 throw std::invalid_argument(
"n must be > 0");
124 std::ostringstream os;
125#define KNF_PRINT(x) os << #x << ": " << x << "\n"
176 float blackman_coeff = 0.42);
190 const std::vector<float> &
GetWindow()
const {
return window_; }
193 std::vector<float> window_;
257 std::vector<float> *window,
258 float *log_energy_pre_window =
nullptr);
281 float *log_energy_pre_window =
nullptr);
315std::vector<float>
GetWindow(
const std::string &window_type,
316 int32_t window_size,
float blackman_coeff = 0.42);
Stores the windowing coefficients and applies them to a frame.
Definition feature-window.h:156
FeatureWindowFunction(const FrameExtractionOptions &opts)
Construct the windowing function implied by opts.window_type, with a size of opts....
FeatureWindowFunction(const std::string &window_type, int32_t window_size, float blackman_coeff=0.42)
Construct the windowing function of the given type and size.
FeatureWindowFunction()=default
Construct an empty window function.
FeatureWindowFunction(const std::vector< float > &window)
Construct from explicit window coefficients.
void Apply(float *wave) const
Apply the window to a frame, in place.
const std::vector< float > & GetWindow() const
Return the window coefficients.
Definition feature-window.h:190
This file is part of kaldi-native-fbank.
Definition feature-cmvn.h:42
void ProcessWindow(const FrameExtractionOptions &opts, const FeatureWindowFunction &window_function, float *window, float *log_energy_pre_window=nullptr)
This function does all the windowing steps after actually extracting the windowed signal: depending o...
int32_t RoundUpToNearestPowerOfTwo(int32_t n)
Round n up to the nearest power of two.
Definition feature-window.h:32
int32_t NumFrames(int64_t num_samples, const FrameExtractionOptions &opts, bool flush=true)
This function returns the number of frames that we can extract from a wave file with the given number...
float InnerProduct(const float *a, const float *b, int32_t n)
Compute the inner product of two vectors of size n.
std::vector< float > GetWindow(const std::string &window_type, int32_t window_size, float blackman_coeff=0.42)
Return the window coefficients of the given window type.
void ExtractWindow(int64_t sample_offset, const std::vector< float > &wave, int32_t f, const FrameExtractionOptions &opts, const FeatureWindowFunction &window_function, std::vector< float > *window, float *log_energy_pre_window=nullptr)
ExtractWindow() extracts a windowed frame of waveform (possibly with a power-of-two,...
std::ostream & operator<<(std::ostream &os, const FbankOptions &opts)
Write the options to the stream, one option per line.
int64_t FirstSampleOfFrame(int32_t frame, const FrameExtractionOptions &opts)
Return the index of the first sample of the frame indexed frame.