Patch Detail
Show a patch.
GET /api/patches/18466/?format=api
{ "id": 18466, "url": "https://patchwork.libcamera.org/api/patches/18466/?format=api", "web_url": "https://patchwork.libcamera.org/patch/18466/", "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": "<20230327093439.24670-3-naush@raspberrypi.com>", "date": "2023-03-27T09:34:37", "name": "[libcamera-devel,v2,2/4] ipa: raspberrypi: Use the new sensor limits fields in CameraMode", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "54a01cbfa685b19d9eedf9a1cd0b998d17ce8d6b", "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/18466/mbox/", "series": [ { "id": 3818, "url": "https://patchwork.libcamera.org/api/series/3818/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3818", "date": "2023-03-27T09:34:35", "name": "Raspberry Pi: Sensor limits", "version": 2, "mbox": "https://patchwork.libcamera.org/series/3818/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/18466/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/18466/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 EC0F9C329C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 27 Mar 2023 09:34:47 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 467D462747;\n\tMon, 27 Mar 2023 11:34:47 +0200 (CEST)", "from mail-io1-xd29.google.com (mail-io1-xd29.google.com\n\t[IPv6:2607:f8b0:4864:20::d29])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id A9FF26271E\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 27 Mar 2023 11:34:44 +0200 (CEST)", "by mail-io1-xd29.google.com with SMTP id z1so3596778iot.11\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 27 Mar 2023 02:34:44 -0700 (PDT)", "from localhost.localdomain ([93.93.133.154])\n\tby smtp.gmail.com with ESMTPSA id\n\td12-20020a056602328c00b0075464a69c10sm7658345ioz.10.2023.03.27.02.34.42\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tMon, 27 Mar 2023 02:34:42 -0700 (PDT)" ], "DKIM-Signature": [ "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1679909687;\n\tbh=JVdfbSnT6OCQKMajmp+DwoRSSQ66yxco/CpyDTl3f1U=;\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=QNtOy+oCB13c8ePw6MtmJyYLn59JaE3b4XJ63bTxggU/QIBSB3oJBnKsGXLe+bC4u\n\tdUe4q9/mVf30esZ/9m99udNjBu6OAKhFSHtfkg318wu83YWAwcH7CNv9ngFgnSuGKZ\n\tXhrVUZS7F18k6x1IcZSvjdc3z62UzfkLrgWz0exeolX35Ohl3IE1oUFvgul86dj07F\n\tT0PzANBpdQej7NCsskYu3/ut4l1xpbIZK2epXrY3MmBMkMNP561cXWlNVS2/nfk9KV\n\t7V9rnrMiC8WRfuBz1v/hQlZD6NtbaYeAeSkvij6V8wVuG+kFrVLp5xLQ3cIDzZDkoJ\n\tdwXs5IGA+F9yg==", "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google; t=1679909683;\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=m0q0eJhd3Kapv18ykdi9paPfoedIk4GLldhtnmYKlLw=;\n\tb=IPuUjmRoiPK11b780NesBgK1nNJ62RWuJse1+FgJDTpcTw49tiw3Kd3SZYc2ocFu81\n\taEQ16y242OeVACxsOVaO6zon6mt/ogvlAzeCZuo6xjpHRxNSH7fToVCxzflk864gpT9I\n\tG3pTPzKtWR3d2oFUnYJNXd/70Gss9x/LisWf5KRgtExZuSe+it4OEvvqPzjlPHky1Mpi\n\t9//3EFpPjKzps9gZATxVET8Cs8kiTR1gagrpp3GlWRsrVIxry7SIhKGyfCq3T0WmziyC\n\tZwFcXEY01rPunlBbQioyD+RI6bTNvAsLBMrVmSMEfX0Q/LkZByf4l0/1HUrLF4yJz7cW\n\tuTaA==" ], "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=raspberrypi.com\n\theader.i=@raspberrypi.com\n\theader.b=\"IPuUjmRo\"; dkim-atps=neutral", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112; t=1679909683;\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=m0q0eJhd3Kapv18ykdi9paPfoedIk4GLldhtnmYKlLw=;\n\tb=5XSrJ43s0HuTJhOGQ8d8Ijpg8U5ca12L2RkIr61jBoYV3K+J5YMVkkCPYPLtoURVgm\n\t1GhVOnX8Zw9itinC5WE8nDhBG8v2wDl2Ha6TApZGHhQAWO8skiyWa7RR9BkNbMalFjG+\n\tfUzAX/BPkPdHBM99ImB4E4k6jNwm1krSbslCvphGLENHQOSFM6zcc17T2bcpnnlp8PfC\n\tsMnrzVVTk8Arl4jrbHG0e9PIflRxdxv1V5wwmQXdiEPs48EKKuwrrTbv6s63d4egjHW2\n\twKDHLroDpak1b1WPdrNHujfwNGwrD3WCg+nZt1SWT9MzIM7c/pcZXaZk8Xcwqw94IIOY\n\tCK0g==", "X-Gm-Message-State": "AO0yUKU2YnQaw3aW8UlttJlex6N7ORA2vx7naXR5kae1A54x0C5BviYv\n\tRDe67O7NEMe4SV0HN5kWLt1/ptuh4X9+lA3RO/VDcg==", "X-Google-Smtp-Source": "AK7set9NMaC5KydlQZa0CUJAZnCKfwMwhiTxfXnMRwrLyvAFQvPgV7MWUoVFIMaUMl0S5RLXVPFxZw==", "X-Received": "by 2002:a6b:d310:0:b0:74c:9cc4:ac0 with SMTP id\n\ts16-20020a6bd310000000b0074c9cc40ac0mr7854459iob.14.1679909683140; \n\tMon, 27 Mar 2023 02:34:43 -0700 (PDT)", "To": "libcamera-devel@lists.libcamera.org", "Date": "Mon, 27 Mar 2023 10:34:37 +0100", "Message-Id": "<20230327093439.24670-3-naush@raspberrypi.com>", "X-Mailer": "git-send-email 2.34.1", "In-Reply-To": "<20230327093439.24670-1-naush@raspberrypi.com>", "References": "<20230327093439.24670-1-naush@raspberrypi.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH v2 2/4] ipa: raspberrypi: Use the new\n\tsensor limits fields in CameraMode", "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": "Use the new analogue gain and shutter speed limit fields in the ipa\ncode when reporting back the control value limits and calculating the\nanalogue gain code to use. This also replaces the now unused (and\nremoved) maxSensorGainCode_ field.\n\nSigned-off-by: Naushir Patuck <naush@raspberrypi.com>\n---\n src/ipa/raspberrypi/raspberrypi.cpp | 37 +++++++++--------------------\n 1 file changed, 11 insertions(+), 26 deletions(-)", "diff": "diff --git a/src/ipa/raspberrypi/raspberrypi.cpp b/src/ipa/raspberrypi/raspberrypi.cpp\nindex 3f1afb846420..c10e57e07ab0 100644\n--- a/src/ipa/raspberrypi/raspberrypi.cpp\n+++ b/src/ipa/raspberrypi/raspberrypi.cpp\n@@ -224,9 +224,6 @@ private:\n \tDuration minFrameDuration_;\n \tDuration maxFrameDuration_;\n \n-\t/* Maximum gain code for the sensor. */\n-\tuint32_t maxSensorGainCode_;\n-\n \t/* Track the frame length times over FrameLengthsQueueSize frames. */\n \tstd::deque<Duration> frameLengths_;\n \tDuration lastTimeout_;\n@@ -455,8 +452,6 @@ int IPARPi::configure(const IPACameraSensorInfo &sensorInfo, const IPAConfig &ip\n \t\t}\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@@ -517,26 +512,17 @@ int IPARPi::configure(const IPACameraSensorInfo &sensorInfo, const IPAConfig &ip\n \t * based on the current sensor mode.\n \t */\n \tControlInfoMap::Map ctrlMap = ipaControls;\n-\tconst Duration minSensorFrameDuration = mode_.minFrameLength * mode_.minLineLength;\n-\tconst Duration maxSensorFrameDuration = mode_.maxFrameLength * mode_.maxLineLength;\n \tctrlMap[&controls::FrameDurationLimits] =\n-\t\tControlInfo(static_cast<int64_t>(minSensorFrameDuration.get<std::micro>()),\n-\t\t\t static_cast<int64_t>(maxSensorFrameDuration.get<std::micro>()));\n+\t\tControlInfo(static_cast<int64_t>(mode_.minFrameDuration.get<std::micro>()),\n+\t\t\t static_cast<int64_t>(mode_.maxFrameDuration.get<std::micro>()));\n \n \tctrlMap[&controls::AnalogueGain] =\n-\t\tControlInfo(1.0f, static_cast<float>(helper_->gain(maxSensorGainCode_)));\n-\n-\t/*\n-\t * Calculate the max exposure limit from the frame duration limit as V4L2\n-\t * will limit the maximum control value based on the current VBLANK value.\n-\t */\n-\tDuration maxShutter = Duration::max();\n-\thelper_->getBlanking(maxShutter, minSensorFrameDuration, maxSensorFrameDuration);\n-\tconst uint32_t exposureMin = sensorCtrls_.at(V4L2_CID_EXPOSURE).min().get<int32_t>();\n+\t\tControlInfo(static_cast<float>(mode_.minAnalogueGain),\n+\t\t\t static_cast<float>(mode_.maxAnalogueGain));\n \n \tctrlMap[&controls::ExposureTime] =\n-\t\tControlInfo(static_cast<int32_t>(helper_->exposure(exposureMin, mode_.minLineLength).get<std::micro>()),\n-\t\t\t static_cast<int32_t>(maxShutter.get<std::micro>()));\n+\t\tControlInfo(static_cast<int32_t>(mode_.minShutter.get<std::micro>()),\n+\t\t\t static_cast<int32_t>(mode_.maxShutter.get<std::micro>()));\n \n \t/* Declare Autofocus controls, only if we have a controllable lens */\n \tif (lensPresent_)\n@@ -1496,9 +1482,6 @@ void IPARPi::applyAWB(const struct AwbStatus *awbStatus, ControlList &ctrls)\n \n void IPARPi::applyFrameDurations(Duration minFrameDuration, Duration maxFrameDuration)\n {\n-\tconst Duration minSensorFrameDuration = mode_.minFrameLength * mode_.minLineLength;\n-\tconst Duration maxSensorFrameDuration = mode_.maxFrameLength * mode_.maxLineLength;\n-\n \t/*\n \t * This will only be applied once AGC recalculations occur.\n \t * The values may be clamped based on the sensor mode capabilities as well.\n@@ -1506,9 +1489,9 @@ void IPARPi::applyFrameDurations(Duration minFrameDuration, Duration maxFrameDur\n \tminFrameDuration_ = minFrameDuration ? minFrameDuration : defaultMaxFrameDuration;\n \tmaxFrameDuration_ = maxFrameDuration ? maxFrameDuration : defaultMinFrameDuration;\n \tminFrameDuration_ = std::clamp(minFrameDuration_,\n-\t\t\t\t minSensorFrameDuration, maxSensorFrameDuration);\n+\t\t\t\t mode_.minFrameDuration, mode_.maxFrameDuration);\n \tmaxFrameDuration_ = std::clamp(maxFrameDuration_,\n-\t\t\t\t minSensorFrameDuration, maxSensorFrameDuration);\n+\t\t\t\t mode_.minFrameDuration, mode_.maxFrameDuration);\n \tmaxFrameDuration_ = std::max(maxFrameDuration_, minFrameDuration_);\n \n \t/* Return the validated limits via metadata. */\n@@ -1531,6 +1514,8 @@ void IPARPi::applyFrameDurations(Duration minFrameDuration, Duration maxFrameDur\n \n void IPARPi::applyAGC(const struct AgcStatus *agcStatus, ControlList &ctrls)\n {\n+\tconst int32_t minGainCode = helper_->gainCode(mode_.minAnalogueGain);\n+\tconst int32_t maxGainCode = helper_->gainCode(mode_.maxAnalogueGain);\n \tint32_t gainCode = helper_->gainCode(agcStatus->analogueGain);\n \n \t/*\n@@ -1538,7 +1523,7 @@ void IPARPi::applyAGC(const struct AgcStatus *agcStatus, ControlList &ctrls)\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+\tgainCode = std::clamp<int32_t>(gainCode, minGainCode, maxGainCode);\n \n \t/* getBlanking might clip exposure time to the fps limits. */\n \tDuration exposure = agcStatus->shutterTime;\n", "prefixes": [ "libcamera-devel", "v2", "2/4" ] }