Patch Detail
Show a patch.
GET /api/1.1/patches/14271/?format=api
{ "id": 14271, "url": "https://patchwork.libcamera.org/api/1.1/patches/14271/?format=api", "web_url": "https://patchwork.libcamera.org/patch/14271/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/1.1/projects/1/?format=api", "name": "libcamera", "link_name": "libcamera", "list_id": "libcamera_core", "list_email": "libcamera-devel@lists.libcamera.org", "web_url": "", "scm_url": "", "webscm_url": "" }, "msgid": "<20211022151218.111966-6-jeanmichel.hautbois@ideasonboard.com>", "date": "2021-10-22T15:12:04", "name": "[libcamera-devel,v3,05/19] ipa: ipu3: awb: Add AWB class documentation", "commit_ref": null, "pull_url": null, "state": "changes-requested", "archived": false, "hash": "9e5a5e58d7997b77a970ce523b91ac4867506e9d", "submitter": { "id": 75, "url": "https://patchwork.libcamera.org/api/1.1/people/75/?format=api", "name": "Jean-Michel Hautbois", "email": "jeanmichel.hautbois@ideasonboard.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/14271/mbox/", "series": [ { "id": 2651, "url": "https://patchwork.libcamera.org/api/1.1/series/2651/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=2651", "date": "2021-10-22T15:11:59", "name": "Document IPU3 IPA", "version": 3, "mbox": "https://patchwork.libcamera.org/series/2651/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/14271/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/14271/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 59725BF415\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 22 Oct 2021 15:12:35 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 9826A68F73;\n\tFri, 22 Oct 2021 17:12:31 +0200 (CEST)", "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id A81EA6012A\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 22 Oct 2021 17:12:23 +0200 (CEST)", "from tatooine.ideasonboard.com (unknown\n\t[IPv6:2a01:e0a:169:7140:22cc:3af6:5ccb:8367])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 70C7951D;\n\tFri, 22 Oct 2021 17:12:23 +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=\"LwL1q0Tz\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1634915543;\n\tbh=fM0WX4vMyX+GX/z7liQZaGTy6MzFM2k6zjsOXSxQGy4=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=LwL1q0Tzgw2zamxs/oTk62DwzPeJNawal+OY6SmDmhHGR8bWwLb+gTNLdWJql4ouP\n\t7hdzk0Ev2ezirxOVmpFsv/UN9A/hbqJe0SZSOFCCT3sAbsMCoSgZBR6aKKBgVWwlYE\n\tLhfuBIXlENsk73h7cEYVhCCQJxJjOrcSiTXqzrHU=", "From": "Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Fri, 22 Oct 2021 17:12:04 +0200", "Message-Id": "<20211022151218.111966-6-jeanmichel.hautbois@ideasonboard.com>", "X-Mailer": "git-send-email 2.32.0", "In-Reply-To": "<20211022151218.111966-1-jeanmichel.hautbois@ideasonboard.com>", "References": "<20211022151218.111966-1-jeanmichel.hautbois@ideasonboard.com>", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=UTF-8", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH v3 05/19] ipa: ipu3: awb: Add AWB class\n\tdocumentation", "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": "The AWB algorithm is based on the Grey world algorithm and uses the\nstatistics generated by the ImgU for that. Explain how it uses those,\nand reference the original algorithm at the same time.\n\nSigned-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>\n\n---\nv3:\n- move the diagram from Accumulator to AWB\n- add a word to say green gains are always set to 1\n---\n src/ipa/ipu3/algorithms/awb.cpp | 108 ++++++++++++++++++++------------\n 1 file changed, 67 insertions(+), 41 deletions(-)", "diff": "diff --git a/src/ipa/ipu3/algorithms/awb.cpp b/src/ipa/ipu3/algorithms/awb.cpp\nindex 91364a04..7e10460f 100644\n--- a/src/ipa/ipu3/algorithms/awb.cpp\n+++ b/src/ipa/ipu3/algorithms/awb.cpp\n@@ -11,6 +11,10 @@\n \n #include <libcamera/base/log.h>\n \n+/**\n+ * \\file awb.h\n+ */\n+\n namespace libcamera {\n \n namespace ipa::ipu3::algorithms {\n@@ -42,47 +46,6 @@ static constexpr uint32_t kMinCellsPerZoneRatio = 255 * 90 / 100;\n * \\struct Accumulator\n * \\brief RGB statistics for a given zone\n *\n- * - Cells are defined in Pixels\n- * - Zones are defined in Cells\n- *\n- * 80 cells\n- * /───────────── 1280 pixels ───────────\\\n- * 16 zones\n- * 16\n- * ┌────┬────┬────┬────┬────┬─ ──────┬────┐ \\\n- * │Cell│ │ │ │ │ | │ │ │\n- * 16 │ px │ │ │ │ │ | │ │ │\n- * ├────┼────┼────┼────┼────┼─ ──────┼────┤ │\n- * │ │ │ │ │ │ | │ │\n- * │ │ │ │ │ │ | │ │ 7\n- * │ ── │ ── │ ── │ ── │ ── │ ── ── ─┤ ── │ 1 2 4\n- * │ │ │ │ │ │ | │ │ 2 0 5\n- *\n- * │ │ │ │ │ │ | │ │ z p c\n- * ├────┼────┼────┼────┼────┼─ ──────┼────┤ o i e\n- * │ │ │ │ │ │ | │ │ n x l\n- * │ │ | │ │ e e l\n- * ├─── ───┼─ ──────┼────┤ s l s\n- * │ │ | │ │ s\n- * │ │ | │ │\n- * ├─── Zone of Cells ───┼─ ──────┼────┤ │\n- * │ (5 x 4) │ | │ │ │\n- * │ │ | │ │ │\n- * ├── ───┼─ ──────┼────┤ │\n- * │ │ │ | │ │ │\n- * │ │ │ │ │ │ | │ │ │\n- * └────┴────┴────┴────┴────┴─ ──────┴────┘ /\n- *\n- *\n- * The algorithm works with a fixed number of zones \\a kAwbStatsSizeX x\n- * \\a kAwbStatsSizeY. For example, a frame of 1280x720 is divided into 80x45\n- * cells of [16x16] pixels. In the case of \\a kAwbStatsSizeX=16 and\n- * \\a kAwbStatsSizeY=12 the zones are made of [5x4] cells. The cells are\n- * left-aligned and calculated by IPAIPU3::calculateBdsGrid().\n- *\n- * Each statistics cell represents the average value of the pixels in that cell\n- * split by colour components.\n- *\n * The Accumulator structure stores the sum of the average of each cell in a\n * zone of the image, as well as the number of cells which were unsaturated and\n * therefore included in the average.\n@@ -152,6 +115,69 @@ static const struct ipu3_uapi_ccm_mat_config imguCssCcmDefault = {\n \t0, 0, 8191, 0\n };\n \n+/**\n+ * \\class Awb\n+ * \\brief A Grey world white balance correction algorithm\n+ *\n+ * The Grey World algorithm assumes that the scene, in average, is neutral grey.\n+ * Reference: Lam, Edmund & Fung, George. (2008). Automatic White Balancing in\n+ * Digital Photography. 10.1201/9781420054538.ch10.\n+ *\n+ * The IPU3 generates statistics from the Bayer Down Scaler output into a grid\n+ * defined in the ipu3_uapi_awb_config_s structure.\n+ *\n+ * - Cells are defined in Pixels\n+ * - Zones are defined in Cells\n+ *\n+ * 80 cells\n+ * /───────────── 1280 pixels ───────────\\\n+ * 16 zones\n+ * 16\n+ * ┌────┬────┬────┬────┬────┬─ ──────┬────┐ \\\n+ * │Cell│ │ │ │ │ | │ │ │\n+ * 16 │ px │ │ │ │ │ | │ │ │\n+ * ├────┼────┼────┼────┼────┼─ ──────┼────┤ │\n+ * │ │ │ │ │ │ | │ │\n+ * │ │ │ │ │ │ | │ │ 7\n+ * │ ── │ ── │ ── │ ── │ ── │ ── ── ─┤ ── │ 1 2 4\n+ * │ │ │ │ │ │ | │ │ 2 0 5\n+ *\n+ * │ │ │ │ │ │ | │ │ z p c\n+ * ├────┼────┼────┼────┼────┼─ ──────┼────┤ o i e\n+ * │ │ │ │ │ │ | │ │ n x l\n+ * │ │ | │ │ e e l\n+ * ├─── ───┼─ ──────┼────┤ s l s\n+ * │ │ | │ │ s\n+ * │ │ | │ │\n+ * ├─── Zone of Cells ───┼─ ──────┼────┤ │\n+ * │ (5 x 4) │ | │ │ │\n+ * │ │ | │ │ │\n+ * ├── ───┼─ ──────┼────┤ │\n+ * │ │ │ | │ │ │\n+ * │ │ │ │ │ │ | │ │ │\n+ * └────┴────┴────┴────┴────┴─ ──────┴────┘ /\n+ *\n+ *\n+ * The algorithm works with a fixed number of zones \\a kAwbStatsSizeX x\n+ * \\a kAwbStatsSizeY. For example, a frame of 1280x720 is divided into 80x45\n+ * cells of [16x16] pixels. In the case of \\a kAwbStatsSizeX=16 and\n+ * \\a kAwbStatsSizeY=12 the zones are made of [5x4] cells. The cells are\n+ * left-aligned and calculated by IPAIPU3::calculateBdsGrid().\n+ *\n+ * Each statistics cell represents the average value of the pixels in that cell\n+ * split by colour components.\n+ *\n+ * Before calculating the gains, we will convert the statistics from the BDS\n+ * grid to an internal grid configuration in generateAwbStats.\n+ * As part of converting the statistics to an internal grid, the saturation\n+ * flag from the originating grid cell is used to decide if the zone contains\n+ * saturated pixels or not, making the zone relevant or not.\n+ * A saturated zone will be excluded from the calculation.\n+ *\n+ * The Grey World algorithm will then estimate the red and blue gains to apply, and\n+ * store the results in the metadata. The green gain is always set to 1.\n+ */\n+\n Awb::Awb()\n \t: Algorithm()\n {\n", "prefixes": [ "libcamera-devel", "v3", "05/19" ] }