28 const float *pixel_color = it.in(0);
29 const float *screen_color = it.in(1);
31 const int screen_primary_channel =
max_axis_v3(screen_color);
32 const int other_1 = (screen_primary_channel + 1) % 3;
33 const int other_2 = (screen_primary_channel + 2) % 3;
35 const int min_channel = std::min(other_1, other_2);
36 const int max_channel = std::max(other_1, other_2);
38 const float average_value =
color_balance_ * pixel_color[min_channel] +
40 const float amount = (pixel_color[screen_primary_channel] - average_value);
45 if (amount_despill > 0.0f) {
46 it.out[screen_primary_channel] = pixel_color[screen_primary_channel] - amount_despill;