summaryrefslogtreecommitdiff
path: root/src/ipa/rkisp1/algorithms/af.h
diff options
context:
space:
mode:
authorDaniel Semkowicz <dse@thaumatec.com>2023-01-19 09:41:09 +0100
committerJacopo Mondi <jacopo.mondi@ideasonboard.com>2023-09-04 14:08:51 +0200
commit568a7a20f1bfe03b973029b62cebf11e853e7abf (patch)
tree6b291d221a384d83689aaf40f6a0a2e5de7ca85a /src/ipa/rkisp1/algorithms/af.h
parent0f6172999dafbf9f80c2b5941bf0487a09b18dd5 (diff)
ipa: rkisp1: Add AF algorithm basing on common AfHillClimbing class
Rockchip ISP AF block allows calculation of sharpness and luminance in up to three user defined windows. If no windows are set, there are some default settings applied for the first window and exposed through the driver. For each frame, use the sharpness value calculated for this default window and feed the hill climbing algorithm with them. Then set the lens position to value calculated by the algorithm. Signed-off-by: Daniel Semkowicz <dse@thaumatec.com>
Diffstat (limited to 'src/ipa/rkisp1/algorithms/af.h')
-rw-r--r--src/ipa/rkisp1/algorithms/af.h42
1 files changed, 42 insertions, 0 deletions
diff --git a/src/ipa/rkisp1/algorithms/af.h b/src/ipa/rkisp1/algorithms/af.h
new file mode 100644
index 00000000..882be952
--- /dev/null
+++ b/src/ipa/rkisp1/algorithms/af.h
@@ -0,0 +1,42 @@
+/* SPDX-License-Identifier: LGPL-2.1-or-later */
+/*
+ * Copyright (C) 2022, Theobroma Systems
+ *
+ * af.h - RkISP1 AF hill climbing based control algorithm
+ */
+
+#pragma once
+
+#include <linux/rkisp1-config.h>
+
+#include "libipa/algorithms/af_hill_climbing.h"
+
+#include "algorithm.h"
+
+namespace libcamera::ipa::rkisp1::algorithms {
+
+class Af : public ipa::common::algorithms::AfHillClimbing, public Algorithm
+{
+public:
+ Af() = default;
+ ~Af() = default;
+
+ int init(IPAContext &context, const YamlObject &tuningData) override;
+ int configure(IPAContext &context, const IPACameraSensorInfo &configInfo) override;
+ void queueRequest(IPAContext &context, const uint32_t frame,
+ IPAFrameContext &frameContext, const ControlList &controls) override;
+ void prepare(IPAContext &context, const uint32_t frame,
+ IPAFrameContext &frameContext, rkisp1_params_cfg *params) override;
+ void process(IPAContext &context, const uint32_t frame,
+ IPAFrameContext &frameContext, const rkisp1_stat_buffer *stats,
+ ControlList &metadata) override;
+
+private:
+ void setMeteringMode(controls::AfMeteringEnum metering) final;
+ void setWindows(Span<const Rectangle> windows) final;
+
+ /* Wait number of frames after changing lens position */
+ uint32_t waitFramesLens_;
+};
+
+} /* namespace libcamera::ipa::rkisp1::algorithms */