Patch Detail
Show a patch.
GET /api/patches/17856/?format=api
{ "id": 17856, "url": "https://patchwork.libcamera.org/api/patches/17856/?format=api", "web_url": "https://patchwork.libcamera.org/patch/17856/", "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": "<20221124025133.17875-6-laurent.pinchart@ideasonboard.com>", "date": "2022-11-24T02:51:29", "name": "[libcamera-devel,v4,5/9] ipa: rkisp1: agc: Support raw capture", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "477205555add34a661c71d090a81d22d6d763680", "submitter": { "id": 2, "url": "https://patchwork.libcamera.org/api/people/2/?format=api", "name": "Laurent Pinchart", "email": "laurent.pinchart@ideasonboard.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/17856/mbox/", "series": [ { "id": 3634, "url": "https://patchwork.libcamera.org/api/series/3634/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3634", "date": "2022-11-24T02:51:24", "name": "Add Bayer format support for RkISP1", "version": 4, "mbox": "https://patchwork.libcamera.org/series/3634/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/17856/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/17856/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 B31B7BDE6B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 24 Nov 2022 02:52:00 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 5FBFF6332C;\n\tThu, 24 Nov 2022 03:52:00 +0100 (CET)", "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 3762B63325\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 24 Nov 2022 03:51:57 +0100 (CET)", "from pendragon.ideasonboard.com (62-78-145-57.bb.dnainternet.fi\n\t[62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id AEA3A496\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 24 Nov 2022 03:51:56 +0100 (CET)" ], "DKIM-Signature": [ "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1669258320;\n\tbh=hR1H2XvPxMz/AJJBPZvPmizY8AIaDb20Qff5SjK4wkM=;\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=nzdnS980dXPpf3/M/P529KG8nDem98AcgXJKRaunFx491HQd3DMbOi6vGxW0xRrza\n\tNG0K0WMx7ulMpweCWcVwIkst/6aLLMrQZiGEF5xNGs5Cd+ODyHW6lRCTRZ4TcLQ79+\n\tHLa5O+5nxo8qjT0AhSfBbR0F8+zAT4evOSE6nnC7WbdmAaGKAzlXvy5eddDwrsFbeW\n\tTDl+VfXEU7Fak/9btjxpi+bBjjT2M21NRVfWgGo2p0T1JKA2rpQvVvD6d3MQl4MQ5D\n\tE2CRCwmAK4CDrqq+okqihTsPkBgn4ak7ecFJwMobKBkXFztoRRimsAT9rNUQ6nNKeS\n\tFF3g/823MZK1Q==", "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1669258316;\n\tbh=hR1H2XvPxMz/AJJBPZvPmizY8AIaDb20Qff5SjK4wkM=;\n\th=From:To:Subject:Date:In-Reply-To:References:From;\n\tb=O+M5r1HxTPR/dG6umaMUgvun92sd6gYX0yPI7kXWn7fN+K7YMtT1yn93tSRRVGNfK\n\tEc/ecEN5a34xs4f+DustC8IMZHUO12k8UQ6TXgvIHZ9CyKm5AYEG71vQlWwIr34yT4\n\tzkx+AWaqHplO1nX7oWN+KmLgdWtFVIDChc+EVFxQ=" ], "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"O+M5r1Hx\"; dkim-atps=neutral", "To": "libcamera-devel@lists.libcamera.org", "Date": "Thu, 24 Nov 2022 04:51:29 +0200", "Message-Id": "<20221124025133.17875-6-laurent.pinchart@ideasonboard.com>", "X-Mailer": "git-send-email 2.37.4", "In-Reply-To": "<20221124025133.17875-1-laurent.pinchart@ideasonboard.com>", "References": "<20221124025133.17875-1-laurent.pinchart@ideasonboard.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH v4 5/9] ipa: rkisp1: agc: Support raw\n\tcapture", "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": "Laurent Pinchart via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>", "Reply-To": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>", "Errors-To": "libcamera-devel-bounces@lists.libcamera.org", "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>" }, "content": "Support raw capture by allowing manual control of the exposure time and\nanalogue gain.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\nReviewed-by: Paul Elder <paul.elder@ideasonboard.com>\n---\nChanges since v3:\n\n- Drop unneeded params null check\n---\n src/ipa/rkisp1/algorithms/agc.cpp | 49 ++++++++++++++++++++-----------\n src/ipa/rkisp1/algorithms/agc.h | 2 ++\n 2 files changed, 34 insertions(+), 17 deletions(-)", "diff": "diff --git a/src/ipa/rkisp1/algorithms/agc.cpp b/src/ipa/rkisp1/algorithms/agc.cpp\nindex ccbcd4a9583d..6bf92743f4cf 100644\n--- a/src/ipa/rkisp1/algorithms/agc.cpp\n+++ b/src/ipa/rkisp1/algorithms/agc.cpp\n@@ -62,6 +62,7 @@ static constexpr double kRelativeLuminanceTarget = 0.4;\n Agc::Agc()\n \t: frameCount_(0), numCells_(0), numHistBins_(0), filteredExposure_(0s)\n {\n+\tsupportsRaw_ = true;\n }\n \n /**\n@@ -81,7 +82,7 @@ int Agc::configure(IPAContext &context, const IPACameraSensorInfo &configInfo)\n \t\t10ms / context.configuration.sensor.lineDuration;\n \tcontext.activeState.agc.manual.gain = context.activeState.agc.automatic.gain;\n \tcontext.activeState.agc.manual.exposure = context.activeState.agc.automatic.exposure;\n-\tcontext.activeState.agc.autoEnabled = true;\n+\tcontext.activeState.agc.autoEnabled = !context.configuration.raw;\n \n \t/*\n \t * According to the RkISP1 documentation:\n@@ -123,12 +124,15 @@ void Agc::queueRequest(IPAContext &context,\n {\n \tauto &agc = context.activeState.agc;\n \n-\tconst auto &agcEnable = controls.get(controls::AeEnable);\n-\tif (agcEnable && *agcEnable != agc.autoEnabled) {\n-\t\tagc.autoEnabled = *agcEnable;\n+\tif (!context.configuration.raw) {\n+\t\tconst auto &agcEnable = controls.get(controls::AeEnable);\n+\t\tif (agcEnable && *agcEnable != agc.autoEnabled) {\n+\t\t\tagc.autoEnabled = *agcEnable;\n \n-\t\tLOG(RkISP1Agc, Debug)\n-\t\t\t<< (agc.autoEnabled ? \"Enabling\" : \"Disabling\") << \" AGC\";\n+\t\t\tLOG(RkISP1Agc, Debug)\n+\t\t\t\t<< (agc.autoEnabled ? \"Enabling\" : \"Disabling\")\n+\t\t\t\t<< \" AGC\";\n+\t\t}\n \t}\n \n \tconst auto &exposure = controls.get(controls::ExposureTime);\n@@ -368,6 +372,22 @@ double Agc::measureBrightness(const rkisp1_cif_isp_hist_stat *hist) const\n \treturn histogram.interQuantileMean(0.98, 1.0);\n }\n \n+void Agc::fillMetadata(IPAContext &context, IPAFrameContext &frameContext,\n+\t\t ControlList &metadata)\n+{\n+\tutils::Duration exposureTime = context.configuration.sensor.lineDuration\n+\t\t\t\t * frameContext.sensor.exposure;\n+\tmetadata.set(controls::AnalogueGain, frameContext.sensor.gain);\n+\tmetadata.set(controls::ExposureTime, exposureTime.get<std::micro>());\n+\n+\t/* \\todo Use VBlank value calculated from each frame exposure. */\n+\tuint32_t vTotal = context.configuration.sensor.size.height\n+\t\t\t+ context.configuration.sensor.defVBlank;\n+\tutils::Duration frameDuration = context.configuration.sensor.lineDuration\n+\t\t\t\t * vTotal;\n+\tmetadata.set(controls::FrameDuration, frameDuration.get<std::micro>());\n+}\n+\n /**\n * \\brief Process RkISP1 statistics, and run AGC operations\n * \\param[in] context The shared IPA context\n@@ -383,6 +403,11 @@ void Agc::process(IPAContext &context, [[maybe_unused]] const uint32_t frame,\n \t\t IPAFrameContext &frameContext, const rkisp1_stat_buffer *stats,\n \t\t ControlList &metadata)\n {\n+\tif (!stats) {\n+\t\tfillMetadata(context, frameContext, metadata);\n+\t\treturn;\n+\t}\n+\n \t/*\n \t * \\todo Verify that the exposure and gain applied by the sensor for\n \t * this frame match what has been requested. This isn't a hard\n@@ -425,17 +450,7 @@ void Agc::process(IPAContext &context, [[maybe_unused]] const uint32_t frame,\n \tcomputeExposure(context, frameContext, yGain, iqMeanGain);\n \tframeCount_++;\n \n-\tutils::Duration exposureTime = context.configuration.sensor.lineDuration\n-\t\t\t\t * frameContext.sensor.exposure;\n-\tmetadata.set(controls::AnalogueGain, frameContext.sensor.gain);\n-\tmetadata.set(controls::ExposureTime, exposureTime.get<std::micro>());\n-\n-\t/* \\todo Use VBlank value calculated from each frame exposure. */\n-\tuint32_t vTotal = context.configuration.sensor.size.height\n-\t\t\t+ context.configuration.sensor.defVBlank;\n-\tutils::Duration frameDuration = context.configuration.sensor.lineDuration\n-\t\t\t\t * vTotal;\n-\tmetadata.set(controls::FrameDuration, frameDuration.get<std::micro>());\n+\tfillMetadata(context, frameContext, metadata);\n }\n \n REGISTER_IPA_ALGORITHM(Agc, \"Agc\")\ndiff --git a/src/ipa/rkisp1/algorithms/agc.h b/src/ipa/rkisp1/algorithms/agc.h\nindex a228d0c37768..8a22263741b6 100644\n--- a/src/ipa/rkisp1/algorithms/agc.h\n+++ b/src/ipa/rkisp1/algorithms/agc.h\n@@ -44,6 +44,8 @@ private:\n \tutils::Duration filterExposure(utils::Duration exposureValue);\n \tdouble estimateLuminance(const rkisp1_cif_isp_ae_stat *ae, double gain);\n \tdouble measureBrightness(const rkisp1_cif_isp_hist_stat *hist) const;\n+\tvoid fillMetadata(IPAContext &context, IPAFrameContext &frameContext,\n+\t\t\t ControlList &metadata);\n \n \tuint64_t frameCount_;\n \n", "prefixes": [ "libcamera-devel", "v4", "5/9" ] }