78 #define MUTE_THRESHOLD_SEC 0.000333
82 #define S16_SCALE 32753.0f
85 #define LFG_SCALE (1.0f / (2.0f * INT32_MAX))
90 2.2374f, -0.7339f, -0.1251f, -0.6033f
94 0.9030f, 0.0116f, -0.5853f, -0.2571f
98 2.2061f, -0.4707f, -0.2534f, -0.6213f
102 1.0587f, 0.0676f, -0.6054f, -0.2738f
108 for (i = 0; i <
len; i++)
115 int *src1 = src0 +
len;
117 for (i = 0; i <
len; i++) {
127 for (i = 0; i <
len; i++)
131 #define SQRT_1_6 0.40824829046386301723f
138 for (i = 0; i < len - 2; i++)
139 src[i] = (-src[i] + 2 * src[i + 1] - src[i + 2]) *
SQRT_1_6;
146 int nb_samples =
FFALIGN(min_samples, 16) + 16;
147 int buf_samples = nb_samples *
149 unsigned int *noise_buf_ui;
158 noise_buf_ui = (
unsigned int *)state->
noise_buf;
161 for (i = 0; i < buf_samples; i++)
173 int16_t *dst,
const float *
src,
182 for (i = 0; i < nb_samples; i++) {
186 for (j = 0; j < 4; j++) {
190 for (j = 3; j > 0; j--) {
198 dst[i] = av_clip_int16(
lrintf(sample));
201 dst[i] = av_clip_int16(
lrintf(sample + dither[i]));
202 state->
dither_b[0] = av_clipf(dst[i] - sample, -1.5f, 1.5f);
212 int channels,
int nb_samples)
215 int aligned_samples =
FFALIGN(nb_samples, 16);
217 for (ch = 0; ch < channels; ch++) {
284 if (!(ptr_align % c->
ddsp.
ptr_align) && samples_align >= aligned_len) {
323 for (ch = 0; ch < c->
channels; ch++)
370 sample_rate != 48000 && sample_rate != 44100) {
372 "for triangular_ns dither. using triangular_hp instead.\n");
379 if (sample_rate == 48000) {
393 "dither s16 buffer");
398 channels, sample_rate, 0);
405 "dither flt buffer");
428 for (ch = 0; ch < channels; ch++) {