Show a patch.

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

{
    "id": 16366,
    "url": "https://patchwork.libcamera.org/api/patches/16366/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/16366/",
    "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": "<20220624073528.26670-5-naush@raspberrypi.com>",
    "date": "2022-06-24T07:35:28",
    "name": "[libcamera-devel,v2,4/4] ipa: raspberrypi: Use std::optional in DeviceStatus",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "d424de20f081c411308504ae8a73c6068f2f329b",
    "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/16366/mbox/",
    "series": [
        {
            "id": 3217,
            "url": "https://patchwork.libcamera.org/api/series/3217/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3217",
            "date": "2022-06-24T07:35:24",
            "name": "Add SensorTemperature control",
            "version": 2,
            "mbox": "https://patchwork.libcamera.org/series/3217/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/16366/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/16366/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 DD513BD808\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 24 Jun 2022 07:35:38 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 498F46563F;\n\tFri, 24 Jun 2022 09:35:38 +0200 (CEST)",
            "from mail-wm1-x32e.google.com (mail-wm1-x32e.google.com\n\t[IPv6:2a00:1450:4864:20::32e])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 2D72D6563D\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 24 Jun 2022 09:35:34 +0200 (CEST)",
            "by mail-wm1-x32e.google.com with SMTP id\n\tu12-20020a05600c210c00b003a02b16d2b8so1013970wml.2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 24 Jun 2022 00:35:34 -0700 (PDT)",
            "from naush-laptop.localdomain ([93.93.133.154])\n\tby smtp.gmail.com with ESMTPSA id\n\tf13-20020a05600c154d00b0039ee391a024sm6695195wmg.14.2022.06.24.00.35.32\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tFri, 24 Jun 2022 00:35:32 -0700 (PDT)"
        ],
        "DKIM-Signature": [
            "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1656056138;\n\tbh=sDyI8g97X48JdfiwaxJIL/+wnmJROB56cMLoq2m57ds=;\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=DpZ1oidmrhBCPWdH2Q+1rc4PEdmAXrCrR2jSmXj9P4Mv1i7udGouDfQDIiQwkyG21\n\tfPbdhWStAy+GwDhCDCuV4xfMFaUv4KXba7HXEPtawi3pziIx9DPpFaan/IvtdAd9RP\n\tpnZmiMC6LriwerP7LqpjFTPANxE7cp/wucKxt514NxFA2bQo2Lxr6tKp+OGmzO4Zlr\n\touT5/Sf9XbuHWqfA8NGwuLLMLsjma+NJJ/sRZG4xvjIxfdd8FGLb5xpWwCrYzAFaVX\n\tWLT7WM5C6KL8A9m7nNQoLGaI+R+d2YGBzWe/CqpIFGVBnaaavYVPoVMh8XcBu1zHIX\n\tmgNkIrx4BGqVQ==",
            "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=HNrdXmmfeCNlElA1aGia+hElBRScKTSJx9yNux7DNGw=;\n\tb=iHnBBxLRDTDcx+Nj9dfk5oD7jql3ZS+1SjBYVVw7C/AL4hCYYWxZwnhQjDrR2QdeGC\n\tpEphLKW6b30wwsMuAk8GvYy2kShx85ZJ+22adeQbzyuyHv3TXecqlbLhlMNhw1IVPud6\n\t2xOcCDOjAHPRuAsBZdlDHXZUoGdeNSL66RLTFGXZOhcnRSIcg80hLnzIH8Erd6xFZO/7\n\tYXSFaak/WgN4E92wQqxI9fAcHyIKZMbPOxDPv4XqgL1mjS+IrE1knSx9pxEzDltR/EK/\n\tWUpRhDdK/Npr8eOhmiEJhbcNrJP7/QBx7TFhKrw6L3VGuYs+ePx9JZE4D0E+i+V6IW6c\n\tZ75g=="
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=raspberrypi.com\n\theader.i=@raspberrypi.com\n\theader.b=\"iHnBBxLR\"; 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=HNrdXmmfeCNlElA1aGia+hElBRScKTSJx9yNux7DNGw=;\n\tb=ZvTE0+WESr9dmy5Q7ezyqd/TJ+mikjBodh2yDxY+xxhXK2rMRalnPp4KKskZ3oj1Gw\n\tr9TaUjKbDYxNyoPqzuZcw0qc5MKF3sAqpQ/kxuRGIvMqTRV0Sgl1ewgwcFywscOXqdeT\n\tln0xxGmNS3n+RQIdPLhKboa8bHoqnkvkhIZ45SvfuO/le5uUqMLAW/lIAMnPbKEkiUdK\n\t+DV7avPMI40Wdx2rSepNerHB11cQ4dOx/NqygA0V4WPZaJLDo5xY3nSLs2MHsA2kKN3H\n\tsNXV5hpbDrTgA8ssGmUT4e2QsMaz0XYLR81sDLvT1h9wsCTn96ONBCXxnmfJRDP0gePm\n\ttDOw==",
        "X-Gm-Message-State": "AJIora+S0gB8JSyfUNwXLhgHq1VuMgMJNZRoo3u+eT5SWHYZYYpWtiTs\n\tdGJY6En2247eF+0d3mFhbWf0wT4DdOljeOPu",
        "X-Google-Smtp-Source": "AGRyM1u8StVfx0AuyD9UNyTj7SgaNC1zzyd1nXOaHk6TLdTNoteHBMgr3sOYHsU4TqQ+N0LZ9FkjGA==",
        "X-Received": "by 2002:a05:600c:4fd4:b0:3a0:334e:241e with SMTP id\n\to20-20020a05600c4fd400b003a0334e241emr2237363wmq.73.1656056133542; \n\tFri, 24 Jun 2022 00:35:33 -0700 (PDT)",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Fri, 24 Jun 2022 08:35:28 +0100",
        "Message-Id": "<20220624073528.26670-5-naush@raspberrypi.com>",
        "X-Mailer": "git-send-email 2.25.1",
        "In-Reply-To": "<20220624073528.26670-1-naush@raspberrypi.com>",
        "References": "<20220624073528.26670-1-naush@raspberrypi.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v2 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>\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       |  5 ++---\n 3 files changed, 16 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..643fb8fbaac6 100644\n--- a/src/ipa/raspberrypi/controller/rpi/lux.cpp\n+++ b/src/ipa/raspberrypi/controller/rpi/lux.cpp\n@@ -63,9 +63,8 @@ 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 ? *device_status.aperture\n+\t\t\t\t\t\t\t\t : 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",
        "v2",
        "4/4"
    ]
}