{"id":18820,"url":"https://patchwork.libcamera.org/api/patches/18820/?format=json","web_url":"https://patchwork.libcamera.org/patch/18820/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20230713151218.26045-2-david.plowman@raspberrypi.com>","date":"2023-07-13T15:12:17","name":"[libcamera-devel,v4,1/2] libcamera: controls: Add controls for AEC/AGC flicker avoidance","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"7114f955d21a59f764c83754dc56e354f74861ba","submitter":{"id":42,"url":"https://patchwork.libcamera.org/api/people/42/?format=json","name":"David Plowman","email":"david.plowman@raspberrypi.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/18820/mbox/","series":[{"id":3970,"url":"https://patchwork.libcamera.org/api/series/3970/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=3970","date":"2023-07-13T15:12:16","name":"Add flicker avoidance controls","version":4,"mbox":"https://patchwork.libcamera.org/series/3970/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/18820/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/18820/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 8C9C9C3243\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 13 Jul 2023 15:12:25 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 11327628C6;\n\tThu, 13 Jul 2023 17:12:24 +0200 (CEST)","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 33E9E628BC\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 13 Jul 2023 17:12:22 +0200 (CEST)","by mail-wm1-x334.google.com with SMTP id\n\t5b1f17b1804b1-3fbc6ab5ff5so7690615e9.1\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 13 Jul 2023 08:12:22 -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\tf11-20020a7bc8cb000000b003fa98908014sm18771086wml.8.2023.07.13.08.12.20\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tThu, 13 Jul 2023 08:12:21 -0700 (PDT)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1689261144;\n\tbh=V/gSmuMH38IPCacjZgb56tS70tY0C7M2x0mnRwta7xQ=;\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=O+J5UiDr0p2/beJHScs+1LjQBSYCHZuDliqN7xvxAF5cea+hvANP5/W2As8VKu8QB\n\tk33hbn5U4IQ+s/i+Rw7OriJaYtxE9gvOzIjQsWBmg35jJXzJi01ibaL32A5T+BKQP3\n\tZQOaQ0oU8GgS4y3yZtfSvN956n9oZ/6zODhNTcGm8wwf9zIozo5s9mQJtC7MChEeUf\n\tKgWtu/ls+M02UU7ySVj4oebtYq26HImDTM5xvqFb1w1z3baCsu8VZtABXyesx3z6R3\n\tkpxaGOHhGNX39IWvMKPrR2vSW6TythsW9RUSkpU8AQjKPR9z2aZ9zLo40BKsEG3U/I\n\thLVrBpwo+OawA==","v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google; t=1689261141; x=1691853141;\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=KwGuxCULk77E/Yw9MPkmolm5Nod6d9LR09UZXbDa/Kg=;\n\tb=tBhAzCmZn2AqQuL6GjLlq+HQguo7N/EFbadRUIA7od9VGqROC7WndsBu7oVy4EYLvy\n\t2u2xfNDC2wLkyuWg9eflmet6Cb/Jmugtzp7xwBqMgKy1prcPtxdd0jd5yz1qLOMXwqXd\n\tY6rxZBbJ7myUR6cH0uHqV3PTl9GuetSv5DIfdr5zBtRt1hdpvwKTlGY66g6S98lMiF9d\n\tejndtKDdMeojokEatwgIv/7NJmGBVV/4tZhGUIEz1IyMmdHmYbYuDhSi5lmG0BO/g5tK\n\to/JPD6xjzn9X9gHmwAe0LK9ka+c+vkHouSeVX15KzSwQybofAcItgSd3wbHbSDua3wmO\n\toX1Q=="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=raspberrypi.com\n\theader.i=@raspberrypi.com\n\theader.b=\"tBhAzCmZ\"; dkim-atps=neutral","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20221208; t=1689261141; x=1691853141;\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=KwGuxCULk77E/Yw9MPkmolm5Nod6d9LR09UZXbDa/Kg=;\n\tb=UD7qns77S/NfQsooGqm/qCrCKJRxYlVbOQigH4HxAJ1gVVYsy8rRJxD9tR3QI6FCFh\n\tbQc55oqxfXoSKrRWuQOdgGckmUfeHocrRpAa4dlrYVeFfAgfo9MJ1QZX3Rnna5QSKPm9\n\tbLjTqfsUdWv7fGmoKEO/xWi0IzWTwYWoyONzezsAdYbidJmpSEHWs8KqGIzl9KMBTgTc\n\tagvOkOfEX30+Mh7ye0zqkQSIpIzoyHprQnQllJDe8BznzPmPAmOe2jLQ9P6eRzXf6oAW\n\t+aVJXw0U4HgUbW/FovSK3yPThRhxC8+/I1ZJ/b+yafASCfhfySwoFOFOi0dyyY03FjIM\n\tqSgw==","X-Gm-Message-State":"ABy/qLbKsUqirBP+s0+f6lSb8uSmPBHq1GwDl5nhTUuaK+BuISIFK5Sw\n\tv3kx1vYLN4PzFdRTVsn5TorYwDO2FS8aAgSohWk=","X-Google-Smtp-Source":"APBJJlGI/4HzBUTHoLAAM8Gty2D3msCDJdhQK9pDwlocLuj34R0ej8O0pfWVKQOq73PuFWNSrh3K4Q==","X-Received":"by 2002:a7b:ca4a:0:b0:3fc:240:cecc with SMTP id\n\tm10-20020a7bca4a000000b003fc0240ceccmr1716316wml.11.1689261141441; \n\tThu, 13 Jul 2023 08:12:21 -0700 (PDT)","To":"libcamera-devel@lists.libcamera.org","Date":"Thu, 13 Jul 2023 16:12:17 +0100","Message-Id":"<20230713151218.26045-2-david.plowman@raspberrypi.com>","X-Mailer":"git-send-email 2.30.2","In-Reply-To":"<20230713151218.26045-1-david.plowman@raspberrypi.com>","References":"<20230713151218.26045-1-david.plowman@raspberrypi.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v4 1/2] libcamera: controls: Add controls\n\tfor AEC/AGC flicker avoidance","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":"Flicker is the term used to describe brightness banding or oscillation\nof images caused typically by artificial lighting driven by a 50 or\n60Hz mains supply. We add three controls intended to be used by\nAEC/AGC algorithms:\n\nAeFlickerMode to enable flicker avoidance.\n\nAeFlickerCustom to set custom flicker periods.\n\nAeFlickerDetected to report any flicker that is currently detected.\n\nSigned-off-by: David Plowman <david.plowman@raspberrypi.com>\n---\n src/libcamera/control_ids.yaml | 79 ++++++++++++++++++++++++++--------\n 1 file changed, 62 insertions(+), 17 deletions(-)","diff":"diff --git a/src/libcamera/control_ids.yaml b/src/libcamera/control_ids.yaml\nindex 056886e6..f1629b89 100644\n--- a/src/libcamera/control_ids.yaml\n+++ b/src/libcamera/control_ids.yaml\n@@ -156,6 +156,68 @@ controls:\n         control of which features should be automatically adjusted shouldn't\n         better be handled through a separate AE mode control.\n \n+  - AeFlickerMode:\n+      type: int32_t\n+      description: |\n+        Set the flicker mode, which determines whether, and how, the AGC/AEC\n+        algorithm attempts to hide flicker effects caused by the duty cycle of\n+        artificial lighting.\n+\n+        Although implementation dependent, many algorithms for \"flicker\n+        avoidance\" work by restricting this exposure time to integer multiples\n+        of the cycle period, wherever possible.\n+\n+        Implementations may not support all of the flicker modes listed below.\n+\n+        By default the system will start in FlickerAuto mode if this is\n+        supported, otherwise the flicker mode will be set to FlickerOff.\n+\n+      enum:\n+        - name: FlickerOff\n+          value: 0\n+          description: No flicker avoidance is performed.\n+        - name: FlickerCustom\n+          value: 1\n+          description: Custom flicker avoidance.\n+            Suppress flicker effects caused by lighting running with a period\n+            specified by the AeFlickerCustom control.\n+            \\sa AeFlickerCustom\n+        - name: FlickerAuto\n+          value: 2\n+          description: Automatic flicker period detection and avoidance.\n+            The system will automatically determine the most likely value of\n+            flicker period, and avoid flicker of this frequency. Once flicker\n+            is being corrected, it is implementation dependent whether the\n+            system is still able to detect a change in the flicker period.\n+\n+  - AeFlickerCustom:\n+      type: int32_t\n+      description: Custom flicker period in microseconds.\n+        This value sets the current flicker period to avoid. It is used when\n+        AeFlickerMode is set to FlickerCustom.\n+\n+        To cancel 50Hz mains flicker, this should be set to 10000 (corresponding\n+        to 100Hz), or 8333 (120Hz) for 60Hz mains.\n+\n+        If this control is not available, then the setting of custom flicker\n+        periods is not supported.\n+\n+        \\sa AeFlickerMode\n+\n+  - AeFlickerDetected:\n+      type: int32_t\n+      description: Flicker period detected in microseconds.\n+        The value reported here indicates the currently detected flicker\n+        period, or zero if no flicker at all is detected.\n+\n+        In the case of 50Hz mains flicker, the value would be 10000\n+        (corresponding to 100Hz), or 8333 (120Hz) for 60Hz mains flicker.\n+\n+        It is implementation dependent exactly when the system is able\n+        to detect and report the flicker period.\n+\n+        \\sa AeFlickerMode\n+\n   - Brightness:\n       type: float\n       description: |\n@@ -850,23 +912,6 @@ controls:\n           value: 1\n           description: The lens shading map mode is available.\n \n-  - SceneFlicker:\n-      type: int32_t\n-      draft: true\n-      description: |\n-       Control to report the detected scene light frequency. Currently\n-       identical to ANDROID_STATISTICS_SCENE_FLICKER.\n-      enum:\n-        - name: SceneFickerOff\n-          value: 0\n-          description: No flickering detected.\n-        - name: SceneFicker50Hz\n-          value: 1\n-          description: 50Hz flickering detected.\n-        - name: SceneFicker60Hz\n-          value: 2\n-          description: 60Hz flickering detected.\n-\n   - PipelineDepth:\n       type: int32_t\n       draft: true\n","prefixes":["libcamera-devel","v4","1/2"]}