29 #define WS_MAX_CHANNELS 32
30 #define INF_TS 0x7FFFFFFFFFFFFFFF
106 #define LCG_A 1284865837
107 #define LCG_C 4150755663
108 #define LCG_AI 849225893
118 uint32_t
a,
c, t = *
s;
152 for (j = 0; j < 7; j++) {
172 if (b < (uint64_t)1 << 32) {
174 return ((a / b) << 32) | ((a %
b) << 32) /
b;
176 if (b < (uint64_t)1 << 48) {
177 for (i = 0; i < 4; i++) {
179 r = (r << 16) | (a / b);
184 for (i = 63; i >= 0; i--) {
185 if (a >= (uint64_t)1 << 63 || a << 1 >=
b) {
186 r |= (uint64_t)1 << i;
198 uint64_t dt2 = dt & 1 ?
199 dt * ((dt - 1) >> 1) : (dt >> 1) * (dt - 1);
209 for (i = 0; i < ws->
nb_inter; i++) {
227 int64_t pink_ts_next = ts & ~(
PINK_UNIT - 1);
247 int64_t dphi1, dphi2, dt, cur_ts = -0x8000000000000000;
261 for (i = 0; i < ws->
nb_inter; i++) {
263 if (edata_end - edata < 24)
276 if (edata_end - edata < 20)
287 in->
ddphi = (dphi2 - dphi1) / dt;
288 if (phi & 0x80000000) {
294 in->
phi0 = (uint64_t)phi << 33;
298 if (edata_end - edata < 8)
307 in->
amp0 = (int64_t)a1 << 32;
308 in->
damp = (((int64_t)a2 << 32) - ((int64_t)a1 << 32)) / dt;
310 if (edata != edata_end)
322 "This implementation is limited to %d channels.\n",
337 ws->
sin[i] = floor(32767 *
sin(2 *
M_PI * i / (1 << SIN_BITS)));
359 uint32_t
c, all_ch = 0;
389 for (c = in->
channels, cv = channels; c; c >>= 1, cv++)
394 for (c = all_ch, cv = channels;
c; c >>= 1, cv++)
407 for (i = ws->
next_inter; i < ws->nb_inter; i++) {
436 if (packet->
size != 12)
448 pcm = (int16_t *)frame->
data[0];
450 memset(channels, 0, avc->
channels *
sizeof(*channels));
455 *(pcm++) = channels[
c] >> 16;