Patch Detail
Show a patch.
GET /api/patches/10616/?format=api
{ "id": 10616, "url": "https://patchwork.libcamera.org/api/patches/10616/?format=api", "web_url": "https://patchwork.libcamera.org/patch/10616/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/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": "<20201208204441.9356-5-david.plowman@raspberrypi.com>", "date": "2020-12-08T20:44:39", "name": "[libcamera-devel,v3,4/6] src: ipa: raspberrypi: Compute inverse of piecewise linear function", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "41495ab595f6121e014666e43cfa4d1af63c3a86", "submitter": { "id": 42, "url": "https://patchwork.libcamera.org/api/people/42/?format=api", "name": "David Plowman", "email": "david.plowman@raspberrypi.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/10616/mbox/", "series": [ { "id": 1515, "url": "https://patchwork.libcamera.org/api/series/1515/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=1515", "date": "2020-12-08T20:44:35", "name": "Raspberry Pi AGC: initial frame drop count", "version": 3, "mbox": "https://patchwork.libcamera.org/series/1515/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/10616/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/10616/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 F401DBDB20\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 8 Dec 2020 20:44:49 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id A198667F12;\n\tTue, 8 Dec 2020 21:44:49 +0100 (CET)", "from mail-ed1-x532.google.com (mail-ed1-x532.google.com\n\t[IPv6:2a00:1450:4864:20::532])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 651CE67E6F\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 8 Dec 2020 21:44:48 +0100 (CET)", "by mail-ed1-x532.google.com with SMTP id cm17so19040349edb.4\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 08 Dec 2020 12:44:48 -0800 (PST)", "from pi4-davidp.lan (plowpeople3.plus.com. [80.229.223.72])\n\tby smtp.gmail.com with ESMTPSA id\n\tbe6sm18441471edb.29.2020.12.08.12.44.46\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tTue, 08 Dec 2020 12:44:47 -0800 (PST)" ], "Authentication-Results": "lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=raspberrypi.com header.i=@raspberrypi.com\n\theader.b=\"NlUkXIQ1\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google;\n\th=from:to:cc:subject:date:message-id:in-reply-to:references\n\t:mime-version:content-transfer-encoding;\n\tbh=Zy5kG8Dx19vajqkeNd3AVwmfxp8E+gdkVwFyJzoeJFo=;\n\tb=NlUkXIQ1f1A74pK7VGzEdKAUWdf/tS4vkfEe93EyRoRG/WDC13Hid+cJGiOdMpWxau\n\tN8eAPDd9DHGkFNC6atKLAgbAkidSsVHDiO5SQ3rTjAE2gBcDZACTH+4AJcoVWGmcXlOv\n\tIswuGbOd8b0gQYK61+0K4b9xpAFknNEygHhBMWsCgrA1U6bHcwDFSoxu03EE7Z9APr/6\n\tXTqvEQ9SxkIn8hHqEjVFoChy8NdXBQDu7pXko1JVF6rvQZFuHtq6hvjabNr/bcmIenb8\n\t4eY8a+gLyW5zYCvpNLhOfA6GPxWc31crhAEnG4Q0Vqi3P1n5JzpaP1ItXjMOds/QMUuR\n\tOfRg==", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references:mime-version:content-transfer-encoding;\n\tbh=Zy5kG8Dx19vajqkeNd3AVwmfxp8E+gdkVwFyJzoeJFo=;\n\tb=SH0xSWAQfSL1n7MjxoZ4jYFAiBOgXQ/UFsN0iT4zp/tX+QB0kBJ01lWDuP/jNfWNls\n\tkcQ/R02i8/E2pmnpebd+TENKypK0J6C7T9cqdU/eNKuZOFdJLklKP+5I8lHepJ7WL2Aq\n\t2oxPQR914YdJavfVazneBax8qoHHKbjERX87OrRfdkr9PW7Fz4kkyV7BQYwvzVzGiLZw\n\tx/WspTS7N7YIEEHCptcN9stgkATq3vp/sgVpGWIJgdNzwVP7vunLcHjjsBBWbRLufm96\n\tDNnStLMHe+wAl8Irwf/ZOnC25zPeWNX3mc0m0MYEOYXkkf322jDcgHcIHwP2BMJmLbo0\n\tYI1w==", "X-Gm-Message-State": "AOAM531oe2vFVtTGiwMNhD9czA8838HdTJNRSnGQ/xXPx31ZiLBvPEHn\n\tKWBIC5UK0lXRLpXh4Q4ayOLwuz9Lm6dwdaSu", "X-Google-Smtp-Source": "ABdhPJy57bJJIYrfggRqJwv17gF4JEUiyrBUXEMkMw36r++eQo3Fk4S0belR9VRLctck1Kih0ChQfA==", "X-Received": "by 2002:a05:6402:1caa:: with SMTP id\n\tcz10mr14565766edb.345.1607460287756; \n\tTue, 08 Dec 2020 12:44:47 -0800 (PST)", "From": "David Plowman <david.plowman@raspberrypi.com>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Tue, 8 Dec 2020 20:44:39 +0000", "Message-Id": "<20201208204441.9356-5-david.plowman@raspberrypi.com>", "X-Mailer": "git-send-email 2.20.1", "In-Reply-To": "<20201208204441.9356-1-david.plowman@raspberrypi.com>", "References": "<20201208204441.9356-1-david.plowman@raspberrypi.com>", "MIME-Version": "1.0", "Subject": "[libcamera-devel] [PATCH v3 4/6] src: ipa: raspberrypi: Compute\n\tinverse of piecewise linear function", "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>", "Content-Type": "text/plain; charset=\"us-ascii\"", "Content-Transfer-Encoding": "7bit", "Errors-To": "libcamera-devel-bounces@lists.libcamera.org", "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>" }, "content": "Add a method to the piecewise linear function (Pwl) class to compute\nthe inverse of a given Pwl. If the input function is non-monotonic we\ncan only produce a best effort \"pseudo\" inverse, and we signal this to\nthe caller.\n\nSigned-off-by: David Plowman <david.plowman@raspberrypi.com>\nReviewed-by: Naushir Patuck <naush@raspberrypi.com>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n src/ipa/raspberrypi/controller/pwl.cpp | 30 ++++++++++++++++++++++++++\n src/ipa/raspberrypi/controller/pwl.hpp | 3 +++\n 2 files changed, 33 insertions(+)", "diff": "diff --git a/src/ipa/raspberrypi/controller/pwl.cpp b/src/ipa/raspberrypi/controller/pwl.cpp\nindex aa134a1f..130c820b 100644\n--- a/src/ipa/raspberrypi/controller/pwl.cpp\n+++ b/src/ipa/raspberrypi/controller/pwl.cpp\n@@ -114,6 +114,36 @@ Pwl::PerpType Pwl::Invert(Point const &xy, Point &perp, int &span,\n \treturn PerpType::None;\n }\n \n+Pwl Pwl::Inverse(bool *true_inverse, const double eps) const\n+{\n+\tbool appended = false, prepended = false, neither = false;\n+\tPwl inverse;\n+\n+\tfor (Point const &p : points_) {\n+\t\tif (inverse.Empty())\n+\t\t\tinverse.Append(p.y, p.x, eps);\n+\t\telse if (std::abs(inverse.points_.back().x - p.y) <= eps ||\n+\t\t\t std::abs(inverse.points_.front().x - p.y) <= eps)\n+\t\t\t/* do nothing */;\n+\t\telse if (p.y > inverse.points_.back().x) {\n+\t\t\tinverse.Append(p.y, p.x, eps);\n+\t\t\tappended = true;\n+\t\t} else if (p.y < inverse.points_.front().x) {\n+\t\t\tinverse.Prepend(p.y, p.x, eps);\n+\t\t\tprepended = true;\n+\t\t} else\n+\t\t\tneither = true;\n+\t}\n+\n+\t// This is not a proper inverse if we found ourselves putting points\n+\t// onto both ends of the inverse, or if there were points that couldn't\n+\t// go on either.\n+\tif (true_inverse)\n+\t\t*true_inverse = !(neither || (appended && prepended));\n+\n+\treturn inverse;\n+}\n+\n Pwl Pwl::Compose(Pwl const &other, const double eps) const\n {\n \tdouble this_x = points_[0].x, this_y = points_[0].y;\ndiff --git a/src/ipa/raspberrypi/controller/pwl.hpp b/src/ipa/raspberrypi/controller/pwl.hpp\nindex 4f168551..484672f6 100644\n--- a/src/ipa/raspberrypi/controller/pwl.hpp\n+++ b/src/ipa/raspberrypi/controller/pwl.hpp\n@@ -80,6 +80,9 @@ public:\n \t};\n \tPerpType Invert(Point const &xy, Point &perp, int &span,\n \t\t\tconst double eps = 1e-6) const;\n+\t// Compute the inverse function. Indicate if it is a proper (true)\n+\t// inverse, or only a best effort (e.g. input was non-monotonic).\n+\tPwl Inverse(bool *true_inverse = nullptr, const double eps = 1e-6) const;\n \t// Compose two Pwls together, doing \"this\" first and \"other\" after.\n \tPwl Compose(Pwl const &other, const double eps = 1e-6) const;\n \t// Apply function to (x,y) values at every control point.\n", "prefixes": [ "libcamera-devel", "v3", "4/6" ] }