History

vf_curves: add option to set all curves at once

Michael Niedermayer committed 13 years ago

Commit 9280fc71 parent 81c1ed72 files · +17 −1Browse files

Unified · Split

2 files
  1. doc/filters.texi +5 −0
  2. libavfilter/vf_curves.c +12 −1
doc/filters.texi+5−0
@@ -2385,6 +2385,11 @@ Set the key points for the red component. · 2384 unmodified lines
23852385 Set the key points for the green component.
23862386 @item blue, b
23872387 Set the key points for the blue component.
2388+@item all
2389+Set the key points for all components.
2390+Can be used in addition to the other key points component
2391+options. In this case, the unset component(s) will fallback on this
2392+@option{all} setting.
23882393 @item preset
23892394 Select one of the available color presets. This option can not be used in
23902395 addition to the @option{r}, @option{g}, @option{b} parameters.
libavfilter/vf_curves.c+12−1
@@ -52,6 +52,7 @@ typedef struct { · 51 unmodified lines
5252 const AVClass *class;
5353 enum preset preset;
5454 char *comp_points_str[NB_COMP];
55+ char *comp_points_str_all;
5556 uint8_t graph[NB_COMP][256];
5657 } CurvesContext;
5758
@@ -64,6 +65,7 @@ static const AVOption curves_options[] = { · 6 unmodified lines
6465 { "g", "set green points coordinates", OFFSET(comp_points_str[1]), AV_OPT_TYPE_STRING, {.str=NULL}, .flags = FLAGS },
6566 { "blue", "set blue points coordinates", OFFSET(comp_points_str[2]), AV_OPT_TYPE_STRING, {.str=NULL}, .flags = FLAGS },
6667 { "b", "set blue points coordinates", OFFSET(comp_points_str[2]), AV_OPT_TYPE_STRING, {.str=NULL}, .flags = FLAGS },
68+ { "all", "set points coordinates for all components", OFFSET(comp_points_str_all),AV_OPT_TYPE_STRING, {.str=NULL}, .flags = FLAGS },
6769 { "preset", "select a color curves preset", OFFSET(preset), AV_OPT_TYPE_INT, {.i64=PRESET_NONE}, PRESET_NONE, NB_PRESETS-1, FLAGS, "preset_name" },
6870 { "color_negative", NULL, 0, AV_OPT_TYPE_CONST, {.i64=PRESET_COLOR_NEGATIVE}, INT_MIN, INT_MAX, FLAGS, "preset_name" },
6971 { "cross_process", NULL, 0, AV_OPT_TYPE_CONST, {.i64=PRESET_CROSS_PROCESS}, INT_MIN, INT_MAX, FLAGS, "preset_name" },
@@ -318,9 +320,18 @@ static av_cold int init(AVFilterContext *ctx, const char *args) · 248 unmodified lines
318320 int i, j, ret;
319321 CurvesContext *curves = ctx->priv;
320322 struct keypoint *comp_points[NB_COMP] = {0};
323+ char **pts = curves->comp_points_str;
324+
325+ if (curves->comp_points_str_all) {
326+ for (i = 0; i < NB_COMP; i++) {
327+ if (!pts[i])
328+ pts[i] = av_strdup(curves->comp_points_str_all);
329+ if (!pts[i])
330+ return AVERROR(ENOMEM);
331+ }
332+ }
321333
322334 if (curves->preset != PRESET_NONE) {
323− char **pts = curves->comp_points_str;
324335 if (pts[0] || pts[1] || pts[2]) {
325336 av_log(ctx, AV_LOG_ERROR, "It is not possible to mix a preset "
326337 "with explicit points placements\n");

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