FFmpeg
vf_dedot.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2018 Paul B Mahol
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 "libavutil/opt.h"
22 #include "libavutil/pixdesc.h"
23 
24 #include "avfilter.h"
25 #include "filters.h"
26 #include "internal.h"
27 #include "video.h"
28 
29 typedef struct DedotContext {
30  const AVClass *class;
31  int m;
32  float lt;
33  float tl;
34  float tc;
35  float ct;
36 
38  int depth;
39  int max;
40  int luma2d;
41  int lumaT;
42  int chromaT1;
43  int chromaT2;
44 
45  int eof;
47  int nb_planes;
48  int planewidth[4];
49  int planeheight[4];
50 
52 
53  int (*dedotcrawl)(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs);
54  int (*derainbow)(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs);
55 } DedotContext;
56 
57 static const enum AVPixelFormat pixel_fmts[] = {
73 };
74 
75 #define DEFINE_DEDOTCRAWL(name, type, div) \
76 static int dedotcrawl##name(AVFilterContext *ctx, void *arg, \
77  int jobnr, int nb_jobs) \
78 { \
79  DedotContext *s = ctx->priv; \
80  AVFrame *out = arg; \
81  int src_linesize = s->frames[2]->linesize[0] / div; \
82  int dst_linesize = out->linesize[0] / div; \
83  int p0_linesize = s->frames[0]->linesize[0] / div; \
84  int p1_linesize = s->frames[1]->linesize[0] / div; \
85  int p3_linesize = s->frames[3]->linesize[0] / div; \
86  int p4_linesize = s->frames[4]->linesize[0] / div; \
87  const int h = s->planeheight[0]; \
88  int slice_start = (h * jobnr) / nb_jobs; \
89  int slice_end = (h * (jobnr+1)) / nb_jobs; \
90  type *p0 = (type *)s->frames[0]->data[0]; \
91  type *p1 = (type *)s->frames[1]->data[0]; \
92  type *p3 = (type *)s->frames[3]->data[0]; \
93  type *p4 = (type *)s->frames[4]->data[0]; \
94  type *src = (type *)s->frames[2]->data[0]; \
95  type *dst = (type *)out->data[0]; \
96  const int luma2d = s->luma2d; \
97  const int lumaT = s->lumaT; \
98  \
99  if (!slice_start) { \
100  slice_start++; \
101  } \
102  p0 += p0_linesize * slice_start; \
103  p1 += p1_linesize * slice_start; \
104  p3 += p3_linesize * slice_start; \
105  p4 += p4_linesize * slice_start; \
106  src += src_linesize * slice_start; \
107  dst += dst_linesize * slice_start; \
108  if (slice_end == h) { \
109  slice_end--; \
110  } \
111  for (int y = slice_start; y < slice_end; y++) { \
112  for (int x = 1; x < s->planewidth[0] - 1; x++) { \
113  int above = src[x - src_linesize]; \
114  int below = src[x + src_linesize]; \
115  int cur = src[x]; \
116  int left = src[x - 1]; \
117  int right = src[x + 1]; \
118  \
119  if (FFABS(above + below - 2 * cur) <= luma2d && \
120  FFABS(left + right - 2 * cur) <= luma2d) \
121  continue; \
122  \
123  if (FFABS(cur - p0[x]) <= lumaT && \
124  FFABS(cur - p4[x]) <= lumaT && \
125  FFABS(p1[x] - p3[x]) <= lumaT) { \
126  int diff1 = FFABS(cur - p1[x]); \
127  int diff2 = FFABS(cur - p3[x]); \
128  \
129  if (diff1 < diff2) \
130  dst[x] = (src[x] + p1[x] + 1) >> 1; \
131  else \
132  dst[x] = (src[x] + p3[x] + 1) >> 1; \
133  } \
134  } \
135  \
136  dst += dst_linesize; \
137  src += src_linesize; \
138  p0 += p0_linesize; \
139  p1 += p1_linesize; \
140  p3 += p3_linesize; \
141  p4 += p4_linesize; \
142  } \
143  return 0; \
144 }
145 
146 DEFINE_DEDOTCRAWL(8, uint8_t, 1)
147 DEFINE_DEDOTCRAWL(16, uint16_t, 2)
148 
149 typedef struct ThreadData {
150  AVFrame *out;
151  int plane;
152 } ThreadData;
153 
154 #define DEFINE_DERAINBOW(name, type, div) \
155 static int derainbow##name(AVFilterContext *ctx, void *arg, \
156  int jobnr, int nb_jobs) \
157 { \
158  DedotContext *s = ctx->priv; \
159  ThreadData *td = arg; \
160  AVFrame *out = td->out; \
161  const int plane = td->plane; \
162  const int h = s->planeheight[plane]; \
163  int slice_start = (h * jobnr) / nb_jobs; \
164  int slice_end = (h * (jobnr+1)) / nb_jobs; \
165  int src_linesize = s->frames[2]->linesize[plane] / div; \
166  int dst_linesize = out->linesize[plane] / div; \
167  int p0_linesize = s->frames[0]->linesize[plane] / div; \
168  int p1_linesize = s->frames[1]->linesize[plane] / div; \
169  int p3_linesize = s->frames[3]->linesize[plane] / div; \
170  int p4_linesize = s->frames[4]->linesize[plane] / div; \
171  type *p0 = (type *)s->frames[0]->data[plane]; \
172  type *p1 = (type *)s->frames[1]->data[plane]; \
173  type *p3 = (type *)s->frames[3]->data[plane]; \
174  type *p4 = (type *)s->frames[4]->data[plane]; \
175  type *src = (type *)s->frames[2]->data[plane]; \
176  type *dst = (type *)out->data[plane]; \
177  const int chromaT1 = s->chromaT1; \
178  const int chromaT2 = s->chromaT2; \
179  \
180  p0 += slice_start * p0_linesize; \
181  p1 += slice_start * p1_linesize; \
182  p3 += slice_start * p3_linesize; \
183  p4 += slice_start * p4_linesize; \
184  src += slice_start * src_linesize; \
185  dst += slice_start * dst_linesize; \
186  for (int y = slice_start; y < slice_end; y++) { \
187  for (int x = 0; x < s->planewidth[plane]; x++) { \
188  int cur = src[x]; \
189  \
190  if (FFABS(cur - p0[x]) <= chromaT1 && \
191  FFABS(cur - p4[x]) <= chromaT1 && \
192  FFABS(p1[x] - p3[x]) <= chromaT1 && \
193  FFABS(cur - p1[x]) > chromaT2 && \
194  FFABS(cur - p3[x]) > chromaT2) { \
195  int diff1 = FFABS(cur - p1[x]); \
196  int diff2 = FFABS(cur - p3[x]); \
197  \
198  if (diff1 < diff2) \
199  dst[x] = (src[x] + p1[x] + 1) >> 1; \
200  else \
201  dst[x] = (src[x] + p3[x] + 1) >> 1; \
202  } \
203  } \
204  \
205  dst += dst_linesize; \
206  src += src_linesize; \
207  p0 += p0_linesize; \
208  p1 += p1_linesize; \
209  p3 += p3_linesize; \
210  p4 += p4_linesize; \
211  } \
212  return 0; \
213 }
214 
215 DEFINE_DERAINBOW(8, uint8_t, 1)
216 DEFINE_DERAINBOW(16, uint16_t, 2)
217 
218 static int config_output(AVFilterLink *outlink)
219 {
220  AVFilterContext *ctx = outlink->src;
221  DedotContext *s = ctx->priv;
222  AVFilterLink *inlink = ctx->inputs[0];
223 
224  s->desc = av_pix_fmt_desc_get(outlink->format);
225  if (!s->desc)
226  return AVERROR_BUG;
227  s->nb_planes = av_pix_fmt_count_planes(outlink->format);
228  s->depth = s->desc->comp[0].depth;
229  s->max = (1 << s->depth) - 1;
230  s->luma2d = s->lt * s->max;
231  s->lumaT = s->tl * s->max;
232  s->chromaT1 = s->tc * s->max;
233  s->chromaT2 = s->ct * s->max;
234 
235  s->planewidth[1] = s->planewidth[2] = AV_CEIL_RSHIFT(inlink->w, s->desc->log2_chroma_w);
236  s->planewidth[0] = s->planewidth[3] = inlink->w;
237 
238  s->planeheight[1] = s->planeheight[2] = AV_CEIL_RSHIFT(inlink->h, s->desc->log2_chroma_h);
239  s->planeheight[0] = s->planeheight[3] = inlink->h;
240 
241  if (s->depth <= 8) {
242  s->dedotcrawl = dedotcrawl8;
243  s->derainbow = derainbow8;
244  } else {
245  s->dedotcrawl = dedotcrawl16;
246  s->derainbow = derainbow16;
247  }
248 
249  return 0;
250 }
251 
253 {
254  AVFilterLink *inlink = ctx->inputs[0];
255  AVFilterLink *outlink = ctx->outputs[0];
256  DedotContext *s = ctx->priv;
257  AVFrame *frame = NULL;
258  int64_t pts;
259  int status;
260  int ret = 0;
261 
263 
264  if (s->eof == 0) {
266  if (ret < 0)
267  return ret;
268  }
269  if (frame || s->eof_frames > 0) {
270  AVFrame *out = NULL;
271 
272  if (frame) {
273  for (int i = 2; i < 5; i++) {
274  if (!s->frames[i])
275  s->frames[i] = av_frame_clone(frame);
276  }
278  } else if (s->frames[3]) {
279  s->eof_frames--;
280  s->frames[4] = av_frame_clone(s->frames[3]);
281  }
282 
283  if (s->frames[0] &&
284  s->frames[1] &&
285  s->frames[2] &&
286  s->frames[3] &&
287  s->frames[4]) {
288  out = av_frame_clone(s->frames[2]);
289  if (out && !ctx->is_disabled) {
291  if (ret >= 0) {
292  if (s->m & 1)
293  ff_filter_execute(ctx, s->dedotcrawl, out, NULL,
295  s->planeheight[0]));
296  if (s->m & 2) {
297  ThreadData td;
298  td.out = out; td.plane = 1;
299  ff_filter_execute(ctx, s->derainbow, &td, NULL,
301  s->planeheight[1]));
302  td.plane = 2;
303  ff_filter_execute(ctx, s->derainbow, &td, NULL,
305  s->planeheight[2]));
306  }
307  } else
308  av_frame_free(&out);
309  } else if (!out) {
310  ret = AVERROR(ENOMEM);
311  }
312  }
313 
314  av_frame_free(&s->frames[0]);
315  s->frames[0] = s->frames[1];
316  s->frames[1] = s->frames[2];
317  s->frames[2] = s->frames[3];
318  s->frames[3] = s->frames[4];
319  s->frames[4] = NULL;
320 
321  if (ret < 0)
322  return ret;
323  if (out)
324  return ff_filter_frame(outlink, out);
325  }
326 
327  if (s->eof) {
328  if (s->eof_frames <= 0) {
329  ff_outlink_set_status(outlink, AVERROR_EOF, s->frames[2]->pts);
330  } else {
332  }
333  return 0;
334  }
335 
336  if (!s->eof && ff_inlink_acknowledge_status(inlink, &status, &pts)) {
337  if (status == AVERROR_EOF) {
338  s->eof = 1;
339  s->eof_frames = !!s->frames[0] + !!s->frames[1];
340  if (s->eof_frames <= 0) {
342  return 0;
343  }
345  return 0;
346  }
347  }
348 
350 
351  return FFERROR_NOT_READY;
352 }
353 
355 {
356  DedotContext *s = ctx->priv;
357 
358  for (int i = 0; i < 5; i++)
359  av_frame_free(&s->frames[i]);
360 }
361 
362 #define OFFSET(x) offsetof(DedotContext, x)
363 #define FLAGS AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_FILTERING_PARAM
364 
365 static const AVOption dedot_options[] = {
366  { "m", "set filtering mode", OFFSET( m), AV_OPT_TYPE_FLAGS, {.i64=3}, 0, 3, FLAGS, .unit = "m" },
367  { "dotcrawl", 0, 0, AV_OPT_TYPE_CONST, {.i64=1}, 0, 0, FLAGS, .unit = "m" },
368  { "rainbows", 0, 0, AV_OPT_TYPE_CONST, {.i64=2}, 0, 0, FLAGS, .unit = "m" },
369  { "lt", "set spatial luma threshold", OFFSET(lt), AV_OPT_TYPE_FLOAT, {.dbl=.079}, 0, 1, FLAGS },
370  { "tl", "set tolerance for temporal luma", OFFSET(tl), AV_OPT_TYPE_FLOAT, {.dbl=.079}, 0, 1, FLAGS },
371  { "tc", "set tolerance for chroma temporal variation", OFFSET(tc), AV_OPT_TYPE_FLOAT, {.dbl=.058}, 0, 1, FLAGS },
372  { "ct", "set temporal chroma threshold", OFFSET(ct), AV_OPT_TYPE_FLOAT, {.dbl=.019}, 0, 1, FLAGS },
373  { NULL },
374 };
375 
376 static const AVFilterPad outputs[] = {
377  {
378  .name = "default",
379  .type = AVMEDIA_TYPE_VIDEO,
380  .config_props = config_output,
381  },
382 };
383 
384 AVFILTER_DEFINE_CLASS(dedot);
385 
387  .name = "dedot",
388  .description = NULL_IF_CONFIG_SMALL("Reduce cross-luminance and cross-color."),
389  .priv_size = sizeof(DedotContext),
390  .priv_class = &dedot_class,
391  .activate = activate,
392  .uninit = uninit,
397 };
AV_PIX_FMT_YUVA422P16
#define AV_PIX_FMT_YUVA422P16
Definition: pixfmt.h:522
td
#define td
Definition: regdef.h:70
AVPixelFormat
AVPixelFormat
Pixel format.
Definition: pixfmt.h:71
DedotContext
Definition: vf_dedot.c:29
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
ff_vf_dedot
const AVFilter ff_vf_dedot
Definition: vf_dedot.c:386
opt.h
outputs
static const AVFilterPad outputs[]
Definition: vf_dedot.c:376
out
FILE * out
Definition: movenc.c:55
ff_filter_frame
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
Definition: avfilter.c:1015
av_pix_fmt_desc_get
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
Definition: pixdesc.c:2965
AVERROR_EOF
#define AVERROR_EOF
End of file.
Definition: error.h:57
FFERROR_NOT_READY
return FFERROR_NOT_READY
Definition: filter_design.txt:204
FILTER_PIXFMTS_ARRAY
#define FILTER_PIXFMTS_ARRAY(array)
Definition: internal.h:162
DedotContext::depth
int depth
Definition: vf_dedot.c:38
inlink
The exact code depends on how similar the blocks are and how related they are to the and needs to apply these operations to the correct inlink or outlink if there are several Macros are available to factor that when no extra processing is inlink
Definition: filter_design.txt:212
av_frame_free
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
Definition: frame.c:160
DedotContext::nb_planes
int nb_planes
Definition: vf_dedot.c:47
AV_PIX_FMT_YUVA422P9
#define AV_PIX_FMT_YUVA422P9
Definition: pixfmt.h:514
AVFrame
This structure describes decoded (raw) audio or video data.
Definition: frame.h:374
pixdesc.h
AV_PIX_FMT_YUVA420P16
#define AV_PIX_FMT_YUVA420P16
Definition: pixfmt.h:521
AV_PIX_FMT_YUVA420P10
#define AV_PIX_FMT_YUVA420P10
Definition: pixfmt.h:516
config_output
static int config_output(AVFilterLink *outlink)
Definition: vf_dedot.c:218
AVOption
AVOption.
Definition: opt.h:346
AV_PIX_FMT_YUV420P10
#define AV_PIX_FMT_YUV420P10
Definition: pixfmt.h:478
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
AVFilter::name
const char * name
Filter name.
Definition: avfilter.h:170
video.h
AV_PIX_FMT_YUVA422P10
#define AV_PIX_FMT_YUVA422P10
Definition: pixfmt.h:517
FF_FILTER_FORWARD_STATUS_BACK
#define FF_FILTER_FORWARD_STATUS_BACK(outlink, inlink)
Forward the status on an output link to an input link.
Definition: filters.h:199
ff_inlink_consume_frame
int ff_inlink_consume_frame(AVFilterLink *link, AVFrame **rframe)
Take a frame from the link's FIFO and update the link's stats.
Definition: avfilter.c:1442
av_pix_fmt_count_planes
int av_pix_fmt_count_planes(enum AVPixelFormat pix_fmt)
Definition: pixdesc.c:3005
AV_PIX_FMT_YUVA420P9
#define AV_PIX_FMT_YUVA420P9
Definition: pixfmt.h:513
AVFILTER_DEFINE_CLASS
AVFILTER_DEFINE_CLASS(dedot)
DedotContext::max
int max
Definition: vf_dedot.c:39
AV_PIX_FMT_YUVA444P16
#define AV_PIX_FMT_YUVA444P16
Definition: pixfmt.h:523
AV_PIX_FMT_YUV422P9
#define AV_PIX_FMT_YUV422P9
Definition: pixfmt.h:476
DedotContext::lumaT
int lumaT
Definition: vf_dedot.c:41
pts
static int64_t pts
Definition: transcode_aac.c:644
AVFilterPad
A filter pad used for either input or output.
Definition: internal.h:33
AV_PIX_FMT_YUV444P10
#define AV_PIX_FMT_YUV444P10
Definition: pixfmt.h:481
AV_PIX_FMT_YUVJ411P
@ AV_PIX_FMT_YUVJ411P
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples) full scale (JPEG), deprecated in favor ...
Definition: pixfmt.h:283
av_cold
#define av_cold
Definition: attributes.h:90
AV_PIX_FMT_YUV422P16
#define AV_PIX_FMT_YUV422P16
Definition: pixfmt.h:490
ff_video_default_filterpad
const AVFilterPad ff_video_default_filterpad[1]
An AVFilterPad array whose only entry has name "default" and is of type AVMEDIA_TYPE_VIDEO.
Definition: video.c:37
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
ff_outlink_set_status
static void ff_outlink_set_status(AVFilterLink *link, int status, int64_t pts)
Set the status field of a link from the source filter.
Definition: filters.h:189
s
#define s(width, name)
Definition: cbs_vp9.c:198
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:491
AV_CEIL_RSHIFT
#define AV_CEIL_RSHIFT(a, b)
Definition: common.h:59
DedotContext::desc
const AVPixFmtDescriptor * desc
Definition: vf_dedot.c:37
DedotContext::chromaT1
int chromaT1
Definition: vf_dedot.c:42
filters.h
AV_PIX_FMT_YUVA444P12
#define AV_PIX_FMT_YUVA444P12
Definition: pixfmt.h:520
AV_PIX_FMT_YUV420P9
#define AV_PIX_FMT_YUV420P9
Definition: pixfmt.h:475
AV_PIX_FMT_YUV420P16
#define AV_PIX_FMT_YUV420P16
Definition: pixfmt.h:489
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:593
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
DedotContext::chromaT2
int chromaT2
Definition: vf_dedot.c:43
FILTER_INPUTS
#define FILTER_INPUTS(array)
Definition: internal.h:182
DedotContext::ct
float ct
Definition: vf_dedot.c:35
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
ff_inlink_make_frame_writable
int ff_inlink_make_frame_writable(AVFilterLink *link, AVFrame **rframe)
Make sure a frame is writable.
Definition: avfilter.c:1489
arg
const char * arg
Definition: jacosubdec.c:67
AVClass
Describe the class of an AVClass context structure.
Definition: log.h:66
NULL
#define NULL
Definition: coverity.c:32
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
DEFINE_DEDOTCRAWL
#define DEFINE_DEDOTCRAWL(name, type, div)
Definition: vf_dedot.c:75
DedotContext::planeheight
int planeheight[4]
Definition: vf_dedot.c:49
AV_PIX_FMT_YUV422P10
#define AV_PIX_FMT_YUV422P10
Definition: pixfmt.h:479
ff_inlink_acknowledge_status
int ff_inlink_acknowledge_status(AVFilterLink *link, int *rstatus, int64_t *rpts)
Test and acknowledge the change of status on the link.
Definition: avfilter.c:1389
DedotContext::derainbow
int(* derainbow)(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
Definition: vf_dedot.c:54
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
DedotContext::dedotcrawl
int(* dedotcrawl)(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
Definition: vf_dedot.c:53
uninit
static av_cold void uninit(AVFilterContext *ctx)
Definition: vf_dedot.c:354
DedotContext::planewidth
int planewidth[4]
Definition: vf_dedot.c:48
AV_PIX_FMT_YUV422P12
#define AV_PIX_FMT_YUV422P12
Definition: pixfmt.h:483
AV_PIX_FMT_YUV444P12
#define AV_PIX_FMT_YUV444P12
Definition: pixfmt.h:485
FLAGS
#define FLAGS
Definition: vf_dedot.c:363
DedotContext::eof_frames
int eof_frames
Definition: vf_dedot.c:46
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
AV_PIX_FMT_YUVA444P10
#define AV_PIX_FMT_YUVA444P10
Definition: pixfmt.h:518
FF_FILTER_FORWARD_WANTED
FF_FILTER_FORWARD_WANTED(outlink, inlink)
pixel_fmts
static enum AVPixelFormat pixel_fmts[]
Definition: vf_dedot.c:57
internal.h
AV_OPT_TYPE_FLOAT
@ AV_OPT_TYPE_FLOAT
Definition: opt.h:238
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:256
DedotContext::luma2d
int luma2d
Definition: vf_dedot.c:40
ff_filter_get_nb_threads
int ff_filter_get_nb_threads(AVFilterContext *ctx)
Get number of threads for current filter instance.
Definition: avfilter.c:827
ThreadData
Used for passing data between threads.
Definition: dsddec.c:71
FFMIN
#define FFMIN(a, b)
Definition: macros.h:49
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
DedotContext::tc
float tc
Definition: vf_dedot.c:34
AVFilterPad::name
const char * name
Pad name.
Definition: internal.h:39
AV_PIX_FMT_YUV444P9
#define AV_PIX_FMT_YUV444P9
Definition: pixfmt.h:477
DEFINE_DERAINBOW
#define DEFINE_DERAINBOW(name, type, div)
Definition: vf_dedot.c:154
AVFilter
Filter definition.
Definition: avfilter.h:166
DedotContext::frames
AVFrame * frames[5]
Definition: vf_dedot.c:51
DedotContext::tl
float tl
Definition: vf_dedot.c:33
ret
ret
Definition: filter_design.txt:187
frame
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several the filter must be ready for frames arriving randomly on any input any filter with several inputs will most likely require some kind of queuing mechanism It is perfectly acceptable to have a limited queue and to drop frames when the inputs are too unbalanced request_frame For filters that do not use the this method is called when a frame is wanted on an output For a it should directly call filter_frame on the corresponding output For a if there are queued frames already one of these frames should be pushed If the filter should request a frame on one of its repeatedly until at least one frame has been pushed Return or at least make progress towards producing a frame
Definition: filter_design.txt:264
AV_PIX_FMT_YUVA444P9
#define AV_PIX_FMT_YUVA444P9
Definition: pixfmt.h:515
AV_PIX_FMT_YUV420P12
#define AV_PIX_FMT_YUV420P12
Definition: pixfmt.h:482
AV_PIX_FMT_YUV422P14
#define AV_PIX_FMT_YUV422P14
Definition: pixfmt.h:487
OFFSET
#define OFFSET(x)
Definition: vf_dedot.c:362
status
ov_status_e status
Definition: dnn_backend_openvino.c:121
DedotContext::eof
int eof
Definition: vf_dedot.c:45
DedotContext::m
int m
Definition: vf_dedot.c:31
AV_PIX_FMT_NONE
@ AV_PIX_FMT_NONE
Definition: pixfmt.h:72
AV_PIX_FMT_YUVA422P12
#define AV_PIX_FMT_YUVA422P12
Definition: pixfmt.h:519
avfilter.h
dedot_options
static const AVOption dedot_options[]
Definition: vf_dedot.c:365
DedotContext::lt
float lt
Definition: vf_dedot.c:32
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:407
tc
#define tc
Definition: regdef.h:69
AVFILTER_FLAG_SLICE_THREADS
#define AVFILTER_FLAG_SLICE_THREADS
The filter supports multithreading by splitting frames into multiple parts and processing them concur...
Definition: avfilter.h:117
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
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
AVPixFmtDescriptor
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
Definition: pixdesc.h:69
FILTER_OUTPUTS
#define FILTER_OUTPUTS(array)
Definition: internal.h:183
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
AV_OPT_TYPE_FLAGS
@ AV_OPT_TYPE_FLAGS
Definition: opt.h:234
AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL
#define AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL
Same as AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC, except that the filter will have its filter_frame() c...
Definition: avfilter.h:155
AVERROR_BUG
#define AVERROR_BUG
Internal bug, also see AVERROR_BUG2.
Definition: error.h:52
activate
static int activate(AVFilterContext *ctx)
Definition: vf_dedot.c:252
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_PIX_FMT_YUV440P12
#define AV_PIX_FMT_YUV440P12
Definition: pixfmt.h:484
AV_PIX_FMT_YUV444P14
#define AV_PIX_FMT_YUV444P14
Definition: pixfmt.h:488
ff_filter_execute
static av_always_inline int ff_filter_execute(AVFilterContext *ctx, avfilter_action_func *func, void *arg, int *ret, int nb_jobs)
Definition: internal.h:134
int
int
Definition: ffmpeg_filter.c:424
AV_OPT_TYPE_CONST
@ AV_OPT_TYPE_CONST
Definition: opt.h:244
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:486
ff_filter_set_ready
void ff_filter_set_ready(AVFilterContext *filter, unsigned priority)
Mark a filter ready and schedule it for activation.
Definition: avfilter.c:235