aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul B Mahol <onemda@gmail.com>2015-12-13 17:37:47 +0100
committerPaul B Mahol <onemda@gmail.com>2015-12-13 17:57:07 +0100
commitf69f050a316810dca1f3bce79d5c7ccaa2ea51c0 (patch)
treea2d2bc412d7d7f3140d6bd0483b65d58c3f093a2
parentb51e7554e74cbf007a1cab83c7bed3ad9fa2793a (diff)
downloadffmpeg-f69f050a316810dca1f3bce79d5c7ccaa2ea51c0.tar.gz
avfilter/af_sofalizer: fix calculation of split point
Signed-off-by: Paul B Mahol <onemda@gmail.com>
-rw-r--r--libavfilter/af_sofalizer.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/libavfilter/af_sofalizer.c b/libavfilter/af_sofalizer.c
index e8698fb9be..5143145043 100644
--- a/libavfilter/af_sofalizer.c
+++ b/libavfilter/af_sofalizer.c
@@ -652,8 +652,10 @@ static int sofalizer_convolute(AVFilterContext *ctx, void *arg, int jobnr, int n
if (read + n_samples < buffer_length) {
memcpy(temp_src, bptr + read, n_samples * sizeof(*temp_src));
} else {
- memcpy(temp_src, bptr + read, (buffer_length - read) * sizeof(*temp_src));
- memcpy(temp_src + (buffer_length - read), bptr, (read - n_samples) * sizeof(*temp_src));
+ int len = FFMIN(n_samples - (read % n_samples), buffer_length - read);
+
+ memcpy(temp_src, bptr + read, len * sizeof(*temp_src));
+ memcpy(temp_src + len, bptr, (n_samples - len) * sizeof(*temp_src));
}
/* multiply signal and IR, and add up the results */