FFmpeg
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/common.h"
24 #include "libavutil/opt.h"
25 #include "libavutil/pixdesc.h"
26 
27 #include "filters.h"
28 #include "vf_idetdsp.h"
29 
30 typedef enum {
31  TFF,
32  BFF,
35 } Type;
36 
37 typedef enum {
42 
43 typedef struct IDETContext {
44  const AVClass *class;
46 
50  float half_life;
52 
54 
55  uint64_t repeats[3];
56  uint64_t prestat[4];
57  uint64_t poststat[4];
58  uint64_t total_repeats[3];
59  uint64_t total_prestat[4];
60  uint64_t total_poststat[4];
61 
62  #define HIST_SIZE 4
63  uint8_t history[HIST_SIZE];
64 
68 
72 
74  int eof;
75 } IDETContext;
76 
77 #define OFFSET(x) offsetof(IDETContext, x)
78 #define FLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
79 
80 static const AVOption idet_options[] = {
81  { "intl_thres", "set interlacing threshold", OFFSET(interlace_threshold), AV_OPT_TYPE_FLOAT, {.dbl = 1.04}, -1, FLT_MAX, FLAGS },
82  { "prog_thres", "set progressive threshold", OFFSET(progressive_threshold), AV_OPT_TYPE_FLOAT, {.dbl = 1.5}, -1, FLT_MAX, FLAGS },
83  { "rep_thres", "set repeat threshold", OFFSET(repeat_threshold), AV_OPT_TYPE_FLOAT, {.dbl = 3.0}, -1, FLT_MAX, FLAGS },
84  { "half_life", "half life of cumulative statistics", OFFSET(half_life), AV_OPT_TYPE_FLOAT, {.dbl = 0.0}, -1, INT_MAX, FLAGS },
85  { "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 },
86  { NULL }
87 };
88 
90 
91 static const char *type2str(Type type)
92 {
93  switch(type) {
94  case TFF : return "tff";
95  case BFF : return "bff";
96  case PROGRESSIVE : return "progressive";
97  case UNDETERMINED : return "undetermined";
98  }
99  return NULL;
100 }
101 
102 #define PRECISION 1048576
103 
104 static uint64_t uintpow(uint64_t b,unsigned int e)
105 {
106  uint64_t r=1;
107  while(e--) r*=b;
108  return r;
109 }
110 
111 static int av_dict_set_fxp(AVDictionary **pm, const char *key, uint64_t value, unsigned int digits,
112  int flags)
113 {
114  char valuestr[44];
115  uint64_t print_precision = uintpow(10, digits);
116 
117  value = av_rescale(value, print_precision, PRECISION);
118 
119  snprintf(valuestr, sizeof(valuestr), "%"PRId64".%0*"PRId64,
120  value / print_precision, digits, value % print_precision);
121 
122  return av_dict_set(pm, key, valuestr, flags);
123 }
124 
125 static const char *rep2str(RepeatedField repeated_field)
126 {
127  switch(repeated_field) {
128  case REPEAT_NONE : return "neither";
129  case REPEAT_TOP : return "top";
130  case REPEAT_BOTTOM : return "bottom";
131  }
132  return NULL;
133 }
134 
136 {
137  IDETContext *idet = ctx->priv;
138  int y, i;
139  int64_t alpha[2]={0};
140  int64_t delta=0;
141  int64_t gamma[2]={0};
142  Type type, best_type;
143  RepeatedField repeat;
144  int match = 0;
145  AVDictionary **metadata = &idet->cur->metadata;
146  ff_idet_filter_func filter_line = idet->dsp.filter_line;
147 
148  for (i = 0; i < idet->csp->nb_components; i++) {
149  int w = idet->cur->width;
150  int h = idet->cur->height;
151  int refs = idet->cur->linesize[i];
152 
153  if (i && i<3) {
154  w = AV_CEIL_RSHIFT(w, idet->csp->log2_chroma_w);
155  h = AV_CEIL_RSHIFT(h, idet->csp->log2_chroma_h);
156  }
157 
158  for (y = 2; y < h - 2; y++) {
159  uint8_t *prev = &idet->prev->data[i][y*refs];
160  uint8_t *cur = &idet->cur ->data[i][y*refs];
161  uint8_t *next = &idet->next->data[i][y*refs];
162  alpha[ y &1] += filter_line(cur-refs, prev, cur+refs, w);
163  alpha[(y^1)&1] += filter_line(cur-refs, next, cur+refs, w);
164  delta += filter_line(cur-refs, cur, cur+refs, w);
165  gamma[(y^1)&1] += filter_line(cur , prev, cur , w);
166  }
167  }
168 
169  if (alpha[0] > idet->interlace_threshold * alpha[1]){
170  type = TFF;
171  }else if(alpha[1] > idet->interlace_threshold * alpha[0]){
172  type = BFF;
173  }else if(alpha[1] > idet->progressive_threshold * delta){
174  type = PROGRESSIVE;
175  }else{
176  type = UNDETERMINED;
177  }
178 
179  if ( gamma[0] > idet->repeat_threshold * gamma[1] ){
180  repeat = REPEAT_TOP;
181  } else if ( gamma[1] > idet->repeat_threshold * gamma[0] ){
182  repeat = REPEAT_BOTTOM;
183  } else {
184  repeat = REPEAT_NONE;
185  }
186 
187  memmove(idet->history+1, idet->history, HIST_SIZE-1);
188  idet->history[0] = type;
189  best_type = UNDETERMINED;
190  for(i=0; i<HIST_SIZE; i++){
191  if(idet->history[i] != UNDETERMINED){
192  if(best_type == UNDETERMINED)
193  best_type = idet->history[i];
194 
195  if(idet->history[i] == best_type) {
196  match++;
197  }else{
198  match=0;
199  break;
200  }
201  }
202  }
203  if(idet->last_type == UNDETERMINED){
204  if(match ) idet->last_type = best_type;
205  }else{
206  if(match>2) idet->last_type = best_type;
207  }
208 
209  if (idet->last_type == TFF){
211  }else if(idet->last_type == BFF){
214  }else if(idet->last_type == PROGRESSIVE){
216  }
217 
218  for(i=0; i<3; i++)
219  idet->repeats[i] = av_rescale(idet->repeats [i], idet->decay_coefficient, PRECISION);
220 
221  for(i=0; i<4; i++){
222  idet->prestat [i] = av_rescale(idet->prestat [i], idet->decay_coefficient, PRECISION);
223  idet->poststat[i] = av_rescale(idet->poststat[i], idet->decay_coefficient, PRECISION);
224  }
225 
226  idet->total_repeats [ repeat] ++;
227  idet->repeats [ repeat] += PRECISION;
228 
229  idet->total_prestat [ type] ++;
230  idet->prestat [ type] += PRECISION;
231 
232  idet->total_poststat[idet->last_type] ++;
233  idet->poststat [idet->last_type] += PRECISION;
234 
235  av_log(ctx, AV_LOG_DEBUG, "Repeated Field:%12s, Single frame:%12s, Multi frame:%12s\n",
236  rep2str(repeat), type2str(type), type2str(idet->last_type));
237 
238  av_dict_set (metadata, "lavfi.idet.repeated.current_frame", rep2str(repeat), 0);
239  av_dict_set_fxp(metadata, "lavfi.idet.repeated.neither", idet->repeats[REPEAT_NONE], 2, 0);
240  av_dict_set_fxp(metadata, "lavfi.idet.repeated.top", idet->repeats[REPEAT_TOP], 2, 0);
241  av_dict_set_fxp(metadata, "lavfi.idet.repeated.bottom", idet->repeats[REPEAT_BOTTOM], 2, 0);
242 
243  av_dict_set (metadata, "lavfi.idet.single.current_frame", type2str(type), 0);
244  av_dict_set_fxp(metadata, "lavfi.idet.single.tff", idet->prestat[TFF], 2 , 0);
245  av_dict_set_fxp(metadata, "lavfi.idet.single.bff", idet->prestat[BFF], 2, 0);
246  av_dict_set_fxp(metadata, "lavfi.idet.single.progressive", idet->prestat[PROGRESSIVE], 2, 0);
247  av_dict_set_fxp(metadata, "lavfi.idet.single.undetermined", idet->prestat[UNDETERMINED], 2, 0);
248 
249  av_dict_set (metadata, "lavfi.idet.multiple.current_frame", type2str(idet->last_type), 0);
250  av_dict_set_fxp(metadata, "lavfi.idet.multiple.tff", idet->poststat[TFF], 2, 0);
251  av_dict_set_fxp(metadata, "lavfi.idet.multiple.bff", idet->poststat[BFF], 2, 0);
252  av_dict_set_fxp(metadata, "lavfi.idet.multiple.progressive", idet->poststat[PROGRESSIVE], 2, 0);
253  av_dict_set_fxp(metadata, "lavfi.idet.multiple.undetermined", idet->poststat[UNDETERMINED], 2, 0);
254 }
255 
256 static int filter_frame(AVFilterLink *link, AVFrame *picref)
257 {
258  AVFilterContext *ctx = link->dst;
259  IDETContext *idet = ctx->priv;
260 
261  // initial frame(s) and not interlaced, just pass through for
262  // the analyze_interlaced_flag mode
263  if (idet->analyze_interlaced_flag &&
264  !(picref->flags & AV_FRAME_FLAG_INTERLACED) &&
265  !idet->next) {
266  return ff_filter_frame(ctx->outputs[0], picref);
267  }
268  if (idet->analyze_interlaced_flag_done) {
269  if ((picref->flags & AV_FRAME_FLAG_INTERLACED) && idet->interlaced_flag_accuracy < 0) {
270  picref->flags &= ~AV_FRAME_FLAG_INTERLACED;
271  }
272  return ff_filter_frame(ctx->outputs[0], picref);
273  }
274 
275  av_frame_free(&idet->prev);
276 
277  if( picref->width != link->w
278  || picref->height != link->h
279  || picref->format != link->format) {
280  link->dst->inputs[0]->format = picref->format;
281  link->dst->inputs[0]->w = picref->width;
282  link->dst->inputs[0]->h = picref->height;
283 
284  av_frame_free(&idet->cur );
285  av_frame_free(&idet->next);
286  idet->csp = NULL;
287  }
288 
289  idet->prev = idet->cur;
290  idet->cur = idet->next;
291  idet->next = picref;
292 
293  if (!idet->cur &&
294  !(idet->cur = av_frame_clone(idet->next)))
295  return AVERROR(ENOMEM);
296 
297  if (!idet->prev)
298  return 0;
299 
300  if (!idet->csp) {
302  ff_idet_dsp_init(&idet->dsp, idet->csp->comp[0].depth);
303  }
304 
305  if (idet->analyze_interlaced_flag) {
306  if (idet->cur->flags & AV_FRAME_FLAG_INTERLACED) {
308  filter(ctx);
309  if (idet->last_type == PROGRESSIVE) {
310  idet->interlaced_flag_accuracy --;
311  idet->analyze_interlaced_flag --;
312  } else if (idet->last_type != UNDETERMINED) {
313  idet->interlaced_flag_accuracy ++;
314  idet->analyze_interlaced_flag --;
315  }
316  if (idet->analyze_interlaced_flag == 1) {
317  ff_filter_frame(ctx->outputs[0], av_frame_clone(idet->cur));
318 
319  if ((idet->next->flags & AV_FRAME_FLAG_INTERLACED) && idet->interlaced_flag_accuracy < 0) {
321  }
323  av_log(ctx, AV_LOG_INFO, "Final flag accuracy %d\n", idet->interlaced_flag_accuracy);
324  return ff_filter_frame(ctx->outputs[0], av_frame_clone(idet->next));
325  }
326  }
327  } else {
328  filter(ctx);
329  }
330 
331  return ff_filter_frame(ctx->outputs[0], av_frame_clone(idet->cur));
332 }
333 
335 {
336  AVFilterContext *ctx = link->src;
337  IDETContext *idet = ctx->priv;
338  int ret;
339 
340  if (idet->eof)
341  return AVERROR_EOF;
342 
343  ret = ff_request_frame(link->src->inputs[0]);
344 
345  if (ret == AVERROR_EOF && idet->cur && !idet->analyze_interlaced_flag_done) {
346  AVFrame *next = av_frame_clone(idet->next);
347 
348  if (!next)
349  return AVERROR(ENOMEM);
350 
351  ret = filter_frame(link->src->inputs[0], next);
352  idet->eof = 1;
353  }
354 
355  return ret;
356 }
357 
359 {
360  IDETContext *idet = ctx->priv;
361 
362  av_log(ctx, AV_LOG_INFO, "Repeated Fields: Neither:%6"PRId64" Top:%6"PRId64" Bottom:%6"PRId64"\n",
363  idet->total_repeats[REPEAT_NONE],
364  idet->total_repeats[REPEAT_TOP],
366  );
367  av_log(ctx, AV_LOG_INFO, "Single frame detection: TFF:%6"PRId64" BFF:%6"PRId64" Progressive:%6"PRId64" Undetermined:%6"PRId64"\n",
368  idet->total_prestat[TFF],
369  idet->total_prestat[BFF],
370  idet->total_prestat[PROGRESSIVE],
372  );
373  av_log(ctx, AV_LOG_INFO, "Multi frame detection: TFF:%6"PRId64" BFF:%6"PRId64" Progressive:%6"PRId64" Undetermined:%6"PRId64"\n",
374  idet->total_poststat[TFF],
375  idet->total_poststat[BFF],
378  );
379 
380  av_frame_free(&idet->prev);
381  av_frame_free(&idet->cur );
382  av_frame_free(&idet->next);
383 }
384 
385 static const enum AVPixelFormat pix_fmts[] = {
417 };
418 
420 {
421  IDETContext *idet = ctx->priv;
422 
423  idet->eof = 0;
424  idet->last_type = UNDETERMINED;
425  memset(idet->history, UNDETERMINED, HIST_SIZE);
426 
427  if( idet->half_life > 0 )
428  idet->decay_coefficient = lrint( PRECISION * exp2(-1.0 / idet->half_life) );
429  else
431 
432  ff_idet_dsp_init(&idet->dsp, 8);
433 
434  return 0;
435 }
436 
437 static const AVFilterPad idet_inputs[] = {
438  {
439  .name = "default",
440  .type = AVMEDIA_TYPE_VIDEO,
441  .filter_frame = filter_frame,
442  },
443 };
444 
445 static const AVFilterPad idet_outputs[] = {
446  {
447  .name = "default",
448  .type = AVMEDIA_TYPE_VIDEO,
449  .request_frame = request_frame
450  },
451 };
452 
454  .p.name = "idet",
455  .p.description = NULL_IF_CONFIG_SMALL("Interlace detect Filter."),
456  .p.flags = AVFILTER_FLAG_METADATA_ONLY,
457  .p.priv_class = &idet_class,
458  .priv_size = sizeof(IDETContext),
459  .init = init,
460  .uninit = uninit,
464 };
flags
const SwsFlags flags[]
Definition: swscale.c:61
AVPixelFormat
AVPixelFormat
Pixel format.
Definition: pixfmt.h:71
type2str
static const char * type2str(Type type)
Definition: vf_idet.c:91
PRECISION
#define PRECISION
Definition: vf_idet.c:102
RepeatedField
RepeatedField
Definition: vf_idet.c:37
r
const char * r
Definition: vf_curves.c:127
AVERROR
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
opt.h
FILTER_PIXFMTS_ARRAY
#define FILTER_PIXFMTS_ARRAY(array)
Definition: filters.h:243
ff_filter_frame
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
Definition: avfilter.c:1067
REPEAT_BOTTOM
@ REPEAT_BOTTOM
Definition: vf_idet.c:40
av_pix_fmt_desc_get
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
Definition: pixdesc.c:3447
AVERROR_EOF
#define AVERROR_EOF
End of file.
Definition: error.h:57
IDETContext::half_life
float half_life
Definition: vf_idet.c:50
HIST_SIZE
#define HIST_SIZE
Definition: vf_idet.c:62
ff_idet_filter_func
int(* ff_idet_filter_func)(const uint8_t *a, const uint8_t *b, const uint8_t *c, int w)
Definition: vf_idetdsp.h:24
int64_t
long long int64_t
Definition: coverity.c:34
av_frame_free
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
Definition: frame.c:64
FILTER_INPUTS
#define FILTER_INPUTS(array)
Definition: filters.h:263
AVFrame
This structure describes decoded (raw) audio or video data.
Definition: frame.h:427
pixdesc.h
AVFrame::width
int width
Definition: frame.h:499
w
uint8_t w
Definition: llviddspenc.c:38
AVComponentDescriptor::depth
int depth
Number of bits in the component.
Definition: pixdesc.h:57
AVOption
AVOption.
Definition: opt.h:429
b
#define b
Definition: input.c:42
AV_PIX_FMT_YUV420P10
#define AV_PIX_FMT_YUV420P10
Definition: pixfmt.h:539
ff_request_frame
int ff_request_frame(AVFilterLink *link)
Request an input frame from the filter at the other end of the link.
Definition: avfilter.c:483
float.h
AV_PIX_FMT_YUV440P
@ AV_PIX_FMT_YUV440P
planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples)
Definition: pixfmt.h:106
AVDictionary
Definition: dict.c:32
AVFrame::flags
int flags
Frame flags, a combination of AV_FRAME_FLAGS.
Definition: frame.h:671
IDETContext::analyze_interlaced_flag_done
int analyze_interlaced_flag_done
Definition: vf_idet.c:71
AVFilter::name
const char * name
Filter name.
Definition: avfilter.h:220
AVFrame::data
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
Definition: frame.h:448
IDETContext::dsp
IDETDSPContext dsp
Definition: vf_idet.c:45
AV_FRAME_FLAG_TOP_FIELD_FIRST
#define AV_FRAME_FLAG_TOP_FIELD_FIRST
A flag to mark frames where the top field is displayed first if the content is interlaced.
Definition: frame.h:655
IDETContext
Definition: vf_idet.c:43
IDETContext::prestat
uint64_t prestat[4]
Definition: vf_idet.c:56
AV_PIX_FMT_YUV422P9
#define AV_PIX_FMT_YUV422P9
Definition: pixfmt.h:537
type
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf type
Definition: writing_filters.txt:86
AV_PIX_FMT_GRAY16
#define AV_PIX_FMT_GRAY16
Definition: pixfmt.h:522
IDETContext::interlace_threshold
float interlace_threshold
Definition: vf_idet.c:47
AVFilterPad
A filter pad used for either input or output.
Definition: filters.h:39
AV_PIX_FMT_YUV444P10
#define AV_PIX_FMT_YUV444P10
Definition: pixfmt.h:542
IDETContext::prev
AVFrame * prev
Definition: vf_idet.c:67
lrint
#define lrint
Definition: tablegen.h:53
av_cold
#define av_cold
Definition: attributes.h:106
AV_PIX_FMT_YUV422P16
#define AV_PIX_FMT_YUV422P16
Definition: pixfmt.h:551
IDETContext::next
AVFrame * next
Definition: vf_idet.c:66
FFFilter
Definition: filters.h:266
vf_idetdsp.h
AV_PIX_FMT_YUVJ422P
@ AV_PIX_FMT_YUVJ422P
planar YUV 4:2:2, 16bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV422P and setting col...
Definition: pixfmt.h:86
TFF
@ TFF
Definition: vf_idet.c:31
AV_PIX_FMT_YUVA420P
@ AV_PIX_FMT_YUVA420P
planar YUV 4:2:0, 20bpp, (1 Cr & Cb sample per 2x2 Y & A samples)
Definition: pixfmt.h:108
AV_PIX_FMT_YUV444P16
#define AV_PIX_FMT_YUV444P16
Definition: pixfmt.h:552
AV_CEIL_RSHIFT
#define AV_CEIL_RSHIFT(a, b)
Definition: common.h:60
filters.h
AV_PIX_FMT_YUV420P9
#define AV_PIX_FMT_YUV420P9
Definition: pixfmt.h:536
REPEAT_TOP
@ REPEAT_TOP
Definition: vf_idet.c:39
AV_LOG_DEBUG
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
Definition: log.h:231
AV_PIX_FMT_YUV420P16
#define AV_PIX_FMT_YUV420P16
Definition: pixfmt.h:550
ff_vf_idet
const FFFilter ff_vf_idet
Definition: vf_idet.c:453
ctx
AVFormatContext * ctx
Definition: movenc.c:49
av_frame_clone
AVFrame * av_frame_clone(const AVFrame *src)
Create a new frame that references the same data as src.
Definition: frame.c:483
AVPixFmtDescriptor::log2_chroma_w
uint8_t log2_chroma_w
Amount to shift the luma width right to find the chroma width.
Definition: pixdesc.h:80
rep2str
static const char * rep2str(RepeatedField repeated_field)
Definition: vf_idet.c:125
IDETContext::repeat_threshold
float repeat_threshold
Definition: vf_idet.c:49
AV_PIX_FMT_YUV420P
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
Definition: pixfmt.h:73
IDETContext::eof
int eof
Definition: vf_idet.c:74
key
const char * key
Definition: hwcontext_opencl.c:189
FILTER_OUTPUTS
#define FILTER_OUTPUTS(array)
Definition: filters.h:264
IDETContext::csp
const AVPixFmtDescriptor * csp
Definition: vf_idet.c:73
link
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a link
Definition: filter_design.txt:23
AV_PIX_FMT_YUVJ444P
@ AV_PIX_FMT_YUVJ444P
planar YUV 4:4:4, 24bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV444P and setting col...
Definition: pixfmt.h:87
AVClass
Describe the class of an AVClass context structure.
Definition: log.h:76
PROGRESSIVE
@ PROGRESSIVE
Definition: vf_idet.c:33
FLAGS
#define FLAGS
Definition: vf_idet.c:78
IDETDSPContext::filter_line
ff_idet_filter_func filter_line
Definition: vf_idetdsp.h:27
metadata
Stream codec metadata
Definition: ogg-flac-chained-meta.txt:2
NULL
#define NULL
Definition: coverity.c:32
AVPixFmtDescriptor::nb_components
uint8_t nb_components
The number of components each pixel has, (1-4)
Definition: pixdesc.h:71
AV_PIX_FMT_YUVJ420P
@ AV_PIX_FMT_YUVJ420P
planar YUV 4:2:0, 12bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV420P and setting col...
Definition: pixfmt.h:85
AV_PIX_FMT_YUV422P10
#define AV_PIX_FMT_YUV422P10
Definition: pixfmt.h:540
AV_PIX_FMT_GRAY8
@ AV_PIX_FMT_GRAY8
Y , 8bpp.
Definition: pixfmt.h:81
IDETContext::total_poststat
uint64_t total_poststat[4]
Definition: vf_idet.c:60
pix_fmts
static enum AVPixelFormat pix_fmts[]
Definition: vf_idet.c:385
OFFSET
#define OFFSET(x)
Definition: vf_idet.c:77
UNDETERMINED
@ UNDETERMINED
Definition: vf_idet.c:34
IDETContext::interlaced_flag_accuracy
int interlaced_flag_accuracy
Definition: vf_idet.c:69
NULL_IF_CONFIG_SMALL
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition: internal.h:94
REPEAT_NONE
@ REPEAT_NONE
Definition: vf_idet.c:38
AV_PIX_FMT_YUV422P12
#define AV_PIX_FMT_YUV422P12
Definition: pixfmt.h:544
AV_PIX_FMT_YUV444P12
#define AV_PIX_FMT_YUV444P12
Definition: pixfmt.h:546
AVFrame::format
int format
format of the frame, -1 if unknown or unset Values correspond to enum AVPixelFormat for video frames,...
Definition: frame.h:514
uninit
static av_cold void uninit(AVFilterContext *ctx)
Definition: vf_idet.c:358
init
static av_cold int init(AVFilterContext *ctx)
Definition: vf_idet.c:419
AV_PIX_FMT_YUVA444P
@ AV_PIX_FMT_YUVA444P
planar YUV 4:4:4 32bpp, (1 Cr & Cb sample per 1x1 Y & A samples)
Definition: pixfmt.h:174
IDETContext::analyze_interlaced_flag
int analyze_interlaced_flag
Definition: vf_idet.c:70
AV_LOG_INFO
#define AV_LOG_INFO
Standard information.
Definition: log.h:221
idet_outputs
static const AVFilterPad idet_outputs[]
Definition: vf_idet.c:445
AV_OPT_TYPE_FLOAT
@ AV_OPT_TYPE_FLOAT
Underlying C type is float.
Definition: opt.h:271
uintpow
static uint64_t uintpow(uint64_t b, unsigned int e)
Definition: vf_idet.c:104
Type
Type
Definition: vf_idet.c:30
idet_options
static const AVOption idet_options[]
Definition: vf_idet.c:80
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:256
common.h
delta
float delta
Definition: vorbis_enc_data.h:430
exp2
#define exp2(x)
Definition: libm.h:290
value
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf default value
Definition: writing_filters.txt:86
AV_PIX_FMT_YUVJ440P
@ AV_PIX_FMT_YUVJ440P
planar YUV 4:4:0 full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV440P and setting color_range
Definition: pixfmt.h:107
AVFilterPad::name
const char * name
Pad name.
Definition: filters.h:45
av_rescale
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:129
IDETContext::cur
AVFrame * cur
Definition: vf_idet.c:65
AV_FRAME_FLAG_INTERLACED
#define AV_FRAME_FLAG_INTERLACED
A flag to mark frames whose content is interlaced.
Definition: frame.h:650
AV_PIX_FMT_YUV444P9
#define AV_PIX_FMT_YUV444P9
Definition: pixfmt.h:538
IDETContext::poststat
uint64_t poststat[4]
Definition: vf_idet.c:57
IDETContext::total_prestat
uint64_t total_prestat[4]
Definition: vf_idet.c:59
BFF
@ BFF
Definition: vf_idet.c:32
ff_idet_dsp_init
void av_cold ff_idet_dsp_init(IDETDSPContext *dsp, int depth)
Definition: vf_idetdsp.c:56
ret
ret
Definition: filter_design.txt:187
IDETContext::total_repeats
uint64_t total_repeats[3]
Definition: vf_idet.c:58
AV_PIX_FMT_YUV420P12
#define AV_PIX_FMT_YUV420P12
Definition: pixfmt.h:543
AV_PIX_FMT_YUV422P14
#define AV_PIX_FMT_YUV422P14
Definition: pixfmt.h:548
IDETContext::history
uint8_t history[HIST_SIZE]
Definition: vf_idet.c:63
request_frame
static int request_frame(AVFilterLink *link)
Definition: vf_idet.c:334
AVFrame::height
int height
Definition: frame.h:499
idet_inputs
static const AVFilterPad idet_inputs[]
Definition: vf_idet.c:437
AV_PIX_FMT_NONE
@ AV_PIX_FMT_NONE
Definition: pixfmt.h:72
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Underlying C type is int.
Definition: opt.h:259
AVFrame::metadata
AVDictionary * metadata
metadata.
Definition: frame.h:705
IDETContext::repeats
uint64_t repeats[3]
Definition: vf_idet.c:55
AVFILTER_FLAG_METADATA_ONLY
#define AVFILTER_FLAG_METADATA_ONLY
The filter is a "metadata" filter - it does not modify the frame data in any way.
Definition: avfilter.h:183
AVPixFmtDescriptor::comp
AVComponentDescriptor comp[4]
Parameters that describe how pixels are packed.
Definition: pixdesc.h:105
AV_PIX_FMT_YUV444P
@ AV_PIX_FMT_YUV444P
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
Definition: pixfmt.h:78
AVFilterContext
An instance of a filter.
Definition: avfilter.h:274
AVFILTER_DEFINE_CLASS
AVFILTER_DEFINE_CLASS(idet)
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:200
FFFilter::p
AVFilter p
The public AVFilter.
Definition: filters.h:270
AV_PIX_FMT_YUV422P
@ AV_PIX_FMT_YUV422P
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
Definition: pixfmt.h:77
IDETDSPContext
Definition: vf_idetdsp.h:26
AVPixFmtDescriptor
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
Definition: pixdesc.h:69
IDETContext::decay_coefficient
uint64_t decay_coefficient
Definition: vf_idet.c:51
IDETContext::progressive_threshold
float progressive_threshold
Definition: vf_idet.c:48
alpha
static const int16_t alpha[]
Definition: ilbcdata.h:55
filter_frame
static int filter_frame(AVFilterLink *link, AVFrame *picref)
Definition: vf_idet.c:256
av_dict_set
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:86
AV_PIX_FMT_YUV411P
@ AV_PIX_FMT_YUV411P
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples)
Definition: pixfmt.h:80
AVFrame::linesize
int linesize[AV_NUM_DATA_POINTERS]
For video, a positive or negative value, which is typically indicating the size in bytes of each pict...
Definition: frame.h:472
AV_PIX_FMT_YUV410P
@ AV_PIX_FMT_YUV410P
planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples)
Definition: pixfmt.h:79
av_log
#define av_log(a,...)
Definition: tableprint_vlc.h:27
h
h
Definition: vp9dsp_template.c:2070
AV_PIX_FMT_YUV444P14
#define AV_PIX_FMT_YUV444P14
Definition: pixfmt.h:549
IDETContext::last_type
Type last_type
Definition: vf_idet.c:53
snprintf
#define snprintf
Definition: snprintf.h:34
filter
static void filter(AVFilterContext *ctx)
Definition: vf_idet.c:135
av_dict_set_fxp
static int av_dict_set_fxp(AVDictionary **pm, const char *key, uint64_t value, unsigned int digits, int flags)
Definition: vf_idet.c:111
AVPixFmtDescriptor::log2_chroma_h
uint8_t log2_chroma_h
Amount to shift the luma height right to find the chroma height.
Definition: pixdesc.h:89
AV_PIX_FMT_YUVA422P
@ AV_PIX_FMT_YUVA422P
planar YUV 4:2:2 24bpp, (1 Cr & Cb sample per 2x1 Y & A samples)
Definition: pixfmt.h:173
AV_PIX_FMT_YUV420P14
#define AV_PIX_FMT_YUV420P14
Definition: pixfmt.h:547