Re: [FFmpeg-devel] [PATCH] avutil/opencl_internal: add av_warn_unused_result
From: Ganesh Ajjanagadde Date: 2015-10-29 10:53 To: FFmpeg development discussions and patches CC: Ganesh Ajjanagadde Subject: Re: [FFmpeg-devel] [PATCH] avutil/opencl_internal: add av_warn_unused_result On Thu, Oct 15, 2015 at 6:24 PM, Ganesh Ajjanagadde wrote: > Signed-off-by: Ganesh Ajjanagadde > --- > libavutil/opencl_internal.h | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/libavutil/opencl_internal.h b/libavutil/opencl_internal.h > index dacd930..a4f5885 100644 > --- a/libavutil/opencl_internal.h > +++ b/libavutil/opencl_internal.h > @@ -30,4 +30,5 @@ typedef struct { > void *ctx; > } FFOpenclParam; > > +av_warn_unused_result > int avpriv_opencl_set_parameter(FFOpenclParam *opencl_param, ...); > -- > 2.6.1 > ping Hi Looks good to me. Thanks Best regards ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avutil/opencl: add av_warn_unused_result
From: Ganesh Ajjanagadde Date: 2015-10-16 08:08 To: ffmpeg-devel CC: Ganesh Ajjanagadde Subject: [FFmpeg-devel] [PATCH] avutil/opencl: add av_warn_unused_result This will trigger a few warnings. My config does not compile the opencl code, so this is untested. Signed-off-by: Ganesh Ajjanagadde --- libavutil/opencl.h | 10 ++ 1 file changed, 10 insertions(+) diff --git a/libavutil/opencl.h b/libavutil/opencl.h index e423e55..6a5b0ab 100644 --- a/libavutil/opencl.h +++ b/libavutil/opencl.h @@ -81,6 +81,7 @@ typedef struct { * * @return >=0 on success, a negative error code in case of failure */ +av_warn_unused_result int av_opencl_get_device_list(AVOpenCLDeviceList **device_list); /** @@ -108,6 +109,7 @@ void av_opencl_free_device_list(AVOpenCLDeviceList **device_list); * @return >=0 on success, a negative error code in case of failure * @see av_opencl_get_option() */ +av_warn_unused_result int av_opencl_set_option(const char *key, const char *val); /** @@ -119,6 +121,7 @@ int av_opencl_set_option(const char *key, const char *val); * @return >=0 on success, a negative error code in case of failure * @see av_opencl_set_option() */ +av_warn_unused_result int av_opencl_get_option(const char *key, uint8_t **out_val); /** @@ -161,6 +164,7 @@ const char *av_opencl_errstr(cl_int status); * @param kernel_codekernel code to be compiled in the OpenCL runtime environment * @return >=0 on success, a negative error code in case of failure */ +av_warn_unused_result int av_opencl_register_kernel_code(const char *kernel_code); /** @@ -170,6 +174,7 @@ int av_opencl_register_kernel_code(const char *kernel_code); * application program, ignored if set to NULL * @return >=0 on success, a negative error code in case of failure */ +av_warn_unused_result int av_opencl_init(AVOpenCLExternalEnv *ext_opencl_env); /** @@ -205,6 +210,7 @@ cl_command_queue av_opencl_get_command_queue(void); * @param host_ptr host pointer of the OpenCL buffer * @return >=0 on success, a negative error code in case of failure */ +av_warn_unused_result int av_opencl_buffer_create(cl_mem *cl_buf, size_t cl_buf_size, int flags, void *host_ptr); /** @@ -215,6 +221,7 @@ int av_opencl_buffer_create(cl_mem *cl_buf, size_t cl_buf_size, int flags, void * @param buf_size size in bytes of the source and destination buffers * @return >=0 on success, a negative error code in case of failure */ +av_warn_unused_result int av_opencl_buffer_write(cl_mem dst_cl_buf, uint8_t *src_buf, size_t buf_size); /** @@ -225,6 +232,7 @@ int av_opencl_buffer_write(cl_mem dst_cl_buf, uint8_t *src_buf, size_t buf_size) * @param buf_size size in bytes of the source and destination buffers * @return >=0 on success, a negative error code in case of failure */ +av_warn_unused_result int av_opencl_buffer_read(uint8_t *dst_buf, cl_mem src_cl_buf, size_t buf_size); /** @@ -240,6 +248,7 @@ int av_opencl_buffer_read(uint8_t *dst_buf, cl_mem src_cl_buf, size_t buf_size); * @param src_plane_num number of source image planes * @return >=0 on success, a negative error code in case of failure */ +av_warn_unused_result int av_opencl_buffer_write_image(cl_mem dst_cl_buf, size_t cl_buffer_size, int dst_cl_offset, uint8_t **src_data, int *plane_size, int plane_num); @@ -253,6 +262,7 @@ int av_opencl_buffer_write_image(cl_mem dst_cl_buf, size_t cl_buffer_size, int d * @param src_cl_buf_sizesize in bytes of OpenCL buffer * @return >=0 on success, a negative error code in case of failure */ +av_warn_unused_result int av_opencl_buffer_read_image(uint8_t **dst_data, int *plane_size, int plane_num, cl_mem src_cl_buf, size_t cl_buffer_size); -- 2.6.1 Hi Could I ask a question? Why should we add the av_warn_unused_result? Thanks Best regards ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 3/3][RFC] avfilter/vf_chromakey: Add OpenCL acceleration
From: Timo Rothenpieler Date: 2015-10-10 17:47 To: FFmpeg development discussions and patches CC: highgod0401 Subject: Re: [FFmpeg-devel] [PATCH 3/3][RFC] avfilter/vf_chromakey: Add OpenCL acceleration > Could you please fix it? > > Thanks > > Best regards curl https://github.com/BtbN/FFmpeg/commit/29294c283a656cf809461cbae21d612b5a0f2159.patch | git apply That works for me, the patch is not in git format-patch format, so git am can't apply it. I also attached the two patches in format-patch format, in case you realy want to use git am. Hi I use your filter, but the kernel can't pass the compile, you should consider the "double" type in the kernel, some GPU card does not support double type I add "#pragma OPENCL_EXTENSION cl_khr_fp64: enable " to the kernel, but it does not works I will check the error tomorrow Thanks Best regards ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 3/3][RFC] avfilter/vf_chromakey: Add OpenCL acceleration
From: Timo Rothenpieler Date: 2015-10-10 17:47 To: FFmpeg development discussions and patches CC: highgod0401 Subject: Re: [FFmpeg-devel] [PATCH 3/3][RFC] avfilter/vf_chromakey: Add OpenCL acceleration > Could you please fix it? > > Thanks > > Best regards curl https://github.com/BtbN/FFmpeg/commit/29294c283a656cf809461cbae21d612b5a0f2159.patch | git apply That works for me, the patch is not in git format-patch format, so git am can't apply it. I also attached the two patches in format-patch format, in case you realy want to use git am. Hi I will check them. Thanks Best regards ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 3/3][RFC] avfilter/vf_chromakey: Add OpenCL acceleration
From: Timo Rothenpieler Date: 2015-10-09 16:41 To: FFmpeg development discussions and patches CC: highgod0401 Subject: Re: [FFmpeg-devel] [PATCH 3/3][RFC] avfilter/vf_chromakey: Add OpenCL acceleration > > Using this sample: https://btbn.de/files/chromakey_sample.mp4 > > ffmpeg -f lavfi -i color=c=black:s=1280x720 -i chromakey_sample.mp4 -an > -c:v libx264 -preset veryfast -crf 18 -shortest -filter_complex > "[1:v]chromakey=0x70de77:0.1:0.2:0:1[ckout];[0:v][ckout]overlay[out]" > -map "[out]" -y output.mkv > > The last parameter to the chromakey filter enables opencl acceleration. > > Hi, > > Could you please send the patch as attachments? I merge the code, but some > compile errors occur. > > Thanks > Best regards > You can pull from my github, the patches are in the chromakey branch: https://github.com/BtbN/FFmpeg/tree/chromakey If you want just the chromakey patch itself: https://github.com/BtbN/FFmpeg/commit/29294c283a656cf809461cbae21d612b5a0f2159.patch Hi I downloaded and merged the patch again, but the error still exists as follow: $ git am opencl_chromakey.patch Applying: avfilter/vf_chromakey: Add OpenCL acceleration fatal: corrupt patch at line 380 Patch failed at 0001 avfilter/vf_chromakey: Add OpenCL acceleration When you have resolved this problem run "git am --resolved". If you would prefer to skip this patch, instead run "git am --skip". To restore the original branch and stop patching run "git am --abort". I check the code, These codes are in the patch of corrupt patch at line 380. @@ -192,6 +368,7 @@ AVFilter ff_vf_chromakey = { .priv_size = sizeof(ChromakeyContext), .priv_class= &chromakey_class, .init = initialize_chromakey, +.uninit= uninitialize_chromakey, .query_formats = query_formats, .inputs= chromakey_inputs, .outputs = chromakey_outputs, the following codes are the latest ffmpeg master branch codes. AVFilter ff_vf_chromakey = { .name = "chromakey", .description = NULL_IF_CONFIG_SMALL("Turns a certain color into transparency. Operates on YUV colors."), .priv_size = sizeof(ChromakeyContext), .priv_class= &chromakey_class, .init = initialize_chromakey, .query_formats = query_formats, .inputs= chromakey_inputs, .outputs = chromakey_outputs, .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC | AVFILTER_FLAG_SLICE_THREADS, }; I think this is the reason why the conflict occurs. Could you please fix it? Thanks Best regards ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 3/3][RFC] avfilter/vf_chromakey: Add OpenCL acceleration
From: Timo Rothenpieler Date: 2015-10-09 16:41 To: FFmpeg development discussions and patches CC: highgod0401 Subject: Re: [FFmpeg-devel] [PATCH 3/3][RFC] avfilter/vf_chromakey: Add OpenCL acceleration > > Using this sample: https://btbn.de/files/chromakey_sample.mp4 > > ffmpeg -f lavfi -i color=c=black:s=1280x720 -i chromakey_sample.mp4 -an > -c:v libx264 -preset veryfast -crf 18 -shortest -filter_complex > "[1:v]chromakey=0x70de77:0.1:0.2:0:1[ckout];[0:v][ckout]overlay[out]" > -map "[out]" -y output.mkv > > The last parameter to the chromakey filter enables opencl acceleration. > > Hi, > > Could you please send the patch as attachments? I merge the code, but some > compile errors occur. > > Thanks > Best regards > You can pull from my github, the patches are in the chromakey branch: https://github.com/BtbN/FFmpeg/tree/chromakey If you want just the chromakey patch itself: https://github.com/BtbN/FFmpeg/commit/29294c283a656cf809461cbae21d612b5a0f2159.patch Hi OK, I will test as soon as possible Thanks Best regards ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 3/3][RFC] avfilter/vf_chromakey: Add OpenCL acceleration
From: Timo Rothenpieler Date: 2015-09-30 19:27 To: FFmpeg development discussions and patches Subject: Re: [FFmpeg-devel] [PATCH 3/3][RFC] avfilter/vf_chromakey: Add OpenCL acceleration >> ping once again >> >> Hi > Could you describe how to verify it, and how can I test it? > > Thanks > Best regards > Using this sample: https://btbn.de/files/chromakey_sample.mp4 ffmpeg -f lavfi -i color=c=black:s=1280x720 -i chromakey_sample.mp4 -an -c:v libx264 -preset veryfast -crf 18 -shortest -filter_complex "[1:v]chromakey=0x70de77:0.1:0.2:0:1[ckout];[0:v][ckout]overlay[out]" -map "[out]" -y output.mkv The last parameter to the chromakey filter enables opencl acceleration. Hi, Could you please send the patch as attachments? I merge the code, but some compile errors occur. Thanks Best regards ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 2/2] OpenCL: Avoid potential buffer overflow in cmdutils_opencl.c by using strncpy instead of strcpy
From: Gupta, Maneesh Date: 2015-04-27 15:51 To: FFMPEG Developer Mailing List (ffmpeg-devel@ffmpeg.org) Subject: [FFmpeg-devel] [PATCH 2/2] OpenCL: Avoid potential buffer overflow in cmdutils_opencl.c by using strncpy instead of strcpy Hi, There was a potential buffer overflow during a strcpy operation in cmdutils_opencl.c. This patch attempts to fix the same. Regards, Maneesh Hi I have reviewed and commented this patch before it submitted to ffmpeg-devel list, so it looks good to me. Thanks Best regards ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 1/2] OpenCL: Fix ABI incompatibility issues
From: Gupta, Maneesh Date: 2015-04-27 15:51 To: FFMPEG Developer Mailing List (ffmpeg-devel@ffmpeg.org) Subject: [FFmpeg-devel] [PATCH 1/2] OpenCL: Fix ABI incompatibility issues Hi, This patch attempts to fix the ABI incompatibility issues in the OpenCL code. Please review it and let me know if there is anything that I missed addressing in this patch. Regards, Maneesh Hi I have reviewed and commented this patch before it submitted to ffmpeg-devel list, so it looks good to me. Thanks Best regards ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] configure: disallow OpenCL with shared libs
highgod0401 From: James Almer Date: 2014-08-13 07:28 To: FFmpeg development discussions and patches CC: highgod0401; weigao Subject: Re: [FFmpeg-devel] [PATCH] configure: disallow OpenCL with shared libs On 12/08/14 8:13 PM, Michael Niedermayer wrote: > On Tue, Aug 12, 2014 at 07:31:58PM -0300, James Almer wrote: >> On 11/08/14 11:33 PM, Michael Niedermayer wrote: >>> Its API is marked as experimental, we should not export experimental API >>> from shared libs >>> >>> Signed-off-by: Michael Niedermayer >>> --- >>> configure |4 +++- >>> 1 file changed, 3 insertions(+), 1 deletion(-) >>> >>> diff --git a/configure b/configure >>> index 0ac6132..84d308e 100755 >>> --- a/configure >>> +++ b/configure >>> @@ -4861,7 +4861,9 @@ enabled opencl&& { check_lib2 OpenCL/cl.h >>> clEnqueueNDRangeKernel -Wl >>> die "ERROR: opencl not found"; } && >>> { check_cpp_condition "OpenCL/cl.h" >>> "defined(CL_VERSION_1_2)" || >>> check_cpp_condition "CL/cl.h" >>> "defined(CL_VERSION_1_2)" || >>> - die "ERROR: opencl must be installed and >>> version must be 1.2 or compatible"; } >>> + die "ERROR: opencl must be installed and >>> version must be 1.2 or compatible"; } && >>> + { enabled shared && >>> + die "ERROR OpenCL API is experimental and >>> not safe to be used with shared libs"; } >>> enabled opengl&& { check_lib GL/glx.h glXGetProcAddress "-lGL" >>> || >>> check_lib2 windows.h wglGetProcAddress >>> "-lopengl32 -lgdi32" || >>> check_lib2 OpenGL/gl3.h glGetError >>> "-Wl,-framework,OpenGL" || >>> >> >> The API hasn't been touched in several months and is functional, and >> considering >> distros already link to opencl if available in previous ffmpeg releases, i >> don't >> know if removing the feature like this is a good idea. >> Of course they can just remove this check and keep using opencl if they want >> to, >> but that's besides the point. >> >> Maybe a warning instead? > > The question is if people intend to change the API and IIRC its > design makes it hard to make changes without breaking ABI OpenCL maintainers should probably chime in at this point. CCing Wei Gao then. > > i can add a warning if preferred but i think we either should > choose to support the ABI/API until the next bump which wouldnt > need a warning or not support it in which case we probably should > disable it hard for shared libs or put a warning in the release notes > where its hard to miss A warning in release notes and in the configure script is IMO preferable than disabling existing functionality, but i'm fine doing whatever causes the less headaches for everyone. Hi Warning is OK for me. Thanks Best regards > > [...] > > > > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel > ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel