/usr/include/rem/rem_goertzel.h is in librem-dev 0.5.2-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | /**
* @file rem_goertzel.h Goertzel algorithm
*
* Copyright (C) 2010 Creytiv.com
*/
/** Defines the goertzel algorithm state */
struct goertzel {
double q1; /**< current state */
double q2; /**< previous state */
double coef; /**< coefficient */
};
void goertzel_init(struct goertzel *g, double freq, unsigned srate);
void goertzel_reset(struct goertzel *g);
double goertzel_result(struct goertzel *g);
/**
* Process sample
*
* @param g Goertzel state
* @param samp Sample value
*/
static inline void goertzel_update(struct goertzel *g, int16_t samp)
{
double q0 = g->coef*g->q1 - g->q2 + (double)samp;
g->q2 = g->q1;
g->q1 = q0;
}
|