在Android11源码OK3568-android11-source/frameworks/base/packages/SettingsLib/src/com/android/settingslib/display/BrightnessUtils.java文件中做如下修改后编译烧写即可: @@ -76,7 +76,7 @@ public class BrightnessUtils { */ public static final float convertGammaToLinearFloat(int val, float min, float max) { final float normalizedVal = MathUtils.norm(GAMMA_SPACE_MIN, GAMMA_SPACE_MAX, val); - final float ret; + /* final float ret; if (normalizedVal <= R) { ret = MathUtils.sq(normalizedVal / R); } else { @@ -86,10 +86,10 @@ public class BrightnessUtils { // HLG is normalized to the range [0, 12], ensure that value is within that range, // it shouldn't be out of bounds. final float normalizedRet = MathUtils.constrain(ret, 0, 12); - +*/ // Re-normalize to the range [0, 1] // in order to derive the correct setting value. - return MathUtils.lerp(min, max, normalizedRet / 12); + return MathUtils.lerp(min, max, normalizedVal); } /** @@ -128,14 +128,13 @@ public class BrightnessUtils { */ public static final int convertLinearToGammaFloat(float val, float min, float max) { // For some reason, HLG normalizes to the range [0, 12] rather than [0, 1] - final float normalizedVal = MathUtils.norm(min, max, val) * 12; - final float ret; + final float normalizedVal = MathUtils.norm(min, max, val) ; + /* final float ret; if (normalizedVal <= 1f) { ret = MathUtils.sqrt(normalizedVal) * R; } else { ret = A * MathUtils.log(normalizedVal - B) + C; - } - - return Math.round(MathUtils.lerp(GAMMA_SPACE_MIN, GAMMA_SPACE_MAX, ret)); + }*/ + return Math.round(MathUtils.lerp(GAMMA_SPACE_MIN, GAMMA_SPACE_MAX, normalizedVal)); } } |
|小黑屋| 飞凌嵌入式 ( 冀ICP备12004394号-1 )
GMT+8, 2024-11-22 09:56
Powered by Discuz! X3.4
© 2001-2013 Comsenz Inc.