std1.0.0-beta-7 SafeC docs

Module dsp::conv_core

#include <std/dsp/conv_core.h> source

convolution core, written once for both precisions.

Internal: included by convolution.sc (double) and convolution_f32.sc (float), each its own translation unit. The includer defines CV_R (the real type), CV_C / CV_CNEW (its complex type and constructor), CV_DOT, CV_SDOT, CV_FFT / CV_IFFT / CV_FFT_BATCH (that precision's dsp_dot, dsp_sliding_dot and fft functions) and CV_DIRECT / CV_FFTCONV (the public names to define).

Structs

ConvDirectJobDirect convolution's inner sum is sum_k x[k] * h[n-k]: x is walked forward, h is walked in reverse, so it isn't literally a dot product of two contiguous ranges as written. Reversing h once up front (hrev[i] = h[len_h-1-i]) turns h[n-k] into hrev[(len_h-1-n)+k] — now increasing with k, same direction as x[k] — so the whole inner loop becomes one contiguous-range call into dsp_dot_f64's SIMD FMA accumulation instead of a scalar multiply-add per sample. Long convolutions split the outputs across the thread pool.
ConvMulJobPointwise multiply of every row of the batch by H, on the thread pool.
ConvOlaJobFilling rows from the signal, and adding results back, on the pool. A pair's output overlaps only its neighbours', so even pairs and then odd pairs can be added concurrently.

Functions

CV_DIRECT
CV_FFTCONV

Macros

CONV_OLA_BATCHTwo strategies, both on fft_batch / fft_n_ (threaded, vendor FFT if linked):