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
2385Set the key points for the green component.2385Set the key points for the green component.
2386@item blue, b2386@item blue, b
2387Set the key points for the blue component.2387Set the key points for the blue component.
2388@item all
2389Set the key points for all components.
2390Can be used in addition to the other key points component
2391options. In this case, the unset component(s) will fallback on this
2392@option{all} setting.
2388@item preset2393@item preset
2389Select one of the available color presets. This option can not be used in2394Select one of the available color presets. This option can not be used in
2390addition to the @option{r}, @option{g}, @option{b} parameters.2395addition to the @option{r}, @option{g}, @option{b} parameters.
libavfilter/vf_curves.c+12−1
@@ -52,6 +52,7 @@ typedef struct { · 51 unmodified lines
52 const AVClass *class;52 const AVClass *class;
53 enum preset preset;53 enum preset preset;
54 char *comp_points_str[NB_COMP];54 char *comp_points_str[NB_COMP];
55 char *comp_points_str_all;
55 uint8_t graph[NB_COMP][256];56 uint8_t graph[NB_COMP][256];
56} CurvesContext;57} CurvesContext;
57 58
@@ -64,6 +65,7 @@ static const AVOption curves_options[] = { · 6 unmodified lines
64 { "g", "set green points coordinates", OFFSET(comp_points_str[1]), AV_OPT_TYPE_STRING, {.str=NULL}, .flags = FLAGS },65 { "g", "set green points coordinates", OFFSET(comp_points_str[1]), AV_OPT_TYPE_STRING, {.str=NULL}, .flags = FLAGS },
65 { "blue", "set blue points coordinates", OFFSET(comp_points_str[2]), AV_OPT_TYPE_STRING, {.str=NULL}, .flags = FLAGS },66 { "blue", "set blue points coordinates", OFFSET(comp_points_str[2]), AV_OPT_TYPE_STRING, {.str=NULL}, .flags = FLAGS },
66 { "b", "set blue points coordinates", OFFSET(comp_points_str[2]), AV_OPT_TYPE_STRING, {.str=NULL}, .flags = FLAGS },67 { "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 },
67 { "preset", "select a color curves preset", OFFSET(preset), AV_OPT_TYPE_INT, {.i64=PRESET_NONE}, PRESET_NONE, NB_PRESETS-1, FLAGS, "preset_name" },69 { "preset", "select a color curves preset", OFFSET(preset), AV_OPT_TYPE_INT, {.i64=PRESET_NONE}, PRESET_NONE, NB_PRESETS-1, FLAGS, "preset_name" },
68 { "color_negative", NULL, 0, AV_OPT_TYPE_CONST, {.i64=PRESET_COLOR_NEGATIVE}, INT_MIN, INT_MAX, FLAGS, "preset_name" },70 { "color_negative", NULL, 0, AV_OPT_TYPE_CONST, {.i64=PRESET_COLOR_NEGATIVE}, INT_MIN, INT_MAX, FLAGS, "preset_name" },
69 { "cross_process", NULL, 0, AV_OPT_TYPE_CONST, {.i64=PRESET_CROSS_PROCESS}, INT_MIN, INT_MAX, FLAGS, "preset_name" },71 { "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
318 int i, j, ret;320 int i, j, ret;
319 CurvesContext *curves = ctx->priv;321 CurvesContext *curves = ctx->priv;
320 struct keypoint *comp_points[NB_COMP] = {0};322 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 }
321 333
322 if (curves->preset != PRESET_NONE) {334 if (curves->preset != PRESET_NONE) {
323 char **pts = curves->comp_points_str;
324 if (pts[0] || pts[1] || pts[2]) {335 if (pts[0] || pts[1] || pts[2]) {
325 av_log(ctx, AV_LOG_ERROR, "It is not possible to mix a preset "336 av_log(ctx, AV_LOG_ERROR, "It is not possible to mix a preset "
326 "with explicit points placements\n");337 "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