FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
vf_idet.c
Go to the documentation of this file.
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 
23 #include "libavutil/cpu.h"
24 #include "libavutil/common.h"
25 #include "libavutil/opt.h"
26 #include "internal.h"
27 #include "vf_idet.h"
28 
29 #define OFFSET(x) offsetof(IDETContext, x)
30 #define FLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
31 
32 static const AVOption idet_options[] = {
33  { "intl_thres", "set interlacing threshold", OFFSET(interlace_threshold), AV_OPT_TYPE_FLOAT, {.dbl = 1.04}, -1, FLT_MAX, FLAGS },
34  { "prog_thres", "set progressive threshold", OFFSET(progressive_threshold), AV_OPT_TYPE_FLOAT, {.dbl = 1.5}, -1, FLT_MAX, FLAGS },
35  { "rep_thres", "set repeat threshold", OFFSET(repeat_threshold), AV_OPT_TYPE_FLOAT, {.dbl = 3.0}, -1, FLT_MAX, FLAGS },
36  { "half_life", "half life of cumulative statistics", OFFSET(half_life), AV_OPT_TYPE_FLOAT, {.dbl = 0.0}, -1, INT_MAX, FLAGS },
37  { "analyze_interlaced_flag", "set number of frames to use to determine if the interlace flag is accurate", OFFSET(analyze_interlaced_flag), AV_OPT_TYPE_INT, {.i64 = 0 }, 0, INT_MAX, FLAGS },
38  { NULL }
39 };
40 
42 
43 static const char *type2str(Type type)
44 {
45  switch(type) {
46  case TFF : return "tff";
47  case BFF : return "bff";
48  case PROGRESSIVE : return "progressive";
49  case UNDETERMINED : return "undetermined";
50  }
51  return NULL;
52 }
53 
54 #define PRECISION 1048576
55 
56 static uint64_t uintpow(uint64_t b,unsigned int e)
57 {
58  uint64_t r=1;
59  while(e--) r*=b;
60  return r;
61 }
62 
63 static int av_dict_set_fxp(AVDictionary **pm, const char *key, uint64_t value, unsigned int digits,
64  int flags)
65 {
66  char valuestr[44];
67  uint64_t print_precision = uintpow(10, digits);
68 
69  value = av_rescale(value, print_precision, PRECISION);
70 
71  snprintf(valuestr, sizeof(valuestr), "%"PRId64".%0*"PRId64,
72  value / print_precision, digits, value % print_precision);
73 
74  return av_dict_set(pm, key, valuestr, flags);
75 }
76 
77 static const char *rep2str(RepeatedField repeated_field)
78 {
79  switch(repeated_field) {
80  case REPEAT_NONE : return "neither";
81  case REPEAT_TOP : return "top";
82  case REPEAT_BOTTOM : return "bottom";
83  }
84  return NULL;
85 }
86 
87 int ff_idet_filter_line_c(const uint8_t *a, const uint8_t *b, const uint8_t *c, int w)
88 {
89  int x;
90  int ret=0;
91 
92  for(x=0; x<w; x++){
93  int v = (*a++ + *c++) - 2 * *b++;
94  ret += FFABS(v);
95  }
96 
97  return ret;
98 }
99 
100 int ff_idet_filter_line_c_16bit(const uint16_t *a, const uint16_t *b, const uint16_t *c, int w)
101 {
102  int x;
103  int ret=0;
104 
105  for(x=0; x<w; x++){
106  int v = (*a++ + *c++) - 2 * *b++;
107  ret += FFABS(v);
108  }
109 
110  return ret;
111 }
112 
113 static void filter(AVFilterContext *ctx)
114 {
115  IDETContext *idet = ctx->priv;
116  int y, i;
117  int64_t alpha[2]={0};
118  int64_t delta=0;
119  int64_t gamma[2]={0};
120  Type type, best_type;
121  RepeatedField repeat;
122  int match = 0;
123  AVDictionary **metadata = avpriv_frame_get_metadatap(idet->cur);
124 
125  for (i = 0; i < idet->csp->nb_components; i++) {
126  int w = idet->cur->width;
127  int h = idet->cur->height;
128  int refs = idet->cur->linesize[i];
129 
130  if (i && i<3) {
131  w = FF_CEIL_RSHIFT(w, idet->csp->log2_chroma_w);
132  h = FF_CEIL_RSHIFT(h, idet->csp->log2_chroma_h);
133  }
134 
135  for (y = 2; y < h - 2; y++) {
136  uint8_t *prev = &idet->prev->data[i][y*refs];
137  uint8_t *cur = &idet->cur ->data[i][y*refs];
138  uint8_t *next = &idet->next->data[i][y*refs];
139  alpha[ y &1] += idet->filter_line(cur-refs, prev, cur+refs, w);
140  alpha[(y^1)&1] += idet->filter_line(cur-refs, next, cur+refs, w);
141  delta += idet->filter_line(cur-refs, cur, cur+refs, w);
142  gamma[(y^1)&1] += idet->filter_line(cur , prev, cur , w);
143  }
144  }
145 
146  if (alpha[0] > idet->interlace_threshold * alpha[1]){
147  type = TFF;
148  }else if(alpha[1] > idet->interlace_threshold * alpha[0]){
149  type = BFF;
150  }else if(alpha[1] > idet->progressive_threshold * delta){
151  type = PROGRESSIVE;
152  }else{
153  type = UNDETERMINED;
154  }
155 
156  if ( gamma[0] > idet->repeat_threshold * gamma[1] ){
157  repeat = REPEAT_TOP;
158  } else if ( gamma[1] > idet->repeat_threshold * gamma[0] ){
159  repeat = REPEAT_BOTTOM;
160  } else {
161  repeat = REPEAT_NONE;
162  }
163 
164  memmove(idet->history+1, idet->history, HIST_SIZE-1);
165  idet->history[0] = type;
166  best_type = UNDETERMINED;
167  for(i=0; i<HIST_SIZE; i++){
168  if(idet->history[i] != UNDETERMINED){
169  if(best_type == UNDETERMINED)
170  best_type = idet->history[i];
171 
172  if(idet->history[i] == best_type) {
173  match++;
174  }else{
175  match=0;
176  break;
177  }
178  }
179  }
180  if(idet->last_type == UNDETERMINED){
181  if(match ) idet->last_type = best_type;
182  }else{
183  if(match>2) idet->last_type = best_type;
184  }
185 
186  if (idet->last_type == TFF){
187  idet->cur->top_field_first = 1;
188  idet->cur->interlaced_frame = 1;
189  }else if(idet->last_type == BFF){
190  idet->cur->top_field_first = 0;
191  idet->cur->interlaced_frame = 1;
192  }else if(idet->last_type == PROGRESSIVE){
193  idet->cur->interlaced_frame = 0;
194  }
195 
196  for(i=0; i<3; i++)
197  idet->repeats[i] = av_rescale(idet->repeats [i], idet->decay_coefficient, PRECISION);
198 
199  for(i=0; i<4; i++){
200  idet->prestat [i] = av_rescale(idet->prestat [i], idet->decay_coefficient, PRECISION);
201  idet->poststat[i] = av_rescale(idet->poststat[i], idet->decay_coefficient, PRECISION);
202  }
203 
204  idet->total_repeats [ repeat] ++;
205  idet->repeats [ repeat] += PRECISION;
206 
207  idet->total_prestat [ type] ++;
208  idet->prestat [ type] += PRECISION;
209 
210  idet->total_poststat[idet->last_type] ++;
211  idet->poststat [idet->last_type] += PRECISION;
212 
213  av_log(ctx, AV_LOG_DEBUG, "Repeated Field:%12s, Single frame:%12s, Multi frame:%12s\n",
214  rep2str(repeat), type2str(type), type2str(idet->last_type));
215 
216  av_dict_set (metadata, "lavfi.idet.repeated.current_frame", rep2str(repeat), 0);
217  av_dict_set_fxp(metadata, "lavfi.idet.repeated.neither", idet->repeats[REPEAT_NONE], 2, 0);
218  av_dict_set_fxp(metadata, "lavfi.idet.repeated.top", idet->repeats[REPEAT_TOP], 2, 0);
219  av_dict_set_fxp(metadata, "lavfi.idet.repeated.bottom", idet->repeats[REPEAT_BOTTOM], 2, 0);
220 
221  av_dict_set (metadata, "lavfi.idet.single.current_frame", type2str(type), 0);
222  av_dict_set_fxp(metadata, "lavfi.idet.single.tff", idet->prestat[TFF], 2 , 0);
223  av_dict_set_fxp(metadata, "lavfi.idet.single.bff", idet->prestat[BFF], 2, 0);
224  av_dict_set_fxp(metadata, "lavfi.idet.single.progressive", idet->prestat[PROGRESSIVE], 2, 0);
225  av_dict_set_fxp(metadata, "lavfi.idet.single.undetermined", idet->prestat[UNDETERMINED], 2, 0);
226 
227  av_dict_set (metadata, "lavfi.idet.multiple.current_frame", type2str(idet->last_type), 0);
228  av_dict_set_fxp(metadata, "lavfi.idet.multiple.tff", idet->poststat[TFF], 2, 0);
229  av_dict_set_fxp(metadata, "lavfi.idet.multiple.bff", idet->poststat[BFF], 2, 0);
230  av_dict_set_fxp(metadata, "lavfi.idet.multiple.progressive", idet->poststat[PROGRESSIVE], 2, 0);
231  av_dict_set_fxp(metadata, "lavfi.idet.multiple.undetermined", idet->poststat[UNDETERMINED], 2, 0);
232 }
233 
234 static int filter_frame(AVFilterLink *link, AVFrame *picref)
235 {
236  AVFilterContext *ctx = link->dst;
237  IDETContext *idet = ctx->priv;
238 
239  // initial frame(s) and not interlaced, just pass through for
240  // the analyze_interlaced_flag mode
241  if (idet->analyze_interlaced_flag &&
242  !picref->interlaced_frame &&
243  !idet->next) {
244  return ff_filter_frame(ctx->outputs[0], picref);
245  }
246  if (idet->analyze_interlaced_flag_done) {
247  if (picref->interlaced_frame && idet->interlaced_flag_accuracy < 0)
248  picref->interlaced_frame = 0;
249  return ff_filter_frame(ctx->outputs[0], picref);
250  }
251 
252  av_frame_free(&idet->prev);
253 
254  if( picref->width != link->w
255  || picref->height != link->h
256  || picref->format != link->format) {
257  link->dst->inputs[0]->format = picref->format;
258  link->dst->inputs[0]->w = picref->width;
259  link->dst->inputs[0]->h = picref->height;
260 
261  av_frame_free(&idet->cur );
262  av_frame_free(&idet->next);
263  }
264 
265  idet->prev = idet->cur;
266  idet->cur = idet->next;
267  idet->next = picref;
268 
269  if (!idet->cur &&
270  !(idet->cur = av_frame_clone(idet->next)))
271  return AVERROR(ENOMEM);
272 
273  if (!idet->prev)
274  return 0;
275 
276  if (!idet->csp)
277  idet->csp = av_pix_fmt_desc_get(link->format);
278  if (idet->csp->comp[0].depth_minus1 / 8 == 1){
280  if (ARCH_X86)
281  ff_idet_init_x86(idet, 1);
282  }
283 
284  if (idet->analyze_interlaced_flag) {
285  if (idet->cur->interlaced_frame) {
286  idet->cur->interlaced_frame = 0;
287  filter(ctx);
288  if (idet->last_type == PROGRESSIVE) {
289  idet->interlaced_flag_accuracy --;
290  idet->analyze_interlaced_flag --;
291  } else if (idet->last_type != UNDETERMINED) {
292  idet->interlaced_flag_accuracy ++;
293  idet->analyze_interlaced_flag --;
294  }
295  if (idet->analyze_interlaced_flag == 1) {
296  ff_filter_frame(ctx->outputs[0], av_frame_clone(idet->cur));
297 
298  if (idet->next->interlaced_frame && idet->interlaced_flag_accuracy < 0)
299  idet->next->interlaced_frame = 0;
301  av_log(ctx, AV_LOG_INFO, "Final flag accuracy %d\n", idet->interlaced_flag_accuracy);
302  return ff_filter_frame(ctx->outputs[0], av_frame_clone(idet->next));
303  }
304  }
305  } else {
306  filter(ctx);
307  }
308 
309  return ff_filter_frame(ctx->outputs[0], av_frame_clone(idet->cur));
310 }
311 
312 static int request_frame(AVFilterLink *link)
313 {
314  AVFilterContext *ctx = link->src;
315  IDETContext *idet = ctx->priv;
316 
317  do {
318  int ret;
319 
320  if (idet->eof)
321  return AVERROR_EOF;
322 
323  ret = ff_request_frame(link->src->inputs[0]);
324 
325  if (ret == AVERROR_EOF && idet->cur && !idet->analyze_interlaced_flag_done) {
326  AVFrame *next = av_frame_clone(idet->next);
327 
328  if (!next)
329  return AVERROR(ENOMEM);
330 
331  filter_frame(link->src->inputs[0], next);
332  idet->eof = 1;
333  } else if (ret < 0) {
334  return ret;
335  }
336  } while (link->frame_requested);
337 
338  return 0;
339 }
340 
341 static av_cold void uninit(AVFilterContext *ctx)
342 {
343  IDETContext *idet = ctx->priv;
344  int level = strncmp(ctx->name, "auto-inserted", 13) ? AV_LOG_INFO : AV_LOG_DEBUG;
345 
346  av_log(ctx, level, "Repeated Fields: Neither:%6"PRId64" Top:%6"PRId64" Bottom:%6"PRId64"\n",
347  idet->total_repeats[REPEAT_NONE],
348  idet->total_repeats[REPEAT_TOP],
350  );
351  av_log(ctx, level, "Single frame detection: TFF:%6"PRId64" BFF:%6"PRId64" Progressive:%6"PRId64" Undetermined:%6"PRId64"\n",
352  idet->total_prestat[TFF],
353  idet->total_prestat[BFF],
354  idet->total_prestat[PROGRESSIVE],
356  );
357  av_log(ctx, level, "Multi frame detection: TFF:%6"PRId64" BFF:%6"PRId64" Progressive:%6"PRId64" Undetermined:%6"PRId64"\n",
358  idet->total_poststat[TFF],
359  idet->total_poststat[BFF],
362  );
363 
364  av_frame_free(&idet->prev);
365  av_frame_free(&idet->cur );
366  av_frame_free(&idet->next);
367 }
368 
370 {
371  static const enum AVPixelFormat pix_fmts[] = {
401  };
402  AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts);
403  if (!fmts_list)
404  return AVERROR(ENOMEM);
405  return ff_set_common_formats(ctx, fmts_list);
406 }
407 
408 static int config_output(AVFilterLink *outlink)
409 {
410  outlink->flags |= FF_LINK_FLAG_REQUEST_LOOP;
411  return 0;
412 }
413 
414 static av_cold int init(AVFilterContext *ctx)
415 {
416  IDETContext *idet = ctx->priv;
417 
418  idet->eof = 0;
419  idet->last_type = UNDETERMINED;
420  memset(idet->history, UNDETERMINED, HIST_SIZE);
421 
422  if( idet->half_life > 0 )
423  idet->decay_coefficient = (uint64_t) round( PRECISION * exp2(-1.0 / idet->half_life) );
424  else
426 
428 
429  if (ARCH_X86)
430  ff_idet_init_x86(idet, 0);
431 
432  return 0;
433 }
434 
435 static const AVFilterPad idet_inputs[] = {
436  {
437  .name = "default",
438  .type = AVMEDIA_TYPE_VIDEO,
439  .filter_frame = filter_frame,
440  },
441  { NULL }
442 };
443 
444 static const AVFilterPad idet_outputs[] = {
445  {
446  .name = "default",
447  .type = AVMEDIA_TYPE_VIDEO,
448  .config_props = config_output,
449  .request_frame = request_frame
450  },
451  { NULL }
452 };
453 
455  .name = "idet",
456  .description = NULL_IF_CONFIG_SMALL("Interlace detect Filter."),
457  .priv_size = sizeof(IDETContext),
458  .init = init,
459  .uninit = uninit,
461  .inputs = idet_inputs,
462  .outputs = idet_outputs,
463  .priv_class = &idet_class,
464 };
in the bitstream is reported as 00b
Definition: vc1.h:149
static void filter(AVFilterContext *ctx)
Definition: vf_idet.c:113
#define NULL
Definition: coverity.c:32
float v
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
Definition: pixdesc.c:2090
This structure describes decoded (raw) audio or video data.
Definition: frame.h:171
AVOption.
Definition: opt.h:255
static const char * type2str(Type type)
Definition: vf_idet.c:43
#define AV_PIX_FMT_YUV444P14
Definition: pixfmt.h:374
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
Definition: pixfmt.h:68
static const AVFilterPad outputs[]
Definition: af_ashowinfo.c:248
static int query_formats(AVFilterContext *ctx)
Definition: vf_idet.c:369
static const AVFilterPad idet_inputs[]
Definition: vf_idet.c:435
const char * b
Definition: vf_curves.c:109
#define FLAGS
Definition: vf_idet.c:30
#define AV_PIX_FMT_YUV420P12
Definition: pixfmt.h:368
int ff_idet_filter_line_c_16bit(const uint16_t *a, const uint16_t *b, const uint16_t *c, int w)
Definition: vf_idet.c:100
#define HIST_SIZE
Definition: f_ebur128.c:64
float interlace_threshold
Definition: vf_idet.h:44
const AVPixFmtDescriptor * csp
Definition: vf_idet.h:70
uint8_t log2_chroma_w
Amount to shift the luma width right to find the chroma width.
Definition: pixdesc.h:80
int eof
Definition: vf_idet.h:71
AVFilterFormats * ff_make_format_list(const int *fmts)
Create a list of supported formats.
Definition: formats.c:283
static const AVFilterPad idet_outputs[]
Definition: vf_idet.c:444
float progressive_threshold
Definition: vf_idet.h:45
const char * name
Pad name.
Definition: internal.h:67
AVFilterLink ** inputs
array of pointers to input links
Definition: avfilter.h:641
char * name
name of this filter instance
Definition: avfilter.h:638
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
Definition: avfilter.c:1145
planar YUV 4:2:0, 20bpp, (1 Cr & Cb sample per 2x2 Y & A samples)
Definition: pixfmt.h:103
AVComponentDescriptor comp[4]
Parameters that describe how pixels are packed.
Definition: pixdesc.h:100
uint8_t
#define av_cold
Definition: attributes.h:74
float delta
AVOptions.
Definition: vf_idet.h:31
uint64_t decay_coefficient
Definition: vf_idet.h:48
static const AVOption idet_options[]
Definition: vf_idet.c:32
planar YUV 4:4:0 full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV440P and setting color_range...
Definition: pixfmt.h:102
uint64_t prestat[4]
Definition: vf_idet.h:53
planar YUV 4:2:2, 16bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV422P and setting col...
Definition: pixfmt.h:76
#define AVERROR_EOF
End of file.
Definition: error.h:55
#define AV_PIX_FMT_YUV444P16
Definition: pixfmt.h:377
int interlaced_frame
The content of the picture is interlaced.
Definition: frame.h:367
float half_life
Definition: vf_idet.h:47
#define AV_PIX_FMT_YUV422P12
Definition: pixfmt.h:369
#define av_log(a,...)
A filter pad used for either input or output.
Definition: internal.h:61
uint16_t depth_minus1
Number of bits in the component minus 1.
Definition: pixdesc.h:57
static double alpha(void *priv, double x, double y)
Definition: vf_geq.c:98
int width
width and height of the video frame
Definition: frame.h:220
int ff_set_common_formats(AVFilterContext *ctx, AVFilterFormats *formats)
A helper for query_formats() which sets all links to the same list of formats.
Definition: formats.c:542
uint8_t log2_chroma_h
Amount to shift the luma height right to find the chroma height.
Definition: pixdesc.h:89
void ff_idet_init_x86(IDETContext *idet, int for_16b)
Definition: vf_idet_init.c:69
uint8_t history[HIST_SIZE]
Definition: vf_idet.h:59
AVFrame * next
Definition: vf_idet.h:62
int analyze_interlaced_flag
Definition: vf_idet.h:67
#define AVERROR(e)
Definition: error.h:43
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
Definition: frame.c:148
AVFILTER_DEFINE_CLASS(idet)
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:175
const char * r
Definition: vf_curves.c:107
void * priv
private data for use by the filter
Definition: avfilter.h:654
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
Definition: log.h:197
static const char * rep2str(RepeatedField repeated_field)
Definition: vf_idet.c:77
static av_always_inline av_const double round(double x)
Definition: libm.h:162
#define AV_PIX_FMT_YUV444P10
Definition: pixfmt.h:367
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
Definition: pixfmt.h:67
#define AV_PIX_FMT_YUV422P9
Definition: pixfmt.h:362
int ff_idet_filter_line_c(const uint8_t *a, const uint8_t *b, const uint8_t *c, int w)
Definition: vf_idet.c:87
uint8_t nb_components
The number of components each pixel has, (1-4)
Definition: pixdesc.h:71
#define AV_PIX_FMT_GRAY16
Definition: pixfmt.h:348
int64_t av_rescale(int64_t a, int64_t b, int64_t c)
Rescale a 64-bit integer with rounding to nearest.
Definition: mathematics.c:127
float y
planar YUV 4:2:0, 12bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV420P and setting col...
Definition: pixfmt.h:75
Type
Definition: vf_idet.h:29
ret
Definition: avfilter.c:974
GLsizei GLboolean const GLfloat * value
Definition: opengl_enc.c:109
#define FF_CEIL_RSHIFT(a, b)
Definition: common.h:57
#define FFABS(a)
Definition: common.h:61
uint64_t total_prestat[4]
Definition: vf_idet.h:56
#define AV_PIX_FMT_YUV444P9
Definition: pixfmt.h:363
ff_idet_filter_func filter_line
Definition: vf_idet.h:64
AVFrame * av_frame_clone(const AVFrame *src)
Create a new frame that references the same data as src.
Definition: frame.c:449
static av_cold void uninit(AVFilterContext *ctx)
Definition: vf_idet.c:341
#define AV_PIX_FMT_YUV420P16
Definition: pixfmt.h:375
int format
format of the frame, -1 if unknown or unset Values correspond to enum AVPixelFormat for video frames...
Definition: frame.h:232
#define AV_LOG_INFO
Standard information.
Definition: log.h:187
#define AV_PIX_FMT_YUV420P14
Definition: pixfmt.h:372
AVDictionary ** avpriv_frame_get_metadatap(AVFrame *frame)
Definition: frame.c:47
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
Definition: frame.h:199
static uint64_t uintpow(uint64_t b, unsigned int e)
Definition: vf_idet.c:56
#define PRECISION
Definition: vf_idet.c:54
float repeat_threshold
Definition: vf_idet.h:46
#define OFFSET(x)
Definition: vf_idet.c:29
RepeatedField
Definition: vf_idet.h:36
GLint GLenum type
Definition: opengl_enc.c:105
int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags)
Set the given entry in *pm, overwriting an existing entry.
Definition: dict.c:69
#define AV_PIX_FMT_YUV420P10
Definition: pixfmt.h:364
planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples)
Definition: pixfmt.h:69
Definition: vf_idet.h:30
Filter definition.
Definition: avfilter.h:470
static const AVFilterPad inputs[]
Definition: af_ashowinfo.c:239
const char * name
Filter name.
Definition: avfilter.h:474
#define AV_PIX_FMT_YUV420P9
Definition: pixfmt.h:361
#define snprintf
Definition: snprintf.h:34
static int config_output(AVFilterLink *outlink)
Definition: vf_idet.c:408
Type last_type
Definition: vf_idet.h:50
AVFilterLink ** outputs
array of pointers to output links
Definition: avfilter.h:648
#define AV_PIX_FMT_YUV422P14
Definition: pixfmt.h:373
#define AV_PIX_FMT_YUV422P10
Definition: pixfmt.h:365
Frame requests may need to loop in order to be fulfilled.
Definition: internal.h:359
static int flags
Definition: cpu.c:47
static int request_frame(AVFilterLink *link)
Definition: vf_idet.c:312
#define AV_PIX_FMT_YUV444P12
Definition: pixfmt.h:371
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
Definition: frame.h:182
uint8_t level
Definition: svq3.c:150
AVFilter ff_vf_idet
Definition: vf_idet.c:454
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
Definition: pixfmt.h:63
Y , 8bpp.
Definition: pixfmt.h:71
AVFrame * cur
Definition: vf_idet.h:61
common internal and external API header
#define exp2(x)
Definition: libm.h:77
static double c[64]
uint64_t repeats[3]
Definition: vf_idet.h:52
uint64_t total_poststat[4]
Definition: vf_idet.h:57
planar YUV 4:4:4, 24bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV444P and setting col...
Definition: pixfmt.h:77
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples)
Definition: pixfmt.h:70
int analyze_interlaced_flag_done
Definition: vf_idet.h:68
int top_field_first
If the content is interlaced, is top field displayed first.
Definition: frame.h:372
static int filter_frame(AVFilterLink *link, AVFrame *picref)
Definition: vf_idet.c:234
uint64_t poststat[4]
Definition: vf_idet.h:54
A list of supported formats for one end of a filter link.
Definition: formats.h:64
An instance of a filter.
Definition: avfilter.h:633
static av_cold int init(AVFilterContext *ctx)
Definition: vf_idet.c:414
int interlaced_flag_accuracy
Definition: vf_idet.h:66
int height
Definition: frame.h:220
planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples)
Definition: pixfmt.h:101
int ff_request_frame(AVFilterLink *link)
Request an input frame from the filter at the other end of the link.
Definition: avfilter.c:343
uint64_t total_repeats[3]
Definition: vf_idet.h:55
internal API functions
AVFrame * prev
Definition: vf_idet.h:63
AVPixelFormat
Pixel format.
Definition: pixfmt.h:61
static int av_dict_set_fxp(AVDictionary **pm, const char *key, uint64_t value, unsigned int digits, int flags)
Definition: vf_idet.c:63
#define AV_PIX_FMT_YUV422P16
Definition: pixfmt.h:376
int(* ff_idet_filter_func)(const uint8_t *a, const uint8_t *b, const uint8_t *c, int w)
Definition: vf_idet.h:27