Skip to content

Commit

Permalink
Cleanup RawConverter exception and white point conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
amirzaidi committed Mar 26, 2019
1 parent 4b7ee1d commit 6a95d94
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions app/src/main/java/amirz/dngprocessor/gl/RawConverter.java
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ public RawConverter(SensorParams sensor, ProcessParams process,
}
if ((sensor.inputStride % 2) != 0) {
throw new IllegalArgumentException("Invalid stride for RAW16 format ("
+ sensor.inputStride + "), see graphics.h.");
+ sensor.inputStride + ")");
}

outWidth = argbOutput.getWidth();
Expand Down Expand Up @@ -237,7 +237,7 @@ public RawConverter(SensorParams sensor, ProcessParams process,
XYZ[2] /= XYZ[1];
XYZ[1] = 1f;

float[] CA = mapWhiteMatrix(XYZ, D50_XYZ);
float[] CA = mapWhiteMatrix(XYZ);
multiply(CA, sensorToXYZ, sensorToXYZ_D50);
}

Expand Down Expand Up @@ -266,18 +266,18 @@ public RawConverter(SensorParams sensor, ProcessParams process,
square.setTransforms1(sensorToXYZ_D50);
}

private float[] mapWhiteMatrix(float[] white_d50, float[] white_xyz) {
private float[] mapWhiteMatrix(float[] sensorWhiteXYZ) {
float[] Mb = {
0.8951f, 0.2664f, -0.1614f,
-0.7502f, 1.7135f, 0.0367f,
0.0389f, -0.0685f, 1.0296f
};

float[] w1 = new float[3];
map(Mb, white_d50, w1);
map(Mb, sensorWhiteXYZ, w1);

float[] w2 = new float[3];
map(Mb, white_xyz, w2);
map(Mb, RawConverter.D50_XYZ, w2);

float[] A = new float[9];
A[0] = (float) Math.max(0.1, Math.min(w1[0] > 0 ? w2[0] / w1[0] : 10, 10));
Expand Down

0 comments on commit 6a95d94

Please sign in to comment.