[FFmpeg-devel] [PATCH] lavfi: add erosion, dilation, deflate & inflate filter

Paul B Mahol onemda at gmail.com
Wed Jul 15 00:54:58 CEST 2015


On 7/14/15, James Darnley <james.darnley at gmail.com> wrote:
> On 2015-07-15 00:15, Paul B Mahol wrote:
>> diff --git a/doc/filters.texi b/doc/filters.texi
>> index 9f7b976..d4d8bad 100644
>> --- a/doc/filters.texi
>> +++ b/doc/filters.texi
>> @@ -3718,6 +3718,24 @@ Set whether or not chroma is considered in the
>> metric calculations. Default is
>>  @code{1}.
>>  @end table
>>
>> + at section deflate
>> +
>> +Apply deflate effect to the video.
>> +
>> +This filter replaces the pixel by the local(3x3) average by taking into
>> account
>> +only values lower than the pixel.
>> +
>> +It accepts the following options:
>> +
>> + at table @option
>> + at item threshold
>> +Allows to limit the maximum change, default is 65535.
>
> Strange phrasing.  Why not just "Limits the maximum change, default is
> 65535"
>
>> + at item planes
>> +Flag which specifies which planes to filter. Default is 15 i.e. all four
>> +planes.
>> + at end table
>
> While this was probably the existing behaviour (assuming this is the
> patch from ubitux), do many other filters use a bit mask for controlling
> which planes are processed?  But to be honest, I don't have a suggestion

Those have nothing to do with ubitux patch. His patch is about generic
convolution. Those above use ffmin/ffmax so they are not in same category IMHO.

> for how else you should do it.  4 separate threshold options, similar to
> removegrain and its modes?

Maybe that is better approach I will think about it.

>
>> @@ -3904,6 +3922,27 @@ A number representing position of the first frame
>> with respect to the telecine
>>  pattern. This is to be used if the stream is cut. The default value is
>> @code{0}.
>>  @end table
>>
>> + at section dilation
>> +
>> +Apply dilation effect to the video.
>> +
>> +This filter replaces the pixel by the local(3x3) maximum.
>> +
>> +It accepts the following options:
>> +
>> + at table @option
>> + at item threshold
>> +Allows to limit the maximum change, default is 65535.
>
> As above.
>
>> + at item coordinates
>> +Flag which specifies the pixel to refer to. Default is 255 i.e. all
>> eight
>> +pixels are used.
>
> You should probably explain which values represent which pixel, i.e.
> tha1 1 is the top left pixel.

Something like this:

 1  2  3
 4     5
 6  7  8

>
>> @@ -4759,6 +4798,27 @@ value.
>>
>>  @end table
>>
>> + at section erosion
>> +
>> +Apply erosion effect to the video.
>> +
>> +This filter replaces the pixel by the local(3x3) minimum.
>> +
>> +It accepts the following options:
>> +
>> + at table @option
>> + at item threshold
>> +Allows to limit the maximum change, default is 65535.
>
> ...
>
>> + at item coordinates
>> +Flag which specifies the pixel to refer to. Default is 255 i.e. all
>> eight
>> +pixels are used.
>
> ...
>
>> @@ -6356,6 +6416,24 @@ Default value is @code{none}.
>>  Swap luma/chroma/alpha fields. Exchange even & odd lines. Default value
>> is @code{0}.
>>  @end table
>>
>> + at section inflate
>> +
>> +Apply inflate effect to the video.
>> +
>> +This filter replaces the pixel by the local(3x3) average by taking into
>> account
>> +only values higher than the pixel.
>> +
>> +It accepts the following options:
>> +
>> + at table @option
>> + at item threshold
>> +Allows to limit the maximum change, default is 65535.
>> +
>> + at item planes
>> +Flag which specifies which planes to filter. Default is 15 i.e. all four
>> +planes.
>> + at end table
>> +
>
> Same comments.
>
>> ...
>
> Despite my comments above I get the feeling that this might be intended
> for programmatic use by other future filters.  If that's the case then I
> guess the options don't have to be user friendly.


More information about the ffmpeg-devel mailing list