new brightness handling (#430)

* clean color adjustment

* now a prio duration of "0" means infinity

* implement dynamic 'just in time' initialization

* implement new brightness handling

* cahnge access level

* i18n fix

* - cleanup brightness stuff
- update webserver, now with initial ssl support

* - backlightThreshold is now 0-100 instead 0-1
- better performance for brightness - use piecewise linear instead of sqrt
This commit is contained in:
redPanther
2017-04-03 05:19:05 +02:00
committed by GitHub
parent 852f7b86bb
commit 5ea3c752b5
22 changed files with 366 additions and 139 deletions

View File

@@ -162,12 +162,13 @@ RgbTransform* Hyperion::createRgbTransform(const QJsonObject& colorConfig)
{
const double backlightThreshold = colorConfig["backlightThreshold"].toDouble(0.0);
const bool backlightColored = colorConfig["backlightColored"].toBool(false);
const double brightness = colorConfig["brightness"].toDouble(0.5);
const double brightness = colorConfig["brightness"].toInt(100);
const double brightnessComp= colorConfig["brightnessCompensation"].toInt(100);
const double gammaR = colorConfig["gammaRed"].toDouble(1.0);
const double gammaG = colorConfig["gammaGreen"].toDouble(1.0);
const double gammaB = colorConfig["gammaBlue"].toDouble(1.0);
RgbTransform* transform = new RgbTransform(gammaR, gammaG, gammaB, backlightThreshold, backlightColored, brightness);
RgbTransform* transform = new RgbTransform(gammaR, gammaG, gammaB, backlightThreshold, backlightColored, brightness, brightnessComp);
return transform;
}

View File

@@ -106,8 +106,10 @@ void MultiColorAdjustment::applyAdjustment(std::vector<ColorRgb>& ledColors)
uint8_t ored = color.red;
uint8_t ogreen = color.green;
uint8_t oblue = color.blue;
uint8_t B_RGB, B_CMY, B_W;
adjustment->_rgbTransform.transform(ored,ogreen,oblue);
adjustment->_rgbTransform.getBrightnessComponents(B_RGB, B_CMY, B_W);
uint32_t nrng = (uint32_t) (255-ored)*(255-ogreen);
uint32_t rng = (uint32_t) (ored) *(255-ogreen);
@@ -123,15 +125,17 @@ void MultiColorAdjustment::applyAdjustment(std::vector<ColorRgb>& ledColors)
uint8_t yellow = rg *(255-oblue)/65025;
uint8_t white = rg *(oblue) /65025;
uint8_t OR, OG, OB, RR, RG, RB, GR, GG, GB, BR, BG, BB, CR, CG, CB, MR, MG, MB, YR, YG, YB, WR, WG, WB;
adjustment->_rgbBlackAdjustment.apply(black, OR, OG, OB);
adjustment->_rgbRedAdjustment.apply(red, RR, RG, RB);
adjustment->_rgbGreenAdjustment.apply(green, GR, GG, GB);
adjustment->_rgbBlueAdjustment.apply(blue, BR, BG, BB);
adjustment->_rgbCyanAdjustment.apply(cyan, CR, CG, CB);
adjustment->_rgbMagentaAdjustment.apply(magenta, MR, MG, MB);
adjustment->_rgbYellowAdjustment.apply(yellow, YR, YG, YB);
adjustment->_rgbWhiteAdjustment.apply(white, WR, WG, WB);
uint8_t OR, OG, OB, RR, RG, RB, GR, GG, GB, BR, BG, BB;
uint8_t CR, CG, CB, MR, MG, MB, YR, YG, YB, WR, WG, WB;
adjustment->_rgbBlackAdjustment.apply (black , 255 , OR, OG, OB);
adjustment->_rgbRedAdjustment.apply (red , B_RGB, RR, RG, RB);
adjustment->_rgbGreenAdjustment.apply (green , B_RGB, GR, GG, GB);
adjustment->_rgbBlueAdjustment.apply (blue , B_RGB, BR, BG, BB);
adjustment->_rgbCyanAdjustment.apply (cyan , B_CMY, CR, CG, CB);
adjustment->_rgbMagentaAdjustment.apply(magenta, B_CMY, MR, MG, MB);
adjustment->_rgbYellowAdjustment.apply (yellow , B_CMY, YR, YG, YB);
adjustment->_rgbWhiteAdjustment.apply (white , B_W , WR, WG, WB);
color.red = OR + RR + GR + BR + CR + MR + YR + WR;
color.green = OG + RG + GG + BG + CG + MG + YG + WG;

View File

@@ -12,7 +12,7 @@ PriorityMuxer::PriorityMuxer(int ledCount)
, _lowestPriorityInfo()
{
_lowestPriorityInfo.priority = LOWEST_PRIORITY;
_lowestPriorityInfo.timeoutTime_ms = -1;
_lowestPriorityInfo.timeoutTime_ms = 0;
_lowestPriorityInfo.ledColors = std::vector<ColorRgb>(ledCount, {0, 0, 0});
_lowestPriorityInfo.componentId = hyperion::COMP_COLOR;
_lowestPriorityInfo.origin = "System";
@@ -91,7 +91,7 @@ void PriorityMuxer::setCurrentTime(const int64_t& now)
for (auto infoIt = _activeInputs.begin(); infoIt != _activeInputs.end();)
{
if (infoIt->timeoutTime_ms != -1 && infoIt->timeoutTime_ms <= now)
if (infoIt->timeoutTime_ms > 0 && infoIt->timeoutTime_ms <= now)
{
infoIt = _activeInputs.erase(infoIt);
}

View File

@@ -275,13 +275,13 @@
},
"backlightThreshold" :
{
"type" : "number",
"type" : "integer",
"title" : "edt_conf_color_backlightThreshold_title",
"required" : true,
"minimum" : 0.0,
"maximum": 1.0,
"default" : 0.0,
"step" : 0.05,
"minimum" : 0,
"maximum": 100,
"default" : 0,
"append" : "edt_append_percent",
"propertyOrder" : 11
},
"backlightColored" :
@@ -294,15 +294,27 @@
},
"brightness" :
{
"type" : "number",
"type" : "integer",
"title" : "edt_conf_color_brightness_title",
"required" : true,
"minimum" : 0.0,
"maximum": 1.0,
"default" : 1.0,
"step" : 0.05,
"minimum" : 0,
"maximum": 100,
"default" : 100,
"append" : "edt_append_percent",
"propertyOrder" : 13
},
"brightnessCompensation" :
{
"type" : "integer",
"title" : "edt_conf_color_brightnessComp_title",
"required" : true,
"minimum" : 0,
"maximum": 100,
"default" : 90,
"append" : "edt_append_percent",
"access" : "advanced",
"propertyOrder" : 14
},
"gammaRed" :
{
"type" : "number",
@@ -312,7 +324,7 @@
"maximum": 100.0,
"default" : 1.5,
"step" : 0.1,
"propertyOrder" : 14
"propertyOrder" : 15
},
"gammaGreen" :
{
@@ -323,7 +335,7 @@
"maximum": 100.0,
"default" : 1.5,
"step" : 0.1,
"propertyOrder" : 15
"propertyOrder" : 16
},
"gammaBlue" :
{
@@ -334,7 +346,7 @@
"maximum": 100.0,
"default" : 1.5,
"step" : 0.1,
"propertyOrder" : 16
"propertyOrder" : 17
}
},
"additionalProperties" : false