52 #define OFFSET(x) offsetof(ColorBalanceContext, x)
53 #define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
89 double *shadows, *midtones, *highlights, *
buffer;
92 buffer =
av_malloc(256 * 3 *
sizeof(*buffer));
96 shadows = buffer + 256 * 0;
97 midtones = buffer + 256 * 1;
98 highlights = buffer + 256 * 2;
100 for (i = 0; i < 256; i++) {
101 double low = av_clipd((i - 85.0) / -64.0 + 0.5, 0, 1) * 178.5;
102 double mid = av_clipd((i - 85.0) / 64.0 + 0.5, 0, 1) *
103 av_clipd((i + 85.0 - 255.0) / -64.0 + 0.5, 0, 1) * 178.5;
107 highlights[255 - i] = low;
110 for (i = 0; i < 256; i++) {
147 const int step = cb->
step;
164 dstrow = out->
data[0];
165 for (i = 0; i < outlink->
h; i++) {
169 for (j = 0; j < outlink->
w * step; j += step) {
170 dst[j + roffset] = cb->
lut[
R][src[j + roffset]];
171 dst[j + goffset] = cb->
lut[
G][src[j + goffset]];
172 dst[j + boffset] = cb->
lut[
B][src[j + boffset]];
173 if (in != out && step == 4)
174 dst[j + aoffset] = src[j + aoffset];
205 .
name =
"colorbalance",
208 .priv_class = &colorbalance_class,
210 .
inputs = colorbalance_inputs,
211 .
outputs = colorbalance_outputs,