Value from left_luminance is assigned to out_luminance here, but that stored value is not used before it is overwritten in the next cycle of the loop. Removing assignation. CID #1226473