summaryrefslogtreecommitdiff
path: root/libavfilter/vf_unsharp_opencl.c
diff options
context:
space:
mode:
authorMark Thompson <sw@jkqxz.net>2018-03-19 22:52:30 +0000
committerMark Thompson <sw@jkqxz.net>2018-03-22 23:12:47 +0000
commit2a1542d105dc3161516e34eef77bcd64aa72cab4 (patch)
tree2f32963bfb6d8a00b9136b8a4f169922840a905e /libavfilter/vf_unsharp_opencl.c
parentb78d55b2e63e410abe744932fda9358633743a9e (diff)
downloadffmpeg-2a1542d105dc3161516e34eef77bcd64aa72cab4.tar.gz
lavfi/opencl: Derive global work size from plane image sizes
Add a new function to find the global work size given the output image and the required block alignment, then use it in the overlay, program and unsharp filters. Fixes the overlay and unsharp filters applying the kernel to locations outside the frame when subsampled planes are present.
Diffstat (limited to 'libavfilter/vf_unsharp_opencl.c')
-rw-r--r--libavfilter/vf_unsharp_opencl.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/libavfilter/vf_unsharp_opencl.c b/libavfilter/vf_unsharp_opencl.c
index 6a453c014b..19c91857cb 100644
--- a/libavfilter/vf_unsharp_opencl.c
+++ b/libavfilter/vf_unsharp_opencl.c
@@ -320,15 +320,13 @@ static int unsharp_opencl_filter_frame(AVFilterLink *inlink, AVFrame *input)
}
}
- if (ctx->global) {
- global_work[0] = output->width;
- global_work[1] = output->height;
- } else {
- global_work[0] = FFALIGN(output->width, 16);
- global_work[1] = FFALIGN(output->height, 16);
- local_work[0] = 16;
- local_work[1] = 16;
- }
+ err = ff_opencl_filter_work_size_from_image(avctx, global_work, output, p,
+ ctx->global ? 0 : 16);
+ if (err < 0)
+ goto fail;
+
+ local_work[0] = 16;
+ local_work[1] = 16;
av_log(avctx, AV_LOG_DEBUG, "Run kernel on plane %d "
"(%"SIZE_SPECIFIER"x%"SIZE_SPECIFIER").\n",