45 double g = 1.0 / param->
gamma;
48 for (i = 0; i < 256; i++) {
60 param->
lut[i] = 256.0 *
v;
68 const uint8_t *
src,
int src_stride,
int w,
int h)
75 for (y = 0; y < h; y++) {
76 for (x = 0; x < w; x++) {
77 dst[y * dst_stride + x] = param->
lut[src[y * src_stride + x]];
83 const uint8_t *
src,
int src_stride,
int w,
int h)
87 int contrast = (int) (param->
contrast * 256 * 16);
88 int brightness = ((int) (100.0 * param->
brightness + 100.0) * 511) / 200 - 128 - contrast / 32;
90 for (y = 0; y < h; y++) {
91 for (x = 0; x < w; x++) {
92 pel = ((src[y * src_stride + x] * contrast) >> 12) + brightness;
97 dst[y * dst_stride + x] = pel;
106 else if (param->
gamma == 1.0)
142 for (i = 0; i < 3; i++) {
155 for (i = 1; i < 3; i++) {
173 "Error when evaluating the expression '%s' for %s\n",
262 if (i == 1 || i == 2) {
280 char *res,
int res_len,
int flags)
285 if (!strcmp(cmd,
"contrast")) {
290 else if (!strcmp(cmd,
"brightness")) {
295 else if (!strcmp(cmd,
"saturation")) {
300 else if (!strcmp(cmd,
"gamma")) {
305 else if (!strcmp(cmd,
"gamma_r")) {
310 else if (!strcmp(cmd,
"gamma_g")) {
315 else if (!strcmp(cmd,
"gamma_b")) {
320 else if (!strcmp(cmd,
"gamma_weight")) {
346 #define OFFSET(x) offsetof(EQContext, x)
347 #define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
350 {
"contrast",
"set the contrast adjustment, negative values give a negative image",
352 {
"brightness",
"set the brightness adjustment",
354 {
"saturation",
"set the saturation adjustment",
356 {
"gamma",
"set the initial gamma value",
358 {
"gamma_r",
"gamma value for red",
360 {
"gamma_g",
"gamma value for green",
362 {
"gamma_b",
"gamma value for blue",
364 {
"gamma_weight",
"set the gamma weight which reduces the effect of gamma on bright areas",
375 .priv_class = &eq_class,