History

avfilter/vf_atadenoise: add support for commands

Paul B Mahol committed 7 years ago

Commit 357f11e1 parent 824b0262 files · +25 −4Browse files

Unified · Split

2 files
  1. doc/filters.texi +4 −0
  2. libavfilter/vf_atadenoise.c +21 −4
doc/filters.texi+4−0
@@ -6281,6 +6281,10 @@ Parallel will abort early on first change being greater then thresholds, while s · 6280 unmodified lines
6281will continue processing other side of frames if they are equal or bellow thresholds.6281will continue processing other side of frames if they are equal or bellow thresholds.
6282@end table6282@end table
6283 6283
6284@subsection Commands
6285This filter supports same @ref{commands} as options except option @code{s}.
6286The command accepts the same syntax of the corresponding option.
6287
6284@section avgblur6288@section avgblur
6285 6289
6286Apply average blur filter.6290Apply average blur filter.
libavfilter/vf_atadenoise.c+21−4
@@ -64,7 +64,8 @@ typedef struct ATADenoiseContext { · 63 unmodified lines
64} ATADenoiseContext;64} ATADenoiseContext;
65 65
66#define OFFSET(x) offsetof(ATADenoiseContext, x)66#define OFFSET(x) offsetof(ATADenoiseContext, x)
67#define FLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM67#define FLAGS AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_RUNTIME_PARAM
68#define VF AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_FILTERING_PARAM
68 69
69static const AVOption atadenoise_options[] = {70static const AVOption atadenoise_options[] = {
70 { "0a", "set threshold A for 1st plane", OFFSET(fthra[0]), AV_OPT_TYPE_FLOAT, {.dbl=0.02}, 0, 0.3, FLAGS },71 { "0a", "set threshold A for 1st plane", OFFSET(fthra[0]), AV_OPT_TYPE_FLOAT, {.dbl=0.02}, 0, 0.3, FLAGS },
@@ -73,11 +74,11 @@ static const AVOption atadenoise_options[] = { · 2 unmodified lines
73 { "1b", "set threshold B for 2nd plane", OFFSET(fthrb[1]), AV_OPT_TYPE_FLOAT, {.dbl=0.04}, 0, 5.0, FLAGS },74 { "1b", "set threshold B for 2nd plane", OFFSET(fthrb[1]), AV_OPT_TYPE_FLOAT, {.dbl=0.04}, 0, 5.0, FLAGS },
74 { "2a", "set threshold A for 3rd plane", OFFSET(fthra[2]), AV_OPT_TYPE_FLOAT, {.dbl=0.02}, 0, 0.3, FLAGS },75 { "2a", "set threshold A for 3rd plane", OFFSET(fthra[2]), AV_OPT_TYPE_FLOAT, {.dbl=0.02}, 0, 0.3, FLAGS },
75 { "2b", "set threshold B for 3rd plane", OFFSET(fthrb[2]), AV_OPT_TYPE_FLOAT, {.dbl=0.04}, 0, 5.0, FLAGS },76 { "2b", "set threshold B for 3rd plane", OFFSET(fthrb[2]), AV_OPT_TYPE_FLOAT, {.dbl=0.04}, 0, 5.0, FLAGS },
76 { "s", "set how many frames to use", OFFSET(size), AV_OPT_TYPE_INT, {.i64=9}, 5, SIZE, FLAGS },77 { "s", "set how many frames to use", OFFSET(size), AV_OPT_TYPE_INT, {.i64=9}, 5, SIZE, VF },
77 { "p", "set what planes to filter", OFFSET(planes), AV_OPT_TYPE_FLAGS, {.i64=7}, 0, 15, FLAGS },78 { "p", "set what planes to filter", OFFSET(planes), AV_OPT_TYPE_FLAGS, {.i64=7}, 0, 15, FLAGS },
78 { "a", "set variant of algorithm", OFFSET(algorithm),AV_OPT_TYPE_INT, {.i64=PARALLEL}, 0, NB_ATAA-1, FLAGS, "a" },79 { "a", "set variant of algorithm", OFFSET(algorithm),AV_OPT_TYPE_INT, {.i64=PARALLEL}, 0, NB_ATAA-1, FLAGS, "a" },
79 { "p", "parallel", 0, AV_OPT_TYPE_CONST, {.i64=PARALLEL}, 0, 0, FLAGS, "a" },80 { "p", "parallel", 0, AV_OPT_TYPE_CONST, {.i64=PARALLEL}, 0, 0, FLAGS, "a" },
80 { "s", "serial", 0, AV_OPT_TYPE_CONST, {.i64=SERIAL}, 0, 0, FLAGS, "a" },81 { "s", "serial", 0, AV_OPT_TYPE_CONST, {.i64=SERIAL}, 0, 0, FLAGS, "a" },
81 { NULL }82 { NULL }
82};83};
83 84
@@ -404,6 +405,21 @@ static av_cold void uninit(AVFilterContext *ctx) · 320 unmodified lines
404 ff_bufqueue_discard_all(&s->q);405 ff_bufqueue_discard_all(&s->q);
405}406}
406 407
408static int process_command(AVFilterContext *ctx,
409 const char *cmd,
410 const char *arg,
411 char *res,
412 int res_len,
413 int flags)
414{
415 int ret = ff_filter_process_command(ctx, cmd, arg, res, res_len, flags);
416
417 if (ret < 0)
418 return ret;
419
420 return config_input(ctx->inputs[0]);
421}
422
407static const AVFilterPad inputs[] = {423static const AVFilterPad inputs[] = {
408 {424 {
409 .name = "default",425 .name = "default",
@@ -434,4 +450,5 @@ AVFilter ff_vf_atadenoise = { · 24 unmodified lines
434 .inputs = inputs,450 .inputs = inputs,
435 .outputs = outputs,451 .outputs = outputs,
436 .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL | AVFILTER_FLAG_SLICE_THREADS,452 .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL | AVFILTER_FLAG_SLICE_THREADS,
453 .process_command = process_command,
437};454};

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t