[Improvement]Fix loss of permissibleRatio calcaulation accuracy.

The previous method performs exponential calculation after natural logarithm and subtraction operation, which brings loss of calculation accuracy. So it is recommended to modify this method from the perspective of scientific calculation.

Change-Id: Id6c7ca3c222226d642bd075519da693a8538dba6
Signed-off-by: linkai <linkai@xiaomi.com>
This commit is contained in:
linkai
2021-03-29 14:11:15 +08:00
parent 35f70208f8
commit 2aaa220e0f

View File

@@ -440,9 +440,8 @@ public abstract class BrightnessMappingStrategy {
}
private float permissibleRatio(float currLux, float prevLux) {
return MathUtils.exp(MAX_GRAD
* (MathUtils.log(currLux + LUX_GRAD_SMOOTHING)
- MathUtils.log(prevLux + LUX_GRAD_SMOOTHING)));
return MathUtils.pow((currLux + LUX_GRAD_SMOOTHING)
/ (prevLux + LUX_GRAD_SMOOTHING), MAX_GRAD);
}
protected float inferAutoBrightnessAdjustment(float maxGamma, float desiredBrightness,