mirror of
https://github.com/mollyim/webrtc.git
synced 2025-05-15 14:50:39 +01:00
APM PFFFT wrapper: Add frequency domain convolution
Wrapping pffft_zconvolve_accumulate() Bug: webrtc:9577 Change-Id: I68b7da4d08c28583f5abd59d906603754c94c00f Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/130500 Reviewed-by: Ivo Creusen <ivoc@webrtc.org> Commit-Queue: Alessio Bazzica <alessiob@webrtc.org> Cr-Commit-Position: refs/heads/master@{#27358}
This commit is contained in:
parent
21583fdbcf
commit
703e34a04f
2 changed files with 20 additions and 0 deletions
|
@ -121,4 +121,15 @@ void Pffft::BackwardTransform(const FloatBuffer& in,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Pffft::FrequencyDomainConvolve(const FloatBuffer& fft_x,
|
||||||
|
const FloatBuffer& fft_y,
|
||||||
|
FloatBuffer* out,
|
||||||
|
float scaling) {
|
||||||
|
RTC_DCHECK_EQ(fft_x.size(), GetBufferSize(fft_size_, fft_type_));
|
||||||
|
RTC_DCHECK_EQ(fft_x.size(), fft_y.size());
|
||||||
|
RTC_DCHECK_EQ(fft_x.size(), out->size());
|
||||||
|
pffft_zconvolve_accumulate(pffft_status_, fft_x.const_data(),
|
||||||
|
fft_y.const_data(), out->data(), scaling);
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace webrtc
|
} // namespace webrtc
|
||||||
|
|
|
@ -73,6 +73,15 @@ class Pffft {
|
||||||
// Computes the backward fast Fourier transform.
|
// Computes the backward fast Fourier transform.
|
||||||
void BackwardTransform(const FloatBuffer& in, FloatBuffer* out, bool ordered);
|
void BackwardTransform(const FloatBuffer& in, FloatBuffer* out, bool ordered);
|
||||||
|
|
||||||
|
// Multiplies the frequency components of |fft_x| and |fft_y| and accumulates
|
||||||
|
// them into |out|. The arrays must have been obtained with
|
||||||
|
// ForwardTransform(..., /*ordered=*/false) - i.e., |fft_x| and |fft_y| must
|
||||||
|
// not be ordered.
|
||||||
|
void FrequencyDomainConvolve(const FloatBuffer& fft_x,
|
||||||
|
const FloatBuffer& fft_y,
|
||||||
|
FloatBuffer* out,
|
||||||
|
float scaling = 1.f);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const size_t fft_size_;
|
const size_t fft_size_;
|
||||||
const FftType fft_type_;
|
const FftType fft_type_;
|
||||||
|
|
Loading…
Reference in a new issue