+ // Only set the white balance if it actually changed. This means that the user
+ // is free to override the white balance in a video with no white balance information
+ // actually set (ie. r=g=b=1 all the time), or one where the white point is wrong,
+ // but frame-to-frame decisions will be heeded. We do this pretty much as late
+ // as possible (ie., after picking out the frame from the buffer), so that we are sure
+ // that the change takes effect on exactly the right frame.
+ if (fabs(new_frame->neutral_color.r - last_received_neutral_color[card_index].r) > 1e-3 ||
+ fabs(new_frame->neutral_color.g - last_received_neutral_color[card_index].g) > 1e-3 ||
+ fabs(new_frame->neutral_color.b - last_received_neutral_color[card_index].b) > 1e-3) {
+ theme->set_wb_for_signal(card_index, new_frame->neutral_color.r, new_frame->neutral_color.g, new_frame->neutral_color.b);
+ last_received_neutral_color[card_index] = new_frame->neutral_color;
+ }
+