History

avfilter/vf_lut3d: lut1d: add support for commands

Paul B Mahol committed 5 years ago

Commit d8181cb1 parent feea20e2 files · +31 −7Browse files

Showing the changes to libavfilter (1 of 2 files). Show all

Unified · Split

libavfilter/vf_lut3d.c+27−7
@@ -100,6 +100,7 @@ typedef struct ThreadData { · 99 unmodified lines
100 100
101#define OFFSET(x) offsetof(LUT3DContext, x)101#define OFFSET(x) offsetof(LUT3DContext, x)
102#define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM102#define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
103#define TFLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_RUNTIME_PARAM
103#define COMMON_OPTIONS \104#define COMMON_OPTIONS \
104 { "interp", "select interpolation mode", OFFSET(interpolation), AV_OPT_TYPE_INT, {.i64=INTERPOLATE_TETRAHEDRAL}, 0, NB_INTERP_MODE-1, FLAGS, "interp_mode" }, \105 { "interp", "select interpolation mode", OFFSET(interpolation), AV_OPT_TYPE_INT, {.i64=INTERPOLATE_TETRAHEDRAL}, 0, NB_INTERP_MODE-1, FLAGS, "interp_mode" }, \
105 { "nearest", "use values from the nearest defined points", 0, AV_OPT_TYPE_CONST, {.i64=INTERPOLATE_NEAREST}, INT_MIN, INT_MAX, FLAGS, "interp_mode" }, \106 { "nearest", "use values from the nearest defined points", 0, AV_OPT_TYPE_CONST, {.i64=INTERPOLATE_NEAREST}, INT_MIN, INT_MAX, FLAGS, "interp_mode" }, \
@@ -1798,13 +1799,13 @@ try_again: · 1692 unmodified lines
1798}1799}
1799 1800
1800static const AVOption lut1d_options[] = {1801static const AVOption lut1d_options[] = {
1801 { "file", "set 1D LUT file name", OFFSET(file), AV_OPT_TYPE_STRING, {.str=NULL}, .flags = FLAGS },1802 { "file", "set 1D LUT file name", OFFSET(file), AV_OPT_TYPE_STRING, {.str=NULL}, .flags = TFLAGS },
1802 { "interp", "select interpolation mode", OFFSET(interpolation), AV_OPT_TYPE_INT, {.i64=INTERPOLATE_1D_LINEAR}, 0, NB_INTERP_1D_MODE-1, FLAGS, "interp_mode" },1803 { "interp", "select interpolation mode", OFFSET(interpolation), AV_OPT_TYPE_INT, {.i64=INTERPOLATE_1D_LINEAR}, 0, NB_INTERP_1D_MODE-1, TFLAGS, "interp_mode" },
1803 { "nearest", "use values from the nearest defined points", 0, AV_OPT_TYPE_CONST, {.i64=INTERPOLATE_1D_NEAREST}, INT_MIN, INT_MAX, FLAGS, "interp_mode" },1804 { "nearest", "use values from the nearest defined points", 0, AV_OPT_TYPE_CONST, {.i64=INTERPOLATE_1D_NEAREST}, 0, 0, TFLAGS, "interp_mode" },
1804 { "linear", "use values from the linear interpolation", 0, AV_OPT_TYPE_CONST, {.i64=INTERPOLATE_1D_LINEAR}, INT_MIN, INT_MAX, FLAGS, "interp_mode" },1805 { "linear", "use values from the linear interpolation", 0, AV_OPT_TYPE_CONST, {.i64=INTERPOLATE_1D_LINEAR}, 0, 0, TFLAGS, "interp_mode" },
1805 { "cosine", "use values from the cosine interpolation", 0, AV_OPT_TYPE_CONST, {.i64=INTERPOLATE_1D_COSINE}, INT_MIN, INT_MAX, FLAGS, "interp_mode" },1806 { "cosine", "use values from the cosine interpolation", 0, AV_OPT_TYPE_CONST, {.i64=INTERPOLATE_1D_COSINE}, 0, 0, TFLAGS, "interp_mode" },
1806 { "cubic", "use values from the cubic interpolation", 0, AV_OPT_TYPE_CONST, {.i64=INTERPOLATE_1D_CUBIC}, INT_MIN, INT_MAX, FLAGS, "interp_mode" },1807 { "cubic", "use values from the cubic interpolation", 0, AV_OPT_TYPE_CONST, {.i64=INTERPOLATE_1D_CUBIC}, 0, 0, TFLAGS, "interp_mode" },
1807 { "spline", "use values from the spline interpolation", 0, AV_OPT_TYPE_CONST, {.i64=INTERPOLATE_1D_SPLINE}, INT_MIN, INT_MAX, FLAGS, "interp_mode" },1808 { "spline", "use values from the spline interpolation", 0, AV_OPT_TYPE_CONST, {.i64=INTERPOLATE_1D_SPLINE}, 0, 0, TFLAGS, "interp_mode" },
1808 { NULL }1809 { NULL }
1809};1810};
1810 1811
@@ -2234,6 +2235,24 @@ static int filter_frame_1d(AVFilterLink *inlink, AVFrame *in) · 423 unmodified lines
2234 return ff_filter_frame(outlink, out);2235 return ff_filter_frame(outlink, out);
2235}2236}
2236 2237
2238static int lut1d_process_command(AVFilterContext *ctx, const char *cmd, const char *args,
2239 char *res, int res_len, int flags)
2240{
2241 LUT1DContext *lut1d = ctx->priv;
2242 int ret;
2243
2244 ret = ff_filter_process_command(ctx, cmd, args, res, res_len, flags);
2245 if (ret < 0)
2246 return ret;
2247
2248 ret = lut1d_init(ctx);
2249 if (ret < 0) {
2250 set_identity_matrix_1d(lut1d, 32);
2251 return ret;
2252 }
2253 return config_input_1d(ctx->inputs[0]);
2254}
2255
2237static const AVFilterPad lut1d_inputs[] = {2256static const AVFilterPad lut1d_inputs[] = {
2238 {2257 {
2239 .name = "default",2258 .name = "default",
@@ -2262,5 +2281,6 @@ AVFilter ff_vf_lut1d = { · 22 unmodified lines
2262 .outputs = lut1d_outputs,2281 .outputs = lut1d_outputs,
2263 .priv_class = &lut1d_class,2282 .priv_class = &lut1d_class,
2264 .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC | AVFILTER_FLAG_SLICE_THREADS,2283 .flags = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC | AVFILTER_FLAG_SLICE_THREADS,
2284 .process_command = lut1d_process_command,
2265};2285};
2266#endif2286#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