Patch Detail
Show a patch.
GET /api/1.1/patches/19378/?format=api
{ "id": 19378, "url": "https://patchwork.libcamera.org/api/1.1/patches/19378/?format=api", "web_url": "https://patchwork.libcamera.org/patch/19378/", "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": "<20240109102547.2762-2-david.plowman@raspberrypi.com>", "date": "2024-01-09T10:25:46", "name": "[libcamera-devel,v4,1/2] ipa: rpi: Implement HDR control", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "ca423f0722a390d8c46450960f7882d29f1a4f52", "submitter": { "id": 42, "url": "https://patchwork.libcamera.org/api/1.1/people/42/?format=api", "name": "David Plowman", "email": "david.plowman@raspberrypi.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/19378/mbox/", "series": [ { "id": 4135, "url": "https://patchwork.libcamera.org/api/1.1/series/4135/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=4135", "date": "2024-01-09T10:25:45", "name": "HDR for Raspberry Pi", "version": 4, "mbox": "https://patchwork.libcamera.org/series/4135/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/19378/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/19378/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 E7C09C3240\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 9 Jan 2024 10:25:55 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id CE2C962B3F;\n\tTue, 9 Jan 2024 11:25:53 +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 DB24F62B32\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 9 Jan 2024 11:25:50 +0100 (CET)", "by mail-wm1-x329.google.com with SMTP id\n\t5b1f17b1804b1-40d604b4b30so21879465e9.1\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 09 Jan 2024 02:25:50 -0800 (PST)", "from pi4-davidp.pitowers.org\n\t([2001:4d4e:300:1f:70fb:d051:958c:e7b3])\n\tby smtp.gmail.com with ESMTPSA id\n\tc15-20020a5d4ccf000000b00336765e9babsm2005086wrt.83.2024.01.09.02.25.49\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tTue, 09 Jan 2024 02:25:49 -0800 (PST)" ], "DKIM-Signature": [ "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1704795953;\n\tbh=sk7VkbU94NQuRCEFYbnRPk9Zsntk86lan3bWahTyVUo=;\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=tIMrSE9yvmwxNcdql+plTOIfC2PKH3sxjLijIN5aQ0sbrDo+U+ZSb/2y4gkW6QSHJ\n\tMxkYY9hv6iq0D+jd0z6jTgAUuCf9tzgloXjB9CCjbucb8j9cHkLKj/V63LT6p+Mzrn\n\t2eDbuM6W342TIAUKwn9sTCOTHCaKV+pX6sZ+kwQBs6o346lZzPCZPg55yOhNbEX8Sw\n\tDaw4QjGeo1rdrMZBRMIvcQAsL5caBickc91K41nzE2GcuIEpMWHjLz+uDko3jGn+rX\n\tPPsHkXsyd150T23o+bKKJGgWK7/VAk0o3wBSHFad52GS/iJciS589lr9B+mslakUYs\n\t8AggHCqzKUu1A==", "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google; t=1704795950; x=1705400750;\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=x8k0NAvoRYRsE3vDJDFTshG7FA7sFPwGxhdu55F3+b8=;\n\tb=lmjErkdq1SaEMUbzTOiiIFdr9RXXLloSfwy7H5Sym0IbvvdsQtnxC/KYc5nAHaBTvY\n\tj3Zr7IInRnT3eSOwlsNd8YyUnA+yJsN4H78BP196Ft7C9B3icPf3nkGPrWX7hUcE/KVS\n\tiF8dBLTtM7TRzql9B3jK1WJDjzJ4CGavJYhJ9ducC1B5yI9t5YHBqMuP6+41fxrSz2uc\n\tMO1ZliwJ6I2d/uw3wtbLdl+ucxJP+zegBswpNNnsqN+DyNeoeFlTVdtlWHjOvoCmK5r2\n\tWwqFvn0dhYRNzSjV6YpspV5qx5wadObMkm7pHA+d2uJ7TYnub2b0qY7qe8HsvwxnaC8/\n\tj13w==" ], "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=raspberrypi.com\n\theader.i=@raspberrypi.com\n\theader.b=\"lmjErkdq\"; dkim-atps=neutral", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1704795950; x=1705400750;\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=x8k0NAvoRYRsE3vDJDFTshG7FA7sFPwGxhdu55F3+b8=;\n\tb=oHPet5AnbXhDbl1gyZBK56xZA2XSOyVmjLy9wIfS4Oaw54k12oaGtXwDyxV2Islm5l\n\tRqK6wnauk4f8p10IWb6ro2M6ySJ914GaRlO5MPxtx9o8SrXt4YjzTBxT2DHhSuQnegR3\n\tJwBvP6vNwYNnDlbvPgvVcWE3dNMGCPLeeU5cb5i+bW762PhBvLhBv7nZaQiEx4hrbV0A\n\tTlyNhFE+nrAoPTxDXKoprTX97Zmbea+fNIJoOcKR5yqHQlOoIut1JZkS2InA74CGSUch\n\tqtY0JF/2z+h6qYHXU2xhNqQXVpln870DhN5vxzC0E6tLJ8kQHgblHC0OeBDaXhfzZ0u2\n\tICZg==", "X-Gm-Message-State": "AOJu0YwiudiIAjRThMoxfIPbWyFxtaCs+sEAvRCCho03XkJdGO86mtno\n\t5mwhsZ50YY37hHtlMnmZhN18pwepvK3DxSMHXeMx6T7FKxk=", "X-Google-Smtp-Source": "AGHT+IE6p80SKaSNKe4VIonS4dfqe9IEVJa68lVKbUrfeyMPTd+F5Cofhua7ej2hi+vbPzCbavO0Lw==", "X-Received": "by 2002:a05:600c:3109:b0:40d:8ed9:ce8c with SMTP id\n\tg9-20020a05600c310900b0040d8ed9ce8cmr301529wmo.120.1704795950144; \n\tTue, 09 Jan 2024 02:25:50 -0800 (PST)", "To": "libcamera-devel@lists.libcamera.org", "Date": "Tue, 9 Jan 2024 10:25:46 +0000", "Message-Id": "<20240109102547.2762-2-david.plowman@raspberrypi.com>", "X-Mailer": "git-send-email 2.30.2", "In-Reply-To": "<20240109102547.2762-1-david.plowman@raspberrypi.com>", "References": "<20240109102547.2762-1-david.plowman@raspberrypi.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH v4 1/2] ipa: rpi: Implement HDR control", "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": "David Plowman via libcamera-devel <libcamera-devel@lists.libcamera.org>", "Reply-To": "David Plowman <david.plowman@raspberrypi.com>", "Errors-To": "libcamera-devel-bounces@lists.libcamera.org", "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>" }, "content": "Sufficient plumbing is added so that the HDR mode control can be used\nto engage HDR modes on platforms that support them. On the vc4\nplatform, this allows multi-channel AGC to run, though there is no\nimage merging.\n\nSigned-off-by: David Plowman <david.plowman@raspberrypi.com>\n---\n src/ipa/rpi/common/ipa_base.cpp | 49 +++++++++++++++++++++++++++++++++\n 1 file changed, 49 insertions(+)", "diff": "diff --git a/src/ipa/rpi/common/ipa_base.cpp b/src/ipa/rpi/common/ipa_base.cpp\nindex 6ec91575..632b8d2f 100644\n--- a/src/ipa/rpi/common/ipa_base.cpp\n+++ b/src/ipa/rpi/common/ipa_base.cpp\n@@ -24,6 +24,8 @@\n #include \"controller/ccm_status.h\"\n #include \"controller/contrast_algorithm.h\"\n #include \"controller/denoise_algorithm.h\"\n+#include \"controller/hdr_algorithm.h\"\n+#include \"controller/hdr_status.h\"\n #include \"controller/lux_status.h\"\n #include \"controller/sharpen_algorithm.h\"\n #include \"controller/statistics.h\"\n@@ -67,6 +69,7 @@ const ControlInfoMap::Map ipaControls{\n \t{ &controls::AeFlickerPeriod, ControlInfo(100, 1000000) },\n \t{ &controls::Brightness, ControlInfo(-1.0f, 1.0f, 0.0f) },\n \t{ &controls::Contrast, ControlInfo(0.0f, 32.0f, 1.0f) },\n+\t{ &controls::HdrMode, ControlInfo(controls::HdrModeValues) },\n \t{ &controls::Sharpness, ControlInfo(0.0f, 16.0f, 1.0f) },\n \t{ &controls::ScalerCrop, ControlInfo(Rectangle{}, Rectangle(65535, 65535, 65535, 65535), Rectangle{}) },\n \t{ &controls::FrameDurationLimits, ControlInfo(INT64_C(33333), INT64_C(120000)) },\n@@ -688,9 +691,17 @@ static const std::map<int32_t, RPiController::AfAlgorithm::AfPause> AfPauseTable\n \t{ controls::AfPauseResume, RPiController::AfAlgorithm::AfPauseResume },\n };\n \n+static const std::map<int32_t, std::string> HdrModeTable = {\n+\t{ controls::HdrModeOff, \"Off\" },\n+\t{ controls::HdrModeMultiExposure, \"MultiExposure\" },\n+\t{ controls::HdrModeSingleExposure, \"SingleExposure\" },\n+};\n+\n void IpaBase::applyControls(const ControlList &controls)\n {\n+\tusing RPiController::AgcAlgorithm;\n \tusing RPiController::AfAlgorithm;\n+\tusing RPiController::HdrAlgorithm;\n \n \t/* Clear the return metadata buffer. */\n \tlibcameraMetadata_.clear();\n@@ -1162,6 +1173,34 @@ void IpaBase::applyControls(const ControlList &controls)\n \t\t\tbreak;\n \t\t}\n \n+\t\tcase controls::HDR_MODE: {\n+\t\t\tHdrAlgorithm *hdr = dynamic_cast<HdrAlgorithm *>(controller_.getAlgorithm(\"hdr\"));\n+\t\t\tif (!hdr) {\n+\t\t\t\tLOG(IPARPI, Warning) << \"No HDR algorithm available\";\n+\t\t\t\tbreak;\n+\t\t\t}\n+\n+\t\t\tauto mode = HdrModeTable.find(ctrl.second.get<int32_t>());\n+\t\t\tif (mode == HdrModeTable.end()) {\n+\t\t\t\tLOG(IPARPI, Warning) << \"Unrecognised HDR mode\";\n+\t\t\t\tbreak;\n+\t\t\t}\n+\n+\t\t\tAgcAlgorithm *agc = dynamic_cast<AgcAlgorithm *>(controller_.getAlgorithm(\"agc\"));\n+\t\t\tif (!agc) {\n+\t\t\t\tLOG(IPARPI, Warning) << \"HDR requires an AGC algorithm\";\n+\t\t\t\tbreak;\n+\t\t\t}\n+\n+\t\t\tif (hdr->setMode(mode->second) == 0)\n+\t\t\t\tagc->setActiveChannels(hdr->getChannels());\n+\t\t\telse\n+\t\t\t\tLOG(IPARPI, Warning)\n+\t\t\t\t\t<< \"HDR mode \" << mode->second << \" not supported\";\n+\n+\t\t\tbreak;\n+\t\t}\n+\n \t\tdefault:\n \t\t\tLOG(IPARPI, Warning)\n \t\t\t\t<< \"Ctrl \" << controls::controls.at(ctrl.first)->name()\n@@ -1309,6 +1348,16 @@ void IpaBase::reportMetadata(unsigned int ipaContext)\n \t\tlibcameraMetadata_.set(controls::AfPauseState, p);\n \t}\n \n+\tconst HdrStatus *hdrStatus = rpiMetadata.getLocked<HdrStatus>(\"hdr.status\");\n+\tif (hdrStatus) {\n+\t\tif (hdrStatus->channel == \"short\")\n+\t\t\tlibcameraMetadata_.set(controls::HdrChannel, controls::HdrChannelShort);\n+\t\telse if (hdrStatus->channel == \"long\")\n+\t\t\tlibcameraMetadata_.set(controls::HdrChannel, controls::HdrChannelLong);\n+\t\telse\n+\t\t\tlibcameraMetadata_.set(controls::HdrChannel, controls::HdrChannelNone);\n+\t}\n+\n \tmetadataReady.emit(libcameraMetadata_);\n }\n \n", "prefixes": [ "libcamera-devel", "v4", "1/2" ] }