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

Paul B Mahol onemda at gmail.com
Wed Oct 23 17:05:47 CEST 2013


On 10/23/13, Stefano Sabatini <stefasab at gmail.com> wrote:
> On date Wednesday 2013-10-23 14:47:29 +0000, Paul B Mahol encoded:
>> 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.
>
> No they are not, the meaning of the numeric value is not explained at
> all.

Let's pick pixel at location 256x412: values for that pixel for #1 input is
53 and for #2 input it is 178. Destination pixel value will be pixel value at
location: 256+(53-128)x412+(178-128) which is 181x462

>
>>
>> >
>> >> +
>> >> +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...
>
> So is this a ripple effect along the y axis? But yes do not invert
> order of specified input for improved clarity.
>
>>
>> [...]
>>
>> >> +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).
>
> Drop the option if the feature is not implemented.

No way.

> --
> FFmpeg = Faithless Fanciful Minimalistic Ponderous Embarassing Gadget
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>


More information about the ffmpeg-devel mailing list