[FFmpeg-cvslog] avfilter/af_sofalizer: fix crash when ir size is not aligned, usually when n_samples are not power of 2
Paul B Mahol
git at videolan.org
Fri Mar 4 10:41:32 CET 2016
ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Fri Mar 4 10:36:11 2016 +0100| [79a54f30c8ba02cbf2b02c650120246b260977ec] | committer: Paul B Mahol
avfilter/af_sofalizer: fix crash when ir size is not aligned, usually when n_samples are not power of 2
Signed-off-by: Paul B Mahol <onemda at gmail.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=79a54f30c8ba02cbf2b02c650120246b260977ec
---
libavfilter/af_sofalizer.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/libavfilter/af_sofalizer.c b/libavfilter/af_sofalizer.c
index 33937d8..4c7ea68 100644
--- a/libavfilter/af_sofalizer.c
+++ b/libavfilter/af_sofalizer.c
@@ -490,8 +490,15 @@ static int compensate_volume(AVFilterContext *ctx)
av_log(ctx, AV_LOG_DEBUG, "Compensate-factor: %f\n", compensate);
ir = sofa->data_ir;
/* apply volume compensation to IRs */
- s->fdsp->vector_fmul_scalar(ir, ir, compensate, sofa->n_samples * sofa->m_dim * 2);
- emms_c();
+ if (sofa->n_samples & 31) {
+ int i;
+ for (i = 0; i < sofa->n_samples * sofa->m_dim * 2; i++) {
+ ir[i] = ir[i] * compensate;
+ }
+ } else {
+ s->fdsp->vector_fmul_scalar(ir, ir, compensate, sofa->n_samples * sofa->m_dim * 2);
+ emms_c();
+ }
}
return 0;
More information about the ffmpeg-cvslog
mailing list