1 /*
2 * Copyright (C) 2012 Michael Niedermayer <michaelni@gmx.at>
3 *
4 * This file is part of FFmpeg.
5 *
6 * FFmpeg is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * FFmpeg is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with FFmpeg; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20
21 #include <float.h> /* FLT_MAX */
22
29
31
38
43
47
49
54
57
58 #define OFFSET(x) offsetof(IDETContext, x)
59 #define FLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
60
64 { NULL }
65 };
66
68
70 {
71 switch(type) {
72 case TFF :
return "Top Field First ";
73 case BFF :
return "Bottom Field First";
76 }
77 return NULL;
78 }
79
81 {
82 int x;
84
85 for(x=0; x<w; x++){
86 int v = (*a++ + *c++) - 2 * *b++;
88 }
89
91 }
92
94 {
95 int x;
97
98 for(x=0; x<w; x++){
99 int v = (*a++ + *c++) - 2 * *b++;
101 }
102
104 }
105
107 {
110 int64_t
alpha[2]={0};
113 int match = 0;
114
119
120 if (i && i<3) {
123 }
124
125 for (y = 2; y < h - 2; y++) {
129 alpha[ y &1] += idet->
filter_line(cur-refs, prev, cur+refs, w);
130 alpha[(y^1)&1] += idet->
filter_line(cur-refs, next, cur+refs, w);
131 delta += idet->
filter_line(cur-refs, cur, cur+refs, w);
132 }
133 }
134
141 }else{
143 }
144
152
153 if(idet->
history[i] == best_type) {
154 match++;
155 }else{
156 match=0;
157 break;
158 }
159 }
160 }
163 }else{
165 }
166
175 }
176
180 }
181
183 {
186
192
194 return 0;
195
198
203
205
207 }
208
210 {
212
213 av_log(ctx,
AV_LOG_INFO,
"Single frame detection: TFF:%d BFF:%d Progressive:%d Undetermined:%d\n",
218 );
219 av_log(ctx,
AV_LOG_INFO,
"Multi frame detection: TFF:%d BFF:%d Progressive:%d Undetermined:%d\n",
224 );
225
229 }
230
232 {
254 };
255
257
258 return 0;
259 }
260
262 {
264 return 0;
265 }
266
268 {
270
273
275
276 return 0;
277 }
278
279
281 {
285 },
286 { NULL }
287 };
288
290 {
294 },
295 { NULL }
296 };
297
301
308 .priv_class = &idet_class,
309 };