Browse code

avfilter/vf_colormatrix: make sure the number of threads is even for yuv420p

Fix crash with for example:
ffmpeg -f lavfi -i testsrc=568x320 -threads 3 -vf format=yuv420p,colormatrix=bt709:smpte170m -f null -

Clément Bœsch authored on 2015/03/18 04:09:49
Showing 1 changed files
... ...
@@ -416,7 +416,7 @@ static int filter_frame(AVFilterLink *link, AVFrame *in)
416 416
                                FFMIN(in->height, ctx->graph->nb_threads));
417 417
     else if (in->format == AV_PIX_FMT_YUV420P)
418 418
         ctx->internal->execute(ctx, process_slice_yuv420p, &td, NULL,
419
-                               FFMIN(in->height, ctx->graph->nb_threads));
419
+                               FFMAX(1, FFMIN(in->height, ctx->graph->nb_threads) & ~1));
420 420
     else
421 421
         ctx->internal->execute(ctx, process_slice_uyvy422, &td, NULL,
422 422
                                FFMIN(in->height, ctx->graph->nb_threads));