auxInfo = rendering.getEngine().getAuxInfo();
metadata = rendering.getEngine().getMetadata();
if (auxInfo instanceof RawImageInfo) {
final DCRaw dcRaw = ((RawImageInfo)auxInfo).getDCRaw();
daylightMultipliers = dcRaw.getDaylightMultipliers(); // pre_mul
preMul = daylightMultipliers.clone();
cameraMultipliers = dcRaw.getCameraMultipliers();
if (daylightMultipliers[0] != 0) {
daylightTemperature = neutralTemperature(daylightMultipliers, 5000);
System.out.println("daylightMultipliers: " + daylightMultipliers[0] + ", " + daylightMultipliers[1] + ", " + daylightMultipliers[2]);
System.out.println("Daylight Temperature : " + daylightTemperature);
} else
daylightTemperature = 5000;
if (cameraMultipliers[0] != 0) {
originalTemperature = temperature = neutralTemperature(cameraMultipliers, 5000);
System.out.println("cameraMultipliers: " + cameraMultipliers[0] + ", " + cameraMultipliers[1] + ", " + cameraMultipliers[2]);
System.out.println("Camera Temperature: " + originalTemperature);
} else
originalTemperature = temperature = daylightTemperature;
// we preserve the hilights in dcraw, here we have to make sure that
// we clip them appropratedly together with white balance
// double dmin = Math.min(daylightMultipliers[0], Math.min(daylightMultipliers[1], daylightMultipliers[2]));
double dmax = Math.max(daylightMultipliers[0], Math.max(daylightMultipliers[1], daylightMultipliers[2]));
// System.out.println("dmax: " + dmax + ", dmin: " + dmin);
for (int c=0; c < 3; c++)
daylightMultipliers[c] /= dmax;
// Apply camera white balance
if (cameraMultipliers[0] > 0) {
float[] wb = new float[] {(cameraMultipliers[0] / (cameraMultipliers[1] * daylightMultipliers[0])),
(cameraMultipliers[1] / (cameraMultipliers[1] * daylightMultipliers[1])),
(cameraMultipliers[2] / (cameraMultipliers[1] * daylightMultipliers[2]))};
System.out.println("Scaling with: " + wb[0] + ", " + wb[1] + ", " + wb[2]);
System.out.println("Correlated Temperature: " + neutralTemperature(wb, 5000));
cameraRGBWB = dcRaw.getCameraRGB();
for (int i = 0; i < 3; i++)
for (int j = 0; j < 3; j++)
cameraRGBWB[j][i] *= wb[i];
Matrix B = new Matrix(ColorScience.chromaticAdaptation(daylightTemperature, originalTemperature, caMethod));
Matrix combo = XYZtoRGB.times(B.times(RGBtoZYX));
cameraRGBWB = combo.inverse().times(new Matrix(cameraRGBWB)).getArrayFloat();
}
cameraRGBCA = dcRaw.getCameraRGB();
dcRaw.getDaylightMultipliers();
for (int i = 0; i < 3; i++)
for (int j = 0; j < 3; j++)
cameraRGBCA[j][i] *= dmax;
} else {