@@ -14,7 +14,7 @@ using namespace RPiController;
class CamHelperImx290 : public CamHelper
{
public:
- CamHelperImx290();
+ CamHelperImx290(unsigned int frameIntegrationDiff = kFrameIntegrationDiff);
uint32_t gainCode(double gain) const override;
double gain(uint32_t gainCode) const override;
unsigned int hideFramesStartup() const override;
@@ -25,10 +25,10 @@ private:
* Smallest difference between the frame length and integration time,
* in units of lines.
*/
- static constexpr int frameIntegrationDiff = 2;
+ static constexpr unsigned int kFrameIntegrationDiff = 2;
};
-CamHelperImx290::CamHelperImx290()
+CamHelperImx290::CamHelperImx290(unsigned int frameIntegrationDiff)
: CamHelper({}, frameIntegrationDiff)
{
}
@@ -61,7 +61,18 @@ static CamHelper *create()
return new CamHelperImx290();
}
+static CamHelper *createImx662()
+{
+ /*
+ * The imx662 requires a frame integration diff of at least 4,
+ * according to the datasheet, but in practice this didn't prevent
+ * bad black level values in HCG (high conversion gain) mode.
+ * So instead, we go with 6 for "safety".
+ */
+ return new CamHelperImx290(6);
+}
+
static RegisterCamHelper reg("imx290", &create);
static RegisterCamHelper reg327("imx327", &create);
static RegisterCamHelper reg462("imx462", &create);
-static RegisterCamHelper reg662("imx662", &create);
+static RegisterCamHelper reg662("imx662", &createImx662);
IMX662 can still share its CamHelper with the IMX290 and other sensors, but requires a frameIntegrationDiff of 6 (as opposed to 2 for the others). The value 2 is invalid for the IMX662 and can lead to bad black level values in HCG (High Conversion Gain) mode. The CamHelperImx290 constructor is refactored slightly to allow the IMX662 version to be created with a custom frameIntegrationDiff. Signed-off-by: David Plowman <david.plowman@raspberrypi.com> --- src/ipa/rpi/cam_helper/cam_helper_imx290.cpp | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-)