{"id":12737,"url":"https://patchwork.libcamera.org/api/patches/12737/?format=json","web_url":"https://patchwork.libcamera.org/patch/12737/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20210628202255.138874-3-jeanmichel.hautbois@ideasonboard.com>","date":"2021-06-28T20:22:50","name":"[libcamera-devel,v1,2/7] ipa: libipa: Create a common ISP header to store the structure types","commit_ref":null,"pull_url":null,"state":"changes-requested","archived":false,"hash":"2662caeb6da98cd3002cceb0338cccc8d842d8b7","submitter":{"id":75,"url":"https://patchwork.libcamera.org/api/people/75/?format=json","name":"Jean-Michel Hautbois","email":"jeanmichel.hautbois@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/12737/mbox/","series":[{"id":2190,"url":"https://patchwork.libcamera.org/api/series/2190/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=2190","date":"2021-06-28T20:22:48","name":"ipa: Introduce a new open AGC","version":1,"mbox":"https://patchwork.libcamera.org/series/2190/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/12737/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/12737/checks/","tags":{},"headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id DE526C321F\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 28 Jun 2021 20:23:04 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 11FC7684DF;\n\tMon, 28 Jun 2021 22:23:04 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 2C82360508\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 28 Jun 2021 22:23:00 +0200 (CEST)","from tatooine.ideasonboard.com (unknown\n\t[IPv6:2a01:e0a:169:7140:c3ad:78d0:405e:fc33])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id BF575E1A;\n\tMon, 28 Jun 2021 22:22:59 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"E+AhN7OK\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1624911779;\n\tbh=xkdDA1ZOoupVOv9QCvdpZOzjk0vdTtZMgVmltEckeRU=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=E+AhN7OKSh4n3qHi+lYvPn3rbxS0TnIXDFuEKOzrvogrMyxMD4c7BX8ut186F8+bU\n\t3a8CybOvYwz63Wnx5XIYrPisKIxm60tYgObEJtNBPSZvfToAgTZF/nvBVLrM61Ctgi\n\t+/dkCrbVOvRYo+bJ96z3+HwC2mZ7hI5DvFlhIg1s=","From":"Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Date":"Mon, 28 Jun 2021 22:22:50 +0200","Message-Id":"<20210628202255.138874-3-jeanmichel.hautbois@ideasonboard.com>","X-Mailer":"git-send-email 2.30.2","In-Reply-To":"<20210628202255.138874-1-jeanmichel.hautbois@ideasonboard.com>","References":"<20210628202255.138874-1-jeanmichel.hautbois@ideasonboard.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v1 2/7] ipa: libipa: Create a common ISP\n\theader to store the structure types","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"Each ISP may use the same AWB or AGC algorithms. In order to avoid\nduplicated code, create a header with the main structures used for now.\n\nSigned-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>\n---\n src/ipa/ipu3/ipu3_agc.h |   1 +\n src/ipa/ipu3/ipu3_awb.h |  30 +----------\n src/ipa/libipa/isp.h    | 110 ++++++++++++++++++++++++++++++++++++++++\n 3 files changed, 112 insertions(+), 29 deletions(-)\n create mode 100644 src/ipa/libipa/isp.h","diff":"diff --git a/src/ipa/ipu3/ipu3_agc.h b/src/ipa/ipu3/ipu3_agc.h\nindex 3deca3ae..6ca9af8e 100644\n--- a/src/ipa/ipu3/ipu3_agc.h\n+++ b/src/ipa/ipu3/ipu3_agc.h\n@@ -17,6 +17,7 @@\n #include <libcamera/geometry.h>\n \n #include \"libipa/algorithm.h\"\n+#include \"libipa/isp.h\"\n \n namespace libcamera {\n \ndiff --git a/src/ipa/ipu3/ipu3_awb.h b/src/ipa/ipu3/ipu3_awb.h\nindex 122cf68c..6ae111fd 100644\n--- a/src/ipa/ipu3/ipu3_awb.h\n+++ b/src/ipa/ipu3/ipu3_awb.h\n@@ -14,6 +14,7 @@\n #include <libcamera/geometry.h>\n \n #include \"libipa/algorithm.h\"\n+#include \"libipa/isp.h\"\n \n namespace libcamera {\n \n@@ -42,35 +43,6 @@ public:\n \t\tunsigned char padding[3];\n \t} __attribute__((packed));\n \n-\t/* \\todo Make these three structs available to all the ISPs ? */\n-\tstruct RGB {\n-\t\tRGB(double _R = 0, double _G = 0, double _B = 0)\n-\t\t\t: R(_R), G(_G), B(_B)\n-\t\t{\n-\t\t}\n-\t\tdouble R, G, B;\n-\t\tRGB &operator+=(RGB const &other)\n-\t\t{\n-\t\t\tR += other.R, G += other.G, B += other.B;\n-\t\t\treturn *this;\n-\t\t}\n-\t};\n-\n-\tstruct IspStatsRegion {\n-\t\tunsigned int counted;\n-\t\tunsigned int uncounted;\n-\t\tunsigned long long rSum;\n-\t\tunsigned long long gSum;\n-\t\tunsigned long long bSum;\n-\t};\n-\n-\tstruct AwbStatus {\n-\t\tdouble temperatureK;\n-\t\tdouble redGain;\n-\t\tdouble greenGain;\n-\t\tdouble blueGain;\n-\t};\n-\n private:\n \tvoid generateZones(std::vector<RGB> &zones);\n \tvoid generateAwbStats(const ipu3_uapi_stats_3a *stats);\ndiff --git a/src/ipa/libipa/isp.h b/src/ipa/libipa/isp.h\nnew file mode 100644\nindex 00000000..a15803d6\n--- /dev/null\n+++ b/src/ipa/libipa/isp.h\n@@ -0,0 +1,110 @@\n+/* SPDX-License-Identifier: LGPL-2.1-or-later */\n+/*\n+ * Copyright (C) 2021, Ideas On Board\n+ *\n+ * isp.h - ISP statistics interface\n+ */\n+#ifndef __LIBCAMERA_IPA_LIBIPA_ISP_H__\n+#define __LIBCAMERA_IPA_LIBIPA_ISP_H__\n+\n+namespace libcamera {\n+\n+namespace ipa {\n+/**\n+ * \\struct RGB\n+ * \\brief RGB\n+ *\n+ * \\fn RGB::RGB\n+ * \\brief Construct a RGB structure\n+ * \\param[in] _R Red value to set, defaults to 0\n+ * \\param[in] _G Green value to set, defaults to 0\n+ * \\param[in] _B Blue value to set, defaults to 0\n+ *\n+ * \\var RGB::R\n+ * \\brief Red value of the RGB structure\n+ *\n+ * \\var RGB::G\n+ * \\brief Green value of the RGB structure\n+ *\n+ * \\var RGB::B\n+ * \\brief Blue value of the RGB structure\n+ *\n+ * \\fn RGB &RGB::operator+=(RGB const &other)\n+ * \\brief Add each RGB value to another RGB structure\n+ * \\param[in] other An RGB structure\n+ * \\return An RGB structure containing the added R, G and B values\n+ */\n+struct RGB {\n+\tRGB(double _R = 0, double _G = 0, double _B = 0)\n+\t\t: R(_R), G(_G), B(_B)\n+\t{\n+\t}\n+\tdouble R, G, B;\n+\tRGB &operator+=(RGB const &other)\n+\t{\n+\t\tR += other.R, G += other.G, B += other.B;\n+\t\treturn *this;\n+\t}\n+};\n+\n+/**\n+ * \\struct IspStatsRegion\n+ * \\brief RGB statistics for a given region\n+ *\n+ * The IspStatsRegion structure is intended to abstract the ISP specific\n+ * statistics and use an agnostic algorithm to compute AWB.\n+ *\n+ * \\var IspStatsRegion::counted\n+ * \\brief Number of pixels used to calculate the sums\n+ *\n+ * \\var IspStatsRegion::uncounted\n+ * \\brief Remaining number of pixels in the region\n+ *\n+ * \\var IspStatsRegion::rSum\n+ * \\brief Sum of the red values in the region\n+ *\n+ * \\var IspStatsRegion::gSum\n+ * \\brief Sum of the green values in the region\n+ *\n+ * \\var IspStatsRegion::bSum\n+ * \\brief Sum of the blue values in the region\n+ */\n+struct IspStatsRegion {\n+\tunsigned int counted;\n+\tunsigned int uncounted;\n+\tunsigned long long rSum;\n+\tunsigned long long gSum;\n+\tunsigned long long bSum;\n+};\n+\n+/**\n+ * \\struct AwbStatus\n+ * \\brief AWB parameters calculated\n+ *\n+ * The AwbStatus structure is intended to store the AWB\n+ * parameters calculated by the algorithm\n+ *\n+ * \\var AwbStatus::temperatureK\n+ * \\brief Color temperature calculated\n+ *\n+ * \\var AwbStatus::redGain\n+ * \\brief Gain calculated for the red channel\n+ *\n+ * \\var AwbStatus::greenGain\n+ * \\brief Gain calculated for the green channel\n+ *\n+ * \\var AwbStatus::blueGain\n+ * \\brief Gain calculated for the blue channel\n+ */\n+struct AwbStatus {\n+\tdouble temperatureK;\n+\tdouble redGain;\n+\tdouble greenGain;\n+\tdouble blueGain;\n+};\n+\n+} /* namespace ipa */\n+\n+} /* namespace libcamera */\n+\n+#endif /* __LIBCAMERA_IPA_LIBIPA_ISP_H__ */\n","prefixes":["libcamera-devel","v1","2/7"]}