[FFmpeg-devel] [PATCH] lavfilter/vf_unsharp: add the OPENCL share buffer for the unsharp video filter

weixuan wang batmanwwx at gmail.com
Tue Aug 6 02:19:59 CEST 2013


This patch has not been reviewed for a long time.
Thanks for reviewing

Best regards

2013/7/27 weixuan wang <batmanwwx at gmail.com>

> * *
> *Hi,*
> * ***
> *I found that there are two video filters having the OPENCL supports in
> the latest trunk. The two video filters are deshake video filter and
> unsharp video filter. when I used all of the two filters with the OPENCL, i
> find out a idea to get a better performance of them.***
> *In these OPENCL filters, they first copy the input frame buffer into the
> input OPENCL buffer like this:***
> *av_opencl_buffer_write_image(unsharp->opencl_ctx.cl_inbuf,***
> *unsharp->opencl_ctx.cl_inbuf_size,0, in->data,
> unsharp->opencl_ctx.in_plane_size,***
> *unsharp->opencl_ctx.plane_num);***
> *the in->data is the input frame buffer and the
> unsharp->opencl_ctx.cl_inbuf is the input OPENCL buffer.***
> *They use the input OPENCL buffer to run the kernel and get the output
> OPENCL buffer. They then copy the output OPENCL buffer into the output
> frame buffer like this:***
> *av_opencl_buffer_read_image(out->data,
> unsharp->opencl_ctx.out_plane_size,***
> *unsharp->opencl_ctx.plane_num, unsharp->opencl_ctx.cl_outbuf,***
> *unsharp->opencl_ctx.cl_outbuf_size);***
> *the out->data is the output frame buffer and the unsharp->opencl_ctx.cl_
> outbuf is the output OPENCL buffer.***
> *if I use two or more video filters with the OPENCL, the time of the data
> copying will be very long. So I have a idea:***
> *if the first video filter is using the OPENCL and the next video filter
> is using the OPENCL too, we can remove the output data copying of the first
> video filter and the input data copying of the next video filter. we can
> directly use the output OPENCL buffer of the first video filter as the
> input OPENCL buffer of the next video filter.***
> *I implement a patch for my idea. This patch is implemented for the
> unsharp video filter. you can run the command:” **ffmpeg -i test.mp4 -vf
> "unsharp=opencl=1,unsharp=opencl=1" -y out.mpg” to test the improvement of
> the performance. *
> *If this patch can be accepted by community, I will continue to implement
> the patch for the deshake video filter.*

More information about the ffmpeg-devel mailing list