[FFmpeg-devel] [PATCH v2 1/2] lavfi/opencl: add macro for opencl error handling.

Mark Thompson sw at jkqxz.net
Thu Jul 12 01:10:01 EEST 2018


On 03/07/18 19:16, Ruiling Song wrote:
> Signed-off-by: Ruiling Song <ruiling.song at intel.com>
> ---
>  libavfilter/opencl.h            | 11 +++++++++
>  libavfilter/vf_avgblur_opencl.c | 45 +++++++++--------------------------
>  libavfilter/vf_overlay_opencl.c | 29 +++++------------------
>  libavfilter/vf_program_opencl.c | 14 ++---------
>  libavfilter/vf_tonemap_opencl.c | 33 +++++---------------------
>  libavfilter/vf_unsharp_opencl.c | 52 +++++++++--------------------------------
>  6 files changed, 47 insertions(+), 137 deletions(-)
> 
> diff --git a/libavfilter/opencl.h b/libavfilter/opencl.h
> index 7441b11..0ed360b 100644
> --- a/libavfilter/opencl.h
> +++ b/libavfilter/opencl.h
> @@ -112,5 +112,16 @@ int ff_opencl_filter_work_size_from_image(AVFilterContext *avctx,
>                                            size_t *work_size,
>                                            AVFrame *frame, int plane,
>                                            int block_alignment);
> +/**
> + * A helper macro to handle OpenCL error. It will assign errcode to
> + * variable err, log error msg, and jump to fail label on error.
> + */
> +#define CL_FAIL_ON_ERROR(errcode, ...) do {\
> +    if (cle != CL_SUCCESS) {\
> +        av_log(avctx, AV_LOG_ERROR, __VA_ARGS__);\
> +        err = errcode;\
> +        goto fail;\
> +    }\
> +} while(0)

I moved this up in the file to be next to the similar macro and match the formatting.

All looks good, so applied with that change.

Thanks,

- Mark


More information about the ffmpeg-devel mailing list