diff --git a/platformio.ini b/platformio.ini index f93278b8..91670629 100644 --- a/platformio.ini +++ b/platformio.ini @@ -591,8 +591,9 @@ build_flags_min = -D WLED_DISABLE_BLYNK ; BLYNK is only provided for backwards compatibility (no new users accepted) ;-D WLED_DISABLE_BROWNOUT_DET ; enable if you get "brownout detected" errors at startup -D WLED_USE_MY_CONFIG + -D WLED_USE_CIE_BRIGHTNESS_TABLE ;; experimental: use different color / brightness lookup table -D USERMOD_AUDIOREACTIVE - -D UM_AUDIOREACTIVE_USE_NEW_FFT ; use latest (upstream) FFTLib, instead of older library midified by blazoncek. Slightly faster, more accurate, needs 2KB RAM extra + -D UM_AUDIOREACTIVE_USE_NEW_FFT ; use latest (upstream) FFTLib, instead of older library modified by blazoncek. Slightly faster, more accurate, needs 2KB RAM extra -D USERMOD_CUSTOMEFFECTS ; WLEDMM usermod ; -D WLED_DEBUG ; lots of generic debug messages ; -D SR_DEBUG ; some extra debug messages from audioreactive diff --git a/wled00/colors.cpp b/wled00/colors.cpp index 0387a925..e816c6f8 100644 --- a/wled00/colors.cpp +++ b/wled00/colors.cpp @@ -320,8 +320,9 @@ uint16_t approximateKelvinFromRGB(uint32_t rgb) { } } +#if !defined(WLED_USE_CIE_BRIGHTNESS_TABLE) //gamma 2.8 lookup table used for color correction -static byte gammaT[] = { +static byte gammaT[256] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, @@ -338,6 +339,29 @@ static byte gammaT[] = { 144,146,148,150,152,154,156,158,160,162,164,167,169,171,173,175, 177,180,182,184,186,189,191,193,196,198,200,203,205,208,210,213, 215,218,220,223,225,228,231,233,236,239,241,244,247,249,252,255 }; +#else +// experimental +// CIE 1931 lookup table (8bit->8bit) that was proposed during discussion of issue #2767 +// https://github.com/Aircoookie/WLED/issues/2767#issuecomment-1310961308 +static byte gammaT[256] = { + 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 4, + 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, + 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 10, 10, 10, 10, 11, + 11, 11, 12, 12, 12, 13, 13, 13, 14, 14, 15, 15, 15, 16, 16, 17, + 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, 23, 23, 24, 24, + 25, 25, 26, 27, 27, 28, 28, 29, 30, 30, 31, 31, 32, 33, 33, 34, + 35, 35, 36, 37, 38, 38, 39, 40, 41, 41, 42, 43, 44, 44, 45, 46, + 47, 48, 49, 50, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, + 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 74, 75, 76, 77, 78, + 79, 81, 82, 83, 84, 85, 87, 88, 89, 91, 92, 93, 94, 96, 97, 99, + 100, 101, 103, 104, 106, 107, 109, 110, 111, 113, 115, 116, 118, 119, 121, + 122, 124, 126, 127, 129, 130, 132, 134, 135, 137, 139, 141, 142, 144, 146, + 148, 150, 151, 153, 155, 157, 159, 161, 163, 165, 167, 169, 170, 172, 174, + 177, 179, 181, 183, 185, 187, 189, 191, 193, 195, 198, 200, 202, 204, 207, + 209, 211, 213, 216, 218, 220, 223, 225, 227, 230, 232, 235, 237, 240, 242, + 245, 247, 250, 252, 255 }; +#endif uint8_t gamma8_cal(uint8_t b, float gamma) {