Re: [FFmpeg-devel] [PATCH 12/14] lavfi: Add OpenCL overlay filter
2017-09-11 5:46 GMT+08:00 James Almer : > On 9/10/2017 6:10 PM, Nicolas George wrote: > > Le quartidi 24 fructidor, an CCXXV, Mark Thompson a écrit : > >> Input and output formats must be the same, the overlay format must be > >> the same as the input except possibly with an additional alpha > component. > >> --- > >> configure | 1 + > >> libavfilter/Makefile| 2 + > >> libavfilter/allfilters.c| 1 + > >> libavfilter/opencl/overlay.cl | 104 > >> libavfilter/opencl_source.h | 2 + > >> libavfilter/vf_overlay_opencl.c | 347 ++ > ++ > >> 6 files changed, 457 insertions(+) > >> create mode 100644 libavfilter/opencl/overlay.cl > >> create mode 100644 libavfilter/vf_overlay_opencl.c > >> > >> diff --git a/configure b/configure > >> index 895ae2ec38..c036a53a69 100755 > >> --- a/configure > >> +++ b/configure > >> @@ -3178,6 +3178,7 @@ negate_filter_deps="lut_filter" > >> nnedi_filter_deps="gpl" > >> ocr_filter_deps="libtesseract" > >> ocv_filter_deps="libopencv" > >> +overlay_opencl_filter_deps="opencl" > >> owdenoise_filter_deps="gpl" > >> pan_filter_deps="swresample" > >> perspective_filter_deps="gpl" > >> diff --git a/libavfilter/Makefile b/libavfilter/Makefile > >> index cb3a1424d9..cc9d4021b8 100644 > >> --- a/libavfilter/Makefile > >> +++ b/libavfilter/Makefile > >> @@ -249,6 +249,8 @@ OBJS-$(CONFIG_OCV_FILTER)+= > vf_libopencv.o > >> OBJS-$(CONFIG_OPENCL)+= deshake_opencl.o > unsharp_opencl.o > >> OBJS-$(CONFIG_OSCILLOSCOPE_FILTER) += vf_datascope.o > > > >> OBJS-$(CONFIG_OVERLAY_FILTER)+= vf_overlay.o > framesync2.o > >> +OBJS-$(CONFIG_OVERLAY_OPENCL_FILTER) += vf_overlay_opencl.o > opencl.o \ > >> +opencl/overlay.o > > > > Missing framesync2.o? > > Maybe it should be its own subsystem entry with the filters stating the > dependency in configure instead? It's used by enough filters by now to > justify that. > Unless of course it becomes a requirement for all filters in the long > run, where it should be an unconditional OBJS object. > looks good to me > _ __ > 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/3] cmdutils_opencl: fix resource_leak cid 1396852
2017-01-12 3:29 GMT+08:00 Michael Niedermayer : > On Tue, Jan 10, 2017 at 07:44:32PM +0800, Steven Liu wrote: > > CID: 1396852 > > check the devices_list alloc status, > > and release the devices_list when alloc devices error > > > > Signed-off-by: Steven Liu > > --- > > cmdutils_opencl.c | 7 ++- > > 1 file changed, 6 insertions(+), 1 deletion(-) > > > > diff --git a/cmdutils_opencl.c b/cmdutils_opencl.c > > index dd21344..5bbc8dc 100644 > > --- a/cmdutils_opencl.c > > +++ b/cmdutils_opencl.c > > @@ -220,15 +220,20 @@ int opt_opencl_bench(void *optctx, const char > *opt, const char *arg) > > OpenCLDeviceBenchmark *devices = NULL; > > cl_platform_id platform; > > > > -av_opencl_get_device_list(&device_list); > > +if (av_opencl_get_device_list(&device_list) < 0) { > > +return AVERROR(ENOMEM); > > +} > > The error code from av_opencl_get_device_list() should be forwarded > > thx > Hi Looks good to me Thanks > > [...] > -- > Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB > > The educated differ from the uneducated as much as the living from the > dead. -- Aristotle > > ___ > 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 03/11] libavutil/opencl: fix potentiall nul dereference
2017-06-11 22:05 GMT+08:00 Timo Rothenpieler : > Fixes CID 1396840 > --- > libavutil/opencl.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/libavutil/opencl.c b/libavutil/opencl.c > index af35770e06..202756516b 100644 > --- a/libavutil/opencl.c > +++ b/libavutil/opencl.c > @@ -169,7 +169,7 @@ const char *av_opencl_errstr(cl_int status) > static void free_device_list(AVOpenCLDeviceList *device_list) > { > int i, j; > -if (!device_list) > +if (!device_list || !device_list->platform_node) > return; > for (i = 0; i < device_list->platform_num; i++) { > if (!device_list->platform_node[i]) > -- > 2.13.0 > Looks good to me, thanks. > > ___ > 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 6/7] avutil/opencl: convert to stdatomic
2017-03-23 7:34 GMT+08:00 James Almer : > Signed-off-by: James Almer > --- > libavutil/opencl.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/libavutil/opencl.c b/libavutil/opencl.c > index af35770e06..9b6c8d10d8 100644 > --- a/libavutil/opencl.c > +++ b/libavutil/opencl.c > @@ -29,7 +29,7 @@ > > #if HAVE_THREADS > #include "thread.h" > -#include "atomic.h" > +#include > > static pthread_mutex_t * volatile atomic_opencl_lock = NULL; > #define LOCK_OPENCL pthread_mutex_lock(atomic_opencl_lock) > @@ -351,13 +351,14 @@ static inline int init_opencl_mtx(void) > if (!atomic_opencl_lock) { > int err; > pthread_mutex_t *tmp = av_malloc(sizeof(pthread_mutex_t)); > +const pthread_mutex_t *cmp = NULL; > if (!tmp) > return AVERROR(ENOMEM); > if ((err = pthread_mutex_init(tmp, NULL))) { > av_free(tmp); > return AVERROR(err); > } > -if (avpriv_atomic_ptr_cas((void * volatile *)&atomic_opencl_lock, > NULL, tmp)) { > +if (!atomic_compare_exchange_strong(&atomic_opencl_lock, &cmp, > tmp)) { > pthread_mutex_destroy(tmp); > av_free(tmp); > } > -- > 2.12.0 > > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel Hi Looks good to me, thanks ___ 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
2014-08-13 9:45 GMT+08:00 Timothy Gu : > On Aug 12, 2014 6:43 PM, "highgod0401" wrote: > > > Hi > > > > Warning is OK for me. > > Do you plan to change the API? > Hi Sorry for the late reply, could you tell me more details? How to change it? I will change it according your suggestion. Thanks Best regards > > [...] > > Timothy > ___ > 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
[FFmpeg-devel] [FFmpeng-devel] Dose ffmpeg plan to support FMO decode in h264
Hi I have a question. Does ffmpeg plan to support FMO(Flexible Macroblock Ordering)? Thanks Best regards ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [FFmpeng-devel] Dose ffmpeg plan to support FMO decode in h264
2018-02-07 6:57 GMT+08:00 Michael Niedermayer : > On Tue, Feb 06, 2018 at 11:14:49AM +0800, Wei Gao wrote: > > Hi > > > > I have a question. > > > > Does ffmpeg plan to support FMO(Flexible Macroblock Ordering)? > > when someone sends a patch that implements it > Hi OK, thanks. I saw there is a FMO macro, but it define to 0. Thanks Best regards > > [...] > > -- > Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB > > Elect your leaders based on what they did after the last election, not > based on what they say before an election. > > > ___ > 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] [FFmpeng-devel] Dose ffmpeg plan to support FMO decode in h264
2018-02-08 6:59 GMT+08:00 Michael Niedermayer : > On Wed, Feb 07, 2018 at 02:15:26PM +0800, Wei Gao wrote: > > 2018-02-07 6:57 GMT+08:00 Michael Niedermayer : > > > > > On Tue, Feb 06, 2018 at 11:14:49AM +0800, Wei Gao wrote: > > > > Hi > > > > > > > > I have a question. > > > > > > > > Does ffmpeg plan to support FMO(Flexible Macroblock Ordering)? > > > > > > when someone sends a patch that implements it > > > > > Hi > > OK, thanks. > > I saw there is a FMO macro, but it define to 0. > > yes, there was partial FMO support in some functions i wrote but it was > never completed. > > lack of interrest, lack of anything out there using it and lack of anyone > funding the work probably are the reasons why noone implemented FMO support > Hi Thanks Best regards > > [...] > > -- > Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB > > Awnsering whenever a program halts or runs forever is > On a turing machine, in general impossible (turings halting problem). > On any real computer, always possible as a real computer has a finite > number > of states N, and will either halt in less than N cycles or never halt. > > ___ > 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] libavfilter: unsharpen opencl filter optimizations
2014-12-18 8:14 GMT+08:00 Titov, Alexey : > > Hi, here is a patch for optimized OpenCL implementation for > libavfilter/unsharpen filter. > This implementation leverages hardware acceleration where possible. > > Regards, > Alexey > > --- > libavfilter/unsharp.h | 4 ++ > libavfilter/unsharp_opencl.c| 76 +++--- > libavfilter/unsharp_opencl_kernel.h | 122 > ++-- > libavutil/opencl.c | 19 +- > 4 files changed, 165 insertions(+), 56 deletions(-) > > diff --git a/libavfilter/unsharp.h b/libavfilter/unsharp.h > index c2aed64..fc651c0 100644 > --- a/libavfilter/unsharp.h > +++ b/libavfilter/unsharp.h > @@ -41,6 +41,10 @@ typedef struct { > cl_kernel kernel_chroma; > cl_mem cl_luma_mask; > cl_mem cl_chroma_mask; > +cl_mem cl_luma_mask_x; > +cl_mem cl_chroma_mask_x; > +cl_mem cl_luma_mask_y; > +cl_mem cl_chroma_mask_y; > int in_plane_size[8]; > int out_plane_size[8]; > int plane_num; > diff --git a/libavfilter/unsharp_opencl.c b/libavfilter/unsharp_opencl.c > index 5c6b5ef..a99fc5b 100644 > --- a/libavfilter/unsharp_opencl.c > +++ b/libavfilter/unsharp_opencl.c > @@ -87,42 +87,36 @@ end: > return ret; > } > -static int compute_mask_matrix(cl_mem cl_mask_matrix, int step_x, int > step_y) > +static int copy_separable_masks(cl_mem cl_mask_x, cl_mem cl_mask_y, int > step_x, int step_y) > { > -int i, j, ret = 0; > -uint32_t *mask_matrix, *mask_x, *mask_y; > -size_t size_matrix = sizeof(uint32_t) * (2 * step_x + 1) * (2 * > step_y + 1); > -mask_x = av_mallocz_array(2 * step_x + 1, sizeof(uint32_t)); > +int ret = 0; > +uint32_t *mask_x, *mask_y; > +size_t size_mask_x = sizeof(uint32_t) * (2 * step_x + 1); > +size_t size_mask_y = sizeof(uint32_t) * (2 * step_y + 1); > +mask_x = av_mallocz_array(size_mask_x); > if (!mask_x) { > ret = AVERROR(ENOMEM); > goto end; > } > -mask_y = av_mallocz_array(2 * step_y + 1, sizeof(uint32_t)); > +mask_y = av_mallocz_array(size_mask_y); > if (!mask_y) { > ret = AVERROR(ENOMEM); > goto end; > } > -mask_matrix = av_mallocz(size_matrix); > -if (!mask_matrix) { > -ret = AVERROR(ENOMEM); > -goto end; > -} > + > ret = compute_mask(step_x, mask_x); > if (ret < 0) > goto end; > ret = compute_mask(step_y, mask_y); > if (ret < 0) > goto end; > -for (j = 0; j < 2 * step_y + 1; j++) { > -for (i = 0; i < 2 * step_x + 1; i++) { > -mask_matrix[i + j * (2 * step_x + 1)] = mask_y[j] * mask_x[i]; > -} > -} > -ret = av_opencl_buffer_write(cl_mask_matrix, (uint8_t *)mask_matrix, > size_matrix); > + > +ret = av_opencl_buffer_write(cl_mask_x, (uint8_t *)mask_x, > size_mask_x); > +ret = av_opencl_buffer_write(cl_mask_y, (uint8_t *)mask_y, > size_mask_y); > end: > av_freep(&mask_x); > av_freep(&mask_y); > -av_freep(&mask_matrix); > + > return ret; > } > @@ -133,6 +127,11 @@ static int generate_mask(AVFilterContext *ctx) > cl_mem mask_matrix[2]; > mask_matrix[0] = unsharp->opencl_ctx.cl_luma_mask; > mask_matrix[1] = unsharp->opencl_ctx.cl_chroma_mask; > +cl_mem masks[4]; > +masks[0] = unsharp->opencl_ctx.cl_luma_mask_x; > +masks[1] = unsharp->opencl_ctx.cl_luma_mask_y; > +masks[2] = unsharp->opencl_ctx.cl_chroma_mask_x; > +masks[3] = unsharp->opencl_ctx.cl_chroma_mask_y; > step_x[0] = unsharp->luma.steps_x; > step_x[1] = unsharp->chroma.steps_x; > step_y[0] = unsharp->luma.steps_y; > @@ -144,12 +143,16 @@ static int generate_mask(AVFilterContext *ctx) > else > unsharp->opencl_ctx.use_fast_kernels = 1; > +if (!masks[0] || !masks[1] || !masks[2] || !masks[3]) { > +av_log(ctx, AV_LOG_ERROR, "Luma mask and chroma mask should not > be NULL\n"); > +return AVERROR(EINVAL); > +} > if (!mask_matrix[0] || !mask_matrix[1]) { > av_log(ctx, AV_LOG_ERROR, "Luma mask and chroma mask should not > be NULL\n"); > return AVERROR(EINVAL); > } > for (i = 0; i < 2; i++) { > -ret = compute_mask_matrix(mask_matrix[i], step_x[i], step_y[i]); > +ret = copy_separable_masks(masks[2*i], masks[2*i+1], step_x[i], > step_y[i]); > if (ret < 0) > return ret; > } > @@ -184,7 +187,8 @@ int ff_opencl_apply_unsharp(AVFilterContext *ctx, > AVFrame *in, AVFrame *out) > ret = avpriv_opencl_set_parameter(&kernel1, > > FF_OPENCL_PARAM_INFO(unsharp->opencl_ctx.cl_inbuf), > > FF_OPENCL_PARAM_INFO(unsharp->opencl_ctx.cl_outbuf), > - > FF_OPENCL_PARAM_INFO(unsharp->opencl_ctx.cl_luma_mask), > + > FF_OPENCL_PARAM_INFO(unsharp->opencl_ctx.cl_luma_mask_x), > + > FF_OPENCL_PARAM_INFO(unsharp->opencl_ctx.cl_luma_mask_y), > > FF_OPENCL_PARAM_INFO(unsharp->luma.amount), > > FF_OPENCL_PARAM_INFO(unsharp->luma.scalebits), > >
Re: [FFmpeg-devel] [PATCH] libavfilter: unsharpen opencl filter optimizations
2014-12-18 8:14 GMT+08:00 Titov, Alexey : > > Hi, here is a patch for optimized OpenCL implementation for > libavfilter/unsharpen filter. > This implementation leverages hardware acceleration where possible. > > Regards, > Alexey > > --- > libavfilter/unsharp.h | 4 ++ > libavfilter/unsharp_opencl.c| 76 +++--- > libavfilter/unsharp_opencl_kernel.h | 122 > ++-- > libavutil/opencl.c | 19 +- > 4 files changed, 165 insertions(+), 56 deletions(-) > > diff --git a/libavfilter/unsharp.h b/libavfilter/unsharp.h > index c2aed64..fc651c0 100644 > --- a/libavfilter/unsharp.h > +++ b/libavfilter/unsharp.h > @@ -41,6 +41,10 @@ typedef struct { > cl_kernel kernel_chroma; > cl_mem cl_luma_mask; > cl_mem cl_chroma_mask; > +cl_mem cl_luma_mask_x; > +cl_mem cl_chroma_mask_x; > +cl_mem cl_luma_mask_y; > +cl_mem cl_chroma_mask_y; > int in_plane_size[8]; > int out_plane_size[8]; > int plane_num; > diff --git a/libavfilter/unsharp_opencl.c b/libavfilter/unsharp_opencl.c > index 5c6b5ef..a99fc5b 100644 > --- a/libavfilter/unsharp_opencl.c > +++ b/libavfilter/unsharp_opencl.c > @@ -87,42 +87,36 @@ end: > return ret; > } > -static int compute_mask_matrix(cl_mem cl_mask_matrix, int step_x, int > step_y) > +static int copy_separable_masks(cl_mem cl_mask_x, cl_mem cl_mask_y, int > step_x, int step_y) > { > -int i, j, ret = 0; > -uint32_t *mask_matrix, *mask_x, *mask_y; > -size_t size_matrix = sizeof(uint32_t) * (2 * step_x + 1) * (2 * > step_y + 1); > -mask_x = av_mallocz_array(2 * step_x + 1, sizeof(uint32_t)); > +int ret = 0; > +uint32_t *mask_x, *mask_y; > +size_t size_mask_x = sizeof(uint32_t) * (2 * step_x + 1); > +size_t size_mask_y = sizeof(uint32_t) * (2 * step_y + 1); > +mask_x = av_mallocz_array(size_mask_x); > if (!mask_x) { > ret = AVERROR(ENOMEM); > goto end; > } > -mask_y = av_mallocz_array(2 * step_y + 1, sizeof(uint32_t)); > +mask_y = av_mallocz_array(size_mask_y); > if (!mask_y) { > ret = AVERROR(ENOMEM); > goto end; > } > -mask_matrix = av_mallocz(size_matrix); > -if (!mask_matrix) { > -ret = AVERROR(ENOMEM); > -goto end; > -} > + > ret = compute_mask(step_x, mask_x); > if (ret < 0) > goto end; > ret = compute_mask(step_y, mask_y); > if (ret < 0) > goto end; > -for (j = 0; j < 2 * step_y + 1; j++) { > -for (i = 0; i < 2 * step_x + 1; i++) { > -mask_matrix[i + j * (2 * step_x + 1)] = mask_y[j] * mask_x[i]; > -} > -} > -ret = av_opencl_buffer_write(cl_mask_matrix, (uint8_t *)mask_matrix, > size_matrix); > + > +ret = av_opencl_buffer_write(cl_mask_x, (uint8_t *)mask_x, > size_mask_x); > +ret = av_opencl_buffer_write(cl_mask_y, (uint8_t *)mask_y, > size_mask_y); > end: > av_freep(&mask_x); > av_freep(&mask_y); > -av_freep(&mask_matrix); > + > return ret; > } > @@ -133,6 +127,11 @@ static int generate_mask(AVFilterContext *ctx) > cl_mem mask_matrix[2]; > mask_matrix[0] = unsharp->opencl_ctx.cl_luma_mask; > mask_matrix[1] = unsharp->opencl_ctx.cl_chroma_mask; > +cl_mem masks[4]; > +masks[0] = unsharp->opencl_ctx.cl_luma_mask_x; > +masks[1] = unsharp->opencl_ctx.cl_luma_mask_y; > +masks[2] = unsharp->opencl_ctx.cl_chroma_mask_x; > +masks[3] = unsharp->opencl_ctx.cl_chroma_mask_y; > step_x[0] = unsharp->luma.steps_x; > step_x[1] = unsharp->chroma.steps_x; > step_y[0] = unsharp->luma.steps_y; > @@ -144,12 +143,16 @@ static int generate_mask(AVFilterContext *ctx) > else > unsharp->opencl_ctx.use_fast_kernels = 1; > +if (!masks[0] || !masks[1] || !masks[2] || !masks[3]) { > +av_log(ctx, AV_LOG_ERROR, "Luma mask and chroma mask should not > be NULL\n"); > +return AVERROR(EINVAL); > +} > if (!mask_matrix[0] || !mask_matrix[1]) { > av_log(ctx, AV_LOG_ERROR, "Luma mask and chroma mask should not > be NULL\n"); > return AVERROR(EINVAL); > } > for (i = 0; i < 2; i++) { > -ret = compute_mask_matrix(mask_matrix[i], step_x[i], step_y[i]); > +ret = copy_separable_masks(masks[2*i], masks[2*i+1], step_x[i], > step_y[i]); > if (ret < 0) > return ret; > } > @@ -184,7 +187,8 @@ int ff_opencl_apply_unsharp(AVFilterContext *ctx, > AVFrame *in, AVFrame *out) > ret = avpriv_opencl_set_parameter(&kernel1, > > FF_OPENCL_PARAM_INFO(unsharp->opencl_ctx.cl_inbuf), > > FF_OPENCL_PARAM_INFO(unsharp->opencl_ctx.cl_outbuf), > - > FF_OPENCL_PARAM_INFO(unsharp->opencl_ctx.cl_luma_mask), > + > FF_OPENCL_PARAM_INFO(unsharp->opencl_ctx.cl_luma_mask_x), > + > FF_OPENCL_PARAM_INFO(unsharp->opencl_ctx.cl_luma_mask_y), > > FF_OPENCL_PARAM_INFO(unsharp->luma.amount), > > FF_OPENCL_PARAM_INFO(unsharp->luma.scalebits), > >
Re: [FFmpeg-devel] libavutil/opencl: output program build log
2014-12-25 4:34 GMT+08:00 Michael Niedermayer : > On Wed, Dec 24, 2014 at 07:55:13PM +, Titov, Alexey wrote: > > Attached corrected patch > > should be ok > if wei gao is ok with it then i can apply it > Hi, I tried to merge the three patches on mingw, but seems some errors, the log is as follow. Administrator@MCW-HIGHGOD /E/ffmpeg/ffmpeg_submit/ffmpeg_updata/ffmpeg_unsharp master) $ git am 0001-libavfilter-unsharpen-opencl-filter-optimizations.patch Applying: libavfilter: unsharpen opencl filter optimizations Administrator@MCW-HIGHGOD /E/ffmpeg/ffmpeg_submit/ffmpeg_updata/ffmpeg_unsharp master) $ git am 0002-Fixed-the-patch-according-to-the-suggestions.patch Applying: Fixed the patch according to the suggestions e:/ffmpeg/ffmpeg_submit/ffmpeg_updata/ffmpeg_unsharp/.git/rebase-apply/patch:10 : trailing whitespace. warning: 1 line adds whitespace errors. Administrator@MCW-HIGHGOD /E/ffmpeg/ffmpeg_submit/ffmpeg_updata/ffmpeg_unsharp master) $ git am 0001-libavutil-opencl-output-program-build-failure-log.patch Applying: libavutil/opencl: output program build failure log e:/ffmpeg/ffmpeg_submit/ffmpeg_updata/ffmpeg_unsharp/.git/rebase-apply/patch:44 trailing whitespace. error: patch failed: libavutil/opencl.c:449 error: libavutil/opencl.c: patch does not apply error: patch failed: libavutil/opencl.h:51 error: libavutil/opencl.h: patch does not apply Patch failed at 0001 libavutil/opencl: output program build failure log 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". Thanks Best regards > > [...] > > -- > Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB > > I have never wished to cater to the crowd; for what I know they do not > approve, and what they approve I do not know. -- Epicurus > > ___ > 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] libavutil/opencl: output program build log
2014-12-29 10:10 GMT+08:00 Wei Gao : > > > 2014-12-25 4:34 GMT+08:00 Michael Niedermayer : > >> On Wed, Dec 24, 2014 at 07:55:13PM +, Titov, Alexey wrote: >> > Attached corrected patch >> >> should be ok >> if wei gao is ok with it then i can apply it >> > Hi, I tried to merge the three patches on mingw, but seems some errors, > the log is as follow. > > Administrator@MCW-HIGHGOD > /E/ffmpeg/ffmpeg_submit/ffmpeg_updata/ffmpeg_unsharp > master) > $ git am 0001-libavfilter-unsharpen-opencl-filter-optimizations.patch > Applying: libavfilter: unsharpen opencl filter optimizations > > Administrator@MCW-HIGHGOD > /E/ffmpeg/ffmpeg_submit/ffmpeg_updata/ffmpeg_unsharp > master) > $ git am 0002-Fixed-the-patch-according-to-the-suggestions.patch > Applying: Fixed the patch according to the suggestions > > e:/ffmpeg/ffmpeg_submit/ffmpeg_updata/ffmpeg_unsharp/.git/rebase-apply/patch:10 > : trailing whitespace. > > warning: 1 line adds whitespace errors. > > Administrator@MCW-HIGHGOD > /E/ffmpeg/ffmpeg_submit/ffmpeg_updata/ffmpeg_unsharp > master) > $ git am 0001-libavutil-opencl-output-program-build-failure-log.patch > Applying: libavutil/opencl: output program build failure log > > e:/ffmpeg/ffmpeg_submit/ffmpeg_updata/ffmpeg_unsharp/.git/rebase-apply/patch:44 > trailing whitespace. > > error: patch failed: libavutil/opencl.c:449 > error: libavutil/opencl.c: patch does not apply > error: patch failed: libavutil/opencl.h:51 > error: libavutil/opencl.h: patch does not apply > Patch failed at 0001 libavutil/opencl: output program build failure log > 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". > > Thanks > Best regards > Hi The base version is as follow commit 202947a0665ea523022afb0a6c50eed96bcd6b69 Author: Pedro E. M. Brito Date: Sun Dec 28 05:35:34 2014 -0200 libavformat/segment.c: Add strftime expansion for segment filename templates Allows expansion of the filename template with strftime() with the option -strftime 1 (disabled by default). This allows segments to be named by time creation, adding some flexibility. Fixes Ticket 4104 (add strftime to segment muxer) Signed-off-by: Pedro E. M. Brito Signed-off-by: Michael Niedermayer --- Administrator@MCW-HIGHGOD /E/ffmpeg/ffmpeg_submit/ffmpeg_updata/ffmpeg_unsharp ( master|AM) $ git log commit 76ee532ff2443842ec0a8c9a0527dc9266a65ff5 Author: atitov Date: Tue Dec 23 13:16:35 2014 -0800 Fixed the patch according to the suggestions build log is now capped and is using av_log, other issues are fixed commit 08e07370f59f862efaedf12d9eb7962c9f5556d6 Author: atitov Date: Wed Dec 17 16:02:17 2014 -0800 libavfilter: unsharpen opencl filter optimizations commit 202947a0665ea523022afb0a6c50eed96bcd6b69 Author: Pedro E. M. Brito Date: Sun Dec 28 05:35:34 2014 -0200 libavformat/segment.c: Add strftime expansion for segment filename templates Allows expansion of the filename template with strftime() with the option -strftime 1 (disabled by default). This allows segments to be named by time creation, adding some flexibility. Fixes Ticket 4104 (add strftime to segment muxer) Signed-off-by: Pedro E. M. Brito Signed-off-by: Michael Niedermayer > >> >> [...] >> >> -- >> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB >> >> I have never wished to cater to the crowd; for what I know they do not >> approve, and what they approve I do not know. -- Epicurus >> >> ___ >> 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] libavfilter/unsharp opencl optimization
2015-01-04 7:34 GMT+08:00 Alexey Titov : > From: atitov > > --- > libavfilter/unsharp.h | 4 ++ > libavfilter/unsharp_opencl.c| 74 +++--- > libavfilter/unsharp_opencl_kernel.h | 122 > ++-- > 3 files changed, 145 insertions(+), 55 deletions(-) > > diff --git a/libavfilter/unsharp.h b/libavfilter/unsharp.h > index c2aed64..fc651c0 100644 > --- a/libavfilter/unsharp.h > +++ b/libavfilter/unsharp.h > @@ -41,6 +41,10 @@ typedef struct { > cl_kernel kernel_chroma; > cl_mem cl_luma_mask; > cl_mem cl_chroma_mask; > +cl_mem cl_luma_mask_x; > +cl_mem cl_chroma_mask_x; > +cl_mem cl_luma_mask_y; > +cl_mem cl_chroma_mask_y; > int in_plane_size[8]; > int out_plane_size[8]; > int plane_num; > diff --git a/libavfilter/unsharp_opencl.c b/libavfilter/unsharp_opencl.c > index 5c6b5ef..1923cb3 100644 > --- a/libavfilter/unsharp_opencl.c > +++ b/libavfilter/unsharp_opencl.c > @@ -87,11 +87,12 @@ end: > return ret; > } > > -static int compute_mask_matrix(cl_mem cl_mask_matrix, int step_x, int > step_y) > +static int copy_separable_masks(cl_mem cl_mask_x, cl_mem cl_mask_y, int > step_x, int step_y) > { > -int i, j, ret = 0; > -uint32_t *mask_matrix, *mask_x, *mask_y; > -size_t size_matrix = sizeof(uint32_t) * (2 * step_x + 1) * (2 * > step_y + 1); > +int ret = 0; > +uint32_t *mask_x, *mask_y; > +size_t size_mask_x = sizeof(uint32_t) * (2 * step_x + 1); > +size_t size_mask_y = sizeof(uint32_t) * (2 * step_y + 1); > mask_x = av_mallocz_array(2 * step_x + 1, sizeof(uint32_t)); > if (!mask_x) { > ret = AVERROR(ENOMEM); > @@ -102,37 +103,33 @@ static int compute_mask_matrix(cl_mem > cl_mask_matrix, int step_x, int step_y) > ret = AVERROR(ENOMEM); > goto end; > } > -mask_matrix = av_mallocz(size_matrix); > -if (!mask_matrix) { > -ret = AVERROR(ENOMEM); > -goto end; > -} > ret = compute_mask(step_x, mask_x); > if (ret < 0) > goto end; > ret = compute_mask(step_y, mask_y); > if (ret < 0) > goto end; > -for (j = 0; j < 2 * step_y + 1; j++) { > -for (i = 0; i < 2 * step_x + 1; i++) { > -mask_matrix[i + j * (2 * step_x + 1)] = mask_y[j] * mask_x[i]; > -} > -} > -ret = av_opencl_buffer_write(cl_mask_matrix, (uint8_t *)mask_matrix, > size_matrix); > +ret = av_opencl_buffer_write(cl_mask_x, (uint8_t *)mask_x, > size_mask_x); > +ret = av_opencl_buffer_write(cl_mask_y, (uint8_t *)mask_y, > size_mask_y); > end: > av_freep(&mask_x); > av_freep(&mask_y); > -av_freep(&mask_matrix); > return ret; > } > > static int generate_mask(AVFilterContext *ctx) > { > -UnsharpContext *unsharp = ctx->priv; > -int i, ret = 0, step_x[2], step_y[2]; > +cl_mem masks[4]; > cl_mem mask_matrix[2]; > +int i, ret = 0, step_x[2], step_y[2]; > + > +UnsharpContext *unsharp = ctx->priv; > mask_matrix[0] = unsharp->opencl_ctx.cl_luma_mask; > mask_matrix[1] = unsharp->opencl_ctx.cl_chroma_mask; > +masks[0] = unsharp->opencl_ctx.cl_luma_mask_x; > +masks[1] = unsharp->opencl_ctx.cl_luma_mask_y; > +masks[2] = unsharp->opencl_ctx.cl_chroma_mask_x; > +masks[3] = unsharp->opencl_ctx.cl_chroma_mask_y; > step_x[0] = unsharp->luma.steps_x; > step_x[1] = unsharp->chroma.steps_x; > step_y[0] = unsharp->luma.steps_y; > @@ -144,12 +141,16 @@ static int generate_mask(AVFilterContext *ctx) > else > unsharp->opencl_ctx.use_fast_kernels = 1; > > +if (!masks[0] || !masks[1] || !masks[2] || !masks[3]) { > +av_log(ctx, AV_LOG_ERROR, "Luma mask and chroma mask should not > be NULL\n"); > +return AVERROR(EINVAL); > +} > if (!mask_matrix[0] || !mask_matrix[1]) { > av_log(ctx, AV_LOG_ERROR, "Luma mask and chroma mask should not > be NULL\n"); > return AVERROR(EINVAL); > } > for (i = 0; i < 2; i++) { > -ret = compute_mask_matrix(mask_matrix[i], step_x[i], step_y[i]); > +ret = copy_separable_masks(masks[2*i], masks[2*i+1], step_x[i], > step_y[i]); > if (ret < 0) > return ret; > } > @@ -184,7 +185,8 @@ int ff_opencl_apply_unsharp(AVFilterContext *ctx, > AVFrame *in, AVFrame *out) > ret = avpriv_opencl_set_parameter(&kernel1, > > FF_OPENCL_PARAM_INFO(unsharp->opencl_ctx.cl_inbuf), > > FF_OPENCL_PARAM_INFO(unsharp->opencl_ctx.cl_outbuf), > - > FF_OPENCL_PARAM_INFO(unsharp->opencl_ctx.cl_luma_mask), > + > FF_OPENCL_PARAM_INFO(unsharp->opencl_ctx.cl_luma_mask_x), > + > FF_OPENCL_PARAM_INFO(unsharp->opencl_ctx.cl_luma_mask_y), > > FF_OPENCL_PARAM_INFO(unsharp->luma.amount), > > FF_OPENCL_PARAM_INFO(unsharp->luma.scalebits), > > FF_OPENCL_PARAM_INFO(unsharp->luma.halfscale), > @@ -201,7 +203,8 @@ int ff_opencl_apply_unsharp(AVFilterContext *ctx, > AVFrame *in, AVFrame *out) > re
Re: [FFmpeg-devel] [PATCH 1/2] libavfilter/unsharp opencl optimization
2015-01-06 0:47 GMT+08:00 Titov, Alexey : > Hi Wei, > I will double check using yuv. > What opencl platform/device you are running it on? > Also, can you point me to /testfile/blueangles.m4v so I can reproduce > correct and not correct outputs? > > Thanks! > Hi Number of platforms: 1 Platform Profile:FULL_PROFILE Platform Version: OpenCL 1.2 AMD-APP (1016.4) Platform Name: AMD Accelerated Parallel Processing Platform Vendor: Advanced Micro Devices, Inc. Platform Name:AMD Accelerated Parallel Processing Number of devices: 2 Device Type: CL_DEVICE_TYPE_GPU Device ID: 4098 Board name:AMD Radeon HD 6700M Series Also, can you point me to /testfile/blueangles.m4v so I can reproduce correct and not correct outputs? about the input file, just a 1080p video, I think you can use anther video which size is 1080p. You can compile a master branch and run the command in the mail above. Thanks Best regards > 2015-01-05 14:50 GMT+08:00 Titov, Alexey : > Hi Wei, > > > This is the first part of the whole patch right? Could you send the > second > > part? > > Nope, this is the whole patch. git sendmail automatically added 1/2, even > though this is the only part. > > Regards > Hi > did you check the result? of YUV, my command is > ffmpeg -i ./testfile/blueangels.m4v -vf > unsharp=lx=11:ly=9:cx=5:cy=7:ca=1:la=1:opencl=1 -vframes 1 -y > ./testfile/out.yuv > > and the result of the new patches is not correct. please reference the > attachment, the wrong one is created by the new patches, the correct one is > node 202947a0665ea523022afb0a6c50eed96bcd6b69 > > BTW, I use the 2 patches you submitted before. The size of yuv is > 1920x1080. > > > ___ > > 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: don't include config.h
2015-01-06 12:56 GMT+08:00 James Almer : > It's not an installed header. Use libavutil/avconfig.h instead. > > Signed-off-by: James Almer > --- > Untested as i don't have an OpenCL SDK installed. > > configure | 2 +- > libavutil/opencl.h | 2 +- > 2 files changed, 2 insertions(+), 2 deletions(-) > > diff --git a/configure b/configure > index 50458ea..de6975c 100755 > --- a/configure > +++ b/configure > @@ -1629,6 +1629,7 @@ HAVE_LIST_CMDLINE=" > > HAVE_LIST_PUB=" > bigendian > +CL_cl_h > fast_unaligned > incompatible_libav_abi > " > @@ -1640,7 +1641,6 @@ HEADERS_LIST=" > asm_types_h > cdio_paranoia_h > cdio_paranoia_paranoia_h > -CL_cl_h > dev_bktr_ioctl_bt848_h > dev_bktr_ioctl_meteor_h > dev_ic_bt8xx_h > diff --git a/libavutil/opencl.h b/libavutil/opencl.h > index 4655cba..67306da 100644 > --- a/libavutil/opencl.h > +++ b/libavutil/opencl.h > @@ -32,7 +32,7 @@ > #ifndef LIBAVUTIL_OPENCL_H > #define LIBAVUTIL_OPENCL_H > > -#include "config.h" > +#include "libavutil/avconfig.h" > #if HAVE_CL_CL_H > #include > #else > -- > 2.2.1 > > looks good to me thanks > ___ > 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: don't include config.h
2015-01-08 8:42 GMT+08:00 Michael Niedermayer : > On Wed, Jan 07, 2015 at 05:44:41PM -0300, James Almer wrote: > > On 06/01/15 11:27 PM, Michael Niedermayer wrote: > > > On Tue, Jan 06, 2015 at 01:56:01AM -0300, James Almer wrote: > > >> It's not an installed header. Use libavutil/avconfig.h instead. > > > > > > assuming noone objects to this "hack" ... ugly but it should fix the > > > build so ok > > > > Yes, i agree it's kinda ugly. What about this instead? > > LGTM but i dont have opencl setup so havnt tested it > Hi diff --git a/libavutil/opencl.h b/libavutil/opencl.h index 4655cba..0b7b8d4 100644 --- a/libavutil/opencl.h +++ b/libavutil/opencl.h @@ -32,11 +32,10 @@ #ifndef LIBAVUTIL_OPENCL_H #define LIBAVUTIL_OPENCL_H -#include "config.h" -#if HAVE_CL_CL_H -#include -#else +#ifdef __APPLE__ #include +#else +#include #endif #include #include "dict.h" just this patch right? I can test it, but I don't have apple platform. > > [...] > -- > Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB > > Let us carefully observe those good qualities wherein our enemies excel us > and endeavor to excel them, by avoiding what is faulty, and imitating what > is excellent in them. -- Plutarch > > ___ > 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: don't include config.h
2015-01-08 10:10 GMT+08:00 James Almer : > On 07/01/15 10:55 PM, Wei Gao wrote: > > 2015-01-08 8:42 GMT+08:00 Michael Niedermayer : > > > >> On Wed, Jan 07, 2015 at 05:44:41PM -0300, James Almer wrote: > >>> On 06/01/15 11:27 PM, Michael Niedermayer wrote: > >>>> On Tue, Jan 06, 2015 at 01:56:01AM -0300, James Almer wrote: > >>>>> It's not an installed header. Use libavutil/avconfig.h instead. > >>>> > >>>> assuming noone objects to this "hack" ... ugly but it should fix the > >>>> build so ok > >>> > >>> Yes, i agree it's kinda ugly. What about this instead? > >> > >> LGTM but i dont have opencl setup so havnt tested it > >> > > Hi > > > > diff --git a/libavutil/opencl.h b/libavutil/opencl.h > > index 4655cba..0b7b8d4 100644 > > --- a/libavutil/opencl.h > > +++ b/libavutil/opencl.h > > @@ -32,11 +32,10 @@ > > #ifndef LIBAVUTIL_OPENCL_H > > #define LIBAVUTIL_OPENCL_H > > > > -#include "config.h" > > -#if HAVE_CL_CL_H > > -#include > > -#else > > +#ifdef __APPLE__ > > #include > > +#else > > +#include > > #endif > > #include > > #include "dict.h" > > just this patch right? I can test it, but I don't have apple platform. > > Yes. > The CL_cl_h check in configure could also be removed alongside this since > it wouldn't > be necessary anymore. > Hi Thanks, so I merge the patch above then compile ffmpeg to test right? I want to clear the way of testing. Thanks Best regards > > https://www.khronos.org/registry/cl/ mentions that the OpenCL/cl.h path > is exclusive > to MacOSX, so i think the patch should be good to finally get the > libavutil/opencl.h > header work for api users. > ___ > 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: don't include config.h
2015-01-09 5:54 GMT+08:00 Thilo Borgmann : > Am 08.01.15 17:43, schrieb James Almer: > > On 08/01/15 4:52 AM, Wei Gao wrote: > >> 2015-01-08 10:10 GMT+08:00 James Almer : > >> > >>> On 07/01/15 10:55 PM, Wei Gao wrote: > >>>> 2015-01-08 8:42 GMT+08:00 Michael Niedermayer : > >>>> > >>>>> On Wed, Jan 07, 2015 at 05:44:41PM -0300, James Almer wrote: > >>>>>> On 06/01/15 11:27 PM, Michael Niedermayer wrote: > >>>>>>> On Tue, Jan 06, 2015 at 01:56:01AM -0300, James Almer wrote: > >>>>>>>> It's not an installed header. Use libavutil/avconfig.h instead. > >>>>>>> > >>>>>>> assuming noone objects to this "hack" ... ugly but it should fix > the > >>>>>>> build so ok > >>>>>> > >>>>>> Yes, i agree it's kinda ugly. What about this instead? > >>>>> > >>>>> LGTM but i dont have opencl setup so havnt tested it > >>>>> > >>>> Hi > >>>> > >>>> diff --git a/libavutil/opencl.h b/libavutil/opencl.h > >>>> index 4655cba..0b7b8d4 100644 > >>>> --- a/libavutil/opencl.h > >>>> +++ b/libavutil/opencl.h > >>>> @@ -32,11 +32,10 @@ > >>>> #ifndef LIBAVUTIL_OPENCL_H > >>>> #define LIBAVUTIL_OPENCL_H > >>>> > >>>> -#include "config.h" > >>>> -#if HAVE_CL_CL_H > >>>> -#include > >>>> -#else > >>>> +#ifdef __APPLE__ > >>>> #include > >>>> +#else > >>>> +#include > >>>> #endif > >>>> #include > >>>> #include "dict.h" > >>>> just this patch right? I can test it, but I don't have apple platform. > >>> > >>> Yes. > >>> The CL_cl_h check in configure could also be removed alongside this > since > >>> it wouldn't > >>> be necessary anymore. > >>> > >> Hi > >> Thanks, so I merge the patch above then compile ffmpeg to test right? > >> I want to clear the way of testing. > >> > >> Thanks > >> Best regards > > > > Yes > > The patch works for me on OSX 10.10.1 > Compiled and tested (unsharp=7:7:2:opencl=1). > Hi The patch works for me on Mingw and Linux Thanks Best Regards > > -Thilo > ___ > 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: autodetect OpenCL headers and ICD loader
2015-05-28 11:28 GMT+08:00 Gupta, Maneesh : > Attached is a patch that enables configure to autodetect the presence of > OpenCL headers and ICD loader. If the necessary headers are found, the > OpenCL infrastructure compilation is enabled as well. Note that this does > not modify the runtime behavior in any way. Execution of the OpenCL code > path still requires the user to explicitly enable it. > > Please review the patch and share your comments on the same. > Hi I have review the code, and merge the patch for testing, it can auto detect the OpenCL configuration. It looks good to me. Thanks Best regards > > - Maneesh > > ___ > 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
2015-10-13 18:27 GMT+08:00 Timo Rothenpieler : > 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 >> > > I tested this filter on Nvidia on Linux, using driver 355 and on the Intel > CPU-based OpenCL SDK so far. > Using floats potentially has an impact on the keying quality. > Hi I have check the error, for some card, yes, just like what I said above, some cards does not support double type, so we must check the opencl extension: cl_khr_fp64 before the kernel compile. If the device support, we use GPU, else, we use CPU or use float type, Is it OK? 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
2015-10-14 14:31 GMT+08:00 Timo Rothenpieler : > Hi >> >> I have check the error, for some card, yes, just like what I said above, >> some cards does not support double type, so we must check the opencl >> extension: cl_khr_fp64 before the kernel compile. If the device support, >> we use GPU, else, we use CPU or use float type, Is it OK? >> >> Thanks >> Best regards >> >> > Of course, if there's a way to only fall back to floats if doubles are not > available, that'd be preferable. > Hi A simple idea is that 1. Check whether the device support cl_khr_fp64 2. Set a macro in build option. you can reference the unsharp filter, the code is as follow: snprintf(build_opts, 96, "-D LU_RADIUS_X=%d -D LU_RADIUS_Y=%d -D CH_RADIUS_X=%d -D CH_RADIUS_Y=%d", 2*unsharp->luma.steps_x+1, 2*unsharp->luma.steps_y+1, 2*unsharp->chroma.steps_x+1, 2*unsharp->chroma.steps_y+1); unsharp->opencl_ctx.program = av_opencl_compile("unsharp", build_opts); use the macro to decide whether to use double or float at the compile stage Do you think it is OK? Thanks Best regards ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 3/4] opencl: Use "opencl" as log context name
2015-10-14 12:48 GMT+08:00 Timothy Gu : > All other classes use lowercase names. > --- > libavutil/opencl.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/libavutil/opencl.c b/libavutil/opencl.c > index f720ce0..62706f3 100644 > --- a/libavutil/opencl.c > +++ b/libavutil/opencl.c > @@ -84,7 +84,7 @@ static const AVOption opencl_options[] = { > }; > > static const AVClass openclutils_class = { > -.class_name= "OPENCLUTILS", > +.class_name= "opencl", > .option= opencl_options, > .item_name = av_default_item_name, > .version = LIBAVUTIL_VERSION_INT, > -- > 2.1.4 > Look good to me Thanks > > ___ > 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
2015-09-30 3:45 GMT+08:00 Timo Rothenpieler : > > Signed-off-by: Timo Rothenpieler > > --- > > doc/filters.texi | 5 + > > libavfilter/chromakey_opencl_kernel.h | 98 +++ > > libavfilter/opencl_allkernels.c | 2 + > > libavfilter/vf_chromakey.c| 179 > +- > > 4 files changed, 283 insertions(+), 1 deletion(-) > > create mode 100644 libavfilter/chromakey_opencl_kernel.h > > > > diff --git a/doc/filters.texi b/doc/filters.texi > > index 044876c..4faf4b9 100644 > > --- a/doc/filters.texi > > +++ b/doc/filters.texi > > @@ -3734,6 +3734,11 @@ Signals that the color passed is already in YUV > instead of RGB. > > > > Litteral colors like "green" or "red" don't make sense with this > enabled anymore. > > This can be used to pass exact YUV values as hexadecimal numbers. > > + > > +@item opencl > > +If set to 1, specify using OpenCL capabilities, only available if > > +FFmpeg was configured with @code{--enable-opencl}. Default value is 0. > > + > > @end table > > > > @subsection Examples > > diff --git a/libavfilter/chromakey_opencl_kernel.h > b/libavfilter/chromakey_opencl_kernel.h > > new file mode 100644 > > index 000..56bbc79 > > --- /dev/null > > +++ b/libavfilter/chromakey_opencl_kernel.h > > @@ -0,0 +1,98 @@ > > +/* > > + * Copyright (c) 2015 Timo Rothenpieler > > + * > > + * This file is part of FFmpeg. > > + * > > + * FFmpeg is free software; you can redistribute it and/or > > + * modify it under the terms of the GNU Lesser General Public > > + * License as published by the Free Software Foundation; either > > + * version 2.1 of the License, or (at your option) any later version. > > + * > > + * FFmpeg is distributed in the hope that it will be useful, > > + * but WITHOUT ANY WARRANTY; without even the implied warranty of > > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU > > + * Lesser General Public License for more details. > > + * > > + * You should have received a copy of the GNU Lesser General Public > > + * License along with FFmpeg; if not, write to the Free Software > > + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA > 02110-1301 USA > > + */ > > + > > +#ifndef AVFILTER_CHROMAKEY_OPENCL_KERNEL_H > > +#define AVFILTER_CHROMAKEY_OPENCL_KERNEL_H > > + > > +#include "libavutil/opencl.h" > > + > > +const char *ff_kernel_chromakey_opencl = AV_OPENCL_KERNEL( > > + > > +inline unsigned char get_pixel(global unsigned char *src, > > + int x, > > + int y, > > + int w, > > + int h, > > + int linesize, > > + int hsub_log2, > > + int vsub_log2, > > + unsigned char def) > > +{ > > +if (x < 0 || x >= w || y < 0 || x >= w) > > +return def; > > + > > +x >>= hsub_log2; > > +y >>= vsub_log2; > > + > > +return src[linesize * y + x]; > > +} > > + > > +kernel void chromakey(global unsigned char *src_u, > > + global unsigned char *src_v, > > + global unsigned char *dst, > > + int linesize_u, > > + int linesize_v, > > + int linesize_a, > > + int height, > > + int width, > > + int hsub_log2, > > + int vsub_log2, > > + unsigned char chromakey_u, > > + unsigned char chromakey_v, > > + float similarity, > > + float blend > > + ) > > +{ > > +int x = get_global_id(0); > > +int y = get_global_id(1); > > +unsigned char res; > > + > > +int xo, yo, du, dv; > > +double diff = 0.0; > > + > > +if (x >= width || y >= height) > > +return; > > + > > +for (yo = 0; yo < 3; yo++) { > > +for (xo = 0; xo < 3; xo++) { > > +du = get_pixel(src_u, x + xo - 1, y + yo - 1, width, > height, linesize_u, hsub_log2, vsub_log2, chromakey_u); > > +dv = get_pixel(src_v, x + xo - 1, y + yo - 1, width, > height, linesize_v, hsub_log2, vsub_log2, chromakey_v); > > + > > +du -= chromakey_u; > > +dv -= chromakey_v; > > + > > +diff += sqrt((du * du + dv * dv) / (double)(255.0 * 255.0)); > > +} > > +} > > + > > +diff /= 9.0; > > + > > +if (blend > 0.0001) { > > +res = clamp((diff - similarity) / blend, 0.0, 1.0) * 255.0; > > +} else { > > +res = (diff > similarity) ? 255 : 0; > > +} > > + > > +dst[linesize_a * y + x] = res; > > +} > > + > > +); > > + > > +#endif /* AVFILTER_CHROMAKEY_OPENCL_KERNEL_H */ > > diff --git a/libavfilter/opencl_allkernels.c > b/libavfilter/opencl_allkernels.c > > index 6d80fa8..fc05e66 100644 > > --
Re: [FFmpeg-devel] [PATCH] is_compiled flag not being cleared in av_opencl_uninit
2015-03-05 8:48 GMT+08:00 Srikanth G : > When OpenCL kernels are compiled, is_compiled flag is being set for each > kernel. But, in opencl uninit, this flag is not being cleared. > This causes an error when an OpenCL kernel is tried on different OpenCL > devices on same platform. > > Here is the patch with a fix > > --- > libavutil/opencl.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/libavutil/opencl.c b/libavutil/opencl.c > index 36cb6fe..a56029c 100644 > --- a/libavutil/opencl.c > +++ b/libavutil/opencl.c > @@ -611,6 +611,9 @@ void av_opencl_uninit(void) > } > opencl_ctx.context = NULL; > } > + for (i = 0; i < opencl_ctx.kernel_code_count; i++) { > +opencl_ctx.kernel_code[i].is_compiled = 0; > +} > free_device_list(&opencl_ctx.device_list); > end: > if (opencl_ctx.init_count <= 0) > > Please incorporate this change. > Let me know if more info is needed regarding this. > Looks good to me. Thanks > > > Thanks, > Srikanth > ___ > 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