@@ -17,6 +17,11 @@
#include "md_parser.hpp"
using namespace RPiController;
+using namespace libcamera;
+
+namespace libcamera {
+LOG_DECLARE_CATEGORY(IPARPI)
+}
static std::map<std::string, CamHelperCreateFunc> cam_helpers;
@@ -57,6 +62,19 @@ double CamHelper::Exposure(uint32_t exposure_lines) const
return exposure_lines * mode_.line_length / 1000.0;
}
+uint32_t CamHelper::ColourGainCode([[maybe_unused]] double gain) const
+{
+ /*
+ * This is only used when the sensor has RED/BLUE_BALANCE controls.
+ * Most do not, so supplying a default is helpful - though no one
+ * should be calling it.
+ */
+ LOG(IPARPI, Fatal)
+ << "Sensor is requesting RED/BLUE gains so a proper "
+ << "implementation of ColourGainCode must be provided";
+ return 0;
+}
+
uint32_t CamHelper::GetVBlanking(double &exposure, double minFrameDuration,
double maxFrameDuration) const
{
@@ -26,7 +26,8 @@ namespace RPiController {
//
// The ability to convert between number of lines of exposure and actual
// exposure time, and to convert between the sensor's gain codes and actual
-// gains.
+// gains. Some sensors like to be told the colour (red and blue) gains, so
+// there's a method for converting these to gain codes too.
//
// A method to return the number of frames of delay between updating exposure,
// analogue gain and vblanking, and for the changes to take effect. For many
@@ -72,6 +73,7 @@ public:
double maxFrameDuration) const;
virtual uint32_t GainCode(double gain) const = 0;
virtual double Gain(uint32_t gain_code) const = 0;
+ virtual uint32_t ColourGainCode(double gain) const;
virtual void GetDelays(int &exposure_delay, int &gain_delay,
int &vblank_delay) const;
virtual bool SensorEmbeddedDataPresent() const;