36 double gr, gg, gb, ga;
37 double br, bg, bb, ba;
38 double ar, ag, ab, aa;
47 #define OFFSET(x) offsetof(ColorChannelMixerContext, x)
48 #define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
111 for (i = 0; i < 4; i++)
112 for (j = 0; j < 4; j++, buffer +=
size)
113 cm->
lut[i][j] = buffer;
165 dstrow = out->
data[0];
166 switch (outlink->
format) {
169 for (i = 0; i < outlink->
h; i++) {
173 for (j = 0; j < outlink->
w * 3; j += 3) {
174 const uint8_t rin = src[j + roffset];
175 const uint8_t gin = src[j + goffset];
176 const uint8_t bin = src[j + boffset];
178 dst[j + roffset] = av_clip_uint8(cm->
lut[
R][
R][rin] +
181 dst[j + goffset] = av_clip_uint8(cm->
lut[
G][
R][rin] +
184 dst[j + boffset] = av_clip_uint8(cm->
lut[
B][
R][rin] +
197 for (i = 0; i < outlink->
h; i++) {
201 for (j = 0; j < outlink->
w * 4; j += 4) {
202 const uint8_t rin = src[j + roffset];
203 const uint8_t gin = src[j + goffset];
204 const uint8_t bin = src[j + boffset];
206 dst[j + roffset] = av_clip_uint8(cm->
lut[
R][
R][rin] +
209 dst[j + goffset] = av_clip_uint8(cm->
lut[
G][
R][rin] +
212 dst[j + boffset] = av_clip_uint8(cm->
lut[
B][
R][rin] +
216 dst[j + aoffset] = 0;
227 for (i = 0; i < outlink->
h; i++) {
231 for (j = 0; j < outlink->
w * 4; j += 4) {
232 const uint8_t rin = src[j + roffset];
233 const uint8_t gin = src[j + goffset];
234 const uint8_t bin = src[j + boffset];
235 const uint8_t ain = src[j + aoffset];
237 dst[j + roffset] = av_clip_uint8(cm->
lut[
R][
R][rin] +
241 dst[j + goffset] = av_clip_uint8(cm->
lut[
G][
R][rin] +
245 dst[j + boffset] = av_clip_uint8(cm->
lut[
B][
R][rin] +
249 dst[j + aoffset] = av_clip_uint8(cm->
lut[
A][
R][rin] +
261 for (i = 0; i < outlink->
h; i++) {
262 const uint16_t *
src = (
const uint16_t *)srcrow;
263 uint16_t *dst = (uint16_t *)dstrow;
265 for (j = 0; j < outlink->
w * 3; j += 3) {
266 const uint16_t rin = src[j + roffset];
267 const uint16_t gin = src[j + goffset];
268 const uint16_t bin = src[j + boffset];
270 dst[j + roffset] = av_clip_uint16(cm->
lut[
R][
R][rin] +
273 dst[j + goffset] = av_clip_uint16(cm->
lut[
G][
R][rin] +
276 dst[j + boffset] = av_clip_uint16(cm->
lut[
B][
R][rin] +
287 for (i = 0; i < outlink->
h; i++) {
288 const uint16_t *
src = (
const uint16_t *)srcrow;
289 uint16_t *dst = (uint16_t *)dstrow;
291 for (j = 0; j < outlink->
w * 4; j += 4) {
292 const uint16_t rin = src[j + roffset];
293 const uint16_t gin = src[j + goffset];
294 const uint16_t bin = src[j + boffset];
295 const uint16_t ain = src[j + aoffset];
297 dst[j + roffset] = av_clip_uint16(cm->
lut[
R][
R][rin] +
301 dst[j + goffset] = av_clip_uint16(cm->
lut[
G][
R][rin] +
305 dst[j + boffset] = av_clip_uint16(cm->
lut[
B][
R][rin] +
309 dst[j + aoffset] = av_clip_uint16(cm->
lut[
A][
R][rin] +
351 .
name =
"colorchannelmixer",
354 .priv_class = &colorchannelmixer_class,
357 .
inputs = colorchannelmixer_inputs,
358 .
outputs = colorchannelmixer_outputs,