[RFC,06/12] ipa: rpi: cam_helper: Add CamHelperDefault class
diff mbox series

Message ID 20250827090739.86955-7-david.plowman@raspberrypi.com
State New
Headers show
Series
  • Bayer Re-Processing
Related show

Commit Message

David Plowman Aug. 27, 2025, 9:07 a.m. UTC
This will help make "memory cameras" work where there is no real
sensor.

Signed-off-by: David Plowman <david.plowman@raspberrypi.com>
---
 src/ipa/rpi/cam_helper/cam_helper_default.cpp | 45 +++++++++++++++++++
 src/ipa/rpi/cam_helper/meson.build            |  1 +
 2 files changed, 46 insertions(+)
 create mode 100644 src/ipa/rpi/cam_helper/cam_helper_default.cpp

Patch
diff mbox series

diff --git a/src/ipa/rpi/cam_helper/cam_helper_default.cpp b/src/ipa/rpi/cam_helper/cam_helper_default.cpp
new file mode 100644
index 00000000..99801cc3
--- /dev/null
+++ b/src/ipa/rpi/cam_helper/cam_helper_default.cpp
@@ -0,0 +1,45 @@ 
+/* SPDX-License-Identifier: BSD-2-Clause */
+/*
+ * Copyright (C) 2025, Raspberry Pi Ltd
+ *
+ * default camera helper for unknown sensors
+ */
+
+#include <assert.h>
+#include <stddef.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "cam_helper.h"
+
+using namespace RPiController;
+
+class CamHelperDefault : public CamHelper
+{
+public:
+	CamHelperDefault();
+	uint32_t gainCode(double gain) const override;
+	double gain(uint32_t gainCode) const override;
+};
+
+CamHelperDefault::CamHelperDefault()
+	: CamHelper({}, 0)
+{
+}
+
+uint32_t CamHelperDefault::gainCode([[maybe_unused]] double gain) const
+{
+	return 0;
+}
+
+double CamHelperDefault::gain([[maybe_unused]] uint32_t gainCode) const
+{
+	return 1.0;
+}
+
+static CamHelper *create()
+{
+	return new CamHelperDefault();
+}
+
+static RegisterCamHelper reg("default", &create);
diff --git a/src/ipa/rpi/cam_helper/meson.build b/src/ipa/rpi/cam_helper/meson.build
index 7433cffd..6f4c86e7 100644
--- a/src/ipa/rpi/cam_helper/meson.build
+++ b/src/ipa/rpi/cam_helper/meson.build
@@ -2,6 +2,7 @@ 
 
 rpi_ipa_cam_helper_sources = files([
     'cam_helper.cpp',
+    'cam_helper_default.cpp',
     'cam_helper_ov5647.cpp',
     'cam_helper_imx219.cpp',
     'cam_helper_imx283.cpp',