Since OpenCL filters are not able to access frame data in normal memory, all frame data needs to be uploaded(@ref{hwupload}) to hardware surfaces connected to the appropriate device before being used and then downloaded(@ref{hwdownload}) back to normal memory. Note that @ref{hwupload} will upload to a surface with the same layout as the software frame, so it may be necessary to add a @ref{format} filter immediately before to get the input into the right format and @ref{hwdownload} does not support all formats on the output - it may be necessary to insert an additional @ref{format} filter immediately following in the graph to get the output in a supported format.
@section avgblur_opencl
Apply average blur filter.
The filter accepts the following options:
@table @option
@item sizeX
Set horizontal radius size.
Range is @code{[1, 1024]} and default value is @code{1}.
@item planes
Set which planes to filter. Default value is @code{0xf}, by which all planes are processed.
@item sizeY
Set vertical radius size. Range is @code{[1, 1024]} and default value is @code{0}. If zero, @code{sizeX} value will be used.
@end table
@subsection Example
@itemize
@item
Apply average blur filter with horizontal and vertical size of 3, setting each pixel of the output to the average value of the 7x7 region centered on it in the input. For pixels on the edges of the image, the region does not extend beyond the image boundaries, and so out-of-range coordinates are not used in the calculations.
Set an expression for the box radius in pixels used for blurring the
corresponding input plane.
The radius value must be a non-negative number, and must not be
greater than the value of the expression @code{min(w,h)/2} for the
luma and alpha planes, and of @code{min(cw,ch)/2} for the chroma
planes.
Default value for @option{luma_radius} is "2". If not specified,
@option{chroma_radius} and @option{alpha_radius} default to the
corresponding value set for @option{luma_radius}.
The expressions can contain the following constants:
@table @option
@item w
@item h
The input width and height in pixels.
@item cw
@item ch
The input chroma image width and height in pixels.
@item hsub
@item vsub
The horizontal and vertical chroma subsample values. For example, for the
pixel format "yuv422p", @var{hsub} is 2 and @var{vsub} is 1.
@end table
@item luma_power, lp
@item chroma_power, cp
@item alpha_power, ap
Specify how many times the boxblur filter is applied to the
corresponding plane.
Default value for @option{luma_power} is 2. If not specified,
@option{chroma_power} and @option{alpha_power} default to the
corresponding value set for @option{luma_power}.
A value of 0 will disable the effect.
@end table
@subsection Examples
Apply boxblur filter, setting each pixel of the output to the average value of box-radiuses @var{luma_radius}, @var{chroma_radius}, @var{alpha_radius} for each plane respectively. The filter will apply @var{luma_power}, @var{chroma_power}, @var{alpha_power} times onto the corresponding plane. For pixels on the edges of the image, the radius does not extend beyond the image boundaries, and so out-of-range coordinates are not used in the calculations.
@itemize
@item
Apply a boxblur filter with the luma, chroma, and alpha radius
set to 2 and luma, chroma, and alpha power set to 3. The filter will run 3 times with box-radius set to 2 for every plane of the image.
This filter replaces the pixel by the local(3x3) maximum.
It accepts the following options:
@table @option
@item threshold0
@item threshold1
@item threshold2
@item threshold3
Limit the maximum change for each plane. Range is @code{[0, 65535]} and default value is @code{65535}.
If @code{0}, plane will remain unchanged.
@item coordinates
Flag which specifies the pixel to refer to.
Range is @code{[0, 255]} and default value is @code{255}, i.e. all eight pixels are used.
Flags to local 3x3 coordinates region centered on @code{x}:
1 2 3
4 x 5
6 7 8
@end table
@subsection Example
@itemize
@item
Apply dilation filter with threshold0 set to 30, threshold1 set 40, threshold2 set to 50 and coordinates set to 231, setting each pixel of the output to the local maximum between pixels: 1, 2, 3, 6, 7, 8 of the 3x3 region centered on it in the input. If the difference between input pixel and local maximum is more then threshold of the corresponding plane, output pixel will be set to input pixel + threshold of corresponding plane.
This filter replaces the pixel by the local(3x3) minimum.
It accepts the following options:
@table @option
@item threshold0
@item threshold1
@item threshold2
@item threshold3
Limit the maximum change for each plane. Range is @code{[0, 65535]} and default value is @code{65535}.
If @code{0}, plane will remain unchanged.
@item coordinates
Flag which specifies the pixel to refer to.
Range is @code{[0, 255]} and default value is @code{255}, i.e. all eight pixels are used.
Flags to local 3x3 coordinates region centered on @code{x}:
1 2 3
4 x 5
6 7 8
@end table
@subsection Example
@itemize
@item
Apply erosion filter with threshold0 set to 30, threshold1 set 40, threshold2 set to 50 and coordinates set to 231, setting each pixel of the output to the local minimum between pixels: 1, 2, 3, 6, 7, 8 of the 3x3 region centered on it in the input. If the difference between input pixel and local minimum is more then threshold of the corresponding plane, output pixel will be set to input pixel - threshold of corresponding plane.