MayaFlux 1.0.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ FftContext() [3/3]

MayaFlux::Yantra::FftContext::FftContext ( const Portal::Graphics::ShaderSpec & spec,
uint32_t points,
Portal::Graphics::SpectrumOutput output,
bool inverse,
std::span< const double > weights = {} )
inlineprivate

Definition at line 233 of file FftContext.hpp.

234 {})
235 : WordPairExecutionContext(config_from_spec(spec), bindings_from_spec(spec), false, "FftContext")
240 , m_scale(inverse && points > 0 ? 1.0 / static_cast<double>(points) : 1.0)
241 , m_weights(weights.begin(), weights.end())
242 {
243 const uint32_t half = points / 2;
244 m_twiddle.reserve(static_cast<size_t>(half) * 2);
245 for (uint32_t k = 0; k < half; ++k) {
246 const double angle = 2.0 * std::numbers::pi * static_cast<double>(k) / static_cast<double>(points);
247 m_twiddle.push_back(std::cos(angle));
248 m_twiddle.push_back(inverse ? std::sin(angle) : -std::sin(angle));
249 }
250 }
std::vector< double > m_weights
std::vector< double > m_twiddle
uint32_t descriptors() const noexcept
Rows of weights of a projecting context, zero otherwise.
uint32_t points() const noexcept
ShaderExecutionContext & output(size_t byte_size, GpuBufferBinding::ElementType type=GpuBufferBinding::ElementType::FLOAT32)
Add an OUTPUT binding, inferring the next available binding index.
WordPairExecutionContext(GpuComputeConfig config, std::vector< GpuBufferBinding > bindings, bool order_key, std::string name="WordPairExecutionContext")
@ Portal
High-level user-facing API layer.
SpectrumOutput
What an FFT template writes for each window.
@ Projection
descriptors values per window: row r of a weights binding, one weight per power bin,...
@ Power
points / 2 + 1 bins of re * re + im * im, after scaling
GpuComputeConfig config_from_spec(const Portal::Graphics::ShaderSpec &spec)
Derive a GpuComputeConfig from a ShaderSpec.
std::vector< GpuBufferBinding > bindings_from_spec(const Portal::Graphics::ShaderSpec &spec)
Derive a GpuBufferBinding list from a ShaderSpec.
static constexpr DomainSpec Graphics
Domain constant for Graphics domain.
Definition Creator.hpp:516

References MayaFlux::Yantra::ShaderExecutionContext< InputType, OutputType >::output(), and points().

Here is the call graph for this function: