Patch Detail
Show a patch.
GET /api/patches/18484/?format=api
{ "id": 18484, "url": "https://patchwork.libcamera.org/api/patches/18484/?format=api", "web_url": "https://patchwork.libcamera.org/patch/18484/", "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": "<20230328085521.7409-3-david.plowman@raspberrypi.com>", "date": "2023-03-28T08:55:21", "name": "[libcamera-devel,v3,2/2] ipa: raspberrypi: Handle AEC/AGC flicker controls", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "98a5452fc9da8a299aa6e42f1bf339682aa7260d", "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/18484/mbox/", "series": [ { "id": 3822, "url": "https://patchwork.libcamera.org/api/series/3822/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3822", "date": "2023-03-28T08:55:19", "name": "Add flicker avoidance controls", "version": 3, "mbox": "https://patchwork.libcamera.org/series/3822/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/18484/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/18484/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 56FE8C326C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 28 Mar 2023 08:55:33 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 774F762742;\n\tTue, 28 Mar 2023 10:55:32 +0200 (CEST)", "from mail-il1-x134.google.com (mail-il1-x134.google.com\n\t[IPv6:2607:f8b0:4864:20::134])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 079C862742\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 28 Mar 2023 10:55:28 +0200 (CEST)", "by mail-il1-x134.google.com with SMTP id h7so6023401ila.5\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 28 Mar 2023 01:55:27 -0700 (PDT)", "from pi4-davidp.pitowers.org\n\t([2a00:1098:3142:14:2bce:64d6:1a5c:49a2])\n\tby smtp.gmail.com with ESMTPSA id\n\tg1-20020a028501000000b0040380d7c768sm9887414jai.106.2023.03.28.01.55.25\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tTue, 28 Mar 2023 01:55:26 -0700 (PDT)" ], "DKIM-Signature": [ "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1679993732;\n\tbh=2r/yf1zzoBFA6VOfia/avCOBqkRGNngouNN9mTUgU0Y=;\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=Lyf5FRp2qI9J8D0Epp00t9xiOFKeIWQmqFtdcSPaZJ417+/tkmFKX6fSZWTLQu9Ai\n\tGrmCy4EmQG6xQ+5r+9eLfUZT15oLowJRSm4YS0bqRmgHRqZwUIS8bAblNHD3F84wVD\n\tIuh8xVouZ9DXvSIX0GrEDRTqQhml9RhwxyQkM1yprXm1eqRC6HqB7BwnhhJXecN072\n\tgZ5cEQMiKMtTKFKah7FsfdHmVtqsilIvfcYB3SYl2qNZGC7ywRRnACSX5DgLGoW5kW\n\tIqyRSTBIH7N4xbfA29lx3e636CrzBzXNvVL3I/f1nROPjLQA7Zj5EMDA0P2DA3CrYN\n\t3DUHAtSnDt/0g==", "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google; t=1679993726;\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=MqMbt9OzNQyhbcVo1jTzGTjETY6G4gi1d15/I+rRNFs=;\n\tb=Bo29vH9s5f6NRxUT61OKKFPMx3zj+U4QQIGzKUWp7xkdn9ScmSLEt5O1pKMK/8KFXE\n\tLzGrscYXf3CB8VA8bQbnnJkNl0RonSnGOaeGl9EEBat31oquVS5ZeYZFQfNge4y4KQG6\n\tXO+IoRzbi52XVADG/WXwk2TFCW/9kWi8XanuSEW6FWkLS+7J6oKAZmM87/2LC+G7w5/E\n\tFdfH6FsCQ6h56mOsjNyRnRxGsb3THPHbMqmcQqu6vwfyYccjfH2XpJ9otNH2Fo40gSHR\n\tAZfd3vuRzLAJGjLJaxtzqCkpatUNh9w/54NXEhcLCU7/wGOFubYsqEDD1Zc5cFbO+RnQ\n\tUolQ==" ], "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=raspberrypi.com\n\theader.i=@raspberrypi.com\n\theader.b=\"Bo29vH9s\"; dkim-atps=neutral", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112; t=1679993726;\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=MqMbt9OzNQyhbcVo1jTzGTjETY6G4gi1d15/I+rRNFs=;\n\tb=GUKIPNzV648E45LtsQYK7G6c39XYg9XMCwvUl2AaglP21pPFIu10KrsrU4b2pPS3ld\n\tmSrwRqHVCyNMsmH/8si87kzmadqQAlXvLHIRS0UPFwwj2yIuWUNJ+4gf2E70YQnqfD9a\n\tseOWD2gnC0ITBlueVpUkCRcEXfFMCl0NgAg9gbOHaiOO92C+uaA9ERj+o1MaF0NqTPzj\n\tbMyMchU3mS0fvLVQd2PV/Yesghj3Ggs36Ai+h6vMzV29cYkSBs9G8zGH48xTkF+2yxK3\n\tEqXNlXeRA7cXiaLm/IDI/DEYBn97hiPpIiGNybC26cbMglQxythjnSuSVD9GRzfUr6sp\n\t+8sg==", "X-Gm-Message-State": "AAQBX9esj9P13KgOHDEbORe4BMKLpA9l1N+cesNDcB+Lufu2z3YtaX33\n\t5YLEm4GGReqy9Gjufvor5M3kWv6sl0vaFx/BRIUXkA==", "X-Google-Smtp-Source": "AKy350aD/J5HvZKcCZHrWpkeQ7PJicJH7FNA87eA84/JSh1sxmk1pjK6uNjJzpI3PYzYm9NTC/RdMw==", "X-Received": "by 2002:a05:6e02:4cb:b0:323:f57c:806d with SMTP id\n\tf11-20020a056e0204cb00b00323f57c806dmr6602296ils.3.1679993726642; \n\tTue, 28 Mar 2023 01:55:26 -0700 (PDT)", "To": "libcamera-devel@lists.libcamera.org", "Date": "Tue, 28 Mar 2023 09:55:21 +0100", "Message-Id": "<20230328085521.7409-3-david.plowman@raspberrypi.com>", "X-Mailer": "git-send-email 2.30.2", "In-Reply-To": "<20230328085521.7409-1-david.plowman@raspberrypi.com>", "References": "<20230328085521.7409-1-david.plowman@raspberrypi.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH v3 2/2] ipa: raspberrypi: Handle AEC/AGC\n\tflicker controls", "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": "We handle the flicker modes by passing the correct period to the\nAEC/AGC algorithm which already contains the necessary code.\n\nThe \"Auto\" mode, as well as reporting the detected flicker period via\nthe \"AeFlickerDetected\" metadata, are unsupported for now.\n\nSigned-off-by: David Plowman <david.plowman@raspberrypi.com>\n---\n src/ipa/raspberrypi/raspberrypi.cpp | 80 +++++++++++++++++++++++++++++\n 1 file changed, 80 insertions(+)", "diff": "diff --git a/src/ipa/raspberrypi/raspberrypi.cpp b/src/ipa/raspberrypi/raspberrypi.cpp\nindex 13757955..d485b851 100644\n--- a/src/ipa/raspberrypi/raspberrypi.cpp\n+++ b/src/ipa/raspberrypi/raspberrypi.cpp\n@@ -91,6 +91,8 @@ static const ControlInfoMap::Map ipaControls{\n \t{ &controls::AeConstraintMode, ControlInfo(controls::AeConstraintModeValues) },\n \t{ &controls::AeExposureMode, ControlInfo(controls::AeExposureModeValues) },\n \t{ &controls::ExposureValue, ControlInfo(-8.0f, 8.0f, 0.0f) },\n+\t{ &controls::AeFlickerMode, ControlInfo(controls::AeFlickerModeValues) },\n+\t{ &controls::AeFlickerCustom, ControlInfo(100, 1000000) },\n \t{ &controls::AwbEnable, ControlInfo(false, true) },\n \t{ &controls::ColourGains, ControlInfo(0.0f, 32.0f) },\n \t{ &controls::AwbMode, ControlInfo(controls::AwbModeValues) },\n@@ -230,6 +232,12 @@ private:\n \t/* Track the frame length times over FrameLengthsQueueSize frames. */\n \tstd::deque<Duration> frameLengths_;\n \tDuration lastTimeout_;\n+\n+\t/* The current state of flicker avoidance. */\n+\tstruct FlickerState {\n+\t\tint32_t mode;\n+\t\tDuration customPeriod;\n+\t} flickerState_;\n };\n \n int IPARPi::init(const IPASettings &settings, bool lensPresent, IPAInitResult *result)\n@@ -962,6 +970,78 @@ void IPARPi::queueRequest(const ControlList &controls)\n \t\t\tbreak;\n \t\t}\n \n+\t\tcase controls::AE_FLICKER_MODE: {\n+\t\t\tRPiController::AgcAlgorithm *agc = dynamic_cast<RPiController::AgcAlgorithm *>(\n+\t\t\t\tcontroller_.getAlgorithm(\"agc\"));\n+\t\t\tif (!agc) {\n+\t\t\t\tLOG(IPARPI, Warning)\n+\t\t\t\t\t<< \"Could not set AeFlickerMode - no AGC algorithm\";\n+\t\t\t\tbreak;\n+\t\t\t}\n+\n+\t\t\tint32_t mode = ctrl.second.get<int32_t>();\n+\t\t\tbool modeValid = true;\n+\n+\t\t\tswitch (mode) {\n+\t\t\tcase controls::FlickerOff: {\n+\t\t\t\tagc->setFlickerPeriod(0us);\n+\n+\t\t\t\tbreak;\n+\t\t\t}\n+\n+\t\t\tcase controls::FlickerFreq50Hz: {\n+\t\t\t\tagc->setFlickerPeriod(10000 * 1.0us);\n+\n+\t\t\t\tbreak;\n+\t\t\t}\n+\n+\t\t\tcase controls::FlickerFreq60Hz: {\n+\t\t\t\tagc->setFlickerPeriod(8333.333 * 1.0us);\n+\n+\t\t\t\tbreak;\n+\t\t\t}\n+\n+\t\t\tcase controls::FlickerCustom: {\n+\t\t\t\tagc->setFlickerPeriod(flickerState_.customPeriod);\n+\n+\t\t\t\tbreak;\n+\t\t\t}\n+\n+\t\t\tdefault:\n+\t\t\t\tLOG(IPARPI, Error) << \"Flicker mode \" << mode << \" is not supported\";\n+\t\t\t\tmodeValid = false;\n+\n+\t\t\t\tbreak;\n+\t\t\t}\n+\n+\t\t\tif (modeValid)\n+\t\t\t\tflickerState_.mode = mode;\n+\n+\t\t\tbreak;\n+\t\t}\n+\n+\t\tcase controls::AE_FLICKER_CUSTOM: {\n+\t\t\tRPiController::AgcAlgorithm *agc = dynamic_cast<RPiController::AgcAlgorithm *>(\n+\t\t\t\tcontroller_.getAlgorithm(\"agc\"));\n+\t\t\tif (!agc) {\n+\t\t\t\tLOG(IPARPI, Warning)\n+\t\t\t\t\t<< \"Could not set AeFlickerCustom - no AGC algorithm\";\n+\t\t\t\tbreak;\n+\t\t\t}\n+\n+\t\t\tuint32_t customPeriod = ctrl.second.get<int32_t>();\n+\t\t\tflickerState_.customPeriod = customPeriod * 1.0us;\n+\n+\t\t\t/*\n+\t\t\t * We note that it makes no difference if the mode gets set to \"custom\"\n+\t\t\t * first, and the period updated after, or vice versa.\n+\t\t\t */\n+\t\t\tif (flickerState_.mode == controls::FlickerCustom)\n+\t\t\t\tagc->setFlickerPeriod(flickerState_.customPeriod);\n+\n+\t\t\tbreak;\n+\t\t}\n+\n \t\tcase controls::AWB_ENABLE: {\n \t\t\tRPiController::AwbAlgorithm *awb = dynamic_cast<RPiController::AwbAlgorithm *>(\n \t\t\t\tcontroller_.getAlgorithm(\"awb\"));\n", "prefixes": [ "libcamera-devel", "v3", "2/2" ] }