CalRGB: optimize CalRGB calculations

Also fix one silly mistake.
Merge pull request #5200 from kkujala/calrgb

CalRGB: optimize CalRGB calculations