Factorize luminance computation.