summaryrefslogtreecommitdiff
path: root/libavfilter/vf_colormatrix.c
diff options
context:
space:
mode:
authorClément Bœsch <u@pkh.me>2015-03-18 23:58:30 +0100
committerClément Bœsch <u@pkh.me>2015-03-19 00:03:29 +0100
commitd2009c77fb0018e602e6f0fe7a4a90c2de03c4f0 (patch)
tree0b18813395392e675bb972c46741072d88ea601e /libavfilter/vf_colormatrix.c
parentb1fbe29e51c4bda5419eb7b9239acf8055e7b0e8 (diff)
avfilter/vf_colormatrix: fix yuv420p threading, second try
Now seems to work fine with different combinations of odd/even heights and odd/even number of threads.
Diffstat (limited to 'libavfilter/vf_colormatrix.c')
-rw-r--r--libavfilter/vf_colormatrix.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/libavfilter/vf_colormatrix.c b/libavfilter/vf_colormatrix.c
index 78d1bad217..fde4b897fd 100644
--- a/libavfilter/vf_colormatrix.c
+++ b/libavfilter/vf_colormatrix.c
@@ -281,10 +281,10 @@ static int process_slice_yuv420p(AVFilterContext *ctx, void *arg, int jobnr, int
const ThreadData *td = arg;
const AVFrame *src = td->src;
AVFrame *dst = td->dst;
- const int height = src->height;
+ const int height = FFALIGN(src->height, 2) >> 1;
const int width = src->width;
- const int slice_start = (height * jobnr ) / nb_jobs;
- const int slice_end = (height * (jobnr+1)) / nb_jobs;
+ const int slice_start = ((height * jobnr ) / nb_jobs) << 1;
+ const int slice_end = ((height * (jobnr+1)) / nb_jobs) << 1;
const int src_pitchY = src->linesize[0];
const int src_pitchUV = src->linesize[1];
const int dst_pitchY = dst->linesize[0];
@@ -416,7 +416,7 @@ static int filter_frame(AVFilterLink *link, AVFrame *in)
FFMIN(in->height, ctx->graph->nb_threads));
else if (in->format == AV_PIX_FMT_YUV420P)
ctx->internal->execute(ctx, process_slice_yuv420p, &td, NULL,
- FFMAX(1, FFMIN(in->height, ctx->graph->nb_threads) & ~1));
+ FFMIN(in->height / 2, ctx->graph->nb_threads));
else
ctx->internal->execute(ctx, process_slice_uyvy422, &td, NULL,
FFMIN(in->height, ctx->graph->nb_threads));