aboutsummaryrefslogtreecommitdiffstats
path: root/libavfilter
diff options
context:
space:
mode:
authorKyle Swanson <k@ylo.ph>2015-10-28 21:29:59 -0500
committerMichael Niedermayer <michael@niedermayer.cc>2015-10-29 18:16:09 +0100
commit3b1939bb6679e4e2e91eb41e7f09830ac418de16 (patch)
treed43b66b1041f7744071c53343d3272bf948d0101 /libavfilter
parente5451f25d3c2728943d31da2cf7975f33f5c9831 (diff)
downloadffmpeg-3b1939bb6679e4e2e91eb41e7f09830ac418de16.tar.gz
avfilter/tremolo: fix wavetable buffer size
Signed-off-by: Kyle Swanson <k@ylo.ph> Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavfilter')
-rw-r--r--libavfilter/af_tremolo.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/libavfilter/af_tremolo.c b/libavfilter/af_tremolo.c
index 50df2e4cc0..572e9e3b56 100644
--- a/libavfilter/af_tremolo.c
+++ b/libavfilter/af_tremolo.c
@@ -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;