Show a patch.

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

{
    "id": 19112,
    "url": "https://patchwork.libcamera.org/api/1.1/patches/19112/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/19112/",
    "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": "<20231006132000.23504-11-naush@raspberrypi.com>",
    "date": "2023-10-06T13:19:50",
    "name": "[libcamera-devel,10/20] ipa: rpi: Prepare AWB for PiSP support",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "977d92891bc40b4c0b6826882cd8e69d83e579d6",
    "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/19112/mbox/",
    "series": [
        {
            "id": 4047,
            "url": "https://patchwork.libcamera.org/api/1.1/series/4047/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=4047",
            "date": "2023-10-06T13:19:40",
            "name": "Raspberry Pi: Preliminary PiSP support",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/4047/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/19112/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/19112/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 B3CC8C32BC\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri,  6 Oct 2023 13:20:11 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 5BB5762984;\n\tFri,  6 Oct 2023 15:20:11 +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 D69A16296F\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri,  6 Oct 2023 15:20:09 +0200 (CEST)",
            "by mail-wm1-x32e.google.com with SMTP id\n\t5b1f17b1804b1-406609df1a6so19907235e9.3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 06 Oct 2023 06:20:09 -0700 (PDT)",
            "from localhost.localdomain ([93.93.133.154])\n\tby smtp.gmail.com with ESMTPSA id\n\tm8-20020a056000180800b00321773bb933sm1639478wrh.77.2023.10.06.06.20.07\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tFri, 06 Oct 2023 06:20:07 -0700 (PDT)"
        ],
        "DKIM-Signature": [
            "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1696598411;\n\tbh=0ZtfABh258FbGqVnIeOpFRQbTFa6M03BetqktijCdQc=;\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=xMrgbCYdjp8c/fBVdgjBrSTsTEXmQ1icgW7O2XC/SuVXnjmhYQd/fyZChesIU9tWG\n\twR7CrWDsurhuy40C+Nxhj15LvXHWYqoxZXOZGoj62H2LUdVYcknR2ah4/T1qPS2f6z\n\toDE7JLEgMx7eckCVYstk9W+2oUH1JZAieeWbLG6IddloToe96Qg+Zv4N8d7kkMklHC\n\tWzTxzl7KV4xMCa/T79U6IPwxTPsOOQLuSNydA8TW3yUw+bXDy9WSO2RmKwuWVPbO5S\n\t3AANQ1WWIsRdNDsQ3K8mj3M50cBsutuxr2vRw9FAYWiGqR2uMNcj3mphutWVSYK6SI\n\t0nstARljuz7Xw==",
            "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google; t=1696598409; x=1697203209;\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=TDelLhgOpWpnzQB5HzYn4kSIXqsCbLcSZC/V78W+NJ0=;\n\tb=OhINF8/DVKp4/j2JY7qSC31wvZOEtJbyfahhHuTQKsWWMqwxUVx2XqS9kKZ7XOlCA0\n\tAoyZ8jpukMDo/60MvdGkB9Vp5Lzml5RyKeuWcw2zVAQIxnEFnUJgbt9kEG3DGKqGLNsO\n\tgEksUpkWLFO976ZHQlqnpb5uaMyXxsi1bzBLl97F61GixY5ncK4u2cGvHp7mfixJNdTs\n\tZAAdzfNwlccjvoGrGSK8HVmMrC9/FT7fjIJjYD3cGKoX6wTZRL2CTTl6Sjv4mhMtdZtP\n\tR26XG7TM6kLXDGKZnlWEh04wZxO7d+vbHKTJ7wL0Xxbe85wMPhUfF4sN6fQu/juQ07/U\n\tOXzQ=="
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=raspberrypi.com\n\theader.i=@raspberrypi.com\n\theader.b=\"OhINF8/D\"; dkim-atps=neutral",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1696598409; x=1697203209;\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=TDelLhgOpWpnzQB5HzYn4kSIXqsCbLcSZC/V78W+NJ0=;\n\tb=ve9x28WesbxdhOtQV43AD9lpcDkh1sFRPzvdVp2tMTRNtVtytNIoKESKKw6OK9Jhlv\n\tr59W8dd8DETSzoUJfPZJ1ZKsUE6ywhuV252YReQNGmOpx1xbyWH894dPY4vW5E+rHC27\n\tC/SGfXVLIMT613dwjHo9DxD4dd5WzfTUHLZRTF1reXLJ4TWUZ4p9LNjmVl1j6rrEi14N\n\tLKXZZvBCYh5ZAV+DFfhcfX/CV74iF6WNih+7s5n5PVQH9+gKzL3hQwL4REL38d0GDr9z\n\tE8ujHpAiT5APK1hT5Bn1Wi9iotmmWfV69IySQzgjOMW10TzIzaxkfp/JMXldgQ2YQgTF\n\tbrWg==",
        "X-Gm-Message-State": "AOJu0Yz9ugOheLmGIF18U87hgiwOyghcZOzXL0IRqzKQKL/M3Uc+oyOO\n\tlCuTVEQGeJm0zMuUhxbaXa4e2KxCR82tI5OFEGXdcQ==",
        "X-Google-Smtp-Source": "AGHT+IHXAGvX7xx8RyD+227KhqGNxcJ2e2uewsJpXTd7Rt+BGgLy4FMAlbwSEgVQuaN24KUAAtLpUQ==",
        "X-Received": "by 2002:a05:600c:21d0:b0:405:3a3b:2aa2 with SMTP id\n\tx16-20020a05600c21d000b004053a3b2aa2mr7312275wmj.37.1696598408181; \n\tFri, 06 Oct 2023 06:20:08 -0700 (PDT)",
        "To": "libcamera-devel@lists.libcamera.org",
        "Date": "Fri,  6 Oct 2023 14:19:50 +0100",
        "Message-Id": "<20231006132000.23504-11-naush@raspberrypi.com>",
        "X-Mailer": "git-send-email 2.34.1",
        "In-Reply-To": "<20231006132000.23504-1-naush@raspberrypi.com>",
        "References": "<20231006132000.23504-1-naush@raspberrypi.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[libcamera-devel] [PATCH 10/20] ipa: rpi: Prepare AWB for PiSP\n\tsupport",
        "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": "Prepare the AWB algorithm to support the PiSP hardware. The key change\nis to factor in the LS correction in the AWB zone statistics. This is\ndifferent from VC4 where the LS correction happens before statistics\ngathering.\n\nSigned-off-by: Naushir Patuck <naush@raspberrypi.com>\nReviewed-by: David Plowman <david.plowman@raspberrypi.com>\n---\n src/ipa/rpi/controller/rpi/awb.cpp | 29 ++++++++++++++++++++---------\n 1 file changed, 20 insertions(+), 9 deletions(-)",
    "diff": "diff --git a/src/ipa/rpi/controller/rpi/awb.cpp b/src/ipa/rpi/controller/rpi/awb.cpp\nindex ef3435d66106..5ae0c2fad6e9 100644\n--- a/src/ipa/rpi/controller/rpi/awb.cpp\n+++ b/src/ipa/rpi/controller/rpi/awb.cpp\n@@ -12,6 +12,7 @@\n \n #include \"../lux_status.h\"\n \n+#include \"alsc_status.h\"\n #include \"awb.h\"\n \n using namespace RPiController;\n@@ -398,18 +399,28 @@ void Awb::asyncFunc()\n }\n \n static void generateStats(std::vector<Awb::RGB> &zones,\n-\t\t\t  RgbyRegions &stats, double minPixels,\n-\t\t\t  double minG)\n+\t\t\t  StatisticsPtr &stats, double minPixels,\n+\t\t\t  double minG, Metadata &globalMetadata)\n {\n-\tfor (auto const &region : stats) {\n+\tstd::scoped_lock<RPiController::Metadata> l(globalMetadata);\n+\n+\tfor (unsigned int i = 0; i < stats->awbRegions.numRegions(); i++) {\n \t\tAwb::RGB zone;\n+\t\tauto &region = stats->awbRegions.get(i);\n \t\tif (region.counted >= minPixels) {\n \t\t\tzone.G = region.val.gSum / region.counted;\n-\t\t\tif (zone.G >= minG) {\n-\t\t\t\tzone.R = region.val.rSum / region.counted;\n-\t\t\t\tzone.B = region.val.bSum / region.counted;\n-\t\t\t\tzones.push_back(zone);\n+\t\t\tif (zone.G < minG)\n+\t\t\t\tcontinue;\n+\t\t\tzone.R = region.val.rSum / region.counted;\n+\t\t\tzone.B = region.val.bSum / region.counted;\n+\t\t\t/* Factor in the ALSC applied colour shading correction if required. */\n+\t\t\tconst AlscStatus *alscStatus = globalMetadata.getLocked<AlscStatus>(\"alsc.status\");\n+\t\t\tif (stats->colourStatsPos == Statistics::ColourStatsPos::PreLsc && alscStatus) {\n+\t\t\t\tzone.R *= alscStatus->r[i];\n+\t\t\t\tzone.G *= alscStatus->g[i];\n+\t\t\t\tzone.B *= alscStatus->b[i];\n \t\t\t}\n+\t\t\tzones.push_back(zone);\n \t\t}\n \t}\n }\n@@ -421,8 +432,8 @@ void Awb::prepareStats()\n \t * LSC has already been applied to the stats in this pipeline, so stop\n \t * any LSC compensation.  We also ignore config_.fast in this version.\n \t */\n-\tgenerateStats(zones_, statistics_->awbRegions, config_.minPixels,\n-\t\t      config_.minG);\n+\tgenerateStats(zones_, statistics_, config_.minPixels,\n+\t\t      config_.minG, getGlobalMetadata());\n \t/*\n \t * apply sensitivities, so values appear to come from our \"canonical\"\n \t * sensor.\n",
    "prefixes": [
        "libcamera-devel",
        "10/20"
    ]
}