Commit 3b1939bb authored by Kyle Swanson's avatar Kyle Swanson Committed by Michael Niedermayer

avfilter/tremolo: fix wavetable buffer size

Signed-off-by: 's avatarKyle Swanson <k@ylo.ph>
Reviewed-by: 's avatarPaul B Mahol <onemda@gmail.com>
Signed-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent e5451f25
......@@ -72,7 +72,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
dst += channels;
src += channels;
s->index++;
if (s->index >= inlink->sample_rate)
if (s->index >= inlink->sample_rate / s->freq)
s->index = 0;
}
......@@ -125,11 +125,11 @@ static int config_input(AVFilterLink *inlink)
const double offset = 1. - s->depth / 2.;
int i;
s->table = av_malloc_array(inlink->sample_rate, sizeof(*s->table));
s->table = av_malloc_array(inlink->sample_rate / s->freq, sizeof(*s->table));
if (!s->table)
return AVERROR(ENOMEM);
for (i = 0; i < inlink->sample_rate; i++) {
for (i = 0; i < inlink->sample_rate / s->freq; i++) {
double env = s->freq * i / inlink->sample_rate;
env = sin(2 * M_PI * fmod(env + 0.25, 1.0));
s->table[i] = env * (1 - fabs(offset)) + offset;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment