Show a patch.

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

{
    "id": 19166,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/19166/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/19166/",
    "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": "<20231020084002.30665-6-naush@raspberrypi.com>",
    "date": "2023-10-20T08:40:01",
    "name": "[libcamera-devel,v1,5/6] ipa: rpi: agc: Fetch AWB status in the prepare method",
    "commit_ref": "78a2d00c79b22445b5ad0f57dda3947d9bcd005b",
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "134ea6098a92dd2e947a8265956e534302c91553",
    "submitter": {
        "id": 34,
        "url": "https://patchwork.libcamera.org/api/1.1/people/34/?format=api",
        "name": "Naushir Patuck",
        "email": "naush@raspberrypi.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/19166/mbox/",
    "series": [
        {
            "id": 4054,
            "url": "https://patchwork.libcamera.org/api/1.1/series/4054/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=4054",
            "date": "2023-10-20T08:39:56",
            "name": "Raspberry Pi: Preliminary PiSP support (round 2)",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/4054/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/19166/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/19166/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 76C2CC3275\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 20 Oct 2023 08:40:36 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 245E562982;\n\tFri, 20 Oct 2023 10:40:36 +0200 (CEST)",
            "from mail-wr1-x42f.google.com (mail-wr1-x42f.google.com\n\t[IPv6:2a00:1450:4864:20::42f])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 0B26B61DCF\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 20 Oct 2023 10:40:31 +0200 (CEST)",
            "by mail-wr1-x42f.google.com with SMTP id\n\tffacd0b85a97d-32d9b507b00so434590f8f.1\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 20 Oct 2023 01:40:31 -0700 (PDT)",
            "from localhost.localdomain ([93.93.133.154])\n\tby smtp.gmail.com with ESMTPSA id\n\tr3-20020adff103000000b0032d9337e7d1sm1213356wro.11.2023.10.20.01.40.29\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tFri, 20 Oct 2023 01:40:29 -0700 (PDT)"
        ],
        "DKIM-Signature": [
            "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1697791236;\n\tbh=ylFITJcGz25qrF6i5eL+oH9LlPjYqrPKrAPETAxOwoY=;\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=mmEEJo+z6ewRBHi0JUZwfV8VXZgaMGyeY/74dryaTsbe+CXqQh0B3TEWlFKyAUM1y\n\tvxErD839o76px9nKs4rkc0wFTnJEtY+vKjnOY84fyf8ZHCeLKnwmcXMRl869GHUnC7\n\tgxV3Hc9Gs1AoDAR8hGW3Nl7LEeQ9RCD7GQ6+l2hpsIBQnNO6Bwq8oaObb+EPLT7HGi\n\tFXZTvlT7JkYUXXRh75oq+fP/uss5yn2vZlRZQaTL3GuqCgFBmti8d1a4w7jT+KR3V9\n\tJhn74F3cLstoE8S3+K1F55lO/W67RJ4SVrwRUwqYJnRgaEFOS/D6ut2VmQgWcWP7wL\n\tyAfuZ2VTnajFQ==",
            "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google; t=1697791230; x=1698396030;\n\tdarn=lists.libcamera.org; \n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:from:to:cc:subject:date\n\t:message-id:reply-to;\n\tbh=A0D0tXnU990HtWARhVc3XMkpdyaSBOIWYzTRIuhHRcc=;\n\tb=dLUBsBAoKSQq8Fx6SUOG+YYxWPdiJMeOBCSClTvg/fM8BTZs+XSz136CViSFxzIXGU\n\t396Cel1JSljFsKe4KjyyOZLy6gJMQedooZKp9RST4hK6aJ14EP0H1j9MyH0bnVe3HwPS\n\t4E2jIlbObFHRdTX/U6Xv9JSMHlqmp0Evkqx45Km0MSDCWtyOCowpQBScP0ot6B8Q6/pp\n\tSOcGr5Vj0C9az/1L+ngxI6dMciYwwIRYTfh4bja2Og1AXIXpftAuXRlVYonIouT7fsum\n\twTLf1rhneyKB7AWvRyKTYdntFHAhX1edcMwKqj2ejgVvAPf1iMH70CLVVIVzGx9CICF9\n\t5wLg=="
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=raspberrypi.com\n\theader.i=@raspberrypi.com\n\theader.b=\"dLUBsBAo\"; dkim-atps=neutral",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1697791230; x=1698396030;\n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc\n\t:subject:date:message-id:reply-to;\n\tbh=A0D0tXnU990HtWARhVc3XMkpdyaSBOIWYzTRIuhHRcc=;\n\tb=F+jDQWDMvP4wzvksR17ttRo7008ZpvAW5bqF47R7/clrr8YzX4zDPmAFozOf0CetI2\n\ttd/7XZDZnl1RT+f0tv+83p6gxQgnDs1qfiG4zcF4E5A+R8vyMa2oqXhe9b8HngwhPAhj\n\tQrs+eJVkKBKIzAC5qzoW4x33NqJfG6TwNRojiJAw9N0hrN97R6OMY6FtTfeupWv2IX4L\n\tVn4dABuMF7DFHye65EYMI70Mnyz3I2xU1tpwwEdk9ikhuFCUH3/zV+LBAbLxjYpAqcLf\n\trDCo9ayVsVvgVt7APVG+OfqAChdjxqlrhyU0rZNcPbsJoxx1taj9qJh6N4vtieHd2Z14\n\tdePQ==",
        "X-Gm-Message-State": "AOJu0Ywdy0e4HKn+TWGXpljYPukVhnWBFtZz0jVHVmYYpXkEn8BClDYf\n\tpYDK73yTUKVIPCmu5h739Cujb/GQ8z9zfZTsHk95JQ==",
        "X-Google-Smtp-Source": "AGHT+IHNtWK8arF3ev0j4V8har8751+XVA0bwLcUQuP0IBRCh4IRXcvBZSuZt8In9KvWddSnaZeiVA==",
        "X-Received": "by 2002:adf:e5c8:0:b0:32d:6891:f819 with SMTP id\n\ta8-20020adfe5c8000000b0032d6891f819mr937397wrn.41.1697791230448; \n\tFri, 20 Oct 2023 01:40:30 -0700 (PDT)",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Fri, 20 Oct 2023 09:40:01 +0100",
        "Message-Id": "<20231020084002.30665-6-naush@raspberrypi.com>",
        "X-Mailer": "git-send-email 2.34.1",
        "In-Reply-To": "<20231020084002.30665-1-naush@raspberrypi.com>",
        "References": "<20231020084002.30665-1-naush@raspberrypi.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH v1 5/6] ipa: rpi: agc: Fetch AWB status in\n\tthe prepare method",
        "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": "From: David Plowman <david.plowman@raspberrypi.com>\n\nAWB writes this out during prepare, so we may as well read it in AGC\nprepare as well. Reading it in process is wrong on the PiSP platform\nbecause process runs before prepare, so the AWB status won't be there\n(on vc4 it made no difference).\n\nSigned-off-by: David Plowman <david.plowman@raspberrypi.com>\nReviewed-by: Naushir Patuck <naush@raspberrypi.com>\n---\n src/ipa/rpi/controller/rpi/agc_channel.cpp | 15 ++++++++-------\n 1 file changed, 8 insertions(+), 7 deletions(-)",
    "diff": "diff --git a/src/ipa/rpi/controller/rpi/agc_channel.cpp b/src/ipa/rpi/controller/rpi/agc_channel.cpp\nindex 3efb6482b67f..8d374b53689d 100644\n--- a/src/ipa/rpi/controller/rpi/agc_channel.cpp\n+++ b/src/ipa/rpi/controller/rpi/agc_channel.cpp\n@@ -270,7 +270,11 @@ AgcChannel::AgcChannel()\n \t  lastTargetExposure_(0s), ev_(1.0), flickerPeriod_(0s),\n \t  maxShutter_(0s), fixedShutter_(0s), fixedAnalogueGain_(0.0)\n {\n-\tmemset(&awb_, 0, sizeof(awb_));\n+\t/* Set AWB default values in case early frames have no updates in metadata. */\n+\tawb_.gainR = 1.0;\n+\tawb_.gainG = 1.0;\n+\tawb_.gainB = 1.0;\n+\n \t/*\n \t * Setting status_.totalExposureValue_ to zero initially tells us\n \t * it's not been calculated yet (i.e. Process hasn't yet run).\n@@ -409,7 +413,6 @@ void AgcChannel::switchMode(CameraMode const &cameraMode,\n \tDuration fixedShutter = limitShutter(fixedShutter_);\n \tif (fixedShutter && fixedAnalogueGain_) {\n \t\t/* We're going to reset the algorithm here with these fixed values. */\n-\n \t\tfetchAwbStatus(metadata);\n \t\tdouble minColourGain = std::min({ awb_.gainR, awb_.gainG, awb_.gainB, 1.0 });\n \t\tASSERT(minColourGain != 0.0);\n@@ -464,6 +467,9 @@ void AgcChannel::prepare(Metadata *imageMetadata)\n \tAgcStatus delayedStatus;\n \tAgcPrepareStatus prepareStatus;\n \n+\t/* Fetch the AWB status now because AWB also sets it in the prepare method. */\n+\tfetchAwbStatus(imageMetadata);\n+\n \tif (!imageMetadata->get(\"agc.delayed_status\", delayedStatus))\n \t\ttotalExposureValue = delayedStatus.totalExposureValue;\n \n@@ -507,8 +513,6 @@ void AgcChannel::process(StatisticsPtr &stats, DeviceStatus const &deviceStatus,\n \t * configuration, that kind of thing.\n \t */\n \thousekeepConfig();\n-\t/* Fetch the AWB status immediately, so that we can assume it's there. */\n-\tfetchAwbStatus(imageMetadata);\n \t/* Get the current exposure values for the frame that's just arrived. */\n \tfetchCurrentExposure(deviceStatus);\n \t/* Compute the total gain we require relative to the current exposure. */\n@@ -637,9 +641,6 @@ void AgcChannel::fetchCurrentExposure(DeviceStatus const &deviceStatus)\n \n void AgcChannel::fetchAwbStatus(Metadata *imageMetadata)\n {\n-\tawb_.gainR = 1.0; /* in case not found in metadata */\n-\tawb_.gainG = 1.0;\n-\tawb_.gainB = 1.0;\n \tif (imageMetadata->get(\"awb.status\", awb_) != 0)\n \t\tLOG(RPiAgc, Debug) << \"No AWB status found\";\n }\n",
    "prefixes": [
        "libcamera-devel",
        "v1",
        "5/6"
    ]
}