[FFmpeg-devel] [PATCH] avfilter: add displace video filter

Paul B Mahol onemda at gmail.com
Wed Oct 23 16:47:29 CEST 2013


On 10/23/13, Stefano Sabatini <stefasab at gmail.com> wrote:
> On date Wednesday 2013-10-23 13:25:26 +0000, Paul B Mahol encoded:
>> Signed-off-by: Paul B Mahol <onemda at gmail.com>
>> ---
>>  doc/filters.texi          |  42 ++++++
>>  libavfilter/Makefile      |   1 +
>>  libavfilter/allfilters.c  |   1 +
>>  libavfilter/vf_displace.c | 325
>> ++++++++++++++++++++++++++++++++++++++++++++++
>>  4 files changed, 369 insertions(+)
>>  create mode 100644 libavfilter/vf_displace.c
>>
>> diff --git a/doc/filters.texi b/doc/filters.texi
>> index 7783807..905cb5a 100644
>> --- a/doc/filters.texi
>> +++ b/doc/filters.texi
>> @@ -3100,6 +3100,48 @@ delogo=x=0:y=0:w=100:h=77:band=10
>>
>>  @end itemize
>>
>> + at section displace
>> +
>> +Displace pixels as indicated by second and third input stream.
>> +
>> +It takes three input streams and output one stream, the first input is
>> the
>> +source and second and third input are displacement maps.
>> +
>
>> +Second input specify for how much to displace pixel at x-axis, while the
>> +third input specify for how much to displace pixel at y-axis.
>
> The second input specifies how much to displace pixels along the
> x-axis, while the third input specifies how much to displace pixels
> along the y-axis.
>
> Also you should describe what's the meaning of the input maps.

I think they are already described above.

>
>> +
>> +A description of the accepted options follows.
>> +
>> + at table @option
>> + at item edge
>> +Set displace behavior for pixels that are out of range.
>> +
>> +Available values are:
>> + at table @samp
>> + at item blank
>> +Missing pixels are replaced by black pixels.
>> +
>> + at item smear
>> +Adjacent pixels will spread out to replace missing pixels.
>> +
>> + at item wrap
>> +Out of range pixels are wrapped so they point to pixels of other side.
>> + at end table
>> +
>> +Default is @samp{smear}.
>> +
>> + at end table
>> +
>> + at subsection Examples
>> +
>> + at itemize
>> + at item
>> +Add ripple effect to input of video size hd720:
>> + at example
>> +ffmpeg -i INPUT -f lavfi -i
>
>> nullsrc=s=hd720,geq='r=128+50*sin(2*PI*X/800):g=128+50*sin(2*PI*X/800):b=128+50*sin(2*PI*X/800)'
>> -f lavfi -i nullsrc=s=hd720,lutrgb=128:128:128
>
> -lavfi '[0][2][1]displace' OUTPUT
>
> [0][1][2] ?

Well, effect would then be something else, I could switch inputs if
that is wanted...

[...]

>> +static const AVOption displace_options[] = {
>> +    { "edge", "set edge mode", OFFSET(edge), AV_OPT_TYPE_INT,
>> {.i64=EDGE_SMEAR}, 0, EDGE_NB-1, FLAGS, "edge" },
>> +    {   "blank", "", 0, AV_OPT_TYPE_CONST, {.i64=EDGE_BLANK}, 0, 0,
>> FLAGS, "edge" },
>> +    {   "smear", "", 0, AV_OPT_TYPE_CONST, {.i64=EDGE_SMEAR}, 0, 0,
>> FLAGS, "edge" },
>> +    {   "wrap" , "", 0, AV_OPT_TYPE_CONST, {.i64=EDGE_WRAP},  0, 0,
>> FLAGS, "edge" },
>> +    { NULL }
>> +};
>
> why is this unused?

I may implement this later (depending on number of bikesheds).

[...]

>> +        srclink->h                       != ylink->h ||
>> +        srclink->sample_aspect_ratio.num !=
>> ylink->sample_aspect_ratio.num ||
>> +        srclink->sample_aspect_ratio.den !=
>> ylink->sample_aspect_ratio.den) {
>
> note: this could be helped with an utility

ff_check_params?

[...]


More information about the ffmpeg-devel mailing list