summaryrefslogtreecommitdiff
path: root/src/ipa/raspberrypi/controller
diff options
context:
space:
mode:
authorNaushir Patuck <naush@raspberrypi.com>2023-03-27 13:20:30 +0100
committerKieran Bingham <kieran.bingham@ideasonboard.com>2023-03-31 13:29:18 +0100
commitac7511dc4c594f567ddff27ccc02c30bf6c00bfd (patch)
tree539bdcc2e877095b97f9455449464d86882f5a3e /src/ipa/raspberrypi/controller
parent43f57f26b44648e609f66770e43294a361bd6657 (diff)
ipa: raspberrypi: Generalise the focus reporting code
Use the generalised focus statistics structure to compute the centre window focus FoM value. This avoids needed to hard-code a specific grid size. Remove the focus reporting algorithm as the functionality is duplicated by this bit of IPA code. Remove focus_status.h as it is no longer needed. Signed-off-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Reviewed-by: David Plowman <david.plowman@raspberrypi.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Diffstat (limited to 'src/ipa/raspberrypi/controller')
-rw-r--r--src/ipa/raspberrypi/controller/focus_status.h20
-rw-r--r--src/ipa/raspberrypi/controller/rpi/af.h1
-rw-r--r--src/ipa/raspberrypi/controller/rpi/focus.cpp49
3 files changed, 0 insertions, 70 deletions
diff --git a/src/ipa/raspberrypi/controller/focus_status.h b/src/ipa/raspberrypi/controller/focus_status.h
deleted file mode 100644
index 8b74e598..00000000
--- a/src/ipa/raspberrypi/controller/focus_status.h
+++ /dev/null
@@ -1,20 +0,0 @@
-/* SPDX-License-Identifier: BSD-2-Clause */
-/*
- * Copyright (C) 2020, Raspberry Pi Ltd
- *
- * focus_status.h - focus measurement status
- */
-#pragma once
-
-#include <linux/bcm2835-isp.h>
-
-/*
- * The focus algorithm should post the following structure into the image's
- * "focus.status" metadata. Recall that it's only reporting focus (contrast)
- * measurements, it's not driving any kind of auto-focus algorithm!
- */
-
-struct FocusStatus {
- unsigned int num;
- uint32_t focusMeasures[FOCUS_REGIONS];
-};
diff --git a/src/ipa/raspberrypi/controller/rpi/af.h b/src/ipa/raspberrypi/controller/rpi/af.h
index b479feb8..6d2bae67 100644
--- a/src/ipa/raspberrypi/controller/rpi/af.h
+++ b/src/ipa/raspberrypi/controller/rpi/af.h
@@ -28,7 +28,6 @@
* "nuisance" scans. During each interval where PDAF is not working, only
* ONE scan will be performed; CAF cannot track objects using CDAF alone.
*
- * This algorithm is unrelated to "rpi.focus" which merely reports CDAF FoM.
*/
namespace RPiController {
diff --git a/src/ipa/raspberrypi/controller/rpi/focus.cpp b/src/ipa/raspberrypi/controller/rpi/focus.cpp
deleted file mode 100644
index ea3cc00e..00000000
--- a/src/ipa/raspberrypi/controller/rpi/focus.cpp
+++ /dev/null
@@ -1,49 +0,0 @@
-/* SPDX-License-Identifier: BSD-2-Clause */
-/*
- * Copyright (C) 2020, Raspberry Pi Ltd
- *
- * focus.cpp - focus algorithm
- */
-#include <stdint.h>
-
-#include <libcamera/base/log.h>
-
-#include "../focus_status.h"
-#include "focus.h"
-
-using namespace RPiController;
-using namespace libcamera;
-
-LOG_DEFINE_CATEGORY(RPiFocus)
-
-#define NAME "rpi.focus"
-
-Focus::Focus(Controller *controller)
- : Algorithm(controller)
-{
-}
-
-char const *Focus::name() const
-{
- return NAME;
-}
-
-void Focus::process(StatisticsPtr &stats, Metadata *imageMetadata)
-{
- FocusStatus status;
- for (unsigned int i = 0; i < stats->focusRegions.numRegions(); i++)
- status.focusMeasures[i] = stats->focusRegions.get(i).val;
- status.num = stats->focusRegions.numRegions();
- imageMetadata->set("focus.status", status);
-
- LOG(RPiFocus, Debug)
- << "Focus contrast measure: "
- << (status.focusMeasures[5] + status.focusMeasures[6]) / 10;
-}
-
-/* Register algorithm with the system. */
-static Algorithm *create(Controller *controller)
-{
- return new Focus(controller);
-}
-static RegisterAlgorithm reg(NAME, &create);