Le duodi 2 floréal, an CCXXIII, Pedro Arthur a écrit : > Subject: [FFmpeg-devel] [GSoC] Patch which adds support for gamma correct
"sws: add support for gamma-correct scaling"
> + { "true", "enable", 0,
> AV_OPT_TYPE_CONST, { .i64 = 1 }, INT_MIN, INT_MAX,
> VE, "gamma" },
> + { "false", "disable", 0,
> AV_OPT_TYPE_CONST, { .i64 = 0 }, INT_MIN, INT_MAX,
> VE, "gamma" },
This is not usually done.
> + float gamma_value;
> +static uint16_t * alloc_gamma_tbl(float e)
> + tbl[i] = (int) (pow( ((float)i)/65535.f, e) * 65535.f);
Do you have reasons to use float specifically? AFAIK, except when memory
consumption is relevant (i.e. large arrays), double should be preferred.
This is especially true in your last formula: you force i to float, you
force 65535 to float, but you use pow() rather than powf().
The cast to int seems dubious too, since your array is uint16_t.
IMHO, just use a double argument and write:
tbl[i] = pow(i / 65535.0, e) * 65535.0);
More readable, less confusing for the compiler.
Regards,
--
Nicolas George
signature.asc
Description: Digital signature
_______________________________________________ ffmpeg-devel mailing list [email protected] http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
