cmdutils: print missing caps in print_codec().
[ffmpeg.git] / libavfilter / vf_program_opencl.c
index d49365a..a002792 100644 (file)
  */
 
 #include "libavutil/avstring.h"
-#include "libavutil/buffer.h"
-#include "libavutil/common.h"
-#include "libavutil/hwcontext.h"
-#include "libavutil/hwcontext_opencl.h"
 #include "libavutil/log.h"
 #include "libavutil/mem.h"
-#include "libavutil/pixdesc.h"
 #include "libavutil/opt.h"
+#include "libavutil/pixdesc.h"
 
 #include "avfilter.h"
 #include "framesync.h"
@@ -116,12 +112,14 @@ static int program_opencl_run(AVFilterContext *avctx)
         if (cle != CL_SUCCESS) {
             av_log(avctx, AV_LOG_ERROR, "Failed to set kernel "
                    "destination image argument: %d.\n", cle);
+            err = AVERROR_UNKNOWN;
             goto fail;
         }
         cle = clSetKernelArg(ctx->kernel, 1, sizeof(cl_uint), &ctx->index);
         if (cle != CL_SUCCESS) {
             av_log(avctx, AV_LOG_ERROR, "Failed to set kernel "
                    "index argument: %d.\n", cle);
+            err = AVERROR_UNKNOWN;
             goto fail;
         }
 
@@ -135,14 +133,15 @@ static int program_opencl_run(AVFilterContext *avctx)
             if (cle != CL_SUCCESS) {
                 av_log(avctx, AV_LOG_ERROR, "Failed to set kernel "
                        "source image argument %d: %d.\n", input, cle);
+                err = AVERROR_UNKNOWN;
                 goto fail;
             }
         }
 
-        cle = clGetImageInfo(dst, CL_IMAGE_WIDTH,  sizeof(size_t),
-                             &global_work[0], NULL);
-        cle = clGetImageInfo(dst, CL_IMAGE_HEIGHT, sizeof(size_t),
-                             &global_work[1], NULL);
+        err = ff_opencl_filter_work_size_from_image(avctx, global_work,
+                                                    output, plane, 0);
+        if (err < 0)
+            goto fail;
 
         av_log(avctx, AV_LOG_DEBUG, "Run kernel on plane %d "
                "(%zux%zu).\n", plane, global_work[0], global_work[1]);