This is a port of the kerndeint filter (libmpcodecs/vf_kerndeint) by
Donal A. Graft (original avisynth plugin author), and is based on the
work by Jérémy Tran <tran.jeremy.av@gmail.com> done for SOCIS 2012.
... | ... |
@@ -1987,6 +1987,7 @@ frei0r_src_filter_extralibs='$ldl' |
1987 | 1987 |
geq_filter_deps="gpl" |
1988 | 1988 |
hqdn3d_filter_deps="gpl" |
1989 | 1989 |
hue_filter_deps="gpl" |
1990 |
+kerndeint_filter_deps="gpl" |
|
1990 | 1991 |
movie_filter_deps="avcodec avformat" |
1991 | 1992 |
mp_filter_deps="gpl avcodec swscale inline_asm" |
1992 | 1993 |
mptestsrc_filter_deps="gpl" |
... | ... |
@@ -2810,6 +2810,63 @@ If a parameter is omitted, it is kept at its current value. |
2810 | 2810 |
Interlaceing detect filter. This filter tries to detect if the input is |
2811 | 2811 |
interlaced or progressive. Top or bottom field first. |
2812 | 2812 |
|
2813 |
+@section kerndeint |
|
2814 |
+ |
|
2815 |
+Deinterlace input video by applying Donald Graft's adaptive kernel |
|
2816 |
+deinterling. Work on interlaced parts of a video to produce |
|
2817 |
+progressive frames. |
|
2818 |
+ |
|
2819 |
+This filter accepts parameters as a list of @var{key}=@var{value} |
|
2820 |
+pairs, separated by ":". If the key of the first options is omitted, |
|
2821 |
+the arguments are interpreted according to the following syntax: |
|
2822 |
+@var{thresh}:@var{map}:@var{order}:@var{sharp}:@var{twoway}. |
|
2823 |
+ |
|
2824 |
+The description of the accepted parameters follows. |
|
2825 |
+ |
|
2826 |
+@table @option |
|
2827 |
+@item thresh |
|
2828 |
+Set the threshold which affects the filter's tolerance when |
|
2829 |
+determining if a pixel line must be processed. It must be an integer |
|
2830 |
+in the range [0,255] and defaults to 10. A value of 0 will result in |
|
2831 |
+applying the process on every pixels. |
|
2832 |
+ |
|
2833 |
+@item map |
|
2834 |
+Paint pixels exceeding the threshold value to white if set to 1. |
|
2835 |
+Default is 0. |
|
2836 |
+ |
|
2837 |
+@item order |
|
2838 |
+Set the fields order. Swap fields if set to 1, leave fields alone if |
|
2839 |
+0. Default is 0. |
|
2840 |
+ |
|
2841 |
+@item sharp |
|
2842 |
+Enable additional sharpening if set to 1. Default is 0. |
|
2843 |
+ |
|
2844 |
+@item twoway |
|
2845 |
+Enable twoway sharpening if set to 1. Default is 0. |
|
2846 |
+@end table |
|
2847 |
+ |
|
2848 |
+@subsection Examples |
|
2849 |
+ |
|
2850 |
+@itemize |
|
2851 |
+@item |
|
2852 |
+Apply default values: |
|
2853 |
+@example |
|
2854 |
+kerndeint=thresh=10:map=0:order=0:sharp=0:twoway=0 |
|
2855 |
+@end example |
|
2856 |
+ |
|
2857 |
+@item |
|
2858 |
+Enable additional sharpening: |
|
2859 |
+@example |
|
2860 |
+kerndeint=sharp=1 |
|
2861 |
+@end example |
|
2862 |
+ |
|
2863 |
+@item |
|
2864 |
+Paint processed pixels in white: |
|
2865 |
+@example |
|
2866 |
+kerndeint=map=1 |
|
2867 |
+@end example |
|
2868 |
+@end itemize |
|
2869 |
+ |
|
2813 | 2870 |
@section lut, lutrgb, lutyuv |
2814 | 2871 |
|
2815 | 2872 |
Compute a look-up table for binding each pixel component input value |
... | ... |
@@ -114,6 +114,7 @@ OBJS-$(CONFIG_HFLIP_FILTER) += vf_hflip.o |
114 | 114 |
OBJS-$(CONFIG_HQDN3D_FILTER) += vf_hqdn3d.o |
115 | 115 |
OBJS-$(CONFIG_HUE_FILTER) += vf_hue.o |
116 | 116 |
OBJS-$(CONFIG_IDET_FILTER) += vf_idet.o |
117 |
+OBJS-$(CONFIG_KERNDEINT_FILTER) += vf_kerndeint.o |
|
117 | 118 |
OBJS-$(CONFIG_LUT_FILTER) += vf_lut.o |
118 | 119 |
OBJS-$(CONFIG_LUTRGB_FILTER) += vf_lut.o |
119 | 120 |
OBJS-$(CONFIG_LUTYUV_FILTER) += vf_lut.o |
... | ... |
@@ -108,6 +108,7 @@ void avfilter_register_all(void) |
108 | 108 |
REGISTER_FILTER(HQDN3D, hqdn3d, vf); |
109 | 109 |
REGISTER_FILTER(HUE, hue, vf); |
110 | 110 |
REGISTER_FILTER(IDET, idet, vf); |
111 |
+ REGISTER_FILTER(KERNDEINT, kerndeint, vf); |
|
111 | 112 |
REGISTER_FILTER(LUT, lut, vf); |
112 | 113 |
REGISTER_FILTER(LUTRGB, lutrgb, vf); |
113 | 114 |
REGISTER_FILTER(LUTYUV, lutyuv, vf); |
... | ... |
@@ -29,8 +29,8 @@ |
29 | 29 |
#include "libavutil/avutil.h" |
30 | 30 |
|
31 | 31 |
#define LIBAVFILTER_VERSION_MAJOR 3 |
32 |
-#define LIBAVFILTER_VERSION_MINOR 30 |
|
33 |
-#define LIBAVFILTER_VERSION_MICRO 104 |
|
32 |
+#define LIBAVFILTER_VERSION_MINOR 31 |
|
33 |
+#define LIBAVFILTER_VERSION_MICRO 100 |
|
34 | 34 |
|
35 | 35 |
#define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \ |
36 | 36 |
LIBAVFILTER_VERSION_MINOR, \ |
37 | 37 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,318 @@ |
0 |
+/* |
|
1 |
+ * Copyright (c) 2012 Jeremy Tran |
|
2 |
+ * Copyright (c) 2004 Tobias Diedrich |
|
3 |
+ * Copyright (c) 2003 Donald A. Graft |
|
4 |
+ * |
|
5 |
+ * This file is part of FFmpeg. |
|
6 |
+ * |
|
7 |
+ * FFmpeg is free software; you can redistribute it and/or modify |
|
8 |
+ * it under the terms of the GNU General Public License as published by |
|
9 |
+ * the Free Software Foundation; either version 2 of the License, or |
|
10 |
+ * (at your option) any later version. |
|
11 |
+ * |
|
12 |
+ * FFmpeg is distributed in the hope that it will be useful, |
|
13 |
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
14 |
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
15 |
+ * GNU General Public License for more details. |
|
16 |
+ * |
|
17 |
+ * You should have received a copy of the GNU General Public License along |
|
18 |
+ * with FFmpeg; if not, write to the Free Software Foundation, Inc., |
|
19 |
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
|
20 |
+ */ |
|
21 |
+ |
|
22 |
+/** |
|
23 |
+ * @file |
|
24 |
+ * Kernel Deinterlacer |
|
25 |
+ * Ported from MPlayer libmpcodecs/vf_kerndeint.c. |
|
26 |
+ */ |
|
27 |
+ |
|
28 |
+#include "libavutil/imgutils.h" |
|
29 |
+#include "libavutil/intreadwrite.h" |
|
30 |
+#include "libavutil/opt.h" |
|
31 |
+#include "libavutil/pixdesc.h" |
|
32 |
+ |
|
33 |
+#include "avfilter.h" |
|
34 |
+#include "formats.h" |
|
35 |
+#include "internal.h" |
|
36 |
+ |
|
37 |
+typedef struct { |
|
38 |
+ const AVClass *class; |
|
39 |
+ int frame; ///< frame count, starting from 0 |
|
40 |
+ int thresh, map, order, sharp, twoway; |
|
41 |
+ int vsub; |
|
42 |
+ uint8_t *tmp_data [4]; ///< temporary plane data buffer |
|
43 |
+ int tmp_bwidth[4]; ///< temporary plane byte width |
|
44 |
+ int pixel_step; |
|
45 |
+} KerndeintContext; |
|
46 |
+ |
|
47 |
+#define OFFSET(x) offsetof(KerndeintContext, x) |
|
48 |
+#define FLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM |
|
49 |
+static const AVOption kerndeint_options[] = { |
|
50 |
+ { "thresh", "set the threshold", OFFSET(thresh), AV_OPT_TYPE_INT, {.i64=10}, 0, 255, FLAGS }, |
|
51 |
+ { "map", "set the map", OFFSET(map), AV_OPT_TYPE_INT, {.i64=0}, 0, 1, FLAGS }, |
|
52 |
+ { "order", "set the order", OFFSET(order), AV_OPT_TYPE_INT, {.i64=0}, 0, 1, FLAGS }, |
|
53 |
+ { "sharp", "enable sharpening", OFFSET(sharp), AV_OPT_TYPE_INT, {.i64=0}, 0, 1, FLAGS }, |
|
54 |
+ { "twoway", "enable twoway", OFFSET(twoway), AV_OPT_TYPE_INT, {.i64=0}, 0, 1, FLAGS }, |
|
55 |
+ { NULL } |
|
56 |
+}; |
|
57 |
+ |
|
58 |
+AVFILTER_DEFINE_CLASS(kerndeint); |
|
59 |
+ |
|
60 |
+static av_cold int init(AVFilterContext *ctx, const char *args) |
|
61 |
+{ |
|
62 |
+ KerndeintContext *kerndeint = ctx->priv; |
|
63 |
+ const char const * shorthand[] = { "thresh", "map", "order", "sharp", "twoway", NULL }; |
|
64 |
+ |
|
65 |
+ kerndeint->class = &kerndeint_class; |
|
66 |
+ av_opt_set_defaults(kerndeint); |
|
67 |
+ |
|
68 |
+ return av_opt_set_from_string(kerndeint, args, shorthand, "=", ":"); |
|
69 |
+} |
|
70 |
+ |
|
71 |
+static av_cold void uninit(AVFilterContext *ctx) |
|
72 |
+{ |
|
73 |
+ KerndeintContext *kerndeint = ctx->priv; |
|
74 |
+ |
|
75 |
+ av_free(kerndeint->tmp_data[0]); |
|
76 |
+ av_opt_free(kerndeint); |
|
77 |
+} |
|
78 |
+ |
|
79 |
+static int query_formats(AVFilterContext *ctx) |
|
80 |
+{ |
|
81 |
+ static const enum PixelFormat pix_fmts[] = { |
|
82 |
+ AV_PIX_FMT_YUV420P, |
|
83 |
+ AV_PIX_FMT_YUYV422, |
|
84 |
+ AV_PIX_FMT_ARGB, |
|
85 |
+ AV_PIX_FMT_NONE |
|
86 |
+ }; |
|
87 |
+ |
|
88 |
+ ff_set_common_formats(ctx, ff_make_format_list(pix_fmts)); |
|
89 |
+ |
|
90 |
+ return 0; |
|
91 |
+} |
|
92 |
+ |
|
93 |
+static int config_props(AVFilterLink *inlink) |
|
94 |
+{ |
|
95 |
+ KerndeintContext *kerndeint = inlink->dst->priv; |
|
96 |
+ const AVPixFmtDescriptor *desc = &av_pix_fmt_descriptors[inlink->format]; |
|
97 |
+ |
|
98 |
+ kerndeint->vsub = desc->log2_chroma_h; |
|
99 |
+ kerndeint->pixel_step = av_get_bits_per_pixel(desc) >> 3; |
|
100 |
+ |
|
101 |
+ return av_image_alloc(kerndeint->tmp_data, kerndeint->tmp_bwidth, |
|
102 |
+ inlink->w, inlink->h, inlink->format, 1); |
|
103 |
+} |
|
104 |
+ |
|
105 |
+static int filter_frame(AVFilterLink *inlink, AVFilterBufferRef *inpic) |
|
106 |
+{ |
|
107 |
+ KerndeintContext *kerndeint = inlink->dst->priv; |
|
108 |
+ AVFilterLink *outlink = inlink->dst->outputs[0]; |
|
109 |
+ AVFilterBufferRef *outpic; |
|
110 |
+ const uint8_t *prvp; ///< Previous field's pixel line number n |
|
111 |
+ const uint8_t *prvpp; ///< Previous field's pixel line number (n - 1) |
|
112 |
+ const uint8_t *prvpn; ///< Previous field's pixel line number (n + 1) |
|
113 |
+ const uint8_t *prvppp; ///< Previous field's pixel line number (n - 2) |
|
114 |
+ const uint8_t *prvpnn; ///< Previous field's pixel line number (n + 2) |
|
115 |
+ const uint8_t *prvp4p; ///< Previous field's pixel line number (n - 4) |
|
116 |
+ const uint8_t *prvp4n; ///< Previous field's pixel line number (n + 4) |
|
117 |
+ |
|
118 |
+ const uint8_t *srcp; ///< Current field's pixel line number n |
|
119 |
+ const uint8_t *srcpp; ///< Current field's pixel line number (n - 1) |
|
120 |
+ const uint8_t *srcpn; ///< Current field's pixel line number (n + 1) |
|
121 |
+ const uint8_t *srcppp; ///< Current field's pixel line number (n - 2) |
|
122 |
+ const uint8_t *srcpnn; ///< Current field's pixel line number (n + 2) |
|
123 |
+ const uint8_t *srcp3p; ///< Current field's pixel line number (n - 3) |
|
124 |
+ const uint8_t *srcp3n; ///< Current field's pixel line number (n + 3) |
|
125 |
+ const uint8_t *srcp4p; ///< Current field's pixel line number (n - 4) |
|
126 |
+ const uint8_t *srcp4n; ///< Current field's pixel line number (n + 4) |
|
127 |
+ |
|
128 |
+ uint8_t *dstp, *dstp_saved; |
|
129 |
+ const uint8_t *srcp_saved; |
|
130 |
+ |
|
131 |
+ int src_linesize, psrc_linesize, dst_linesize, bwidth; |
|
132 |
+ int x, y, plane, val, hi, lo, g, h, n = kerndeint->frame++; |
|
133 |
+ double valf; |
|
134 |
+ |
|
135 |
+ const int thresh = kerndeint->thresh; |
|
136 |
+ const int order = kerndeint->order; |
|
137 |
+ const int map = kerndeint->map; |
|
138 |
+ const int sharp = kerndeint->sharp; |
|
139 |
+ const int twoway = kerndeint->twoway; |
|
140 |
+ |
|
141 |
+ outpic = ff_get_video_buffer(outlink, AV_PERM_WRITE|AV_PERM_ALIGN, outlink->w, outlink->h); |
|
142 |
+ if (!outpic) { |
|
143 |
+ avfilter_unref_bufferp(&inpic); |
|
144 |
+ return AVERROR(ENOMEM); |
|
145 |
+ } |
|
146 |
+ avfilter_copy_buffer_ref_props(outpic, inpic); |
|
147 |
+ outpic->video->interlaced = 0; |
|
148 |
+ |
|
149 |
+ for (plane = 0; inpic->data[plane] && plane < 4; plane++) { |
|
150 |
+ h = plane == 0 ? inlink->h : inlink->h >> kerndeint->vsub; |
|
151 |
+ bwidth = kerndeint->tmp_bwidth[plane]; |
|
152 |
+ |
|
153 |
+ srcp = srcp_saved = inpic->data[plane]; |
|
154 |
+ src_linesize = inpic->linesize[plane]; |
|
155 |
+ psrc_linesize = outpic->linesize[plane]; |
|
156 |
+ dstp = dstp_saved = outpic->data[plane]; |
|
157 |
+ dst_linesize = outpic->linesize[plane]; |
|
158 |
+ srcp = srcp_saved + (1 - order) * src_linesize; |
|
159 |
+ dstp = dstp_saved + (1 - order) * dst_linesize; |
|
160 |
+ |
|
161 |
+ for (y = 0; y < h; y += 2) { |
|
162 |
+ memcpy(dstp, srcp, bwidth); |
|
163 |
+ srcp += 2 * src_linesize; |
|
164 |
+ dstp += 2 * dst_linesize; |
|
165 |
+ } |
|
166 |
+ |
|
167 |
+ // Copy through the lines that will be missed below. |
|
168 |
+ memcpy(dstp_saved + order * dst_linesize, srcp_saved + (1 - order) * src_linesize, bwidth); |
|
169 |
+ memcpy(dstp_saved + (2 + order ) * dst_linesize, srcp_saved + (3 - order) * src_linesize, bwidth); |
|
170 |
+ memcpy(dstp_saved + (h - 2 + order) * dst_linesize, srcp_saved + (h - 1 - order) * src_linesize, bwidth); |
|
171 |
+ memcpy(dstp_saved + (h - 4 + order) * dst_linesize, srcp_saved + (h - 3 - order) * src_linesize, bwidth); |
|
172 |
+ |
|
173 |
+ /* For the other field choose adaptively between using the previous field |
|
174 |
+ or the interpolant from the current field. */ |
|
175 |
+ prvp = kerndeint->tmp_data[plane] + 5 * psrc_linesize - (1 - order) * psrc_linesize; |
|
176 |
+ prvpp = prvp - psrc_linesize; |
|
177 |
+ prvppp = prvp - 2 * psrc_linesize; |
|
178 |
+ prvp4p = prvp - 4 * psrc_linesize; |
|
179 |
+ prvpn = prvp + psrc_linesize; |
|
180 |
+ prvpnn = prvp + 2 * psrc_linesize; |
|
181 |
+ prvp4n = prvp + 4 * psrc_linesize; |
|
182 |
+ |
|
183 |
+ srcp = srcp_saved + 5 * src_linesize - (1 - order) * src_linesize; |
|
184 |
+ srcpp = srcp - src_linesize; |
|
185 |
+ srcppp = srcp - 2 * src_linesize; |
|
186 |
+ srcp3p = srcp - 3 * src_linesize; |
|
187 |
+ srcp4p = srcp - 4 * src_linesize; |
|
188 |
+ |
|
189 |
+ srcpn = srcp + src_linesize; |
|
190 |
+ srcpnn = srcp + 2 * src_linesize; |
|
191 |
+ srcp3n = srcp + 3 * src_linesize; |
|
192 |
+ srcp4n = srcp + 4 * src_linesize; |
|
193 |
+ |
|
194 |
+ dstp = dstp_saved + 5 * dst_linesize - (1 - order) * dst_linesize; |
|
195 |
+ |
|
196 |
+ for (y = 5 - (1 - order); y <= h - 5 - (1 - order); y += 2) { |
|
197 |
+ for (x = 0; x < bwidth; x++) { |
|
198 |
+ if (thresh == 0 || n == 0 || |
|
199 |
+ (abs((int)prvp[x] - (int)srcp[x]) > thresh) || |
|
200 |
+ (abs((int)prvpp[x] - (int)srcpp[x]) > thresh) || |
|
201 |
+ (abs((int)prvpn[x] - (int)srcpn[x]) > thresh)) { |
|
202 |
+ if (map) { |
|
203 |
+ g = x & ~3; |
|
204 |
+ |
|
205 |
+ if (inlink->format == AV_PIX_FMT_RGBA) { |
|
206 |
+ AV_WB32(dstp + g, 0xffffffff); |
|
207 |
+ x = g + 3; |
|
208 |
+ } else if (inlink->format == AV_PIX_FMT_YUYV422) { |
|
209 |
+ // y <- 235, u <- 128, y <- 235, v <- 128 |
|
210 |
+ AV_WB32(dstp + g, 0xeb80eb80); |
|
211 |
+ x = g + 3; |
|
212 |
+ } else { |
|
213 |
+ dstp[x] = plane == 0 ? 235 : 128; |
|
214 |
+ } |
|
215 |
+ } else { |
|
216 |
+ if (inlink->format == AV_PIX_FMT_RGBA) { |
|
217 |
+ hi = 255; |
|
218 |
+ lo = 0; |
|
219 |
+ } else if (inlink->format == AV_PIX_FMT_YUYV422) { |
|
220 |
+ hi = x & 1 ? 240 : 235; |
|
221 |
+ lo = 16; |
|
222 |
+ } else { |
|
223 |
+ hi = plane == 0 ? 235 : 240; |
|
224 |
+ lo = 16; |
|
225 |
+ } |
|
226 |
+ |
|
227 |
+ if (sharp) { |
|
228 |
+ if (twoway) { |
|
229 |
+ valf = + 0.526 * ((int)srcpp[x] + (int)srcpn[x]) |
|
230 |
+ + 0.170 * ((int)srcp[x] + (int)prvp[x]) |
|
231 |
+ - 0.116 * ((int)srcppp[x] + (int)srcpnn[x] + (int)prvppp[x] + (int)prvpnn[x]) |
|
232 |
+ - 0.026 * ((int)srcp3p[x] + (int)srcp3n[x]) |
|
233 |
+ + 0.031 * ((int)srcp4p[x] + (int)srcp4n[x] + (int)prvp4p[x] + (int)prvp4n[x]); |
|
234 |
+ } else { |
|
235 |
+ valf = + 0.526 * ((int)srcpp[x] + (int)srcpn[x]) |
|
236 |
+ + 0.170 * ((int)prvp[x]) |
|
237 |
+ - 0.116 * ((int)prvppp[x] + (int)prvpnn[x]) |
|
238 |
+ - 0.026 * ((int)srcp3p[x] + (int)srcp3n[x]) |
|
239 |
+ + 0.031 * ((int)prvp4p[x] + (int)prvp4p[x]); |
|
240 |
+ } |
|
241 |
+ dstp[x] = av_clip(valf, lo, hi); |
|
242 |
+ } else { |
|
243 |
+ if (twoway) { |
|
244 |
+ val = (8 * ((int)srcpp[x] + (int)srcpn[x]) + 2 * ((int)srcp[x] + (int)prvp[x]) |
|
245 |
+ - (int)(srcppp[x]) - (int)(srcpnn[x]) |
|
246 |
+ - (int)(prvppp[x]) - (int)(prvpnn[x])) >> 4; |
|
247 |
+ } else { |
|
248 |
+ val = (8 * ((int)srcpp[x] + (int)srcpn[x]) + 2 * ((int)prvp[x]) |
|
249 |
+ - (int)(prvppp[x]) - (int)(prvpnn[x])) >> 4; |
|
250 |
+ } |
|
251 |
+ dstp[x] = av_clip(val, lo, hi); |
|
252 |
+ } |
|
253 |
+ } |
|
254 |
+ } else { |
|
255 |
+ dstp[x] = srcp[x]; |
|
256 |
+ } |
|
257 |
+ } |
|
258 |
+ prvp += 2 * psrc_linesize; |
|
259 |
+ prvpp += 2 * psrc_linesize; |
|
260 |
+ prvppp += 2 * psrc_linesize; |
|
261 |
+ prvpn += 2 * psrc_linesize; |
|
262 |
+ prvpnn += 2 * psrc_linesize; |
|
263 |
+ prvp4p += 2 * psrc_linesize; |
|
264 |
+ prvp4n += 2 * psrc_linesize; |
|
265 |
+ srcp += 2 * src_linesize; |
|
266 |
+ srcpp += 2 * src_linesize; |
|
267 |
+ srcppp += 2 * src_linesize; |
|
268 |
+ srcp3p += 2 * src_linesize; |
|
269 |
+ srcp4p += 2 * src_linesize; |
|
270 |
+ srcpn += 2 * src_linesize; |
|
271 |
+ srcpnn += 2 * src_linesize; |
|
272 |
+ srcp3n += 2 * src_linesize; |
|
273 |
+ srcp4n += 2 * src_linesize; |
|
274 |
+ dstp += 2 * dst_linesize; |
|
275 |
+ } |
|
276 |
+ |
|
277 |
+ srcp = inpic->data[plane]; |
|
278 |
+ dstp = kerndeint->tmp_data[plane]; |
|
279 |
+ av_image_copy_plane(dstp, psrc_linesize, srcp, src_linesize, bwidth, h); |
|
280 |
+ } |
|
281 |
+ |
|
282 |
+ avfilter_unref_buffer(inpic); |
|
283 |
+ return ff_filter_frame(outlink, outpic); |
|
284 |
+} |
|
285 |
+ |
|
286 |
+static const AVFilterPad kerndeint_inputs[] = { |
|
287 |
+ { |
|
288 |
+ .name = "default", |
|
289 |
+ .type = AVMEDIA_TYPE_VIDEO, |
|
290 |
+ .filter_frame = filter_frame, |
|
291 |
+ .config_props = config_props, |
|
292 |
+ .min_perms = AV_PERM_READ, |
|
293 |
+ }, |
|
294 |
+ { NULL } |
|
295 |
+}; |
|
296 |
+ |
|
297 |
+static const AVFilterPad kerndeint_outputs[] = { |
|
298 |
+ { |
|
299 |
+ .name = "default", |
|
300 |
+ .type = AVMEDIA_TYPE_VIDEO, |
|
301 |
+ }, |
|
302 |
+ { NULL } |
|
303 |
+}; |
|
304 |
+ |
|
305 |
+AVFilter avfilter_vf_kerndeint = { |
|
306 |
+ .name = "kerndeint", |
|
307 |
+ .description = NULL_IF_CONFIG_SMALL("Apply kernel deinterlacing to the input."), |
|
308 |
+ .priv_size = sizeof(KerndeintContext), |
|
309 |
+ .init = init, |
|
310 |
+ .uninit = uninit, |
|
311 |
+ .query_formats = query_formats, |
|
312 |
+ |
|
313 |
+ .inputs = kerndeint_inputs, |
|
314 |
+ .outputs = kerndeint_outputs, |
|
315 |
+ |
|
316 |
+ .priv_class = &kerndeint_class, |
|
317 |
+}; |
... | ... |
@@ -80,6 +80,7 @@ do_lavfi_pixfmts(){ |
80 | 80 |
test ${test%_[bl]e} = $testname || return 0 |
81 | 81 |
filter=$2 |
82 | 82 |
filter_args=$3 |
83 |
+ prefilter_chain=$4 |
|
83 | 84 |
|
84 | 85 |
showfiltfmts="$target_exec $target_path/libavfilter/filtfmts-test" |
85 | 86 |
scale_exclude_fmts=${outfile}${testname}_scale_exclude_fmts |
... | ... |
@@ -96,7 +97,7 @@ do_lavfi_pixfmts(){ |
96 | 96 |
pix_fmts=$(comm -12 $scale_exclude_fmts $in_fmts) |
97 | 97 |
|
98 | 98 |
for pix_fmt in $pix_fmts; do |
99 |
- do_video_filter $pix_fmt "format=$pix_fmt,$filter=$filter_args" -pix_fmt $pix_fmt |
|
99 |
+ do_video_filter $pix_fmt "${prefilter_chain}format=$pix_fmt,$filter=$filter_args" -pix_fmt $pix_fmt |
|
100 | 100 |
done |
101 | 101 |
|
102 | 102 |
rm $in_fmts $scale_in_fmts $scale_out_fmts $scale_exclude_fmts |
... | ... |
@@ -104,6 +105,7 @@ do_lavfi_pixfmts(){ |
104 | 104 |
|
105 | 105 |
# all these filters have exactly one input and exactly one output |
106 | 106 |
do_lavfi_pixfmts "field" "field" "bottom" |
107 |
+do_lavfi_pixfmts "kerndeint" "kerndeint" "" "tinterlace=interleave_top," |
|
107 | 108 |
do_lavfi_pixfmts "pixfmts_copy" "copy" "" |
108 | 109 |
do_lavfi_pixfmts "pixfmts_crop" "crop" "100:100:100:100" |
109 | 110 |
do_lavfi_pixfmts "pixfmts_hflip" "hflip" "" |