Fixes #8262
Unified · Split
| @@ -706,8 +706,8 @@ static int filter_slice(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs) · 705 unmodified lines | |||
| 706 | const int plane = td->plane; | 706 | const int plane = td->plane; |
| 707 | const int width = s->planewidth[plane]; | 707 | const int width = s->planewidth[plane]; |
| 708 | const int height = s->planeheight[plane]; | 708 | const int height = s->planeheight[plane]; |
| 709 | const int block_pos_bottom = height - s->block_size; | 709 | const int block_pos_bottom = FFMAX(0, height - s->block_size); |
| 710 | const int block_pos_right = width - s->block_size; | 710 | const int block_pos_right = FFMAX(0, width - s->block_size); |
| 711 | const int slice_start = (((height + block_step - 1) / block_step) * jobnr / nb_jobs) * block_step; | 711 | const int slice_start = (((height + block_step - 1) / block_step) * jobnr / nb_jobs) * block_step; |
| 712 | const int slice_end = (jobnr == nb_jobs - 1) ? block_pos_bottom + block_step : | 712 | const int slice_end = (jobnr == nb_jobs - 1) ? block_pos_bottom + block_step : |
| 713 | (((height + block_step - 1) / block_step) * (jobnr + 1) / nb_jobs) * block_step; | 713 | (((height + block_step - 1) / block_step) * (jobnr + 1) / nb_jobs) * block_step; |
| @@ -796,8 +796,8 @@ static int config_input(AVFilterLink *inlink) · 82 unmodified lines | |||
| 796 | for (i = 0; i < s->nb_threads; i++) { | 796 | for (i = 0; i < s->nb_threads; i++) { |
| 797 | SliceContext *sc = &s->slices[i]; | 797 | SliceContext *sc = &s->slices[i]; |
| 798 | 798 | ||
| 799 | sc->num = av_calloc(s->planewidth[0] * s->planeheight[0], sizeof(FFTSample)); | 799 | sc->num = av_calloc(FFALIGN(s->planewidth[0], s->block_size) * FFALIGN(s->planeheight[0], s->block_size), sizeof(FFTSample)); |
| 800 | sc->den = av_calloc(s->planewidth[0] * s->planeheight[0], sizeof(FFTSample)); | 800 | sc->den = av_calloc(FFALIGN(s->planewidth[0], s->block_size) * FFALIGN(s->planeheight[0], s->block_size), sizeof(FFTSample)); |
| 801 | if (!sc->num || !sc->den) | 801 | if (!sc->num || !sc->den) |
| 802 | return AVERROR(ENOMEM); | 802 | return AVERROR(ENOMEM); |
| 803 | 803 | ||