]> git.sesse.net Git - ffmpeg/commitdiff
vf_avgblur_opencl: Don't run kernel on pixels outside the image
authorMark Thompson <sw@jkqxz.net>
Sat, 24 Mar 2018 13:56:16 +0000 (13:56 +0000)
committerMark Thompson <sw@jkqxz.net>
Mon, 26 Mar 2018 21:28:24 +0000 (22:28 +0100)
The output frame size is larger than the image containing a subsampled
plane - use the actual size of the image being written rather than the
dimensions of the intended output frame.

Reviewed-by: Dylan Fernando <dylanf123@gmail.com>
libavfilter/vf_avgblur_opencl.c

index 5ee66c0ba21a1bd6560c3cf93749cc26f21e6a53..3a5b4a28ca5215db42875b8ccaf1ea4441d64f9e 100644 (file)
@@ -170,8 +170,10 @@ static int avgblur_opencl_filter_frame(AVFilterLink *inlink, AVFrame *input)
             goto fail;
         }
 
-        global_work[0] = output->width;
-        global_work[1] = output->height;
+        err = ff_opencl_filter_work_size_from_image(avctx, global_work,
+                                                    intermediate, p, 0);
+        if (err < 0)
+            goto fail;
 
         av_log(avctx, AV_LOG_DEBUG, "Run kernel on plane %d "
                "(%"SIZE_SPECIFIER"x%"SIZE_SPECIFIER").\n",
@@ -206,8 +208,10 @@ static int avgblur_opencl_filter_frame(AVFilterLink *inlink, AVFrame *input)
             goto fail;
         }
 
-        global_work[0] = output->width;
-        global_work[1] = output->height;
+        err = ff_opencl_filter_work_size_from_image(avctx, global_work,
+                                                    output, p, 0);
+        if (err < 0)
+            goto fail;
 
         av_log(avctx, AV_LOG_DEBUG, "Run kernel on plane %d "
                "(%"SIZE_SPECIFIER"x%"SIZE_SPECIFIER").\n",