Color correction is performed on a first set of three pixel values by
determining a color phase of the pixel values. The determined color phase
is used to determine a phase difference, and the phase difference is used
to control an amount of color phase rotation applied to the chrominance
pixel values of the first set. The color phase is also used to determine
a first gain, and the first gain is used to control a scaling of the
rotated chrominance pixel values, thereby generating color corrected
chrominance pixel values. The color phase is also used to determine a
second gain, and the second gain is used to control an amount of scaling
applied to the luminance pixel value of the first set, thereby generating
the color corrected luminance pixel value. How color phase determines
phase difference, the first gain and the second gain is changed depending
on lighting conditions.