Build-time flag to disable CIE1931 color correction
Signed-off-by: Emil Muratov <gpm@hotplug.ru>
This commit is contained in:
parent
b1092495e9
commit
e04c30c8ae
2 changed files with 11 additions and 4 deletions
|
@ -478,10 +478,11 @@ void IRAM_ATTR MatrixPanel_I2S_DMA::updateMatrixDMABuffer(int16_t x_coord, int16
|
|||
* i.e. It's almost impossible for color_depth_idx of 0 to be sent out to the MATRIX unless the 'value' of a color is exactly '1'
|
||||
* https://ledshield.wordpress.com/2012/11/13/led-brightness-to-your-eye-gamma-correction-no/
|
||||
*/
|
||||
|
||||
#ifndef NO_CIE1931
|
||||
red = lumConvTab[red];
|
||||
green = lumConvTab[green];
|
||||
blue = lumConvTab[blue];
|
||||
#endif
|
||||
|
||||
/* When using the drawPixel, we are obviously only changing the value of one x,y position,
|
||||
* however, the two-scan panels paint TWO lines at the same time
|
||||
|
@ -543,9 +544,11 @@ void MatrixPanel_I2S_DMA::updateMatrixDMABuffer(uint8_t red, uint8_t green, uint
|
|||
if ( !initialized ) return;
|
||||
|
||||
/* https://ledshield.wordpress.com/2012/11/13/led-brightness-to-your-eye-gamma-correction-no/ */
|
||||
#ifndef NO_CIE1931
|
||||
red = lumConvTab[red];
|
||||
green = lumConvTab[green];
|
||||
blue = lumConvTab[blue];
|
||||
#endif
|
||||
|
||||
for(uint8_t color_depth_idx=0; color_depth_idx<PIXEL_COLOR_DEPTH_BITS; color_depth_idx++) // color depth - 8 iterations
|
||||
{
|
||||
|
@ -862,9 +865,11 @@ void MatrixPanel_I2S_DMA::hlineDMA(int16_t x_coord, int16_t y_coord, int16_t l,
|
|||
l = PIXELS_PER_ROW - x_coord + 1; // reset width to end of row
|
||||
|
||||
/* LED Brightness Compensation */
|
||||
#ifndef NO_CIE1931
|
||||
red = lumConvTab[red];
|
||||
green = lumConvTab[green];
|
||||
blue = lumConvTab[blue];
|
||||
#endif
|
||||
|
||||
uint16_t _colorbitclear = BITMASK_RGB1_CLEAR, _colorbitoffset = 0;
|
||||
|
||||
|
@ -929,9 +934,11 @@ void MatrixPanel_I2S_DMA::vlineDMA(int16_t x_coord, int16_t y_coord, int16_t l,
|
|||
l = m_cfg.mx_height - y_coord + 1; // reset width to end of col
|
||||
|
||||
/* LED Brightness Compensation */
|
||||
#ifndef NO_CIE1931
|
||||
red = lumConvTab[red];
|
||||
green = lumConvTab[green];
|
||||
blue = lumConvTab[blue];
|
||||
#endif
|
||||
|
||||
// Save the calculated value to the bitplane memory in reverse order to account for I2S Tx FIFO mode1 ordering
|
||||
x_coord & 1U ? --x_coord : ++x_coord;
|
||||
|
|
|
@ -74,7 +74,7 @@
|
|||
#endif
|
||||
|
||||
// 8bit per RGB color = 24 bit/per pixel,
|
||||
// might be reduced to save RAM but it corrupts colours badly (currently broken)
|
||||
// might be reduced to save DMA RAM
|
||||
#ifndef PIXEL_COLOR_DEPTH_BITS
|
||||
#define PIXEL_COLOR_DEPTH_BITS 8
|
||||
#endif
|
||||
|
@ -208,13 +208,13 @@ typedef struct RGB24 {
|
|||
|
||||
|
||||
/***************************************************************************************/
|
||||
// Used by val2PWM
|
||||
//C/p'ed from https://ledshield.wordpress.com/2012/11/13/led-brightness-to-your-eye-gamma-correction-no/
|
||||
// Example calculator: https://gist.github.com/mathiasvr/19ce1d7b6caeab230934080ae1f1380e
|
||||
// need to make sure this would end up in RAM for fastest access
|
||||
#ifndef NO_CIE1931
|
||||
static const uint8_t DRAM_ATTR lumConvTab[]={
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 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, 11, 11, 11, 12, 12, 12, 13, 13, 13, 14, 14, 14, 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, 45, 45, 46, 47, 48, 49, 50, 51, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 73, 74, 75, 76, 77, 78, 80, 81, 82, 83, 84, 86, 87, 88, 90, 91, 92, 93, 95, 96, 98, 99, 100, 102, 103, 105, 106, 107, 109, 110, 112, 113, 115, 116, 118, 120, 121, 123, 124, 126, 128, 129, 131, 133, 134, 136, 138, 139, 141, 143, 145, 146, 148, 150, 152, 154, 156, 157, 159, 161, 163, 165, 167, 169, 171, 173, 175, 177, 179, 181, 183, 185, 187, 189, 192, 194, 196, 198, 200, 203, 205, 207, 209, 212, 214, 216, 218, 221, 223, 226, 228, 230, 233, 235, 238, 240, 243, 245, 248, 250, 253, 255, 255};
|
||||
|
||||
#endif
|
||||
|
||||
/** @brief - configuration values for HUB75_I2S driver
|
||||
* This structure holds configuration vars that are used as
|
||||
|
|
Loading…
Reference in a new issue