Gaborator reference: render.h

Spectrogram Rendering with Power-of-Two Scaling

template <class OI, class T>
void render_p2scale(const analyzer<T> &a,
                    const coefs<T> &c,
                    int64_t xorigin, int64_t yorigin,
                    int64_t xi0, int64_t xi1, int xe,
                    int64_t yi0, int64_t yi1, int ye,
                    OI output);

Render a rectangular array of pixel values representing signal amplitudes in time-frequency space, optionally scaling up or down by powers of two.

The spectrum analyzer that produced the coefficients c
A set of spectrogram coefficients to render
The point in time corresponding to pixel X coordinate 0, in samples. Due to limitations of the implementation, this must currently be 0. Instead, horizontal translation must be done by means of converting the origin to pixel units and adding it to both xi0 and yi0.
The band number of the frequency band corresponding to pixel Y coordinate 0. Typically 0, or the band number of a reference frequency such as 440 Hz, to make that frequency always coincide exactly with a pixel regardless of the scale factor.
The X coordinate of the first pixel to render
The X coordinate one past the last pixel to render
The horizontal scaling exponent. One horizontal pixel corresponds to 2xe signal samples.
The Y coordinate of the first pixel to render
The Y coordinate one past the last pixel to render
The vertical scaling exponent. One vertical pixel corresponds to 2ye frequency bands.
A random access iterator through which the output pixel amplitude values will be written. This is typically a float *. A total of (xi1 - xi0) * (yi1 - yi0)) values will be written.

Utility Functions

template <class T>
unsigned int float2pixel_8bit(T amp);

Convert a normalized amplitude value to a 8-bit greyscale pixel value.

A floating point value representing a signal amplitude, nominally ranging from 0 to 1

Returns an pixel value ranging from 0 to 255 (inclusive), using an approximation of the sRGB gamma.