Patch Detail
Show a patch.
GET /api/1.1/patches/15293/?format=api
{ "id": 15293, "url": "https://patchwork.libcamera.org/api/1.1/patches/15293/?format=api", "web_url": "https://patchwork.libcamera.org/patch/15293/", "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": "<20220124103107.1799464-1-naush@raspberrypi.com>", "date": "2022-01-24T10:31:06", "name": "[libcamera-devel,v1,1/2] ipa: raspberrypi: Limit the maximum sensor gain used", "commit_ref": "e875503bc4a40e5043fb045942535b865692ff60", "pull_url": null, "state": "accepted", "archived": false, "hash": "ebe6b9f54c574f0721fc32b27f3972b34a171012", "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/15293/mbox/", "series": [ { "id": 2901, "url": "https://patchwork.libcamera.org/api/1.1/series/2901/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=2901", "date": "2022-01-24T10:31:06", "name": "[libcamera-devel,v1,1/2] ipa: raspberrypi: Limit the maximum sensor gain used", "version": 1, "mbox": "https://patchwork.libcamera.org/series/2901/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/15293/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/15293/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 260C4BF415\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 24 Jan 2022 10:31:13 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 7E9CB60987;\n\tMon, 24 Jan 2022 11:31:12 +0100 (CET)", "from mail-wm1-x334.google.com (mail-wm1-x334.google.com\n\t[IPv6:2a00:1450:4864:20::334])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id A477E60215\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 24 Jan 2022 11:31:10 +0100 (CET)", "by mail-wm1-x334.google.com with SMTP id\n\to30-20020a05600c511e00b0034f4c3186f4so2758072wms.3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 24 Jan 2022 02:31:10 -0800 (PST)", "from naush-laptop.pitowers.org\n\t([2a00:1098:3142:14:d877:8ca4:c9e0:6bb7])\n\tby smtp.gmail.com with ESMTPSA id\n\tx6sm16285480wrn.18.2022.01.24.02.31.09\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tMon, 24 Jan 2022 02:31:09 -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=\"BYPFnPwK\"; 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:mime-version\n\t:content-transfer-encoding;\n\tbh=lUd6MuJ460zqOHLslCR49u36QMbLyzBHDCNTLUdvVHI=;\n\tb=BYPFnPwKVb6HGczlyYU9Jawy3UFyKFAg6XnVONMyG3S5PuxILSbRAkkHQpJGYF+79f\n\tKO1Wss4iM0I+AUtTRZ98tD84BIyuACQEIkKtlvQ5zh93zmSHRlGVfs6xVNlS9RVG59eb\n\tlciRs+B1cMmkBoT01OInAfkMgfg08bAYdIpCbTaduglioTgDvYI28R4/lzvku91cIEbu\n\tN8o1ZjBP/0GOKL6b7mjd6FaF18bH7C92e0+9LX06tQ7iPFefzndtyeL0ybF0pxKGL/7D\n\tOcNJ/BLf5Rb8x8gCygChn/L3ejDPr0gjt9DFNO8tqxc3gFFwo81M5F291FhmRZlk+X9R\n\t2HXg==", "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:mime-version\n\t:content-transfer-encoding;\n\tbh=lUd6MuJ460zqOHLslCR49u36QMbLyzBHDCNTLUdvVHI=;\n\tb=IcU7vOOYjlESaZanY/sZWm07IBfkvLXfqgdoQJ6CcaIa94YZP0xvmuFW2pYpEYq13y\n\t2MOkCt7M1p8xUIlNnxFI89oiOvyXx0rfIiFLrXKZJ5mqbOsotj02MZutIwW/gyW95uxh\n\twtYKLAWq8VFGPrVEvPsi+faLwMfiLhAopT8pBkUs2IkK0DycGDbUaY5qAgGNCB2Sh9Q6\n\tFGB3gCcdoIw1kPuhj8EcUjBZ9tui6u1eeRb2oOiwLJrcypsj//It6oP+09g9s0HXQgre\n\tEPd4Uj6IrCOzA08Ep8ekzqxKFEOCR8IuAW5LOWNboEGZYtwX40xQJ+vExLzWfVSIrU+y\n\tncDA==", "X-Gm-Message-State": "AOAM531VYrSNYkiWdD8vs15WHnRe9hkD0mE1pPVsdd4vBsMUYPZvq6v5\n\tDaSQJTx2pIoauQ3fYqYG8yXjzwZkUHRX+A==", "X-Google-Smtp-Source": "ABdhPJyCTl3EVdeqyQru6Ea2BSbBAlnmgzEsQqvEqMbyQcJmBFkTwlvmJJFiFWSy2JmunIsvURc25w==", "X-Received": "by 2002:a05:600c:3391:: with SMTP id\n\to17mr1206309wmp.156.1643020270048; \n\tMon, 24 Jan 2022 02:31:10 -0800 (PST)", "From": "Naushir Patuck <naush@raspberrypi.com>", "To": "libcamera-devel@lists.libcamera.org", "Date": "Mon, 24 Jan 2022 10:31:06 +0000", "Message-Id": "<20220124103107.1799464-1-naush@raspberrypi.com>", "X-Mailer": "git-send-email 2.25.1", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH v1 1/2] ipa: raspberrypi: Limit the\n\tmaximum sensor gain used", "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>", "Errors-To": "libcamera-devel-bounces@lists.libcamera.org", "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>" }, "content": "Limit the gain code to the maximum value reported by the sensor controls when\nsending to DelayedControls. The AGC algorithm will handle a lower gain used by\nthe sensor, provided provided it knows the actual gain used. This change ensures\nthat DelayedControls will never report an unclipped gain used.\n\nSigned-off-by: Naushir Patuck <naush@raspberrypi.com>\n---\n src/ipa/raspberrypi/raspberrypi.cpp | 12 ++++++++++++\n 1 file changed, 12 insertions(+)", "diff": "diff --git a/src/ipa/raspberrypi/raspberrypi.cpp b/src/ipa/raspberrypi/raspberrypi.cpp\nindex 0ed41385018a..a72d516f84ee 100644\n--- a/src/ipa/raspberrypi/raspberrypi.cpp\n+++ b/src/ipa/raspberrypi/raspberrypi.cpp\n@@ -173,6 +173,9 @@ private:\n \t/* Frame duration (1/fps) limits. */\n \tDuration minFrameDuration_;\n \tDuration maxFrameDuration_;\n+\n+\t/* Maximum gain code for the sensor. */\n+\tuint32_t maxSensorGainCode_;\n };\n \n int IPARPi::init(const IPASettings &settings, ipa::RPi::SensorConfig *sensorConfig)\n@@ -357,6 +360,8 @@ int IPARPi::configure(const IPACameraSensorInfo &sensorInfo,\n \t\treturn -1;\n \t}\n \n+\tmaxSensorGainCode_ = sensorCtrls_.at(V4L2_CID_ANALOGUE_GAIN).max().get<int32_t>();\n+\n \t/* Setup a metadata ControlList to output metadata. */\n \tlibcameraMetadata_ = ControlList(controls::controls);\n \n@@ -1113,6 +1118,13 @@ void IPARPi::applyAGC(const struct AgcStatus *agcStatus, ControlList &ctrls)\n {\n \tint32_t gainCode = helper_->GainCode(agcStatus->analogue_gain);\n \n+\t/*\n+\t * Ensure anything larger than the max gain code will not be passed to\n+\t * DelayedControls. The AGC will correctly handle a lower gain returned\n+\t * by the sensor, provided it knows the actual gain used.\n+\t */\n+\tgainCode = std::min<int32_t>(gainCode, maxSensorGainCode_);\n+\n \t/* GetVBlanking might clip exposure time to the fps limits. */\n \tDuration exposure = agcStatus->shutter_time;\n \tint32_t vblanking = helper_->GetVBlanking(exposure, minFrameDuration_, maxFrameDuration_);\n", "prefixes": [ "libcamera-devel", "v1", "1/2" ] }