summaryrefslogtreecommitdiff
path: root/libavfilter
diff options
context:
space:
mode:
authorPaul B Mahol <onemda@gmail.com>2018-05-14 16:02:00 +0200
committerPaul B Mahol <onemda@gmail.com>2018-05-14 16:04:33 +0200
commit80b474875e72897b3f7eb2f0edbeaa4b2087da61 (patch)
treeac0b86e5ebe514ff76b4856bc6640b05d81f6bb7 /libavfilter
parente3a697eda3b7c3e786a8e7dba9d4627c922f9aad (diff)
avfilter/vf_srcnn: use function to get number of threads
Signed-off-by: Paul B Mahol <onemda@gmail.com>
Diffstat (limited to 'libavfilter')
-rw-r--r--libavfilter/vf_srcnn.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/libavfilter/vf_srcnn.c b/libavfilter/vf_srcnn.c
index edffebb278..db1c40cf1e 100644
--- a/libavfilter/vf_srcnn.c
+++ b/libavfilter/vf_srcnn.c
@@ -337,6 +337,7 @@ static int filter_frame(AVFilterLink* inlink, AVFrame* in)
AVFrame* out = ff_get_video_buffer(outlink, outlink->w, outlink->h);
ThreadData td;
ConvThreadData ctd;
+ int nb_threads;
if (!out){
av_log(context, AV_LOG_ERROR, "could not allocate memory for output frame\n");
@@ -351,20 +352,21 @@ static int filter_frame(AVFilterLink* inlink, AVFrame* in)
td.height = ctd.height = out->height;
td.width = ctd.width = out->width;
- context->internal->execute(context, uint8_to_double, &td, NULL, FFMIN(td.height, context->graph->nb_threads));
+ nb_threads = ff_filter_get_nb_threads(context);
+ context->internal->execute(context, uint8_to_double, &td, NULL, FFMIN(td.height, nb_threads));
ctd.conv = &srcnn_context->conv1;
ctd.input = srcnn_context->input_output_buf;
ctd.output = srcnn_context->conv1_buf;
- context->internal->execute(context, convolve, &ctd, NULL, FFMIN(ctd.height, context->graph->nb_threads));
+ context->internal->execute(context, convolve, &ctd, NULL, FFMIN(ctd.height, nb_threads));
ctd.conv = &srcnn_context->conv2;
ctd.input = srcnn_context->conv1_buf;
ctd.output = srcnn_context->conv2_buf;
- context->internal->execute(context, convolve, &ctd, NULL, FFMIN(ctd.height, context->graph->nb_threads));
+ context->internal->execute(context, convolve, &ctd, NULL, FFMIN(ctd.height, nb_threads));
ctd.conv = &srcnn_context->conv3;
ctd.input = srcnn_context->conv2_buf;
ctd.output = srcnn_context->input_output_buf;
- context->internal->execute(context, convolve, &ctd, NULL, FFMIN(ctd.height, context->graph->nb_threads));
- context->internal->execute(context, double_to_uint8, &td, NULL, FFMIN(td.height, context->graph->nb_threads));
+ context->internal->execute(context, convolve, &ctd, NULL, FFMIN(ctd.height, nb_threads));
+ context->internal->execute(context, double_to_uint8, &td, NULL, FFMIN(td.height, nb_threads));
return ff_filter_frame(outlink, out);
}