ctx->command_queue = clCreateCommandQueue(ctx->ocf.hwctx->context,
ctx->ocf.hwctx->device_id,
0, &cle);
- if (!ctx->command_queue) {
- av_log(avctx, AV_LOG_ERROR, "Failed to create OpenCL "
- "command queue: %d.\n", cle);
- err = AVERROR(EIO);
- goto fail;
- }
+ CL_FAIL_ON_ERROR(AVERROR(EIO), "Failed to create OpenCL "
+ "command queue %d.\n", cle);
ctx->kernel_horiz = clCreateKernel(ctx->ocf.program,"avgblur_horiz", &cle);
- if (!ctx->kernel_horiz) {
- av_log(avctx, AV_LOG_ERROR, "Failed to create kernel: %d.\n", cle);
- err = AVERROR(EIO);
- goto fail;
- }
+ CL_FAIL_ON_ERROR(AVERROR(EIO), "Failed to create horizontal "
+ "kernel %d.\n", cle);
ctx->kernel_vert = clCreateKernel(ctx->ocf.program,"avgblur_vert", &cle);
- if (!ctx->kernel_vert) {
- av_log(avctx, AV_LOG_ERROR, "Failed to create kernel: %d.\n", cle);
- err = AVERROR(EIO);
- goto fail;
- }
+ CL_FAIL_ON_ERROR(AVERROR(EIO), "Failed to create vertical "
+ "kernel %d.\n", cle);
ctx->initialised = 1;
return 0;
radius_y = 0;
}
- av_log(avctx, AV_LOG_DEBUG, "Run kernel on plane %d "
- "(%"SIZE_SPECIFIER"x%"SIZE_SPECIFIER").\n",
- p, global_work[0], global_work[1]);
-
for (i = 0; i < ctx->power[p]; i++) {
CL_SET_KERNEL_ARG(ctx->kernel_horiz, 0, cl_mem, &inter);
CL_SET_KERNEL_ARG(ctx->kernel_horiz, 1, cl_mem, i == 0 ? &src : &dst);
if (err < 0)
goto fail;
+ av_log(avctx, AV_LOG_DEBUG, "Run kernel on plane %d "
+ "(%"SIZE_SPECIFIER"x%"SIZE_SPECIFIER").\n",
+ p, global_work[0], global_work[1]);
+
cle = clEnqueueNDRangeKernel(ctx->command_queue, ctx->kernel_horiz, 2, NULL,
global_work, NULL,
0, NULL, NULL);
- if (cle != CL_SUCCESS) {
- av_log(avctx, AV_LOG_ERROR, "Failed to enqueue kernel: %d.\n",
- cle);
- err = AVERROR(EIO);
- goto fail;
- }
- cle = clFinish(ctx->command_queue);
+ CL_FAIL_ON_ERROR(AVERROR(EIO), "Failed to enqueue horizontal "
+ "kernel: %d.\n", cle);
err = ff_opencl_filter_work_size_from_image(avctx, global_work,
i == 0 ? output : intermediate, p, 0);
cle = clEnqueueNDRangeKernel(ctx->command_queue, ctx->kernel_vert, 2, NULL,
global_work, NULL,
0, NULL, NULL);
- if (cle != CL_SUCCESS) {
- av_log(avctx, AV_LOG_ERROR, "Failed to enqueue kernel: %d.\n",
- cle);
- err = AVERROR(EIO);
- goto fail;
- }
+ CL_FAIL_ON_ERROR(AVERROR(EIO), "Failed to enqueue vertical "
+ "kernel: %d.\n", cle);
}
}
cle = clFinish(ctx->command_queue);
- if (cle != CL_SUCCESS) {
- av_log(avctx, AV_LOG_ERROR, "Failed to finish command queue: %d.\n",
- cle);
- err = AVERROR(EIO);
- goto fail;
- }
+ CL_FAIL_ON_ERROR(AVERROR(EIO), "Failed to finish command queue: %d.\n", cle);
err = av_frame_copy_props(output, input);
if (err < 0)
AVFILTER_DEFINE_CLASS(avgblur_opencl);
-AVFilter ff_vf_avgblur_opencl = {
+const AVFilter ff_vf_avgblur_opencl = {
.name = "avgblur_opencl",
.description = NULL_IF_CONFIG_SMALL("Apply average blur filter"),
.priv_size = sizeof(AverageBlurOpenCLContext),
AVFILTER_DEFINE_CLASS(boxblur_opencl);
-AVFilter ff_vf_boxblur_opencl = {
+const AVFilter ff_vf_boxblur_opencl = {
.name = "boxblur_opencl",
.description = NULL_IF_CONFIG_SMALL("Apply boxblur filter to input video"),
.priv_size = sizeof(AverageBlurOpenCLContext),