[FFmpeg-devel] [PATCH] lavfi: add inverse telecine filter
Michael Niedermayer
michaelni at gmx.at
Fri Mar 27 12:39:49 CET 2015
On Fri, Mar 27, 2015 at 11:07:18AM +0530, Himangi Saraogi wrote:
> ---
> Changelog | 1 +
> doc/filters.texi | 27 ++++
> libavfilter/Makefile | 1 +
> libavfilter/allfilters.c | 1 +
> libavfilter/vf_detelecine.c | 345 ++++++++++++++++++++++++++++++++++++++++++++
> 5 files changed, 375 insertions(+)
> create mode 100644 libavfilter/vf_detelecine.c
>
> diff --git a/Changelog b/Changelog
> index b0d0414..81c6eab 100644
> --- a/Changelog
> +++ b/Changelog
> @@ -9,6 +9,7 @@ version <next>:
> - libdcadec wrapper
> - Drop support for nvenc API before 5.0
> - nvenc H265 encoder
> +- Detelecine filter
>
>
> version 2.6:
> diff --git a/doc/filters.texi b/doc/filters.texi
> index f2999f2..15f8ed5 100644
> --- a/doc/filters.texi
> +++ b/doc/filters.texi
> @@ -3728,6 +3728,33 @@ FFmpeg was configured with @code{--enable-opencl}. Default value is 0.
>
> @end table
>
> + at section detelecine
> +
> +Apply an exact inverse of the telecine operation. It requires a predefined
> +pattern specified using the pattern option which must be the same as that passed
> +to the telecine filter.
> +
> +This filter accepts the following options:
> +
> + at table @option
> + at item first_field
> + at table @samp
> + at item top, t
> +top field first
> + at item bottom, b
> +bottom field first
> +The default value is @code{top}.
> + at end table
> +
> + at item pattern
> +A string of numbers representing the pulldown pattern you wish to apply.
> +The default value is @code{23}.
> +
> + at item start_frame
> +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}.
> + at end table
> +
> @section drawbox
>
> Draw a colored box on the input image.
> diff --git a/libavfilter/Makefile b/libavfilter/Makefile
> index 2cde029..73e7adf 100644
> --- a/libavfilter/Makefile
> +++ b/libavfilter/Makefile
> @@ -112,6 +112,7 @@ OBJS-$(CONFIG_DECIMATE_FILTER) += vf_decimate.o
> OBJS-$(CONFIG_DEJUDDER_FILTER) += vf_dejudder.o
> OBJS-$(CONFIG_DELOGO_FILTER) += vf_delogo.o
> OBJS-$(CONFIG_DESHAKE_FILTER) += vf_deshake.o
> +OBJS-$(CONFIG_DETELECINE_FILTER) += vf_detelecine.o
> OBJS-$(CONFIG_DRAWBOX_FILTER) += vf_drawbox.o
> OBJS-$(CONFIG_DRAWGRID_FILTER) += vf_drawbox.o
> OBJS-$(CONFIG_DRAWTEXT_FILTER) += vf_drawtext.o
> diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
> index 0288082..6bc01c5 100644
> --- a/libavfilter/allfilters.c
> +++ b/libavfilter/allfilters.c
> @@ -128,6 +128,7 @@ void avfilter_register_all(void)
> REGISTER_FILTER(DEJUDDER, dejudder, vf);
> REGISTER_FILTER(DELOGO, delogo, vf);
> REGISTER_FILTER(DESHAKE, deshake, vf);
> + REGISTER_FILTER(DETELECINE, detelecine, vf);
> REGISTER_FILTER(DRAWBOX, drawbox, vf);
> REGISTER_FILTER(DRAWGRID, drawgrid, vf);
> REGISTER_FILTER(DRAWTEXT, drawtext, vf);
> diff --git a/libavfilter/vf_detelecine.c b/libavfilter/vf_detelecine.c
> new file mode 100644
> index 0000000..27463fe
> --- /dev/null
> +++ b/libavfilter/vf_detelecine.c
> @@ -0,0 +1,345 @@
> +/*
> + * Copyright (c) 2015 Himangi Saraogi <himangi774 at gmail.com>
> + *
> + * This file is part of FFmpeg.
> + *
> + * FFmpeg is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU Lesser General Public
> + * License as published by the Free Software Foundation; either
> + * version 2.1 of the License, or (at your option) any later version.
> + *
> + * FFmpeg is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
> + * Lesser General Public License for more details.
> + *
> + * You should have received a copy of the GNU Lesser General Public
> + * License along with FFmpeg; if not, write to the Free Software
> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
> + */
> +
> +/**
> + * @file detelecine filter.
> + */
> +
> +
> +#include "libavutil/avstring.h"
> +#include "libavutil/imgutils.h"
> +#include "libavutil/opt.h"
> +#include "libavutil/pixdesc.h"
> +#include "avfilter.h"
> +#include "formats.h"
> +#include "internal.h"
> +#include "video.h"
> +
> +typedef struct {
> + const AVClass *class;
> + int first_field;
> + char *pattern;
> + int start_frame;
> + unsigned int pattern_pos;
> + unsigned int nskip_fields;
> + int64_t start_time;
> +
> + AVRational pts;
> + double ts_unit;
this should be a AVRational or some int64_t / int64_t in case there is
insufficient precission in AVRational.
floating point should be avoided so that the same values are
produced on every platform, which is important for regression testig
[...]
> + frame->pts = ((s->start_time == AV_NOPTS_VALUE) ? 0 : s->start_time) +
> + outlink->frame_count * s->ts_unit;
this could use av_rescale()
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
There will always be a question for which you do not know the correct answer.
-------------- 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/20150327/0fe25dd0/attachment.asc>
More information about the ffmpeg-devel
mailing list