26 void *
table,
int table_size,
27 double min,
double max,
double phase)
29 uint32_t i, phase_offset = phase /
M_PI / 2 * table_size + 0.5;
31 for (i = 0; i < table_size; i++) {
32 uint32_t point = (i + phase_offset) % table_size;
37 d = (sin((
double)point / table_size * 2 *
M_PI) + 1) / 2;
40 d = (double)point * 2 / table_size;
41 switch (4 * point / table_size) {
42 case 0: d = d + 0.5;
break;
44 case 2: d = 1.5 - d;
break;
45 case 3: d = d - 1.5;
break;
52 d = d * (max -
min) + min;
55 float *
fp = (
float *)table;
60 double *dp = (
double *)table;
66 d += d < 0 ? -0.5 : 0.5;
Main libavfilter public API header.
#define av_assert0(cond)
assert() equivalent, that is always enabled.
static const struct endianess table[]
simple assert() macros that are a bit more flexible than ISO C assert().
void ff_generate_wave_table(enum WaveType wave_type, enum AVSampleFormat sample_fmt, void *table, int table_size, double min, double max, double phase)
AVSampleFormat
Audio sample formats.