... | ... |
@@ -357,7 +357,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *buf) |
357 | 357 |
ctx->internal->execute(ctx, s->filter_slice, &td, NULL, |
358 | 358 |
FFMIN3(s->planeheight[1], |
359 | 359 |
s->planeheight[2], |
360 |
- ctx->graph->nb_threads)); |
|
360 |
+ ff_filter_get_nb_threads(ctx))); |
|
361 | 361 |
av_frame_copy_props(out, in); |
362 | 362 |
} else { |
363 | 363 |
out = av_frame_clone(in); |
... | ... |
@@ -393,7 +393,7 @@ static AVFrame *blend_frame(AVFilterContext *ctx, AVFrame *top_buf, |
393 | 393 |
.w = outw, .h = outh, .param = param, .plane = plane, |
394 | 394 |
.inlink = inlink }; |
395 | 395 |
|
396 |
- ctx->internal->execute(ctx, filter_slice, &td, NULL, FFMIN(outh, ctx->graph->nb_threads)); |
|
396 |
+ ctx->internal->execute(ctx, filter_slice, &td, NULL, FFMIN(outh, ff_filter_get_nb_threads(ctx))); |
|
397 | 397 |
} |
398 | 398 |
|
399 | 399 |
if (!s->tblend) |
... | ... |
@@ -278,7 +278,7 @@ static void filter(AVFilterContext *ctx, AVFrame *dstpic, |
278 | 278 |
td.h = h; |
279 | 279 |
td.plane = i; |
280 | 280 |
|
281 |
- ctx->internal->execute(ctx, filter_slice, &td, NULL, FFMIN(h, ctx->graph->nb_threads)); |
|
281 |
+ ctx->internal->execute(ctx, filter_slice, &td, NULL, FFMIN(h, ff_filter_get_nb_threads(ctx))); |
|
282 | 282 |
} |
283 | 283 |
if (!bwdif->inter_field) { |
284 | 284 |
bwdif->inter_field = 1; |
... | ... |
@@ -108,7 +108,7 @@ static int filter_frame(AVFilterLink *link, AVFrame *frame) |
108 | 108 |
AVFilterContext *avctx = link->dst; |
109 | 109 |
int res; |
110 | 110 |
|
111 |
- if (res = avctx->internal->execute(avctx, do_chromakey_slice, frame, NULL, FFMIN(frame->height, avctx->graph->nb_threads))) |
|
111 |
+ if (res = avctx->internal->execute(avctx, do_chromakey_slice, frame, NULL, FFMIN(frame->height, ff_filter_get_nb_threads(avctx)))) |
|
112 | 112 |
return res; |
113 | 113 |
|
114 | 114 |
return ff_filter_frame(avctx->outputs[0], frame); |
... | ... |
@@ -85,7 +85,7 @@ static int filter_frame(AVFilterLink *link, AVFrame *frame) |
85 | 85 |
if (res = av_frame_make_writable(frame)) |
86 | 86 |
return res; |
87 | 87 |
|
88 |
- if (res = avctx->internal->execute(avctx, do_colorkey_slice, frame, NULL, FFMIN(frame->height, avctx->graph->nb_threads))) |
|
88 |
+ if (res = avctx->internal->execute(avctx, do_colorkey_slice, frame, NULL, FFMIN(frame->height, ff_filter_get_nb_threads(avctx)))) |
|
89 | 89 |
return res; |
90 | 90 |
|
91 | 91 |
return ff_filter_frame(avctx->outputs[0], frame); |
... | ... |
@@ -474,16 +474,16 @@ static int filter_frame(AVFilterLink *link, AVFrame *in) |
474 | 474 |
|
475 | 475 |
if (in->format == AV_PIX_FMT_YUV444P) |
476 | 476 |
ctx->internal->execute(ctx, process_slice_yuv444p, &td, NULL, |
477 |
- FFMIN(in->height, ctx->graph->nb_threads)); |
|
477 |
+ FFMIN(in->height, ff_filter_get_nb_threads(ctx))); |
|
478 | 478 |
else if (in->format == AV_PIX_FMT_YUV422P) |
479 | 479 |
ctx->internal->execute(ctx, process_slice_yuv422p, &td, NULL, |
480 |
- FFMIN(in->height, ctx->graph->nb_threads)); |
|
480 |
+ FFMIN(in->height, ff_filter_get_nb_threads(ctx))); |
|
481 | 481 |
else if (in->format == AV_PIX_FMT_YUV420P) |
482 | 482 |
ctx->internal->execute(ctx, process_slice_yuv420p, &td, NULL, |
483 |
- FFMIN(in->height / 2, ctx->graph->nb_threads)); |
|
483 |
+ FFMIN(in->height / 2, ff_filter_get_nb_threads(ctx))); |
|
484 | 484 |
else |
485 | 485 |
ctx->internal->execute(ctx, process_slice_uyvy422, &td, NULL, |
486 |
- FFMIN(in->height, ctx->graph->nb_threads)); |
|
486 |
+ FFMIN(in->height, ff_filter_get_nb_threads(ctx))); |
|
487 | 487 |
|
488 | 488 |
av_frame_free(&in); |
489 | 489 |
return ff_filter_frame(outlink, out); |
... | ... |
@@ -947,7 +947,7 @@ static int filter_frame(AVFilterLink *link, AVFrame *in) |
947 | 947 |
return res; |
948 | 948 |
} else { |
949 | 949 |
ctx->internal->execute(ctx, convert, &td, NULL, |
950 |
- FFMIN((in->height + 1) >> 1, ctx->graph->nb_threads)); |
|
950 |
+ FFMIN((in->height + 1) >> 1, ff_filter_get_nb_threads(ctx))); |
|
951 | 951 |
} |
952 | 952 |
av_frame_free(&in); |
953 | 953 |
|
... | ... |
@@ -647,7 +647,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) |
647 | 647 |
|
648 | 648 |
td.in = in; |
649 | 649 |
td.out = out; |
650 |
- ctx->internal->execute(ctx, filter_slice, &td, NULL, FFMIN(outlink->h, ctx->graph->nb_threads)); |
|
650 |
+ ctx->internal->execute(ctx, filter_slice, &td, NULL, FFMIN(outlink->h, ff_filter_get_nb_threads(ctx))); |
|
651 | 651 |
|
652 | 652 |
if (out != in) |
653 | 653 |
av_frame_free(&in); |
... | ... |
@@ -328,7 +328,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) |
328 | 328 |
} |
329 | 329 |
|
330 | 330 |
td.in = in; td.out = out, td.yoff = xmaxlen, td.xoff = ymaxlen; |
331 |
- ctx->internal->execute(ctx, s->filter, &td, NULL, FFMIN(ctx->graph->nb_threads, FFMAX(outlink->w / 20, 1))); |
|
331 |
+ ctx->internal->execute(ctx, s->filter, &td, NULL, FFMIN(ff_filter_get_nb_threads(ctx), FFMAX(outlink->w / 20, 1))); |
|
332 | 332 |
|
333 | 333 |
av_frame_free(&in); |
334 | 334 |
return ff_filter_frame(outlink, out); |
... | ... |
@@ -507,9 +507,9 @@ static int config_input(AVFilterLink *inlink) |
507 | 507 |
inlink->h - s->pr_height); |
508 | 508 |
|
509 | 509 |
max_slice_h = s->pr_height / ((s->bsize - 1) * 2); |
510 |
- s->nb_threads = FFMIN3(MAX_THREADS, ctx->graph->nb_threads, max_slice_h); |
|
510 |
+ s->nb_threads = FFMIN3(MAX_THREADS, ff_filter_get_nb_threads(ctx), max_slice_h); |
|
511 | 511 |
av_log(ctx, AV_LOG_DEBUG, "threads: [max=%d hmax=%d user=%d] => %d\n", |
512 |
- MAX_THREADS, max_slice_h, ctx->graph->nb_threads, s->nb_threads); |
|
512 |
+ MAX_THREADS, max_slice_h, ff_filter_get_nb_threads(ctx), s->nb_threads); |
|
513 | 513 |
|
514 | 514 |
s->p_linesize = linesize = FFALIGN(s->pr_width, 32); |
515 | 515 |
for (i = 0; i < 2; i++) { |
... | ... |
@@ -267,7 +267,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) |
267 | 267 |
td.in = in; td.out = out; |
268 | 268 |
ctx->internal->execute(ctx, s->deband, &td, NULL, FFMIN3(s->planeheight[1], |
269 | 269 |
s->planeheight[2], |
270 |
- ctx->graph->nb_threads)); |
|
270 |
+ ff_filter_get_nb_threads(ctx))); |
|
271 | 271 |
|
272 | 272 |
av_frame_free(&in); |
273 | 273 |
return ff_filter_frame(outlink, out); |
... | ... |
@@ -347,19 +347,19 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame) |
347 | 347 |
if (s->factor < UINT16_MAX) { |
348 | 348 |
if (s->alpha) { |
349 | 349 |
ctx->internal->execute(ctx, filter_slice_alpha, frame, NULL, |
350 |
- FFMIN(frame->height, ctx->graph->nb_threads)); |
|
350 |
+ FFMIN(frame->height, ff_filter_get_nb_threads(ctx))); |
|
351 | 351 |
} else if (s->is_packed_rgb && !s->black_fade) { |
352 | 352 |
ctx->internal->execute(ctx, filter_slice_rgb, frame, NULL, |
353 |
- FFMIN(frame->height, ctx->graph->nb_threads)); |
|
353 |
+ FFMIN(frame->height, ff_filter_get_nb_threads(ctx))); |
|
354 | 354 |
} else { |
355 | 355 |
/* luma, or rgb plane in case of black */ |
356 | 356 |
ctx->internal->execute(ctx, filter_slice_luma, frame, NULL, |
357 |
- FFMIN(frame->height, ctx->graph->nb_threads)); |
|
357 |
+ FFMIN(frame->height, ff_filter_get_nb_threads(ctx))); |
|
358 | 358 |
|
359 | 359 |
if (frame->data[1] && frame->data[2]) { |
360 | 360 |
/* chroma planes */ |
361 | 361 |
ctx->internal->execute(ctx, filter_slice_chroma, frame, NULL, |
362 |
- FFMIN(frame->height, ctx->graph->nb_threads)); |
|
362 |
+ FFMIN(frame->height, ff_filter_get_nb_threads(ctx))); |
|
363 | 363 |
} |
364 | 364 |
} |
365 | 365 |
} |
... | ... |
@@ -174,7 +174,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) |
174 | 174 |
memcpy(out->data[1], in->data[1], AVPALETTE_SIZE); |
175 | 175 |
|
176 | 176 |
td.in = in, td.out = out; |
177 |
- ctx->internal->execute(ctx, filter_slice, &td, NULL, FFMIN(outlink->h, ctx->graph->nb_threads)); |
|
177 |
+ ctx->internal->execute(ctx, filter_slice, &td, NULL, FFMIN(outlink->h, ff_filter_get_nb_threads(ctx))); |
|
178 | 178 |
|
179 | 179 |
av_frame_free(&in); |
180 | 180 |
return ff_filter_frame(outlink, out); |
... | ... |
@@ -502,7 +502,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) |
502 | 502 |
td.in = in; |
503 | 503 |
td.out = out; |
504 | 504 |
td.rgbtoyuv = hqx->rgbtoyuv; |
505 |
- ctx->internal->execute(ctx, hqx->func, &td, NULL, FFMIN(inlink->h, ctx->graph->nb_threads)); |
|
505 |
+ ctx->internal->execute(ctx, hqx->func, &td, NULL, FFMIN(inlink->h, ff_filter_get_nb_threads(ctx))); |
|
506 | 506 |
|
507 | 507 |
av_frame_free(&in); |
508 | 508 |
return ff_filter_frame(outlink, out); |
... | ... |
@@ -193,7 +193,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) |
193 | 193 |
} |
194 | 194 |
|
195 | 195 |
td.correction = rect->correction[plane]; |
196 |
- ctx->internal->execute(ctx, filter_slice, &td, NULL, FFMIN(h, ctx->graph->nb_threads)); |
|
196 |
+ ctx->internal->execute(ctx, filter_slice, &td, NULL, FFMIN(h, ff_filter_get_nb_threads(ctx))); |
|
197 | 197 |
} |
198 | 198 |
|
199 | 199 |
av_frame_free(&in); |
... | ... |
@@ -531,7 +531,7 @@ static AVFrame *apply_lut(AVFilterLink *inlink, AVFrame *in) |
531 | 531 |
|
532 | 532 |
td.in = in; |
533 | 533 |
td.out = out; |
534 |
- ctx->internal->execute(ctx, lut3d->interp, &td, NULL, FFMIN(outlink->h, ctx->graph->nb_threads)); |
|
534 |
+ ctx->internal->execute(ctx, lut3d->interp, &td, NULL, FFMIN(outlink->h, ff_filter_get_nb_threads(ctx))); |
|
535 | 535 |
|
536 | 536 |
if (out != in) |
537 | 537 |
av_frame_free(&in); |
... | ... |
@@ -272,7 +272,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *inpicref) |
272 | 272 |
} |
273 | 273 |
|
274 | 274 |
td.in = inpicref; td.out = out; |
275 |
- ctx->internal->execute(ctx, filter_slice, &td, NULL, FFMIN(n->height[0], ctx->graph->nb_threads)); |
|
275 |
+ ctx->internal->execute(ctx, filter_slice, &td, NULL, FFMIN(n->height[0], ff_filter_get_nb_threads(ctx))); |
|
276 | 276 |
emms_c(); |
277 | 277 |
|
278 | 278 |
if (inpicref != out) |
... | ... |
@@ -478,7 +478,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame) |
478 | 478 |
.h = s->height[plane], |
479 | 479 |
.hsub = hsub, |
480 | 480 |
.vsub = vsub }; |
481 |
- ctx->internal->execute(ctx, s->perspective, &td, NULL, FFMIN(td.h, ctx->graph->nb_threads)); |
|
481 |
+ ctx->internal->execute(ctx, s->perspective, &td, NULL, FFMIN(td.h, ff_filter_get_nb_threads(ctx))); |
|
482 | 482 |
} |
483 | 483 |
|
484 | 484 |
av_frame_free(&frame); |
... | ... |
@@ -619,7 +619,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) |
619 | 619 |
|
620 | 620 |
td.in = in; td.out = out; td.plane = i; |
621 | 621 |
ctx->internal->execute(ctx, filter_slice, &td, NULL, |
622 |
- FFMIN(s->planeheight[i], ctx->graph->nb_threads)); |
|
622 |
+ FFMIN(s->planeheight[i], ff_filter_get_nb_threads(ctx))); |
|
623 | 623 |
|
624 | 624 |
src = in->data[i] + (s->planeheight[i] - 1) * in->linesize[i]; |
625 | 625 |
dst = out->data[i] + (s->planeheight[i] - 1) * out->linesize[i]; |
... | ... |
@@ -553,7 +553,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) |
553 | 553 |
.plane = plane, .c = c, .s = s }; |
554 | 554 |
|
555 | 555 |
|
556 |
- ctx->internal->execute(ctx, filter_slice, &td, NULL, FFMIN(outh, ctx->graph->nb_threads)); |
|
556 |
+ ctx->internal->execute(ctx, filter_slice, &td, NULL, FFMIN(outh, ff_filter_get_nb_threads(ctx))); |
|
557 | 557 |
} |
558 | 558 |
|
559 | 559 |
av_frame_free(&in); |
... | ... |
@@ -471,7 +471,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) |
471 | 471 |
td.in = in; |
472 | 472 |
td.out = out; |
473 | 473 |
ctx->internal->execute(ctx, funcs[s->is_16bit][direct][s->correction_method], |
474 |
- &td, NULL, FFMIN(inlink->h, ctx->graph->nb_threads)); |
|
474 |
+ &td, NULL, FFMIN(inlink->h, ff_filter_get_nb_threads(ctx))); |
|
475 | 475 |
|
476 | 476 |
if (!direct) |
477 | 477 |
av_frame_free(&in); |
... | ... |
@@ -185,7 +185,7 @@ static int config_props(AVFilterLink *outlink) |
185 | 185 |
s->fs = inlink->w * inlink->h; |
186 | 186 |
s->cfs = s->chromaw * s->chromah; |
187 | 187 |
|
188 |
- s->nb_jobs = FFMAX(1, FFMIN(inlink->h, ctx->graph->nb_threads)); |
|
188 |
+ s->nb_jobs = FFMAX(1, FFMIN(inlink->h, ff_filter_get_nb_threads(ctx))); |
|
189 | 189 |
s->jobs_rets = av_malloc_array(s->nb_jobs, sizeof(*s->jobs_rets)); |
190 | 190 |
if (!s->jobs_rets) |
191 | 191 |
return AVERROR(ENOMEM); |
... | ... |
@@ -602,7 +602,7 @@ static int filter_frame8(AVFilterLink *link, AVFrame *in) |
602 | 602 |
} |
603 | 603 |
|
604 | 604 |
ctx->internal->execute(ctx, compute_sat_hue_metrics8, &td_huesat, |
605 |
- NULL, FFMIN(s->chromah, ctx->graph->nb_threads)); |
|
605 |
+ NULL, FFMIN(s->chromah, ff_filter_get_nb_threads(ctx))); |
|
606 | 606 |
|
607 | 607 |
// Calculate luma histogram and difference with previous frame or field. |
608 | 608 |
for (j = 0; j < link->h; j++) { |
... | ... |
@@ -820,7 +820,7 @@ static int filter_frame16(AVFilterLink *link, AVFrame *in) |
820 | 820 |
} |
821 | 821 |
|
822 | 822 |
ctx->internal->execute(ctx, compute_sat_hue_metrics16, &td_huesat, |
823 |
- NULL, FFMIN(s->chromah, ctx->graph->nb_threads)); |
|
823 |
+ NULL, FFMIN(s->chromah, ff_filter_get_nb_threads(ctx))); |
|
824 | 824 |
|
825 | 825 |
// Calculate luma histogram and difference with previous frame or field. |
826 | 826 |
memset(s->histy, 0, (1 << s->depth) * sizeof(*s->histy)); |
... | ... |
@@ -935,7 +935,7 @@ copy: |
935 | 935 |
|
936 | 936 |
td.ileft = ileft; td.iright = iright; td.out = out; |
937 | 937 |
ctx->internal->execute(ctx, filter_slice, &td, NULL, |
938 |
- FFMIN(s->out.height, ctx->graph->nb_threads)); |
|
938 |
+ FFMIN(s->out.height, ff_filter_get_nb_threads(ctx))); |
|
939 | 939 |
} |
940 | 940 |
break; |
941 | 941 |
} |
... | ... |
@@ -250,7 +250,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) |
250 | 250 |
} |
251 | 251 |
|
252 | 252 |
td.in = in, td.out = out; |
253 |
- ctx->internal->execute(ctx, filter_slice, &td, NULL, FFMIN(outlink->h, ctx->graph->nb_threads)); |
|
253 |
+ ctx->internal->execute(ctx, filter_slice, &td, NULL, FFMIN(outlink->h, ff_filter_get_nb_threads(ctx))); |
|
254 | 254 |
av_frame_free(&in); |
255 | 255 |
return ff_filter_frame(outlink, out); |
256 | 256 |
} |
... | ... |
@@ -170,7 +170,7 @@ static int config_input(AVFilterLink *inlink) |
170 | 170 |
s->planeheight[0] = s->planeheight[3] = inlink->h; |
171 | 171 |
|
172 | 172 |
s->nb_planes = av_pix_fmt_count_planes(inlink->format); |
173 |
- s->nb_threads = ctx->graph->nb_threads; |
|
173 |
+ s->nb_threads = ff_filter_get_nb_threads(ctx); |
|
174 | 174 |
s->work_line = av_calloc(s->nb_threads, sizeof(*s->work_line)); |
175 | 175 |
if (!s->work_line) |
176 | 176 |
return AVERROR(ENOMEM); |
... | ... |
@@ -367,7 +367,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) |
367 | 367 |
td.in = in; |
368 | 368 |
td.out = out; |
369 | 369 |
td.rgbtoyuv = s->rgbtoyuv; |
370 |
- ctx->internal->execute(ctx, s->func, &td, NULL, FFMIN(inlink->h, ctx->graph->nb_threads)); |
|
370 |
+ ctx->internal->execute(ctx, s->func, &td, NULL, FFMIN(inlink->h, ff_filter_get_nb_threads(ctx))); |
|
371 | 371 |
|
372 | 372 |
out->width = outlink->w; |
373 | 373 |
out->height = outlink->h; |
... | ... |
@@ -242,7 +242,7 @@ static void filter(AVFilterContext *ctx, AVFrame *dstpic, |
242 | 242 |
td.h = h; |
243 | 243 |
td.plane = i; |
244 | 244 |
|
245 |
- ctx->internal->execute(ctx, filter_slice, &td, NULL, FFMIN(h, ctx->graph->nb_threads)); |
|
245 |
+ ctx->internal->execute(ctx, filter_slice, &td, NULL, FFMIN(h, ff_filter_get_nb_threads(ctx))); |
|
246 | 246 |
} |
247 | 247 |
|
248 | 248 |
emms_c(); |