I think there is not much secret to tell. **Typical Auto WB tries to get an image which is gray in average**, i.e. where the R, G and B averaged values are the same. And to achieve that it calculates the 3 appropiate relative coefficients (2 in practice) by which each RAW channel must be scaled.

Regards.

As per

Eric Chan's previous post, multiplying by the red and blue coefficients merely gives a first order approximation to the white balance (diagonal matrix). To obtain a more accurate white balance, one has to use a full matrix derived from the correlated color temperature of the set white balance. ACR interpolates between daylight and tungsten profiles to derive the matrix. The precise methodology used by ACR is described in Chapter 6 of the DNG specification, but many of these matters are beyond my expertise. For my Nikon D3, I don't know exactly what white balance information is recorded in the raw file. It could by multipliers, a correlated color temperature, or a CIE xy coordinate. Perhaps Eric can elaborate.

If you have a well defined white as in Guillermo's image, one can achieve an approximate WB relatively simply by using linear curves for the red and blue so as to equalize the RGB values in the whites and neutral areas. This is equivalent to using multipliers. This is shown in the following image rendered by Iris into a gamma one space without white balance. The white balance curves are shown. Additional curves were needed for gamma, contrast, and saturation.

[attachment=16247:WhiBal.png]

The image is hardly optimized, as shown by comparison to the ACR rendering.

[attachment=16248:2009Jul16_0014.jpg]