mirror of
				https://github.com/hyperion-project/hyperion.ng.git
				synced 2025-03-01 10:33:28 +00:00 
			
		
		
		
	color filter config additions (#142)
* add ability to disably specific color corrections update protobuf external move smoothing out of color section * update config * update schema * update schema
This commit is contained in:
		| @@ -28,18 +28,21 @@ | |||||||
| 	/// Color manipulation configuration used to tune the output colors to specific surroundings.  | 	/// Color manipulation configuration used to tune the output colors to specific surroundings.  | ||||||
| 	/// The configuration contains a list of color-transforms. Each transform contains the  | 	/// The configuration contains a list of color-transforms. Each transform contains the  | ||||||
| 	/// following fields: | 	/// following fields: | ||||||
|  | 	///  * 'channelAdjustment_enable' : true/false enables/disables this channelAdjustment section | ||||||
| 	///  * 'channelAdjustment' | 	///  * 'channelAdjustment' | ||||||
| 	///  * 'id'     : The unique identifier of the channel adjustments (eg 'device_1') | 	///  * 'id'     : The unique identifier of the channel adjustments (eg 'device_1') | ||||||
| 	///  * 'leds'   : The indices (or index ranges) of the leds to which this channel adjustment applies | 	///  * 'leds'   : The indices (or index ranges) of the leds to which this channel adjustment applies | ||||||
| 	///             (eg '0-5, 9, 11, 12-17'). The indices are zero based. | 	///             (eg '0-5, 9, 11, 12-17'). The indices are zero based. | ||||||
| 	///  * 'pureRed'/'pureGreen'/'pureBlue' : The manipulation in the Red-Green-Blue color domain with the  | 	///  * 'pureRed'/'pureGreen'/'pureBlue' : The manipulation in the Red-Green-Blue color domain with the  | ||||||
| 	///                           following tuning parameters for each channel: | 	///                           following tuning parameters for each channel: | ||||||
|  | 	///  * 'temperature_enable' : true/false enables/disables this temperature section | ||||||
| 	///  * 'temperature' | 	///  * 'temperature' | ||||||
| 	///  * 'id'     : The unique identifier of the temperature (eg 'device_1') | 	///  * 'id'     : The unique identifier of the temperature (eg 'device_1') | ||||||
| 	///  * 'leds'   : The indices (or index ranges) of the leds to which this temperature applies | 	///  * 'leds'   : The indices (or index ranges) of the leds to which this temperature applies | ||||||
| 	///             (eg '0-5, 9, 11, 12-17'). The indices are zero based. | 	///             (eg '0-5, 9, 11, 12-17'). The indices are zero based. | ||||||
| 	///  * 'red'/'green'/'blue' : The temperature manipulation in the Red-Green-Blue color domain with the  | 	///  * 'red'/'green'/'blue' : The temperature manipulation in the Red-Green-Blue color domain with the  | ||||||
| 	///                           following tuning parameters for each channel: | 	///                           following tuning parameters for each channel: | ||||||
|  | 	///  * 'transform_enable' : true/false enables/disables this transform section | ||||||
| 	///  * 'transform' | 	///  * 'transform' | ||||||
| 	///  * 'id'   : The unique identifier of the color transformation (eg 'device_1') | 	///  * 'id'   : The unique identifier of the color transformation (eg 'device_1') | ||||||
| 	///  * 'leds' : The indices (or index ranges) of the leds to which this color transform applies | 	///  * 'leds' : The indices (or index ranges) of the leds to which this color transform applies | ||||||
| @@ -54,18 +57,9 @@ | |||||||
| 	///            - 'threshold'       The minimum required input value for the channel to be on  | 	///            - 'threshold'       The minimum required input value for the channel to be on  | ||||||
| 	///                                (else zero) | 	///                                (else zero) | ||||||
| 	///            - 'gamma'           The gamma-curve correction factor | 	///            - 'gamma'           The gamma-curve correction factor | ||||||
| 	/// |  | ||||||
| 	/// Next to the list with color transforms there is also a smoothing option. |  | ||||||
| 	///  * 'smoothing' : Smoothing of the colors in the time-domain with the following tuning  |  | ||||||
| 	///                  parameters: |  | ||||||
| 	///            - 'enable'          Enable or disable the smoothing (true/false) |  | ||||||
| 	///            - 'type'             The type of smoothing algorithm ('linear' or 'none') |  | ||||||
| 	///            - 'time_ms'          The time constant for smoothing algorithm in milliseconds |  | ||||||
| 	///            - 'updateFrequency'  The update frequency of the leds in Hz |  | ||||||
| 	///            - 'updateDelay'      The delay of the output to leds (in periods of smoothing) |  | ||||||
| 	///            - 'continuousOutput' Flag for enabling continuous output to Leds regardless of new input or not |  | ||||||
| 	"color" : | 	"color" : | ||||||
| 	{ | 	{ | ||||||
|  | 		"channelAdjustment_enable" : true, | ||||||
| 		"channelAdjustment" : | 		"channelAdjustment" : | ||||||
| 		[ | 		[ | ||||||
| 			{ | 			{ | ||||||
| @@ -91,6 +85,7 @@ | |||||||
| 				} | 				} | ||||||
| 			} | 			} | ||||||
| 		], | 		], | ||||||
|  | 		"temperature_enable" : true, | ||||||
| 		"temperature" : | 		"temperature" : | ||||||
| 		[ | 		[ | ||||||
| 			{ | 			{ | ||||||
| @@ -104,6 +99,7 @@ | |||||||
| 				} | 				} | ||||||
| 			} | 			} | ||||||
| 		], | 		], | ||||||
|  | 		"transform_enable" : true, | ||||||
| 		"transform" : | 		"transform" : | ||||||
| 		[ | 		[ | ||||||
| 			{ | 			{ | ||||||
| @@ -131,17 +127,26 @@ | |||||||
| 					"gamma"     : 2.5000 | 					"gamma"     : 2.5000 | ||||||
| 				} | 				} | ||||||
| 			} | 			} | ||||||
| 		], | 		] | ||||||
|  | 	}, | ||||||
|  |  | ||||||
| 		"smoothing" : | 	/// smoothing | ||||||
| 		{ | 	///  * 'smoothing' : Smoothing of the colors in the time-domain with the following tuning  | ||||||
| 			"enable"           : true, | 	///                  parameters: | ||||||
| 			"type"             : "linear", | 	///            - 'enable'          Enable or disable the smoothing (true/false) | ||||||
| 			"time_ms"          : 200, | 	///            - 'type'             The type of smoothing algorithm ('linear' or 'none') | ||||||
| 			"updateFrequency"  : 25.0000, | 	///            - 'time_ms'          The time constant for smoothing algorithm in milliseconds | ||||||
| 			"updateDelay"      : 0, | 	///            - 'updateFrequency'  The update frequency of the leds in Hz | ||||||
| 			"continuousOutput" : true | 	///            - 'updateDelay'      The delay of the output to leds (in periods of smoothing) | ||||||
| 		} | 	///            - 'continuousOutput' Flag for enabling continuous output to Leds regardless of new input or not | ||||||
|  | 	"smoothing" : | ||||||
|  | 	{ | ||||||
|  | 		"enable"           : true, | ||||||
|  | 		"type"             : "linear", | ||||||
|  | 		"time_ms"          : 200, | ||||||
|  | 		"updateFrequency"  : 25.0000, | ||||||
|  | 		"updateDelay"      : 0, | ||||||
|  | 		"continuousOutput" : true | ||||||
| 	}, | 	}, | ||||||
|  |  | ||||||
| 	/// Configuration for the embedded V4L2 grabber | 	/// Configuration for the embedded V4L2 grabber | ||||||
|   | |||||||
| @@ -15,6 +15,7 @@ | |||||||
|  |  | ||||||
| 	"color" : | 	"color" : | ||||||
| 	{ | 	{ | ||||||
|  | 		"channelAdjustment_enable" : true, | ||||||
| 		"channelAdjustment" : | 		"channelAdjustment" : | ||||||
| 		[ | 		[ | ||||||
| 			{ | 			{ | ||||||
| @@ -40,6 +41,7 @@ | |||||||
| 				} | 				} | ||||||
| 			} | 			} | ||||||
| 		], | 		], | ||||||
|  | 		"temperature_enable" : true, | ||||||
| 		"temperature" : | 		"temperature" : | ||||||
| 		[ | 		[ | ||||||
| 			{ | 			{ | ||||||
| @@ -53,6 +55,7 @@ | |||||||
| 				} | 				} | ||||||
| 			} | 			} | ||||||
| 		], | 		], | ||||||
|  | 		"transform_enable" : true, | ||||||
| 		"transform" : | 		"transform" : | ||||||
| 		[ | 		[ | ||||||
| 			{ | 			{ | ||||||
| @@ -80,18 +83,19 @@ | |||||||
| 					"gamma"     : 2.5000 | 					"gamma"     : 2.5000 | ||||||
| 				} | 				} | ||||||
| 			} | 			} | ||||||
| 		], | 		] | ||||||
| 		"smoothing" : |  | ||||||
| 		{ |  | ||||||
| 			"enable"           : true, |  | ||||||
| 			"type"             : "linear", |  | ||||||
| 			"time_ms"          : 200, |  | ||||||
| 			"updateFrequency"  : 25.0000, |  | ||||||
| 			"updateDelay"      : 0, |  | ||||||
| 			"continuousOutput" : false |  | ||||||
| 		} |  | ||||||
| 	}, | 	}, | ||||||
| 	 |  | ||||||
|  | 	"smoothing" : | ||||||
|  | 	{ | ||||||
|  | 		"enable"           : true, | ||||||
|  | 		"type"             : "linear", | ||||||
|  | 		"time_ms"          : 200, | ||||||
|  | 		"updateFrequency"  : 25.0000, | ||||||
|  | 		"updateDelay"      : 0, | ||||||
|  | 		"continuousOutput" : true | ||||||
|  | 	}, | ||||||
|  |  | ||||||
| 	"grabber-v4l2" : | 	"grabber-v4l2" : | ||||||
| 	{ | 	{ | ||||||
| 		"enable"   : false, | 		"enable"   : false, | ||||||
|   | |||||||
							
								
								
									
										2
									
								
								dependencies/external/protobuf
									
									
									
									
										vendored
									
									
								
							
							
								
								
								
								
								
							
						
						
									
										2
									
								
								dependencies/external/protobuf
									
									
									
									
										vendored
									
									
								
							 Submodule dependencies/external/protobuf updated: ec01142317...efb59b79e5
									
								
							| @@ -313,16 +313,20 @@ private: | |||||||
|  |  | ||||||
| 	/// The timer for handling priority channel timeouts | 	/// The timer for handling priority channel timeouts | ||||||
| 	QTimer _timer; | 	QTimer _timer; | ||||||
| 	 |  | ||||||
| 	/// buffer for leds | 	/// buffer for leds | ||||||
| 	std::vector<ColorRgb> _ledBuffer; | 	std::vector<ColorRgb> _ledBuffer; | ||||||
| 	 |  | ||||||
| 	/// Logger instance | 	/// Logger instance | ||||||
| 	Logger * _log; | 	Logger * _log; | ||||||
| 	 |  | ||||||
| 	/// count of hardware leds | 	/// count of hardware leds | ||||||
| 	unsigned _hwLedCount; | 	unsigned _hwLedCount; | ||||||
| 	 |  | ||||||
| 	/// register of input sources and it's prio channel | 	/// register of input sources and it's prio channel | ||||||
| 	PriorityRegister _priorityRegister; | 	PriorityRegister _priorityRegister; | ||||||
|  |  | ||||||
|  | 	bool _transformEnabled; | ||||||
|  | 	bool _adjustmentEnabled; | ||||||
|  | 	bool _temperatureEnabled; | ||||||
| }; | }; | ||||||
|   | |||||||
| @@ -501,7 +501,7 @@ LedDevice * Hyperion::createColorSmoothing(const Json::Value & smoothingConfig, | |||||||
| 		            smoothingConfig.get("updateFrequency", 25.0).asDouble(), | 		            smoothingConfig.get("updateFrequency", 25.0).asDouble(), | ||||||
| 		            smoothingConfig.get("time_ms", 200).asInt(), | 		            smoothingConfig.get("time_ms", 200).asInt(), | ||||||
| 		            smoothingConfig.get("updateDelay", 0).asUInt(), | 		            smoothingConfig.get("updateDelay", 0).asUInt(), | ||||||
| 		            smoothingConfig.get("continuousOutput", false).asBool() | 		            smoothingConfig.get("continuousOutput", true).asBool() | ||||||
| 		            ); | 		            ); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| @@ -568,6 +568,15 @@ Hyperion::Hyperion(const Json::Value &jsonConfig, const std::string configFile) | |||||||
| 	{ | 	{ | ||||||
| 		throw std::runtime_error("Color transformation incorrectly set"); | 		throw std::runtime_error("Color transformation incorrectly set"); | ||||||
| 	} | 	} | ||||||
|  | 	// set color correction activity state | ||||||
|  | 	_transformEnabled   = jsonConfig["color"].get("transform_enable",true).asBool(); | ||||||
|  | 	_adjustmentEnabled  = jsonConfig["color"].get("channelAdjustment_enable",true).asBool(); | ||||||
|  | 	_temperatureEnabled = jsonConfig["color"].get("temperature_enable",true).asBool(); | ||||||
|  |  | ||||||
|  | 	InfoIf(!_transformEnabled  , _log, "Color transformation disabled" ); | ||||||
|  | 	InfoIf(!_adjustmentEnabled , _log, "Color adjustment disabled" ); | ||||||
|  | 	InfoIf(!_temperatureEnabled, _log, "Color temperature disabled" ); | ||||||
|  | 	 | ||||||
| 	// initialize the image processor factory | 	// initialize the image processor factory | ||||||
| 	ImageProcessorFactory::getInstance().init( | 	ImageProcessorFactory::getInstance().init( | ||||||
| 				_ledString, | 				_ledString, | ||||||
| @@ -575,7 +584,8 @@ Hyperion::Hyperion(const Json::Value &jsonConfig, const std::string configFile) | |||||||
| 	); | 	); | ||||||
|  |  | ||||||
| 	// initialize the color smoothing filter | 	// initialize the color smoothing filter | ||||||
| 	_device = createColorSmoothing(jsonConfig["color"]["smoothing"], _device); | 	_device = createColorSmoothing(jsonConfig["smoothing"], _device); | ||||||
|  |  | ||||||
|  |  | ||||||
| 	// setup the timer | 	// setup the timer | ||||||
| 	_timer.setSingleShot(true); | 	_timer.setSingleShot(true); | ||||||
| @@ -796,9 +806,9 @@ void Hyperion::update() | |||||||
|  |  | ||||||
| 	// Apply the correction and the transform to each led and color-channel | 	// Apply the correction and the transform to each led and color-channel | ||||||
| 	// Avoid applying correction, the same task is performed by adjustment | 	// Avoid applying correction, the same task is performed by adjustment | ||||||
| 	_raw2ledTransform->applyTransform(_ledBuffer); | 	if (_transformEnabled)   _raw2ledTransform->applyTransform(_ledBuffer); | ||||||
| 	_raw2ledAdjustment->applyAdjustment(_ledBuffer); | 	if (_adjustmentEnabled)  _raw2ledAdjustment->applyAdjustment(_ledBuffer); | ||||||
| 	_raw2ledTemperature->applyCorrection(_ledBuffer); | 	if (_temperatureEnabled) _raw2ledTemperature->applyCorrection(_ledBuffer); | ||||||
|  |  | ||||||
| 	const std::vector<Led>& leds = _ledString.leds(); | 	const std::vector<Led>& leds = _ledString.leds(); | ||||||
|  |  | ||||||
|   | |||||||
| @@ -58,6 +58,7 @@ | |||||||
| 			"required" : true, | 			"required" : true, | ||||||
| 			"properties": | 			"properties": | ||||||
| 			{ | 			{ | ||||||
|  | 				"channelAdjustment_enable" : "boolean", | ||||||
| 				"channelAdjustment" : | 				"channelAdjustment" : | ||||||
| 				{ | 				{ | ||||||
| 					"type" : "array", | 					"type" : "array", | ||||||
| @@ -172,6 +173,7 @@ | |||||||
| 						"additionalProperties" : false | 						"additionalProperties" : false | ||||||
| 					} | 					} | ||||||
| 				}, | 				}, | ||||||
|  | 				"temperature_enable" : "boolean", | ||||||
| 				"temperature" : | 				"temperature" : | ||||||
| 				{ | 				{ | ||||||
| 					"type" : "array", | 					"type" : "array", | ||||||
| @@ -226,6 +228,7 @@ | |||||||
| 						"additionalProperties" : false | 						"additionalProperties" : false | ||||||
| 					} | 					} | ||||||
| 				}, | 				}, | ||||||
|  | 				"transform_enable" : "boolean", | ||||||
| 				"transform" : | 				"transform" : | ||||||
| 				{ | 				{ | ||||||
| 					"type" : "array", | 					"type" : "array", | ||||||
| @@ -345,51 +348,51 @@ | |||||||
| 						}, | 						}, | ||||||
| 						"additionalProperties" : false | 						"additionalProperties" : false | ||||||
| 					} | 					} | ||||||
|  | 				} | ||||||
|  | 			}, | ||||||
|  | 			"additionalProperties" : false | ||||||
|  | 		}, | ||||||
|  | 		"smoothing": | ||||||
|  | 		{ | ||||||
|  | 			"type" : "object", | ||||||
|  | 			"required" : true, | ||||||
|  | 			"properties" : | ||||||
|  | 			{ | ||||||
|  | 				"enable" : | ||||||
|  | 				{ | ||||||
|  | 					"type" : "boolean", | ||||||
|  | 					"required" : true | ||||||
| 				}, | 				}, | ||||||
| 				"smoothing": | 				"type" : | ||||||
|                 		{ | 				{ | ||||||
| 					"type" : "object", | 					"enum" : ["none", "linear"], | ||||||
| 					"required" : true, | 					"required" : true | ||||||
| 					"properties" : | 				}, | ||||||
| 					{ | 				"time_ms" : | ||||||
| 						"enable" : | 				{ | ||||||
| 						{ | 					"type" : "integer", | ||||||
| 							"type" : "boolean", | 					"required" : false, | ||||||
| 							"required" : true | 					"minimum" : 25, | ||||||
| 						}, | 					"maximum": 600 | ||||||
| 						"type" : | 				}, | ||||||
| 						{ | 				"updateFrequency" : | ||||||
| 							"enum" : ["none", "linear"], | 				{ | ||||||
| 							"required" : true | 					"type" : "number", | ||||||
| 						}, | 					"required" : false, | ||||||
| 						"time_ms" : | 					"minimum" : 1.000, | ||||||
| 						{ | 					"maximum": 100.000 | ||||||
| 							"type" : "integer", | 				}, | ||||||
| 							"required" : false, | 				"updateDelay" : | ||||||
| 							"minimum" : 25, | 				{ | ||||||
| 							"maximum": 600 | 					"type" : "integer", | ||||||
| 						}, | 					"required" : false, | ||||||
| 						"updateFrequency" : | 					"minimum" : 0, | ||||||
| 						{ | 					"maximum": 2048 | ||||||
| 							"type" : "number", | 				}, | ||||||
| 							"required" : false, | 				"continuousOutput" : | ||||||
| 							"minimum" : 1.000, | 				{ | ||||||
| 							"maximum": 100.000 | 					"type" : "boolean", | ||||||
| 						}, | 					"required" : false | ||||||
| 						"updateDelay" : |  | ||||||
| 						{ |  | ||||||
| 							"type" : "integer", |  | ||||||
| 							"required" : false, |  | ||||||
| 							"minimum" : 0, |  | ||||||
| 							"maximum": 2048 |  | ||||||
| 						}, |  | ||||||
| 						"continuousOutput" : |  | ||||||
| 						{ |  | ||||||
| 							"type" : "boolean", |  | ||||||
| 							"required" : false |  | ||||||
| 						} |  | ||||||
| 					}, |  | ||||||
| 					"additionalProperties" : false |  | ||||||
| 				} | 				} | ||||||
| 			}, | 			}, | ||||||
| 			"additionalProperties" : false | 			"additionalProperties" : false | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user