MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / GetNextWindowOfSamples

Method GetNextWindowOfSamples

tensorflow/lite/kernels/internal/spectrogram.cc:199–222  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

197// Return true if a full window of samples is prepared; manage the queue.
198template <class InputSample>
199bool Spectrogram::GetNextWindowOfSamples(const std::vector<InputSample>& input,
200 int* input_start) {
201 auto input_it = input.begin() + *input_start;
202 int input_remaining = input.end() - input_it;
203 if (samples_to_next_step_ > input_remaining) {
204 // Copy in as many samples are left and return false, no full window.
205 input_queue_.insert(input_queue_.end(), input_it, input.end());
206 *input_start += input_remaining; // Increases it to input.size().
207 samples_to_next_step_ -= input_remaining;
208 return false; // Not enough for a full window.
209 } else {
210 // Copy just enough into queue to make a new window, then trim the
211 // front off the queue to make it window-sized.
212 input_queue_.insert(input_queue_.end(), input_it,
213 input_it + samples_to_next_step_);
214 *input_start += samples_to_next_step_;
215 input_queue_.erase(
216 input_queue_.begin(),
217 input_queue_.begin() + input_queue_.size() - window_length_);
218 // DCHECK_EQ(window_length_, input_queue_.size());
219 samples_to_next_step_ = step_length_; // Be ready for next time.
220 return true; // Yes, input_queue_ now contains exactly a window-full.
221 }
222}
223
224void Spectrogram::ProcessCoreFFT() {
225 for (int j = 0; j < window_length_; ++j) {

Callers

nothing calls this directly

Calls 5

beginMethod · 0.45
endMethod · 0.45
insertMethod · 0.45
eraseMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected