[05/11] ipa: rpi: cam_helper: Add CamHelperDefault class
diff mbox series

Message ID 20251210164055.17856-6-david.plowman@raspberrypi.com
State New
Headers show
Series
  • Bayer re-processing
Related show

Commit Message

David Plowman Dec. 10, 2025, 4:15 p.m. UTC
This will help make "memory cameras" work where there is no real
sensor. This implementation does not really have to do anything except
provide a few default values to satisfy any calling code.

We use "memory cameras" to process raw camera images obtained from
other sources, when in fact no actual camera may be present at all.

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 c1eac689..0c968033 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',