Filter rework, next step (#82)

* common ledbuffer for color transform

hyperion class uses a common buffer for all operations on ledColors got from muxer
all color transforms uses new ledBuffer instead of making copies of ledbuffer

other fixes:
fix compile bug in profiler
update doxygen config

* migrate logging for color transform classes

* prepare new logger in hyperion class

* implement hwledcount

* Update Hyperion.cpp

Fix off color

* remove ledscount equivalent from apa102
migrate logging in hyperion.cpp
remove unused and duuplicate colorcorrection - but same is available through tempertature

* remove colorcorrection completly
fix compile

* set colororder back to static

* in remote: using correction is the same as using temperature - correction is obsolete, command not delete atm for compat reasons

* refactoring of RgbChannelAdjustment

* - remove rgbchannelcorrection, this was a dup of rgbchanneladjustment
- add cmake policy to hide warning
- tune code of rgbchanneltransform
This commit is contained in:
redPanther
2016-07-04 00:43:41 +02:00
committed by brindosch
parent 921f164b26
commit 78eaaa2e84
12 changed files with 46 additions and 226 deletions

View File

@@ -36,8 +36,6 @@ add_library(hyperion-utils
${CURRENT_SOURCE_DIR}/HslTransform.cpp
${CURRENT_HEADER_DIR}/RgbChannelTransform.h
${CURRENT_SOURCE_DIR}/RgbChannelTransform.cpp
${CURRENT_HEADER_DIR}/RgbChannelCorrection.h
${CURRENT_SOURCE_DIR}/RgbChannelCorrection.cpp
${CURRENT_HEADER_DIR}/RgbChannelAdjustment.h
${CURRENT_SOURCE_DIR}/RgbChannelAdjustment.cpp

View File

@@ -1,120 +0,0 @@
// STL includes
#include <cmath>
// Utils includes
#include <utils/RgbChannelCorrection.h>
RgbChannelCorrection::RgbChannelCorrection() :
_correctionR(255),
_correctionG(255),
_correctionB(255)
{
initializeMapping();
}
RgbChannelCorrection::RgbChannelCorrection(int correctionR, int correctionG, int correctionB) :
_correctionR(correctionR),
_correctionG(correctionG),
_correctionB(correctionB)
{
initializeMapping();
}
RgbChannelCorrection::~RgbChannelCorrection()
{
}
uint8_t RgbChannelCorrection::getcorrectionR() const
{
return _correctionR;
}
void RgbChannelCorrection::setcorrectionR(uint8_t correctionR)
{
_correctionR = correctionR;
initializeMapping();
}
uint8_t RgbChannelCorrection::getcorrectionG() const
{
return _correctionG;
}
void RgbChannelCorrection::setcorrectionG(uint8_t correctionG)
{
_correctionG = correctionG;
initializeMapping();
}
uint8_t RgbChannelCorrection::getcorrectionB() const
{
return _correctionB;
}
void RgbChannelCorrection::setcorrectionB(uint8_t correctionB)
{
_correctionB = correctionB;
initializeMapping();
}
uint8_t RgbChannelCorrection::correctionR(uint8_t inputR) const
{
return _mappingR[inputR];
}
uint8_t RgbChannelCorrection::correctionG(uint8_t inputG) const
{
return _mappingG[inputG];
}
uint8_t RgbChannelCorrection::correctionB(uint8_t inputB) const
{
return _mappingB[inputB];
}
void RgbChannelCorrection::initializeMapping()
{
// initialize the mapping
for (int i = 0; i < 256; ++i)
{
int outputR = (i * _correctionR) / 255;
if (outputR < -255)
{
outputR = -255;
}
else if (outputR > 255)
{
outputR = 255;
}
_mappingR[i] = outputR;
}
for (int i = 0; i < 256; ++i)
{
int outputG = (i * _correctionG) / 255;
if (outputG < -255)
{
outputG = -255;
}
else if (outputG > 255)
{
outputG = 255;
}
_mappingG[i] = outputG;
}
for (int i = 0; i < 256; ++i)
{
int outputB = (i * _correctionB) / 255;
if (outputB < -255)
{
outputB = -255;
}
else if (outputB > 255)
{
outputB = 255;
}
_mappingB[i] = outputB;
}
}

View File

@@ -4,28 +4,29 @@
// Utils includes
#include <utils/RgbChannelTransform.h>
RgbChannelTransform::RgbChannelTransform() :
_threshold(0),
_gamma(1.0),
_blacklevel(0.0),
_whitelevel(1.0)
RgbChannelTransform::RgbChannelTransform()
{
initializeMapping();
setTransform(0.0, 1.0, 0.0, 1.0);
}
RgbChannelTransform::RgbChannelTransform(double threshold, double gamma, double blacklevel, double whitelevel) :
_threshold(threshold),
_gamma(gamma),
_blacklevel(blacklevel),
_whitelevel(whitelevel)
RgbChannelTransform::RgbChannelTransform(double threshold, double gamma, double blacklevel, double whitelevel)
{
initializeMapping();
setTransform(threshold, gamma, blacklevel, whitelevel);
}
RgbChannelTransform::~RgbChannelTransform()
{
}
void RgbChannelTransform::setTransform(double threshold, double gamma, double blacklevel, double whitelevel)
{
_threshold = threshold;
_gamma = gamma;
_blacklevel = blacklevel;
_whitelevel = whitelevel;
initializeMapping();
}
double RgbChannelTransform::getThreshold() const
{
return _threshold;
@@ -33,8 +34,7 @@ double RgbChannelTransform::getThreshold() const
void RgbChannelTransform::setThreshold(double threshold)
{
_threshold = threshold;
initializeMapping();
setTransform(threshold, _gamma, _blacklevel, _whitelevel);
}
double RgbChannelTransform::getGamma() const
@@ -44,8 +44,7 @@ double RgbChannelTransform::getGamma() const
void RgbChannelTransform::setGamma(double gamma)
{
_gamma = gamma;
initializeMapping();
setTransform(_threshold, gamma, _blacklevel, _whitelevel);
}
double RgbChannelTransform::getBlacklevel() const
@@ -55,8 +54,7 @@ double RgbChannelTransform::getBlacklevel() const
void RgbChannelTransform::setBlacklevel(double blacklevel)
{
_blacklevel = blacklevel;
initializeMapping();
setTransform(_threshold, _gamma, blacklevel, _whitelevel);
}
double RgbChannelTransform::getWhitelevel() const
@@ -66,8 +64,7 @@ double RgbChannelTransform::getWhitelevel() const
void RgbChannelTransform::setWhitelevel(double whitelevel)
{
_whitelevel = whitelevel;
initializeMapping();
setTransform(_threshold, _gamma, _blacklevel, whitelevel);
}
void RgbChannelTransform::initializeMapping()