Show a patch.

GET /api/patches/16425/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 16425,
    "url": "https://patchwork.libcamera.org/api/patches/16425/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/16425/",
    "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": "<20220629085722.11786-5-naush@raspberrypi.com>",
    "date": "2022-06-29T08:57:22",
    "name": "[libcamera-devel,v4,4/4] ipa: raspberrypi: Use std::optional in DeviceStatus",
    "commit_ref": "8acfb8494c7575161b88dfa982819ecca2c79b3a",
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "25a8f4f3b5d541b30bcb3b2efbe82cca6529180b",
    "submitter": {
        "id": 34,
        "url": "https://patchwork.libcamera.org/api/people/34/?format=api",
        "name": "Naushir Patuck",
        "email": "naush@raspberrypi.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/16425/mbox/",
    "series": [
        {
            "id": 3231,
            "url": "https://patchwork.libcamera.org/api/series/3231/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3231",
            "date": "2022-06-29T08:57:18",
            "name": "Add SensorTemperature control",
            "version": 4,
            "mbox": "https://patchwork.libcamera.org/series/3231/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/16425/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/16425/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 2F346BD808\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 29 Jun 2022 08:57:35 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 8DF1C65643;\n\tWed, 29 Jun 2022 10:57:34 +0200 (CEST)",
            "from mail-wr1-x42d.google.com (mail-wr1-x42d.google.com\n\t[IPv6:2a00:1450:4864:20::42d])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 0B9EA6563B\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 29 Jun 2022 10:57:31 +0200 (CEST)",
            "by mail-wr1-x42d.google.com with SMTP id i25so15854515wrc.13\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 29 Jun 2022 01:57:31 -0700 (PDT)",
            "from naush-laptop.localdomain ([93.93.133.154])\n\tby smtp.gmail.com with ESMTPSA id\n\tf15-20020a05600c154f00b003a032c88877sm2897102wmg.15.2022.06.29.01.57.29\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tWed, 29 Jun 2022 01:57:29 -0700 (PDT)"
        ],
        "DKIM-Signature": [
            "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1656493054;\n\tbh=LKM41LkvdfqwKIuygN7sVv3WXuRUOjTdLGZvjQ9+rkk=;\n\th=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:\n\tFrom;\n\tb=2OleYZV3aDeSC7OFBOfhHsp1jjZqALrXq4fmQdbHq7oZ77UW5vkplU1hH1dvMVAc5\n\tQ55hr1EnPAcBWE1RBxFPSmqqMuK6ezkRfv9jQRRRh+7tNuwD9YXVIFsI+QWZbZ2oCh\n\txSvDybw0Yith7Z4z2QsjDfUZMSjubTj68k1FI94Ps1eWn6bq0cJ/Ze+/uytITj3/lP\n\tPaMJbE82fpR/m56erDX4IxXnR9ci3RtrBs8Oz0SWQPjUpJTDk6iB7A41sQeQnYxvhl\n\tgVB2cL7lGCcXfhggawAChqgnp2gkwdTnqAMDHTs3Tg8dh9a/NUs/7HyZr52ejKEWrq\n\tcg2kPCy2fDemg==",
            "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=in89XHK+OhJp/bEi8fRq7qH5ZAnliJIX3PqoxwQ/GOA=;\n\tb=AE/0aNZc/P3Jtq+BKPFdeTGC82KaHbeC7FVKdz25WHbKkScg7SaTo6jcfyNbO1JiSH\n\tw0j0fBicMpS9wkwAwwYaINrAvZvbqW7GC53o8oCGiRvp3PVOJC18iIyfTvNArXPYWCyP\n\tbNLfrWwOhCgyLT8pQ4J1HzsWUpiFtkbJ+QjsxGIjIVWUWrqpZrNNqwUcxZt7su+DDHCc\n\tmA9qRDRUiJas7BxOXyHCaVbGahj6XkNvYMvgTObaY6y/hL631ne6qYsAr+An1P1Tykfo\n\tE7zPHzTA2rVKN8av2NA1indQmh6yCg20EUfUqiSnVrhktXkqIEu+sC1+vS/3ykukm94K\n\tlAJg=="
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=raspberrypi.com\n\theader.i=@raspberrypi.com\n\theader.b=\"AE/0aNZc\"; dkim-atps=neutral",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112;\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=in89XHK+OhJp/bEi8fRq7qH5ZAnliJIX3PqoxwQ/GOA=;\n\tb=Ztgh3o5ukdpKowkbpMH3s3BfO6zc6TNHE9p9jqsWP1ykY41uHIoyk05G8m8f3UH1OR\n\tTklcocYjcc8Y+VSZVAPy1vZlROxlu8G66ptsOVBPbGimNZhsaRSW6pqOv10nvD3QLskL\n\tWlRQTcu7CbIqbzGjGhFWSlqIwVwLngtx7qgyTvzhu15whkGC5Cesp2rn9YyP35z9lQ/K\n\tlUhty2P5OvgcLNNAKaPnhxxDVSuIZ7aehi8KznPNi0jl7bvX5UOaISROdFa1XuPHUXtK\n\tEcJr71TYr6TPcsa5GByT04OxaTbshKs3YG6ZASy55utlubYI2v2U/UwzMlg5BGkfBkhf\n\tRROw==",
        "X-Gm-Message-State": "AJIora/jU4E+w9bB+N/qEBlZLbJc2Wa+JU2+1N4MU9XKmNcAg+zGHbYp\n\tOJUjNK6edPN/Ytq44JJeLeI5kYn/VIwlOLB2",
        "X-Google-Smtp-Source": "AGRyM1uuKMLm9/ZuS+pq3HAbj1XobfnXtQu6NHUzGTiXwI8EKG24ORz68EiIy6tjpFSldkwxGtdn8Q==",
        "X-Received": "by 2002:adf:e8c7:0:b0:21d:1c7a:a45f with SMTP id\n\tk7-20020adfe8c7000000b0021d1c7aa45fmr1952696wrn.168.1656493050395; \n\tWed, 29 Jun 2022 01:57:30 -0700 (PDT)",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Wed, 29 Jun 2022 09:57:22 +0100",
        "Message-Id": "<20220629085722.11786-5-naush@raspberrypi.com>",
        "X-Mailer": "git-send-email 2.25.1",
        "In-Reply-To": "<20220629085722.11786-1-naush@raspberrypi.com>",
        "References": "<20220629085722.11786-1-naush@raspberrypi.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v4 4/4] ipa: raspberrypi: Use\n\tstd::optional in DeviceStatus",
        "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>",
        "From": "Naushir Patuck via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>",
        "Reply-To": "Naushir Patuck <naush@raspberrypi.com>",
        "Errors-To": "libcamera-devel-bounces@lists.libcamera.org",
        "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"
    },
    "content": "Switch the aperture, lens_position, and flash_intensity fields in the\nDeviceStatus structure to use std::optional instead of using invalid default\nvalues.\n\nSigned-off-by: Naushir Patuck <naush@raspberrypi.com>\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\nReviewed-by: David Plowman <david.plowman@raspberrypi.com>\n---\n src/ipa/raspberrypi/controller/device_status.cpp | 14 ++++++++++----\n src/ipa/raspberrypi/controller/device_status.h   |  9 ++++-----\n src/ipa/raspberrypi/controller/rpi/lux.cpp       |  4 +---\n 3 files changed, 15 insertions(+), 12 deletions(-)",
    "diff": "diff --git a/src/ipa/raspberrypi/controller/device_status.cpp b/src/ipa/raspberrypi/controller/device_status.cpp\nindex 05897fc15b50..a389c40dafed 100644\n--- a/src/ipa/raspberrypi/controller/device_status.cpp\n+++ b/src/ipa/raspberrypi/controller/device_status.cpp\n@@ -12,10 +12,16 @@ std::ostream &operator<<(std::ostream &out, const DeviceStatus &d)\n {\n \tout << \"Exposure: \" << d.shutter_speed\n \t    << \" Frame length: \" << d.frame_length\n-\t    << \" Gain: \" << d.analogue_gain\n-\t    << \" Aperture: \" << d.aperture\n-\t    << \" Lens: \" << d.lens_position\n-\t    << \" Flash: \" << d.flash_intensity;\n+\t    << \" Gain: \" << d.analogue_gain;\n+\n+\tif (d.aperture)\n+\t\tout << \" Aperture: \" << *d.aperture;\n+\n+\tif (d.lens_position)\n+\t\tout << \" Lens: \" << *d.lens_position;\n+\n+\tif (d.flash_intensity)\n+\t\tout << \" Flash: \" << *d.flash_intensity;\n \n \tif (d.sensor_temperature)\n \t\tout << \" Temperature: \" << *d.sensor_temperature;\ndiff --git a/src/ipa/raspberrypi/controller/device_status.h b/src/ipa/raspberrypi/controller/device_status.h\nindex eca3bf4b042e..b33f0d093ff3 100644\n--- a/src/ipa/raspberrypi/controller/device_status.h\n+++ b/src/ipa/raspberrypi/controller/device_status.h\n@@ -19,8 +19,7 @@\n struct DeviceStatus {\n \tDeviceStatus()\n \t\t: shutter_speed(std::chrono::seconds(0)), frame_length(0),\n-\t\t  analogue_gain(0.0), lens_position(0.0), aperture(0.0),\n-\t\t  flash_intensity(0.0)\n+\t\t  analogue_gain(0.0)\n \t{\n \t}\n \n@@ -32,11 +31,11 @@ struct DeviceStatus {\n \tuint32_t frame_length;\n \tdouble analogue_gain;\n \t/* 1.0/distance-in-metres, or 0 if unknown */\n-\tdouble lens_position;\n+\tstd::optional<double> lens_position;\n \t/* 1/f so that brightness quadruples when this doubles, or 0 if unknown */\n-\tdouble aperture;\n+\tstd::optional<double> aperture;\n \t/* proportional to brightness with 0 = no flash, 1 = maximum flash */\n-\tdouble flash_intensity;\n+\tstd::optional<double> flash_intensity;\n \t/* Sensor reported temperature value (in degrees) */\n \tstd::optional<double> sensor_temperature;\n };\ndiff --git a/src/ipa/raspberrypi/controller/rpi/lux.cpp b/src/ipa/raspberrypi/controller/rpi/lux.cpp\nindex f77e9140ac10..4d145b6ff0e9 100644\n--- a/src/ipa/raspberrypi/controller/rpi/lux.cpp\n+++ b/src/ipa/raspberrypi/controller/rpi/lux.cpp\n@@ -63,9 +63,7 @@ void Lux::Process(StatisticsPtr &stats, Metadata *image_metadata)\n \tDeviceStatus device_status;\n \tif (image_metadata->Get(\"device.status\", device_status) == 0) {\n \t\tdouble current_gain = device_status.analogue_gain;\n-\t\tdouble current_aperture = device_status.aperture;\n-\t\tif (current_aperture == 0)\n-\t\t\tcurrent_aperture = current_aperture_;\n+\t\tdouble current_aperture = device_status.aperture.value_or(current_aperture_);\n \t\tuint64_t sum = 0;\n \t\tuint32_t num = 0;\n \t\tuint32_t *bin = stats->hist[0].g_hist;\n",
    "prefixes": [
        "libcamera-devel",
        "v4",
        "4/4"
    ]
}