{"id":18853,"url":"https://patchwork.libcamera.org/api/1.1/patches/18853/?format=json","web_url":"https://patchwork.libcamera.org/patch/18853/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/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":"<20230718144301.3612-2-david.plowman@raspberrypi.com>","date":"2023-07-18T14:43:00","name":"[libcamera-devel,v5,1/2] libcamera: controls: Add controls for AEC/AGC flicker avoidance","commit_ref":"6fdbf3f38c3148f1ba780286715d9a78ffe1e387","pull_url":null,"state":"accepted","archived":false,"hash":"95d28a05da528801e717f9ee7ad374428cf677d0","submitter":{"id":42,"url":"https://patchwork.libcamera.org/api/1.1/people/42/?format=json","name":"David Plowman","email":"david.plowman@raspberrypi.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/18853/mbox/","series":[{"id":3977,"url":"https://patchwork.libcamera.org/api/1.1/series/3977/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=3977","date":"2023-07-18T14:42:59","name":"Add flicker avoidance controls","version":5,"mbox":"https://patchwork.libcamera.org/series/3977/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/18853/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/18853/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 E18BCC324D\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 18 Jul 2023 14:43:08 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 546E8628C2;\n\tTue, 18 Jul 2023 16:43:08 +0200 (CEST)","from mail-wm1-x332.google.com (mail-wm1-x332.google.com\n\t[IPv6:2a00:1450:4864:20::332])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 4922961E2B\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 18 Jul 2023 16:43:06 +0200 (CEST)","by mail-wm1-x332.google.com with SMTP id\n\t5b1f17b1804b1-3fbf1b82de7so37130105e9.1\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 18 Jul 2023 07:43:06 -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\t12-20020a05600c230c00b003f90b9b2c31sm10469686wmo.28.2023.07.18.07.43.04\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tTue, 18 Jul 2023 07:43:05 -0700 (PDT)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1689691388;\n\tbh=odvmMP1mfbDW4IpPqhAZBKs1y1ZjTvXNU7NEBQ+IzuE=;\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=1KIqlWUlbDfdLyO6lYhxIPwc4lp6azcyra92Mnnh9KOTCAfG1OkJxX2HvSBpOgBZT\n\tNpGAJHLdIiz1MZC/JpKpLZmbtEh83DFLQdRcY4V7sLI6xX8pHa4K4Qrhf837hUWNST\n\txdamPrSUKA5/7Iy7+fmCZs2jtPLiJIJNJchGB5flMwelEXfax+PS+wndv5mRy9STG1\n\tAPL5Tay9MxkFdQ0PSCyiIZsEzAl4Ji8HmmuPVXjcKh8RTHU2QljukpXnH46oZPMdJL\n\tk6axyfHKiEctlZAfGKdZVcnFY4Oznle/L639ydI9/4ViQ9dJm8ha8hfF0BRmYaM/P7\n\t0gaOWWDOxl2Uw==","v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google; t=1689691386; x=1692283386;\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=+lbhbtS+PWJC1jWNapWf2Uo+tHj0pyzFh1gsmDnPZcE=;\n\tb=D1Kn0pH61oHm4F3obNbUHfot8CVuN/ktRfNLMwWiUaMmBAYiZyTOlT/fGYkGLRia1Z\n\tIpoHzl+aMNz+yf8JzeVOsTXfXqNOlZRNovTMVqI8h4nqPhJVvx40FFhCD47IkMygc59J\n\t9OUeBXZ5r++Ck3WHkaDKN+YbbHlG4CmDf6at3AuTTzU6wPVirepJocwM2L5iOykM9Xk2\n\t1fc4OMAtTCc3OJsHMRi3Kl4tQ3sL4Ow7gpxlqaY59Sr5a7GfaqXwABRm91lDxxaPUngh\n\tWdJI+sqMBPWaDZh5Lg/VmYwRRE1kWJ+yhtW5/iH3tFpVHasqK/d5qglrVzAvwuVwgk5T\n\tdYGg=="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=raspberrypi.com\n\theader.i=@raspberrypi.com\n\theader.b=\"D1Kn0pH6\"; dkim-atps=neutral","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20221208; t=1689691386; x=1692283386;\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=+lbhbtS+PWJC1jWNapWf2Uo+tHj0pyzFh1gsmDnPZcE=;\n\tb=A5r7pV9M7sGDCE7lV15sZR3NJZ0iROB2jFkdsUkARWoQxpCaBtNK3Rqt7iatVxW5r9\n\tg2guFGBnj8As8cQ1qSUTkiIPPC468JO0Qzi75YiFfEQWYXDb0tcMeh22En/45LEO1g83\n\tJjXgCDwFoTiTAfXzMFEu96GFqUp9rnq1y8/YNyQB3zPH/22DXm1lYcqmDLuhepnroHo0\n\tJwfIUyl1et4fI6TmBgHPe4KgJeb/O+WxXO5AVO7H2xEU4uinQpnEaeGAIUGU/mfZNptM\n\t6ch+HJu87/QLecRmTWPAnt2DKnEWly78/6lwR2O+KA3E3Nrsd918KlGleDbXyN+E0SBe\n\twhAQ==","X-Gm-Message-State":"ABy/qLZu3E29hqbejmx75HI0hJgmmuO4y3UlVt29EKw3t0k+QgShwzYT\n\thk284MhrJjdkego6H1WPUi6ZPOzlmS06YFUv2Eo=","X-Google-Smtp-Source":"APBJJlGcnbflMaL+r8GcnQyMHcSZ7kYa+HwkS/aF0fZ9P52QQfaFY9g+D9g5Kg6GhN1prH2DwegcFQ==","X-Received":"by 2002:a05:600c:3c9e:b0:3fa:ef97:1fa5 with SMTP id\n\tbg30-20020a05600c3c9e00b003faef971fa5mr2335549wmb.6.1689691385591; \n\tTue, 18 Jul 2023 07:43:05 -0700 (PDT)","To":"libcamera-devel@lists.libcamera.org","Date":"Tue, 18 Jul 2023 15:43:00 +0100","Message-Id":"<20230718144301.3612-2-david.plowman@raspberrypi.com>","X-Mailer":"git-send-email 2.30.2","In-Reply-To":"<20230718144301.3612-1-david.plowman@raspberrypi.com>","References":"<20230718144301.3612-1-david.plowman@raspberrypi.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"[libcamera-devel] [PATCH v5 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\nAeFlickerPeriod to set the flicker period \"manually\".\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 | 90 +++++++++++++++++++++++++++-------\n 1 file changed, 73 insertions(+), 17 deletions(-)","diff":"diff --git a/src/libcamera/control_ids.yaml b/src/libcamera/control_ids.yaml\nindex 056886e6..f2e542f4 100644\n--- a/src/libcamera/control_ids.yaml\n+++ b/src/libcamera/control_ids.yaml\n@@ -156,6 +156,79 @@ 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: FlickerManual\n+          value: 1\n+          description: Manual flicker avoidance.\n+            Suppress flicker effects caused by lighting running with a period\n+            specified by the AeFlickerPeriod control.\n+            \\sa AeFlickerPeriod\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+            \\sa AeFlickerDetected\n+\n+  - AeFlickerPeriod:\n+      type: int32_t\n+      description: Manual flicker period in microseconds.\n+        This value sets the current flicker period to avoid. It is used when\n+        AeFlickerMode is set to FlickerManual.\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+        Setting the mode to FlickerManual when no AeFlickerPeriod has ever been\n+        set means that no flicker cancellation occurs (until the value of this\n+        control is updated).\n+\n+        Switching to modes other than FlickerManual has no effect on the\n+        value of the AeFlickerPeriod control.\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+        When AeFlickerMode is set to FlickerAuto, there may be a period during\n+        which the value reported here remains zero. Once a non-zero value is\n+        reported, then this is the flicker period that has been detected and is\n+        now being cancelled.\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 whether the system can continue to detect\n+        flicker of different periods when another frequency is already being\n+        cancelled.\n+\n+        \\sa AeFlickerMode\n+\n   - Brightness:\n       type: float\n       description: |\n@@ -850,23 +923,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","v5","1/2"]}