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/imgutils.h"
22 #include "libavutil/opt.h"
23 #include "libavutil/pixdesc.h"
24 
25 #include "avfilter.h"
26 #include "filters.h"
27 #include "formats.h"
28 #include "internal.h"
29 #include "video.h"
30 
31 typedef struct DedotContext {
32  const AVClass *class;
33  int m;
34  float lt;
35  float tl;
36  float tc;
37  float ct;
38 
40  int depth;
41  int max;
42  int luma2d;
43  int lumaT;
44  int chromaT1;
45  int chromaT2;
46 
47  int eof;
49  int nb_planes;
50  int planewidth[4];
51  int planeheight[4];
52 
54 
55  int (*dedotcrawl)(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs);
56  int (*derainbow)(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs);
57 } DedotContext;
58 
60 {
61  static const enum AVPixelFormat pixel_fmts[] = {
76  };
78  if (!formats)
79  return AVERROR(ENOMEM);
81 }
82 
83 #define DEFINE_DEDOTCRAWL(name, type, div) \
84 static int dedotcrawl##name(AVFilterContext *ctx, void *arg, \
85  int jobnr, int nb_jobs) \
86 { \
87  DedotContext *s = ctx->priv; \
88  AVFrame *out = arg; \
89  int src_linesize = s->frames[2]->linesize[0] / div; \
90  int dst_linesize = out->linesize[0] / div; \
91  int p0_linesize = s->frames[0]->linesize[0] / div; \
92  int p1_linesize = s->frames[1]->linesize[0] / div; \
93  int p3_linesize = s->frames[3]->linesize[0] / div; \
94  int p4_linesize = s->frames[4]->linesize[0] / div; \
95  const int h = s->planeheight[0]; \
96  int slice_start = (h * jobnr) / nb_jobs; \
97  int slice_end = (h * (jobnr+1)) / nb_jobs; \
98  type *p0 = (type *)s->frames[0]->data[0]; \
99  type *p1 = (type *)s->frames[1]->data[0]; \
100  type *p3 = (type *)s->frames[3]->data[0]; \
101  type *p4 = (type *)s->frames[4]->data[0]; \
102  type *src = (type *)s->frames[2]->data[0]; \
103  type *dst = (type *)out->data[0]; \
104  const int luma2d = s->luma2d; \
105  const int lumaT = s->lumaT; \
106  \
107  if (!slice_start) { \
108  slice_start++; \
109  } \
110  p0 += p0_linesize * slice_start; \
111  p1 += p1_linesize * slice_start; \
112  p3 += p3_linesize * slice_start; \
113  p4 += p4_linesize * slice_start; \
114  src += src_linesize * slice_start; \
115  dst += dst_linesize * slice_start; \
116  if (slice_end == h) { \
117  slice_end--; \
118  } \
119  for (int y = slice_start; y < slice_end; y++) { \
120  for (int x = 1; x < s->planewidth[0] - 1; x++) { \
121  int above = src[x - src_linesize]; \
122  int bellow = src[x + src_linesize]; \
123  int cur = src[x]; \
124  int left = src[x - 1]; \
125  int right = src[x + 1]; \
126  \
127  if (FFABS(above + bellow - 2 * cur) <= luma2d && \
128  FFABS(left + right - 2 * cur) <= luma2d) \
129  continue; \
130  \
131  if (FFABS(cur - p0[x]) <= lumaT && \
132  FFABS(cur - p4[x]) <= lumaT && \
133  FFABS(p1[x] - p3[x]) <= lumaT) { \
134  int diff1 = FFABS(cur - p1[x]); \
135  int diff2 = FFABS(cur - p3[x]); \
136  \
137  if (diff1 < diff2) \
138  dst[x] = (src[x] + p1[x] + 1) >> 1; \
139  else \
140  dst[x] = (src[x] + p3[x] + 1) >> 1; \
141  } \
142  } \
143  \
144  dst += dst_linesize; \
145  src += src_linesize; \
146  p0 += p0_linesize; \
147  p1 += p1_linesize; \
148  p3 += p3_linesize; \
149  p4 += p4_linesize; \
150  } \
151  return 0; \
152 }
153 
155 DEFINE_DEDOTCRAWL(16, uint16_t, 2)
156 
157 typedef struct ThreadData {
158  AVFrame *out;
159  int plane;
160 } ThreadData;
161 
162 #define DEFINE_DERAINBOW(name, type, div) \
163 static int derainbow##name(AVFilterContext *ctx, void *arg, \
164  int jobnr, int nb_jobs) \
165 { \
166  DedotContext *s = ctx->priv; \
167  ThreadData *td = arg; \
168  AVFrame *out = td->out; \
169  const int plane = td->plane; \
170  const int h = s->planeheight[plane]; \
171  int slice_start = (h * jobnr) / nb_jobs; \
172  int slice_end = (h * (jobnr+1)) / nb_jobs; \
173  int src_linesize = s->frames[2]->linesize[plane] / div; \
174  int dst_linesize = out->linesize[plane] / div; \
175  int p0_linesize = s->frames[0]->linesize[plane] / div; \
176  int p1_linesize = s->frames[1]->linesize[plane] / div; \
177  int p3_linesize = s->frames[3]->linesize[plane] / div; \
178  int p4_linesize = s->frames[4]->linesize[plane] / div; \
179  type *p0 = (type *)s->frames[0]->data[plane]; \
180  type *p1 = (type *)s->frames[1]->data[plane]; \
181  type *p3 = (type *)s->frames[3]->data[plane]; \
182  type *p4 = (type *)s->frames[4]->data[plane]; \
183  type *src = (type *)s->frames[2]->data[plane]; \
184  type *dst = (type *)out->data[plane]; \
185  const int chromaT1 = s->chromaT1; \
186  const int chromaT2 = s->chromaT2; \
187  \
188  p0 += slice_start * p0_linesize; \
189  p1 += slice_start * p1_linesize; \
190  p3 += slice_start * p3_linesize; \
191  p4 += slice_start * p4_linesize; \
192  src += slice_start * src_linesize; \
193  dst += slice_start * dst_linesize; \
194  for (int y = slice_start; y < slice_end; y++) { \
195  for (int x = 0; x < s->planewidth[plane]; x++) { \
196  int cur = src[x]; \
197  \
198  if (FFABS(cur - p0[x]) <= chromaT1 && \
199  FFABS(cur - p4[x]) <= chromaT1 && \
200  FFABS(p1[x] - p3[x]) <= chromaT1 && \
201  FFABS(cur - p1[x]) > chromaT2 && \
202  FFABS(cur - p3[x]) > chromaT2) { \
203  int diff1 = FFABS(cur - p1[x]); \
204  int diff2 = FFABS(cur - p3[x]); \
205  \
206  if (diff1 < diff2) \
207  dst[x] = (src[x] + p1[x] + 1) >> 1; \
208  else \
209  dst[x] = (src[x] + p3[x] + 1) >> 1; \
210  } \
211  } \
212  \
213  dst += dst_linesize; \
214  src += src_linesize; \
215  p0 += p0_linesize; \
216  p1 += p1_linesize; \
217  p3 += p3_linesize; \
218  p4 += p4_linesize; \
219  } \
220  return 0; \
221 }
222 
224 DEFINE_DERAINBOW(16, uint16_t, 2)
225 
226 static int config_output(AVFilterLink *outlink)
227 {
228  AVFilterContext *ctx = outlink->src;
229  DedotContext *s = ctx->priv;
230  AVFilterLink *inlink = ctx->inputs[0];
231 
232  s->desc = av_pix_fmt_desc_get(outlink->format);
233  if (!s->desc)
234  return AVERROR_BUG;
235  s->nb_planes = av_pix_fmt_count_planes(outlink->format);
236  s->depth = s->desc->comp[0].depth;
237  s->max = (1 << s->depth) - 1;
238  s->luma2d = s->lt * s->max;
239  s->lumaT = s->tl * s->max;
240  s->chromaT1 = s->tc * s->max;
241  s->chromaT2 = s->ct * s->max;
242 
243  s->planewidth[1] = s->planewidth[2] = AV_CEIL_RSHIFT(inlink->w, s->desc->log2_chroma_w);
244  s->planewidth[0] = s->planewidth[3] = inlink->w;
245 
246  s->planeheight[1] = s->planeheight[2] = AV_CEIL_RSHIFT(inlink->h, s->desc->log2_chroma_h);
247  s->planeheight[0] = s->planeheight[3] = inlink->h;
248 
249  if (s->depth <= 8) {
250  s->dedotcrawl = dedotcrawl8;
251  s->derainbow = derainbow8;
252  } else {
253  s->dedotcrawl = dedotcrawl16;
254  s->derainbow = derainbow16;
255  }
256 
257  return 0;
258 }
259 
261 {
262  AVFilterLink *inlink = ctx->inputs[0];
263  AVFilterLink *outlink = ctx->outputs[0];
264  DedotContext *s = ctx->priv;
265  AVFrame *frame = NULL;
266  int64_t pts;
267  int status;
268  int ret = 0;
269 
271 
272  if (s->eof == 0) {
274  if (ret < 0)
275  return ret;
276  }
277  if (frame || s->eof_frames > 0) {
278  AVFrame *out = NULL;
279 
280  if (frame) {
281  for (int i = 2; i < 5; i++) {
282  if (!s->frames[i])
283  s->frames[i] = av_frame_clone(frame);
284  }
286  } else {
287  s->eof_frames--;
288  s->frames[4] = av_frame_clone(s->frames[3]);
289  }
290 
291  if (s->frames[0] &&
292  s->frames[1] &&
293  s->frames[2] &&
294  s->frames[3] &&
295  s->frames[4]) {
296  out = av_frame_clone(s->frames[2]);
297  if (out && !ctx->is_disabled) {
299  if (ret >= 0) {
300  if (s->m & 1)
301  ctx->internal->execute(ctx, s->dedotcrawl, out, NULL,
302  FFMIN(s->planeheight[0],
304  if (s->m & 2) {
305  ThreadData td;
306  td.out = out; td.plane = 1;
307  ctx->internal->execute(ctx, s->derainbow, &td, NULL,
308  FFMIN(s->planeheight[1],
310  td.plane = 2;
311  ctx->internal->execute(ctx, s->derainbow, &td, NULL,
312  FFMIN(s->planeheight[2],
314  }
315  } else
316  av_frame_free(&out);
317  } else if (!out) {
318  ret = AVERROR(ENOMEM);
319  }
320  }
321 
322  av_frame_free(&s->frames[0]);
323  s->frames[0] = s->frames[1];
324  s->frames[1] = s->frames[2];
325  s->frames[2] = s->frames[3];
326  s->frames[3] = s->frames[4];
327  s->frames[4] = NULL;
328 
329  if (ret < 0)
330  return ret;
331  if (out)
332  return ff_filter_frame(outlink, out);
333  }
334 
335  if (s->eof) {
336  if (s->eof_frames <= 0) {
337  ff_outlink_set_status(outlink, AVERROR_EOF, s->frames[2]->pts);
338  } else {
340  }
341  return 0;
342  }
343 
344  if (!s->eof && ff_inlink_acknowledge_status(inlink, &status, &pts)) {
345  if (status == AVERROR_EOF) {
346  s->eof = 1;
347  s->eof_frames = 2;
349  return 0;
350  }
351  }
352 
354 
355  return FFERROR_NOT_READY;
356 }
357 
359 {
360  DedotContext *s = ctx->priv;
361 
362  for (int i = 0; i < 5; i++)
363  av_frame_free(&s->frames[i]);
364 }
365 
366 #define OFFSET(x) offsetof(DedotContext, x)
367 #define FLAGS AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_FILTERING_PARAM
368 
369 static const AVOption dedot_options[] = {
370  { "m", "set filtering mode", OFFSET( m), AV_OPT_TYPE_FLAGS, {.i64=3}, 0, 3, FLAGS, "m" },
371  { "dotcrawl", 0, 0, AV_OPT_TYPE_CONST, {.i64=1}, 0, 0, FLAGS, "m" },
372  { "rainbows", 0, 0, AV_OPT_TYPE_CONST, {.i64=2}, 0, 0, FLAGS, "m" },
373  { "lt", "set spatial luma threshold", OFFSET(lt), AV_OPT_TYPE_FLOAT, {.dbl=.079}, 0, 1, FLAGS },
374  { "tl", "set tolerance for temporal luma", OFFSET(tl), AV_OPT_TYPE_FLOAT, {.dbl=.079}, 0, 1, FLAGS },
375  { "tc", "set tolerance for chroma temporal variation", OFFSET(tc), AV_OPT_TYPE_FLOAT, {.dbl=.058}, 0, 1, FLAGS },
376  { "ct", "set temporal chroma threshold", OFFSET(ct), AV_OPT_TYPE_FLOAT, {.dbl=.019}, 0, 1, FLAGS },
377  { NULL },
378 };
379 
380 static const AVFilterPad inputs[] = {
381  {
382  .name = "default",
383  .type = AVMEDIA_TYPE_VIDEO,
384  },
385  { NULL }
386 };
387 
388 static const AVFilterPad outputs[] = {
389  {
390  .name = "default",
391  .type = AVMEDIA_TYPE_VIDEO,
392  .config_props = config_output,
393  },
394  { NULL }
395 };
396 
397 AVFILTER_DEFINE_CLASS(dedot);
398 
400  .name = "dedot",
401  .description = NULL_IF_CONFIG_SMALL("Reduce cross-luminance and cross-color."),
402  .priv_size = sizeof(DedotContext),
403  .priv_class = &dedot_class,
405  .activate = activate,
406  .uninit = uninit,
407  .inputs = inputs,
408  .outputs = outputs,
410 };
formats
formats
Definition: signature.h:48
AV_PIX_FMT_YUVA422P16
#define AV_PIX_FMT_YUVA422P16
Definition: pixfmt.h:430
td
#define td
Definition: regdef.h:70
AVPixelFormat
AVPixelFormat
Pixel format.
Definition: pixfmt.h:64
status
they must not be accessed directly The fifo field contains the frames that are queued in the input for processing by the filter The status_in and status_out fields contains the queued status(EOF or error) of the link
DedotContext
Definition: vf_dedot.c:31
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
outputs
static const AVFilterPad outputs[]
Definition: vf_dedot.c:388
ff_make_format_list
AVFilterFormats * ff_make_format_list(const int *fmts)
Create a list of supported formats.
Definition: formats.c:283
out
FILE * out
Definition: movenc.c:54
ff_filter_frame
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
Definition: avfilter.c:1080
av_pix_fmt_desc_get
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
Definition: pixdesc.c:2522
AVERROR_EOF
#define AVERROR_EOF
End of file.
Definition: error.h:55
FFERROR_NOT_READY
return FFERROR_NOT_READY
Definition: filter_design.txt:204
DedotContext::depth
int depth
Definition: vf_dedot.c:40
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:202
DedotContext::nb_planes
int nb_planes
Definition: vf_dedot.c:49
AV_PIX_FMT_YUVA422P9
#define AV_PIX_FMT_YUVA422P9
Definition: pixfmt.h:422
AVFrame
This structure describes decoded (raw) audio or video data.
Definition: frame.h:295
av_frame_make_writable
int av_frame_make_writable(AVFrame *frame)
Ensure that the frame data is writable, avoiding data copy if possible.
Definition: frame.c:611
pixdesc.h
AV_PIX_FMT_YUVA420P16
#define AV_PIX_FMT_YUVA420P16
Definition: pixfmt.h:429
AV_PIX_FMT_YUVA420P10
#define AV_PIX_FMT_YUVA420P10
Definition: pixfmt.h:424
config_output
static int config_output(AVFilterLink *outlink)
Definition: vf_dedot.c:226
AVOption
AVOption.
Definition: opt.h:246
AV_PIX_FMT_YUV420P10
#define AV_PIX_FMT_YUV420P10
Definition: pixfmt.h:387
AV_PIX_FMT_YUV440P
@ AV_PIX_FMT_YUV440P
planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples)
Definition: pixfmt.h:99
AVFilter::name
const char * name
Filter name.
Definition: avfilter.h:148
video.h
AVFormatContext::internal
AVFormatInternal * internal
An opaque field for libavformat internal usage.
Definition: avformat.h:1795
AV_PIX_FMT_YUVA422P10
#define AV_PIX_FMT_YUVA422P10
Definition: pixfmt.h:425
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
AVFilterFormats
A list of supported formats for one end of a filter link.
Definition: formats.h:64
formats.h
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:1481
av_pix_fmt_count_planes
int av_pix_fmt_count_planes(enum AVPixelFormat pix_fmt)
Definition: pixdesc.c:2562
AV_PIX_FMT_YUVA420P9
#define AV_PIX_FMT_YUVA420P9
Definition: pixfmt.h:421
AVFILTER_DEFINE_CLASS
AVFILTER_DEFINE_CLASS(dedot)
DedotContext::max
int max
Definition: vf_dedot.c:41
AV_PIX_FMT_YUVA444P16
#define AV_PIX_FMT_YUVA444P16
Definition: pixfmt.h:431
plane
int plane
Definition: avisynth_c.h:384
AV_PIX_FMT_YUV422P9
#define AV_PIX_FMT_YUV422P9
Definition: pixfmt.h:385
DedotContext::lumaT
int lumaT
Definition: vf_dedot.c:43
pts
static int64_t pts
Definition: transcode_aac.c:647
AVFilterPad
A filter pad used for either input or output.
Definition: internal.h:54
AV_PIX_FMT_YUV444P10
#define AV_PIX_FMT_YUV444P10
Definition: pixfmt.h:390
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:258
av_cold
#define av_cold
Definition: attributes.h:84
AV_PIX_FMT_YUV422P16
#define AV_PIX_FMT_YUV422P16
Definition: pixfmt.h:399
ff_set_common_formats
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:568
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:79
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:257
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:101
AV_PIX_FMT_YUV444P16
#define AV_PIX_FMT_YUV444P16
Definition: pixfmt.h:400
AV_CEIL_RSHIFT
#define AV_CEIL_RSHIFT(a, b)
Definition: common.h:58
DedotContext::desc
const AVPixFmtDescriptor * desc
Definition: vf_dedot.c:39
DedotContext::chromaT1
int chromaT1
Definition: vf_dedot.c:44
filters.h
AV_PIX_FMT_YUV420P9
#define AV_PIX_FMT_YUV420P9
Definition: pixfmt.h:384
AV_PIX_FMT_YUV420P16
#define AV_PIX_FMT_YUV420P16
Definition: pixfmt.h:398
ctx
AVFormatContext * ctx
Definition: movenc.c:48
av_frame_clone
AVFrame * av_frame_clone(const AVFrame *src)
Create a new frame that references the same data as src.
Definition: frame.c:540
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:66
DedotContext::chromaT2
int chromaT2
Definition: vf_dedot.c:45
DedotContext::ct
float ct
Definition: vf_dedot.c:37
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:80
arg
const char * arg
Definition: jacosubdec.c:66
AVClass
Describe the class of an AVClass context structure.
Definition: log.h:67
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:78
DEFINE_DEDOTCRAWL
#define DEFINE_DEDOTCRAWL(name, type, div)
Definition: vf_dedot.c:83
DedotContext::planeheight
int planeheight[4]
Definition: vf_dedot.c:51
AV_PIX_FMT_YUV422P10
#define AV_PIX_FMT_YUV422P10
Definition: pixfmt.h:388
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:1436
DedotContext::derainbow
int(* derainbow)(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
Definition: vf_dedot.c:56
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:188
DedotContext::dedotcrawl
int(* dedotcrawl)(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
Definition: vf_dedot.c:55
uninit
static av_cold void uninit(AVFilterContext *ctx)
Definition: vf_dedot.c:358
DedotContext::planewidth
int planewidth[4]
Definition: vf_dedot.c:50
AV_PIX_FMT_YUV422P12
#define AV_PIX_FMT_YUV422P12
Definition: pixfmt.h:392
query_formats
static int query_formats(AVFilterContext *ctx)
Definition: vf_dedot.c:59
AV_PIX_FMT_YUV444P12
#define AV_PIX_FMT_YUV444P12
Definition: pixfmt.h:394
FLAGS
#define FLAGS
Definition: vf_dedot.c:367
FFMIN
#define FFMIN(a, b)
Definition: common.h:96
DedotContext::eof_frames
int eof_frames
Definition: vf_dedot.c:48
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:177
AV_PIX_FMT_YUVA444P10
#define AV_PIX_FMT_YUVA444P10
Definition: pixfmt.h:426
FF_FILTER_FORWARD_WANTED
FF_FILTER_FORWARD_WANTED(outlink, inlink)
internal.h
AV_OPT_TYPE_FLOAT
@ AV_OPT_TYPE_FLOAT
Definition: opt.h:226
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:259
DedotContext::luma2d
int luma2d
Definition: vf_dedot.c:42
ff_filter_get_nb_threads
int ff_filter_get_nb_threads(AVFilterContext *ctx)
Get number of threads for current filter instance.
Definition: avfilter.c:802
ThreadData
Used for passing data between threads.
Definition: af_adeclick.c:487
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:100
uint8_t
uint8_t
Definition: audio_convert.c:194
DedotContext::tc
float tc
Definition: vf_dedot.c:36
AVFilterPad::name
const char * name
Pad name.
Definition: internal.h:60
AV_PIX_FMT_YUV444P9
#define AV_PIX_FMT_YUV444P9
Definition: pixfmt.h:386
DEFINE_DERAINBOW
#define DEFINE_DERAINBOW(name, type, div)
Definition: vf_dedot.c:162
AVFilter
Filter definition.
Definition: avfilter.h:144
DedotContext::frames
AVFrame * frames[5]
Definition: vf_dedot.c:53
DedotContext::tl
float tl
Definition: vf_dedot.c:35
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:423
AV_PIX_FMT_YUV420P12
#define AV_PIX_FMT_YUV420P12
Definition: pixfmt.h:391
AV_PIX_FMT_YUV422P14
#define AV_PIX_FMT_YUV422P14
Definition: pixfmt.h:396
OFFSET
#define OFFSET(x)
Definition: vf_dedot.c:366
DedotContext::eof
int eof
Definition: vf_dedot.c:47
DedotContext::m
int m
Definition: vf_dedot.c:33
AV_PIX_FMT_NONE
@ AV_PIX_FMT_NONE
Definition: pixfmt.h:65
avfilter.h
dedot_options
static const AVOption dedot_options[]
Definition: vf_dedot.c:369
DedotContext::lt
float lt
Definition: vf_dedot.c:34
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:71
AVFilterContext
An instance of a filter.
Definition: avfilter.h:338
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:116
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:70
AVPixFmtDescriptor
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
Definition: pixdesc.h:81
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:73
AV_OPT_TYPE_FLAGS
@ AV_OPT_TYPE_FLAGS
Definition: opt.h:222
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:133
imgutils.h
flags
#define flags(name, subs,...)
Definition: cbs_av1.c:565
AVERROR_BUG
#define AVERROR_BUG
Internal bug, also see AVERROR_BUG2.
Definition: error.h:50
activate
static int activate(AVFilterContext *ctx)
Definition: vf_dedot.c:260
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:72
AV_PIX_FMT_YUV440P12
#define AV_PIX_FMT_YUV440P12
Definition: pixfmt.h:393
AV_PIX_FMT_YUV444P14
#define AV_PIX_FMT_YUV444P14
Definition: pixfmt.h:397
int
int
Definition: ffmpeg_filter.c:191
ff_vf_dedot
AVFilter ff_vf_dedot
Definition: vf_dedot.c:399
AV_OPT_TYPE_CONST
@ AV_OPT_TYPE_CONST
Definition: opt.h:232
inputs
static const AVFilterPad inputs[]
Definition: vf_dedot.c:380
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:176
AV_PIX_FMT_YUV420P14
#define AV_PIX_FMT_YUV420P14
Definition: pixfmt.h:395
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:193