[FFmpeg-devel] [PATCH] lavfi: add tdiff filter
Michael Niedermayer
michaelni at gmx.at
Sun Nov 23 01:04:37 CET 2014
On Sat, Nov 22, 2014 at 11:44:29PM +0100, Stefano Sabatini wrote:
> TODO: bump minor
> ---
> Changelog | 1 +
> doc/filters.texi | 4 ++
> libavfilter/Makefile | 1 +
> libavfilter/allfilters.c | 1 +
> libavfilter/vf_tdiff.c | 131 +++++++++++++++++++++++++++++++++++++++++++++++
> 5 files changed, 138 insertions(+)
> create mode 100644 libavfilter/vf_tdiff.c
>
> diff --git a/Changelog b/Changelog
> index 5f38aea..41fdf18 100644
> --- a/Changelog
> +++ b/Changelog
> @@ -15,6 +15,7 @@ version <next>:
> - ffserver supports codec private options
> - creating DASH compatible fragmented MP4, MPEG-DASH segmenting muxer
> - WebP muxer with animated WebP support
> +- tdiff filter
>
>
> version 2.4:
> diff --git a/doc/filters.texi b/doc/filters.texi
> index 8c16c7a..9882da7 100644
> --- a/doc/filters.texi
> +++ b/doc/filters.texi
> @@ -8394,6 +8394,10 @@ Useful for enlarging pixel art images without reducing sharpness.
> @section swapuv
> Swap U & V plane.
>
> + at section tdiff
> +
> +Show difference between consecutive frames.
> +
> @section telecine
>
> Apply telecine process to the video.
> diff --git a/libavfilter/Makefile b/libavfilter/Makefile
> index 2c56e38..3217c99 100644
> --- a/libavfilter/Makefile
> +++ b/libavfilter/Makefile
> @@ -97,6 +97,7 @@ OBJS-$(CONFIG_BLACKDETECT_FILTER) += vf_blackdetect.o
> OBJS-$(CONFIG_BLACKFRAME_FILTER) += vf_blackframe.o
> OBJS-$(CONFIG_BLEND_FILTER) += vf_blend.o dualinput.o framesync.o
> OBJS-$(CONFIG_BOXBLUR_FILTER) += vf_boxblur.o
> +OBJS-$(CONFIG_CDIFF_FILTER) += vf_cdiff.o
[...]
> --- /dev/null
> +++ b/libavfilter/vf_tdiff.c
the name doesnt match
[...]
> +
> +static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
> +{
> + TDiffContext *tdiff = inlink->dst->priv;
> + AVFilterLink *outlink = inlink->dst->outputs[0];
> +
> + if (tdiff->prev_frame) {
> + int i, j;
> +
> + AVFrame *diff = ff_get_video_buffer(outlink, outlink->w, outlink->h);
> + av_frame_copy_props(frame, diff);
> + if (!diff) {
> + av_frame_free(&frame);
> + return AVERROR(ENOMEM);
> + }
> +
> + /* compute difference with previous frame */
> + for (i = 0; i < frame->height; i++) {
> + uint8_t *pdiff = diff ->data[0] + i * diff ->linesize[0];
> + uint8_t *pprev = tdiff->prev_frame->data[0] + i * tdiff->prev_frame->linesize[0];
> + uint8_t *pthis = frame ->data[0] + i * frame ->linesize[0];
> + for (j = 0; j < frame->width; j++) {
> + *pdiff++ = abs(*pthis++ - *pprev++);
a difference that leaves the sign intact might be interresting too
like 128 + *pthis++ - *pprev++ or something like that
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Those who are too smart to engage in politics are punished by being
governed by those who are dumber. -- Plato
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20141123/99951e41/attachment.asc>
More information about the ffmpeg-devel
mailing list