summaryrefslogtreecommitdiff
path: root/libavfilter/vf_curves.c
diff options
context:
space:
mode:
authorClément Bœsch <ubitux@gmail.com>2013-04-11 13:03:25 +0200
committerClément Bœsch <ubitux@gmail.com>2013-04-11 13:05:06 +0200
commit2844ea86c8f704444eebb59f78b7b04843d6b15a (patch)
tree968d73a31116b5e8be7bbcd14a883337eea0a6e2 /libavfilter/vf_curves.c
parent7e7dc1489f5e7b3810935f17ec3c9a7ca2beb68a (diff)
lavfi/curves: introduce "all" field in presets and use it.
Diffstat (limited to 'libavfilter/vf_curves.c')
-rw-r--r--libavfilter/vf_curves.c45
1 files changed, 14 insertions, 31 deletions
diff --git a/libavfilter/vf_curves.c b/libavfilter/vf_curves.c
index 378754dfba..bed532760d 100644
--- a/libavfilter/vf_curves.c
+++ b/libavfilter/vf_curves.c
@@ -87,6 +87,7 @@ static const struct {
const char *r;
const char *g;
const char *b;
+ const char *all;
} curves_presets[] = {
[PRESET_COLOR_NEGATIVE] = {
"0/1 0.129/1 0.466/0.498 0.725/0 1/0",
@@ -98,35 +99,13 @@ static const struct {
"0.25/0.188 0.38/0.501 0.745/0.815 1/0.815",
"0.231/0.094 0.709/0.874",
},
- [PRESET_DARKER] = {
- "0.5/0.4", "0.5/0.4", "0.5/0.4",
- },
- [PRESET_INCREASE_CONTRAST] = {
- "0.149/0.066 0.831/0.905 0.905/0.98",
- "0.149/0.066 0.831/0.905 0.905/0.98",
- "0.149/0.066 0.831/0.905 0.905/0.98",
- },
- [PRESET_LIGHTER] = {
- "0.4/0.5", "0.4/0.5", "0.4/0.5",
- },
- [PRESET_LINEAR_CONTRAST] = {
- "0.305/0.286 0.694/0.713",
- "0.305/0.286 0.694/0.713",
- "0.305/0.286 0.694/0.713",
- },
- [PRESET_MEDIUM_CONTRAST] = {
- "0.286/0.219 0.639/0.643",
- "0.286/0.219 0.639/0.643",
- "0.286/0.219 0.639/0.643",
- },
- [PRESET_NEGATIVE] = {
- "0/1 1/0", "0/1 1/0", "0/1 1/0",
- },
- [PRESET_STRONG_CONTRAST] = {
- "0.301/0.196 0.592/0.6 0.686/0.737",
- "0.301/0.196 0.592/0.6 0.686/0.737",
- "0.301/0.196 0.592/0.6 0.686/0.737",
- },
+ [PRESET_DARKER] = { .all = "0.5/0.4" },
+ [PRESET_INCREASE_CONTRAST] = { .all = "0.149/0.066 0.831/0.905 0.905/0.98" },
+ [PRESET_LIGHTER] = { .all = "0.4/0.5" },
+ [PRESET_LINEAR_CONTRAST] = { .all = "0.305/0.286 0.694/0.713" },
+ [PRESET_MEDIUM_CONTRAST] = { .all = "0.286/0.219 0.639/0.643" },
+ [PRESET_NEGATIVE] = { .all = "0/1 1/0" },
+ [PRESET_STRONG_CONTRAST] = { .all = "0.301/0.196 0.592/0.6 0.686/0.737" },
[PRESET_VINTAGE] = {
"0/0.11 0.42/0.51 1/0.95",
"0.50/0.48",
@@ -322,11 +301,15 @@ static av_cold int init(AVFilterContext *ctx, const char *args)
CurvesContext *curves = ctx->priv;
struct keypoint *comp_points[NB_COMP] = {0};
char **pts = curves->comp_points_str;
+ const char *allp = curves->comp_points_str_all;
+
+ if (!allp && curves->preset != PRESET_NONE && curves_presets[curves->preset].all)
+ allp = curves_presets[curves->preset].all;
- if (curves->comp_points_str_all) {
+ if (allp) {
for (i = 0; i < NB_COMP; i++) {
if (!pts[i])
- pts[i] = av_strdup(curves->comp_points_str_all);
+ pts[i] = av_strdup(allp);
if (!pts[i])
return AVERROR(ENOMEM);
}