Commit b186b713 authored by Peter Ross's avatar Peter Ross Committed by Michael Niedermayer

avfilter/vf_lut: gammaval709()

See http://www.itu.int/rec/R-REC-BT.709
Item 1.2, overall opto-electronic transfer characteristics at source
Signed-off-by: 's avatarPeter Ross <pross@xvid.org>
Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent 57688aec
......@@ -161,15 +161,32 @@ static double compute_gammaval(void *opaque, double gamma)
return pow((val-minval)/(maxval-minval), gamma) * (maxval-minval)+minval;
}
/**
* Compute Rec.709 gama correction of value val
*/
static double compute_gammaval709(void *opaque, double gamma)
{
LutContext *s = opaque;
double val = s->var_values[VAR_CLIPVAL];
double minval = s->var_values[VAR_MINVAL];
double maxval = s->var_values[VAR_MAXVAL];
double level = (val - minval) / (maxval - minval);
level = level < 0.018 ? 4.5 * level
: 1.099 * pow(level, 1.0 / gamma) - 0.099;
return level * (maxval - minval) + minval;
}
static double (* const funcs1[])(void *, double) = {
(void *)clip,
(void *)compute_gammaval,
(void *)compute_gammaval709,
NULL
};
static const char * const funcs1_names[] = {
"clip",
"gammaval",
"gammaval709",
NULL
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment