Commit eb7efaa9 authored by Clément Bœsch's avatar Clément Bœsch

avfilter/dctdnoiz: fix slice_h computation

ceilf() can only work if the reminder of the division is not 0.

This fixes memory errors with for instance:
  ffmpeg -f lavfi -i testsrc=s=800x500 -threads 3 -vf dctdnoiz -frames:v 1 -f null -
parent 009a57b4
...@@ -534,7 +534,7 @@ static int config_input(AVFilterLink *inlink) ...@@ -534,7 +534,7 @@ static int config_input(AVFilterLink *inlink)
/* each slice will need to (pre & re)process the top and bottom block of /* each slice will need to (pre & re)process the top and bottom block of
* the previous one in in addition to its processing area. This is because * the previous one in in addition to its processing area. This is because
* each pixel is averaged by all the surrounding blocks */ * each pixel is averaged by all the surrounding blocks */
slice_h = (int)ceilf(s->pr_height / s->nb_threads) + (s->bsize - 1) * 2; slice_h = (int)ceilf(s->pr_height / (float)s->nb_threads) + (s->bsize - 1) * 2;
for (i = 0; i < s->nb_threads; i++) { for (i = 0; i < s->nb_threads; i++) {
s->slices[i] = av_malloc_array(linesize, slice_h * sizeof(*s->slices[i])); s->slices[i] = av_malloc_array(linesize, slice_h * sizeof(*s->slices[i]));
if (!s->slices[i]) if (!s->slices[i])
......
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