History

avfilter/vf_lut2: add support for commands

Paul B Mahol committed 5 years ago

Commit 5f592131 parent 629dd8e2 files · +28 −9Browse files

Unified · Split

2 files
  1. doc/filters.texi +4 −0
  2. libavfilter/vf_lut2.c +24 −9
doc/filters.texi+4−0
@@ -14221,6 +14221,10 @@ The second input video bit depth. · 14220 unmodified lines
14221 14221
14222All expressions default to "x".14222All expressions default to "x".
14223 14223
14224@subsection Commands
14225
14226This filter supports the all above options as @ref{commands} except option @code{d}.
14227
14224@subsection Examples14228@subsection Examples
14225 14229
14226@itemize14230@itemize
libavfilter/vf_lut2.c+24−9
@@ -79,12 +79,13 @@ typedef struct ThreadData { · 78 unmodified lines
79 79
80#define OFFSET(x) offsetof(LUT2Context, x)80#define OFFSET(x) offsetof(LUT2Context, x)
81#define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM81#define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
82#define TFLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_RUNTIME_PARAM
82 83
83static const AVOption options[] = {84static const AVOption options[] = {
84 { "c0", "set component #0 expression", OFFSET(comp_expr_str[0]), AV_OPT_TYPE_STRING, { .str = "x" }, .flags = FLAGS },85 { "c0", "set component #0 expression", OFFSET(comp_expr_str[0]), AV_OPT_TYPE_STRING, { .str = "x" }, .flags = TFLAGS },
85 { "c1", "set component #1 expression", OFFSET(comp_expr_str[1]), AV_OPT_TYPE_STRING, { .str = "x" }, .flags = FLAGS },86 { "c1", "set component #1 expression", OFFSET(comp_expr_str[1]), AV_OPT_TYPE_STRING, { .str = "x" }, .flags = TFLAGS },
86 { "c2", "set component #2 expression", OFFSET(comp_expr_str[2]), AV_OPT_TYPE_STRING, { .str = "x" }, .flags = FLAGS },87 { "c2", "set component #2 expression", OFFSET(comp_expr_str[2]), AV_OPT_TYPE_STRING, { .str = "x" }, .flags = TFLAGS },
87 { "c3", "set component #3 expression", OFFSET(comp_expr_str[3]), AV_OPT_TYPE_STRING, { .str = "x" }, .flags = FLAGS },88 { "c3", "set component #3 expression", OFFSET(comp_expr_str[3]), AV_OPT_TYPE_STRING, { .str = "x" }, .flags = TFLAGS },
88 { "d", "set output depth", OFFSET(odepth), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 16, .flags = FLAGS },89 { "d", "set output depth", OFFSET(odepth), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 16, .flags = FLAGS },
89 { NULL }90 { NULL }
90};91};
@@ -353,7 +354,8 @@ static int config_output(AVFilterLink *outlink) · 262 unmodified lines
353 }354 }
354 355
355 for (p = 0; p < s->nb_planes; p++) {356 for (p = 0; p < s->nb_planes; p++) {
356 s->lut[p] = av_malloc_array(1 << s->depth, sizeof(uint16_t));357 if (!s->lut[p])
358 s->lut[p] = av_malloc_array(1 << s->depth, sizeof(uint16_t));
357 if (!s->lut[p])359 if (!s->lut[p])
358 return AVERROR(ENOMEM);360 return AVERROR(ENOMEM);
359 }361 }
@@ -543,6 +545,17 @@ static const AVFilterPad outputs[] = { · 183 unmodified lines
543 { NULL }545 { NULL }
544};546};
545 547
548static int process_command(AVFilterContext *ctx, const char *cmd, const char *args,
549 char *res, int res_len, int flags)
550{
551 int ret = ff_filter_process_command(ctx, cmd, args, res, res_len, flags);
552
553 if (ret < 0)
554 return ret;
555
556 return config_output(ctx->outputs[0]);
557}
558
546#define lut2_options options559#define lut2_options options
547 560
548FRAMESYNC_DEFINE_CLASS(lut2, LUT2Context, fs);561FRAMESYNC_DEFINE_CLASS(lut2, LUT2Context, fs);
@@ -560,6 +573,7 @@ AVFilter ff_vf_lut2 = { · 11 unmodified lines
560 .outputs = outputs,573 .outputs = outputs,
561 .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL |574 .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL |
562 AVFILTER_FLAG_SLICE_THREADS,575 AVFILTER_FLAG_SLICE_THREADS,
576 .process_command = process_command,
563};577};
564 578
565#if CONFIG_TLUT2_FILTER579#if CONFIG_TLUT2_FILTER
@@ -610,10 +624,10 @@ static int tlut2_filter_frame(AVFilterLink *inlink, AVFrame *frame) · 44 unmodified lines
610}624}
611 625
612static const AVOption tlut2_options[] = {626static const AVOption tlut2_options[] = {
613 { "c0", "set component #0 expression", OFFSET(comp_expr_str[0]), AV_OPT_TYPE_STRING, { .str = "x" }, .flags = FLAGS },627 { "c0", "set component #0 expression", OFFSET(comp_expr_str[0]), AV_OPT_TYPE_STRING, { .str = "x" }, .flags = TFLAGS },
614 { "c1", "set component #1 expression", OFFSET(comp_expr_str[1]), AV_OPT_TYPE_STRING, { .str = "x" }, .flags = FLAGS },628 { "c1", "set component #1 expression", OFFSET(comp_expr_str[1]), AV_OPT_TYPE_STRING, { .str = "x" }, .flags = TFLAGS },
615 { "c2", "set component #2 expression", OFFSET(comp_expr_str[2]), AV_OPT_TYPE_STRING, { .str = "x" }, .flags = FLAGS },629 { "c2", "set component #2 expression", OFFSET(comp_expr_str[2]), AV_OPT_TYPE_STRING, { .str = "x" }, .flags = TFLAGS },
616 { "c3", "set component #3 expression", OFFSET(comp_expr_str[3]), AV_OPT_TYPE_STRING, { .str = "x" }, .flags = FLAGS },630 { "c3", "set component #3 expression", OFFSET(comp_expr_str[3]), AV_OPT_TYPE_STRING, { .str = "x" }, .flags = TFLAGS },
617 { NULL }631 { NULL }
618};632};
619 633
@@ -650,6 +664,7 @@ AVFilter ff_vf_tlut2 = { · 30 unmodified lines
650 .outputs = tlut2_outputs,664 .outputs = tlut2_outputs,
651 .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL |665 .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_INTERNAL |
652 AVFILTER_FLAG_SLICE_THREADS,666 AVFILTER_FLAG_SLICE_THREADS,
667 .process_command = process_command,
653};668};
654 669
655#endif670#endif

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