mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2025-02-04 22:04:38 +00:00
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: Peter Ross <pross@xvid.org> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
parent
57688aecbd
commit
b186b7131e
@ -161,15 +161,32 @@ static double compute_gammaval(void *opaque, double gamma)
|
|||||||
return pow((val-minval)/(maxval-minval), gamma) * (maxval-minval)+minval;
|
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) = {
|
static double (* const funcs1[])(void *, double) = {
|
||||||
(void *)clip,
|
(void *)clip,
|
||||||
(void *)compute_gammaval,
|
(void *)compute_gammaval,
|
||||||
|
(void *)compute_gammaval709,
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
static const char * const funcs1_names[] = {
|
static const char * const funcs1_names[] = {
|
||||||
"clip",
|
"clip",
|
||||||
"gammaval",
|
"gammaval",
|
||||||
|
"gammaval709",
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user