mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
Merge branch 'master' into refactor/led_device
This commit is contained in:
@@ -6,7 +6,6 @@
|
||||
|
||||
struct ColorArgb
|
||||
{
|
||||
|
||||
/// The alpha mask channel
|
||||
uint8_t alpha;
|
||||
|
||||
@@ -18,20 +17,19 @@ struct ColorArgb
|
||||
uint8_t blue;
|
||||
|
||||
/// 'Black' RgbColor (255, 0, 0, 0)
|
||||
static ColorArgb BLACK;
|
||||
static const ColorArgb BLACK;
|
||||
/// 'Red' RgbColor (255, 255, 0, 0)
|
||||
static ColorArgb RED;
|
||||
static const ColorArgb RED;
|
||||
/// 'Green' RgbColor (255, 0, 255, 0)
|
||||
static ColorArgb GREEN;
|
||||
static const ColorArgb GREEN;
|
||||
/// 'Blue' RgbColor (255, 0, 0, 255)
|
||||
static ColorArgb BLUE;
|
||||
static const ColorArgb BLUE;
|
||||
/// 'Yellow' RgbColor (255, 255, 255, 0)
|
||||
static ColorArgb YELLOW;
|
||||
static const ColorArgb YELLOW;
|
||||
/// 'White' RgbColor (255, 255, 255, 255)
|
||||
static ColorArgb WHITE;
|
||||
static const ColorArgb WHITE;
|
||||
};
|
||||
|
||||
|
||||
/// Assert to ensure that the size of the structure is 'only' 3 bytes
|
||||
static_assert(sizeof(ColorArgb) == 4, "Incorrect size of ColorARGB");
|
||||
|
||||
@@ -44,6 +42,12 @@ static_assert(sizeof(ColorArgb) == 4, "Incorrect size of ColorARGB");
|
||||
///
|
||||
inline std::ostream& operator<<(std::ostream& os, const ColorArgb& color)
|
||||
{
|
||||
os << "{" << unsigned(color.alpha) << "," << unsigned(color.red) << "," << unsigned(color.green) << "," << unsigned(color.blue) << "}";
|
||||
os << "{"
|
||||
<< color.alpha << ","
|
||||
<< color.red << ","
|
||||
<< color.green << ","
|
||||
<< color.blue
|
||||
<< "}";
|
||||
|
||||
return os;
|
||||
}
|
||||
|
@@ -17,18 +17,19 @@ struct ColorBgr
|
||||
/// The red color channel
|
||||
uint8_t red;
|
||||
|
||||
|
||||
/// 'Black' RgbColor (0, 0, 0)
|
||||
static ColorBgr BLACK;
|
||||
static const ColorBgr BLACK;
|
||||
/// 'Red' RgbColor (255, 0, 0)
|
||||
static ColorBgr RED;
|
||||
static const ColorBgr RED;
|
||||
/// 'Green' RgbColor (0, 255, 0)
|
||||
static ColorBgr GREEN;
|
||||
static const ColorBgr GREEN;
|
||||
/// 'Blue' RgbColor (0, 0, 255)
|
||||
static ColorBgr BLUE;
|
||||
static const ColorBgr BLUE;
|
||||
/// 'Yellow' RgbColor (255, 255, 0)
|
||||
static ColorBgr YELLOW;
|
||||
static const ColorBgr YELLOW;
|
||||
/// 'White' RgbColor (255, 255, 255)
|
||||
static ColorBgr WHITE;
|
||||
static const ColorBgr WHITE;
|
||||
};
|
||||
|
||||
/// Assert to ensure that the size of the structure is 'only' 3 bytes
|
||||
@@ -43,19 +44,33 @@ static_assert(sizeof(ColorBgr) == 3, "Incorrect size of ColorBgr");
|
||||
///
|
||||
inline std::ostream& operator<<(std::ostream& os, const ColorBgr& color)
|
||||
{
|
||||
os << "{" << unsigned(color.red) << "," << unsigned(color.green) << "," << unsigned(color.blue) << "}";
|
||||
os << "{"
|
||||
<< color.red << ","
|
||||
<< color.green << ","
|
||||
<< color.blue
|
||||
<< "}";
|
||||
|
||||
return os;
|
||||
}
|
||||
|
||||
/// Compare operator to check if a color is 'equal' to another color
|
||||
inline bool operator==(const ColorBgr & lhs, const ColorBgr & rhs)
|
||||
{
|
||||
return (lhs.red == rhs.red) &&
|
||||
(lhs.green == rhs.green) &&
|
||||
(lhs.blue == rhs.blue);
|
||||
}
|
||||
|
||||
/// Compare operator to check if a color is 'smaller' than another color
|
||||
inline bool operator<(const ColorBgr & lhs, const ColorBgr & rhs)
|
||||
{
|
||||
return (lhs.red < rhs.red) && (lhs.green < rhs.green) && (lhs.blue < rhs.blue);
|
||||
return (lhs.red < rhs.red) &&
|
||||
(lhs.green < rhs.green) &&
|
||||
(lhs.blue < rhs.blue);
|
||||
}
|
||||
|
||||
/// Compare operator to check if a color is 'smaller' than or 'equal' to another color
|
||||
inline bool operator<=(const ColorBgr & lhs, const ColorBgr & rhs)
|
||||
{
|
||||
return (lhs.red <= rhs.red) && (lhs.green <= rhs.green) && (lhs.blue <= rhs.blue);
|
||||
return lhs < rhs || lhs == rhs;
|
||||
}
|
||||
|
@@ -20,17 +20,17 @@ struct ColorRgb
|
||||
uint8_t blue;
|
||||
|
||||
/// 'Black' RgbColor (0, 0, 0)
|
||||
static ColorRgb BLACK;
|
||||
static const ColorRgb BLACK;
|
||||
/// 'Red' RgbColor (255, 0, 0)
|
||||
static ColorRgb RED;
|
||||
static const ColorRgb RED;
|
||||
/// 'Green' RgbColor (0, 255, 0)
|
||||
static ColorRgb GREEN;
|
||||
static const ColorRgb GREEN;
|
||||
/// 'Blue' RgbColor (0, 0, 255)
|
||||
static ColorRgb BLUE;
|
||||
static const ColorRgb BLUE;
|
||||
/// 'Yellow' RgbColor (255, 255, 0)
|
||||
static ColorRgb YELLOW;
|
||||
static const ColorRgb YELLOW;
|
||||
/// 'White' RgbColor (255, 255, 255)
|
||||
static ColorRgb WHITE;
|
||||
static const ColorRgb WHITE;
|
||||
};
|
||||
|
||||
/// Assert to ensure that the size of the structure is 'only' 3 bytes
|
||||
@@ -45,7 +45,12 @@ static_assert(sizeof(ColorRgb) == 3, "Incorrect size of ColorRgb");
|
||||
///
|
||||
inline std::ostream& operator<<(std::ostream& os, const ColorRgb& color)
|
||||
{
|
||||
os << "{" << unsigned(color.red) << "," << unsigned(color.green) << "," << unsigned(color.blue) << "}";
|
||||
os << "{"
|
||||
<< color.red << ","
|
||||
<< color.green << ","
|
||||
<< color.blue
|
||||
<< "}";
|
||||
|
||||
return os;
|
||||
}
|
||||
|
||||
@@ -58,30 +63,51 @@ inline std::ostream& operator<<(std::ostream& os, const ColorRgb& color)
|
||||
///
|
||||
inline QTextStream& operator<<(QTextStream &os, const ColorRgb& color)
|
||||
{
|
||||
os << "{" << unsigned(color.red) << "," << unsigned(color.green) << "," << unsigned(color.blue) << "}";
|
||||
os << "{"
|
||||
<< color.red << ","
|
||||
<< color.green << ","
|
||||
<< color.blue
|
||||
<< "}";
|
||||
|
||||
return os;
|
||||
}
|
||||
|
||||
/// Compare operator to check if a color is 'equal' to another color
|
||||
inline bool operator==(const ColorRgb & lhs, const ColorRgb & rhs)
|
||||
{
|
||||
return lhs.red == rhs.red &&
|
||||
lhs.green == rhs.green &&
|
||||
lhs.blue == rhs.blue;
|
||||
}
|
||||
|
||||
/// Compare operator to check if a color is 'smaller' than another color
|
||||
inline bool operator<(const ColorRgb & lhs, const ColorRgb & rhs)
|
||||
{
|
||||
return (lhs.red < rhs.red) && (lhs.green < rhs.green) && (lhs.blue < rhs.blue);
|
||||
return lhs.red < rhs.red &&
|
||||
lhs.green < rhs.green &&
|
||||
lhs.blue < rhs.blue;
|
||||
}
|
||||
|
||||
/// Compare operator to check if a color is 'not equal' to another color
|
||||
inline bool operator!=(const ColorRgb & lhs, const ColorRgb & rhs)
|
||||
{
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
/// Compare operator to check if a color is 'smaller' than or 'equal' to another color
|
||||
inline bool operator<=(const ColorRgb & lhs, const ColorRgb & rhs)
|
||||
{
|
||||
return (lhs.red <= rhs.red) && (lhs.green <= rhs.green) && (lhs.blue <= rhs.blue);
|
||||
return lhs < rhs || lhs == rhs;
|
||||
}
|
||||
|
||||
/// Compare operator to check if a color is 'greater' to another color
|
||||
inline bool operator>(const ColorRgb & lhs, const ColorRgb & rhs)
|
||||
{
|
||||
return (lhs.red > rhs.red) && (lhs.green > rhs.green) && (lhs.blue > rhs.blue);
|
||||
return !(lhs < rhs) && lhs != rhs;
|
||||
}
|
||||
|
||||
/// Compare operator to check if a color is 'greater' than or 'equal' to another color
|
||||
inline bool operator>=(const ColorRgb & lhs, const ColorRgb & rhs)
|
||||
{
|
||||
return (lhs.red >= rhs.red) && (lhs.green >= rhs.green) && (lhs.blue >= rhs.blue);
|
||||
return lhs > rhs || lhs == rhs;
|
||||
}
|
||||
|
@@ -6,7 +6,6 @@
|
||||
|
||||
struct ColorRgba
|
||||
{
|
||||
|
||||
/// The red color channel
|
||||
uint8_t red;
|
||||
/// The green color channel
|
||||
@@ -18,20 +17,19 @@ struct ColorRgba
|
||||
uint8_t alpha;
|
||||
|
||||
/// 'Black' RgbColor (0, 0, 0, 255)
|
||||
static ColorRgba BLACK;
|
||||
static const ColorRgba BLACK;
|
||||
/// 'Red' RgbColor (255, 0, 0, 255)
|
||||
static ColorRgba RED;
|
||||
static const ColorRgba RED;
|
||||
/// 'Green' RgbColor (0, 255, 0, 255)
|
||||
static ColorRgba GREEN;
|
||||
static const ColorRgba GREEN;
|
||||
/// 'Blue' RgbColor (0, 0, 255, 255)
|
||||
static ColorRgba BLUE;
|
||||
static const ColorRgba BLUE;
|
||||
/// 'Yellow' RgbColor (255, 255, 0, 255)
|
||||
static ColorRgba YELLOW;
|
||||
static const ColorRgba YELLOW;
|
||||
/// 'White' RgbColor (255, 255, 255, 255
|
||||
static ColorRgba WHITE;
|
||||
static const ColorRgba WHITE;
|
||||
};
|
||||
|
||||
|
||||
/// Assert to ensure that the size of the structure is 'only' 3 bytes
|
||||
static_assert(sizeof(ColorRgba) == 4, "Incorrect size of ColorARGB");
|
||||
|
||||
@@ -44,6 +42,12 @@ static_assert(sizeof(ColorRgba) == 4, "Incorrect size of ColorARGB");
|
||||
///
|
||||
inline std::ostream& operator<<(std::ostream& os, const ColorRgba& color)
|
||||
{
|
||||
os << "{" << unsigned(color.alpha) << "," << unsigned(color.red) << "," << unsigned(color.green) << "," << unsigned(color.blue) << "}";
|
||||
os << "{"
|
||||
<< color.alpha << ","
|
||||
<< color.red << ","
|
||||
<< color.green << ","
|
||||
<< color.blue
|
||||
<< "}";
|
||||
|
||||
return os;
|
||||
}
|
||||
|
@@ -20,17 +20,17 @@ struct ColorRgbw
|
||||
uint8_t white;
|
||||
|
||||
/// 'Black' RgbColor (0, 0, 0, 0)
|
||||
static ColorRgbw BLACK;
|
||||
static const ColorRgbw BLACK;
|
||||
/// 'Red' RgbColor (255, 0, 0, 0)
|
||||
static ColorRgbw RED;
|
||||
static const ColorRgbw RED;
|
||||
/// 'Green' RgbColor (0, 255, 0, 0)
|
||||
static ColorRgbw GREEN;
|
||||
static const ColorRgbw GREEN;
|
||||
/// 'Blue' RgbColor (0, 0, 255, 0)
|
||||
static ColorRgbw BLUE;
|
||||
static const ColorRgbw BLUE;
|
||||
/// 'Yellow' RgbColor (255, 255, 0, 0)
|
||||
static ColorRgbw YELLOW;
|
||||
static const ColorRgbw YELLOW;
|
||||
/// 'White' RgbColor (0, 0, 0, 255)
|
||||
static ColorRgbw WHITE;
|
||||
static const ColorRgbw WHITE;
|
||||
};
|
||||
|
||||
/// Assert to ensure that the size of the structure is 'only' 4 bytes
|
||||
@@ -45,19 +45,36 @@ static_assert(sizeof(ColorRgbw) == 4, "Incorrect size of ColorRgbw");
|
||||
///
|
||||
inline std::ostream& operator<<(std::ostream& os, const ColorRgbw& color)
|
||||
{
|
||||
os << "{" << unsigned(color.red) << "," << unsigned(color.green) << "," << unsigned(color.blue) << "," << unsigned(color.white) << "}";
|
||||
os << "{"
|
||||
<< color.red << ","
|
||||
<< color.green << ","
|
||||
<< color.blue << ","
|
||||
<< color.white <<
|
||||
"}";
|
||||
|
||||
return os;
|
||||
}
|
||||
|
||||
/// Compare operator to check if a color is 'equal' than another color
|
||||
inline bool operator==(const ColorRgbw & lhs, const ColorRgbw & rhs)
|
||||
{
|
||||
return lhs.red == rhs.red &&
|
||||
lhs.green == rhs.green &&
|
||||
lhs.blue == rhs.blue &&
|
||||
lhs.white == rhs.white;
|
||||
}
|
||||
|
||||
/// Compare operator to check if a color is 'smaller' than another color
|
||||
inline bool operator<(const ColorRgbw & lhs, const ColorRgbw & rhs)
|
||||
{
|
||||
return (lhs.red < rhs.red) && (lhs.green < rhs.green) && (lhs.blue < rhs.blue) && (lhs.white < rhs.white);
|
||||
return lhs.red < rhs.red &&
|
||||
lhs.green < rhs.green &&
|
||||
lhs.blue < rhs.blue &&
|
||||
lhs.white < rhs.white;
|
||||
}
|
||||
|
||||
/// Compare operator to check if a color is 'smaller' than or 'equal' to another color
|
||||
inline bool operator<=(const ColorRgbw & lhs, const ColorRgbw & rhs)
|
||||
{
|
||||
return (lhs.red <= rhs.red) && (lhs.green <= rhs.green) && (lhs.blue <= rhs.blue) && (lhs.white < rhs.white);
|
||||
return lhs < rhs || lhs == rhs;
|
||||
}
|
||||
|
@@ -65,4 +65,15 @@ public:
|
||||
/// number and scaled between 0 and 360
|
||||
///
|
||||
static void hsv2rgb(uint16_t hue, uint8_t saturation, uint8_t value, uint8_t & red, uint8_t & green, uint8_t & blue);
|
||||
|
||||
///
|
||||
/// Translates a YUV (luminance, chrominance, chrominance) color to an RGB (red, green, blue) color
|
||||
///
|
||||
/// @param[in] y The luminance YUV-component
|
||||
/// @param[in] u The chrominance YUV-component
|
||||
/// @param[in] v The chrominance YUV-component
|
||||
/// @param[out] red The red RGB-component
|
||||
/// @param[out] green The green RGB-component
|
||||
/// @param[out] blue The blue RGB-component
|
||||
static void yuv2rgb(uint8_t y, uint8_t u, uint8_t v, uint8_t & r, uint8_t & g, uint8_t & b);
|
||||
};
|
||||
|
@@ -67,22 +67,22 @@ inline const char* componentToIdString(Components c)
|
||||
}
|
||||
}
|
||||
|
||||
inline Components stringToComponent(QString component)
|
||||
inline Components stringToComponent(const QString& component)
|
||||
{
|
||||
component = component.toUpper();
|
||||
if (component == "ALL") return COMP_ALL;
|
||||
if (component == "SMOOTHING") return COMP_SMOOTHING;
|
||||
if (component == "BLACKBORDER") return COMP_BLACKBORDER;
|
||||
if (component == "FORWARDER") return COMP_FORWARDER;
|
||||
if (component == "BOBLIGHTSERVER")return COMP_BOBLIGHTSERVER;
|
||||
if (component == "GRABBER") return COMP_GRABBER;
|
||||
if (component == "V4L") return COMP_V4L;
|
||||
if (component == "COLOR") return COMP_COLOR;
|
||||
if (component == "EFFECT") return COMP_EFFECT;
|
||||
if (component == "IMAGE") return COMP_IMAGE;
|
||||
if (component == "LEDDEVICE") return COMP_LEDDEVICE;
|
||||
if (component == "FLATBUFSERVER") return COMP_FLATBUFSERVER;
|
||||
if (component == "PROTOSERVER") return COMP_PROTOSERVER;
|
||||
const QString cmp = component.toUpper();
|
||||
if (cmp == "ALL") return COMP_ALL;
|
||||
if (cmp == "SMOOTHING") return COMP_SMOOTHING;
|
||||
if (cmp == "BLACKBORDER") return COMP_BLACKBORDER;
|
||||
if (cmp == "FORWARDER") return COMP_FORWARDER;
|
||||
if (cmp == "BOBLIGHTSERVER")return COMP_BOBLIGHTSERVER;
|
||||
if (cmp == "GRABBER") return COMP_GRABBER;
|
||||
if (cmp == "V4L") return COMP_V4L;
|
||||
if (cmp == "COLOR") return COMP_COLOR;
|
||||
if (cmp == "EFFECT") return COMP_EFFECT;
|
||||
if (cmp == "IMAGE") return COMP_IMAGE;
|
||||
if (cmp == "LEDDEVICE") return COMP_LEDDEVICE;
|
||||
if (cmp == "FLATBUFSERVER") return COMP_FLATBUFSERVER;
|
||||
if (cmp == "PROTOSERVER") return COMP_PROTOSERVER;
|
||||
return COMP_INVALID;
|
||||
}
|
||||
|
||||
|
@@ -10,8 +10,8 @@
|
||||
|
||||
namespace FileUtils {
|
||||
|
||||
QString getBaseName(QString sourceFile);
|
||||
QString getDirName(QString sourceFile);
|
||||
QString getBaseName(const QString& sourceFile);
|
||||
QString getDirName(const QString& sourceFile);
|
||||
|
||||
///
|
||||
/// @brief remove directory recursive given by path
|
||||
|
@@ -20,6 +20,7 @@ public:
|
||||
static GlobalSignals instance;
|
||||
return & instance;
|
||||
}
|
||||
|
||||
private:
|
||||
GlobalSignals() = default;
|
||||
|
||||
@@ -54,7 +55,7 @@ signals:
|
||||
/// @param[in] owner Specific owner string, might be empty
|
||||
/// @param[in] smooth_cfg The smooth id to use
|
||||
///
|
||||
void registerGlobalInput(const int priority, const hyperion::Components& component, const QString& origin = "External", const QString& owner = "", unsigned smooth_cfg = 0);
|
||||
void registerGlobalInput(int priority, hyperion::Components component, const QString& origin = "External", const QString& owner = "", unsigned smooth_cfg = 0);
|
||||
|
||||
///
|
||||
/// @brief PIPE the clear command for the global priority channel over HyperionDaemon to Hyperion class
|
||||
@@ -70,7 +71,7 @@ signals:
|
||||
/// @param[in] timeout_ms The timeout in milliseconds
|
||||
/// @param clearEffect Should be true when NOT called from an effect
|
||||
///
|
||||
void setGlobalImage(const int priority, const Image<ColorRgb>& image, const int timeout_ms, const bool& clearEffect = true);
|
||||
void setGlobalImage(int priority, const Image<ColorRgb>& image, int timeout_ms, bool clearEffect = true);
|
||||
|
||||
///
|
||||
/// @brief PIPE external color message over HyperionDaemon to Hyperion class
|
||||
@@ -80,7 +81,7 @@ signals:
|
||||
/// @param[in] origin The setter
|
||||
/// @param clearEffect Should be true when NOT called from an effect
|
||||
///
|
||||
void setGlobalColor(const int priority, const std::vector<ColorRgb> &ledColor, const int timeout_ms, const QString& origin = "External" ,bool clearEffects = true);
|
||||
void setGlobalColor(int priority, const std::vector<ColorRgb> &ledColor, int timeout_ms, const QString& origin = "External" ,bool clearEffects = true);
|
||||
|
||||
///////////////////////////////////////
|
||||
//////////// FROM HYPERION ////////////
|
||||
@@ -98,6 +99,6 @@ signals:
|
||||
/// @param hyperionInd The Hyperion instance index as identifier
|
||||
/// @param listen True when listening, else false
|
||||
///
|
||||
void requestSource(const hyperion::Components& component, const int hyperionInd, const bool listen);
|
||||
void requestSource(hyperion::Components component, int hyperionInd, bool listen);
|
||||
|
||||
};
|
||||
|
@@ -15,7 +15,7 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
Image(const unsigned width, const unsigned height) :
|
||||
Image(unsigned width, unsigned height) :
|
||||
Image(width, height, Pixel_T())
|
||||
|
||||
{
|
||||
@@ -28,7 +28,7 @@ public:
|
||||
/// @param height The height of the image
|
||||
/// @param background The color of the image
|
||||
///
|
||||
Image(const unsigned width, const unsigned height, const Pixel_T background) :
|
||||
Image(unsigned width, unsigned height, const Pixel_T background) :
|
||||
_d_ptr(new ImageData<Pixel_T>(width, height, background))
|
||||
{
|
||||
}
|
||||
@@ -93,12 +93,12 @@ public:
|
||||
return _d_ptr->height();
|
||||
}
|
||||
|
||||
uint8_t red(const unsigned pixel) const
|
||||
uint8_t red(unsigned pixel) const
|
||||
{
|
||||
return _d_ptr->red(pixel);
|
||||
}
|
||||
|
||||
uint8_t green(const unsigned pixel) const
|
||||
uint8_t green(unsigned pixel) const
|
||||
{
|
||||
return _d_ptr->green(pixel);
|
||||
}
|
||||
@@ -111,7 +111,7 @@ public:
|
||||
///
|
||||
/// @return const reference to specified pixel
|
||||
///
|
||||
uint8_t blue(const unsigned pixel) const
|
||||
uint8_t blue(unsigned pixel) const
|
||||
{
|
||||
return _d_ptr->blue(pixel);
|
||||
}
|
||||
@@ -121,7 +121,7 @@ public:
|
||||
///
|
||||
/// @param x The x index
|
||||
/// @param y The y index
|
||||
const Pixel_T& operator()(const unsigned x, const unsigned y) const
|
||||
const Pixel_T& operator()(unsigned x, unsigned y) const
|
||||
{
|
||||
return _d_ptr->operator()(x, y);
|
||||
}
|
||||
@@ -129,7 +129,7 @@ public:
|
||||
///
|
||||
/// @return reference to specified pixel
|
||||
///
|
||||
Pixel_T& operator()(const unsigned x, const unsigned y)
|
||||
Pixel_T& operator()(unsigned x, unsigned y)
|
||||
{
|
||||
return _d_ptr->operator()(x, y);
|
||||
}
|
||||
@@ -137,7 +137,7 @@ public:
|
||||
/// Resize the image
|
||||
/// @param width The width of the image
|
||||
/// @param height The height of the image
|
||||
void resize(const unsigned width, const unsigned height)
|
||||
void resize(unsigned width, unsigned height)
|
||||
{
|
||||
_d_ptr->resize(width, height);
|
||||
}
|
||||
@@ -198,7 +198,7 @@ private:
|
||||
///
|
||||
/// @return The index into the underlying data-vector
|
||||
///
|
||||
inline unsigned toIndex(const unsigned x, const unsigned y) const
|
||||
inline unsigned toIndex(unsigned x, unsigned y) const
|
||||
{
|
||||
return _d_ptr->toIndex(x, y);
|
||||
}
|
||||
|
@@ -24,7 +24,7 @@ class ImageData : public QSharedData
|
||||
public:
|
||||
typedef Pixel_T pixel_type;
|
||||
|
||||
ImageData(const unsigned width, const unsigned height, const Pixel_T background) :
|
||||
ImageData(unsigned width, unsigned height, const Pixel_T background) :
|
||||
_width(width),
|
||||
_height(height),
|
||||
_pixels(new Pixel_T[width * height + 1])
|
||||
@@ -84,32 +84,32 @@ public:
|
||||
return _height;
|
||||
}
|
||||
|
||||
uint8_t red(const unsigned pixel) const
|
||||
uint8_t red(unsigned pixel) const
|
||||
{
|
||||
return (_pixels + pixel)->red;
|
||||
}
|
||||
|
||||
uint8_t green(const unsigned pixel) const
|
||||
uint8_t green(unsigned pixel) const
|
||||
{
|
||||
return (_pixels + pixel)->green;
|
||||
}
|
||||
|
||||
uint8_t blue(const unsigned pixel) const
|
||||
uint8_t blue(unsigned pixel) const
|
||||
{
|
||||
return (_pixels + pixel)->blue;
|
||||
}
|
||||
|
||||
const Pixel_T& operator()(const unsigned x, const unsigned y) const
|
||||
const Pixel_T& operator()(unsigned x, unsigned y) const
|
||||
{
|
||||
return _pixels[toIndex(x,y)];
|
||||
}
|
||||
|
||||
Pixel_T& operator()(const unsigned x, const unsigned y)
|
||||
Pixel_T& operator()(unsigned x, unsigned y)
|
||||
{
|
||||
return _pixels[toIndex(x,y)];
|
||||
}
|
||||
|
||||
void resize(const unsigned width, const unsigned height)
|
||||
void resize(unsigned width, unsigned height)
|
||||
{
|
||||
if (width == _width && height == _height)
|
||||
return;
|
||||
@@ -167,7 +167,7 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
inline unsigned toIndex(const unsigned x, const unsigned y) const
|
||||
inline unsigned toIndex(unsigned x, unsigned y) const
|
||||
{
|
||||
return y * _width + x;
|
||||
}
|
||||
|
@@ -12,22 +12,11 @@ public:
|
||||
~ImageResampler();
|
||||
|
||||
void setHorizontalPixelDecimation(int decimator);
|
||||
|
||||
void setVerticalPixelDecimation(int decimator);
|
||||
|
||||
void setCropping(int cropLeft,
|
||||
int cropRight,
|
||||
int cropTop,
|
||||
int cropBottom);
|
||||
|
||||
void setCropping(int cropLeft, int cropRight, int cropTop, int cropBottom);
|
||||
void setVideoMode(VideoMode mode);
|
||||
|
||||
void processImage(const uint8_t * data, int width, int height, int lineLength, PixelFormat pixelFormat, Image<ColorRgb> & outputImage) const;
|
||||
|
||||
private:
|
||||
static inline uint8_t clamp(int x);
|
||||
static void yuv2rgb(uint8_t y, uint8_t u, uint8_t v, uint8_t & r, uint8_t & g, uint8_t & b);
|
||||
|
||||
private:
|
||||
int _horizontalDecimation;
|
||||
int _verticalDecimation;
|
||||
@@ -37,3 +26,4 @@ private:
|
||||
int _cropBottom;
|
||||
VideoMode _videoMode;
|
||||
};
|
||||
|
||||
|
@@ -5,7 +5,7 @@
|
||||
#include <QJsonObject>
|
||||
#include <utils/Logger.h>
|
||||
|
||||
namespace JsonUtils{
|
||||
namespace JsonUtils {
|
||||
///
|
||||
/// @brief read a json file and get the parsed result on success
|
||||
/// @param[in] path The file path to read
|
||||
|
@@ -67,7 +67,7 @@ public:
|
||||
|
||||
void Message(LogLevel level, const char* sourceFile, const char* func, unsigned int line, const char* fmt, ...);
|
||||
void setMinLevel(LogLevel level) { _minLevel = static_cast<int>(level); }
|
||||
LogLevel getMinLevel() { return static_cast<LogLevel>(int(_minLevel)); }
|
||||
LogLevel getMinLevel() const { return static_cast<LogLevel>(int(_minLevel)); }
|
||||
QString getName() const { return _name; }
|
||||
QString getAppName() const { return _appname; }
|
||||
|
||||
@@ -76,7 +76,7 @@ signals:
|
||||
|
||||
protected:
|
||||
Logger(const QString & name="", LogLevel minLevel = INFO);
|
||||
~Logger();
|
||||
~Logger() override;
|
||||
|
||||
private:
|
||||
void write(const Logger::T_LOG_MESSAGE & message);
|
||||
|
@@ -42,7 +42,7 @@ private slots:
|
||||
/// @param type settingyType from enum
|
||||
/// @param config configuration object
|
||||
///
|
||||
void handleSettingsUpdate(const settings::type& type, const QJsonDocument& config);
|
||||
void handleSettingsUpdate(settings::type type, const QJsonDocument& config);
|
||||
|
||||
private:
|
||||
Logger* _log;
|
||||
|
@@ -18,37 +18,37 @@ enum class PixelFormat {
|
||||
NO_CHANGE
|
||||
};
|
||||
|
||||
inline PixelFormat parsePixelFormat(QString pixelFormat)
|
||||
inline PixelFormat parsePixelFormat(const QString& pixelFormat)
|
||||
{
|
||||
// convert to lower case
|
||||
pixelFormat = pixelFormat.toLower();
|
||||
QString format = pixelFormat.toLower();
|
||||
|
||||
if (pixelFormat.compare("yuyv") )
|
||||
if (format.compare("yuyv") )
|
||||
{
|
||||
return PixelFormat::YUYV;
|
||||
}
|
||||
else if (pixelFormat.compare("uyvy") )
|
||||
else if (format.compare("uyvy") )
|
||||
{
|
||||
return PixelFormat::UYVY;
|
||||
}
|
||||
else if (pixelFormat.compare("bgr16") )
|
||||
else if (format.compare("bgr16") )
|
||||
{
|
||||
return PixelFormat::BGR16;
|
||||
}
|
||||
else if (pixelFormat.compare("bgr24") )
|
||||
else if (format.compare("bgr24") )
|
||||
{
|
||||
return PixelFormat::BGR24;
|
||||
}
|
||||
else if (pixelFormat.compare("rgb32") )
|
||||
else if (format.compare("rgb32") )
|
||||
{
|
||||
return PixelFormat::RGB32;
|
||||
}
|
||||
else if (pixelFormat.compare("bgr32") )
|
||||
else if (format.compare("bgr32") )
|
||||
{
|
||||
return PixelFormat::BGR32;
|
||||
}
|
||||
#ifdef HAVE_JPEG_DECODER
|
||||
else if (pixelFormat.compare("mjpeg") )
|
||||
else if (format.compare("mjpeg") )
|
||||
{
|
||||
return PixelFormat::MJPEG;
|
||||
}
|
||||
|
@@ -30,15 +30,14 @@ For more profiler function see the macros listed below
|
||||
#define PROFILER_TIMER_GET(stopWatchName) Profiler::TimerGetTime(stopWatchName, __FILE__, __FUNCTION__, __LINE__);
|
||||
#define PROFILER_TIMER_GET_IF(condition, stopWatchName) { if (condition) {Profiler::TimerGetTime(stopWatchName, __FILE__, __FUNCTION__, __LINE__);} }
|
||||
|
||||
|
||||
class Profiler
|
||||
{
|
||||
public:
|
||||
Profiler(const char* sourceFile, const char* func, unsigned int line);
|
||||
~Profiler();
|
||||
|
||||
static void TimerStart(const QString stopWatchName, const char* sourceFile, const char* func, unsigned int line);
|
||||
static void TimerGetTime(const QString stopWatchName, const char* sourceFile, const char* func, unsigned int line);
|
||||
static void TimerStart(const QString& stopWatchName, const char* sourceFile, const char* func, unsigned int line);
|
||||
static void TimerGetTime(const QString& stopWatchName, const char* sourceFile, const char* func, unsigned int line);
|
||||
|
||||
private:
|
||||
static void initLogger();
|
||||
|
@@ -14,7 +14,6 @@ namespace RGBW {
|
||||
WHITE_OFF
|
||||
};
|
||||
|
||||
WhiteAlgorithm stringToWhiteAlgorithm(QString str);
|
||||
void Rgb_to_Rgbw(ColorRgb input, ColorRgbw * output, const WhiteAlgorithm algorithm);
|
||||
|
||||
WhiteAlgorithm stringToWhiteAlgorithm(const QString& str);
|
||||
void Rgb_to_Rgbw(ColorRgb input, ColorRgbw * output, WhiteAlgorithm algorithm);
|
||||
}
|
||||
|
@@ -5,7 +5,6 @@
|
||||
|
||||
class SysInfo : public QObject
|
||||
{
|
||||
|
||||
public:
|
||||
struct HyperionSysInfo
|
||||
{
|
||||
|
@@ -12,16 +12,16 @@ enum class VideoMode
|
||||
VIDEO_3DTAB
|
||||
};
|
||||
|
||||
inline VideoMode parse3DMode(QString videoMode)
|
||||
inline VideoMode parse3DMode(const QString& videoMode)
|
||||
{
|
||||
// convert to upper case
|
||||
videoMode = videoMode.toUpper();
|
||||
const QString vm = videoMode.toUpper();
|
||||
|
||||
if (videoMode == "3DTAB")
|
||||
if (vm == "3DTAB")
|
||||
{
|
||||
return VideoMode::VIDEO_3DTAB;
|
||||
}
|
||||
else if (videoMode == "3DSBS")
|
||||
else if (vm == "3DSBS")
|
||||
{
|
||||
return VideoMode::VIDEO_3DSBS;
|
||||
}
|
||||
|
@@ -71,7 +71,7 @@ namespace hyperion {
|
||||
return RgbTransform(gammaR, gammaG, gammaB, backlightThreshold, backlightColored, brightness, brightnessComp);
|
||||
}
|
||||
|
||||
RgbChannelAdjustment createRgbChannelAdjustment(const QJsonObject& colorConfig, const QString& channelName, const int defaultR, const int defaultG, const int defaultB)
|
||||
RgbChannelAdjustment createRgbChannelAdjustment(const QJsonObject& colorConfig, const QString& channelName, int defaultR, int defaultG, int defaultB)
|
||||
{
|
||||
const QJsonArray& channelConfig = colorConfig[channelName].toArray();
|
||||
return RgbChannelAdjustment(
|
||||
@@ -101,7 +101,7 @@ namespace hyperion {
|
||||
return adjustment;
|
||||
}
|
||||
|
||||
MultiColorAdjustment * createLedColorsAdjustment(const unsigned ledCnt, const QJsonObject & colorConfig)
|
||||
MultiColorAdjustment * createLedColorsAdjustment(unsigned ledCnt, const QJsonObject & colorConfig)
|
||||
{
|
||||
// Create the result, the transforms are added to this
|
||||
MultiColorAdjustment * adjustment = new MultiColorAdjustment(ledCnt);
|
||||
|
@@ -57,7 +57,7 @@ public:
|
||||
///
|
||||
/// @return A list of error messages
|
||||
///
|
||||
const QStringList & getMessages() const;
|
||||
QStringList getMessages() const;
|
||||
|
||||
private:
|
||||
///
|
||||
|
@@ -19,14 +19,14 @@ public:
|
||||
{
|
||||
if (path.first() == "[root]")
|
||||
path.removeFirst();
|
||||
|
||||
|
||||
for (QStringList::iterator it = path.begin(); it != path.end(); ++it)
|
||||
{
|
||||
QString current = *it;
|
||||
if (current.left(1) == ".")
|
||||
*it = current.mid(1, current.size()-1);
|
||||
}
|
||||
|
||||
|
||||
if (!value.isEmpty())
|
||||
modifyValue(value, result, path, newValue, propertyName);
|
||||
else if (newValue != QJsonValue::Null && !propertyName.isEmpty())
|
||||
@@ -78,17 +78,17 @@ private:
|
||||
{
|
||||
QJsonObject result;
|
||||
QJsonObject obj = schema.toObject();
|
||||
|
||||
|
||||
if (obj.find("type") != obj.end() && obj.find("type").value().isString())
|
||||
{
|
||||
QJsonValue ret = QJsonValue::Null;
|
||||
|
||||
|
||||
if (obj.find("type").value().toString() == "object" && ( obj.find("required").value().toBool() || ignoreRequired ) )
|
||||
ret = createValue(obj["properties"], ignoreRequired);
|
||||
else if (obj.find("type").value().toString() == "array" && ( obj.find("required").value().toBool() || ignoreRequired ) )
|
||||
{
|
||||
QJsonArray array;
|
||||
|
||||
|
||||
if (obj.find("default") != obj.end())
|
||||
ret = obj.find("default").value();
|
||||
else
|
||||
@@ -103,7 +103,7 @@ private:
|
||||
else if ( obj.find("required").value().toBool() || ignoreRequired )
|
||||
if (obj.find("default") != obj.end())
|
||||
ret = obj.find("default").value();
|
||||
|
||||
|
||||
return ret;
|
||||
}
|
||||
else
|
||||
@@ -133,7 +133,7 @@ private:
|
||||
{
|
||||
QJsonValue retEmpty;
|
||||
retEmpty = createValue(attributeValue.toObject()["items"], ignoreRequired);
|
||||
|
||||
|
||||
if (!retEmpty.toObject().isEmpty())
|
||||
array.append(retEmpty);
|
||||
result[attribute] = array;
|
||||
@@ -234,7 +234,7 @@ private:
|
||||
subValue = newValue;
|
||||
else
|
||||
continue;
|
||||
|
||||
|
||||
if (!subValue.toObject().isEmpty())
|
||||
json_array.append(subValue);
|
||||
else if (newValue != QJsonValue::Null && arrayLevel != -1)
|
||||
|
@@ -37,7 +37,7 @@ namespace settings {
|
||||
/// @param type The settings::type from enum
|
||||
/// @return The settings type as string
|
||||
///
|
||||
inline QString typeToString(const type& type)
|
||||
inline QString typeToString(type type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
|
Reference in New Issue
Block a user