77 #define MUTE_THRESHOLD_SEC 0.000333
81 #define S16_SCALE 32753.0f
84 #define LFG_SCALE (1.0f / (2.0f * INT32_MAX))
89 2.2374f, -0.7339f, -0.1251f, -0.6033f
93 0.9030f, 0.0116f, -0.5853f, -0.2571f
97 2.2061f, -0.4707f, -0.2534f, -0.6213f
101 1.0587f, 0.0676f, -0.6054f, -0.2738f
107 for (i = 0; i <
len; i++)
114 int *src1 = src0 +
len;
116 for (i = 0; i <
len; i++) {
126 for (i = 0; i <
len; i++)
130 #define SQRT_1_6 0.40824829046386301723f
137 for (i = 0; i < len - 2; i++)
138 src[i] = (-src[i] + 2 * src[i + 1] - src[i + 2]) *
SQRT_1_6;
146 int buf_samples = nb_samples *
148 unsigned int *noise_buf_ui;
157 noise_buf_ui = (
unsigned int *)state->
noise_buf;
160 for (i = 0; i < buf_samples; i++)
172 int16_t *
dst,
const float *src,
185 for (j = 0; j < 4; j++) {
189 for (j = 3; j > 0; j--) {
197 dst[i] = av_clip_int16(
lrintf(sample));
200 dst[i] = av_clip_int16(
lrintf(sample + dither[i]));
201 state->
dither_b[0] = av_clipf(dst[i] - sample, -1.5f, 1.5f);
214 int aligned_samples =
FFALIGN(nb_samples, 16);
216 for (ch = 0; ch < channels; ch++) {
283 if (!(ptr_align % c->
ddsp.
ptr_align) && samples_align >= aligned_len) {
322 for (ch = 0; ch < c->
channels; ch++)
369 sample_rate != 48000 && sample_rate != 44100) {
371 "for triangular_ns dither. using triangular_hp instead.\n");
378 if (sample_rate == 48000) {
392 "dither s16 buffer");
397 channels, sample_rate, 0);
404 "dither flt buffer");
427 for (ch = 0; ch < channels; ch++) {