Patch Detail
Show a patch.
GET /api/patches/10433/?format=api
{ "id": 10433, "url": "https://patchwork.libcamera.org/api/patches/10433/?format=api", "web_url": "https://patchwork.libcamera.org/patch/10433/", "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": "<20201116164918.2055-5-david.plowman@raspberrypi.com>", "date": "2020-11-16T16:49:12", "name": "[libcamera-devel,04/10] libcamera: ipa: raspberrypi: agc: Improve centre-weighted luminance calucation", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "27eee47def51ccd8e6048b799aa8d86b00597cb0", "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/10433/mbox/", "series": [ { "id": 1464, "url": "https://patchwork.libcamera.org/api/series/1464/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=1464", "date": "2020-11-16T16:49:08", "name": "Raspberry Pi AGC", "version": 1, "mbox": "https://patchwork.libcamera.org/series/1464/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/10433/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/10433/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 73F11BE082\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 16 Nov 2020 16:49:30 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 347DB632DB;\n\tMon, 16 Nov 2020 17:49:30 +0100 (CET)", "from mail-wm1-x329.google.com (mail-wm1-x329.google.com\n\t[IPv6:2a00:1450:4864:20::329])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 99E0D632CA\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 16 Nov 2020 17:49:28 +0100 (CET)", "by mail-wm1-x329.google.com with SMTP id d142so24363792wmd.4\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 16 Nov 2020 08:49:28 -0800 (PST)", "from pi4-davidp.lan (plowpeople3.plus.com. [80.229.223.72])\n\tby smtp.gmail.com with ESMTPSA id\n\tq16sm23716973wrn.13.2020.11.16.08.49.27\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tMon, 16 Nov 2020 08:49:27 -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=\"XsgOcAoZ\"; 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=FX6HZ/72E1uEy6eG+0sP6T7FgtQ8d+tG9LreXqCwQJA=;\n\tb=XsgOcAoZ9Zhw30bzQUzHkrWo4WxJWpZh0YHGZbxZDlDfe7WuC3wYRZtFumySiOkz1z\n\t1l6yHgzLiTTKvgmxOX1fBa633xlNYdLrHi3FcfHPFAZiitvNr8/0HW1OU/CqwIr/qE/g\n\tpTV2s1mF3jJ7+15NEbWEi6E9BHvg/bbRj6wqrFKiqolEufz7Jn6Qqr1NlADj1FX8dB67\n\ta6aJTUUFQHuZKo3epS5676sXzKJVRQAvuRQlsRTwK560ERCsRjUOgI8MhOwVp1q/bCHx\n\taywGZN4XKdjChuFy4iUw67MDqzCROCT7m9hf4+nZv8nleNS/QuQIEcrsHARZwDdCptf4\n\tOj0A==", "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=FX6HZ/72E1uEy6eG+0sP6T7FgtQ8d+tG9LreXqCwQJA=;\n\tb=c34JGJAQdHdiTXo4ou869UMlew+y2HDhfRRKJWOyehWeHiBSe9ks9rcrTxOZR6cmjG\n\tiCRVzO/cqO+Hs1gasfKH3VVejxWot1oc+o5N0oefSMk4R/Kd7ITEwCfv3071JiEfRScW\n\t4VkngxEHfSMQJo/cv7UEpjdHjsIuvT306CIvjZzDB9YjNBdiLeNafmR+HSFjRfahpHPF\n\taxJ3GqK9zVm5fiEPRcxFuILHQ6IXmOlXGWqCIH12ol+DAnmcZ1kJhZWwhKE9hZQsNn9k\n\tJI24HW3iiktbxRoxHl3KjWruK3B/IYK4NYCSglU4AXnTFTnclOe/UBBctobKZsNlSpJQ\n\tTiWQ==", "X-Gm-Message-State": "AOAM533zokIk32jOqNIaT417sMNoC0lluhrL12RmppIfvhnjwOqEEVIj\n\tXsaLMHNZlNCCiXszDXnCL5/SP89IgF80QQ==", "X-Google-Smtp-Source": "ABdhPJzYCQu+19OTMC4l0xpWn9ykV9KHJJ9Vq1j/BP2TxpVcayNJjJS//mQ2L0/QhaSuWYRz/MnuVw==", "X-Received": "by 2002:a1c:7c02:: with SMTP id x2mr12803544wmc.64.1605545368018;\n\tMon, 16 Nov 2020 08:49:28 -0800 (PST)", "From": "David Plowman <david.plowman@raspberrypi.com>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Mon, 16 Nov 2020 16:49:12 +0000", "Message-Id": "<20201116164918.2055-5-david.plowman@raspberrypi.com>", "X-Mailer": "git-send-email 2.20.1", "In-Reply-To": "<20201116164918.2055-1-david.plowman@raspberrypi.com>", "References": "<20201116164918.2055-1-david.plowman@raspberrypi.com>", "MIME-Version": "1.0", "Subject": "[libcamera-devel] [PATCH 04/10] libcamera: ipa: raspberrypi: agc:\n\tImprove centre-weighted luminance calucation", "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": "Previously the calculation computed Y for each region before returning\nthe weighted average, which \"baked in\" the over-importance of small\nstatistics regions. The revised calculation will treat all pixels\nequally when the region weights are the same, making it easier to\nuse. With the previous scheme, proper \"average\" metering was difficult\nto implement.\n\nSigned-off-by: David Plowman <david.plowman@raspberrypi.com>\n---\n src/ipa/raspberrypi/controller/rpi/agc.cpp | 25 +++++++++++++---------\n 1 file changed, 15 insertions(+), 10 deletions(-)", "diff": "diff --git a/src/ipa/raspberrypi/controller/rpi/agc.cpp b/src/ipa/raspberrypi/controller/rpi/agc.cpp\nindex d29b1156..ead28398 100644\n--- a/src/ipa/raspberrypi/controller/rpi/agc.cpp\n+++ b/src/ipa/raspberrypi/controller/rpi/agc.cpp\n@@ -386,18 +386,23 @@ static double compute_initial_Y(bcm2835_isp_stats *stats, Metadata *image_metada\n \tawb.gain_r = awb.gain_g = awb.gain_b = 1.0; // in case no metadata\n \tif (image_metadata->Get(\"awb.status\", awb) != 0)\n \t\tLOG(RPiAgc, Warning) << \"Agc: no AWB status found\";\n-\tdouble Y_sum = 0, weight_sum = 0;\n+\t// Note how the calculation below means that equal weights give you\n+\t// \"average\" metering (i.e. all pixels equally important).\n+\tdouble R_sum = 0, G_sum = 0, B_sum = 0, pixel_sum = 0;\n \tfor (int i = 0; i < AGC_STATS_SIZE; i++) {\n-\t\tif (regions[i].counted == 0)\n-\t\t\tcontinue;\n-\t\tweight_sum += weights[i];\n-\t\tdouble Y = regions[i].r_sum * awb.gain_r * .299 +\n-\t\t\t regions[i].g_sum * awb.gain_g * .587 +\n-\t\t\t regions[i].b_sum * awb.gain_b * .114;\n-\t\tY /= regions[i].counted;\n-\t\tY_sum += Y * weights[i];\n+\t\tR_sum += regions[i].r_sum * weights[i];\n+\t\tG_sum += regions[i].g_sum * weights[i];\n+\t\tB_sum += regions[i].b_sum * weights[i];\n+\t\tpixel_sum += regions[i].counted * weights[i];\n \t}\n-\treturn Y_sum / weight_sum / (1 << PIPELINE_BITS);\n+\tif (pixel_sum == 0.0) {\n+\t\tLOG(RPiAgc, Warning) << \"compute_initial_Y: pixel_sum is zero\";\n+\t\treturn 0;\n+\t}\n+\tdouble Y_sum = R_sum * awb.gain_r * .299 +\n+\t\t G_sum * awb.gain_g * .587 +\n+\t\t B_sum * awb.gain_b * .114;\n+\treturn Y_sum / pixel_sum / (1 << PIPELINE_BITS);\n }\n \n // We handle extra gain through EV by adjusting our Y targets. However, you\n", "prefixes": [ "libcamera-devel", "04/10" ] }