Re: [FFmpeg-devel] [PATCH] [PATCH] lavfi: add inverse telecine filter
On Tue, Mar 17, 2015 at 12:44:07AM +0530, Himangi Saraogi wrote: On 14 March 2015 at 09:42, Michael Niedermayer michae...@gmx.at wrote: On Wed, Mar 11, 2015 at 03:20:47AM +0530, Himangi Saraogi wrote: This is an exact inverse of the telecine filter unlike previously existing pullup and fieldmatch ones. The algorithm was briefly discussed with Carl. The algorithm is not completely tested, though I do have a some sample suggestions and will be testing on them soon. Documentation is yet to be added. --- Changelog | 1 + libavfilter/Makefile| 1 + libavfilter/allfilters.c| 1 + libavfilter/vf_detelecine.c | 323 4 files changed, 326 insertions(+) create mode 100644 libavfilter/vf_detelecine.c diff --git a/Changelog b/Changelog index e88359d..341faca 100644 --- a/Changelog +++ b/Changelog @@ -3,6 +3,7 @@ releases are sorted from youngest to oldest. version next: - FFT video filter +- Detelecine filter version 2.6: diff --git a/libavfilter/Makefile b/libavfilter/Makefile index b184f07..399072c 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 043ac56..2e4e2f6 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 000..ce9ba74 --- /dev/null +++ b/libavfilter/vf_detelecine.c @@ -0,0 +1,323 @@ +/* + * Copyright (c) 2015 Himangi Saraogi himangi...@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; +unsigned int pattern_pos; +unsigned int nskip_fields; + +AVRational pts; +double ts_unit; +int occupied; + +int nb_planes; +int planeheight[4]; +int stride[4]; + +AVFrame *frame; +AVFrame *temp; +} DetelecineContext; + +#define OFFSET(x) offsetof(DetelecineContext, x) +#define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM + +static const AVOption detelecine_options[] = { +{first_field, select first field, OFFSET(first_field), AV_OPT_TYPE_INT, {.i64=0}, 0, 1, FLAGS, field}, +{top,select top field first,0, AV_OPT_TYPE_CONST, {.i64=0}, 0, 0, FLAGS, field}, +{t, select top field first,0, AV_OPT_TYPE_CONST, {.i64=0}, 0, 0, FLAGS, field}, +{bottom, select bottom field first, 0, AV_OPT_TYPE_CONST, {.i64=1}, 0, 0, FLAGS, field}, +{b, select bottom field first, 0, AV_OPT_TYPE_CONST, {.i64=1}, 0, 0, FLAGS, field}, +
Re: [FFmpeg-devel] [PATCH] [PATCH] lavfi: add inverse telecine filter
On 14 March 2015 at 09:42, Michael Niedermayer michae...@gmx.at wrote: On Wed, Mar 11, 2015 at 03:20:47AM +0530, Himangi Saraogi wrote: This is an exact inverse of the telecine filter unlike previously existing pullup and fieldmatch ones. The algorithm was briefly discussed with Carl. The algorithm is not completely tested, though I do have a some sample suggestions and will be testing on them soon. Documentation is yet to be added. --- Changelog | 1 + libavfilter/Makefile| 1 + libavfilter/allfilters.c| 1 + libavfilter/vf_detelecine.c | 323 4 files changed, 326 insertions(+) create mode 100644 libavfilter/vf_detelecine.c diff --git a/Changelog b/Changelog index e88359d..341faca 100644 --- a/Changelog +++ b/Changelog @@ -3,6 +3,7 @@ releases are sorted from youngest to oldest. version next: - FFT video filter +- Detelecine filter version 2.6: diff --git a/libavfilter/Makefile b/libavfilter/Makefile index b184f07..399072c 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 043ac56..2e4e2f6 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 000..ce9ba74 --- /dev/null +++ b/libavfilter/vf_detelecine.c @@ -0,0 +1,323 @@ +/* + * Copyright (c) 2015 Himangi Saraogi himangi...@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; +unsigned int pattern_pos; +unsigned int nskip_fields; + +AVRational pts; +double ts_unit; +int occupied; + +int nb_planes; +int planeheight[4]; +int stride[4]; + +AVFrame *frame; +AVFrame *temp; +} DetelecineContext; + +#define OFFSET(x) offsetof(DetelecineContext, x) +#define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM + +static const AVOption detelecine_options[] = { +{first_field, select first field, OFFSET(first_field), AV_OPT_TYPE_INT, {.i64=0}, 0, 1, FLAGS, field}, +{top,select top field first,0, AV_OPT_TYPE_CONST, {.i64=0}, 0, 0, FLAGS, field}, +{t, select top field first,0, AV_OPT_TYPE_CONST, {.i64=0}, 0, 0, FLAGS, field}, +{bottom, select bottom field first, 0, AV_OPT_TYPE_CONST, {.i64=1}, 0, 0, FLAGS, field}, +{b, select bottom field first, 0, AV_OPT_TYPE_CONST, {.i64=1}, 0, 0, FLAGS, field}, +{pattern, pattern that describe for how many fields a frame is to be displayed, OFFSET(pattern), AV_OPT_TYPE_STRING, {.str=23}, 0, 0, FLAGS}, +{NULL} +}; +
Re: [FFmpeg-devel] [PATCH] [PATCH] lavfi: add inverse telecine filter
On Wed, Mar 11, 2015 at 03:20:47AM +0530, Himangi Saraogi wrote: This is an exact inverse of the telecine filter unlike previously existing pullup and fieldmatch ones. The algorithm was briefly discussed with Carl. The algorithm is not completely tested, though I do have a some sample suggestions and will be testing on them soon. Documentation is yet to be added. --- Changelog | 1 + libavfilter/Makefile| 1 + libavfilter/allfilters.c| 1 + libavfilter/vf_detelecine.c | 323 4 files changed, 326 insertions(+) create mode 100644 libavfilter/vf_detelecine.c diff --git a/Changelog b/Changelog index e88359d..341faca 100644 --- a/Changelog +++ b/Changelog @@ -3,6 +3,7 @@ releases are sorted from youngest to oldest. version next: - FFT video filter +- Detelecine filter version 2.6: diff --git a/libavfilter/Makefile b/libavfilter/Makefile index b184f07..399072c 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 043ac56..2e4e2f6 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 000..ce9ba74 --- /dev/null +++ b/libavfilter/vf_detelecine.c @@ -0,0 +1,323 @@ +/* + * Copyright (c) 2015 Himangi Saraogi himangi...@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; +unsigned int pattern_pos; +unsigned int nskip_fields; + +AVRational pts; +double ts_unit; +int occupied; + +int nb_planes; +int planeheight[4]; +int stride[4]; + +AVFrame *frame; +AVFrame *temp; +} DetelecineContext; + +#define OFFSET(x) offsetof(DetelecineContext, x) +#define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM + +static const AVOption detelecine_options[] = { +{first_field, select first field, OFFSET(first_field), AV_OPT_TYPE_INT, {.i64=0}, 0, 1, FLAGS, field}, +{top,select top field first,0, AV_OPT_TYPE_CONST, {.i64=0}, 0, 0, FLAGS, field}, +{t, select top field first,0, AV_OPT_TYPE_CONST, {.i64=0}, 0, 0, FLAGS, field}, +{bottom, select bottom field first, 0, AV_OPT_TYPE_CONST, {.i64=1}, 0, 0, FLAGS, field}, +{b, select bottom field first, 0, AV_OPT_TYPE_CONST, {.i64=1}, 0, 0, FLAGS, field}, +{pattern, pattern that describe for how many fields a frame is to be displayed, OFFSET(pattern), AV_OPT_TYPE_STRING, {.str=23}, 0, 0, FLAGS}, +{NULL} +}; + +AVFILTER_DEFINE_CLASS(detelecine); + +static av_cold int init(AVFilterContext *ctx) +{ +DetelecineContext *s = ctx-priv; +const char *p; +int max = 0; + +if (!strlen(s-pattern)) { +
Re: [FFmpeg-devel] [PATCH] [PATCH] lavfi: add inverse telecine filter
Himangi Saraogi himangi774 at gmail.com writes: I am collecting suitable test samples You should only test the filter with samples created with the telecine filter. To test the start point in the telecine sequence, use -ss 0.x -vcodec copy (or similar options) to cut away the first frames. The qualification task for the VDPAU filter is not to write a new telecine detection algorithm: If we hadn't already two filters, this would be a whole GSoC project. Carl Eugen ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] [PATCH] lavfi: add inverse telecine filter
Timothy Gu timothygu99 at gmail.com writes: This is an exact inverse of the telecine filter unlike previously existing pullup and fieldmatch ones. What's the difference between the three seemingly similar filters? The other two are similar (speed and license are different): They try to detect the telecined frames and reconstruct the original progressive stream even if cuts were made. They sometimes miss telecined frames. This filter does not detect anything, it applies a fixed pattern to the input stream: It fails very badly if the input was cut (and the pattern changed), it works perfectly for streams that contain a constant pattern. Carl Eugen ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] [PATCH] lavfi: add inverse telecine filter
On 11 March 2015 at 15:10, Clément Bœsch u...@pkh.me wrote: On Wed, Mar 11, 2015 at 07:12:16AM +, Carl Eugen Hoyos wrote: Timothy Gu timothygu99 at gmail.com writes: This is an exact inverse of the telecine filter unlike previously existing pullup and fieldmatch ones. What's the difference between the three seemingly similar filters? The other two are similar (speed and license are different): They try to detect the telecined frames and reconstruct the original progressive stream even if cuts were made. They sometimes miss telecined frames. This filter does not detect anything, it applies a fixed pattern to the input stream: It fails very badly if the input was cut (and the pattern changed), it works perfectly for streams that contain a constant pattern. Did this happen even once with real material? We aim to have it work perfectly for such streams. It has not been tested on a proper telecine stream yet. As the description mentions, this work is still under progress. I am collecting suitable test samples and would like to discuss the algorithm for any suggestions. Should I add the algorithm in the description to gain feedback on it? Carl Eugen -- Clément B. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] [PATCH] lavfi: add inverse telecine filter
On Wed, Mar 11, 2015 at 07:12:16AM +, Carl Eugen Hoyos wrote: Timothy Gu timothygu99 at gmail.com writes: This is an exact inverse of the telecine filter unlike previously existing pullup and fieldmatch ones. What's the difference between the three seemingly similar filters? The other two are similar (speed and license are different): They try to detect the telecined frames and reconstruct the original progressive stream even if cuts were made. They sometimes miss telecined frames. This filter does not detect anything, it applies a fixed pattern to the input stream: It fails very badly if the input was cut (and the pattern changed), it works perfectly for streams that contain a constant pattern. Did this happen even once with real material? Carl Eugen -- Clément B. pgpEMpEqlJoN0.pgp Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] [PATCH] lavfi: add inverse telecine filter
On 11 March 2015 at 04:00, Carl Eugen Hoyos ceho...@ag.or.at wrote: Himangi Saraogi himangi774 at gmail.com writes: +{pattern, pattern that describe for how many fields a frame is to be displayed, OFFSET(pattern), This works fine in a quick test. An additional parameter could be start_frame to allow using the filter after a stream was cut. For example: Assuming the default 32 value for telecine, your current detelecine filter only works if the stream is uncut or if exactly a multiple of five frames was cut (from the beginning). Add an option that allows to choose the starting point in the telecine pattern. Sure, I missed this. Warnings are shown when vf_detelecine.c is compiled, please remove them. Fixed locally. Another important clarification is for the case when the pattern has a 1 or a 0. In the 0 case, I am currently just missing the frames in the output as there is no way to recover them. However, for the 1 case, one of the fields of a frame is missing. in the output, I can fill the second field with the nearest frame, but is there a better solution? Thank you, Carl Eugen ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] [PATCH] lavfi: add inverse telecine filter
On Tue, Mar 10, 2015 at 2:52 PM Himangi Saraogi himangi...@gmail.com wrote: This is an exact inverse of the telecine filter unlike previously existing pullup and fieldmatch ones. What's the difference between the three seemingly similar filters? Timothy ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] [PATCH] lavfi: add inverse telecine filter
This is an exact inverse of the telecine filter unlike previously existing pullup and fieldmatch ones. The algorithm was briefly discussed with Carl. The algorithm is not completely tested, though I do have a some sample suggestions and will be testing on them soon. Documentation is yet to be added. --- Changelog | 1 + libavfilter/Makefile| 1 + libavfilter/allfilters.c| 1 + libavfilter/vf_detelecine.c | 323 4 files changed, 326 insertions(+) create mode 100644 libavfilter/vf_detelecine.c diff --git a/Changelog b/Changelog index e88359d..341faca 100644 --- a/Changelog +++ b/Changelog @@ -3,6 +3,7 @@ releases are sorted from youngest to oldest. version next: - FFT video filter +- Detelecine filter version 2.6: diff --git a/libavfilter/Makefile b/libavfilter/Makefile index b184f07..399072c 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 043ac56..2e4e2f6 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 000..ce9ba74 --- /dev/null +++ b/libavfilter/vf_detelecine.c @@ -0,0 +1,323 @@ +/* + * Copyright (c) 2015 Himangi Saraogi himangi...@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; +unsigned int pattern_pos; +unsigned int nskip_fields; + +AVRational pts; +double ts_unit; +int occupied; + +int nb_planes; +int planeheight[4]; +int stride[4]; + +AVFrame *frame; +AVFrame *temp; +} DetelecineContext; + +#define OFFSET(x) offsetof(DetelecineContext, x) +#define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM + +static const AVOption detelecine_options[] = { +{first_field, select first field, OFFSET(first_field), AV_OPT_TYPE_INT, {.i64=0}, 0, 1, FLAGS, field}, +{top,select top field first,0, AV_OPT_TYPE_CONST, {.i64=0}, 0, 0, FLAGS, field}, +{t, select top field first,0, AV_OPT_TYPE_CONST, {.i64=0}, 0, 0, FLAGS, field}, +{bottom, select bottom field first, 0, AV_OPT_TYPE_CONST, {.i64=1}, 0, 0, FLAGS, field}, +{b, select bottom field first, 0, AV_OPT_TYPE_CONST, {.i64=1}, 0, 0, FLAGS, field}, +{pattern, pattern that describe for how many fields a frame is to be displayed, OFFSET(pattern), AV_OPT_TYPE_STRING, {.str=23}, 0, 0, FLAGS}, +{NULL} +}; + +AVFILTER_DEFINE_CLASS(detelecine); + +static av_cold int init(AVFilterContext *ctx) +{ +DetelecineContext *s = ctx-priv; +const char *p; +int max = 0; + +if (!strlen(s-pattern)) { +av_log(ctx, AV_LOG_ERROR, No pattern provided.\n); +return AVERROR_INVALIDDATA; +} + +for (p = s-pattern; *p; p++) { +if (!av_isdigit(*p)) { +av_log(ctx, AV_LOG_ERROR,
Re: [FFmpeg-devel] [PATCH] [PATCH] lavfi: add inverse telecine filter
Himangi Saraogi himangi774 at gmail.com writes: +{pattern, pattern that describe for how many fields a frame is to be displayed, OFFSET(pattern), This works fine in a quick test. An additional parameter could be start_frame to allow using the filter after a stream was cut. For example: Assuming the default 32 value for telecine, your current detelecine filter only works if the stream is uncut or if exactly a multiple of five frames was cut (from the beginning). Add an option that allows to choose the starting point in the telecine pattern. Warnings are shown when vf_detelecine.c is compiled, please remove them. Thank you, Carl Eugen ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel